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