@cuadra-ai/uikit 0.1.25 → 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,10 +1,10 @@
1
1
  var Sr = Object.defineProperty;
2
2
  var Lr = (e, r, t) => r in e ? Sr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
3
  var ae = (e, r, t) => Lr(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { jsx as d, jsxs as w, Fragment as ee } from "react/jsx-runtime";
5
- import kt, { forwardRef as we, createElement as Je, useMemo as X, useState as L, useEffect as O, useCallback as K, memo as Pr, useImperativeHandle as at, useSyncExternalStore as Rr, useRef as de, createContext as _r } from "react";
4
+ import { jsx as d, jsxs as w, Fragment as J } from "react/jsx-runtime";
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
6
  import { createPortal as Ye } from "react-dom";
7
- import { useThreadListItem as zt, RuntimeAdapterProvider as Dr, useLocalRuntime as jt, AssistantRuntimeProvider as $t, unstable_useRemoteThreadListRuntime as Er, useThreadRuntime as Fr, useAssistantApi as zr, ThreadPrimitive as Ne, ComposerPrimitive as ge, useAssistantState as Pe, AttachmentPrimitive as jr, MessagePrimitive as be, ThreadListPrimitive as qe, useThread as $r, ThreadListItemPrimitive as He } from "@assistant-ui/react";
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
8
  import { unstable_memoizeMarkdownComponents as Or, useIsMarkdownCodeBlock as Ur, MarkdownTextPrimitive as Br } from "@assistant-ui/react-markdown";
9
9
  let ye = !1, wt = !1;
10
10
  function vt() {
@@ -55,11 +55,11 @@ function Wr() {
55
55
  }, document.head.appendChild(e);
56
56
  }
57
57
  typeof document < "u" && typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", vt) : vt());
58
- const qr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Hr = (e) => e.replace(
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
61
  ), Ct = (e) => {
62
- const r = Hr(e);
62
+ const r = qr(e);
63
63
  return r.charAt(0).toUpperCase() + r.slice(1);
64
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)
@@ -77,7 +77,7 @@ var Xr = {
77
77
  strokeLinecap: "round",
78
78
  strokeLinejoin: "round"
79
79
  };
80
- const Kr = we(
80
+ const Kr = ve(
81
81
  ({
82
82
  color: e = "currentColor",
83
83
  size: r = 24,
@@ -107,12 +107,12 @@ const Kr = we(
107
107
  )
108
108
  );
109
109
  const U = (e, r) => {
110
- const t = we(
110
+ const t = ve(
111
111
  ({ className: a, ...i }, o) => Je(Kr, {
112
112
  ref: o,
113
113
  iconNode: r,
114
114
  className: Ot(
115
- `lucide-${qr(Ct(e))}`,
115
+ `lucide-${Hr(Ct(e))}`,
116
116
  `lucide-${e}`,
117
117
  a
118
118
  ),
@@ -125,32 +125,22 @@ const Qr = [
125
125
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
126
126
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
127
127
  ], Gr = U("arrow-up", Qr);
128
- const Zr = [
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
- ], Jr = U("brain", Zr);
138
- const Yr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], ea = U("check", Yr);
139
- const ta = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], et = U("chevron-down", ta);
140
- const ra = [
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
- ], aa = U("contrast", ra);
144
- const na = [
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
- ], ia = U("copy", na);
148
- const oa = [
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
- ], ca = U("ellipsis-vertical", oa);
153
- const ua = [
142
+ ], ia = U("ellipsis-vertical", na);
143
+ const oa = [
154
144
  [
155
145
  "path",
156
146
  {
@@ -163,8 +153,8 @@ const ua = [
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
- ], sa = U("file-spreadsheet", ua);
167
- const la = [
156
+ ], ca = U("file-spreadsheet", oa);
157
+ const ua = [
168
158
  [
169
159
  "path",
170
160
  {
@@ -176,8 +166,8 @@ const la = [
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
- ], Ut = U("file-text", la);
180
- const da = [
169
+ ], Ut = U("file-text", ua);
170
+ const sa = [
181
171
  [
182
172
  "path",
183
173
  {
@@ -189,19 +179,19 @@ const da = [
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
- ], fa = U("file-type", da);
193
- const ha = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Bt = U("loader-circle", ha);
194
- const ma = [
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
- ], pa = U("log-out", ma);
199
- const ga = [
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
- ], ba = U("menu", ga);
204
- const ya = [
193
+ ], pa = U("menu", ma);
194
+ const ga = [
205
195
  [
206
196
  "path",
207
197
  {
@@ -209,16 +199,16 @@ const ya = [
209
199
  key: "1miecu"
210
200
  }
211
201
  ]
212
- ], Wt = U("paperclip", ya);
213
- const xa = [
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
- ], ka = U("plus", xa);
217
- const wa = [
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
- ], nt = U("x", wa);
221
- class qt {
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);
@@ -464,7 +454,7 @@ class qt {
464
454
  return c.json();
465
455
  }
466
456
  }
467
- async function* va(e, r) {
457
+ async function* ka(e, r) {
468
458
  const t = e.getReader(), a = new TextDecoder();
469
459
  let i = "";
470
460
  try {
@@ -497,7 +487,7 @@ async function* va(e, r) {
497
487
  t.releaseLock();
498
488
  }
499
489
  }
500
- function Ca(e) {
490
+ function wa(e) {
501
491
  return e.map((r) => {
502
492
  let t = "";
503
493
  if (typeof r.content == "string")
@@ -513,7 +503,7 @@ function Ca(e) {
513
503
  };
514
504
  });
515
505
  }
516
- function Ma(e) {
506
+ function va(e) {
517
507
  return {
518
508
  id: e.id,
519
509
  role: e.role,
@@ -545,8 +535,8 @@ function Ma(e) {
545
535
  }
546
536
  };
547
537
  }
548
- const Re = /* @__PURE__ */ new Map();
549
- function Ta(e, r) {
538
+ const De = /* @__PURE__ */ new Map();
539
+ function Ca(e, r) {
550
540
  return {
551
541
  async list() {
552
542
  const t = [];
@@ -567,7 +557,7 @@ function Ta(e, r) {
567
557
  }).filter((u) => u !== null) };
568
558
  },
569
559
  async initialize(t) {
570
- return { remoteId: Re.get(t) || t, externalId: void 0 };
560
+ return { remoteId: De.get(t) || t, externalId: void 0 };
571
561
  },
572
562
  async rename(t, a) {
573
563
  await e.updateChat(t, { title: a });
@@ -603,7 +593,7 @@ function Ta(e, r) {
603
593
  },
604
594
  // Add a method to update the remoteId mapping when chat ID is received
605
595
  updateRemoteId(t, a) {
606
- Re.set(t, a), r?.(t, a);
596
+ De.set(t, a), r?.(t, a);
607
597
  },
608
598
  // Provider component that adds thread-specific history adapter
609
599
  unstable_Provider: ({ children: t }) => {
@@ -613,7 +603,7 @@ function Ta(e, r) {
613
603
  if (!i) return { messages: [] };
614
604
  try {
615
605
  const u = await e.getChat(i);
616
- return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((s) => Ma(s)) };
606
+ return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((s) => va(s)) };
617
607
  } catch {
618
608
  return { messages: [] };
619
609
  }
@@ -623,11 +613,11 @@ function Ta(e, r) {
623
613
  }),
624
614
  [i, e]
625
615
  ), n = kt.useMemo(() => ({ history: o }), [o]);
626
- return /* @__PURE__ */ d(Dr, { adapters: n, children: t });
616
+ return /* @__PURE__ */ d(_r, { adapters: n, children: t });
627
617
  }
628
618
  };
629
619
  }
630
- class Aa {
620
+ class Ta {
631
621
  constructor() {
632
622
  /** Per-message metadata, keyed by message ID */
633
623
  ae(this, "messageMetadata", /* @__PURE__ */ new Map());
@@ -687,36 +677,36 @@ class Aa {
687
677
  this.listeners.forEach((r) => r());
688
678
  }
689
679
  }
690
- const ie = new Aa(), Mt = /* @__PURE__ */ new Map(), Ht = [];
691
- let Ie = [];
692
- function Na(e, r, t = 50, a = 800) {
693
- Ht.push({ question: e, response: r, streamingSpeed: t, initialDelay: a });
680
+ const ie = new Ta(), Tt = /* @__PURE__ */ new Map(), qt = [];
681
+ let Le = [];
682
+ function Ma(e, r, t = 50, a = 800) {
683
+ qt.push({ question: e, response: r, streamingSpeed: t, initialDelay: a });
694
684
  }
695
685
  function Vt(e, r) {
696
686
  const { modelId: t, systemPrompt: a, ephemeral: i, enableReasoning: o, onChatCreated: n, onUserMessage: u, onThreadIdUpdate: c, onBeforeRequest: s } = r;
697
687
  let f;
698
688
  return {
699
689
  async *run(l) {
700
- const { messages: p, abortSignal: g, context: m } = l, x = Ht.shift();
690
+ const { messages: p, abortSignal: g, context: m } = l, x = qt.shift();
701
691
  if (x) {
702
692
  u?.();
703
693
  const v = x.initialDelay ?? 800;
704
- if (v > 0 && await new Promise(($) => setTimeout($, v)), g?.aborted)
694
+ if (v > 0 && await new Promise((P) => setTimeout(P, v)), g?.aborted)
705
695
  throw new Error("Request aborted");
706
- const j = x.response.split(" ");
707
- let _ = "";
708
- const B = x.streamingSpeed || 50, E = `premade-${Date.now()}`;
709
- i && n?.(E);
710
- for (let $ = 0; $ < j.length; $++) {
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++) {
711
701
  if (g?.aborted)
712
702
  throw new Error("Request aborted");
713
- _ += ($ === 0 ? "" : " ") + j[$], yield {
714
- content: [{ type: "text", text: _ }]
715
- }, await new Promise((V) => setTimeout(V, B + Math.random() * (B * 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)));
716
706
  }
717
707
  yield {
718
- content: [{ type: "text", text: _ }]
719
- }, Ie.push(
708
+ content: [{ type: "text", text: $ }]
709
+ }, Le.push(
720
710
  { role: "user", content: x.question },
721
711
  { role: "assistant", content: x.response }
722
712
  );
@@ -725,28 +715,28 @@ function Vt(e, r) {
725
715
  const b = m?.threadId;
726
716
  let y = b;
727
717
  if (!y && p.length > 0) {
728
- const v = p.find((j) => j.role === "user");
729
- v && (y = (typeof v.content == "string" ? v.content : Array.isArray(v.content) && v.content.find((_) => _.type === "text")?.text || "").substring(0, 50));
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));
730
720
  }
731
721
  let k;
732
- b && (k = Re.get(b)), !k && y && (k = Mt.get(y)), !k && f && (k = f), u?.();
733
- let M = p, S = -1;
722
+ b && (k = De.get(b)), !k && y && (k = Tt.get(y)), !k && f && (k = f), u?.();
723
+ let T = p, L = -1;
734
724
  for (let v = p.length - 1; v >= 0; v--)
735
725
  if (p[v].role === "assistant") {
736
- S = v;
726
+ L = v;
737
727
  break;
738
728
  }
739
- (k || S >= 0) && S >= 0 && (M = p.slice(S + 1));
740
- const N = Ca(M);
741
- if (Ie.length > 0 && !k) {
742
- const v = Ie.map((j) => ({
743
- role: j.role,
744
- content: j.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
745
735
  }));
746
- N.unshift(...v), Ie = [];
736
+ I.unshift(...v), Le = [];
747
737
  }
748
738
  const C = {
749
- messages: N,
739
+ messages: I,
750
740
  chatId: k || null,
751
741
  // Use server chatId if available
752
742
  systemPrompt: a,
@@ -756,41 +746,41 @@ function Vt(e, r) {
756
746
  };
757
747
  if (t && t.trim() !== "" && (C.modelId = t), s && !await s())
758
748
  throw new Error("Request blocked");
759
- const P = await e.createOrContinueChat(C, g);
760
- let A = "", I = "", h;
761
- const R = [];
762
- let q = 0;
763
- const G = `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
764
- ie.clear(), ie.setCurrentMessage(G);
765
- const re = () => {
766
- R.length !== q && (q = R.length, ie.update({
767
- sources: R.length > 0 ? [...R] : 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
768
758
  }));
769
- }, H = () => {
770
- re();
759
+ }, q = () => {
760
+ Te();
771
761
  const v = [];
772
- return I && v.push({ type: "reasoning", text: I }), A && v.push({ type: "text", text: A }), v.length === 0 && v.push({ type: "text", text: "" }), { content: v };
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 };
773
763
  };
774
- for await (const v of va(P, g)) {
764
+ for await (const v of ka(D, g)) {
775
765
  if (g?.aborted)
776
766
  throw new Error("Request aborted");
777
- const j = v.id || v.chatId || v.messageId;
778
- j && !h && (h = j, f = j, n?.(j), b && c && (c(b, j), Re.set(b, j)), y && Mt.set(y, j));
779
- const _ = v.sources;
780
- if (_ && Array.isArray(_) && _.length > 0)
781
- for (const $ of _)
782
- R.some((V) => V.sourceId === $.sourceId) || R.push({
783
- sourceId: $.sourceId,
784
- filename: $.filename || "Unknown",
785
- score: $.score ?? 1,
786
- chunkId: $.chunkId,
787
- datasetId: $.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
788
778
  });
789
- const B = v.reasoning;
790
- if (B && B.length > 0 && (I += B, yield H()), v.type)
779
+ const E = v.reasoning;
780
+ if (E && E.length > 0 && (N += E, yield q()), v.type)
791
781
  switch (v.type) {
792
782
  case "source-document":
793
- v.sourceId && R.push({
783
+ v.sourceId && _.push({
794
784
  sourceId: v.sourceId,
795
785
  filename: v.title || "Unknown",
796
786
  score: 1
@@ -799,13 +789,13 @@ function Vt(e, r) {
799
789
  case "reasoning-start":
800
790
  continue;
801
791
  case "reasoning-delta":
802
- v.delta && (I += v.delta), (A || I) && (yield H());
792
+ v.delta && (N += v.delta), (A || N) && (yield q());
803
793
  continue;
804
794
  case "reasoning-end":
805
- (A || I) && (yield H());
795
+ (A || N) && (yield q());
806
796
  continue;
807
797
  case "text-delta":
808
- v.delta && (A += v.delta), A && (yield H());
798
+ v.delta && (N && !W && !A && (W = !0, await new Promise((P) => setTimeout(P, 400))), A += v.delta), A && (yield q());
809
799
  continue;
810
800
  case "error":
811
801
  throw new Error(v.errorText || "Stream error");
@@ -817,14 +807,14 @@ function Vt(e, r) {
817
807
  case "finish":
818
808
  continue;
819
809
  }
820
- const E = v.delta;
821
- if (E != null && (A += E), v.content && (A += v.content), v.message && (A += v.message.content || ""), v.finished) {
822
- (A || I || R.length > 0) && (yield H());
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());
823
813
  break;
824
814
  }
825
- (A || I || R.length > 0) && (yield H());
815
+ (A || N || _.length > 0) && (yield q());
826
816
  }
827
- (A || I || R.length > 0) && (yield H());
817
+ (A || N || _.length > 0) && (yield q());
828
818
  }
829
819
  };
830
820
  }
@@ -869,7 +859,7 @@ function Xt() {
869
859
  }
870
860
  };
871
861
  }
872
- function Ia({
862
+ function Aa({
873
863
  children: e,
874
864
  baseUrl: r,
875
865
  sessionToken: t,
@@ -889,43 +879,43 @@ function Ia({
889
879
  enableAttachments: b = !1,
890
880
  onBeforeRequest: y
891
881
  }) {
892
- const k = X(
893
- () => new qt(r, t || void 0, a),
882
+ const k = V(
883
+ () => new Ht(r, t || void 0, a),
894
884
  [r, t, a]
895
- ), [M, S] = L(o || null);
885
+ ), [T, L] = R(o || null);
896
886
  O(() => {
897
- o && S(o);
887
+ o && L(o);
898
888
  }, [o]);
899
- const N = K(
889
+ const I = X(
900
890
  (A) => {
901
891
  p?.(A);
902
892
  },
903
893
  [p]
904
- ), C = K(
905
- (A, I) => {
906
- m?.(A, I);
894
+ ), C = X(
895
+ (A, N) => {
896
+ m?.(A, N);
907
897
  },
908
898
  [m]
909
- ), P = X(() => Vt(k, {
910
- modelId: M || void 0,
899
+ ), D = V(() => Vt(k, {
900
+ modelId: T || void 0,
911
901
  // Pass undefined if not set (backend resolves it)
912
902
  systemPrompt: c,
913
903
  ephemeral: u,
914
904
  enableReasoning: s,
915
- onChatCreated: N,
905
+ onChatCreated: I,
916
906
  onUserMessage: g,
917
907
  onBeforeRequest: y
918
- }), [k, M, c, u, s, N, g, y]);
919
- return i === "singleChat" ? /* @__PURE__ */ d(Sa, { modelAdapter: P, enableAttachments: b, children: e }) : /* @__PURE__ */ d(
920
- La,
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,
921
911
  {
922
912
  client: k,
923
913
  modelAdapterOptions: {
924
- modelId: M || void 0,
914
+ modelId: T || void 0,
925
915
  systemPrompt: c,
926
916
  ephemeral: u,
927
917
  enableReasoning: s,
928
- onChatCreated: N,
918
+ onChatCreated: I,
929
919
  onUserMessage: g,
930
920
  onBeforeRequest: y
931
921
  },
@@ -938,19 +928,19 @@ function Ia({
938
928
  }
939
929
  );
940
930
  }
941
- function Sa({
931
+ function Na({
942
932
  modelAdapter: e,
943
933
  enableAttachments: r,
944
934
  children: t
945
935
  }) {
946
- const a = X(() => r ? Xt() : void 0, [r]), i = jt(e, {
936
+ const a = V(() => r ? Xt() : void 0, [r]), i = jt(e, {
947
937
  adapters: {
948
938
  ...a && { attachments: a }
949
939
  }
950
940
  });
951
941
  return /* @__PURE__ */ d($t, { runtime: i, children: t });
952
942
  }
953
- function La({
943
+ function Ia({
954
944
  client: e,
955
945
  modelAdapterOptions: r,
956
946
  initialThreadId: t,
@@ -960,14 +950,14 @@ function La({
960
950
  enableAttachments: n,
961
951
  children: u
962
952
  }) {
963
- const c = X(() => Ta(e, (x, b) => {
953
+ const c = V(() => Ca(e, (x, b) => {
964
954
  i?.(x, b);
965
- }), [e, i]), s = K(
955
+ }), [e, i]), s = X(
966
956
  (x, b) => {
967
957
  c.updateRemoteId && c.updateRemoteId(x, b), i?.(x, b);
968
958
  },
969
959
  [c, i]
970
- ), f = X(() => ({
960
+ ), f = V(() => ({
971
961
  ...c,
972
962
  async list() {
973
963
  const x = await c.list();
@@ -977,10 +967,10 @@ function La({
977
967
  O(() => {
978
968
  window.__cuadraThreadListAdapter = f, window.__cuadraThreadListRuntime = null;
979
969
  }, [f]);
980
- const l = X(() => Vt(e, {
970
+ const l = V(() => Vt(e, {
981
971
  ...r,
982
972
  onThreadIdUpdate: s
983
- }), [e, r, s]), p = X(() => n ? Xt() : void 0, [n]), g = K(() => jt(l, {
973
+ }), [e, r, s]), p = V(() => n ? Xt() : void 0, [n]), g = X(() => jt(l, {
984
974
  adapters: {
985
975
  ...p && { attachments: p }
986
976
  }
@@ -992,7 +982,7 @@ function La({
992
982
  window.__cuadraThreadListRuntime = m;
993
983
  }, [m]), /* @__PURE__ */ d($t, { runtime: m, children: u });
994
984
  }
995
- function Tt(e, r) {
985
+ function Mt(e, r) {
996
986
  const t = String(e);
997
987
  if (typeof r != "string")
998
988
  throw new TypeError("Expected character");
@@ -1001,8 +991,8 @@ function Tt(e, r) {
1001
991
  a++, i = t.indexOf(r, i + r.length);
1002
992
  return a;
1003
993
  }
1004
- const xe = Fe(/[A-Za-z]/), it = Fe(/[\dA-Za-z]/);
1005
- function Pa(e) {
994
+ const ke = ze(/[A-Za-z]/), it = ze(/[\dA-Za-z]/);
995
+ function Sa(e) {
1006
996
  return (
1007
997
  // Special whitespace codes (which have negative values), C0 and Control
1008
998
  // character DEL
@@ -1012,25 +1002,25 @@ function Pa(e) {
1012
1002
  function fe(e) {
1013
1003
  return e !== null && e < -2;
1014
1004
  }
1015
- function W(e) {
1005
+ function B(e) {
1016
1006
  return e !== null && (e < 0 || e === 32);
1017
1007
  }
1018
- function J(e) {
1008
+ function G(e) {
1019
1009
  return e === -2 || e === -1 || e === 32;
1020
1010
  }
1021
- const Ee = Fe(/\p{P}|\p{S}/u), oe = Fe(/\s/);
1022
- function Fe(e) {
1011
+ const Fe = ze(/\p{P}|\p{S}/u), oe = ze(/\s/);
1012
+ function ze(e) {
1023
1013
  return r;
1024
1014
  function r(t) {
1025
1015
  return t !== null && t > -1 && e.test(String.fromCharCode(t));
1026
1016
  }
1027
1017
  }
1028
- function Ra(e) {
1018
+ function La(e) {
1029
1019
  if (typeof e != "string")
1030
1020
  throw new TypeError("Expected a string");
1031
1021
  return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
1032
1022
  }
1033
- const ze = (
1023
+ const je = (
1034
1024
  // Note: overloads in JSDoc can’t yet use different `@template`s.
1035
1025
  /**
1036
1026
  * @type {(
@@ -1047,29 +1037,29 @@ const ze = (
1047
1037
  */
1048
1038
  (function(e) {
1049
1039
  if (e == null)
1050
- return Fa;
1040
+ return _a;
1051
1041
  if (typeof e == "function")
1052
- return je(e);
1042
+ return $e(e);
1053
1043
  if (typeof e == "object")
1054
- return Array.isArray(e) ? _a(e) : (
1044
+ return Array.isArray(e) ? Pa(e) : (
1055
1045
  // Cast because `ReadonlyArray` goes into the above but `isArray`
1056
1046
  // narrows to `Array`.
1057
- Da(
1047
+ Ra(
1058
1048
  /** @type {Props} */
1059
1049
  e
1060
1050
  )
1061
1051
  );
1062
1052
  if (typeof e == "string")
1063
- return Ea(e);
1053
+ return Da(e);
1064
1054
  throw new Error("Expected function, string, or object as test");
1065
1055
  })
1066
1056
  );
1067
- function _a(e) {
1057
+ function Pa(e) {
1068
1058
  const r = [];
1069
1059
  let t = -1;
1070
1060
  for (; ++t < e.length; )
1071
- r[t] = ze(e[t]);
1072
- return je(a);
1061
+ r[t] = je(e[t]);
1062
+ return $e(a);
1073
1063
  function a(...i) {
1074
1064
  let o = -1;
1075
1065
  for (; ++o < r.length; )
@@ -1077,12 +1067,12 @@ function _a(e) {
1077
1067
  return !1;
1078
1068
  }
1079
1069
  }
1080
- function Da(e) {
1070
+ function Ra(e) {
1081
1071
  const r = (
1082
1072
  /** @type {Record<string, unknown>} */
1083
1073
  e
1084
1074
  );
1085
- return je(t);
1075
+ return $e(t);
1086
1076
  function t(a) {
1087
1077
  const i = (
1088
1078
  /** @type {Record<string, unknown>} */
@@ -1095,16 +1085,16 @@ function Da(e) {
1095
1085
  return !0;
1096
1086
  }
1097
1087
  }
1098
- function Ea(e) {
1099
- return je(r);
1088
+ function Da(e) {
1089
+ return $e(r);
1100
1090
  function r(t) {
1101
1091
  return t && t.type === e;
1102
1092
  }
1103
1093
  }
1104
- function je(e) {
1094
+ function $e(e) {
1105
1095
  return r;
1106
1096
  function r(t, a, i) {
1107
- return !!(za(t) && e.call(
1097
+ return !!(Ea(t) && e.call(
1108
1098
  this,
1109
1099
  t,
1110
1100
  typeof a == "number" ? a : void 0,
@@ -1112,17 +1102,17 @@ function je(e) {
1112
1102
  ));
1113
1103
  }
1114
1104
  }
1115
- function Fa() {
1105
+ function _a() {
1116
1106
  return !0;
1117
1107
  }
1118
- function za(e) {
1108
+ function Ea(e) {
1119
1109
  return e !== null && typeof e == "object" && "type" in e;
1120
1110
  }
1121
- const Kt = [], ja = !0, tt = !1, $a = "skip";
1111
+ const Kt = [], Fa = !0, tt = !1, za = "skip";
1122
1112
  function Qt(e, r, t, a) {
1123
1113
  let i;
1124
1114
  typeof r == "function" && typeof t != "function" ? (a = t, t = r) : i = r;
1125
- const o = ze(i), n = a ? -1 : 1;
1115
+ const o = je(i), n = a ? -1 : 1;
1126
1116
  u(e, void 0, [])();
1127
1117
  function u(c, s, f) {
1128
1118
  const l = (
@@ -1144,14 +1134,14 @@ function Qt(e, r, t, a) {
1144
1134
  return p;
1145
1135
  function p() {
1146
1136
  let g = Kt, m, x, b;
1147
- if ((!r || o(c, s, f[f.length - 1] || void 0)) && (g = Oa(t(c, f)), g[0] === tt))
1137
+ if ((!r || o(c, s, f[f.length - 1] || void 0)) && (g = ja(t(c, f)), g[0] === tt))
1148
1138
  return g;
1149
1139
  if ("children" in c && c.children) {
1150
1140
  const y = (
1151
1141
  /** @type {UnistParent} */
1152
1142
  c
1153
1143
  );
1154
- if (y.children && g[0] !== $a)
1144
+ if (y.children && g[0] !== za)
1155
1145
  for (x = (a ? y.children.length : -1) + n, b = f.concat(y); x > -1 && x < y.children.length; ) {
1156
1146
  const k = y.children[x];
1157
1147
  if (m = u(k, x, b)(), m[0] === tt)
@@ -1163,11 +1153,11 @@ function Qt(e, r, t, a) {
1163
1153
  }
1164
1154
  }
1165
1155
  }
1166
- function Oa(e) {
1167
- return Array.isArray(e) ? e : typeof e == "number" ? [ja, e] : e == null ? Kt : [e];
1156
+ function ja(e) {
1157
+ return Array.isArray(e) ? e : typeof e == "number" ? [Fa, e] : e == null ? Kt : [e];
1168
1158
  }
1169
- function Ua(e, r, t) {
1170
- const i = ze((t || {}).ignore || []), o = Ba(r);
1159
+ function $a(e, r, t) {
1160
+ const i = je((t || {}).ignore || []), o = Oa(r);
1171
1161
  let n = -1;
1172
1162
  for (; ++n < o.length; )
1173
1163
  Qt(e, "text", u);
@@ -1192,25 +1182,25 @@ function Ua(e, r, t) {
1192
1182
  const b = l.children.indexOf(s);
1193
1183
  let y = !1, k = [];
1194
1184
  p.lastIndex = 0;
1195
- let M = p.exec(s.value);
1196
- for (; M; ) {
1197
- const S = M.index, N = {
1198
- index: M.index,
1199
- 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,
1200
1190
  stack: [...f, s]
1201
1191
  };
1202
- let C = g(...M, N);
1203
- 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({
1204
1194
  type: "text",
1205
- value: s.value.slice(m, S)
1206
- }), Array.isArray(C) ? k.push(...C) : C && k.push(C), m = S + M[0].length, y = !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)
1207
1197
  break;
1208
- M = p.exec(s.value);
1198
+ T = p.exec(s.value);
1209
1199
  }
1210
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;
1211
1201
  }
1212
1202
  }
1213
- function Ba(e) {
1203
+ function Oa(e) {
1214
1204
  const r = [];
1215
1205
  if (!Array.isArray(e))
1216
1206
  throw new TypeError("Expected find and replace tuple or list of tuples");
@@ -1218,37 +1208,37 @@ function Ba(e) {
1218
1208
  let a = -1;
1219
1209
  for (; ++a < t.length; ) {
1220
1210
  const i = t[a];
1221
- r.push([Wa(i[0]), qa(i[1])]);
1211
+ r.push([Ua(i[0]), Ba(i[1])]);
1222
1212
  }
1223
1213
  return r;
1224
1214
  }
1225
- function Wa(e) {
1226
- return typeof e == "string" ? new RegExp(Ra(e), "g") : e;
1215
+ function Ua(e) {
1216
+ return typeof e == "string" ? new RegExp(La(e), "g") : e;
1227
1217
  }
1228
- function qa(e) {
1218
+ function Ba(e) {
1229
1219
  return typeof e == "function" ? e : function() {
1230
1220
  return e;
1231
1221
  };
1232
1222
  }
1233
1223
  const Ve = "phrasing", Xe = ["autolink", "link", "image", "label"];
1234
- function Ha() {
1224
+ function Wa() {
1235
1225
  return {
1236
- transforms: [Ja],
1226
+ transforms: [Ga],
1237
1227
  enter: {
1238
- literalAutolink: Xa,
1228
+ literalAutolink: qa,
1239
1229
  literalAutolinkEmail: Ke,
1240
1230
  literalAutolinkHttp: Ke,
1241
1231
  literalAutolinkWww: Ke
1242
1232
  },
1243
1233
  exit: {
1244
- literalAutolink: Za,
1245
- literalAutolinkEmail: Ga,
1246
- literalAutolinkHttp: Ka,
1247
- literalAutolinkWww: Qa
1234
+ literalAutolink: Qa,
1235
+ literalAutolinkEmail: Ka,
1236
+ literalAutolinkHttp: Va,
1237
+ literalAutolinkWww: Xa
1248
1238
  }
1249
1239
  };
1250
1240
  }
1251
- function Va() {
1241
+ function Ha() {
1252
1242
  return {
1253
1243
  unsafe: [
1254
1244
  {
@@ -1275,41 +1265,41 @@ function Va() {
1275
1265
  ]
1276
1266
  };
1277
1267
  }
1278
- function Xa(e) {
1268
+ function qa(e) {
1279
1269
  this.enter({ type: "link", title: null, url: "", children: [] }, e);
1280
1270
  }
1281
1271
  function Ke(e) {
1282
1272
  this.config.enter.autolinkProtocol.call(this, e);
1283
1273
  }
1284
- function Ka(e) {
1274
+ function Va(e) {
1285
1275
  this.config.exit.autolinkProtocol.call(this, e);
1286
1276
  }
1287
- function Qa(e) {
1277
+ function Xa(e) {
1288
1278
  this.config.exit.data.call(this, e);
1289
1279
  const r = this.stack[this.stack.length - 1];
1290
1280
  r.type, r.url = "http://" + this.sliceSerialize(e);
1291
1281
  }
1292
- function Ga(e) {
1282
+ function Ka(e) {
1293
1283
  this.config.exit.autolinkEmail.call(this, e);
1294
1284
  }
1295
- function Za(e) {
1285
+ function Qa(e) {
1296
1286
  this.exit(e);
1297
1287
  }
1298
- function Ja(e) {
1299
- Ua(
1288
+ function Ga(e) {
1289
+ $a(
1300
1290
  e,
1301
1291
  [
1302
- [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Ya],
1303
- [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, en]
1292
+ [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Za],
1293
+ [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Ja]
1304
1294
  ],
1305
1295
  { ignore: ["link", "linkReference"] }
1306
1296
  );
1307
1297
  }
1308
- function Ya(e, r, t, a, i) {
1298
+ function Za(e, r, t, a, i) {
1309
1299
  let o = "";
1310
- if (!Gt(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !tn(t)))
1300
+ if (!Gt(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !Ya(t)))
1311
1301
  return !1;
1312
- const n = rn(t + a);
1302
+ const n = en(t + a);
1313
1303
  if (!n[0]) return !1;
1314
1304
  const u = {
1315
1305
  type: "link",
@@ -1319,7 +1309,7 @@ function Ya(e, r, t, a, i) {
1319
1309
  };
1320
1310
  return n[1] ? [u, { type: "text", value: n[1] }] : u;
1321
1311
  }
1322
- function en(e, r, t, a) {
1312
+ function Ja(e, r, t, a) {
1323
1313
  return (
1324
1314
  // Not an expected previous character.
1325
1315
  !Gt(a, !0) || // Label ends in not allowed character.
@@ -1331,65 +1321,65 @@ function en(e, r, t, a) {
1331
1321
  }
1332
1322
  );
1333
1323
  }
1334
- function tn(e) {
1324
+ function Ya(e) {
1335
1325
  const r = e.split(".");
1336
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])));
1337
1327
  }
1338
- function rn(e) {
1328
+ function en(e) {
1339
1329
  const r = /[!"&'),.:;<>?\]}]+$/.exec(e);
1340
1330
  if (!r)
1341
1331
  return [e, void 0];
1342
1332
  e = e.slice(0, r.index);
1343
1333
  let t = r[0], a = t.indexOf(")");
1344
- const i = Tt(e, "(");
1345
- let o = Tt(e, ")");
1334
+ const i = Mt(e, "(");
1335
+ let o = Mt(e, ")");
1346
1336
  for (; a !== -1 && i > o; )
1347
1337
  e += t.slice(0, a + 1), t = t.slice(a + 1), a = t.indexOf(")"), o++;
1348
1338
  return [e, t];
1349
1339
  }
1350
1340
  function Gt(e, r) {
1351
1341
  const t = e.input.charCodeAt(e.index - 1);
1352
- return (e.index === 0 || oe(t) || Ee(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.
1353
1343
  (!r || t !== 47);
1354
1344
  }
1355
- function ve(e) {
1345
+ function Ce(e) {
1356
1346
  return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
1357
1347
  }
1358
- Zt.peek = fn;
1359
- function an() {
1348
+ Zt.peek = ln;
1349
+ function tn() {
1360
1350
  this.buffer();
1361
1351
  }
1362
- function nn(e) {
1352
+ function rn(e) {
1363
1353
  this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
1364
1354
  }
1365
- function on() {
1355
+ function an() {
1366
1356
  this.buffer();
1367
1357
  }
1368
- function cn(e) {
1358
+ function nn(e) {
1369
1359
  this.enter(
1370
1360
  { type: "footnoteDefinition", identifier: "", label: "", children: [] },
1371
1361
  e
1372
1362
  );
1373
1363
  }
1374
- function un(e) {
1364
+ function on(e) {
1375
1365
  const r = this.resume(), t = this.stack[this.stack.length - 1];
1376
- t.type, t.identifier = ve(
1366
+ t.type, t.identifier = Ce(
1377
1367
  this.sliceSerialize(e)
1378
1368
  ).toLowerCase(), t.label = r;
1379
1369
  }
1380
- function sn(e) {
1370
+ function cn(e) {
1381
1371
  this.exit(e);
1382
1372
  }
1383
- function ln(e) {
1373
+ function un(e) {
1384
1374
  const r = this.resume(), t = this.stack[this.stack.length - 1];
1385
- t.type, t.identifier = ve(
1375
+ t.type, t.identifier = Ce(
1386
1376
  this.sliceSerialize(e)
1387
1377
  ).toLowerCase(), t.label = r;
1388
1378
  }
1389
- function dn(e) {
1379
+ function sn(e) {
1390
1380
  this.exit(e);
1391
1381
  }
1392
- function fn() {
1382
+ function ln() {
1393
1383
  return "[";
1394
1384
  }
1395
1385
  function Zt(e, r, t, a) {
@@ -1400,23 +1390,23 @@ function Zt(e, r, t, a) {
1400
1390
  t.safe(t.associationId(e), { after: "]", before: o })
1401
1391
  ), u(), n(), o += i.move("]"), o;
1402
1392
  }
1403
- function hn() {
1393
+ function dn() {
1404
1394
  return {
1405
1395
  enter: {
1406
- gfmFootnoteCallString: an,
1407
- gfmFootnoteCall: nn,
1408
- gfmFootnoteDefinitionLabelString: on,
1409
- gfmFootnoteDefinition: cn
1396
+ gfmFootnoteCallString: tn,
1397
+ gfmFootnoteCall: rn,
1398
+ gfmFootnoteDefinitionLabelString: an,
1399
+ gfmFootnoteDefinition: nn
1410
1400
  },
1411
1401
  exit: {
1412
- gfmFootnoteCallString: un,
1413
- gfmFootnoteCall: sn,
1414
- gfmFootnoteDefinitionLabelString: ln,
1415
- gfmFootnoteDefinition: dn
1402
+ gfmFootnoteCallString: on,
1403
+ gfmFootnoteCall: cn,
1404
+ gfmFootnoteDefinitionLabelString: un,
1405
+ gfmFootnoteDefinition: sn
1416
1406
  }
1417
1407
  };
1418
1408
  }
1419
- function mn(e) {
1409
+ function fn(e) {
1420
1410
  let r = !1;
1421
1411
  return e && e.firstLineBlank && (r = !0), {
1422
1412
  handlers: { footnoteDefinition: t, footnoteReference: Zt },
@@ -1433,18 +1423,18 @@ function mn(e) {
1433
1423
  (r ? `
1434
1424
  ` : " ") + o.indentLines(
1435
1425
  o.containerFlow(a, u.current()),
1436
- r ? Jt : pn
1426
+ r ? Jt : hn
1437
1427
  )
1438
1428
  )), s(), c;
1439
1429
  }
1440
1430
  }
1441
- function pn(e, r, t) {
1431
+ function hn(e, r, t) {
1442
1432
  return r === 0 ? e : Jt(e, r, t);
1443
1433
  }
1444
1434
  function Jt(e, r, t) {
1445
1435
  return (t ? "" : " ") + e;
1446
1436
  }
1447
- const gn = [
1437
+ const mn = [
1448
1438
  "autolink",
1449
1439
  "destinationLiteral",
1450
1440
  "destinationRaw",
@@ -1452,30 +1442,30 @@ const gn = [
1452
1442
  "titleQuote",
1453
1443
  "titleApostrophe"
1454
1444
  ];
1455
- Yt.peek = wn;
1456
- function bn() {
1445
+ Yt.peek = xn;
1446
+ function pn() {
1457
1447
  return {
1458
1448
  canContainEols: ["delete"],
1459
- enter: { strikethrough: xn },
1460
- exit: { strikethrough: kn }
1449
+ enter: { strikethrough: bn },
1450
+ exit: { strikethrough: yn }
1461
1451
  };
1462
1452
  }
1463
- function yn() {
1453
+ function gn() {
1464
1454
  return {
1465
1455
  unsafe: [
1466
1456
  {
1467
1457
  character: "~",
1468
1458
  inConstruct: "phrasing",
1469
- notInConstruct: gn
1459
+ notInConstruct: mn
1470
1460
  }
1471
1461
  ],
1472
1462
  handlers: { delete: Yt }
1473
1463
  };
1474
1464
  }
1475
- function xn(e) {
1465
+ function bn(e) {
1476
1466
  this.enter({ type: "delete", children: [] }, e);
1477
1467
  }
1478
- function kn(e) {
1468
+ function yn(e) {
1479
1469
  this.exit(e);
1480
1470
  }
1481
1471
  function Yt(e, r, t, a) {
@@ -1487,23 +1477,23 @@ function Yt(e, r, t, a) {
1487
1477
  after: "~"
1488
1478
  }), n += i.move("~~"), o(), n;
1489
1479
  }
1490
- function wn() {
1480
+ function xn() {
1491
1481
  return "~";
1492
1482
  }
1493
- function vn(e) {
1483
+ function kn(e) {
1494
1484
  return e.length;
1495
1485
  }
1496
- function Cn(e, r) {
1497
- const t = r || {}, a = (t.align || []).concat(), i = t.stringLength || vn, 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 = [];
1498
1488
  let s = 0, f = -1;
1499
1489
  for (; ++f < e.length; ) {
1500
1490
  const x = [], b = [];
1501
1491
  let y = -1;
1502
1492
  for (e[f].length > s && (s = e[f].length); ++y < e[f].length; ) {
1503
- const k = Mn(e[f][y]);
1493
+ const k = vn(e[f][y]);
1504
1494
  if (t.alignDelimiters !== !1) {
1505
- const M = i(k);
1506
- b[y] = M, (c[y] === void 0 || M > c[y]) && (c[y] = M);
1495
+ const T = i(k);
1496
+ b[y] = T, (c[y] === void 0 || T > c[y]) && (c[y] = T);
1507
1497
  }
1508
1498
  x.push(k);
1509
1499
  }
@@ -1528,8 +1518,8 @@ function Cn(e, r) {
1528
1518
  1,
1529
1519
  c[l] - b.length - y.length
1530
1520
  );
1531
- const M = b + "-".repeat(k) + y;
1532
- t.alignDelimiters !== !1 && (k = b.length + k + y.length, k > c[l] && (c[l] = k), g[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;
1533
1523
  }
1534
1524
  n.splice(1, 0, p), u.splice(1, 0, g), f = -1;
1535
1525
  const m = [];
@@ -1539,14 +1529,14 @@ function Cn(e, r) {
1539
1529
  const y = [];
1540
1530
  for (; ++l < s; ) {
1541
1531
  const k = x[l] || "";
1542
- let M = "", S = "";
1532
+ let T = "", L = "";
1543
1533
  if (t.alignDelimiters !== !1) {
1544
- const N = c[l] - (b[l] || 0), C = o[l];
1545
- C === 114 ? M = " ".repeat(N) : C === 99 ? N % 2 ? (M = " ".repeat(N / 2 + 0.5), S = " ".repeat(N / 2 - 0.5)) : (M = " ".repeat(N / 2), S = M) : S = " ".repeat(N);
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);
1546
1536
  }
1547
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
1548
1538
  // empty: there will be a closing space.
1549
- !(t.alignDelimiters === !1 && k === "") && (t.delimiterStart !== !1 || l) && y.push(" "), t.alignDelimiters !== !1 && y.push(M), y.push(k), t.alignDelimiters !== !1 && y.push(S), t.padding !== !1 && y.push(" "), (t.delimiterEnd !== !1 || l !== s - 1) && y.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("|");
1550
1540
  }
1551
1541
  m.push(
1552
1542
  t.delimiterEnd === !1 ? y.join("").replace(/ +$/, "") : y.join("")
@@ -1555,26 +1545,26 @@ function Cn(e, r) {
1555
1545
  return m.join(`
1556
1546
  `);
1557
1547
  }
1558
- function Mn(e) {
1548
+ function vn(e) {
1559
1549
  return e == null ? "" : String(e);
1560
1550
  }
1561
1551
  function At(e) {
1562
1552
  const r = typeof e == "string" ? e.codePointAt(0) : 0;
1563
1553
  return r === 67 || r === 99 ? 99 : r === 76 || r === 108 ? 108 : r === 82 || r === 114 ? 114 : 0;
1564
1554
  }
1565
- function Tn(e, r, t, a) {
1555
+ function Cn(e, r, t, a) {
1566
1556
  const i = t.enter("blockquote"), o = t.createTracker(a);
1567
1557
  o.move("> "), o.shift(2);
1568
1558
  const n = t.indentLines(
1569
1559
  t.containerFlow(e, o.current()),
1570
- An
1560
+ Tn
1571
1561
  );
1572
1562
  return i(), n;
1573
1563
  }
1574
- function An(e, r, t) {
1564
+ function Tn(e, r, t) {
1575
1565
  return ">" + (t ? "" : " ") + e;
1576
1566
  }
1577
- function Nn(e, r) {
1567
+ function Mn(e, r) {
1578
1568
  return Nt(e, r.inConstruct, !0) && !Nt(e, r.notInConstruct, !1);
1579
1569
  }
1580
1570
  function Nt(e, r, t) {
@@ -1590,12 +1580,12 @@ function It(e, r, t, a) {
1590
1580
  let i = -1;
1591
1581
  for (; ++i < t.unsafe.length; )
1592
1582
  if (t.unsafe[i].character === `
1593
- ` && Nn(t.stack, t.unsafe[i]))
1583
+ ` && Mn(t.stack, t.unsafe[i]))
1594
1584
  return /[ \t]/.test(a.before) ? "" : " ";
1595
1585
  return `\\
1596
1586
  `;
1597
1587
  }
1598
- function In(e, r) {
1588
+ function An(e, r) {
1599
1589
  const t = String(e);
1600
1590
  let a = t.indexOf(r), i = a, o = 0, n = 0;
1601
1591
  if (typeof r != "string")
@@ -1604,13 +1594,13 @@ function In(e, r) {
1604
1594
  a === i ? ++o > n && (n = o) : o = 1, i = a + r.length, a = t.indexOf(r, i);
1605
1595
  return n;
1606
1596
  }
1607
- function Sn(e, r) {
1597
+ function Nn(e, r) {
1608
1598
  return !!(r.options.fences === !1 && e.value && // If there’s no info…
1609
1599
  !e.lang && // And there’s a non-whitespace character…
1610
1600
  /[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
1611
1601
  !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
1612
1602
  }
1613
- function Ln(e) {
1603
+ function In(e) {
1614
1604
  const r = e.options.fence || "`";
1615
1605
  if (r !== "`" && r !== "~")
1616
1606
  throw new Error(
@@ -1618,13 +1608,13 @@ function Ln(e) {
1618
1608
  );
1619
1609
  return r;
1620
1610
  }
1621
- function Pn(e, r, t, a) {
1622
- const i = Ln(t), o = e.value || "", n = i === "`" ? "GraveAccent" : "Tilde";
1623
- if (Sn(e, t)) {
1624
- const l = t.enter("codeIndented"), p = t.indentLines(o, Rn);
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);
1625
1615
  return l(), p;
1626
1616
  }
1627
- const u = t.createTracker(a), c = i.repeat(Math.max(In(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");
1628
1618
  let f = u.move(c);
1629
1619
  if (e.lang) {
1630
1620
  const l = t.enter(`codeFencedLang${n}`);
@@ -1653,7 +1643,7 @@ function Pn(e, r, t, a) {
1653
1643
  `), o && (f += u.move(o + `
1654
1644
  `)), f += u.move(c), s(), f;
1655
1645
  }
1656
- function Rn(e, r, t) {
1646
+ function Ln(e, r, t) {
1657
1647
  return (t ? "" : " ") + e;
1658
1648
  }
1659
1649
  function ot(e) {
@@ -1664,7 +1654,7 @@ function ot(e) {
1664
1654
  );
1665
1655
  return r;
1666
1656
  }
1667
- function _n(e, r, t, a) {
1657
+ function Pn(e, r, t, a) {
1668
1658
  const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("definition");
1669
1659
  let u = t.enter("label");
1670
1660
  const c = t.createTracker(a);
@@ -1694,7 +1684,7 @@ function _n(e, r, t, a) {
1694
1684
  })
1695
1685
  ), s += c.move(i), u()), n(), s;
1696
1686
  }
1697
- function Dn(e) {
1687
+ function Rn(e) {
1698
1688
  const r = e.options.emphasis || "*";
1699
1689
  if (r !== "*" && r !== "_")
1700
1690
  throw new Error(
@@ -1702,16 +1692,16 @@ function Dn(e) {
1702
1692
  );
1703
1693
  return r;
1704
1694
  }
1705
- function ke(e) {
1695
+ function we(e) {
1706
1696
  return "&#x" + e.toString(16).toUpperCase() + ";";
1707
1697
  }
1708
1698
  function _e(e) {
1709
- if (e === null || W(e) || oe(e))
1699
+ if (e === null || B(e) || oe(e))
1710
1700
  return 1;
1711
- if (Ee(e))
1701
+ if (Fe(e))
1712
1702
  return 2;
1713
1703
  }
1714
- function De(e, r, t) {
1704
+ function Ee(e, r, t) {
1715
1705
  const a = _e(e), i = _e(r);
1716
1706
  return a === void 0 ? i === void 0 ? (
1717
1707
  // Letter inside:
@@ -1744,9 +1734,9 @@ function De(e, r, t) {
1744
1734
  { inside: !1, outside: !1 }
1745
1735
  );
1746
1736
  }
1747
- er.peek = En;
1737
+ er.peek = Dn;
1748
1738
  function er(e, r, t, a) {
1749
- const i = Dn(t), o = t.enter("emphasis"), n = t.createTracker(a), u = n.move(i);
1739
+ const i = Rn(t), o = t.enter("emphasis"), n = t.createTracker(a), u = n.move(i);
1750
1740
  let c = n.move(
1751
1741
  t.containerPhrasing(e, {
1752
1742
  after: i,
@@ -1754,24 +1744,24 @@ function er(e, r, t, a) {
1754
1744
  ...n.current()
1755
1745
  })
1756
1746
  );
1757
- const s = c.charCodeAt(0), f = De(
1747
+ const s = c.charCodeAt(0), f = Ee(
1758
1748
  a.before.charCodeAt(a.before.length - 1),
1759
1749
  s,
1760
1750
  i
1761
1751
  );
1762
- f.inside && (c = ke(s) + c.slice(1));
1763
- const l = c.charCodeAt(c.length - 1), p = De(a.after.charCodeAt(0), l, i);
1764
- p.inside && (c = c.slice(0, -1) + ke(l));
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));
1765
1755
  const g = n.move(i);
1766
1756
  return o(), t.attentionEncodeSurroundingInfo = {
1767
1757
  after: p.outside,
1768
1758
  before: f.outside
1769
1759
  }, u + c + g;
1770
1760
  }
1771
- function En(e, r, t) {
1761
+ function Dn(e, r, t) {
1772
1762
  return t.options.emphasis || "*";
1773
1763
  }
1774
- function Fn(e, r, t, a) {
1764
+ function _n(e, r, t, a) {
1775
1765
  let i, o, n;
1776
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);
1777
1767
  function u(c, s) {
@@ -1779,13 +1769,13 @@ function Fn(e, r, t, a) {
1779
1769
  return n(c, l, f);
1780
1770
  }
1781
1771
  }
1782
- const zn = {};
1772
+ const En = {};
1783
1773
  function tr(e, r) {
1784
- const t = zn, a = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1774
+ const t = En, a = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1785
1775
  return rr(e, a, i);
1786
1776
  }
1787
1777
  function rr(e, r, t) {
1788
- if (jn(e)) {
1778
+ if (Fn(e)) {
1789
1779
  if ("value" in e)
1790
1780
  return e.type === "html" && !t ? "" : e.value;
1791
1781
  if (r && "alt" in e && e.alt)
@@ -1802,19 +1792,19 @@ function St(e, r, t) {
1802
1792
  a[i] = rr(e[i], r, t);
1803
1793
  return a.join("");
1804
1794
  }
1805
- function jn(e) {
1795
+ function Fn(e) {
1806
1796
  return !!(e && typeof e == "object");
1807
1797
  }
1808
- function $n(e, r) {
1798
+ function zn(e, r) {
1809
1799
  let t = !1;
1810
- return Fn(e, function(a) {
1800
+ return _n(e, function(a) {
1811
1801
  if ("value" in a && /\r?\n|\r/.test(a.value) || a.type === "break")
1812
1802
  return t = !0, tt;
1813
1803
  }), !!((!e.depth || e.depth < 3) && tr(e) && (r.options.setext || t));
1814
1804
  }
1815
- function On(e, r, t, a) {
1805
+ function jn(e, r, t, a) {
1816
1806
  const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(a);
1817
- if ($n(e, t)) {
1807
+ if (zn(e, t)) {
1818
1808
  const f = t.enter("headingSetext"), l = t.enter("phrasing"), p = t.containerPhrasing(e, {
1819
1809
  ...o.current(),
1820
1810
  before: `
@@ -1839,16 +1829,16 @@ function On(e, r, t, a) {
1839
1829
  `,
1840
1830
  ...o.current()
1841
1831
  });
1842
- 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;
1843
1833
  }
1844
- ar.peek = Un;
1834
+ ar.peek = $n;
1845
1835
  function ar(e) {
1846
1836
  return e.value || "";
1847
1837
  }
1848
- function Un() {
1838
+ function $n() {
1849
1839
  return "<";
1850
1840
  }
1851
- nr.peek = Bn;
1841
+ nr.peek = On;
1852
1842
  function nr(e, r, t, a) {
1853
1843
  const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.enter("image");
1854
1844
  let u = t.enter("label");
@@ -1874,10 +1864,10 @@ function nr(e, r, t, a) {
1874
1864
  })
1875
1865
  ), s += c.move(i), u()), s += c.move(")"), n(), s;
1876
1866
  }
1877
- function Bn() {
1867
+ function On() {
1878
1868
  return "!";
1879
1869
  }
1880
- ir.peek = Wn;
1870
+ ir.peek = Un;
1881
1871
  function ir(e, r, t, a) {
1882
1872
  const i = e.referenceType, o = t.enter("imageReference");
1883
1873
  let n = t.enter("label");
@@ -1898,10 +1888,10 @@ function ir(e, r, t, a) {
1898
1888
  });
1899
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;
1900
1890
  }
1901
- function Wn() {
1891
+ function Un() {
1902
1892
  return "!";
1903
1893
  }
1904
- or.peek = qn;
1894
+ or.peek = Bn;
1905
1895
  function or(e, r, t) {
1906
1896
  let a = e.value || "", i = "`", o = -1;
1907
1897
  for (; new RegExp("(^|[^`])" + i + "([^`]|$)").test(a); )
@@ -1917,7 +1907,7 @@ function or(e, r, t) {
1917
1907
  }
1918
1908
  return i + a + i;
1919
1909
  }
1920
- function qn() {
1910
+ function Bn() {
1921
1911
  return "`";
1922
1912
  }
1923
1913
  function cr(e, r) {
@@ -1931,7 +1921,7 @@ function cr(e, r) {
1931
1921
  // references don’t work), space, or angle brackets…
1932
1922
  !/[\0- <>\u007F]/.test(e.url));
1933
1923
  }
1934
- ur.peek = Hn;
1924
+ ur.peek = Wn;
1935
1925
  function ur(e, r, t, a) {
1936
1926
  const i = ot(t), o = i === '"' ? "Quote" : "Apostrophe", n = t.createTracker(a);
1937
1927
  let u, c;
@@ -1973,10 +1963,10 @@ function ur(e, r, t, a) {
1973
1963
  })
1974
1964
  ), s += n.move(i), c()), s += n.move(")"), u(), s;
1975
1965
  }
1976
- function Hn(e, r, t) {
1966
+ function Wn(e, r, t) {
1977
1967
  return cr(e, t) ? "<" : "[";
1978
1968
  }
1979
- sr.peek = Vn;
1969
+ sr.peek = Hn;
1980
1970
  function sr(e, r, t, a) {
1981
1971
  const i = e.referenceType, o = t.enter("linkReference");
1982
1972
  let n = t.enter("label");
@@ -1997,7 +1987,7 @@ function sr(e, r, t, a) {
1997
1987
  });
1998
1988
  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;
1999
1989
  }
2000
- function Vn() {
1990
+ function Hn() {
2001
1991
  return "[";
2002
1992
  }
2003
1993
  function ct(e) {
@@ -2008,7 +1998,7 @@ function ct(e) {
2008
1998
  );
2009
1999
  return r;
2010
2000
  }
2011
- function Xn(e) {
2001
+ function qn(e) {
2012
2002
  const r = ct(e), t = e.options.bulletOther;
2013
2003
  if (!t)
2014
2004
  return r === "*" ? "-" : "*";
@@ -2022,7 +2012,7 @@ function Xn(e) {
2022
2012
  );
2023
2013
  return t;
2024
2014
  }
2025
- function Kn(e) {
2015
+ function Vn(e) {
2026
2016
  const r = e.options.bulletOrdered || ".";
2027
2017
  if (r !== "." && r !== ")")
2028
2018
  throw new Error(
@@ -2038,10 +2028,10 @@ function lr(e) {
2038
2028
  );
2039
2029
  return r;
2040
2030
  }
2041
- function Qn(e, r, t, a) {
2031
+ function Xn(e, r, t, a) {
2042
2032
  const i = t.enter("list"), o = t.bulletCurrent;
2043
- let n = e.ordered ? Kn(t) : ct(t);
2044
- const u = e.ordered ? n === "." ? ")" : "." : Xn(t);
2033
+ let n = e.ordered ? Vn(t) : ct(t);
2034
+ const u = e.ordered ? n === "." ? ")" : "." : qn(t);
2045
2035
  let c = r && t.bulletLastUsed ? n === t.bulletLastUsed : !1;
2046
2036
  if (!e.ordered) {
2047
2037
  const f = e.children ? e.children[0] : void 0;
@@ -2066,7 +2056,7 @@ function Qn(e, r, t, a) {
2066
2056
  const s = t.containerFlow(e, a);
2067
2057
  return t.bulletLastUsed = n, t.bulletCurrent = o, i(), s;
2068
2058
  }
2069
- function Gn(e) {
2059
+ function Kn(e) {
2070
2060
  const r = e.options.listItemIndent || "one";
2071
2061
  if (r !== "tab" && r !== "one" && r !== "mixed")
2072
2062
  throw new Error(
@@ -2074,8 +2064,8 @@ function Gn(e) {
2074
2064
  );
2075
2065
  return r;
2076
2066
  }
2077
- function Zn(e, r, t, a) {
2078
- const i = Gn(t);
2067
+ function Qn(e, r, t, a) {
2068
+ const i = Kn(t);
2079
2069
  let o = t.bulletCurrent || ct(t);
2080
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);
2081
2071
  let n = o.length + 1;
@@ -2091,13 +2081,13 @@ function Zn(e, r, t, a) {
2091
2081
  return p ? (g ? "" : " ".repeat(n)) + l : (g ? o : o + " ".repeat(n - o.length)) + l;
2092
2082
  }
2093
2083
  }
2094
- function Jn(e, r, t, a) {
2084
+ function Gn(e, r, t, a) {
2095
2085
  const i = t.enter("paragraph"), o = t.enter("phrasing"), n = t.containerPhrasing(e, a);
2096
2086
  return o(), i(), n;
2097
2087
  }
2098
- const Yn = (
2088
+ const Zn = (
2099
2089
  /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
2100
- ze([
2090
+ je([
2101
2091
  "break",
2102
2092
  "delete",
2103
2093
  "emphasis",
@@ -2121,12 +2111,12 @@ const Yn = (
2121
2111
  "textDirective"
2122
2112
  ])
2123
2113
  );
2124
- function ei(e, r, t, a) {
2114
+ function Jn(e, r, t, a) {
2125
2115
  return (e.children.some(function(n) {
2126
- return Yn(n);
2116
+ return Zn(n);
2127
2117
  }) ? t.containerPhrasing : t.containerFlow).call(t, e, a);
2128
2118
  }
2129
- function ti(e) {
2119
+ function Yn(e) {
2130
2120
  const r = e.options.strong || "*";
2131
2121
  if (r !== "*" && r !== "_")
2132
2122
  throw new Error(
@@ -2134,9 +2124,9 @@ function ti(e) {
2134
2124
  );
2135
2125
  return r;
2136
2126
  }
2137
- dr.peek = ri;
2127
+ dr.peek = ei;
2138
2128
  function dr(e, r, t, a) {
2139
- const i = ti(t), o = t.enter("strong"), n = t.createTracker(a), u = n.move(i + i);
2129
+ const i = Yn(t), o = t.enter("strong"), n = t.createTracker(a), u = n.move(i + i);
2140
2130
  let c = n.move(
2141
2131
  t.containerPhrasing(e, {
2142
2132
  after: i,
@@ -2144,27 +2134,27 @@ function dr(e, r, t, a) {
2144
2134
  ...n.current()
2145
2135
  })
2146
2136
  );
2147
- const s = c.charCodeAt(0), f = De(
2137
+ const s = c.charCodeAt(0), f = Ee(
2148
2138
  a.before.charCodeAt(a.before.length - 1),
2149
2139
  s,
2150
2140
  i
2151
2141
  );
2152
- f.inside && (c = ke(s) + c.slice(1));
2153
- const l = c.charCodeAt(c.length - 1), p = De(a.after.charCodeAt(0), l, i);
2154
- p.inside && (c = c.slice(0, -1) + ke(l));
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));
2155
2145
  const g = n.move(i + i);
2156
2146
  return o(), t.attentionEncodeSurroundingInfo = {
2157
2147
  after: p.outside,
2158
2148
  before: f.outside
2159
2149
  }, u + c + g;
2160
2150
  }
2161
- function ri(e, r, t) {
2151
+ function ei(e, r, t) {
2162
2152
  return t.options.strong || "*";
2163
2153
  }
2164
- function ai(e, r, t, a) {
2154
+ function ti(e, r, t, a) {
2165
2155
  return t.safe(e.value, a);
2166
2156
  }
2167
- function ni(e) {
2157
+ function ri(e) {
2168
2158
  const r = e.options.ruleRepetition || 3;
2169
2159
  if (r < 3)
2170
2160
  throw new Error(
@@ -2172,50 +2162,50 @@ function ni(e) {
2172
2162
  );
2173
2163
  return r;
2174
2164
  }
2175
- function ii(e, r, t) {
2176
- const a = (lr(t) + (t.options.ruleSpaces ? " " : "")).repeat(ni(t));
2165
+ function ai(e, r, t) {
2166
+ const a = (lr(t) + (t.options.ruleSpaces ? " " : "")).repeat(ri(t));
2177
2167
  return t.options.ruleSpaces ? a.slice(0, -1) : a;
2178
2168
  }
2179
2169
  const fr = {
2180
- blockquote: Tn,
2170
+ blockquote: Cn,
2181
2171
  break: It,
2182
- code: Pn,
2183
- definition: _n,
2172
+ code: Sn,
2173
+ definition: Pn,
2184
2174
  emphasis: er,
2185
2175
  hardBreak: It,
2186
- heading: On,
2176
+ heading: jn,
2187
2177
  html: ar,
2188
2178
  image: nr,
2189
2179
  imageReference: ir,
2190
2180
  inlineCode: or,
2191
2181
  link: ur,
2192
2182
  linkReference: sr,
2193
- list: Qn,
2194
- listItem: Zn,
2195
- paragraph: Jn,
2196
- root: ei,
2183
+ list: Xn,
2184
+ listItem: Qn,
2185
+ paragraph: Gn,
2186
+ root: Jn,
2197
2187
  strong: dr,
2198
- text: ai,
2199
- thematicBreak: ii
2188
+ text: ti,
2189
+ thematicBreak: ai
2200
2190
  };
2201
- function oi() {
2191
+ function ni() {
2202
2192
  return {
2203
2193
  enter: {
2204
- table: ci,
2194
+ table: ii,
2205
2195
  tableData: Lt,
2206
2196
  tableHeader: Lt,
2207
- tableRow: si
2197
+ tableRow: ci
2208
2198
  },
2209
2199
  exit: {
2210
- codeText: li,
2211
- table: ui,
2200
+ codeText: ui,
2201
+ table: oi,
2212
2202
  tableData: Qe,
2213
2203
  tableHeader: Qe,
2214
2204
  tableRow: Qe
2215
2205
  }
2216
2206
  };
2217
2207
  }
2218
- function ci(e) {
2208
+ function ii(e) {
2219
2209
  const r = e._align;
2220
2210
  this.enter(
2221
2211
  {
@@ -2228,10 +2218,10 @@ function ci(e) {
2228
2218
  e
2229
2219
  ), this.data.inTable = !0;
2230
2220
  }
2231
- function ui(e) {
2221
+ function oi(e) {
2232
2222
  this.exit(e), this.data.inTable = void 0;
2233
2223
  }
2234
- function si(e) {
2224
+ function ci(e) {
2235
2225
  this.enter({ type: "tableRow", children: [] }, e);
2236
2226
  }
2237
2227
  function Qe(e) {
@@ -2240,16 +2230,16 @@ function Qe(e) {
2240
2230
  function Lt(e) {
2241
2231
  this.enter({ type: "tableCell", children: [] }, e);
2242
2232
  }
2243
- function li(e) {
2233
+ function ui(e) {
2244
2234
  let r = this.resume();
2245
- this.data.inTable && (r = r.replace(/\\([\\|])/g, di));
2235
+ this.data.inTable && (r = r.replace(/\\([\\|])/g, si));
2246
2236
  const t = this.stack[this.stack.length - 1];
2247
2237
  t.type, t.value = r, this.exit(e);
2248
2238
  }
2249
- function di(e, r) {
2239
+ function si(e, r) {
2250
2240
  return r === "|" ? r : e;
2251
2241
  }
2252
- function fi(e) {
2242
+ function li(e) {
2253
2243
  const r = e || {}, t = r.tableCellPadding, a = r.tablePipeAlign, i = r.stringLength, o = t ? " " : "|";
2254
2244
  return {
2255
2245
  unsafe: [
@@ -2287,15 +2277,15 @@ function fi(e) {
2287
2277
  `));
2288
2278
  }
2289
2279
  function c(g, m, x, b) {
2290
- const y = x.enter("tableCell"), k = x.enter("phrasing"), M = x.containerPhrasing(g, {
2280
+ const y = x.enter("tableCell"), k = x.enter("phrasing"), T = x.containerPhrasing(g, {
2291
2281
  ...b,
2292
2282
  before: o,
2293
2283
  after: o
2294
2284
  });
2295
- return k(), y(), M;
2285
+ return k(), y(), T;
2296
2286
  }
2297
2287
  function s(g, m) {
2298
- return Cn(g, {
2288
+ return wn(g, {
2299
2289
  align: m,
2300
2290
  // @ts-expect-error: `markdown-table` types should support `null`.
2301
2291
  alignDelimiters: a,
@@ -2308,44 +2298,44 @@ function fi(e) {
2308
2298
  function f(g, m, x) {
2309
2299
  const b = g.children;
2310
2300
  let y = -1;
2311
- const k = [], M = m.enter("table");
2301
+ const k = [], T = m.enter("table");
2312
2302
  for (; ++y < b.length; )
2313
2303
  k[y] = l(b[y], m, x);
2314
- return M(), k;
2304
+ return T(), k;
2315
2305
  }
2316
2306
  function l(g, m, x) {
2317
2307
  const b = g.children;
2318
2308
  let y = -1;
2319
- const k = [], M = m.enter("tableRow");
2309
+ const k = [], T = m.enter("tableRow");
2320
2310
  for (; ++y < b.length; )
2321
2311
  k[y] = c(b[y], g, m, x);
2322
- return M(), k;
2312
+ return T(), k;
2323
2313
  }
2324
2314
  function p(g, m, x) {
2325
2315
  let b = fr.inlineCode(g, m, x);
2326
2316
  return x.stack.includes("tableCell") && (b = b.replace(/\|/g, "\\$&")), b;
2327
2317
  }
2328
2318
  }
2329
- function hi() {
2319
+ function di() {
2330
2320
  return {
2331
2321
  exit: {
2332
2322
  taskListCheckValueChecked: Pt,
2333
2323
  taskListCheckValueUnchecked: Pt,
2334
- paragraph: pi
2324
+ paragraph: hi
2335
2325
  }
2336
2326
  };
2337
2327
  }
2338
- function mi() {
2328
+ function fi() {
2339
2329
  return {
2340
2330
  unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
2341
- handlers: { listItem: gi }
2331
+ handlers: { listItem: mi }
2342
2332
  };
2343
2333
  }
2344
2334
  function Pt(e) {
2345
2335
  const r = this.stack[this.stack.length - 2];
2346
2336
  r.type, r.checked = e.type === "taskListCheckValueChecked";
2347
2337
  }
2348
- function pi(e) {
2338
+ function hi(e) {
2349
2339
  const r = this.stack[this.stack.length - 2];
2350
2340
  if (r && r.type === "listItem" && typeof r.checked == "boolean") {
2351
2341
  const t = this.stack[this.stack.length - 1];
@@ -2366,7 +2356,7 @@ function pi(e) {
2366
2356
  }
2367
2357
  this.exit(e);
2368
2358
  }
2369
- function gi(e, r, t, a) {
2359
+ function mi(e, r, t, a) {
2370
2360
  const i = e.children[0], o = typeof e.checked == "boolean" && i && i.type === "paragraph", n = "[" + (e.checked ? "x" : " ") + "] ", u = t.createTracker(a);
2371
2361
  o && u.move(n);
2372
2362
  let c = fr.listItem(e, r, t, {
@@ -2378,27 +2368,27 @@ function gi(e, r, t, a) {
2378
2368
  return f + n;
2379
2369
  }
2380
2370
  }
2381
- function bi() {
2371
+ function pi() {
2382
2372
  return [
2383
- Ha(),
2384
- hn(),
2385
- bn(),
2386
- oi(),
2387
- hi()
2373
+ Wa(),
2374
+ dn(),
2375
+ pn(),
2376
+ ni(),
2377
+ di()
2388
2378
  ];
2389
2379
  }
2390
- function yi(e) {
2380
+ function gi(e) {
2391
2381
  return {
2392
2382
  extensions: [
2393
- Va(),
2394
- mn(e),
2395
- yn(),
2396
- fi(e),
2397
- mi()
2383
+ Ha(),
2384
+ fn(e),
2385
+ gn(),
2386
+ li(e),
2387
+ fi()
2398
2388
  ]
2399
2389
  };
2400
2390
  }
2401
- function Le(e, r, t, a) {
2391
+ function Re(e, r, t, a) {
2402
2392
  const i = e.length;
2403
2393
  let o = 0, n;
2404
2394
  if (r < 0 ? r = -r > i ? 0 : i + r : r = r > i ? i : r, t = t > 0 ? t : 0, a.length < 1e4)
@@ -2408,14 +2398,14 @@ function Le(e, r, t, a) {
2408
2398
  n = a.slice(o, o + 1e4), n.unshift(r, 0), e.splice(...n), o += 1e4, r += 1e4;
2409
2399
  }
2410
2400
  const Rt = {}.hasOwnProperty;
2411
- function xi(e) {
2401
+ function bi(e) {
2412
2402
  const r = {};
2413
2403
  let t = -1;
2414
2404
  for (; ++t < e.length; )
2415
- ki(r, e[t]);
2405
+ yi(r, e[t]);
2416
2406
  return r;
2417
2407
  }
2418
- function ki(e, r) {
2408
+ function yi(e, r) {
2419
2409
  let t;
2420
2410
  for (t in r) {
2421
2411
  const i = (Rt.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
@@ -2424,7 +2414,7 @@ function ki(e, r) {
2424
2414
  for (n in o) {
2425
2415
  Rt.call(i, n) || (i[n] = []);
2426
2416
  const u = o[n];
2427
- wi(
2417
+ xi(
2428
2418
  // @ts-expect-error Looks like a list.
2429
2419
  i[n],
2430
2420
  Array.isArray(u) ? u : u ? [u] : []
@@ -2432,58 +2422,58 @@ function ki(e, r) {
2432
2422
  }
2433
2423
  }
2434
2424
  }
2435
- function wi(e, r) {
2425
+ function xi(e, r) {
2436
2426
  let t = -1;
2437
2427
  const a = [];
2438
2428
  for (; ++t < r.length; )
2439
2429
  (r[t].add === "after" ? e : a).push(r[t]);
2440
- Le(e, 0, 0, a);
2430
+ Re(e, 0, 0, a);
2441
2431
  }
2442
- const vi = {
2443
- tokenize: Ii,
2432
+ const ki = {
2433
+ tokenize: Ai,
2444
2434
  partial: !0
2445
2435
  }, hr = {
2446
- tokenize: Si,
2436
+ tokenize: Ni,
2447
2437
  partial: !0
2448
2438
  }, mr = {
2449
- tokenize: Li,
2439
+ tokenize: Ii,
2450
2440
  partial: !0
2451
2441
  }, pr = {
2452
- tokenize: Pi,
2442
+ tokenize: Si,
2453
2443
  partial: !0
2454
- }, Ci = {
2455
- tokenize: Ri,
2444
+ }, wi = {
2445
+ tokenize: Li,
2456
2446
  partial: !0
2457
2447
  }, gr = {
2458
2448
  name: "wwwAutolink",
2459
- tokenize: Ai,
2449
+ tokenize: Ti,
2460
2450
  previous: yr
2461
2451
  }, br = {
2462
2452
  name: "protocolAutolink",
2463
- tokenize: Ni,
2453
+ tokenize: Mi,
2464
2454
  previous: xr
2465
- }, te = {
2455
+ }, Y = {
2466
2456
  name: "emailAutolink",
2467
- tokenize: Ti,
2457
+ tokenize: Ci,
2468
2458
  previous: kr
2469
- }, Q = {};
2470
- function Mi() {
2459
+ }, K = {};
2460
+ function vi() {
2471
2461
  return {
2472
- text: Q
2462
+ text: K
2473
2463
  };
2474
2464
  }
2475
2465
  let ne = 48;
2476
2466
  for (; ne < 123; )
2477
- Q[ne] = te, ne++, ne === 58 ? ne = 65 : ne === 91 && (ne = 97);
2478
- Q[43] = te;
2479
- Q[45] = te;
2480
- Q[46] = te;
2481
- Q[95] = te;
2482
- Q[72] = [te, br];
2483
- Q[104] = [te, br];
2484
- Q[87] = [te, gr];
2485
- Q[119] = [te, gr];
2486
- function Ti(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) {
2487
2477
  const a = this;
2488
2478
  let i, o;
2489
2479
  return n;
@@ -2494,26 +2484,26 @@ function Ti(e, r, t) {
2494
2484
  return rt(l) ? (e.consume(l), u) : l === 64 ? (e.consume(l), c) : t(l);
2495
2485
  }
2496
2486
  function c(l) {
2497
- return l === 46 ? e.check(Ci, f, s)(l) : l === 45 || l === 95 || it(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);
2498
2488
  }
2499
2489
  function s(l) {
2500
2490
  return e.consume(l), i = !0, c;
2501
2491
  }
2502
2492
  function f(l) {
2503
- 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);
2504
2494
  }
2505
2495
  }
2506
- function Ai(e, r, t) {
2496
+ function Ti(e, r, t) {
2507
2497
  const a = this;
2508
2498
  return i;
2509
2499
  function i(n) {
2510
- return n !== 87 && n !== 119 || !yr.call(a, a.previous) || ut(a.events) ? t(n) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(vi, e.attempt(hr, e.attempt(mr, 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));
2511
2501
  }
2512
2502
  function o(n) {
2513
2503
  return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(n);
2514
2504
  }
2515
2505
  }
2516
- function Ni(e, r, t) {
2506
+ function Mi(e, r, t) {
2517
2507
  const a = this;
2518
2508
  let i = "", o = !1;
2519
2509
  return n;
@@ -2521,7 +2511,7 @@ function Ni(e, r, t) {
2521
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);
2522
2512
  }
2523
2513
  function u(l) {
2524
- if (xe(l) && i.length < 5)
2514
+ if (ke(l) && i.length < 5)
2525
2515
  return i += String.fromCodePoint(l), e.consume(l), u;
2526
2516
  if (l === 58) {
2527
2517
  const p = i.toLowerCase();
@@ -2534,13 +2524,13 @@ function Ni(e, r, t) {
2534
2524
  return l === 47 ? (e.consume(l), o ? s : (o = !0, c)) : t(l);
2535
2525
  }
2536
2526
  function s(l) {
2537
- return l === null || Pa(l) || W(l) || oe(l) || Ee(l) ? t(l) : e.attempt(hr, e.attempt(mr, 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);
2538
2528
  }
2539
2529
  function f(l) {
2540
2530
  return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(l);
2541
2531
  }
2542
2532
  }
2543
- function Ii(e, r, t) {
2533
+ function Ai(e, r, t) {
2544
2534
  let a = 0;
2545
2535
  return i;
2546
2536
  function i(n) {
@@ -2550,11 +2540,11 @@ function Ii(e, r, t) {
2550
2540
  return n === null ? t(n) : r(n);
2551
2541
  }
2552
2542
  }
2553
- function Si(e, r, t) {
2543
+ function Ni(e, r, t) {
2554
2544
  let a, i, o;
2555
2545
  return n;
2556
2546
  function n(s) {
2557
- return s === 46 || s === 95 ? e.check(pr, c, u)(s) : s === null || W(s) || oe(s) || s !== 45 && Ee(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);
2558
2548
  }
2559
2549
  function u(s) {
2560
2550
  return s === 95 ? a = !0 : (i = a, a = void 0), e.consume(s), n;
@@ -2563,36 +2553,36 @@ function Si(e, r, t) {
2563
2553
  return i || a || !o ? t(s) : r(s);
2564
2554
  }
2565
2555
  }
2566
- function Li(e, r) {
2556
+ function Ii(e, r) {
2567
2557
  let t = 0, a = 0;
2568
2558
  return i;
2569
2559
  function i(n) {
2570
- 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 || W(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);
2571
2561
  }
2572
2562
  function o(n) {
2573
2563
  return n === 41 && a++, e.consume(n), i;
2574
2564
  }
2575
2565
  }
2576
- function Pi(e, r, t) {
2566
+ function Si(e, r, t) {
2577
2567
  return a;
2578
2568
  function a(u) {
2579
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) : (
2580
2570
  // `<` is an end.
2581
2571
  u === 60 || // So is whitespace.
2582
- u === null || W(u) || oe(u) ? r(u) : t(u)
2572
+ u === null || B(u) || oe(u) ? r(u) : t(u)
2583
2573
  );
2584
2574
  }
2585
2575
  function i(u) {
2586
- return u === null || u === 40 || u === 91 || W(u) || oe(u) ? r(u) : a(u);
2576
+ return u === null || u === 40 || u === 91 || B(u) || oe(u) ? r(u) : a(u);
2587
2577
  }
2588
2578
  function o(u) {
2589
- return xe(u) ? n(u) : t(u);
2579
+ return ke(u) ? n(u) : t(u);
2590
2580
  }
2591
2581
  function n(u) {
2592
- 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);
2593
2583
  }
2594
2584
  }
2595
- function Ri(e, r, t) {
2585
+ function Li(e, r, t) {
2596
2586
  return a;
2597
2587
  function a(o) {
2598
2588
  return e.consume(o), i;
@@ -2602,10 +2592,10 @@ function Ri(e, r, t) {
2602
2592
  }
2603
2593
  }
2604
2594
  function yr(e) {
2605
- return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || W(e);
2595
+ return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || B(e);
2606
2596
  }
2607
2597
  function xr(e) {
2608
- return !xe(e);
2598
+ return !ke(e);
2609
2599
  }
2610
2600
  function kr(e) {
2611
2601
  return !(e === 47 || rt(e));
@@ -2628,7 +2618,7 @@ function ut(e) {
2628
2618
  }
2629
2619
  return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
2630
2620
  }
2631
- function _i(e, r, t) {
2621
+ function Pi(e, r, t) {
2632
2622
  const a = [];
2633
2623
  let i = -1;
2634
2624
  for (; ++i < e.length; ) {
@@ -2637,61 +2627,61 @@ function _i(e, r, t) {
2637
2627
  }
2638
2628
  return r;
2639
2629
  }
2640
- function Y(e, r, t, a) {
2630
+ function Z(e, r, t, a) {
2641
2631
  const i = a ? a - 1 : Number.POSITIVE_INFINITY;
2642
2632
  let o = 0;
2643
2633
  return n;
2644
2634
  function n(c) {
2645
- return J(c) ? (e.enter(t), u(c)) : r(c);
2635
+ return G(c) ? (e.enter(t), u(c)) : r(c);
2646
2636
  }
2647
2637
  function u(c) {
2648
- return J(c) && o++ < i ? (e.consume(c), u) : (e.exit(t), r(c));
2638
+ return G(c) && o++ < i ? (e.consume(c), u) : (e.exit(t), r(c));
2649
2639
  }
2650
2640
  }
2651
- const Di = {
2641
+ const Ri = {
2652
2642
  partial: !0,
2653
- tokenize: Ei
2643
+ tokenize: Di
2654
2644
  };
2655
- function Ei(e, r, t) {
2645
+ function Di(e, r, t) {
2656
2646
  return a;
2657
2647
  function a(o) {
2658
- return J(o) ? Y(e, i, "linePrefix")(o) : i(o);
2648
+ return G(o) ? Z(e, i, "linePrefix")(o) : i(o);
2659
2649
  }
2660
2650
  function i(o) {
2661
2651
  return o === null || fe(o) ? r(o) : t(o);
2662
2652
  }
2663
2653
  }
2664
- const Fi = {
2665
- tokenize: qi,
2654
+ const _i = {
2655
+ tokenize: Bi,
2666
2656
  partial: !0
2667
2657
  };
2668
- function zi() {
2658
+ function Ei() {
2669
2659
  return {
2670
2660
  document: {
2671
2661
  91: {
2672
2662
  name: "gfmFootnoteDefinition",
2673
- tokenize: Ui,
2663
+ tokenize: $i,
2674
2664
  continuation: {
2675
- tokenize: Bi
2665
+ tokenize: Oi
2676
2666
  },
2677
- exit: Wi
2667
+ exit: Ui
2678
2668
  }
2679
2669
  },
2680
2670
  text: {
2681
2671
  91: {
2682
2672
  name: "gfmFootnoteCall",
2683
- tokenize: Oi
2673
+ tokenize: ji
2684
2674
  },
2685
2675
  93: {
2686
2676
  name: "gfmPotentialFootnoteCall",
2687
2677
  add: "after",
2688
- tokenize: ji,
2689
- resolveTo: $i
2678
+ tokenize: Fi,
2679
+ resolveTo: zi
2690
2680
  }
2691
2681
  }
2692
2682
  };
2693
2683
  }
2694
- function ji(e, r, t) {
2684
+ function Fi(e, r, t) {
2695
2685
  const a = this;
2696
2686
  let i = a.events.length;
2697
2687
  const o = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
@@ -2709,14 +2699,14 @@ function ji(e, r, t) {
2709
2699
  function u(c) {
2710
2700
  if (!n || !n._balanced)
2711
2701
  return t(c);
2712
- const s = ve(a.sliceSerialize({
2702
+ const s = Ce(a.sliceSerialize({
2713
2703
  start: n.end,
2714
2704
  end: a.now()
2715
2705
  }));
2716
2706
  return s.codePointAt(0) !== 94 || !o.includes(s.slice(1)) ? t(c) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), r(c));
2717
2707
  }
2718
2708
  }
2719
- function $i(e, r) {
2709
+ function zi(e, r) {
2720
2710
  let t = e.length;
2721
2711
  for (; t--; )
2722
2712
  if (e[t][1].type === "labelImage" && e[t][0] === "enter") {
@@ -2766,7 +2756,7 @@ function $i(e, r) {
2766
2756
  ];
2767
2757
  return e.splice(t, e.length - t + 1, ...u), e;
2768
2758
  }
2769
- function Oi(e, r, t) {
2759
+ function ji(e, r, t) {
2770
2760
  const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
2771
2761
  let o = 0, n;
2772
2762
  return u;
@@ -2782,21 +2772,21 @@ function Oi(e, r, t) {
2782
2772
  o > 999 || // Closing brace with nothing.
2783
2773
  l === 93 && !n || // Space or tab is not supported by GFM for some reason.
2784
2774
  // `\n` and `[` not being supported makes sense.
2785
- l === null || l === 91 || W(l)
2775
+ l === null || l === 91 || B(l)
2786
2776
  )
2787
2777
  return t(l);
2788
2778
  if (l === 93) {
2789
2779
  e.exit("chunkString");
2790
2780
  const p = e.exit("gfmFootnoteCallString");
2791
- 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);
2792
2782
  }
2793
- return W(l) || (n = !0), o++, e.consume(l), l === 92 ? f : s;
2783
+ return B(l) || (n = !0), o++, e.consume(l), l === 92 ? f : s;
2794
2784
  }
2795
2785
  function f(l) {
2796
2786
  return l === 91 || l === 92 || l === 93 ? (e.consume(l), o++, s) : s(l);
2797
2787
  }
2798
2788
  }
2799
- function Ui(e, r, t) {
2789
+ function $i(e, r, t) {
2800
2790
  const a = this, i = a.parser.gfmFootnotes || (a.parser.gfmFootnotes = []);
2801
2791
  let o, n = 0, u;
2802
2792
  return c;
@@ -2812,41 +2802,41 @@ function Ui(e, r, t) {
2812
2802
  n > 999 || // Closing brace with nothing.
2813
2803
  m === 93 && !u || // Space or tab is not supported by GFM for some reason.
2814
2804
  // `\n` and `[` not being supported makes sense.
2815
- m === null || m === 91 || W(m)
2805
+ m === null || m === 91 || B(m)
2816
2806
  )
2817
2807
  return t(m);
2818
2808
  if (m === 93) {
2819
2809
  e.exit("chunkString");
2820
2810
  const x = e.exit("gfmFootnoteDefinitionLabelString");
2821
- 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;
2822
2812
  }
2823
- return W(m) || (u = !0), n++, e.consume(m), m === 92 ? l : f;
2813
+ return B(m) || (u = !0), n++, e.consume(m), m === 92 ? l : f;
2824
2814
  }
2825
2815
  function l(m) {
2826
2816
  return m === 91 || m === 92 || m === 93 ? (e.consume(m), n++, f) : f(m);
2827
2817
  }
2828
2818
  function p(m) {
2829
- return m === 58 ? (e.enter("definitionMarker"), e.consume(m), e.exit("definitionMarker"), i.includes(o) || i.push(o), Y(e, g, "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);
2830
2820
  }
2831
2821
  function g(m) {
2832
2822
  return r(m);
2833
2823
  }
2834
2824
  }
2835
- function Bi(e, r, t) {
2836
- return e.check(Di, r, e.attempt(Fi, r, t));
2825
+ function Oi(e, r, t) {
2826
+ return e.check(Ri, r, e.attempt(_i, r, t));
2837
2827
  }
2838
- function Wi(e) {
2828
+ function Ui(e) {
2839
2829
  e.exit("gfmFootnoteDefinition");
2840
2830
  }
2841
- function qi(e, r, t) {
2831
+ function Bi(e, r, t) {
2842
2832
  const a = this;
2843
- return Y(e, i, "gfmFootnoteDefinitionIndent", 5);
2833
+ return Z(e, i, "gfmFootnoteDefinitionIndent", 5);
2844
2834
  function i(o) {
2845
2835
  const n = a.events[a.events.length - 1];
2846
2836
  return n && n[1].type === "gfmFootnoteDefinitionIndent" && n[2].sliceSerialize(n[1], !0).length === 4 ? r(o) : t(o);
2847
2837
  }
2848
2838
  }
2849
- function Hi(e) {
2839
+ function Wi(e) {
2850
2840
  let t = (e || {}).singleTilde;
2851
2841
  const a = {
2852
2842
  name: "strikethrough",
@@ -2882,7 +2872,7 @@ function Hi(e) {
2882
2872
  start: Object.assign({}, n[s][1].end),
2883
2873
  end: Object.assign({}, n[c][1].start)
2884
2874
  }, p = [["enter", f, u], ["enter", n[s][1], u], ["exit", n[s][1], u], ["enter", l, u]], g = u.parser.constructs.insideSpan.null;
2885
- g && Le(p, p.length, 0, _i(g, 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;
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;
2886
2876
  break;
2887
2877
  }
2888
2878
  }
@@ -2907,7 +2897,7 @@ function Hi(e) {
2907
2897
  }
2908
2898
  }
2909
2899
  }
2910
- class Vi {
2900
+ class Hi {
2911
2901
  /**
2912
2902
  * Create a new edit map.
2913
2903
  */
@@ -2923,7 +2913,7 @@ class Vi {
2923
2913
  * @returns {undefined}
2924
2914
  */
2925
2915
  add(r, t, a) {
2926
- Xi(this, r, t, a);
2916
+ qi(this, r, t, a);
2927
2917
  }
2928
2918
  // To do: add this when moving to `micromark`.
2929
2919
  // /**
@@ -2962,7 +2952,7 @@ class Vi {
2962
2952
  this.map.length = 0;
2963
2953
  }
2964
2954
  }
2965
- function Xi(e, r, t, a) {
2955
+ function qi(e, r, t, a) {
2966
2956
  let i = 0;
2967
2957
  if (!(t === 0 && a.length === 0)) {
2968
2958
  for (; i < e.map.length; ) {
@@ -2975,7 +2965,7 @@ function Xi(e, r, t, a) {
2975
2965
  e.map.push([r, t, a]);
2976
2966
  }
2977
2967
  }
2978
- function Ki(e, r) {
2968
+ function Vi(e, r) {
2979
2969
  let t = !1;
2980
2970
  const a = [];
2981
2971
  for (; r < e.length; ) {
@@ -2995,31 +2985,31 @@ function Ki(e, r) {
2995
2985
  }
2996
2986
  return a;
2997
2987
  }
2998
- function Qi() {
2988
+ function Xi() {
2999
2989
  return {
3000
2990
  flow: {
3001
2991
  null: {
3002
2992
  name: "table",
3003
- tokenize: Gi,
3004
- resolveAll: Zi
2993
+ tokenize: Ki,
2994
+ resolveAll: Qi
3005
2995
  }
3006
2996
  }
3007
2997
  };
3008
2998
  }
3009
- function Gi(e, r, t) {
2999
+ function Ki(e, r, t) {
3010
3000
  const a = this;
3011
3001
  let i = 0, o = 0, n;
3012
3002
  return u;
3013
3003
  function u(h) {
3014
- let R = a.events.length - 1;
3015
- for (; R > -1; ) {
3016
- const re = a.events[R][1].type;
3017
- if (re === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
3018
- re === "linePrefix") R--;
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") _--;
3019
3009
  else break;
3020
3010
  }
3021
- const q = R > -1 ? a.events[R][1].type : null, G = q === "tableHead" || q === "tableRow" ? C : c;
3022
- return G === C && a.parser.lazy[a.now().line] ? t(h) : G(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);
3023
3013
  }
3024
3014
  function c(h) {
3025
3015
  return e.enter("tableHead"), e.enter("tableRow"), s(h);
@@ -3028,60 +3018,60 @@ function Gi(e, r, t) {
3028
3018
  return h === 124 || (n = !0, o += 1), f(h);
3029
3019
  }
3030
3020
  function f(h) {
3031
- 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) : J(h) ? Y(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)));
3032
3022
  }
3033
3023
  function l(h) {
3034
- return h === null || h === 124 || W(h) ? (e.exit("data"), f(h)) : (e.consume(h), h === 92 ? p : l);
3024
+ return h === null || h === 124 || B(h) ? (e.exit("data"), f(h)) : (e.consume(h), h === 92 ? p : l);
3035
3025
  }
3036
3026
  function p(h) {
3037
3027
  return h === 92 || h === 124 ? (e.consume(h), l) : l(h);
3038
3028
  }
3039
3029
  function g(h) {
3040
- return a.interrupt = !1, a.parser.lazy[a.now().line] ? t(h) : (e.enter("tableDelimiterRow"), n = !1, J(h) ? Y(e, m, "linePrefix", a.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(h) : m(h));
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));
3041
3031
  }
3042
3032
  function m(h) {
3043
- return h === 45 || h === 58 ? b(h) : h === 124 ? (n = !0, e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), x) : N(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);
3044
3034
  }
3045
3035
  function x(h) {
3046
- return J(h) ? Y(e, b, "whitespace")(h) : b(h);
3036
+ return G(h) ? Z(e, b, "whitespace")(h) : b(h);
3047
3037
  }
3048
3038
  function b(h) {
3049
- 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) ? S(h) : N(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);
3050
3040
  }
3051
3041
  function y(h) {
3052
- return h === 45 ? (e.enter("tableDelimiterFiller"), k(h)) : N(h);
3042
+ return h === 45 ? (e.enter("tableDelimiterFiller"), k(h)) : I(h);
3053
3043
  }
3054
3044
  function k(h) {
3055
- 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));
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));
3056
3046
  }
3057
- function M(h) {
3058
- return J(h) ? Y(e, S, "whitespace")(h) : S(h);
3047
+ function T(h) {
3048
+ return G(h) ? Z(e, L, "whitespace")(h) : L(h);
3059
3049
  }
3060
- function S(h) {
3061
- return h === 124 ? m(h) : h === null || fe(h) ? !n || i !== o ? N(h) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(h)) : N(h);
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);
3062
3052
  }
3063
- function N(h) {
3053
+ function I(h) {
3064
3054
  return t(h);
3065
3055
  }
3066
3056
  function C(h) {
3067
- return e.enter("tableRow"), P(h);
3057
+ return e.enter("tableRow"), D(h);
3068
3058
  }
3069
- function P(h) {
3070
- return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), P) : h === null || fe(h) ? (e.exit("tableRow"), r(h)) : J(h) ? Y(e, P, "whitespace")(h) : (e.enter("data"), A(h));
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));
3071
3061
  }
3072
3062
  function A(h) {
3073
- return h === null || h === 124 || W(h) ? (e.exit("data"), P(h)) : (e.consume(h), h === 92 ? I : A);
3063
+ return h === null || h === 124 || B(h) ? (e.exit("data"), D(h)) : (e.consume(h), h === 92 ? N : A);
3074
3064
  }
3075
- function I(h) {
3065
+ function N(h) {
3076
3066
  return h === 92 || h === 124 ? (e.consume(h), A) : A(h);
3077
3067
  }
3078
3068
  }
3079
- function Zi(e, r) {
3069
+ function Qi(e, r) {
3080
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;
3081
- const p = new Vi();
3071
+ const p = new Hi();
3082
3072
  for (; ++t < e.length; ) {
3083
3073
  const g = e[t], m = g[1];
3084
- g[0] === "enter" ? m.type === "tableHead" ? (u = !1, c !== 0 && (_t(p, r, c, s, f), f = void 0, c = 0), s = {
3074
+ g[0] === "enter" ? m.type === "tableHead" ? (u = !1, c !== 0 && (Dt(p, r, c, s, f), f = void 0, c = 0), s = {
3085
3075
  type: "table",
3086
3076
  start: Object.assign({}, m.start),
3087
3077
  // Note: correct end is set later.
@@ -3091,15 +3081,15 @@ function Zi(e, r) {
3091
3081
  start: Object.assign({}, m.start),
3092
3082
  // Note: correct end is set later.
3093
3083
  end: Object.assign({}, m.end)
3094
- }, 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);
3095
3085
  }
3096
- for (c !== 0 && _t(p, r, c, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
3086
+ for (c !== 0 && Dt(p, r, c, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
3097
3087
  const g = r.events[t];
3098
- g[0] === "enter" && g[1].type === "table" && (g[1]._align = Ki(r.events, t));
3088
+ g[0] === "enter" && g[1].type === "table" && (g[1]._align = Vi(r.events, t));
3099
3089
  }
3100
3090
  return e;
3101
3091
  }
3102
- function Se(e, r, t, a, i, o) {
3092
+ function Pe(e, r, t, a, i, o) {
3103
3093
  const n = a === 1 ? "tableHeader" : a === 2 ? "tableDelimiter" : "tableData", u = "tableContent";
3104
3094
  t[0] !== 0 && (o.end = Object.assign({}, le(r.events, t[0])), e.add(t[0], 0, [["exit", o, r]]));
3105
3095
  const c = le(r.events, t[1]);
@@ -3125,7 +3115,7 @@ function Se(e, r, t, a, i, o) {
3125
3115
  }
3126
3116
  return i !== void 0 && (o.end = Object.assign({}, le(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
3127
3117
  }
3128
- function _t(e, r, t, a, i) {
3118
+ function Dt(e, r, t, a, i) {
3129
3119
  const o = [], n = le(r.events, t);
3130
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);
3131
3121
  }
@@ -3133,18 +3123,18 @@ function le(e, r) {
3133
3123
  const t = e[r], a = t[0] === "enter" ? "start" : "end";
3134
3124
  return t[1][a];
3135
3125
  }
3136
- const Ji = {
3126
+ const Gi = {
3137
3127
  name: "tasklistCheck",
3138
- tokenize: eo
3128
+ tokenize: Ji
3139
3129
  };
3140
- function Yi() {
3130
+ function Zi() {
3141
3131
  return {
3142
3132
  text: {
3143
- 91: Ji
3133
+ 91: Gi
3144
3134
  }
3145
3135
  };
3146
3136
  }
3147
- function eo(e, r, t) {
3137
+ function Ji(e, r, t) {
3148
3138
  const a = this;
3149
3139
  return i;
3150
3140
  function i(c) {
@@ -3156,53 +3146,53 @@ function eo(e, r, t) {
3156
3146
  );
3157
3147
  }
3158
3148
  function o(c) {
3159
- return W(c) ? (e.enter("taskListCheckValueUnchecked"), e.consume(c), e.exit("taskListCheckValueUnchecked"), n) : c === 88 || c === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(c), e.exit("taskListCheckValueChecked"), n) : t(c);
3149
+ return B(c) ? (e.enter("taskListCheckValueUnchecked"), e.consume(c), e.exit("taskListCheckValueUnchecked"), n) : c === 88 || c === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(c), e.exit("taskListCheckValueChecked"), n) : t(c);
3160
3150
  }
3161
3151
  function n(c) {
3162
3152
  return c === 93 ? (e.enter("taskListCheckMarker"), e.consume(c), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), u) : t(c);
3163
3153
  }
3164
3154
  function u(c) {
3165
- return fe(c) ? r(c) : J(c) ? e.check({
3166
- tokenize: to
3155
+ return fe(c) ? r(c) : G(c) ? e.check({
3156
+ tokenize: Yi
3167
3157
  }, r, t)(c) : t(c);
3168
3158
  }
3169
3159
  }
3170
- function to(e, r, t) {
3171
- return Y(e, a, "whitespace");
3160
+ function Yi(e, r, t) {
3161
+ return Z(e, a, "whitespace");
3172
3162
  function a(i) {
3173
3163
  return i === null ? t(i) : r(i);
3174
3164
  }
3175
3165
  }
3176
- function ro(e) {
3177
- return xi([
3178
- Mi(),
3179
- zi(),
3180
- Hi(e),
3181
- Qi(),
3182
- Yi()
3166
+ function eo(e) {
3167
+ return bi([
3168
+ vi(),
3169
+ Ei(),
3170
+ Wi(e),
3171
+ Xi(),
3172
+ Zi()
3183
3173
  ]);
3184
3174
  }
3185
- const ao = {};
3186
- function no(e) {
3175
+ const to = {};
3176
+ function ro(e) {
3187
3177
  const r = (
3188
3178
  /** @type {Processor<Root>} */
3189
3179
  this
3190
- ), t = e || ao, a = r.data(), i = a.micromarkExtensions || (a.micromarkExtensions = []), o = a.fromMarkdownExtensions || (a.fromMarkdownExtensions = []), n = a.toMarkdownExtensions || (a.toMarkdownExtensions = []);
3191
- i.push(ro(t)), o.push(bi()), n.push(yi(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));
3192
3182
  }
3193
- function z(...e) {
3183
+ function j(...e) {
3194
3184
  return e.filter(Boolean).join(" ");
3195
3185
  }
3196
- const io = ({ content: e }) => /* @__PURE__ */ d(
3186
+ const ao = ({ content: e }) => /* @__PURE__ */ d(
3197
3187
  Br,
3198
3188
  {
3199
- remarkPlugins: [no],
3189
+ remarkPlugins: [ro],
3200
3190
  className: "cuadra-aui-md",
3201
- components: uo,
3191
+ components: oo,
3202
3192
  children: e
3203
3193
  }
3204
- ), st = Pr(io), oo = ({ language: e, code: r }) => {
3205
- const { isCopied: t, copyToClipboard: a } = co();
3194
+ ), st = Pr(ao), no = ({ language: e, code: r }) => {
3195
+ const { isCopied: t, copyToClipboard: a } = io();
3206
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: [
3207
3197
  /* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
3208
3198
  /* @__PURE__ */ w(
@@ -3214,33 +3204,33 @@ const io = ({ content: e }) => /* @__PURE__ */ d(
3214
3204
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
3215
3205
  "aria-label": "Copy code",
3216
3206
  children: [
3217
- !t && /* @__PURE__ */ d(ia, { className: "cuadra-h-4 cuadra-w-4" }),
3218
- t && /* @__PURE__ */ d(ea, { 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" })
3219
3209
  ]
3220
3210
  }
3221
3211
  )
3222
3212
  ] });
3223
- }, co = ({
3213
+ }, io = ({
3224
3214
  copiedDuration: e = 3e3
3225
3215
  } = {}) => {
3226
- const [r, t] = L(!1);
3216
+ const [r, t] = R(!1);
3227
3217
  return { isCopied: r, copyToClipboard: (i) => {
3228
3218
  i && navigator.clipboard.writeText(i).then(() => {
3229
3219
  t(!0), setTimeout(() => t(!1), e);
3230
3220
  });
3231
3221
  } };
3232
- }, uo = Or({
3222
+ }, oo = Or({
3233
3223
  h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
3234
3224
  "h1",
3235
3225
  {
3236
- 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),
3237
3227
  ...r
3238
3228
  }
3239
3229
  ),
3240
3230
  h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
3241
3231
  "h2",
3242
3232
  {
3243
- className: z(
3233
+ className: j(
3244
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",
3245
3235
  e
3246
3236
  ),
@@ -3250,7 +3240,7 @@ const io = ({ content: e }) => /* @__PURE__ */ d(
3250
3240
  h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
3251
3241
  "h3",
3252
3242
  {
3253
- className: z(
3243
+ className: j(
3254
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",
3255
3245
  e
3256
3246
  ),
@@ -3260,38 +3250,38 @@ const io = ({ content: e }) => /* @__PURE__ */ d(
3260
3250
  h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
3261
3251
  "h4",
3262
3252
  {
3263
- className: z(
3253
+ className: j(
3264
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",
3265
3255
  e
3266
3256
  ),
3267
3257
  ...r
3268
3258
  }
3269
3259
  ),
3270
- 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 }),
3271
- h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: z("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
3272
- 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 }),
3273
3263
  a: ({ className: e, ...r }) => /* @__PURE__ */ d(
3274
3264
  "a",
3275
3265
  {
3276
- 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),
3277
3267
  ...r
3278
3268
  }
3279
3269
  ),
3280
- blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: z("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
3281
- 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 }),
3282
- 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 }),
3283
- 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 }),
3284
3274
  table: ({ className: e, ...r }) => /* @__PURE__ */ d(
3285
3275
  "table",
3286
3276
  {
3287
- 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),
3288
3278
  ...r
3289
3279
  }
3290
3280
  ),
3291
3281
  th: ({ className: e, ...r }) => /* @__PURE__ */ d(
3292
3282
  "th",
3293
3283
  {
3294
- className: z(
3284
+ className: j(
3295
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",
3296
3286
  e
3297
3287
  ),
@@ -3301,7 +3291,7 @@ const io = ({ content: e }) => /* @__PURE__ */ d(
3301
3291
  td: ({ className: e, ...r }) => /* @__PURE__ */ d(
3302
3292
  "td",
3303
3293
  {
3304
- className: z(
3294
+ className: j(
3305
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",
3306
3296
  e
3307
3297
  ),
@@ -3311,18 +3301,18 @@ const io = ({ content: e }) => /* @__PURE__ */ d(
3311
3301
  tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
3312
3302
  "tr",
3313
3303
  {
3314
- className: z(
3304
+ className: j(
3315
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",
3316
3306
  e
3317
3307
  ),
3318
3308
  ...r
3319
3309
  }
3320
3310
  ),
3321
- 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 }),
3322
3312
  pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
3323
3313
  "pre",
3324
3314
  {
3325
- className: z(
3315
+ className: j(
3326
3316
  "cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",
3327
3317
  e
3328
3318
  ),
@@ -3334,12 +3324,12 @@ const io = ({ content: e }) => /* @__PURE__ */ d(
3334
3324
  return /* @__PURE__ */ d(
3335
3325
  "code",
3336
3326
  {
3337
- 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),
3338
3328
  ...t
3339
3329
  }
3340
3330
  );
3341
3331
  },
3342
- CodeHeader: oo
3332
+ CodeHeader: no
3343
3333
  });
3344
3334
  function wr({ className: e = "", variant: r = "default", ...t }) {
3345
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 = {
@@ -3356,7 +3346,7 @@ function wr({ className: e = "", variant: r = "default", ...t }) {
3356
3346
  }
3357
3347
  );
3358
3348
  }
3359
- function so(e) {
3349
+ function co(e) {
3360
3350
  const r = /* @__PURE__ */ new Map();
3361
3351
  for (const t of e) {
3362
3352
  const a = r.get(t.filename);
@@ -3364,19 +3354,19 @@ function so(e) {
3364
3354
  }
3365
3355
  return Array.from(r.values()).sort((t, a) => a.score - t.score);
3366
3356
  }
3367
- function lo({
3357
+ function uo({
3368
3358
  sources: e,
3369
3359
  maxVisible: r = 3
3370
3360
  }) {
3371
3361
  if (!e || e.length === 0) return null;
3372
- const t = so(e), a = t.slice(0, r), i = t.length - r;
3362
+ const t = co(e), a = t.slice(0, r), i = t.length - r;
3373
3363
  return /* @__PURE__ */ w("div", { className: "cuadra-mt-4 cuadra-pt-3 cuadra-border-t cuadra-border-border", children: [
3374
3364
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-1.5 cuadra-mb-2.5", children: [
3375
3365
  /* @__PURE__ */ d(Ut, { className: "cuadra-h-3.5 cuadra-w-3.5 cuadra-text-muted-foreground" }),
3376
3366
  /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-font-medium cuadra-text-muted-foreground font-brand", children: "Sources" })
3377
3367
  ] }),
3378
3368
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-wrap cuadra-gap-2", children: [
3379
- a.map((o, n) => /* @__PURE__ */ d(ho, { source: o }, o.sourceId || n)),
3369
+ a.map((o, n) => /* @__PURE__ */ d(lo, { source: o }, o.sourceId || n)),
3380
3370
  i > 0 && /* @__PURE__ */ w(wr, { variant: "subtle", children: [
3381
3371
  "+",
3382
3372
  i,
@@ -3385,21 +3375,21 @@ function lo({
3385
3375
  ] })
3386
3376
  ] });
3387
3377
  }
3388
- function fo(e) {
3378
+ function so(e) {
3389
3379
  switch (e.split(".").pop()?.toLowerCase()) {
3390
3380
  case "csv":
3391
3381
  case "xlsx":
3392
3382
  case "xls":
3393
- return sa;
3383
+ return ca;
3394
3384
  case "md":
3395
3385
  case "txt":
3396
- return fa;
3386
+ return la;
3397
3387
  default:
3398
3388
  return Ut;
3399
3389
  }
3400
3390
  }
3401
- function ho({ source: e }) {
3402
- const { filename: r, score: t } = e, a = fo(r);
3391
+ function lo({ source: e }) {
3392
+ const { filename: r, score: t } = e, a = so(r);
3403
3393
  return /* @__PURE__ */ w(
3404
3394
  wr,
3405
3395
  {
@@ -3416,7 +3406,7 @@ function ho({ source: e }) {
3416
3406
  }
3417
3407
  );
3418
3408
  }
3419
- const Dt = we(
3409
+ const _t = ve(
3420
3410
  function({
3421
3411
  welcomeTitle: r = "Hi, how can I help you today?",
3422
3412
  welcomeSubtitle: t = "Start exploring our platform and discover what you can build.",
@@ -3427,36 +3417,36 @@ const Dt = we(
3427
3417
  preMadeResponseDelay: u = 1e3,
3428
3418
  streamingSpeed: c = 50
3429
3419
  }, s) {
3430
- const f = Fr(), l = zr(), [p, g] = L(!1), [m, x] = L(null), [b, y] = L(!1), k = K((C, P, A) => {
3420
+ const f = Fr(), l = zr(), [p, g] = R(!1), [m, x] = R(null), [b, y] = R(!1), k = X((C, D, A) => {
3431
3421
  if (!b)
3432
3422
  try {
3433
- const I = A?.streamingSpeed ?? c, h = A?.delay ?? u;
3434
- Na(C, P, I, 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(() => {
3435
3425
  l.composer().send();
3436
3426
  }, 10);
3437
3427
  } catch {
3438
3428
  }
3439
- }, [b, c, u, l]), M = K((C) => {
3429
+ }, [b, c, u, l]), T = X((C) => {
3440
3430
  try {
3441
3431
  l.composer().setText(C), setTimeout(() => {
3442
3432
  l.composer().send();
3443
3433
  }, 10);
3444
3434
  } catch {
3445
3435
  }
3446
- }, [l]), S = K(async (C) => {
3436
+ }, [l]), L = X(async (C) => {
3447
3437
  if (!(b || !f))
3448
3438
  try {
3449
3439
  if (C.response) {
3450
- const P = C.responseDelay ?? u;
3440
+ const D = C.responseDelay ?? u;
3451
3441
  await k(C.prompt, C.response, {
3452
- delay: P,
3442
+ delay: D,
3453
3443
  streamingSpeed: c
3454
3444
  });
3455
3445
  } else
3456
- M(C.prompt);
3446
+ T(C.prompt);
3457
3447
  } catch {
3458
3448
  }
3459
- }, [f, b, u, c, k, M]), N = K(() => {
3449
+ }, [f, b, u, c, k, T]), I = X(() => {
3460
3450
  try {
3461
3451
  const C = window.__cuadraThreadListRuntime;
3462
3452
  C?.switchToNewThread && C.switchToNewThread();
@@ -3464,10 +3454,10 @@ const Dt = we(
3464
3454
  }
3465
3455
  }, []);
3466
3456
  return at(s, () => ({
3467
- sendMessage: M,
3457
+ sendMessage: T,
3468
3458
  sendPreMadeQA: k,
3469
- clearChat: N
3470
- }), [M, k, N]), O(() => {
3459
+ clearChat: I
3460
+ }), [T, k, I]), O(() => {
3471
3461
  if (!f) {
3472
3462
  g(!1);
3473
3463
  return;
@@ -3478,46 +3468,46 @@ const Dt = we(
3478
3468
  g(!1);
3479
3469
  return;
3480
3470
  }
3481
- const P = C.subscribe?.((I) => {
3482
- const h = I?.threadId, R = I?.messages || [], q = I?.isLoadingHistory || !1, G = R.length;
3483
- h && h !== m && x(h), g(q && G === 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);
3484
3474
  }), A = C.getState?.();
3485
3475
  if (A) {
3486
- const I = A?.threadId, h = A?.messages || [], R = A?.isLoadingHistory || !1, q = h.length;
3487
- I && I !== m && x(I), g(R && q === 0);
3476
+ const N = A?.threadId, h = A?.messages || [], _ = A?.isLoadingHistory || !1, H = h.length;
3477
+ N && N !== m && x(N), g(_ && H === 0);
3488
3478
  }
3489
3479
  return () => {
3490
- P && P();
3480
+ D && D();
3491
3481
  };
3492
3482
  } catch {
3493
3483
  g(!1);
3494
3484
  }
3495
- }, [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: [
3496
3486
  /* @__PURE__ */ d(
3497
- Ne.Viewport,
3487
+ Se.Viewport,
3498
3488
  {
3499
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",
3500
3490
  style: a ? { paddingTop: a } : void 0,
3501
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: [
3502
3492
  /* @__PURE__ */ d(Bt, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
3503
3493
  /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
3504
- ] }) }) : /* @__PURE__ */ w(ee, { children: [
3505
- /* @__PURE__ */ d(Ne.Empty, { children: /* @__PURE__ */ d(
3506
- mo,
3494
+ ] }) }) : /* @__PURE__ */ w(J, { children: [
3495
+ /* @__PURE__ */ d(Se.Empty, { children: /* @__PURE__ */ d(
3496
+ fo,
3507
3497
  {
3508
3498
  title: r,
3509
3499
  subtitle: t,
3510
3500
  suggestions: i,
3511
- onSuggestionClick: S,
3501
+ onSuggestionClick: L,
3512
3502
  isProcessing: b
3513
3503
  }
3514
3504
  ) }),
3515
3505
  /* @__PURE__ */ d(
3516
- Ne.Messages,
3506
+ Se.Messages,
3517
3507
  {
3518
3508
  components: {
3519
- UserMessage: po,
3520
- AssistantMessage: yo
3509
+ UserMessage: ho,
3510
+ AssistantMessage: go
3521
3511
  }
3522
3512
  }
3523
3513
  )
@@ -3530,7 +3520,7 @@ const Dt = we(
3530
3520
  {
3531
3521
  components: {
3532
3522
  Attachment: () => {
3533
- const C = Pe(({ attachment: P }) => P);
3523
+ const C = xe(({ attachment: D }) => D);
3534
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: [
3535
3525
  /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground font-brand", children: C.name || "Attachment" }),
3536
3526
  /* @__PURE__ */ d(jr.Remove, { asChild: !0, children: /* @__PURE__ */ d(
@@ -3609,7 +3599,7 @@ const Dt = we(
3609
3599
  ] });
3610
3600
  }
3611
3601
  );
3612
- function mo({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isProcessing: i }) {
3602
+ function fo({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isProcessing: i }) {
3613
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: [
3614
3604
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3615
3605
  /* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
@@ -3629,14 +3619,14 @@ function mo({ title: e, subtitle: r, suggestions: t, onSuggestionClick: a, isPro
3629
3619
  )) })
3630
3620
  ] }) });
3631
3621
  }
3632
- function po() {
3622
+ function ho() {
3633
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: [
3634
3624
  /* @__PURE__ */ d(
3635
3625
  be.Attachments,
3636
3626
  {
3637
3627
  components: {
3638
3628
  Attachment: () => {
3639
- const e = Pe(({ attachment: o }) => o);
3629
+ const e = xe(({ attachment: o }) => o);
3640
3630
  if (!e) return null;
3641
3631
  const r = e.type === "image", t = e.file, a = e.content?.find((o) => o.type === "image"), i = t ? URL.createObjectURL(t) : a?.image;
3642
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(
@@ -3683,31 +3673,36 @@ function po() {
3683
3673
  )
3684
3674
  ] });
3685
3675
  }
3686
- function go({ text: e }) {
3687
- const [r, t] = L(!0);
3688
- 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: [
3689
3679
  /* @__PURE__ */ w(
3690
3680
  "button",
3691
3681
  {
3692
3682
  type: "button",
3693
3683
  onClick: () => t(!r),
3694
- 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",
3695
3685
  children: [
3696
3686
  /* @__PURE__ */ d(
3697
3687
  et,
3698
3688
  {
3699
- 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"}`
3700
3690
  }
3701
3691
  ),
3702
- /* @__PURE__ */ d(Jr, { className: "cuadra-h-4 cuadra-w-4 cuadra-shrink-0" }),
3703
3692
  /* @__PURE__ */ d("span", { children: "Reasoning" })
3704
3693
  ]
3705
3694
  }
3706
3695
  ),
3707
- 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(st, { 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
+ )
3708
3703
  ] }) : null;
3709
3704
  }
3710
- function bo() {
3705
+ function po() {
3711
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: [
3712
3707
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-1", children: [
3713
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" } }),
@@ -3717,8 +3712,8 @@ function bo() {
3717
3712
  /* @__PURE__ */ d("span", { children: "Thinking..." })
3718
3713
  ] });
3719
3714
  }
3720
- function yo() {
3721
- const [e] = L(() => ie.getCurrentMessageId()), r = Pe(({ message: i }) => i?.status?.type === "running"), t = Pe(({ message: i }) => {
3715
+ function go() {
3716
+ const [e] = R(() => ie.getCurrentMessageId()), r = xe(({ message: i }) => i?.status?.type === "running"), t = xe(({ message: i }) => {
3722
3717
  const o = i?.content;
3723
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));
3724
3719
  }), a = Rr(
@@ -3747,12 +3742,12 @@ function yo() {
3747
3742
  {
3748
3743
  components: {
3749
3744
  Text: ({ text: i }) => /* @__PURE__ */ d(st, { content: i || "" }),
3750
- Reasoning: ({ text: i }) => /* @__PURE__ */ d(go, { text: i || "" })
3745
+ Reasoning: ({ text: i }) => /* @__PURE__ */ d(mo, { text: i || "" })
3751
3746
  }
3752
3747
  }
3753
3748
  ),
3754
- r && !t && /* @__PURE__ */ d(bo, {}),
3755
- a && a.length > 0 && /* @__PURE__ */ d(lo, { sources: a })
3749
+ r && !t && /* @__PURE__ */ d(po, {}),
3750
+ a && a.length > 0 && /* @__PURE__ */ d(uo, { sources: a })
3756
3751
  ]
3757
3752
  }
3758
3753
  ) });
@@ -3765,7 +3760,7 @@ const vr = ({ className: e = "", theme: r = "system" }) => {
3765
3760
  return n || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
3766
3761
  }
3767
3762
  return r;
3768
- }, [a, i] = L(t);
3763
+ }, [a, i] = R(t);
3769
3764
  return O(() => {
3770
3765
  r !== "system" && i(r);
3771
3766
  }, [r]), O(() => {
@@ -3782,7 +3777,7 @@ const vr = ({ className: e = "", theme: r = "system" }) => {
3782
3777
  disabled: r !== "system",
3783
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}`,
3784
3779
  children: /* @__PURE__ */ d(
3785
- aa,
3780
+ ta,
3786
3781
  {
3787
3782
  className: `cuadra-h-4 cuadra-w-4 cuadra-transition-colors ${a === "dark" ? "cuadra-text-primary" : "cuadra-text-gray-400"}`
3788
3783
  }
@@ -3790,8 +3785,8 @@ const vr = ({ className: e = "", theme: r = "system" }) => {
3790
3785
  }
3791
3786
  );
3792
3787
  };
3793
- function xo({ onThreadSelect: e }) {
3794
- const r = zt(), t = $r((b) => b.threadId), [a, i] = L(null), o = r?.id === t, n = a === r?.id, [u, c] = L(!1), [s, f] = L(r?.title || ""), [l, p] = L(!1), [g, m] = L(!1), x = async () => {
3788
+ function bo({ onThreadSelect: e }) {
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 () => {
3795
3790
  if (!r?.remoteId || !s || s === r.title) {
3796
3791
  c(!1);
3797
3792
  return;
@@ -3809,7 +3804,7 @@ function xo({ onThreadSelect: e }) {
3809
3804
  return O(() => {
3810
3805
  r?.title && !u && f(r.title);
3811
3806
  }, [r?.title, u]), r ? /* @__PURE__ */ w(
3812
- He.Root,
3807
+ qe.Root,
3813
3808
  {
3814
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"}`,
3815
3810
  style: { marginBottom: "0.5rem" },
@@ -3817,7 +3812,7 @@ function xo({ onThreadSelect: e }) {
3817
3812
  onMouseLeave: () => i(null),
3818
3813
  children: [
3819
3814
  /* @__PURE__ */ d(
3820
- He.Trigger,
3815
+ qe.Trigger,
3821
3816
  {
3822
3817
  className: "cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-min-w-0 cuadra-cursor-pointer",
3823
3818
  onClick: () => e?.(),
@@ -3834,7 +3829,7 @@ function xo({ onThreadSelect: e }) {
3834
3829
  autoFocus: !0,
3835
3830
  onClick: (b) => b.stopPropagation()
3836
3831
  }
3837
- ) : /* @__PURE__ */ w(ee, { children: [
3832
+ ) : /* @__PURE__ */ w(J, { children: [
3838
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" }),
3839
3834
  r.updatedAt && /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
3840
3835
  ] }) })
@@ -3850,10 +3845,10 @@ function xo({ onThreadSelect: e }) {
3850
3845
  b.stopPropagation(), p(!l);
3851
3846
  },
3852
3847
  "aria-label": "Thread options",
3853
- children: /* @__PURE__ */ d(ca, { 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" })
3854
3849
  }
3855
3850
  ),
3856
- l && /* @__PURE__ */ w(ee, { children: [
3851
+ l && /* @__PURE__ */ w(J, { children: [
3857
3852
  /* @__PURE__ */ d(
3858
3853
  "div",
3859
3854
  {
@@ -3872,7 +3867,7 @@ function xo({ onThreadSelect: e }) {
3872
3867
  disabled: g,
3873
3868
  children: "Save"
3874
3869
  }
3875
- ) : /* @__PURE__ */ w(ee, { children: [
3870
+ ) : /* @__PURE__ */ w(J, { children: [
3876
3871
  /* @__PURE__ */ d(
3877
3872
  "button",
3878
3873
  {
@@ -3885,7 +3880,7 @@ function xo({ onThreadSelect: e }) {
3885
3880
  }
3886
3881
  ),
3887
3882
  /* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
3888
- /* @__PURE__ */ d(He.Delete, { asChild: !0, children: /* @__PURE__ */ d(
3883
+ /* @__PURE__ */ d(qe.Delete, { asChild: !0, children: /* @__PURE__ */ d(
3889
3884
  "button",
3890
3885
  {
3891
3886
  type: "button",
@@ -3909,7 +3904,7 @@ function Et({
3909
3904
  theme: t,
3910
3905
  onLogout: a
3911
3906
  }) {
3912
- return /* @__PURE__ */ w(qe.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: [
3913
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(
3914
3909
  "button",
3915
3910
  {
@@ -3922,22 +3917,22 @@ function Et({
3922
3917
  ) }),
3923
3918
  /* @__PURE__ */ w("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3924
3919
  /* @__PURE__ */ d(
3925
- qe.New,
3920
+ He.New,
3926
3921
  {
3927
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",
3928
3923
  onClick: () => e?.(),
3929
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: [
3930
- /* @__PURE__ */ d(ka, { 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" }),
3931
3926
  /* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3932
3927
  ] }) })
3933
3928
  }
3934
3929
  ),
3935
3930
  /* @__PURE__ */ d("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
3936
3931
  /* @__PURE__ */ d(
3937
- qe.Items,
3932
+ He.Items,
3938
3933
  {
3939
3934
  components: {
3940
- ThreadListItem: (i) => /* @__PURE__ */ d(xo, { ...i, onThreadSelect: e })
3935
+ ThreadListItem: (i) => /* @__PURE__ */ d(bo, { ...i, onThreadSelect: e })
3941
3936
  }
3942
3937
  }
3943
3938
  )
@@ -3950,14 +3945,14 @@ function Et({
3950
3945
  onClick: a,
3951
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",
3952
3947
  "aria-label": "Logout",
3953
- children: /* @__PURE__ */ d(pa, { 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" })
3954
3949
  }
3955
3950
  ),
3956
3951
  r && /* @__PURE__ */ d(vr, { theme: t })
3957
3952
  ] })
3958
3953
  ] });
3959
3954
  }
3960
- const ko = `
3955
+ const yo = `
3961
3956
  @keyframes rotate {
3962
3957
  100% { transform: rotate(1turn); }
3963
3958
  }
@@ -3970,8 +3965,8 @@ const ko = `
3970
3965
  style: o,
3971
3966
  contentStyle: n,
3972
3967
  rotating: u = !1
3973
- }) => /* @__PURE__ */ w(ee, { children: [
3974
- /* @__PURE__ */ d("style", { children: ko }),
3968
+ }) => /* @__PURE__ */ w(J, { children: [
3969
+ /* @__PURE__ */ d("style", { children: yo }),
3975
3970
  /* @__PURE__ */ w(
3976
3971
  "div",
3977
3972
  {
@@ -4028,7 +4023,7 @@ const ko = `
4028
4023
  onMobileMenuClick: c,
4029
4024
  showMobileMenuButton: s = !1
4030
4025
  }) => {
4031
- const [f, l] = L(!1), [p, g] = L(!1), m = de(null);
4026
+ const [f, l] = R(!1), [p, g] = R(!1), m = de(null);
4032
4027
  O(() => {
4033
4028
  const y = (k) => {
4034
4029
  m.current && !m.current.contains(k.target) && l(!1);
@@ -4049,14 +4044,14 @@ const ko = `
4049
4044
  onClick: c,
4050
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",
4051
4046
  "aria-label": "Toggle thread list",
4052
- children: /* @__PURE__ */ d(ba, { 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" })
4053
4048
  }
4054
4049
  ),
4055
4050
  n && /* @__PURE__ */ d("div", { className: "cuadra-hidden md:cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(vr, { theme: u }) })
4056
4051
  ] }),
4057
4052
  /* @__PURE__ */ w("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
4058
4053
  !o && /* @__PURE__ */ d("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
4059
- o ? null : t ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-destructive cuadra-px-3 cuadra-py-2 cuadra-bg-destructive/10", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */ w(ee, { children: [
4054
+ o ? null : t ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ d("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : a ? /* @__PURE__ */ d("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-destructive cuadra-px-3 cuadra-py-2 cuadra-bg-destructive/10", children: /* @__PURE__ */ d("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */ w(J, { children: [
4060
4055
  /* @__PURE__ */ w("div", { ref: m, className: "cuadra-hidden md:cuadra-block cuadra-relative cuadra-w-48", children: [
4061
4056
  /* @__PURE__ */ w(
4062
4057
  "button",
@@ -4117,7 +4112,7 @@ const ko = `
4117
4112
  }
4118
4113
  ),
4119
4114
  p && typeof document < "u" && Ye(
4120
- /* @__PURE__ */ w(ee, { children: [
4115
+ /* @__PURE__ */ w(J, { children: [
4121
4116
  /* @__PURE__ */ d(
4122
4117
  "div",
4123
4118
  {
@@ -4178,8 +4173,8 @@ const ko = `
4178
4173
  ] })
4179
4174
  ] })
4180
4175
  ] });
4181
- }, wo = _r(void 0), Ze = ({ children: e, value: r }) => /* @__PURE__ */ d(wo.Provider, { value: r, children: e });
4182
- function vo() {
4176
+ }, xo = Dr(void 0), Ze = ({ children: e, value: r }) => /* @__PURE__ */ d(xo.Provider, { value: r, children: e });
4177
+ function ko() {
4183
4178
  O(() => {
4184
4179
  if (document.querySelector("style[data-cuadra-uikit]"))
4185
4180
  return;
@@ -4202,9 +4197,9 @@ function vo() {
4202
4197
  }, document.head.appendChild(a), o) break;
4203
4198
  }, []);
4204
4199
  }
4205
- const Co = we(
4200
+ const wo = ve(
4206
4201
  function({ config: r }, t) {
4207
- vo();
4202
+ ko();
4208
4203
  const a = de(null), i = de(!1), {
4209
4204
  baseUrl: o,
4210
4205
  proxyUrl: n,
@@ -4220,93 +4215,93 @@ const Co = we(
4220
4215
  welcomeTitle: b,
4221
4216
  welcomeSubtitle: y,
4222
4217
  extraTopPadding: k,
4223
- suggestions: M,
4224
- inputPlaceholder: S,
4225
- preMadeResponseDelay: N = 1e3,
4218
+ suggestions: T,
4219
+ inputPlaceholder: L,
4220
+ preMadeResponseDelay: I = 1e3,
4226
4221
  streamingSpeed: C = 50,
4227
- showThemeToggle: P = !0,
4222
+ showThemeToggle: D = !0,
4228
4223
  initialMessage: A,
4229
- initialPreMadeQA: I,
4224
+ initialPreMadeQA: N,
4230
4225
  theme: h = "system",
4231
- onError: R,
4232
- onChatCreated: q,
4233
- onUserMessage: G,
4234
- onThreadIdUpdate: re,
4235
- onLogout: H,
4236
- enableAttachments: v = !1,
4237
- onBeforeRequest: j
4226
+ onError: _,
4227
+ onChatCreated: H,
4228
+ onUserMessage: W,
4229
+ onThreadIdUpdate: te,
4230
+ onLogout: Te,
4231
+ enableAttachments: q = !1,
4232
+ onBeforeRequest: v
4238
4233
  } = r;
4239
4234
  at(t, () => ({
4240
- sendMessage: (T) => {
4241
- a.current?.sendMessage(T);
4235
+ sendMessage: (M) => {
4236
+ a.current?.sendMessage(M);
4242
4237
  },
4243
- sendPreMadeQA: (T, D, F) => {
4244
- a.current?.sendPreMadeQA(T, D, F);
4238
+ sendPreMadeQA: (M, F, z) => {
4239
+ a.current?.sendPreMadeQA(M, F, z);
4245
4240
  },
4246
4241
  clearChat: () => {
4247
4242
  a.current?.clearChat();
4248
4243
  }
4249
4244
  }), []), O(() => {
4250
4245
  if (i.current) return;
4251
- const T = setTimeout(() => {
4252
- I ? (i.current = !0, a.current?.sendPreMadeQA(
4253
- I.question,
4254
- I.answer,
4255
- { delay: N, streamingSpeed: C }
4246
+ const M = setTimeout(() => {
4247
+ N ? (i.current = !0, a.current?.sendPreMadeQA(
4248
+ N.question,
4249
+ N.answer,
4250
+ { delay: I, streamingSpeed: C }
4256
4251
  )) : A && (i.current = !0, a.current?.sendMessage(A));
4257
4252
  }, 500);
4258
- return () => clearTimeout(T);
4259
- }, [A, I, N, C]);
4260
- const [_, B] = L(!1), [E, $] = L(null), [V, $e] = L(null), [ce, Oe] = L(!1), Ue = de(null), Ce = (T) => {
4261
- if (T < 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;
4262
4257
  if (Ue.current) {
4263
- const D = Ue.current.getBoundingClientRect();
4264
- if (T - D.left < 30) return !0;
4258
+ const F = Ue.current.getBoundingClientRect();
4259
+ if (M - F.left < 30) return !0;
4265
4260
  }
4266
4261
  return !1;
4267
- }, lt = (T) => {
4268
- const F = T.touches[0].clientX;
4269
- (Ce(F) || _) && ($(F), $e(F), Oe(!0));
4270
- }, dt = (T) => {
4262
+ }, lt = (M) => {
4263
+ const z = M.touches[0].clientX;
4264
+ (Me(z) || S) && (ee(z), re(z), Oe(!0));
4265
+ }, dt = (M) => {
4271
4266
  if (E === null || !ce) return;
4272
- const D = T.touches[0];
4273
- $e(D.clientX);
4267
+ const F = M.touches[0];
4268
+ re(F.clientX);
4274
4269
  }, ft = () => {
4275
- if (E === null || V === null) {
4270
+ if (E === null || P === null) {
4276
4271
  Oe(!1);
4277
4272
  return;
4278
4273
  }
4279
- const T = V - E, D = 50, F = 0.3, xt = Math.abs(T) / 300;
4280
- T > D && !_ && E !== null ? Ce(E) && B(!0) : ((T < -D || T < 0 && xt > F) && _ || _ && T < -20 && xt > F) && B(!1), $(null), $e(null), Oe(!1);
4281
- }, Mr = () => {
4282
- if (ce && E !== null && V !== null) {
4283
- const T = V - E;
4284
- if (_)
4285
- return `translateX(${Math.min(0, T)}px)`;
4286
- if (E !== null && Ce(E))
4287
- return `translateX(${Math.min(0, -320 + T)}px)`;
4288
- }
4289
- return _ ? "translateX(0)" : "translateX(-100%)";
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);
4290
4276
  }, Tr = () => {
4291
- if (!ce || E === null || V === null)
4292
- return _ ? 0.5 : 0;
4293
- const D = V - E;
4294
- return _ ? Math.max(0, Math.min(1, (320 + D) / 320)) * 0.5 : E !== null && Ce(E) ? Math.max(0, Math.min(1, (D + 320) / 320)) * 0.5 : 0;
4295
- }, Me = n || o || "", Te = !!n, ht = X(
4296
- () => new qt(Me, u || void 0, Te),
4297
- [Me, u, Te]
4298
- ), [ue, Ar] = L(null), [he, mt] = L(!1), [me, pt] = L(null), [Nr, gt] = L(!1);
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)`;
4283
+ }
4284
+ return S ? "translateX(0)" : "translateX(-100%)";
4285
+ }, Mr = () => {
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);
4299
4294
  O(() => {
4300
4295
  c === "multiChat" && gt(!0);
4301
4296
  }, [c]);
4302
- const se = K(async () => {
4297
+ const se = X(async () => {
4303
4298
  if (s === "selector") {
4304
4299
  mt(!0), pt(null);
4305
4300
  try {
4306
- const T = await ht.listModels();
4307
- Ar(T);
4308
- } catch (T) {
4309
- pt(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"));
4310
4305
  } finally {
4311
4306
  mt(!1);
4312
4307
  }
@@ -4317,26 +4312,26 @@ const Co = we(
4317
4312
  }, [s, se]), O(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = se), () => {
4318
4313
  typeof window < "u" && delete window.__cuadraUIKitRefetchModels;
4319
4314
  }), [se]);
4320
- const [Z, bt] = L(
4315
+ const [Q, bt] = R(
4321
4316
  s === "fixed" && f || null
4322
- ), yt = de(Z), pe = K(
4323
- (T) => {
4324
- const D = yt.current;
4325
- bt(T), yt.current = T, l?.(T), D !== null && D !== T && c === "multiChat" && setTimeout(() => {
4326
- const F = window.__cuadraThreadListRuntime;
4327
- 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)
4328
4323
  try {
4329
- F.threads.switchToNewThread();
4324
+ z.threads.switchToNewThread();
4330
4325
  } catch {
4331
4326
  }
4332
- else if (F?.threads?.createThread)
4327
+ else if (z?.threads?.createThread)
4333
4328
  try {
4334
- F.threads.createThread();
4329
+ z.threads.createThread();
4335
4330
  } catch {
4336
4331
  }
4337
- else if (F?.switchToNewThread)
4332
+ else if (z?.switchToNewThread)
4338
4333
  try {
4339
- F.switchToNewThread();
4334
+ z.switchToNewThread();
4340
4335
  } catch {
4341
4336
  }
4342
4337
  }, 100);
@@ -4344,48 +4339,48 @@ const Co = we(
4344
4339
  [l, c]
4345
4340
  );
4346
4341
  O(() => {
4347
- if (s === "selector" && ue?.items && ue.items.length > 0 && !Z) {
4348
- const T = ue.items[0];
4349
- if (T?.id) {
4350
- const D = T.id;
4351
- bt(D), l?.(D);
4342
+ if (s === "selector" && ue?.items && ue.items.length > 0 && !Q) {
4343
+ const M = ue.items[0];
4344
+ if (M?.id) {
4345
+ const F = M.id;
4346
+ bt(F), l?.(F);
4352
4347
  }
4353
4348
  }
4354
- }, [s, ue?.items, Z, l]);
4355
- const Ir = s === "fixed" ? !!f : !!Z, Ae = X(
4356
- () => (ue?.items || []).filter((T) => T?.id && T?.displayName).map((T) => ({ id: T.id, name: T.displayName })),
4349
+ }, [s, ue?.items, Q, l]);
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 })),
4357
4352
  [ue]
4358
- ), Be = X(
4353
+ ), Be = V(
4359
4354
  () => ({
4360
- currentModelId: Z || "",
4361
- models: Ae,
4355
+ currentModelId: Q || "",
4356
+ models: Ie,
4362
4357
  modelsLoading: he,
4363
4358
  modelsError: me,
4364
4359
  onModelChange: pe,
4365
4360
  refetchModels: se
4366
4361
  }),
4367
- [Z, Ae, he, me, pe, se]
4362
+ [Q, Ie, he, me, pe, se]
4368
4363
  );
4369
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(
4370
- Ia,
4365
+ Aa,
4371
4366
  {
4372
- baseUrl: Te ? Me : o || Me,
4367
+ baseUrl: Ne ? Ae : o || Ae,
4373
4368
  sessionToken: u,
4374
- isProxyMode: Te,
4369
+ isProxyMode: Ne,
4375
4370
  mode: c,
4376
4371
  modelMode: s,
4377
- modelId: Z || f || void 0,
4372
+ modelId: Q || f || void 0,
4378
4373
  onModelChange: pe,
4379
4374
  ephemeral: p,
4380
4375
  systemPrompt: g,
4381
4376
  enableReasoning: m,
4382
4377
  initialThreadId: x,
4383
- enableAttachments: v,
4384
- onError: R,
4385
- onChatCreated: q,
4386
- onUserMessage: G,
4387
- onThreadIdUpdate: re,
4388
- onBeforeRequest: j,
4378
+ enableAttachments: q,
4379
+ onError: _,
4380
+ onChatCreated: H,
4381
+ onUserMessage: W,
4382
+ onThreadIdUpdate: te,
4383
+ onBeforeRequest: v,
4389
4384
  onChatsLoaded: () => {
4390
4385
  c === "multiChat" && gt(!1);
4391
4386
  },
@@ -4405,19 +4400,19 @@ const Co = we(
4405
4400
  onTouchStart: lt,
4406
4401
  onTouchMove: dt,
4407
4402
  onTouchEnd: ft,
4408
- children: c === "multiChat" ? /* @__PURE__ */ w(ee, { children: [
4403
+ children: c === "multiChat" ? /* @__PURE__ */ w(J, { children: [
4409
4404
  typeof document < "u" && Ye(
4410
4405
  /* @__PURE__ */ d(
4411
4406
  "div",
4412
4407
  {
4413
- className: `cuadra-fixed cuadra-inset-0 cuadra-bg-black cuadra-z-40 md:cuadra-hidden cuadra-transition-opacity cuadra-duration-300 ${_ || ce ? "" : "cuadra-pointer-events-none"}`,
4414
- style: { opacity: Tr() },
4415
- onClick: () => B(!1)
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"}`,
4409
+ style: { opacity: Mr() },
4410
+ onClick: () => $(!1)
4416
4411
  }
4417
4412
  ),
4418
4413
  document.body
4419
4414
  ),
4420
- typeof document < "u" && /* @__PURE__ */ w(ee, { children: [
4415
+ typeof document < "u" && /* @__PURE__ */ w(J, { children: [
4421
4416
  /* @__PURE__ */ d(
4422
4417
  "div",
4423
4418
  {
@@ -4426,10 +4421,10 @@ const Co = we(
4426
4421
  children: /* @__PURE__ */ d(
4427
4422
  Et,
4428
4423
  {
4429
- onThreadSelect: () => B(!1),
4430
- showThemeToggle: P,
4424
+ onThreadSelect: () => $(!1),
4425
+ showThemeToggle: D,
4431
4426
  theme: h,
4432
- onLogout: H
4427
+ onLogout: Te
4433
4428
  }
4434
4429
  )
4435
4430
  }
@@ -4438,10 +4433,10 @@ const Co = we(
4438
4433
  /* @__PURE__ */ d(
4439
4434
  "div",
4440
4435
  {
4441
- 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 ${_ || 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"}`,
4442
4437
  style: {
4443
4438
  borderRightWidth: "1px",
4444
- transform: Mr(),
4439
+ transform: Tr(),
4445
4440
  transition: ce ? "none" : "transform 0.3s ease-in-out"
4446
4441
  },
4447
4442
  onTouchStart: lt,
@@ -4450,10 +4445,10 @@ const Co = we(
4450
4445
  children: /* @__PURE__ */ d(
4451
4446
  Et,
4452
4447
  {
4453
- onThreadSelect: () => B(!1),
4454
- showThemeToggle: P,
4448
+ onThreadSelect: () => $(!1),
4449
+ showThemeToggle: D,
4455
4450
  theme: h,
4456
- onLogout: H
4451
+ onLogout: Te
4457
4452
  }
4458
4453
  )
4459
4454
  }
@@ -4465,28 +4460,28 @@ const Co = we(
4465
4460
  s === "selector" && /* @__PURE__ */ d(
4466
4461
  Ft,
4467
4462
  {
4468
- currentModel: Z || "",
4469
- models: Ae,
4463
+ currentModel: Q || "",
4464
+ models: Ie,
4470
4465
  modelsLoading: he,
4471
4466
  modelsError: me,
4472
4467
  onModelChange: pe,
4473
- showThemeToggle: P,
4468
+ showThemeToggle: D,
4474
4469
  theme: h,
4475
- onMobileMenuClick: () => B(!_),
4470
+ onMobileMenuClick: () => $(!S),
4476
4471
  showMobileMenuButton: c === "multiChat"
4477
4472
  }
4478
4473
  ),
4479
4474
  /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
4480
- Dt,
4475
+ _t,
4481
4476
  {
4482
4477
  ref: a,
4483
4478
  welcomeTitle: b,
4484
4479
  welcomeSubtitle: y,
4485
4480
  extraTopPadding: k,
4486
- suggestions: M,
4487
- inputPlaceholder: S,
4488
- enableAttachments: v,
4489
- preMadeResponseDelay: N,
4481
+ suggestions: T,
4482
+ inputPlaceholder: L,
4483
+ enableAttachments: q,
4484
+ preMadeResponseDelay: I,
4490
4485
  streamingSpeed: C
4491
4486
  }
4492
4487
  ) })
@@ -4495,25 +4490,25 @@ const Co = we(
4495
4490
  s === "selector" && /* @__PURE__ */ d(
4496
4491
  Ft,
4497
4492
  {
4498
- currentModel: Z || "",
4499
- models: Ae,
4493
+ currentModel: Q || "",
4494
+ models: Ie,
4500
4495
  modelsLoading: he,
4501
4496
  modelsError: me,
4502
4497
  onModelChange: pe,
4503
- showThemeToggle: P,
4498
+ showThemeToggle: D,
4504
4499
  theme: h
4505
4500
  }
4506
4501
  ),
4507
4502
  /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
4508
- Dt,
4503
+ _t,
4509
4504
  {
4510
4505
  ref: a,
4511
4506
  welcomeTitle: b,
4512
4507
  welcomeSubtitle: y,
4513
4508
  extraTopPadding: k,
4514
- suggestions: M,
4515
- inputPlaceholder: S,
4516
- preMadeResponseDelay: N,
4509
+ suggestions: T,
4510
+ inputPlaceholder: L,
4511
+ preMadeResponseDelay: I,
4517
4512
  streamingSpeed: C
4518
4513
  }
4519
4514
  ) })
@@ -4526,18 +4521,18 @@ const Co = we(
4526
4521
  ) }) });
4527
4522
  }
4528
4523
  );
4529
- function Mo(e, r = ":root") {
4524
+ function vo(e, r = ":root") {
4530
4525
  if (typeof document > "u")
4531
4526
  return;
4532
4527
  const t = document.documentElement;
4533
- if (e.light && Ao(e.light, t), e.dark) {
4528
+ if (e.light && To(e.light, t), e.dark) {
4534
4529
  let a = document.getElementById("cuadra-theme-dark");
4535
4530
  a || (a = document.createElement("style"), a.id = "cuadra-theme-dark", document.head.appendChild(a));
4536
- const i = No(e.dark);
4531
+ const i = Mo(e.dark);
4537
4532
  a.textContent = `.dark { ${i} }`;
4538
4533
  }
4539
4534
  }
4540
- const To = {
4535
+ const Co = {
4541
4536
  background: "background",
4542
4537
  foreground: "foreground",
4543
4538
  card: "card",
@@ -4567,10 +4562,10 @@ const To = {
4567
4562
  warningForeground: "warning-foreground"
4568
4563
  };
4569
4564
  function Cr(e) {
4570
- const r = To[e];
4565
+ const r = Co[e];
4571
4566
  return r ? `--cuadra-${r}` : `--cuadra-${e.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
4572
4567
  }
4573
- function Ao(e, r) {
4568
+ function To(e, r) {
4574
4569
  Object.entries(e).forEach(([t, a]) => {
4575
4570
  if (a) {
4576
4571
  const i = Cr(t);
@@ -4578,10 +4573,10 @@ function Ao(e, r) {
4578
4573
  }
4579
4574
  });
4580
4575
  }
4581
- function No(e) {
4576
+ function Mo(e) {
4582
4577
  return Object.entries(e).map(([r, t]) => t ? `${Cr(r)}: ${t};` : "").filter(Boolean).join(" ");
4583
4578
  }
4584
- function Eo() {
4579
+ function Do() {
4585
4580
  if (typeof document > "u")
4586
4581
  return;
4587
4582
  const e = document.documentElement;
@@ -4589,11 +4584,11 @@ function Eo() {
4589
4584
  const t = document.getElementById("cuadra-theme-dark");
4590
4585
  t && t.remove();
4591
4586
  }
4592
- const Fo = we(
4587
+ const _o = ve(
4593
4588
  function(r, t) {
4594
4589
  const a = de(null);
4595
4590
  O(() => {
4596
- r.customTheme && Mo(r.customTheme);
4591
+ r.customTheme && vo(r.customTheme);
4597
4592
  }, [r.customTheme]), at(t, () => ({
4598
4593
  sendMessage: (o) => {
4599
4594
  a.current?.sendMessage(o);
@@ -4644,15 +4639,15 @@ const Fo = we(
4644
4639
  initialPreMadeQA: r.initialPreMadeQA,
4645
4640
  onBeforeRequest: r.onBeforeRequest
4646
4641
  };
4647
- return /* @__PURE__ */ d(Co, { ref: a, config: i });
4642
+ return /* @__PURE__ */ d(wo, { ref: a, config: i });
4648
4643
  }
4649
4644
  );
4650
4645
  export {
4651
4646
  wr as Badge,
4652
- Fo as CuadraChat,
4653
- lo as SourceCitations,
4654
- Mo as applyTheme,
4655
- Eo as removeTheme,
4647
+ _o as CuadraChat,
4648
+ uo as SourceCitations,
4649
+ vo as applyTheme,
4650
+ Do as removeTheme,
4656
4651
  ie as streamingMetadataStore
4657
4652
  };
4658
4653
  //# sourceMappingURL=index.mjs.map