@cuadra-ai/uikit 0.1.24 → 0.1.26

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.
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- var Ir = Object.defineProperty;
2
- var Sr = (e, r, t) => r in e ? Ir(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var ae = (e, r, t) => Sr(e, typeof r != "symbol" ? r + "" : r, t);
1
+ var Sr = Object.defineProperty;
2
+ var Lr = (e, r, t) => r in e ? Sr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var ae = (e, r, t) => Lr(e, typeof r != "symbol" ? r + "" : r, t);
4
4
  import { jsx as d, jsxs as w, Fragment as J } from "react/jsx-runtime";
5
- import yt, { forwardRef as we, createElement as Ge, useMemo as q, useState as P, useEffect as $, useCallback as H, memo as Lr, useImperativeHandle as tt, useSyncExternalStore as Pr, useRef as de, createContext as Rr } from "react";
6
- import { createPortal as Ze } from "react-dom";
7
- import { useThreadListItem as Et, RuntimeAdapterProvider as _r, useLocalRuntime as Ft, AssistantRuntimeProvider as zt, unstable_useRemoteThreadListRuntime as Dr, useThreadRuntime as Er, useAssistantApi as Fr, ThreadPrimitive as Ne, ComposerPrimitive as ge, useAssistantState as jt, AttachmentPrimitive as zr, MessagePrimitive as be, ThreadListPrimitive as Be, useThread as jr, ThreadListItemPrimitive as We } from "@assistant-ui/react";
8
- import { unstable_memoizeMarkdownComponents as $r, useIsMarkdownCodeBlock as Or, MarkdownTextPrimitive as Ur } from "@assistant-ui/react-markdown";
9
- let ye = !1, xt = !1;
10
- function kt() {
11
- if (xt || (xt = !0, typeof document > "u" || typeof window > "u"))
5
+ import kt, { forwardRef as ve, createElement as Je, useMemo as V, useState as R, useEffect as O, useCallback as X, memo as Pr, useImperativeHandle as at, useSyncExternalStore as Rr, useRef as de, createContext as Dr } from "react";
6
+ import { createPortal as Ye } from "react-dom";
7
+ import { useThreadListItem as zt, RuntimeAdapterProvider as _r, useLocalRuntime as jt, AssistantRuntimeProvider as $t, unstable_useRemoteThreadListRuntime as Er, useThreadRuntime as Fr, useAssistantApi as zr, ThreadPrimitive as Se, ComposerPrimitive as ge, useAssistantState as xe, AttachmentPrimitive as jr, MessagePrimitive as be, ThreadListPrimitive as He, useThread as $r, ThreadListItemPrimitive as qe } from "@assistant-ui/react";
8
+ import { unstable_memoizeMarkdownComponents as Or, useIsMarkdownCodeBlock as Ur, MarkdownTextPrimitive as Br } from "@assistant-ui/react-markdown";
9
+ let ye = !1, wt = !1;
10
+ function vt() {
11
+ if (wt || (wt = !0, typeof document > "u" || typeof window > "u"))
12
12
  return;
13
13
  const e = document.querySelector("link[data-cuadra-uikit-styles]"), r = document.querySelector("style[data-cuadra-uikit-styles]");
14
14
  if (e || r) {
@@ -25,9 +25,9 @@ function kt() {
25
25
  }
26
26
  } catch {
27
27
  }
28
- Br();
28
+ Wr();
29
29
  }
30
- function Br() {
30
+ function Wr() {
31
31
  if (ye)
32
32
  return;
33
33
  const e = document.createElement("link");
@@ -54,19 +54,19 @@ function Br() {
54
54
  a();
55
55
  }, document.head.appendChild(e);
56
56
  }
57
- typeof document < "u" && typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", kt) : kt());
58
- const Wr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), qr = (e) => e.replace(
57
+ typeof document < "u" && typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", vt) : vt());
58
+ const Hr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), qr = (e) => e.replace(
59
59
  /^([A-Z])|[\s-_]+(\w)/g,
60
60
  (r, t, a) => a ? a.toUpperCase() : t.toLowerCase()
61
- ), wt = (e) => {
61
+ ), Ct = (e) => {
62
62
  const r = qr(e);
63
63
  return r.charAt(0).toUpperCase() + r.slice(1);
64
- }, $t = (...e) => e.filter((r, t, a) => !!r && r.trim() !== "" && a.indexOf(r) === t).join(" ").trim(), Hr = (e) => {
64
+ }, Ot = (...e) => e.filter((r, t, a) => !!r && r.trim() !== "" && a.indexOf(r) === t).join(" ").trim(), Vr = (e) => {
65
65
  for (const r in e)
66
66
  if (r.startsWith("aria-") || r === "role" || r === "title")
67
67
  return !0;
68
68
  };
69
- var Vr = {
69
+ var Xr = {
70
70
  xmlns: "http://www.w3.org/2000/svg",
71
71
  width: 24,
72
72
  height: 24,
@@ -77,7 +77,7 @@ var Vr = {
77
77
  strokeLinecap: "round",
78
78
  strokeLinejoin: "round"
79
79
  };
80
- const Xr = we(
80
+ const Kr = ve(
81
81
  ({
82
82
  color: e = "currentColor",
83
83
  size: r = 24,
@@ -87,70 +87,60 @@ const Xr = we(
87
87
  children: o,
88
88
  iconNode: n,
89
89
  ...u
90
- }, c) => Ge(
90
+ }, c) => Je(
91
91
  "svg",
92
92
  {
93
93
  ref: c,
94
- ...Vr,
94
+ ...Xr,
95
95
  width: r,
96
96
  height: r,
97
97
  stroke: e,
98
98
  strokeWidth: a ? Number(t) * 24 / Number(r) : t,
99
- className: $t("lucide", i),
100
- ...!o && !Hr(u) && { "aria-hidden": "true" },
99
+ className: Ot("lucide", i),
100
+ ...!o && !Vr(u) && { "aria-hidden": "true" },
101
101
  ...u
102
102
  },
103
103
  [
104
- ...n.map(([s, f]) => Ge(s, f)),
104
+ ...n.map(([s, f]) => Je(s, f)),
105
105
  ...Array.isArray(o) ? o : [o]
106
106
  ]
107
107
  )
108
108
  );
109
- const O = (e, r) => {
110
- const t = we(
111
- ({ className: a, ...i }, o) => Ge(Xr, {
109
+ const U = (e, r) => {
110
+ const t = ve(
111
+ ({ className: a, ...i }, o) => Je(Kr, {
112
112
  ref: o,
113
113
  iconNode: r,
114
- className: $t(
115
- `lucide-${Wr(wt(e))}`,
114
+ className: Ot(
115
+ `lucide-${Hr(Ct(e))}`,
116
116
  `lucide-${e}`,
117
117
  a
118
118
  ),
119
119
  ...i
120
120
  })
121
121
  );
122
- return t.displayName = wt(e), t;
122
+ return t.displayName = Ct(e), t;
123
123
  };
124
- const Kr = [
124
+ const Qr = [
125
125
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
126
126
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
127
- ], Qr = O("arrow-up", Kr);
128
- const Gr = [
129
- ["path", { d: "M12 18V5", key: "adv99a" }],
130
- ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
131
- ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
132
- ["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
133
- ["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
134
- ["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
135
- ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
136
- ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
137
- ], Zr = O("brain", Gr);
138
- const Jr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Yr = O("check", Jr);
139
- const ea = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], Je = O("chevron-down", ea);
140
- const ta = [
127
+ ], Gr = U("arrow-up", Qr);
128
+ const Zr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Jr = U("check", Zr);
129
+ const Yr = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], et = U("chevron-down", Yr);
130
+ const ea = [
141
131
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
142
132
  ["path", { d: "M12 18a6 6 0 0 0 0-12v12z", key: "j4l70d" }]
143
- ], ra = O("contrast", ta);
144
- const aa = [
133
+ ], ta = U("contrast", ea);
134
+ const ra = [
145
135
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
146
136
  ["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" }]
147
- ], na = O("copy", aa);
148
- const ia = [
137
+ ], aa = U("copy", ra);
138
+ const na = [
149
139
  ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
150
140
  ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
151
141
  ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
152
- ], oa = O("ellipsis-vertical", ia);
153
- const ca = [
142
+ ], ia = U("ellipsis-vertical", na);
143
+ const oa = [
154
144
  [
155
145
  "path",
156
146
  {
@@ -163,8 +153,8 @@ const ca = [
163
153
  ["path", { d: "M14 13h2", key: "un5t4a" }],
164
154
  ["path", { d: "M8 17h2", key: "2yhykz" }],
165
155
  ["path", { d: "M14 17h2", key: "10kma7" }]
166
- ], ua = O("file-spreadsheet", ca);
167
- const sa = [
156
+ ], ca = U("file-spreadsheet", oa);
157
+ const ua = [
168
158
  [
169
159
  "path",
170
160
  {
@@ -176,8 +166,8 @@ const sa = [
176
166
  ["path", { d: "M10 9H8", key: "b1mrlr" }],
177
167
  ["path", { d: "M16 13H8", key: "t4e002" }],
178
168
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
179
- ], Ot = O("file-text", sa);
180
- const la = [
169
+ ], Ut = U("file-text", ua);
170
+ const sa = [
181
171
  [
182
172
  "path",
183
173
  {
@@ -189,19 +179,19 @@ const la = [
189
179
  ["path", { d: "M11 18h2", key: "12mj7e" }],
190
180
  ["path", { d: "M12 12v6", key: "3ahymv" }],
191
181
  ["path", { d: "M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5", key: "qbrxap" }]
192
- ], da = O("file-type", la);
193
- const fa = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Ut = O("loader-circle", fa);
194
- const ha = [
182
+ ], la = U("file-type", sa);
183
+ const da = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Bt = U("loader-circle", da);
184
+ const fa = [
195
185
  ["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
196
186
  ["path", { d: "M21 12H9", key: "dn1m92" }],
197
187
  ["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
198
- ], ma = O("log-out", ha);
199
- const pa = [
188
+ ], ha = U("log-out", fa);
189
+ const ma = [
200
190
  ["path", { d: "M4 5h16", key: "1tepv9" }],
201
191
  ["path", { d: "M4 12h16", key: "1lakjw" }],
202
192
  ["path", { d: "M4 19h16", key: "1djgab" }]
203
- ], ga = O("menu", pa);
204
- const ba = [
193
+ ], pa = U("menu", ma);
194
+ const ga = [
205
195
  [
206
196
  "path",
207
197
  {
@@ -209,16 +199,16 @@ const ba = [
209
199
  key: "1miecu"
210
200
  }
211
201
  ]
212
- ], Bt = O("paperclip", ba);
213
- const ya = [
202
+ ], Wt = U("paperclip", ga);
203
+ const ba = [
214
204
  ["path", { d: "M5 12h14", key: "1ays0h" }],
215
205
  ["path", { d: "M12 5v14", key: "s699le" }]
216
- ], xa = O("plus", ya);
217
- const ka = [
206
+ ], ya = U("plus", ba);
207
+ const xa = [
218
208
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
219
209
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
220
- ], rt = O("x", ka);
221
- class Wt {
210
+ ], nt = U("x", xa);
211
+ class Ht {
222
212
  constructor(r, t, a = !1) {
223
213
  ae(this, "baseUrl");
224
214
  ae(this, "sessionToken", null);
@@ -245,6 +235,14 @@ class Wt {
245
235
  async createOrContinueChat(r, t) {
246
236
  const a = this.getUrl("/v1/chats"), o = {
247
237
  "Content-Type": "application/json",
238
+ Accept: "text/event-stream",
239
+ // Tell server we expect SSE streaming
240
+ "Accept-Encoding": "identity",
241
+ // Disable compression to prevent buffering
242
+ "Cache-Control": "no-cache",
243
+ // Prevent caching of streaming response
244
+ "X-Accel-Buffering": "no",
245
+ // Disable nginx buffering if behind reverse proxy
248
246
  "Idempotency-Key": this.generateIdempotencyKey()
249
247
  };
250
248
  this.sessionToken && (o.Authorization = `Bearer ${this.sessionToken}`);
@@ -255,7 +253,8 @@ class Wt {
255
253
  method: "POST",
256
254
  headers: o,
257
255
  body: JSON.stringify(n),
258
- signal: t
256
+ signal: t,
257
+ cache: "no-store"
259
258
  });
260
259
  if (!u.ok) {
261
260
  const c = await u.json().catch(() => ({}));
@@ -455,7 +454,7 @@ class Wt {
455
454
  return c.json();
456
455
  }
457
456
  }
458
- async function* wa(e, r) {
457
+ async function* ka(e, r) {
459
458
  const t = e.getReader(), a = new TextDecoder();
460
459
  let i = "";
461
460
  try {
@@ -488,7 +487,7 @@ async function* wa(e, r) {
488
487
  t.releaseLock();
489
488
  }
490
489
  }
491
- function va(e) {
490
+ function wa(e) {
492
491
  return e.map((r) => {
493
492
  let t = "";
494
493
  if (typeof r.content == "string")
@@ -504,7 +503,7 @@ function va(e) {
504
503
  };
505
504
  });
506
505
  }
507
- function Ca(e) {
506
+ function va(e) {
508
507
  return {
509
508
  id: e.id,
510
509
  role: e.role,
@@ -536,8 +535,8 @@ function Ca(e) {
536
535
  }
537
536
  };
538
537
  }
539
- const Pe = /* @__PURE__ */ new Map();
540
- function Ma(e, r) {
538
+ const De = /* @__PURE__ */ new Map();
539
+ function Ca(e, r) {
541
540
  return {
542
541
  async list() {
543
542
  const t = [];
@@ -558,7 +557,7 @@ function Ma(e, r) {
558
557
  }).filter((u) => u !== null) };
559
558
  },
560
559
  async initialize(t) {
561
- return { remoteId: Pe.get(t) || t, externalId: void 0 };
560
+ return { remoteId: De.get(t) || t, externalId: void 0 };
562
561
  },
563
562
  async rename(t, a) {
564
563
  await e.updateChat(t, { title: a });
@@ -594,17 +593,17 @@ function Ma(e, r) {
594
593
  },
595
594
  // Add a method to update the remoteId mapping when chat ID is received
596
595
  updateRemoteId(t, a) {
597
- Pe.set(t, a), r?.(t, a);
596
+ De.set(t, a), r?.(t, a);
598
597
  },
599
598
  // Provider component that adds thread-specific history adapter
600
599
  unstable_Provider: ({ children: t }) => {
601
- const i = Et()?.remoteId, o = yt.useMemo(
600
+ const i = zt()?.remoteId, o = kt.useMemo(
602
601
  () => ({
603
602
  async load() {
604
603
  if (!i) return { messages: [] };
605
604
  try {
606
605
  const u = await e.getChat(i);
607
- return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((s) => Ca(s)) };
606
+ return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((s) => va(s)) };
608
607
  } catch {
609
608
  return { messages: [] };
610
609
  }
@@ -613,7 +612,7 @@ function Ma(e, r) {
613
612
  }
614
613
  }),
615
614
  [i, e]
616
- ), n = yt.useMemo(() => ({ history: o }), [o]);
615
+ ), n = kt.useMemo(() => ({ history: o }), [o]);
617
616
  return /* @__PURE__ */ d(_r, { adapters: n, children: t });
618
617
  }
619
618
  };
@@ -678,109 +677,110 @@ class Ta {
678
677
  this.listeners.forEach((r) => r());
679
678
  }
680
679
  }
681
- const ie = new Ta(), vt = /* @__PURE__ */ new Map(), qt = [];
682
- let Ie = [];
683
- function Aa(e, r, t = 50, a = 800) {
680
+ const ie = new Ta(), Tt = /* @__PURE__ */ new Map(), qt = [];
681
+ let Le = [];
682
+ function Ma(e, r, t = 50, a = 800) {
684
683
  qt.push({ question: e, response: r, streamingSpeed: t, initialDelay: a });
685
684
  }
686
- function Ht(e, r) {
687
- const { modelId: t, systemPrompt: a, ephemeral: i, onChatCreated: o, onUserMessage: n, onThreadIdUpdate: u, onBeforeRequest: c } = r;
688
- let s;
685
+ function Vt(e, r) {
686
+ const { modelId: t, systemPrompt: a, ephemeral: i, enableReasoning: o, onChatCreated: n, onUserMessage: u, onThreadIdUpdate: c, onBeforeRequest: s } = r;
687
+ let f;
689
688
  return {
690
- async *run(f) {
691
- const { messages: l, abortSignal: p, context: y } = f, m = qt.shift();
692
- if (m) {
693
- n?.();
694
- const v = m.initialDelay ?? 800;
695
- if (v > 0 && await new Promise((D) => setTimeout(D, v)), p?.aborted)
689
+ async *run(l) {
690
+ const { messages: p, abortSignal: g, context: m } = l, x = qt.shift();
691
+ if (x) {
692
+ u?.();
693
+ const v = x.initialDelay ?? 800;
694
+ if (v > 0 && await new Promise((P) => setTimeout(P, v)), g?.aborted)
696
695
  throw new Error("Request aborted");
697
- const I = m.response.split(" ");
698
- let j = "";
699
- const R = m.streamingSpeed || 50, te = `premade-${Date.now()}`;
700
- i && o?.(te);
701
- for (let D = 0; D < I.length; D++) {
702
- if (p?.aborted)
696
+ const S = x.response.split(" ");
697
+ let $ = "";
698
+ const E = x.streamingSpeed || 50, ee = `premade-${Date.now()}`;
699
+ i && n?.(ee);
700
+ for (let P = 0; P < S.length; P++) {
701
+ if (g?.aborted)
703
702
  throw new Error("Request aborted");
704
- j += (D === 0 ? "" : " ") + I[D], yield {
705
- content: [{ type: "text", text: j }]
706
- }, await new Promise((re) => setTimeout(re, R + Math.random() * (R * 0.5)));
703
+ $ += (P === 0 ? "" : " ") + S[P], yield {
704
+ content: [{ type: "text", text: $ }]
705
+ }, await new Promise((re) => setTimeout(re, E + Math.random() * (E * 0.5)));
707
706
  }
708
707
  yield {
709
- content: [{ type: "text", text: j }]
710
- }, Ie.push(
711
- { role: "user", content: m.question },
712
- { role: "assistant", content: m.response }
708
+ content: [{ type: "text", text: $ }]
709
+ }, Le.push(
710
+ { role: "user", content: x.question },
711
+ { role: "assistant", content: x.response }
713
712
  );
714
713
  return;
715
714
  }
716
- const x = y?.threadId;
717
- let g = x;
718
- if (!g && l.length > 0) {
719
- const v = l.find((I) => I.role === "user");
720
- v && (g = (typeof v.content == "string" ? v.content : Array.isArray(v.content) && v.content.find((j) => j.type === "text")?.text || "").substring(0, 50));
715
+ const b = m?.threadId;
716
+ let y = b;
717
+ if (!y && p.length > 0) {
718
+ const v = p.find((S) => S.role === "user");
719
+ v && (y = (typeof v.content == "string" ? v.content : Array.isArray(v.content) && v.content.find(($) => $.type === "text")?.text || "").substring(0, 50));
721
720
  }
722
- let b;
723
- x && (b = Pe.get(x)), !b && g && (b = vt.get(g)), !b && s && (b = s), n?.();
724
- let k = l, M = -1;
725
- for (let v = l.length - 1; v >= 0; v--)
726
- if (l[v].role === "assistant") {
727
- M = v;
721
+ let k;
722
+ b && (k = De.get(b)), !k && y && (k = Tt.get(y)), !k && f && (k = f), u?.();
723
+ let T = p, L = -1;
724
+ for (let v = p.length - 1; v >= 0; v--)
725
+ if (p[v].role === "assistant") {
726
+ L = v;
728
727
  break;
729
728
  }
730
- (b || M >= 0) && M >= 0 && (k = l.slice(M + 1));
731
- const S = va(k);
732
- if (Ie.length > 0 && !b) {
733
- const v = Ie.map((I) => ({
734
- role: I.role,
735
- content: I.content
729
+ (k || L >= 0) && L >= 0 && (T = p.slice(L + 1));
730
+ const I = wa(T);
731
+ if (Le.length > 0 && !k) {
732
+ const v = Le.map((S) => ({
733
+ role: S.role,
734
+ content: S.content
736
735
  }));
737
- S.unshift(...v), Ie = [];
736
+ I.unshift(...v), Le = [];
738
737
  }
739
- const L = {
740
- messages: S,
741
- chatId: b || null,
738
+ const C = {
739
+ messages: I,
740
+ chatId: k || null,
742
741
  // Use server chatId if available
743
742
  systemPrompt: a,
744
743
  ephemeral: i,
744
+ enableReasoning: o,
745
745
  stream: !0
746
746
  };
747
- if (t && t.trim() !== "" && (L.modelId = t), c && !await c())
747
+ if (t && t.trim() !== "" && (C.modelId = t), s && !await s())
748
748
  throw new Error("Request blocked");
749
- const C = await e.createOrContinueChat(L, p);
750
- let A = "", N = "", _;
751
- const h = [];
752
- let U = 0, W = 0;
753
- const X = `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
754
- ie.clear(), ie.setCurrentMessage(X);
755
- const ee = () => {
756
- h.length !== W && (W = h.length, ie.update({
757
- sources: h.length > 0 ? [...h] : void 0
749
+ const D = await e.createOrContinueChat(C, g);
750
+ let A = "", N = "", h;
751
+ const _ = [];
752
+ let H = 0, W = !1;
753
+ const te = `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
754
+ ie.clear(), ie.setCurrentMessage(te);
755
+ const Te = () => {
756
+ _.length !== H && (H = _.length, ie.update({
757
+ sources: _.length > 0 ? [..._] : void 0
758
758
  }));
759
- }, K = () => {
760
- ee();
759
+ }, q = () => {
760
+ Te();
761
761
  const v = [];
762
762
  return N && v.push({ type: "reasoning", text: N }), A && v.push({ type: "text", text: A }), v.length === 0 && v.push({ type: "text", text: "" }), { content: v };
763
763
  };
764
- for await (const v of wa(C, p)) {
765
- if (p?.aborted)
764
+ for await (const v of ka(D, g)) {
765
+ if (g?.aborted)
766
766
  throw new Error("Request aborted");
767
- const I = v.id || v.chatId || v.messageId;
768
- I && !_ && (_ = I, s = I, o?.(I), x && u && (u(x, I), Pe.set(x, I)), g && vt.set(g, I));
769
- const j = v.sources;
770
- if (j && Array.isArray(j) && j.length > 0)
771
- for (const D of j)
772
- h.some((re) => re.sourceId === D.sourceId) || h.push({
773
- sourceId: D.sourceId,
774
- filename: D.filename || "Unknown",
775
- score: D.score ?? 1,
776
- chunkId: D.chunkId,
777
- datasetId: D.datasetId
767
+ const S = v.id || v.chatId || v.messageId;
768
+ S && !h && (h = S, f = S, n?.(S), b && c && (c(b, S), De.set(b, S)), y && Tt.set(y, S));
769
+ const $ = v.sources;
770
+ if ($ && Array.isArray($) && $.length > 0)
771
+ for (const P of $)
772
+ _.some((re) => re.sourceId === P.sourceId) || _.push({
773
+ sourceId: P.sourceId,
774
+ filename: P.filename || "Unknown",
775
+ score: P.score ?? 1,
776
+ chunkId: P.chunkId,
777
+ datasetId: P.datasetId
778
778
  });
779
- const R = v.reasoning;
780
- if (R && R.length > 0 && R.length > U && (N = R, U = R.length), v.type)
779
+ const E = v.reasoning;
780
+ if (E && E.length > 0 && (N += E, yield q()), v.type)
781
781
  switch (v.type) {
782
782
  case "source-document":
783
- v.sourceId && h.push({
783
+ v.sourceId && _.push({
784
784
  sourceId: v.sourceId,
785
785
  filename: v.title || "Unknown",
786
786
  score: 1
@@ -789,13 +789,13 @@ function Ht(e, r) {
789
789
  case "reasoning-start":
790
790
  continue;
791
791
  case "reasoning-delta":
792
- v.delta && (N += v.delta), (A || N) && (yield K());
792
+ v.delta && (N += v.delta), (A || N) && (yield q());
793
793
  continue;
794
794
  case "reasoning-end":
795
- (A || N) && (yield K());
795
+ (A || N) && (yield q());
796
796
  continue;
797
797
  case "text-delta":
798
- v.delta && (A += v.delta), A && (yield K());
798
+ v.delta && (N && !W && !A && (W = !0, await new Promise((P) => setTimeout(P, 400))), A += v.delta), A && (yield q());
799
799
  continue;
800
800
  case "error":
801
801
  throw new Error(v.errorText || "Stream error");
@@ -807,18 +807,18 @@ function Ht(e, r) {
807
807
  case "finish":
808
808
  continue;
809
809
  }
810
- const te = v.delta;
811
- if (te != null && (A += te), v.content && (A += v.content), v.message && (A += v.message.content || ""), v.finished) {
812
- (A || N || h.length > 0) && (yield K());
810
+ const ee = v.delta;
811
+ if (ee != null && (N && !W && !A && (W = !0, await new Promise((P) => setTimeout(P, 400))), A += ee), v.content && (A += v.content), v.message && (A += v.message.content || ""), v.finished) {
812
+ (A || N || _.length > 0) && (yield q());
813
813
  break;
814
814
  }
815
- (A || N || h.length > 0) && (yield K());
815
+ (A || N || _.length > 0) && (yield q());
816
816
  }
817
- (A || N || h.length > 0) && (yield K());
817
+ (A || N || _.length > 0) && (yield q());
818
818
  }
819
819
  };
820
820
  }
821
- function Vt() {
821
+ function Xt() {
822
822
  return {
823
823
  accept: ".pdf,.docx,.txt,.md,.csv,.json,image/*",
824
824
  async add({ file: e }) {
@@ -859,7 +859,7 @@ function Vt() {
859
859
  }
860
860
  };
861
861
  }
862
- function Na({
862
+ function Aa({
863
863
  children: e,
864
864
  baseUrl: r,
865
865
  sessionToken: t,
@@ -869,75 +869,78 @@ function Na({
869
869
  onModelChange: n,
870
870
  ephemeral: u = !1,
871
871
  systemPrompt: c,
872
- initialThreadId: s,
873
- onError: f,
874
- onChatCreated: l,
875
- onUserMessage: p,
876
- onThreadIdUpdate: y,
877
- onChatsLoaded: m,
878
- enableAttachments: x = !1,
879
- onBeforeRequest: g
872
+ enableReasoning: s = !1,
873
+ initialThreadId: f,
874
+ onError: l,
875
+ onChatCreated: p,
876
+ onUserMessage: g,
877
+ onThreadIdUpdate: m,
878
+ onChatsLoaded: x,
879
+ enableAttachments: b = !1,
880
+ onBeforeRequest: y
880
881
  }) {
881
- const b = q(
882
- () => new Wt(r, t || void 0, a),
882
+ const k = V(
883
+ () => new Ht(r, t || void 0, a),
883
884
  [r, t, a]
884
- ), [k, M] = P(o || null);
885
- $(() => {
886
- o && M(o);
885
+ ), [T, L] = R(o || null);
886
+ O(() => {
887
+ o && L(o);
887
888
  }, [o]);
888
- const S = H(
889
+ const I = X(
889
890
  (A) => {
890
- l?.(A);
891
+ p?.(A);
891
892
  },
892
- [l]
893
- ), L = H(
893
+ [p]
894
+ ), C = X(
894
895
  (A, N) => {
895
- y?.(A, N);
896
+ m?.(A, N);
896
897
  },
897
- [y]
898
- ), C = q(() => Ht(b, {
899
- modelId: k || void 0,
898
+ [m]
899
+ ), D = V(() => Vt(k, {
900
+ modelId: T || void 0,
900
901
  // Pass undefined if not set (backend resolves it)
901
902
  systemPrompt: c,
902
903
  ephemeral: u,
903
- onChatCreated: S,
904
- onUserMessage: p,
905
- onBeforeRequest: g
906
- }), [b, k, c, u, S, p, g]);
907
- return i === "singleChat" ? /* @__PURE__ */ d(Ia, { modelAdapter: C, enableAttachments: x, children: e }) : /* @__PURE__ */ d(
908
- Sa,
904
+ enableReasoning: s,
905
+ onChatCreated: I,
906
+ onUserMessage: g,
907
+ onBeforeRequest: y
908
+ }), [k, T, c, u, s, I, g, y]);
909
+ return i === "singleChat" ? /* @__PURE__ */ d(Na, { modelAdapter: D, enableAttachments: b, children: e }) : /* @__PURE__ */ d(
910
+ Ia,
909
911
  {
910
- client: b,
912
+ client: k,
911
913
  modelAdapterOptions: {
912
- modelId: k || void 0,
914
+ modelId: T || void 0,
913
915
  systemPrompt: c,
914
916
  ephemeral: u,
915
- onChatCreated: S,
916
- onUserMessage: p,
917
- onBeforeRequest: g
917
+ enableReasoning: s,
918
+ onChatCreated: I,
919
+ onUserMessage: g,
920
+ onBeforeRequest: y
918
921
  },
919
- initialThreadId: s,
920
- onChatsLoaded: m,
921
- onThreadIdUpdate: L,
922
- onError: f,
923
- enableAttachments: x,
922
+ initialThreadId: f,
923
+ onChatsLoaded: x,
924
+ onThreadIdUpdate: C,
925
+ onError: l,
926
+ enableAttachments: b,
924
927
  children: e
925
928
  }
926
929
  );
927
930
  }
928
- function Ia({
931
+ function Na({
929
932
  modelAdapter: e,
930
933
  enableAttachments: r,
931
934
  children: t
932
935
  }) {
933
- const a = q(() => r ? Vt() : void 0, [r]), i = Ft(e, {
936
+ const a = V(() => r ? Xt() : void 0, [r]), i = jt(e, {
934
937
  adapters: {
935
938
  ...a && { attachments: a }
936
939
  }
937
940
  });
938
- return /* @__PURE__ */ d(zt, { runtime: i, children: t });
941
+ return /* @__PURE__ */ d($t, { runtime: i, children: t });
939
942
  }
940
- function Sa({
943
+ function Ia({
941
944
  client: e,
942
945
  modelAdapterOptions: r,
943
946
  initialThreadId: t,
@@ -947,39 +950,39 @@ function Sa({
947
950
  enableAttachments: n,
948
951
  children: u
949
952
  }) {
950
- const c = q(() => Ma(e, (x, g) => {
951
- i?.(x, g);
952
- }), [e, i]), s = H(
953
- (x, g) => {
954
- c.updateRemoteId && c.updateRemoteId(x, g), i?.(x, g);
953
+ const c = V(() => Ca(e, (x, b) => {
954
+ i?.(x, b);
955
+ }), [e, i]), s = X(
956
+ (x, b) => {
957
+ c.updateRemoteId && c.updateRemoteId(x, b), i?.(x, b);
955
958
  },
956
959
  [c, i]
957
- ), f = q(() => ({
960
+ ), f = V(() => ({
958
961
  ...c,
959
962
  async list() {
960
963
  const x = await c.list();
961
964
  return a?.(), x;
962
965
  }
963
966
  }), [c, a]);
964
- $(() => {
967
+ O(() => {
965
968
  window.__cuadraThreadListAdapter = f, window.__cuadraThreadListRuntime = null;
966
969
  }, [f]);
967
- const l = q(() => Ht(e, {
970
+ const l = V(() => Vt(e, {
968
971
  ...r,
969
972
  onThreadIdUpdate: s
970
- }), [e, r, s]), p = q(() => n ? Vt() : void 0, [n]), y = H(() => Ft(l, {
973
+ }), [e, r, s]), p = V(() => n ? Xt() : void 0, [n]), g = X(() => jt(l, {
971
974
  adapters: {
972
975
  ...p && { attachments: p }
973
976
  }
974
- }), [l, p]), m = Dr({
977
+ }), [l, p]), m = Er({
975
978
  adapter: f,
976
- runtimeHook: y
979
+ runtimeHook: g
977
980
  });
978
- return $(() => {
981
+ return O(() => {
979
982
  window.__cuadraThreadListRuntime = m;
980
- }, [m]), /* @__PURE__ */ d(zt, { runtime: m, children: u });
983
+ }, [m]), /* @__PURE__ */ d($t, { runtime: m, children: u });
981
984
  }
982
- function Ct(e, r) {
985
+ function Mt(e, r) {
983
986
  const t = String(e);
984
987
  if (typeof r != "string")
985
988
  throw new TypeError("Expected character");
@@ -988,8 +991,8 @@ function Ct(e, r) {
988
991
  a++, i = t.indexOf(r, i + r.length);
989
992
  return a;
990
993
  }
991
- const xe = Ee(/[A-Za-z]/), at = Ee(/[\dA-Za-z]/);
992
- function La(e) {
994
+ const ke = ze(/[A-Za-z]/), it = ze(/[\dA-Za-z]/);
995
+ function Sa(e) {
993
996
  return (
994
997
  // Special whitespace codes (which have negative values), C0 and Control
995
998
  // character DEL
@@ -1005,19 +1008,19 @@ function B(e) {
1005
1008
  function G(e) {
1006
1009
  return e === -2 || e === -1 || e === 32;
1007
1010
  }
1008
- const De = Ee(/\p{P}|\p{S}/u), oe = Ee(/\s/);
1009
- function Ee(e) {
1011
+ const Fe = ze(/\p{P}|\p{S}/u), oe = ze(/\s/);
1012
+ function ze(e) {
1010
1013
  return r;
1011
1014
  function r(t) {
1012
1015
  return t !== null && t > -1 && e.test(String.fromCharCode(t));
1013
1016
  }
1014
1017
  }
1015
- function Pa(e) {
1018
+ function La(e) {
1016
1019
  if (typeof e != "string")
1017
1020
  throw new TypeError("Expected a string");
1018
1021
  return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
1019
1022
  }
1020
- const Fe = (
1023
+ const je = (
1021
1024
  // Note: overloads in JSDoc can’t yet use different `@template`s.
1022
1025
  /**
1023
1026
  * @type {(
@@ -1034,14 +1037,14 @@ const Fe = (
1034
1037
  */
1035
1038
  (function(e) {
1036
1039
  if (e == null)
1037
- return Ea;
1040
+ return _a;
1038
1041
  if (typeof e == "function")
1039
- return ze(e);
1042
+ return $e(e);
1040
1043
  if (typeof e == "object")
1041
- return Array.isArray(e) ? Ra(e) : (
1044
+ return Array.isArray(e) ? Pa(e) : (
1042
1045
  // Cast because `ReadonlyArray` goes into the above but `isArray`
1043
1046
  // narrows to `Array`.
1044
- _a(
1047
+ Ra(
1045
1048
  /** @type {Props} */
1046
1049
  e
1047
1050
  )
@@ -1051,12 +1054,12 @@ const Fe = (
1051
1054
  throw new Error("Expected function, string, or object as test");
1052
1055
  })
1053
1056
  );
1054
- function Ra(e) {
1057
+ function Pa(e) {
1055
1058
  const r = [];
1056
1059
  let t = -1;
1057
1060
  for (; ++t < e.length; )
1058
- r[t] = Fe(e[t]);
1059
- return ze(a);
1061
+ r[t] = je(e[t]);
1062
+ return $e(a);
1060
1063
  function a(...i) {
1061
1064
  let o = -1;
1062
1065
  for (; ++o < r.length; )
@@ -1064,12 +1067,12 @@ function Ra(e) {
1064
1067
  return !1;
1065
1068
  }
1066
1069
  }
1067
- function _a(e) {
1070
+ function Ra(e) {
1068
1071
  const r = (
1069
1072
  /** @type {Record<string, unknown>} */
1070
1073
  e
1071
1074
  );
1072
- return ze(t);
1075
+ return $e(t);
1073
1076
  function t(a) {
1074
1077
  const i = (
1075
1078
  /** @type {Record<string, unknown>} */
@@ -1083,15 +1086,15 @@ function _a(e) {
1083
1086
  }
1084
1087
  }
1085
1088
  function Da(e) {
1086
- return ze(r);
1089
+ return $e(r);
1087
1090
  function r(t) {
1088
1091
  return t && t.type === e;
1089
1092
  }
1090
1093
  }
1091
- function ze(e) {
1094
+ function $e(e) {
1092
1095
  return r;
1093
1096
  function r(t, a, i) {
1094
- return !!(Fa(t) && e.call(
1097
+ return !!(Ea(t) && e.call(
1095
1098
  this,
1096
1099
  t,
1097
1100
  typeof a == "number" ? a : void 0,
@@ -1099,17 +1102,17 @@ function ze(e) {
1099
1102
  ));
1100
1103
  }
1101
1104
  }
1102
- function Ea() {
1105
+ function _a() {
1103
1106
  return !0;
1104
1107
  }
1105
- function Fa(e) {
1108
+ function Ea(e) {
1106
1109
  return e !== null && typeof e == "object" && "type" in e;
1107
1110
  }
1108
- const Xt = [], za = !0, Ye = !1, ja = "skip";
1109
- function Kt(e, r, t, a) {
1111
+ const Kt = [], Fa = !0, tt = !1, za = "skip";
1112
+ function Qt(e, r, t, a) {
1110
1113
  let i;
1111
1114
  typeof r == "function" && typeof t != "function" ? (a = t, t = r) : i = r;
1112
- const o = Fe(i), n = a ? -1 : 1;
1115
+ const o = je(i), n = a ? -1 : 1;
1113
1116
  u(e, void 0, [])();
1114
1117
  function u(c, s, f) {
1115
1118
  const l = (
@@ -1117,7 +1120,7 @@ function Kt(e, r, t, a) {
1117
1120
  c && typeof c == "object" ? c : {}
1118
1121
  );
1119
1122
  if (typeof l.type == "string") {
1120
- const y = (
1123
+ const g = (
1121
1124
  // `hast`
1122
1125
  typeof l.tagName == "string" ? l.tagName : (
1123
1126
  // `xast`
@@ -1125,79 +1128,79 @@ function Kt(e, r, t, a) {
1125
1128
  )
1126
1129
  );
1127
1130
  Object.defineProperty(p, "name", {
1128
- value: "node (" + (c.type + (y ? "<" + y + ">" : "")) + ")"
1131
+ value: "node (" + (c.type + (g ? "<" + g + ">" : "")) + ")"
1129
1132
  });
1130
1133
  }
1131
1134
  return p;
1132
1135
  function p() {
1133
- let y = Xt, m, x, g;
1134
- if ((!r || o(c, s, f[f.length - 1] || void 0)) && (y = $a(t(c, f)), y[0] === Ye))
1135
- return y;
1136
+ let g = Kt, m, x, b;
1137
+ if ((!r || o(c, s, f[f.length - 1] || void 0)) && (g = ja(t(c, f)), g[0] === tt))
1138
+ return g;
1136
1139
  if ("children" in c && c.children) {
1137
- const b = (
1140
+ const y = (
1138
1141
  /** @type {UnistParent} */
1139
1142
  c
1140
1143
  );
1141
- if (b.children && y[0] !== ja)
1142
- for (x = (a ? b.children.length : -1) + n, g = f.concat(b); x > -1 && x < b.children.length; ) {
1143
- const k = b.children[x];
1144
- if (m = u(k, x, g)(), m[0] === Ye)
1144
+ if (y.children && g[0] !== za)
1145
+ for (x = (a ? y.children.length : -1) + n, b = f.concat(y); x > -1 && x < y.children.length; ) {
1146
+ const k = y.children[x];
1147
+ if (m = u(k, x, b)(), m[0] === tt)
1145
1148
  return m;
1146
1149
  x = typeof m[1] == "number" ? m[1] : x + n;
1147
1150
  }
1148
1151
  }
1149
- return y;
1152
+ return g;
1150
1153
  }
1151
1154
  }
1152
1155
  }
1153
- function $a(e) {
1154
- return Array.isArray(e) ? e : typeof e == "number" ? [za, e] : e == null ? Xt : [e];
1156
+ function ja(e) {
1157
+ return Array.isArray(e) ? e : typeof e == "number" ? [Fa, e] : e == null ? Kt : [e];
1155
1158
  }
1156
- function Oa(e, r, t) {
1157
- const i = Fe((t || {}).ignore || []), o = Ua(r);
1159
+ function $a(e, r, t) {
1160
+ const i = je((t || {}).ignore || []), o = Oa(r);
1158
1161
  let n = -1;
1159
1162
  for (; ++n < o.length; )
1160
- Kt(e, "text", u);
1163
+ Qt(e, "text", u);
1161
1164
  function u(s, f) {
1162
1165
  let l = -1, p;
1163
1166
  for (; ++l < f.length; ) {
1164
- const y = f[l], m = p ? p.children : void 0;
1167
+ const g = f[l], m = p ? p.children : void 0;
1165
1168
  if (i(
1166
- y,
1167
- m ? m.indexOf(y) : void 0,
1169
+ g,
1170
+ m ? m.indexOf(g) : void 0,
1168
1171
  p
1169
1172
  ))
1170
1173
  return;
1171
- p = y;
1174
+ p = g;
1172
1175
  }
1173
1176
  if (p)
1174
1177
  return c(s, f);
1175
1178
  }
1176
1179
  function c(s, f) {
1177
- const l = f[f.length - 1], p = o[n][0], y = o[n][1];
1180
+ const l = f[f.length - 1], p = o[n][0], g = o[n][1];
1178
1181
  let m = 0;
1179
- const g = l.children.indexOf(s);
1180
- let b = !1, k = [];
1182
+ const b = l.children.indexOf(s);
1183
+ let y = !1, k = [];
1181
1184
  p.lastIndex = 0;
1182
- let M = p.exec(s.value);
1183
- for (; M; ) {
1184
- const S = M.index, L = {
1185
- index: M.index,
1186
- input: M.input,
1185
+ let T = p.exec(s.value);
1186
+ for (; T; ) {
1187
+ const L = T.index, I = {
1188
+ index: T.index,
1189
+ input: T.input,
1187
1190
  stack: [...f, s]
1188
1191
  };
1189
- let C = y(...M, L);
1190
- if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = S + 1 : (m !== S && k.push({
1192
+ let C = g(...T, I);
1193
+ if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = L + 1 : (m !== L && k.push({
1191
1194
  type: "text",
1192
- value: s.value.slice(m, S)
1193
- }), Array.isArray(C) ? k.push(...C) : C && k.push(C), m = S + M[0].length, b = !0), !p.global)
1195
+ value: s.value.slice(m, L)
1196
+ }), Array.isArray(C) ? k.push(...C) : C && k.push(C), m = L + T[0].length, y = !0), !p.global)
1194
1197
  break;
1195
- M = p.exec(s.value);
1198
+ T = p.exec(s.value);
1196
1199
  }
1197
- return b ? (m < s.value.length && k.push({ type: "text", value: s.value.slice(m) }), l.children.splice(g, 1, ...k)) : k = [s], g + k.length;
1200
+ return y ? (m < s.value.length && k.push({ type: "text", value: s.value.slice(m) }), l.children.splice(b, 1, ...k)) : k = [s], b + k.length;
1198
1201
  }
1199
1202
  }
1200
- function Ua(e) {
1203
+ function Oa(e) {
1201
1204
  const r = [];
1202
1205
  if (!Array.isArray(e))
1203
1206
  throw new TypeError("Expected find and replace tuple or list of tuples");
@@ -1205,33 +1208,33 @@ function Ua(e) {
1205
1208
  let a = -1;
1206
1209
  for (; ++a < t.length; ) {
1207
1210
  const i = t[a];
1208
- r.push([Ba(i[0]), Wa(i[1])]);
1211
+ r.push([Ua(i[0]), Ba(i[1])]);
1209
1212
  }
1210
1213
  return r;
1211
1214
  }
1212
- function Ba(e) {
1213
- return typeof e == "string" ? new RegExp(Pa(e), "g") : e;
1215
+ function Ua(e) {
1216
+ return typeof e == "string" ? new RegExp(La(e), "g") : e;
1214
1217
  }
1215
- function Wa(e) {
1218
+ function Ba(e) {
1216
1219
  return typeof e == "function" ? e : function() {
1217
1220
  return e;
1218
1221
  };
1219
1222
  }
1220
- const qe = "phrasing", He = ["autolink", "link", "image", "label"];
1221
- function qa() {
1223
+ const Ve = "phrasing", Xe = ["autolink", "link", "image", "label"];
1224
+ function Wa() {
1222
1225
  return {
1223
- transforms: [Za],
1226
+ transforms: [Ga],
1224
1227
  enter: {
1225
- literalAutolink: Va,
1226
- literalAutolinkEmail: Ve,
1227
- literalAutolinkHttp: Ve,
1228
- literalAutolinkWww: Ve
1228
+ literalAutolink: qa,
1229
+ literalAutolinkEmail: Ke,
1230
+ literalAutolinkHttp: Ke,
1231
+ literalAutolinkWww: Ke
1229
1232
  },
1230
1233
  exit: {
1231
- literalAutolink: Ga,
1232
- literalAutolinkEmail: Qa,
1233
- literalAutolinkHttp: Xa,
1234
- literalAutolinkWww: Ka
1234
+ literalAutolink: Qa,
1235
+ literalAutolinkEmail: Ka,
1236
+ literalAutolinkHttp: Va,
1237
+ literalAutolinkWww: Xa
1235
1238
  }
1236
1239
  };
1237
1240
  }
@@ -1242,61 +1245,61 @@ function Ha() {
1242
1245
  character: "@",
1243
1246
  before: "[+\\-.\\w]",
1244
1247
  after: "[\\-.\\w]",
1245
- inConstruct: qe,
1246
- notInConstruct: He
1248
+ inConstruct: Ve,
1249
+ notInConstruct: Xe
1247
1250
  },
1248
1251
  {
1249
1252
  character: ".",
1250
1253
  before: "[Ww]",
1251
1254
  after: "[\\-.\\w]",
1252
- inConstruct: qe,
1253
- notInConstruct: He
1255
+ inConstruct: Ve,
1256
+ notInConstruct: Xe
1254
1257
  },
1255
1258
  {
1256
1259
  character: ":",
1257
1260
  before: "[ps]",
1258
1261
  after: "\\/",
1259
- inConstruct: qe,
1260
- notInConstruct: He
1262
+ inConstruct: Ve,
1263
+ notInConstruct: Xe
1261
1264
  }
1262
1265
  ]
1263
1266
  };
1264
1267
  }
1265
- function Va(e) {
1268
+ function qa(e) {
1266
1269
  this.enter({ type: "link", title: null, url: "", children: [] }, e);
1267
1270
  }
1268
- function Ve(e) {
1271
+ function Ke(e) {
1269
1272
  this.config.enter.autolinkProtocol.call(this, e);
1270
1273
  }
1271
- function Xa(e) {
1274
+ function Va(e) {
1272
1275
  this.config.exit.autolinkProtocol.call(this, e);
1273
1276
  }
1274
- function Ka(e) {
1277
+ function Xa(e) {
1275
1278
  this.config.exit.data.call(this, e);
1276
1279
  const r = this.stack[this.stack.length - 1];
1277
1280
  r.type, r.url = "http://" + this.sliceSerialize(e);
1278
1281
  }
1279
- function Qa(e) {
1282
+ function Ka(e) {
1280
1283
  this.config.exit.autolinkEmail.call(this, e);
1281
1284
  }
1282
- function Ga(e) {
1285
+ function Qa(e) {
1283
1286
  this.exit(e);
1284
1287
  }
1285
- function Za(e) {
1286
- Oa(
1288
+ function Ga(e) {
1289
+ $a(
1287
1290
  e,
1288
1291
  [
1289
- [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Ja],
1290
- [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Ya]
1292
+ [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Za],
1293
+ [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Ja]
1291
1294
  ],
1292
1295
  { ignore: ["link", "linkReference"] }
1293
1296
  );
1294
1297
  }
1295
- function Ja(e, r, t, a, i) {
1298
+ function Za(e, r, t, a, i) {
1296
1299
  let o = "";
1297
- if (!Qt(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !en(t)))
1300
+ if (!Gt(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !Ya(t)))
1298
1301
  return !1;
1299
- const n = tn(t + a);
1302
+ const n = en(t + a);
1300
1303
  if (!n[0]) return !1;
1301
1304
  const u = {
1302
1305
  type: "link",
@@ -1306,10 +1309,10 @@ function Ja(e, r, t, a, i) {
1306
1309
  };
1307
1310
  return n[1] ? [u, { type: "text", value: n[1] }] : u;
1308
1311
  }
1309
- function Ya(e, r, t, a) {
1312
+ function Ja(e, r, t, a) {
1310
1313
  return (
1311
1314
  // Not an expected previous character.
1312
- !Qt(a, !0) || // Label ends in not allowed character.
1315
+ !Gt(a, !0) || // Label ends in not allowed character.
1313
1316
  /[-\d_]$/.test(t) ? !1 : {
1314
1317
  type: "link",
1315
1318
  title: null,
@@ -1318,68 +1321,68 @@ function Ya(e, r, t, a) {
1318
1321
  }
1319
1322
  );
1320
1323
  }
1321
- function en(e) {
1324
+ function Ya(e) {
1322
1325
  const r = e.split(".");
1323
1326
  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])));
1324
1327
  }
1325
- function tn(e) {
1328
+ function en(e) {
1326
1329
  const r = /[!"&'),.:;<>?\]}]+$/.exec(e);
1327
1330
  if (!r)
1328
1331
  return [e, void 0];
1329
1332
  e = e.slice(0, r.index);
1330
1333
  let t = r[0], a = t.indexOf(")");
1331
- const i = Ct(e, "(");
1332
- let o = Ct(e, ")");
1334
+ const i = Mt(e, "(");
1335
+ let o = Mt(e, ")");
1333
1336
  for (; a !== -1 && i > o; )
1334
1337
  e += t.slice(0, a + 1), t = t.slice(a + 1), a = t.indexOf(")"), o++;
1335
1338
  return [e, t];
1336
1339
  }
1337
- function Qt(e, r) {
1340
+ function Gt(e, r) {
1338
1341
  const t = e.input.charCodeAt(e.index - 1);
1339
- return (e.index === 0 || oe(t) || De(t)) && // If it’s an email, the previous character should not be a slash.
1342
+ return (e.index === 0 || oe(t) || Fe(t)) && // If it’s an email, the previous character should not be a slash.
1340
1343
  (!r || t !== 47);
1341
1344
  }
1342
- function ve(e) {
1345
+ function Ce(e) {
1343
1346
  return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
1344
1347
  }
1345
- Gt.peek = dn;
1346
- function rn() {
1348
+ Zt.peek = ln;
1349
+ function tn() {
1347
1350
  this.buffer();
1348
1351
  }
1349
- function an(e) {
1352
+ function rn(e) {
1350
1353
  this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
1351
1354
  }
1352
- function nn() {
1355
+ function an() {
1353
1356
  this.buffer();
1354
1357
  }
1355
- function on(e) {
1358
+ function nn(e) {
1356
1359
  this.enter(
1357
1360
  { type: "footnoteDefinition", identifier: "", label: "", children: [] },
1358
1361
  e
1359
1362
  );
1360
1363
  }
1361
- function cn(e) {
1364
+ function on(e) {
1362
1365
  const r = this.resume(), t = this.stack[this.stack.length - 1];
1363
- t.type, t.identifier = ve(
1366
+ t.type, t.identifier = Ce(
1364
1367
  this.sliceSerialize(e)
1365
1368
  ).toLowerCase(), t.label = r;
1366
1369
  }
1367
- function un(e) {
1370
+ function cn(e) {
1368
1371
  this.exit(e);
1369
1372
  }
1370
- function sn(e) {
1373
+ function un(e) {
1371
1374
  const r = this.resume(), t = this.stack[this.stack.length - 1];
1372
- t.type, t.identifier = ve(
1375
+ t.type, t.identifier = Ce(
1373
1376
  this.sliceSerialize(e)
1374
1377
  ).toLowerCase(), t.label = r;
1375
1378
  }
1376
- function ln(e) {
1379
+ function sn(e) {
1377
1380
  this.exit(e);
1378
1381
  }
1379
- function dn() {
1382
+ function ln() {
1380
1383
  return "[";
1381
1384
  }
1382
- function Gt(e, r, t, a) {
1385
+ function Zt(e, r, t, a) {
1383
1386
  const i = t.createTracker(a);
1384
1387
  let o = i.move("[^");
1385
1388
  const n = t.enter("footnoteReference"), u = t.enter("reference");
@@ -1387,26 +1390,26 @@ function Gt(e, r, t, a) {
1387
1390
  t.safe(t.associationId(e), { after: "]", before: o })
1388
1391
  ), u(), n(), o += i.move("]"), o;
1389
1392
  }
1390
- function fn() {
1393
+ function dn() {
1391
1394
  return {
1392
1395
  enter: {
1393
- gfmFootnoteCallString: rn,
1394
- gfmFootnoteCall: an,
1395
- gfmFootnoteDefinitionLabelString: nn,
1396
- gfmFootnoteDefinition: on
1396
+ gfmFootnoteCallString: tn,
1397
+ gfmFootnoteCall: rn,
1398
+ gfmFootnoteDefinitionLabelString: an,
1399
+ gfmFootnoteDefinition: nn
1397
1400
  },
1398
1401
  exit: {
1399
- gfmFootnoteCallString: cn,
1400
- gfmFootnoteCall: un,
1401
- gfmFootnoteDefinitionLabelString: sn,
1402
- gfmFootnoteDefinition: ln
1402
+ gfmFootnoteCallString: on,
1403
+ gfmFootnoteCall: cn,
1404
+ gfmFootnoteDefinitionLabelString: un,
1405
+ gfmFootnoteDefinition: sn
1403
1406
  }
1404
1407
  };
1405
1408
  }
1406
- function hn(e) {
1409
+ function fn(e) {
1407
1410
  let r = !1;
1408
1411
  return e && e.firstLineBlank && (r = !0), {
1409
- handlers: { footnoteDefinition: t, footnoteReference: Gt },
1412
+ handlers: { footnoteDefinition: t, footnoteReference: Zt },
1410
1413
  // This is on by default already.
1411
1414
  unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
1412
1415
  };
@@ -1420,18 +1423,18 @@ function hn(e) {
1420
1423
  (r ? `
1421
1424
  ` : " ") + o.indentLines(
1422
1425
  o.containerFlow(a, u.current()),
1423
- r ? Zt : mn
1426
+ r ? Jt : hn
1424
1427
  )
1425
1428
  )), s(), c;
1426
1429
  }
1427
1430
  }
1428
- function mn(e, r, t) {
1429
- return r === 0 ? e : Zt(e, r, t);
1431
+ function hn(e, r, t) {
1432
+ return r === 0 ? e : Jt(e, r, t);
1430
1433
  }
1431
- function Zt(e, r, t) {
1434
+ function Jt(e, r, t) {
1432
1435
  return (t ? "" : " ") + e;
1433
1436
  }
1434
- const pn = [
1437
+ const mn = [
1435
1438
  "autolink",
1436
1439
  "destinationLiteral",
1437
1440
  "destinationRaw",
@@ -1439,33 +1442,33 @@ const pn = [
1439
1442
  "titleQuote",
1440
1443
  "titleApostrophe"
1441
1444
  ];
1442
- Jt.peek = kn;
1443
- function gn() {
1445
+ Yt.peek = xn;
1446
+ function pn() {
1444
1447
  return {
1445
1448
  canContainEols: ["delete"],
1446
- enter: { strikethrough: yn },
1447
- exit: { strikethrough: xn }
1449
+ enter: { strikethrough: bn },
1450
+ exit: { strikethrough: yn }
1448
1451
  };
1449
1452
  }
1450
- function bn() {
1453
+ function gn() {
1451
1454
  return {
1452
1455
  unsafe: [
1453
1456
  {
1454
1457
  character: "~",
1455
1458
  inConstruct: "phrasing",
1456
- notInConstruct: pn
1459
+ notInConstruct: mn
1457
1460
  }
1458
1461
  ],
1459
- handlers: { delete: Jt }
1462
+ handlers: { delete: Yt }
1460
1463
  };
1461
1464
  }
1462
- function yn(e) {
1465
+ function bn(e) {
1463
1466
  this.enter({ type: "delete", children: [] }, e);
1464
1467
  }
1465
- function xn(e) {
1468
+ function yn(e) {
1466
1469
  this.exit(e);
1467
1470
  }
1468
- function Jt(e, r, t, a) {
1471
+ function Yt(e, r, t, a) {
1469
1472
  const i = t.createTracker(a), o = t.enter("strikethrough");
1470
1473
  let n = i.move("~~");
1471
1474
  return n += t.containerPhrasing(e, {
@@ -1474,82 +1477,82 @@ function Jt(e, r, t, a) {
1474
1477
  after: "~"
1475
1478
  }), n += i.move("~~"), o(), n;
1476
1479
  }
1477
- function kn() {
1480
+ function xn() {
1478
1481
  return "~";
1479
1482
  }
1480
- function wn(e) {
1483
+ function kn(e) {
1481
1484
  return e.length;
1482
1485
  }
1483
- function vn(e, r) {
1484
- const t = r || {}, a = (t.align || []).concat(), i = t.stringLength || wn, o = [], n = [], u = [], c = [];
1486
+ function wn(e, r) {
1487
+ const t = r || {}, a = (t.align || []).concat(), i = t.stringLength || kn, o = [], n = [], u = [], c = [];
1485
1488
  let s = 0, f = -1;
1486
1489
  for (; ++f < e.length; ) {
1487
- const x = [], g = [];
1488
- let b = -1;
1489
- for (e[f].length > s && (s = e[f].length); ++b < e[f].length; ) {
1490
- const k = Cn(e[f][b]);
1490
+ const x = [], b = [];
1491
+ let y = -1;
1492
+ for (e[f].length > s && (s = e[f].length); ++y < e[f].length; ) {
1493
+ const k = vn(e[f][y]);
1491
1494
  if (t.alignDelimiters !== !1) {
1492
- const M = i(k);
1493
- g[b] = M, (c[b] === void 0 || M > c[b]) && (c[b] = M);
1495
+ const T = i(k);
1496
+ b[y] = T, (c[y] === void 0 || T > c[y]) && (c[y] = T);
1494
1497
  }
1495
1498
  x.push(k);
1496
1499
  }
1497
- n[f] = x, u[f] = g;
1500
+ n[f] = x, u[f] = b;
1498
1501
  }
1499
1502
  let l = -1;
1500
1503
  if (typeof a == "object" && "length" in a)
1501
1504
  for (; ++l < s; )
1502
- o[l] = Mt(a[l]);
1505
+ o[l] = At(a[l]);
1503
1506
  else {
1504
- const x = Mt(a);
1507
+ const x = At(a);
1505
1508
  for (; ++l < s; )
1506
1509
  o[l] = x;
1507
1510
  }
1508
1511
  l = -1;
1509
- const p = [], y = [];
1512
+ const p = [], g = [];
1510
1513
  for (; ++l < s; ) {
1511
1514
  const x = o[l];
1512
- let g = "", b = "";
1513
- x === 99 ? (g = ":", b = ":") : x === 108 ? g = ":" : x === 114 && (b = ":");
1515
+ let b = "", y = "";
1516
+ x === 99 ? (b = ":", y = ":") : x === 108 ? b = ":" : x === 114 && (y = ":");
1514
1517
  let k = t.alignDelimiters === !1 ? 1 : Math.max(
1515
1518
  1,
1516
- c[l] - g.length - b.length
1519
+ c[l] - b.length - y.length
1517
1520
  );
1518
- const M = g + "-".repeat(k) + b;
1519
- t.alignDelimiters !== !1 && (k = g.length + k + b.length, k > c[l] && (c[l] = k), y[l] = k), p[l] = M;
1521
+ const T = b + "-".repeat(k) + y;
1522
+ t.alignDelimiters !== !1 && (k = b.length + k + y.length, k > c[l] && (c[l] = k), g[l] = k), p[l] = T;
1520
1523
  }
1521
- n.splice(1, 0, p), u.splice(1, 0, y), f = -1;
1524
+ n.splice(1, 0, p), u.splice(1, 0, g), f = -1;
1522
1525
  const m = [];
1523
1526
  for (; ++f < n.length; ) {
1524
- const x = n[f], g = u[f];
1527
+ const x = n[f], b = u[f];
1525
1528
  l = -1;
1526
- const b = [];
1529
+ const y = [];
1527
1530
  for (; ++l < s; ) {
1528
1531
  const k = x[l] || "";
1529
- let M = "", S = "";
1532
+ let T = "", L = "";
1530
1533
  if (t.alignDelimiters !== !1) {
1531
- const L = c[l] - (g[l] || 0), C = o[l];
1532
- C === 114 ? M = " ".repeat(L) : C === 99 ? L % 2 ? (M = " ".repeat(L / 2 + 0.5), S = " ".repeat(L / 2 - 0.5)) : (M = " ".repeat(L / 2), S = M) : S = " ".repeat(L);
1534
+ const I = c[l] - (b[l] || 0), C = o[l];
1535
+ C === 114 ? T = " ".repeat(I) : C === 99 ? I % 2 ? (T = " ".repeat(I / 2 + 0.5), L = " ".repeat(I / 2 - 0.5)) : (T = " ".repeat(I / 2), L = T) : L = " ".repeat(I);
1533
1536
  }
1534
- t.delimiterStart !== !1 && !l && b.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
1537
+ t.delimiterStart !== !1 && !l && y.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
1535
1538
  // empty: there will be a closing space.
1536
- !(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) && b.push(" "), t.alignDelimiters !== !1 && b.push(M), b.push(k), t.alignDelimiters !== !1 && b.push(S), t.padding !== !1 && b.push(" "), (t.delimiterEnd !== !1 || l !== s - 1) && b.push("|");
1539
+ !(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) && y.push(" "), t.alignDelimiters !== !1 && y.push(T), y.push(k), t.alignDelimiters !== !1 && y.push(L), t.padding !== !1 && y.push(" "), (t.delimiterEnd !== !1 || l !== s - 1) && y.push("|");
1537
1540
  }
1538
1541
  m.push(
1539
- t.delimiterEnd === !1 ? b.join("").replace(/ +$/, "") : b.join("")
1542
+ t.delimiterEnd === !1 ? y.join("").replace(/ +$/, "") : y.join("")
1540
1543
  );
1541
1544
  }
1542
1545
  return m.join(`
1543
1546
  `);
1544
1547
  }
1545
- function Cn(e) {
1548
+ function vn(e) {
1546
1549
  return e == null ? "" : String(e);
1547
1550
  }
1548
- function Mt(e) {
1551
+ function At(e) {
1549
1552
  const r = typeof e == "string" ? e.codePointAt(0) : 0;
1550
1553
  return r === 67 || r === 99 ? 99 : r === 76 || r === 108 ? 108 : r === 82 || r === 114 ? 114 : 0;
1551
1554
  }
1552
- function Mn(e, r, t, a) {
1555
+ function Cn(e, r, t, a) {
1553
1556
  const i = t.enter("blockquote"), o = t.createTracker(a);
1554
1557
  o.move("> "), o.shift(2);
1555
1558
  const n = t.indentLines(
@@ -1561,10 +1564,10 @@ function Mn(e, r, t, a) {
1561
1564
  function Tn(e, r, t) {
1562
1565
  return ">" + (t ? "" : " ") + e;
1563
1566
  }
1564
- function An(e, r) {
1565
- return Tt(e, r.inConstruct, !0) && !Tt(e, r.notInConstruct, !1);
1567
+ function Mn(e, r) {
1568
+ return Nt(e, r.inConstruct, !0) && !Nt(e, r.notInConstruct, !1);
1566
1569
  }
1567
- function Tt(e, r, t) {
1570
+ function Nt(e, r, t) {
1568
1571
  if (typeof r == "string" && (r = [r]), !r || r.length === 0)
1569
1572
  return t;
1570
1573
  let a = -1;
@@ -1573,16 +1576,16 @@ function Tt(e, r, t) {
1573
1576
  return !0;
1574
1577
  return !1;
1575
1578
  }
1576
- function At(e, r, t, a) {
1579
+ function It(e, r, t, a) {
1577
1580
  let i = -1;
1578
1581
  for (; ++i < t.unsafe.length; )
1579
1582
  if (t.unsafe[i].character === `
1580
- ` && An(t.stack, t.unsafe[i]))
1583
+ ` && Mn(t.stack, t.unsafe[i]))
1581
1584
  return /[ \t]/.test(a.before) ? "" : " ";
1582
1585
  return `\\
1583
1586
  `;
1584
1587
  }
1585
- function Nn(e, r) {
1588
+ function An(e, r) {
1586
1589
  const t = String(e);
1587
1590
  let a = t.indexOf(r), i = a, o = 0, n = 0;
1588
1591
  if (typeof r != "string")
@@ -1591,13 +1594,13 @@ function Nn(e, r) {
1591
1594
  a === i ? ++o > n && (n = o) : o = 1, i = a + r.length, a = t.indexOf(r, i);
1592
1595
  return n;
1593
1596
  }
1594
- function In(e, r) {
1597
+ function Nn(e, r) {
1595
1598
  return !!(r.options.fences === !1 && e.value && // If there’s no info…
1596
1599
  !e.lang && // And there’s a non-whitespace character…
1597
1600
  /[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
1598
1601
  !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
1599
1602
  }
1600
- function Sn(e) {
1603
+ function In(e) {
1601
1604
  const r = e.options.fence || "`";
1602
1605
  if (r !== "`" && r !== "~")
1603
1606
  throw new Error(
@@ -1605,13 +1608,13 @@ function Sn(e) {
1605
1608
  );
1606
1609
  return r;
1607
1610
  }
1608
- function Ln(e, r, t, a) {
1609
- const i = Sn(t), o = e.value || "", n = i === "`" ? "GraveAccent" : "Tilde";
1610
- if (In(e, t)) {
1611
- const l = t.enter("codeIndented"), p = t.indentLines(o, Pn);
1611
+ function Sn(e, r, t, a) {
1612
+ const i = In(t), o = e.value || "", n = i === "`" ? "GraveAccent" : "Tilde";
1613
+ if (Nn(e, t)) {
1614
+ const l = t.enter("codeIndented"), p = t.indentLines(o, Ln);
1612
1615
  return l(), p;
1613
1616
  }
1614
- const u = t.createTracker(a), c = i.repeat(Math.max(Nn(o, i) + 1, 3)), s = t.enter("codeFenced");
1617
+ const u = t.createTracker(a), c = i.repeat(Math.max(An(o, i) + 1, 3)), s = t.enter("codeFenced");
1615
1618
  let f = u.move(c);
1616
1619
  if (e.lang) {
1617
1620
  const l = t.enter(`codeFencedLang${n}`);
@@ -1640,10 +1643,10 @@ function Ln(e, r, t, a) {
1640
1643
  `), o && (f += u.move(o + `
1641
1644
  `)), f += u.move(c), s(), f;
1642
1645
  }
1643
- function Pn(e, r, t) {
1646
+ function Ln(e, r, t) {
1644
1647
  return (t ? "" : " ") + e;
1645
1648
  }
1646
- function nt(e) {
1649
+ function ot(e) {
1647
1650
  const r = e.options.quote || '"';
1648
1651
  if (r !== '"' && r !== "'")
1649
1652
  throw new Error(
@@ -1651,8 +1654,8 @@ function nt(e) {
1651
1654
  );
1652
1655
  return r;
1653
1656
  }
1654
- function Rn(e, r, t, a) {
1655
- const i = nt(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("definition");
1657
+ function Pn(e, r, t, a) {
1658
+ const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("definition");
1656
1659
  let u = t.enter("label");
1657
1660
  const c = t.createTracker(a);
1658
1661
  let s = c.move("[");
@@ -1681,7 +1684,7 @@ function Rn(e, r, t, a) {
1681
1684
  })
1682
1685
  ), s += c.move(i), u()), n(), s;
1683
1686
  }
1684
- function _n(e) {
1687
+ function Rn(e) {
1685
1688
  const r = e.options.emphasis || "*";
1686
1689
  if (r !== "*" && r !== "_")
1687
1690
  throw new Error(
@@ -1689,17 +1692,17 @@ function _n(e) {
1689
1692
  );
1690
1693
  return r;
1691
1694
  }
1692
- function ke(e) {
1695
+ function we(e) {
1693
1696
  return "&#x" + e.toString(16).toUpperCase() + ";";
1694
1697
  }
1695
- function Re(e) {
1698
+ function _e(e) {
1696
1699
  if (e === null || B(e) || oe(e))
1697
1700
  return 1;
1698
- if (De(e))
1701
+ if (Fe(e))
1699
1702
  return 2;
1700
1703
  }
1701
- function _e(e, r, t) {
1702
- const a = Re(e), i = Re(r);
1704
+ function Ee(e, r, t) {
1705
+ const a = _e(e), i = _e(r);
1703
1706
  return a === void 0 ? i === void 0 ? (
1704
1707
  // Letter inside:
1705
1708
  // we have to encode *both* letters for `_` as it is looser.
@@ -1731,9 +1734,9 @@ function _e(e, r, t) {
1731
1734
  { inside: !1, outside: !1 }
1732
1735
  );
1733
1736
  }
1734
- Yt.peek = Dn;
1735
- function Yt(e, r, t, a) {
1736
- const i = _n(t), o = t.enter("emphasis"), n = t.createTracker(a), u = n.move(i);
1737
+ er.peek = Dn;
1738
+ function er(e, r, t, a) {
1739
+ const i = Rn(t), o = t.enter("emphasis"), n = t.createTracker(a), u = n.move(i);
1737
1740
  let c = n.move(
1738
1741
  t.containerPhrasing(e, {
1739
1742
  after: i,
@@ -1741,67 +1744,67 @@ function Yt(e, r, t, a) {
1741
1744
  ...n.current()
1742
1745
  })
1743
1746
  );
1744
- const s = c.charCodeAt(0), f = _e(
1747
+ const s = c.charCodeAt(0), f = Ee(
1745
1748
  a.before.charCodeAt(a.before.length - 1),
1746
1749
  s,
1747
1750
  i
1748
1751
  );
1749
- f.inside && (c = ke(s) + c.slice(1));
1750
- const l = c.charCodeAt(c.length - 1), p = _e(a.after.charCodeAt(0), l, i);
1751
- p.inside && (c = c.slice(0, -1) + ke(l));
1752
- const y = n.move(i);
1752
+ f.inside && (c = we(s) + c.slice(1));
1753
+ const l = c.charCodeAt(c.length - 1), p = Ee(a.after.charCodeAt(0), l, i);
1754
+ p.inside && (c = c.slice(0, -1) + we(l));
1755
+ const g = n.move(i);
1753
1756
  return o(), t.attentionEncodeSurroundingInfo = {
1754
1757
  after: p.outside,
1755
1758
  before: f.outside
1756
- }, u + c + y;
1759
+ }, u + c + g;
1757
1760
  }
1758
1761
  function Dn(e, r, t) {
1759
1762
  return t.options.emphasis || "*";
1760
1763
  }
1761
- function En(e, r, t, a) {
1764
+ function _n(e, r, t, a) {
1762
1765
  let i, o, n;
1763
- typeof r == "function" && typeof t != "function" ? (o = void 0, n = r, i = t) : (o = r, n = t, i = a), Kt(e, o, u, i);
1766
+ typeof r == "function" && typeof t != "function" ? (o = void 0, n = r, i = t) : (o = r, n = t, i = a), Qt(e, o, u, i);
1764
1767
  function u(c, s) {
1765
1768
  const f = s[s.length - 1], l = f ? f.children.indexOf(c) : void 0;
1766
1769
  return n(c, l, f);
1767
1770
  }
1768
1771
  }
1769
- const Fn = {};
1770
- function er(e, r) {
1771
- const t = Fn, a = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1772
- return tr(e, a, i);
1772
+ const En = {};
1773
+ function tr(e, r) {
1774
+ const t = En, a = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1775
+ return rr(e, a, i);
1773
1776
  }
1774
- function tr(e, r, t) {
1775
- if (zn(e)) {
1777
+ function rr(e, r, t) {
1778
+ if (Fn(e)) {
1776
1779
  if ("value" in e)
1777
1780
  return e.type === "html" && !t ? "" : e.value;
1778
1781
  if (r && "alt" in e && e.alt)
1779
1782
  return e.alt;
1780
1783
  if ("children" in e)
1781
- return Nt(e.children, r, t);
1784
+ return St(e.children, r, t);
1782
1785
  }
1783
- return Array.isArray(e) ? Nt(e, r, t) : "";
1786
+ return Array.isArray(e) ? St(e, r, t) : "";
1784
1787
  }
1785
- function Nt(e, r, t) {
1788
+ function St(e, r, t) {
1786
1789
  const a = [];
1787
1790
  let i = -1;
1788
1791
  for (; ++i < e.length; )
1789
- a[i] = tr(e[i], r, t);
1792
+ a[i] = rr(e[i], r, t);
1790
1793
  return a.join("");
1791
1794
  }
1792
- function zn(e) {
1795
+ function Fn(e) {
1793
1796
  return !!(e && typeof e == "object");
1794
1797
  }
1795
- function jn(e, r) {
1798
+ function zn(e, r) {
1796
1799
  let t = !1;
1797
- return En(e, function(a) {
1800
+ return _n(e, function(a) {
1798
1801
  if ("value" in a && /\r?\n|\r/.test(a.value) || a.type === "break")
1799
- return t = !0, Ye;
1800
- }), !!((!e.depth || e.depth < 3) && er(e) && (r.options.setext || t));
1802
+ return t = !0, tt;
1803
+ }), !!((!e.depth || e.depth < 3) && tr(e) && (r.options.setext || t));
1801
1804
  }
1802
- function $n(e, r, t, a) {
1805
+ function jn(e, r, t, a) {
1803
1806
  const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(a);
1804
- if (jn(e, t)) {
1807
+ if (zn(e, t)) {
1805
1808
  const f = t.enter("headingSetext"), l = t.enter("phrasing"), p = t.containerPhrasing(e, {
1806
1809
  ...o.current(),
1807
1810
  before: `
@@ -1826,18 +1829,18 @@ function $n(e, r, t, a) {
1826
1829
  `,
1827
1830
  ...o.current()
1828
1831
  });
1829
- return /^[\t ]/.test(s) && (s = ke(s.charCodeAt(0)) + s.slice(1)), s = s ? n + " " + s : n, t.options.closeAtx && (s += " " + n), c(), u(), s;
1832
+ return /^[\t ]/.test(s) && (s = we(s.charCodeAt(0)) + s.slice(1)), s = s ? n + " " + s : n, t.options.closeAtx && (s += " " + n), c(), u(), s;
1830
1833
  }
1831
- rr.peek = On;
1832
- function rr(e) {
1834
+ ar.peek = $n;
1835
+ function ar(e) {
1833
1836
  return e.value || "";
1834
1837
  }
1835
- function On() {
1838
+ function $n() {
1836
1839
  return "<";
1837
1840
  }
1838
- ar.peek = Un;
1839
- function ar(e, r, t, a) {
1840
- const i = nt(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("image");
1841
+ nr.peek = On;
1842
+ function nr(e, r, t, a) {
1843
+ const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("image");
1841
1844
  let u = t.enter("label");
1842
1845
  const c = t.createTracker(a);
1843
1846
  let s = c.move("![");
@@ -1861,11 +1864,11 @@ function ar(e, r, t, a) {
1861
1864
  })
1862
1865
  ), s += c.move(i), u()), s += c.move(")"), n(), s;
1863
1866
  }
1864
- function Un() {
1867
+ function On() {
1865
1868
  return "!";
1866
1869
  }
1867
- nr.peek = Bn;
1868
- function nr(e, r, t, a) {
1870
+ ir.peek = Un;
1871
+ function ir(e, r, t, a) {
1869
1872
  const i = e.referenceType, o = t.enter("imageReference");
1870
1873
  let n = t.enter("label");
1871
1874
  const u = t.createTracker(a);
@@ -1885,11 +1888,11 @@ function nr(e, r, t, a) {
1885
1888
  });
1886
1889
  return n(), t.stack = f, o(), i === "full" || !s || s !== l ? c += u.move(l + "]") : i === "shortcut" ? c = c.slice(0, -1) : c += u.move("]"), c;
1887
1890
  }
1888
- function Bn() {
1891
+ function Un() {
1889
1892
  return "!";
1890
1893
  }
1891
- ir.peek = Wn;
1892
- function ir(e, r, t) {
1894
+ or.peek = Bn;
1895
+ function or(e, r, t) {
1893
1896
  let a = e.value || "", i = "`", o = -1;
1894
1897
  for (; new RegExp("(^|[^`])" + i + "([^`]|$)").test(a); )
1895
1898
  i += "`";
@@ -1904,11 +1907,11 @@ function ir(e, r, t) {
1904
1907
  }
1905
1908
  return i + a + i;
1906
1909
  }
1907
- function Wn() {
1910
+ function Bn() {
1908
1911
  return "`";
1909
1912
  }
1910
- function or(e, r) {
1911
- const t = er(e);
1913
+ function cr(e, r) {
1914
+ const t = tr(e);
1912
1915
  return !!(!r.options.resourceLink && // If there’s a url…
1913
1916
  e.url && // And there’s a no title…
1914
1917
  !e.title && // And the content of `node` is a single text node…
@@ -1918,11 +1921,11 @@ function or(e, r) {
1918
1921
  // references don’t work), space, or angle brackets…
1919
1922
  !/[\0- <>\u007F]/.test(e.url));
1920
1923
  }
1921
- cr.peek = qn;
1922
- function cr(e, r, t, a) {
1923
- const i = nt(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.createTracker(a);
1924
+ ur.peek = Wn;
1925
+ function ur(e, r, t, a) {
1926
+ const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.createTracker(a);
1924
1927
  let u, c;
1925
- if (or(e, t)) {
1928
+ if (cr(e, t)) {
1926
1929
  const f = t.stack;
1927
1930
  t.stack = [], u = t.enter("autolink");
1928
1931
  let l = n.move("<");
@@ -1960,11 +1963,11 @@ function cr(e, r, t, a) {
1960
1963
  })
1961
1964
  ), s += n.move(i), c()), s += n.move(")"), u(), s;
1962
1965
  }
1963
- function qn(e, r, t) {
1964
- return or(e, t) ? "<" : "[";
1966
+ function Wn(e, r, t) {
1967
+ return cr(e, t) ? "<" : "[";
1965
1968
  }
1966
- ur.peek = Hn;
1967
- function ur(e, r, t, a) {
1969
+ sr.peek = Hn;
1970
+ function sr(e, r, t, a) {
1968
1971
  const i = e.referenceType, o = t.enter("linkReference");
1969
1972
  let n = t.enter("label");
1970
1973
  const u = t.createTracker(a);
@@ -1987,7 +1990,7 @@ function ur(e, r, t, a) {
1987
1990
  function Hn() {
1988
1991
  return "[";
1989
1992
  }
1990
- function it(e) {
1993
+ function ct(e) {
1991
1994
  const r = e.options.bullet || "*";
1992
1995
  if (r !== "*" && r !== "+" && r !== "-")
1993
1996
  throw new Error(
@@ -1995,8 +1998,8 @@ function it(e) {
1995
1998
  );
1996
1999
  return r;
1997
2000
  }
1998
- function Vn(e) {
1999
- const r = it(e), t = e.options.bulletOther;
2001
+ function qn(e) {
2002
+ const r = ct(e), t = e.options.bulletOther;
2000
2003
  if (!t)
2001
2004
  return r === "*" ? "-" : "*";
2002
2005
  if (t !== "*" && t !== "+" && t !== "-")
@@ -2009,7 +2012,7 @@ function Vn(e) {
2009
2012
  );
2010
2013
  return t;
2011
2014
  }
2012
- function Xn(e) {
2015
+ function Vn(e) {
2013
2016
  const r = e.options.bulletOrdered || ".";
2014
2017
  if (r !== "." && r !== ")")
2015
2018
  throw new Error(
@@ -2017,7 +2020,7 @@ function Xn(e) {
2017
2020
  );
2018
2021
  return r;
2019
2022
  }
2020
- function sr(e) {
2023
+ function lr(e) {
2021
2024
  const r = e.options.rule || "*";
2022
2025
  if (r !== "*" && r !== "-" && r !== "_")
2023
2026
  throw new Error(
@@ -2025,10 +2028,10 @@ function sr(e) {
2025
2028
  );
2026
2029
  return r;
2027
2030
  }
2028
- function Kn(e, r, t, a) {
2031
+ function Xn(e, r, t, a) {
2029
2032
  const i = t.enter("list"), o = t.bulletCurrent;
2030
- let n = e.ordered ? Xn(t) : it(t);
2031
- const u = e.ordered ? n === "." ? ")" : "." : Vn(t);
2033
+ let n = e.ordered ? Vn(t) : ct(t);
2034
+ const u = e.ordered ? n === "." ? ")" : "." : qn(t);
2032
2035
  let c = r && t.bulletLastUsed ? n === t.bulletLastUsed : !1;
2033
2036
  if (!e.ordered) {
2034
2037
  const f = e.children ? e.children[0] : void 0;
@@ -2037,7 +2040,7 @@ function Kn(e, r, t, a) {
2037
2040
  (n === "*" || n === "-") && // Empty first list item:
2038
2041
  f && (!f.children || !f.children[0]) && // Directly in two other list items:
2039
2042
  t.stack[t.stack.length - 1] === "list" && t.stack[t.stack.length - 2] === "listItem" && t.stack[t.stack.length - 3] === "list" && t.stack[t.stack.length - 4] === "listItem" && // That are each the first child.
2040
- t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (c = !0), sr(t) === n && f
2043
+ t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (c = !0), lr(t) === n && f
2041
2044
  ) {
2042
2045
  let l = -1;
2043
2046
  for (; ++l < e.children.length; ) {
@@ -2053,7 +2056,7 @@ function Kn(e, r, t, a) {
2053
2056
  const s = t.containerFlow(e, a);
2054
2057
  return t.bulletLastUsed = n, t.bulletCurrent = o, i(), s;
2055
2058
  }
2056
- function Qn(e) {
2059
+ function Kn(e) {
2057
2060
  const r = e.options.listItemIndent || "one";
2058
2061
  if (r !== "tab" && r !== "one" && r !== "mixed")
2059
2062
  throw new Error(
@@ -2061,9 +2064,9 @@ function Qn(e) {
2061
2064
  );
2062
2065
  return r;
2063
2066
  }
2064
- function Gn(e, r, t, a) {
2065
- const i = Qn(t);
2066
- let o = t.bulletCurrent || it(t);
2067
+ function Qn(e, r, t, a) {
2068
+ const i = Kn(t);
2069
+ let o = t.bulletCurrent || ct(t);
2067
2070
  r && r.type === "list" && r.ordered && (o = (typeof r.start == "number" && r.start > -1 ? r.start : 1) + (t.options.incrementListMarker === !1 ? 0 : r.children.indexOf(e)) + o);
2068
2071
  let n = o.length + 1;
2069
2072
  (i === "tab" || i === "mixed" && (r && r.type === "list" && r.spread || e.spread)) && (n = Math.ceil(n / 4) * 4);
@@ -2074,17 +2077,17 @@ function Gn(e, r, t, a) {
2074
2077
  f
2075
2078
  );
2076
2079
  return c(), s;
2077
- function f(l, p, y) {
2078
- return p ? (y ? "" : " ".repeat(n)) + l : (y ? o : o + " ".repeat(n - o.length)) + l;
2080
+ function f(l, p, g) {
2081
+ return p ? (g ? "" : " ".repeat(n)) + l : (g ? o : o + " ".repeat(n - o.length)) + l;
2079
2082
  }
2080
2083
  }
2081
- function Zn(e, r, t, a) {
2084
+ function Gn(e, r, t, a) {
2082
2085
  const i = t.enter("paragraph"), o = t.enter("phrasing"), n = t.containerPhrasing(e, a);
2083
2086
  return o(), i(), n;
2084
2087
  }
2085
- const Jn = (
2088
+ const Zn = (
2086
2089
  /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
2087
- Fe([
2090
+ je([
2088
2091
  "break",
2089
2092
  "delete",
2090
2093
  "emphasis",
@@ -2108,12 +2111,12 @@ const Jn = (
2108
2111
  "textDirective"
2109
2112
  ])
2110
2113
  );
2111
- function Yn(e, r, t, a) {
2114
+ function Jn(e, r, t, a) {
2112
2115
  return (e.children.some(function(n) {
2113
- return Jn(n);
2116
+ return Zn(n);
2114
2117
  }) ? t.containerPhrasing : t.containerFlow).call(t, e, a);
2115
2118
  }
2116
- function ei(e) {
2119
+ function Yn(e) {
2117
2120
  const r = e.options.strong || "*";
2118
2121
  if (r !== "*" && r !== "_")
2119
2122
  throw new Error(
@@ -2121,9 +2124,9 @@ function ei(e) {
2121
2124
  );
2122
2125
  return r;
2123
2126
  }
2124
- lr.peek = ti;
2125
- function lr(e, r, t, a) {
2126
- const i = ei(t), o = t.enter("strong"), n = t.createTracker(a), u = n.move(i + i);
2127
+ dr.peek = ei;
2128
+ function dr(e, r, t, a) {
2129
+ const i = Yn(t), o = t.enter("strong"), n = t.createTracker(a), u = n.move(i + i);
2127
2130
  let c = n.move(
2128
2131
  t.containerPhrasing(e, {
2129
2132
  after: i,
@@ -2131,27 +2134,27 @@ function lr(e, r, t, a) {
2131
2134
  ...n.current()
2132
2135
  })
2133
2136
  );
2134
- const s = c.charCodeAt(0), f = _e(
2137
+ const s = c.charCodeAt(0), f = Ee(
2135
2138
  a.before.charCodeAt(a.before.length - 1),
2136
2139
  s,
2137
2140
  i
2138
2141
  );
2139
- f.inside && (c = ke(s) + c.slice(1));
2140
- const l = c.charCodeAt(c.length - 1), p = _e(a.after.charCodeAt(0), l, i);
2141
- p.inside && (c = c.slice(0, -1) + ke(l));
2142
- const y = n.move(i + i);
2142
+ f.inside && (c = we(s) + c.slice(1));
2143
+ const l = c.charCodeAt(c.length - 1), p = Ee(a.after.charCodeAt(0), l, i);
2144
+ p.inside && (c = c.slice(0, -1) + we(l));
2145
+ const g = n.move(i + i);
2143
2146
  return o(), t.attentionEncodeSurroundingInfo = {
2144
2147
  after: p.outside,
2145
2148
  before: f.outside
2146
- }, u + c + y;
2149
+ }, u + c + g;
2147
2150
  }
2148
- function ti(e, r, t) {
2151
+ function ei(e, r, t) {
2149
2152
  return t.options.strong || "*";
2150
2153
  }
2151
- function ri(e, r, t, a) {
2154
+ function ti(e, r, t, a) {
2152
2155
  return t.safe(e.value, a);
2153
2156
  }
2154
- function ai(e) {
2157
+ function ri(e) {
2155
2158
  const r = e.options.ruleRepetition || 3;
2156
2159
  if (r < 3)
2157
2160
  throw new Error(
@@ -2159,50 +2162,50 @@ function ai(e) {
2159
2162
  );
2160
2163
  return r;
2161
2164
  }
2162
- function ni(e, r, t) {
2163
- const a = (sr(t) + (t.options.ruleSpaces ? " " : "")).repeat(ai(t));
2165
+ function ai(e, r, t) {
2166
+ const a = (lr(t) + (t.options.ruleSpaces ? " " : "")).repeat(ri(t));
2164
2167
  return t.options.ruleSpaces ? a.slice(0, -1) : a;
2165
2168
  }
2166
- const dr = {
2167
- blockquote: Mn,
2168
- break: At,
2169
- code: Ln,
2170
- definition: Rn,
2171
- emphasis: Yt,
2172
- hardBreak: At,
2173
- heading: $n,
2174
- html: rr,
2175
- image: ar,
2176
- imageReference: nr,
2177
- inlineCode: ir,
2178
- link: cr,
2179
- linkReference: ur,
2180
- list: Kn,
2181
- listItem: Gn,
2182
- paragraph: Zn,
2183
- root: Yn,
2184
- strong: lr,
2185
- text: ri,
2186
- thematicBreak: ni
2169
+ const fr = {
2170
+ blockquote: Cn,
2171
+ break: It,
2172
+ code: Sn,
2173
+ definition: Pn,
2174
+ emphasis: er,
2175
+ hardBreak: It,
2176
+ heading: jn,
2177
+ html: ar,
2178
+ image: nr,
2179
+ imageReference: ir,
2180
+ inlineCode: or,
2181
+ link: ur,
2182
+ linkReference: sr,
2183
+ list: Xn,
2184
+ listItem: Qn,
2185
+ paragraph: Gn,
2186
+ root: Jn,
2187
+ strong: dr,
2188
+ text: ti,
2189
+ thematicBreak: ai
2187
2190
  };
2188
- function ii() {
2191
+ function ni() {
2189
2192
  return {
2190
2193
  enter: {
2191
- table: oi,
2192
- tableData: It,
2193
- tableHeader: It,
2194
- tableRow: ui
2194
+ table: ii,
2195
+ tableData: Lt,
2196
+ tableHeader: Lt,
2197
+ tableRow: ci
2195
2198
  },
2196
2199
  exit: {
2197
- codeText: si,
2198
- table: ci,
2199
- tableData: Xe,
2200
- tableHeader: Xe,
2201
- tableRow: Xe
2200
+ codeText: ui,
2201
+ table: oi,
2202
+ tableData: Qe,
2203
+ tableHeader: Qe,
2204
+ tableRow: Qe
2202
2205
  }
2203
2206
  };
2204
2207
  }
2205
- function oi(e) {
2208
+ function ii(e) {
2206
2209
  const r = e._align;
2207
2210
  this.enter(
2208
2211
  {
@@ -2215,28 +2218,28 @@ function oi(e) {
2215
2218
  e
2216
2219
  ), this.data.inTable = !0;
2217
2220
  }
2218
- function ci(e) {
2221
+ function oi(e) {
2219
2222
  this.exit(e), this.data.inTable = void 0;
2220
2223
  }
2221
- function ui(e) {
2224
+ function ci(e) {
2222
2225
  this.enter({ type: "tableRow", children: [] }, e);
2223
2226
  }
2224
- function Xe(e) {
2227
+ function Qe(e) {
2225
2228
  this.exit(e);
2226
2229
  }
2227
- function It(e) {
2230
+ function Lt(e) {
2228
2231
  this.enter({ type: "tableCell", children: [] }, e);
2229
2232
  }
2230
- function si(e) {
2233
+ function ui(e) {
2231
2234
  let r = this.resume();
2232
- this.data.inTable && (r = r.replace(/\\([\\|])/g, li));
2235
+ this.data.inTable && (r = r.replace(/\\([\\|])/g, si));
2233
2236
  const t = this.stack[this.stack.length - 1];
2234
2237
  t.type, t.value = r, this.exit(e);
2235
2238
  }
2236
- function li(e, r) {
2239
+ function si(e, r) {
2237
2240
  return r === "|" ? r : e;
2238
2241
  }
2239
- function di(e) {
2242
+ function li(e) {
2240
2243
  const r = e || {}, t = r.tableCellPadding, a = r.tablePipeAlign, i = r.stringLength, o = t ? " " : "|";
2241
2244
  return {
2242
2245
  unsafe: [
@@ -2265,24 +2268,24 @@ function di(e) {
2265
2268
  tableRow: u
2266
2269
  }
2267
2270
  };
2268
- function n(y, m, x, g) {
2269
- return s(f(y, x, g), y.align);
2271
+ function n(g, m, x, b) {
2272
+ return s(f(g, x, b), g.align);
2270
2273
  }
2271
- function u(y, m, x, g) {
2272
- const b = l(y, x, g), k = s([b]);
2274
+ function u(g, m, x, b) {
2275
+ const y = l(g, x, b), k = s([y]);
2273
2276
  return k.slice(0, k.indexOf(`
2274
2277
  `));
2275
2278
  }
2276
- function c(y, m, x, g) {
2277
- const b = x.enter("tableCell"), k = x.enter("phrasing"), M = x.containerPhrasing(y, {
2278
- ...g,
2279
+ function c(g, m, x, b) {
2280
+ const y = x.enter("tableCell"), k = x.enter("phrasing"), T = x.containerPhrasing(g, {
2281
+ ...b,
2279
2282
  before: o,
2280
2283
  after: o
2281
2284
  });
2282
- return k(), b(), M;
2285
+ return k(), y(), T;
2283
2286
  }
2284
- function s(y, m) {
2285
- return vn(y, {
2287
+ function s(g, m) {
2288
+ return wn(g, {
2286
2289
  align: m,
2287
2290
  // @ts-expect-error: `markdown-table` types should support `null`.
2288
2291
  alignDelimiters: a,
@@ -2292,47 +2295,47 @@ function di(e) {
2292
2295
  stringLength: i
2293
2296
  });
2294
2297
  }
2295
- function f(y, m, x) {
2296
- const g = y.children;
2297
- let b = -1;
2298
- const k = [], M = m.enter("table");
2299
- for (; ++b < g.length; )
2300
- k[b] = l(g[b], m, x);
2301
- return M(), k;
2298
+ function f(g, m, x) {
2299
+ const b = g.children;
2300
+ let y = -1;
2301
+ const k = [], T = m.enter("table");
2302
+ for (; ++y < b.length; )
2303
+ k[y] = l(b[y], m, x);
2304
+ return T(), k;
2302
2305
  }
2303
- function l(y, m, x) {
2304
- const g = y.children;
2305
- let b = -1;
2306
- const k = [], M = m.enter("tableRow");
2307
- for (; ++b < g.length; )
2308
- k[b] = c(g[b], y, m, x);
2309
- return M(), k;
2306
+ function l(g, m, x) {
2307
+ const b = g.children;
2308
+ let y = -1;
2309
+ const k = [], T = m.enter("tableRow");
2310
+ for (; ++y < b.length; )
2311
+ k[y] = c(b[y], g, m, x);
2312
+ return T(), k;
2310
2313
  }
2311
- function p(y, m, x) {
2312
- let g = dr.inlineCode(y, m, x);
2313
- return x.stack.includes("tableCell") && (g = g.replace(/\|/g, "\\$&")), g;
2314
+ function p(g, m, x) {
2315
+ let b = fr.inlineCode(g, m, x);
2316
+ return x.stack.includes("tableCell") && (b = b.replace(/\|/g, "\\$&")), b;
2314
2317
  }
2315
2318
  }
2316
- function fi() {
2319
+ function di() {
2317
2320
  return {
2318
2321
  exit: {
2319
- taskListCheckValueChecked: St,
2320
- taskListCheckValueUnchecked: St,
2321
- paragraph: mi
2322
+ taskListCheckValueChecked: Pt,
2323
+ taskListCheckValueUnchecked: Pt,
2324
+ paragraph: hi
2322
2325
  }
2323
2326
  };
2324
2327
  }
2325
- function hi() {
2328
+ function fi() {
2326
2329
  return {
2327
2330
  unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
2328
- handlers: { listItem: pi }
2331
+ handlers: { listItem: mi }
2329
2332
  };
2330
2333
  }
2331
- function St(e) {
2334
+ function Pt(e) {
2332
2335
  const r = this.stack[this.stack.length - 2];
2333
2336
  r.type, r.checked = e.type === "taskListCheckValueChecked";
2334
2337
  }
2335
- function mi(e) {
2338
+ function hi(e) {
2336
2339
  const r = this.stack[this.stack.length - 2];
2337
2340
  if (r && r.type === "listItem" && typeof r.checked == "boolean") {
2338
2341
  const t = this.stack[this.stack.length - 1];
@@ -2353,10 +2356,10 @@ function mi(e) {
2353
2356
  }
2354
2357
  this.exit(e);
2355
2358
  }
2356
- function pi(e, r, t, a) {
2359
+ function mi(e, r, t, a) {
2357
2360
  const i = e.children[0], o = typeof e.checked == "boolean" && i && i.type === "paragraph", n = "[" + (e.checked ? "x" : " ") + "] ", u = t.createTracker(a);
2358
2361
  o && u.move(n);
2359
- let c = dr.listItem(e, r, t, {
2362
+ let c = fr.listItem(e, r, t, {
2360
2363
  ...a,
2361
2364
  ...u.current()
2362
2365
  });
@@ -2365,27 +2368,27 @@ function pi(e, r, t, a) {
2365
2368
  return f + n;
2366
2369
  }
2367
2370
  }
2368
- function gi() {
2371
+ function pi() {
2369
2372
  return [
2370
- qa(),
2371
- fn(),
2372
- gn(),
2373
- ii(),
2374
- fi()
2373
+ Wa(),
2374
+ dn(),
2375
+ pn(),
2376
+ ni(),
2377
+ di()
2375
2378
  ];
2376
2379
  }
2377
- function bi(e) {
2380
+ function gi(e) {
2378
2381
  return {
2379
2382
  extensions: [
2380
2383
  Ha(),
2381
- hn(e),
2382
- bn(),
2383
- di(e),
2384
- hi()
2384
+ fn(e),
2385
+ gn(),
2386
+ li(e),
2387
+ fi()
2385
2388
  ]
2386
2389
  };
2387
2390
  }
2388
- function Le(e, r, t, a) {
2391
+ function Re(e, r, t, a) {
2389
2392
  const i = e.length;
2390
2393
  let o = 0, n;
2391
2394
  if (r < 0 ? r = -r > i ? 0 : i + r : r = r > i ? i : r, t = t > 0 ? t : 0, a.length < 1e4)
@@ -2394,24 +2397,24 @@ function Le(e, r, t, a) {
2394
2397
  for (t && e.splice(r, t); o < a.length; )
2395
2398
  n = a.slice(o, o + 1e4), n.unshift(r, 0), e.splice(...n), o += 1e4, r += 1e4;
2396
2399
  }
2397
- const Lt = {}.hasOwnProperty;
2398
- function yi(e) {
2400
+ const Rt = {}.hasOwnProperty;
2401
+ function bi(e) {
2399
2402
  const r = {};
2400
2403
  let t = -1;
2401
2404
  for (; ++t < e.length; )
2402
- xi(r, e[t]);
2405
+ yi(r, e[t]);
2403
2406
  return r;
2404
2407
  }
2405
- function xi(e, r) {
2408
+ function yi(e, r) {
2406
2409
  let t;
2407
2410
  for (t in r) {
2408
- const i = (Lt.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
2411
+ const i = (Rt.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
2409
2412
  let n;
2410
2413
  if (o)
2411
2414
  for (n in o) {
2412
- Lt.call(i, n) || (i[n] = []);
2415
+ Rt.call(i, n) || (i[n] = []);
2413
2416
  const u = o[n];
2414
- ki(
2417
+ xi(
2415
2418
  // @ts-expect-error Looks like a list.
2416
2419
  i[n],
2417
2420
  Array.isArray(u) ? u : u ? [u] : []
@@ -2419,96 +2422,96 @@ function xi(e, r) {
2419
2422
  }
2420
2423
  }
2421
2424
  }
2422
- function ki(e, r) {
2425
+ function xi(e, r) {
2423
2426
  let t = -1;
2424
2427
  const a = [];
2425
2428
  for (; ++t < r.length; )
2426
2429
  (r[t].add === "after" ? e : a).push(r[t]);
2427
- Le(e, 0, 0, a);
2430
+ Re(e, 0, 0, a);
2428
2431
  }
2429
- const wi = {
2432
+ const ki = {
2433
+ tokenize: Ai,
2434
+ partial: !0
2435
+ }, hr = {
2430
2436
  tokenize: Ni,
2431
2437
  partial: !0
2432
- }, fr = {
2438
+ }, mr = {
2433
2439
  tokenize: Ii,
2434
2440
  partial: !0
2435
- }, hr = {
2441
+ }, pr = {
2436
2442
  tokenize: Si,
2437
2443
  partial: !0
2438
- }, mr = {
2444
+ }, wi = {
2439
2445
  tokenize: Li,
2440
2446
  partial: !0
2441
- }, vi = {
2442
- tokenize: Pi,
2443
- partial: !0
2444
- }, pr = {
2447
+ }, gr = {
2445
2448
  name: "wwwAutolink",
2446
2449
  tokenize: Ti,
2447
- previous: br
2448
- }, gr = {
2449
- name: "protocolAutolink",
2450
- tokenize: Ai,
2451
2450
  previous: yr
2452
- }, Y = {
2453
- name: "emailAutolink",
2451
+ }, br = {
2452
+ name: "protocolAutolink",
2454
2453
  tokenize: Mi,
2455
2454
  previous: xr
2456
- }, V = {};
2457
- function Ci() {
2455
+ }, Y = {
2456
+ name: "emailAutolink",
2457
+ tokenize: Ci,
2458
+ previous: kr
2459
+ }, K = {};
2460
+ function vi() {
2458
2461
  return {
2459
- text: V
2462
+ text: K
2460
2463
  };
2461
2464
  }
2462
2465
  let ne = 48;
2463
2466
  for (; ne < 123; )
2464
- V[ne] = Y, ne++, ne === 58 ? ne = 65 : ne === 91 && (ne = 97);
2465
- V[43] = Y;
2466
- V[45] = Y;
2467
- V[46] = Y;
2468
- V[95] = Y;
2469
- V[72] = [Y, gr];
2470
- V[104] = [Y, gr];
2471
- V[87] = [Y, pr];
2472
- V[119] = [Y, pr];
2473
- function Mi(e, r, t) {
2467
+ K[ne] = Y, ne++, ne === 58 ? ne = 65 : ne === 91 && (ne = 97);
2468
+ K[43] = Y;
2469
+ K[45] = Y;
2470
+ K[46] = Y;
2471
+ K[95] = Y;
2472
+ K[72] = [Y, br];
2473
+ K[104] = [Y, br];
2474
+ K[87] = [Y, gr];
2475
+ K[119] = [Y, gr];
2476
+ function Ci(e, r, t) {
2474
2477
  const a = this;
2475
2478
  let i, o;
2476
2479
  return n;
2477
2480
  function n(l) {
2478
- return !et(l) || !xr.call(a, a.previous) || ot(a.events) ? t(l) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(l));
2481
+ return !rt(l) || !kr.call(a, a.previous) || ut(a.events) ? t(l) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(l));
2479
2482
  }
2480
2483
  function u(l) {
2481
- return et(l) ? (e.consume(l), u) : l === 64 ? (e.consume(l), c) : t(l);
2484
+ return rt(l) ? (e.consume(l), u) : l === 64 ? (e.consume(l), c) : t(l);
2482
2485
  }
2483
2486
  function c(l) {
2484
- return l === 46 ? e.check(vi, f, s)(l) : l === 45 || l === 95 || at(l) ? (o = !0, e.consume(l), c) : f(l);
2487
+ return l === 46 ? e.check(wi, f, s)(l) : l === 45 || l === 95 || it(l) ? (o = !0, e.consume(l), c) : f(l);
2485
2488
  }
2486
2489
  function s(l) {
2487
2490
  return e.consume(l), i = !0, c;
2488
2491
  }
2489
2492
  function f(l) {
2490
- return o && i && xe(a.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(l)) : t(l);
2493
+ return o && i && ke(a.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(l)) : t(l);
2491
2494
  }
2492
2495
  }
2493
2496
  function Ti(e, r, t) {
2494
2497
  const a = this;
2495
2498
  return i;
2496
2499
  function i(n) {
2497
- return n !== 87 && n !== 119 || !br.call(a, a.previous) || ot(a.events) ? t(n) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(wi, e.attempt(fr, e.attempt(hr, o), t), t)(n));
2500
+ return n !== 87 && n !== 119 || !yr.call(a, a.previous) || ut(a.events) ? t(n) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(ki, e.attempt(hr, e.attempt(mr, o), t), t)(n));
2498
2501
  }
2499
2502
  function o(n) {
2500
2503
  return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(n);
2501
2504
  }
2502
2505
  }
2503
- function Ai(e, r, t) {
2506
+ function Mi(e, r, t) {
2504
2507
  const a = this;
2505
2508
  let i = "", o = !1;
2506
2509
  return n;
2507
2510
  function n(l) {
2508
- return (l === 72 || l === 104) && yr.call(a, a.previous) && !ot(a.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(l), e.consume(l), u) : t(l);
2511
+ return (l === 72 || l === 104) && xr.call(a, a.previous) && !ut(a.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(l), e.consume(l), u) : t(l);
2509
2512
  }
2510
2513
  function u(l) {
2511
- if (xe(l) && i.length < 5)
2514
+ if (ke(l) && i.length < 5)
2512
2515
  return i += String.fromCodePoint(l), e.consume(l), u;
2513
2516
  if (l === 58) {
2514
2517
  const p = i.toLowerCase();
@@ -2521,13 +2524,13 @@ function Ai(e, r, t) {
2521
2524
  return l === 47 ? (e.consume(l), o ? s : (o = !0, c)) : t(l);
2522
2525
  }
2523
2526
  function s(l) {
2524
- return l === null || La(l) || B(l) || oe(l) || De(l) ? t(l) : e.attempt(fr, e.attempt(hr, f), t)(l);
2527
+ return l === null || Sa(l) || B(l) || oe(l) || Fe(l) ? t(l) : e.attempt(hr, e.attempt(mr, f), t)(l);
2525
2528
  }
2526
2529
  function f(l) {
2527
2530
  return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(l);
2528
2531
  }
2529
2532
  }
2530
- function Ni(e, r, t) {
2533
+ function Ai(e, r, t) {
2531
2534
  let a = 0;
2532
2535
  return i;
2533
2536
  function i(n) {
@@ -2537,11 +2540,11 @@ function Ni(e, r, t) {
2537
2540
  return n === null ? t(n) : r(n);
2538
2541
  }
2539
2542
  }
2540
- function Ii(e, r, t) {
2543
+ function Ni(e, r, t) {
2541
2544
  let a, i, o;
2542
2545
  return n;
2543
2546
  function n(s) {
2544
- return s === 46 || s === 95 ? e.check(mr, c, u)(s) : s === null || B(s) || oe(s) || s !== 45 && De(s) ? c(s) : (o = !0, e.consume(s), n);
2547
+ return s === 46 || s === 95 ? e.check(pr, c, u)(s) : s === null || B(s) || oe(s) || s !== 45 && Fe(s) ? c(s) : (o = !0, e.consume(s), n);
2545
2548
  }
2546
2549
  function u(s) {
2547
2550
  return s === 95 ? a = !0 : (i = a, a = void 0), e.consume(s), n;
@@ -2550,17 +2553,17 @@ function Ii(e, r, t) {
2550
2553
  return i || a || !o ? t(s) : r(s);
2551
2554
  }
2552
2555
  }
2553
- function Si(e, r) {
2556
+ function Ii(e, r) {
2554
2557
  let t = 0, a = 0;
2555
2558
  return i;
2556
2559
  function i(n) {
2557
- return n === 40 ? (t++, e.consume(n), i) : n === 41 && a < t ? o(n) : n === 33 || n === 34 || n === 38 || n === 39 || n === 41 || n === 42 || n === 44 || n === 46 || n === 58 || n === 59 || n === 60 || n === 63 || n === 93 || n === 95 || n === 126 ? e.check(mr, r, o)(n) : n === null || B(n) || oe(n) ? r(n) : (e.consume(n), i);
2560
+ return n === 40 ? (t++, e.consume(n), i) : n === 41 && a < t ? o(n) : n === 33 || n === 34 || n === 38 || n === 39 || n === 41 || n === 42 || n === 44 || n === 46 || n === 58 || n === 59 || n === 60 || n === 63 || n === 93 || n === 95 || n === 126 ? e.check(pr, r, o)(n) : n === null || B(n) || oe(n) ? r(n) : (e.consume(n), i);
2558
2561
  }
2559
2562
  function o(n) {
2560
2563
  return n === 41 && a++, e.consume(n), i;
2561
2564
  }
2562
2565
  }
2563
- function Li(e, r, t) {
2566
+ function Si(e, r, t) {
2564
2567
  return a;
2565
2568
  function a(u) {
2566
2569
  return u === 33 || u === 34 || u === 39 || u === 41 || u === 42 || u === 44 || u === 46 || u === 58 || u === 59 || u === 63 || u === 95 || u === 126 ? (e.consume(u), a) : u === 38 ? (e.consume(u), o) : u === 93 ? (e.consume(u), i) : (
@@ -2573,34 +2576,34 @@ function Li(e, r, t) {
2573
2576
  return u === null || u === 40 || u === 91 || B(u) || oe(u) ? r(u) : a(u);
2574
2577
  }
2575
2578
  function o(u) {
2576
- return xe(u) ? n(u) : t(u);
2579
+ return ke(u) ? n(u) : t(u);
2577
2580
  }
2578
2581
  function n(u) {
2579
- return u === 59 ? (e.consume(u), a) : xe(u) ? (e.consume(u), n) : t(u);
2582
+ return u === 59 ? (e.consume(u), a) : ke(u) ? (e.consume(u), n) : t(u);
2580
2583
  }
2581
2584
  }
2582
- function Pi(e, r, t) {
2585
+ function Li(e, r, t) {
2583
2586
  return a;
2584
2587
  function a(o) {
2585
2588
  return e.consume(o), i;
2586
2589
  }
2587
2590
  function i(o) {
2588
- return at(o) ? t(o) : r(o);
2591
+ return it(o) ? t(o) : r(o);
2589
2592
  }
2590
2593
  }
2591
- function br(e) {
2592
- return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || B(e);
2593
- }
2594
2594
  function yr(e) {
2595
- return !xe(e);
2595
+ return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || B(e);
2596
2596
  }
2597
2597
  function xr(e) {
2598
- return !(e === 47 || et(e));
2598
+ return !ke(e);
2599
2599
  }
2600
- function et(e) {
2601
- return e === 43 || e === 45 || e === 46 || e === 95 || at(e);
2600
+ function kr(e) {
2601
+ return !(e === 47 || rt(e));
2602
2602
  }
2603
- function ot(e) {
2603
+ function rt(e) {
2604
+ return e === 43 || e === 45 || e === 46 || e === 95 || it(e);
2605
+ }
2606
+ function ut(e) {
2604
2607
  let r = e.length, t = !1;
2605
2608
  for (; r--; ) {
2606
2609
  const a = e[r][1];
@@ -2615,7 +2618,7 @@ function ot(e) {
2615
2618
  }
2616
2619
  return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
2617
2620
  }
2618
- function Ri(e, r, t) {
2621
+ function Pi(e, r, t) {
2619
2622
  const a = [];
2620
2623
  let i = -1;
2621
2624
  for (; ++i < e.length; ) {
@@ -2635,7 +2638,7 @@ function Z(e, r, t, a) {
2635
2638
  return G(c) && o++ < i ? (e.consume(c), u) : (e.exit(t), r(c));
2636
2639
  }
2637
2640
  }
2638
- const _i = {
2641
+ const Ri = {
2639
2642
  partial: !0,
2640
2643
  tokenize: Di
2641
2644
  };
@@ -2648,37 +2651,37 @@ function Di(e, r, t) {
2648
2651
  return o === null || fe(o) ? r(o) : t(o);
2649
2652
  }
2650
2653
  }
2651
- const Ei = {
2652
- tokenize: Wi,
2654
+ const _i = {
2655
+ tokenize: Bi,
2653
2656
  partial: !0
2654
2657
  };
2655
- function Fi() {
2658
+ function Ei() {
2656
2659
  return {
2657
2660
  document: {
2658
2661
  91: {
2659
2662
  name: "gfmFootnoteDefinition",
2660
- tokenize: Oi,
2663
+ tokenize: $i,
2661
2664
  continuation: {
2662
- tokenize: Ui
2665
+ tokenize: Oi
2663
2666
  },
2664
- exit: Bi
2667
+ exit: Ui
2665
2668
  }
2666
2669
  },
2667
2670
  text: {
2668
2671
  91: {
2669
2672
  name: "gfmFootnoteCall",
2670
- tokenize: $i
2673
+ tokenize: ji
2671
2674
  },
2672
2675
  93: {
2673
2676
  name: "gfmPotentialFootnoteCall",
2674
2677
  add: "after",
2675
- tokenize: zi,
2676
- resolveTo: ji
2678
+ tokenize: Fi,
2679
+ resolveTo: zi
2677
2680
  }
2678
2681
  }
2679
2682
  };
2680
2683
  }
2681
- function zi(e, r, t) {
2684
+ function Fi(e, r, t) {
2682
2685
  const a = this;
2683
2686
  let i = a.events.length;
2684
2687
  const o = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
@@ -2696,14 +2699,14 @@ function zi(e, r, t) {
2696
2699
  function u(c) {
2697
2700
  if (!n || !n._balanced)
2698
2701
  return t(c);
2699
- const s = ve(a.sliceSerialize({
2702
+ const s = Ce(a.sliceSerialize({
2700
2703
  start: n.end,
2701
2704
  end: a.now()
2702
2705
  }));
2703
2706
  return s.codePointAt(0) !== 94 || !o.includes(s.slice(1)) ? t(c) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), r(c));
2704
2707
  }
2705
2708
  }
2706
- function ji(e, r) {
2709
+ function zi(e, r) {
2707
2710
  let t = e.length;
2708
2711
  for (; t--; )
2709
2712
  if (e[t][1].type === "labelImage" && e[t][0] === "enter") {
@@ -2753,7 +2756,7 @@ function ji(e, r) {
2753
2756
  ];
2754
2757
  return e.splice(t, e.length - t + 1, ...u), e;
2755
2758
  }
2756
- function $i(e, r, t) {
2759
+ function ji(e, r, t) {
2757
2760
  const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
2758
2761
  let o = 0, n;
2759
2762
  return u;
@@ -2775,7 +2778,7 @@ function $i(e, r, t) {
2775
2778
  if (l === 93) {
2776
2779
  e.exit("chunkString");
2777
2780
  const p = e.exit("gfmFootnoteCallString");
2778
- return i.includes(ve(a.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(l);
2781
+ return i.includes(Ce(a.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(l);
2779
2782
  }
2780
2783
  return B(l) || (n = !0), o++, e.consume(l), l === 92 ? f : s;
2781
2784
  }
@@ -2783,7 +2786,7 @@ function $i(e, r, t) {
2783
2786
  return l === 91 || l === 92 || l === 93 ? (e.consume(l), o++, s) : s(l);
2784
2787
  }
2785
2788
  }
2786
- function Oi(e, r, t) {
2789
+ function $i(e, r, t) {
2787
2790
  const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
2788
2791
  let o, n = 0, u;
2789
2792
  return c;
@@ -2805,7 +2808,7 @@ function Oi(e, r, t) {
2805
2808
  if (m === 93) {
2806
2809
  e.exit("chunkString");
2807
2810
  const x = e.exit("gfmFootnoteDefinitionLabelString");
2808
- return o = ve(a.sliceSerialize(x)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(m), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2811
+ return o = Ce(a.sliceSerialize(x)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(m), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2809
2812
  }
2810
2813
  return B(m) || (u = !0), n++, e.consume(m), m === 92 ? l : f;
2811
2814
  }
@@ -2813,19 +2816,19 @@ function Oi(e, r, t) {
2813
2816
  return m === 91 || m === 92 || m === 93 ? (e.consume(m), n++, f) : f(m);
2814
2817
  }
2815
2818
  function p(m) {
2816
- return m === 58 ? (e.enter("definitionMarker"), e.consume(m), e.exit("definitionMarker"), i.includes(o) || i.push(o), Z(e, y, "gfmFootnoteDefinitionWhitespace")) : t(m);
2819
+ return m === 58 ? (e.enter("definitionMarker"), e.consume(m), e.exit("definitionMarker"), i.includes(o) || i.push(o), Z(e, g, "gfmFootnoteDefinitionWhitespace")) : t(m);
2817
2820
  }
2818
- function y(m) {
2821
+ function g(m) {
2819
2822
  return r(m);
2820
2823
  }
2821
2824
  }
2822
- function Ui(e, r, t) {
2823
- return e.check(_i, r, e.attempt(Ei, r, t));
2825
+ function Oi(e, r, t) {
2826
+ return e.check(Ri, r, e.attempt(_i, r, t));
2824
2827
  }
2825
- function Bi(e) {
2828
+ function Ui(e) {
2826
2829
  e.exit("gfmFootnoteDefinition");
2827
2830
  }
2828
- function Wi(e, r, t) {
2831
+ function Bi(e, r, t) {
2829
2832
  const a = this;
2830
2833
  return Z(e, i, "gfmFootnoteDefinitionIndent", 5);
2831
2834
  function i(o) {
@@ -2833,7 +2836,7 @@ function Wi(e, r, t) {
2833
2836
  return n && n[1].type === "gfmFootnoteDefinitionIndent" && n[2].sliceSerialize(n[1], !0).length === 4 ? r(o) : t(o);
2834
2837
  }
2835
2838
  }
2836
- function qi(e) {
2839
+ function Wi(e) {
2837
2840
  let t = (e || {}).singleTilde;
2838
2841
  const a = {
2839
2842
  name: "strikethrough",
@@ -2868,8 +2871,8 @@ function qi(e) {
2868
2871
  type: "strikethroughText",
2869
2872
  start: Object.assign({}, n[s][1].end),
2870
2873
  end: Object.assign({}, n[c][1].start)
2871
- }, p = [["enter", f, u], ["enter", n[s][1], u], ["exit", n[s][1], u], ["enter", l, u]], y = u.parser.constructs.insideSpan.null;
2872
- y && Le(p, p.length, 0, Ri(y, n.slice(s + 1, c), u)), Le(p, p.length, 0, [["exit", l, u], ["enter", n[c][1], u], ["exit", n[c][1], u], ["exit", f, u]]), Le(n, s - 1, c - s + 3, p), c = s + p.length - 2;
2874
+ }, p = [["enter", f, u], ["enter", n[s][1], u], ["exit", n[s][1], u], ["enter", l, u]], g = u.parser.constructs.insideSpan.null;
2875
+ g && Re(p, p.length, 0, Pi(g, n.slice(s + 1, c), u)), Re(p, p.length, 0, [["exit", l, u], ["enter", n[c][1], u], ["exit", n[c][1], u], ["exit", f, u]]), Re(n, s - 1, c - s + 3, p), c = s + p.length - 2;
2873
2876
  break;
2874
2877
  }
2875
2878
  }
@@ -2882,15 +2885,15 @@ function qi(e) {
2882
2885
  let l = 0;
2883
2886
  return p;
2884
2887
  function p(m) {
2885
- return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? c(m) : (n.enter("strikethroughSequenceTemporary"), y(m));
2888
+ return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? c(m) : (n.enter("strikethroughSequenceTemporary"), g(m));
2886
2889
  }
2887
- function y(m) {
2888
- const x = Re(s);
2890
+ function g(m) {
2891
+ const x = _e(s);
2889
2892
  if (m === 126)
2890
- return l > 1 ? c(m) : (n.consume(m), l++, y);
2893
+ return l > 1 ? c(m) : (n.consume(m), l++, g);
2891
2894
  if (l < 2 && !t) return c(m);
2892
- const g = n.exit("strikethroughSequenceTemporary"), b = Re(m);
2893
- return g._open = !b || b === 2 && !!x, g._close = !x || x === 2 && !!b, u(m);
2895
+ const b = n.exit("strikethroughSequenceTemporary"), y = _e(m);
2896
+ return b._open = !y || y === 2 && !!x, b._close = !x || x === 2 && !!y, u(m);
2894
2897
  }
2895
2898
  }
2896
2899
  }
@@ -2910,7 +2913,7 @@ class Hi {
2910
2913
  * @returns {undefined}
2911
2914
  */
2912
2915
  add(r, t, a) {
2913
- Vi(this, r, t, a);
2916
+ qi(this, r, t, a);
2914
2917
  }
2915
2918
  // To do: add this when moving to `micromark`.
2916
2919
  // /**
@@ -2949,7 +2952,7 @@ class Hi {
2949
2952
  this.map.length = 0;
2950
2953
  }
2951
2954
  }
2952
- function Vi(e, r, t, a) {
2955
+ function qi(e, r, t, a) {
2953
2956
  let i = 0;
2954
2957
  if (!(t === 0 && a.length === 0)) {
2955
2958
  for (; i < e.map.length; ) {
@@ -2962,7 +2965,7 @@ function Vi(e, r, t, a) {
2962
2965
  e.map.push([r, t, a]);
2963
2966
  }
2964
2967
  }
2965
- function Xi(e, r) {
2968
+ function Vi(e, r) {
2966
2969
  let t = !1;
2967
2970
  const a = [];
2968
2971
  for (; r < e.length; ) {
@@ -2982,31 +2985,31 @@ function Xi(e, r) {
2982
2985
  }
2983
2986
  return a;
2984
2987
  }
2985
- function Ki() {
2988
+ function Xi() {
2986
2989
  return {
2987
2990
  flow: {
2988
2991
  null: {
2989
2992
  name: "table",
2990
- tokenize: Qi,
2991
- resolveAll: Gi
2993
+ tokenize: Ki,
2994
+ resolveAll: Qi
2992
2995
  }
2993
2996
  }
2994
2997
  };
2995
2998
  }
2996
- function Qi(e, r, t) {
2999
+ function Ki(e, r, t) {
2997
3000
  const a = this;
2998
3001
  let i = 0, o = 0, n;
2999
3002
  return u;
3000
3003
  function u(h) {
3001
- let U = a.events.length - 1;
3002
- for (; U > -1; ) {
3003
- const ee = a.events[U][1].type;
3004
- if (ee === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
3005
- ee === "linePrefix") U--;
3004
+ let _ = a.events.length - 1;
3005
+ for (; _ > -1; ) {
3006
+ const te = a.events[_][1].type;
3007
+ if (te === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
3008
+ te === "linePrefix") _--;
3006
3009
  else break;
3007
3010
  }
3008
- const W = U > -1 ? a.events[U][1].type : null, X = W === "tableHead" || W === "tableRow" ? C : c;
3009
- return X === C && a.parser.lazy[a.now().line] ? t(h) : X(h);
3011
+ const H = _ > -1 ? a.events[_][1].type : null, W = H === "tableHead" || H === "tableRow" ? C : c;
3012
+ return W === C && a.parser.lazy[a.now().line] ? t(h) : W(h);
3010
3013
  }
3011
3014
  function c(h) {
3012
3015
  return e.enter("tableHead"), e.enter("tableRow"), s(h);
@@ -3015,7 +3018,7 @@ function Qi(e, r, t) {
3015
3018
  return h === 124 || (n = !0, o += 1), f(h);
3016
3019
  }
3017
3020
  function f(h) {
3018
- return h === null ? t(h) : fe(h) ? o > 1 ? (o = 0, a.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"), y) : t(h) : G(h) ? Z(e, f, "whitespace")(h) : (o += 1, n && (n = !1, i += 1), h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), n = !0, f) : (e.enter("data"), l(h)));
3021
+ return h === null ? t(h) : fe(h) ? o > 1 ? (o = 0, a.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"), g) : t(h) : G(h) ? Z(e, f, "whitespace")(h) : (o += 1, n && (n = !1, i += 1), h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), n = !0, f) : (e.enter("data"), l(h)));
3019
3022
  }
3020
3023
  function l(h) {
3021
3024
  return h === null || h === 124 || B(h) ? (e.exit("data"), f(h)) : (e.consume(h), h === 92 ? p : l);
@@ -3023,52 +3026,52 @@ function Qi(e, r, t) {
3023
3026
  function p(h) {
3024
3027
  return h === 92 || h === 124 ? (e.consume(h), l) : l(h);
3025
3028
  }
3026
- function y(h) {
3029
+ function g(h) {
3027
3030
  return a.interrupt = !1, a.parser.lazy[a.now().line] ? t(h) : (e.enter("tableDelimiterRow"), n = !1, G(h) ? Z(e, m, "linePrefix", a.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(h) : m(h));
3028
3031
  }
3029
3032
  function m(h) {
3030
- return h === 45 || h === 58 ? g(h) : h === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), x) : L(h);
3033
+ return h === 45 || h === 58 ? b(h) : h === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), x) : I(h);
3031
3034
  }
3032
3035
  function x(h) {
3033
- return G(h) ? Z(e, g, "whitespace")(h) : g(h);
3034
- }
3035
- function g(h) {
3036
- return h === 58 ? (o += 1, n = !0, e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), b) : h === 45 ? (o += 1, b(h)) : h === null || fe(h) ? S(h) : L(h);
3036
+ return G(h) ? Z(e, b, "whitespace")(h) : b(h);
3037
3037
  }
3038
3038
  function b(h) {
3039
- return h === 45 ? (e.enter("tableDelimiterFiller"), k(h)) : L(h);
3039
+ return h === 58 ? (o += 1, n = !0, e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), y) : h === 45 ? (o += 1, y(h)) : h === null || fe(h) ? L(h) : I(h);
3040
3040
  }
3041
- function k(h) {
3042
- return h === 45 ? (e.consume(h), k) : h === 58 ? (n = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), M) : (e.exit("tableDelimiterFiller"), M(h));
3041
+ function y(h) {
3042
+ return h === 45 ? (e.enter("tableDelimiterFiller"), k(h)) : I(h);
3043
3043
  }
3044
- function M(h) {
3045
- return G(h) ? Z(e, S, "whitespace")(h) : S(h);
3044
+ function k(h) {
3045
+ return h === 45 ? (e.consume(h), k) : h === 58 ? (n = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), T) : (e.exit("tableDelimiterFiller"), T(h));
3046
3046
  }
3047
- function S(h) {
3048
- return h === 124 ? m(h) : h === null || fe(h) ? !n || i !== o ? L(h) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(h)) : L(h);
3047
+ function T(h) {
3048
+ return G(h) ? Z(e, L, "whitespace")(h) : L(h);
3049
3049
  }
3050
3050
  function L(h) {
3051
+ return h === 124 ? m(h) : h === null || fe(h) ? !n || i !== o ? I(h) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(h)) : I(h);
3052
+ }
3053
+ function I(h) {
3051
3054
  return t(h);
3052
3055
  }
3053
3056
  function C(h) {
3054
- return e.enter("tableRow"), A(h);
3057
+ return e.enter("tableRow"), D(h);
3058
+ }
3059
+ function D(h) {
3060
+ return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), D) : h === null || fe(h) ? (e.exit("tableRow"), r(h)) : G(h) ? Z(e, D, "whitespace")(h) : (e.enter("data"), A(h));
3055
3061
  }
3056
3062
  function A(h) {
3057
- return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), A) : h === null || fe(h) ? (e.exit("tableRow"), r(h)) : G(h) ? Z(e, A, "whitespace")(h) : (e.enter("data"), N(h));
3063
+ return h === null || h === 124 || B(h) ? (e.exit("data"), D(h)) : (e.consume(h), h === 92 ? N : A);
3058
3064
  }
3059
3065
  function N(h) {
3060
- return h === null || h === 124 || B(h) ? (e.exit("data"), A(h)) : (e.consume(h), h === 92 ? _ : N);
3061
- }
3062
- function _(h) {
3063
- return h === 92 || h === 124 ? (e.consume(h), N) : N(h);
3066
+ return h === 92 || h === 124 ? (e.consume(h), A) : A(h);
3064
3067
  }
3065
3068
  }
3066
- function Gi(e, r) {
3069
+ function Qi(e, r) {
3067
3070
  let t = -1, a = !0, i = 0, o = [0, 0, 0, 0], n = [0, 0, 0, 0], u = !1, c = 0, s, f, l;
3068
3071
  const p = new Hi();
3069
3072
  for (; ++t < e.length; ) {
3070
- const y = e[t], m = y[1];
3071
- y[0] === "enter" ? m.type === "tableHead" ? (u = !1, c !== 0 && (Pt(p, r, c, s, f), f = void 0, c = 0), s = {
3073
+ const g = e[t], m = g[1];
3074
+ g[0] === "enter" ? m.type === "tableHead" ? (u = !1, c !== 0 && (Dt(p, r, c, s, f), f = void 0, c = 0), s = {
3072
3075
  type: "table",
3073
3076
  start: Object.assign({}, m.start),
3074
3077
  // Note: correct end is set later.
@@ -3078,15 +3081,15 @@ function Gi(e, r) {
3078
3081
  start: Object.assign({}, m.start),
3079
3082
  // Note: correct end is set later.
3080
3083
  end: Object.assign({}, m.end)
3081
- }, p.add(t, 0, [["enter", f, r]])), i = m.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") ? (a = !1, n[2] === 0 && (o[1] !== 0 && (n[0] = n[1], l = Se(p, r, o, i, void 0, l), o = [0, 0, 0, 0]), n[2] = t)) : m.type === "tableCellDivider" && (a ? a = !1 : (o[1] !== 0 && (n[0] = n[1], l = Se(p, r, o, i, void 0, l)), o = n, n = [o[1], t, 0, 0])) : m.type === "tableHead" ? (u = !0, c = t) : m.type === "tableRow" || m.type === "tableDelimiterRow" ? (c = t, o[1] !== 0 ? (n[0] = n[1], l = Se(p, r, o, i, t, l)) : n[1] !== 0 && (l = Se(p, r, n, i, t, l)), i = 0) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") && (n[3] = t);
3084
+ }, p.add(t, 0, [["enter", f, r]])), i = m.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") ? (a = !1, n[2] === 0 && (o[1] !== 0 && (n[0] = n[1], l = Pe(p, r, o, i, void 0, l), o = [0, 0, 0, 0]), n[2] = t)) : m.type === "tableCellDivider" && (a ? a = !1 : (o[1] !== 0 && (n[0] = n[1], l = Pe(p, r, o, i, void 0, l)), o = n, n = [o[1], t, 0, 0])) : m.type === "tableHead" ? (u = !0, c = t) : m.type === "tableRow" || m.type === "tableDelimiterRow" ? (c = t, o[1] !== 0 ? (n[0] = n[1], l = Pe(p, r, o, i, t, l)) : n[1] !== 0 && (l = Pe(p, r, n, i, t, l)), i = 0) : i && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") && (n[3] = t);
3082
3085
  }
3083
- for (c !== 0 && Pt(p, r, c, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
3084
- const y = r.events[t];
3085
- y[0] === "enter" && y[1].type === "table" && (y[1]._align = Xi(r.events, t));
3086
+ for (c !== 0 && Dt(p, r, c, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
3087
+ const g = r.events[t];
3088
+ g[0] === "enter" && g[1].type === "table" && (g[1]._align = Vi(r.events, t));
3086
3089
  }
3087
3090
  return e;
3088
3091
  }
3089
- function Se(e, r, t, a, i, o) {
3092
+ function Pe(e, r, t, a, i, o) {
3090
3093
  const n = a === 1 ? "tableHeader" : a === 2 ? "tableDelimiter" : "tableData", u = "tableContent";
3091
3094
  t[0] !== 0 && (o.end = Object.assign({}, le(r.events, t[0])), e.add(t[0], 0, [["exit", o, r]]));
3092
3095
  const c = le(r.events, t[1]);
@@ -3102,8 +3105,8 @@ function Se(e, r, t, a, i, o) {
3102
3105
  end: Object.assign({}, f)
3103
3106
  };
3104
3107
  if (e.add(t[2], 0, [["enter", l, r]]), a !== 2) {
3105
- const p = r.events[t[2]], y = r.events[t[3]];
3106
- if (p[1].end = Object.assign({}, y[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
3108
+ const p = r.events[t[2]], g = r.events[t[3]];
3109
+ if (p[1].end = Object.assign({}, g[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
3107
3110
  const m = t[2] + 1, x = t[3] - t[2] - 1;
3108
3111
  e.add(m, x, []);
3109
3112
  }
@@ -3112,7 +3115,7 @@ function Se(e, r, t, a, i, o) {
3112
3115
  }
3113
3116
  return i !== void 0 && (o.end = Object.assign({}, le(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
3114
3117
  }
3115
- function Pt(e, r, t, a, i) {
3118
+ function Dt(e, r, t, a, i) {
3116
3119
  const o = [], n = le(r.events, t);
3117
3120
  i && (i.end = Object.assign({}, n), o.push(["exit", i, r])), a.end = Object.assign({}, n), o.push(["exit", a, r]), e.add(t + 1, 0, o);
3118
3121
  }
@@ -3120,18 +3123,18 @@ function le(e, r) {
3120
3123
  const t = e[r], a = t[0] === "enter" ? "start" : "end";
3121
3124
  return t[1][a];
3122
3125
  }
3123
- const Zi = {
3126
+ const Gi = {
3124
3127
  name: "tasklistCheck",
3125
- tokenize: Yi
3128
+ tokenize: Ji
3126
3129
  };
3127
- function Ji() {
3130
+ function Zi() {
3128
3131
  return {
3129
3132
  text: {
3130
- 91: Zi
3133
+ 91: Gi
3131
3134
  }
3132
3135
  };
3133
3136
  }
3134
- function Yi(e, r, t) {
3137
+ function Ji(e, r, t) {
3135
3138
  const a = this;
3136
3139
  return i;
3137
3140
  function i(c) {
@@ -3150,46 +3153,46 @@ function Yi(e, r, t) {
3150
3153
  }
3151
3154
  function u(c) {
3152
3155
  return fe(c) ? r(c) : G(c) ? e.check({
3153
- tokenize: eo
3156
+ tokenize: Yi
3154
3157
  }, r, t)(c) : t(c);
3155
3158
  }
3156
3159
  }
3157
- function eo(e, r, t) {
3160
+ function Yi(e, r, t) {
3158
3161
  return Z(e, a, "whitespace");
3159
3162
  function a(i) {
3160
3163
  return i === null ? t(i) : r(i);
3161
3164
  }
3162
3165
  }
3163
- function to(e) {
3164
- return yi([
3165
- Ci(),
3166
- Fi(),
3167
- qi(e),
3168
- Ki(),
3169
- Ji()
3166
+ function eo(e) {
3167
+ return bi([
3168
+ vi(),
3169
+ Ei(),
3170
+ Wi(e),
3171
+ Xi(),
3172
+ Zi()
3170
3173
  ]);
3171
3174
  }
3172
- const ro = {};
3173
- function ao(e) {
3175
+ const to = {};
3176
+ function ro(e) {
3174
3177
  const r = (
3175
3178
  /** @type {Processor<Root>} */
3176
3179
  this
3177
- ), t = e || ro, a = r.data(), i = a.micromarkExtensions || (a.micromarkExtensions = []), o = a.fromMarkdownExtensions || (a.fromMarkdownExtensions = []), n = a.toMarkdownExtensions || (a.toMarkdownExtensions = []);
3178
- i.push(to(t)), o.push(gi()), n.push(bi(t));
3180
+ ), t = e || to, a = r.data(), i = a.micromarkExtensions || (a.micromarkExtensions = []), o = a.fromMarkdownExtensions || (a.fromMarkdownExtensions = []), n = a.toMarkdownExtensions || (a.toMarkdownExtensions = []);
3181
+ i.push(eo(t)), o.push(pi()), n.push(gi(t));
3179
3182
  }
3180
- function z(...e) {
3183
+ function j(...e) {
3181
3184
  return e.filter(Boolean).join(" ");
3182
3185
  }
3183
- const no = ({ content: e }) => /* @__PURE__ */ d(
3184
- Ur,
3186
+ const ao = ({ content: e }) => /* @__PURE__ */ d(
3187
+ Br,
3185
3188
  {
3186
- remarkPlugins: [ao],
3189
+ remarkPlugins: [ro],
3187
3190
  className: "cuadra-aui-md",
3188
- components: co,
3191
+ components: oo,
3189
3192
  children: e
3190
3193
  }
3191
- ), ct = Lr(no), io = ({ language: e, code: r }) => {
3192
- const { isCopied: t, copyToClipboard: a } = oo();
3194
+ ), st = Pr(ao), no = ({ language: e, code: r }) => {
3195
+ const { isCopied: t, copyToClipboard: a } = io();
3193
3196
  return /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-between cuadra-gap-4 cuadra-mt-4 cuadra-rounded-t-lg cuadra-bg-muted/50 cuadra-border-b cuadra-border-border cuadra-px-4 cuadra-py-2 cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-font-brand", children: [
3194
3197
  /* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
3195
3198
  /* @__PURE__ */ w(
@@ -3201,33 +3204,33 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
3201
3204
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
3202
3205
  "aria-label": "Copy code",
3203
3206
  children: [
3204
- !t && /* @__PURE__ */ d(na, { className: "cuadra-h-4 cuadra-w-4" }),
3205
- t && /* @__PURE__ */ d(Yr, { className: "cuadra-h-4 cuadra-w-4" })
3207
+ !t && /* @__PURE__ */ d(aa, { className: "cuadra-h-4 cuadra-w-4" }),
3208
+ t && /* @__PURE__ */ d(Jr, { className: "cuadra-h-4 cuadra-w-4" })
3206
3209
  ]
3207
3210
  }
3208
3211
  )
3209
3212
  ] });
3210
- }, oo = ({
3213
+ }, io = ({
3211
3214
  copiedDuration: e = 3e3
3212
3215
  } = {}) => {
3213
- const [r, t] = P(!1);
3216
+ const [r, t] = R(!1);
3214
3217
  return { isCopied: r, copyToClipboard: (i) => {
3215
3218
  i && navigator.clipboard.writeText(i).then(() => {
3216
3219
  t(!0), setTimeout(() => t(!1), e);
3217
3220
  });
3218
3221
  } };
3219
- }, co = $r({
3222
+ }, oo = Or({
3220
3223
  h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
3221
3224
  "h1",
3222
3225
  {
3223
- className: z("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
3226
+ className: j("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
3224
3227
  ...r
3225
3228
  }
3226
3229
  ),
3227
3230
  h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
3228
3231
  "h2",
3229
3232
  {
3230
- className: z(
3233
+ className: j(
3231
3234
  "cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
3232
3235
  e
3233
3236
  ),
@@ -3237,7 +3240,7 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
3237
3240
  h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
3238
3241
  "h3",
3239
3242
  {
3240
- className: z(
3243
+ className: j(
3241
3244
  "cuadra-mb-3 cuadra-mt-5 cuadra-scroll-m-20 cuadra-text-lg cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
3242
3245
  e
3243
3246
  ),
@@ -3247,38 +3250,38 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
3247
3250
  h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
3248
3251
  "h4",
3249
3252
  {
3250
- className: z(
3253
+ className: j(
3251
3254
  "cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
3252
3255
  e
3253
3256
  ),
3254
3257
  ...r
3255
3258
  }
3256
3259
  ),
3257
- h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: z("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
3258
- h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: z("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
3259
- p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: z("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
3260
+ h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: j("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
3261
+ h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: j("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
3262
+ p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: j("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
3260
3263
  a: ({ className: e, ...r }) => /* @__PURE__ */ d(
3261
3264
  "a",
3262
3265
  {
3263
- className: z("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
3266
+ className: j("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
3264
3267
  ...r
3265
3268
  }
3266
3269
  ),
3267
- blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: z("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
3268
- ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: z("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
3269
- ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: z("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
3270
- hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: z("cuadra-my-5 cuadra-border-b", e), ...r }),
3270
+ blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: j("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
3271
+ ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: j("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
3272
+ ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: j("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
3273
+ hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: j("cuadra-my-5 cuadra-border-b", e), ...r }),
3271
3274
  table: ({ className: e, ...r }) => /* @__PURE__ */ d(
3272
3275
  "table",
3273
3276
  {
3274
- className: z("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
3277
+ className: j("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
3275
3278
  ...r
3276
3279
  }
3277
3280
  ),
3278
3281
  th: ({ className: e, ...r }) => /* @__PURE__ */ d(
3279
3282
  "th",
3280
3283
  {
3281
- className: z(
3284
+ className: j(
3282
3285
  "cuadra-bg-muted cuadra-px-4 cuadra-py-2 cuadra-text-left cuadra-font-normal first:cuadra-rounded-tl-lg last:cuadra-rounded-tr-lg [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
3283
3286
  e
3284
3287
  ),
@@ -3288,7 +3291,7 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
3288
3291
  td: ({ className: e, ...r }) => /* @__PURE__ */ d(
3289
3292
  "td",
3290
3293
  {
3291
- className: z(
3294
+ className: j(
3292
3295
  "cuadra-border-b cuadra-border-l cuadra-px-4 cuadra-py-2 cuadra-text-left last:cuadra-border-r [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
3293
3296
  e
3294
3297
  ),
@@ -3298,18 +3301,18 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
3298
3301
  tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
3299
3302
  "tr",
3300
3303
  {
3301
- className: z(
3304
+ className: j(
3302
3305
  "cuadra-m-0 cuadra-border-b cuadra-p-0 first:cuadra-border-t [&:last-child>td:first-child]:cuadra-rounded-bl-lg [&:last-child>td:last-child]:cuadra-rounded-br-lg",
3303
3306
  e
3304
3307
  ),
3305
3308
  ...r
3306
3309
  }
3307
3310
  ),
3308
- sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: z("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
3311
+ sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: j("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
3309
3312
  pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
3310
3313
  "pre",
3311
3314
  {
3312
- className: z(
3315
+ className: j(
3313
3316
  "cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",
3314
3317
  e
3315
3318
  ),
@@ -3317,18 +3320,18 @@ const no = ({ content: e }) => /* @__PURE__ */ d(
3317
3320
  }
3318
3321
  ),
3319
3322
  code: function({ className: r, ...t }) {
3320
- const a = Or();
3323
+ const a = Ur();
3321
3324
  return /* @__PURE__ */ d(
3322
3325
  "code",
3323
3326
  {
3324
- className: z(!a && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
3327
+ className: j(!a && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
3325
3328
  ...t
3326
3329
  }
3327
3330
  );
3328
3331
  },
3329
- CodeHeader: io
3332
+ CodeHeader: no
3330
3333
  });
3331
- function kr({ className: e = "", variant: r = "default", ...t }) {
3334
+ function wr({ className: e = "", variant: r = "default", ...t }) {
3332
3335
  const a = "cuadra-inline-flex cuadra-items-center cuadra-rounded-md cuadra-px-3 cuadra-py-1.5 cuadra-text-xs cuadra-font-medium font-brand", i = {
3333
3336
  default: "cuadra-border cuadra-border-border cuadra-bg-muted cuadra-text-muted-foreground",
3334
3337
  subtle: "cuadra-border cuadra-border-border/50 cuadra-bg-muted/50 cuadra-text-muted-foreground",
@@ -3343,7 +3346,7 @@ function kr({ className: e = "", variant: r = "default", ...t }) {
3343
3346
  }
3344
3347
  );
3345
3348
  }
3346
- function uo(e) {
3349
+ function co(e) {
3347
3350
  const r = /* @__PURE__ */ new Map();
3348
3351
  for (const t of e) {
3349
3352
  const a = r.get(t.filename);
@@ -3351,20 +3354,20 @@ function uo(e) {
3351
3354
  }
3352
3355
  return Array.from(r.values()).sort((t, a) => a.score - t.score);
3353
3356
  }
3354
- function so({
3357
+ function uo({
3355
3358
  sources: e,
3356
3359
  maxVisible: r = 3
3357
3360
  }) {
3358
3361
  if (!e || e.length === 0) return null;
3359
- const t = uo(e), a = t.slice(0, r), i = t.length - r;
3362
+ const t = co(e), a = t.slice(0, r), i = t.length - r;
3360
3363
  return /* @__PURE__ */ w("div", { className: "cuadra-mt-4 cuadra-pt-3 cuadra-border-t cuadra-border-border", children: [
3361
3364
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-1.5 cuadra-mb-2.5", children: [
3362
- /* @__PURE__ */ d(Ot, { className: "cuadra-h-3.5 cuadra-w-3.5 cuadra-text-muted-foreground" }),
3365
+ /* @__PURE__ */ d(Ut, { className: "cuadra-h-3.5 cuadra-w-3.5 cuadra-text-muted-foreground" }),
3363
3366
  /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-font-medium cuadra-text-muted-foreground font-brand", children: "Sources" })
3364
3367
  ] }),
3365
3368
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-wrap cuadra-gap-2", children: [
3366
- a.map((o, n) => /* @__PURE__ */ d(fo, { source: o }, o.sourceId || n)),
3367
- i > 0 && /* @__PURE__ */ w(kr, { variant: "subtle", children: [
3369
+ a.map((o, n) => /* @__PURE__ */ d(lo, { source: o }, o.sourceId || n)),
3370
+ i > 0 && /* @__PURE__ */ w(wr, { variant: "subtle", children: [
3368
3371
  "+",
3369
3372
  i,
3370
3373
  " more"
@@ -3372,23 +3375,23 @@ function so({
3372
3375
  ] })
3373
3376
  ] });
3374
3377
  }
3375
- function lo(e) {
3378
+ function so(e) {
3376
3379
  switch (e.split(".").pop()?.toLowerCase()) {
3377
3380
  case "csv":
3378
3381
  case "xlsx":
3379
3382
  case "xls":
3380
- return ua;
3383
+ return ca;
3381
3384
  case "md":
3382
3385
  case "txt":
3383
- return da;
3386
+ return la;
3384
3387
  default:
3385
- return Ot;
3388
+ return Ut;
3386
3389
  }
3387
3390
  }
3388
- function fo({ source: e }) {
3389
- const { filename: r, score: t } = e, a = lo(r);
3391
+ function lo({ source: e }) {
3392
+ const { filename: r, score: t } = e, a = so(r);
3390
3393
  return /* @__PURE__ */ w(
3391
- kr,
3394
+ wr,
3392
3395
  {
3393
3396
  className: "cuadra-gap-2 cuadra-cursor-default",
3394
3397
  title: t < 1 ? `${Math.round(t * 100)}% relevant` : void 0,
@@ -3403,7 +3406,7 @@ function fo({ source: e }) {
3403
3406
  }
3404
3407
  );
3405
3408
  }
3406
- const Rt = we(
3409
+ const _t = ve(
3407
3410
  function({
3408
3411
  welcomeTitle: r = "Hi, how can I help you today?",
3409
3412
  welcomeSubtitle: t = "Start exploring our platform and discover what you can build.",
@@ -3414,96 +3417,96 @@ const Rt = we(
3414
3417
  preMadeResponseDelay: u = 1e3,
3415
3418
  streamingSpeed: c = 50
3416
3419
  }, s) {
3417
- const f = Er(), l = Fr(), [p, y] = P(!1), [m, x] = P(null), [g, b] = P(!1), k = H((C, A, N) => {
3418
- if (!g)
3420
+ const f = Fr(), l = zr(), [p, g] = R(!1), [m, x] = R(null), [b, y] = R(!1), k = X((C, D, A) => {
3421
+ if (!b)
3419
3422
  try {
3420
- const _ = N?.streamingSpeed ?? c, h = N?.delay ?? u;
3421
- Aa(C, A, _, h), l.composer().setText(C), setTimeout(() => {
3423
+ const N = A?.streamingSpeed ?? c, h = A?.delay ?? u;
3424
+ Ma(C, D, N, h), l.composer().setText(C), setTimeout(() => {
3422
3425
  l.composer().send();
3423
3426
  }, 10);
3424
3427
  } catch {
3425
3428
  }
3426
- }, [g, c, u, l]), M = H((C) => {
3429
+ }, [b, c, u, l]), T = X((C) => {
3427
3430
  try {
3428
3431
  l.composer().setText(C), setTimeout(() => {
3429
3432
  l.composer().send();
3430
3433
  }, 10);
3431
3434
  } catch {
3432
3435
  }
3433
- }, [l]), S = H(async (C) => {
3434
- if (!(g || !f))
3436
+ }, [l]), L = X(async (C) => {
3437
+ if (!(b || !f))
3435
3438
  try {
3436
3439
  if (C.response) {
3437
- const A = C.responseDelay ?? u;
3440
+ const D = C.responseDelay ?? u;
3438
3441
  await k(C.prompt, C.response, {
3439
- delay: A,
3442
+ delay: D,
3440
3443
  streamingSpeed: c
3441
3444
  });
3442
3445
  } else
3443
- M(C.prompt);
3446
+ T(C.prompt);
3444
3447
  } catch {
3445
3448
  }
3446
- }, [f, g, u, c, k, M]), L = H(() => {
3449
+ }, [f, b, u, c, k, T]), I = X(() => {
3447
3450
  try {
3448
3451
  const C = window.__cuadraThreadListRuntime;
3449
3452
  C?.switchToNewThread && C.switchToNewThread();
3450
3453
  } catch {
3451
3454
  }
3452
3455
  }, []);
3453
- return tt(s, () => ({
3454
- sendMessage: M,
3456
+ return at(s, () => ({
3457
+ sendMessage: T,
3455
3458
  sendPreMadeQA: k,
3456
- clearChat: L
3457
- }), [M, k, L]), $(() => {
3459
+ clearChat: I
3460
+ }), [T, k, I]), O(() => {
3458
3461
  if (!f) {
3459
- y(!1);
3462
+ g(!1);
3460
3463
  return;
3461
3464
  }
3462
3465
  try {
3463
3466
  const C = f?.store;
3464
3467
  if (!C) {
3465
- y(!1);
3468
+ g(!1);
3466
3469
  return;
3467
3470
  }
3468
- const A = C.subscribe?.((_) => {
3469
- const h = _?.threadId, U = _?.messages || [], W = _?.isLoadingHistory || !1, X = U.length;
3470
- h && h !== m && x(h), y(W && X === 0);
3471
- }), N = C.getState?.();
3472
- if (N) {
3473
- const _ = N?.threadId, h = N?.messages || [], U = N?.isLoadingHistory || !1, W = h.length;
3474
- _ && _ !== m && x(_), y(U && W === 0);
3471
+ const D = C.subscribe?.((N) => {
3472
+ const h = N?.threadId, _ = N?.messages || [], H = N?.isLoadingHistory || !1, W = _.length;
3473
+ h && h !== m && x(h), g(H && W === 0);
3474
+ }), A = C.getState?.();
3475
+ if (A) {
3476
+ const N = A?.threadId, h = A?.messages || [], _ = A?.isLoadingHistory || !1, H = h.length;
3477
+ N && N !== m && x(N), g(_ && H === 0);
3475
3478
  }
3476
3479
  return () => {
3477
- A && A();
3480
+ D && D();
3478
3481
  };
3479
3482
  } catch {
3480
- y(!1);
3483
+ g(!1);
3481
3484
  }
3482
- }, [f, m]), /* @__PURE__ */ w(Ne.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
3485
+ }, [f, m]), /* @__PURE__ */ w(Se.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
3483
3486
  /* @__PURE__ */ d(
3484
- Ne.Viewport,
3487
+ Se.Viewport,
3485
3488
  {
3486
3489
  className: "cuadra-w-full cuadra-bg-inherit cuadra-px-4 cuadra-flex-1 cuadra-min-h-0 cuadra-overflow-y-auto cuadra-relative scrollbar-thin cuadra-pt-4",
3487
3490
  style: a ? { paddingTop: a } : void 0,
3488
3491
  children: p ? /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: [
3489
- /* @__PURE__ */ d(Ut, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
3492
+ /* @__PURE__ */ d(Bt, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
3490
3493
  /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
3491
3494
  ] }) }) : /* @__PURE__ */ w(J, { children: [
3492
- /* @__PURE__ */ d(Ne.Empty, { children: /* @__PURE__ */ d(
3493
- ho,
3495
+ /* @__PURE__ */ d(Se.Empty, { children: /* @__PURE__ */ d(
3496
+ fo,
3494
3497
  {
3495
3498
  title: r,
3496
3499
  subtitle: t,
3497
3500
  suggestions: i,
3498
- onSuggestionClick: S,
3499
- isProcessing: g
3501
+ onSuggestionClick: L,
3502
+ isProcessing: b
3500
3503
  }
3501
3504
  ) }),
3502
3505
  /* @__PURE__ */ d(
3503
- Ne.Messages,
3506
+ Se.Messages,
3504
3507
  {
3505
3508
  components: {
3506
- UserMessage: mo,
3509
+ UserMessage: ho,
3507
3510
  AssistantMessage: go
3508
3511
  }
3509
3512
  }
@@ -3517,16 +3520,16 @@ const Rt = we(
3517
3520
  {
3518
3521
  components: {
3519
3522
  Attachment: () => {
3520
- const C = jt(({ attachment: A }) => A);
3523
+ const C = xe(({ attachment: D }) => D);
3521
3524
  return C ? /* @__PURE__ */ w("div", { className: "cuadra-relative cuadra-inline-flex cuadra-items-center cuadra-gap-2 cuadra-mb-2 cuadra-px-2 cuadra-py-1 cuadra-rounded-md cuadra-bg-muted cuadra-border cuadra-border-border", children: [
3522
3525
  /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground font-brand", children: C.name || "Attachment" }),
3523
- /* @__PURE__ */ d(zr.Remove, { asChild: !0, children: /* @__PURE__ */ d(
3526
+ /* @__PURE__ */ d(jr.Remove, { asChild: !0, children: /* @__PURE__ */ d(
3524
3527
  "button",
3525
3528
  {
3526
3529
  type: "button",
3527
3530
  className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-size-4 cuadra-rounded hover:cuadra-bg-background cuadra-transition-colors",
3528
3531
  "aria-label": "Remove attachment",
3529
- children: /* @__PURE__ */ d(rt, { className: "cuadra-h-3 cuadra-w-3 cuadra-text-muted-foreground" })
3532
+ children: /* @__PURE__ */ d(nt, { className: "cuadra-h-3 cuadra-w-3 cuadra-text-muted-foreground" })
3530
3533
  }
3531
3534
  ) })
3532
3535
  ] }) : null;
@@ -3570,7 +3573,7 @@ const Rt = we(
3570
3573
  right: "3rem"
3571
3574
  },
3572
3575
  "aria-label": "Attach file",
3573
- children: /* @__PURE__ */ d(Bt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground", strokeWidth: 1.5 })
3576
+ children: /* @__PURE__ */ d(Wt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground", strokeWidth: 1.5 })
3574
3577
  }
3575
3578
  )
3576
3579
  }
@@ -3588,7 +3591,7 @@ const Rt = we(
3588
3591
  },
3589
3592
  "aria-label": "Send message",
3590
3593
  type: "button",
3591
- children: /* @__PURE__ */ d(Qr, { className: "cuadra-h-4 cuadra-w-4" })
3594
+ children: /* @__PURE__ */ d(Gr, { className: "cuadra-h-4 cuadra-w-4" })
3592
3595
  }
3593
3596
  ) })
3594
3597
  ] })
@@ -3596,7 +3599,7 @@ const Rt = we(
3596
3599
  ] });
3597
3600
  }
3598
3601
  );
3599
- function ho({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isProcessing: i }) {
3602
+ function fo({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isProcessing: i }) {
3600
3603
  return /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-h-full cuadra-py-12 cuadra-px-4 cuadra-overflow-y-auto scrollbar-hide", children: /* @__PURE__ */ w("div", { className: "cuadra-text-center cuadra-max-w-3xl cuadra-w-full cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-min-h-full", children: [
3601
3604
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3602
3605
  /* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
@@ -3616,14 +3619,14 @@ function ho({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isPro
3616
3619
  )) })
3617
3620
  ] }) });
3618
3621
  }
3619
- function mo() {
3622
+ function ho() {
3620
3623
  return /* @__PURE__ */ w(be.Root, { className: "cuadra-grid cuadra-w-full cuadra-auto-rows-auto cuadra-grid-cols-[minmax(72px,1fr)_auto] cuadra-gap-y-2 cuadra-py-3 [&:where(>*)]:cuadra-col-start-2", children: [
3621
3624
  /* @__PURE__ */ d(
3622
3625
  be.Attachments,
3623
3626
  {
3624
3627
  components: {
3625
3628
  Attachment: () => {
3626
- const e = jt(({ attachment: o }) => o);
3629
+ const e = xe(({ attachment: o }) => o);
3627
3630
  if (!e) return null;
3628
3631
  const r = e.type === "image", t = e.file, a = e.content?.find((o) => o.type === "image"), i = t ? URL.createObjectURL(t) : a?.image;
3629
3632
  return /* @__PURE__ */ d("div", { className: "cuadra-col-start-2 cuadra-row-start-1 cuadra-mb-2 cuadra-max-w-[calc(42rem*0.8)]", children: r && i ? /* @__PURE__ */ d(
@@ -3635,7 +3638,7 @@ function mo() {
3635
3638
  style: { borderWidth: "1px" }
3636
3639
  }
3637
3640
  ) : /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-muted cuadra-px-3 cuadra-py-2", children: [
3638
- /* @__PURE__ */ d(Bt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3641
+ /* @__PURE__ */ d(Wt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3639
3642
  /* @__PURE__ */ d("span", { className: "cuadra-text-sm cuadra-text-foreground font-brand", children: e.name || "Attachment" })
3640
3643
  ] }) });
3641
3644
  }
@@ -3662,7 +3665,7 @@ function mo() {
3662
3665
  be.Parts,
3663
3666
  {
3664
3667
  components: {
3665
- Text: ({ text: e }) => /* @__PURE__ */ d(ct, { content: e || "" })
3668
+ Text: ({ text: e }) => /* @__PURE__ */ d(st, { content: e || "" })
3666
3669
  }
3667
3670
  }
3668
3671
  )
@@ -3670,37 +3673,55 @@ function mo() {
3670
3673
  )
3671
3674
  ] });
3672
3675
  }
3673
- function po({ text: e }) {
3674
- const [r, t] = P(!1);
3675
- return e ? /* @__PURE__ */ w("div", { className: "cuadra-mb-3 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-muted/50 cuadra-overflow-hidden", children: [
3676
+ function mo({ text: e }) {
3677
+ const [r, t] = R(!1), a = xe(({ message: i }) => i?.status?.type === "running");
3678
+ return e ? a ? /* @__PURE__ */ d("div", { className: "cuadra-mb-3 cuadra-py-1", children: /* @__PURE__ */ d("div", { className: "cuadra-text-sm cuadra-text-muted-foreground cuadra-leading-relaxed font-brand cuadra-animate-text-shimmer", children: e }) }) : /* @__PURE__ */ w("div", { className: "cuadra-mb-3", children: [
3676
3679
  /* @__PURE__ */ w(
3677
3680
  "button",
3678
3681
  {
3679
3682
  type: "button",
3680
3683
  onClick: () => t(!r),
3681
- className: "cuadra-w-full cuadra-flex cuadra-items-center cuadra-gap-2 cuadra-px-3 cuadra-py-2 cuadra-text-left cuadra-text-sm cuadra-text-muted-foreground hover:cuadra-bg-muted/80 cuadra-transition-colors font-brand",
3684
+ className: "cuadra-flex cuadra-items-center cuadra-gap-1.5 cuadra-py-1 cuadra-text-sm cuadra-text-muted-foreground hover:cuadra-text-foreground cuadra-transition-colors font-brand",
3682
3685
  children: [
3683
3686
  /* @__PURE__ */ d(
3684
- Je,
3687
+ et,
3685
3688
  {
3686
- className: `cuadra-h-4 cuadra-w-4 cuadra-shrink-0 cuadra-transition-transform ${r ? "" : "cuadra--rotate-90"}`
3689
+ className: `cuadra-h-3.5 cuadra-w-3.5 cuadra-shrink-0 cuadra-transition-transform cuadra-duration-200 ${r ? "" : "cuadra--rotate-90"}`
3687
3690
  }
3688
3691
  ),
3689
- /* @__PURE__ */ d(Zr, { className: "cuadra-h-4 cuadra-w-4 cuadra-shrink-0" }),
3690
3692
  /* @__PURE__ */ d("span", { children: "Reasoning" })
3691
3693
  ]
3692
3694
  }
3693
3695
  ),
3694
- r && /* @__PURE__ */ d("div", { className: "cuadra-px-3 cuadra-pb-3 cuadra-pt-1 cuadra-border-t cuadra-border-border", children: /* @__PURE__ */ d("div", { className: "cuadra-text-sm cuadra-text-muted-foreground cuadra-leading-relaxed font-brand", children: /* @__PURE__ */ d(ct, { content: e }) }) })
3696
+ /* @__PURE__ */ d(
3697
+ "div",
3698
+ {
3699
+ className: `cuadra-overflow-hidden cuadra-transition-all cuadra-duration-200 cuadra-ease-out ${r ? "cuadra-max-h-[2000px] cuadra-opacity-100" : "cuadra-max-h-0 cuadra-opacity-0"}`,
3700
+ children: /* @__PURE__ */ d("div", { className: "cuadra-pl-5 cuadra-pt-2 cuadra-text-sm cuadra-text-muted-foreground cuadra-leading-relaxed font-brand", children: /* @__PURE__ */ d(st, { content: e }) })
3701
+ }
3702
+ )
3695
3703
  ] }) : null;
3696
3704
  }
3705
+ function po() {
3706
+ return /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 cuadra-text-muted-foreground cuadra-text-sm font-brand cuadra-py-2", children: [
3707
+ /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-1", children: [
3708
+ /* @__PURE__ */ d("span", { className: "cuadra-inline-block cuadra-w-1.5 cuadra-h-1.5 cuadra-bg-current cuadra-rounded-full cuadra-animate-bounce", style: { animationDelay: "0ms" } }),
3709
+ /* @__PURE__ */ d("span", { className: "cuadra-inline-block cuadra-w-1.5 cuadra-h-1.5 cuadra-bg-current cuadra-rounded-full cuadra-animate-bounce", style: { animationDelay: "150ms" } }),
3710
+ /* @__PURE__ */ d("span", { className: "cuadra-inline-block cuadra-w-1.5 cuadra-h-1.5 cuadra-bg-current cuadra-rounded-full cuadra-animate-bounce", style: { animationDelay: "300ms" } })
3711
+ ] }),
3712
+ /* @__PURE__ */ d("span", { children: "Thinking..." })
3713
+ ] });
3714
+ }
3697
3715
  function go() {
3698
- const [e] = P(() => ie.getCurrentMessageId()), r = Pr(
3699
- (t) => ie.subscribe(t),
3716
+ const [e] = R(() => ie.getCurrentMessageId()), r = xe(({ message: i }) => i?.status?.type === "running"), t = xe(({ message: i }) => {
3717
+ const o = i?.content;
3718
+ return !o || !Array.isArray(o) ? !1 : o.some((n) => !!(n.type === "text" && n.text && n.text.length > 0 || n.type === "reasoning" && n.text && n.text.length > 0));
3719
+ }), a = Rr(
3720
+ (i) => ie.subscribe(i),
3700
3721
  () => {
3701
3722
  if (e) {
3702
- const t = ie.getForMessage(e);
3703
- if (t.sources?.length) return t.sources;
3723
+ const i = ie.getForMessage(e);
3724
+ if (i.sources?.length) return i.sources;
3704
3725
  }
3705
3726
  return ie.get().sources || null;
3706
3727
  },
@@ -3720,17 +3741,18 @@ function go() {
3720
3741
  be.Parts,
3721
3742
  {
3722
3743
  components: {
3723
- Text: ({ text: t }) => /* @__PURE__ */ d(ct, { content: t || "" }),
3724
- Reasoning: ({ text: t }) => /* @__PURE__ */ d(po, { text: t || "" })
3744
+ Text: ({ text: i }) => /* @__PURE__ */ d(st, { content: i || "" }),
3745
+ Reasoning: ({ text: i }) => /* @__PURE__ */ d(mo, { text: i || "" })
3725
3746
  }
3726
3747
  }
3727
3748
  ),
3728
- r && r.length > 0 && /* @__PURE__ */ d(so, { sources: r })
3749
+ r && !t && /* @__PURE__ */ d(po, {}),
3750
+ a && a.length > 0 && /* @__PURE__ */ d(uo, { sources: a })
3729
3751
  ]
3730
3752
  }
3731
3753
  ) });
3732
3754
  }
3733
- const wr = ({ className: e = "", theme: r = "system" }) => {
3755
+ const vr = ({ className: e = "", theme: r = "system" }) => {
3734
3756
  const t = () => {
3735
3757
  if (typeof window > "u") return "light";
3736
3758
  if (r === "system") {
@@ -3738,10 +3760,10 @@ const wr = ({ className: e = "", theme: r = "system" }) => {
3738
3760
  return n || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
3739
3761
  }
3740
3762
  return r;
3741
- }, [a, i] = P(t);
3742
- return $(() => {
3763
+ }, [a, i] = R(t);
3764
+ return O(() => {
3743
3765
  r !== "system" && i(r);
3744
- }, [r]), $(() => {
3766
+ }, [r]), O(() => {
3745
3767
  const n = document.documentElement;
3746
3768
  n.classList.remove("light", "dark"), n.classList.add(a), r === "system" && localStorage.setItem("theme", a);
3747
3769
  }, [a, r]), /* @__PURE__ */ d(
@@ -3755,7 +3777,7 @@ const wr = ({ className: e = "", theme: r = "system" }) => {
3755
3777
  disabled: r !== "system",
3756
3778
  className: `cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed ${e}`,
3757
3779
  children: /* @__PURE__ */ d(
3758
- ra,
3780
+ ta,
3759
3781
  {
3760
3782
  className: `cuadra-h-4 cuadra-w-4 cuadra-transition-colors ${a === "dark" ? "cuadra-text-primary" : "cuadra-text-gray-400"}`
3761
3783
  }
@@ -3764,25 +3786,25 @@ const wr = ({ className: e = "", theme: r = "system" }) => {
3764
3786
  );
3765
3787
  };
3766
3788
  function bo({ onThreadSelect: e }) {
3767
- const r = Et(), t = jr((g) => g.threadId), [a, i] = P(null), o = r?.id === t, n = a === r?.id, [u, c] = P(!1), [s, f] = P(r?.title || ""), [l, p] = P(!1), [y, m] = P(!1), x = async () => {
3789
+ const r = zt(), t = $r((b) => b.threadId), [a, i] = R(null), o = r?.id === t, n = a === r?.id, [u, c] = R(!1), [s, f] = R(r?.title || ""), [l, p] = R(!1), [g, m] = R(!1), x = async () => {
3768
3790
  if (!r?.remoteId || !s || s === r.title) {
3769
3791
  c(!1);
3770
3792
  return;
3771
3793
  }
3772
3794
  try {
3773
3795
  m(!0);
3774
- const g = window.__cuadraThreadListAdapter;
3775
- g && typeof g.rename == "function" && await g.rename(r.remoteId, s), c(!1), p(!1);
3796
+ const b = window.__cuadraThreadListAdapter;
3797
+ b && typeof b.rename == "function" && await b.rename(r.remoteId, s), c(!1), p(!1);
3776
3798
  } catch {
3777
3799
  c(!1), p(!1);
3778
3800
  } finally {
3779
3801
  m(!1);
3780
3802
  }
3781
3803
  };
3782
- return $(() => {
3804
+ return O(() => {
3783
3805
  r?.title && !u && f(r.title);
3784
3806
  }, [r?.title, u]), r ? /* @__PURE__ */ w(
3785
- We.Root,
3807
+ qe.Root,
3786
3808
  {
3787
3809
  className: `group cuadra-relative cuadra-flex cuadra-items-center cuadra-rounded-lg cuadra-transition-colors cuadra-cursor-pointer cuadra-border cuadra-mb-2 ${o ? "cuadra-bg-muted cuadra-border-border" : "cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border"}`,
3788
3810
  style: { marginBottom: "0.5rem" },
@@ -3790,7 +3812,7 @@ function bo({ onThreadSelect: e }) {
3790
3812
  onMouseLeave: () => i(null),
3791
3813
  children: [
3792
3814
  /* @__PURE__ */ d(
3793
- We.Trigger,
3815
+ qe.Trigger,
3794
3816
  {
3795
3817
  className: "cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-min-w-0 cuadra-cursor-pointer",
3796
3818
  onClick: () => e?.(),
@@ -3799,13 +3821,13 @@ function bo({ onThreadSelect: e }) {
3799
3821
  {
3800
3822
  className: "cuadra-flex cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 font-brand",
3801
3823
  value: s,
3802
- onChange: (g) => f(g.target.value),
3803
- onKeyDown: (g) => {
3804
- g.key === "Enter" && x(), g.key === "Escape" && (c(!1), f(r.title || ""));
3824
+ onChange: (b) => f(b.target.value),
3825
+ onKeyDown: (b) => {
3826
+ b.key === "Enter" && x(), b.key === "Escape" && (c(!1), f(r.title || ""));
3805
3827
  },
3806
- disabled: y,
3828
+ disabled: g,
3807
3829
  autoFocus: !0,
3808
- onClick: (g) => g.stopPropagation()
3830
+ onClick: (b) => b.stopPropagation()
3809
3831
  }
3810
3832
  ) : /* @__PURE__ */ w(J, { children: [
3811
3833
  /* @__PURE__ */ d("span", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-truncate font-brand", children: (r.title?.length || 0) > 60 ? `${r.title?.slice(0, 60)}…` : r.title || "Chat" }),
@@ -3819,11 +3841,11 @@ function bo({ onThreadSelect: e }) {
3819
3841
  {
3820
3842
  type: "button",
3821
3843
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",
3822
- onClick: (g) => {
3823
- g.stopPropagation(), p(!l);
3844
+ onClick: (b) => {
3845
+ b.stopPropagation(), p(!l);
3824
3846
  },
3825
3847
  "aria-label": "Thread options",
3826
- children: /* @__PURE__ */ d(oa, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3848
+ children: /* @__PURE__ */ d(ia, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3827
3849
  }
3828
3850
  ),
3829
3851
  l && /* @__PURE__ */ w(J, { children: [
@@ -3839,10 +3861,10 @@ function bo({ onThreadSelect: e }) {
3839
3861
  {
3840
3862
  type: "button",
3841
3863
  className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",
3842
- onClick: (g) => {
3843
- g.stopPropagation(), x();
3864
+ onClick: (b) => {
3865
+ b.stopPropagation(), x();
3844
3866
  },
3845
- disabled: y,
3867
+ disabled: g,
3846
3868
  children: "Save"
3847
3869
  }
3848
3870
  ) : /* @__PURE__ */ w(J, { children: [
@@ -3851,20 +3873,20 @@ function bo({ onThreadSelect: e }) {
3851
3873
  {
3852
3874
  type: "button",
3853
3875
  className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",
3854
- onClick: (g) => {
3855
- g.stopPropagation(), c(!0), f(r.title || ""), p(!1);
3876
+ onClick: (b) => {
3877
+ b.stopPropagation(), c(!0), f(r.title || ""), p(!1);
3856
3878
  },
3857
3879
  children: "Rename"
3858
3880
  }
3859
3881
  ),
3860
3882
  /* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
3861
- /* @__PURE__ */ d(We.Delete, { asChild: !0, children: /* @__PURE__ */ d(
3883
+ /* @__PURE__ */ d(qe.Delete, { asChild: !0, children: /* @__PURE__ */ d(
3862
3884
  "button",
3863
3885
  {
3864
3886
  type: "button",
3865
3887
  className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left cuadra-text-destructive hover:cuadra-bg-muted cuadra-transition-colors font-brand",
3866
- onClick: (g) => {
3867
- g.stopPropagation(), p(!1);
3888
+ onClick: (b) => {
3889
+ b.stopPropagation(), p(!1);
3868
3890
  },
3869
3891
  children: "Delete"
3870
3892
  }
@@ -3876,13 +3898,13 @@ function bo({ onThreadSelect: e }) {
3876
3898
  }
3877
3899
  ) : null;
3878
3900
  }
3879
- function _t({
3901
+ function Et({
3880
3902
  onThreadSelect: e,
3881
3903
  showThemeToggle: r,
3882
3904
  theme: t,
3883
3905
  onLogout: a
3884
3906
  }) {
3885
- return /* @__PURE__ */ w(Be.Root, { className: "!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80", style: { borderRightWidth: "1px" }, children: [
3907
+ return /* @__PURE__ */ w(He.Root, { className: "!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80", style: { borderRightWidth: "1px" }, children: [
3886
3908
  /* @__PURE__ */ d("div", { className: "cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-end cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4", children: /* @__PURE__ */ d(
3887
3909
  "button",
3888
3910
  {
@@ -3890,24 +3912,24 @@ function _t({
3890
3912
  onClick: e,
3891
3913
  className: "cuadra-flex md:cuadra-hidden cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors",
3892
3914
  "aria-label": "Close",
3893
- children: /* @__PURE__ */ d(rt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3915
+ children: /* @__PURE__ */ d(nt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3894
3916
  }
3895
3917
  ) }),
3896
3918
  /* @__PURE__ */ w("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3897
3919
  /* @__PURE__ */ d(
3898
- Be.New,
3920
+ He.New,
3899
3921
  {
3900
3922
  className: "group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 cuadra-p-3 cuadra-rounded-lg cuadra-cursor-pointer cuadra-transition-colors cuadra-border cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border",
3901
3923
  onClick: () => e?.(),
3902
3924
  children: /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3903
- /* @__PURE__ */ d(xa, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3925
+ /* @__PURE__ */ d(ya, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3904
3926
  /* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3905
3927
  ] }) })
3906
3928
  }
3907
3929
  ),
3908
3930
  /* @__PURE__ */ d("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
3909
3931
  /* @__PURE__ */ d(
3910
- Be.Items,
3932
+ He.Items,
3911
3933
  {
3912
3934
  components: {
3913
3935
  ThreadListItem: (i) => /* @__PURE__ */ d(bo, { ...i, onThreadSelect: e })
@@ -3923,10 +3945,10 @@ function _t({
3923
3945
  onClick: a,
3924
3946
  className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors",
3925
3947
  "aria-label": "Logout",
3926
- children: /* @__PURE__ */ d(ma, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3948
+ children: /* @__PURE__ */ d(ha, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3927
3949
  }
3928
3950
  ),
3929
- r && /* @__PURE__ */ d(wr, { theme: t })
3951
+ r && /* @__PURE__ */ d(vr, { theme: t })
3930
3952
  ] })
3931
3953
  ] });
3932
3954
  }
@@ -3934,7 +3956,7 @@ const yo = `
3934
3956
  @keyframes rotate {
3935
3957
  100% { transform: rotate(1turn); }
3936
3958
  }
3937
- `, Ke = ({
3959
+ `, Ge = ({
3938
3960
  children: e,
3939
3961
  className: r = "",
3940
3962
  paddingX: t = "px-0",
@@ -3989,7 +4011,7 @@ const yo = `
3989
4011
  ]
3990
4012
  }
3991
4013
  )
3992
- ] }), Dt = ({
4014
+ ] }), Ft = ({
3993
4015
  currentModel: e,
3994
4016
  models: r,
3995
4017
  modelsLoading: t,
@@ -4001,17 +4023,17 @@ const yo = `
4001
4023
  onMobileMenuClick: c,
4002
4024
  showMobileMenuButton: s = !1
4003
4025
  }) => {
4004
- const [f, l] = P(!1), [p, y] = P(!1), m = de(null);
4005
- $(() => {
4006
- const b = (k) => {
4026
+ const [f, l] = R(!1), [p, g] = R(!1), m = de(null);
4027
+ O(() => {
4028
+ const y = (k) => {
4007
4029
  m.current && !m.current.contains(k.target) && l(!1);
4008
4030
  };
4009
- return f && document.addEventListener("mousedown", b), () => {
4010
- document.removeEventListener("mousedown", b);
4031
+ return f && document.addEventListener("mousedown", y), () => {
4032
+ document.removeEventListener("mousedown", y);
4011
4033
  };
4012
4034
  }, [f]);
4013
- const x = r.find((b) => b.id === e), g = (b) => {
4014
- i(b), l(!1), y(!1);
4035
+ const x = r.find((y) => y.id === e), b = (y) => {
4036
+ i(y), l(!1), g(!1);
4015
4037
  };
4016
4038
  return /* @__PURE__ */ w("div", { className: "cuadra-h-16 cuadra-px-4 cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-bg-background", children: [
4017
4039
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
@@ -4022,10 +4044,10 @@ const yo = `
4022
4044
  onClick: c,
4023
4045
  className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed md:cuadra-hidden",
4024
4046
  "aria-label": "Toggle thread list",
4025
- children: /* @__PURE__ */ d(ga, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
4047
+ children: /* @__PURE__ */ d(pa, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
4026
4048
  }
4027
4049
  ),
4028
- n && /* @__PURE__ */ d("div", { className: "cuadra-hidden md:cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(wr, { theme: u }) })
4050
+ n && /* @__PURE__ */ d("div", { className: "cuadra-hidden md:cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(vr, { theme: u }) })
4029
4051
  ] }),
4030
4052
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
4031
4053
  !o && /* @__PURE__ */ d("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
@@ -4040,18 +4062,18 @@ const yo = `
4040
4062
  className: "cuadra-flex cuadra-h-10 cuadra-w-full cuadra-items-center cuadra-justify-between cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-font-brand",
4041
4063
  children: [
4042
4064
  /* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
4043
- /* @__PURE__ */ d(Je, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
4065
+ /* @__PURE__ */ d(et, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
4044
4066
  ]
4045
4067
  }
4046
4068
  ),
4047
- f && r.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ d("div", { className: "cuadra-p-1", children: r.map((b) => /* @__PURE__ */ w(
4069
+ f && r.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ d("div", { className: "cuadra-p-1", children: r.map((y) => /* @__PURE__ */ w(
4048
4070
  "button",
4049
4071
  {
4050
4072
  type: "button",
4051
- onClick: () => g(b.id),
4052
- className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e === b.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
4073
+ onClick: () => b(y.id),
4074
+ className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e === y.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
4053
4075
  children: [
4054
- e === b.id && /* @__PURE__ */ d("span", { className: "cuadra-absolute cuadra-left-2 cuadra-flex cuadra-h-3.5 cuadra-w-3.5 cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ d(
4076
+ e === y.id && /* @__PURE__ */ d("span", { className: "cuadra-absolute cuadra-left-2 cuadra-flex cuadra-h-3.5 cuadra-w-3.5 cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ d(
4055
4077
  "svg",
4056
4078
  {
4057
4079
  xmlns: "http://www.w3.org/2000/svg",
@@ -4070,32 +4092,32 @@ const yo = `
4070
4092
  )
4071
4093
  }
4072
4094
  ) }),
4073
- /* @__PURE__ */ d("span", { children: b.name })
4095
+ /* @__PURE__ */ d("span", { children: y.name })
4074
4096
  ]
4075
4097
  },
4076
- b.id
4098
+ y.id
4077
4099
  )) }) })
4078
4100
  ] }),
4079
4101
  /* @__PURE__ */ w(
4080
4102
  "button",
4081
4103
  {
4082
4104
  type: "button",
4083
- onClick: () => y(!0),
4105
+ onClick: () => g(!0),
4084
4106
  disabled: t || r.length === 0 || !!a,
4085
4107
  className: "cuadra-flex md:cuadra-hidden cuadra-h-10 cuadra-w-full cuadra-items-center cuadra-justify-between cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-font-brand",
4086
4108
  children: [
4087
4109
  /* @__PURE__ */ d("span", { className: x ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: x?.name || "Select model" }),
4088
- /* @__PURE__ */ d(Je, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
4110
+ /* @__PURE__ */ d(et, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
4089
4111
  ]
4090
4112
  }
4091
4113
  ),
4092
- p && typeof document < "u" && Ze(
4114
+ p && typeof document < "u" && Ye(
4093
4115
  /* @__PURE__ */ w(J, { children: [
4094
4116
  /* @__PURE__ */ d(
4095
4117
  "div",
4096
4118
  {
4097
4119
  className: "cuadra-fixed cuadra-inset-0 cuadra-bg-black/50 cuadra-z-50 md:cuadra-hidden",
4098
- onClick: () => y(!1)
4120
+ onClick: () => g(!1)
4099
4121
  }
4100
4122
  ),
4101
4123
  /* @__PURE__ */ w("div", { className: "cuadra-fixed cuadra-inset-0 cuadra-z-50 cuadra-flex cuadra-flex-col cuadra-bg-background md:cuadra-hidden", children: [
@@ -4105,22 +4127,22 @@ const yo = `
4105
4127
  "button",
4106
4128
  {
4107
4129
  type: "button",
4108
- onClick: () => y(!1),
4130
+ onClick: () => g(!1),
4109
4131
  className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-8 cuadra-w-8 cuadra-rounded-full cuadra-bg-muted hover:cuadra-bg-muted/80 cuadra-transition-colors",
4110
4132
  "aria-label": "Close",
4111
- children: /* @__PURE__ */ d(rt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
4133
+ children: /* @__PURE__ */ d(nt, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
4112
4134
  }
4113
4135
  )
4114
4136
  ] }),
4115
- /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-4", children: t ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading models..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : r.length === 0 ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "No models available" }) }) : /* @__PURE__ */ d("div", { className: "cuadra-space-y-2", children: r.map((b) => /* @__PURE__ */ w(
4137
+ /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-4", children: t ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading models..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : r.length === 0 ? /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-py-8", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "No models available" }) }) : /* @__PURE__ */ d("div", { className: "cuadra-space-y-2", children: r.map((y) => /* @__PURE__ */ w(
4116
4138
  "button",
4117
4139
  {
4118
4140
  type: "button",
4119
- onClick: () => g(b.id),
4120
- className: `cuadra-w-full cuadra-flex cuadra-items-center cuadra-justify-between cuadra-rounded-lg cuadra-border cuadra-px-4 cuadra-py-4 cuadra-text-left cuadra-transition-colors font-brand cuadra-bg-background cuadra-text-foreground cuadra-border-border hover:cuadra-bg-muted ${e === b.id ? "cuadra-border-primary" : ""}`,
4141
+ onClick: () => b(y.id),
4142
+ className: `cuadra-w-full cuadra-flex cuadra-items-center cuadra-justify-between cuadra-rounded-lg cuadra-border cuadra-px-4 cuadra-py-4 cuadra-text-left cuadra-transition-colors font-brand cuadra-bg-background cuadra-text-foreground cuadra-border-border hover:cuadra-bg-muted ${e === y.id ? "cuadra-border-primary" : ""}`,
4121
4143
  children: [
4122
- /* @__PURE__ */ d("span", { className: "cuadra-text-base cuadra-font-normal", children: b.name }),
4123
- e === b.id && /* @__PURE__ */ d(
4144
+ /* @__PURE__ */ d("span", { className: "cuadra-text-base cuadra-font-normal", children: y.name }),
4145
+ e === y.id && /* @__PURE__ */ d(
4124
4146
  "svg",
4125
4147
  {
4126
4148
  xmlns: "http://www.w3.org/2000/svg",
@@ -4142,7 +4164,7 @@ const yo = `
4142
4164
  )
4143
4165
  ]
4144
4166
  },
4145
- b.id
4167
+ y.id
4146
4168
  )) }) })
4147
4169
  ] })
4148
4170
  ] }),
@@ -4151,9 +4173,9 @@ const yo = `
4151
4173
  ] })
4152
4174
  ] })
4153
4175
  ] });
4154
- }, xo = Rr(void 0), Qe = ({ children: e, value: r }) => /* @__PURE__ */ d(xo.Provider, { value: r, children: e });
4176
+ }, xo = Dr(void 0), Ze = ({ children: e, value: r }) => /* @__PURE__ */ d(xo.Provider, { value: r, children: e });
4155
4177
  function ko() {
4156
- $(() => {
4178
+ O(() => {
4157
4179
  if (document.querySelector("style[data-cuadra-uikit]"))
4158
4180
  return;
4159
4181
  const r = document.createElement("div");
@@ -4175,7 +4197,7 @@ function ko() {
4175
4197
  }, document.head.appendChild(a), o) break;
4176
4198
  }, []);
4177
4199
  }
4178
- const wo = we(
4200
+ const wo = ve(
4179
4201
  function({ config: r }, t) {
4180
4202
  ko();
4181
4203
  const a = de(null), i = de(!1), {
@@ -4187,181 +4209,183 @@ const wo = we(
4187
4209
  modelId: f,
4188
4210
  onModelChange: l,
4189
4211
  ephemeral: p = !1,
4190
- systemPrompt: y,
4191
- initialThreadId: m,
4192
- welcomeTitle: x,
4193
- welcomeSubtitle: g,
4194
- extraTopPadding: b,
4195
- suggestions: k,
4196
- inputPlaceholder: M,
4197
- preMadeResponseDelay: S = 1e3,
4198
- streamingSpeed: L = 50,
4199
- showThemeToggle: C = !0,
4212
+ systemPrompt: g,
4213
+ enableReasoning: m = !1,
4214
+ initialThreadId: x,
4215
+ welcomeTitle: b,
4216
+ welcomeSubtitle: y,
4217
+ extraTopPadding: k,
4218
+ suggestions: T,
4219
+ inputPlaceholder: L,
4220
+ preMadeResponseDelay: I = 1e3,
4221
+ streamingSpeed: C = 50,
4222
+ showThemeToggle: D = !0,
4200
4223
  initialMessage: A,
4201
4224
  initialPreMadeQA: N,
4202
- theme: _ = "system",
4203
- onError: h,
4204
- onChatCreated: U,
4225
+ theme: h = "system",
4226
+ onError: _,
4227
+ onChatCreated: H,
4205
4228
  onUserMessage: W,
4206
- onThreadIdUpdate: X,
4207
- onLogout: ee,
4208
- enableAttachments: K = !1,
4229
+ onThreadIdUpdate: te,
4230
+ onLogout: Te,
4231
+ enableAttachments: q = !1,
4209
4232
  onBeforeRequest: v
4210
4233
  } = r;
4211
- tt(t, () => ({
4212
- sendMessage: (T) => {
4213
- a.current?.sendMessage(T);
4234
+ at(t, () => ({
4235
+ sendMessage: (M) => {
4236
+ a.current?.sendMessage(M);
4214
4237
  },
4215
- sendPreMadeQA: (T, E, F) => {
4216
- a.current?.sendPreMadeQA(T, E, F);
4238
+ sendPreMadeQA: (M, F, z) => {
4239
+ a.current?.sendPreMadeQA(M, F, z);
4217
4240
  },
4218
4241
  clearChat: () => {
4219
4242
  a.current?.clearChat();
4220
4243
  }
4221
- }), []), $(() => {
4244
+ }), []), O(() => {
4222
4245
  if (i.current) return;
4223
- const T = setTimeout(() => {
4246
+ const M = setTimeout(() => {
4224
4247
  N ? (i.current = !0, a.current?.sendPreMadeQA(
4225
4248
  N.question,
4226
4249
  N.answer,
4227
- { delay: S, streamingSpeed: L }
4250
+ { delay: I, streamingSpeed: C }
4228
4251
  )) : A && (i.current = !0, a.current?.sendMessage(A));
4229
4252
  }, 500);
4230
- return () => clearTimeout(T);
4231
- }, [A, N, S, L]);
4232
- const [I, j] = P(!1), [R, te] = P(null), [D, re] = P(null), [ce, je] = P(!1), $e = de(null), Ce = (T) => {
4233
- if (T < 30) return !0;
4234
- if ($e.current) {
4235
- const E = $e.current.getBoundingClientRect();
4236
- if (T - E.left < 30) return !0;
4253
+ return () => clearTimeout(M);
4254
+ }, [A, N, I, C]);
4255
+ const [S, $] = R(!1), [E, ee] = R(null), [P, re] = R(null), [ce, Oe] = R(!1), Ue = de(null), Me = (M) => {
4256
+ if (M < 30) return !0;
4257
+ if (Ue.current) {
4258
+ const F = Ue.current.getBoundingClientRect();
4259
+ if (M - F.left < 30) return !0;
4237
4260
  }
4238
4261
  return !1;
4239
- }, ut = (T) => {
4240
- const F = T.touches[0].clientX;
4241
- (Ce(F) || I) && (te(F), re(F), je(!0));
4242
- }, st = (T) => {
4243
- if (R === null || !ce) return;
4244
- const E = T.touches[0];
4245
- re(E.clientX);
4246
- }, lt = () => {
4247
- if (R === null || D === null) {
4248
- je(!1);
4262
+ }, lt = (M) => {
4263
+ const z = M.touches[0].clientX;
4264
+ (Me(z) || S) && (ee(z), re(z), Oe(!0));
4265
+ }, dt = (M) => {
4266
+ if (E === null || !ce) return;
4267
+ const F = M.touches[0];
4268
+ re(F.clientX);
4269
+ }, ft = () => {
4270
+ if (E === null || P === null) {
4271
+ Oe(!1);
4249
4272
  return;
4250
4273
  }
4251
- const T = D - R, E = 50, F = 0.3, bt = Math.abs(T) / 300;
4252
- T > E && !I && R !== null ? Ce(R) && j(!0) : ((T < -E || T < 0 && bt > F) && I || I && T < -20 && bt > F) && j(!1), te(null), re(null), je(!1);
4253
- }, Cr = () => {
4254
- if (ce && R !== null && D !== null) {
4255
- const T = D - R;
4256
- if (I)
4257
- return `translateX(${Math.min(0, T)}px)`;
4258
- if (R !== null && Ce(R))
4259
- return `translateX(${Math.min(0, -320 + T)}px)`;
4274
+ const M = P - E, F = 50, z = 0.3, xt = Math.abs(M) / 300;
4275
+ M > F && !S && E !== null ? Me(E) && $(!0) : ((M < -F || M < 0 && xt > z) && S || S && M < -20 && xt > z) && $(!1), ee(null), re(null), Oe(!1);
4276
+ }, Tr = () => {
4277
+ if (ce && E !== null && P !== null) {
4278
+ const M = P - E;
4279
+ if (S)
4280
+ return `translateX(${Math.min(0, M)}px)`;
4281
+ if (E !== null && Me(E))
4282
+ return `translateX(${Math.min(0, -320 + M)}px)`;
4260
4283
  }
4261
- return I ? "translateX(0)" : "translateX(-100%)";
4284
+ return S ? "translateX(0)" : "translateX(-100%)";
4262
4285
  }, Mr = () => {
4263
- if (!ce || R === null || D === null)
4264
- return I ? 0.5 : 0;
4265
- const E = D - R;
4266
- return I ? Math.max(0, Math.min(1, (320 + E) / 320)) * 0.5 : R !== null && Ce(R) ? Math.max(0, Math.min(1, (E + 320) / 320)) * 0.5 : 0;
4267
- }, Me = n || o || "", Te = !!n, dt = q(
4268
- () => new Wt(Me, u || void 0, Te),
4269
- [Me, u, Te]
4270
- ), [ue, Tr] = P(null), [he, ft] = P(!1), [me, ht] = P(null), [Ar, mt] = P(!1);
4271
- $(() => {
4272
- c === "multiChat" && mt(!0);
4286
+ if (!ce || E === null || P === null)
4287
+ return S ? 0.5 : 0;
4288
+ const F = P - E;
4289
+ return S ? Math.max(0, Math.min(1, (320 + F) / 320)) * 0.5 : E !== null && Me(E) ? Math.max(0, Math.min(1, (F + 320) / 320)) * 0.5 : 0;
4290
+ }, Ae = n || o || "", Ne = !!n, ht = V(
4291
+ () => new Ht(Ae, u || void 0, Ne),
4292
+ [Ae, u, Ne]
4293
+ ), [ue, Ar] = R(null), [he, mt] = R(!1), [me, pt] = R(null), [Nr, gt] = R(!1);
4294
+ O(() => {
4295
+ c === "multiChat" && gt(!0);
4273
4296
  }, [c]);
4274
- const se = H(async () => {
4297
+ const se = X(async () => {
4275
4298
  if (s === "selector") {
4276
- ft(!0), ht(null);
4299
+ mt(!0), pt(null);
4277
4300
  try {
4278
- const T = await dt.listModels();
4279
- Tr(T);
4280
- } catch (T) {
4281
- ht(T instanceof Error ? T : new Error("Failed to load models"));
4301
+ const M = await ht.listModels();
4302
+ Ar(M);
4303
+ } catch (M) {
4304
+ pt(M instanceof Error ? M : new Error("Failed to load models"));
4282
4305
  } finally {
4283
- ft(!1);
4306
+ mt(!1);
4284
4307
  }
4285
4308
  }
4286
- }, [dt, s]);
4287
- $(() => {
4309
+ }, [ht, s]);
4310
+ O(() => {
4288
4311
  s === "selector" && se();
4289
- }, [s, se]), $(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = se), () => {
4312
+ }, [s, se]), O(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = se), () => {
4290
4313
  typeof window < "u" && delete window.__cuadraUIKitRefetchModels;
4291
4314
  }), [se]);
4292
- const [Q, pt] = P(
4315
+ const [Q, bt] = R(
4293
4316
  s === "fixed" && f || null
4294
- ), gt = de(Q), pe = H(
4295
- (T) => {
4296
- const E = gt.current;
4297
- pt(T), gt.current = T, l?.(T), E !== null && E !== T && c === "multiChat" && setTimeout(() => {
4298
- const F = window.__cuadraThreadListRuntime;
4299
- if (F?.threads?.switchToNewThread)
4317
+ ), yt = de(Q), pe = X(
4318
+ (M) => {
4319
+ const F = yt.current;
4320
+ bt(M), yt.current = M, l?.(M), F !== null && F !== M && c === "multiChat" && setTimeout(() => {
4321
+ const z = window.__cuadraThreadListRuntime;
4322
+ if (z?.threads?.switchToNewThread)
4300
4323
  try {
4301
- F.threads.switchToNewThread();
4324
+ z.threads.switchToNewThread();
4302
4325
  } catch {
4303
4326
  }
4304
- else if (F?.threads?.createThread)
4327
+ else if (z?.threads?.createThread)
4305
4328
  try {
4306
- F.threads.createThread();
4329
+ z.threads.createThread();
4307
4330
  } catch {
4308
4331
  }
4309
- else if (F?.switchToNewThread)
4332
+ else if (z?.switchToNewThread)
4310
4333
  try {
4311
- F.switchToNewThread();
4334
+ z.switchToNewThread();
4312
4335
  } catch {
4313
4336
  }
4314
4337
  }, 100);
4315
4338
  },
4316
4339
  [l, c]
4317
4340
  );
4318
- $(() => {
4341
+ O(() => {
4319
4342
  if (s === "selector" && ue?.items && ue.items.length > 0 && !Q) {
4320
- const T = ue.items[0];
4321
- if (T?.id) {
4322
- const E = T.id;
4323
- pt(E), l?.(E);
4343
+ const M = ue.items[0];
4344
+ if (M?.id) {
4345
+ const F = M.id;
4346
+ bt(F), l?.(F);
4324
4347
  }
4325
4348
  }
4326
4349
  }, [s, ue?.items, Q, l]);
4327
- const Nr = s === "fixed" ? !!f : !!Q, Ae = q(
4328
- () => (ue?.items || []).filter((T) => T?.id && T?.displayName).map((T) => ({ id: T.id, name: T.displayName })),
4350
+ const Ir = s === "fixed" ? !!f : !!Q, Ie = V(
4351
+ () => (ue?.items || []).filter((M) => M?.id && M?.displayName).map((M) => ({ id: M.id, name: M.displayName })),
4329
4352
  [ue]
4330
- ), Oe = q(
4353
+ ), Be = V(
4331
4354
  () => ({
4332
4355
  currentModelId: Q || "",
4333
- models: Ae,
4356
+ models: Ie,
4334
4357
  modelsLoading: he,
4335
4358
  modelsError: me,
4336
4359
  onModelChange: pe,
4337
4360
  refetchModels: se
4338
4361
  }),
4339
- [Q, Ae, he, me, pe, se]
4362
+ [Q, Ie, he, me, pe, se]
4340
4363
  );
4341
- return s === "selector" && he || c === "multiChat" && Ar ? /* @__PURE__ */ d(Qe, { value: Oe, children: /* @__PURE__ */ d(Ke, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d(Ut, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : s === "selector" && !Nr && me ? /* @__PURE__ */ d(Qe, { value: Oe, children: /* @__PURE__ */ d(Ke, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-destructive font-brand", children: "Failed to load models" }) }) }) }) }) : /* @__PURE__ */ d("div", { className: "cuadra-uikit cuadra-h-full cuadra-w-full", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ d(Qe, { value: Oe, children: /* @__PURE__ */ d(
4342
- Na,
4364
+ return s === "selector" && he || c === "multiChat" && Nr ? /* @__PURE__ */ d(Ze, { value: Be, children: /* @__PURE__ */ d(Ge, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d(Bt, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : s === "selector" && !Ir && me ? /* @__PURE__ */ d(Ze, { value: Be, children: /* @__PURE__ */ d(Ge, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-destructive font-brand", children: "Failed to load models" }) }) }) }) }) : /* @__PURE__ */ d("div", { className: "cuadra-uikit cuadra-h-full cuadra-w-full", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ d(Ze, { value: Be, children: /* @__PURE__ */ d(
4365
+ Aa,
4343
4366
  {
4344
- baseUrl: Te ? Me : o || Me,
4367
+ baseUrl: Ne ? Ae : o || Ae,
4345
4368
  sessionToken: u,
4346
- isProxyMode: Te,
4369
+ isProxyMode: Ne,
4347
4370
  mode: c,
4348
4371
  modelMode: s,
4349
4372
  modelId: Q || f || void 0,
4350
4373
  onModelChange: pe,
4351
4374
  ephemeral: p,
4352
- systemPrompt: y,
4353
- initialThreadId: m,
4354
- enableAttachments: K,
4355
- onError: h,
4356
- onChatCreated: U,
4375
+ systemPrompt: g,
4376
+ enableReasoning: m,
4377
+ initialThreadId: x,
4378
+ enableAttachments: q,
4379
+ onError: _,
4380
+ onChatCreated: H,
4357
4381
  onUserMessage: W,
4358
- onThreadIdUpdate: X,
4382
+ onThreadIdUpdate: te,
4359
4383
  onBeforeRequest: v,
4360
4384
  onChatsLoaded: () => {
4361
- c === "multiChat" && mt(!1);
4385
+ c === "multiChat" && gt(!1);
4362
4386
  },
4363
4387
  children: /* @__PURE__ */ d(
4364
- Ke,
4388
+ Ge,
4365
4389
  {
4366
4390
  paddingX: "cuadra-px-0",
4367
4391
  paddingY: "cuadra-py-0",
@@ -4373,17 +4397,17 @@ const wo = we(
4373
4397
  {
4374
4398
  className: "cuadra-h-full cuadra-flex cuadra-relative",
4375
4399
  style: { height: "100%" },
4376
- onTouchStart: ut,
4377
- onTouchMove: st,
4378
- onTouchEnd: lt,
4400
+ onTouchStart: lt,
4401
+ onTouchMove: dt,
4402
+ onTouchEnd: ft,
4379
4403
  children: c === "multiChat" ? /* @__PURE__ */ w(J, { children: [
4380
- typeof document < "u" && Ze(
4404
+ typeof document < "u" && Ye(
4381
4405
  /* @__PURE__ */ d(
4382
4406
  "div",
4383
4407
  {
4384
- className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${I || ce ? "" : "cuadra-pointer-events-none"}`,
4408
+ className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${S || ce ? "" : "cuadra-pointer-events-none"}`,
4385
4409
  style: { opacity: Mr() },
4386
- onClick: () => j(!1)
4410
+ onClick: () => $(!1)
4387
4411
  }
4388
4412
  ),
4389
4413
  document.body
@@ -4395,36 +4419,36 @@ const wo = we(
4395
4419
  className: "cuadra-hidden md:cuadra-block !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80 cuadra-relative",
4396
4420
  style: { borderRightWidth: "1px", height: "100%" },
4397
4421
  children: /* @__PURE__ */ d(
4398
- _t,
4422
+ Et,
4399
4423
  {
4400
- onThreadSelect: () => j(!1),
4401
- showThemeToggle: C,
4402
- theme: _,
4403
- onLogout: ee
4424
+ onThreadSelect: () => $(!1),
4425
+ showThemeToggle: D,
4426
+ theme: h,
4427
+ onLogout: Te
4404
4428
  }
4405
4429
  )
4406
4430
  }
4407
4431
  ),
4408
- typeof document < "u" && Ze(
4432
+ typeof document < "u" && Ye(
4409
4433
  /* @__PURE__ */ d(
4410
4434
  "div",
4411
4435
  {
4412
- className: `cuadra-block md:cuadra-hidden !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-h-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 ${I || ce ? "" : "cuadra-pointer-events-none"}`,
4436
+ className: `cuadra-block md:cuadra-hidden !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-h-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 ${S || ce ? "" : "cuadra-pointer-events-none"}`,
4413
4437
  style: {
4414
4438
  borderRightWidth: "1px",
4415
- transform: Cr(),
4439
+ transform: Tr(),
4416
4440
  transition: ce ? "none" : "transform 0.3s ease-in-out"
4417
4441
  },
4418
- onTouchStart: ut,
4419
- onTouchMove: st,
4420
- onTouchEnd: lt,
4442
+ onTouchStart: lt,
4443
+ onTouchMove: dt,
4444
+ onTouchEnd: ft,
4421
4445
  children: /* @__PURE__ */ d(
4422
- _t,
4446
+ Et,
4423
4447
  {
4424
- onThreadSelect: () => j(!1),
4425
- showThemeToggle: C,
4426
- theme: _,
4427
- onLogout: ee
4448
+ onThreadSelect: () => $(!1),
4449
+ showThemeToggle: D,
4450
+ theme: h,
4451
+ onLogout: Te
4428
4452
  }
4429
4453
  )
4430
4454
  }
@@ -4432,60 +4456,60 @@ const wo = we(
4432
4456
  document.body
4433
4457
  )
4434
4458
  ] }),
4435
- /* @__PURE__ */ w("div", { ref: $e, className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
4459
+ /* @__PURE__ */ w("div", { ref: Ue, className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
4436
4460
  s === "selector" && /* @__PURE__ */ d(
4437
- Dt,
4461
+ Ft,
4438
4462
  {
4439
4463
  currentModel: Q || "",
4440
- models: Ae,
4464
+ models: Ie,
4441
4465
  modelsLoading: he,
4442
4466
  modelsError: me,
4443
4467
  onModelChange: pe,
4444
- showThemeToggle: C,
4445
- theme: _,
4446
- onMobileMenuClick: () => j(!I),
4468
+ showThemeToggle: D,
4469
+ theme: h,
4470
+ onMobileMenuClick: () => $(!S),
4447
4471
  showMobileMenuButton: c === "multiChat"
4448
4472
  }
4449
4473
  ),
4450
4474
  /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
4451
- Rt,
4475
+ _t,
4452
4476
  {
4453
4477
  ref: a,
4454
- welcomeTitle: x,
4455
- welcomeSubtitle: g,
4456
- extraTopPadding: b,
4457
- suggestions: k,
4458
- inputPlaceholder: M,
4459
- enableAttachments: K,
4460
- preMadeResponseDelay: S,
4461
- streamingSpeed: L
4478
+ welcomeTitle: b,
4479
+ welcomeSubtitle: y,
4480
+ extraTopPadding: k,
4481
+ suggestions: T,
4482
+ inputPlaceholder: L,
4483
+ enableAttachments: q,
4484
+ preMadeResponseDelay: I,
4485
+ streamingSpeed: C
4462
4486
  }
4463
4487
  ) })
4464
4488
  ] })
4465
4489
  ] }) : /* @__PURE__ */ w("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
4466
4490
  s === "selector" && /* @__PURE__ */ d(
4467
- Dt,
4491
+ Ft,
4468
4492
  {
4469
4493
  currentModel: Q || "",
4470
- models: Ae,
4494
+ models: Ie,
4471
4495
  modelsLoading: he,
4472
4496
  modelsError: me,
4473
4497
  onModelChange: pe,
4474
- showThemeToggle: C,
4475
- theme: _
4498
+ showThemeToggle: D,
4499
+ theme: h
4476
4500
  }
4477
4501
  ),
4478
4502
  /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
4479
- Rt,
4503
+ _t,
4480
4504
  {
4481
4505
  ref: a,
4482
- welcomeTitle: x,
4483
- welcomeSubtitle: g,
4484
- extraTopPadding: b,
4485
- suggestions: k,
4486
- inputPlaceholder: M,
4487
- preMadeResponseDelay: S,
4488
- streamingSpeed: L
4506
+ welcomeTitle: b,
4507
+ welcomeSubtitle: y,
4508
+ extraTopPadding: k,
4509
+ suggestions: T,
4510
+ inputPlaceholder: L,
4511
+ preMadeResponseDelay: I,
4512
+ streamingSpeed: C
4489
4513
  }
4490
4514
  ) })
4491
4515
  ] })
@@ -4501,10 +4525,10 @@ function vo(e, r = ":root") {
4501
4525
  if (typeof document > "u")
4502
4526
  return;
4503
4527
  const t = document.documentElement;
4504
- if (e.light && Mo(e.light, t), e.dark) {
4528
+ if (e.light && To(e.light, t), e.dark) {
4505
4529
  let a = document.getElementById("cuadra-theme-dark");
4506
4530
  a || (a = document.createElement("style"), a.id = "cuadra-theme-dark", document.head.appendChild(a));
4507
- const i = To(e.dark);
4531
+ const i = Mo(e.dark);
4508
4532
  a.textContent = `.dark { ${i} }`;
4509
4533
  }
4510
4534
  }
@@ -4537,22 +4561,22 @@ const Co = {
4537
4561
  warning: "warning",
4538
4562
  warningForeground: "warning-foreground"
4539
4563
  };
4540
- function vr(e) {
4564
+ function Cr(e) {
4541
4565
  const r = Co[e];
4542
4566
  return r ? `--cuadra-${r}` : `--cuadra-${e.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
4543
4567
  }
4544
- function Mo(e, r) {
4568
+ function To(e, r) {
4545
4569
  Object.entries(e).forEach(([t, a]) => {
4546
4570
  if (a) {
4547
- const i = vr(t);
4571
+ const i = Cr(t);
4548
4572
  r.style.setProperty(i, a);
4549
4573
  }
4550
4574
  });
4551
4575
  }
4552
- function To(e) {
4553
- return Object.entries(e).map(([r, t]) => t ? `${vr(r)}: ${t};` : "").filter(Boolean).join(" ");
4576
+ function Mo(e) {
4577
+ return Object.entries(e).map(([r, t]) => t ? `${Cr(r)}: ${t};` : "").filter(Boolean).join(" ");
4554
4578
  }
4555
- function _o() {
4579
+ function Do() {
4556
4580
  if (typeof document > "u")
4557
4581
  return;
4558
4582
  const e = document.documentElement;
@@ -4560,12 +4584,12 @@ function _o() {
4560
4584
  const t = document.getElementById("cuadra-theme-dark");
4561
4585
  t && t.remove();
4562
4586
  }
4563
- const Do = we(
4587
+ const _o = ve(
4564
4588
  function(r, t) {
4565
4589
  const a = de(null);
4566
- $(() => {
4590
+ O(() => {
4567
4591
  r.customTheme && vo(r.customTheme);
4568
- }, [r.customTheme]), tt(t, () => ({
4592
+ }, [r.customTheme]), at(t, () => ({
4569
4593
  sendMessage: (o) => {
4570
4594
  a.current?.sendMessage(o);
4571
4595
  },
@@ -4575,7 +4599,7 @@ const Do = we(
4575
4599
  clearChat: () => {
4576
4600
  a.current?.clearChat();
4577
4601
  }
4578
- }), []), $(() => (typeof window < "u" && (window.__cuadraChatControls = {
4602
+ }), []), O(() => (typeof window < "u" && (window.__cuadraChatControls = {
4579
4603
  sendMessage: (o) => a.current?.sendMessage(o),
4580
4604
  sendPreMadeQA: (o, n, u) => a.current?.sendPreMadeQA(o, n, u),
4581
4605
  clearChat: () => a.current?.clearChat()
@@ -4592,6 +4616,7 @@ const Do = we(
4592
4616
  onModelChange: r.onModelChange,
4593
4617
  ephemeral: r.ephemeral,
4594
4618
  systemPrompt: r.systemPrompt,
4619
+ enableReasoning: r.enableReasoning,
4595
4620
  initialThreadId: r.initialThreadId,
4596
4621
  language: r.language,
4597
4622
  welcomeTitle: r.welcomeTitle,
@@ -4618,11 +4643,11 @@ const Do = we(
4618
4643
  }
4619
4644
  );
4620
4645
  export {
4621
- kr as Badge,
4622
- Do as CuadraChat,
4623
- so as SourceCitations,
4646
+ wr as Badge,
4647
+ _o as CuadraChat,
4648
+ uo as SourceCitations,
4624
4649
  vo as applyTheme,
4625
- _o as removeTheme,
4650
+ Do as removeTheme,
4626
4651
  ie as streamingMetadataStore
4627
4652
  };
4628
4653
  //# sourceMappingURL=index.mjs.map