@pagelines/sdk 1.0.419 → 1.0.421
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.
|
@@ -2,8 +2,8 @@ var Dn = Object.defineProperty;
|
|
|
2
2
|
var ws = (l, t, e) => t in l ? Dn(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
|
|
3
3
|
var u = (l, t) => Dn(l, "name", { value: t, configurable: !0 });
|
|
4
4
|
var C = (l, t, e) => ws(l, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
-
import { defineComponent as Ee, openBlock as
|
|
6
|
-
import { SettingsObject as ys, Agent as
|
|
5
|
+
import { defineComponent as Ee, openBlock as A, createElementBlock as E, createElementVNode as T, normalizeClass as _, ref as V, watch as Je, computed as F, createCommentVNode as G, renderSlot as Yn, onMounted as Kt, Fragment as Te, renderList as mt, withDirectives as Zn, vModelText as Xn, unref as Vt, toDisplayString as ue, nextTick as Ut, createVNode as Bt, createTextVNode as pt, shallowRef as vs } from "vue";
|
|
6
|
+
import { SettingsObject as ys, Agent as kt, getDefaultAvatarUrl as Kn, createLogger as Ts } from "@pagelines/core";
|
|
7
7
|
import { P as Ss } from "./sdkClient.js";
|
|
8
8
|
const As = { class: "spinner max-w-sm" }, Es = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
@@ -15,10 +15,10 @@ const As = { class: "spinner max-w-sm" }, Es = {
|
|
|
15
15
|
colorMode: { type: String, default: "primary" }
|
|
16
16
|
},
|
|
17
17
|
setup(l) {
|
|
18
|
-
return (t, e) => (
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
class:
|
|
18
|
+
return (t, e) => (A(), E("div", As, [
|
|
19
|
+
(A(), E("svg", Es, [
|
|
20
|
+
T("circle", {
|
|
21
|
+
class: _([l.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
24
24
|
r: "20",
|
|
@@ -41,16 +41,16 @@ const As = { class: "spinner max-w-sm" }, Es = {
|
|
|
41
41
|
C(this, "isConnecting", !1);
|
|
42
42
|
// Chat conversation tracking (server-managed persistence)
|
|
43
43
|
C(this, "conversationId");
|
|
44
|
-
C(this, "textState",
|
|
44
|
+
C(this, "textState", V({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
C(this, "agentMode",
|
|
51
|
-
C(this, "sharedMessages",
|
|
50
|
+
C(this, "agentMode", V("self"));
|
|
51
|
+
C(this, "sharedMessages", V([]));
|
|
52
52
|
C(this, "_agent");
|
|
53
|
-
this._agent = e.agent instanceof
|
|
53
|
+
this._agent = e.agent instanceof kt ? e.agent : new kt({ config: e.agent }), this.setupModeWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
56
56
|
return this._agent.chatAvailable.value;
|
|
@@ -165,39 +165,39 @@ Current User:
|
|
|
165
165
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
166
166
|
const a = `stream-${Date.now()}`;
|
|
167
167
|
let o = !1;
|
|
168
|
-
const c = /* @__PURE__ */ u((
|
|
168
|
+
const c = /* @__PURE__ */ u((g) => {
|
|
169
169
|
o || (o = !0, this.sharedMessages.value = [
|
|
170
170
|
...this.sharedMessages.value,
|
|
171
171
|
{ id: a, text: "", sender: "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
172
172
|
]);
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
}, "onDelta"), d = /* @__PURE__ */ u((
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
let
|
|
173
|
+
const m = this.sharedMessages.value, y = m[m.length - 1];
|
|
174
|
+
y?.id === a && (y.text += g, this.sharedMessages.value = [...m]);
|
|
175
|
+
}, "onDelta"), d = /* @__PURE__ */ u((g) => {
|
|
176
|
+
const m = this.sharedMessages.value, y = m[m.length - 1];
|
|
177
|
+
if (y?.id === a && y.text) {
|
|
178
|
+
let S = y.text;
|
|
179
179
|
for (const O of _s)
|
|
180
|
-
O.pattern.test(
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
}, "onDone"),
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
this.isTransientError(
|
|
189
|
-
}, "onError"), p = /* @__PURE__ */ u((
|
|
190
|
-
this.addMessage(
|
|
180
|
+
O.pattern.test(S) && (console.debug(`[chat] filtered directive: ${O.label}`), S = S.replace(O.pattern, "").trim(), O.pattern.lastIndex = 0);
|
|
181
|
+
S ? S !== y.text && (y.text = S, this.sharedMessages.value = [...m]) : this.sharedMessages.value = m.slice(0, -1);
|
|
182
|
+
}
|
|
183
|
+
g && (this.conversationId = g), this.updateState(this.textState, { isThinking: !1 });
|
|
184
|
+
}, "onDone"), f = /* @__PURE__ */ u((g) => {
|
|
185
|
+
const m = this.sharedMessages.value, y = m[m.length - 1];
|
|
186
|
+
y?.id === a && !y.text && (this.sharedMessages.value = m.slice(0, -1));
|
|
187
|
+
const S = this.mapChatError(g);
|
|
188
|
+
this.isTransientError(g) ? (this.addMessage(S, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(S));
|
|
189
|
+
}, "onError"), p = /* @__PURE__ */ u((g) => {
|
|
190
|
+
this.addMessage(g, "system");
|
|
191
191
|
}, "onStatus");
|
|
192
192
|
try {
|
|
193
|
-
const
|
|
193
|
+
const g = s ? s({
|
|
194
194
|
message: e,
|
|
195
195
|
attachments: n,
|
|
196
196
|
conversationId: this.conversationId,
|
|
197
197
|
history: this.buildHistory(),
|
|
198
198
|
onDelta: c,
|
|
199
199
|
onDone: d,
|
|
200
|
-
onError:
|
|
200
|
+
onError: f,
|
|
201
201
|
onStatus: p
|
|
202
202
|
}) : r.chatStream({
|
|
203
203
|
handle: this._agent.handle.value,
|
|
@@ -209,15 +209,15 @@ Current User:
|
|
|
209
209
|
context: this.getDynamicSettings().context || void 0,
|
|
210
210
|
onDelta: c,
|
|
211
211
|
onDone: d,
|
|
212
|
-
onError:
|
|
212
|
+
onError: f,
|
|
213
213
|
onStatus: p
|
|
214
214
|
});
|
|
215
215
|
await Promise.race([
|
|
216
|
-
|
|
217
|
-
new Promise((
|
|
216
|
+
g,
|
|
217
|
+
new Promise((m, y) => setTimeout(() => y(new Error("timed out")), Rs))
|
|
218
218
|
]);
|
|
219
|
-
} catch (
|
|
220
|
-
g
|
|
219
|
+
} catch (g) {
|
|
220
|
+
f(g.message || "Something went wrong");
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
buildHistory() {
|
|
@@ -274,38 +274,38 @@ const Ds = {
|
|
|
274
274
|
iconAfter: {}
|
|
275
275
|
},
|
|
276
276
|
setup(l) {
|
|
277
|
-
const t =
|
|
277
|
+
const t = F(() => ({
|
|
278
278
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
279
279
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
280
280
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
281
281
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"
|
|
282
|
-
})[l.theme]), e =
|
|
282
|
+
})[l.theme]), e = F(() => ({
|
|
283
283
|
sm: "px-4 py-2 text-sm",
|
|
284
284
|
md: "px-6 py-3 text-base",
|
|
285
285
|
lg: "px-8 py-4 text-base"
|
|
286
|
-
})[l.size]), n =
|
|
286
|
+
})[l.size]), n = F(() => ({
|
|
287
287
|
sm: "size-4",
|
|
288
288
|
md: "size-4",
|
|
289
289
|
lg: "size-5"
|
|
290
290
|
})[l.size]);
|
|
291
|
-
return (s, r) => (
|
|
292
|
-
class:
|
|
291
|
+
return (s, r) => (A(), E("button", {
|
|
292
|
+
class: _(["relative inline-flex items-center justify-center gap-2 font-medium rounded-full backdrop-blur-sm border-2 text-white transition-all duration-200 focus:outline-none active:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer", [t.value, e.value]])
|
|
293
293
|
}, [
|
|
294
|
-
l.loading ? (
|
|
295
|
-
|
|
296
|
-
])])) :
|
|
297
|
-
|
|
298
|
-
class:
|
|
294
|
+
l.loading ? (A(), E("div", Ds, [...r[0] || (r[0] = [
|
|
295
|
+
T("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
296
|
+
])])) : G("", !0),
|
|
297
|
+
T("span", {
|
|
298
|
+
class: _(["flex items-center gap-2 transition-opacity duration-200", l.loading ? "opacity-0" : "opacity-100"])
|
|
299
299
|
}, [
|
|
300
|
-
l.icon ? (
|
|
300
|
+
l.icon ? (A(), E("i", {
|
|
301
301
|
key: 0,
|
|
302
|
-
class:
|
|
303
|
-
}, null, 2)) :
|
|
302
|
+
class: _([l.icon, n.value])
|
|
303
|
+
}, null, 2)) : G("", !0),
|
|
304
304
|
Yn(s.$slots, "default"),
|
|
305
|
-
l.iconAfter ? (
|
|
305
|
+
l.iconAfter ? (A(), E("i", {
|
|
306
306
|
key: 1,
|
|
307
|
-
class:
|
|
308
|
-
}, null, 2)) :
|
|
307
|
+
class: _([l.iconAfter, n.value])
|
|
308
|
+
}, null, 2)) : G("", !0)
|
|
309
309
|
], 2)
|
|
310
310
|
], 2));
|
|
311
311
|
}
|
|
@@ -317,7 +317,7 @@ const Ds = {
|
|
|
317
317
|
emits: ["update:modelValue"],
|
|
318
318
|
setup(l, { emit: t }) {
|
|
319
319
|
const e = t;
|
|
320
|
-
return (n, s) => (
|
|
320
|
+
return (n, s) => (A(), E("input", {
|
|
321
321
|
type: "email",
|
|
322
322
|
autocomplete: "email",
|
|
323
323
|
placeholder: "Enter Your Email",
|
|
@@ -336,7 +336,7 @@ const Ds = {
|
|
|
336
336
|
},
|
|
337
337
|
emits: ["update:modelValue", "autoSubmit"],
|
|
338
338
|
setup(l, { emit: t }) {
|
|
339
|
-
const e = l, n = t, s =
|
|
339
|
+
const e = l, n = t, s = V([]), r = V(Array.from({ length: e.length }).fill("")), a = V(!1);
|
|
340
340
|
Kt(() => {
|
|
341
341
|
e.modelValue && (r.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && s.value[0]?.focus();
|
|
342
342
|
}), Je(() => e.modelValue, (p) => {
|
|
@@ -345,57 +345,57 @@ const Ds = {
|
|
|
345
345
|
const p = r.value.filter(Boolean).join("");
|
|
346
346
|
n("update:modelValue", p), p.length === e.length && n("autoSubmit", p);
|
|
347
347
|
}, { deep: !0 });
|
|
348
|
-
function o(p,
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
352
|
-
r.value =
|
|
348
|
+
function o(p, g) {
|
|
349
|
+
g.preventDefault(), a.value = !0;
|
|
350
|
+
const m = (g.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
351
|
+
if (m.length === e.length)
|
|
352
|
+
r.value = m.split(""), setTimeout(() => {
|
|
353
353
|
s.value[e.length - 1]?.focus(), a.value = !1;
|
|
354
354
|
}, 10);
|
|
355
355
|
else {
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}), r.value =
|
|
360
|
-
const
|
|
356
|
+
const y = [...r.value];
|
|
357
|
+
m.split("").slice(0, e.length - p).forEach((O, ge) => {
|
|
358
|
+
y[p + ge] = O;
|
|
359
|
+
}), r.value = y;
|
|
360
|
+
const S = Math.min(p + m.length, e.length - 1);
|
|
361
361
|
setTimeout(() => {
|
|
362
|
-
s.value[
|
|
362
|
+
s.value[S]?.focus(), a.value = !1;
|
|
363
363
|
}, 10);
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
u(o, "onPaste");
|
|
367
|
-
function c(p,
|
|
368
|
-
const
|
|
369
|
-
r.value[p] =
|
|
367
|
+
function c(p, g) {
|
|
368
|
+
const m = g.target.value.slice(-1).replace(/\D/g, "");
|
|
369
|
+
r.value[p] = m, m && p < e.length - 1 && s.value[p + 1]?.focus();
|
|
370
370
|
}
|
|
371
371
|
u(c, "onInput");
|
|
372
|
-
function d(p,
|
|
373
|
-
|
|
372
|
+
function d(p, g) {
|
|
373
|
+
g.key === "Backspace" ? (g.preventDefault(), r.value[p] = "", p > 0 && s.value[p - 1]?.focus()) : g.key === "ArrowLeft" && p > 0 ? s.value[p - 1]?.focus() : g.key === "ArrowRight" && p < e.length - 1 && s.value[p + 1]?.focus();
|
|
374
374
|
}
|
|
375
375
|
u(d, "onKeydown");
|
|
376
|
-
function
|
|
376
|
+
function f(p) {
|
|
377
377
|
if (s.value[p]?.select(), !a.value && r.value[p])
|
|
378
|
-
for (let
|
|
379
|
-
r.value[
|
|
378
|
+
for (let g = p; g < e.length; g++)
|
|
379
|
+
r.value[g] = "";
|
|
380
380
|
}
|
|
381
|
-
return u(
|
|
382
|
-
(
|
|
383
|
-
key:
|
|
381
|
+
return u(f, "onFocus"), (p, g) => (A(), E("div", Is, [
|
|
382
|
+
(A(!0), E(Te, null, mt(l.length, (m) => Zn((A(), E("input", {
|
|
383
|
+
key: m,
|
|
384
384
|
ref_for: !0,
|
|
385
|
-
ref: /* @__PURE__ */ u((
|
|
386
|
-
"onUpdate:modelValue": /* @__PURE__ */ u((
|
|
385
|
+
ref: /* @__PURE__ */ u((y) => s.value[m - 1] = y, "ref"),
|
|
386
|
+
"onUpdate:modelValue": /* @__PURE__ */ u((y) => r.value[m - 1] = y, "onUpdate:modelValue"),
|
|
387
387
|
type: "text",
|
|
388
388
|
inputmode: "numeric",
|
|
389
389
|
autocomplete: "one-time-code",
|
|
390
390
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
391
391
|
style: { "font-size": "16px" },
|
|
392
392
|
maxlength: "1",
|
|
393
|
-
onInput: /* @__PURE__ */ u((
|
|
394
|
-
onKeydown: /* @__PURE__ */ u((
|
|
395
|
-
onPaste: /* @__PURE__ */ u((
|
|
396
|
-
onFocus: /* @__PURE__ */ u((
|
|
393
|
+
onInput: /* @__PURE__ */ u((y) => c(m - 1, y), "onInput"),
|
|
394
|
+
onKeydown: /* @__PURE__ */ u((y) => d(m - 1, y), "onKeydown"),
|
|
395
|
+
onPaste: /* @__PURE__ */ u((y) => o(m - 1, y), "onPaste"),
|
|
396
|
+
onFocus: /* @__PURE__ */ u((y) => f(m - 1), "onFocus")
|
|
397
397
|
}, null, 40, Ms)), [
|
|
398
|
-
[Xn, r.value[
|
|
398
|
+
[Xn, r.value[m - 1]]
|
|
399
399
|
])), 128))
|
|
400
400
|
]));
|
|
401
401
|
}
|
|
@@ -411,16 +411,16 @@ const Ds = {
|
|
|
411
411
|
layout: { default: "centered" }
|
|
412
412
|
},
|
|
413
413
|
setup(l) {
|
|
414
|
-
return (t, e) => (
|
|
415
|
-
class:
|
|
414
|
+
return (t, e) => (A(), E("div", {
|
|
415
|
+
class: _(["flex gap-4", [
|
|
416
416
|
l.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
417
417
|
]])
|
|
418
418
|
}, [
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
class:
|
|
419
|
+
T("div", Ls, [
|
|
420
|
+
T("div", {
|
|
421
|
+
class: _(["rounded-full overflow-hidden border-white", l.size === "lg" ? "w-20 h-20 sm:w-24 sm:h-24 border-4" : "w-16 sm:size-16 border-2"])
|
|
422
422
|
}, [
|
|
423
|
-
|
|
423
|
+
T("img", {
|
|
424
424
|
src: l.agent.avatarUrl.value,
|
|
425
425
|
alt: l.agent.displayName.value,
|
|
426
426
|
class: "w-full h-full object-cover",
|
|
@@ -428,25 +428,25 @@ const Ds = {
|
|
|
428
428
|
(...n) => Vt(Ln) && Vt(Ln)(...n))
|
|
429
429
|
}, null, 40, zs)
|
|
430
430
|
], 2),
|
|
431
|
-
|
|
432
|
-
l.isOnline ? (
|
|
433
|
-
e[1] || (e[1] =
|
|
431
|
+
T("div", Os, [
|
|
432
|
+
l.isOnline ? (A(), E(Te, { key: 0 }, [
|
|
433
|
+
e[1] || (e[1] = T("div", {
|
|
434
434
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
435
435
|
style: { "animation-duration": "3s" }
|
|
436
436
|
}, null, -1)),
|
|
437
|
-
e[2] || (e[2] =
|
|
438
|
-
], 64)) : (
|
|
437
|
+
e[2] || (e[2] = T("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
438
|
+
], 64)) : (A(), E("div", Ns))
|
|
439
439
|
])
|
|
440
440
|
]),
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
class:
|
|
441
|
+
T("div", Ps, [
|
|
442
|
+
T("h1", {
|
|
443
|
+
class: _(["font-light text-white mb-1 truncate", [
|
|
444
444
|
l.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
445
445
|
l.layout === "horizontal" ? "text-white/95" : ""
|
|
446
446
|
]])
|
|
447
447
|
}, ue(l.agent.displayName.value), 3),
|
|
448
|
-
|
|
449
|
-
class:
|
|
448
|
+
T("p", {
|
|
449
|
+
class: _(["font-light line-clamp-1", [
|
|
450
450
|
l.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
451
451
|
l.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
452
452
|
]])
|
|
@@ -463,14 +463,14 @@ const {
|
|
|
463
463
|
getOwnPropertyDescriptor: Fs
|
|
464
464
|
} = Object;
|
|
465
465
|
let {
|
|
466
|
-
freeze:
|
|
466
|
+
freeze: Z,
|
|
467
467
|
seal: te,
|
|
468
|
-
create:
|
|
468
|
+
create: xt
|
|
469
469
|
} = Object, {
|
|
470
470
|
apply: Yt,
|
|
471
471
|
construct: Zt
|
|
472
472
|
} = typeof Reflect < "u" && Reflect;
|
|
473
|
-
|
|
473
|
+
Z || (Z = /* @__PURE__ */ u(function(t) {
|
|
474
474
|
return t;
|
|
475
475
|
}, "freeze"));
|
|
476
476
|
te || (te = /* @__PURE__ */ u(function(t) {
|
|
@@ -486,8 +486,8 @@ Zt || (Zt = /* @__PURE__ */ u(function(t) {
|
|
|
486
486
|
n[s - 1] = arguments[s];
|
|
487
487
|
return new t(...n);
|
|
488
488
|
}, "construct"));
|
|
489
|
-
const
|
|
490
|
-
function
|
|
489
|
+
const dt = X(Array.prototype.forEach), Hs = X(Array.prototype.lastIndexOf), On = X(Array.prototype.pop), je = X(Array.prototype.push), Gs = X(Array.prototype.splice), bt = X(String.prototype.toLowerCase), Ft = X(String.prototype.toString), Ht = X(String.prototype.match), qe = X(String.prototype.replace), Ws = X(String.prototype.indexOf), js = X(String.prototype.trim), Q = X(Object.prototype.hasOwnProperty), q = X(RegExp.prototype.test), Ve = qs(TypeError);
|
|
490
|
+
function X(l) {
|
|
491
491
|
return function(t) {
|
|
492
492
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
493
493
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
@@ -495,7 +495,7 @@ function K(l) {
|
|
|
495
495
|
return Yt(l, t, n);
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
|
-
u(
|
|
498
|
+
u(X, "unapply");
|
|
499
499
|
function qs(l) {
|
|
500
500
|
return function() {
|
|
501
501
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
@@ -504,8 +504,8 @@ function qs(l) {
|
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
506
|
u(qs, "unconstruct");
|
|
507
|
-
function
|
|
508
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
507
|
+
function R(l, t) {
|
|
508
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : bt;
|
|
509
509
|
zn && zn(l, null);
|
|
510
510
|
let n = t.length;
|
|
511
511
|
for (; n--; ) {
|
|
@@ -518,17 +518,17 @@ function D(l, t) {
|
|
|
518
518
|
}
|
|
519
519
|
return l;
|
|
520
520
|
}
|
|
521
|
-
u(
|
|
521
|
+
u(R, "addToSet");
|
|
522
522
|
function Vs(l) {
|
|
523
523
|
for (let t = 0; t < l.length; t++)
|
|
524
|
-
|
|
524
|
+
Q(l, t) || (l[t] = null);
|
|
525
525
|
return l;
|
|
526
526
|
}
|
|
527
527
|
u(Vs, "cleanArray");
|
|
528
528
|
function oe(l) {
|
|
529
|
-
const t =
|
|
529
|
+
const t = xt(null);
|
|
530
530
|
for (const [e, n] of Qn(l))
|
|
531
|
-
|
|
531
|
+
Q(l, e) && (Array.isArray(n) ? t[e] = Vs(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = oe(n) : t[e] = n);
|
|
532
532
|
return t;
|
|
533
533
|
}
|
|
534
534
|
u(oe, "clone");
|
|
@@ -537,9 +537,9 @@ function Ye(l, t) {
|
|
|
537
537
|
const n = Fs(l, t);
|
|
538
538
|
if (n) {
|
|
539
539
|
if (n.get)
|
|
540
|
-
return
|
|
540
|
+
return X(n.get);
|
|
541
541
|
if (typeof n.value == "function")
|
|
542
|
-
return
|
|
542
|
+
return X(n.value);
|
|
543
543
|
}
|
|
544
544
|
l = Bs(l);
|
|
545
545
|
}
|
|
@@ -549,7 +549,7 @@ function Ye(l, t) {
|
|
|
549
549
|
return u(e, "fallbackValue"), e;
|
|
550
550
|
}
|
|
551
551
|
u(Ye, "lookupGetter");
|
|
552
|
-
const Nn =
|
|
552
|
+
const Nn = Z(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Gt = Z(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Wt = Z(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Ys = Z(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), jt = Z(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Zs = Z(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Pn = Z(["#text"]), $n = Z(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), qt = Z(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Un = Z(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), ft = Z(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Xs = te(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Ks = te(/<%[\w\W]*|[\w\W]*%>/gm), Qs = te(/\$\{[\w\W]*/gm), Js = te(/^data-[\-\w.\u00B7-\uFFFF]+$/), er = te(/^aria-[\-\w]+$/), Jn = te(
|
|
553
553
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
554
554
|
// eslint-disable-line no-useless-escape
|
|
555
555
|
), tr = te(/^(?:\w+script|data):/i), nr = te(
|
|
@@ -624,43 +624,43 @@ function ts() {
|
|
|
624
624
|
Node: o,
|
|
625
625
|
Element: c,
|
|
626
626
|
NodeFilter: d,
|
|
627
|
-
NamedNodeMap:
|
|
627
|
+
NamedNodeMap: f = l.NamedNodeMap || l.MozNamedAttrMap,
|
|
628
628
|
HTMLFormElement: p,
|
|
629
|
-
DOMParser:
|
|
630
|
-
trustedTypes:
|
|
631
|
-
} = l,
|
|
629
|
+
DOMParser: g,
|
|
630
|
+
trustedTypes: m
|
|
631
|
+
} = l, y = c.prototype, S = Ye(y, "cloneNode"), O = Ye(y, "remove"), ge = Ye(y, "nextSibling"), me = Ye(y, "childNodes"), ne = Ye(y, "parentNode");
|
|
632
632
|
if (typeof a == "function") {
|
|
633
633
|
const w = e.createElement("template");
|
|
634
634
|
w.content && w.content.ownerDocument && (e = w.content.ownerDocument);
|
|
635
635
|
}
|
|
636
|
-
let
|
|
636
|
+
let $, j = "";
|
|
637
637
|
const {
|
|
638
|
-
implementation:
|
|
639
|
-
createNodeIterator:
|
|
640
|
-
createDocumentFragment:
|
|
641
|
-
getElementsByTagName:
|
|
638
|
+
implementation: se,
|
|
639
|
+
createNodeIterator: he,
|
|
640
|
+
createDocumentFragment: tt,
|
|
641
|
+
getElementsByTagName: L
|
|
642
642
|
} = e, {
|
|
643
643
|
importNode: nt
|
|
644
644
|
} = n;
|
|
645
|
-
let
|
|
646
|
-
t.isSupported = typeof Qn == "function" && typeof ne == "function" &&
|
|
645
|
+
let U = Fn();
|
|
646
|
+
t.isSupported = typeof Qn == "function" && typeof ne == "function" && se && se.createHTMLDocument !== void 0;
|
|
647
647
|
const {
|
|
648
|
-
MUSTACHE_EXPR:
|
|
648
|
+
MUSTACHE_EXPR: Re,
|
|
649
649
|
ERB_EXPR: Fe,
|
|
650
|
-
TMPLIT_EXPR:
|
|
650
|
+
TMPLIT_EXPR: De,
|
|
651
651
|
DATA_ATTR: At,
|
|
652
652
|
ARIA_ATTR: Et,
|
|
653
653
|
IS_SCRIPT_OR_DATA: _t,
|
|
654
|
-
ATTR_WHITESPACE:
|
|
655
|
-
CUSTOM_ELEMENT:
|
|
654
|
+
ATTR_WHITESPACE: st,
|
|
655
|
+
CUSTOM_ELEMENT: rt
|
|
656
656
|
} = Bn;
|
|
657
657
|
let {
|
|
658
|
-
IS_ALLOWED_URI:
|
|
659
|
-
} = Bn,
|
|
660
|
-
const
|
|
661
|
-
let
|
|
662
|
-
const
|
|
663
|
-
let
|
|
658
|
+
IS_ALLOWED_URI: He
|
|
659
|
+
} = Bn, b = null;
|
|
660
|
+
const v = R({}, [...Nn, ...Gt, ...Wt, ...jt, ...Pn]);
|
|
661
|
+
let k = null;
|
|
662
|
+
const z = R({}, [...$n, ...qt, ...Un, ...ft]);
|
|
663
|
+
let D = Object.seal(xt(null, {
|
|
664
664
|
tagNameCheck: {
|
|
665
665
|
writable: !0,
|
|
666
666
|
configurable: !1,
|
|
@@ -679,8 +679,8 @@ function ts() {
|
|
|
679
679
|
enumerable: !0,
|
|
680
680
|
value: !1
|
|
681
681
|
}
|
|
682
|
-
})),
|
|
683
|
-
const
|
|
682
|
+
})), J = null, we = null;
|
|
683
|
+
const ee = Object.seal(xt(null, {
|
|
684
684
|
tagCheck: {
|
|
685
685
|
writable: !0,
|
|
686
686
|
configurable: !1,
|
|
@@ -694,45 +694,45 @@ function ts() {
|
|
|
694
694
|
value: null
|
|
695
695
|
}
|
|
696
696
|
}));
|
|
697
|
-
let cn = !0, Rt = !0, un = !1, hn = !0, Ce = !1,
|
|
697
|
+
let cn = !0, Rt = !0, un = !1, hn = !0, Ce = !1, it = !0, ve = !1, Dt = !1, Ct = !1, Ie = !1, at = !1, lt = !1, pn = !0, dn = !1;
|
|
698
698
|
const ps = "user-content-";
|
|
699
699
|
let It = !0, Ge = !1, Me = {}, ae = null;
|
|
700
|
-
const Mt =
|
|
700
|
+
const Mt = R({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
701
701
|
let fn = null;
|
|
702
|
-
const gn =
|
|
702
|
+
const gn = R({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
703
703
|
let Lt = null;
|
|
704
|
-
const mn =
|
|
704
|
+
const mn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ot = "http://www.w3.org/1998/Math/MathML", ct = "http://www.w3.org/2000/svg", pe = "http://www.w3.org/1999/xhtml";
|
|
705
705
|
let Le = pe, zt = !1, Ot = null;
|
|
706
|
-
const ds =
|
|
707
|
-
let
|
|
708
|
-
const fs =
|
|
706
|
+
const ds = R({}, [ot, ct, pe], Ft);
|
|
707
|
+
let ut = R({}, ["mi", "mo", "mn", "ms", "mtext"]), ht = R({}, ["annotation-xml"]);
|
|
708
|
+
const fs = R({}, ["title", "style", "font", "a", "script"]);
|
|
709
709
|
let We = null;
|
|
710
710
|
const gs = ["application/xhtml+xml", "text/html"], ms = "text/html";
|
|
711
|
-
let
|
|
711
|
+
let B = null, ze = null;
|
|
712
712
|
const xs = e.createElement("form"), xn = /* @__PURE__ */ u(function(i) {
|
|
713
713
|
return i instanceof RegExp || i instanceof Function;
|
|
714
714
|
}, "isRegexOrFunction"), Nt = /* @__PURE__ */ u(function() {
|
|
715
715
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
716
716
|
if (!(ze && ze === i)) {
|
|
717
717
|
if ((!i || typeof i != "object") && (i = {}), i = oe(i), We = // eslint-disable-next-line unicorn/prefer-includes
|
|
718
|
-
gs.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? ms : i.PARSER_MEDIA_TYPE,
|
|
718
|
+
gs.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? ms : i.PARSER_MEDIA_TYPE, B = We === "application/xhtml+xml" ? Ft : bt, b = Q(i, "ALLOWED_TAGS") ? R({}, i.ALLOWED_TAGS, B) : v, k = Q(i, "ALLOWED_ATTR") ? R({}, i.ALLOWED_ATTR, B) : z, Ot = Q(i, "ALLOWED_NAMESPACES") ? R({}, i.ALLOWED_NAMESPACES, Ft) : ds, Lt = Q(i, "ADD_URI_SAFE_ATTR") ? R(oe(mn), i.ADD_URI_SAFE_ATTR, B) : mn, fn = Q(i, "ADD_DATA_URI_TAGS") ? R(oe(gn), i.ADD_DATA_URI_TAGS, B) : gn, ae = Q(i, "FORBID_CONTENTS") ? R({}, i.FORBID_CONTENTS, B) : Mt, J = Q(i, "FORBID_TAGS") ? R({}, i.FORBID_TAGS, B) : oe({}), we = Q(i, "FORBID_ATTR") ? R({}, i.FORBID_ATTR, B) : oe({}), Me = Q(i, "USE_PROFILES") ? i.USE_PROFILES : !1, cn = i.ALLOW_ARIA_ATTR !== !1, Rt = i.ALLOW_DATA_ATTR !== !1, un = i.ALLOW_UNKNOWN_PROTOCOLS || !1, hn = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ce = i.SAFE_FOR_TEMPLATES || !1, it = i.SAFE_FOR_XML !== !1, ve = i.WHOLE_DOCUMENT || !1, Ie = i.RETURN_DOM || !1, at = i.RETURN_DOM_FRAGMENT || !1, lt = i.RETURN_TRUSTED_TYPE || !1, Ct = i.FORCE_BODY || !1, pn = i.SANITIZE_DOM !== !1, dn = i.SANITIZE_NAMED_PROPS || !1, It = i.KEEP_CONTENT !== !1, Ge = i.IN_PLACE || !1, He = i.ALLOWED_URI_REGEXP || Jn, Le = i.NAMESPACE || pe, ut = i.MATHML_TEXT_INTEGRATION_POINTS || ut, ht = i.HTML_INTEGRATION_POINTS || ht, D = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && xn(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (D.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && xn(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (D.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (D.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ce && (Rt = !1), at && (Ie = !0), Me && (b = R({}, Pn), k = xt(null), Me.html === !0 && (R(b, Nn), R(k, $n)), Me.svg === !0 && (R(b, Gt), R(k, qt), R(k, ft)), Me.svgFilters === !0 && (R(b, Wt), R(k, qt), R(k, ft)), Me.mathMl === !0 && (R(b, jt), R(k, Un), R(k, ft))), Q(i, "ADD_TAGS") || (ee.tagCheck = null), Q(i, "ADD_ATTR") || (ee.attributeCheck = null), i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? ee.tagCheck = i.ADD_TAGS : (b === v && (b = oe(b)), R(b, i.ADD_TAGS, B))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? ee.attributeCheck = i.ADD_ATTR : (k === z && (k = oe(k)), R(k, i.ADD_ATTR, B))), i.ADD_URI_SAFE_ATTR && R(Lt, i.ADD_URI_SAFE_ATTR, B), i.FORBID_CONTENTS && (ae === Mt && (ae = oe(ae)), R(ae, i.FORBID_CONTENTS, B)), i.ADD_FORBID_CONTENTS && (ae === Mt && (ae = oe(ae)), R(ae, i.ADD_FORBID_CONTENTS, B)), It && (b["#text"] = !0), ve && R(b, ["html", "head", "body"]), b.table && (R(b, ["tbody"]), delete J.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
719
719
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
720
720
|
throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
721
721
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
722
722
|
throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
723
|
-
|
|
723
|
+
$ = i.TRUSTED_TYPES_POLICY, j = $.createHTML("");
|
|
724
724
|
} else
|
|
725
|
-
|
|
726
|
-
|
|
725
|
+
$ === void 0 && ($ = ir(m, s)), $ !== null && typeof j == "string" && (j = $.createHTML(""));
|
|
726
|
+
Z && Z(i), ze = i;
|
|
727
727
|
}
|
|
728
|
-
}, "_parseConfig"), bn =
|
|
728
|
+
}, "_parseConfig"), bn = R({}, [...Gt, ...Wt, ...Ys]), kn = R({}, [...jt, ...Zs]), bs = /* @__PURE__ */ u(function(i) {
|
|
729
729
|
let h = ne(i);
|
|
730
730
|
(!h || !h.tagName) && (h = {
|
|
731
731
|
namespaceURI: Le,
|
|
732
732
|
tagName: "template"
|
|
733
733
|
});
|
|
734
|
-
const
|
|
735
|
-
return Ot[i.namespaceURI] ? i.namespaceURI ===
|
|
734
|
+
const x = bt(i.tagName), N = bt(h.tagName);
|
|
735
|
+
return Ot[i.namespaceURI] ? i.namespaceURI === ct ? h.namespaceURI === pe ? x === "svg" : h.namespaceURI === ot ? x === "svg" && (N === "annotation-xml" || ut[N]) : !!bn[x] : i.namespaceURI === ot ? h.namespaceURI === pe ? x === "math" : h.namespaceURI === ct ? x === "math" && ht[N] : !!kn[x] : i.namespaceURI === pe ? h.namespaceURI === ct && !ht[N] || h.namespaceURI === ot && !ut[N] ? !1 : !kn[x] && (fs[x] || !bn[x]) : !!(We === "application/xhtml+xml" && Ot[i.namespaceURI]) : !1;
|
|
736
736
|
}, "_checkValidNamespace"), le = /* @__PURE__ */ u(function(i) {
|
|
737
737
|
je(t.removed, {
|
|
738
738
|
element: i
|
|
@@ -755,7 +755,7 @@ function ts() {
|
|
|
755
755
|
});
|
|
756
756
|
}
|
|
757
757
|
if (h.removeAttribute(i), i === "is")
|
|
758
|
-
if (Ie ||
|
|
758
|
+
if (Ie || at)
|
|
759
759
|
try {
|
|
760
760
|
le(h);
|
|
761
761
|
} catch {
|
|
@@ -766,31 +766,31 @@ function ts() {
|
|
|
766
766
|
} catch {
|
|
767
767
|
}
|
|
768
768
|
}, "_removeAttribute"), wn = /* @__PURE__ */ u(function(i) {
|
|
769
|
-
let h = null,
|
|
769
|
+
let h = null, x = null;
|
|
770
770
|
if (Ct)
|
|
771
771
|
i = "<remove></remove>" + i;
|
|
772
772
|
else {
|
|
773
|
-
const
|
|
774
|
-
|
|
773
|
+
const P = Ht(i, /^[\r\n\t ]+/);
|
|
774
|
+
x = P && P[0];
|
|
775
775
|
}
|
|
776
776
|
We === "application/xhtml+xml" && Le === pe && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
777
|
-
const N =
|
|
777
|
+
const N = $ ? $.createHTML(i) : i;
|
|
778
778
|
if (Le === pe)
|
|
779
779
|
try {
|
|
780
|
-
h = new
|
|
780
|
+
h = new g().parseFromString(N, We);
|
|
781
781
|
} catch {
|
|
782
782
|
}
|
|
783
783
|
if (!h || !h.documentElement) {
|
|
784
|
-
h =
|
|
784
|
+
h = se.createDocument(Le, "template", null);
|
|
785
785
|
try {
|
|
786
|
-
h.documentElement.innerHTML = zt ?
|
|
786
|
+
h.documentElement.innerHTML = zt ? j : N;
|
|
787
787
|
} catch {
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
|
-
const
|
|
791
|
-
return i &&
|
|
790
|
+
const W = h.body || h.documentElement;
|
|
791
|
+
return i && x && W.insertBefore(e.createTextNode(x), W.childNodes[0] || null), Le === pe ? L.call(h, ve ? "html" : "body")[0] : ve ? h.documentElement : W;
|
|
792
792
|
}, "_initDocument"), vn = /* @__PURE__ */ u(function(i) {
|
|
793
|
-
return
|
|
793
|
+
return he.call(
|
|
794
794
|
i.ownerDocument || i,
|
|
795
795
|
i,
|
|
796
796
|
// eslint-disable-next-line no-bitwise
|
|
@@ -798,66 +798,66 @@ function ts() {
|
|
|
798
798
|
null
|
|
799
799
|
);
|
|
800
800
|
}, "_createNodeIterator"), Pt = /* @__PURE__ */ u(function(i) {
|
|
801
|
-
return i instanceof p && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof
|
|
801
|
+
return i instanceof p && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof f) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
802
802
|
}, "_isClobbered"), yn = /* @__PURE__ */ u(function(i) {
|
|
803
803
|
return typeof o == "function" && i instanceof o;
|
|
804
804
|
}, "_isNode");
|
|
805
805
|
function de(w, i, h) {
|
|
806
|
-
|
|
807
|
-
|
|
806
|
+
dt(w, (x) => {
|
|
807
|
+
x.call(t, i, h, ze);
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
810
|
u(de, "_executeHooks");
|
|
811
811
|
const Tn = /* @__PURE__ */ u(function(i) {
|
|
812
812
|
let h = null;
|
|
813
|
-
if (de(
|
|
813
|
+
if (de(U.beforeSanitizeElements, i, null), Pt(i))
|
|
814
814
|
return le(i), !0;
|
|
815
|
-
const
|
|
816
|
-
if (de(
|
|
817
|
-
tagName:
|
|
818
|
-
allowedTags:
|
|
819
|
-
}),
|
|
815
|
+
const x = B(i.nodeName);
|
|
816
|
+
if (de(U.uponSanitizeElement, i, {
|
|
817
|
+
tagName: x,
|
|
818
|
+
allowedTags: b
|
|
819
|
+
}), it && i.hasChildNodes() && !yn(i.firstElementChild) && q(/<[/\w!]/g, i.innerHTML) && q(/<[/\w!]/g, i.textContent) || i.nodeType === Ze.progressingInstruction || it && i.nodeType === Ze.comment && q(/<[/\w]/g, i.data))
|
|
820
820
|
return le(i), !0;
|
|
821
|
-
if (!(
|
|
822
|
-
if (!
|
|
821
|
+
if (!(ee.tagCheck instanceof Function && ee.tagCheck(x)) && (!b[x] || J[x])) {
|
|
822
|
+
if (!J[x] && An(x) && (D.tagNameCheck instanceof RegExp && q(D.tagNameCheck, x) || D.tagNameCheck instanceof Function && D.tagNameCheck(x)))
|
|
823
823
|
return !1;
|
|
824
|
-
if (It && !ae[
|
|
825
|
-
const N = ne(i) || i.parentNode,
|
|
826
|
-
if (
|
|
827
|
-
const
|
|
828
|
-
for (let
|
|
829
|
-
const fe =
|
|
830
|
-
fe.__removalCount = (i.__removalCount || 0) + 1, N.insertBefore(fe,
|
|
824
|
+
if (It && !ae[x]) {
|
|
825
|
+
const N = ne(i) || i.parentNode, W = me(i) || i.childNodes;
|
|
826
|
+
if (W && N) {
|
|
827
|
+
const P = W.length;
|
|
828
|
+
for (let K = P - 1; K >= 0; --K) {
|
|
829
|
+
const fe = S(W[K], !0);
|
|
830
|
+
fe.__removalCount = (i.__removalCount || 0) + 1, N.insertBefore(fe, ge(i));
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
return le(i), !0;
|
|
835
835
|
}
|
|
836
|
-
return i instanceof c && !bs(i) || (
|
|
836
|
+
return i instanceof c && !bs(i) || (x === "noscript" || x === "noembed" || x === "noframes") && q(/<\/no(script|embed|frames)/i, i.innerHTML) ? (le(i), !0) : (Ce && i.nodeType === Ze.text && (h = i.textContent, dt([Re, Fe, De], (N) => {
|
|
837
837
|
h = qe(h, N, " ");
|
|
838
838
|
}), i.textContent !== h && (je(t.removed, {
|
|
839
839
|
element: i.cloneNode()
|
|
840
|
-
}), i.textContent = h)), de(
|
|
841
|
-
}, "_sanitizeElements"), Sn = /* @__PURE__ */ u(function(i, h,
|
|
842
|
-
if (
|
|
840
|
+
}), i.textContent = h)), de(U.afterSanitizeElements, i, null), !1);
|
|
841
|
+
}, "_sanitizeElements"), Sn = /* @__PURE__ */ u(function(i, h, x) {
|
|
842
|
+
if (we[h] || pn && (h === "id" || h === "name") && (x in e || x in xs))
|
|
843
843
|
return !1;
|
|
844
|
-
if (!(Rt && !
|
|
845
|
-
if (!(cn &&
|
|
846
|
-
if (!(
|
|
847
|
-
if (!
|
|
844
|
+
if (!(Rt && !we[h] && q(At, h))) {
|
|
845
|
+
if (!(cn && q(Et, h))) {
|
|
846
|
+
if (!(ee.attributeCheck instanceof Function && ee.attributeCheck(h, i))) {
|
|
847
|
+
if (!k[h] || we[h]) {
|
|
848
848
|
if (
|
|
849
849
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
850
850
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
851
851
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
852
|
-
!(An(i) && (
|
|
852
|
+
!(An(i) && (D.tagNameCheck instanceof RegExp && q(D.tagNameCheck, i) || D.tagNameCheck instanceof Function && D.tagNameCheck(i)) && (D.attributeNameCheck instanceof RegExp && q(D.attributeNameCheck, h) || D.attributeNameCheck instanceof Function && D.attributeNameCheck(h, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
853
853
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
854
|
-
h === "is" &&
|
|
854
|
+
h === "is" && D.allowCustomizedBuiltInElements && (D.tagNameCheck instanceof RegExp && q(D.tagNameCheck, x) || D.tagNameCheck instanceof Function && D.tagNameCheck(x)))
|
|
855
855
|
) return !1;
|
|
856
856
|
} else if (!Lt[h]) {
|
|
857
|
-
if (!
|
|
858
|
-
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" && Ws(
|
|
859
|
-
if (!(un && !
|
|
860
|
-
if (
|
|
857
|
+
if (!q(He, qe(x, st, ""))) {
|
|
858
|
+
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" && Ws(x, "data:") === 0 && fn[i])) {
|
|
859
|
+
if (!(un && !q(_t, qe(x, st, "")))) {
|
|
860
|
+
if (x)
|
|
861
861
|
return !1;
|
|
862
862
|
}
|
|
863
863
|
}
|
|
@@ -868,83 +868,83 @@ function ts() {
|
|
|
868
868
|
}
|
|
869
869
|
return !0;
|
|
870
870
|
}, "_isValidAttribute"), An = /* @__PURE__ */ u(function(i) {
|
|
871
|
-
return i !== "annotation-xml" && Ht(i,
|
|
871
|
+
return i !== "annotation-xml" && Ht(i, rt);
|
|
872
872
|
}, "_isBasicCustomElement"), En = /* @__PURE__ */ u(function(i) {
|
|
873
|
-
de(
|
|
873
|
+
de(U.beforeSanitizeAttributes, i, null);
|
|
874
874
|
const {
|
|
875
875
|
attributes: h
|
|
876
876
|
} = i;
|
|
877
877
|
if (!h || Pt(i))
|
|
878
878
|
return;
|
|
879
|
-
const
|
|
879
|
+
const x = {
|
|
880
880
|
attrName: "",
|
|
881
881
|
attrValue: "",
|
|
882
882
|
keepAttr: !0,
|
|
883
|
-
allowedAttributes:
|
|
883
|
+
allowedAttributes: k,
|
|
884
884
|
forceKeepAttr: void 0
|
|
885
885
|
};
|
|
886
886
|
let N = h.length;
|
|
887
887
|
for (; N--; ) {
|
|
888
|
-
const
|
|
889
|
-
name:
|
|
890
|
-
namespaceURI:
|
|
888
|
+
const W = h[N], {
|
|
889
|
+
name: P,
|
|
890
|
+
namespaceURI: K,
|
|
891
891
|
value: fe
|
|
892
|
-
} =
|
|
893
|
-
let
|
|
894
|
-
if (
|
|
895
|
-
ye(
|
|
892
|
+
} = W, Oe = B(P), $t = fe;
|
|
893
|
+
let H = P === "value" ? $t : js($t);
|
|
894
|
+
if (x.attrName = Oe, x.attrValue = H, x.keepAttr = !0, x.forceKeepAttr = void 0, de(U.uponSanitizeAttribute, i, x), H = x.attrValue, dn && (Oe === "id" || Oe === "name") && (ye(P, i), H = ps + H), it && q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, H)) {
|
|
895
|
+
ye(P, i);
|
|
896
896
|
continue;
|
|
897
897
|
}
|
|
898
|
-
if (Oe === "attributename" && Ht(
|
|
899
|
-
ye(
|
|
898
|
+
if (Oe === "attributename" && Ht(H, "href")) {
|
|
899
|
+
ye(P, i);
|
|
900
900
|
continue;
|
|
901
901
|
}
|
|
902
|
-
if (
|
|
902
|
+
if (x.forceKeepAttr)
|
|
903
903
|
continue;
|
|
904
|
-
if (!
|
|
905
|
-
ye(
|
|
904
|
+
if (!x.keepAttr) {
|
|
905
|
+
ye(P, i);
|
|
906
906
|
continue;
|
|
907
907
|
}
|
|
908
|
-
if (!hn &&
|
|
909
|
-
ye(
|
|
908
|
+
if (!hn && q(/\/>/i, H)) {
|
|
909
|
+
ye(P, i);
|
|
910
910
|
continue;
|
|
911
911
|
}
|
|
912
|
-
Ce &&
|
|
913
|
-
|
|
912
|
+
Ce && dt([Re, Fe, De], (Rn) => {
|
|
913
|
+
H = qe(H, Rn, " ");
|
|
914
914
|
});
|
|
915
|
-
const _n =
|
|
916
|
-
if (!Sn(_n, Oe,
|
|
917
|
-
ye(
|
|
915
|
+
const _n = B(i.nodeName);
|
|
916
|
+
if (!Sn(_n, Oe, H)) {
|
|
917
|
+
ye(P, i);
|
|
918
918
|
continue;
|
|
919
919
|
}
|
|
920
|
-
if (
|
|
921
|
-
switch (
|
|
920
|
+
if ($ && typeof m == "object" && typeof m.getAttributeType == "function" && !K)
|
|
921
|
+
switch (m.getAttributeType(_n, Oe)) {
|
|
922
922
|
case "TrustedHTML": {
|
|
923
|
-
|
|
923
|
+
H = $.createHTML(H);
|
|
924
924
|
break;
|
|
925
925
|
}
|
|
926
926
|
case "TrustedScriptURL": {
|
|
927
|
-
|
|
927
|
+
H = $.createScriptURL(H);
|
|
928
928
|
break;
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
|
-
if (
|
|
931
|
+
if (H !== $t)
|
|
932
932
|
try {
|
|
933
|
-
|
|
933
|
+
K ? i.setAttributeNS(K, P, H) : i.setAttribute(P, H), Pt(i) ? le(i) : On(t.removed);
|
|
934
934
|
} catch {
|
|
935
|
-
ye(
|
|
935
|
+
ye(P, i);
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
-
de(
|
|
938
|
+
de(U.afterSanitizeAttributes, i, null);
|
|
939
939
|
}, "_sanitizeAttributes"), ks = /* @__PURE__ */ u(function w(i) {
|
|
940
940
|
let h = null;
|
|
941
|
-
const
|
|
942
|
-
for (de(
|
|
943
|
-
de(
|
|
944
|
-
de(
|
|
941
|
+
const x = vn(i);
|
|
942
|
+
for (de(U.beforeSanitizeShadowDOM, i, null); h = x.nextNode(); )
|
|
943
|
+
de(U.uponSanitizeShadowNode, h, null), Tn(h), En(h), h.content instanceof r && w(h.content);
|
|
944
|
+
de(U.afterSanitizeShadowDOM, i, null);
|
|
945
945
|
}, "_sanitizeShadowDOM");
|
|
946
946
|
return t.sanitize = function(w) {
|
|
947
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null,
|
|
947
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, x = null, N = null, W = null;
|
|
948
948
|
if (zt = !w, zt && (w = "<!-->"), typeof w != "string" && !yn(w))
|
|
949
949
|
if (typeof w.toString == "function") {
|
|
950
950
|
if (w = w.toString(), typeof w != "string")
|
|
@@ -955,38 +955,38 @@ function ts() {
|
|
|
955
955
|
return w;
|
|
956
956
|
if (Dt || Nt(i), t.removed = [], typeof w == "string" && (Ge = !1), Ge) {
|
|
957
957
|
if (w.nodeName) {
|
|
958
|
-
const fe =
|
|
959
|
-
if (!
|
|
958
|
+
const fe = B(w.nodeName);
|
|
959
|
+
if (!b[fe] || J[fe])
|
|
960
960
|
throw Ve("root node is forbidden and cannot be sanitized in-place");
|
|
961
961
|
}
|
|
962
962
|
} else if (w instanceof o)
|
|
963
|
-
h = wn("<!---->"),
|
|
963
|
+
h = wn("<!---->"), x = h.ownerDocument.importNode(w, !0), x.nodeType === Ze.element && x.nodeName === "BODY" || x.nodeName === "HTML" ? h = x : h.appendChild(x);
|
|
964
964
|
else {
|
|
965
965
|
if (!Ie && !Ce && !ve && // eslint-disable-next-line unicorn/prefer-includes
|
|
966
966
|
w.indexOf("<") === -1)
|
|
967
|
-
return
|
|
967
|
+
return $ && lt ? $.createHTML(w) : w;
|
|
968
968
|
if (h = wn(w), !h)
|
|
969
|
-
return Ie ? null :
|
|
969
|
+
return Ie ? null : lt ? j : "";
|
|
970
970
|
}
|
|
971
971
|
h && Ct && le(h.firstChild);
|
|
972
|
-
const
|
|
973
|
-
for (; N =
|
|
972
|
+
const P = vn(Ge ? w : h);
|
|
973
|
+
for (; N = P.nextNode(); )
|
|
974
974
|
Tn(N), En(N), N.content instanceof r && ks(N.content);
|
|
975
975
|
if (Ge)
|
|
976
976
|
return w;
|
|
977
977
|
if (Ie) {
|
|
978
|
-
if (
|
|
979
|
-
for (
|
|
980
|
-
|
|
978
|
+
if (at)
|
|
979
|
+
for (W = tt.call(h.ownerDocument); h.firstChild; )
|
|
980
|
+
W.appendChild(h.firstChild);
|
|
981
981
|
else
|
|
982
|
-
|
|
983
|
-
return (
|
|
982
|
+
W = h;
|
|
983
|
+
return (k.shadowroot || k.shadowrootmode) && (W = nt.call(n, W, !0)), W;
|
|
984
984
|
}
|
|
985
|
-
let
|
|
986
|
-
return ve &&
|
|
987
|
-
` +
|
|
988
|
-
|
|
989
|
-
}),
|
|
985
|
+
let K = ve ? h.outerHTML : h.innerHTML;
|
|
986
|
+
return ve && b["!doctype"] && h.ownerDocument && h.ownerDocument.doctype && h.ownerDocument.doctype.name && q(es, h.ownerDocument.doctype.name) && (K = "<!DOCTYPE " + h.ownerDocument.doctype.name + `>
|
|
987
|
+
` + K), Ce && dt([Re, Fe, De], (fe) => {
|
|
988
|
+
K = qe(K, fe, " ");
|
|
989
|
+
}), $ && lt ? $.createHTML(K) : K;
|
|
990
990
|
}, t.setConfig = function() {
|
|
991
991
|
let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
992
992
|
Nt(w), Dt = !0;
|
|
@@ -994,20 +994,20 @@ function ts() {
|
|
|
994
994
|
ze = null, Dt = !1;
|
|
995
995
|
}, t.isValidAttribute = function(w, i, h) {
|
|
996
996
|
ze || Nt({});
|
|
997
|
-
const
|
|
998
|
-
return Sn(
|
|
997
|
+
const x = B(w), N = B(i);
|
|
998
|
+
return Sn(x, N, h);
|
|
999
999
|
}, t.addHook = function(w, i) {
|
|
1000
|
-
typeof i == "function" && je(
|
|
1000
|
+
typeof i == "function" && je(U[w], i);
|
|
1001
1001
|
}, t.removeHook = function(w, i) {
|
|
1002
1002
|
if (i !== void 0) {
|
|
1003
|
-
const h = Hs(
|
|
1004
|
-
return h === -1 ? void 0 : Gs(
|
|
1003
|
+
const h = Hs(U[w], i);
|
|
1004
|
+
return h === -1 ? void 0 : Gs(U[w], h, 1)[0];
|
|
1005
1005
|
}
|
|
1006
|
-
return On(
|
|
1006
|
+
return On(U[w]);
|
|
1007
1007
|
}, t.removeHooks = function(w) {
|
|
1008
|
-
|
|
1008
|
+
U[w] = [];
|
|
1009
1009
|
}, t.removeAllHooks = function() {
|
|
1010
|
-
|
|
1010
|
+
U = Fn();
|
|
1011
1011
|
}, t;
|
|
1012
1012
|
}
|
|
1013
1013
|
u(ts, "createDOMPurify");
|
|
@@ -1025,7 +1025,7 @@ var Se = { exec: /* @__PURE__ */ u(() => null, "exec") };
|
|
|
1025
1025
|
function I(l, t = "") {
|
|
1026
1026
|
let e = typeof l == "string" ? l : l.source, n = { replace: /* @__PURE__ */ u((s, r) => {
|
|
1027
1027
|
let a = typeof r == "string" ? r : r.source;
|
|
1028
|
-
return a = a.replace(
|
|
1028
|
+
return a = a.replace(Y.caret, "$1"), e = e.replace(s, a), n;
|
|
1029
1029
|
}, "replace"), getRegex: /* @__PURE__ */ u(() => new RegExp(e, t), "getRegex") };
|
|
1030
1030
|
return n;
|
|
1031
1031
|
}
|
|
@@ -1036,18 +1036,18 @@ var lr = (() => {
|
|
|
1036
1036
|
} catch {
|
|
1037
1037
|
return !1;
|
|
1038
1038
|
}
|
|
1039
|
-
})(),
|
|
1040
|
-
]`).replace("lheading", rs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, wr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, vr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, as = /^( {2,}|\\)\n(?!\s*$)/, yr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Be = /[\p{P}\p{S}]/u,
|
|
1039
|
+
})(), Y = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ u((l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}>`), "blockquoteBeginRegex") }, or = /^(?:[ \t]*(?:\n|$))+/, cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ur = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, et = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, hr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Jt = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ss = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, rs = I(ss).replace(/bull/g, Jt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), pr = I(ss).replace(/bull/g, Jt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), en = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, dr = /^[^\n]+/, tn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, fr = I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", tn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), gr = I(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Jt).getRegex(), Tt = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", nn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, mr = I("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", nn).replace("tag", Tt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), is = I(en).replace("hr", et).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Tt).getRegex(), xr = I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", is).getRegex(), sn = { blockquote: xr, code: cr, def: fr, fences: ur, heading: hr, hr: et, html: mr, lheading: rs, list: gr, newline: or, paragraph: is, table: Se, text: dr }, Hn = I("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", et).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Tt).getRegex(), br = { ...sn, lheading: pr, table: Hn, paragraph: I(en).replace("hr", et).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Hn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Tt).getRegex() }, kr = { ...sn, html: I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", nn).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: Se, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: I(en).replace("hr", et).replace("heading", ` *#{1,6} *[^
|
|
1040
|
+
]`).replace("lheading", rs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, wr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, vr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, as = /^( {2,}|\\)\n(?!\s*$)/, yr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Be = /[\p{P}\p{S}]/u, St = /[\s\p{P}\p{S}]/u, rn = /[^\s\p{P}\p{S}]/u, Tr = I(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, St).getRegex(), ls = /(?!~)[\p{P}\p{S}]/u, Sr = /(?!~)[\s\p{P}\p{S}]/u, Ar = /(?:[^\s\p{P}\p{S}]|~)/u, Er = I(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", lr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), os = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, _r = I(os, "u").replace(/punct/g, Be).getRegex(), Rr = I(os, "u").replace(/punct/g, ls).getRegex(), cs = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Dr = I(cs, "gu").replace(/notPunctSpace/g, rn).replace(/punctSpace/g, St).replace(/punct/g, Be).getRegex(), Cr = I(cs, "gu").replace(/notPunctSpace/g, Ar).replace(/punctSpace/g, Sr).replace(/punct/g, ls).getRegex(), Ir = I("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, rn).replace(/punctSpace/g, St).replace(/punct/g, Be).getRegex(), Mr = I(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, Be).getRegex(), Lr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", zr = I(Lr, "gu").replace(/notPunctSpace/g, rn).replace(/punctSpace/g, St).replace(/punct/g, Be).getRegex(), Or = I(/\\(punct)/, "gu").replace(/punct/g, Be).getRegex(), Nr = I(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Pr = I(nn).replace("(?:-->|$)", "-->").getRegex(), $r = I("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Pr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), wt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ur = I(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", wt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), us = I(/^!?\[(label)\]\[(ref)\]/).replace("label", wt).replace("ref", tn).getRegex(), hs = I(/^!?\[(ref)\](?:\[\])?/).replace("ref", tn).getRegex(), Br = I("reflink|nolink(?!\\()", "g").replace("reflink", us).replace("nolink", hs).getRegex(), Gn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, an = { _backpedal: Se, anyPunctuation: Or, autolink: Nr, blockSkip: Er, br: as, code: vr, del: Se, delLDelim: Se, delRDelim: Se, emStrongLDelim: _r, emStrongRDelimAst: Dr, emStrongRDelimUnd: Ir, escape: wr, link: Ur, nolink: hs, punctuation: Tr, reflink: us, reflinkSearch: Br, tag: $r, text: yr, url: Se }, Fr = { ...an, link: I(/^!?\[(label)\]\((.*?)\)/).replace("label", wt).getRegex(), reflink: I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", wt).getRegex() }, Xt = { ...an, emStrongRDelimAst: Cr, emStrongLDelim: Rr, delLDelim: Mr, delRDelim: zr, url: I(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Gn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: I(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Gn).getRegex() }, Hr = { ...Xt, br: I(as).replace("{2,}", "*").getRegex(), text: I(Xt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, gt = { normal: sn, gfm: br, pedantic: kr }, Xe = { normal: an, gfm: Xt, breaks: Hr, pedantic: Fr }, Gr = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Wn = /* @__PURE__ */ u((l) => Gr[l], "ke");
|
|
1041
1041
|
function ce(l, t) {
|
|
1042
1042
|
if (t) {
|
|
1043
|
-
if (
|
|
1044
|
-
} else if (
|
|
1043
|
+
if (Y.escapeTest.test(l)) return l.replace(Y.escapeReplace, Wn);
|
|
1044
|
+
} else if (Y.escapeTestNoEncode.test(l)) return l.replace(Y.escapeReplaceNoEncode, Wn);
|
|
1045
1045
|
return l;
|
|
1046
1046
|
}
|
|
1047
1047
|
u(ce, "T");
|
|
1048
1048
|
function jn(l) {
|
|
1049
1049
|
try {
|
|
1050
|
-
l = encodeURI(l).replace(
|
|
1050
|
+
l = encodeURI(l).replace(Y.percentDecode, "%");
|
|
1051
1051
|
} catch {
|
|
1052
1052
|
return null;
|
|
1053
1053
|
}
|
|
@@ -1055,14 +1055,14 @@ function jn(l) {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
u(jn, "J");
|
|
1057
1057
|
function qn(l, t) {
|
|
1058
|
-
let e = l.replace(
|
|
1058
|
+
let e = l.replace(Y.findPipe, (r, a, o) => {
|
|
1059
1059
|
let c = !1, d = a;
|
|
1060
1060
|
for (; --d >= 0 && o[d] === "\\"; ) c = !c;
|
|
1061
1061
|
return c ? "|" : " |";
|
|
1062
|
-
}), n = e.split(
|
|
1062
|
+
}), n = e.split(Y.splitPipe), s = 0;
|
|
1063
1063
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
1064
1064
|
else for (; n.length < t; ) n.push("");
|
|
1065
|
-
for (; s < n.length; s++) n[s] = n[s].trim().replace(
|
|
1065
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(Y.slashPipe, "|");
|
|
1066
1066
|
return n;
|
|
1067
1067
|
}
|
|
1068
1068
|
u(qn, "V");
|
|
@@ -1114,7 +1114,7 @@ function qr(l, t, e) {
|
|
|
1114
1114
|
`);
|
|
1115
1115
|
}
|
|
1116
1116
|
u(qr, "nt");
|
|
1117
|
-
var Ne,
|
|
1117
|
+
var Ne, vt = (Ne = class {
|
|
1118
1118
|
constructor(t) {
|
|
1119
1119
|
C(this, "options");
|
|
1120
1120
|
C(this, "rules");
|
|
@@ -1168,27 +1168,27 @@ var Ne, wt = (Ne = class {
|
|
|
1168
1168
|
else if (!o) c.push(n[d]);
|
|
1169
1169
|
else break;
|
|
1170
1170
|
n = n.slice(d);
|
|
1171
|
-
let
|
|
1172
|
-
`), p =
|
|
1171
|
+
let f = c.join(`
|
|
1172
|
+
`), p = f.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1173
1173
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1174
1174
|
s = s ? `${s}
|
|
1175
|
-
${
|
|
1175
|
+
${f}` : f, r = r ? `${r}
|
|
1176
1176
|
${p}` : p;
|
|
1177
|
-
let
|
|
1178
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, a, !0), this.lexer.state.top =
|
|
1179
|
-
let
|
|
1180
|
-
if (
|
|
1181
|
-
if (
|
|
1182
|
-
let
|
|
1177
|
+
let g = this.lexer.state.top;
|
|
1178
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, a, !0), this.lexer.state.top = g, n.length === 0) break;
|
|
1179
|
+
let m = a.at(-1);
|
|
1180
|
+
if (m?.type === "code") break;
|
|
1181
|
+
if (m?.type === "blockquote") {
|
|
1182
|
+
let y = m, S = y.raw + `
|
|
1183
1183
|
` + n.join(`
|
|
1184
|
-
`), O = this.blockquote(
|
|
1185
|
-
a[a.length - 1] = O, s = s.substring(0, s.length -
|
|
1184
|
+
`), O = this.blockquote(S);
|
|
1185
|
+
a[a.length - 1] = O, s = s.substring(0, s.length - y.raw.length) + O.raw, r = r.substring(0, r.length - y.text.length) + O.text;
|
|
1186
1186
|
break;
|
|
1187
|
-
} else if (
|
|
1188
|
-
let
|
|
1187
|
+
} else if (m?.type === "list") {
|
|
1188
|
+
let y = m, S = y.raw + `
|
|
1189
1189
|
` + n.join(`
|
|
1190
|
-
`), O = this.list(
|
|
1191
|
-
a[a.length - 1] = O, s = s.substring(0, s.length -
|
|
1190
|
+
`), O = this.list(S);
|
|
1191
|
+
a[a.length - 1] = O, s = s.substring(0, s.length - m.raw.length) + O.raw, r = r.substring(0, r.length - y.raw.length) + O.raw, n = S.substring(a.at(-1).raw.length).split(`
|
|
1192
1192
|
`);
|
|
1193
1193
|
continue;
|
|
1194
1194
|
}
|
|
@@ -1203,31 +1203,31 @@ ${p}` : p;
|
|
|
1203
1203
|
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
1204
1204
|
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
1205
1205
|
for (; t; ) {
|
|
1206
|
-
let d = !1,
|
|
1206
|
+
let d = !1, f = "", p = "";
|
|
1207
1207
|
if (!(e = a.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1208
|
-
|
|
1209
|
-
let
|
|
1210
|
-
`, 1)[0], e[1].length),
|
|
1211
|
-
`, 1)[0],
|
|
1212
|
-
if (this.options.pedantic ? (
|
|
1213
|
-
`, t = t.substring(
|
|
1214
|
-
let O = this.rules.other.nextBulletRegex(
|
|
1208
|
+
f = e[0], t = t.substring(f.length);
|
|
1209
|
+
let g = jr(e[2].split(`
|
|
1210
|
+
`, 1)[0], e[1].length), m = t.split(`
|
|
1211
|
+
`, 1)[0], y = !g.trim(), S = 0;
|
|
1212
|
+
if (this.options.pedantic ? (S = 2, p = g.trimStart()) : y ? S = e[1].length + 1 : (S = g.search(this.rules.other.nonSpaceChar), S = S > 4 ? 1 : S, p = g.slice(S), S += e[1].length), y && this.rules.other.blankLine.test(m) && (f += m + `
|
|
1213
|
+
`, t = t.substring(m.length + 1), d = !0), !d) {
|
|
1214
|
+
let O = this.rules.other.nextBulletRegex(S), ge = this.rules.other.hrRegex(S), me = this.rules.other.fencesBeginRegex(S), ne = this.rules.other.headingBeginRegex(S), $ = this.rules.other.htmlBeginRegex(S), j = this.rules.other.blockquoteBeginRegex(S);
|
|
1215
1215
|
for (; t; ) {
|
|
1216
|
-
let
|
|
1217
|
-
`, 1)[0],
|
|
1218
|
-
if (
|
|
1219
|
-
if (
|
|
1220
|
-
` +
|
|
1216
|
+
let se = t.split(`
|
|
1217
|
+
`, 1)[0], he;
|
|
1218
|
+
if (m = se, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), he = m) : he = m.replace(this.rules.other.tabCharGlobal, " "), me.test(m) || ne.test(m) || $.test(m) || j.test(m) || O.test(m) || ge.test(m)) break;
|
|
1219
|
+
if (he.search(this.rules.other.nonSpaceChar) >= S || !m.trim()) p += `
|
|
1220
|
+
` + he.slice(S);
|
|
1221
1221
|
else {
|
|
1222
|
-
if (
|
|
1222
|
+
if (y || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || me.test(g) || ne.test(g) || ge.test(g)) break;
|
|
1223
1223
|
p += `
|
|
1224
|
-
` +
|
|
1224
|
+
` + m;
|
|
1225
1225
|
}
|
|
1226
|
-
|
|
1227
|
-
`, t = t.substring(
|
|
1226
|
+
y = !m.trim(), f += se + `
|
|
1227
|
+
`, t = t.substring(se.length + 1), g = he.slice(S);
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
1230
|
-
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
1230
|
+
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(f) && (o = !0)), r.items.push({ type: "list_item", raw: f, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: !1, text: p, tokens: [] }), r.raw += f;
|
|
1231
1231
|
}
|
|
1232
1232
|
let c = r.items.at(-1);
|
|
1233
1233
|
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
@@ -1242,20 +1242,20 @@ ${p}` : p;
|
|
|
1242
1242
|
break;
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
|
-
let
|
|
1246
|
-
if (
|
|
1247
|
-
let p = { type: "checkbox", raw:
|
|
1245
|
+
let f = this.rules.other.listTaskCheckbox.exec(d.raw);
|
|
1246
|
+
if (f) {
|
|
1247
|
+
let p = { type: "checkbox", raw: f[0] + " ", checked: f[0] !== "[ ]" };
|
|
1248
1248
|
d.checked = p.checked, r.loose ? d.tokens[0] && ["paragraph", "text"].includes(d.tokens[0].type) && "tokens" in d.tokens[0] && d.tokens[0].tokens ? (d.tokens[0].raw = p.raw + d.tokens[0].raw, d.tokens[0].text = p.raw + d.tokens[0].text, d.tokens[0].tokens.unshift(p)) : d.tokens.unshift({ type: "paragraph", raw: p.raw, text: p.raw, tokens: [p] }) : d.tokens.unshift(p);
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
1251
|
if (!r.loose) {
|
|
1252
|
-
let
|
|
1252
|
+
let f = d.tokens.filter((g) => g.type === "space"), p = f.length > 0 && f.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
1253
1253
|
r.loose = p;
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
if (r.loose) for (let d of r.items) {
|
|
1257
1257
|
d.loose = !0;
|
|
1258
|
-
for (let
|
|
1258
|
+
for (let f of d.tokens) f.type === "text" && (f.type = "paragraph");
|
|
1259
1259
|
}
|
|
1260
1260
|
return r;
|
|
1261
1261
|
}
|
|
@@ -1348,8 +1348,8 @@ ${p}` : p;
|
|
|
1348
1348
|
emStrong(t, e, n = "") {
|
|
1349
1349
|
let s = this.rules.inline.emStrongLDelim.exec(t);
|
|
1350
1350
|
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1351
|
-
let r = [...s[0]].length - 1, a, o, c = r, d = 0,
|
|
1352
|
-
for (
|
|
1351
|
+
let r = [...s[0]].length - 1, a, o, c = r, d = 0, f = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1352
|
+
for (f.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = f.exec(e)) !== null; ) {
|
|
1353
1353
|
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a) continue;
|
|
1354
1354
|
if (o = [...a].length, s[3] || s[4]) {
|
|
1355
1355
|
c += o;
|
|
@@ -1360,13 +1360,13 @@ ${p}` : p;
|
|
|
1360
1360
|
}
|
|
1361
1361
|
if (c -= o, c > 0) continue;
|
|
1362
1362
|
o = Math.min(o, o + c + d);
|
|
1363
|
-
let p = [...s[0]][0].length,
|
|
1363
|
+
let p = [...s[0]][0].length, g = t.slice(0, r + s.index + p + o);
|
|
1364
1364
|
if (Math.min(r, o) % 2) {
|
|
1365
|
-
let
|
|
1366
|
-
return { type: "em", raw:
|
|
1365
|
+
let y = g.slice(1, -1);
|
|
1366
|
+
return { type: "em", raw: g, text: y, tokens: this.lexer.inlineTokens(y) };
|
|
1367
1367
|
}
|
|
1368
|
-
let
|
|
1369
|
-
return { type: "strong", raw:
|
|
1368
|
+
let m = g.slice(2, -2);
|
|
1369
|
+
return { type: "strong", raw: g, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
@@ -1393,8 +1393,8 @@ ${p}` : p;
|
|
|
1393
1393
|
}
|
|
1394
1394
|
if (c -= o, c > 0) continue;
|
|
1395
1395
|
o = Math.min(o, o + c);
|
|
1396
|
-
let
|
|
1397
|
-
return { type: "del", raw: p, text:
|
|
1396
|
+
let f = [...s[0]][0].length, p = t.slice(0, r + s.index + f + o), g = p.slice(r, -r);
|
|
1397
|
+
return { type: "del", raw: p, text: g, tokens: this.lexer.inlineTokens(g) };
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
@@ -1427,28 +1427,28 @@ ${p}` : p;
|
|
|
1427
1427
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
|
-
}, u(Ne, "w"), Ne),
|
|
1430
|
+
}, u(Ne, "w"), Ne), be, re = (be = class {
|
|
1431
1431
|
constructor(t) {
|
|
1432
1432
|
C(this, "tokens");
|
|
1433
1433
|
C(this, "options");
|
|
1434
1434
|
C(this, "state");
|
|
1435
1435
|
C(this, "inlineQueue");
|
|
1436
1436
|
C(this, "tokenizer");
|
|
1437
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || _e, this.options.tokenizer = this.options.tokenizer || new
|
|
1438
|
-
let e = { other:
|
|
1439
|
-
this.options.pedantic ? (e.block =
|
|
1437
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || _e, this.options.tokenizer = this.options.tokenizer || new vt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1438
|
+
let e = { other: Y, block: gt.normal, inline: Xe.normal };
|
|
1439
|
+
this.options.pedantic ? (e.block = gt.pedantic, e.inline = Xe.pedantic) : this.options.gfm && (e.block = gt.gfm, this.options.breaks ? e.inline = Xe.breaks : e.inline = Xe.gfm), this.tokenizer.rules = e;
|
|
1440
1440
|
}
|
|
1441
1441
|
static get rules() {
|
|
1442
|
-
return { block:
|
|
1442
|
+
return { block: gt, inline: Xe };
|
|
1443
1443
|
}
|
|
1444
1444
|
static lex(t, e) {
|
|
1445
|
-
return new
|
|
1445
|
+
return new be(e).lex(t);
|
|
1446
1446
|
}
|
|
1447
1447
|
static lexInline(t, e) {
|
|
1448
|
-
return new
|
|
1448
|
+
return new be(e).inlineTokens(t);
|
|
1449
1449
|
}
|
|
1450
1450
|
lex(t) {
|
|
1451
|
-
t = t.replace(
|
|
1451
|
+
t = t.replace(Y.carriageReturn, `
|
|
1452
1452
|
`), this.blockTokens(t, this.tokens);
|
|
1453
1453
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1454
1454
|
let n = this.inlineQueue[e];
|
|
@@ -1457,7 +1457,7 @@ ${p}` : p;
|
|
|
1457
1457
|
return this.inlineQueue = [], this.tokens;
|
|
1458
1458
|
}
|
|
1459
1459
|
blockTokens(t, e = [], n = !1) {
|
|
1460
|
-
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(
|
|
1460
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(Y.tabCharGlobal, " ").replace(Y.spaceLine, "")); t; ) {
|
|
1461
1461
|
let s;
|
|
1462
1462
|
if (this.options.extensions?.block?.some((a) => (s = a.call({ lexer: this }, t, e)) ? (t = t.substring(s.raw.length), e.push(s), !0) : !1)) continue;
|
|
1463
1463
|
if (s = this.tokenizer.space(t)) {
|
|
@@ -1569,7 +1569,7 @@ ${p}` : p;
|
|
|
1569
1569
|
for (; t; ) {
|
|
1570
1570
|
a || (o = ""), a = !1;
|
|
1571
1571
|
let c;
|
|
1572
|
-
if (this.options.extensions?.inline?.some((
|
|
1572
|
+
if (this.options.extensions?.inline?.some((f) => (c = f.call({ lexer: this }, t, e)) ? (t = t.substring(c.raw.length), e.push(c), !0) : !1)) continue;
|
|
1573
1573
|
if (c = this.tokenizer.escape(t)) {
|
|
1574
1574
|
t = t.substring(c.raw.length), e.push(c);
|
|
1575
1575
|
continue;
|
|
@@ -1584,8 +1584,8 @@ ${p}` : p;
|
|
|
1584
1584
|
}
|
|
1585
1585
|
if (c = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1586
1586
|
t = t.substring(c.raw.length);
|
|
1587
|
-
let
|
|
1588
|
-
c.type === "text" &&
|
|
1587
|
+
let f = e.at(-1);
|
|
1588
|
+
c.type === "text" && f?.type === "text" ? (f.raw += c.raw, f.text += c.text) : e.push(c);
|
|
1589
1589
|
continue;
|
|
1590
1590
|
}
|
|
1591
1591
|
if (c = this.tokenizer.emStrong(t, n, o)) {
|
|
@@ -1614,28 +1614,28 @@ ${p}` : p;
|
|
|
1614
1614
|
}
|
|
1615
1615
|
let d = t;
|
|
1616
1616
|
if (this.options.extensions?.startInline) {
|
|
1617
|
-
let
|
|
1618
|
-
this.options.extensions.startInline.forEach((
|
|
1619
|
-
|
|
1620
|
-
}),
|
|
1617
|
+
let f = 1 / 0, p = t.slice(1), g;
|
|
1618
|
+
this.options.extensions.startInline.forEach((m) => {
|
|
1619
|
+
g = m.call({ lexer: this }, p), typeof g == "number" && g >= 0 && (f = Math.min(f, g));
|
|
1620
|
+
}), f < 1 / 0 && f >= 0 && (d = t.substring(0, f + 1));
|
|
1621
1621
|
}
|
|
1622
1622
|
if (c = this.tokenizer.inlineText(d)) {
|
|
1623
1623
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), a = !0;
|
|
1624
|
-
let
|
|
1625
|
-
|
|
1624
|
+
let f = e.at(-1);
|
|
1625
|
+
f?.type === "text" ? (f.raw += c.raw, f.text += c.text) : e.push(c);
|
|
1626
1626
|
continue;
|
|
1627
1627
|
}
|
|
1628
1628
|
if (t) {
|
|
1629
|
-
let
|
|
1629
|
+
let f = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
1630
1630
|
if (this.options.silent) {
|
|
1631
|
-
console.error(
|
|
1631
|
+
console.error(f);
|
|
1632
1632
|
break;
|
|
1633
|
-
} else throw new Error(
|
|
1633
|
+
} else throw new Error(f);
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
1636
|
return e;
|
|
1637
1637
|
}
|
|
1638
|
-
}, u(
|
|
1638
|
+
}, u(be, "u"), be), Pe, yt = (Pe = class {
|
|
1639
1639
|
constructor(t) {
|
|
1640
1640
|
C(this, "options");
|
|
1641
1641
|
C(this, "parser");
|
|
@@ -1645,7 +1645,7 @@ ${p}` : p;
|
|
|
1645
1645
|
return "";
|
|
1646
1646
|
}
|
|
1647
1647
|
code({ text: t, lang: e, escaped: n }) {
|
|
1648
|
-
let s = (e || "").match(
|
|
1648
|
+
let s = (e || "").match(Y.notSpaceStart)?.[0], r = t.replace(Y.endingNewline, "") + `
|
|
1649
1649
|
`;
|
|
1650
1650
|
return s ? '<pre><code class="language-' + ce(s) + '">' + (n ? r : ce(r, !0)) + `</code></pre>
|
|
1651
1651
|
` : "<pre><code>" + (n ? r : ce(r, !0)) + `</code></pre>
|
|
@@ -1783,18 +1783,18 @@ ${t}</tr>
|
|
|
1783
1783
|
checkbox({ raw: t }) {
|
|
1784
1784
|
return t;
|
|
1785
1785
|
}
|
|
1786
|
-
}, u($e, "$"), $e),
|
|
1786
|
+
}, u($e, "$"), $e), ke, ie = (ke = class {
|
|
1787
1787
|
constructor(t) {
|
|
1788
1788
|
C(this, "options");
|
|
1789
1789
|
C(this, "renderer");
|
|
1790
1790
|
C(this, "textRenderer");
|
|
1791
|
-
this.options = t || _e, this.options.renderer = this.options.renderer || new
|
|
1791
|
+
this.options = t || _e, this.options.renderer = this.options.renderer || new yt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ln();
|
|
1792
1792
|
}
|
|
1793
1793
|
static parse(t, e) {
|
|
1794
|
-
return new
|
|
1794
|
+
return new ke(e).parse(t);
|
|
1795
1795
|
}
|
|
1796
1796
|
static parseInline(t, e) {
|
|
1797
|
-
return new
|
|
1797
|
+
return new ke(e).parseInline(t);
|
|
1798
1798
|
}
|
|
1799
1799
|
parse(t) {
|
|
1800
1800
|
this.renderer.parser = this;
|
|
@@ -1934,7 +1934,7 @@ ${t}</tr>
|
|
|
1934
1934
|
}
|
|
1935
1935
|
return n;
|
|
1936
1936
|
}
|
|
1937
|
-
}, u(
|
|
1937
|
+
}, u(ke, "u"), ke), xe, Qe = (xe = class {
|
|
1938
1938
|
constructor(t) {
|
|
1939
1939
|
C(this, "options");
|
|
1940
1940
|
C(this, "block");
|
|
@@ -1958,17 +1958,17 @@ ${t}</tr>
|
|
|
1958
1958
|
provideParser(t = this.block) {
|
|
1959
1959
|
return t ? ie.parse : ie.parseInline;
|
|
1960
1960
|
}
|
|
1961
|
-
}, u(
|
|
1961
|
+
}, u(xe, "P"), C(xe, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), C(xe, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), xe), Ue, Vr = (Ue = class {
|
|
1962
1962
|
constructor(...t) {
|
|
1963
1963
|
C(this, "defaults", Qt());
|
|
1964
1964
|
C(this, "options", this.setOptions);
|
|
1965
1965
|
C(this, "parse", this.parseMarkdown(!0));
|
|
1966
1966
|
C(this, "parseInline", this.parseMarkdown(!1));
|
|
1967
1967
|
C(this, "Parser", ie);
|
|
1968
|
-
C(this, "Renderer",
|
|
1968
|
+
C(this, "Renderer", yt);
|
|
1969
1969
|
C(this, "TextRenderer", ln);
|
|
1970
1970
|
C(this, "Lexer", re);
|
|
1971
|
-
C(this, "Tokenizer",
|
|
1971
|
+
C(this, "Tokenizer", vt);
|
|
1972
1972
|
C(this, "Hooks", Qe);
|
|
1973
1973
|
this.use(...t);
|
|
1974
1974
|
}
|
|
@@ -2016,27 +2016,27 @@ ${t}</tr>
|
|
|
2016
2016
|
}
|
|
2017
2017
|
"childTokens" in r && r.childTokens && (e.childTokens[r.name] = r.childTokens);
|
|
2018
2018
|
}), s.extensions = e), n.renderer) {
|
|
2019
|
-
let r = this.defaults.renderer || new
|
|
2019
|
+
let r = this.defaults.renderer || new yt(this.defaults);
|
|
2020
2020
|
for (let a in n.renderer) {
|
|
2021
2021
|
if (!(a in r)) throw new Error(`renderer '${a}' does not exist`);
|
|
2022
2022
|
if (["options", "parser"].includes(a)) continue;
|
|
2023
2023
|
let o = a, c = n.renderer[o], d = r[o];
|
|
2024
|
-
r[o] = (...
|
|
2025
|
-
let p = c.apply(r,
|
|
2026
|
-
return p === !1 && (p = d.apply(r,
|
|
2024
|
+
r[o] = (...f) => {
|
|
2025
|
+
let p = c.apply(r, f);
|
|
2026
|
+
return p === !1 && (p = d.apply(r, f)), p || "";
|
|
2027
2027
|
};
|
|
2028
2028
|
}
|
|
2029
2029
|
s.renderer = r;
|
|
2030
2030
|
}
|
|
2031
2031
|
if (n.tokenizer) {
|
|
2032
|
-
let r = this.defaults.tokenizer || new
|
|
2032
|
+
let r = this.defaults.tokenizer || new vt(this.defaults);
|
|
2033
2033
|
for (let a in n.tokenizer) {
|
|
2034
2034
|
if (!(a in r)) throw new Error(`tokenizer '${a}' does not exist`);
|
|
2035
2035
|
if (["options", "rules", "lexer"].includes(a)) continue;
|
|
2036
2036
|
let o = a, c = n.tokenizer[o], d = r[o];
|
|
2037
|
-
r[o] = (...
|
|
2038
|
-
let p = c.apply(r,
|
|
2039
|
-
return p === !1 && (p = d.apply(r,
|
|
2037
|
+
r[o] = (...f) => {
|
|
2038
|
+
let p = c.apply(r, f);
|
|
2039
|
+
return p === !1 && (p = d.apply(r, f)), p;
|
|
2040
2040
|
};
|
|
2041
2041
|
}
|
|
2042
2042
|
s.tokenizer = r;
|
|
@@ -2047,20 +2047,20 @@ ${t}</tr>
|
|
|
2047
2047
|
if (!(a in r)) throw new Error(`hook '${a}' does not exist`);
|
|
2048
2048
|
if (["options", "block"].includes(a)) continue;
|
|
2049
2049
|
let o = a, c = n.hooks[o], d = r[o];
|
|
2050
|
-
Qe.passThroughHooks.has(a) ? r[o] = (
|
|
2050
|
+
Qe.passThroughHooks.has(a) ? r[o] = (f) => {
|
|
2051
2051
|
if (this.defaults.async && Qe.passThroughHooksRespectAsync.has(a)) return (async () => {
|
|
2052
|
-
let
|
|
2053
|
-
return d.call(r,
|
|
2052
|
+
let g = await c.call(r, f);
|
|
2053
|
+
return d.call(r, g);
|
|
2054
2054
|
})();
|
|
2055
|
-
let p = c.call(r,
|
|
2055
|
+
let p = c.call(r, f);
|
|
2056
2056
|
return d.call(r, p);
|
|
2057
|
-
} : r[o] = (...
|
|
2057
|
+
} : r[o] = (...f) => {
|
|
2058
2058
|
if (this.defaults.async) return (async () => {
|
|
2059
|
-
let
|
|
2060
|
-
return
|
|
2059
|
+
let g = await c.apply(r, f);
|
|
2060
|
+
return g === !1 && (g = await d.apply(r, f)), g;
|
|
2061
2061
|
})();
|
|
2062
|
-
let p = c.apply(r,
|
|
2063
|
-
return p === !1 && (p = d.apply(r,
|
|
2062
|
+
let p = c.apply(r, f);
|
|
2063
|
+
return p === !1 && (p = d.apply(r, f)), p;
|
|
2064
2064
|
};
|
|
2065
2065
|
}
|
|
2066
2066
|
s.hooks = r;
|
|
@@ -2093,8 +2093,8 @@ ${t}</tr>
|
|
|
2093
2093
|
if (r.hooks && (r.hooks.options = r, r.hooks.block = t), r.async) return (async () => {
|
|
2094
2094
|
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer(t) : t ? re.lex : re.lexInline)(o, r), d = r.hooks ? await r.hooks.processAllTokens(c) : c;
|
|
2095
2095
|
r.walkTokens && await Promise.all(this.walkTokens(d, r.walkTokens));
|
|
2096
|
-
let
|
|
2097
|
-
return r.hooks ? await r.hooks.postprocess(
|
|
2096
|
+
let f = await (r.hooks ? await r.hooks.provideParser(t) : t ? ie.parse : ie.parseInline)(d, r);
|
|
2097
|
+
return r.hooks ? await r.hooks.postprocess(f) : f;
|
|
2098
2098
|
})().catch(a);
|
|
2099
2099
|
try {
|
|
2100
2100
|
r.hooks && (e = r.hooks.preprocess(e));
|
|
@@ -2119,51 +2119,54 @@ Please report this to https://github.com/markedjs/marked.`, t) {
|
|
|
2119
2119
|
};
|
|
2120
2120
|
}
|
|
2121
2121
|
}, u(Ue, "D"), Ue), Ae = new Vr();
|
|
2122
|
-
function
|
|
2122
|
+
function M(l, t) {
|
|
2123
2123
|
return Ae.parse(l, t);
|
|
2124
2124
|
}
|
|
2125
|
-
u(
|
|
2126
|
-
|
|
2127
|
-
return Ae.setOptions(l),
|
|
2125
|
+
u(M, "g");
|
|
2126
|
+
M.options = M.setOptions = function(l) {
|
|
2127
|
+
return Ae.setOptions(l), M.defaults = Ae.defaults, ns(M.defaults), M;
|
|
2128
2128
|
};
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
return Ae.use(...l),
|
|
2129
|
+
M.getDefaults = Qt;
|
|
2130
|
+
M.defaults = _e;
|
|
2131
|
+
M.use = function(...l) {
|
|
2132
|
+
return Ae.use(...l), M.defaults = Ae.defaults, ns(M.defaults), M;
|
|
2133
2133
|
};
|
|
2134
|
-
|
|
2134
|
+
M.walkTokens = function(l, t) {
|
|
2135
2135
|
return Ae.walkTokens(l, t);
|
|
2136
2136
|
};
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2137
|
+
M.parseInline = Ae.parseInline;
|
|
2138
|
+
M.Parser = ie;
|
|
2139
|
+
M.parser = ie.parse;
|
|
2140
|
+
M.Renderer = yt;
|
|
2141
|
+
M.TextRenderer = ln;
|
|
2142
|
+
M.Lexer = re;
|
|
2143
|
+
M.lexer = re.lex;
|
|
2144
|
+
M.Tokenizer = vt;
|
|
2145
|
+
M.Hooks = Qe;
|
|
2146
|
+
M.parse = M;
|
|
2147
|
+
M.options;
|
|
2148
|
+
M.setOptions;
|
|
2149
|
+
M.use;
|
|
2150
|
+
M.walkTokens;
|
|
2151
|
+
M.parseInline;
|
|
2152
2152
|
ie.parse;
|
|
2153
2153
|
re.lex;
|
|
2154
|
-
const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
2154
|
+
const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
2155
2155
|
key: 0,
|
|
2156
2156
|
class: "pb-4"
|
|
2157
2157
|
}, Xr = {
|
|
2158
2158
|
key: 0,
|
|
2159
|
-
class: "flex flex-col items-center justify-center
|
|
2160
|
-
}, Kr = { class: "relative mb-
|
|
2159
|
+
class: "flex flex-col items-center justify-center px-4 min-h-full"
|
|
2160
|
+
}, Kr = { class: "relative mb-4 size-20 @sm/chat:size-24" }, Qr = ["src", "alt"], Jr = ["title"], ei = {
|
|
2161
2161
|
key: 0,
|
|
2162
2162
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2163
|
-
}, ti =
|
|
2163
|
+
}, ti = {
|
|
2164
|
+
key: 0,
|
|
2165
|
+
class: "flex-shrink-0 size-7 @sm/chat:size-8"
|
|
2166
|
+
}, ni = ["src", "alt"], si = ["src", "alt"], ri = ["src"], ii = ["href"], ai = ["innerHTML"], li = {
|
|
2164
2167
|
key: 1,
|
|
2165
|
-
class: "flex gap-2 justify-start items-
|
|
2166
|
-
},
|
|
2168
|
+
class: "flex gap-2 justify-start items-center mb-4"
|
|
2169
|
+
}, oi = ["src", "alt"], ci = {
|
|
2167
2170
|
key: 0,
|
|
2168
2171
|
class: "flex items-center gap-2 px-2 pb-2 overflow-x-auto"
|
|
2169
2172
|
}, ui = ["src", "alt"], hi = { class: "max-w-20 truncate" }, pi = ["onClick"], di = {
|
|
@@ -2181,7 +2184,6 @@ const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
|
2181
2184
|
chatController: {},
|
|
2182
2185
|
agent: {},
|
|
2183
2186
|
variant: { default: "dark" },
|
|
2184
|
-
scale: { default: "md" },
|
|
2185
2187
|
uploadFn: { type: Function },
|
|
2186
2188
|
scope: { default: "private" },
|
|
2187
2189
|
scopeName: {},
|
|
@@ -2189,13 +2191,13 @@ const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
|
2189
2191
|
emptyStateMessage: {}
|
|
2190
2192
|
},
|
|
2191
2193
|
setup(l) {
|
|
2192
|
-
const t = new
|
|
2193
|
-
t.link = ({ href:
|
|
2194
|
-
function e(
|
|
2195
|
-
if (!
|
|
2194
|
+
const t = new M.Renderer();
|
|
2195
|
+
t.link = ({ href: b, text: v }) => `<a href="${b}" target="_blank" rel="noopener noreferrer">${v}</a>`, M.setOptions({ breaks: !0, gfm: !0, renderer: t });
|
|
2196
|
+
function e(b) {
|
|
2197
|
+
if (!b)
|
|
2196
2198
|
return "";
|
|
2197
|
-
const
|
|
2198
|
-
return ar.sanitize(
|
|
2199
|
+
const v = M.parse(b, { async: !1 });
|
|
2200
|
+
return ar.sanitize(v, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2199
2201
|
}
|
|
2200
2202
|
u(e, "renderMarkdown");
|
|
2201
2203
|
const n = {
|
|
@@ -2206,361 +2208,343 @@ const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
|
2206
2208
|
private: { icon: "i-tabler-lock", label: "Private", tooltip: "Only you can see this conversation" },
|
|
2207
2209
|
org: { icon: "i-tabler-users", label: "Workspace", tooltip: "Visible to workspace members" },
|
|
2208
2210
|
public: { icon: "i-tabler-globe", label: "Public", tooltip: "Anyone with the link can see this" }
|
|
2209
|
-
}, r =
|
|
2210
|
-
const
|
|
2211
|
-
return l.scope === "org" && l.scopeName && (
|
|
2212
|
-
}), o =
|
|
2213
|
-
function
|
|
2214
|
-
const
|
|
2215
|
-
return !
|
|
2211
|
+
}, r = F(() => l.setupHint ?? n[l.scope]), a = F(() => {
|
|
2212
|
+
const b = { ...s[l.scope] };
|
|
2213
|
+
return l.scope === "org" && l.scopeName && (b.label = l.scopeName, b.tooltip = `Visible to ${l.scopeName} members`), b;
|
|
2214
|
+
}), o = V(""), c = V(!1), d = V(), f = V(), p = V(), g = V([]), m = V(!1);
|
|
2215
|
+
function y(b, v) {
|
|
2216
|
+
const k = b[v], z = b[v + 1];
|
|
2217
|
+
return !z || z.sender !== k.sender;
|
|
2216
2218
|
}
|
|
2217
|
-
u(
|
|
2218
|
-
const
|
|
2219
|
+
u(y, "shouldShowAvatar");
|
|
2220
|
+
const S = F(() => l.chatController?.textState.value), O = F(() => S.value?.isConnected ?? !1), ge = F(() => S.value?.isThinking ?? !1), me = F(() => S.value?.connectionStatus === "disconnected" && !!S.value?.error), ne = F(() => S.value?.connectionStatus !== "connected" && !S.value?.error), $ = F(() => S.value?.error), j = F(() => l.chatController?.sharedMessages.value?.filter((b) => b.sender !== "system") ?? []), se = F(() => !O.value), he = F(() => me.value ? "Agent is offline" : ne.value ? "Connecting..." : "Message"), tt = F(() => (o.value.trim() || g.value.length > 0) && !se.value && !m.value), L = F(() => l.variant === "light"), nt = F(
|
|
2221
|
+
() => L.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2222
|
+
), U = F(() => L.value ? "text-theme-300" : "text-white/30");
|
|
2219
2223
|
Kt(async () => {
|
|
2220
|
-
if (l.chatController && !
|
|
2224
|
+
if (l.chatController && !O.value)
|
|
2221
2225
|
try {
|
|
2222
2226
|
await l.chatController.startTextConversation();
|
|
2223
|
-
} catch (
|
|
2224
|
-
console.error("Failed to start text conversation:",
|
|
2227
|
+
} catch (b) {
|
|
2228
|
+
console.error("Failed to start text conversation:", b);
|
|
2225
2229
|
}
|
|
2226
2230
|
});
|
|
2227
|
-
async function
|
|
2228
|
-
const
|
|
2229
|
-
if (!
|
|
2231
|
+
async function Re() {
|
|
2232
|
+
const b = o.value.trim(), v = g.value.length > 0;
|
|
2233
|
+
if (!b && !v || !l.chatController || !O.value || m.value)
|
|
2230
2234
|
return;
|
|
2231
|
-
const
|
|
2232
|
-
|
|
2235
|
+
const k = o.value, z = v ? [...g.value] : void 0;
|
|
2236
|
+
o.value = "", g.value = [], f.value && (f.value.style.height = "auto", f.value.focus());
|
|
2233
2237
|
try {
|
|
2234
|
-
await l.chatController.sendChatMessage(
|
|
2235
|
-
} catch (
|
|
2236
|
-
console.error("Error sending message:",
|
|
2238
|
+
await l.chatController.sendChatMessage(k, z), De();
|
|
2239
|
+
} catch (D) {
|
|
2240
|
+
console.error("Error sending message:", D);
|
|
2237
2241
|
}
|
|
2238
2242
|
}
|
|
2239
|
-
u(
|
|
2240
|
-
function
|
|
2241
|
-
|
|
2243
|
+
u(Re, "sendMessage");
|
|
2244
|
+
function Fe(b) {
|
|
2245
|
+
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), Re());
|
|
2242
2246
|
}
|
|
2243
|
-
u(
|
|
2247
|
+
u(Fe, "handleKeydown");
|
|
2244
2248
|
function De() {
|
|
2245
|
-
|
|
2246
|
-
|
|
2249
|
+
d.value && Ut(() => {
|
|
2250
|
+
d.value.scrollTop = d.value.scrollHeight;
|
|
2247
2251
|
});
|
|
2248
2252
|
}
|
|
2249
2253
|
u(De, "scrollToBottom");
|
|
2250
|
-
function Fe() {
|
|
2251
|
-
p.value && (p.value.style.height = "auto", p.value.style.height = `${Math.min(p.value.scrollHeight, 150)}px`);
|
|
2252
|
-
}
|
|
2253
|
-
u(Fe, "adjustTextareaHeight"), Je(c, () => Ut(() => Fe()));
|
|
2254
|
-
const M = W(() => l.variant === "light");
|
|
2255
2254
|
function At() {
|
|
2256
|
-
|
|
2255
|
+
f.value && (f.value.style.height = "auto", f.value.style.height = `${Math.min(f.value.scrollHeight, 150)}px`);
|
|
2257
2256
|
}
|
|
2258
|
-
u(At, "
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2257
|
+
u(At, "adjustTextareaHeight"), Je(o, () => Ut(() => At()));
|
|
2258
|
+
function Et() {
|
|
2259
|
+
p.value?.click();
|
|
2260
|
+
}
|
|
2261
|
+
u(Et, "triggerFileInput");
|
|
2262
|
+
async function _t(b) {
|
|
2263
|
+
const v = b.target, k = v.files?.[0];
|
|
2264
|
+
if (!(!k || !l.uploadFn)) {
|
|
2265
|
+
m.value = !0;
|
|
2263
2266
|
try {
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2266
|
-
} catch (
|
|
2267
|
-
console.error("Upload failed:",
|
|
2267
|
+
const z = await l.uploadFn(k);
|
|
2268
|
+
g.value = [...g.value, z];
|
|
2269
|
+
} catch (z) {
|
|
2270
|
+
console.error("Upload failed:", z);
|
|
2268
2271
|
} finally {
|
|
2269
|
-
|
|
2272
|
+
m.value = !1, v.value = "";
|
|
2270
2273
|
}
|
|
2271
2274
|
}
|
|
2272
2275
|
}
|
|
2273
|
-
u(
|
|
2274
|
-
function
|
|
2275
|
-
|
|
2276
|
+
u(_t, "handleFileSelect");
|
|
2277
|
+
function st(b) {
|
|
2278
|
+
g.value = g.value.filter((v, k) => k !== b);
|
|
2276
2279
|
}
|
|
2277
|
-
u(
|
|
2278
|
-
function
|
|
2279
|
-
if (
|
|
2280
|
-
const
|
|
2281
|
-
return
|
|
2282
|
-
}
|
|
2283
|
-
const
|
|
2284
|
-
if (!
|
|
2285
|
-
const
|
|
2286
|
-
return new Date(
|
|
2280
|
+
u(st, "removeAttachment");
|
|
2281
|
+
function rt(b, v) {
|
|
2282
|
+
if (v === 0) {
|
|
2283
|
+
const ee = b[v];
|
|
2284
|
+
return ee?.timestamp ? He(new Date(ee.timestamp)) : null;
|
|
2285
|
+
}
|
|
2286
|
+
const k = b[v - 1], z = b[v];
|
|
2287
|
+
if (!k?.timestamp || !z?.timestamp) return null;
|
|
2288
|
+
const D = new Date(k.timestamp).getTime();
|
|
2289
|
+
return new Date(z.timestamp).getTime() - D > 36e5 ? He(new Date(z.timestamp)) : null;
|
|
2287
2290
|
}
|
|
2288
|
-
u(
|
|
2289
|
-
function
|
|
2290
|
-
const
|
|
2291
|
-
|
|
2292
|
-
const
|
|
2293
|
-
if (
|
|
2294
|
-
if (
|
|
2295
|
-
const
|
|
2296
|
-
return `${
|
|
2291
|
+
u(rt, "shouldShowTimeDivider");
|
|
2292
|
+
function He(b) {
|
|
2293
|
+
const v = /* @__PURE__ */ new Date(), k = b.toDateString() === v.toDateString(), z = new Date(v);
|
|
2294
|
+
z.setDate(z.getDate() - 1);
|
|
2295
|
+
const D = b.toDateString() === z.toDateString(), J = b.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2296
|
+
if (k) return J;
|
|
2297
|
+
if (D) return `Yesterday, ${J}`;
|
|
2298
|
+
const we = b.getFullYear() === v.getFullYear();
|
|
2299
|
+
return `${b.toLocaleDateString("en-US", {
|
|
2297
2300
|
weekday: "long",
|
|
2298
2301
|
month: "short",
|
|
2299
2302
|
day: "numeric",
|
|
2300
|
-
...
|
|
2301
|
-
})}, ${
|
|
2303
|
+
...we ? {} : { year: "numeric" }
|
|
2304
|
+
})}, ${J}`;
|
|
2302
2305
|
}
|
|
2303
|
-
return u(
|
|
2304
|
-
|
|
2305
|
-
}, { immediate: !0, deep: !0 }), (
|
|
2306
|
-
|
|
2306
|
+
return u(He, "formatTimeDivider"), Je(j, (b) => {
|
|
2307
|
+
b.length > 0 && Ut(() => De());
|
|
2308
|
+
}, { immediate: !0, deep: !0 }), (b, v) => (A(), E("div", Yr, [
|
|
2309
|
+
L.value ? G("", !0) : (A(), E("div", Zr, [
|
|
2307
2310
|
Bt($s, {
|
|
2308
2311
|
agent: l.agent,
|
|
2309
|
-
"is-online":
|
|
2312
|
+
"is-online": O.value
|
|
2310
2313
|
}, null, 8, ["agent", "is-online"])
|
|
2311
2314
|
])),
|
|
2312
|
-
|
|
2315
|
+
me.value ? (A(), E("div", {
|
|
2313
2316
|
key: 1,
|
|
2314
|
-
class:
|
|
2317
|
+
class: _(["py-16 flex flex-col items-center justify-center gap-3 text-sm", L.value ? "text-theme-400" : "text-white/60"])
|
|
2315
2318
|
}, [
|
|
2316
|
-
|
|
2317
|
-
class:
|
|
2319
|
+
T("i", {
|
|
2320
|
+
class: _(["i-heroicons-cloud-arrow-down size-8", L.value ? "text-theme-300" : "text-white/40"])
|
|
2318
2321
|
}, null, 2),
|
|
2319
|
-
|
|
2320
|
-
], 2)) :
|
|
2322
|
+
T("span", null, ue($.value), 1)
|
|
2323
|
+
], 2)) : ne.value ? (A(), E("div", {
|
|
2321
2324
|
key: 2,
|
|
2322
|
-
class:
|
|
2325
|
+
class: _(["py-16 flex flex-col items-center justify-center gap-2 text-sm", L.value ? "text-theme-400" : "text-theme-600"])
|
|
2323
2326
|
}, [
|
|
2324
2327
|
Bt(Cn, { class: "size-4" })
|
|
2325
|
-
], 2)) : r.value ? (
|
|
2328
|
+
], 2)) : r.value ? (A(), E("div", {
|
|
2326
2329
|
key: 3,
|
|
2327
|
-
class:
|
|
2330
|
+
class: _(["flex items-center justify-center gap-1.5 py-2 text-[11px]", U.value])
|
|
2328
2331
|
}, [
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
], 2)) :
|
|
2332
|
-
|
|
2332
|
+
v[5] || (v[5] = T("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2333
|
+
T("span", null, ue(r.value), 1)
|
|
2334
|
+
], 2)) : G("", !0),
|
|
2335
|
+
T("div", {
|
|
2333
2336
|
ref_key: "messagesContainer",
|
|
2334
|
-
ref:
|
|
2337
|
+
ref: d,
|
|
2335
2338
|
class: "flex-1 overflow-y-auto overflow-x-hidden pt-4 pb-[120px] px-3 space-y-1 min-h-0 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"
|
|
2336
2339
|
}, [
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
+
j.value.length === 0 && !ne.value && !me.value ? (A(), E("div", Xr, [
|
|
2341
|
+
T("div", Kr, [
|
|
2342
|
+
T("img", {
|
|
2340
2343
|
src: l.agent.avatarUrl.value,
|
|
2341
2344
|
alt: l.agent.displayName.value,
|
|
2342
|
-
class:
|
|
2345
|
+
class: _(["size-full rounded-full object-cover ring-1", L.value ? "ring-black/5" : "ring-white/10"])
|
|
2343
2346
|
}, null, 10, Qr),
|
|
2344
|
-
|
|
2347
|
+
O.value ? (A(), E("span", {
|
|
2345
2348
|
key: 0,
|
|
2346
|
-
class:
|
|
2347
|
-
}, [
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
style: { "animation-duration": "2.5s" }
|
|
2351
|
-
}, null, 2),
|
|
2352
|
-
v("span", {
|
|
2353
|
-
class: y(["relative inline-flex rounded-full bg-emerald-500 ring-2", [
|
|
2354
|
-
o.value ? "size-3" : "size-2.5",
|
|
2355
|
-
M.value ? "ring-white" : "ring-theme-900"
|
|
2356
|
-
]])
|
|
2357
|
-
}, null, 2)
|
|
2358
|
-
], 2)) : B("", !0)
|
|
2349
|
+
class: _(["absolute top-[85%] left-[85%] -translate-x-1/2 -translate-y-1/2 size-[18%] min-w-2.5 min-h-2.5 flex items-center justify-center rounded-full", L.value ? "bg-white" : "bg-theme-900"])
|
|
2350
|
+
}, [...v[6] || (v[6] = [
|
|
2351
|
+
T("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2352
|
+
])], 2)) : G("", !0)
|
|
2359
2353
|
]),
|
|
2360
|
-
|
|
2361
|
-
class:
|
|
2354
|
+
T("div", {
|
|
2355
|
+
class: _(["text-base @sm/chat:text-lg font-semibold", L.value ? "text-theme-900" : "text-white"])
|
|
2362
2356
|
}, ue(l.agent.displayName.value), 3),
|
|
2363
|
-
|
|
2364
|
-
class:
|
|
2357
|
+
T("p", {
|
|
2358
|
+
class: _(["mt-1 text-center text-xs @sm/chat:text-sm", U.value])
|
|
2365
2359
|
}, ue(l.emptyStateMessage || "Send a message to get started"), 3),
|
|
2366
|
-
|
|
2367
|
-
class:
|
|
2360
|
+
T("div", {
|
|
2361
|
+
class: _(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", L.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2368
2362
|
title: a.value.tooltip
|
|
2369
2363
|
}, [
|
|
2370
|
-
|
|
2371
|
-
class:
|
|
2364
|
+
T("i", {
|
|
2365
|
+
class: _([a.value.icon, "size-3"])
|
|
2372
2366
|
}, null, 2),
|
|
2373
|
-
|
|
2367
|
+
T("span", null, ue(a.value.label), 1)
|
|
2374
2368
|
], 10, Jr)
|
|
2375
|
-
])) :
|
|
2376
|
-
(
|
|
2377
|
-
key:
|
|
2369
|
+
])) : G("", !0),
|
|
2370
|
+
(A(!0), E(Te, null, mt(j.value, (k, z) => (A(), E(Te, {
|
|
2371
|
+
key: k.id
|
|
2378
2372
|
}, [
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
class:
|
|
2373
|
+
rt(j.value, z) ? (A(), E("div", ei, [
|
|
2374
|
+
T("div", {
|
|
2375
|
+
class: _(["flex-1 h-px", nt.value])
|
|
2382
2376
|
}, null, 2),
|
|
2383
|
-
|
|
2384
|
-
class:
|
|
2385
|
-
}, ue(
|
|
2386
|
-
|
|
2387
|
-
class:
|
|
2377
|
+
T("span", {
|
|
2378
|
+
class: _(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", U.value])
|
|
2379
|
+
}, ue(rt(j.value, z)), 3),
|
|
2380
|
+
T("div", {
|
|
2381
|
+
class: _(["flex-1 h-px", nt.value])
|
|
2388
2382
|
}, null, 2)
|
|
2389
|
-
])) :
|
|
2390
|
-
|
|
2391
|
-
class:
|
|
2392
|
-
"justify-end":
|
|
2393
|
-
"justify-start":
|
|
2394
|
-
"mb-4":
|
|
2383
|
+
])) : G("", !0),
|
|
2384
|
+
T("div", {
|
|
2385
|
+
class: _(["flex gap-2 items-end", {
|
|
2386
|
+
"justify-end": k.sender === "user",
|
|
2387
|
+
"justify-start": k.sender === "agent",
|
|
2388
|
+
"mb-4": y(j.value, z)
|
|
2395
2389
|
}])
|
|
2396
2390
|
}, [
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
class: y(["flex-shrink-0", o.value ? "size-10" : "size-8"])
|
|
2400
|
-
}, [
|
|
2401
|
-
_(q.value, A) ? (T(), S("img", {
|
|
2391
|
+
k.sender === "agent" ? (A(), E("div", ti, [
|
|
2392
|
+
y(j.value, z) ? (A(), E("img", {
|
|
2402
2393
|
key: 0,
|
|
2403
2394
|
src: l.agent.avatarUrl.value,
|
|
2404
2395
|
alt: l.agent.displayName.value,
|
|
2405
|
-
class:
|
|
2406
|
-
}, null, 10,
|
|
2407
|
-
]
|
|
2408
|
-
|
|
2409
|
-
class:
|
|
2396
|
+
class: _(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", L.value ? "ring-1 ring-black/5" : ""])
|
|
2397
|
+
}, null, 10, ni)) : G("", !0)
|
|
2398
|
+
])) : G("", !0),
|
|
2399
|
+
T("div", {
|
|
2400
|
+
class: _(k.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2410
2401
|
}, [
|
|
2411
|
-
|
|
2402
|
+
k.attachments?.length ? (A(), E("div", {
|
|
2412
2403
|
key: 0,
|
|
2413
|
-
class:
|
|
2404
|
+
class: _(["mb-1 space-y-1", k.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2414
2405
|
}, [
|
|
2415
|
-
(
|
|
2416
|
-
|
|
2406
|
+
(A(!0), E(Te, null, mt(k.attachments, (D, J) => (A(), E(Te, { key: J }, [
|
|
2407
|
+
D.type === "image" ? (A(), E("img", {
|
|
2417
2408
|
key: 0,
|
|
2418
|
-
src:
|
|
2419
|
-
alt:
|
|
2420
|
-
class:
|
|
2421
|
-
}, null,
|
|
2409
|
+
src: D.url,
|
|
2410
|
+
alt: D.name,
|
|
2411
|
+
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2412
|
+
}, null, 8, si)) : D.type === "audio" ? (A(), E("audio", {
|
|
2422
2413
|
key: 1,
|
|
2423
|
-
src:
|
|
2414
|
+
src: D.url,
|
|
2424
2415
|
controls: "",
|
|
2425
2416
|
class: "max-w-full"
|
|
2426
|
-
}, null, 8,
|
|
2417
|
+
}, null, 8, ri)) : (A(), E("a", {
|
|
2427
2418
|
key: 2,
|
|
2428
|
-
href:
|
|
2419
|
+
href: D.url,
|
|
2429
2420
|
target: "_blank",
|
|
2430
2421
|
rel: "noopener",
|
|
2431
|
-
class:
|
|
2422
|
+
class: _(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", L.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2432
2423
|
}, [
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
], 10,
|
|
2424
|
+
v[7] || (v[7] = T("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2425
|
+
pt(" " + ue(D.name), 1)
|
|
2426
|
+
], 10, ii))
|
|
2436
2427
|
], 64))), 128))
|
|
2437
|
-
], 2)) :
|
|
2438
|
-
|
|
2428
|
+
], 2)) : G("", !0),
|
|
2429
|
+
k.text ? (A(), E("div", {
|
|
2439
2430
|
key: 1,
|
|
2440
|
-
class:
|
|
2431
|
+
class: _(["rounded-2xl px-3.5 py-2", [
|
|
2432
|
+
k.sender === "user" ? "bg-primary-500 text-white rounded-br-[4px]" : L.value ? "bg-theme-50 text-theme-800 border border-black/[0.02] rounded-bl-[4px]" : "bg-white/15 backdrop-blur-sm text-white/95 rounded-bl-[4px]"
|
|
2433
|
+
]])
|
|
2441
2434
|
}, [
|
|
2442
|
-
|
|
2443
|
-
class:
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
innerHTML: e(R.text)
|
|
2448
|
-
}, null, 10, ii)
|
|
2449
|
-
], 2)) : B("", !0)
|
|
2435
|
+
T("div", {
|
|
2436
|
+
class: _(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed", k.sender === "user" || !L.value ? "chat-msg-prose-invert" : ""]),
|
|
2437
|
+
innerHTML: e(k.text)
|
|
2438
|
+
}, null, 10, ai)
|
|
2439
|
+
], 2)) : G("", !0)
|
|
2450
2440
|
], 2)
|
|
2451
2441
|
], 2)
|
|
2452
2442
|
], 64))), 128)),
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
v("div", {
|
|
2462
|
-
class: y(["rounded-2xl px-4 py-2.5 flex items-center", M.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2443
|
+
ge.value ? (A(), E("div", li, [
|
|
2444
|
+
T("img", {
|
|
2445
|
+
src: l.agent.avatarUrl.value,
|
|
2446
|
+
alt: l.agent.displayName.value,
|
|
2447
|
+
class: _(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", L.value ? "ring-1 ring-black/5" : ""])
|
|
2448
|
+
}, null, 10, oi),
|
|
2449
|
+
T("div", {
|
|
2450
|
+
class: _(["rounded-2xl px-3.5 py-2.5 flex items-center", L.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2463
2451
|
}, [
|
|
2464
|
-
|
|
2465
|
-
class:
|
|
2452
|
+
T("i", {
|
|
2453
|
+
class: _(["i-svg-spinners-3-dots-bounce size-7", L.value ? "text-theme-400" : "text-white/50"])
|
|
2466
2454
|
}, null, 2)
|
|
2467
2455
|
], 2)
|
|
2468
|
-
])) :
|
|
2456
|
+
])) : G("", !0)
|
|
2469
2457
|
], 512),
|
|
2470
|
-
|
|
2471
|
-
class:
|
|
2458
|
+
T("div", {
|
|
2459
|
+
class: _(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", L.value ? "bg-gradient-to-t from-white via-white/95 to-white/70" : "bg-gradient-to-t from-black/80 via-black/70 to-black/40"])
|
|
2472
2460
|
}, [
|
|
2473
|
-
|
|
2474
|
-
(
|
|
2475
|
-
key:
|
|
2461
|
+
g.value.length > 0 ? (A(), E("div", ci, [
|
|
2462
|
+
(A(!0), E(Te, null, mt(g.value, (k, z) => (A(), E("div", {
|
|
2463
|
+
key: z,
|
|
2476
2464
|
class: "relative shrink-0 group"
|
|
2477
2465
|
}, [
|
|
2478
|
-
|
|
2466
|
+
k.type === "image" ? (A(), E("img", {
|
|
2479
2467
|
key: 0,
|
|
2480
|
-
src:
|
|
2481
|
-
alt:
|
|
2482
|
-
class:
|
|
2483
|
-
}, null, 10, ui)) : (
|
|
2468
|
+
src: k.url,
|
|
2469
|
+
alt: k.name,
|
|
2470
|
+
class: _(["size-14 rounded-xl object-cover border", L.value ? "border-black/10" : "border-white/20"])
|
|
2471
|
+
}, null, 10, ui)) : (A(), E("div", {
|
|
2484
2472
|
key: 1,
|
|
2485
|
-
class:
|
|
2473
|
+
class: _(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", L.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2486
2474
|
}, [
|
|
2487
|
-
|
|
2488
|
-
|
|
2475
|
+
v[8] || (v[8] = T("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2476
|
+
T("span", hi, ue(k.name), 1)
|
|
2489
2477
|
], 2)),
|
|
2490
|
-
|
|
2478
|
+
T("button", {
|
|
2491
2479
|
class: "absolute -top-1.5 -right-1.5 size-5 flex items-center justify-center rounded-full bg-theme-800 text-white text-xs scale-0 group-hover:scale-100 transition-transform cursor-pointer",
|
|
2492
|
-
onClick: /* @__PURE__ */ u((
|
|
2493
|
-
}, [...
|
|
2494
|
-
|
|
2480
|
+
onClick: /* @__PURE__ */ u((D) => st(z), "onClick")
|
|
2481
|
+
}, [...v[9] || (v[9] = [
|
|
2482
|
+
T("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2495
2483
|
])], 8, pi)
|
|
2496
2484
|
]))), 128)),
|
|
2497
|
-
|
|
2485
|
+
m.value ? (A(), E("div", di, [
|
|
2498
2486
|
Bt(Cn, { class: "size-5" })
|
|
2499
|
-
])) :
|
|
2500
|
-
])) :
|
|
2501
|
-
l.uploadFn ? (
|
|
2487
|
+
])) : G("", !0)
|
|
2488
|
+
])) : G("", !0),
|
|
2489
|
+
l.uploadFn ? (A(), E("input", {
|
|
2502
2490
|
key: 1,
|
|
2503
2491
|
ref_key: "fileInput",
|
|
2504
|
-
ref:
|
|
2492
|
+
ref: p,
|
|
2505
2493
|
type: "file",
|
|
2506
2494
|
accept: "image/*,audio/*,video/*",
|
|
2507
2495
|
class: "hidden",
|
|
2508
|
-
onChange:
|
|
2509
|
-
}, null, 544)) :
|
|
2510
|
-
|
|
2511
|
-
class:
|
|
2496
|
+
onChange: _t
|
|
2497
|
+
}, null, 544)) : G("", !0),
|
|
2498
|
+
T("div", {
|
|
2499
|
+
class: _(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", L.value ? c.value ? "bg-white ring-1 ring-black/10 shadow-[0_4px_16px_rgba(0,0,0,0.06)]" : "bg-theme-50 ring-1 ring-transparent hover:ring-black/5" : c.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2512
2500
|
}, [
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
k.value ? "opacity-50 pointer-events-none" : ""
|
|
2501
|
+
T("button", {
|
|
2502
|
+
class: _(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
2503
|
+
l.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
2504
|
+
L.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2505
|
+
m.value ? "opacity-50 pointer-events-none" : ""
|
|
2519
2506
|
]]),
|
|
2520
|
-
disabled: se.value ||
|
|
2521
|
-
onClick:
|
|
2507
|
+
disabled: se.value || m.value || !l.uploadFn,
|
|
2508
|
+
onClick: v[0] || (v[0] = (k) => l.uploadFn && Et())
|
|
2522
2509
|
}, [
|
|
2523
|
-
|
|
2524
|
-
], 10, fi)
|
|
2525
|
-
Zn(
|
|
2510
|
+
m.value ? (A(), E("i", gi)) : (A(), E("i", mi))
|
|
2511
|
+
], 10, fi),
|
|
2512
|
+
Zn(T("textarea", {
|
|
2526
2513
|
ref_key: "textarea",
|
|
2527
|
-
ref:
|
|
2528
|
-
"onUpdate:modelValue":
|
|
2514
|
+
ref: f,
|
|
2515
|
+
"onUpdate:modelValue": v[1] || (v[1] = (k) => o.value = k),
|
|
2529
2516
|
rows: "1",
|
|
2530
2517
|
enterkeyhint: "send",
|
|
2531
|
-
placeholder:
|
|
2518
|
+
placeholder: he.value,
|
|
2532
2519
|
disabled: se.value,
|
|
2533
2520
|
style: { fontSize: "16px", resize: "none" },
|
|
2534
|
-
class:
|
|
2535
|
-
onKeydown:
|
|
2536
|
-
onFocus:
|
|
2537
|
-
onBlur:
|
|
2521
|
+
class: _(["flex-1 min-w-0 bg-transparent px-1 py-2 focus:outline-none disabled:opacity-50 overflow-y-auto leading-relaxed [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", L.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2522
|
+
onKeydown: Fe,
|
|
2523
|
+
onFocus: v[2] || (v[2] = (k) => c.value = !0),
|
|
2524
|
+
onBlur: v[3] || (v[3] = (k) => c.value = !1)
|
|
2538
2525
|
}, null, 42, xi), [
|
|
2539
|
-
[Xn,
|
|
2526
|
+
[Xn, o.value]
|
|
2540
2527
|
]),
|
|
2541
|
-
|
|
2542
|
-
class:
|
|
2543
|
-
o.value ? "size-10" : "size-9",
|
|
2544
|
-
tt.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : M.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"
|
|
2545
|
-
]]),
|
|
2528
|
+
T("button", {
|
|
2529
|
+
class: _(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10", tt.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : L.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2546
2530
|
disabled: !tt.value,
|
|
2547
|
-
onClick:
|
|
2548
|
-
}, [...
|
|
2549
|
-
|
|
2531
|
+
onClick: v[4] || (v[4] = (k) => Re())
|
|
2532
|
+
}, [...v[10] || (v[10] = [
|
|
2533
|
+
T("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2550
2534
|
])], 10, bi)
|
|
2551
2535
|
], 2),
|
|
2552
|
-
|
|
2553
|
-
class:
|
|
2536
|
+
T("div", {
|
|
2537
|
+
class: _(["text-[10px] text-center mt-2.5 select-none opacity-70", L.value ? "text-theme-400" : "text-white/50"])
|
|
2554
2538
|
}, [
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
class:
|
|
2539
|
+
v[11] || (v[11] = pt(" Press ", -1)),
|
|
2540
|
+
T("kbd", {
|
|
2541
|
+
class: _(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", L.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2558
2542
|
}, "Enter", 2),
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
class:
|
|
2543
|
+
v[12] || (v[12] = pt(" to send, ", -1)),
|
|
2544
|
+
T("kbd", {
|
|
2545
|
+
class: _(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", L.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2562
2546
|
}, "Shift+Enter", 2),
|
|
2563
|
-
|
|
2547
|
+
v[13] || (v[13] = pt(" for new line ", -1))
|
|
2564
2548
|
], 2)
|
|
2565
2549
|
], 2)
|
|
2566
2550
|
]));
|
|
@@ -2585,7 +2569,7 @@ const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
|
2585
2569
|
const t = Ts("AgentWrap"), e = l, n = e.sdk || Ss.getInstance({
|
|
2586
2570
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2587
2571
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2588
|
-
}), s =
|
|
2572
|
+
}), s = V(!e.agent), r = vs(e.agent ? new kt({ config: e.agent }) : void 0), a = V();
|
|
2589
2573
|
return Kt(async () => {
|
|
2590
2574
|
if (e.agent) {
|
|
2591
2575
|
t.debug("Agent provided via props, skipping fetch", {
|
|
@@ -2612,7 +2596,7 @@ const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
|
2612
2596
|
try {
|
|
2613
2597
|
s.value = !0, t.debug("Fetching public agent", { handle: e.handle });
|
|
2614
2598
|
const o = await n.getPublicAgent({ handle: e.handle });
|
|
2615
|
-
o ? (r.value = new
|
|
2599
|
+
o ? (r.value = new kt({ config: o }), t.debug("Successfully fetched public agent", {
|
|
2616
2600
|
agentId: o.agentId,
|
|
2617
2601
|
handle: o.handle
|
|
2618
2602
|
}), o.agentId && n.track({
|
|
@@ -2662,9 +2646,9 @@ const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
|
2662
2646
|
}
|
|
2663
2647
|
});
|
|
2664
2648
|
}
|
|
2665
|
-
}), (o, c) => (
|
|
2666
|
-
s.value ? (
|
|
2667
|
-
|
|
2649
|
+
}), (o, c) => (A(), E("div", ki, [
|
|
2650
|
+
s.value ? (A(), E("div", wi, [...c[0] || (c[0] = [
|
|
2651
|
+
T("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2668
2652
|
])])) : r.value ? Yn(o.$slots, "default", {
|
|
2669
2653
|
key: 1,
|
|
2670
2654
|
sdk: Vt(n),
|
|
@@ -2674,7 +2658,7 @@ const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
|
2674
2658
|
buttonText: l.buttonText,
|
|
2675
2659
|
buttonIcon: l.buttonIcon,
|
|
2676
2660
|
loading: s.value
|
|
2677
|
-
}) :
|
|
2661
|
+
}) : G("", !0)
|
|
2678
2662
|
]));
|
|
2679
2663
|
}
|
|
2680
2664
|
});
|