@cuadra-ai/uikit 0.1.9 → 0.1.12

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,7 +1,7 @@
1
1
  var jt = Object.defineProperty;
2
2
  var $t = (e, r, t) => r in e ? jt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
3
  var le = (e, r, t) => $t(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { jsx as d, jsxs as v, Fragment as B } from "react/jsx-runtime";
4
+ import { jsx as h, jsxs as v, Fragment as B } from "react/jsx-runtime";
5
5
  import { forwardRef as tt, createElement as Ne, useMemo as W, useState as N, useEffect as M, useCallback as te, memo as Ot, useRef as rt, createContext as Ut } from "react";
6
6
  import { createPortal as $e } from "react-dom";
7
7
  import { useLocalRuntime as nt, AssistantRuntimeProvider as at, unstable_useRemoteThreadListRuntime as Bt, useThreadRuntime as Wt, ThreadPrimitive as ee, ComposerPrimitive as ke, useAssistantApi as Ht, MessagePrimitive as se, ThreadListPrimitive as xe, useThreadListItem as qt, useThread as Kt, ThreadListItemPrimitive as we } from "@assistant-ui/react";
@@ -52,7 +52,7 @@ const er = tt(
52
52
  ...u
53
53
  },
54
54
  [
55
- ...a.map(([s, f]) => Ne(s, f)),
55
+ ...a.map(([c, d]) => Ne(c, d)),
56
56
  ...Array.isArray(o) ? o : [o]
57
57
  ]
58
58
  )
@@ -224,24 +224,24 @@ class lt {
224
224
  body: JSON.stringify(t)
225
225
  });
226
226
  if (!l.ok) {
227
- const f = await l.text();
228
- let c = {};
227
+ const d = await l.text();
228
+ let s = {};
229
229
  try {
230
- c = JSON.parse(f);
230
+ s = JSON.parse(d);
231
231
  } catch {
232
- c = { detail: f };
232
+ s = { detail: d };
233
233
  }
234
234
  throw new Error(
235
- c.detail || c.message || `API error: ${l.status} ${l.statusText}`
235
+ s.detail || s.message || `API error: ${l.status} ${l.statusText}`
236
236
  );
237
237
  }
238
238
  if (l.status === 204)
239
239
  return {};
240
- const s = await l.text();
241
- if (!s)
240
+ const c = await l.text();
241
+ if (!c)
242
242
  return {};
243
243
  try {
244
- return JSON.parse(s);
244
+ return JSON.parse(c);
245
245
  } catch {
246
246
  return {};
247
247
  }
