@cuadra-ai/uikit 0.1.7 → 0.1.8

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,23 +1,23 @@
1
1
  var Ft = Object.defineProperty;
2
2
  var zt = (e, r, t) => r in e ? Ft(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var ee = (e, r, t) => zt(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { jsx as h, jsxs as T, Fragment as W } from "react/jsx-runtime";
5
- import { forwardRef as Ye, createElement as Ae, useMemo as H, useState as N, useEffect as L, useCallback as re, memo as jt, useRef as et, createContext as $t } from "react";
3
+ var oe = (e, r, t) => zt(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { jsx as h, jsxs as v, Fragment as W } from "react/jsx-runtime";
5
+ import { forwardRef as Ye, createElement as Ie, useMemo as H, useState as N, useEffect as L, useCallback as te, memo as jt, useRef as et, createContext as $t } from "react";
6
6
  import { createPortal as ze } from "react-dom";
7
- import { useLocalRuntime as tt, AssistantRuntimeProvider as rt, unstable_useRemoteThreadListRuntime as Ot, useThreadRuntime as Ut, ThreadPrimitive as te, ComposerPrimitive as be, useAssistantApi as Bt, MessagePrimitive as ce, ThreadListPrimitive as ke, useThreadListItem as Wt, useThread as Ht, ThreadListItemPrimitive as xe } from "@assistant-ui/react";
7
+ import { useLocalRuntime as tt, AssistantRuntimeProvider as rt, unstable_useRemoteThreadListRuntime as Ot, useThreadRuntime as Ut, ThreadPrimitive as ee, ComposerPrimitive as be, useAssistantApi as Bt, MessagePrimitive as ce, ThreadListPrimitive as ke, useThreadListItem as Wt, useThread as Ht, ThreadListItemPrimitive as xe } from "@assistant-ui/react";
8
8
  import { unstable_memoizeMarkdownComponents as qt, useIsMarkdownCodeBlock as Kt, MarkdownTextPrimitive as Vt } from "@assistant-ui/react-markdown";
9
- const Xt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Gt = (e) => e.replace(
9
+ const Gt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Zt = (e) => e.replace(
10
10
  /^([A-Z])|[\s-_]+(\w)/g,
11
11
  (r, t, n) => n ? n.toUpperCase() : t.toLowerCase()
12
12
  ), je = (e) => {
13
- const r = Gt(e);
13
+ const r = Zt(e);
14
14
  return r.charAt(0).toUpperCase() + r.slice(1);
15
- }, nt = (...e) => e.filter((r, t, n) => !!r && r.trim() !== "" && n.indexOf(r) === t).join(" ").trim(), Zt = (e) => {
15
+ }, nt = (...e) => e.filter((r, t, n) => !!r && r.trim() !== "" && n.indexOf(r) === t).join(" ").trim(), Jt = (e) => {
16
16
  for (const r in e)
17
17
  if (r.startsWith("aria-") || r === "role" || r === "title")
18
18
  return !0;
19
19
  };
20
- var Jt = {
20
+ var Qt = {
21
21
  xmlns: "http://www.w3.org/2000/svg",
22
22
  width: 24,
23
23
  height: 24,
@@ -28,7 +28,7 @@ var Jt = {
28
28
  strokeLinecap: "round",
29
29
  strokeLinejoin: "round"
30
30
  };
31
- const Qt = Ye(
31
+ const Xt = Ye(
32
32
  ({
33
33
  color: e = "currentColor",
34
34
  size: r = 24,
@@ -38,32 +38,32 @@ const Qt = Ye(
38
38
  children: o,
39
39
  iconNode: a,
40
40
  ...u
41
- }, l) => Ae(
41
+ }, l) => Ie(
42
42
  "svg",
43
43
  {
44
44
  ref: l,
45
- ...Jt,
45
+ ...Qt,
46
46
  width: r,
47
47
  height: r,
48
48
  stroke: e,
49
49
  strokeWidth: n ? Number(t) * 24 / Number(r) : t,
50
50
  className: nt("lucide", i),
51
- ...!o && !Zt(u) && { "aria-hidden": "true" },
51
+ ...!o && !Jt(u) && { "aria-hidden": "true" },
52
52
  ...u
53
53
  },
54
54
  [
55
- ...a.map(([s, f]) => Ae(s, f)),
55
+ ...a.map(([s, f]) => Ie(s, f)),
56
56
  ...Array.isArray(o) ? o : [o]
57
57
  ]
58
58
  )
59
59
  );
60
60
  const z = (e, r) => {
61
61
  const t = Ye(
62
- ({ className: n, ...i }, o) => Ae(Qt, {
62
+ ({ className: n, ...i }, o) => Ie(Xt, {
63
63
  ref: o,
64
64
  iconNode: r,
65
65
  className: nt(
66
- `lucide-${Xt(je(e))}`,
66
+ `lucide-${Gt(je(e))}`,
67
67
  `lucide-${e}`,
68
68
  n
69
69
  ),
@@ -102,12 +102,11 @@ const mr = [
102
102
  ["path", { d: "M12 5v14", key: "s699le" }]
103
103
  ], pr = z("plus", mr);
104
104
  class it {
105
- constructor(r, t, n = !1, i) {
106
- ee(this, "baseUrl");
107
- ee(this, "sessionToken", null);
108
- ee(this, "isProxyMode", !1);
109
- ee(this, "tenantId", null);
110
- this.baseUrl = r.replace(/\/$/, ""), this.isProxyMode = n, t && (this.sessionToken = t), i && (this.tenantId = i);
105
+ constructor(r, t, n = !1) {
106
+ oe(this, "baseUrl");
107
+ oe(this, "sessionToken", null);
108
+ oe(this, "isProxyMode", !1);
109
+ this.baseUrl = r.replace(/\/$/, ""), this.isProxyMode = n, t && (this.sessionToken = t);
111
110
  }
112
111
  /**
113
112
  * Set or update the session token
@@ -115,12 +114,6 @@ class it {
115
114
  setSessionToken(r) {
116
115
  this.sessionToken = r;
117
116
  }
118
- /**
119
- * Set or update the tenant ID
120
- */
121
- setTenantId(r) {
122
- this.tenantId = r;
123
- }
124
117
  /**
125
118
  * Create or continue a chat with streaming support
126
119
  * Returns a ReadableStream for SSE parsing
@@ -137,7 +130,7 @@ class it {
137
130
  "Content-Type": "application/json",
138
131
  "Idempotency-Key": this.generateIdempotencyKey()
139
132
  };
140
- this.sessionToken && (o.Authorization = `Bearer ${this.sessionToken}`), this.tenantId && (o["X-Tenant-Id"] = this.tenantId);
133
+ this.sessionToken && (o.Authorization = `Bearer ${this.sessionToken}`);
141
134
  const a = {
142
135
  ...r,
143
136
  stream: !0
@@ -164,7 +157,7 @@ class it {
164
157
  const t = this.getUrl(`/v1/chats/${r}`), n = {
165
158
  "Content-Type": "application/json"
166
159
  };
167
- this.sessionToken && (n.Authorization = `Bearer ${this.sessionToken}`), this.tenantId && (n["X-Tenant-Id"] = this.tenantId);
160
+ this.sessionToken && (n.Authorization = `Bearer ${this.sessionToken}`);
168
161
  const i = await fetch(t, {
169
162
  method: "GET",
170
163
  headers: n
@@ -188,7 +181,7 @@ class it {
188
181
  const i = {
189
182
  "Content-Type": "application/json"
190
183
  };
191
- this.sessionToken && (i.Authorization = `Bearer ${this.sessionToken}`), this.tenantId && (i["X-Tenant-Id"] = this.tenantId);
184
+ this.sessionToken && (i.Authorization = `Bearer ${this.sessionToken}`);
192
185
  const o = await fetch(n.toString(), {
193
186
  method: "GET",
194
187
  headers: i
@@ -224,7 +217,7 @@ class it {
224
217
  "Content-Type": "application/json",
225
218
  "Idempotency-Key": this.generateIdempotencyKey()
226
219
  };
227
- this.sessionToken && (u.Authorization = `Bearer ${this.sessionToken}`), this.tenantId && (u["X-Tenant-Id"] = this.tenantId);
220
+ this.sessionToken && (u.Authorization = `Bearer ${this.sessionToken}`);
228
221
  const l = await fetch(o.toString(), {
229
222
  method: "PATCH",
230
223
  headers: u,
@@ -261,7 +254,7 @@ class it {
261
254
  "Content-Type": "application/json",
262
255
  "Idempotency-Key": this.generateIdempotencyKey()
263
256
  };
264
- this.sessionToken && (a.Authorization = `Bearer ${this.sessionToken}`), this.tenantId && (a["X-Tenant-Id"] = this.tenantId);
257
+ this.sessionToken && (a.Authorization = `Bearer ${this.sessionToken}`);
265
258
  const u = await fetch(i.toString(), {
266
259
  method: "DELETE",
267
260
  headers: a
@@ -284,7 +277,7 @@ class it {
284
277
  const i = {
285
278
  "Content-Type": "application/json"
286
279
  };
287
- this.sessionToken && (i.Authorization = `Bearer ${this.sessionToken}`), this.tenantId && (i["X-Tenant-Id"] = this.tenantId);
280
+ this.sessionToken && (i.Authorization = `Bearer ${this.sessionToken}`);
288
281
  const o = await fetch(n.toString(), {
289
282
  method: "GET",
290
283
  headers: i
@@ -304,7 +297,7 @@ class it {
304
297
  const t = this.getUrl(`/v1/models/${r}`), n = {
305
298
  "Content-Type": "application/json"
306
299
  };
307
- this.sessionToken && (n.Authorization = `Bearer ${this.sessionToken}`), this.tenantId && (n["X-Tenant-Id"] = this.tenantId);
300
+ this.sessionToken && (n.Authorization = `Bearer ${this.sessionToken}`);
308
301
  const i = await fetch(t, {
309
302
  method: "GET",
310
303
  headers: n
@@ -474,51 +467,50 @@ function wr({
474
467
  baseUrl: r,
475
468
  sessionToken: t,
476
469
  isProxyMode: n = !1,
477
- tenantId: i,
478
- mode: o = "multiChat",
479
- modelId: a,
480
- onModelChange: u,
481
- ephemeral: l = !1,
482
- systemPrompt: s,
483
- initialThreadId: f,
484
- onError: c,
485
- onChatCreated: p,
486
- onThreadIdUpdate: g,
487
- onChatsLoaded: d
470
+ mode: i = "multiChat",
471
+ modelId: o,
472
+ onModelChange: a,
473
+ ephemeral: u = !1,
474
+ systemPrompt: l,
475
+ initialThreadId: s,
476
+ onError: f,
477
+ onChatCreated: c,
478
+ onThreadIdUpdate: p,
479
+ onChatsLoaded: g
488
480
  }) {
489
- const k = H(
490
- () => new it(r, t || void 0, n, i),
491
- [r, t, n, i]
492
- ), [b, x] = N(a || null);
481
+ const d = H(
482
+ () => new it(r, t || void 0, n),
483
+ [r, t, n]
484
+ ), [k, b] = N(o || null);
493
485
  L(() => {
494
- a && x(a);
495
- }, [a]);
496
- const w = re(
497
- (I) => {
498
- p?.(I);
486
+ o && b(o);
487
+ }, [o]);
488
+ const x = te(
489
+ (C) => {
490
+ c?.(C);
499
491
  },
500
- [p]
501
- ), y = re(
502
- (I, D) => {
503
- g?.(I, D);
492
+ [c]
493
+ ), w = te(
494
+ (C, A) => {
495
+ p?.(C, A);
504
496
  },
505
- [g]
506
- ), v = H(() => kr(k, {
507
- modelId: b || void 0,
497
+ [p]
498
+ ), y = H(() => kr(d, {
499
+ modelId: k || void 0,
508
500
  // Pass undefined if not set (backend resolves it)
509
- systemPrompt: s,
510
- ephemeral: l,
511
- onChatCreated: w
512
- }), [k, b, s, l, w]), C = tt(v);
513
- return o === "singleChat" ? /* @__PURE__ */ h(rt, { runtime: C, children: e }) : /* @__PURE__ */ h(
501
+ systemPrompt: l,
502
+ ephemeral: u,
503
+ onChatCreated: x
504
+ }), [d, k, l, u, x]), T = tt(y);
505
+ return i === "singleChat" ? /* @__PURE__ */ h(rt, { runtime: T, children: e }) : /* @__PURE__ */ h(
514
506
  yr,
515
507
  {
516
- client: k,
517
- modelAdapter: v,
518
- initialThreadId: f,
519
- onChatsLoaded: d,
520
- onThreadIdUpdate: y,
521
- onError: c,
508
+ client: d,
509
+ modelAdapter: y,
510
+ initialThreadId: s,
511
+ onChatsLoaded: g,
512
+ onThreadIdUpdate: w,
513
+ onError: f,
522
514
  children: e
523
515
  }
524
516
  );
@@ -544,7 +536,7 @@ function yr({
544
536
  L(() => {
545
537
  window.__cuadraThreadListAdapter = l, window.__cuadraThreadListRuntime = null;
546
538
  }, [l]);
547
- const s = re(() => tt(r), [r]), f = Ot({
539
+ const s = te(() => tt(r), [r]), f = Ot({
548
540
  adapter: l,
549
541
  runtimeHook: s
550
542
  });
@@ -561,7 +553,7 @@ function Oe(e, r) {
561
553
  n++, i = t.indexOf(r, i + r.length);
562
554
  return n;
563
555
  }
564
- const ne = he(/[A-Za-z]/), Le = he(/[\dA-Za-z]/);
556
+ const re = he(/[A-Za-z]/), Le = he(/[\dA-Za-z]/);
565
557
  function Cr(e) {
566
558
  return (
567
559
  // Special whitespace codes (which have negative values), C0 and Control
@@ -569,7 +561,7 @@ function Cr(e) {
569
561
  e !== null && (e < 32 || e === 127)
570
562
  );
571
563
  }
572
- function G(e) {
564
+ function Z(e) {
573
565
  return e !== null && e < -2;
574
566
  }
575
567
  function M(e) {
@@ -614,13 +606,13 @@ const me = (
614
606
  return Array.isArray(e) ? Tr(e) : (
615
607
  // Cast because `ReadonlyArray` goes into the above but `isArray`
616
608
  // narrows to `Array`.
617
- Ir(
609
+ Ar(
618
610
  /** @type {Props} */
619
611
  e
620
612
  )
621
613
  );
622
614
  if (typeof e == "string")
623
- return Ar(e);
615
+ return Ir(e);
624
616
  throw new Error("Expected function, string, or object as test");
625
617
  })
626
618
  );
@@ -637,7 +629,7 @@ function Tr(e) {
637
629
  return !1;
638
630
  }
639
631
  }
640
- function Ir(e) {
632
+ function Ar(e) {
641
633
  const r = (
642
634
  /** @type {Record<string, unknown>} */
643
635
  e
@@ -655,7 +647,7 @@ function Ir(e) {
655
647
  return !0;
656
648
  }
657
649
  }
658
- function Ar(e) {
650
+ function Ir(e) {
659
651
  return pe(r);
660
652
  function r(t) {
661
653
  return t && t.type === e;
@@ -754,16 +746,16 @@ function Pr(e, r, t) {
754
746
  p.lastIndex = 0;
755
747
  let y = p.exec(s.value);
756
748
  for (; y; ) {
757
- const v = y.index, C = {
749
+ const T = y.index, C = {
758
750
  index: y.index,
759
751
  input: y.input,
760
752
  stack: [...f, s]
761
753
  };
762
- let I = g(...y, C);
763
- if (typeof I == "string" && (I = I.length > 0 ? { type: "text", value: I } : void 0), I === !1 ? p.lastIndex = v + 1 : (d !== v && w.push({
754
+ let A = g(...y, C);
755
+ if (typeof A == "string" && (A = A.length > 0 ? { type: "text", value: A } : void 0), A === !1 ? p.lastIndex = T + 1 : (d !== T && w.push({
764
756
  type: "text",
765
- value: s.value.slice(d, v)
766
- }), Array.isArray(I) ? w.push(...I) : I && w.push(I), d = v + y[0].length, x = !0), !p.global)
757
+ value: s.value.slice(d, T)
758
+ }), Array.isArray(A) ? w.push(...A) : A && w.push(A), d = T + y[0].length, x = !0), !p.global)
767
759
  break;
768
760
  y = p.exec(s.value);
769
761
  }
@@ -912,28 +904,28 @@ function ut(e, r) {
912
904
  return (e.index === 0 || q(t) || fe(t)) && // If it’s an email, the previous character should not be a slash.
913
905
  (!r || t !== 47);
914
906
  }
915
- function ie(e) {
907
+ function ae(e) {
916
908
  return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
917
909
  }
918
910
  ct.peek = rn;
919
- function Xr() {
911
+ function Gr() {
920
912
  this.buffer();
921
913
  }
922
- function Gr(e) {
914
+ function Zr(e) {
923
915
  this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
924
916
  }
925
- function Zr() {
917
+ function Jr() {
926
918
  this.buffer();
927
919
  }
928
- function Jr(e) {
920
+ function Qr(e) {
929
921
  this.enter(
930
922
  { type: "footnoteDefinition", identifier: "", label: "", children: [] },
931
923
  e
932
924
  );
933
925
  }
934
- function Qr(e) {
926
+ function Xr(e) {
935
927
  const r = this.resume(), t = this.stack[this.stack.length - 1];
936
- t.type, t.identifier = ie(
928
+ t.type, t.identifier = ae(
937
929
  this.sliceSerialize(e)
938
930
  ).toLowerCase(), t.label = r;
939
931
  }
@@ -942,7 +934,7 @@ function Yr(e) {
942
934
  }
943
935
  function en(e) {
944
936
  const r = this.resume(), t = this.stack[this.stack.length - 1];
945
- t.type, t.identifier = ie(
937
+ t.type, t.identifier = ae(
946
938
  this.sliceSerialize(e)
947
939
  ).toLowerCase(), t.label = r;
948
940
  }
@@ -963,13 +955,13 @@ function ct(e, r, t, n) {
963
955
  function nn() {
964
956
  return {
965
957
  enter: {
966
- gfmFootnoteCallString: Xr,
967
- gfmFootnoteCall: Gr,
968
- gfmFootnoteDefinitionLabelString: Zr,
969
- gfmFootnoteDefinition: Jr
958
+ gfmFootnoteCallString: Gr,
959
+ gfmFootnoteCall: Zr,
960
+ gfmFootnoteDefinitionLabelString: Jr,
961
+ gfmFootnoteDefinition: Qr
970
962
  },
971
963
  exit: {
972
- gfmFootnoteCallString: Qr,
964
+ gfmFootnoteCallString: Xr,
973
965
  gfmFootnoteCall: Yr,
974
966
  gfmFootnoteDefinitionLabelString: en,
975
967
  gfmFootnoteDefinition: tn
@@ -1099,14 +1091,14 @@ function mn(e, r) {
1099
1091
  const x = [];
1100
1092
  for (; ++c < s; ) {
1101
1093
  const w = k[c] || "";
1102
- let y = "", v = "";
1094
+ let y = "", T = "";
1103
1095
  if (t.alignDelimiters !== !1) {
1104
- const C = l[c] - (b[c] || 0), I = o[c];
1105
- I === 114 ? y = " ".repeat(C) : I === 99 ? C % 2 ? (y = " ".repeat(C / 2 + 0.5), v = " ".repeat(C / 2 - 0.5)) : (y = " ".repeat(C / 2), v = y) : v = " ".repeat(C);
1096
+ const C = l[c] - (b[c] || 0), A = o[c];
1097
+ A === 114 ? y = " ".repeat(C) : A === 99 ? C % 2 ? (y = " ".repeat(C / 2 + 0.5), T = " ".repeat(C / 2 - 0.5)) : (y = " ".repeat(C / 2), T = y) : T = " ".repeat(C);
1106
1098
  }
1107
1099
  t.delimiterStart !== !1 && !c && x.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
1108
1100
  // empty: there will be a closing space.
1109
- !(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || c) && x.push(" "), t.alignDelimiters !== !1 && x.push(y), x.push(w), t.alignDelimiters !== !1 && x.push(v), t.padding !== !1 && x.push(" "), (t.delimiterEnd !== !1 || c !== s - 1) && x.push("|");
1101
+ !(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || c) && x.push(" "), t.alignDelimiters !== !1 && x.push(y), x.push(w), t.alignDelimiters !== !1 && x.push(T), t.padding !== !1 && x.push(" "), (t.delimiterEnd !== !1 || c !== s - 1) && x.push("|");
1110
1102
  }
1111
1103
  d.push(
1112
1104
  t.delimiterEnd === !1 ? x.join("").replace(/ +$/, "") : x.join("")
@@ -1254,7 +1246,7 @@ function Tn(e, r, t, n) {
1254
1246
  })
1255
1247
  ), s += l.move(i), u()), a(), s;
1256
1248
  }
1257
- function In(e) {
1249
+ function An(e) {
1258
1250
  const r = e.options.emphasis || "*";
1259
1251
  if (r !== "*" && r !== "_")
1260
1252
  throw new Error(
@@ -1262,7 +1254,7 @@ function In(e) {
1262
1254
  );
1263
1255
  return r;
1264
1256
  }
1265
- function ae(e) {
1257
+ function ne(e) {
1266
1258
  return "&#x" + e.toString(16).toUpperCase() + ";";
1267
1259
  }
1268
1260
  function se(e) {
@@ -1304,9 +1296,9 @@ function de(e, r, t) {
1304
1296
  { inside: !1, outside: !1 }
1305
1297
  );
1306
1298
  }
1307
- ft.peek = An;
1299
+ ft.peek = In;
1308
1300
  function ft(e, r, t, n) {
1309
- const i = In(t), o = t.enter("emphasis"), a = t.createTracker(n), u = a.move(i);
1301
+ const i = An(t), o = t.enter("emphasis"), a = t.createTracker(n), u = a.move(i);
1310
1302
  let l = a.move(
1311
1303
  t.containerPhrasing(e, {
1312
1304
  after: i,
@@ -1319,16 +1311,16 @@ function ft(e, r, t, n) {
1319
1311
  s,
1320
1312
  i
1321
1313
  );
1322
- f.inside && (l = ae(s) + l.slice(1));
1314
+ f.inside && (l = ne(s) + l.slice(1));
1323
1315
  const c = l.charCodeAt(l.length - 1), p = de(n.after.charCodeAt(0), c, i);
1324
- p.inside && (l = l.slice(0, -1) + ae(c));
1316
+ p.inside && (l = l.slice(0, -1) + ne(c));
1325
1317
  const g = a.move(i);
1326
1318
  return o(), t.attentionEncodeSurroundingInfo = {
1327
1319
  after: p.outside,
1328
1320
  before: f.outside
1329
1321
  }, u + l + g;
1330
1322
  }
1331
- function An(e, r, t) {
1323
+ function In(e, r, t) {
1332
1324
  return t.options.emphasis || "*";
1333
1325
  }
1334
1326
  function Nn(e, r, t, n) {
@@ -1399,7 +1391,7 @@ function Dn(e, r, t, n) {
1399
1391
  `,
1400
1392
  ...o.current()
1401
1393
  });
1402
- return /^[\t ]/.test(s) && (s = ae(s.charCodeAt(0)) + s.slice(1)), s = s ? a + " " + s : a, t.options.closeAtx && (s += " " + a), l(), u(), s;
1394
+ return /^[\t ]/.test(s) && (s = ne(s.charCodeAt(0)) + s.slice(1)), s = s ? a + " " + s : a, t.options.closeAtx && (s += " " + a), l(), u(), s;
1403
1395
  }
1404
1396
  pt.peek = Pn;
1405
1397
  function pt(e) {
@@ -1709,9 +1701,9 @@ function vt(e, r, t, n) {
1709
1701
  s,
1710
1702
  i
1711
1703
  );
1712
- f.inside && (l = ae(s) + l.slice(1));
1704
+ f.inside && (l = ne(s) + l.slice(1));
1713
1705
  const c = l.charCodeAt(l.length - 1), p = de(n.after.charCodeAt(0), c, i);
1714
- p.inside && (l = l.slice(0, -1) + ae(c));
1706
+ p.inside && (l = l.slice(0, -1) + ne(c));
1715
1707
  const g = a.move(i + i);
1716
1708
  return o(), t.attentionEncodeSurroundingInfo = {
1717
1709
  after: p.outside,
@@ -1721,10 +1713,10 @@ function vt(e, r, t, n) {
1721
1713
  function Vn(e, r, t) {
1722
1714
  return t.options.strong || "*";
1723
1715
  }
1724
- function Xn(e, r, t, n) {
1716
+ function Gn(e, r, t, n) {
1725
1717
  return t.safe(e.value, n);
1726
1718
  }
1727
- function Gn(e) {
1719
+ function Zn(e) {
1728
1720
  const r = e.options.ruleRepetition || 3;
1729
1721
  if (r < 3)
1730
1722
  throw new Error(
@@ -1732,8 +1724,8 @@ function Gn(e) {
1732
1724
  );
1733
1725
  return r;
1734
1726
  }
1735
- function Zn(e, r, t) {
1736
- const n = (Ct(t) + (t.options.ruleSpaces ? " " : "")).repeat(Gn(t));
1727
+ function Jn(e, r, t) {
1728
+ const n = (Ct(t) + (t.options.ruleSpaces ? " " : "")).repeat(Zn(t));
1737
1729
  return t.options.ruleSpaces ? n.slice(0, -1) : n;
1738
1730
  }
1739
1731
  const Tt = {
@@ -1755,13 +1747,13 @@ const Tt = {
1755
1747
  paragraph: Wn,
1756
1748
  root: qn,
1757
1749
  strong: vt,
1758
- text: Xn,
1759
- thematicBreak: Zn
1750
+ text: Gn,
1751
+ thematicBreak: Jn
1760
1752
  };
1761
- function Jn() {
1753
+ function Qn() {
1762
1754
  return {
1763
1755
  enter: {
1764
- table: Qn,
1756
+ table: Xn,
1765
1757
  tableData: qe,
1766
1758
  tableHeader: qe,
1767
1759
  tableRow: ea
@@ -1775,7 +1767,7 @@ function Jn() {
1775
1767
  }
1776
1768
  };
1777
1769
  }
1778
- function Qn(e) {
1770
+ function Xn(e) {
1779
1771
  const r = e._align;
1780
1772
  this.enter(
1781
1773
  {
@@ -1943,7 +1935,7 @@ function ua() {
1943
1935
  Fr(),
1944
1936
  nn(),
1945
1937
  un(),
1946
- Jn(),
1938
+ Qn(),
1947
1939
  aa()
1948
1940
  ];
1949
1941
  }
@@ -2002,10 +1994,10 @@ function fa(e, r) {
2002
1994
  const ha = {
2003
1995
  tokenize: xa,
2004
1996
  partial: !0
2005
- }, It = {
1997
+ }, At = {
2006
1998
  tokenize: wa,
2007
1999
  partial: !0
2008
- }, At = {
2000
+ }, It = {
2009
2001
  tokenize: ya,
2010
2002
  partial: !0
2011
2003
  }, Nt = {
@@ -2026,23 +2018,23 @@ const ha = {
2026
2018
  name: "emailAutolink",
2027
2019
  tokenize: ga,
2028
2020
  previous: Pt
2029
- }, R = {};
2021
+ }, P = {};
2030
2022
  function pa() {
2031
2023
  return {
2032
- text: R
2024
+ text: P
2033
2025
  };
2034
2026
  }
2035
2027
  let B = 48;
2036
2028
  for (; B < 123; )
2037
- R[B] = j, B++, B === 58 ? B = 65 : B === 91 && (B = 97);
2038
- R[43] = j;
2039
- R[45] = j;
2040
- R[46] = j;
2041
- R[95] = j;
2042
- R[72] = [j, Lt];
2043
- R[104] = [j, Lt];
2044
- R[87] = [j, St];
2045
- R[119] = [j, St];
2029
+ P[B] = j, B++, B === 58 ? B = 65 : B === 91 && (B = 97);
2030
+ P[43] = j;
2031
+ P[45] = j;
2032
+ P[46] = j;
2033
+ P[95] = j;
2034
+ P[72] = [j, Lt];
2035
+ P[104] = [j, Lt];
2036
+ P[87] = [j, St];
2037
+ P[119] = [j, St];
2046
2038
  function ga(e, r, t) {
2047
2039
  const n = this;
2048
2040
  let i, o;
@@ -2060,14 +2052,14 @@ function ga(e, r, t) {
2060
2052
  return e.consume(c), i = !0, l;
2061
2053
  }
2062
2054
  function f(c) {
2063
- return o && i && ne(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(c)) : t(c);
2055
+ return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(c)) : t(c);
2064
2056
  }
2065
2057
  }
2066
2058
  function ba(e, r, t) {
2067
2059
  const n = this;
2068
2060
  return i;
2069
2061
  function i(a) {
2070
- return a !== 87 && a !== 119 || !Mt.call(n, n.previous) || Pe(n.events) ? t(a) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(ha, e.attempt(It, e.attempt(At, o), t), t)(a));
2062
+ return a !== 87 && a !== 119 || !Mt.call(n, n.previous) || Pe(n.events) ? t(a) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(ha, e.attempt(At, e.attempt(It, o), t), t)(a));
2071
2063
  }
2072
2064
  function o(a) {
2073
2065
  return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(a);
@@ -2081,7 +2073,7 @@ function ka(e, r, t) {
2081
2073
  return (c === 72 || c === 104) && Dt.call(n, n.previous) && !Pe(n.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(c), e.consume(c), u) : t(c);
2082
2074
  }
2083
2075
  function u(c) {
2084
- if (ne(c) && i.length < 5)
2076
+ if (re(c) && i.length < 5)
2085
2077
  return i += String.fromCodePoint(c), e.consume(c), u;
2086
2078
  if (c === 58) {
2087
2079
  const p = i.toLowerCase();
@@ -2094,7 +2086,7 @@ function ka(e, r, t) {
2094
2086
  return c === 47 ? (e.consume(c), o ? s : (o = !0, l)) : t(c);
2095
2087
  }
2096
2088
  function s(c) {
2097
- return c === null || Cr(c) || M(c) || q(c) || fe(c) ? t(c) : e.attempt(It, e.attempt(At, f), t)(c);
2089
+ return c === null || Cr(c) || M(c) || q(c) || fe(c) ? t(c) : e.attempt(At, e.attempt(It, f), t)(c);
2098
2090
  }
2099
2091
  function f(c) {
2100
2092
  return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(c);
@@ -2146,10 +2138,10 @@ function Ca(e, r, t) {
2146
2138
  return u === null || u === 40 || u === 91 || M(u) || q(u) ? r(u) : n(u);
2147
2139
  }
2148
2140
  function o(u) {
2149
- return ne(u) ? a(u) : t(u);
2141
+ return re(u) ? a(u) : t(u);
2150
2142
  }
2151
2143
  function a(u) {
2152
- return u === 59 ? (e.consume(u), n) : ne(u) ? (e.consume(u), a) : t(u);
2144
+ return u === 59 ? (e.consume(u), n) : re(u) ? (e.consume(u), a) : t(u);
2153
2145
  }
2154
2146
  }
2155
2147
  function va(e, r, t) {
@@ -2165,7 +2157,7 @@ function Mt(e) {
2165
2157
  return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || M(e);
2166
2158
  }
2167
2159
  function Dt(e) {
2168
- return !ne(e);
2160
+ return !re(e);
2169
2161
  }
2170
2162
  function Pt(e) {
2171
2163
  return !(e === 47 || Se(e));
@@ -2208,17 +2200,17 @@ function F(e, r, t, n) {
2208
2200
  return _(l) && o++ < i ? (e.consume(l), u) : (e.exit(t), r(l));
2209
2201
  }
2210
2202
  }
2211
- const Ia = {
2203
+ const Aa = {
2212
2204
  partial: !0,
2213
- tokenize: Aa
2205
+ tokenize: Ia
2214
2206
  };
2215
- function Aa(e, r, t) {
2207
+ function Ia(e, r, t) {
2216
2208
  return n;
2217
2209
  function n(o) {
2218
2210
  return _(o) ? F(e, i, "linePrefix")(o) : i(o);
2219
2211
  }
2220
2212
  function i(o) {
2221
- return o === null || G(o) ? r(o) : t(o);
2213
+ return o === null || Z(o) ? r(o) : t(o);
2222
2214
  }
2223
2215
  }
2224
2216
  const Na = {
@@ -2269,7 +2261,7 @@ function La(e, r, t) {
2269
2261
  function u(l) {
2270
2262
  if (!a || !a._balanced)
2271
2263
  return t(l);
2272
- const s = ie(n.sliceSerialize({
2264
+ const s = ae(n.sliceSerialize({
2273
2265
  start: a.end,
2274
2266
  end: n.now()
2275
2267
  }));
@@ -2348,7 +2340,7 @@ function Da(e, r, t) {
2348
2340
  if (c === 93) {
2349
2341
  e.exit("chunkString");
2350
2342
  const p = e.exit("gfmFootnoteCallString");
2351
- return i.includes(ie(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(c);
2343
+ return i.includes(ae(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(c);
2352
2344
  }
2353
2345
  return M(c) || (a = !0), o++, e.consume(c), c === 92 ? f : s;
2354
2346
  }
@@ -2378,7 +2370,7 @@ function Pa(e, r, t) {
2378
2370
  if (d === 93) {
2379
2371
  e.exit("chunkString");
2380
2372
  const k = e.exit("gfmFootnoteDefinitionLabelString");
2381
- return o = ie(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(d), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2373
+ return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(d), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2382
2374
  }
2383
2375
  return M(d) || (u = !0), a++, e.consume(d), d === 92 ? c : f;
2384
2376
  }
@@ -2393,7 +2385,7 @@ function Pa(e, r, t) {
2393
2385
  }
2394
2386
  }
2395
2387
  function Ra(e, r, t) {
2396
- return e.check(Ia, r, e.attempt(Na, r, t));
2388
+ return e.check(Aa, r, e.attempt(Na, r, t));
2397
2389
  }
2398
2390
  function Ea(e) {
2399
2391
  e.exit("gfmFootnoteDefinition");
@@ -2571,15 +2563,15 @@ function Ua(e, r, t) {
2571
2563
  let i = 0, o = 0, a;
2572
2564
  return u;
2573
2565
  function u(m) {
2574
- let P = n.events.length - 1;
2575
- for (; P > -1; ) {
2576
- const J = n.events[P][1].type;
2577
- if (J === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
2578
- J === "linePrefix") P--;
2566
+ let D = n.events.length - 1;
2567
+ for (; D > -1; ) {
2568
+ const Q = n.events[D][1].type;
2569
+ if (Q === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
2570
+ Q === "linePrefix") D--;
2579
2571
  else break;
2580
2572
  }
2581
- const Z = P > -1 ? n.events[P][1].type : null, O = Z === "tableHead" || Z === "tableRow" ? I : l;
2582
- return O === I && n.parser.lazy[n.now().line] ? t(m) : O(m);
2573
+ const J = D > -1 ? n.events[D][1].type : null, O = J === "tableHead" || J === "tableRow" ? A : l;
2574
+ return O === A && n.parser.lazy[n.now().line] ? t(m) : O(m);
2583
2575
  }
2584
2576
  function l(m) {
2585
2577
  return e.enter("tableHead"), e.enter("tableRow"), s(m);
@@ -2588,7 +2580,7 @@ function Ua(e, r, t) {
2588
2580
  return m === 124 || (a = !0, o += 1), f(m);
2589
2581
  }
2590
2582
  function f(m) {
2591
- return m === null ? t(m) : G(m) ? o > 1 ? (o = 0, n.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), g) : t(m) : _(m) ? F(e, f, "whitespace")(m) : (o += 1, a && (a = !1, i += 1), m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), a = !0, f) : (e.enter("data"), c(m)));
2583
+ return m === null ? t(m) : Z(m) ? o > 1 ? (o = 0, n.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(m), e.exit("lineEnding"), g) : t(m) : _(m) ? F(e, f, "whitespace")(m) : (o += 1, a && (a = !1, i += 1), m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), a = !0, f) : (e.enter("data"), c(m)));
2592
2584
  }
2593
2585
  function c(m) {
2594
2586
  return m === null || m === 124 || M(m) ? (e.exit("data"), f(m)) : (e.consume(m), m === 92 ? p : c);
@@ -2606,7 +2598,7 @@ function Ua(e, r, t) {
2606
2598
  return _(m) ? F(e, b, "whitespace")(m) : b(m);
2607
2599
  }
2608
2600
  function b(m) {
2609
- return m === 58 ? (o += 1, a = !0, e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), x) : m === 45 ? (o += 1, x(m)) : m === null || G(m) ? v(m) : C(m);
2601
+ return m === 58 ? (o += 1, a = !0, e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), x) : m === 45 ? (o += 1, x(m)) : m === null || Z(m) ? T(m) : C(m);
2610
2602
  }
2611
2603
  function x(m) {
2612
2604
  return m === 45 ? (e.enter("tableDelimiterFiller"), w(m)) : C(m);
@@ -2615,22 +2607,22 @@ function Ua(e, r, t) {
2615
2607
  return m === 45 ? (e.consume(m), w) : m === 58 ? (a = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), y) : (e.exit("tableDelimiterFiller"), y(m));
2616
2608
  }
2617
2609
  function y(m) {
2618
- return _(m) ? F(e, v, "whitespace")(m) : v(m);
2610
+ return _(m) ? F(e, T, "whitespace")(m) : T(m);
2619
2611
  }
2620
- function v(m) {
2621
- return m === 124 ? d(m) : m === null || G(m) ? !a || i !== o ? C(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : C(m);
2612
+ function T(m) {
2613
+ return m === 124 ? d(m) : m === null || Z(m) ? !a || i !== o ? C(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : C(m);
2622
2614
  }
2623
2615
  function C(m) {
2624
2616
  return t(m);
2625
2617
  }
2626
- function I(m) {
2627
- return e.enter("tableRow"), D(m);
2618
+ function A(m) {
2619
+ return e.enter("tableRow"), R(m);
2628
2620
  }
2629
- function D(m) {
2630
- return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), D) : m === null || G(m) ? (e.exit("tableRow"), r(m)) : _(m) ? F(e, D, "whitespace")(m) : (e.enter("data"), U(m));
2621
+ function R(m) {
2622
+ return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), R) : m === null || Z(m) ? (e.exit("tableRow"), r(m)) : _(m) ? F(e, R, "whitespace")(m) : (e.enter("data"), U(m));
2631
2623
  }
2632
2624
  function U(m) {
2633
- return m === null || m === 124 || M(m) ? (e.exit("data"), D(m)) : (e.consume(m), m === 92 ? $ : U);
2625
+ return m === null || m === 124 || M(m) ? (e.exit("data"), R(m)) : (e.consume(m), m === 92 ? $ : U);
2634
2626
  }
2635
2627
  function $(m) {
2636
2628
  return m === 92 || m === 124 ? (e.consume(m), U) : U(m);
@@ -2641,7 +2633,7 @@ function Ba(e, r) {
2641
2633
  const p = new za();
2642
2634
  for (; ++t < e.length; ) {
2643
2635
  const g = e[t], d = g[1];
2644
- g[0] === "enter" ? d.type === "tableHead" ? (u = !1, l !== 0 && (Xe(p, r, l, s, f), f = void 0, l = 0), s = {
2636
+ g[0] === "enter" ? d.type === "tableHead" ? (u = !1, l !== 0 && (Ge(p, r, l, s, f), f = void 0, l = 0), s = {
2645
2637
  type: "table",
2646
2638
  start: Object.assign({}, d.start),
2647
2639
  // Note: correct end is set later.
@@ -2653,7 +2645,7 @@ function Ba(e, r) {
2653
2645
  end: Object.assign({}, d.end)
2654
2646
  }, p.add(t, 0, [["enter", f, r]])), i = d.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (d.type === "data" || d.type === "tableDelimiterMarker" || d.type === "tableDelimiterFiller") ? (n = !1, a[2] === 0 && (o[1] !== 0 && (a[0] = a[1], c = le(p, r, o, i, void 0, c), o = [0, 0, 0, 0]), a[2] = t)) : d.type === "tableCellDivider" && (n ? n = !1 : (o[1] !== 0 && (a[0] = a[1], c = le(p, r, o, i, void 0, c)), o = a, a = [o[1], t, 0, 0])) : d.type === "tableHead" ? (u = !0, l = t) : d.type === "tableRow" || d.type === "tableDelimiterRow" ? (l = t, o[1] !== 0 ? (a[0] = a[1], c = le(p, r, o, i, t, c)) : a[1] !== 0 && (c = le(p, r, a, i, t, c)), i = 0) : i && (d.type === "data" || d.type === "tableDelimiterMarker" || d.type === "tableDelimiterFiller") && (a[3] = t);
2655
2647
  }
2656
- for (l !== 0 && Xe(p, r, l, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
2648
+ for (l !== 0 && Ge(p, r, l, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
2657
2649
  const g = r.events[t];
2658
2650
  g[0] === "enter" && g[1].type === "table" && (g[1]._align = $a(r.events, t));
2659
2651
  }
@@ -2661,15 +2653,15 @@ function Ba(e, r) {
2661
2653
  }
2662
2654
  function le(e, r, t, n, i, o) {
2663
2655
  const a = n === 1 ? "tableHeader" : n === 2 ? "tableDelimiter" : "tableData", u = "tableContent";
2664
- t[0] !== 0 && (o.end = Object.assign({}, X(r.events, t[0])), e.add(t[0], 0, [["exit", o, r]]));
2665
- const l = X(r.events, t[1]);
2656
+ t[0] !== 0 && (o.end = Object.assign({}, G(r.events, t[0])), e.add(t[0], 0, [["exit", o, r]]));
2657
+ const l = G(r.events, t[1]);
2666
2658
  if (o = {
2667
2659
  type: a,
2668
2660
  start: Object.assign({}, l),
2669
2661
  // Note: correct end is set later.
2670
2662
  end: Object.assign({}, l)
2671
2663
  }, e.add(t[1], 0, [["enter", o, r]]), t[2] !== 0) {
2672
- const s = X(r.events, t[2]), f = X(r.events, t[3]), c = {
2664
+ const s = G(r.events, t[2]), f = G(r.events, t[3]), c = {
2673
2665
  type: u,
2674
2666
  start: Object.assign({}, s),
2675
2667
  end: Object.assign({}, f)
@@ -2683,13 +2675,13 @@ function le(e, r, t, n, i, o) {
2683
2675
  }
2684
2676
  e.add(t[3] + 1, 0, [["exit", c, r]]);
2685
2677
  }
2686
- return i !== void 0 && (o.end = Object.assign({}, X(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
2678
+ return i !== void 0 && (o.end = Object.assign({}, G(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
2687
2679
  }
2688
- function Xe(e, r, t, n, i) {
2689
- const o = [], a = X(r.events, t);
2680
+ function Ge(e, r, t, n, i) {
2681
+ const o = [], a = G(r.events, t);
2690
2682
  i && (i.end = Object.assign({}, a), o.push(["exit", i, r])), n.end = Object.assign({}, a), o.push(["exit", n, r]), e.add(t + 1, 0, o);
2691
2683
  }
2692
- function X(e, r) {
2684
+ function G(e, r) {
2693
2685
  const t = e[r], n = t[0] === "enter" ? "start" : "end";
2694
2686
  return t[1][n];
2695
2687
  }
@@ -2722,7 +2714,7 @@ function qa(e, r, t) {
2722
2714
  return l === 93 ? (e.enter("taskListCheckMarker"), e.consume(l), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), u) : t(l);
2723
2715
  }
2724
2716
  function u(l) {
2725
- return G(l) ? r(l) : _(l) ? e.check({
2717
+ return Z(l) ? r(l) : _(l) ? e.check({
2726
2718
  tokenize: Ka
2727
2719
  }, r, t)(l) : t(l);
2728
2720
  }
@@ -2742,30 +2734,30 @@ function Va(e) {
2742
2734
  Ha()
2743
2735
  ]);
2744
2736
  }
2745
- const Xa = {};
2746
- function Ga(e) {
2737
+ const Ga = {};
2738
+ function Za(e) {
2747
2739
  const r = (
2748
2740
  /** @type {Processor<Root>} */
2749
2741
  this
2750
- ), t = e || Xa, n = r.data(), i = n.micromarkExtensions || (n.micromarkExtensions = []), o = n.fromMarkdownExtensions || (n.fromMarkdownExtensions = []), a = n.toMarkdownExtensions || (n.toMarkdownExtensions = []);
2742
+ ), t = e || Ga, n = r.data(), i = n.micromarkExtensions || (n.micromarkExtensions = []), o = n.fromMarkdownExtensions || (n.fromMarkdownExtensions = []), a = n.toMarkdownExtensions || (n.toMarkdownExtensions = []);
2751
2743
  i.push(Va(t)), o.push(ua()), a.push(ca(t));
2752
2744
  }
2753
- function A(...e) {
2745
+ function I(...e) {
2754
2746
  return e.filter(Boolean).join(" ");
2755
2747
  }
2756
- const Za = ({ content: e }) => /* @__PURE__ */ h(
2748
+ const Ja = ({ content: e }) => /* @__PURE__ */ h(
2757
2749
  Vt,
2758
2750
  {
2759
- remarkPlugins: [Ga],
2751
+ remarkPlugins: [Za],
2760
2752
  className: "cuadra-aui-md",
2761
2753
  components: Ya,
2762
2754
  children: e
2763
2755
  }
2764
- ), Rt = jt(Za), Ja = ({ language: e, code: r }) => {
2765
- const { isCopied: t, copyToClipboard: n } = Qa();
2766
- return /* @__PURE__ */ T("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: [
2756
+ ), Rt = jt(Ja), Qa = ({ language: e, code: r }) => {
2757
+ const { isCopied: t, copyToClipboard: n } = Xa();
2758
+ return /* @__PURE__ */ v("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: [
2767
2759
  /* @__PURE__ */ h("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
2768
- /* @__PURE__ */ T(
2760
+ /* @__PURE__ */ v(
2769
2761
  "button",
2770
2762
  {
2771
2763
  onClick: () => {
@@ -2780,7 +2772,7 @@ const Za = ({ content: e }) => /* @__PURE__ */ h(
2780
2772
  }
2781
2773
  )
2782
2774
  ] });
2783
- }, Qa = ({
2775
+ }, Xa = ({
2784
2776
  copiedDuration: e = 3e3
2785
2777
  } = {}) => {
2786
2778
  const [r, t] = N(!1);
@@ -2793,14 +2785,14 @@ const Za = ({ content: e }) => /* @__PURE__ */ h(
2793
2785
  h1: ({ className: e, ...r }) => /* @__PURE__ */ h(
2794
2786
  "h1",
2795
2787
  {
2796
- className: A("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
2788
+ className: I("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
2797
2789
  ...r
2798
2790
  }
2799
2791
  ),
2800
2792
  h2: ({ className: e, ...r }) => /* @__PURE__ */ h(
2801
2793
  "h2",
2802
2794
  {
2803
- className: A(
2795
+ className: I(
2804
2796
  "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",
2805
2797
  e
2806
2798
  ),
@@ -2810,7 +2802,7 @@ const Za = ({ content: e }) => /* @__PURE__ */ h(
2810
2802
  h3: ({ className: e, ...r }) => /* @__PURE__ */ h(
2811
2803
  "h3",
2812
2804
  {
2813
- className: A(
2805
+ className: I(
2814
2806
  "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",
2815
2807
  e
2816
2808
  ),
@@ -2820,38 +2812,38 @@ const Za = ({ content: e }) => /* @__PURE__ */ h(
2820
2812
  h4: ({ className: e, ...r }) => /* @__PURE__ */ h(
2821
2813
  "h4",
2822
2814
  {
2823
- className: A(
2815
+ className: I(
2824
2816
  "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",
2825
2817
  e
2826
2818
  ),
2827
2819
  ...r
2828
2820
  }
2829
2821
  ),
2830
- h5: ({ className: e, ...r }) => /* @__PURE__ */ h("h5", { className: A("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2831
- h6: ({ className: e, ...r }) => /* @__PURE__ */ h("h6", { className: A("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
2832
- p: ({ className: e, ...r }) => /* @__PURE__ */ h("p", { className: A("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2822
+ h5: ({ className: e, ...r }) => /* @__PURE__ */ h("h5", { className: I("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2823
+ h6: ({ className: e, ...r }) => /* @__PURE__ */ h("h6", { className: I("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
2824
+ p: ({ className: e, ...r }) => /* @__PURE__ */ h("p", { className: I("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2833
2825
  a: ({ className: e, ...r }) => /* @__PURE__ */ h(
2834
2826
  "a",
2835
2827
  {
2836
- className: A("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
2828
+ className: I("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
2837
2829
  ...r
2838
2830
  }
2839
2831
  ),
2840
- blockquote: ({ className: e, ...r }) => /* @__PURE__ */ h("blockquote", { className: A("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
2841
- ul: ({ className: e, ...r }) => /* @__PURE__ */ h("ul", { className: A("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2842
- ol: ({ className: e, ...r }) => /* @__PURE__ */ h("ol", { className: A("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2843
- hr: ({ className: e, ...r }) => /* @__PURE__ */ h("hr", { className: A("cuadra-my-5 cuadra-border-b", e), ...r }),
2832
+ blockquote: ({ className: e, ...r }) => /* @__PURE__ */ h("blockquote", { className: I("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
2833
+ ul: ({ className: e, ...r }) => /* @__PURE__ */ h("ul", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2834
+ ol: ({ className: e, ...r }) => /* @__PURE__ */ h("ol", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2835
+ hr: ({ className: e, ...r }) => /* @__PURE__ */ h("hr", { className: I("cuadra-my-5 cuadra-border-b", e), ...r }),
2844
2836
  table: ({ className: e, ...r }) => /* @__PURE__ */ h(
2845
2837
  "table",
2846
2838
  {
2847
- className: A("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
2839
+ className: I("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
2848
2840
  ...r
2849
2841
  }
2850
2842
  ),
2851
2843
  th: ({ className: e, ...r }) => /* @__PURE__ */ h(
2852
2844
  "th",
2853
2845
  {
2854
- className: A(
2846
+ className: I(
2855
2847
  "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",
2856
2848
  e
2857
2849
  ),
@@ -2861,7 +2853,7 @@ const Za = ({ content: e }) => /* @__PURE__ */ h(
2861
2853
  td: ({ className: e, ...r }) => /* @__PURE__ */ h(
2862
2854
  "td",
2863
2855
  {
2864
- className: A(
2856
+ className: I(
2865
2857
  "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",
2866
2858
  e
2867
2859
  ),
@@ -2871,18 +2863,18 @@ const Za = ({ content: e }) => /* @__PURE__ */ h(
2871
2863
  tr: ({ className: e, ...r }) => /* @__PURE__ */ h(
2872
2864
  "tr",
2873
2865
  {
2874
- className: A(
2866
+ className: I(
2875
2867
  "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",
2876
2868
  e
2877
2869
  ),
2878
2870
  ...r
2879
2871
  }
2880
2872
  ),
2881
- sup: ({ className: e, ...r }) => /* @__PURE__ */ h("sup", { className: A("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2873
+ sup: ({ className: e, ...r }) => /* @__PURE__ */ h("sup", { className: I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2882
2874
  pre: ({ className: e, ...r }) => /* @__PURE__ */ h(
2883
2875
  "pre",
2884
2876
  {
2885
- className: A(
2877
+ className: I(
2886
2878
  "cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",
2887
2879
  e
2888
2880
  ),
@@ -2894,13 +2886,13 @@ const Za = ({ content: e }) => /* @__PURE__ */ h(
2894
2886
  return /* @__PURE__ */ h(
2895
2887
  "code",
2896
2888
  {
2897
- className: A(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
2889
+ className: I(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
2898
2890
  ...t
2899
2891
  }
2900
2892
  );
2901
2893
  },
2902
- CodeHeader: Ja
2903
- }), Ge = [
2894
+ CodeHeader: Qa
2895
+ }), Ze = [
2904
2896
  "Sending question…",
2905
2897
  "Understanding your need…",
2906
2898
  "Scanning data…",
@@ -2915,15 +2907,15 @@ function ei({ active: e }) {
2915
2907
  return;
2916
2908
  }
2917
2909
  const n = window.setInterval(() => {
2918
- t((i) => i >= Ge.length - 1 ? (window.clearInterval(n), i) : i + 1);
2910
+ t((i) => i >= Ze.length - 1 ? (window.clearInterval(n), i) : i + 1);
2919
2911
  }, 2500);
2920
2912
  return () => window.clearInterval(n);
2921
- }, [e]), e ? /* @__PURE__ */ T("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand", children: [
2913
+ }, [e]), e ? /* @__PURE__ */ v("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand", children: [
2922
2914
  "Thinking… ",
2923
- Ge[r]
2915
+ Ze[r]
2924
2916
  ] }) : null;
2925
2917
  }
2926
- function Ze({
2918
+ function Je({
2927
2919
  welcomeTitle: e = "Hi, how can I help you today?",
2928
2920
  welcomeSubtitle: r = "Start exploring our platform and discover what you can build.",
2929
2921
  extraTopPadding: t,
@@ -2944,16 +2936,16 @@ function Ze({
2944
2936
  const p = c.subscribe?.((d) => {
2945
2937
  const k = d?.threadId, b = d?.messages || [], x = d?.isLoadingHistory || !1, w = b.length;
2946
2938
  k && k !== u && l(k), a(x && w === 0);
2947
- const v = b.some(
2948
- (C) => C.role === "assistant" && !!C.content && (Array.isArray(C.content) ? C.content.some((I) => typeof I == "object" && I?.text ? I.text.trim().length > 0 : !1) : typeof C.content == "string" ? C.content.trim().length > 0 : !1)
2939
+ const T = b.some(
2940
+ (C) => C.role === "assistant" && !!C.content && (Array.isArray(C.content) ? C.content.some((A) => typeof A == "object" && A?.text ? A.text.trim().length > 0 : !1) : typeof C.content == "string" ? C.content.trim().length > 0 : !1)
2949
2941
  );
2950
- f(v);
2942
+ f(T);
2951
2943
  }), g = c.getState?.();
2952
2944
  if (g) {
2953
2945
  const d = g?.threadId, k = g?.messages || [], b = g?.isLoadingHistory || !1, x = k.length;
2954
2946
  d && d !== u && l(d), a(b && x === 0);
2955
2947
  const y = k.some(
2956
- (v) => v.role === "assistant" && !!v.content && (Array.isArray(v.content) ? v.content.some((C) => typeof C == "object" && C?.text ? C.text.trim().length > 0 : !1) : typeof v.content == "string" ? v.content.trim().length > 0 : !1)
2948
+ (T) => T.role === "assistant" && !!T.content && (Array.isArray(T.content) ? T.content.some((C) => typeof C == "object" && C?.text ? C.text.trim().length > 0 : !1) : typeof T.content == "string" ? T.content.trim().length > 0 : !1)
2957
2949
  );
2958
2950
  f(y);
2959
2951
  }
@@ -2963,17 +2955,17 @@ function Ze({
2963
2955
  } catch {
2964
2956
  a(!1);
2965
2957
  }
2966
- }, [i, u]), /* @__PURE__ */ T(te.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
2958
+ }, [i, u]), /* @__PURE__ */ v(ee.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
2967
2959
  /* @__PURE__ */ h(
2968
- te.Viewport,
2960
+ ee.Viewport,
2969
2961
  {
2970
2962
  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",
2971
2963
  style: t ? { paddingTop: t } : void 0,
2972
- children: o ? /* @__PURE__ */ h("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: [
2964
+ children: o ? /* @__PURE__ */ h("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: [
2973
2965
  /* @__PURE__ */ h(at, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
2974
2966
  /* @__PURE__ */ h("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
2975
- ] }) }) : /* @__PURE__ */ T(W, { children: [
2976
- /* @__PURE__ */ h(te.Empty, { children: /* @__PURE__ */ h(
2967
+ ] }) }) : /* @__PURE__ */ v(W, { children: [
2968
+ /* @__PURE__ */ h(ee.Empty, { children: /* @__PURE__ */ h(
2977
2969
  ti,
2978
2970
  {
2979
2971
  title: e,
@@ -2982,7 +2974,7 @@ function Ze({
2982
2974
  }
2983
2975
  ) }),
2984
2976
  /* @__PURE__ */ h(
2985
- te.Messages,
2977
+ ee.Messages,
2986
2978
  {
2987
2979
  components: {
2988
2980
  UserMessage: ri,
@@ -2990,11 +2982,11 @@ function Ze({
2990
2982
  }
2991
2983
  }
2992
2984
  ),
2993
- /* @__PURE__ */ h(te.If, { running: !0, children: !s && /* @__PURE__ */ h("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ h(ei, { active: !0 }) }) })
2985
+ /* @__PURE__ */ h(ee.If, { running: !0, children: !s && /* @__PURE__ */ h("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ h(ei, { active: !0 }) }) })
2994
2986
  ] })
2995
2987
  }
2996
2988
  ),
2997
- /* @__PURE__ */ h("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ T(be.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
2989
+ /* @__PURE__ */ h("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ v(be.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
2998
2990
  /* @__PURE__ */ h(
2999
2991
  be.Input,
3000
2992
  {
@@ -3030,8 +3022,8 @@ function ti({ title: e, subtitle: r, suggestions: t }) {
3030
3022
  } catch {
3031
3023
  }
3032
3024
  };
3033
- return /* @__PURE__ */ h("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__ */ T("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: [
3034
- /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3025
+ return /* @__PURE__ */ h("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__ */ v("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: [
3026
+ /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3035
3027
  /* @__PURE__ */ h("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
3036
3028
  /* @__PURE__ */ h("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
3037
3029
  ] }),
@@ -3121,7 +3113,7 @@ function ai({ onThreadSelect: e }) {
3121
3113
  style: { marginBottom: "0.5rem" },
3122
3114
  onMouseEnter: () => i(r.id),
3123
3115
  onMouseLeave: () => i(null),
3124
- children: /* @__PURE__ */ T(
3116
+ children: /* @__PURE__ */ v(
3125
3117
  xe.Trigger,
3126
3118
  {
3127
3119
  className: "cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-justify-between cuadra-w-full cuadra-min-w-0 cuadra-cursor-pointer",
@@ -3140,11 +3132,11 @@ function ai({ onThreadSelect: e }) {
3140
3132
  autoFocus: !0,
3141
3133
  onClick: (b) => b.stopPropagation()
3142
3134
  }
3143
- ) : /* @__PURE__ */ T(W, { children: [
3135
+ ) : /* @__PURE__ */ v(W, { children: [
3144
3136
  /* @__PURE__ */ h("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" }),
3145
3137
  r.updatedAt && /* @__PURE__ */ h("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
3146
3138
  ] }) }),
3147
- /* @__PURE__ */ h("div", { className: "cuadra-ml-2 cuadra-flex-shrink-0 cuadra-w-6 cuadra-h-6 cuadra-flex cuadra-items-center cuadra-justify-center", children: (a || o || c) && /* @__PURE__ */ T("div", { className: "cuadra-relative", children: [
3139
+ /* @__PURE__ */ h("div", { className: "cuadra-ml-2 cuadra-flex-shrink-0 cuadra-w-6 cuadra-h-6 cuadra-flex cuadra-items-center cuadra-justify-center", children: (a || o || c) && /* @__PURE__ */ v("div", { className: "cuadra-relative", children: [
3148
3140
  /* @__PURE__ */ h(
3149
3141
  "button",
3150
3142
  {
@@ -3156,7 +3148,7 @@ function ai({ onThreadSelect: e }) {
3156
3148
  children: /* @__PURE__ */ h(sr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3157
3149
  }
3158
3150
  ),
3159
- c && /* @__PURE__ */ T(W, { children: [
3151
+ c && /* @__PURE__ */ v(W, { children: [
3160
3152
  /* @__PURE__ */ h(
3161
3153
  "div",
3162
3154
  {
@@ -3174,7 +3166,7 @@ function ai({ onThreadSelect: e }) {
3174
3166
  disabled: g,
3175
3167
  children: "Save"
3176
3168
  }
3177
- ) : /* @__PURE__ */ T(W, { children: [
3169
+ ) : /* @__PURE__ */ v(W, { children: [
3178
3170
  /* @__PURE__ */ h(
3179
3171
  "button",
3180
3172
  {
@@ -3205,16 +3197,16 @@ function ai({ onThreadSelect: e }) {
3205
3197
  }
3206
3198
  ) : null;
3207
3199
  }
3208
- function Je({ onThreadSelect: e }) {
3209
- return /* @__PURE__ */ T(ke.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: [
3200
+ function Qe({ onThreadSelect: e }) {
3201
+ return /* @__PURE__ */ v(ke.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: [
3210
3202
  /* @__PURE__ */ h("div", { className: "cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4", children: /* @__PURE__ */ h("h3", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-text-nowrap font-brand", children: "Chat History" }) }),
3211
- /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3203
+ /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3212
3204
  /* @__PURE__ */ h(
3213
3205
  ke.New,
3214
3206
  {
3215
3207
  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",
3216
3208
  onClick: () => e?.(),
3217
- children: /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3209
+ children: /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3218
3210
  /* @__PURE__ */ h(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3219
3211
  /* @__PURE__ */ h("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3220
3212
  ] }) })
@@ -3245,9 +3237,9 @@ const ii = `
3245
3237
  style: o,
3246
3238
  contentStyle: a,
3247
3239
  rotating: u = !1
3248
- }) => /* @__PURE__ */ T(W, { children: [
3240
+ }) => /* @__PURE__ */ v(W, { children: [
3249
3241
  /* @__PURE__ */ h("style", { children: ii }),
3250
- /* @__PURE__ */ T(
3242
+ /* @__PURE__ */ v(
3251
3243
  "div",
3252
3244
  {
3253
3245
  className: `cuadra-relative cuadra-bg-background md:cuadra-rounded-xl cuadra-overflow-hidden ${r}`,
@@ -3325,7 +3317,7 @@ const ii = `
3325
3317
  )
3326
3318
  }
3327
3319
  );
3328
- }, Qe = ({
3320
+ }, Xe = ({
3329
3321
  currentModel: e,
3330
3322
  models: r,
3331
3323
  modelsLoading: t,
@@ -3347,8 +3339,8 @@ const ii = `
3347
3339
  };
3348
3340
  }, [f]);
3349
3341
  const g = r.find((d) => d.id === e);
3350
- return /* @__PURE__ */ T("div", { className: "cuadra-h-16 cuadra-px-4 cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-bg-background", children: [
3351
- /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3342
+ return /* @__PURE__ */ v("div", { className: "cuadra-h-16 cuadra-px-4 cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-bg-background", children: [
3343
+ /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3352
3344
  s && /* @__PURE__ */ h(
3353
3345
  "button",
3354
3346
  {
@@ -3361,10 +3353,10 @@ const ii = `
3361
3353
  ),
3362
3354
  a && /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ h(oi, { theme: u }) })
3363
3355
  ] }),
3364
- /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
3356
+ /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
3365
3357
  !o && /* @__PURE__ */ h("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
3366
- o ? null : t ? /* @__PURE__ */ h("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ h("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : n ? /* @__PURE__ */ h("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__ */ h("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */ T("div", { ref: p, className: "cuadra-relative cuadra-w-48", children: [
3367
- /* @__PURE__ */ T(
3358
+ o ? null : t ? /* @__PURE__ */ h("div", { className: "cuadra-w-48 cuadra-rounded-md cuadra-border cuadra-border-border cuadra-px-3 cuadra-py-2 cuadra-bg-muted", children: /* @__PURE__ */ h("span", { className: "cuadra-text-muted-foreground cuadra-text-sm cuadra-font-brand", children: "Loading..." }) }) : n ? /* @__PURE__ */ h("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__ */ h("span", { className: "cuadra-text-destructive cuadra-text-sm cuadra-font-brand", children: "Failed to load models" }) }) : /* @__PURE__ */ v("div", { ref: p, className: "cuadra-relative cuadra-w-48", children: [
3359
+ /* @__PURE__ */ v(
3368
3360
  "button",
3369
3361
  {
3370
3362
  type: "button",
@@ -3377,7 +3369,7 @@ const ii = `
3377
3369
  ]
3378
3370
  }
3379
3371
  ),
3380
- f && r.length > 0 && /* @__PURE__ */ h("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ h("div", { className: "cuadra-p-1", children: r.map((d) => /* @__PURE__ */ T(
3372
+ f && r.length > 0 && /* @__PURE__ */ h("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ h("div", { className: "cuadra-p-1", children: r.map((d) => /* @__PURE__ */ v(
3381
3373
  "button",
3382
3374
  {
3383
3375
  type: "button",
@@ -3413,7 +3405,7 @@ const ii = `
3413
3405
  ] })
3414
3406
  ] })
3415
3407
  ] });
3416
- }, li = $t(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ h(li.Provider, { value: r, children: e });
3408
+ }, li = $t(void 0), Ae = ({ children: e, value: r }) => /* @__PURE__ */ h(li.Provider, { value: r, children: e });
3417
3409
  function ui() {
3418
3410
  L(() => {
3419
3411
  if (document.querySelector("style[data-cuadra-uikit]"))
@@ -3459,23 +3451,23 @@ const ci = ({ config: e }) => {
3459
3451
  onError: x,
3460
3452
  onChatCreated: w,
3461
3453
  onThreadIdUpdate: y
3462
- } = e, [v, C] = N(!1), I = t || r || "", D = !!t, U = H(
3463
- () => new it(I, n || void 0, D, e.tenantId),
3464
- [I, n, D, e.tenantId]
3465
- ), [$, m] = N(null), [P, Z] = N(!1), [O, J] = N(null), [Et, Re] = N(!1);
3454
+ } = e, [T, C] = N(!1), A = t || r || "", R = !!t, U = H(
3455
+ () => new it(A, n || void 0, R),
3456
+ [A, n, R]
3457
+ ), [$, m] = N(null), [D, J] = N(!1), [O, Q] = N(null), [Et, Re] = N(!1);
3466
3458
  L(() => {
3467
3459
  i === "multiChat" && Re(!0);
3468
3460
  }, [i]);
3469
- const K = re(async () => {
3461
+ const K = te(async () => {
3470
3462
  if (o === "selector") {
3471
- Z(!0), J(null);
3463
+ J(!0), Q(null);
3472
3464
  try {
3473
3465
  const S = await U.listModels();
3474
3466
  m(S);
3475
3467
  } catch (S) {
3476
- J(S instanceof Error ? S : new Error("Failed to load models"));
3468
+ Q(S instanceof Error ? S : new Error("Failed to load models"));
3477
3469
  } finally {
3478
- Z(!1);
3470
+ J(!1);
3479
3471
  }
3480
3472
  }
3481
3473
  }, [U, o]);
@@ -3486,7 +3478,7 @@ const ci = ({ config: e }) => {
3486
3478
  }), [K]);
3487
3479
  const [E, Ee] = N(
3488
3480
  o === "fixed" && a || null
3489
- ), _e = et(E), Q = re(
3481
+ ), _e = et(E), X = te(
3490
3482
  (S) => {
3491
3483
  const Y = _e.current;
3492
3484
  Ee(S), _e.current = S, u?.(S), Y !== null && Y !== S && i === "multiChat" && setTimeout(() => {
@@ -3519,31 +3511,30 @@ const ci = ({ config: e }) => {
3519
3511
  }
3520
3512
  }
3521
3513
  }, [o, $?.items, E, u]);
3522
- const _t = o === "fixed" ? !!a : !!E, oe = H(
3514
+ const _t = o === "fixed" ? !!a : !!E, ie = H(
3523
3515
  () => ($?.items || []).filter((S) => S?.id && S?.displayName).map((S) => ({ id: S.id, name: S.displayName })),
3524
3516
  [$]
3525
3517
  ), ge = H(
3526
3518
  () => ({
3527
3519
  currentModelId: E || "",
3528
- models: oe,
3529
- modelsLoading: P,
3520
+ models: ie,
3521
+ modelsLoading: D,
3530
3522
  modelsError: O,
3531
- onModelChange: Q,
3523
+ onModelChange: X,
3532
3524
  refetchModels: K
3533
3525
  }),
3534
- [E, oe, P, O, Q, K]
3526
+ [E, ie, D, O, X, K]
3535
3527
  );
3536
- return o === "selector" && P || i === "multiChat" && Et ? /* @__PURE__ */ h(Ie, { value: ge, children: /* @__PURE__ */ h(Te, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ h(at, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !_t && O ? /* @__PURE__ */ h(Ie, { value: ge, children: /* @__PURE__ */ h(Te, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ h("p", { className: "cuadra-text-sm cuadra-text-destructive font-brand", children: "Failed to load models" }) }) }) }) }) : /* @__PURE__ */ h("div", { className: "cuadra-uikit cuadra-h-full cuadra-w-full", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ h(Ie, { value: ge, children: /* @__PURE__ */ h(
3528
+ return o === "selector" && D || i === "multiChat" && Et ? /* @__PURE__ */ h(Ae, { value: ge, children: /* @__PURE__ */ h(Te, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ h(at, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !_t && O ? /* @__PURE__ */ h(Ae, { value: ge, children: /* @__PURE__ */ h(Te, { className: "cuadra-h-full", paddingX: "cuadra-px-0", paddingY: "cuadra-py-0", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-center cuadra-h-full", children: /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ h("p", { className: "cuadra-text-sm cuadra-text-destructive font-brand", children: "Failed to load models" }) }) }) }) }) : /* @__PURE__ */ h("div", { className: "cuadra-uikit cuadra-h-full cuadra-w-full", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ h(Ae, { value: ge, children: /* @__PURE__ */ h(
3537
3529
  wr,
3538
3530
  {
3539
- baseUrl: D ? I : r || I,
3531
+ baseUrl: R ? A : r || A,
3540
3532
  sessionToken: n,
3541
- isProxyMode: D,
3542
- tenantId: e.tenantId,
3533
+ isProxyMode: R,
3543
3534
  mode: i,
3544
3535
  modelMode: o,
3545
3536
  modelId: E || a || void 0,
3546
- onModelChange: Q,
3537
+ onModelChange: X,
3547
3538
  ephemeral: l,
3548
3539
  systemPrompt: s,
3549
3540
  initialThreadId: f,
@@ -3561,8 +3552,8 @@ const ci = ({ config: e }) => {
3561
3552
  className: `cuadra-h-full ${e.containerClass || ""}`,
3562
3553
  borderSizePx: 4,
3563
3554
  style: { height: "100%" },
3564
- children: /* @__PURE__ */ h("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ T(W, { children: [
3565
- v && typeof document < "u" && ze(
3555
+ children: /* @__PURE__ */ h("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ v(W, { children: [
3556
+ T && typeof document < "u" && ze(
3566
3557
  /* @__PURE__ */ h(
3567
3558
  "div",
3568
3559
  {
@@ -3572,44 +3563,44 @@ const ci = ({ config: e }) => {
3572
3563
  ),
3573
3564
  document.body
3574
3565
  ),
3575
- typeof document < "u" && /* @__PURE__ */ T(W, { children: [
3566
+ typeof document < "u" && /* @__PURE__ */ v(W, { children: [
3576
3567
  /* @__PURE__ */ h(
3577
3568
  "div",
3578
3569
  {
3579
3570
  className: "cuadra-hidden md:cuadra-block !cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80 cuadra-relative",
3580
3571
  style: { borderRightWidth: "1px", height: "100%" },
3581
- children: /* @__PURE__ */ h(Je, { onThreadSelect: () => C(!1) })
3572
+ children: /* @__PURE__ */ h(Qe, { onThreadSelect: () => C(!1) })
3582
3573
  }
3583
3574
  ),
3584
- v && ze(
3575
+ T && ze(
3585
3576
  /* @__PURE__ */ h(
3586
3577
  "div",
3587
3578
  {
3588
3579
  className: "cuadra-block md:cuadra-hidden !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-screen cuadra-w-80 cuadra-fixed cuadra-z-50 cuadra-top-0 cuadra-left-0 cuadra-translate-x-0",
3589
3580
  style: { borderRightWidth: "1px" },
3590
- children: /* @__PURE__ */ h(Je, { onThreadSelect: () => C(!1) })
3581
+ children: /* @__PURE__ */ h(Qe, { onThreadSelect: () => C(!1) })
3591
3582
  }
3592
3583
  ),
3593
3584
  document.body
3594
3585
  )
3595
3586
  ] }),
3596
- /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3587
+ /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3597
3588
  o === "selector" && /* @__PURE__ */ h(
3598
- Qe,
3589
+ Xe,
3599
3590
  {
3600
3591
  currentModel: E || "",
3601
- models: oe,
3602
- modelsLoading: P,
3592
+ models: ie,
3593
+ modelsLoading: D,
3603
3594
  modelsError: O,
3604
- onModelChange: Q,
3595
+ onModelChange: X,
3605
3596
  showThemeToggle: k,
3606
3597
  theme: b,
3607
- onMobileMenuClick: () => C(!v),
3598
+ onMobileMenuClick: () => C(!T),
3608
3599
  showMobileMenuButton: i === "multiChat"
3609
3600
  }
3610
3601
  ),
3611
3602
  /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ h(
3612
- Ze,
3603
+ Je,
3613
3604
  {
3614
3605
  welcomeTitle: c,
3615
3606
  welcomeSubtitle: p,
@@ -3618,21 +3609,21 @@ const ci = ({ config: e }) => {
3618
3609
  }
3619
3610
  ) })
3620
3611
  ] })
3621
- ] }) : /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3612
+ ] }) : /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3622
3613
  o === "selector" && /* @__PURE__ */ h(
3623
- Qe,
3614
+ Xe,
3624
3615
  {
3625
3616
  currentModel: E || "",
3626
- models: oe,
3627
- modelsLoading: P,
3617
+ models: ie,
3618
+ modelsLoading: D,
3628
3619
  modelsError: O,
3629
- onModelChange: Q,
3620
+ onModelChange: X,
3630
3621
  showThemeToggle: k,
3631
3622
  theme: b
3632
3623
  }
3633
3624
  ),
3634
3625
  /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ h(
3635
- Ze,
3626
+ Je,
3636
3627
  {
3637
3628
  welcomeTitle: c,
3638
3629
  welcomeSubtitle: p,
@@ -3651,7 +3642,6 @@ function bi(e) {
3651
3642
  baseUrl: e.baseUrl,
3652
3643
  proxyUrl: e.proxyUrl,
3653
3644
  sessionToken: e.sessionToken || null,
3654
- tenantId: e.tenantId,
3655
3645
  mode: e.mode || "multiChat",
3656
3646
  modelMode: e.modelMode || "fixed",
3657
3647
  modelId: e.modelId,