@cuadra-ai/uikit 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,23 +1,23 @@
1
- var jt = Object.defineProperty;
2
- var $t = (e, r, t) => r in e ? jt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
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";
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
- import { createPortal as $e } from "react-dom";
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";
8
- import { unstable_memoizeMarkdownComponents as Vt, useIsMarkdownCodeBlock as Gt, MarkdownTextPrimitive as Zt } from "@assistant-ui/react-markdown";
9
- const Jt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Qt = (e) => e.replace(
1
+ var Ut = Object.defineProperty;
2
+ var Bt = (e, r, t) => r in e ? Ut(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var le = (e, r, t) => Bt(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { jsx as d, Fragment as U, jsxs as T } from "react/jsx-runtime";
5
+ import $e, { forwardRef as rt, createElement as Ne, useMemo as B, useState as I, useEffect as L, useCallback as J, memo as Wt, useRef as nt, createContext as Ht } from "react";
6
+ import { createPortal as Oe } from "react-dom";
7
+ import { useThreadListItem as at, RuntimeAdapterProvider as qt, useLocalRuntime as it, AssistantRuntimeProvider as ot, unstable_useRemoteThreadListRuntime as Kt, useThreadRuntime as Vt, ThreadPrimitive as te, ComposerPrimitive as ke, useAssistantApi as Gt, MessagePrimitive as se, ThreadListPrimitive as xe, useThread as Zt, ThreadListItemPrimitive as we } from "@assistant-ui/react";
8
+ import { unstable_memoizeMarkdownComponents as Jt, useIsMarkdownCodeBlock as Qt, MarkdownTextPrimitive as Xt } from "@assistant-ui/react-markdown";
9
+ const Yt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), er = (e) => e.replace(
10
10
  /^([A-Z])|[\s-_]+(\w)/g,
11
11
  (r, t, n) => n ? n.toUpperCase() : t.toLowerCase()
12
- ), Oe = (e) => {
13
- const r = Qt(e);
12
+ ), Ue = (e) => {
13
+ const r = er(e);
14
14
  return r.charAt(0).toUpperCase() + r.slice(1);
15
- }, it = (...e) => e.filter((r, t, n) => !!r && r.trim() !== "" && n.indexOf(r) === t).join(" ").trim(), Xt = (e) => {
15
+ }, lt = (...e) => e.filter((r, t, n) => !!r && r.trim() !== "" && n.indexOf(r) === t).join(" ").trim(), tr = (e) => {
16
16
  for (const r in e)
17
17
  if (r.startsWith("aria-") || r === "role" || r === "title")
18
18
  return !0;
19
19
  };
20
- var Yt = {
20
+ var rr = {
21
21
  xmlns: "http://www.w3.org/2000/svg",
22
22
  width: 24,
23
23
  height: 24,
@@ -28,7 +28,7 @@ var Yt = {
28
28
  strokeLinecap: "round",
29
29
  strokeLinejoin: "round"
30
30
  };
31
- const er = tt(
31
+ const nr = rt(
32
32
  ({
33
33
  color: e = "currentColor",
34
34
  size: r = 24,
@@ -42,66 +42,66 @@ const er = tt(
42
42
  "svg",
43
43
  {
44
44
  ref: l,
45
- ...Yt,
45
+ ...rr,
46
46
  width: r,
47
47
  height: r,
48
48
  stroke: e,
49
49
  strokeWidth: n ? Number(t) * 24 / Number(r) : t,
50
- className: it("lucide", i),
51
- ...!o && !Xt(u) && { "aria-hidden": "true" },
50
+ className: lt("lucide", i),
51
+ ...!o && !tr(u) && { "aria-hidden": "true" },
52
52
  ...u
53
53
  },
54
54
  [
55
- ...a.map(([s, f]) => Ne(s, f)),
55
+ ...a.map(([c, f]) => Ne(c, f)),
56
56
  ...Array.isArray(o) ? o : [o]
57
57
  ]
58
58
  )
59
59
  );
60
60
  const j = (e, r) => {
61
- const t = tt(
62
- ({ className: n, ...i }, o) => Ne(er, {
61
+ const t = rt(
62
+ ({ className: n, ...i }, o) => Ne(nr, {
63
63
  ref: o,
64
64
  iconNode: r,
65
- className: it(
66
- `lucide-${Jt(Oe(e))}`,
65
+ className: lt(
66
+ `lucide-${Yt(Ue(e))}`,
67
67
  `lucide-${e}`,
68
68
  n
69
69
  ),
70
70
  ...i
71
71
  })
72
72
  );
73
- return t.displayName = Oe(e), t;
73
+ return t.displayName = Ue(e), t;
74
74
  };
75
- const tr = [
75
+ const ar = [
76
76
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
77
77
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
78
- ], rr = j("arrow-up", tr);
79
- const nr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], ar = j("check", nr);
80
- const ir = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], or = j("chevron-down", ir);
81
- const lr = [
78
+ ], ir = j("arrow-up", ar);
79
+ const or = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], lr = j("check", or);
80
+ const ur = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], cr = j("chevron-down", ur);
81
+ const sr = [
82
82
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
83
83
  ["path", { d: "M12 18a6 6 0 0 0 0-12v12z", key: "j4l70d" }]
84
- ], ur = j("contrast", lr);
85
- const cr = [
84
+ ], dr = j("contrast", sr);
85
+ const fr = [
86
86
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
87
87
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
88
- ], sr = j("copy", cr);
89
- const dr = [
88
+ ], hr = j("copy", fr);
89
+ const mr = [
90
90
  ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
91
91
  ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
92
92
  ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
93
- ], fr = j("ellipsis-vertical", dr);
94
- const hr = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ot = j("loader-circle", hr);
95
- const mr = [
93
+ ], pr = j("ellipsis-vertical", mr);
94
+ const gr = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ut = j("loader-circle", gr);
95
+ const br = [
96
96
  ["path", { d: "M4 5h16", key: "1tepv9" }],
97
97
  ["path", { d: "M4 12h16", key: "1lakjw" }],
98
98
  ["path", { d: "M4 19h16", key: "1djgab" }]
99
- ], pr = j("menu", mr);
100
- const gr = [
99
+ ], kr = j("menu", br);
100
+ const xr = [
101
101
  ["path", { d: "M5 12h14", key: "1ays0h" }],
102
102
  ["path", { d: "M12 5v14", key: "s699le" }]
103
- ], br = j("plus", gr);
104
- class lt {
103
+ ], wr = j("plus", xr);
104
+ class ct {
105
105
  constructor(r, t, n = !1) {
106
106
  le(this, "baseUrl");
107
107
  le(this, "sessionToken", null);
@@ -225,23 +225,23 @@ class lt {
225
225
  });
226
226
  if (!l.ok) {
227
227
  const f = await l.text();
228
- let c = {};
228
+ let s = {};
229
229
  try {
230
- c = JSON.parse(f);
230
+ s = JSON.parse(f);
231
231
  } catch {
232
- c = { detail: f };
232
+ s = { detail: f };
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
  }
@@ -311,7 +311,7 @@ class lt {
311
311
  return i.json();
312
312
  }
313
313
  }
314
- async function* kr(e, r) {
314
+ async function* yr(e, r) {
315
315
  const t = e.getReader(), n = new TextDecoder();
316
316
  let i = "";
317
317
  try {
@@ -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
  }
@@ -344,7 +344,7 @@ async function* kr(e, r) {
344
344
  t.releaseLock();
345
345
  }
346
346
  }
347
- function xr(e) {
347
+ function Cr(e) {
348
348
  return e.map((r) => {
349
349
  let t = "";
350
350
  if (typeof r.content == "string")
@@ -359,34 +359,66 @@ function xr(e) {
359
359
  };
360
360
  });
361
361
  }
362
- function wr(e, r) {
363
- const { modelId: t, systemPrompt: n, ephemeral: i, onChatCreated: o, onUserMessage: a } = r;
362
+ function vr(e) {
363
+ return {
364
+ id: e.id,
365
+ role: e.role,
366
+ content: [
367
+ {
368
+ type: "text",
369
+ text: e.content
370
+ }
371
+ ],
372
+ createdAt: new Date(e.createdAt),
373
+ metadata: {
374
+ custom: {}
375
+ },
376
+ ...e.role === "assistant" && {
377
+ status: {
378
+ type: "complete",
379
+ reason: "stop"
380
+ },
381
+ metadata: {
382
+ unstable_state: null,
383
+ unstable_annotations: [],
384
+ unstable_data: [],
385
+ steps: [],
386
+ custom: {}
387
+ }
388
+ },
389
+ ...e.role === "user" && {
390
+ attachments: []
391
+ }
392
+ };
393
+ }
394
+ function st(e, r) {
395
+ const { modelId: t, systemPrompt: n, ephemeral: i, onChatCreated: o, onUserMessage: a, onThreadIdUpdate: u } = r;
364
396
  return {
365
- async *run(u) {
366
- const { messages: l, abortSignal: s } = u;
397
+ async *run(l) {
398
+ const { messages: c, abortSignal: f, context: s } = l, p = s?.threadId;
367
399
  a?.();
368
- const c = {
369
- messages: xr(l),
400
+ const h = {
401
+ messages: Cr(c),
370
402
  chatId: null,
371
403
  // Thread ID will be set by runtime if needed
372
404
  systemPrompt: n,
373
405
  ephemeral: i,
374
406
  stream: !0
375
407
  };
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)
408
+ t && t.trim() !== "" && (h.modelId = t);
409
+ const k = await e.createOrContinueChat(h, f);
410
+ let g = "", x;
411
+ for await (const w of yr(k, f)) {
412
+ if (f?.aborted)
381
413
  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;
414
+ const y = w.id;
415
+ y && !x && (x = y, o?.(y), p && u && u(p, y));
416
+ const A = w.delta;
417
+ if (A != null && (g += A), w.type === "message" || w.content) {
418
+ const C = w.content || "";
419
+ g += C;
388
420
  }
389
- if (k.message && (g += k.message.content || ""), k.tool_calls, k.finished) {
421
+ if (w.message && (g += w.message.content || ""), w.tool_calls, w.finished) {
390
422
  g && (yield {
391
423
  content: [{ type: "text", text: g }]
392
424
  });
@@ -402,8 +434,8 @@ function wr(e, r) {
402
434
  }
403
435
  };
404
436
  }
405
- const Ue = /* @__PURE__ */ new Map();
406
- function yr(e, r) {
437
+ const Be = /* @__PURE__ */ new Map();
438
+ function Tr(e, r) {
407
439
  return {
408
440
  async list() {
409
441
  const t = [];
@@ -424,7 +456,7 @@ function yr(e, r) {
424
456
  }).filter((u) => u !== null) };
425
457
  },
426
458
  async initialize(t) {
427
- return { remoteId: Ue.get(t) || t, externalId: void 0 };
459
+ return { remoteId: Be.get(t) || t, externalId: void 0 };
428
460
  },
429
461
  async rename(t, n) {
430
462
  await e.updateChat(t, { title: n });
@@ -460,11 +492,31 @@ function yr(e, r) {
460
492
  },
461
493
  // Add a method to update the remoteId mapping when chat ID is received
462
494
  updateRemoteId(t, n) {
463
- Ue.set(t, n), r?.(t, n);
495
+ Be.set(t, n), r?.(t, n);
496
+ },
497
+ // Provider component that adds thread-specific history adapter
498
+ unstable_Provider: ({ children: t }) => {
499
+ const i = at()?.remoteId, o = $e.useMemo(
500
+ () => ({
501
+ async load() {
502
+ if (!i) return { messages: [] };
503
+ try {
504
+ const u = await e.getChat(i);
505
+ return !u.messages || u.messages.length === 0 ? { messages: [] } : { messages: u.messages.map((c) => vr(c)) };
506
+ } catch (u) {
507
+ return console.error("Failed to load messages for thread:", i, u), { messages: [] };
508
+ }
509
+ },
510
+ async append(u) {
511
+ }
512
+ }),
513
+ [i, e]
514
+ ), a = $e.useMemo(() => ({ history: o }), [o]);
515
+ return /* @__PURE__ */ d(qt, { adapters: a, children: t });
464
516
  }
465
517
  };
466
518
  }
467
- function Cr({
519
+ function Ar({
468
520
  children: e,
469
521
  baseUrl: r,
470
522
  sessionToken: t,
@@ -474,44 +526,50 @@ function Cr({
474
526
  onModelChange: a,
475
527
  ephemeral: u = !1,
476
528
  systemPrompt: l,
477
- initialThreadId: s,
529
+ initialThreadId: c,
478
530
  onError: f,
479
- onChatCreated: c,
531
+ onChatCreated: s,
480
532
  onUserMessage: p,
481
- onThreadIdUpdate: g,
533
+ onThreadIdUpdate: b,
482
534
  onChatsLoaded: h
483
535
  }) {
484
- const k = W(
485
- () => new lt(r, t || void 0, n),
536
+ const k = B(
537
+ () => new ct(r, t || void 0, n),
486
538
  [r, t, n]
487
- ), [b, x] = N(o || null);
488
- M(() => {
539
+ ), [g, x] = I(o || null);
540
+ L(() => {
489
541
  o && x(o);
490
542
  }, [o]);
491
- const w = te(
492
- (C) => {
493
- c?.(C);
543
+ const w = J(
544
+ (v) => {
545
+ s?.(v);
494
546
  },
495
- [c]
496
- ), y = te(
497
- (C, L) => {
498
- g?.(C, L);
547
+ [s]
548
+ ), y = J(
549
+ (v, C) => {
550
+ b?.(v, C);
499
551
  },
500
- [g]
501
- ), A = W(() => wr(k, {
502
- modelId: b || void 0,
552
+ [b]
553
+ ), A = B(() => st(k, {
554
+ modelId: g || void 0,
503
555
  // Pass undefined if not set (backend resolves it)
504
556
  systemPrompt: l,
505
557
  ephemeral: u,
506
558
  onChatCreated: w,
507
559
  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(
510
- vr,
560
+ }), [k, g, l, u, w, p]);
561
+ return i === "singleChat" ? /* @__PURE__ */ d(Ir, { modelAdapter: A, children: e }) : /* @__PURE__ */ d(
562
+ Nr,
511
563
  {
512
564
  client: k,
513
- modelAdapter: A,
514
- initialThreadId: s,
565
+ modelAdapterOptions: {
566
+ modelId: g || void 0,
567
+ systemPrompt: l,
568
+ ephemeral: u,
569
+ onChatCreated: w,
570
+ onUserMessage: p
571
+ },
572
+ initialThreadId: c,
515
573
  onChatsLoaded: h,
516
574
  onThreadIdUpdate: y,
517
575
  onError: f,
@@ -519,36 +577,55 @@ function Cr({
519
577
  }
520
578
  );
521
579
  }
522
- function vr({
580
+ function Ir({
581
+ modelAdapter: e,
582
+ children: r
583
+ }) {
584
+ const [t, n] = I(!1);
585
+ L(() => {
586
+ n(!0);
587
+ }, []);
588
+ const i = it(e);
589
+ return t ? /* @__PURE__ */ d(ot, { runtime: i, children: r }) : /* @__PURE__ */ d(U, { children: r });
590
+ }
591
+ function Nr({
523
592
  client: e,
524
- modelAdapter: r,
593
+ modelAdapterOptions: r,
525
594
  initialThreadId: t,
526
595
  onChatsLoaded: n,
527
596
  onThreadIdUpdate: i,
528
597
  onError: o,
529
598
  children: a
530
599
  }) {
531
- const u = W(() => yr(e, (c, p) => {
532
- i?.(c, p);
533
- }), [e, i]), l = W(() => ({
600
+ const u = B(() => Tr(e, (b, h) => {
601
+ i?.(b, h);
602
+ }), [e, i]), l = J(
603
+ (b, h) => {
604
+ u.updateRemoteId && u.updateRemoteId(b, h), i?.(b, h);
605
+ },
606
+ [u, i]
607
+ ), c = B(() => ({
534
608
  ...u,
535
609
  async list() {
536
- const c = await u.list();
537
- return n?.(), c;
610
+ const b = await u.list();
611
+ return n?.(), b;
538
612
  }
539
613
  }), [u, n]);
540
- M(() => {
541
- window.__cuadraThreadListAdapter = l, window.__cuadraThreadListRuntime = null;
542
- }, [l]);
543
- const s = te(() => nt(r), [r]), f = Bt({
544
- adapter: l,
614
+ L(() => {
615
+ window.__cuadraThreadListAdapter = c, window.__cuadraThreadListRuntime = null;
616
+ }, [c]);
617
+ const f = B(() => st(e, {
618
+ ...r,
619
+ onThreadIdUpdate: l
620
+ }), [e, r, l]), s = J(() => it(f), [f]), p = Kt({
621
+ adapter: c,
545
622
  runtimeHook: s
546
623
  });
547
- return M(() => {
548
- window.__cuadraThreadListRuntime = f;
549
- }, [f]), /* @__PURE__ */ d(at, { runtime: f, children: a });
624
+ return L(() => {
625
+ window.__cuadraThreadListRuntime = p;
626
+ }, [p]), /* @__PURE__ */ d(ot, { runtime: p, children: a });
550
627
  }
551
- function Be(e, r) {
628
+ function We(e, r) {
552
629
  const t = String(e);
553
630
  if (typeof r != "string")
554
631
  throw new TypeError("Expected character");
@@ -558,7 +635,7 @@ function Be(e, r) {
558
635
  return n;
559
636
  }
560
637
  const re = me(/[A-Za-z]/), Me = me(/[\dA-Za-z]/);
561
- function Tr(e) {
638
+ function Sr(e) {
562
639
  return (
563
640
  // Special whitespace codes (which have negative values), C0 and Control
564
641
  // character DEL
@@ -568,7 +645,7 @@ function Tr(e) {
568
645
  function Z(e) {
569
646
  return e !== null && e < -2;
570
647
  }
571
- function D(e) {
648
+ function M(e) {
572
649
  return e !== null && (e < 0 || e === 32);
573
650
  }
574
651
  function F(e) {
@@ -581,7 +658,7 @@ function me(e) {
581
658
  return t !== null && t > -1 && e.test(String.fromCharCode(t));
582
659
  }
583
660
  }
584
- function Ar(e) {
661
+ function Lr(e) {
585
662
  if (typeof e != "string")
586
663
  throw new TypeError("Expected a string");
587
664
  return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
@@ -603,24 +680,24 @@ const pe = (
603
680
  */
604
681
  (function(e) {
605
682
  if (e == null)
606
- return Lr;
683
+ return Rr;
607
684
  if (typeof e == "function")
608
685
  return ge(e);
609
686
  if (typeof e == "object")
610
- return Array.isArray(e) ? Ir(e) : (
687
+ return Array.isArray(e) ? Mr(e) : (
611
688
  // Cast because `ReadonlyArray` goes into the above but `isArray`
612
689
  // narrows to `Array`.
613
- Nr(
690
+ Dr(
614
691
  /** @type {Props} */
615
692
  e
616
693
  )
617
694
  );
618
695
  if (typeof e == "string")
619
- return Sr(e);
696
+ return Pr(e);
620
697
  throw new Error("Expected function, string, or object as test");
621
698
  })
622
699
  );
623
- function Ir(e) {
700
+ function Mr(e) {
624
701
  const r = [];
625
702
  let t = -1;
626
703
  for (; ++t < e.length; )
@@ -633,7 +710,7 @@ function Ir(e) {
633
710
  return !1;
634
711
  }
635
712
  }
636
- function Nr(e) {
713
+ function Dr(e) {
637
714
  const r = (
638
715
  /** @type {Record<string, unknown>} */
639
716
  e
@@ -651,7 +728,7 @@ function Nr(e) {
651
728
  return !0;
652
729
  }
653
730
  }
654
- function Sr(e) {
731
+ function Pr(e) {
655
732
  return ge(r);
656
733
  function r(t) {
657
734
  return t && t.type === e;
@@ -660,7 +737,7 @@ function Sr(e) {
660
737
  function ge(e) {
661
738
  return r;
662
739
  function r(t, n, i) {
663
- return !!(Mr(t) && e.call(
740
+ return !!(Er(t) && e.call(
664
741
  this,
665
742
  t,
666
743
  typeof n == "number" ? n : void 0,
@@ -668,105 +745,105 @@ function ge(e) {
668
745
  ));
669
746
  }
670
747
  }
671
- function Lr() {
748
+ function Rr() {
672
749
  return !0;
673
750
  }
674
- function Mr(e) {
751
+ function Er(e) {
675
752
  return e !== null && typeof e == "object" && "type" in e;
676
753
  }
677
- const ut = [], Dr = !0, Se = !1, Pr = "skip";
678
- function ct(e, r, t, n) {
754
+ const dt = [], _r = !0, Se = !1, Fr = "skip";
755
+ function ft(e, r, t, n) {
679
756
  let i;
680
757
  typeof r == "function" && typeof t != "function" ? (n = t, t = r) : i = r;
681
758
  const o = pe(i), a = n ? -1 : 1;
682
759
  u(e, void 0, [])();
683
- function u(l, s, f) {
684
- const c = (
760
+ function u(l, c, f) {
761
+ const s = (
685
762
  /** @type {Record<string, unknown>} */
686
763
  l && typeof l == "object" ? l : {}
687
764
  );
688
- if (typeof c.type == "string") {
689
- const g = (
765
+ if (typeof s.type == "string") {
766
+ const b = (
690
767
  // `hast`
691
- typeof c.tagName == "string" ? c.tagName : (
768
+ typeof s.tagName == "string" ? s.tagName : (
692
769
  // `xast`
693
- typeof c.name == "string" ? c.name : void 0
770
+ typeof s.name == "string" ? s.name : void 0
694
771
  )
695
772
  );
696
773
  Object.defineProperty(p, "name", {
697
- value: "node (" + (l.type + (g ? "<" + g + ">" : "")) + ")"
774
+ value: "node (" + (l.type + (b ? "<" + b + ">" : "")) + ")"
698
775
  });
699
776
  }
700
777
  return p;
701
778
  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;
779
+ let b = dt, h, k, g;
780
+ if ((!r || o(l, c, f[f.length - 1] || void 0)) && (b = zr(t(l, f)), b[0] === Se))
781
+ return b;
705
782
  if ("children" in l && l.children) {
706
783
  const x = (
707
784
  /** @type {UnistParent} */
708
785
  l
709
786
  );
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; ) {
787
+ if (x.children && b[0] !== Fr)
788
+ for (k = (n ? x.children.length : -1) + a, g = f.concat(x); k > -1 && k < x.children.length; ) {
712
789
  const w = x.children[k];
713
- if (h = u(w, k, b)(), h[0] === Se)
790
+ if (h = u(w, k, g)(), h[0] === Se)
714
791
  return h;
715
792
  k = typeof h[1] == "number" ? h[1] : k + a;
716
793
  }
717
794
  }
718
- return g;
795
+ return b;
719
796
  }
720
797
  }
721
798
  }
722
- function Rr(e) {
723
- return Array.isArray(e) ? e : typeof e == "number" ? [Dr, e] : e == null ? ut : [e];
799
+ function zr(e) {
800
+ return Array.isArray(e) ? e : typeof e == "number" ? [_r, e] : e == null ? dt : [e];
724
801
  }
725
- function Er(e, r, t) {
726
- const i = pe((t || {}).ignore || []), o = _r(r);
802
+ function jr(e, r, t) {
803
+ const i = pe((t || {}).ignore || []), o = $r(r);
727
804
  let a = -1;
728
805
  for (; ++a < o.length; )
729
- 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;
806
+ ft(e, "text", u);
807
+ function u(c, f) {
808
+ let s = -1, p;
809
+ for (; ++s < f.length; ) {
810
+ const b = f[s], h = p ? p.children : void 0;
734
811
  if (i(
735
- g,
736
- h ? h.indexOf(g) : void 0,
812
+ b,
813
+ h ? h.indexOf(b) : void 0,
737
814
  p
738
815
  ))
739
816
  return;
740
- p = g;
817
+ p = b;
741
818
  }
742
819
  if (p)
743
- return l(s, f);
820
+ return l(c, f);
744
821
  }
745
- function l(s, f) {
746
- const c = f[f.length - 1], p = o[a][0], g = o[a][1];
822
+ function l(c, f) {
823
+ const s = f[f.length - 1], p = o[a][0], b = o[a][1];
747
824
  let h = 0;
748
- const b = c.children.indexOf(s);
825
+ const g = s.children.indexOf(c);
749
826
  let x = !1, w = [];
750
827
  p.lastIndex = 0;
751
- let y = p.exec(s.value);
828
+ let y = p.exec(c.value);
752
829
  for (; y; ) {
753
- const A = y.index, T = {
830
+ const A = y.index, v = {
754
831
  index: y.index,
755
832
  input: y.input,
756
- stack: [...f, s]
833
+ stack: [...f, c]
757
834
  };
758
- let C = g(...y, T);
835
+ let C = b(...y, v);
759
836
  if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = A + 1 : (h !== A && w.push({
760
837
  type: "text",
761
- value: s.value.slice(h, A)
838
+ value: c.value.slice(h, A)
762
839
  }), Array.isArray(C) ? w.push(...C) : C && w.push(C), h = A + y[0].length, x = !0), !p.global)
763
840
  break;
764
- y = p.exec(s.value);
841
+ y = p.exec(c.value);
765
842
  }
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;
843
+ return x ? (h < c.value.length && w.push({ type: "text", value: c.value.slice(h) }), s.children.splice(g, 1, ...w)) : w = [c], g + w.length;
767
844
  }
768
845
  }
769
- function _r(e) {
846
+ function $r(e) {
770
847
  const r = [];
771
848
  if (!Array.isArray(e))
772
849
  throw new TypeError("Expected find and replace tuple or list of tuples");
@@ -774,37 +851,37 @@ function _r(e) {
774
851
  let n = -1;
775
852
  for (; ++n < t.length; ) {
776
853
  const i = t[n];
777
- r.push([Fr(i[0]), zr(i[1])]);
854
+ r.push([Or(i[0]), Ur(i[1])]);
778
855
  }
779
856
  return r;
780
857
  }
781
- function Fr(e) {
782
- return typeof e == "string" ? new RegExp(Ar(e), "g") : e;
858
+ function Or(e) {
859
+ return typeof e == "string" ? new RegExp(Lr(e), "g") : e;
783
860
  }
784
- function zr(e) {
861
+ function Ur(e) {
785
862
  return typeof e == "function" ? e : function() {
786
863
  return e;
787
864
  };
788
865
  }
789
866
  const ye = "phrasing", Ce = ["autolink", "link", "image", "label"];
790
- function jr() {
867
+ function Br() {
791
868
  return {
792
- transforms: [qr],
869
+ transforms: [Zr],
793
870
  enter: {
794
- literalAutolink: Or,
871
+ literalAutolink: Hr,
795
872
  literalAutolinkEmail: ve,
796
873
  literalAutolinkHttp: ve,
797
874
  literalAutolinkWww: ve
798
875
  },
799
876
  exit: {
800
- literalAutolink: Hr,
801
- literalAutolinkEmail: Wr,
802
- literalAutolinkHttp: Ur,
803
- literalAutolinkWww: Br
877
+ literalAutolink: Gr,
878
+ literalAutolinkEmail: Vr,
879
+ literalAutolinkHttp: qr,
880
+ literalAutolinkWww: Kr
804
881
  }
805
882
  };
806
883
  }
807
- function $r() {
884
+ function Wr() {
808
885
  return {
809
886
  unsafe: [
810
887
  {
@@ -831,41 +908,41 @@ function $r() {
831
908
  ]
832
909
  };
833
910
  }
834
- function Or(e) {
911
+ function Hr(e) {
835
912
  this.enter({ type: "link", title: null, url: "", children: [] }, e);
836
913
  }
837
914
  function ve(e) {
838
915
  this.config.enter.autolinkProtocol.call(this, e);
839
916
  }
840
- function Ur(e) {
917
+ function qr(e) {
841
918
  this.config.exit.autolinkProtocol.call(this, e);
842
919
  }
843
- function Br(e) {
920
+ function Kr(e) {
844
921
  this.config.exit.data.call(this, e);
845
922
  const r = this.stack[this.stack.length - 1];
846
923
  r.type, r.url = "http://" + this.sliceSerialize(e);
847
924
  }
848
- function Wr(e) {
925
+ function Vr(e) {
849
926
  this.config.exit.autolinkEmail.call(this, e);
850
927
  }
851
- function Hr(e) {
928
+ function Gr(e) {
852
929
  this.exit(e);
853
930
  }
854
- function qr(e) {
855
- Er(
931
+ function Zr(e) {
932
+ jr(
856
933
  e,
857
934
  [
858
- [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Kr],
859
- [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Vr]
935
+ [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, Jr],
936
+ [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, Qr]
860
937
  ],
861
938
  { ignore: ["link", "linkReference"] }
862
939
  );
863
940
  }
864
- function Kr(e, r, t, n, i) {
941
+ function Jr(e, r, t, n, i) {
865
942
  let o = "";
866
- if (!st(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !Gr(t)))
943
+ if (!ht(i) || (/^w/i.test(r) && (t = r + t, r = "", o = "http://"), !Xr(t)))
867
944
  return !1;
868
- const a = Zr(t + n);
945
+ const a = Yr(t + n);
869
946
  if (!a[0]) return !1;
870
947
  const u = {
871
948
  type: "link",
@@ -875,10 +952,10 @@ function Kr(e, r, t, n, i) {
875
952
  };
876
953
  return a[1] ? [u, { type: "text", value: a[1] }] : u;
877
954
  }
878
- function Vr(e, r, t, n) {
955
+ function Qr(e, r, t, n) {
879
956
  return (
880
957
  // Not an expected previous character.
881
- !st(n, !0) || // Label ends in not allowed character.
958
+ !ht(n, !0) || // Label ends in not allowed character.
882
959
  /[-\d_]$/.test(t) ? !1 : {
883
960
  type: "link",
884
961
  title: null,
@@ -887,23 +964,23 @@ function Vr(e, r, t, n) {
887
964
  }
888
965
  );
889
966
  }
890
- function Gr(e) {
967
+ function Xr(e) {
891
968
  const r = e.split(".");
892
969
  return !(r.length < 2 || r[r.length - 1] && (/_/.test(r[r.length - 1]) || !/[a-zA-Z\d]/.test(r[r.length - 1])) || r[r.length - 2] && (/_/.test(r[r.length - 2]) || !/[a-zA-Z\d]/.test(r[r.length - 2])));
893
970
  }
894
- function Zr(e) {
971
+ function Yr(e) {
895
972
  const r = /[!"&'),.:;<>?\]}]+$/.exec(e);
896
973
  if (!r)
897
974
  return [e, void 0];
898
975
  e = e.slice(0, r.index);
899
976
  let t = r[0], n = t.indexOf(")");
900
- const i = Be(e, "(");
901
- let o = Be(e, ")");
977
+ const i = We(e, "(");
978
+ let o = We(e, ")");
902
979
  for (; n !== -1 && i > o; )
903
980
  e += t.slice(0, n + 1), t = t.slice(n + 1), n = t.indexOf(")"), o++;
904
981
  return [e, t];
905
982
  }
906
- function st(e, r) {
983
+ function ht(e, r) {
907
984
  const t = e.input.charCodeAt(e.index - 1);
908
985
  return (e.index === 0 || H(t) || he(t)) && // If it’s an email, the previous character should not be a slash.
909
986
  (!r || t !== 47);
@@ -911,44 +988,44 @@ function st(e, r) {
911
988
  function ae(e) {
912
989
  return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
913
990
  }
914
- dt.peek = an;
915
- function Jr() {
991
+ mt.peek = cn;
992
+ function en() {
916
993
  this.buffer();
917
994
  }
918
- function Qr(e) {
995
+ function tn(e) {
919
996
  this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
920
997
  }
921
- function Xr() {
998
+ function rn() {
922
999
  this.buffer();
923
1000
  }
924
- function Yr(e) {
1001
+ function nn(e) {
925
1002
  this.enter(
926
1003
  { type: "footnoteDefinition", identifier: "", label: "", children: [] },
927
1004
  e
928
1005
  );
929
1006
  }
930
- function en(e) {
1007
+ function an(e) {
931
1008
  const r = this.resume(), t = this.stack[this.stack.length - 1];
932
1009
  t.type, t.identifier = ae(
933
1010
  this.sliceSerialize(e)
934
1011
  ).toLowerCase(), t.label = r;
935
1012
  }
936
- function tn(e) {
1013
+ function on(e) {
937
1014
  this.exit(e);
938
1015
  }
939
- function rn(e) {
1016
+ function ln(e) {
940
1017
  const r = this.resume(), t = this.stack[this.stack.length - 1];
941
1018
  t.type, t.identifier = ae(
942
1019
  this.sliceSerialize(e)
943
1020
  ).toLowerCase(), t.label = r;
944
1021
  }
945
- function nn(e) {
1022
+ function un(e) {
946
1023
  this.exit(e);
947
1024
  }
948
- function an() {
1025
+ function cn() {
949
1026
  return "[";
950
1027
  }
951
- function dt(e, r, t, n) {
1028
+ function mt(e, r, t, n) {
952
1029
  const i = t.createTracker(n);
953
1030
  let o = i.move("[^");
954
1031
  const a = t.enter("footnoteReference"), u = t.enter("reference");
@@ -956,51 +1033,51 @@ function dt(e, r, t, n) {
956
1033
  t.safe(t.associationId(e), { after: "]", before: o })
957
1034
  ), u(), a(), o += i.move("]"), o;
958
1035
  }
959
- function on() {
1036
+ function sn() {
960
1037
  return {
961
1038
  enter: {
962
- gfmFootnoteCallString: Jr,
963
- gfmFootnoteCall: Qr,
964
- gfmFootnoteDefinitionLabelString: Xr,
965
- gfmFootnoteDefinition: Yr
966
- },
967
- exit: {
968
1039
  gfmFootnoteCallString: en,
969
1040
  gfmFootnoteCall: tn,
970
1041
  gfmFootnoteDefinitionLabelString: rn,
971
1042
  gfmFootnoteDefinition: nn
1043
+ },
1044
+ exit: {
1045
+ gfmFootnoteCallString: an,
1046
+ gfmFootnoteCall: on,
1047
+ gfmFootnoteDefinitionLabelString: ln,
1048
+ gfmFootnoteDefinition: un
972
1049
  }
973
1050
  };
974
1051
  }
975
- function ln(e) {
1052
+ function dn(e) {
976
1053
  let r = !1;
977
1054
  return e && e.firstLineBlank && (r = !0), {
978
- handlers: { footnoteDefinition: t, footnoteReference: dt },
1055
+ handlers: { footnoteDefinition: t, footnoteReference: mt },
979
1056
  // This is on by default already.
980
1057
  unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
981
1058
  };
982
1059
  function t(n, i, o, a) {
983
1060
  const u = o.createTracker(a);
984
1061
  let l = u.move("[^");
985
- const s = o.enter("footnoteDefinition"), f = o.enter("label");
1062
+ const c = o.enter("footnoteDefinition"), f = o.enter("label");
986
1063
  return l += u.move(
987
1064
  o.safe(o.associationId(n), { before: l, after: "]" })
988
1065
  ), f(), l += u.move("]:"), n.children && n.children.length > 0 && (u.shift(4), l += u.move(
989
1066
  (r ? `
990
1067
  ` : " ") + o.indentLines(
991
1068
  o.containerFlow(n, u.current()),
992
- r ? ft : un
1069
+ r ? pt : fn
993
1070
  )
994
- )), s(), l;
1071
+ )), c(), l;
995
1072
  }
996
1073
  }
997
- function un(e, r, t) {
998
- return r === 0 ? e : ft(e, r, t);
1074
+ function fn(e, r, t) {
1075
+ return r === 0 ? e : pt(e, r, t);
999
1076
  }
1000
- function ft(e, r, t) {
1077
+ function pt(e, r, t) {
1001
1078
  return (t ? "" : " ") + e;
1002
1079
  }
1003
- const cn = [
1080
+ const hn = [
1004
1081
  "autolink",
1005
1082
  "destinationLiteral",
1006
1083
  "destinationRaw",
@@ -1008,33 +1085,33 @@ const cn = [
1008
1085
  "titleQuote",
1009
1086
  "titleApostrophe"
1010
1087
  ];
1011
- ht.peek = mn;
1012
- function sn() {
1088
+ gt.peek = kn;
1089
+ function mn() {
1013
1090
  return {
1014
1091
  canContainEols: ["delete"],
1015
- enter: { strikethrough: fn },
1016
- exit: { strikethrough: hn }
1092
+ enter: { strikethrough: gn },
1093
+ exit: { strikethrough: bn }
1017
1094
  };
1018
1095
  }
1019
- function dn() {
1096
+ function pn() {
1020
1097
  return {
1021
1098
  unsafe: [
1022
1099
  {
1023
1100
  character: "~",
1024
1101
  inConstruct: "phrasing",
1025
- notInConstruct: cn
1102
+ notInConstruct: hn
1026
1103
  }
1027
1104
  ],
1028
- handlers: { delete: ht }
1105
+ handlers: { delete: gt }
1029
1106
  };
1030
1107
  }
1031
- function fn(e) {
1108
+ function gn(e) {
1032
1109
  this.enter({ type: "delete", children: [] }, e);
1033
1110
  }
1034
- function hn(e) {
1111
+ function bn(e) {
1035
1112
  this.exit(e);
1036
1113
  }
1037
- function ht(e, r, t, n) {
1114
+ function gt(e, r, t, n) {
1038
1115
  const i = t.createTracker(n), o = t.enter("strikethrough");
1039
1116
  let a = i.move("~~");
1040
1117
  return a += t.containerPhrasing(e, {
@@ -1043,66 +1120,66 @@ function ht(e, r, t, n) {
1043
1120
  after: "~"
1044
1121
  }), a += i.move("~~"), o(), a;
1045
1122
  }
1046
- function mn() {
1123
+ function kn() {
1047
1124
  return "~";
1048
1125
  }
1049
- function pn(e) {
1126
+ function xn(e) {
1050
1127
  return e.length;
1051
1128
  }
1052
- function gn(e, r) {
1053
- const t = r || {}, n = (t.align || []).concat(), i = t.stringLength || pn, o = [], a = [], u = [], l = [];
1054
- let s = 0, f = -1;
1129
+ function wn(e, r) {
1130
+ const t = r || {}, n = (t.align || []).concat(), i = t.stringLength || xn, o = [], a = [], u = [], l = [];
1131
+ let c = 0, f = -1;
1055
1132
  for (; ++f < e.length; ) {
1056
- const k = [], b = [];
1133
+ const k = [], g = [];
1057
1134
  let x = -1;
1058
- for (e[f].length > s && (s = e[f].length); ++x < e[f].length; ) {
1059
- const w = bn(e[f][x]);
1135
+ for (e[f].length > c && (c = e[f].length); ++x < e[f].length; ) {
1136
+ const w = yn(e[f][x]);
1060
1137
  if (t.alignDelimiters !== !1) {
1061
1138
  const y = i(w);
1062
- b[x] = y, (l[x] === void 0 || y > l[x]) && (l[x] = y);
1139
+ g[x] = y, (l[x] === void 0 || y > l[x]) && (l[x] = y);
1063
1140
  }
1064
1141
  k.push(w);
1065
1142
  }
1066
- a[f] = k, u[f] = b;
1143
+ a[f] = k, u[f] = g;
1067
1144
  }
1068
- let c = -1;
1145
+ let s = -1;
1069
1146
  if (typeof n == "object" && "length" in n)
1070
- for (; ++c < s; )
1071
- o[c] = We(n[c]);
1147
+ for (; ++s < c; )
1148
+ o[s] = He(n[s]);
1072
1149
  else {
1073
- 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 = ":");
1150
+ const k = He(n);
1151
+ for (; ++s < c; )
1152
+ o[s] = k;
1153
+ }
1154
+ s = -1;
1155
+ const p = [], b = [];
1156
+ for (; ++s < c; ) {
1157
+ const k = o[s];
1158
+ let g = "", x = "";
1159
+ k === 99 ? (g = ":", x = ":") : k === 108 ? g = ":" : k === 114 && (x = ":");
1083
1160
  let w = t.alignDelimiters === !1 ? 1 : Math.max(
1084
1161
  1,
1085
- l[c] - b.length - x.length
1162
+ l[s] - g.length - x.length
1086
1163
  );
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;
1164
+ const y = g + "-".repeat(w) + x;
1165
+ t.alignDelimiters !== !1 && (w = g.length + w + x.length, w > l[s] && (l[s] = w), b[s] = w), p[s] = y;
1089
1166
  }
1090
- a.splice(1, 0, p), u.splice(1, 0, g), f = -1;
1167
+ a.splice(1, 0, p), u.splice(1, 0, b), f = -1;
1091
1168
  const h = [];
1092
1169
  for (; ++f < a.length; ) {
1093
- const k = a[f], b = u[f];
1094
- c = -1;
1170
+ const k = a[f], g = u[f];
1171
+ s = -1;
1095
1172
  const x = [];
1096
- for (; ++c < s; ) {
1097
- const w = k[c] || "";
1173
+ for (; ++s < c; ) {
1174
+ const w = k[s] || "";
1098
1175
  let y = "", A = "";
1099
1176
  if (t.alignDelimiters !== !1) {
1100
- const T = l[c] - (b[c] || 0), C = o[c];
1101
- 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);
1177
+ const v = l[s] - (g[s] || 0), C = o[s];
1178
+ C === 114 ? y = " ".repeat(v) : C === 99 ? v % 2 ? (y = " ".repeat(v / 2 + 0.5), A = " ".repeat(v / 2 - 0.5)) : (y = " ".repeat(v / 2), A = y) : A = " ".repeat(v);
1102
1179
  }
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
1180
+ 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
1181
  // 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("|");
1182
+ !(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
1183
  }
1107
1184
  h.push(
1108
1185
  t.delimiterEnd === !1 ? x.join("").replace(/ +$/, "") : x.join("")
@@ -1111,29 +1188,29 @@ function gn(e, r) {
1111
1188
  return h.join(`
1112
1189
  `);
1113
1190
  }
1114
- function bn(e) {
1191
+ function yn(e) {
1115
1192
  return e == null ? "" : String(e);
1116
1193
  }
1117
- function We(e) {
1194
+ function He(e) {
1118
1195
  const r = typeof e == "string" ? e.codePointAt(0) : 0;
1119
1196
  return r === 67 || r === 99 ? 99 : r === 76 || r === 108 ? 108 : r === 82 || r === 114 ? 114 : 0;
1120
1197
  }
1121
- function kn(e, r, t, n) {
1198
+ function Cn(e, r, t, n) {
1122
1199
  const i = t.enter("blockquote"), o = t.createTracker(n);
1123
1200
  o.move("> "), o.shift(2);
1124
1201
  const a = t.indentLines(
1125
1202
  t.containerFlow(e, o.current()),
1126
- xn
1203
+ vn
1127
1204
  );
1128
1205
  return i(), a;
1129
1206
  }
1130
- function xn(e, r, t) {
1207
+ function vn(e, r, t) {
1131
1208
  return ">" + (t ? "" : " ") + e;
1132
1209
  }
1133
- function wn(e, r) {
1134
- return He(e, r.inConstruct, !0) && !He(e, r.notInConstruct, !1);
1210
+ function Tn(e, r) {
1211
+ return qe(e, r.inConstruct, !0) && !qe(e, r.notInConstruct, !1);
1135
1212
  }
1136
- function He(e, r, t) {
1213
+ function qe(e, r, t) {
1137
1214
  if (typeof r == "string" && (r = [r]), !r || r.length === 0)
1138
1215
  return t;
1139
1216
  let n = -1;
@@ -1142,16 +1219,16 @@ function He(e, r, t) {
1142
1219
  return !0;
1143
1220
  return !1;
1144
1221
  }
1145
- function qe(e, r, t, n) {
1222
+ function Ke(e, r, t, n) {
1146
1223
  let i = -1;
1147
1224
  for (; ++i < t.unsafe.length; )
1148
1225
  if (t.unsafe[i].character === `
1149
- ` && wn(t.stack, t.unsafe[i]))
1226
+ ` && Tn(t.stack, t.unsafe[i]))
1150
1227
  return /[ \t]/.test(n.before) ? "" : " ";
1151
1228
  return `\\
1152
1229
  `;
1153
1230
  }
1154
- function yn(e, r) {
1231
+ function An(e, r) {
1155
1232
  const t = String(e);
1156
1233
  let n = t.indexOf(r), i = n, o = 0, a = 0;
1157
1234
  if (typeof r != "string")
@@ -1160,13 +1237,13 @@ function yn(e, r) {
1160
1237
  n === i ? ++o > a && (a = o) : o = 1, i = n + r.length, n = t.indexOf(r, i);
1161
1238
  return a;
1162
1239
  }
1163
- function Cn(e, r) {
1240
+ function In(e, r) {
1164
1241
  return !!(r.options.fences === !1 && e.value && // If there’s no info…
1165
1242
  !e.lang && // And there’s a non-whitespace character…
1166
1243
  /[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
1167
1244
  !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
1168
1245
  }
1169
- function vn(e) {
1246
+ function Nn(e) {
1170
1247
  const r = e.options.fence || "`";
1171
1248
  if (r !== "`" && r !== "~")
1172
1249
  throw new Error(
@@ -1174,16 +1251,16 @@ function vn(e) {
1174
1251
  );
1175
1252
  return r;
1176
1253
  }
1177
- function Tn(e, r, t, n) {
1178
- const i = vn(t), o = e.value || "", a = i === "`" ? "GraveAccent" : "Tilde";
1179
- if (Cn(e, t)) {
1180
- const c = t.enter("codeIndented"), p = t.indentLines(o, An);
1181
- return c(), p;
1254
+ function Sn(e, r, t, n) {
1255
+ const i = Nn(t), o = e.value || "", a = i === "`" ? "GraveAccent" : "Tilde";
1256
+ if (In(e, t)) {
1257
+ const s = t.enter("codeIndented"), p = t.indentLines(o, Ln);
1258
+ return s(), p;
1182
1259
  }
1183
- const u = t.createTracker(n), l = i.repeat(Math.max(yn(o, i) + 1, 3)), s = t.enter("codeFenced");
1260
+ const u = t.createTracker(n), l = i.repeat(Math.max(An(o, i) + 1, 3)), c = t.enter("codeFenced");
1184
1261
  let f = u.move(l);
1185
1262
  if (e.lang) {
1186
- const c = t.enter(`codeFencedLang${a}`);
1263
+ const s = t.enter(`codeFencedLang${a}`);
1187
1264
  f += u.move(
1188
1265
  t.safe(e.lang, {
1189
1266
  before: f,
@@ -1191,10 +1268,10 @@ function Tn(e, r, t, n) {
1191
1268
  encode: ["`"],
1192
1269
  ...u.current()
1193
1270
  })
1194
- ), c();
1271
+ ), s();
1195
1272
  }
1196
1273
  if (e.lang && e.meta) {
1197
- const c = t.enter(`codeFencedMeta${a}`);
1274
+ const s = t.enter(`codeFencedMeta${a}`);
1198
1275
  f += u.move(" "), f += u.move(
1199
1276
  t.safe(e.meta, {
1200
1277
  before: f,
@@ -1203,13 +1280,13 @@ function Tn(e, r, t, n) {
1203
1280
  encode: ["`"],
1204
1281
  ...u.current()
1205
1282
  })
1206
- ), c();
1283
+ ), s();
1207
1284
  }
1208
1285
  return f += u.move(`
1209
1286
  `), o && (f += u.move(o + `
1210
- `)), f += u.move(l), s(), f;
1287
+ `)), f += u.move(l), c(), f;
1211
1288
  }
1212
- function An(e, r, t) {
1289
+ function Ln(e, r, t) {
1213
1290
  return (t ? "" : " ") + e;
1214
1291
  }
1215
1292
  function De(e) {
@@ -1220,37 +1297,37 @@ function De(e) {
1220
1297
  );
1221
1298
  return r;
1222
1299
  }
1223
- function In(e, r, t, n) {
1300
+ function Mn(e, r, t, n) {
1224
1301
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("definition");
1225
1302
  let u = t.enter("label");
1226
1303
  const l = t.createTracker(n);
1227
- let s = l.move("[");
1228
- return s += l.move(
1304
+ let c = l.move("[");
1305
+ return c += l.move(
1229
1306
  t.safe(t.associationId(e), {
1230
- before: s,
1307
+ before: c,
1231
1308
  after: "]",
1232
1309
  ...l.current()
1233
1310
  })
1234
- ), s += l.move("]: "), u(), // If there’s no url, or…
1311
+ ), c += l.move("]: "), u(), // If there’s no url, or…
1235
1312
  !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(
1313
+ /[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), c += l.move("<"), c += l.move(
1314
+ t.safe(e.url, { before: c, after: ">", ...l.current() })
1315
+ ), c += l.move(">")) : (u = t.enter("destinationRaw"), c += l.move(
1239
1316
  t.safe(e.url, {
1240
- before: s,
1317
+ before: c,
1241
1318
  after: e.title ? " " : `
1242
1319
  `,
1243
1320
  ...l.current()
1244
1321
  })
1245
- )), u(), e.title && (u = t.enter(`title${o}`), s += l.move(" " + i), s += l.move(
1322
+ )), u(), e.title && (u = t.enter(`title${o}`), c += l.move(" " + i), c += l.move(
1246
1323
  t.safe(e.title, {
1247
- before: s,
1324
+ before: c,
1248
1325
  after: i,
1249
1326
  ...l.current()
1250
1327
  })
1251
- ), s += l.move(i), u()), a(), s;
1328
+ ), c += l.move(i), u()), a(), c;
1252
1329
  }
1253
- function Nn(e) {
1330
+ function Dn(e) {
1254
1331
  const r = e.options.emphasis || "*";
1255
1332
  if (r !== "*" && r !== "_")
1256
1333
  throw new Error(
@@ -1262,7 +1339,7 @@ function ne(e) {
1262
1339
  return "&#x" + e.toString(16).toUpperCase() + ";";
1263
1340
  }
1264
1341
  function de(e) {
1265
- if (e === null || D(e) || H(e))
1342
+ if (e === null || M(e) || H(e))
1266
1343
  return 1;
1267
1344
  if (he(e))
1268
1345
  return 2;
@@ -1300,9 +1377,9 @@ function fe(e, r, t) {
1300
1377
  { inside: !1, outside: !1 }
1301
1378
  );
1302
1379
  }
1303
- mt.peek = Sn;
1304
- function mt(e, r, t, n) {
1305
- const i = Nn(t), o = t.enter("emphasis"), a = t.createTracker(n), u = a.move(i);
1380
+ bt.peek = Pn;
1381
+ function bt(e, r, t, n) {
1382
+ const i = Dn(t), o = t.enter("emphasis"), a = t.createTracker(n), u = a.move(i);
1306
1383
  let l = a.move(
1307
1384
  t.containerPhrasing(e, {
1308
1385
  after: i,
@@ -1310,75 +1387,75 @@ function mt(e, r, t, n) {
1310
1387
  ...a.current()
1311
1388
  })
1312
1389
  );
1313
- const s = l.charCodeAt(0), f = fe(
1390
+ const c = l.charCodeAt(0), f = fe(
1314
1391
  n.before.charCodeAt(n.before.length - 1),
1315
- s,
1392
+ c,
1316
1393
  i
1317
1394
  );
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);
1395
+ f.inside && (l = ne(c) + l.slice(1));
1396
+ const s = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), s, i);
1397
+ p.inside && (l = l.slice(0, -1) + ne(s));
1398
+ const b = a.move(i);
1322
1399
  return o(), t.attentionEncodeSurroundingInfo = {
1323
1400
  after: p.outside,
1324
1401
  before: f.outside
1325
- }, u + l + g;
1402
+ }, u + l + b;
1326
1403
  }
1327
- function Sn(e, r, t) {
1404
+ function Pn(e, r, t) {
1328
1405
  return t.options.emphasis || "*";
1329
1406
  }
1330
- function Ln(e, r, t, n) {
1407
+ function Rn(e, r, t, n) {
1331
1408
  let i, o, a;
1332
- 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);
1409
+ typeof r == "function" && typeof t != "function" ? (o = void 0, a = r, i = t) : (o = r, a = t, i = n), ft(e, o, u, i);
1410
+ function u(l, c) {
1411
+ const f = c[c.length - 1], s = f ? f.children.indexOf(l) : void 0;
1412
+ return a(l, s, f);
1336
1413
  }
1337
1414
  }
1338
- const Mn = {};
1339
- function pt(e, r) {
1340
- const t = Mn, n = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1341
- return gt(e, n, i);
1415
+ const En = {};
1416
+ function kt(e, r) {
1417
+ const t = En, n = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
1418
+ return xt(e, n, i);
1342
1419
  }
1343
- function gt(e, r, t) {
1344
- if (Dn(e)) {
1420
+ function xt(e, r, t) {
1421
+ if (_n(e)) {
1345
1422
  if ("value" in e)
1346
1423
  return e.type === "html" && !t ? "" : e.value;
1347
1424
  if (r && "alt" in e && e.alt)
1348
1425
  return e.alt;
1349
1426
  if ("children" in e)
1350
- return Ke(e.children, r, t);
1427
+ return Ve(e.children, r, t);
1351
1428
  }
1352
- return Array.isArray(e) ? Ke(e, r, t) : "";
1429
+ return Array.isArray(e) ? Ve(e, r, t) : "";
1353
1430
  }
1354
- function Ke(e, r, t) {
1431
+ function Ve(e, r, t) {
1355
1432
  const n = [];
1356
1433
  let i = -1;
1357
1434
  for (; ++i < e.length; )
1358
- n[i] = gt(e[i], r, t);
1435
+ n[i] = xt(e[i], r, t);
1359
1436
  return n.join("");
1360
1437
  }
1361
- function Dn(e) {
1438
+ function _n(e) {
1362
1439
  return !!(e && typeof e == "object");
1363
1440
  }
1364
- function Pn(e, r) {
1441
+ function Fn(e, r) {
1365
1442
  let t = !1;
1366
- return Ln(e, function(n) {
1443
+ return Rn(e, function(n) {
1367
1444
  if ("value" in n && /\r?\n|\r/.test(n.value) || n.type === "break")
1368
1445
  return t = !0, Se;
1369
- }), !!((!e.depth || e.depth < 3) && pt(e) && (r.options.setext || t));
1446
+ }), !!((!e.depth || e.depth < 3) && kt(e) && (r.options.setext || t));
1370
1447
  }
1371
- function Rn(e, r, t, n) {
1448
+ function zn(e, r, t, n) {
1372
1449
  const i = Math.max(Math.min(6, e.depth || 1), 1), o = t.createTracker(n);
1373
- if (Pn(e, t)) {
1374
- const f = t.enter("headingSetext"), c = t.enter("phrasing"), p = t.containerPhrasing(e, {
1450
+ if (Fn(e, t)) {
1451
+ const f = t.enter("headingSetext"), s = t.enter("phrasing"), p = t.containerPhrasing(e, {
1375
1452
  ...o.current(),
1376
1453
  before: `
1377
1454
  `,
1378
1455
  after: `
1379
1456
  `
1380
1457
  });
1381
- return c(), f(), p + `
1458
+ return s(), f(), p + `
1382
1459
  ` + (i === 1 ? "=" : "-").repeat(
1383
1460
  // The whole size…
1384
1461
  p.length - // Minus the position of the character after the last EOL (or
@@ -1389,76 +1466,76 @@ function Rn(e, r, t, n) {
1389
1466
  }
1390
1467
  const a = "#".repeat(i), u = t.enter("headingAtx"), l = t.enter("phrasing");
1391
1468
  o.move(a + " ");
1392
- let s = t.containerPhrasing(e, {
1469
+ let c = t.containerPhrasing(e, {
1393
1470
  before: "# ",
1394
1471
  after: `
1395
1472
  `,
1396
1473
  ...o.current()
1397
1474
  });
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;
1475
+ 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
1476
  }
1400
- bt.peek = En;
1401
- function bt(e) {
1477
+ wt.peek = jn;
1478
+ function wt(e) {
1402
1479
  return e.value || "";
1403
1480
  }
1404
- function En() {
1481
+ function jn() {
1405
1482
  return "<";
1406
1483
  }
1407
- kt.peek = _n;
1408
- function kt(e, r, t, n) {
1484
+ yt.peek = $n;
1485
+ function yt(e, r, t, n) {
1409
1486
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.enter("image");
1410
1487
  let u = t.enter("label");
1411
1488
  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…
1489
+ let c = l.move("![");
1490
+ return c += l.move(
1491
+ t.safe(e.alt, { before: c, after: "]", ...l.current() })
1492
+ ), c += l.move("]("), u(), // If there’s no url but there is a title…
1416
1493
  !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(
1494
+ /[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), c += l.move("<"), c += l.move(
1495
+ t.safe(e.url, { before: c, after: ">", ...l.current() })
1496
+ ), c += l.move(">")) : (u = t.enter("destinationRaw"), c += l.move(
1420
1497
  t.safe(e.url, {
1421
- before: s,
1498
+ before: c,
1422
1499
  after: e.title ? " " : ")",
1423
1500
  ...l.current()
1424
1501
  })
1425
- )), u(), e.title && (u = t.enter(`title${o}`), s += l.move(" " + i), s += l.move(
1502
+ )), u(), e.title && (u = t.enter(`title${o}`), c += l.move(" " + i), c += l.move(
1426
1503
  t.safe(e.title, {
1427
- before: s,
1504
+ before: c,
1428
1505
  after: i,
1429
1506
  ...l.current()
1430
1507
  })
1431
- ), s += l.move(i), u()), s += l.move(")"), a(), s;
1508
+ ), c += l.move(i), u()), c += l.move(")"), a(), c;
1432
1509
  }
1433
- function _n() {
1510
+ function $n() {
1434
1511
  return "!";
1435
1512
  }
1436
- xt.peek = Fn;
1437
- function xt(e, r, t, n) {
1513
+ Ct.peek = On;
1514
+ function Ct(e, r, t, n) {
1438
1515
  const i = e.referenceType, o = t.enter("imageReference");
1439
1516
  let a = t.enter("label");
1440
1517
  const u = t.createTracker(n);
1441
1518
  let l = u.move("![");
1442
- const s = t.safe(e.alt, {
1519
+ const c = t.safe(e.alt, {
1443
1520
  before: l,
1444
1521
  after: "]",
1445
1522
  ...u.current()
1446
1523
  });
1447
- l += u.move(s + "]["), a();
1524
+ l += u.move(c + "]["), a();
1448
1525
  const f = t.stack;
1449
1526
  t.stack = [], a = t.enter("reference");
1450
- const c = t.safe(t.associationId(e), {
1527
+ const s = t.safe(t.associationId(e), {
1451
1528
  before: l,
1452
1529
  after: "]",
1453
1530
  ...u.current()
1454
1531
  });
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;
1532
+ return a(), t.stack = f, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1456
1533
  }
1457
- function Fn() {
1534
+ function On() {
1458
1535
  return "!";
1459
1536
  }
1460
- wt.peek = zn;
1461
- function wt(e, r, t) {
1537
+ vt.peek = Un;
1538
+ function vt(e, r, t) {
1462
1539
  let n = e.value || "", i = "`", o = -1;
1463
1540
  for (; new RegExp("(^|[^`])" + i + "([^`]|$)").test(n); )
1464
1541
  i += "`";
@@ -1467,17 +1544,17 @@ function wt(e, r, t) {
1467
1544
  let l;
1468
1545
  if (a.atBreak)
1469
1546
  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);
1547
+ let c = l.index;
1548
+ n.charCodeAt(c) === 10 && n.charCodeAt(c - 1) === 13 && c--, n = n.slice(0, c) + " " + n.slice(l.index + 1);
1472
1549
  }
1473
1550
  }
1474
1551
  return i + n + i;
1475
1552
  }
1476
- function zn() {
1553
+ function Un() {
1477
1554
  return "`";
1478
1555
  }
1479
- function yt(e, r) {
1480
- const t = pt(e);
1556
+ function Tt(e, r) {
1557
+ const t = kt(e);
1481
1558
  return !!(!r.options.resourceLink && // If there’s a url…
1482
1559
  e.url && // And there’s a no title…
1483
1560
  !e.title && // And the content of `node` is a single text node…
@@ -1487,73 +1564,73 @@ function yt(e, r) {
1487
1564
  // references don’t work), space, or angle brackets…
1488
1565
  !/[\0- <>\u007F]/.test(e.url));
1489
1566
  }
1490
- Ct.peek = jn;
1491
- function Ct(e, r, t, n) {
1567
+ At.peek = Bn;
1568
+ function At(e, r, t, n) {
1492
1569
  const i = De(t), o = i === '"' ? "Quote" : "Apostrophe", a = t.createTracker(n);
1493
1570
  let u, l;
1494
- if (yt(e, t)) {
1571
+ if (Tt(e, t)) {
1495
1572
  const f = t.stack;
1496
1573
  t.stack = [], u = t.enter("autolink");
1497
- let c = a.move("<");
1498
- return c += a.move(
1574
+ let s = a.move("<");
1575
+ return s += a.move(
1499
1576
  t.containerPhrasing(e, {
1500
- before: c,
1577
+ before: s,
1501
1578
  after: ">",
1502
1579
  ...a.current()
1503
1580
  })
1504
- ), c += a.move(">"), u(), t.stack = f, c;
1581
+ ), s += a.move(">"), u(), t.stack = f, s;
1505
1582
  }
1506
1583
  u = t.enter("link"), l = t.enter("label");
1507
- let s = a.move("[");
1508
- return s += a.move(
1584
+ let c = a.move("[");
1585
+ return c += a.move(
1509
1586
  t.containerPhrasing(e, {
1510
- before: s,
1587
+ before: c,
1511
1588
  after: "](",
1512
1589
  ...a.current()
1513
1590
  })
1514
- ), s += a.move("]("), l(), // If there’s no url but there is a title…
1591
+ ), c += a.move("]("), l(), // If there’s no url but there is a title…
1515
1592
  !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(
1593
+ /[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"), c += a.move("<"), c += a.move(
1594
+ t.safe(e.url, { before: c, after: ">", ...a.current() })
1595
+ ), c += a.move(">")) : (l = t.enter("destinationRaw"), c += a.move(
1519
1596
  t.safe(e.url, {
1520
- before: s,
1597
+ before: c,
1521
1598
  after: e.title ? " " : ")",
1522
1599
  ...a.current()
1523
1600
  })
1524
- )), l(), e.title && (l = t.enter(`title${o}`), s += a.move(" " + i), s += a.move(
1601
+ )), l(), e.title && (l = t.enter(`title${o}`), c += a.move(" " + i), c += a.move(
1525
1602
  t.safe(e.title, {
1526
- before: s,
1603
+ before: c,
1527
1604
  after: i,
1528
1605
  ...a.current()
1529
1606
  })
1530
- ), s += a.move(i), l()), s += a.move(")"), u(), s;
1607
+ ), c += a.move(i), l()), c += a.move(")"), u(), c;
1531
1608
  }
1532
- function jn(e, r, t) {
1533
- return yt(e, t) ? "<" : "[";
1609
+ function Bn(e, r, t) {
1610
+ return Tt(e, t) ? "<" : "[";
1534
1611
  }
1535
- vt.peek = $n;
1536
- function vt(e, r, t, n) {
1612
+ It.peek = Wn;
1613
+ function It(e, r, t, n) {
1537
1614
  const i = e.referenceType, o = t.enter("linkReference");
1538
1615
  let a = t.enter("label");
1539
1616
  const u = t.createTracker(n);
1540
1617
  let l = u.move("[");
1541
- const s = t.containerPhrasing(e, {
1618
+ const c = t.containerPhrasing(e, {
1542
1619
  before: l,
1543
1620
  after: "]",
1544
1621
  ...u.current()
1545
1622
  });
1546
- l += u.move(s + "]["), a();
1623
+ l += u.move(c + "]["), a();
1547
1624
  const f = t.stack;
1548
1625
  t.stack = [], a = t.enter("reference");
1549
- const c = t.safe(t.associationId(e), {
1626
+ const s = t.safe(t.associationId(e), {
1550
1627
  before: l,
1551
1628
  after: "]",
1552
1629
  ...u.current()
1553
1630
  });
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;
1631
+ return a(), t.stack = f, o(), i === "full" || !c || c !== s ? l += u.move(s + "]") : i === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
1555
1632
  }
1556
- function $n() {
1633
+ function Wn() {
1557
1634
  return "[";
1558
1635
  }
1559
1636
  function Pe(e) {
@@ -1564,7 +1641,7 @@ function Pe(e) {
1564
1641
  );
1565
1642
  return r;
1566
1643
  }
1567
- function On(e) {
1644
+ function Hn(e) {
1568
1645
  const r = Pe(e), t = e.options.bulletOther;
1569
1646
  if (!t)
1570
1647
  return r === "*" ? "-" : "*";
@@ -1578,7 +1655,7 @@ function On(e) {
1578
1655
  );
1579
1656
  return t;
1580
1657
  }
1581
- function Un(e) {
1658
+ function qn(e) {
1582
1659
  const r = e.options.bulletOrdered || ".";
1583
1660
  if (r !== "." && r !== ")")
1584
1661
  throw new Error(
@@ -1586,7 +1663,7 @@ function Un(e) {
1586
1663
  );
1587
1664
  return r;
1588
1665
  }
1589
- function Tt(e) {
1666
+ function Nt(e) {
1590
1667
  const r = e.options.rule || "*";
1591
1668
  if (r !== "*" && r !== "-" && r !== "_")
1592
1669
  throw new Error(
@@ -1594,10 +1671,10 @@ function Tt(e) {
1594
1671
  );
1595
1672
  return r;
1596
1673
  }
1597
- function Bn(e, r, t, n) {
1674
+ function Kn(e, r, t, n) {
1598
1675
  const i = t.enter("list"), o = t.bulletCurrent;
1599
- let a = e.ordered ? Un(t) : Pe(t);
1600
- const u = e.ordered ? a === "." ? ")" : "." : On(t);
1676
+ let a = e.ordered ? qn(t) : Pe(t);
1677
+ const u = e.ordered ? a === "." ? ")" : "." : Hn(t);
1601
1678
  let l = r && t.bulletLastUsed ? a === t.bulletLastUsed : !1;
1602
1679
  if (!e.ordered) {
1603
1680
  const f = e.children ? e.children[0] : void 0;
@@ -1606,11 +1683,11 @@ function Bn(e, r, t, n) {
1606
1683
  (a === "*" || a === "-") && // Empty first list item:
1607
1684
  f && (!f.children || !f.children[0]) && // Directly in two other list items:
1608
1685
  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
1686
+ t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Nt(t) === a && f
1610
1687
  ) {
1611
- let c = -1;
1612
- for (; ++c < e.children.length; ) {
1613
- const p = e.children[c];
1688
+ let s = -1;
1689
+ for (; ++s < e.children.length; ) {
1690
+ const p = e.children[s];
1614
1691
  if (p && p.type === "listItem" && p.children && p.children[0] && p.children[0].type === "thematicBreak") {
1615
1692
  l = !0;
1616
1693
  break;
@@ -1619,10 +1696,10 @@ function Bn(e, r, t, n) {
1619
1696
  }
1620
1697
  }
1621
1698
  l && (a = u), t.bulletCurrent = a;
1622
- const s = t.containerFlow(e, n);
1623
- return t.bulletLastUsed = a, t.bulletCurrent = o, i(), s;
1699
+ const c = t.containerFlow(e, n);
1700
+ return t.bulletLastUsed = a, t.bulletCurrent = o, i(), c;
1624
1701
  }
1625
- function Wn(e) {
1702
+ function Vn(e) {
1626
1703
  const r = e.options.listItemIndent || "one";
1627
1704
  if (r !== "tab" && r !== "one" && r !== "mixed")
1628
1705
  throw new Error(
@@ -1630,28 +1707,28 @@ function Wn(e) {
1630
1707
  );
1631
1708
  return r;
1632
1709
  }
1633
- function Hn(e, r, t, n) {
1634
- const i = Wn(t);
1710
+ function Gn(e, r, t, n) {
1711
+ const i = Vn(t);
1635
1712
  let o = t.bulletCurrent || Pe(t);
1636
1713
  r && r.type === "list" && r.ordered && (o = (typeof r.start == "number" && r.start > -1 ? r.start : 1) + (t.options.incrementListMarker === !1 ? 0 : r.children.indexOf(e)) + o);
1637
1714
  let a = o.length + 1;
1638
1715
  (i === "tab" || i === "mixed" && (r && r.type === "list" && r.spread || e.spread)) && (a = Math.ceil(a / 4) * 4);
1639
1716
  const u = t.createTracker(n);
1640
1717
  u.move(o + " ".repeat(a - o.length)), u.shift(a);
1641
- const l = t.enter("listItem"), s = t.indentLines(
1718
+ const l = t.enter("listItem"), c = t.indentLines(
1642
1719
  t.containerFlow(e, u.current()),
1643
1720
  f
1644
1721
  );
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;
1722
+ return l(), c;
1723
+ function f(s, p, b) {
1724
+ return p ? (b ? "" : " ".repeat(a)) + s : (b ? o : o + " ".repeat(a - o.length)) + s;
1648
1725
  }
1649
1726
  }
1650
- function qn(e, r, t, n) {
1727
+ function Zn(e, r, t, n) {
1651
1728
  const i = t.enter("paragraph"), o = t.enter("phrasing"), a = t.containerPhrasing(e, n);
1652
1729
  return o(), i(), a;
1653
1730
  }
1654
- const Kn = (
1731
+ const Jn = (
1655
1732
  /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
1656
1733
  pe([
1657
1734
  "break",
@@ -1677,12 +1754,12 @@ const Kn = (
1677
1754
  "textDirective"
1678
1755
  ])
1679
1756
  );
1680
- function Vn(e, r, t, n) {
1757
+ function Qn(e, r, t, n) {
1681
1758
  return (e.children.some(function(a) {
1682
- return Kn(a);
1759
+ return Jn(a);
1683
1760
  }) ? t.containerPhrasing : t.containerFlow).call(t, e, n);
1684
1761
  }
1685
- function Gn(e) {
1762
+ function Xn(e) {
1686
1763
  const r = e.options.strong || "*";
1687
1764
  if (r !== "*" && r !== "_")
1688
1765
  throw new Error(
@@ -1690,9 +1767,9 @@ function Gn(e) {
1690
1767
  );
1691
1768
  return r;
1692
1769
  }
1693
- At.peek = Zn;
1694
- function At(e, r, t, n) {
1695
- const i = Gn(t), o = t.enter("strong"), a = t.createTracker(n), u = a.move(i + i);
1770
+ St.peek = Yn;
1771
+ function St(e, r, t, n) {
1772
+ const i = Xn(t), o = t.enter("strong"), a = t.createTracker(n), u = a.move(i + i);
1696
1773
  let l = a.move(
1697
1774
  t.containerPhrasing(e, {
1698
1775
  after: i,
@@ -1700,27 +1777,27 @@ function At(e, r, t, n) {
1700
1777
  ...a.current()
1701
1778
  })
1702
1779
  );
1703
- const s = l.charCodeAt(0), f = fe(
1780
+ const c = l.charCodeAt(0), f = fe(
1704
1781
  n.before.charCodeAt(n.before.length - 1),
1705
- s,
1782
+ c,
1706
1783
  i
1707
1784
  );
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);
1785
+ f.inside && (l = ne(c) + l.slice(1));
1786
+ const s = l.charCodeAt(l.length - 1), p = fe(n.after.charCodeAt(0), s, i);
1787
+ p.inside && (l = l.slice(0, -1) + ne(s));
1788
+ const b = a.move(i + i);
1712
1789
  return o(), t.attentionEncodeSurroundingInfo = {
1713
1790
  after: p.outside,
1714
1791
  before: f.outside
1715
- }, u + l + g;
1792
+ }, u + l + b;
1716
1793
  }
1717
- function Zn(e, r, t) {
1794
+ function Yn(e, r, t) {
1718
1795
  return t.options.strong || "*";
1719
1796
  }
1720
- function Jn(e, r, t, n) {
1797
+ function ea(e, r, t, n) {
1721
1798
  return t.safe(e.value, n);
1722
1799
  }
1723
- function Qn(e) {
1800
+ function ta(e) {
1724
1801
  const r = e.options.ruleRepetition || 3;
1725
1802
  if (r < 3)
1726
1803
  throw new Error(
@@ -1728,50 +1805,50 @@ function Qn(e) {
1728
1805
  );
1729
1806
  return r;
1730
1807
  }
1731
- function Xn(e, r, t) {
1732
- const n = (Tt(t) + (t.options.ruleSpaces ? " " : "")).repeat(Qn(t));
1808
+ function ra(e, r, t) {
1809
+ const n = (Nt(t) + (t.options.ruleSpaces ? " " : "")).repeat(ta(t));
1733
1810
  return t.options.ruleSpaces ? n.slice(0, -1) : n;
1734
1811
  }
1735
- const It = {
1736
- blockquote: kn,
1737
- break: qe,
1738
- code: Tn,
1739
- definition: In,
1740
- emphasis: mt,
1741
- hardBreak: qe,
1742
- heading: Rn,
1743
- html: bt,
1744
- image: kt,
1745
- imageReference: xt,
1746
- inlineCode: wt,
1747
- link: Ct,
1748
- linkReference: vt,
1749
- list: Bn,
1750
- listItem: Hn,
1751
- paragraph: qn,
1752
- root: Vn,
1753
- strong: At,
1754
- text: Jn,
1755
- thematicBreak: Xn
1812
+ const Lt = {
1813
+ blockquote: Cn,
1814
+ break: Ke,
1815
+ code: Sn,
1816
+ definition: Mn,
1817
+ emphasis: bt,
1818
+ hardBreak: Ke,
1819
+ heading: zn,
1820
+ html: wt,
1821
+ image: yt,
1822
+ imageReference: Ct,
1823
+ inlineCode: vt,
1824
+ link: At,
1825
+ linkReference: It,
1826
+ list: Kn,
1827
+ listItem: Gn,
1828
+ paragraph: Zn,
1829
+ root: Qn,
1830
+ strong: St,
1831
+ text: ea,
1832
+ thematicBreak: ra
1756
1833
  };
1757
- function Yn() {
1834
+ function na() {
1758
1835
  return {
1759
1836
  enter: {
1760
- table: ea,
1761
- tableData: Ve,
1762
- tableHeader: Ve,
1763
- tableRow: ra
1837
+ table: aa,
1838
+ tableData: Ge,
1839
+ tableHeader: Ge,
1840
+ tableRow: oa
1764
1841
  },
1765
1842
  exit: {
1766
- codeText: na,
1767
- table: ta,
1843
+ codeText: la,
1844
+ table: ia,
1768
1845
  tableData: Te,
1769
1846
  tableHeader: Te,
1770
1847
  tableRow: Te
1771
1848
  }
1772
1849
  };
1773
1850
  }
1774
- function ea(e) {
1851
+ function aa(e) {
1775
1852
  const r = e._align;
1776
1853
  this.enter(
1777
1854
  {
@@ -1784,28 +1861,28 @@ function ea(e) {
1784
1861
  e
1785
1862
  ), this.data.inTable = !0;
1786
1863
  }
1787
- function ta(e) {
1864
+ function ia(e) {
1788
1865
  this.exit(e), this.data.inTable = void 0;
1789
1866
  }
1790
- function ra(e) {
1867
+ function oa(e) {
1791
1868
  this.enter({ type: "tableRow", children: [] }, e);
1792
1869
  }
1793
1870
  function Te(e) {
1794
1871
  this.exit(e);
1795
1872
  }
1796
- function Ve(e) {
1873
+ function Ge(e) {
1797
1874
  this.enter({ type: "tableCell", children: [] }, e);
1798
1875
  }
1799
- function na(e) {
1876
+ function la(e) {
1800
1877
  let r = this.resume();
1801
- this.data.inTable && (r = r.replace(/\\([\\|])/g, aa));
1878
+ this.data.inTable && (r = r.replace(/\\([\\|])/g, ua));
1802
1879
  const t = this.stack[this.stack.length - 1];
1803
1880
  t.type, t.value = r, this.exit(e);
1804
1881
  }
1805
- function aa(e, r) {
1882
+ function ua(e, r) {
1806
1883
  return r === "|" ? r : e;
1807
1884
  }
1808
- function ia(e) {
1885
+ function ca(e) {
1809
1886
  const r = e || {}, t = r.tableCellPadding, n = r.tablePipeAlign, i = r.stringLength, o = t ? " " : "|";
1810
1887
  return {
1811
1888
  unsafe: [
@@ -1834,24 +1911,24 @@ function ia(e) {
1834
1911
  tableRow: u
1835
1912
  }
1836
1913
  };
1837
- function a(g, h, k, b) {
1838
- return s(f(g, k, b), g.align);
1914
+ function a(b, h, k, g) {
1915
+ return c(f(b, k, g), b.align);
1839
1916
  }
1840
- function u(g, h, k, b) {
1841
- const x = c(g, k, b), w = s([x]);
1917
+ function u(b, h, k, g) {
1918
+ const x = s(b, k, g), w = c([x]);
1842
1919
  return w.slice(0, w.indexOf(`
1843
1920
  `));
1844
1921
  }
1845
- function l(g, h, k, b) {
1846
- const x = k.enter("tableCell"), w = k.enter("phrasing"), y = k.containerPhrasing(g, {
1847
- ...b,
1922
+ function l(b, h, k, g) {
1923
+ const x = k.enter("tableCell"), w = k.enter("phrasing"), y = k.containerPhrasing(b, {
1924
+ ...g,
1848
1925
  before: o,
1849
1926
  after: o
1850
1927
  });
1851
1928
  return w(), x(), y;
1852
1929
  }
1853
- function s(g, h) {
1854
- return gn(g, {
1930
+ function c(b, h) {
1931
+ return wn(b, {
1855
1932
  align: h,
1856
1933
  // @ts-expect-error: `markdown-table` types should support `null`.
1857
1934
  alignDelimiters: n,
@@ -1861,47 +1938,47 @@ function ia(e) {
1861
1938
  stringLength: i
1862
1939
  });
1863
1940
  }
1864
- function f(g, h, k) {
1865
- const b = g.children;
1941
+ function f(b, h, k) {
1942
+ const g = b.children;
1866
1943
  let x = -1;
1867
1944
  const w = [], y = h.enter("table");
1868
- for (; ++x < b.length; )
1869
- w[x] = c(b[x], h, k);
1945
+ for (; ++x < g.length; )
1946
+ w[x] = s(g[x], h, k);
1870
1947
  return y(), w;
1871
1948
  }
1872
- function c(g, h, k) {
1873
- const b = g.children;
1949
+ function s(b, h, k) {
1950
+ const g = b.children;
1874
1951
  let x = -1;
1875
1952
  const w = [], y = h.enter("tableRow");
1876
- for (; ++x < b.length; )
1877
- w[x] = l(b[x], g, h, k);
1953
+ for (; ++x < g.length; )
1954
+ w[x] = l(g[x], b, h, k);
1878
1955
  return y(), w;
1879
1956
  }
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;
1957
+ function p(b, h, k) {
1958
+ let g = Lt.inlineCode(b, h, k);
1959
+ return k.stack.includes("tableCell") && (g = g.replace(/\|/g, "\\$&")), g;
1883
1960
  }
1884
1961
  }
1885
- function oa() {
1962
+ function sa() {
1886
1963
  return {
1887
1964
  exit: {
1888
- taskListCheckValueChecked: Ge,
1889
- taskListCheckValueUnchecked: Ge,
1890
- paragraph: ua
1965
+ taskListCheckValueChecked: Ze,
1966
+ taskListCheckValueUnchecked: Ze,
1967
+ paragraph: fa
1891
1968
  }
1892
1969
  };
1893
1970
  }
1894
- function la() {
1971
+ function da() {
1895
1972
  return {
1896
1973
  unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
1897
- handlers: { listItem: ca }
1974
+ handlers: { listItem: ha }
1898
1975
  };
1899
1976
  }
1900
- function Ge(e) {
1977
+ function Ze(e) {
1901
1978
  const r = this.stack[this.stack.length - 2];
1902
1979
  r.type, r.checked = e.type === "taskListCheckValueChecked";
1903
1980
  }
1904
- function ua(e) {
1981
+ function fa(e) {
1905
1982
  const r = this.stack[this.stack.length - 2];
1906
1983
  if (r && r.type === "listItem" && typeof r.checked == "boolean") {
1907
1984
  const t = this.stack[this.stack.length - 1];
@@ -1922,35 +1999,35 @@ function ua(e) {
1922
1999
  }
1923
2000
  this.exit(e);
1924
2001
  }
1925
- function ca(e, r, t, n) {
2002
+ function ha(e, r, t, n) {
1926
2003
  const i = e.children[0], o = typeof e.checked == "boolean" && i && i.type === "paragraph", a = "[" + (e.checked ? "x" : " ") + "] ", u = t.createTracker(n);
1927
2004
  o && u.move(a);
1928
- let l = It.listItem(e, r, t, {
2005
+ let l = Lt.listItem(e, r, t, {
1929
2006
  ...n,
1930
2007
  ...u.current()
1931
2008
  });
1932
- return o && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, s)), l;
1933
- function s(f) {
2009
+ return o && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, c)), l;
2010
+ function c(f) {
1934
2011
  return f + a;
1935
2012
  }
1936
2013
  }
1937
- function sa() {
2014
+ function ma() {
1938
2015
  return [
1939
- jr(),
1940
- on(),
2016
+ Br(),
1941
2017
  sn(),
1942
- Yn(),
1943
- oa()
2018
+ mn(),
2019
+ na(),
2020
+ sa()
1944
2021
  ];
1945
2022
  }
1946
- function da(e) {
2023
+ function pa(e) {
1947
2024
  return {
1948
2025
  extensions: [
1949
- $r(),
1950
- ln(e),
1951
- dn(),
1952
- ia(e),
1953
- la()
2026
+ Wr(),
2027
+ dn(e),
2028
+ pn(),
2029
+ ca(e),
2030
+ da()
1954
2031
  ]
1955
2032
  };
1956
2033
  }
@@ -1963,24 +2040,24 @@ function ce(e, r, t, n) {
1963
2040
  for (t && e.splice(r, t); o < n.length; )
1964
2041
  a = n.slice(o, o + 1e4), a.unshift(r, 0), e.splice(...a), o += 1e4, r += 1e4;
1965
2042
  }
1966
- const Ze = {}.hasOwnProperty;
1967
- function fa(e) {
2043
+ const Je = {}.hasOwnProperty;
2044
+ function ga(e) {
1968
2045
  const r = {};
1969
2046
  let t = -1;
1970
2047
  for (; ++t < e.length; )
1971
- ha(r, e[t]);
2048
+ ba(r, e[t]);
1972
2049
  return r;
1973
2050
  }
1974
- function ha(e, r) {
2051
+ function ba(e, r) {
1975
2052
  let t;
1976
2053
  for (t in r) {
1977
- const i = (Ze.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
2054
+ const i = (Je.call(e, t) ? e[t] : void 0) || (e[t] = {}), o = r[t];
1978
2055
  let a;
1979
2056
  if (o)
1980
2057
  for (a in o) {
1981
- Ze.call(i, a) || (i[a] = []);
2058
+ Je.call(i, a) || (i[a] = []);
1982
2059
  const u = o[a];
1983
- ma(
2060
+ ka(
1984
2061
  // @ts-expect-error Looks like a list.
1985
2062
  i[a],
1986
2063
  Array.isArray(u) ? u : u ? [u] : []
@@ -1988,115 +2065,115 @@ function ha(e, r) {
1988
2065
  }
1989
2066
  }
1990
2067
  }
1991
- function ma(e, r) {
2068
+ function ka(e, r) {
1992
2069
  let t = -1;
1993
2070
  const n = [];
1994
2071
  for (; ++t < r.length; )
1995
2072
  (r[t].add === "after" ? e : n).push(r[t]);
1996
2073
  ce(e, 0, 0, n);
1997
2074
  }
1998
- const pa = {
1999
- tokenize: ya,
2075
+ const xa = {
2076
+ tokenize: Aa,
2000
2077
  partial: !0
2001
- }, Nt = {
2002
- tokenize: Ca,
2078
+ }, Mt = {
2079
+ tokenize: Ia,
2003
2080
  partial: !0
2004
- }, St = {
2005
- tokenize: va,
2081
+ }, Dt = {
2082
+ tokenize: Na,
2006
2083
  partial: !0
2007
- }, Lt = {
2008
- tokenize: Ta,
2084
+ }, Pt = {
2085
+ tokenize: Sa,
2009
2086
  partial: !0
2010
- }, ga = {
2011
- tokenize: Aa,
2087
+ }, wa = {
2088
+ tokenize: La,
2012
2089
  partial: !0
2013
- }, Mt = {
2090
+ }, Rt = {
2014
2091
  name: "wwwAutolink",
2015
- tokenize: xa,
2016
- previous: Pt
2017
- }, Dt = {
2092
+ tokenize: va,
2093
+ previous: _t
2094
+ }, Et = {
2018
2095
  name: "protocolAutolink",
2019
- tokenize: wa,
2020
- previous: Rt
2096
+ tokenize: Ta,
2097
+ previous: Ft
2021
2098
  }, $ = {
2022
2099
  name: "emailAutolink",
2023
- tokenize: ka,
2024
- previous: Et
2100
+ tokenize: Ca,
2101
+ previous: zt
2025
2102
  }, R = {};
2026
- function ba() {
2103
+ function ya() {
2027
2104
  return {
2028
2105
  text: R
2029
2106
  };
2030
2107
  }
2031
- let U = 48;
2032
- for (; U < 123; )
2033
- R[U] = $, U++, U === 58 ? U = 65 : U === 91 && (U = 97);
2108
+ let W = 48;
2109
+ for (; W < 123; )
2110
+ R[W] = $, W++, W === 58 ? W = 65 : W === 91 && (W = 97);
2034
2111
  R[43] = $;
2035
2112
  R[45] = $;
2036
2113
  R[46] = $;
2037
2114
  R[95] = $;
2038
- R[72] = [$, Dt];
2039
- R[104] = [$, Dt];
2040
- R[87] = [$, Mt];
2041
- R[119] = [$, Mt];
2042
- function ka(e, r, t) {
2115
+ R[72] = [$, Et];
2116
+ R[104] = [$, Et];
2117
+ R[87] = [$, Rt];
2118
+ R[119] = [$, Rt];
2119
+ function Ca(e, r, t) {
2043
2120
  const n = this;
2044
2121
  let i, o;
2045
2122
  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));
2123
+ function a(s) {
2124
+ return !Le(s) || !zt.call(n, n.previous) || Re(n.events) ? t(s) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(s));
2048
2125
  }
2049
- function u(c) {
2050
- return Le(c) ? (e.consume(c), u) : c === 64 ? (e.consume(c), l) : t(c);
2126
+ function u(s) {
2127
+ return Le(s) ? (e.consume(s), u) : s === 64 ? (e.consume(s), l) : t(s);
2051
2128
  }
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);
2129
+ function l(s) {
2130
+ return s === 46 ? e.check(wa, f, c)(s) : s === 45 || s === 95 || Me(s) ? (o = !0, e.consume(s), l) : f(s);
2054
2131
  }
2055
- function s(c) {
2056
- return e.consume(c), i = !0, l;
2132
+ function c(s) {
2133
+ return e.consume(s), i = !0, l;
2057
2134
  }
2058
- function f(c) {
2059
- return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(c)) : t(c);
2135
+ function f(s) {
2136
+ return o && i && re(n.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), r(s)) : t(s);
2060
2137
  }
2061
2138
  }
2062
- function xa(e, r, t) {
2139
+ function va(e, r, t) {
2063
2140
  const n = this;
2064
2141
  return i;
2065
2142
  function i(a) {
2066
- return a !== 87 && a !== 119 || !Pt.call(n, n.previous) || Re(n.events) ? t(a) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(pa, e.attempt(Nt, e.attempt(St, o), t), t)(a));
2143
+ return a !== 87 && a !== 119 || !_t.call(n, n.previous) || Re(n.events) ? t(a) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(xa, e.attempt(Mt, e.attempt(Dt, o), t), t)(a));
2067
2144
  }
2068
2145
  function o(a) {
2069
2146
  return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), r(a);
2070
2147
  }
2071
2148
  }
2072
- function wa(e, r, t) {
2149
+ function Ta(e, r, t) {
2073
2150
  const n = this;
2074
2151
  let i = "", o = !1;
2075
2152
  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);
2153
+ function a(s) {
2154
+ return (s === 72 || s === 104) && Ft.call(n, n.previous) && !Re(n.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), i += String.fromCodePoint(s), e.consume(s), u) : t(s);
2078
2155
  }
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) {
2156
+ function u(s) {
2157
+ if (re(s) && i.length < 5)
2158
+ return i += String.fromCodePoint(s), e.consume(s), u;
2159
+ if (s === 58) {
2083
2160
  const p = i.toLowerCase();
2084
2161
  if (p === "http" || p === "https")
2085
- return e.consume(c), l;
2162
+ return e.consume(s), l;
2086
2163
  }
2087
- return t(c);
2164
+ return t(s);
2088
2165
  }
2089
- function l(c) {
2090
- return c === 47 ? (e.consume(c), o ? s : (o = !0, l)) : t(c);
2166
+ function l(s) {
2167
+ return s === 47 ? (e.consume(s), o ? c : (o = !0, l)) : t(s);
2091
2168
  }
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);
2169
+ function c(s) {
2170
+ return s === null || Sr(s) || M(s) || H(s) || he(s) ? t(s) : e.attempt(Mt, e.attempt(Dt, f), t)(s);
2094
2171
  }
2095
- function f(c) {
2096
- return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(c);
2172
+ function f(s) {
2173
+ return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), r(s);
2097
2174
  }
2098
2175
  }
2099
- function ya(e, r, t) {
2176
+ function Aa(e, r, t) {
2100
2177
  let n = 0;
2101
2178
  return i;
2102
2179
  function i(a) {
@@ -2106,40 +2183,40 @@ function ya(e, r, t) {
2106
2183
  return a === null ? t(a) : r(a);
2107
2184
  }
2108
2185
  }
2109
- function Ca(e, r, t) {
2186
+ function Ia(e, r, t) {
2110
2187
  let n, i, o;
2111
2188
  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);
2189
+ function a(c) {
2190
+ return c === 46 || c === 95 ? e.check(Pt, l, u)(c) : c === null || M(c) || H(c) || c !== 45 && he(c) ? l(c) : (o = !0, e.consume(c), a);
2114
2191
  }
2115
- function u(s) {
2116
- return s === 95 ? n = !0 : (i = n, n = void 0), e.consume(s), a;
2192
+ function u(c) {
2193
+ return c === 95 ? n = !0 : (i = n, n = void 0), e.consume(c), a;
2117
2194
  }
2118
- function l(s) {
2119
- return i || n || !o ? t(s) : r(s);
2195
+ function l(c) {
2196
+ return i || n || !o ? t(c) : r(c);
2120
2197
  }
2121
2198
  }
2122
- function va(e, r) {
2199
+ function Na(e, r) {
2123
2200
  let t = 0, n = 0;
2124
2201
  return i;
2125
2202
  function i(a) {
2126
- return a === 40 ? (t++, e.consume(a), i) : a === 41 && n < t ? o(a) : a === 33 || a === 34 || a === 38 || a === 39 || a === 41 || a === 42 || a === 44 || a === 46 || a === 58 || a === 59 || a === 60 || a === 63 || a === 93 || a === 95 || a === 126 ? e.check(Lt, r, o)(a) : a === null || D(a) || H(a) ? r(a) : (e.consume(a), i);
2203
+ return a === 40 ? (t++, e.consume(a), i) : a === 41 && n < t ? o(a) : a === 33 || a === 34 || a === 38 || a === 39 || a === 41 || a === 42 || a === 44 || a === 46 || a === 58 || a === 59 || a === 60 || a === 63 || a === 93 || a === 95 || a === 126 ? e.check(Pt, r, o)(a) : a === null || M(a) || H(a) ? r(a) : (e.consume(a), i);
2127
2204
  }
2128
2205
  function o(a) {
2129
2206
  return a === 41 && n++, e.consume(a), i;
2130
2207
  }
2131
2208
  }
2132
- function Ta(e, r, t) {
2209
+ function Sa(e, r, t) {
2133
2210
  return n;
2134
2211
  function n(u) {
2135
2212
  return u === 33 || u === 34 || u === 39 || u === 41 || u === 42 || u === 44 || u === 46 || u === 58 || u === 59 || u === 63 || u === 95 || u === 126 ? (e.consume(u), n) : u === 38 ? (e.consume(u), o) : u === 93 ? (e.consume(u), i) : (
2136
2213
  // `<` is an end.
2137
2214
  u === 60 || // So is whitespace.
2138
- u === null || D(u) || H(u) ? r(u) : t(u)
2215
+ u === null || M(u) || H(u) ? r(u) : t(u)
2139
2216
  );
2140
2217
  }
2141
2218
  function i(u) {
2142
- return u === null || u === 40 || u === 91 || D(u) || H(u) ? r(u) : n(u);
2219
+ return u === null || u === 40 || u === 91 || M(u) || H(u) ? r(u) : n(u);
2143
2220
  }
2144
2221
  function o(u) {
2145
2222
  return re(u) ? a(u) : t(u);
@@ -2148,7 +2225,7 @@ function Ta(e, r, t) {
2148
2225
  return u === 59 ? (e.consume(u), n) : re(u) ? (e.consume(u), a) : t(u);
2149
2226
  }
2150
2227
  }
2151
- function Aa(e, r, t) {
2228
+ function La(e, r, t) {
2152
2229
  return n;
2153
2230
  function n(o) {
2154
2231
  return e.consume(o), i;
@@ -2157,13 +2234,13 @@ function Aa(e, r, t) {
2157
2234
  return Me(o) ? t(o) : r(o);
2158
2235
  }
2159
2236
  }
2160
- function Pt(e) {
2161
- return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || D(e);
2237
+ function _t(e) {
2238
+ return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || M(e);
2162
2239
  }
2163
- function Rt(e) {
2240
+ function Ft(e) {
2164
2241
  return !re(e);
2165
2242
  }
2166
- function Et(e) {
2243
+ function zt(e) {
2167
2244
  return !(e === 47 || Le(e));
2168
2245
  }
2169
2246
  function Le(e) {
@@ -2184,7 +2261,7 @@ function Re(e) {
2184
2261
  }
2185
2262
  return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
2186
2263
  }
2187
- function Ia(e, r, t) {
2264
+ function Ma(e, r, t) {
2188
2265
  const n = [];
2189
2266
  let i = -1;
2190
2267
  for (; ++i < e.length; ) {
@@ -2204,11 +2281,11 @@ function z(e, r, t, n) {
2204
2281
  return F(l) && o++ < i ? (e.consume(l), u) : (e.exit(t), r(l));
2205
2282
  }
2206
2283
  }
2207
- const Na = {
2284
+ const Da = {
2208
2285
  partial: !0,
2209
- tokenize: Sa
2286
+ tokenize: Pa
2210
2287
  };
2211
- function Sa(e, r, t) {
2288
+ function Pa(e, r, t) {
2212
2289
  return n;
2213
2290
  function n(o) {
2214
2291
  return F(o) ? z(e, i, "linePrefix")(o) : i(o);
@@ -2217,37 +2294,37 @@ function Sa(e, r, t) {
2217
2294
  return o === null || Z(o) ? r(o) : t(o);
2218
2295
  }
2219
2296
  }
2220
- const La = {
2221
- tokenize: za,
2297
+ const Ra = {
2298
+ tokenize: Ua,
2222
2299
  partial: !0
2223
2300
  };
2224
- function Ma() {
2301
+ function Ea() {
2225
2302
  return {
2226
2303
  document: {
2227
2304
  91: {
2228
2305
  name: "gfmFootnoteDefinition",
2229
- tokenize: Ea,
2306
+ tokenize: ja,
2230
2307
  continuation: {
2231
- tokenize: _a
2308
+ tokenize: $a
2232
2309
  },
2233
- exit: Fa
2310
+ exit: Oa
2234
2311
  }
2235
2312
  },
2236
2313
  text: {
2237
2314
  91: {
2238
2315
  name: "gfmFootnoteCall",
2239
- tokenize: Ra
2316
+ tokenize: za
2240
2317
  },
2241
2318
  93: {
2242
2319
  name: "gfmPotentialFootnoteCall",
2243
2320
  add: "after",
2244
- tokenize: Da,
2245
- resolveTo: Pa
2321
+ tokenize: _a,
2322
+ resolveTo: Fa
2246
2323
  }
2247
2324
  }
2248
2325
  };
2249
2326
  }
2250
- function Da(e, r, t) {
2327
+ function _a(e, r, t) {
2251
2328
  const n = this;
2252
2329
  let i = n.events.length;
2253
2330
  const o = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
@@ -2265,14 +2342,14 @@ function Da(e, r, t) {
2265
2342
  function u(l) {
2266
2343
  if (!a || !a._balanced)
2267
2344
  return t(l);
2268
- const s = ae(n.sliceSerialize({
2345
+ const c = ae(n.sliceSerialize({
2269
2346
  start: a.end,
2270
2347
  end: n.now()
2271
2348
  }));
2272
- return s.codePointAt(0) !== 94 || !o.includes(s.slice(1)) ? t(l) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), r(l));
2349
+ return c.codePointAt(0) !== 94 || !o.includes(c.slice(1)) ? t(l) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), r(l));
2273
2350
  }
2274
2351
  }
2275
- function Pa(e, r) {
2352
+ function Fa(e, r) {
2276
2353
  let t = e.length;
2277
2354
  for (; t--; )
2278
2355
  if (e[t][1].type === "labelImage" && e[t][0] === "enter") {
@@ -2322,44 +2399,44 @@ function Pa(e, r) {
2322
2399
  ];
2323
2400
  return e.splice(t, e.length - t + 1, ...u), e;
2324
2401
  }
2325
- function Ra(e, r, t) {
2402
+ function za(e, r, t) {
2326
2403
  const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
2327
2404
  let o = 0, a;
2328
2405
  return u;
2329
- function u(c) {
2330
- return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), l;
2406
+ function u(s) {
2407
+ return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(s), e.exit("gfmFootnoteCallLabelMarker"), l;
2331
2408
  }
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);
2409
+ function l(s) {
2410
+ return s !== 94 ? t(s) : (e.enter("gfmFootnoteCallMarker"), e.consume(s), e.exit("gfmFootnoteCallMarker"), e.enter("gfmFootnoteCallString"), e.enter("chunkString").contentType = "string", c);
2334
2411
  }
2335
- function s(c) {
2412
+ function c(s) {
2336
2413
  if (
2337
2414
  // Too long.
2338
2415
  o > 999 || // Closing brace with nothing.
2339
- c === 93 && !a || // Space or tab is not supported by GFM for some reason.
2416
+ s === 93 && !a || // Space or tab is not supported by GFM for some reason.
2340
2417
  // `\n` and `[` not being supported makes sense.
2341
- c === null || c === 91 || D(c)
2418
+ s === null || s === 91 || M(s)
2342
2419
  )
2343
- return t(c);
2344
- if (c === 93) {
2420
+ return t(s);
2421
+ if (s === 93) {
2345
2422
  e.exit("chunkString");
2346
2423
  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);
2424
+ return i.includes(ae(n.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(s), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), r) : t(s);
2348
2425
  }
2349
- return D(c) || (a = !0), o++, e.consume(c), c === 92 ? f : s;
2426
+ return M(s) || (a = !0), o++, e.consume(s), s === 92 ? f : c;
2350
2427
  }
2351
- function f(c) {
2352
- return c === 91 || c === 92 || c === 93 ? (e.consume(c), o++, s) : s(c);
2428
+ function f(s) {
2429
+ return s === 91 || s === 92 || s === 93 ? (e.consume(s), o++, c) : c(s);
2353
2430
  }
2354
2431
  }
2355
- function Ea(e, r, t) {
2432
+ function ja(e, r, t) {
2356
2433
  const n = this, i = n.parser.gfmFootnotes || (n.parser.gfmFootnotes = []);
2357
2434
  let o, a = 0, u;
2358
2435
  return l;
2359
2436
  function l(h) {
2360
- return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), s;
2437
+ return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), c;
2361
2438
  }
2362
- function s(h) {
2439
+ function c(h) {
2363
2440
  return h === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", f) : t(h);
2364
2441
  }
2365
2442
  function f(h) {
@@ -2368,7 +2445,7 @@ function Ea(e, r, t) {
2368
2445
  a > 999 || // Closing brace with nothing.
2369
2446
  h === 93 && !u || // Space or tab is not supported by GFM for some reason.
2370
2447
  // `\n` and `[` not being supported makes sense.
2371
- h === null || h === 91 || D(h)
2448
+ h === null || h === 91 || M(h)
2372
2449
  )
2373
2450
  return t(h);
2374
2451
  if (h === 93) {
@@ -2376,25 +2453,25 @@ function Ea(e, r, t) {
2376
2453
  const k = e.exit("gfmFootnoteDefinitionLabelString");
2377
2454
  return o = ae(n.sliceSerialize(k)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
2378
2455
  }
2379
- return D(h) || (u = !0), a++, e.consume(h), h === 92 ? c : f;
2456
+ return M(h) || (u = !0), a++, e.consume(h), h === 92 ? s : f;
2380
2457
  }
2381
- function c(h) {
2458
+ function s(h) {
2382
2459
  return h === 91 || h === 92 || h === 93 ? (e.consume(h), a++, f) : f(h);
2383
2460
  }
2384
2461
  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);
2462
+ return h === 58 ? (e.enter("definitionMarker"), e.consume(h), e.exit("definitionMarker"), i.includes(o) || i.push(o), z(e, b, "gfmFootnoteDefinitionWhitespace")) : t(h);
2386
2463
  }
2387
- function g(h) {
2464
+ function b(h) {
2388
2465
  return r(h);
2389
2466
  }
2390
2467
  }
2391
- function _a(e, r, t) {
2392
- return e.check(Na, r, e.attempt(La, r, t));
2468
+ function $a(e, r, t) {
2469
+ return e.check(Da, r, e.attempt(Ra, r, t));
2393
2470
  }
2394
- function Fa(e) {
2471
+ function Oa(e) {
2395
2472
  e.exit("gfmFootnoteDefinition");
2396
2473
  }
2397
- function za(e, r, t) {
2474
+ function Ua(e, r, t) {
2398
2475
  const n = this;
2399
2476
  return z(e, i, "gfmFootnoteDefinitionIndent", 5);
2400
2477
  function i(o) {
@@ -2402,7 +2479,7 @@ function za(e, r, t) {
2402
2479
  return a && a[1].type === "gfmFootnoteDefinitionIndent" && a[2].sliceSerialize(a[1], !0).length === 4 ? r(o) : t(o);
2403
2480
  }
2404
2481
  }
2405
- function ja(e) {
2482
+ function Ba(e) {
2406
2483
  let t = (e || {}).singleTilde;
2407
2484
  const n = {
2408
2485
  name: "strikethrough",
@@ -2424,21 +2501,21 @@ function ja(e) {
2424
2501
  let l = -1;
2425
2502
  for (; ++l < a.length; )
2426
2503
  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";
2504
+ let c = l;
2505
+ for (; c--; )
2506
+ if (a[c][0] === "exit" && a[c][1].type === "strikethroughSequenceTemporary" && a[c][1]._open && // If the sizes are the same:
2507
+ a[l][1].end.offset - a[l][1].start.offset === a[c][1].end.offset - a[c][1].start.offset) {
2508
+ a[l][1].type = "strikethroughSequence", a[c][1].type = "strikethroughSequence";
2432
2509
  const f = {
2433
2510
  type: "strikethrough",
2434
- start: Object.assign({}, a[s][1].start),
2511
+ start: Object.assign({}, a[c][1].start),
2435
2512
  end: Object.assign({}, a[l][1].end)
2436
- }, c = {
2513
+ }, s = {
2437
2514
  type: "strikethroughText",
2438
- start: Object.assign({}, a[s][1].end),
2515
+ start: Object.assign({}, a[c][1].end),
2439
2516
  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;
2517
+ }, p = [["enter", f, u], ["enter", a[c][1], u], ["exit", a[c][1], u], ["enter", s, u]], b = u.parser.constructs.insideSpan.null;
2518
+ b && ce(p, p.length, 0, Ma(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", f, u]]), ce(a, c - 1, l - c + 3, p), l = c + p.length - 2;
2442
2519
  break;
2443
2520
  }
2444
2521
  }
@@ -2447,23 +2524,23 @@ function ja(e) {
2447
2524
  return a;
2448
2525
  }
2449
2526
  function o(a, u, l) {
2450
- const s = this.previous, f = this.events;
2451
- let c = 0;
2527
+ const c = this.previous, f = this.events;
2528
+ let s = 0;
2452
2529
  return p;
2453
2530
  function p(h) {
2454
- return s === 126 && f[f.length - 1][1].type !== "characterEscape" ? l(h) : (a.enter("strikethroughSequenceTemporary"), g(h));
2531
+ return c === 126 && f[f.length - 1][1].type !== "characterEscape" ? l(h) : (a.enter("strikethroughSequenceTemporary"), b(h));
2455
2532
  }
2456
- function g(h) {
2457
- const k = de(s);
2533
+ function b(h) {
2534
+ const k = de(c);
2458
2535
  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);
2536
+ return s > 1 ? l(h) : (a.consume(h), s++, b);
2537
+ if (s < 2 && !t) return l(h);
2538
+ const g = a.exit("strikethroughSequenceTemporary"), x = de(h);
2539
+ return g._open = !x || x === 2 && !!k, g._close = !k || k === 2 && !!x, u(h);
2463
2540
  }
2464
2541
  }
2465
2542
  }
2466
- class $a {
2543
+ class Wa {
2467
2544
  /**
2468
2545
  * Create a new edit map.
2469
2546
  */
@@ -2479,7 +2556,7 @@ class $a {
2479
2556
  * @returns {undefined}
2480
2557
  */
2481
2558
  add(r, t, n) {
2482
- Oa(this, r, t, n);
2559
+ Ha(this, r, t, n);
2483
2560
  }
2484
2561
  // To do: add this when moving to `micromark`.
2485
2562
  // /**
@@ -2518,7 +2595,7 @@ class $a {
2518
2595
  this.map.length = 0;
2519
2596
  }
2520
2597
  }
2521
- function Oa(e, r, t, n) {
2598
+ function Ha(e, r, t, n) {
2522
2599
  let i = 0;
2523
2600
  if (!(t === 0 && n.length === 0)) {
2524
2601
  for (; i < e.map.length; ) {
@@ -2531,7 +2608,7 @@ function Oa(e, r, t, n) {
2531
2608
  e.map.push([r, t, n]);
2532
2609
  }
2533
2610
  }
2534
- function Ua(e, r) {
2611
+ function qa(e, r) {
2535
2612
  let t = !1;
2536
2613
  const n = [];
2537
2614
  for (; r < e.length; ) {
@@ -2551,61 +2628,61 @@ function Ua(e, r) {
2551
2628
  }
2552
2629
  return n;
2553
2630
  }
2554
- function Ba() {
2631
+ function Ka() {
2555
2632
  return {
2556
2633
  flow: {
2557
2634
  null: {
2558
2635
  name: "table",
2559
- tokenize: Wa,
2560
- resolveAll: Ha
2636
+ tokenize: Va,
2637
+ resolveAll: Ga
2561
2638
  }
2562
2639
  }
2563
2640
  };
2564
2641
  }
2565
- function Wa(e, r, t) {
2642
+ function Va(e, r, t) {
2566
2643
  const n = this;
2567
2644
  let i = 0, o = 0, a;
2568
2645
  return u;
2569
2646
  function u(m) {
2570
2647
  let P = n.events.length - 1;
2571
2648
  for (; P > -1; ) {
2572
- const J = n.events[P][1].type;
2573
- if (J === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
2574
- J === "linePrefix") P--;
2649
+ const Q = n.events[P][1].type;
2650
+ if (Q === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
2651
+ Q === "linePrefix") P--;
2575
2652
  else break;
2576
2653
  }
2577
2654
  const ie = P > -1 ? n.events[P][1].type : null, O = ie === "tableHead" || ie === "tableRow" ? C : l;
2578
2655
  return O === C && n.parser.lazy[n.now().line] ? t(m) : O(m);
2579
2656
  }
2580
2657
  function l(m) {
2581
- return e.enter("tableHead"), e.enter("tableRow"), s(m);
2658
+ return e.enter("tableHead"), e.enter("tableRow"), c(m);
2582
2659
  }
2583
- function s(m) {
2660
+ function c(m) {
2584
2661
  return m === 124 || (a = !0, o += 1), f(m);
2585
2662
  }
2586
2663
  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)));
2664
+ 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, 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"), s(m)));
2588
2665
  }
2589
- function c(m) {
2590
- return m === null || m === 124 || D(m) ? (e.exit("data"), f(m)) : (e.consume(m), m === 92 ? p : c);
2666
+ function s(m) {
2667
+ return m === null || m === 124 || M(m) ? (e.exit("data"), f(m)) : (e.consume(m), m === 92 ? p : s);
2591
2668
  }
2592
2669
  function p(m) {
2593
- return m === 92 || m === 124 ? (e.consume(m), c) : c(m);
2670
+ return m === 92 || m === 124 ? (e.consume(m), s) : s(m);
2594
2671
  }
2595
- function g(m) {
2672
+ function b(m) {
2596
2673
  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));
2597
2674
  }
2598
2675
  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);
2676
+ return m === 45 || m === 58 ? g(m) : m === 124 ? (a = !0, e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), k) : v(m);
2600
2677
  }
2601
2678
  function k(m) {
2602
- return F(m) ? z(e, b, "whitespace")(m) : b(m);
2679
+ return F(m) ? z(e, g, "whitespace")(m) : g(m);
2603
2680
  }
2604
- function b(m) {
2605
- 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);
2681
+ function g(m) {
2682
+ 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) : v(m);
2606
2683
  }
2607
2684
  function x(m) {
2608
- return m === 45 ? (e.enter("tableDelimiterFiller"), w(m)) : T(m);
2685
+ return m === 45 ? (e.enter("tableDelimiterFiller"), w(m)) : v(m);
2609
2686
  }
2610
2687
  function w(m) {
2611
2688
  return m === 45 ? (e.consume(m), w) : m === 58 ? (a = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(m), e.exit("tableDelimiterMarker"), y) : (e.exit("tableDelimiterFiller"), y(m));
@@ -2614,44 +2691,44 @@ function Wa(e, r, t) {
2614
2691
  return F(m) ? z(e, A, "whitespace")(m) : A(m);
2615
2692
  }
2616
2693
  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);
2694
+ return m === 124 ? h(m) : m === null || Z(m) ? !a || i !== o ? v(m) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), r(m)) : v(m);
2618
2695
  }
2619
- function T(m) {
2696
+ function v(m) {
2620
2697
  return t(m);
2621
2698
  }
2622
2699
  function C(m) {
2623
- return e.enter("tableRow"), L(m);
2700
+ return e.enter("tableRow"), D(m);
2624
2701
  }
2625
- function L(m) {
2626
- return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), L) : m === null || Z(m) ? (e.exit("tableRow"), r(m)) : F(m) ? z(e, L, "whitespace")(m) : (e.enter("data"), E(m));
2702
+ function D(m) {
2703
+ return m === 124 ? (e.enter("tableCellDivider"), e.consume(m), e.exit("tableCellDivider"), D) : m === null || Z(m) ? (e.exit("tableRow"), r(m)) : F(m) ? z(e, D, "whitespace")(m) : (e.enter("data"), E(m));
2627
2704
  }
2628
2705
  function E(m) {
2629
- return m === null || m === 124 || D(m) ? (e.exit("data"), L(m)) : (e.consume(m), m === 92 ? q : E);
2706
+ return m === null || m === 124 || M(m) ? (e.exit("data"), D(m)) : (e.consume(m), m === 92 ? q : E);
2630
2707
  }
2631
2708
  function q(m) {
2632
2709
  return m === 92 || m === 124 ? (e.consume(m), E) : E(m);
2633
2710
  }
2634
2711
  }
2635
- 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;
2637
- const p = new $a();
2712
+ function Ga(e, r) {
2713
+ let t = -1, n = !0, i = 0, o = [0, 0, 0, 0], a = [0, 0, 0, 0], u = !1, l = 0, c, f, s;
2714
+ const p = new Wa();
2638
2715
  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 = {
2716
+ const b = e[t], h = b[1];
2717
+ b[0] === "enter" ? h.type === "tableHead" ? (u = !1, l !== 0 && (Qe(p, r, l, c, f), f = void 0, l = 0), c = {
2641
2718
  type: "table",
2642
2719
  start: Object.assign({}, h.start),
2643
2720
  // Note: correct end is set later.
2644
2721
  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 = {
2722
+ }, p.add(t, 0, [["enter", c, r]])) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (n = !0, s = void 0, o = [0, 0, 0, 0], a = [0, t + 1, 0, 0], u && (u = !1, f = {
2646
2723
  type: "tableBody",
2647
2724
  start: Object.assign({}, h.start),
2648
2725
  // Note: correct end is set later.
2649
2726
  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);
2727
+ }, 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], s = ue(p, r, o, i, void 0, s), o = [0, 0, 0, 0]), a[2] = t)) : h.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])) : h.type === "tableHead" ? (u = !0, l = t) : h.type === "tableRow" || h.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 && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") && (a[3] = t);
2651
2728
  }
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));
2729
+ for (l !== 0 && Qe(p, r, l, c, f), p.consume(r.events), t = -1; ++t < r.events.length; ) {
2730
+ const b = r.events[t];
2731
+ b[0] === "enter" && b[1].type === "table" && (b[1]._align = qa(r.events, t));
2655
2732
  }
2656
2733
  return e;
2657
2734
  }
@@ -2665,23 +2742,23 @@ function ue(e, r, t, n, i, o) {
2665
2742
  // Note: correct end is set later.
2666
2743
  end: Object.assign({}, l)
2667
2744
  }, 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 = {
2745
+ const c = G(r.events, t[2]), f = G(r.events, t[3]), s = {
2669
2746
  type: u,
2670
- start: Object.assign({}, s),
2747
+ start: Object.assign({}, c),
2671
2748
  end: Object.assign({}, f)
2672
2749
  };
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) {
2750
+ if (e.add(t[2], 0, [["enter", s, r]]), n !== 2) {
2751
+ const p = r.events[t[2]], b = r.events[t[3]];
2752
+ if (p[1].end = Object.assign({}, b[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
2676
2753
  const h = t[2] + 1, k = t[3] - t[2] - 1;
2677
2754
  e.add(h, k, []);
2678
2755
  }
2679
2756
  }
2680
- e.add(t[3] + 1, 0, [["exit", c, r]]);
2757
+ e.add(t[3] + 1, 0, [["exit", s, r]]);
2681
2758
  }
2682
2759
  return i !== void 0 && (o.end = Object.assign({}, G(r.events, i)), e.add(i, 0, [["exit", o, r]]), o = void 0), o;
2683
2760
  }
2684
- function Je(e, r, t, n, i) {
2761
+ function Qe(e, r, t, n, i) {
2685
2762
  const o = [], a = G(r.events, t);
2686
2763
  i && (i.end = Object.assign({}, a), o.push(["exit", i, r])), n.end = Object.assign({}, a), o.push(["exit", n, r]), e.add(t + 1, 0, o);
2687
2764
  }
@@ -2689,18 +2766,18 @@ function G(e, r) {
2689
2766
  const t = e[r], n = t[0] === "enter" ? "start" : "end";
2690
2767
  return t[1][n];
2691
2768
  }
2692
- const qa = {
2769
+ const Za = {
2693
2770
  name: "tasklistCheck",
2694
- tokenize: Va
2771
+ tokenize: Qa
2695
2772
  };
2696
- function Ka() {
2773
+ function Ja() {
2697
2774
  return {
2698
2775
  text: {
2699
- 91: qa
2776
+ 91: Za
2700
2777
  }
2701
2778
  };
2702
2779
  }
2703
- function Va(e, r, t) {
2780
+ function Qa(e, r, t) {
2704
2781
  const n = this;
2705
2782
  return i;
2706
2783
  function i(l) {
@@ -2712,56 +2789,56 @@ function Va(e, r, t) {
2712
2789
  );
2713
2790
  }
2714
2791
  function o(l) {
2715
- return D(l) ? (e.enter("taskListCheckValueUnchecked"), e.consume(l), e.exit("taskListCheckValueUnchecked"), a) : l === 88 || l === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(l), e.exit("taskListCheckValueChecked"), a) : t(l);
2792
+ return M(l) ? (e.enter("taskListCheckValueUnchecked"), e.consume(l), e.exit("taskListCheckValueUnchecked"), a) : l === 88 || l === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(l), e.exit("taskListCheckValueChecked"), a) : t(l);
2716
2793
  }
2717
2794
  function a(l) {
2718
2795
  return l === 93 ? (e.enter("taskListCheckMarker"), e.consume(l), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), u) : t(l);
2719
2796
  }
2720
2797
  function u(l) {
2721
2798
  return Z(l) ? r(l) : F(l) ? e.check({
2722
- tokenize: Ga
2799
+ tokenize: Xa
2723
2800
  }, r, t)(l) : t(l);
2724
2801
  }
2725
2802
  }
2726
- function Ga(e, r, t) {
2803
+ function Xa(e, r, t) {
2727
2804
  return z(e, n, "whitespace");
2728
2805
  function n(i) {
2729
2806
  return i === null ? t(i) : r(i);
2730
2807
  }
2731
2808
  }
2732
- function Za(e) {
2733
- return fa([
2734
- ba(),
2735
- Ma(),
2736
- ja(e),
2737
- Ba(),
2738
- Ka()
2809
+ function Ya(e) {
2810
+ return ga([
2811
+ ya(),
2812
+ Ea(),
2813
+ Ba(e),
2814
+ Ka(),
2815
+ Ja()
2739
2816
  ]);
2740
2817
  }
2741
- const Ja = {};
2742
- function Qa(e) {
2818
+ const ei = {};
2819
+ function ti(e) {
2743
2820
  const r = (
2744
2821
  /** @type {Processor<Root>} */
2745
2822
  this
2746
- ), t = e || Ja, n = r.data(), i = n.micromarkExtensions || (n.micromarkExtensions = []), o = n.fromMarkdownExtensions || (n.fromMarkdownExtensions = []), a = n.toMarkdownExtensions || (n.toMarkdownExtensions = []);
2747
- i.push(Za(t)), o.push(sa()), a.push(da(t));
2823
+ ), t = e || ei, n = r.data(), i = n.micromarkExtensions || (n.micromarkExtensions = []), o = n.fromMarkdownExtensions || (n.fromMarkdownExtensions = []), a = n.toMarkdownExtensions || (n.toMarkdownExtensions = []);
2824
+ i.push(Ya(t)), o.push(ma()), a.push(pa(t));
2748
2825
  }
2749
- function I(...e) {
2826
+ function N(...e) {
2750
2827
  return e.filter(Boolean).join(" ");
2751
2828
  }
2752
- const Xa = ({ content: e }) => /* @__PURE__ */ d(
2753
- Zt,
2829
+ const ri = ({ content: e }) => /* @__PURE__ */ d(
2830
+ Xt,
2754
2831
  {
2755
- remarkPlugins: [Qa],
2832
+ remarkPlugins: [ti],
2756
2833
  className: "cuadra-aui-md",
2757
- components: ti,
2834
+ components: ii,
2758
2835
  children: e
2759
2836
  }
2760
- ), _t = Ot(Xa), Ya = ({ language: e, code: r }) => {
2761
- const { isCopied: t, copyToClipboard: n } = ei();
2762
- 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: [
2837
+ ), jt = Wt(ri), ni = ({ language: e, code: r }) => {
2838
+ const { isCopied: t, copyToClipboard: n } = ai();
2839
+ return /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-justify-between cuadra-gap-4 cuadra-mt-4 cuadra-rounded-t-lg cuadra-bg-muted/50 cuadra-border-b cuadra-border-border cuadra-px-4 cuadra-py-2 cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-font-brand", children: [
2763
2840
  /* @__PURE__ */ d("span", { className: "cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand", children: e }),
2764
- /* @__PURE__ */ v(
2841
+ /* @__PURE__ */ T(
2765
2842
  "button",
2766
2843
  {
2767
2844
  onClick: () => {
@@ -2770,33 +2847,33 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2770
2847
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors",
2771
2848
  "aria-label": "Copy code",
2772
2849
  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" })
2850
+ !t && /* @__PURE__ */ d(hr, { className: "cuadra-h-4 cuadra-w-4" }),
2851
+ t && /* @__PURE__ */ d(lr, { className: "cuadra-h-4 cuadra-w-4" })
2775
2852
  ]
2776
2853
  }
2777
2854
  )
2778
2855
  ] });
2779
- }, ei = ({
2856
+ }, ai = ({
2780
2857
  copiedDuration: e = 3e3
2781
2858
  } = {}) => {
2782
- const [r, t] = N(!1);
2859
+ const [r, t] = I(!1);
2783
2860
  return { isCopied: r, copyToClipboard: (i) => {
2784
2861
  i && navigator.clipboard.writeText(i).then(() => {
2785
2862
  t(!0), setTimeout(() => t(!1), e);
2786
2863
  });
2787
2864
  } };
2788
- }, ti = Vt({
2865
+ }, ii = Jt({
2789
2866
  h1: ({ className: e, ...r }) => /* @__PURE__ */ d(
2790
2867
  "h1",
2791
2868
  {
2792
- 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),
2869
+ className: N("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand", e),
2793
2870
  ...r
2794
2871
  }
2795
2872
  ),
2796
2873
  h2: ({ className: e, ...r }) => /* @__PURE__ */ d(
2797
2874
  "h2",
2798
2875
  {
2799
- className: I(
2876
+ className: N(
2800
2877
  "cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
2801
2878
  e
2802
2879
  ),
@@ -2806,7 +2883,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2806
2883
  h3: ({ className: e, ...r }) => /* @__PURE__ */ d(
2807
2884
  "h3",
2808
2885
  {
2809
- className: I(
2886
+ className: N(
2810
2887
  "cuadra-mb-3 cuadra-mt-5 cuadra-scroll-m-20 cuadra-text-lg cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
2811
2888
  e
2812
2889
  ),
@@ -2816,38 +2893,38 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2816
2893
  h4: ({ className: e, ...r }) => /* @__PURE__ */ d(
2817
2894
  "h4",
2818
2895
  {
2819
- className: I(
2896
+ className: N(
2820
2897
  "cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",
2821
2898
  e
2822
2899
  ),
2823
2900
  ...r
2824
2901
  }
2825
2902
  ),
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 }),
2903
+ h5: ({ className: e, ...r }) => /* @__PURE__ */ d("h5", { className: N("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2904
+ h6: ({ className: e, ...r }) => /* @__PURE__ */ d("h6", { className: N("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand", e), ...r }),
2905
+ p: ({ className: e, ...r }) => /* @__PURE__ */ d("p", { className: N("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand", e), ...r }),
2829
2906
  a: ({ className: e, ...r }) => /* @__PURE__ */ d(
2830
2907
  "a",
2831
2908
  {
2832
- className: I("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
2909
+ className: N("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand", e),
2833
2910
  ...r
2834
2911
  }
2835
2912
  ),
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 }),
2913
+ blockquote: ({ className: e, ...r }) => /* @__PURE__ */ d("blockquote", { className: N("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand", e), ...r }),
2914
+ ul: ({ className: e, ...r }) => /* @__PURE__ */ d("ul", { className: N("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2915
+ ol: ({ className: e, ...r }) => /* @__PURE__ */ d("ol", { className: N("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand", e), ...r }),
2916
+ hr: ({ className: e, ...r }) => /* @__PURE__ */ d("hr", { className: N("cuadra-my-5 cuadra-border-b", e), ...r }),
2840
2917
  table: ({ className: e, ...r }) => /* @__PURE__ */ d(
2841
2918
  "table",
2842
2919
  {
2843
- className: I("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
2920
+ className: N("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand", e),
2844
2921
  ...r
2845
2922
  }
2846
2923
  ),
2847
2924
  th: ({ className: e, ...r }) => /* @__PURE__ */ d(
2848
2925
  "th",
2849
2926
  {
2850
- className: I(
2927
+ className: N(
2851
2928
  "cuadra-bg-muted cuadra-px-4 cuadra-py-2 cuadra-text-left cuadra-font-normal first:cuadra-rounded-tl-lg last:cuadra-rounded-tr-lg [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
2852
2929
  e
2853
2930
  ),
@@ -2857,7 +2934,7 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2857
2934
  td: ({ className: e, ...r }) => /* @__PURE__ */ d(
2858
2935
  "td",
2859
2936
  {
2860
- className: I(
2937
+ className: N(
2861
2938
  "cuadra-border-b cuadra-border-l cuadra-px-4 cuadra-py-2 cuadra-text-left last:cuadra-border-r [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",
2862
2939
  e
2863
2940
  ),
@@ -2867,18 +2944,18 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2867
2944
  tr: ({ className: e, ...r }) => /* @__PURE__ */ d(
2868
2945
  "tr",
2869
2946
  {
2870
- className: I(
2947
+ className: N(
2871
2948
  "cuadra-m-0 cuadra-border-b cuadra-p-0 first:cuadra-border-t [&:last-child>td:first-child]:cuadra-rounded-bl-lg [&:last-child>td:last-child]:cuadra-rounded-br-lg",
2872
2949
  e
2873
2950
  ),
2874
2951
  ...r
2875
2952
  }
2876
2953
  ),
2877
- sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2954
+ sup: ({ className: e, ...r }) => /* @__PURE__ */ d("sup", { className: N("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand", e), ...r }),
2878
2955
  pre: ({ className: e, ...r }) => /* @__PURE__ */ d(
2879
2956
  "pre",
2880
2957
  {
2881
- className: I(
2958
+ className: N(
2882
2959
  "cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",
2883
2960
  e
2884
2961
  ),
@@ -2886,48 +2963,48 @@ const Xa = ({ content: e }) => /* @__PURE__ */ d(
2886
2963
  }
2887
2964
  ),
2888
2965
  code: function({ className: r, ...t }) {
2889
- const n = Gt();
2966
+ const n = Qt();
2890
2967
  return /* @__PURE__ */ d(
2891
2968
  "code",
2892
2969
  {
2893
- className: I(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
2970
+ className: N(!n && "cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand", r),
2894
2971
  ...t
2895
2972
  }
2896
2973
  );
2897
2974
  },
2898
- CodeHeader: Ya
2899
- }), Qe = [
2975
+ CodeHeader: ni
2976
+ }), Xe = [
2900
2977
  "Sending question…",
2901
2978
  "Understanding your need…",
2902
2979
  "Scanning data…",
2903
2980
  "Comparing results…",
2904
2981
  "Composing answer…"
2905
2982
  ];
2906
- function ri({ active: e }) {
2907
- const [r, t] = N(0);
2908
- return M(() => {
2983
+ function oi({ active: e }) {
2984
+ const [r, t] = I(0);
2985
+ return L(() => {
2909
2986
  if (!e) {
2910
2987
  t(0);
2911
2988
  return;
2912
2989
  }
2913
2990
  const n = window.setInterval(() => {
2914
- t((i) => i >= Qe.length - 1 ? (window.clearInterval(n), i) : i + 1);
2991
+ t((i) => i >= Xe.length - 1 ? (window.clearInterval(n), i) : i + 1);
2915
2992
  }, 2500);
2916
2993
  return () => window.clearInterval(n);
2917
- }, [e]), e ? /* @__PURE__ */ v("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand", children: [
2994
+ }, [e]), e ? /* @__PURE__ */ T("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand", children: [
2918
2995
  "Thinking… ",
2919
- Qe[r]
2996
+ Xe[r]
2920
2997
  ] }) : null;
2921
2998
  }
2922
- function Xe({
2999
+ function Ye({
2923
3000
  welcomeTitle: e = "Hi, how can I help you today?",
2924
3001
  welcomeSubtitle: r = "Start exploring our platform and discover what you can build.",
2925
3002
  extraTopPadding: t,
2926
3003
  suggestions: n,
2927
3004
  inputPlaceholder: i = "Type your message..."
2928
3005
  } = {}) {
2929
- const o = Wt(), [a, u] = N(!1), [l, s] = N(null), [f, c] = N(!1);
2930
- return M(() => {
3006
+ const o = Vt(), [a, u] = I(!1), [l, c] = I(null), [f, s] = I(!1);
3007
+ return L(() => {
2931
3008
  if (!o) {
2932
3009
  u(!1);
2933
3010
  return;
@@ -2938,40 +3015,40 @@ function Xe({
2938
3015
  u(!1);
2939
3016
  return;
2940
3017
  }
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);
2944
- const T = x.some(
2945
- (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)
3018
+ const b = p.subscribe?.((k) => {
3019
+ const g = k?.threadId, x = k?.messages || [], w = k?.isLoadingHistory || !1, y = x.length;
3020
+ g && g !== l && c(g), u(w && y === 0);
3021
+ const v = x.some(
3022
+ (C) => C.role === "assistant" && !!C.content && (Array.isArray(C.content) ? C.content.some((D) => typeof D == "object" && D?.text ? D.text.trim().length > 0 : !1) : typeof C.content == "string" ? C.content.trim().length > 0 : !1)
2946
3023
  );
2947
- c(T);
3024
+ s(v);
2948
3025
  }), h = p.getState?.();
2949
3026
  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(
2953
- (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)
3027
+ const k = h?.threadId, g = h?.messages || [], x = h?.isLoadingHistory || !1, w = g.length;
3028
+ k && k !== l && c(k), u(x && w === 0);
3029
+ const A = g.some(
3030
+ (v) => v.role === "assistant" && !!v.content && (Array.isArray(v.content) ? v.content.some((C) => typeof C == "object" && C?.text ? C.text.trim().length > 0 : !1) : typeof v.content == "string" ? v.content.trim().length > 0 : !1)
2954
3031
  );
2955
- c(A);
3032
+ s(A);
2956
3033
  }
2957
3034
  return () => {
2958
- g && g();
3035
+ b && b();
2959
3036
  };
2960
3037
  } catch {
2961
3038
  u(!1);
2962
3039
  }
2963
- }, [o, l]), /* @__PURE__ */ v(ee.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
3040
+ }, [o, l]), /* @__PURE__ */ T(te.Root, { className: "cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full", children: [
2964
3041
  /* @__PURE__ */ d(
2965
- ee.Viewport,
3042
+ te.Viewport,
2966
3043
  {
2967
3044
  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
3045
  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" }),
3046
+ children: a ? /* @__PURE__ */ d("div", { className: "cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center", children: /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2", children: [
3047
+ /* @__PURE__ */ d(ut, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }),
2971
3048
  /* @__PURE__ */ d("p", { className: "cuadra-text-sm cuadra-text-muted-foreground font-brand", children: "Loading messages..." })
2972
- ] }) }) : /* @__PURE__ */ v(B, { children: [
2973
- /* @__PURE__ */ d(ee.Empty, { children: /* @__PURE__ */ d(
2974
- ni,
3049
+ ] }) }) : /* @__PURE__ */ T(U, { children: [
3050
+ /* @__PURE__ */ d(te.Empty, { children: /* @__PURE__ */ d(
3051
+ li,
2975
3052
  {
2976
3053
  title: e,
2977
3054
  subtitle: r,
@@ -2979,19 +3056,19 @@ function Xe({
2979
3056
  }
2980
3057
  ) }),
2981
3058
  /* @__PURE__ */ d(
2982
- ee.Messages,
3059
+ te.Messages,
2983
3060
  {
2984
3061
  components: {
2985
- UserMessage: ai,
2986
- AssistantMessage: ii
3062
+ UserMessage: ui,
3063
+ AssistantMessage: ci
2987
3064
  }
2988
3065
  }
2989
3066
  ),
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 }) }) })
3067
+ /* @__PURE__ */ d(te.If, { running: !0, children: !f && /* @__PURE__ */ d("div", { className: "cuadra-mt-2 cuadra-max-w-2xl", children: /* @__PURE__ */ d(oi, { active: !0 }) }) })
2991
3068
  ] })
2992
3069
  }
2993
3070
  ),
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: [
3071
+ /* @__PURE__ */ d("div", { className: "cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4", children: /* @__PURE__ */ T(ke.Root, { className: "cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full", children: [
2995
3072
  /* @__PURE__ */ d(
2996
3073
  ke.Input,
2997
3074
  {
@@ -3014,21 +3091,21 @@ function Xe({
3014
3091
  style: { position: "absolute", bottom: "0.5rem", right: "0.5rem" },
3015
3092
  "aria-label": "Send message",
3016
3093
  type: "button",
3017
- children: /* @__PURE__ */ d(rr, { className: "cuadra-h-4 cuadra-w-4" })
3094
+ children: /* @__PURE__ */ d(ir, { className: "cuadra-h-4 cuadra-w-4" })
3018
3095
  }
3019
3096
  ) })
3020
3097
  ] }) })
3021
3098
  ] });
3022
3099
  }
3023
- function ni({ title: e, subtitle: r, suggestions: t }) {
3024
- const n = Ht(), i = async (o) => {
3100
+ function li({ title: e, subtitle: r, suggestions: t }) {
3101
+ const n = Gt(), i = async (o) => {
3025
3102
  try {
3026
3103
  n.composer().setText(o), await new Promise((a) => setTimeout(a, 10)), n.composer().send();
3027
3104
  } catch {
3028
3105
  }
3029
3106
  };
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: [
3031
- /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3107
+ 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__ */ T("div", { className: "cuadra-text-center cuadra-max-w-3xl cuadra-w-full cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-min-h-full", children: [
3108
+ /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8", children: [
3032
3109
  /* @__PURE__ */ d("h2", { className: "cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand", children: e }),
3033
3110
  /* @__PURE__ */ d("p", { className: "cuadra-text-muted-foreground font-brand", children: r })
3034
3111
  ] }),
@@ -3045,7 +3122,7 @@ function ni({ title: e, subtitle: r, suggestions: t }) {
3045
3122
  )) })
3046
3123
  ] }) });
3047
3124
  }
3048
- function ai() {
3125
+ function ui() {
3049
3126
  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(
3050
3127
  "div",
3051
3128
  {
@@ -3065,14 +3142,14 @@ function ai() {
3065
3142
  se.Parts,
3066
3143
  {
3067
3144
  components: {
3068
- Text: ({ text: e }) => /* @__PURE__ */ d(_t, { content: e || "" })
3145
+ Text: ({ text: e }) => /* @__PURE__ */ d(jt, { content: e || "" })
3069
3146
  }
3070
3147
  }
3071
3148
  )
3072
3149
  }
3073
3150
  ) });
3074
3151
  }
3075
- function ii() {
3152
+ function ci() {
3076
3153
  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(
3077
3154
  "div",
3078
3155
  {
@@ -3086,30 +3163,30 @@ function ii() {
3086
3163
  se.Parts,
3087
3164
  {
3088
3165
  components: {
3089
- Text: ({ text: e }) => /* @__PURE__ */ d(_t, { content: e || "" })
3166
+ Text: ({ text: e }) => /* @__PURE__ */ d(jt, { content: e || "" })
3090
3167
  }
3091
3168
  }
3092
3169
  )
3093
3170
  }
3094
3171
  ) });
3095
3172
  }
3096
- 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) {
3173
+ function si({ onThreadSelect: e }) {
3174
+ const r = at(), t = Zt((g) => g.threadId), [n, i] = I(null), o = r?.id === t, a = n === r?.id, [u, l] = I(!1), [c, f] = I(r?.title || ""), [s, p] = I(!1), [b, h] = I(!1), k = async () => {
3175
+ if (!r?.remoteId || !c || c === r.title) {
3099
3176
  l(!1);
3100
3177
  return;
3101
3178
  }
3102
3179
  try {
3103
3180
  h(!0);
3104
- const b = window.__cuadraThreadListAdapter;
3105
- b && typeof b.rename == "function" && await b.rename(r.remoteId, s), l(!1), p(!1);
3181
+ const g = window.__cuadraThreadListAdapter;
3182
+ g && typeof g.rename == "function" && await g.rename(r.remoteId, c), l(!1), p(!1);
3106
3183
  } catch {
3107
3184
  l(!1), p(!1);
3108
3185
  } finally {
3109
3186
  h(!1);
3110
3187
  }
3111
3188
  };
3112
- return M(() => {
3189
+ return L(() => {
3113
3190
  r?.title && !u && f(r.title);
3114
3191
  }, [r?.title, u]), r ? /* @__PURE__ */ d(
3115
3192
  we.Root,
@@ -3118,7 +3195,7 @@ function oi({ onThreadSelect: e }) {
3118
3195
  style: { marginBottom: "0.5rem" },
3119
3196
  onMouseEnter: () => i(r.id),
3120
3197
  onMouseLeave: () => i(null),
3121
- children: /* @__PURE__ */ v(
3198
+ children: /* @__PURE__ */ T(
3122
3199
  we.Trigger,
3123
3200
  {
3124
3201
  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",
@@ -3128,32 +3205,32 @@ function oi({ onThreadSelect: e }) {
3128
3205
  "input",
3129
3206
  {
3130
3207
  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 || ""));
3208
+ value: c,
3209
+ onChange: (g) => f(g.target.value),
3210
+ onKeyDown: (g) => {
3211
+ g.key === "Enter" && k(), g.key === "Escape" && (l(!1), f(r.title || ""));
3135
3212
  },
3136
- disabled: g,
3213
+ disabled: b,
3137
3214
  autoFocus: !0,
3138
- onClick: (b) => b.stopPropagation()
3215
+ onClick: (g) => g.stopPropagation()
3139
3216
  }
3140
- ) : /* @__PURE__ */ v(B, { children: [
3217
+ ) : /* @__PURE__ */ T(U, { children: [
3141
3218
  /* @__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
3219
  r.updatedAt && /* @__PURE__ */ d("span", { className: "cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand", children: new Date(r.updatedAt).toLocaleDateString() })
3143
3220
  ] }) }),
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: [
3221
+ /* @__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 || s) && /* @__PURE__ */ T("div", { className: "cuadra-relative", children: [
3145
3222
  /* @__PURE__ */ d(
3146
3223
  "button",
3147
3224
  {
3148
3225
  className: "cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",
3149
- onClick: (b) => {
3150
- b.stopPropagation(), p(!c);
3226
+ onClick: (g) => {
3227
+ g.stopPropagation(), p(!s);
3151
3228
  },
3152
3229
  "aria-label": "Thread options",
3153
- children: /* @__PURE__ */ d(fr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3230
+ children: /* @__PURE__ */ d(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" })
3154
3231
  }
3155
3232
  ),
3156
- c && /* @__PURE__ */ v(B, { children: [
3233
+ s && /* @__PURE__ */ T(U, { children: [
3157
3234
  /* @__PURE__ */ d(
3158
3235
  "div",
3159
3236
  {
@@ -3165,19 +3242,19 @@ function oi({ onThreadSelect: e }) {
3165
3242
  "button",
3166
3243
  {
3167
3244
  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();
3245
+ onClick: (g) => {
3246
+ g.stopPropagation(), k();
3170
3247
  },
3171
- disabled: g,
3248
+ disabled: b,
3172
3249
  children: "Save"
3173
3250
  }
3174
- ) : /* @__PURE__ */ v(B, { children: [
3251
+ ) : /* @__PURE__ */ T(U, { children: [
3175
3252
  /* @__PURE__ */ d(
3176
3253
  "button",
3177
3254
  {
3178
3255
  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);
3256
+ onClick: (g) => {
3257
+ g.stopPropagation(), l(!0), f(r.title || ""), p(!1);
3181
3258
  },
3182
3259
  children: "Rename"
3183
3260
  }
@@ -3187,8 +3264,8 @@ function oi({ onThreadSelect: e }) {
3187
3264
  "button",
3188
3265
  {
3189
3266
  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);
3267
+ onClick: (g) => {
3268
+ g.stopPropagation(), p(!1);
3192
3269
  },
3193
3270
  children: "Delete"
3194
3271
  }
@@ -3202,17 +3279,17 @@ function oi({ onThreadSelect: e }) {
3202
3279
  }
3203
3280
  ) : null;
3204
3281
  }
3205
- function Ye({ onThreadSelect: e }) {
3206
- 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: [
3282
+ function et({ onThreadSelect: e }) {
3283
+ return /* @__PURE__ */ T(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
3284
  /* @__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" }) }),
3208
- /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3285
+ /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin", children: [
3209
3286
  /* @__PURE__ */ d(
3210
3287
  xe.New,
3211
3288
  {
3212
3289
  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
3290
  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" }),
3291
+ children: /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-min-w-0", children: /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3292
+ /* @__PURE__ */ d(wr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground" }),
3216
3293
  /* @__PURE__ */ d("h4", { className: "cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand", children: "New Chat" })
3217
3294
  ] }) })
3218
3295
  }
@@ -3222,14 +3299,14 @@ function Ye({ onThreadSelect: e }) {
3222
3299
  xe.Items,
3223
3300
  {
3224
3301
  components: {
3225
- ThreadListItem: (r) => /* @__PURE__ */ d(oi, { ...r, onThreadSelect: e })
3302
+ ThreadListItem: (r) => /* @__PURE__ */ d(si, { ...r, onThreadSelect: e })
3226
3303
  }
3227
3304
  }
3228
3305
  )
3229
3306
  ] })
3230
3307
  ] });
3231
3308
  }
3232
- const li = `
3309
+ const di = `
3233
3310
  @keyframes rotate {
3234
3311
  100% { transform: rotate(1turn); }
3235
3312
  }
@@ -3242,9 +3319,9 @@ const li = `
3242
3319
  style: o,
3243
3320
  contentStyle: a,
3244
3321
  rotating: u = !1
3245
- }) => /* @__PURE__ */ v(B, { children: [
3246
- /* @__PURE__ */ d("style", { children: li }),
3247
- /* @__PURE__ */ v(
3322
+ }) => /* @__PURE__ */ T(U, { children: [
3323
+ /* @__PURE__ */ d("style", { children: di }),
3324
+ /* @__PURE__ */ T(
3248
3325
  "div",
3249
3326
  {
3250
3327
  className: `cuadra-relative cuadra-bg-background md:cuadra-rounded-xl cuadra-overflow-hidden ${r}`,
@@ -3290,7 +3367,7 @@ const li = `
3290
3367
  ]
3291
3368
  }
3292
3369
  )
3293
- ] }), ui = ({ className: e = "", theme: r = "system" }) => {
3370
+ ] }), fi = ({ className: e = "", theme: r = "system" }) => {
3294
3371
  const t = () => {
3295
3372
  if (typeof window > "u") return "light";
3296
3373
  if (r === "system") {
@@ -3298,10 +3375,10 @@ const li = `
3298
3375
  return a || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
3299
3376
  }
3300
3377
  return r;
3301
- }, [n, i] = N(t);
3302
- return M(() => {
3378
+ }, [n, i] = I(t);
3379
+ return L(() => {
3303
3380
  r !== "system" && i(r);
3304
- }, [r]), M(() => {
3381
+ }, [r]), L(() => {
3305
3382
  const a = document.documentElement;
3306
3383
  a.classList.remove("light", "dark"), a.classList.add(n), r === "system" && localStorage.setItem("theme", n);
3307
3384
  }, [n, r]), /* @__PURE__ */ d(
@@ -3315,14 +3392,14 @@ const li = `
3315
3392
  disabled: r !== "system",
3316
3393
  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
3394
  children: /* @__PURE__ */ d(
3318
- ur,
3395
+ dr,
3319
3396
  {
3320
3397
  className: `cuadra-h-4 cuadra-w-4 cuadra-transition-colors ${n === "dark" ? "cuadra-text-primary" : "cuadra-text-gray-400"}`
3321
3398
  }
3322
3399
  )
3323
3400
  }
3324
3401
  );
3325
- }, et = ({
3402
+ }, tt = ({
3326
3403
  currentModel: e,
3327
3404
  models: r,
3328
3405
  modelsLoading: t,
@@ -3332,54 +3409,54 @@ const li = `
3332
3409
  showThemeToggle: a = !0,
3333
3410
  theme: u = "system",
3334
3411
  onMobileMenuClick: l,
3335
- showMobileMenuButton: s = !1
3412
+ showMobileMenuButton: c = !1
3336
3413
  }) => {
3337
- const [f, c] = N(!1), p = rt(null);
3338
- M(() => {
3414
+ const [f, s] = I(!1), p = nt(null);
3415
+ L(() => {
3339
3416
  const h = (k) => {
3340
- p.current && !p.current.contains(k.target) && c(!1);
3417
+ p.current && !p.current.contains(k.target) && s(!1);
3341
3418
  };
3342
3419
  return f && document.addEventListener("mousedown", h), () => {
3343
3420
  document.removeEventListener("mousedown", h);
3344
3421
  };
3345
3422
  }, [f]);
3346
- const g = r.find((h) => h.id === e);
3347
- 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
- /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3349
- s && /* @__PURE__ */ d(
3423
+ const b = r.find((h) => h.id === e);
3424
+ return /* @__PURE__ */ T("div", { className: "cuadra-h-16 cuadra-px-4 cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-bg-background", children: [
3425
+ /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: [
3426
+ c && /* @__PURE__ */ d(
3350
3427
  "button",
3351
3428
  {
3352
3429
  type: "button",
3353
3430
  onClick: l,
3354
3431
  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
3432
  "aria-label": "Toggle thread list",
3356
- children: /* @__PURE__ */ d(pr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3433
+ children: /* @__PURE__ */ d(kr, { className: "cuadra-h-4 cuadra-w-4 cuadra-text-foreground" })
3357
3434
  }
3358
3435
  ),
3359
- a && /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(ui, { theme: u }) })
3436
+ a && /* @__PURE__ */ d("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2", children: /* @__PURE__ */ d(fi, { theme: u }) })
3360
3437
  ] }),
3361
- /* @__PURE__ */ v("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
3438
+ /* @__PURE__ */ T("div", { className: "cuadra-flex cuadra-items-center cuadra-gap-2 md:cuadra-ml-0 cuadra-ml-auto", children: [
3362
3439
  !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: [
3364
- /* @__PURE__ */ v(
3440
+ 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__ */ T("div", { ref: p, className: "cuadra-relative cuadra-w-48", children: [
3441
+ /* @__PURE__ */ T(
3365
3442
  "button",
3366
3443
  {
3367
3444
  type: "button",
3368
- onClick: () => c(!f),
3445
+ onClick: () => s(!f),
3369
3446
  disabled: t || r.length === 0 || !!n,
3370
3447
  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
3448
  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" })
3449
+ /* @__PURE__ */ d("span", { className: b ? "cuadra-text-foreground" : "cuadra-text-muted-foreground", children: b?.name || "Select model" }),
3450
+ /* @__PURE__ */ d(cr, { className: "cuadra-ml-2 cuadra-h-4 cuadra-w-4 cuadra-opacity-50" })
3374
3451
  ]
3375
3452
  }
3376
3453
  ),
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(
3454
+ 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__ */ T(
3378
3455
  "button",
3379
3456
  {
3380
3457
  type: "button",
3381
3458
  onClick: () => {
3382
- i(h.id), c(!1);
3459
+ i(h.id), s(!1);
3383
3460
  },
3384
3461
  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"}`,
3385
3462
  children: [
@@ -3410,9 +3487,9 @@ const li = `
3410
3487
  ] })
3411
3488
  ] })
3412
3489
  ] });
3413
- }, ci = Ut(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ d(ci.Provider, { value: r, children: e });
3414
- function si() {
3415
- M(() => {
3490
+ }, hi = Ht(void 0), Ie = ({ children: e, value: r }) => /* @__PURE__ */ d(hi.Provider, { value: r, children: e });
3491
+ function mi() {
3492
+ L(() => {
3416
3493
  if (document.querySelector("style[data-cuadra-uikit]"))
3417
3494
  return;
3418
3495
  const r = document.createElement("div");
@@ -3434,8 +3511,8 @@ function si() {
3434
3511
  }, document.head.appendChild(n), o) break;
3435
3512
  }, []);
3436
3513
  }
3437
- const di = ({ config: e }) => {
3438
- si();
3514
+ const pi = ({ config: e }) => {
3515
+ mi();
3439
3516
  const {
3440
3517
  baseUrl: r,
3441
3518
  proxyUrl: t,
@@ -3445,50 +3522,50 @@ const di = ({ config: e }) => {
3445
3522
  modelId: a,
3446
3523
  onModelChange: u,
3447
3524
  ephemeral: l = !1,
3448
- systemPrompt: s,
3525
+ systemPrompt: c,
3449
3526
  initialThreadId: f,
3450
- welcomeTitle: c,
3527
+ welcomeTitle: s,
3451
3528
  welcomeSubtitle: p,
3452
- extraTopPadding: g,
3529
+ extraTopPadding: b,
3453
3530
  suggestions: h,
3454
3531
  inputPlaceholder: k,
3455
- showThemeToggle: b = !0,
3532
+ showThemeToggle: g = !0,
3456
3533
  theme: x = "system",
3457
3534
  onError: w,
3458
3535
  onChatCreated: y,
3459
3536
  onUserMessage: A,
3460
- onThreadIdUpdate: T
3461
- } = e, [C, L] = N(!1), E = t || r || "", q = !!t, m = W(
3462
- () => new lt(E, n || void 0, q),
3537
+ onThreadIdUpdate: v
3538
+ } = e, [C, D] = I(!1), E = t || r || "", q = !!t, m = B(
3539
+ () => new ct(E, n || void 0, q),
3463
3540
  [E, n, q]
3464
- ), [P, ie] = N(null), [O, J] = N(!1), [Q, Ee] = N(null), [Ft, _e] = N(!1);
3465
- M(() => {
3541
+ ), [P, ie] = I(null), [O, Q] = I(!1), [X, Ee] = I(null), [$t, _e] = I(!1);
3542
+ L(() => {
3466
3543
  i === "multiChat" && _e(!0);
3467
3544
  }, [i]);
3468
- const K = te(async () => {
3545
+ const K = J(async () => {
3469
3546
  if (o === "selector") {
3470
- J(!0), Ee(null);
3547
+ Q(!0), Ee(null);
3471
3548
  try {
3472
3549
  const S = await m.listModels();
3473
3550
  ie(S);
3474
3551
  } catch (S) {
3475
3552
  Ee(S instanceof Error ? S : new Error("Failed to load models"));
3476
3553
  } finally {
3477
- J(!1);
3554
+ Q(!1);
3478
3555
  }
3479
3556
  }
3480
3557
  }, [m, o]);
3481
- M(() => {
3558
+ L(() => {
3482
3559
  o === "selector" && K();
3483
- }, [o, K]), M(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = K), () => {
3560
+ }, [o, K]), L(() => (typeof window < "u" && (window.__cuadraUIKitRefetchModels = K), () => {
3484
3561
  typeof window < "u" && delete window.__cuadraUIKitRefetchModels;
3485
3562
  }), [K]);
3486
- const [_, Fe] = N(
3563
+ const [_, Fe] = I(
3487
3564
  o === "fixed" && a || null
3488
- ), ze = rt(_), X = te(
3565
+ ), ze = nt(_), Y = J(
3489
3566
  (S) => {
3490
- const Y = ze.current;
3491
- Fe(S), ze.current = S, u?.(S), Y !== null && Y !== S && i === "multiChat" && setTimeout(() => {
3567
+ const ee = ze.current;
3568
+ Fe(S), ze.current = S, u?.(S), ee !== null && ee !== S && i === "multiChat" && setTimeout(() => {
3492
3569
  const V = window.__cuadraThreadListRuntime;
3493
3570
  if (V?.threads?.switchToNewThread)
3494
3571
  try {
@@ -3509,31 +3586,31 @@ const di = ({ config: e }) => {
3509
3586
  },
3510
3587
  [u, i]
3511
3588
  );
3512
- M(() => {
3589
+ L(() => {
3513
3590
  if (o === "selector" && P?.items && P.items.length > 0 && !_) {
3514
3591
  const S = P.items[0];
3515
3592
  if (S?.id) {
3516
- const Y = S.id;
3517
- Fe(Y), u?.(Y);
3593
+ const ee = S.id;
3594
+ Fe(ee), u?.(ee);
3518
3595
  }
3519
3596
  }
3520
3597
  }, [o, P?.items, _, u]);
3521
- const zt = o === "fixed" ? !!a : !!_, oe = W(
3598
+ const Ot = o === "fixed" ? !!a : !!_, oe = B(
3522
3599
  () => (P?.items || []).filter((S) => S?.id && S?.displayName).map((S) => ({ id: S.id, name: S.displayName })),
3523
3600
  [P]
3524
- ), be = W(
3601
+ ), be = B(
3525
3602
  () => ({
3526
3603
  currentModelId: _ || "",
3527
3604
  models: oe,
3528
3605
  modelsLoading: O,
3529
- modelsError: Q,
3530
- onModelChange: X,
3606
+ modelsError: X,
3607
+ onModelChange: Y,
3531
3608
  refetchModels: K
3532
3609
  }),
3533
- [_, oe, O, Q, X, K]
3610
+ [_, oe, O, X, Y, K]
3534
3611
  );
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(
3536
- Cr,
3612
+ return o === "selector" && O || i === "multiChat" && $t ? /* @__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(ut, { className: "cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground" }) }) }) }) : o === "selector" && !Ot && X ? /* @__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(
3613
+ Ar,
3537
3614
  {
3538
3615
  baseUrl: q ? E : r || E,
3539
3616
  sessionToken: n,
@@ -3541,14 +3618,14 @@ const di = ({ config: e }) => {
3541
3618
  mode: i,
3542
3619
  modelMode: o,
3543
3620
  modelId: _ || a || void 0,
3544
- onModelChange: X,
3621
+ onModelChange: Y,
3545
3622
  ephemeral: l,
3546
- systemPrompt: s,
3623
+ systemPrompt: c,
3547
3624
  initialThreadId: f,
3548
3625
  onError: w,
3549
3626
  onChatCreated: y,
3550
3627
  onUserMessage: A,
3551
- onThreadIdUpdate: T,
3628
+ onThreadIdUpdate: v,
3552
3629
  onChatsLoaded: () => {
3553
3630
  i === "multiChat" && _e(!1);
3554
3631
  },
@@ -3560,83 +3637,83 @@ const di = ({ config: e }) => {
3560
3637
  className: `cuadra-h-full ${e.containerClass || ""}`,
3561
3638
  borderSizePx: 4,
3562
3639
  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: [
3564
- C && typeof document < "u" && $e(
3640
+ children: /* @__PURE__ */ d("div", { className: "cuadra-h-full cuadra-flex cuadra-relative", style: { height: "100%" }, children: i === "multiChat" ? /* @__PURE__ */ T(U, { children: [
3641
+ C && typeof document < "u" && Oe(
3565
3642
  /* @__PURE__ */ d(
3566
3643
  "div",
3567
3644
  {
3568
3645
  className: "cuadra-fixed cuadra-inset-0 cuadra-bg-black/50 cuadra-z-40 md:cuadra-hidden",
3569
- onClick: () => L(!1)
3646
+ onClick: () => D(!1)
3570
3647
  }
3571
3648
  ),
3572
3649
  document.body
3573
3650
  ),
3574
- typeof document < "u" && /* @__PURE__ */ v(B, { children: [
3651
+ typeof document < "u" && /* @__PURE__ */ T(U, { children: [
3575
3652
  /* @__PURE__ */ d(
3576
3653
  "div",
3577
3654
  {
3578
3655
  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
3656
  style: { borderRightWidth: "1px", height: "100%" },
3580
- children: /* @__PURE__ */ d(Ye, { onThreadSelect: () => L(!1) })
3657
+ children: /* @__PURE__ */ d(et, { onThreadSelect: () => D(!1) })
3581
3658
  }
3582
3659
  ),
3583
- C && $e(
3660
+ C && Oe(
3584
3661
  /* @__PURE__ */ d(
3585
3662
  "div",
3586
3663
  {
3587
3664
  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
3665
  style: { borderRightWidth: "1px" },
3589
- children: /* @__PURE__ */ d(Ye, { onThreadSelect: () => L(!1) })
3666
+ children: /* @__PURE__ */ d(et, { onThreadSelect: () => D(!1) })
3590
3667
  }
3591
3668
  ),
3592
3669
  document.body
3593
3670
  )
3594
3671
  ] }),
3595
- /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3672
+ /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3596
3673
  o === "selector" && /* @__PURE__ */ d(
3597
- et,
3674
+ tt,
3598
3675
  {
3599
3676
  currentModel: _ || "",
3600
3677
  models: oe,
3601
3678
  modelsLoading: O,
3602
- modelsError: Q,
3603
- onModelChange: X,
3604
- showThemeToggle: b,
3679
+ modelsError: X,
3680
+ onModelChange: Y,
3681
+ showThemeToggle: g,
3605
3682
  theme: x,
3606
- onMobileMenuClick: () => L(!C),
3683
+ onMobileMenuClick: () => D(!C),
3607
3684
  showMobileMenuButton: i === "multiChat"
3608
3685
  }
3609
3686
  ),
3610
3687
  /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
3611
- Xe,
3688
+ Ye,
3612
3689
  {
3613
- welcomeTitle: c,
3690
+ welcomeTitle: s,
3614
3691
  welcomeSubtitle: p,
3615
- extraTopPadding: g,
3692
+ extraTopPadding: b,
3616
3693
  suggestions: h,
3617
3694
  inputPlaceholder: k
3618
3695
  }
3619
3696
  ) })
3620
3697
  ] })
3621
- ] }) : /* @__PURE__ */ v("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3698
+ ] }) : /* @__PURE__ */ T("div", { className: "cuadra-flex-1 cuadra-flex cuadra-flex-col", children: [
3622
3699
  o === "selector" && /* @__PURE__ */ d(
3623
- et,
3700
+ tt,
3624
3701
  {
3625
3702
  currentModel: _ || "",
3626
3703
  models: oe,
3627
3704
  modelsLoading: O,
3628
- modelsError: Q,
3629
- onModelChange: X,
3630
- showThemeToggle: b,
3705
+ modelsError: X,
3706
+ onModelChange: Y,
3707
+ showThemeToggle: g,
3631
3708
  theme: x
3632
3709
  }
3633
3710
  ),
3634
3711
  /* @__PURE__ */ d("div", { className: "cuadra-flex-1 cuadra-relative cuadra-min-h-0 cuadra-space-y-4 cuadra-p-4", children: /* @__PURE__ */ d(
3635
- Xe,
3712
+ Ye,
3636
3713
  {
3637
- welcomeTitle: c,
3714
+ welcomeTitle: s,
3638
3715
  welcomeSubtitle: p,
3639
- extraTopPadding: g,
3716
+ extraTopPadding: b,
3640
3717
  suggestions: h
3641
3718
  }
3642
3719
  ) })
@@ -3646,7 +3723,7 @@ const di = ({ config: e }) => {
3646
3723
  }
3647
3724
  ) }) });
3648
3725
  };
3649
- function xi(e) {
3726
+ function vi(e) {
3650
3727
  const r = {
3651
3728
  baseUrl: e.baseUrl,
3652
3729
  proxyUrl: e.proxyUrl,
@@ -3672,9 +3749,9 @@ function xi(e) {
3672
3749
  theme: e.theme,
3673
3750
  containerClass: e.className
3674
3751
  };
3675
- return /* @__PURE__ */ d(di, { config: r });
3752
+ return /* @__PURE__ */ d(pi, { config: r });
3676
3753
  }
3677
3754
  export {
3678
- xi as CuadraChat
3755
+ vi as CuadraChat
3679
3756
  };
3680
3757
  //# sourceMappingURL=index.mjs.map