@@ -329,13 +329,13 @@ async function* kr(e, r) {
329
329
  i = u.pop() || "";
330
330
  for (const l of u)
331
331
  if (l.startsWith("data: ")) {
332
- const s = l.slice(6);
333
- if (s.trim() === "[DONE]") {
332
+ const c = l.slice(6);
333
+ if (c.trim() === "[DONE]") {
334
334
  yield { done: !0 };
335
335
  continue;
336
336
  }
337
337
  try {
338
- yield JSON.parse(s);
338
+ yield JSON.parse(c);
339
339
  } catch {
340
340
  }
341
341
  }
@@ -361,43 +361,47 @@ function xr(e) {
361
361
  }
362
362
  function wr(e, r) {
363
363
  const { modelId: t, systemPrompt: n, ephemeral: i, onChatCreated: o, onUserMessage: a } = r;
364
+ let u = null;
364
365
  return {
365
- async *run(u) {
366
- const { messages: l, abortSignal: s } = u;
367
- l.length > 0 && l[l.length - 1].role === "user" && a?.();
368
- const c = {
369
- messages: xr(l),
366
+ async *run(l) {
367
+ const { messages: c, abortSignal: d } = l;
368
+ if (c.length > 0) {
369
+ const g = c[c.length - 1], x = g.role, w = g.id;
370
+ x === "user" && w !== u && (u = w, a?.());
371
+ }
372
+ const p = {
373
+ messages: xr(c),
370
374
  chatId: null,
371
375
  // Thread ID will be set by runtime if needed
372
376
  systemPrompt: n,
373
377
  ephemeral: i,
374
378
  stream: !0
375
379
  };
376
- t && t.trim() !== "" && (c.modelId = t);
377
- const p = await e.createOrContinueChat(c, s);
378
- let g = "", h;
379
- for await (const k of kr(p, s)) {
380
- if (s?.aborted)
380
+ t && t.trim() !== "" && (p.modelId = t);
381
+ const b = await e.createOrContinueChat(p, d);
382
+ let f = "", k;
383
+ for await (const g of kr(b, d)) {
384
+ if (d?.aborted)
381
385
  throw new Error("Request aborted");
382
- const b = k.id;
383
- b && !h && (h = b, o?.(b));
384
- const x = k.delta;
385
- if (x != null && (g += x), k.type === "message" || k.content) {
386
- const y = k.content || "";
387
- g += y;
386
+ const x = g.id;
387
+ x && !k && (k = x, o?.(x));
388
+ const w = g.delta;
389
+ if (w != null && (f += w), g.type === "message" || g.content) {
390
+ const A = g.content || "";
391
+ f += A;
388
392
  }
389
- if (k.message && (g += k.message.content || ""), k.tool_calls, k.finished) {
390
- g && (yield {
391
- content: [{ type: "text", text: g }]
393
+ if (g.message && (f += g.message.content || ""), g.tool_calls, g.finished) {
394
+ f && (yield {
395
+ content: [{ type: "text", text: f }]
392
396
  });
393
397
  break;
394
398
  }
395
- g && (yield {
396
- content: [{ type: "text", text: g }]
399
+ f && (yield {
400
+ content: [{ type: "text", text: f }]
397
401
  });
398
402
  }
399
- g && (yield {
400
- content: [{ type: "text", text: g }]
403
+ f && (yield {
404
+ content: [{ type: "text", text: f }]
401
405
  });
402
406
  }
403
407
  };
@@ -474,47 +478,47 @@ function Cr({
474
478
  onModelChange: a,
475
479
  ephemeral: u = !1,
476
480
  systemPrompt: l,
477
- initialThreadId: s,
478
- onError: f,
479
- onChatCreated: c,
481
+ initialThreadId: c,
482
+ onError: d,
483
+ onChatCreated: s,
480
484
  onUserMessage: p,
481
- onThreadIdUpdate: g,
482
- onChatsLoaded: h
485
+ onThreadIdUpdate: b,
486
+ onChatsLoaded: f
483
487
  }) {
484
488
  const k = W(
485
489
  () => new lt(r, t || void 0, n),
486
490
  [r, t, n]
487
- ), [b, x] = N(o || null);
491
+ ), [g, x] = N(o || null);
488
492
  M(() => {
489
493
  o && x(o);
490
494
  }, [o]);
491
495
  const w = te(
492
496
  (C) => {
493
- c?.(C);
497
+ s?.(C);
494
498
  },
495
- [c]
499
+ [s]
496
500
  ), y = te(
497
501
  (C, L) => {
498
- g?.(C, L);
502
+ b?.(C, L);
499
503
  },
500
- [g]
504
+ [b]
501
505
  ), A = W(() => wr(k, {
502
- modelId: b || void 0,
506
+ modelId: g || void 0,
503
507
  // Pass undefined if not set (backend resolves it)
504
508
  systemPrompt: l,
505
509
  ephemeral: u,
506
510
  onChatCreated: w,
507
511
  onUserMessage: p
508
- }), [k, b, l, u, w, p]), T = nt(A);
509
- return i === "singleChat" ? /* @__PURE__ */ d(at, { runtime: T, children: e }) : /* @__PURE__ */ d(
512
+ }), [k, g, l, u, w, p]), T = nt(A);
513
+ return i === "singleChat" ? /* @__PURE__ */ h(at, { runtime: T, children: e }) : /* @__PURE__ */ h(
510
514
  vr,
511
515
  {
512
516
  client: k,
513
517
  modelAdapter: A,
514
- initialThreadId: s,
515
- onChatsLoaded: h,
518
+ initialThreadId: c,
519
+ onChatsLoaded: f,
516
520
  onThreadIdUpdate: y,
517
- onError: f,
521
+ onError: d,
518
522
  children: e
519
523
  }
520
524
  );
@@ -528,25 +532,25 @@ function vr({
528
532
  onError: o,
529
533
  children: a
530
534
  }) {
531
- const u = W(() => yr(e, (c, p) => {
532
- i?.(c, p);
535
+ const u = W(() => yr(e, (s, p) => {
536
+ i?.(s, p);
533
537
  }), [e, i]), l = W(() => ({
534
538
  ...u,
535
539
  async list() {
536
- const c = await u.list();
537
- return n?.(), c;
540
+ const s = await u.list();
541
+ return n?.(), s;
538
542
  }
539
543
  }), [u, n]);
540
544
  M(() => {
541
545
  window.__cuadraThreadListAdapter = l, window.__cuadraThreadListRuntime = null;
542
546
  }, [l]);
543
- const s = te(() => nt(r), [r]), f = Bt({
547
+ const c = te(() => nt(r), [r]), d = Bt({
544
548
  adapter: l,
545
- runtimeHook: s
549
+ runtimeHook: c
546
550
  });
547
551
  return M(() => {
548
- window.__cuadraThreadListRuntime = f;
549
- }, [f]), /* @__PURE__ */ d(at, { runtime: f, children: a });
552
+ window.__cuadraThreadListRuntime = d;
553
+ }, [d]), /* @__PURE__ */ h(at, { runtime: d, children: a });
550
554
  }
551
555
  function Be(e, r) {
552
556
  const t = String(e);
@@ -680,42 +684,42 @@ function ct(e, r, t, n) {
680
684
  typeof r == "function" && typeof t != "function" ? (n = t, t = r) : i = r;
681
685
  const o = pe(i), a = n ? -1 : 1;
682
686
  u(e, void 0, [])();
683
- function u(l, s, f) {
684
- const c = (
687
+ function u(l, c, d) {
688
+ const s = (
685
689
  /** @type {Record<string, unknown>} */
686
690
  l && typeof l == "object" ? l : {}
687
691
  );
688
- if (typeof c.type == "string") {
689
- const g = (
692
+ if (typeof s.type == "string") {
693
+ const b = (
690
694
  // `hast`
691
- typeof c.tagName == "string" ? c.tagName : (
695
+ typeof s.tagName == "string" ? s.tagName : (
692
696
  // `xast`
693
- typeof c.name == "string" ? c.name : void 0
697
+ typeof s.name == "string" ? s.name : void 0
694
698
  )
695
699
  );
696
700
  Object.defineProperty(p, "name", {
697
- value: "node (" + (l.type + (g ? "<" + g + ">" : "")) + ")"
701
+ value: "node (" + (l.type + (b ? "<" + b + ">" : "")) + ")"
698
702
  });
699
703
  }
700
704
  return p;
701
705
  function p() {
702
- let g = ut, h, k, b;
703
- if ((!r || o(l, s, f[f.length - 1] || void 0)) && (g = Rr(t(l, f)), g[0] === Se))
704
- return g;
706
+ let b = ut, f, k, g;
707
+ if ((!r || o(l, c, d[d.length - 1] || void 0)) && (b = Rr(t(l, d)), b[0] === Se))
708
+ return b;
705
709
  if ("children" in l && l.children) {
706
710
  const x = (
707
711
  /** @type {UnistParent} */
708
712
  l
709
713
  );
710
- if (x.children && g[0] !== Pr)
711
- for (k = (n ? x.children.length : -1) + a, b = f.concat(x); k > -1 && k < x.children.length; ) {
714
+ if (x.children && b[0] !== Pr)
715
+ for (k = (n ? x.children.length : -1) + a, g = d.concat(x); k > -1 && k < x.children.length; ) {
712
716
  const w = x.children[k];
713
- if (h = u(w, k, b)(), h[0] === Se)
714
- return h;
715
- k = typeof h[1] == "number" ? h[1] : k + a;
717
+ if (f = u(w, k, g)(), f[0] === Se)
718
+ return f;
719
+ k = typeof f[1] == "number" ? f[1] : k + a;
716
720
  }
717
721
  }
718
- return g;
722
+ return b;
719
723
  }
720
724
  }
721
725
  }
@@ -727,43 +731,43 @@ function Er(e, r, t) {
727
731
  let a = -1;
728
732
  for (; ++a < o.length; )
729
733
  ct(e, "text", u);
730
- function u(s, f) {
731
- let c = -1, p;
732
- for (; ++c < f.length; ) {
733
- const g = f[c], h = p ? p.children : void 0;
734
+ function u(c, d) {
735
+ let s = -1, p;
736
+ for (; ++s < d.length; ) {
737
+ const b = d[s], f = p ? p.children : void 0;
734
738
  if (i(
735
- g,
736
- h ? h.indexOf(g) : void 0,
739
+ b,
740
+ f ? f.indexOf(b) : void 0,
737
741
  p
738
742
  ))
739
743
  return;
740
- p = g;
744
+ p = b;
741
745
  }
742
746
  if (p)
743
- return l(s, f);
747
+ return l(c, d);
744
748
  }
745
- function l(s, f) {
746
- const c = f[f.length - 1], p = o[a][0], g = o[a][1];
747
- let h = 0;
748
- const b = c.children.indexOf(s);
749
+ function l(c, d) {
750
+ const s = d[d.length - 1], p = o[a][0], b = o[a][1];
751
+ let f = 0;
752
+ const g = s.children.indexOf(c);
749
753
  let x = !1, w = [];
750
754
  p.lastIndex = 0;
751
- let y = p.exec(s.value);
755
+ let y = p.exec(c.value);
752
756
  for (; y; ) {
753
757
  const A = y.index, T = {
754
758
  index: y.index,
755
759
  input: y.input,
756
- stack: [...f, s]
760
+ stack: [...d, c]
757
761
  };
758
- let C = g(...y, T);
759
- if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = A + 1 : (h !== A && w.push({
762
+ let C = b(...y, T);
763
+ if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = A + 1 : (f !== A && w.push({
760
764
  type: "text",
761
- value: s.value.slice(h, A)
762
- }), Array.isArray(C) ? w.push(...C) : C && w.push(C), h = A + y[0].length, x = !0), !p.global)
765
+ value: c.value.slice(f, A)
766
+ }), Array.isArray(C) ? w.push(...C) : C && w.push(C), f = A + y[0].length, x = !0), !p.global)
763
767
  break;
764
- y = p.exec(s.value);
768
+ y = p.exec(c.value);
765
769
  }
766
- return x ? (h < s.value.length && w.push({ type: "text", value: s.value.slice(h) }), c.children.splice(b, 1, ...w)) : w = [s], b + w.length;
770
+ return x ? (f < c.value.length && w.push({ type: "text", value: c.value.slice(f) }), s.children.splice(g, 1, ...w)) : w = [c], g + w.length;
767
771
  }
768
772
  }
769
773
  function _r(e) {
@@ -982,16 +986,16 @@ function ln(e) {
982
986
  function t(n, i, o, a) {
983
987
  const u = o.createTracker(a);
984
988
  let l = u.move("[^");
985
- const s = o.enter("footnoteDefinition"), f = o.enter("label");
989
+ const c = o.enter("footnoteDefinition"), d = o.enter("label");
986
990
  return l += u.move(
987
991
  o.safe(o.associationId(n), { before: l, after: "]" })
988
- ), f(), l += u.move("]:"), n.children && n.children.length > 0 && (u.shift(4), l += u.move(
992
+ ), d(), l += u.move("]:"), n.children && n.children.length > 0 && (u.shift(4), l += u.move(
989
993
  (r ? `
990
994
  ` : " ") + o.indentLines(
991
995
  o.containerFlow(n, u.current()),
992
996
  r ? ft : un
993
997
  )
994
- )), s(), l;
998
+ )), c(), l;
995
999
  }
996
1000
  }
997
1001
  function un(e, r, t) {
@@ -1051,64 +1055,64 @@ function pn(e) {
1051
1055
  }
1052
1056
  function gn(e, r) {
1053
1057
  const t = r || {}, n = (t.align || []).concat(), i = t.stringLength || pn, o = [], a = [], u = [], l = [];
1054
- let s = 0, f = -1;
1055
- for (; ++f < e.length; ) {
1056
- const k = [], b = [];
1058
+ let c = 0, d = -1;
1059
+ for (; ++d < e.length; ) {
1060
+ const k = [], g = [];
1057
1061
  let x = -1;
1058
- for (e[f].length > s && (s = e[f].length); ++x < e[f].length; ) {
1059
- const w = bn(e[f][x]);
1062
+ for (e[d].length > c && (c = e[d].length); ++x < e[d].length; ) {
1063
+ const w = bn(e[d][x]);
1060
1064
  if (t.alignDelimiters !== !1) {
1061
1065
  const y = i(w);
1062
- b[x] = y, (l[x] === void 0 || y > l[x]) && (l[x] = y);
1066
+ g[x] = y, (l[x] === void 0 || y > l[x]) && (l[x] = y);
1063
1067
  }
1064
1068
  k.push(w);
1065
1069
  }
1066
- a[f] = k, u[f] = b;
1070
+ a[d] = k, u[d] = g;
1067
1071
  }
1068
- let c = -1;
1072
+ let s = -1;
1069
1073
  if (typeof n == "object" && "length" in n)
1070
- for (; ++c < s; )
1071
- o[c] = We(n[c]);
1074
+ for (; ++s < c; )
1075
+ o[s] = We(n[s]);
1072
1076
  else {
1073
1077
  const k = We(n);
1074
- for (; ++c < s; )
1075
- o[c] = k;
1076
- }
1077
- c = -1;
1078
- const p = [], g = [];
1079
- for (; ++c < s; ) {
1080
- const k = o[c];
1081
- let b = "", x = "";
1082
- k === 99 ? (b = ":", x = ":") : k === 108 ? b = ":" : k === 114 && (x = ":");
1078
+ for (; ++s < c; )
1079
+ o[s] = k;
1080
+ }
1081
+ s = -1;
1082
+ const p = [], b = [];
1083
+ for (; ++s < c; ) {
1084
+ const k = o[s];
1085
+ let g = "", x = "";
1086
+ k === 99 ? (g = ":", x = ":") : k === 108 ? g = ":" : k === 114 && (x = ":");
1083
1087
  let w = t.alignDelimiters === !1 ? 1 : Math.max(
1084
1088
  1,
1085
- l[c] - b.length - x.length
1089
+ l[s] - g.length - x.length
1086
1090
  );
1087
- const y = b + "-".repeat(w) + x;
1088
- t.alignDelimiters !== !1 && (w = b.length + w + x.length, w > l[c] && (l[c] = w), g[c] = w), p[c] = y;
1089
- }
1090
- a.splice(1, 0, p), u.splice(1, 0, g), f = -1;
1091
- const h = [];
1092
- for (; ++f < a.length; ) {
1093
- const k = a[f], b = u[f];
1094
- c = -1;
1091
+ const y = g + "-".repeat(w) + x;
1092
+ t.alignDelimiters !== !1 && (w = g.length + w + x.length, w > l[s] && (l[s] = w), b[s] = w), p[s] = y;
1093
+ }
1094
+ a.splice(1, 0, p), u.splice(1, 0, b), d = -1;
1095
+ const f = [];
1096
+ for (; ++d < a.length; ) {
1097
+ const k = a[d], g = u[d];
1098
+ s = -1;
1095
1099
  const x = [];
1096
- for (; ++c < s; ) {
1097
- const w = k[c] || "";
1100
+ for (; ++s < c; ) {
1101
+ const w = k[s] || "";
1098
1102
  let y = "", A = "";
1099
1103
  if (t.alignDelimiters !== !1) {
1100
- const T = l[c] - (b[c] || 0), C = o[c];
1104
+ const T = l[s] - (g[s] || 0), C = o[s];
1101
1105
  C === 114 ? y = " ".repeat(T) : C === 99 ? T % 2 ? (y = " ".repeat(T / 2 + 0.5), A = " ".repeat(T / 2 - 0.5)) : (y = " ".repeat(T / 2), A = y) : A = " ".repeat(T);
1102
1106
  }
1103
- t.delimiterStart !== !1 && !c && x.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
1107
+ t.delimiterStart !== !1 && !s && x.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
1104
1108
  // empty: there will be a closing space.
1105
- !(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || c) && x.push(" "), t.alignDelimiters !== !1 && x.push(y), x.push(w), t.alignDelimiters !== !1 && x.push(A), t.padding !== !1 && x.push(" "), (t.delimiterEnd !== !1 || c !== s - 1) && x.push("|");
1109
+ !(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || s) && x.push(" "), t.alignDelimiters !== !1 && x.push(y), x.push(w), t.alignDelimiters !== !1 && x.push(A), t.padding !== !1 && x.push(" "), (t.delimiterEnd !== !1 || s !== c - 1) && x.push("|");
1106
1110
  }
1107
- h.push(
1111
+ f.push(
1108
1112
  t.delimiterEnd === !1 ? x.join("").replace(/ +$/, "") : x.join("")
1109
1113
  );
1110
1114
  }
1111
- return h.join(`
1115
+ return f.join(`
1112
1116
  `);
1113
1117
  }
1114
1118
  function bn(e) {
@@ -1177,37 +1181,37 @@ function vn(e) {
1177
1181
  function Tn(e, r, t, n) {
1178
1182
  const i = vn(t), o = e.value || "", a = i === "`" ? "GraveAccent" : "Tilde";
1179
1183
  if (Cn(e, t)) {
1180
- const c = t.enter("codeIndented"), p = t.indentLines(o, An);
1181
- return c(), p;
1184
+ const s = t.enter("codeIndented"), p = t.indentLines(o, An);
1185
+ return s(), p;
1182
1186
  }
1183
- const u = t.createTracker(n), l = i.repeat(Math.max(yn(o, i) + 1, 3)), s = t.enter("codeFenced");
1184
- let f = u.move(l);
1187
+ const u = t.createTracker(n), l = i.repeat(Math.max(yn(o, i) + 1, 3)), c = t.enter("codeFenced");
1188
+ let d = u.move(l);
1185
1189
  if (e.lang) {
1186
- const c = t.enter(`codeFencedLang${a}`);
1187
- f += u.move(
1190
+ const s = t.enter(`codeFencedLang${a}`);
1191
+ d += u.move(
1188
1192
  t.safe(e.lang, {
1189
- before: f,
1193
+ before: d,
1190
1194
  after: " ",
1191
1195
  encode: ["`"],
1192
1196
  ...u.current()
1193
1197
  })
1194
- ), c();
1198
+ ), s();
1195
1199
  }
1196
1200
  if (e.lang && e.meta) {
1197
- const c = t.enter(`codeFencedMeta${a}`);
1198
- f += u.move(" "), f += u.move(
1201
+ const s = t.enter(`codeFencedMeta${a}`);
1202
+ d += u.move(" "), d += u.move(
1199
1203
  t.safe(e.meta, {
1200
- before: f,
1204
+ before: d,
1201
1205
  after: `
1202
1206
  `,
1203
1207
  encode: ["`"],
1204
1208
  ...u.current()
1205
1209
  })
1206
- ), c();
1210
+ ), s();
1207
1211
  }
1208
- return f += u.move(`
1209
- `), o && (f += u.move(o + `
1210
- `)), f += u.move(l), s(), f;
1212
+ return d += u.move(`
1213
+ `), o && (d += u.move(o + `
1214
+ `)), d += u.move(l), c(), d;
1211
1215
  }
1212
1216
  function An(e, r, t) {
1213
1217
  return (t ? "" : " ") + e;
@@ -1224,31 +1228,31 @@ function In(e, r, t, n) {
1224
1228
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("definition");
1225
1229
  let u = t.enter("label");
1226
1230
  const l = t.createTracker(n);
1227
- let s = l.move("[");
1228
- return s += l.move(
1231
+ let c = l.move("[");
1232
+ return c += l.move(
1229
1233
  t.safe(t.associationId(e), {
1230
- before: s,
1234
+ before: c,
1231
1235
  after: "]",
1232
1236
  ...l.current()
1233
1237
  })
1234
- ), s += l.move("]: "), u(), // If there’s no url, or…
1238
+ ), c += l.move("]: "), u(), // If there’s no url, or…
1235
1239
  !e.url || // If there are control characters or whitespace.
1236
- /[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += l.move("<"), s += l.move(
1237
- t.safe(e.url, { before: s, after: ">", ...l.current() })
1238
- ), s += l.move(">")) : (u = t.enter("destinationRaw"), s += l.move(
1240
+ /[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), c += l.move("<"), c += l.move(
1241
+ t.safe(e.url, { before: c, after: ">", ...l.current() })
1242
+ ), c += l.move(">")) : (u = t.enter("destinationRaw"), c += l.move(
1239
1243
  t.safe(e.url, {
1240
- before: s,
1244
+ before: c,
1241
1245
  after: e.title ? " " : `
1242
1246
  `,
1243
1247
  ...l.current()
1244
1248
  })
1245
- )), u(), e.title && (u = t.enter(`title${o}`), s += l.move(" " + i), s += l.move(
1249
+ )), u(), e.title && (u = t.enter(`title${o}`), c += l.move(" " + i), c += l.move(
1246
1250
  t.safe(e.title, {
1247
- before: s,
1251
+ before: c,
1248
1252
  after: i,
1249
1253
  ...l.current()
1250
1254
  })
1251
- ), s += l.move(i), u()), a(), s;
1255
+ ), c += l.move(i), u()), a(), c;
1252
1256
  }
1253
1257
  function Nn(e) {
1254
1258
  const r = e.options.emphasis || "*";
@@ -1310,19 +1314,19 @@ function mt(e, r, t, n) {
1310
1314
  ...a.current()
1311
1315
  })
1312
1316
  );
1313
- const s = l.charCodeAt(0), f = fe(
1317
+ const c = l.charCodeAt(0), d = fe(
1314
1318
  n.before.charCodeAt(n.before.length - 1),
1315
- s,
1319
+ c,
1316
1320
  i
1317
1321
  );
1318
- f.inside && (l = ne(s) + l.slice(1));
1319
- const c = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), c, i);
1320
- p.inside && (l = l.slice(0, -1) + ne(c));
1321
- const g = a.move(i);
1322
+ d.inside && (l = ne(c) + l.slice(1));
1323
+ const s = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), s, i);
1324
+ p.inside && (l = l.slice(0, -1) + ne(s));
1325
+ const b = a.move(i);
1322
1326
  return o(), t.attentionEncodeSurroundingInfo = {
1323
1327
  after: p.outside,
1324
- before: f.outside
1325
- }, u + l + g;
1328
+ before: d.outside
1329
+ }, u + l + b;
1326
1330
  }
1327
1331
  function Sn(e, r, t) {
1328
1332
  return t.options.emphasis || "*";
@@ -1330,9 +1334,9 @@ function Sn(e, r, t) {
1330
1334
  function Ln(e, r, t, n) {
1331
1335
  let i, o, a;
1332
1336
  typeof r == "function" && typeof t != "function" ? (o = void 0, a = r, i = t) : (o = r, a = t, i = n), ct(e, o, u, i);
1333
- function u(l, s) {
1334
- const f = s[s.length - 1], c = f ? f.children.indexOf(l) : void 0;
1335
- return a(l, c, f);
1337
+ function u(l, c) {
1338
+ const d = c[c.length - 1], s = d ? d.children.indexOf(l) : void 0;
1339
+ return a(l, s, d);
1336
1340
  }
1337
1341
  }
1338
1342
  const Mn = {};
@@ -1371,14 +1375,14 @@ function Pn(e, r) {
1371
1375
  function Rn(e, r, t, n) {
1372
1376
  const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(n);
1373
1377
  if (Pn(e, t)) {
1374
- const f = t.enter("headingSetext"), c = t.enter("phrasing"), p = t.containerPhrasing(e, {
1378
+ const d = t.enter("headingSetext"), s = t.enter("phrasing"), p = t.containerPhrasing(e, {
1375
1379
  ...o.current(),
1376
1380
  before: `
1377
1381
  `,
1378
1382
  after: `
1379
1383
  `
1380
1384
  });
1381
- return c(), f(), p + `
1385
+ return s(), d(), p + `
1382
1386
  ` + (i === 1 ? "=" : "-").repeat(
1383
1387
  // The whole size…
1384
1388
  p.length - // Minus the position of the character after the last EOL (or
@@ -1389,13 +1393,13 @@ function Rn(e, r, t, n) {
1389
1393
  }
1390
1394
  const a = "#".repeat(i), u = t.enter("headingAtx"), l = t.enter("phrasing");
1391
1395
  o.move(a + " ");
1392
- let s = t.containerPhrasing(e, {
1396
+ let c = t.containerPhrasing(e, {
1393
1397
  before: "# ",
1394
1398
  after: `
1395
1399
  `,
1396
1400
  ...o.current()
1397
1401
  });
1398
- 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;
1402
+ return /^[\t ]/.test(c) && (c = ne(c.charCodeAt(0)) + c.slice(1)), c = c ? a + " " + c : a, t.options.closeAtx && (c += " " + a), l(), u(), c;
1399
1403
  }
1400
1404
  bt.peek = En;
1401
1405
  function bt(e) {
@@ -1409,26 +1413,26 @@ function kt(e, r, t, n) {
1409
1413
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("image");
1410
1414
  let u = t.enter("label");
1411
1415
  const l = t.createTracker(n);
1412
- let s = l.move("![");
1413
- return s += l.move(
1414
- t.safe(e.alt, { before: s, after: "]", ...l.current() })
1415
- ), s += l.move("]("), u(), // If there’s no url but there is a title…
1416
+ let c = l.move("![");
1417
+ return c += l.move(
1418
+ t.safe(e.alt, { before: c, after: "]", ...l.current() })
1419
+ ), c += l.move("]("), u(), // If there’s no url but there is a title…
1416
1420
  !e.url && e.title || // If there are control characters or whitespace.
1417
- /[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += l.move("<"), s += l.move(
1418
- t.safe(e.url, { before: s, after: ">", ...l.current() })
1419
- ), s += l.move(">")) : (u = t.enter("destinationRaw"), s += l.move(
1421
+ /[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), c += l.move("<"), c += l.move(
1422
+ t.safe(e.url, { before: c, after: ">", ...l.current() })
1423
+ ), c += l.move(">")) : (u = t.enter("destinationRaw"), c += l.move(
1420
1424
  t.safe(e.url, {
1421
- before: s,
1425
+ before: c,
1422
1426
  after: e.title ? " " : ")",
1423
1427
  ...l.current()
1424
1428
  })
1425
- )), u(), e.title && (u = t.enter(`title${o}`), s += l.move(" " + i), s += l.move(
1429
+ )), u(), e.title && (u = t.enter(`title${o}`), c += l.move(" " + i), c += l.move(
1426
1430
  t.safe(e.title, {
1427
- before: s,
1431
+ before: c,
1428
1432
  after: i,
1429
1433
  ...l.current()
1430
1434
  })
1431
- ), s += l.move(i), u()), s += l.move(")"), a(), s;
1435
+ ), c += l.move(i), u()), c += l.move(")"), a(), c;
1432
1436
  }
1433
1437
  function _n() {
1434
1438
  return "!";
@@ -1439,20 +1443,20 @@ function xt(e, r, t, n) {
1439
1443
  let a = t.enter("label");
1440
1444
  const u = t.createTracker(n);
1441
1445
  let l = u.move("![");
1442
- const s = t.safe(e.alt, {
1446
+ const c = t.safe(e.alt, {
1443
1447
  before: l,
1444
1448
  after: "]",
1445
1449
  ...u.current()
1446
1450
  });
1447
- l += u.move(s + "]["), a();
1448
- const f = t.stack;
1451
+ l += u.move(c + "]["), a();
1452
+ const d = t.stack;
1449
1453
  t.stack = [], a = t.enter("reference");
1450
- const c = t.safe(t.associationId(e), {
1454
+ const s = t.safe(t.associationId(e), {
1451
1455
  before: l,
1452
1456
  after: "]",
1453
1457
  ...u.current()
1454
1458
  });
1455
- return a(), t.stack = f, o(), i === "full" || !s || s !== c ? l += u.move(c + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1459
+ return a(), t.stack = d, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1456
1460
  }
1457
1461
  function Fn() {
1458
1462
  return "!";
@@ -1467,8 +1471,8 @@ function wt(e, r, t) {
1467
1471
  let l;
1468
1472
  if (a.atBreak)
1469
1473
  for (; l = u.exec(n); ) {
1470
- let s = l.index;
1471
- n.charCodeAt(s) === 10 && n.charCodeAt(s - 1) === 13 && s--, n = n.slice(0, s) + " " + n.slice(l.index + 1);
1474
+ let c = l.index;
1475
+ n.charCodeAt(c) === 10 && n.charCodeAt(c - 1) === 13 && c--, n = n.slice(0, c) + " " + n.slice(l.index + 1);
1472
1476
  }
1473
1477
  }
1474
1478
  return i + n + i;
@@ -1492,42 +1496,42 @@ function Ct(e, r, t, n) {
1492
1496
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.createTracker(n);
1493
1497
  let u, l;
1494
1498
  if (yt(e, t)) {
1495
- const f = t.stack;
1499
+ const d = t.stack;
1496
1500
  t.stack = [], u = t.enter("autolink");
1497
- let c = a.move("<");
1498
- return c += a.move(
1501
+ let s = a.move("<");
1502
+ return s += a.move(
1499
1503
  t.containerPhrasing(e, {
1500
- before: c,
1504
+ before: s,
1501
1505
  after: ">",
1502
1506
  ...a.current()
1503
1507
  })
1504
- ), c += a.move(">"), u(), t.stack = f, c;
1508
+ ), s += a.move(">"), u(), t.stack = d, s;
1505
1509
  }
1506
1510
  u = t.enter("link"), l = t.enter("label");
1507
- let s = a.move("[");
1508
- return s += a.move(
1511
+ let c = a.move("[");
1512
+ return c += a.move(
1509
1513
  t.containerPhrasing(e, {
1510
- before: s,
1514
+ before: c,
1511
1515
  after: "](",
1512
1516
  ...a.current()
1513
1517
  })
1514
- ), s += a.move("]("), l(), // If there’s no url but there is a title…
1518
+ ), c += a.move("]("), l(), // If there’s no url but there is a title…
1515
1519
  !e.url && e.title || // If there are control characters or whitespace.
1516
- /[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"), s += a.move("<"), s += a.move(
1517
- t.safe(e.url, { before: s, after: ">", ...a.current() })
1518
- ), s += a.move(">")) : (l = t.enter("destinationRaw"), s += a.move(
1520
+ /[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"), c += a.move("<"), c += a.move(
1521
+ t.safe(e.url, { before: c, after: ">", ...a.current() })
1522
+ ), c += a.move(">")) : (l = t.enter("destinationRaw"), c += a.move(
1519
1523
  t.safe(e.url, {
1520
- before: s,
1524
+ before: c,
1521
1525
  after: e.title ? " " : ")",
1522
1526
  ...a.current()
1523
1527
  })
1524
- )), l(), e.title && (l = t.enter(`title${o}`), s += a.move(" " + i), s += a.move(
1528
+ )), l(), e.title && (l = t.enter(`title${o}`), c += a.move(" " + i), c += a.move(
1525
1529
  t.safe(e.title, {
1526
- before: s,
1530
+ before: c,
1527
1531
  after: i,
1528
1532
  ...a.current()
1529
1533
  })
1530
- ), s += a.move(i), l()), s += a.move(")"), u(), s;
1534
+ ), c += a.move(i), l()), c += a.move(")"), u(), c;
1531
1535
  }
1532
1536
  function jn(e, r, t) {
1533
1537
  return yt(e, t) ? "<" : "[";
@@ -1538,20 +1542,20 @@ function vt(e, r, t, n) {
1538
1542
  let a = t.enter("label");
1539
1543
  const u = t.createTracker(n);
1540
1544
  let l = u.move("[");
1541
- const s = t.containerPhrasing(e, {
1545
+ const c = t.containerPhrasing(e, {
1542
1546
  before: l,
1543
1547
  after: "]",
1544
1548
  ...u.current()
1545
1549
  });
1546
- l += u.move(s + "]["), a();
1547
- const f = t.stack;
1550
+ l += u.move(c + "]["), a();
1551
+ const d = t.stack;
1548
1552
  t.stack = [], a = t.enter("reference");
1549
- const c = t.safe(t.associationId(e), {
1553
+ const s = t.safe(t.associationId(e), {
1550
1554
  before: l,
1551
1555
  after: "]",
1552
1556
  ...u.current()
1553
1557
  });
1554
- return a(), t.stack = f, o(), i === "full" || !s || s !== c ? l += u.move(c + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1558
+ return a(), t.stack = d, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1555
1559
  }
1556
1560
  function $n() {
1557
1561
  return "[";
@@ -1600,17 +1604,17 @@ function Bn(e, r, t, n) {
1600
1604
  const u = e.ordered ? a === "." ? ")" : "." : On(t);
1601
1605
  let l = r && t.bulletLastUsed ? a === t.bulletLastUsed : !1;
1602
1606
  if (!e.ordered) {
1603
- const f = e.children ? e.children[0] : void 0;
1607
+ const d = e.children ? e.children[0] : void 0;
1604
1608
  if (
1605
1609
  // Bullet could be used as a thematic break marker:
1606
1610
  (a === "*" || a === "-") && // Empty first list item:
1607
- f && (!f.children || !f.children[0]) && // Directly in two other list items:
1611
+ d && (!d.children || !d.children[0]) && // Directly in two other list items:
1608
1612
  t.stack[t.stack.length - 1] === "list" && t.stack[t.stack.length - 2] === "listItem" && t.stack[t.stack.length - 3] === "list" && t.stack[t.stack.length - 4] === "listItem" && // That are each the first child.
1609
- t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Tt(t) === a && f
1613
+ t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Tt(t) === a && d
1610
1614
  ) {
1611
- let c = -1;
1612
- for (; ++c < e.children.length; ) {
1613
- const p = e.children[c];
1615
+ let s = -1;
1616
+ for (; ++s < e.children.length; ) {
1617
+ const p = e.children[s];
1614
1618
  if (p && p.type === "listItem" && p.children && p.children[0] && p.children[0].type === "thematicBreak") {
1615
1619
  l = !0;
1616
1620
  break;
@@ -1619,8 +1623,8 @@ function Bn(e, r, t, n) {
1619
1623
  }
1620
1624
  }
1621
1625
  l && (a = u), t.bulletCurrent = a;
1622
- const s = t.containerFlow(e, n);
1623
- return t.bulletLastUsed = a, t.bulletCurrent = o, i(), s;
1626
+ const c = t.containerFlow(e, n);
1627
+ return t.bulletLastUsed = a, t.bulletCurrent = o, i(), c;
1624
1628
  }
1625
1629
  function Wn(e) {
1626
1630
  const r = e.options.listItemIndent || "one";
@@ -1638,13 +1642,13 @@ function Hn(e, r, t, n) {
1638
1642
  (i === "tab" || i === "mixed" && (r && r.type === "list" && r.spread || e.spread)) && (a = Math.ceil(a / 4) * 4);
1639
1643
  const u = t.createTracker(n);
1640
1644
  u.move(o + " ".repeat(a - o.length)), u.shift(a);
1641
- const l = t.enter("listItem"), s = t.indentLines(
1645
+ const l = t.enter("listItem"), c = t.indentLines(
1642
1646
  t.containerFlow(e, u.current()),
1643
- f
1647
+ d
1644
1648
  );
1645
- return l(), s;
1646
- function f(c, p, g) {
1647
- return p ? (g ? "" : " ".repeat(a)) + c : (g ? o : o + " ".repeat(a - o.length)) + c;
1649
+ return l(), c;
1650
+ function d(s, p, b) {
1651
+ return p ? (b ? "" : " ".repeat(a)) + s : (b ? o : o + " ".repeat(a - o.length)) + s;
1648
1652
  }
1649
1653
  }
1650
1654
  function qn(e, r, t, n) {
@@ -1700,19 +1704,19 @@ function At(e, r, t, n) {
1700
1704
  ...a.current()
1701
1705
  })
1702
1706
  );
1703
- const s = l.charCodeAt(0), f = fe(
1707
+ const c = l.charCodeAt(0), d = fe(
1704
1708
  n.before.charCodeAt(n.before.length - 1),
1705
- s,
1709
+ c,
1706
1710
  i
1707
1711
  );
1708
- f.inside && (l = ne(s) + l.slice(1));
1709
- const c = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), c, i);
1710
- p.inside && (l = l.slice(0, -1) + ne(c));
1711
- const g = a.move(i + i);
1712
+ d.inside && (l = ne(c) + l.slice(1));
1713
+ const s = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), s, i);
1714
+ p.inside && (l = l.slice(0, -1) + ne(s));
1715
+ const b = a.move(i + i);
1712
1716
  return o(), t.attentionEncodeSurroundingInfo = {
1713
1717
  after: p.outside,
1714
- before: f.outside
1715
- }, u + l + g;
1718
+ before: d.outside
1719
+ }, u + l + b;
1716
1720
  }
1717
1721
  function Zn(e, r, t) {
1718
1722
  return t.options.strong || "*";
@@ -1834,25 +1838,25 @@ function ia(e) {
1834
1838
  tableRow: u
1835
1839
  }
1836
1840
  };
1837
- function a(g, h, k, b) {
1838
- return s(f(g, k, b), g.align);
1841
+ function a(b, f, k, g) {
1842
+ return c(d(b, k, g), b.align);
1839
1843
  }
1840
- function u(g, h, k, b) {
1841
- const x = c(g, k, b), w = s([x]);
1844
+ function u(b, f, k, g) {
1845
+ const x = s(b, k, g), w = c([x]);
1842
1846
  return w.slice(0, w.indexOf(`
1843
1847
  `));
1844
1848
  }
1845
- function l(g, h, k, b) {
1846
- const x = k.enter("tableCell"), w = k.enter("phrasing"), y = k.containerPhrasing(g, {
1847
- ...b,
1849
+ function l(b, f, k, g) {
1850
+ const x = k.enter("tableCell"), w = k.enter("phrasing"), y = k.containerPhrasing(b, {
1851
+ ...g,
1848
1852
  before: o,
1849
1853
  after: o
1850
1854
  });
1851
1855
  return w(), x(), y;
1852
1856
  }
1853
- function s(g, h) {
1854
- return gn(g, {
1855
- align: h,
1857
+ function c(b, f) {
1858
+ return gn(b, {
1859
+ align: f,
1856
1860
  // @ts-expect-error: `markdown-table` types should support `null`.
1857
1861
  alignDelimiters: n,
1858
1862
  // @ts-expect-error: `markdown-table` types should support `null`.
@@ -1861,25 +1865,25 @@ function ia(e) {
1861
1865
  stringLength: i
1862
1866
  });
1863
1867
  }
1864
- function f(g, h, k) {
1865
- const b = g.children;
1868
+ function d(b, f, k) {
1869
+ const g = b.children;
1866
1870
  let x = -1;
1867
- const w = [], y = h.enter("table");
1868
- for (; ++x < b.length; )
1869
- w[x] = c(b[x], h, k);
1871
+ const w = [], y = f.enter("table");
1872
+ for (; ++x < g.length; )
1873
+ w[x] = s(g[x], f, k);
1870
1874
  return y(), w;
1871
1875
  }
1872
- function c(g, h, k) {
1873
- const b = g.children;
1876
+ function s(b, f, k) {
1877
+ const g = b.children;
1874
1878
  let x = -1;
1875
- const w = [], y = h.enter("tableRow");
1876
- for (; ++x < b.length; )
1877
- w[x] = l(b[x], g, h, k);
1879
+ const w = [], y = f.enter("tableRow");
1880
+ for (; ++x < g.length; )
1881
+ w[x] = l(g[x], b, f, k);
1878
1882
  return y(), w;
1879
1883
  }
1880
- function p(g, h, k) {
1881
- let b = It.inlineCode(g, h, k);
1882
- return k.stack.includes("tableCell") && (b = b.replace(/\|/g, "\\$&")), b;
1884
+ function p(b, f, k) {
1885
+ let g = It.inlineCode(b, f, k);
1886
+ return k.stack.includes("tableCell") && (g = g.replace(/\|/g, "\\$&")), g;
1883
1887
  }
1884
1888
  }
1885
1889
  function oa() {
@@ -1929,9 +1933,9 @@ function ca(e, r, t, n) {
1929
1933
  ...n,
1930
1934
  ...u.current()
1931
1935
  });
1932
- return o && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, s)), l;
1933
- function s(f) {
1934
- return f + a;
1936
+ return o && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, c)), l;
1937
+ function c(d) {
1938
+ return d + a;
1935
1939
  }
1936
1940
  }
1937
1941
  function sa() {
@@ -2043,20 +2047,20 @@ function ka(e, r, t) {
2043
2047
  const n = this;
2044
2048
  let i, o;
2045
2049
  return a;
2046
- function a(c) {
2047
- return !Le(c) || !Et.call(n, n.previous) || Re(n.events) ? t(c) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(c));
2050
+ function a(s) {
2051
+ return !Le(s) || !Et.call(n, n.previous) || Re(n.events) ? t(s) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(s));
2048
2052
  }
2049
- function u(c) {
2050
- return Le(c) ? (e.consume(c), u) : c === 64 ? (e.consume(c), l) : t(c);
2053
+ function u(s) {
2054
+ return Le(s) ? (e.consume(s), u) : s === 64 ? (e.consume(s), l) : t(s);
2051
2055
  }
2052
- function l(c) {
2053
- return c === 46 ? e.check(ga, f, s)(c) : c === 45 || c === 95 || Me(c) ? (o = !0, e.consume(c), l) : f(c);
2056
+ function l(s) {
2057
+ return s === 46 ? e.check(ga, d, c)(s) : s === 45 || s === 95 || Me(s) ? (o = !0, e.consume(s), l) : d(s);
2054
2058
  }
2055
- function s(c) {
2056
- return e.consume(c), i = !0, l;
2059
+ function c(s) {
2060
+ return e.consume(s), i = !0, l;
2057
2061
  }
2058
- function f(c) {
2059
- return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(c)) : t(c);
2062
+ function d(s) {
2063
+ return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(s)) : t(s);
2060
2064
  }
2061
2065
  }
2062
2066
  function xa(e, r, t) {
@@ -2073,27 +2077,27 @@ function wa(e, r, t) {
2073
2077
  const n = this;
2074
2078
  let i = "", o = !1;
2075
2079
  return a;
2076
- function a(c) {
2077
- return (c === 72 || c === 104) && Rt.call(n, n.previous) && !Re(n.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(c), e.consume(c), u) : t(c);
2080
+ function a(s) {
2081
+ return (s === 72 || s === 104) && Rt.call(n, n.previous) && !Re(n.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(s), e.consume(s), u) : t(s);
2078
2082
  }
2079
- function u(c) {
2080
- if (re(c) && i.length < 5)
2081
- return i += String.fromCodePoint(c), e.consume(c), u;
2082
- if (c === 58) {
2083
+ function u(s) {
2084
+ if (re(s) && i.length < 5)
2085
+ return i += String.fromCodePoint(s), e.consume(s), u;
2086
+ if (s === 58) {
2083
2087
  const p = i.toLowerCase();
2084
2088
  if (p === "http" || p === "https")
2085
- return e.consume(c), l;
2089
+ return e.consume(s), l;
2086
2090
  }
2087
- return t(c);
2091
+ return t(s);
2088
2092
  }
2089
- function l(c) {
2090
- return c === 47 ? (e.consume(c), o ? s : (o = !0, l)) : t(c);
2093
+ function l(s) {
2094
+ return s === 47 ? (e.consume(s), o ? c : (o = !0, l)) : t(s);
2091
2095
  }
2092
- function s(c) {
2093
- return c === null || Tr(c) || D(c) || H(c) || he(c) ? t(c) : e.attempt(Nt, e.attempt(St, f), t)(c);
2096
+ function c(s) {
2097
+ return s === null || Tr(s) || D(s) || H(s) || he(s) ? t(s) : e.attempt(Nt, e.attempt(St, d), t)(s);
2094
2098
  }
2095
- function f(c) {
2096
- return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(c);
2099
+ function d(s) {
2100
+ return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(s);
2097
2101
  }
2098
2102
  }
2099
2103
  function ya(e, r, t) {
@@ -2109,14 +2113,14 @@ function ya(e, r, t) {
2109
2113
  function Ca(e, r, t) {
2110
2114
  let n, i, o;
2111
2115
  return a;
2112
- function a(s) {
2113
- return s === 46 || s === 95 ? e.check(Lt, l, u)(s) : s === null || D(s) || H(s) || s !== 45 && he(s) ? l(s) : (o = !0, e.consume(s), a);
2116
+ function a(c) {
2117
+ return c === 46 || c === 95 ? e.check(Lt, l, u)(c) : c === null || D(c) || H(c) || c !== 45 && he(c) ? l(c) : (o = !0, e.consume(c), a);
2114
2118
  }
2115
- function u(s) {
2116
- return s === 95 ? n = !0 : (i = n, n = void 0), e.consume(s), a;
2119
+ function u(c) {
2120
+ return c === 95 ? n = !0 : (i = n, n = void 0), e.consume(c), a;
2117
2121
  }
2118
- function l(s) {
2119
- return i || n || !o ? t(s) : r(s);
2122
+ function l(c) {
2123
+ return i || n || !o ? t(c) : r(c);
2120
2124
  }
2121
2125
  }
2122
2126
  function va(e, r) {
@@ -2265,11 +2269,11 @@ function Da(e, r, t) {
2265
2269
  function u(l) {
2266
2270
  if (!a || !a._balanced)
2267
2271
  return t(l);
2268
- const s = ae(n.sliceSerialize({
2272
+ const c = ae(n.sliceSerialize({
2269
2273
  start: a.end,
2270
2274
  end: n.now()
2271
2275
  }));
2272
- return s.codePointAt(0) !== 94 || !o.includes(s.slice(1)) ? t(l) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), r(l));
2276
+ return c.codePointAt(0) !== 94 || !o.includes(c.slice(1)) ? t(l) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), r(l));
2273
2277
  }
2274
2278
  }
2275
2279
  function Pa(e, r) {
@@ -2326,66 +2330,66 @@ function Ra(e, r, t) {
2326
2330
  const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
2327
2331
  let o = 0, a;
2328
2332
  return u;
2329
- function u(c) {
2330
- return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), l;
2333
+ function u(s) {
2334
+ return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(s), e.exit("gfmFootnoteCallLabelMarker"), l;
2331
2335
  }
2332
- function l(c) {
2333
- return c !== 94 ? t(c) : (e.enter("gfmFootnoteCallMarker"), e.consume(c), e.exit("gfmFootnoteCallMarker"), e.enter("gfmFootnoteCallString"), e.enter("chunkString").contentType = "string", s);
2336
+ function l(s) {
2337
+ return s !== 94 ? t(s) : (e.enter("gfmFootnoteCallMarker"), e.consume(s), e.exit("gfmFootnoteCallMarker"), e.enter("gfmFootnoteCallString"), e.enter("chunkString").contentType = "string", c);
2334
2338
  }
2335
- function s(c) {
2339
+ function c(s) {
2336
2340
  if (
2337
2341
  // Too long.
2338
2342
  o > 999 || // Closing brace with nothing.
2339
- c === 93 && !a || // Space or tab is not supported by GFM for some reason.
2343
+ s === 93 && !a || // Space or tab is not supported by GFM for some reason.
2340
2344
  // `\n` and `[` not being supported makes sense.
2341
- c === null || c === 91 || D(c)
2345
+ s === null || s === 91 || D(s)
2342
2346
  )
2343
- return t(c);
2344
- if (c === 93) {
2347
+ return t(s);
2348
+ if (s === 93) {
2345
2349
  e.exit("chunkString");
2346
2350
  const p = e.exit("gfmFootnoteCallString");
2347
- return i.includes(ae(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(c);
2351
+ return i.includes(ae(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(s), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(s);
2348
2352
  }
2349
- return D(c) || (a = !0), o++, e.consume(c), c === 92 ? f : s;
2353
+ return D(s) || (a = !0), o++, e.consume(s), s === 92 ? d : c;
2350
2354
  }
2351
- function f(c) {
2352
- return c === 91 || c === 92 || c === 93 ? (e.consume(c), o++, s) : s(c);
2355
+ function d(s) {
2356
+ return s === 91 || s === 92 || s === 93 ? (e.consume(s), o++, c) : c(s);
2353
2357
  }
2354
2358
  }
2355
2359
  function Ea(e, r, t) {
2356
2360
  const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
2357
2361
  let o, a = 0, u;
2358
2362
  return l;
2359
- function l(h) {
2360
- return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), s;
2363
+ function l(f) {
2364
+ return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(f), e.exit("gfmFootnoteDefinitionLabelMarker"), c;
2361
2365
  }
2362
- function s(h) {
2363
- return h === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", f) : t(h);
2366
+ function c(f) {
2367
+ return f === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(f), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", d) : t(f);
2364
2368
  }
2365
- function f(h) {
2369
+ function d(f) {
2366
2370
  if (
2367
2371
  // Too long.
2368
2372
  a > 999 || // Closing brace with nothing.
2369
- h === 93 && !u || // Space or tab is not supported by GFM for some reason.
2373
+ f === 93 && !u || // Space or tab is not supported by GFM for some reason.
2370
2374
  // `\n` and `[` not being supported makes sense.
2371
- h === null || h === 91 || D(h)
2375
+ f === null || f === 91 || D(f)
2372
2376
  )
2373
- return t(h);
2374
- if (h === 93) {
2377
+ return t(f);
2378
+ if (f === 93) {
2375
2379
  e.exit("chunkString");
2376
2380
  const k = e.exit("gfmFootnoteDefinitionLabelString");
2377
- return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2381
+ return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(f), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2378
2382
  }
2379
- return D(h) || (u = !0), a++, e.consume(h), h === 92 ? c : f;
2383
+ return D(f) || (u = !0), a++, e.consume(f), f === 92 ? s : d;
2380
2384
  }
2381
- function c(h) {
2382
- return h === 91 || h === 92 || h === 93 ? (e.consume(h), a++, f) : f(h);
2385
+ function s(f) {
2386
+ return f === 91 || f === 92 || f === 93 ? (e.consume(f), a++, d) : d(f);
2383
2387
  }
2384
- function p(h) {
2385
- return h === 58 ? (e.enter("definitionMarker"), e.consume(h), e.exit("definitionMarker"), i.includes(o) || i.push(o), z(e, g, "gfmFootnoteDefinitionWhitespace")) : t(h);
2388
+ function p(f) {
2389
+ return f === 58 ? (e.enter("definitionMarker"), e.consume(f), e.exit("definitionMarker"), i.includes(o) || i.push(o), z(e, b, "gfmFootnoteDefinitionWhitespace")) : t(f);
2386
2390
  }
2387
- function g(h) {
2388
- return r(h);
2391
+ function b(f) {
2392
+ return r(f);
2389
2393
  }
2390
2394
  }
2391
2395
  function _a(e, r, t) {
@@ -2424,21 +2428,21 @@ function ja(e) {
2424
2428
  let l = -1;
2425
2429
  for (; ++l < a.length; )
2426
2430
  if (a[l][0] === "enter" && a[l][1].type === "strikethroughSequenceTemporary" && a[l][1]._close) {
2427
- let s = l;
2428
- for (; s--; )
2429
- if (a[s][0] === "exit" && a[s][1].type === "strikethroughSequenceTemporary" && a[s][1]._open && // If the sizes are the same:
2430
- a[l][1].end.offset - a[l][1].start.offset === a[s][1].end.offset - a[s][1].start.offset) {
2431
- a[l][1].type = "strikethroughSequence", a[s][1].type = "strikethroughSequence";
2432
- const f = {
2431
+ let c = l;
2432
+ for (; c--; )
2433
+ if (a[c][0] === "exit" && a[c][1].type === "strikethroughSequenceTemporary" && a[c][1]._open && // If the sizes are the same:
2434
+ a[l][1].end.offset - a[l][1].start.offset === a[c][1].end.offset - a[c][1].start.offset) {
2435
+ a[l][1].type = "strikethroughSequence", a[c][1].type = "strikethroughSequence";
2436
+ const d = {
2433
2437
  type: "strikethrough",
2434
- start: Object.assign({}, a[s][1].start),
2438
+ start: Object.assign({}, a[c][1].start),
2435
2439
  end: Object.assign({}, a[l][1].end)
2436
- }, c = {
2440
+ }, s = {
2437
2441
  type: "strikethroughText",
2438
- start: Object.assign({}, a[s][1].end),
2442
+ start: Object.assign({}, a[c][1].end),
2439
2443
  end: Object.assign({}, a[l][1].start)
2440
- }, p = [["enter", f, u], ["enter", a[s][1], u], ["exit", a[s][1], u], ["enter", c, u]], g = u.parser.constructs.insideSpan.null;
2441
- g && ce(p, p.length, 0, Ia(g, a.slice(s + 1, l), u)), ce(p, p.length, 0, [["exit", c, u], ["enter", a[l][1], u], ["exit", a[l][1], u], ["exit", f, u]]), ce(a, s - 1, l - s + 3, p), l = s + p.length - 2;
2444
+ }, p = [["enter", d, u], ["enter", a[c][1], u], ["exit", a[c][1], u], ["enter", s, u]], b = u.parser.constructs.insideSpan.null;
2445
+ b && ce(p, p.length, 0, Ia(b, a.slice(c + 1, l), u)), ce(p, p.length, 0, [["exit", s, u], ["enter", a[l][1], u], ["exit", a[l][1], u], ["exit", d, u]]), ce(a, c - 1, l - c + 3, p), l = c + p.length - 2;
2442
2446
  break;
2443
2447
  }
2444
2448
  }
@@ -2447,19 +2451,19 @@ function ja(e) {
2447
2451
  return a;
2448
2452
  }
2449
2453
  function o(a, u, l) {
2450
- const s = this.previous, f = this.events;
2451
- let c = 0;
2454
+ const c = this.previous, d = this.events;
2455
+ let s = 0;
2452
2456
  return p;
2453
- function p(h) {
2454
- return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? l(h) : (a.enter("strikethroughSequenceTemporary"), g(h));
2457
+ function p(f) {
2458
+ return c === 126 && d[d.length - 1][1].type !== "characterEscape" ? l(f) : (a.enter("strikethroughSequenceTemporary"), b(f));
2455
2459
  }
2456
- function g(h) {
2457
- const k = de(s);
2458
- if (h === 126)
2459
- return c > 1 ? l(h) : (a.consume(h), c++, g);
2460
- if (c < 2 && !t) return l(h);
2461
- const b = a.exit("strikethroughSequenceTemporary"), x = de(h);
2462
- return b._open = !x || x === 2 && !!k, b._close = !k || k === 2 && !!x, u(h);
2460
+ function b(f) {
2461
+ const k = de(c);
2462
+ if (f === 126)
2463
+ return s > 1 ? l(f) : (a.consume(f), s++, b);
2464
+ if (s < 2 && !t) return l(f);
2465
+ const g = a.exit("strikethroughSequenceTemporary"), x = de(f);
2466
+ return g._open = !x || x === 2 && !!k, g._close = !k || k === 2 && !!x, u(f);
2463
2467
  }
2464
2468
  }
2465
2469
  }
@@ -2578,30 +2582,30 @@ function Wa(e, r, t) {
2578
2582
  return O === C && n.parser.lazy[n.now().line] ? t(m) : O(m);
2579
2583
  }
2580
2584
  function l(m) {
2581
- return e.enter("tableHead"), e.enter("tableRow"), s(m);
2585
+ return e.enter("tableHead"), e.enter("tableRow"), c(m);
2582
2586
  }
2583
- function s(m) {
2584
- return m === 124 || (a = !0, o += 1), f(m);
2587
+ function c(m) {
2588
+ return m === 124 || (a = !0, o += 1), d(m);
2585
2589
  }
2586
- function f(m) {
2587
- 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) : F(m) ? z(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)));
2590
+ function d(m) {
2591
+ 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"), b) : t(m) : F(m) ? z(e, d, "whitespace")(m) : (o += 1, a && (a = !1, i += 1), m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), a = !0, d) : (e.enter("data"), s(m)));
2588
2592
  }
2589
- function c(m) {
2590
- return m === null || m === 124 || D(m) ? (e.exit("data"), f(m)) : (e.consume(m), m === 92 ? p : c);
2593
+ function s(m) {
2594
+ return m === null || m === 124 || D(m) ? (e.exit("data"), d(m)) : (e.consume(m), m === 92 ? p : s);
2591
2595
  }
2592
2596
  function p(m) {
2593
- return m === 92 || m === 124 ? (e.consume(m), c) : c(m);
2597
+ return m === 92 || m === 124 ? (e.consume(m), s) : s(m);
2594
2598
  }
2595
- function g(m) {
2596
- return n.interrupt = !1, n.parser.lazy[n.now().line] ? t(m) : (e.enter("tableDelimiterRow"), a = !1, F(m) ? z(e, h, "linePrefix", n.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(m) : h(m));
2599
+ function b(m) {
2600
+ return n.interrupt = !1, n.parser.lazy[n.now().line] ? t(m) : (e.enter("tableDelimiterRow"), a = !1, F(m) ? z(e, f, "linePrefix", n.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(m) : f(m));
2597
2601
  }
2598
- function h(m) {
2599
- return m === 45 || m === 58 ? b(m) : m === 124 ? (a = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), k) : T(m);
2602
+ function f(m) {
2603
+ return m === 45 || m === 58 ? g(m) : m === 124 ? (a = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), k) : T(m);
2600
2604
  }
2601
2605
  function k(m) {
2602
- return F(m) ? z(e, b, "whitespace")(m) : b(m);
2606
+ return F(m) ? z(e, g, "whitespace")(m) : g(m);
2603
2607
  }
2604
- function b(m) {
2608
+ function g(m) {
2605
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 || Z(m) ? A(m) : T(m);
2606
2610
  }
2607
2611
  function x(m) {
@@ -2614,7 +2618,7 @@ function Wa(e, r, t) {
2614
2618
  return F(m) ? z(e, A, "whitespace")(m) : A(m);
2615
2619
  }
2616
2620
  function A(m) {
2617
- return m === 124 ? h(m) : m === null || Z(m) ? !a || i !== o ? T(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : T(m);
2621
+ return m === 124 ? f(m) : m === null || Z(m) ? !a || i !== o ? T(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : T(m);
2618
2622
  }
2619
2623
  function T(m) {
2620
2624
  return t(m);
@@ -2633,25 +2637,25 @@ function Wa(e, r, t) {
2633
2637
  }
2634
2638
  }
2635
2639
  function Ha(e, r) {
2636
- let t = -1, n = !0, i = 0, o = [0, 0, 0, 0], a = [0, 0, 0, 0], u = !1, l = 0, s, f, c;
2640
+ let t = -1, n = !0, i = 0, o = [0, 0, 0, 0], a = [0, 0, 0, 0], u = !1, l = 0, c, d, s;
2637
2641
  const p = new $a();
2638
2642
  for (; ++t < e.length; ) {
2639
- const g = e[t], h = g[1];
2640
- g[0] === "enter" ? h.type === "tableHead" ? (u = !1, l !== 0 && (Je(p, r, l, s, f), f = void 0, l = 0), s = {
2643
+ const b = e[t], f = b[1];
2644
+ b[0] === "enter" ? f.type === "tableHead" ? (u = !1, l !== 0 && (Je(p, r, l, c, d), d = void 0, l = 0), c = {
2641
2645
  type: "table",
2642
- start: Object.assign({}, h.start),
2646
+ start: Object.assign({}, f.start),
2643
2647
  // Note: correct end is set later.
2644
- end: Object.assign({}, h.end)
2645
- }, p.add(t, 0, [["enter", s, r]])) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (n = !0, c = void 0, o = [0, 0, 0, 0], a = [0, t + 1, 0, 0], u && (u = !1, f = {
2648
+ end: Object.assign({}, f.end)
2649
+ }, p.add(t, 0, [["enter", c, r]])) : f.type === "tableRow" || f.type === "tableDelimiterRow" ? (n = !0, s = void 0, o = [0, 0, 0, 0], a = [0, t + 1, 0, 0], u && (u = !1, d = {
2646
2650
  type: "tableBody",
2647
- start: Object.assign({}, h.start),
2651
+ start: Object.assign({}, f.start),
2648
2652
  // Note: correct end is set later.
2649
- end: Object.assign({}, h.end)
2650
- }, p.add(t, 0, [["enter", f, r]])), i = h.type === "tableDelimiterRow" ? 2 : f ? 3 : 1) : i && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") ? (n = !1, a[2] === 0 && (o[1] !== 0 && (a[0] = a[1], c = ue(p, r, o, i, void 0, c), o = [0, 0, 0, 0]), a[2] = t)) : h.type === "tableCellDivider" && (n ? n = !1 : (o[1] !== 0 && (a[0] = a[1], c = ue(p, r, o, i, void 0, c)), o = a, a = [o[1], t, 0, 0])) : h.type === "tableHead" ? (u = !0, l = t) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (l = t, o[1] !== 0 ? (a[0] = a[1], c = ue(p, r, o, i, t, c)) : a[1] !== 0 && (c = ue(p, r, a, i, t, c)), i = 0) : i && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") && (a[3] = t);
2653
+ end: Object.assign({}, f.end)
2654
+ }, p.add(t, 0, [["enter", d, r]])), i = f.type === "tableDelimiterRow" ? 2 : d ? 3 : 1) : i && (f.type === "data" || f.type === "tableDelimiterMarker" || f.type === "tableDelimiterFiller") ? (n = !1, a[2] === 0 && (o[1] !== 0 && (a[0] = a[1], s = ue(p, r, o, i, void 0, s), o = [0, 0, 0, 0]), a[2] = t)) : f.type === "tableCellDivider" && (n ? n = !1 : (o[1] !== 0 && (a[0] = a[1], s = ue(p, r, o, i, void 0, s)), o = a, a = [o[1], t, 0, 0])) : f.type === "tableHead" ? (u = !0, l = t) : f.type === "tableRow" || f.type === "tableDelimiterRow" ? (l = t, o[1] !== 0 ? (a[0] = a[1], s = ue(p, r, o, i, t, s)) : a[1] !== 0 && (s = ue(p, r, a, i, t, s)), i = 0) : i && (f.type === "data" || f.type === "tableDelimiterMarker" || f.type === "tableDelimiterFiller") && (a[3] = t);
2651
2655
  }
2652
- for (l !== 0 && Je(p, r, l, s, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
2653
- const g = r.events[t];
2654
- g[0] === "enter" && g[1].type === "table" && (g[1]._align = Ua(r.events, t));
2656
+ for (l !== 0 && Je(p, r, l, c, d), p.consume(r.events), t = -1; ++t < r.events.length; ) {
2657
+ const b = r.events[t];
2658
+ b[0] === "enter" && b[1].type === "table" && (b[1]._align = Ua(r.events, t));
2655
2659
  }
2656
2660
  return e;
2657
2661
  }
@@ -2665,19 +2669,19 @@ function ue(e, r, t, n, i, o) {
2665
2669
  // Note: correct end is set later.
2666
2670
  end: Object.assign({}, l)
2667
2671
  }, e.add(t[1], 0, [["enter", o, r]]), t[2] !== 0) {
2668
- const s = G(r.events, t[2]), f = G(r.events, t[3]), c = {
2672
+ const c = G(r.events, t[2]), d = G(r.events, t[3]), s = {
2669
2673
  type: u,
2670
- start: Object.assign({}, s),
2671
- end: Object.assign({}, f)
2674
+ start: Object.assign({}, c),
2675
+ end: Object.assign({}, d)
2672
2676
  };
2673
- if (e.add(t[2], 0, [["enter", c, r]]), n !== 2) {
2674
- const p = r.events[t[2]], g = r.events[t[3]];
2675
- if (p[1].end = Object.assign({}, g[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
2676
- const h = t[2] + 1, k = t[3] - t[2] - 1;
2677
- e.add(h, k, []);
2677
+ if (e.add(t[2], 0, [["enter", s, r]]), n !== 2) {
2678
+ const p = r.events[t[2]], b = r.events[t[3]];
2679
+ if (p[1].end = Object.assign({}, b[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
2680
+ const f = t[2] + 1, k = t[3] - t[2] - 1;
2681
+ e.add(f, k, []);
2678
2682
  }
2679
2683
  }
2680
- e.add(t[3] + 1, 0, [["exit", c, r]]);
2684
+ e.add(t[3] + 1, 0, [["exit", s, r]]);
2681
2685
  }
2682
2686
  return i !== void 0 && (o.end = Object.assign({}, G(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
2683
2687
  }
@@ -2749,7 +2753,7 @@ function Qa(e) {
2749
2753
  function I(...e) {
2750
2754
  return e.filter(Boolean).join(" ");
2751
2755
  }
2752
- const Xa = ({ content: e }) => /* @__PURE__ */ d(
2756
+ const Xa = ({ content: e }) => /* @__PURE__ */ h(
2753
2757
  Zt,
2754
2758
  {
2755
2759
  remarkPlugins: [Qa],
@@ -2760,7 +2764,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2760
2764
  ), _t = Ot(Xa), Ya = ({ language: e, code: r }) => {
2761
2765
  const { isCopied: t, copyToClipboard: n } = ei();
2762
2766
  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: [
2763
- /* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
2767
+ /* @__PURE__ */ h("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
2764
2768
  /* @__PURE__ */ v(
2765
2769
  "button",
2766
2770
  {
@@ -2770,8 +2774,8 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2770
2774
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
2771
2775
  "aria-label": "Copy code",
2772
2776
  children: [
2773
- !t && /* @__PURE__ */ d(sr, { className: "cuadra-h-4 cuadra-w-4" }),
2774
- t && /* @__PURE__ */ d(ar, { className: "cuadra-h-4 cuadra-w-4" })
2777
+ !t && /* @__PURE__ */ h(sr, { className: "cuadra-h-4 cuadra-w-4" }),
2778
+ t && /* @__PURE__ */ h(ar, { className: "cuadra-h-4 cuadra-w-4" })
2775
2779
  ]
2776
2780
  }
2777
2781
  )
@@ -2786,14 +2790,14 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2786
2790
  });
2787
2791
  } };
2788
2792
  }, ti = Vt({
2789
- h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
2793
+ h1: ({ className: e, ...r }) => /* @__PURE__ */ h(
2790
2794
  "h1",
2791
2795
  {
2792
2796
  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),
2793
2797
  ...r
2794
2798
  }
2795
2799
  ),
2796
- h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
2800
+ h2: ({ className: e, ...r }) => /* @__PURE__ */ h(
2797
2801
  "h2",
2798
2802
  {
2799
2803
  className: I(
@@ -2803,7 +2807,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2803
2807
  ...r
2804
2808
  }
2805
2809
  ),
2806
- h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
2810
+ h3: ({ className: e, ...r }) => /* @__PURE__ */ h(
2807
2811
  "h3",
2808
2812
  {
2809
2813
  className: I(
@@ -2813,7 +2817,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2813
2817
  ...r
2814
2818
  }
2815
2819
  ),
2816
- h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
2820
+ h4: ({ className: e, ...r }) => /* @__PURE__ */ h(
2817
2821
  "h4",
2818
2822
  {
2819
2823
  className: I(
@@ -2823,28 +2827,28 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2823
2827
  ...r
2824
2828
  }
2825
2829
  ),
2826
- h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: I("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2827
- h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: I("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
2828
- p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: I("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2829
- a: ({ className: e, ...r }) => /* @__PURE__ */ d(
2830
+ 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 }),
2831
+ h6: ({ className: e, ...r }) => /* @__PURE__ */ h("h6", { className: I("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
2832
+ 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
+ a: ({ className: e, ...r }) => /* @__PURE__ */ h(
2830
2834
  "a",
2831
2835
  {
2832
2836
  className: I("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
2833
2837
  ...r
2834
2838
  }
2835
2839
  ),
2836
- blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: I("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
2837
- ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2838
- ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: I("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2839
- hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: I("cuadra-my-5 cuadra-border-b", e), ...r }),
2840
- table: ({ className: e, ...r }) => /* @__PURE__ */ d(
2840
+ blockquote: ({ className: e, ...r }) => /* @__PURE__ */ h("blockquote", { className: I("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
2841
+ 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 }),
2842
+ 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 }),
2843
+ hr: ({ className: e, ...r }) => /* @__PURE__ */ h("hr", { className: I("cuadra-my-5 cuadra-border-b", e), ...r }),
2844
+ table: ({ className: e, ...r }) => /* @__PURE__ */ h(
2841
2845
  "table",
2842
2846
  {
2843
2847
  className: I("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
2844
2848
  ...r
2845
2849
  }
2846
2850
  ),
2847
- th: ({ className: e, ...r }) => /* @__PURE__ */ d(
2851
+ th: ({ className: e, ...r }) => /* @__PURE__ */ h(
2848
2852
  "th",
2849
2853
  {
2850
2854
  className: I(
@@ -2854,7 +2858,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2854
2858
  ...r
2855
2859
  }
2856
2860
  ),
2857
- td: ({ className: e, ...r }) => /* @__PURE__ */ d(
2861
+ td: ({ className: e, ...r }) => /* @__PURE__ */ h(
2858
2862
  "td",
2859
2863
  {
2860
2864
  className: I(
@@ -2864,7 +2868,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2864
2868
  ...r
2865
2869
  }
2866
2870
  ),
2867
- tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
2871
+ tr: ({ className: e, ...r }) => /* @__PURE__ */ h(
2868
2872
  "tr",
2869
2873
  {
2870
2874
  className: I(
@@ -2874,8 +2878,8 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2874
2878
  ...r
2875
2879
  }
2876
2880
  ),
2877
- sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2878
- pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
2881
+ sup: ({ className: e, ...r }) => /* @__PURE__ */ h("sup", { className: I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2882
+ pre: ({ className: e, ...r }) => /* @__PURE__ */ h(
2879
2883
  "pre",
2880
2884
  {
2881
2885
  className: I(
@@ -2887,7 +2891,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2887
2891
  ),
2888
2892
  code: function({ className: r, ...t }) {
2889
2893
  const n = Gt();
2890
- return /* @__PURE__ */ d(
2894
+ return /* @__PURE__ */ h(
2891
2895
  "code",
2892
2896
  {
2893
2897
  className: I(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
@@ -2926,7 +2930,7 @@ function Xe({
2926
2930
  suggestions: n,
2927
2931
  inputPlaceholder: i = "Type your message..."
2928
2932
  } = {}) {
2929
- const o = Wt(), [a, u] = N(!1), [l, s] = N(null), [f, c] = N(!1);
2933
+ const o = Wt(), [a, u] = N(!1), [l, c] = N(null), [d, s] = N(!1);
2930
2934
  return M(() => {
2931
2935
  if (!o) {
2932
2936
  u(!1);
@@ -2938,39 +2942,39 @@ function Xe({
2938
2942
  u(!1);
2939
2943
  return;
2940
2944
  }
2941
- const g = p.subscribe?.((k) => {
2942
- const b = k?.threadId, x = k?.messages || [], w = k?.isLoadingHistory || !1, y = x.length;
2943
- b && b !== l && s(b), u(w && y === 0);
2945
+ const b = p.subscribe?.((k) => {
2946
+ const g = k?.threadId, x = k?.messages || [], w = k?.isLoadingHistory || !1, y = x.length;
2947
+ g && g !== l && c(g), u(w && y === 0);
2944
2948
  const T = x.some(
2945
2949
  (C) => C.role === "assistant" && !!C.content && (Array.isArray(C.content) ? C.content.some((L) => typeof L == "object" && L?.text ? L.text.trim().length > 0 : !1) : typeof C.content == "string" ? C.content.trim().length > 0 : !1)
2946
2950
  );
2947
- c(T);
2948
- }), h = p.getState?.();
2949
- if (h) {
2950
- const k = h?.threadId, b = h?.messages || [], x = h?.isLoadingHistory || !1, w = b.length;
2951
- k && k !== l && s(k), u(x && w === 0);
2952
- const A = b.some(
2951
+ s(T);
2952
+ }), f = p.getState?.();
2953
+ if (f) {
2954
+ const k = f?.threadId, g = f?.messages || [], x = f?.isLoadingHistory || !1, w = g.length;
2955
+ k && k !== l && c(k), u(x && w === 0);
2956
+ const A = g.some(
2953
2957
  (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)
2954
2958
  );
2955
- c(A);
2959
+ s(A);
2956
2960
  }
2957
2961
  return () => {
2958
- g && g();
2962
+ b && b();
2959
2963
  };
2960
2964
  } catch {
2961
2965
  u(!1);
2962
2966
  }
2963
2967
  }, [o, l]), /* @__PURE__ */ v(ee.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
2964
- /* @__PURE__ */ d(
2968
+ /* @__PURE__ */ h(
2965
2969
  ee.Viewport,
2966
2970
  {
2967
2971
  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",
2968
2972
  style: t ? { paddingTop: t } : void 0,
2969
- children: a ? /* @__PURE__ */ d("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: [
2970
- /* @__PURE__ */ d(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
2971
- /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
2973
+ children: a ? /* @__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: [
2974
+ /* @__PURE__ */ h(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
2975
+ /* @__PURE__ */ h("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
2972
2976
  ] }) }) : /* @__PURE__ */ v(B, { children: [
2973
- /* @__PURE__ */ d(ee.Empty, { children: /* @__PURE__ */ d(
2977
+ /* @__PURE__ */ h(ee.Empty, { children: /* @__PURE__ */ h(
2974
2978
  ni,
2975
2979
  {
2976
2980
  title: e,
@@ -2978,7 +2982,7 @@ function Xe({
2978
2982
  suggestions: n
2979
2983
  }
2980
2984
  ) }),
2981
- /* @__PURE__ */ d(
2985
+ /* @__PURE__ */ h(
2982
2986
  ee.Messages,
2983
2987
  {
2984
2988
  components: {
@@ -2987,16 +2991,16 @@ function Xe({
2987
2991
  }
2988
2992
  }
2989
2993
  ),
2990
- /* @__PURE__ */ d(ee.If, { running: !0, children: !f && /* @__PURE__ */ d("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ d(ri, { active: !0 }) }) })
2994
+ /* @__PURE__ */ h(ee.If, { running: !0, children: !d && /* @__PURE__ */ h("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ h(ri, { active: !0 }) }) })
2991
2995
  ] })
2992
2996
  }
2993
2997
  ),
2994
- /* @__PURE__ */ d("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ v(ke.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
2995
- /* @__PURE__ */ d(
2998
+ /* @__PURE__ */ h("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ v(ke.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
2999
+ /* @__PURE__ */ h(
2996
3000
  ke.Input,
2997
3001
  {
2998
3002
  asChild: !0,
2999
- children: /* @__PURE__ */ d(
3003
+ children: /* @__PURE__ */ h(
3000
3004
  "textarea",
3001
3005
  {
3002
3006
  rows: 3,
@@ -3007,14 +3011,14 @@ function Xe({
3007
3011
  )
3008
3012
  }
3009
3013
  ),
3010
- /* @__PURE__ */ d(ke.Send, { asChild: !0, children: /* @__PURE__ */ d(
3014
+ /* @__PURE__ */ h(ke.Send, { asChild: !0, children: /* @__PURE__ */ h(
3011
3015
  "button",
3012
3016
  {
3013
3017
  className: "!cuadra-absolute !cuadra-bottom-2 !cuadra-right-2 cuadra-size-8 cuadra-bg-secondary cuadra-text-secondary-foreground cuadra-rounded-md cuadra-shadow-sm hover:cuadra-bg-secondary/90 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed cuadra-flex cuadra-items-center cuadra-justify-center",
3014
3018
  style: { position: "absolute", bottom: "0.5rem", right: "0.5rem" },
3015
3019
  "aria-label": "Send message",
3016
3020
  type: "button",
3017
- children: /* @__PURE__ */ d(rr, { className: "cuadra-h-4 cuadra-w-4" })
3021
+ children: /* @__PURE__ */ h(rr, { className: "cuadra-h-4 cuadra-w-4" })
3018
3022
  }
3019
3023
  ) })
3020
3024
  ] }) })
@@ -3027,12 +3031,12 @@ function ni({ title: e, subtitle: r, suggestions: t }) {
3027
3031
  } catch {
3028
3032
  }
3029
3033
  };
3030
- 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__ */ 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: [
3034
+ 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: [
3031
3035
  /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3032
- /* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
3033
- /* @__PURE__ */ d("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
3036
+ /* @__PURE__ */ h("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
3037
+ /* @__PURE__ */ h("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
3034
3038
  ] }),
3035
- t && t.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-grid cuadra-grid-cols-2 cuadra-gap-2 cuadra-pb-4 cuadra-w-full cuadra-max-w-2xl", children: t.map((o, a) => /* @__PURE__ */ d(
3039
+ t && t.length > 0 && /* @__PURE__ */ h("div", { className: "cuadra-grid cuadra-grid-cols-2 cuadra-gap-2 cuadra-pb-4 cuadra-w-full cuadra-max-w-2xl", children: t.map((o, a) => /* @__PURE__ */ h(
3036
3040
  "button",
3037
3041
  {
3038
3042
  type: "button",
@@ -3046,7 +3050,7 @@ function ni({ title: e, subtitle: r, suggestions: t }) {
3046
3050
  ] }) });
3047
3051
  }
3048
3052
  function ai() {
3049
- return /* @__PURE__ */ d(se.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: /* @__PURE__ */ d(
3053
+ return /* @__PURE__ */ h(se.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: /* @__PURE__ */ h(
3050
3054
  "div",
3051
3055
  {
3052
3056
  className: "cuadra-bg-muted cuadra-text-foreground cuadra-col-start-2 cuadra-row-start-2 cuadra-max-w-[calc(42rem*0.8)] cuadra-break-words cuadra-rounded-3xl cuadra-px-5 cuadra-py-2.5 font-brand",
@@ -3061,11 +3065,11 @@ function ai() {
3061
3065
  paddingBottom: "0.625rem",
3062
3066
  wordBreak: "break-word"
3063
3067
  },
3064
- children: /* @__PURE__ */ d(
3068
+ children: /* @__PURE__ */ h(
3065
3069
  se.Parts,
3066
3070
  {
3067
3071
  components: {
3068
- Text: ({ text: e }) => /* @__PURE__ */ d(_t, { content: e || "" })
3072
+ Text: ({ text: e }) => /* @__PURE__ */ h(_t, { content: e || "" })
3069
3073
  }
3070
3074
  }
3071
3075
  )
@@ -3073,7 +3077,7 @@ function ai() {
3073
3077
  ) });
3074
3078
  }
3075
3079
  function ii() {
3076
- return /* @__PURE__ */ d(se.Root, { className: "cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3", children: /* @__PURE__ */ d(
3080
+ return /* @__PURE__ */ h(se.Root, { className: "cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3", children: /* @__PURE__ */ h(
3077
3081
  "div",
3078
3082
  {
3079
3083
  className: "cuadra-text-foreground cuadra-col-span-2 cuadra-col-start-2 cuadra-row-start-1 cuadra-my-1.5 cuadra-max-w-[90%] cuadra-break-words cuadra-leading-7 font-brand",
@@ -3082,11 +3086,11 @@ function ii() {
3082
3086
  marginTop: "0.375rem",
3083
3087
  marginBottom: "0.375rem"
3084
3088
  },
3085
- children: /* @__PURE__ */ d(
3089
+ children: /* @__PURE__ */ h(
3086
3090
  se.Parts,
3087
3091
  {
3088
3092
  components: {
3089
- Text: ({ text: e }) => /* @__PURE__ */ d(_t, { content: e || "" })
3093
+ Text: ({ text: e }) => /* @__PURE__ */ h(_t, { content: e || "" })
3090
3094
  }
3091
3095
  }
3092
3096
  )
@@ -3094,24 +3098,24 @@ function ii() {
3094
3098
  ) });
3095
3099
  }
3096
3100
  function oi({ onThreadSelect: e }) {
3097
- const r = qt(), t = Kt((b) => b.threadId), [n, i] = N(null), o = r?.id === t, a = n === r?.id, [u, l] = N(!1), [s, f] = N(r?.title || ""), [c, p] = N(!1), [g, h] = N(!1), k = async () => {
3098
- if (!r?.remoteId || !s || s === r.title) {
3101
+ const r = qt(), t = Kt((g) => g.threadId), [n, i] = N(null), o = r?.id === t, a = n === r?.id, [u, l] = N(!1), [c, d] = N(r?.title || ""), [s, p] = N(!1), [b, f] = N(!1), k = async () => {
3102
+ if (!r?.remoteId || !c || c === r.title) {
3099
3103
  l(!1);
3100
3104
  return;
3101
3105
  }
3102
3106
  try {
3103
- h(!0);
3104
- const b = window.__cuadraThreadListAdapter;
3105
- b && typeof b.rename == "function" && await b.rename(r.remoteId, s), l(!1), p(!1);
3107
+ f(!0);
3108
+ const g = window.__cuadraThreadListAdapter;
3109
+ g && typeof g.rename == "function" && await g.rename(r.remoteId, c), l(!1), p(!1);
3106
3110
  } catch {
3107
3111
  l(!1), p(!1);
3108
3112
  } finally {
3109
- h(!1);
3113
+ f(!1);
3110
3114
  }
3111
3115
  };
3112
3116
  return M(() => {
3113
- r?.title && !u && f(r.title);
3114
- }, [r?.title, u]), r ? /* @__PURE__ */ d(
3117
+ r?.title && !u && d(r.title);
3118
+ }, [r?.title, u]), r ? /* @__PURE__ */ h(
3115
3119
  we.Root,
3116
3120
  {
3117
3121
  className: `group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 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"}`,
@@ -3124,71 +3128,71 @@ function oi({ onThreadSelect: e }) {
3124
3128
  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",
3125
3129
  onClick: () => e?.(),
3126
3130
  children: [
3127
- /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-flex-col cuadra-min-w-0 cuadra-flex-1 cuadra-items-start cuadra-text-left", children: u ? /* @__PURE__ */ d(
3131
+ /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-flex-col cuadra-min-w-0 cuadra-flex-1 cuadra-items-start cuadra-text-left", children: u ? /* @__PURE__ */ h(
3128
3132
  "input",
3129
3133
  {
3130
3134
  className: "cuadra-flex cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 font-brand",
3131
- value: s,
3132
- onChange: (b) => f(b.target.value),
3133
- onKeyDown: (b) => {
3134
- b.key === "Enter" && k(), b.key === "Escape" && (l(!1), f(r.title || ""));
3135
+ value: c,
3136
+ onChange: (g) => d(g.target.value),
3137
+ onKeyDown: (g) => {
3138
+ g.key === "Enter" && k(), g.key === "Escape" && (l(!1), d(r.title || ""));
3135
3139
  },
3136
- disabled: g,
3140
+ disabled: b,
3137
3141
  autoFocus: !0,
3138
- onClick: (b) => b.stopPropagation()
3142
+ onClick: (g) => g.stopPropagation()
3139
3143
  }
3140
3144
  ) : /* @__PURE__ */ v(B, { children: [
3141
- /* @__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" }),
3142
- r.updatedAt && /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
3145
+ /* @__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" }),
3146
+ r.updatedAt && /* @__PURE__ */ h("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
3143
3147
  ] }) }),
3144
- /* @__PURE__ */ d("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: [
3145
- /* @__PURE__ */ d(
3148
+ /* @__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 || s) && /* @__PURE__ */ v("div", { className: "cuadra-relative", children: [
3149
+ /* @__PURE__ */ h(
3146
3150
  "button",
3147
3151
  {
3148
3152
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",
3149
- onClick: (b) => {
3150
- b.stopPropagation(), p(!c);
3153
+ onClick: (g) => {
3154
+ g.stopPropagation(), p(!s);
3151
3155
  },
3152
3156
  "aria-label": "Thread options",
3153
- children: /* @__PURE__ */ d(fr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3157
+ children: /* @__PURE__ */ h(fr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3154
3158
  }
3155
3159
  ),
3156
- c && /* @__PURE__ */ v(B, { children: [
3157
- /* @__PURE__ */ d(
3160
+ s && /* @__PURE__ */ v(B, { children: [
3161
+ /* @__PURE__ */ h(
3158
3162
  "div",
3159
3163
  {
3160
3164
  className: "cuadra-fixed cuadra-inset-0 cuadra-z-40",
3161
3165
  onClick: () => p(!1)
3162
3166
  }
3163
3167
  ),
3164
- /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-right-0 cuadra-top-8 cuadra-z-50 cuadra-bg-background cuadra-border cuadra-border-border cuadra-rounded-lg cuadra-shadow-lg cuadra-min-w-[120px] cuadra-overflow-hidden", children: u ? /* @__PURE__ */ d(
3168
+ /* @__PURE__ */ h("div", { className: "cuadra-absolute cuadra-right-0 cuadra-top-8 cuadra-z-50 cuadra-bg-background cuadra-border cuadra-border-border cuadra-rounded-lg cuadra-shadow-lg cuadra-min-w-[120px] cuadra-overflow-hidden", children: u ? /* @__PURE__ */ h(
3165
3169
  "button",
3166
3170
  {
3167
3171
  className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",
3168
- onClick: (b) => {
3169
- b.stopPropagation(), k();
3172
+ onClick: (g) => {
3173
+ g.stopPropagation(), k();
3170
3174
  },
3171
- disabled: g,
3175
+ disabled: b,
3172
3176
  children: "Save"
3173
3177
  }
3174
3178
  ) : /* @__PURE__ */ v(B, { children: [
3175
- /* @__PURE__ */ d(
3179
+ /* @__PURE__ */ h(
3176
3180
  "button",
3177
3181
  {
3178
3182
  className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",
3179
- onClick: (b) => {
3180
- b.stopPropagation(), l(!0), f(r.title || ""), p(!1);
3183
+ onClick: (g) => {
3184
+ g.stopPropagation(), l(!0), d(r.title || ""), p(!1);
3181
3185
  },
3182
3186
  children: "Rename"
3183
3187
  }
3184
3188
  ),
3185
- /* @__PURE__ */ d("div", { className: "cuadra-border-t cuadra-border-border" }),
3186
- /* @__PURE__ */ d(we.Delete, { asChild: !0, children: /* @__PURE__ */ d(
3189
+ /* @__PURE__ */ h("div", { className: "cuadra-border-t cuadra-border-border" }),
3190
+ /* @__PURE__ */ h(we.Delete, { asChild: !0, children: /* @__PURE__ */ h(
3187
3191
  "button",
3188
3192
  {
3189
3193
  className: "cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left cuadra-text-destructive hover:cuadra-bg-muted cuadra-transition-colors font-brand",
3190
- onClick: (b) => {
3191
- b.stopPropagation(), p(!1);
3194
+ onClick: (g) => {
3195
+ g.stopPropagation(), p(!1);
3192
3196
  },
3193
3197
  children: "Delete"
3194
3198
  }
@@ -3204,25 +3208,25 @@ function oi({ onThreadSelect: e }) {
3204
3208
  }
3205
3209
  function Ye({ onThreadSelect: e }) {
3206
3210
  return /* @__PURE__ */ v(xe.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: [
3207
- /* @__PURE__ */ d("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__ */ d("h3", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-text-nowrap font-brand", children: "Chat History" }) }),
3211
+ /* @__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" }) }),
3208
3212
  /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3209
- /* @__PURE__ */ d(
3213
+ /* @__PURE__ */ h(
3210
3214
  xe.New,
3211
3215
  {
3212
3216
  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",
3213
3217
  onClick: () => e?.(),
3214
- children: /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3215
- /* @__PURE__ */ d(br, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3216
- /* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3218
+ 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: [
3219
+ /* @__PURE__ */ h(br, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3220
+ /* @__PURE__ */ h("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3217
3221
  ] }) })
3218
3222
  }
3219
3223
  ),
3220
- /* @__PURE__ */ d("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
3221
- /* @__PURE__ */ d(
3224
+ /* @__PURE__ */ h("div", { className: "cuadra-my-2 cuadra-border-t cuadra-border-border" }),
3225
+ /* @__PURE__ */ h(
3222
3226
  xe.Items,
3223
3227
  {
3224
3228
  components: {
3225
- ThreadListItem: (r) => /* @__PURE__ */ d(oi, { ...r, onThreadSelect: e })
3229
+ ThreadListItem: (r) => /* @__PURE__ */ h(oi, { ...r, onThreadSelect: e })
3226
3230
  }
3227
3231
  }
3228
3232
  )
@@ -3243,14 +3247,14 @@ const li = `
3243
3247
  contentStyle: a,
3244
3248
  rotating: u = !1
3245
3249
  }) => /* @__PURE__ */ v(B, { children: [
3246
- /* @__PURE__ */ d("style", { children: li }),
3250
+ /* @__PURE__ */ h("style", { children: li }),
3247
3251
  /* @__PURE__ */ v(
3248
3252
  "div",
3249
3253
  {
3250
3254
  className: `cuadra-relative cuadra-bg-background md:cuadra-rounded-xl cuadra-overflow-hidden ${r}`,
3251
3255
  style: { padding: i, ...o },
3252
3256
  children: [
3253
- /* @__PURE__ */ d(
3257
+ /* @__PURE__ */ h(
3254
3258
  "div",
3255
3259
  {
3256
3260
  className: "cuadra-absolute md:cuadra-rounded-xl",
@@ -3276,7 +3280,7 @@ const li = `
3276
3280
  }
3277
3281
  }
3278
3282
  ),
3279
- /* @__PURE__ */ d(
3283
+ /* @__PURE__ */ h(
3280
3284
  "div",
3281
3285
  {
3282
3286
  className: `cuadra-relative cuadra-bg-background cuadra-h-full cuadra-z-10 cuadra-flex cuadra-flex-col cuadra-overflow-hidden ${t} ${n}`,
@@ -3304,7 +3308,7 @@ const li = `
3304
3308
  }, [r]), M(() => {
3305
3309
  const a = document.documentElement;
3306
3310
  a.classList.remove("light", "dark"), a.classList.add(n), r === "system" && localStorage.setItem("theme", n);
3307
- }, [n, r]), /* @__PURE__ */ d(
3311
+ }, [n, r]), /* @__PURE__ */ h(
3308
3312
  "button",
3309
3313
  {
3310
3314
  type: "button",
@@ -3314,7 +3318,7 @@ const li = `
3314
3318
  },
3315
3319
  disabled: r !== "system",
3316
3320
  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}`,
3317
- children: /* @__PURE__ */ d(
3321
+ children: /* @__PURE__ */ h(
3318
3322
  ur,
3319
3323
  {
3320
3324
  className: `cuadra-h-4 cuadra-w-4 cuadra-transition-colors ${n === "dark" ? "cuadra-text-primary" : "cuadra-text-gray-400"}`
@@ -3332,58 +3336,58 @@ const li = `
3332
3336
  showThemeToggle: a = !0,
3333
3337
  theme: u = "system",
3334
3338
  onMobileMenuClick: l,
3335
- showMobileMenuButton: s = !1
3339
+ showMobileMenuButton: c = !1
3336
3340
  }) => {
3337
- const [f, c] = N(!1), p = rt(null);
3341
+ const [d, s] = N(!1), p = rt(null);
3338
3342
  M(() => {
3339
- const h = (k) => {
3340
- p.current && !p.current.contains(k.target) && c(!1);
3343
+ const f = (k) => {
3344
+ p.current && !p.current.contains(k.target) && s(!1);
3341
3345
  };
3342
- return f && document.addEventListener("mousedown", h), () => {
3343
- document.removeEventListener("mousedown", h);
3346
+ return d && document.addEventListener("mousedown", f), () => {
3347
+ document.removeEventListener("mousedown", f);
3344
3348
  };
3345
- }, [f]);
3346
- const g = r.find((h) => h.id === e);
3349
+ }, [d]);
3350
+ const b = r.find((f) => f.id === e);
3347
3351
  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: [
3348
3352
  /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3349
- s && /* @__PURE__ */ d(
3353
+ c && /* @__PURE__ */ h(
3350
3354
  "button",
3351
3355
  {
3352
3356
  type: "button",
3353
3357
  onClick: l,
3354
3358
  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",
3355
3359
  "aria-label": "Toggle thread list",
3356
- children: /* @__PURE__ */ d(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3360
+ children: /* @__PURE__ */ h(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3357
3361
  }
3358
3362
  ),
3359
- a && /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(ui, { theme: u }) })
3363
+ a && /* @__PURE__ */ h("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ h(ui, { theme: u }) })
3360
3364
  ] }),
3361
3365
  /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
3362
- !o && /* @__PURE__ */ d("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
3363
- 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..." }) }) : n ? /* @__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__ */ v("div", { ref: p, className: "cuadra-relative cuadra-w-48", children: [
3366
+ !o && /* @__PURE__ */ h("label", { className: "cuadra-hidden md:cuadra-inline cuadra-text-sm cuadra-text-muted-foreground cuadra-font-brand", children: "Model" }),
3367
+ 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: [
3364
3368
  /* @__PURE__ */ v(
3365
3369
  "button",
3366
3370
  {
3367
3371
  type: "button",
3368
- onClick: () => c(!f),
3372
+ onClick: () => s(!d),
3369
3373
  disabled: t || r.length === 0 || !!n,
3370
3374
  className: "cuadra-flex cuadra-h-10 cuadra-w-full cuadra-items-center cuadra-justify-between cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-font-brand",
3371
3375
  children: [
3372
- /* @__PURE__ */ d("span", { className: g ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: g?.name || "Select model" }),
3373
- /* @__PURE__ */ d(or, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
3376
+ /* @__PURE__ */ h("span", { className: b ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: b?.name || "Select model" }),
3377
+ /* @__PURE__ */ h(or, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
3374
3378
  ]
3375
3379
  }
3376
3380
  ),
3377
- f && r.length > 0 && /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-z-50 cuadra-mt-1 cuadra-w-full cuadra-min-w-[8rem] cuadra-overflow-hidden cuadra-rounded-md glass-popover cuadra-text-popover-foreground cuadra-animate-in fade-in-80 cuadra-border cuadra-border-border cuadra-bg-popover cuadra-shadow-md", children: /* @__PURE__ */ d("div", { className: "cuadra-p-1", children: r.map((h) => /* @__PURE__ */ v(
3381
+ d && 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((f) => /* @__PURE__ */ v(
3378
3382
  "button",
3379
3383
  {
3380
3384
  type: "button",
3381
3385
  onClick: () => {
3382
- i(h.id), c(!1);
3386
+ i(f.id), s(!1);
3383
3387
  },
3384
- className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e === h.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
3388
+ className: `cuadra-relative cuadra-flex cuadra-w-full cuadra-cursor-pointer cuadra-select-none cuadra-items-center cuadra-rounded-sm cuadra-py-1.5 cuadra-pl-8 cuadra-pr-2 cuadra-text-sm cuadra-outline-none focus:cuadra-bg-secondary focus:cuadra-text-secondary-foreground font-brand cuadra-transition-colors ${e === f.id ? "cuadra-bg-secondary cuadra-text-secondary-foreground" : "hover:cuadra-bg-secondary/50"}`,
3385
3389
  children: [
3386
- e === h.id && /* @__PURE__ */ d("span", { className: "cuadra-absolute cuadra-left-2 cuadra-flex cuadra-h-3.5 cuadra-w-3.5 cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ d(
3390
+ e === f.id && /* @__PURE__ */ h("span", { className: "cuadra-absolute cuadra-left-2 cuadra-flex cuadra-h-3.5 cuadra-w-3.5 cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ h(
3387
3391
  "svg",
3388
3392
  {
3389
3393
  xmlns: "http://www.w3.org/2000/svg",
@@ -3391,7 +3395,7 @@ const li = `
3391
3395
  height: "16",
3392
3396
  fill: "none",
3393
3397
  viewBox: "0 0 16 16",
3394
- children: /* @__PURE__ */ d(
3398
+ children: /* @__PURE__ */ h(
3395
3399
  "path",
3396
3400
  {
3397
3401
  fill: "currentColor",
@@ -3402,15 +3406,15 @@ const li = `
3402
3406
  )
3403
3407
  }
3404
3408
  ) }),
3405
- /* @__PURE__ */ d("span", { children: h.name })
3409
+ /* @__PURE__ */ h("span", { children: f.name })
3406
3410
  ]
3407
3411
  },
3408
- h.id
3412
+ f.id
3409
3413
  )) }) })
3410
3414
  ] })
3411
3415
  ] })
3412
3416
  ] });
3413
- }, ci = Ut(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ d(ci.Provider, { value: r, children: e });
3417
+ }, ci = Ut(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ h(ci.Provider, { value: r, children: e });
3414
3418
  function si() {
3415
3419
  M(() => {
3416
3420
  if (document.querySelector("style[data-cuadra-uikit]"))
@@ -3445,14 +3449,14 @@ const di = ({ config: e }) => {
3445
3449
  modelId: a,
3446
3450
  onModelChange: u,
3447
3451
  ephemeral: l = !1,
3448
- systemPrompt: s,
3449
- initialThreadId: f,
3450
- welcomeTitle: c,
3452
+ systemPrompt: c,
3453
+ initialThreadId: d,
3454
+ welcomeTitle: s,
3451
3455
  welcomeSubtitle: p,
3452
- extraTopPadding: g,
3453
- suggestions: h,
3456
+ extraTopPadding: b,
3457
+ suggestions: f,
3454
3458
  inputPlaceholder: k,
3455
- showThemeToggle: b = !0,
3459
+ showThemeToggle: g = !0,
3456
3460
  theme: x = "system",
3457
3461
  onError: w,
3458
3462
  onChatCreated: y,
@@ -3532,7 +3536,7 @@ const di = ({ config: e }) => {
3532
3536
  }),
3533
3537
  [_, oe, O, Q, X, K]
3534
3538
  );
3535
- return o === "selector" && O || i === "multiChat" && Ft ? /* @__PURE__ */ d(Ie, { value: be, children: /* @__PURE__ */ d(Ae, { 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(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !zt && Q ? /* @__PURE__ */ d(Ie, { value: be, children: /* @__PURE__ */ d(Ae, { 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(Ie, { value: be, children: /* @__PURE__ */ d(
3539
+ return o === "selector" && O || i === "multiChat" && Ft ? /* @__PURE__ */ h(Ie, { value: be, children: /* @__PURE__ */ h(Ae, { 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(ot, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !zt && Q ? /* @__PURE__ */ h(Ie, { value: be, children: /* @__PURE__ */ h(Ae, { 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: be, children: /* @__PURE__ */ h(
3536
3540
  Cr,
3537
3541
  {
3538
3542
  baseUrl: q ? E : r || E,
@@ -3543,8 +3547,8 @@ const di = ({ config: e }) => {
3543
3547
  modelId: _ || a || void 0,
3544
3548
  onModelChange: X,
3545
3549
  ephemeral: l,
3546
- systemPrompt: s,
3547
- initialThreadId: f,
3550
+ systemPrompt: c,
3551
+ initialThreadId: d,
3548
3552
  onError: w,
3549
3553
  onChatCreated: y,
3550
3554
  onUserMessage: A,
@@ -3552,7 +3556,7 @@ const di = ({ config: e }) => {
3552
3556
  onChatsLoaded: () => {
3553
3557
  i === "multiChat" && _e(!1);
3554
3558
  },
3555
- children: /* @__PURE__ */ d(
3559
+ children: /* @__PURE__ */ h(
3556
3560
  Ae,
3557
3561
  {
3558
3562
  paddingX: "cuadra-px-0",
@@ -3560,9 +3564,9 @@ const di = ({ config: e }) => {
3560
3564
  className: `cuadra-h-full ${e.containerClass || ""}`,
3561
3565
  borderSizePx: 4,
3562
3566
  style: { height: "100%" },
3563
- children: /* @__PURE__ */ d("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ v(B, { children: [
3567
+ children: /* @__PURE__ */ h("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ v(B, { children: [
3564
3568
  C && typeof document < "u" && $e(
3565
- /* @__PURE__ */ d(
3569
+ /* @__PURE__ */ h(
3566
3570
  "div",
3567
3571
  {
3568
3572
  className: "cuadra-fixed cuadra-inset-0 cuadra-bg-black/50 cuadra-z-40 md:cuadra-hidden",
@@ -3572,28 +3576,28 @@ const di = ({ config: e }) => {
3572
3576
  document.body
3573
3577
  ),
3574
3578
  typeof document < "u" && /* @__PURE__ */ v(B, { children: [
3575
- /* @__PURE__ */ d(
3579
+ /* @__PURE__ */ h(
3576
3580
  "div",
3577
3581
  {
3578
3582
  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",
3579
3583
  style: { borderRightWidth: "1px", height: "100%" },
3580
- children: /* @__PURE__ */ d(Ye, { onThreadSelect: () => L(!1) })
3584
+ children: /* @__PURE__ */ h(Ye, { onThreadSelect: () => L(!1) })
3581
3585
  }
3582
3586
  ),
3583
3587
  C && $e(
3584
- /* @__PURE__ */ d(
3588
+ /* @__PURE__ */ h(
3585
3589
  "div",
3586
3590
  {
3587
3591
  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",
3588
3592
  style: { borderRightWidth: "1px" },
3589
- children: /* @__PURE__ */ d(Ye, { onThreadSelect: () => L(!1) })
3593
+ children: /* @__PURE__ */ h(Ye, { onThreadSelect: () => L(!1) })
3590
3594
  }
3591
3595
  ),
3592
3596
  document.body
3593
3597
  )
3594
3598
  ] }),
3595
3599
  /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3596
- o === "selector" && /* @__PURE__ */ d(
3600
+ o === "selector" && /* @__PURE__ */ h(
3597
3601
  et,
3598
3602
  {
3599
3603
  currentModel: _ || "",
@@ -3601,25 +3605,25 @@ const di = ({ config: e }) => {
3601
3605
  modelsLoading: O,
3602
3606
  modelsError: Q,
3603
3607
  onModelChange: X,
3604
- showThemeToggle: b,
3608
+ showThemeToggle: g,
3605
3609
  theme: x,
3606
3610
  onMobileMenuClick: () => L(!C),
3607
3611
  showMobileMenuButton: i === "multiChat"
3608
3612
  }
3609
3613
  ),
3610
- /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
3614
+ /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ h(
3611
3615
  Xe,
3612
3616
  {
3613
- welcomeTitle: c,
3617
+ welcomeTitle: s,
3614
3618
  welcomeSubtitle: p,
3615
- extraTopPadding: g,
3616
- suggestions: h,
3619
+ extraTopPadding: b,
3620
+ suggestions: f,
3617
3621
  inputPlaceholder: k
3618
3622
  }
3619
3623
  ) })
3620
3624
  ] })
3621
3625
  ] }) : /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3622
- o === "selector" && /* @__PURE__ */ d(
3626
+ o === "selector" && /* @__PURE__ */ h(
3623
3627
  et,
3624
3628
  {
3625
3629
  currentModel: _ || "",
@@ -3627,17 +3631,17 @@ const di = ({ config: e }) => {
3627
3631
  modelsLoading: O,
3628
3632
  modelsError: Q,
3629
3633
  onModelChange: X,
3630
- showThemeToggle: b,
3634
+ showThemeToggle: g,
3631
3635
  theme: x
3632
3636
  }
3633
3637
  ),
3634
- /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
3638
+ /* @__PURE__ */ h("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ h(
3635
3639
  Xe,
3636
3640
  {
3637
- welcomeTitle: c,
3641
+ welcomeTitle: s,
3638
3642
  welcomeSubtitle: p,
3639
- extraTopPadding: g,
3640
- suggestions: h
3643
+ extraTopPadding: b,
3644
+ suggestions: f
3641
3645
  }
3642
3646
  ) })
3643
3647
  ] }) })
@@ -3672,7 +3676,7 @@ function xi(e) {
3672
3676
  theme: e.theme,
3673
3677
  containerClass: e.className
3674
3678
  };
3675
- return /* @__PURE__ */ d(di, { config: r });
3679
+ return /* @__PURE__ */ h(di, { config: r });
3676
3680
  }
3677
3681
  export {
3678
3682
  xi as CuadraChat