@pagelines/sdk 1.0.505 → 1.0.507
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js +1213 -1142
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/agent/ui/ChatRichText.vue.d.ts +14 -0
- package/dist/agent/ui/ChatScroller.vue.d.ts +26 -0
- package/dist/agent/ui/ElAgentChat.vue.d.ts +49 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/sdkClient.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
var Mn = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var I = (a, t, e) =>
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { SettingsObject as
|
|
7
|
-
import { P as
|
|
8
|
-
const
|
|
2
|
+
var Cs = (a, t, e) => t in a ? Mn(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var p = (a, t) => Mn(a, "name", { value: t, configurable: !0 });
|
|
4
|
+
var I = (a, t, e) => Cs(a, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { defineComponent as ke, openBlock as y, createElementBlock as T, createElementVNode as v, normalizeClass as E, ref as Z, watch as qe, computed as $, createCommentVNode as B, renderSlot as en, onMounted as St, Fragment as Te, renderList as at, withDirectives as ns, vModelText as ss, unref as Xt, toDisplayString as re, shallowRef as rs, onBeforeUnmount as is, nextTick as Is, createVNode as Je, withCtx as Ds, createTextVNode as et, withModifiers as Ms } from "vue";
|
|
6
|
+
import { SettingsObject as Ls, Agent as wt, getDefaultAvatarUrl as as, createLogger as Os } from "@pagelines/core";
|
|
7
|
+
import { P as zs } from "./sdkClient.js";
|
|
8
|
+
const Ps = { class: "spinner max-w-sm" }, Ns = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
}, Ln = /* @__PURE__ */
|
|
11
|
+
}, Ln = /* @__PURE__ */ ke({
|
|
12
12
|
__name: "FSpinner",
|
|
13
13
|
props: {
|
|
14
14
|
width: { type: String, default: "" },
|
|
15
15
|
colorMode: { type: String, default: "primary" }
|
|
16
16
|
},
|
|
17
17
|
setup(a) {
|
|
18
|
-
return (t, e) => (
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
class:
|
|
18
|
+
return (t, e) => (y(), T("div", Ps, [
|
|
19
|
+
(y(), T("svg", Ns, [
|
|
20
|
+
v("circle", {
|
|
21
|
+
class: E([a.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
24
24
|
r: "20",
|
|
@@ -30,10 +30,10 @@ const Os = { class: "spinner max-w-sm" }, zs = {
|
|
|
30
30
|
]))
|
|
31
31
|
]));
|
|
32
32
|
}
|
|
33
|
-
}),
|
|
33
|
+
}), $s = [
|
|
34
34
|
{ pattern: /\bNO_REP\w*\b/g, label: "NO_REPLY — bot chose not to respond" },
|
|
35
35
|
{ pattern: /\bHEARTBEAT_OK\b/g, label: "HEARTBEAT_OK — scheduled check, nothing to do" }
|
|
36
|
-
],
|
|
36
|
+
], Us = 9e4, ls = /* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP"]), Bs = /* @__PURE__ */ new Set([...ls, "EMPTY_STREAM", "RATE_LIMIT"]), hn = class hn extends Ls {
|
|
37
37
|
constructor(e) {
|
|
38
38
|
super("AgentChatController", e);
|
|
39
39
|
I(this, "isTextMode", !1);
|
|
@@ -41,16 +41,16 @@ const Os = { class: "spinner max-w-sm" }, zs = {
|
|
|
41
41
|
I(this, "isConnecting", !1);
|
|
42
42
|
// Chat conversation tracking (server-managed persistence)
|
|
43
43
|
I(this, "conversationId");
|
|
44
|
-
I(this, "textState",
|
|
44
|
+
I(this, "textState", Z({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
I(this, "agentMode",
|
|
51
|
-
I(this, "sharedMessages",
|
|
50
|
+
I(this, "agentMode", Z("self"));
|
|
51
|
+
I(this, "sharedMessages", Z([]));
|
|
52
52
|
I(this, "_agent");
|
|
53
|
-
this._agent = e.agent instanceof
|
|
53
|
+
this._agent = e.agent instanceof wt ? e.agent : new wt({ config: e.agent }), this.setupModeWatcher(), this.setupAvailabilityWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
56
56
|
return this._agent.chatAvailable.value;
|
|
@@ -72,8 +72,8 @@ const Os = { class: "spinner max-w-sm" }, zs = {
|
|
|
72
72
|
return e.includes("timed out") || e.includes("starting up") || e.includes("503") || e.includes("429") || e.includes("[no-reply]") || e.includes("[stream-open]") || e.includes("[stream-read]") || e.includes("[api]");
|
|
73
73
|
}
|
|
74
74
|
isDuplicateMessage(e, n) {
|
|
75
|
-
const r = `${n}:${e.toLowerCase().trim()}`, s = Date.now(),
|
|
76
|
-
return
|
|
75
|
+
const r = `${n}:${e.toLowerCase().trim()}`, s = Date.now(), l = r === this.lastMessage.hash && s - this.lastMessage.time < 500;
|
|
76
|
+
return l || (this.lastMessage = { hash: r, time: s }), l;
|
|
77
77
|
}
|
|
78
78
|
addMessage(e, n, r, s) {
|
|
79
79
|
this.isDuplicateMessage(e, n) || (this.sharedMessages.value = [
|
|
@@ -96,7 +96,7 @@ const Os = { class: "spinner max-w-sm" }, zs = {
|
|
|
96
96
|
getDynamicSettings() {
|
|
97
97
|
const { sdk: e } = this.settings;
|
|
98
98
|
if (!e) return { context: this.settings.context || "", firstMessage: this.settings.firstMessage || "" };
|
|
99
|
-
const n = e.activeUser.value, r = n?.agents?.find((
|
|
99
|
+
const n = e.activeUser.value, r = n?.agents?.find((l) => l.agentId === n.primaryAgentId), s = n ? `
|
|
100
100
|
|
|
101
101
|
Current User:
|
|
102
102
|
- Name: ${r?.name || "Anonymous"}
|
|
@@ -122,12 +122,12 @@ Current User:
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
setupModeWatcher() {
|
|
125
|
-
|
|
125
|
+
qe(this.agentMode, async (e, n) => {
|
|
126
126
|
this.logger.info(`Mode changed from ${n} to ${e}`), this.isTextMode && (n === "talk" || n === "chat") && await this.endConversation();
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
setupAvailabilityWatcher() {
|
|
130
|
-
|
|
130
|
+
qe(() => this._agent.chatAvailable.value, (e) => {
|
|
131
131
|
if (!(!this.isTextMode || this.isConnecting)) {
|
|
132
132
|
if (e) {
|
|
133
133
|
this.textState.value.isConnected || this.updateState(this.textState, {
|
|
@@ -225,77 +225,77 @@ Current User:
|
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
228
|
-
const
|
|
229
|
-
let
|
|
230
|
-
const
|
|
231
|
-
|
|
228
|
+
const l = `stream-${Date.now()}`;
|
|
229
|
+
let o = !1;
|
|
230
|
+
const d = /* @__PURE__ */ p((m) => {
|
|
231
|
+
o || (o = !0, this.sharedMessages.value = [
|
|
232
232
|
...this.sharedMessages.value,
|
|
233
|
-
{ id:
|
|
233
|
+
{ id: l, text: "", sender: "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
234
234
|
]);
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
}, "onDelta"), c = /* @__PURE__ */
|
|
238
|
-
if (!
|
|
235
|
+
const f = this.sharedMessages.value, w = f[f.length - 1];
|
|
236
|
+
w?.id === l && (w.text += m, this.sharedMessages.value = [...f]);
|
|
237
|
+
}, "onDelta"), c = /* @__PURE__ */ p((m) => {
|
|
238
|
+
if (!o) {
|
|
239
239
|
b("empty_stream — assistant returned no content");
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
let
|
|
245
|
-
for (const O of
|
|
246
|
-
O.pattern.test(
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
}, "onDone"), b = /* @__PURE__ */
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
const { bucket:
|
|
254
|
-
if (
|
|
255
|
-
const ae =
|
|
256
|
-
code:
|
|
242
|
+
const f = this.sharedMessages.value, w = f[f.length - 1];
|
|
243
|
+
if (w?.id === l && w.text) {
|
|
244
|
+
let _ = w.text;
|
|
245
|
+
for (const O of $s)
|
|
246
|
+
O.pattern.test(_) && (console.debug(`[chat] filtered directive: ${O.label}`), _ = _.replace(O.pattern, "").trim(), O.pattern.lastIndex = 0);
|
|
247
|
+
_ ? _ !== w.text && (w.text = _, this.sharedMessages.value = [...f]) : this.sharedMessages.value = f.slice(0, -1);
|
|
248
|
+
}
|
|
249
|
+
m && (this.conversationId = m), this.updateState(this.textState, { isThinking: !1 });
|
|
250
|
+
}, "onDone"), b = /* @__PURE__ */ p((m) => {
|
|
251
|
+
const f = this.sharedMessages.value, w = f[f.length - 1];
|
|
252
|
+
if (w?.id === l && !w.text && (this.sharedMessages.value = f.slice(0, -1)), typeof m == "object" && m.code && m.error) {
|
|
253
|
+
const { bucket: ie, actionUrl: be, actionLabel: G, help: P } = m;
|
|
254
|
+
if (ie !== void 0 || Bs.has(m.code)) {
|
|
255
|
+
const ae = ie ?? (ls.has(m.code) ? "account" : "error"), Q = {
|
|
256
|
+
code: m.code,
|
|
257
257
|
bucket: ae,
|
|
258
|
-
...
|
|
259
|
-
...
|
|
260
|
-
...
|
|
258
|
+
...G ? { actionLabel: G } : {},
|
|
259
|
+
...be ? { actionUrl: be } : {},
|
|
260
|
+
...P ? { help: P } : {}
|
|
261
261
|
};
|
|
262
|
-
this.addMessage(
|
|
262
|
+
this.addMessage(m.error, "system", void 0, Q), ae === "account" ? this.updateState(this.textState, { isThinking: !1, accountGated: !0 }) : this.updateState(this.textState, { isThinking: !1 });
|
|
263
263
|
} else
|
|
264
|
-
this.handleError(new Error(
|
|
264
|
+
this.handleError(new Error(m.error));
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
this.isTransientError(
|
|
269
|
-
}, "onError"),
|
|
270
|
-
this.addMessage(
|
|
267
|
+
const _ = typeof m == "string" ? m : m.error, O = this.mapChatError(_);
|
|
268
|
+
this.isTransientError(_) ? (this.logger.warn("Chat turn failed (transient):", { raw: _, friendly: O }), this.addMessage(O, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(O), _);
|
|
269
|
+
}, "onError"), u = /* @__PURE__ */ p((m) => {
|
|
270
|
+
this.addMessage(m, "system");
|
|
271
271
|
}, "onStatus");
|
|
272
272
|
try {
|
|
273
|
-
const
|
|
273
|
+
const m = r ? r({
|
|
274
274
|
message: e,
|
|
275
275
|
attachments: n,
|
|
276
276
|
conversationId: this.conversationId,
|
|
277
277
|
history: this.buildHistory(),
|
|
278
|
-
onDelta:
|
|
278
|
+
onDelta: d,
|
|
279
279
|
onDone: c,
|
|
280
280
|
onError: b,
|
|
281
|
-
onStatus:
|
|
281
|
+
onStatus: u
|
|
282
282
|
}) : s.chat.chatStreamPublic({
|
|
283
283
|
handle: this._agent.handle.value,
|
|
284
284
|
message: e,
|
|
285
285
|
attachments: n,
|
|
286
286
|
anonymousId: s.user.generateAnonId(),
|
|
287
287
|
context: this.getDynamicSettings().context || void 0,
|
|
288
|
-
onDelta:
|
|
288
|
+
onDelta: d,
|
|
289
289
|
onDone: c,
|
|
290
290
|
onError: b,
|
|
291
|
-
onStatus:
|
|
291
|
+
onStatus: u
|
|
292
292
|
});
|
|
293
293
|
await Promise.race([
|
|
294
|
-
|
|
295
|
-
new Promise((
|
|
294
|
+
m,
|
|
295
|
+
new Promise((f, w) => setTimeout(() => w(new Error("timed out")), Us))
|
|
296
296
|
]);
|
|
297
|
-
} catch (
|
|
298
|
-
b(
|
|
297
|
+
} catch (m) {
|
|
298
|
+
b(m.message || "Something went wrong");
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
buildHistory() {
|
|
@@ -319,30 +319,30 @@ Current User:
|
|
|
319
319
|
await this.endConversation();
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
|
|
323
|
-
let On =
|
|
322
|
+
p(hn, "AgentChatController");
|
|
323
|
+
let On = hn;
|
|
324
324
|
function zn(a) {
|
|
325
325
|
return a ? typeof a == "string" ? a : a.src || "" : "";
|
|
326
326
|
}
|
|
327
|
-
|
|
328
|
-
function
|
|
329
|
-
return zn(a.cover) || zn(a.avatar) ||
|
|
327
|
+
p(zn, "getImageSrc");
|
|
328
|
+
function Ki(a) {
|
|
329
|
+
return zn(a.cover) || zn(a.avatar) || as(a.name);
|
|
330
330
|
}
|
|
331
|
-
|
|
331
|
+
p(Ki, "getAgentAvatarUrl");
|
|
332
332
|
function Pn(a) {
|
|
333
333
|
const t = a.target;
|
|
334
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
334
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = as());
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
function
|
|
336
|
+
p(Pn, "handleImageError");
|
|
337
|
+
function Qi(a) {
|
|
338
338
|
const { template: t, agent: e } = a;
|
|
339
339
|
return t.replace(/{name}/g, e.name || "Assistant").replace(/{title}/g, e.title || "").replace(/{handle}/g, e.handle || "").replace(/{orgName}/g, e.org?.name || "");
|
|
340
340
|
}
|
|
341
|
-
|
|
342
|
-
const
|
|
341
|
+
p(Qi, "parseButtonTemplate");
|
|
342
|
+
const Fs = {
|
|
343
343
|
key: 0,
|
|
344
344
|
class: "absolute inset-0 flex items-center justify-center"
|
|
345
|
-
},
|
|
345
|
+
}, Ji = /* @__PURE__ */ ke({
|
|
346
346
|
__name: "ElAgentButton",
|
|
347
347
|
props: {
|
|
348
348
|
theme: { default: "primary" },
|
|
@@ -352,42 +352,42 @@ const Us = {
|
|
|
352
352
|
iconAfter: {}
|
|
353
353
|
},
|
|
354
354
|
setup(a) {
|
|
355
|
-
const t =
|
|
355
|
+
const t = $(() => ({
|
|
356
356
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
357
357
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
358
358
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
359
359
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"
|
|
360
|
-
})[a.theme]), e =
|
|
360
|
+
})[a.theme]), e = $(() => ({
|
|
361
361
|
sm: "px-4 py-2 text-sm",
|
|
362
362
|
md: "px-6 py-3 text-base",
|
|
363
363
|
lg: "px-8 py-4 text-base"
|
|
364
|
-
})[a.size]), n =
|
|
364
|
+
})[a.size]), n = $(() => ({
|
|
365
365
|
sm: "size-4",
|
|
366
366
|
md: "size-4",
|
|
367
367
|
lg: "size-5"
|
|
368
368
|
})[a.size]);
|
|
369
|
-
return (r, s) => (
|
|
370
|
-
class:
|
|
369
|
+
return (r, s) => (y(), T("button", {
|
|
370
|
+
class: E(["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]])
|
|
371
371
|
}, [
|
|
372
|
-
a.loading ? (
|
|
373
|
-
|
|
374
|
-
])])) :
|
|
375
|
-
|
|
376
|
-
class:
|
|
372
|
+
a.loading ? (y(), T("div", Fs, [...s[0] || (s[0] = [
|
|
373
|
+
v("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
374
|
+
])])) : B("", !0),
|
|
375
|
+
v("span", {
|
|
376
|
+
class: E(["flex items-center gap-2 transition-opacity duration-200", a.loading ? "opacity-0" : "opacity-100"])
|
|
377
377
|
}, [
|
|
378
|
-
a.icon ? (
|
|
378
|
+
a.icon ? (y(), T("i", {
|
|
379
379
|
key: 0,
|
|
380
|
-
class:
|
|
381
|
-
}, null, 2)) :
|
|
382
|
-
|
|
383
|
-
a.iconAfter ? (
|
|
380
|
+
class: E([a.icon, n.value])
|
|
381
|
+
}, null, 2)) : B("", !0),
|
|
382
|
+
en(r.$slots, "default"),
|
|
383
|
+
a.iconAfter ? (y(), T("i", {
|
|
384
384
|
key: 1,
|
|
385
|
-
class:
|
|
386
|
-
}, null, 2)) :
|
|
385
|
+
class: E([a.iconAfter, n.value])
|
|
386
|
+
}, null, 2)) : B("", !0)
|
|
387
387
|
], 2)
|
|
388
388
|
], 2));
|
|
389
389
|
}
|
|
390
|
-
}),
|
|
390
|
+
}), Hs = ["value"], ea = /* @__PURE__ */ ke({
|
|
391
391
|
__name: "AgentInputEmail",
|
|
392
392
|
props: {
|
|
393
393
|
modelValue: { default: "" }
|
|
@@ -395,7 +395,7 @@ const Us = {
|
|
|
395
395
|
emits: ["update:modelValue"],
|
|
396
396
|
setup(a, { emit: t }) {
|
|
397
397
|
const e = t;
|
|
398
|
-
return (n, r) => (
|
|
398
|
+
return (n, r) => (y(), T("input", {
|
|
399
399
|
type: "email",
|
|
400
400
|
autocomplete: "email",
|
|
401
401
|
placeholder: "Enter your email",
|
|
@@ -403,9 +403,9 @@ const Us = {
|
|
|
403
403
|
class: "w-full px-6 py-3 text-theme-900 placeholder-theme-500 bg-white border border-white rounded-full focus:outline-none transition-all",
|
|
404
404
|
style: { "font-size": "16px" },
|
|
405
405
|
onInput: r[0] || (r[0] = (s) => e("update:modelValue", s.target.value))
|
|
406
|
-
}, null, 40,
|
|
406
|
+
}, null, 40, Hs));
|
|
407
407
|
}
|
|
408
|
-
}),
|
|
408
|
+
}), Gs = { class: "flex gap-1.5 justify-center" }, js = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], ta = /* @__PURE__ */ ke({
|
|
409
409
|
__name: "AgentInputOneTimeCode",
|
|
410
410
|
props: {
|
|
411
411
|
modelValue: {},
|
|
@@ -414,73 +414,73 @@ const Us = {
|
|
|
414
414
|
},
|
|
415
415
|
emits: ["update:modelValue", "autoSubmit"],
|
|
416
416
|
setup(a, { emit: t }) {
|
|
417
|
-
const e = a, n = t, r =
|
|
418
|
-
|
|
417
|
+
const e = a, n = t, r = Z([]), s = Z(Array.from({ length: e.length }).fill("")), l = Z(!1);
|
|
418
|
+
St(() => {
|
|
419
419
|
e.modelValue && (s.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && r.value[0]?.focus();
|
|
420
|
-
}),
|
|
421
|
-
s.value =
|
|
422
|
-
}),
|
|
423
|
-
const
|
|
424
|
-
n("update:modelValue",
|
|
420
|
+
}), qe(() => e.modelValue, (u) => {
|
|
421
|
+
s.value = u ? u.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
422
|
+
}), qe(s, () => {
|
|
423
|
+
const u = s.value.filter(Boolean).join("");
|
|
424
|
+
n("update:modelValue", u), u.length === e.length && n("autoSubmit", u);
|
|
425
425
|
}, { deep: !0 });
|
|
426
|
-
function
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
s.value =
|
|
431
|
-
r.value[e.length - 1]?.focus(),
|
|
426
|
+
function o(u, m) {
|
|
427
|
+
m.preventDefault(), l.value = !0;
|
|
428
|
+
const f = (m.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
429
|
+
if (f.length === e.length)
|
|
430
|
+
s.value = f.split(""), setTimeout(() => {
|
|
431
|
+
r.value[e.length - 1]?.focus(), l.value = !1;
|
|
432
432
|
}, 10);
|
|
433
433
|
else {
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}), s.value =
|
|
438
|
-
const
|
|
434
|
+
const w = [...s.value];
|
|
435
|
+
f.split("").slice(0, e.length - u).forEach((O, ie) => {
|
|
436
|
+
w[u + ie] = O;
|
|
437
|
+
}), s.value = w;
|
|
438
|
+
const _ = Math.min(u + f.length, e.length - 1);
|
|
439
439
|
setTimeout(() => {
|
|
440
|
-
r.value[
|
|
440
|
+
r.value[_]?.focus(), l.value = !1;
|
|
441
441
|
}, 10);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
|
|
445
|
-
function
|
|
446
|
-
const
|
|
447
|
-
s.value[
|
|
444
|
+
p(o, "onPaste");
|
|
445
|
+
function d(u, m) {
|
|
446
|
+
const f = m.target.value.slice(-1).replace(/\D/g, "");
|
|
447
|
+
s.value[u] = f, f && u < e.length - 1 && r.value[u + 1]?.focus();
|
|
448
448
|
}
|
|
449
|
-
|
|
450
|
-
function c(
|
|
451
|
-
|
|
449
|
+
p(d, "onInput");
|
|
450
|
+
function c(u, m) {
|
|
451
|
+
m.key === "Backspace" ? (m.preventDefault(), s.value[u] = "", u > 0 && r.value[u - 1]?.focus()) : m.key === "ArrowLeft" && u > 0 ? r.value[u - 1]?.focus() : m.key === "ArrowRight" && u < e.length - 1 && r.value[u + 1]?.focus();
|
|
452
452
|
}
|
|
453
|
-
|
|
454
|
-
function b(
|
|
455
|
-
if (r.value[
|
|
456
|
-
for (let
|
|
457
|
-
s.value[
|
|
453
|
+
p(c, "onKeydown");
|
|
454
|
+
function b(u) {
|
|
455
|
+
if (r.value[u]?.select(), !l.value && s.value[u])
|
|
456
|
+
for (let m = u; m < e.length; m++)
|
|
457
|
+
s.value[m] = "";
|
|
458
458
|
}
|
|
459
|
-
return
|
|
460
|
-
(
|
|
461
|
-
key:
|
|
459
|
+
return p(b, "onFocus"), (u, m) => (y(), T("div", Gs, [
|
|
460
|
+
(y(!0), T(Te, null, at(a.length, (f) => ns((y(), T("input", {
|
|
461
|
+
key: f,
|
|
462
462
|
ref_for: !0,
|
|
463
|
-
ref: /* @__PURE__ */
|
|
464
|
-
"onUpdate:modelValue": /* @__PURE__ */
|
|
463
|
+
ref: /* @__PURE__ */ p((w) => r.value[f - 1] = w, "ref"),
|
|
464
|
+
"onUpdate:modelValue": /* @__PURE__ */ p((w) => s.value[f - 1] = w, "onUpdate:modelValue"),
|
|
465
465
|
type: "text",
|
|
466
466
|
inputmode: "numeric",
|
|
467
467
|
autocomplete: "one-time-code",
|
|
468
468
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
469
469
|
style: { "font-size": "16px" },
|
|
470
470
|
maxlength: "1",
|
|
471
|
-
onInput: /* @__PURE__ */
|
|
472
|
-
onKeydown: /* @__PURE__ */
|
|
473
|
-
onPaste: /* @__PURE__ */
|
|
474
|
-
onFocus: /* @__PURE__ */
|
|
475
|
-
}, null, 40,
|
|
476
|
-
[
|
|
471
|
+
onInput: /* @__PURE__ */ p((w) => d(f - 1, w), "onInput"),
|
|
472
|
+
onKeydown: /* @__PURE__ */ p((w) => c(f - 1, w), "onKeydown"),
|
|
473
|
+
onPaste: /* @__PURE__ */ p((w) => o(f - 1, w), "onPaste"),
|
|
474
|
+
onFocus: /* @__PURE__ */ p((w) => b(f - 1), "onFocus")
|
|
475
|
+
}, null, 40, js)), [
|
|
476
|
+
[ss, s.value[f - 1]]
|
|
477
477
|
])), 128))
|
|
478
478
|
]));
|
|
479
479
|
}
|
|
480
|
-
}),
|
|
480
|
+
}), Ws = { class: "relative flex-shrink-0" }, qs = ["src", "alt"], Vs = { class: "absolute top-1 right-1" }, Ys = {
|
|
481
481
|
key: 1,
|
|
482
482
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
483
|
-
},
|
|
483
|
+
}, Zs = { class: "min-w-0" }, Xs = /* @__PURE__ */ ke({
|
|
484
484
|
__name: "ElModeHeader",
|
|
485
485
|
props: {
|
|
486
486
|
agent: {},
|
|
@@ -489,136 +489,136 @@ const Us = {
|
|
|
489
489
|
layout: { default: "centered" }
|
|
490
490
|
},
|
|
491
491
|
setup(a) {
|
|
492
|
-
return (t, e) => (
|
|
493
|
-
class:
|
|
492
|
+
return (t, e) => (y(), T("div", {
|
|
493
|
+
class: E(["flex gap-4", [
|
|
494
494
|
a.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
495
495
|
]])
|
|
496
496
|
}, [
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
class:
|
|
497
|
+
v("div", Ws, [
|
|
498
|
+
v("div", {
|
|
499
|
+
class: E(["rounded-full overflow-hidden border-white", a.size === "lg" ? "w-20 h-20 sm:w-24 sm:h-24 border-4" : "w-16 sm:size-16 border-2"])
|
|
500
500
|
}, [
|
|
501
|
-
|
|
501
|
+
v("img", {
|
|
502
502
|
src: a.agent.avatarUrl.value,
|
|
503
503
|
alt: a.agent.displayName.value,
|
|
504
504
|
class: "w-full h-full object-cover",
|
|
505
505
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
506
|
-
(...n) =>
|
|
507
|
-
}, null, 40,
|
|
506
|
+
(...n) => Xt(Pn) && Xt(Pn)(...n))
|
|
507
|
+
}, null, 40, qs)
|
|
508
508
|
], 2),
|
|
509
|
-
|
|
510
|
-
a.isOnline ? (
|
|
511
|
-
e[1] || (e[1] =
|
|
509
|
+
v("div", Vs, [
|
|
510
|
+
a.isOnline ? (y(), T(Te, { key: 0 }, [
|
|
511
|
+
e[1] || (e[1] = v("div", {
|
|
512
512
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
513
513
|
style: { "animation-duration": "3s" }
|
|
514
514
|
}, null, -1)),
|
|
515
|
-
e[2] || (e[2] =
|
|
516
|
-
], 64)) : (
|
|
515
|
+
e[2] || (e[2] = v("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
516
|
+
], 64)) : (y(), T("div", Ys))
|
|
517
517
|
])
|
|
518
518
|
]),
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
class:
|
|
519
|
+
v("div", Zs, [
|
|
520
|
+
v("h1", {
|
|
521
|
+
class: E(["font-light text-white mb-1 truncate", [
|
|
522
522
|
a.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
523
523
|
a.layout === "horizontal" ? "text-white/95" : ""
|
|
524
524
|
]])
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
class:
|
|
525
|
+
}, re(a.agent.displayName.value), 3),
|
|
526
|
+
v("p", {
|
|
527
|
+
class: E(["font-light line-clamp-1", [
|
|
528
528
|
a.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
529
529
|
a.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
530
530
|
]])
|
|
531
|
-
},
|
|
531
|
+
}, re(a.layout === "horizontal" ? a.agent.title.value || "Assistant" : a.agent.title.value), 3)
|
|
532
532
|
])
|
|
533
533
|
], 2));
|
|
534
534
|
}
|
|
535
535
|
});
|
|
536
536
|
const {
|
|
537
|
-
entries:
|
|
537
|
+
entries: os,
|
|
538
538
|
setPrototypeOf: Nn,
|
|
539
|
-
isFrozen:
|
|
540
|
-
getPrototypeOf:
|
|
541
|
-
getOwnPropertyDescriptor:
|
|
539
|
+
isFrozen: Ks,
|
|
540
|
+
getPrototypeOf: Qs,
|
|
541
|
+
getOwnPropertyDescriptor: Js
|
|
542
542
|
} = Object;
|
|
543
543
|
let {
|
|
544
544
|
freeze: te,
|
|
545
545
|
seal: oe,
|
|
546
|
-
create:
|
|
546
|
+
create: Be
|
|
547
547
|
} = Object, {
|
|
548
|
-
apply:
|
|
549
|
-
construct:
|
|
548
|
+
apply: Kt,
|
|
549
|
+
construct: Qt
|
|
550
550
|
} = typeof Reflect < "u" && Reflect;
|
|
551
|
-
te || (te = /* @__PURE__ */
|
|
551
|
+
te || (te = /* @__PURE__ */ p(function(t) {
|
|
552
552
|
return t;
|
|
553
553
|
}, "freeze"));
|
|
554
|
-
oe || (oe = /* @__PURE__ */
|
|
554
|
+
oe || (oe = /* @__PURE__ */ p(function(t) {
|
|
555
555
|
return t;
|
|
556
556
|
}, "seal"));
|
|
557
|
-
|
|
557
|
+
Kt || (Kt = /* @__PURE__ */ p(function(t, e) {
|
|
558
558
|
for (var n = arguments.length, r = new Array(n > 2 ? n - 2 : 0), s = 2; s < n; s++)
|
|
559
559
|
r[s - 2] = arguments[s];
|
|
560
560
|
return t.apply(e, r);
|
|
561
561
|
}, "apply"));
|
|
562
|
-
|
|
562
|
+
Qt || (Qt = /* @__PURE__ */ p(function(t) {
|
|
563
563
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++)
|
|
564
564
|
n[r - 1] = arguments[r];
|
|
565
565
|
return new t(...n);
|
|
566
566
|
}, "construct"));
|
|
567
|
-
const tt =
|
|
568
|
-
function
|
|
567
|
+
const tt = H(Array.prototype.forEach), er = H(Array.prototype.lastIndexOf), $n = H(Array.prototype.pop), nt = H(Array.prototype.push), tr = H(Array.prototype.splice), ee = Array.isArray, lt = H(String.prototype.toLowerCase), Wt = H(String.prototype.toString), Un = H(String.prototype.match), Ue = H(String.prototype.replace), Bn = H(String.prototype.indexOf), nr = H(String.prototype.trim), sr = H(Number.prototype.toString), rr = H(Boolean.prototype.toString), Fn = typeof BigInt > "u" ? null : H(BigInt.prototype.toString), Hn = typeof Symbol > "u" ? null : H(Symbol.prototype.toString), N = H(Object.prototype.hasOwnProperty), st = H(Object.prototype.toString), Y = H(RegExp.prototype.test), bt = ir(TypeError);
|
|
568
|
+
function H(a) {
|
|
569
569
|
return function(t) {
|
|
570
570
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
571
571
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++)
|
|
572
572
|
n[r - 1] = arguments[r];
|
|
573
|
-
return
|
|
573
|
+
return Kt(a, t, n);
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
|
-
|
|
577
|
-
function
|
|
576
|
+
p(H, "unapply");
|
|
577
|
+
function ir(a) {
|
|
578
578
|
return function() {
|
|
579
579
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
580
580
|
e[n] = arguments[n];
|
|
581
|
-
return
|
|
581
|
+
return Qt(a, e);
|
|
582
582
|
};
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
p(ir, "unconstruct");
|
|
585
585
|
function R(a, t) {
|
|
586
586
|
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : lt;
|
|
587
|
-
if (Nn && Nn(a, null), !
|
|
587
|
+
if (Nn && Nn(a, null), !ee(t))
|
|
588
588
|
return a;
|
|
589
589
|
let n = t.length;
|
|
590
590
|
for (; n--; ) {
|
|
591
591
|
let r = t[n];
|
|
592
592
|
if (typeof r == "string") {
|
|
593
593
|
const s = e(r);
|
|
594
|
-
s !== r && (
|
|
594
|
+
s !== r && (Ks(t) || (t[n] = s), r = s);
|
|
595
595
|
}
|
|
596
596
|
a[r] = !0;
|
|
597
597
|
}
|
|
598
598
|
return a;
|
|
599
599
|
}
|
|
600
|
-
|
|
601
|
-
function
|
|
600
|
+
p(R, "addToSet");
|
|
601
|
+
function ar(a) {
|
|
602
602
|
for (let t = 0; t < a.length; t++)
|
|
603
|
-
|
|
603
|
+
N(a, t) || (a[t] = null);
|
|
604
604
|
return a;
|
|
605
605
|
}
|
|
606
|
-
|
|
607
|
-
function
|
|
608
|
-
const t =
|
|
609
|
-
for (const [e, n] of
|
|
610
|
-
|
|
606
|
+
p(ar, "cleanArray");
|
|
607
|
+
function se(a) {
|
|
608
|
+
const t = Be(null);
|
|
609
|
+
for (const [e, n] of os(a))
|
|
610
|
+
N(a, e) && (ee(n) ? t[e] = ar(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = se(n) : t[e] = n);
|
|
611
611
|
return t;
|
|
612
612
|
}
|
|
613
|
-
|
|
614
|
-
function
|
|
613
|
+
p(se, "clone");
|
|
614
|
+
function lr(a) {
|
|
615
615
|
switch (typeof a) {
|
|
616
616
|
case "string":
|
|
617
617
|
return a;
|
|
618
618
|
case "number":
|
|
619
|
-
return
|
|
619
|
+
return sr(a);
|
|
620
620
|
case "boolean":
|
|
621
|
-
return
|
|
621
|
+
return rr(a);
|
|
622
622
|
case "bigint":
|
|
623
623
|
return Fn ? Fn(a) : "0";
|
|
624
624
|
case "symbol":
|
|
@@ -629,7 +629,7 @@ function ir(a) {
|
|
|
629
629
|
case "object": {
|
|
630
630
|
if (a === null)
|
|
631
631
|
return st(a);
|
|
632
|
-
const t = a, e =
|
|
632
|
+
const t = a, e = Fe(t, "toString");
|
|
633
633
|
if (typeof e == "function") {
|
|
634
634
|
const n = e(t);
|
|
635
635
|
return typeof n == "string" ? n : st(n);
|
|
@@ -640,51 +640,51 @@ function ir(a) {
|
|
|
640
640
|
return st(a);
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
|
|
644
|
-
function
|
|
643
|
+
p(lr, "stringifyValue");
|
|
644
|
+
function Fe(a, t) {
|
|
645
645
|
for (; a !== null; ) {
|
|
646
|
-
const n =
|
|
646
|
+
const n = Js(a, t);
|
|
647
647
|
if (n) {
|
|
648
648
|
if (n.get)
|
|
649
|
-
return
|
|
649
|
+
return H(n.get);
|
|
650
650
|
if (typeof n.value == "function")
|
|
651
|
-
return
|
|
651
|
+
return H(n.value);
|
|
652
652
|
}
|
|
653
|
-
a =
|
|
653
|
+
a = Qs(a);
|
|
654
654
|
}
|
|
655
655
|
function e() {
|
|
656
656
|
return null;
|
|
657
657
|
}
|
|
658
|
-
return
|
|
658
|
+
return p(e, "fallbackValue"), e;
|
|
659
659
|
}
|
|
660
|
-
|
|
661
|
-
function
|
|
660
|
+
p(Fe, "lookupGetter");
|
|
661
|
+
function or(a) {
|
|
662
662
|
try {
|
|
663
|
-
return
|
|
663
|
+
return Y(a, ""), !0;
|
|
664
664
|
} catch {
|
|
665
665
|
return !1;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
|
|
669
|
-
const Gn = te(["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"]),
|
|
668
|
+
p(or, "isRegex");
|
|
669
|
+
const Gn = te(["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"]), qt = te(["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"]), Vt = te(["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"]), cr = te(["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"]), Yt = te(["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"]), ur = te(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), jn = te(["#text"]), Wn = te(["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"]), Zt = te(["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"]), qn = te(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "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"]), xt = te(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), hr = oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm), pr = oe(/<%[\w\W]*|[\w\W]*%>/gm), dr = oe(/\$\{[\w\W]*/gm), fr = oe(/^data-[\-\w.\u00B7-\uFFFF]+$/), gr = oe(/^aria-[\-\w]+$/), cs = oe(
|
|
670
670
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
671
671
|
// eslint-disable-line no-useless-escape
|
|
672
|
-
),
|
|
672
|
+
), mr = oe(/^(?:\w+script|data):/i), br = oe(
|
|
673
673
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
674
674
|
// eslint-disable-line no-control-regex
|
|
675
|
-
),
|
|
675
|
+
), us = oe(/^html$/i), xr = oe(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
676
676
|
var Vn = /* @__PURE__ */ Object.freeze({
|
|
677
677
|
__proto__: null,
|
|
678
|
-
ARIA_ATTR:
|
|
679
|
-
ATTR_WHITESPACE:
|
|
680
|
-
CUSTOM_ELEMENT:
|
|
681
|
-
DATA_ATTR:
|
|
682
|
-
DOCTYPE_NAME:
|
|
683
|
-
ERB_EXPR:
|
|
684
|
-
IS_ALLOWED_URI:
|
|
685
|
-
IS_SCRIPT_OR_DATA:
|
|
686
|
-
MUSTACHE_EXPR:
|
|
687
|
-
TMPLIT_EXPR:
|
|
678
|
+
ARIA_ATTR: gr,
|
|
679
|
+
ATTR_WHITESPACE: br,
|
|
680
|
+
CUSTOM_ELEMENT: xr,
|
|
681
|
+
DATA_ATTR: fr,
|
|
682
|
+
DOCTYPE_NAME: us,
|
|
683
|
+
ERB_EXPR: pr,
|
|
684
|
+
IS_ALLOWED_URI: cs,
|
|
685
|
+
IS_SCRIPT_OR_DATA: mr,
|
|
686
|
+
MUSTACHE_EXPR: hr,
|
|
687
|
+
TMPLIT_EXPR: dr
|
|
688
688
|
});
|
|
689
689
|
const rt = {
|
|
690
690
|
element: 1,
|
|
@@ -693,9 +693,9 @@ const rt = {
|
|
|
693
693
|
progressingInstruction: 7,
|
|
694
694
|
comment: 8,
|
|
695
695
|
document: 9
|
|
696
|
-
},
|
|
696
|
+
}, kr = /* @__PURE__ */ p(function() {
|
|
697
697
|
return typeof window > "u" ? null : window;
|
|
698
|
-
}, "getGlobal"),
|
|
698
|
+
}, "getGlobal"), wr = /* @__PURE__ */ p(function(t, e) {
|
|
699
699
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
700
700
|
return null;
|
|
701
701
|
let n = null;
|
|
@@ -704,17 +704,17 @@ const rt = {
|
|
|
704
704
|
const s = "dompurify" + (n ? "#" + n : "");
|
|
705
705
|
try {
|
|
706
706
|
return t.createPolicy(s, {
|
|
707
|
-
createHTML(
|
|
708
|
-
return
|
|
707
|
+
createHTML(l) {
|
|
708
|
+
return l;
|
|
709
709
|
},
|
|
710
|
-
createScriptURL(
|
|
711
|
-
return
|
|
710
|
+
createScriptURL(l) {
|
|
711
|
+
return l;
|
|
712
712
|
}
|
|
713
713
|
});
|
|
714
714
|
} catch {
|
|
715
715
|
return console.warn("TrustedTypes policy " + s + " could not be created."), null;
|
|
716
716
|
}
|
|
717
|
-
}, "_createTrustedTypesPolicy"), Yn = /* @__PURE__ */
|
|
717
|
+
}, "_createTrustedTypesPolicy"), Yn = /* @__PURE__ */ p(function() {
|
|
718
718
|
return {
|
|
719
719
|
afterSanitizeAttributes: [],
|
|
720
720
|
afterSanitizeElements: [],
|
|
@@ -727,9 +727,9 @@ const rt = {
|
|
|
727
727
|
uponSanitizeShadowNode: []
|
|
728
728
|
};
|
|
729
729
|
}, "_createHooksMap");
|
|
730
|
-
function
|
|
731
|
-
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
732
|
-
const t = /* @__PURE__ */
|
|
730
|
+
function hs() {
|
|
731
|
+
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : kr();
|
|
732
|
+
const t = /* @__PURE__ */ p((S) => hs(S), "DOMPurify");
|
|
733
733
|
if (t.version = "3.4.1", t.removed = [], !a || !a.document || a.document.nodeType !== rt.document || !a.Element)
|
|
734
734
|
return t.isSupported = !1, t;
|
|
735
735
|
let {
|
|
@@ -737,20 +737,20 @@ function us() {
|
|
|
737
737
|
} = a;
|
|
738
738
|
const n = e, r = n.currentScript, {
|
|
739
739
|
DocumentFragment: s,
|
|
740
|
-
HTMLTemplateElement:
|
|
741
|
-
Node:
|
|
742
|
-
Element:
|
|
740
|
+
HTMLTemplateElement: l,
|
|
741
|
+
Node: o,
|
|
742
|
+
Element: d,
|
|
743
743
|
NodeFilter: c,
|
|
744
744
|
NamedNodeMap: b = a.NamedNodeMap || a.MozNamedAttrMap,
|
|
745
|
-
HTMLFormElement:
|
|
746
|
-
DOMParser:
|
|
747
|
-
trustedTypes:
|
|
748
|
-
} = a,
|
|
749
|
-
if (typeof
|
|
750
|
-
const
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
let
|
|
745
|
+
HTMLFormElement: u,
|
|
746
|
+
DOMParser: m,
|
|
747
|
+
trustedTypes: f
|
|
748
|
+
} = a, w = d.prototype, _ = Fe(w, "cloneNode"), O = Fe(w, "remove"), ie = Fe(w, "nextSibling"), be = Fe(w, "childNodes"), G = Fe(w, "parentNode");
|
|
749
|
+
if (typeof l == "function") {
|
|
750
|
+
const S = e.createElement("template");
|
|
751
|
+
S.content && S.content.ownerDocument && (e = S.content.ownerDocument);
|
|
752
|
+
}
|
|
753
|
+
let P, de = "";
|
|
754
754
|
const {
|
|
755
755
|
implementation: ae,
|
|
756
756
|
createNodeIterator: Q,
|
|
@@ -760,24 +760,24 @@ function us() {
|
|
|
760
760
|
importNode: C
|
|
761
761
|
} = n;
|
|
762
762
|
let q = Yn();
|
|
763
|
-
t.isSupported = typeof
|
|
763
|
+
t.isSupported = typeof os == "function" && typeof G == "function" && ae && ae.createHTMLDocument !== void 0;
|
|
764
764
|
const {
|
|
765
765
|
MUSTACHE_EXPR: we,
|
|
766
766
|
ERB_EXPR: Oe,
|
|
767
|
-
TMPLIT_EXPR:
|
|
767
|
+
TMPLIT_EXPR: ve,
|
|
768
768
|
DATA_ATTR: Rt,
|
|
769
769
|
ARIA_ATTR: Ct,
|
|
770
|
-
IS_SCRIPT_OR_DATA:
|
|
771
|
-
ATTR_WHITESPACE:
|
|
772
|
-
CUSTOM_ELEMENT:
|
|
770
|
+
IS_SCRIPT_OR_DATA: It,
|
|
771
|
+
ATTR_WHITESPACE: ht,
|
|
772
|
+
CUSTOM_ELEMENT: Dt
|
|
773
773
|
} = Vn;
|
|
774
774
|
let {
|
|
775
|
-
IS_ALLOWED_URI:
|
|
776
|
-
} = Vn,
|
|
777
|
-
const
|
|
778
|
-
let
|
|
779
|
-
const
|
|
780
|
-
let
|
|
775
|
+
IS_ALLOWED_URI: pt
|
|
776
|
+
} = Vn, U = null;
|
|
777
|
+
const Ye = R({}, [...Gn, ...qt, ...Vt, ...Yt, ...jn]);
|
|
778
|
+
let A = null;
|
|
779
|
+
const k = R({}, [...Wn, ...Zt, ...qn, ...xt]);
|
|
780
|
+
let g = Object.seal(Be(null, {
|
|
781
781
|
tagNameCheck: {
|
|
782
782
|
writable: !0,
|
|
783
783
|
configurable: !1,
|
|
@@ -796,8 +796,8 @@ function us() {
|
|
|
796
796
|
enumerable: !0,
|
|
797
797
|
value: !1
|
|
798
798
|
}
|
|
799
|
-
})),
|
|
800
|
-
const
|
|
799
|
+
})), M = null, j = null;
|
|
800
|
+
const J = Object.seal(Be(null, {
|
|
801
801
|
tagCheck: {
|
|
802
802
|
writable: !0,
|
|
803
803
|
configurable: !1,
|
|
@@ -811,104 +811,104 @@ function us() {
|
|
|
811
811
|
value: null
|
|
812
812
|
}
|
|
813
813
|
}));
|
|
814
|
-
let
|
|
814
|
+
let Ze = !0, _e = !0, pn = !1, dn = !0, Re = !1, Xe = !0, Ce = !1, Mt = !1, Lt = !1, ze = !1, dt = !1, ft = !1, fn = !0, gn = !1;
|
|
815
815
|
const mn = "user-content-";
|
|
816
|
-
let
|
|
817
|
-
const
|
|
816
|
+
let Ot = !0, Ke = !1, Pe = {}, fe = null;
|
|
817
|
+
const zt = 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"]);
|
|
818
818
|
let bn = null;
|
|
819
819
|
const xn = R({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
820
|
-
let
|
|
821
|
-
const kn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
|
|
822
|
-
let
|
|
823
|
-
const ys = R({}, [
|
|
824
|
-
let
|
|
825
|
-
const
|
|
826
|
-
let
|
|
827
|
-
const
|
|
828
|
-
let
|
|
829
|
-
const
|
|
820
|
+
let Pt = null;
|
|
821
|
+
const kn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), gt = "http://www.w3.org/1998/Math/MathML", mt = "http://www.w3.org/2000/svg", ge = "http://www.w3.org/1999/xhtml";
|
|
822
|
+
let Ne = ge, Nt = !1, $t = null;
|
|
823
|
+
const ys = R({}, [gt, mt, ge], Wt);
|
|
824
|
+
let Ut = R({}, ["mi", "mo", "mn", "ms", "mtext"]), Bt = R({}, ["annotation-xml"]);
|
|
825
|
+
const Ts = R({}, ["title", "style", "font", "a", "script"]);
|
|
826
|
+
let Qe = null;
|
|
827
|
+
const Ss = ["application/xhtml+xml", "text/html"], As = "text/html";
|
|
828
|
+
let W = null, $e = null;
|
|
829
|
+
const Es = e.createElement("form"), wn = /* @__PURE__ */ p(function(i) {
|
|
830
830
|
return i instanceof RegExp || i instanceof Function;
|
|
831
|
-
}, "isRegexOrFunction"),
|
|
831
|
+
}, "isRegexOrFunction"), Ft = /* @__PURE__ */ p(function() {
|
|
832
832
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
833
|
-
if (
|
|
833
|
+
if ($e && $e === i)
|
|
834
834
|
return;
|
|
835
|
-
(!i || typeof i != "object") && (i = {}), i =
|
|
836
|
-
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
835
|
+
(!i || typeof i != "object") && (i = {}), i = se(i), Qe = // eslint-disable-next-line unicorn/prefer-includes
|
|
836
|
+
Ss.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? As : i.PARSER_MEDIA_TYPE, W = Qe === "application/xhtml+xml" ? Wt : lt, U = N(i, "ALLOWED_TAGS") && ee(i.ALLOWED_TAGS) ? R({}, i.ALLOWED_TAGS, W) : Ye, A = N(i, "ALLOWED_ATTR") && ee(i.ALLOWED_ATTR) ? R({}, i.ALLOWED_ATTR, W) : k, $t = N(i, "ALLOWED_NAMESPACES") && ee(i.ALLOWED_NAMESPACES) ? R({}, i.ALLOWED_NAMESPACES, Wt) : ys, Pt = N(i, "ADD_URI_SAFE_ATTR") && ee(i.ADD_URI_SAFE_ATTR) ? R(se(kn), i.ADD_URI_SAFE_ATTR, W) : kn, bn = N(i, "ADD_DATA_URI_TAGS") && ee(i.ADD_DATA_URI_TAGS) ? R(se(xn), i.ADD_DATA_URI_TAGS, W) : xn, fe = N(i, "FORBID_CONTENTS") && ee(i.FORBID_CONTENTS) ? R({}, i.FORBID_CONTENTS, W) : zt, M = N(i, "FORBID_TAGS") && ee(i.FORBID_TAGS) ? R({}, i.FORBID_TAGS, W) : se({}), j = N(i, "FORBID_ATTR") && ee(i.FORBID_ATTR) ? R({}, i.FORBID_ATTR, W) : se({}), Pe = N(i, "USE_PROFILES") ? i.USE_PROFILES && typeof i.USE_PROFILES == "object" ? se(i.USE_PROFILES) : i.USE_PROFILES : !1, Ze = i.ALLOW_ARIA_ATTR !== !1, _e = i.ALLOW_DATA_ATTR !== !1, pn = i.ALLOW_UNKNOWN_PROTOCOLS || !1, dn = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Re = i.SAFE_FOR_TEMPLATES || !1, Xe = i.SAFE_FOR_XML !== !1, Ce = i.WHOLE_DOCUMENT || !1, ze = i.RETURN_DOM || !1, dt = i.RETURN_DOM_FRAGMENT || !1, ft = i.RETURN_TRUSTED_TYPE || !1, Lt = i.FORCE_BODY || !1, fn = i.SANITIZE_DOM !== !1, gn = i.SANITIZE_NAMED_PROPS || !1, Ot = i.KEEP_CONTENT !== !1, Ke = i.IN_PLACE || !1, pt = or(i.ALLOWED_URI_REGEXP) ? i.ALLOWED_URI_REGEXP : cs, Ne = typeof i.NAMESPACE == "string" ? i.NAMESPACE : ge, Ut = N(i, "MATHML_TEXT_INTEGRATION_POINTS") && i.MATHML_TEXT_INTEGRATION_POINTS && typeof i.MATHML_TEXT_INTEGRATION_POINTS == "object" ? se(i.MATHML_TEXT_INTEGRATION_POINTS) : R({}, ["mi", "mo", "mn", "ms", "mtext"]), Bt = N(i, "HTML_INTEGRATION_POINTS") && i.HTML_INTEGRATION_POINTS && typeof i.HTML_INTEGRATION_POINTS == "object" ? se(i.HTML_INTEGRATION_POINTS) : R({}, ["annotation-xml"]);
|
|
837
|
+
const h = N(i, "CUSTOM_ELEMENT_HANDLING") && i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING == "object" ? se(i.CUSTOM_ELEMENT_HANDLING) : Be(null);
|
|
838
|
+
if (g = Be(null), N(h, "tagNameCheck") && wn(h.tagNameCheck) && (g.tagNameCheck = h.tagNameCheck), N(h, "attributeNameCheck") && wn(h.attributeNameCheck) && (g.attributeNameCheck = h.attributeNameCheck), N(h, "allowCustomizedBuiltInElements") && typeof h.allowCustomizedBuiltInElements == "boolean" && (g.allowCustomizedBuiltInElements = h.allowCustomizedBuiltInElements), Re && (_e = !1), dt && (ze = !0), Pe && (U = R({}, jn), A = Be(null), Pe.html === !0 && (R(U, Gn), R(A, Wn)), Pe.svg === !0 && (R(U, qt), R(A, Zt), R(A, xt)), Pe.svgFilters === !0 && (R(U, Vt), R(A, Zt), R(A, xt)), Pe.mathMl === !0 && (R(U, Yt), R(A, qn), R(A, xt))), J.tagCheck = null, J.attributeCheck = null, N(i, "ADD_TAGS") && (typeof i.ADD_TAGS == "function" ? J.tagCheck = i.ADD_TAGS : ee(i.ADD_TAGS) && (U === Ye && (U = se(U)), R(U, i.ADD_TAGS, W))), N(i, "ADD_ATTR") && (typeof i.ADD_ATTR == "function" ? J.attributeCheck = i.ADD_ATTR : ee(i.ADD_ATTR) && (A === k && (A = se(A)), R(A, i.ADD_ATTR, W))), N(i, "ADD_URI_SAFE_ATTR") && ee(i.ADD_URI_SAFE_ATTR) && R(Pt, i.ADD_URI_SAFE_ATTR, W), N(i, "FORBID_CONTENTS") && ee(i.FORBID_CONTENTS) && (fe === zt && (fe = se(fe)), R(fe, i.FORBID_CONTENTS, W)), N(i, "ADD_FORBID_CONTENTS") && ee(i.ADD_FORBID_CONTENTS) && (fe === zt && (fe = se(fe)), R(fe, i.ADD_FORBID_CONTENTS, W)), Ot && (U["#text"] = !0), Ce && R(U, ["html", "head", "body"]), U.table && (R(U, ["tbody"]), delete M.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
839
839
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
840
|
-
throw
|
|
840
|
+
throw bt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
841
841
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
842
|
-
throw
|
|
843
|
-
|
|
842
|
+
throw bt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
843
|
+
P = i.TRUSTED_TYPES_POLICY, de = P.createHTML("");
|
|
844
844
|
} else
|
|
845
|
-
|
|
846
|
-
te && te(i),
|
|
847
|
-
}, "_parseConfig"),
|
|
848
|
-
let
|
|
849
|
-
(!
|
|
850
|
-
namespaceURI:
|
|
845
|
+
P === void 0 && (P = wr(f, r)), P !== null && typeof de == "string" && (de = P.createHTML(""));
|
|
846
|
+
te && te(i), $e = i;
|
|
847
|
+
}, "_parseConfig"), vn = R({}, [...qt, ...Vt, ...cr]), yn = R({}, [...Yt, ...ur]), _s = /* @__PURE__ */ p(function(i) {
|
|
848
|
+
let h = G(i);
|
|
849
|
+
(!h || !h.tagName) && (h = {
|
|
850
|
+
namespaceURI: Ne,
|
|
851
851
|
tagName: "template"
|
|
852
852
|
});
|
|
853
|
-
const
|
|
854
|
-
return
|
|
855
|
-
}, "_checkValidNamespace"),
|
|
853
|
+
const x = lt(i.tagName), z = lt(h.tagName);
|
|
854
|
+
return $t[i.namespaceURI] ? i.namespaceURI === mt ? h.namespaceURI === ge ? x === "svg" : h.namespaceURI === gt ? x === "svg" && (z === "annotation-xml" || Ut[z]) : !!vn[x] : i.namespaceURI === gt ? h.namespaceURI === ge ? x === "math" : h.namespaceURI === mt ? x === "math" && Bt[z] : !!yn[x] : i.namespaceURI === ge ? h.namespaceURI === mt && !Bt[z] || h.namespaceURI === gt && !Ut[z] ? !1 : !yn[x] && (Ts[x] || !vn[x]) : !!(Qe === "application/xhtml+xml" && $t[i.namespaceURI]) : !1;
|
|
855
|
+
}, "_checkValidNamespace"), ce = /* @__PURE__ */ p(function(i) {
|
|
856
856
|
nt(t.removed, {
|
|
857
857
|
element: i
|
|
858
858
|
});
|
|
859
859
|
try {
|
|
860
|
-
|
|
860
|
+
G(i).removeChild(i);
|
|
861
861
|
} catch {
|
|
862
862
|
O(i);
|
|
863
863
|
}
|
|
864
|
-
}, "_forceRemove"),
|
|
864
|
+
}, "_forceRemove"), Ie = /* @__PURE__ */ p(function(i, h) {
|
|
865
865
|
try {
|
|
866
866
|
nt(t.removed, {
|
|
867
|
-
attribute:
|
|
868
|
-
from:
|
|
867
|
+
attribute: h.getAttributeNode(i),
|
|
868
|
+
from: h
|
|
869
869
|
});
|
|
870
870
|
} catch {
|
|
871
871
|
nt(t.removed, {
|
|
872
872
|
attribute: null,
|
|
873
|
-
from:
|
|
873
|
+
from: h
|
|
874
874
|
});
|
|
875
875
|
}
|
|
876
|
-
if (
|
|
877
|
-
if (
|
|
876
|
+
if (h.removeAttribute(i), i === "is")
|
|
877
|
+
if (ze || dt)
|
|
878
878
|
try {
|
|
879
|
-
|
|
879
|
+
ce(h);
|
|
880
880
|
} catch {
|
|
881
881
|
}
|
|
882
882
|
else
|
|
883
883
|
try {
|
|
884
|
-
|
|
884
|
+
h.setAttribute(i, "");
|
|
885
885
|
} catch {
|
|
886
886
|
}
|
|
887
|
-
}, "_removeAttribute"), Tn = /* @__PURE__ */
|
|
888
|
-
let
|
|
889
|
-
if (
|
|
887
|
+
}, "_removeAttribute"), Tn = /* @__PURE__ */ p(function(i) {
|
|
888
|
+
let h = null, x = null;
|
|
889
|
+
if (Lt)
|
|
890
890
|
i = "<remove></remove>" + i;
|
|
891
891
|
else {
|
|
892
|
-
const
|
|
893
|
-
|
|
892
|
+
const F = Un(i, /^[\r\n\t ]+/);
|
|
893
|
+
x = F && F[0];
|
|
894
894
|
}
|
|
895
|
-
|
|
896
|
-
const z =
|
|
897
|
-
if (
|
|
895
|
+
Qe === "application/xhtml+xml" && Ne === ge && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
896
|
+
const z = P ? P.createHTML(i) : i;
|
|
897
|
+
if (Ne === ge)
|
|
898
898
|
try {
|
|
899
|
-
|
|
899
|
+
h = new m().parseFromString(z, Qe);
|
|
900
900
|
} catch {
|
|
901
901
|
}
|
|
902
|
-
if (!
|
|
903
|
-
|
|
902
|
+
if (!h || !h.documentElement) {
|
|
903
|
+
h = ae.createDocument(Ne, "template", null);
|
|
904
904
|
try {
|
|
905
|
-
|
|
905
|
+
h.documentElement.innerHTML = Nt ? de : z;
|
|
906
906
|
} catch {
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const X =
|
|
910
|
-
return i &&
|
|
911
|
-
}, "_initDocument"), Sn = /* @__PURE__ */
|
|
909
|
+
const X = h.body || h.documentElement;
|
|
910
|
+
return i && x && X.insertBefore(e.createTextNode(x), X.childNodes[0] || null), Ne === ge ? ut.call(h, Ce ? "html" : "body")[0] : Ce ? h.documentElement : X;
|
|
911
|
+
}, "_initDocument"), Sn = /* @__PURE__ */ p(function(i) {
|
|
912
912
|
return Q.call(
|
|
913
913
|
i.ownerDocument || i,
|
|
914
914
|
i,
|
|
@@ -916,67 +916,67 @@ function us() {
|
|
|
916
916
|
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
917
917
|
null
|
|
918
918
|
);
|
|
919
|
-
}, "_createNodeIterator"),
|
|
920
|
-
return i instanceof
|
|
921
|
-
}, "_isClobbered"),
|
|
922
|
-
return typeof
|
|
919
|
+
}, "_createNodeIterator"), Ht = /* @__PURE__ */ p(function(i) {
|
|
920
|
+
return i instanceof u && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof b) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
921
|
+
}, "_isClobbered"), Gt = /* @__PURE__ */ p(function(i) {
|
|
922
|
+
return typeof o == "function" && i instanceof o;
|
|
923
923
|
}, "_isNode");
|
|
924
|
-
function
|
|
925
|
-
tt(
|
|
926
|
-
|
|
924
|
+
function xe(S, i, h) {
|
|
925
|
+
tt(S, (x) => {
|
|
926
|
+
x.call(t, i, h, $e);
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
|
-
|
|
930
|
-
const An = /* @__PURE__ */
|
|
931
|
-
let
|
|
932
|
-
if (
|
|
933
|
-
return
|
|
934
|
-
const
|
|
935
|
-
if (
|
|
936
|
-
tagName:
|
|
937
|
-
allowedTags:
|
|
938
|
-
}),
|
|
939
|
-
return
|
|
940
|
-
if (x
|
|
941
|
-
if (!x
|
|
929
|
+
p(xe, "_executeHooks");
|
|
930
|
+
const An = /* @__PURE__ */ p(function(i) {
|
|
931
|
+
let h = null;
|
|
932
|
+
if (xe(q.beforeSanitizeElements, i, null), Ht(i))
|
|
933
|
+
return ce(i), !0;
|
|
934
|
+
const x = W(i.nodeName);
|
|
935
|
+
if (xe(q.uponSanitizeElement, i, {
|
|
936
|
+
tagName: x,
|
|
937
|
+
allowedTags: U
|
|
938
|
+
}), Xe && i.hasChildNodes() && !Gt(i.firstElementChild) && Y(/<[/\w!]/g, i.innerHTML) && Y(/<[/\w!]/g, i.textContent) || Xe && i.namespaceURI === ge && x === "style" && Gt(i.firstElementChild) || i.nodeType === rt.progressingInstruction || Xe && i.nodeType === rt.comment && Y(/<[/\w]/g, i.data))
|
|
939
|
+
return ce(i), !0;
|
|
940
|
+
if (M[x] || !(J.tagCheck instanceof Function && J.tagCheck(x)) && !U[x]) {
|
|
941
|
+
if (!M[x] && _n(x) && (g.tagNameCheck instanceof RegExp && Y(g.tagNameCheck, x) || g.tagNameCheck instanceof Function && g.tagNameCheck(x)))
|
|
942
942
|
return !1;
|
|
943
|
-
if (
|
|
944
|
-
const z =
|
|
943
|
+
if (Ot && !fe[x]) {
|
|
944
|
+
const z = G(i) || i.parentNode, X = be(i) || i.childNodes;
|
|
945
945
|
if (X && z) {
|
|
946
|
-
const
|
|
947
|
-
for (let
|
|
948
|
-
const le =
|
|
949
|
-
z.insertBefore(le,
|
|
946
|
+
const F = X.length;
|
|
947
|
+
for (let ne = F - 1; ne >= 0; --ne) {
|
|
948
|
+
const le = _(X[ne], !0);
|
|
949
|
+
z.insertBefore(le, ie(i));
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
|
-
return
|
|
953
|
+
return ce(i), !0;
|
|
954
954
|
}
|
|
955
|
-
return i instanceof
|
|
956
|
-
|
|
957
|
-
}), i.textContent !==
|
|
955
|
+
return i instanceof d && !_s(i) || (x === "noscript" || x === "noembed" || x === "noframes") && Y(/<\/no(script|embed|frames)/i, i.innerHTML) ? (ce(i), !0) : (Re && i.nodeType === rt.text && (h = i.textContent, tt([we, Oe, ve], (z) => {
|
|
956
|
+
h = Ue(h, z, " ");
|
|
957
|
+
}), i.textContent !== h && (nt(t.removed, {
|
|
958
958
|
element: i.cloneNode()
|
|
959
|
-
}), i.textContent =
|
|
960
|
-
}, "_sanitizeElements"), En = /* @__PURE__ */
|
|
961
|
-
if (
|
|
959
|
+
}), i.textContent = h)), xe(q.afterSanitizeElements, i, null), !1);
|
|
960
|
+
}, "_sanitizeElements"), En = /* @__PURE__ */ p(function(i, h, x) {
|
|
961
|
+
if (j[h] || fn && (h === "id" || h === "name") && (x in e || x in Es))
|
|
962
962
|
return !1;
|
|
963
|
-
if (!(
|
|
964
|
-
if (!(
|
|
965
|
-
if (!(
|
|
966
|
-
if (!
|
|
963
|
+
if (!(_e && !j[h] && Y(Rt, h))) {
|
|
964
|
+
if (!(Ze && Y(Ct, h))) {
|
|
965
|
+
if (!(J.attributeCheck instanceof Function && J.attributeCheck(h, i))) {
|
|
966
|
+
if (!A[h] || j[h]) {
|
|
967
967
|
if (
|
|
968
968
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
969
969
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
970
970
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
971
|
-
!(_n(i) && (
|
|
971
|
+
!(_n(i) && (g.tagNameCheck instanceof RegExp && Y(g.tagNameCheck, i) || g.tagNameCheck instanceof Function && g.tagNameCheck(i)) && (g.attributeNameCheck instanceof RegExp && Y(g.attributeNameCheck, h) || g.attributeNameCheck instanceof Function && g.attributeNameCheck(h, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
972
972
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
973
|
-
|
|
973
|
+
h === "is" && g.allowCustomizedBuiltInElements && (g.tagNameCheck instanceof RegExp && Y(g.tagNameCheck, x) || g.tagNameCheck instanceof Function && g.tagNameCheck(x)))
|
|
974
974
|
) return !1;
|
|
975
|
-
} else if (!
|
|
976
|
-
if (!
|
|
977
|
-
if (!((
|
|
978
|
-
if (!(
|
|
979
|
-
if (
|
|
975
|
+
} else if (!Pt[h]) {
|
|
976
|
+
if (!Y(pt, Ue(x, ht, ""))) {
|
|
977
|
+
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" && Bn(x, "data:") === 0 && bn[i])) {
|
|
978
|
+
if (!(pn && !Y(It, Ue(x, ht, "")))) {
|
|
979
|
+
if (x)
|
|
980
980
|
return !1;
|
|
981
981
|
}
|
|
982
982
|
}
|
|
@@ -986,188 +986,188 @@ function us() {
|
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
return !0;
|
|
989
|
-
}, "_isValidAttribute"),
|
|
990
|
-
return !
|
|
991
|
-
}, "_isBasicCustomElement"), Rn = /* @__PURE__ */
|
|
992
|
-
|
|
989
|
+
}, "_isValidAttribute"), Rs = R({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), _n = /* @__PURE__ */ p(function(i) {
|
|
990
|
+
return !Rs[lt(i)] && Y(Dt, i);
|
|
991
|
+
}, "_isBasicCustomElement"), Rn = /* @__PURE__ */ p(function(i) {
|
|
992
|
+
xe(q.beforeSanitizeAttributes, i, null);
|
|
993
993
|
const {
|
|
994
|
-
attributes:
|
|
994
|
+
attributes: h
|
|
995
995
|
} = i;
|
|
996
|
-
if (!
|
|
996
|
+
if (!h || Ht(i))
|
|
997
997
|
return;
|
|
998
|
-
const
|
|
998
|
+
const x = {
|
|
999
999
|
attrName: "",
|
|
1000
1000
|
attrValue: "",
|
|
1001
1001
|
keepAttr: !0,
|
|
1002
|
-
allowedAttributes:
|
|
1002
|
+
allowedAttributes: A,
|
|
1003
1003
|
forceKeepAttr: void 0
|
|
1004
1004
|
};
|
|
1005
|
-
let z =
|
|
1005
|
+
let z = h.length;
|
|
1006
1006
|
for (; z--; ) {
|
|
1007
|
-
const X =
|
|
1008
|
-
name:
|
|
1009
|
-
namespaceURI:
|
|
1007
|
+
const X = h[z], {
|
|
1008
|
+
name: F,
|
|
1009
|
+
namespaceURI: ne,
|
|
1010
1010
|
value: le
|
|
1011
|
-
} = X,
|
|
1012
|
-
let V =
|
|
1013
|
-
if (
|
|
1014
|
-
|
|
1011
|
+
} = X, ue = W(F), jt = le;
|
|
1012
|
+
let V = F === "value" ? jt : nr(jt);
|
|
1013
|
+
if (x.attrName = ue, x.attrValue = V, x.keepAttr = !0, x.forceKeepAttr = void 0, xe(q.uponSanitizeAttribute, i, x), V = x.attrValue, gn && (ue === "id" || ue === "name") && Bn(V, mn) !== 0 && (Ie(F, i), V = mn + V), Xe && Y(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, V)) {
|
|
1014
|
+
Ie(F, i);
|
|
1015
1015
|
continue;
|
|
1016
1016
|
}
|
|
1017
|
-
if (
|
|
1018
|
-
|
|
1017
|
+
if (ue === "attributename" && Un(V, "href")) {
|
|
1018
|
+
Ie(F, i);
|
|
1019
1019
|
continue;
|
|
1020
1020
|
}
|
|
1021
|
-
if (
|
|
1021
|
+
if (x.forceKeepAttr)
|
|
1022
1022
|
continue;
|
|
1023
|
-
if (!
|
|
1024
|
-
|
|
1023
|
+
if (!x.keepAttr) {
|
|
1024
|
+
Ie(F, i);
|
|
1025
1025
|
continue;
|
|
1026
1026
|
}
|
|
1027
|
-
if (!dn &&
|
|
1028
|
-
|
|
1027
|
+
if (!dn && Y(/\/>/i, V)) {
|
|
1028
|
+
Ie(F, i);
|
|
1029
1029
|
continue;
|
|
1030
1030
|
}
|
|
1031
|
-
|
|
1032
|
-
V =
|
|
1031
|
+
Re && tt([we, Oe, ve], (Dn) => {
|
|
1032
|
+
V = Ue(V, Dn, " ");
|
|
1033
1033
|
});
|
|
1034
|
-
const In =
|
|
1035
|
-
if (!En(In,
|
|
1036
|
-
|
|
1034
|
+
const In = W(i.nodeName);
|
|
1035
|
+
if (!En(In, ue, V)) {
|
|
1036
|
+
Ie(F, i);
|
|
1037
1037
|
continue;
|
|
1038
1038
|
}
|
|
1039
|
-
if (
|
|
1040
|
-
switch (
|
|
1039
|
+
if (P && typeof f == "object" && typeof f.getAttributeType == "function" && !ne)
|
|
1040
|
+
switch (f.getAttributeType(In, ue)) {
|
|
1041
1041
|
case "TrustedHTML": {
|
|
1042
|
-
V =
|
|
1042
|
+
V = P.createHTML(V);
|
|
1043
1043
|
break;
|
|
1044
1044
|
}
|
|
1045
1045
|
case "TrustedScriptURL": {
|
|
1046
|
-
V =
|
|
1046
|
+
V = P.createScriptURL(V);
|
|
1047
1047
|
break;
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
|
-
if (V !==
|
|
1050
|
+
if (V !== jt)
|
|
1051
1051
|
try {
|
|
1052
|
-
|
|
1052
|
+
ne ? i.setAttributeNS(ne, F, V) : i.setAttribute(F, V), Ht(i) ? ce(i) : $n(t.removed);
|
|
1053
1053
|
} catch {
|
|
1054
|
-
|
|
1054
|
+
Ie(F, i);
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
|
-
|
|
1058
|
-
}, "_sanitizeAttributes"), Cn = /* @__PURE__ */
|
|
1059
|
-
let
|
|
1060
|
-
const
|
|
1061
|
-
for (
|
|
1062
|
-
|
|
1063
|
-
|
|
1057
|
+
xe(q.afterSanitizeAttributes, i, null);
|
|
1058
|
+
}, "_sanitizeAttributes"), Cn = /* @__PURE__ */ p(function(i) {
|
|
1059
|
+
let h = null;
|
|
1060
|
+
const x = Sn(i);
|
|
1061
|
+
for (xe(q.beforeSanitizeShadowDOM, i, null); h = x.nextNode(); )
|
|
1062
|
+
xe(q.uponSanitizeShadowNode, h, null), An(h), Rn(h), h.content instanceof s && Cn(h.content);
|
|
1063
|
+
xe(q.afterSanitizeShadowDOM, i, null);
|
|
1064
1064
|
}, "_sanitizeShadowDOM");
|
|
1065
|
-
return t.sanitize = function(
|
|
1066
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
1067
|
-
if (
|
|
1068
|
-
throw
|
|
1065
|
+
return t.sanitize = function(S) {
|
|
1066
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, x = null, z = null, X = null;
|
|
1067
|
+
if (Nt = !S, Nt && (S = "<!-->"), typeof S != "string" && !Gt(S) && (S = lr(S), typeof S != "string"))
|
|
1068
|
+
throw bt("dirty is not a string, aborting");
|
|
1069
1069
|
if (!t.isSupported)
|
|
1070
|
-
return
|
|
1071
|
-
if (
|
|
1072
|
-
const le =
|
|
1070
|
+
return S;
|
|
1071
|
+
if (Mt || Ft(i), t.removed = [], typeof S == "string" && (Ke = !1), Ke) {
|
|
1072
|
+
const le = S.nodeName;
|
|
1073
1073
|
if (typeof le == "string") {
|
|
1074
|
-
const
|
|
1075
|
-
if (!
|
|
1076
|
-
throw
|
|
1074
|
+
const ue = W(le);
|
|
1075
|
+
if (!U[ue] || M[ue])
|
|
1076
|
+
throw bt("root node is forbidden and cannot be sanitized in-place");
|
|
1077
1077
|
}
|
|
1078
|
-
} else if (
|
|
1079
|
-
|
|
1078
|
+
} else if (S instanceof o)
|
|
1079
|
+
h = Tn("<!---->"), x = h.ownerDocument.importNode(S, !0), x.nodeType === rt.element && x.nodeName === "BODY" || x.nodeName === "HTML" ? h = x : h.appendChild(x);
|
|
1080
1080
|
else {
|
|
1081
|
-
if (!
|
|
1082
|
-
|
|
1083
|
-
return
|
|
1084
|
-
if (
|
|
1085
|
-
return
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1089
|
-
for (; z =
|
|
1081
|
+
if (!ze && !Re && !Ce && // eslint-disable-next-line unicorn/prefer-includes
|
|
1082
|
+
S.indexOf("<") === -1)
|
|
1083
|
+
return P && ft ? P.createHTML(S) : S;
|
|
1084
|
+
if (h = Tn(S), !h)
|
|
1085
|
+
return ze ? null : ft ? de : "";
|
|
1086
|
+
}
|
|
1087
|
+
h && Lt && ce(h.firstChild);
|
|
1088
|
+
const F = Sn(Ke ? S : h);
|
|
1089
|
+
for (; z = F.nextNode(); )
|
|
1090
1090
|
An(z), Rn(z), z.content instanceof s && Cn(z.content);
|
|
1091
|
-
if (
|
|
1092
|
-
return
|
|
1093
|
-
if (
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1096
|
-
let le =
|
|
1097
|
-
tt([we, Oe,
|
|
1098
|
-
le =
|
|
1099
|
-
}),
|
|
1100
|
-
}
|
|
1101
|
-
if (
|
|
1102
|
-
for (X = _t.call(
|
|
1103
|
-
X.appendChild(
|
|
1091
|
+
if (Ke)
|
|
1092
|
+
return S;
|
|
1093
|
+
if (ze) {
|
|
1094
|
+
if (Re) {
|
|
1095
|
+
h.normalize();
|
|
1096
|
+
let le = h.innerHTML;
|
|
1097
|
+
tt([we, Oe, ve], (ue) => {
|
|
1098
|
+
le = Ue(le, ue, " ");
|
|
1099
|
+
}), h.innerHTML = le;
|
|
1100
|
+
}
|
|
1101
|
+
if (dt)
|
|
1102
|
+
for (X = _t.call(h.ownerDocument); h.firstChild; )
|
|
1103
|
+
X.appendChild(h.firstChild);
|
|
1104
1104
|
else
|
|
1105
|
-
X =
|
|
1106
|
-
return (
|
|
1107
|
-
}
|
|
1108
|
-
let
|
|
1109
|
-
return
|
|
1110
|
-
` +
|
|
1111
|
-
|
|
1112
|
-
}),
|
|
1105
|
+
X = h;
|
|
1106
|
+
return (A.shadowroot || A.shadowrootmode) && (X = C.call(n, X, !0)), X;
|
|
1107
|
+
}
|
|
1108
|
+
let ne = Ce ? h.outerHTML : h.innerHTML;
|
|
1109
|
+
return Ce && U["!doctype"] && h.ownerDocument && h.ownerDocument.doctype && h.ownerDocument.doctype.name && Y(us, h.ownerDocument.doctype.name) && (ne = "<!DOCTYPE " + h.ownerDocument.doctype.name + `>
|
|
1110
|
+
` + ne), Re && tt([we, Oe, ve], (le) => {
|
|
1111
|
+
ne = Ue(ne, le, " ");
|
|
1112
|
+
}), P && ft ? P.createHTML(ne) : ne;
|
|
1113
1113
|
}, t.setConfig = function() {
|
|
1114
|
-
let
|
|
1115
|
-
|
|
1114
|
+
let S = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1115
|
+
Ft(S), Mt = !0;
|
|
1116
1116
|
}, t.clearConfig = function() {
|
|
1117
|
-
|
|
1118
|
-
}, t.isValidAttribute = function(
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
return En(
|
|
1122
|
-
}, t.addHook = function(
|
|
1123
|
-
typeof i == "function" && nt(q[
|
|
1124
|
-
}, t.removeHook = function(
|
|
1117
|
+
$e = null, Mt = !1;
|
|
1118
|
+
}, t.isValidAttribute = function(S, i, h) {
|
|
1119
|
+
$e || Ft({});
|
|
1120
|
+
const x = W(S), z = W(i);
|
|
1121
|
+
return En(x, z, h);
|
|
1122
|
+
}, t.addHook = function(S, i) {
|
|
1123
|
+
typeof i == "function" && nt(q[S], i);
|
|
1124
|
+
}, t.removeHook = function(S, i) {
|
|
1125
1125
|
if (i !== void 0) {
|
|
1126
|
-
const
|
|
1127
|
-
return
|
|
1126
|
+
const h = er(q[S], i);
|
|
1127
|
+
return h === -1 ? void 0 : tr(q[S], h, 1)[0];
|
|
1128
1128
|
}
|
|
1129
|
-
return $n(q[
|
|
1130
|
-
}, t.removeHooks = function(
|
|
1131
|
-
q[
|
|
1129
|
+
return $n(q[S]);
|
|
1130
|
+
}, t.removeHooks = function(S) {
|
|
1131
|
+
q[S] = [];
|
|
1132
1132
|
}, t.removeAllHooks = function() {
|
|
1133
1133
|
q = Yn();
|
|
1134
1134
|
}, t;
|
|
1135
1135
|
}
|
|
1136
|
-
|
|
1137
|
-
var
|
|
1138
|
-
function
|
|
1136
|
+
p(hs, "createDOMPurify");
|
|
1137
|
+
var vr = hs();
|
|
1138
|
+
function tn() {
|
|
1139
1139
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1140
1140
|
}
|
|
1141
|
-
|
|
1142
|
-
var Le =
|
|
1143
|
-
function
|
|
1141
|
+
p(tn, "z");
|
|
1142
|
+
var Le = tn();
|
|
1143
|
+
function ps(a) {
|
|
1144
1144
|
Le = a;
|
|
1145
1145
|
}
|
|
1146
|
-
|
|
1147
|
-
var
|
|
1146
|
+
p(ps, "G");
|
|
1147
|
+
var De = { exec: /* @__PURE__ */ p(() => null, "exec") };
|
|
1148
1148
|
function D(a, t = "") {
|
|
1149
|
-
let e = typeof a == "string" ? a : a.source, n = { replace: /* @__PURE__ */
|
|
1150
|
-
let
|
|
1151
|
-
return
|
|
1152
|
-
}, "replace"), getRegex: /* @__PURE__ */
|
|
1149
|
+
let e = typeof a == "string" ? a : a.source, n = { replace: /* @__PURE__ */ p((r, s) => {
|
|
1150
|
+
let l = typeof s == "string" ? s : s.source;
|
|
1151
|
+
return l = l.replace(K.caret, "$1"), e = e.replace(r, l), n;
|
|
1152
|
+
}, "replace"), getRegex: /* @__PURE__ */ p(() => new RegExp(e, t), "getRegex") };
|
|
1153
1153
|
return n;
|
|
1154
1154
|
}
|
|
1155
|
-
|
|
1156
|
-
var
|
|
1155
|
+
p(D, "k");
|
|
1156
|
+
var yr = ((a = "") => {
|
|
1157
1157
|
try {
|
|
1158
1158
|
return !!new RegExp("(?<=1)(?<!1)" + a);
|
|
1159
1159
|
} catch {
|
|
1160
1160
|
return !1;
|
|
1161
1161
|
}
|
|
1162
|
-
})(), K = { 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__ */
|
|
1163
|
-
]`).replace("lheading",
|
|
1164
|
-
function
|
|
1162
|
+
})(), K = { 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__ */ p((a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}>`), "blockquoteBeginRegex") }, Tr = /^(?:[ \t]*(?:\n|$))+/, Sr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ar = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ct = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Er = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, nn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ds = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, fs = D(ds).replace(/bull/g, nn).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(), _r = D(ds).replace(/bull/g, nn).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(), sn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Rr = /^[^\n]+/, rn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Cr = D(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", rn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ir = D(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, nn).getRegex(), At = "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", an = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Dr = D("^ {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", an).replace("tag", At).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), gs = D(sn).replace("hr", ct).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", At).getRegex(), Mr = D(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", gs).getRegex(), ln = { blockquote: Mr, code: Sr, def: Cr, fences: Ar, heading: Er, hr: ct, html: Dr, lheading: fs, list: Ir, newline: Tr, paragraph: gs, table: De, text: Rr }, Zn = D("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ct).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", At).getRegex(), Lr = { ...ln, lheading: _r, table: Zn, paragraph: D(sn).replace("hr", ct).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Zn).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", At).getRegex() }, Or = { ...ln, html: D(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", an).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: De, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: D(sn).replace("hr", ct).replace("heading", ` *#{1,6} *[^
|
|
1163
|
+
]`).replace("lheading", fs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, zr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Pr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ms = /^( {2,}|\\)\n(?!\s*$)/, Nr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ve = /[\p{P}\p{S}]/u, Et = /[\s\p{P}\p{S}]/u, on = /[^\s\p{P}\p{S}]/u, $r = D(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Et).getRegex(), bs = /(?!~)[\p{P}\p{S}]/u, Ur = /(?!~)[\s\p{P}\p{S}]/u, Br = /(?:[^\s\p{P}\p{S}]|~)/u, Fr = D(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", yr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), xs = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Hr = D(xs, "u").replace(/punct/g, Ve).getRegex(), Gr = D(xs, "u").replace(/punct/g, bs).getRegex(), ks = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", jr = D(ks, "gu").replace(/notPunctSpace/g, on).replace(/punctSpace/g, Et).replace(/punct/g, Ve).getRegex(), Wr = D(ks, "gu").replace(/notPunctSpace/g, Br).replace(/punctSpace/g, Ur).replace(/punct/g, bs).getRegex(), qr = D("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, on).replace(/punctSpace/g, Et).replace(/punct/g, Ve).getRegex(), Vr = D(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, Ve).getRegex(), Yr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Zr = D(Yr, "gu").replace(/notPunctSpace/g, on).replace(/punctSpace/g, Et).replace(/punct/g, Ve).getRegex(), Xr = D(/\\(punct)/, "gu").replace(/punct/g, Ve).getRegex(), Kr = D(/^<(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(), Qr = D(an).replace("(?:-->|$)", "-->").getRegex(), Jr = D("^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", Qr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), vt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, ei = D(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", vt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ws = D(/^!?\[(label)\]\[(ref)\]/).replace("label", vt).replace("ref", rn).getRegex(), vs = D(/^!?\[(ref)\](?:\[\])?/).replace("ref", rn).getRegex(), ti = D("reflink|nolink(?!\\()", "g").replace("reflink", ws).replace("nolink", vs).getRegex(), Xn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, cn = { _backpedal: De, anyPunctuation: Xr, autolink: Kr, blockSkip: Fr, br: ms, code: Pr, del: De, delLDelim: De, delRDelim: De, emStrongLDelim: Hr, emStrongRDelimAst: jr, emStrongRDelimUnd: qr, escape: zr, link: ei, nolink: vs, punctuation: $r, reflink: ws, reflinkSearch: ti, tag: Jr, text: Nr, url: De }, ni = { ...cn, link: D(/^!?\[(label)\]\((.*?)\)/).replace("label", vt).getRegex(), reflink: D(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", vt).getRegex() }, Jt = { ...cn, emStrongRDelimAst: Wr, emStrongLDelim: Gr, delLDelim: Vr, delRDelim: Zr, url: D(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Xn).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: D(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Xn).getRegex() }, si = { ...Jt, br: D(ms).replace("{2,}", "*").getRegex(), text: D(Jt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, kt = { normal: ln, gfm: Lr, pedantic: Or }, it = { normal: cn, gfm: Jt, breaks: si, pedantic: ni }, ri = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Kn = /* @__PURE__ */ p((a) => ri[a], "de");
|
|
1164
|
+
function me(a, t) {
|
|
1165
1165
|
if (t) {
|
|
1166
1166
|
if (K.escapeTest.test(a)) return a.replace(K.escapeReplace, Kn);
|
|
1167
1167
|
} else if (K.escapeTestNoEncode.test(a)) return a.replace(K.escapeReplaceNoEncode, Kn);
|
|
1168
1168
|
return a;
|
|
1169
1169
|
}
|
|
1170
|
-
|
|
1170
|
+
p(me, "O");
|
|
1171
1171
|
function Qn(a) {
|
|
1172
1172
|
try {
|
|
1173
1173
|
a = encodeURI(a).replace(K.percentDecode, "%");
|
|
@@ -1176,20 +1176,20 @@ function Qn(a) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
return a;
|
|
1178
1178
|
}
|
|
1179
|
-
|
|
1179
|
+
p(Qn, "J");
|
|
1180
1180
|
function Jn(a, t) {
|
|
1181
|
-
let e = a.replace(K.findPipe, (s,
|
|
1182
|
-
let
|
|
1183
|
-
for (; --c >= 0 &&
|
|
1184
|
-
return
|
|
1181
|
+
let e = a.replace(K.findPipe, (s, l, o) => {
|
|
1182
|
+
let d = !1, c = l;
|
|
1183
|
+
for (; --c >= 0 && o[c] === "\\"; ) d = !d;
|
|
1184
|
+
return d ? "|" : " |";
|
|
1185
1185
|
}), n = e.split(K.splitPipe), r = 0;
|
|
1186
1186
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
1187
1187
|
else for (; n.length < t; ) n.push("");
|
|
1188
1188
|
for (; r < n.length; r++) n[r] = n[r].trim().replace(K.slashPipe, "|");
|
|
1189
1189
|
return n;
|
|
1190
1190
|
}
|
|
1191
|
-
|
|
1192
|
-
function
|
|
1191
|
+
p(Jn, "V");
|
|
1192
|
+
function ye(a, t, e) {
|
|
1193
1193
|
let n = a.length;
|
|
1194
1194
|
if (n === 0) return "";
|
|
1195
1195
|
let r = 0;
|
|
@@ -1197,7 +1197,7 @@ function ve(a, t, e) {
|
|
|
1197
1197
|
r++;
|
|
1198
1198
|
return a.slice(0, n - r);
|
|
1199
1199
|
}
|
|
1200
|
-
|
|
1200
|
+
p(ye, "$");
|
|
1201
1201
|
function es(a) {
|
|
1202
1202
|
let t = a.split(`
|
|
1203
1203
|
`), e = t.length - 1;
|
|
@@ -1205,8 +1205,8 @@ function es(a) {
|
|
|
1205
1205
|
return t.length - e <= 2 ? a : t.slice(0, e + 1).join(`
|
|
1206
1206
|
`);
|
|
1207
1207
|
}
|
|
1208
|
-
|
|
1209
|
-
function
|
|
1208
|
+
p(es, "Y");
|
|
1209
|
+
function ii(a, t) {
|
|
1210
1210
|
if (a.indexOf(t[1]) === -1) return -1;
|
|
1211
1211
|
let e = 0;
|
|
1212
1212
|
for (let n = 0; n < a.length; n++) if (a[n] === "\\") n++;
|
|
@@ -1214,8 +1214,8 @@ function si(a, t) {
|
|
|
1214
1214
|
else if (a[n] === t[1] && (e--, e < 0)) return n;
|
|
1215
1215
|
return e > 0 ? -2 : -1;
|
|
1216
1216
|
}
|
|
1217
|
-
|
|
1218
|
-
function
|
|
1217
|
+
p(ii, "ge");
|
|
1218
|
+
function ai(a, t = 0) {
|
|
1219
1219
|
let e = t, n = "";
|
|
1220
1220
|
for (let r of a) if (r === " ") {
|
|
1221
1221
|
let s = 4 - e % 4;
|
|
@@ -1223,29 +1223,29 @@ function ri(a, t = 0) {
|
|
|
1223
1223
|
} else n += r, e++;
|
|
1224
1224
|
return n;
|
|
1225
1225
|
}
|
|
1226
|
-
|
|
1226
|
+
p(ai, "fe");
|
|
1227
1227
|
function ts(a, t, e, n, r) {
|
|
1228
|
-
let s = t.href,
|
|
1228
|
+
let s = t.href, l = t.title || null, o = a[1].replace(r.other.outputLinkReplace, "$1");
|
|
1229
1229
|
n.state.inLink = !0;
|
|
1230
|
-
let
|
|
1231
|
-
return n.state.inLink = !1,
|
|
1230
|
+
let d = { type: a[0].charAt(0) === "!" ? "image" : "link", raw: e, href: s, title: l, text: o, tokens: n.inlineTokens(o) };
|
|
1231
|
+
return n.state.inLink = !1, d;
|
|
1232
1232
|
}
|
|
1233
|
-
|
|
1234
|
-
function
|
|
1233
|
+
p(ts, "me");
|
|
1234
|
+
function li(a, t, e) {
|
|
1235
1235
|
let n = a.match(e.other.indentCodeCompensation);
|
|
1236
1236
|
if (n === null) return t;
|
|
1237
1237
|
let r = n[1];
|
|
1238
1238
|
return t.split(`
|
|
1239
1239
|
`).map((s) => {
|
|
1240
|
-
let
|
|
1241
|
-
if (
|
|
1242
|
-
let [
|
|
1243
|
-
return
|
|
1240
|
+
let l = s.match(e.other.beginningSpace);
|
|
1241
|
+
if (l === null) return s;
|
|
1242
|
+
let [o] = l;
|
|
1243
|
+
return o.length >= r.length ? s.slice(r.length) : s;
|
|
1244
1244
|
}).join(`
|
|
1245
1245
|
`);
|
|
1246
1246
|
}
|
|
1247
|
-
|
|
1248
|
-
var
|
|
1247
|
+
p(li, "rt");
|
|
1248
|
+
var He, yt = (He = class {
|
|
1249
1249
|
constructor(t) {
|
|
1250
1250
|
I(this, "options");
|
|
1251
1251
|
I(this, "rules");
|
|
@@ -1266,7 +1266,7 @@ var je, Tt = (je = class {
|
|
|
1266
1266
|
fences(t) {
|
|
1267
1267
|
let e = this.rules.block.fences.exec(t);
|
|
1268
1268
|
if (e) {
|
|
1269
|
-
let n = e[0], r =
|
|
1269
|
+
let n = e[0], r = li(n, e[3] || "", this.rules);
|
|
1270
1270
|
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: r };
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
@@ -1275,56 +1275,56 @@ var je, Tt = (je = class {
|
|
|
1275
1275
|
if (e) {
|
|
1276
1276
|
let n = e[2].trim();
|
|
1277
1277
|
if (this.rules.other.endingHash.test(n)) {
|
|
1278
|
-
let r =
|
|
1278
|
+
let r = ye(n, "#");
|
|
1279
1279
|
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
1280
1280
|
}
|
|
1281
|
-
return { type: "heading", raw:
|
|
1281
|
+
return { type: "heading", raw: ye(e[0], `
|
|
1282
1282
|
`), depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
1285
|
hr(t) {
|
|
1286
1286
|
let e = this.rules.block.hr.exec(t);
|
|
1287
|
-
if (e) return { type: "hr", raw:
|
|
1287
|
+
if (e) return { type: "hr", raw: ye(e[0], `
|
|
1288
1288
|
`) };
|
|
1289
1289
|
}
|
|
1290
1290
|
blockquote(t) {
|
|
1291
1291
|
let e = this.rules.block.blockquote.exec(t);
|
|
1292
1292
|
if (e) {
|
|
1293
|
-
let n =
|
|
1293
|
+
let n = ye(e[0], `
|
|
1294
1294
|
`).split(`
|
|
1295
|
-
`), r = "", s = "",
|
|
1295
|
+
`), r = "", s = "", l = [];
|
|
1296
1296
|
for (; n.length > 0; ) {
|
|
1297
|
-
let
|
|
1298
|
-
for (c = 0; c < n.length; c++) if (this.rules.other.blockquoteStart.test(n[c]))
|
|
1299
|
-
else if (!
|
|
1297
|
+
let o = !1, d = [], c;
|
|
1298
|
+
for (c = 0; c < n.length; c++) if (this.rules.other.blockquoteStart.test(n[c])) d.push(n[c]), o = !0;
|
|
1299
|
+
else if (!o) d.push(n[c]);
|
|
1300
1300
|
else break;
|
|
1301
1301
|
n = n.slice(c);
|
|
1302
|
-
let b =
|
|
1303
|
-
`),
|
|
1302
|
+
let b = d.join(`
|
|
1303
|
+
`), u = b.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1304
1304
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1305
1305
|
r = r ? `${r}
|
|
1306
1306
|
${b}` : b, s = s ? `${s}
|
|
1307
|
-
${
|
|
1308
|
-
let
|
|
1309
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1310
|
-
let
|
|
1311
|
-
if (
|
|
1312
|
-
if (
|
|
1313
|
-
let
|
|
1307
|
+
${u}` : u;
|
|
1308
|
+
let m = this.lexer.state.top;
|
|
1309
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, l, !0), this.lexer.state.top = m, n.length === 0) break;
|
|
1310
|
+
let f = l.at(-1);
|
|
1311
|
+
if (f?.type === "code") break;
|
|
1312
|
+
if (f?.type === "blockquote") {
|
|
1313
|
+
let w = f, _ = w.raw + `
|
|
1314
1314
|
` + n.join(`
|
|
1315
|
-
`), O = this.blockquote(
|
|
1316
|
-
|
|
1315
|
+
`), O = this.blockquote(_);
|
|
1316
|
+
l[l.length - 1] = O, r = r.substring(0, r.length - w.raw.length) + O.raw, s = s.substring(0, s.length - w.text.length) + O.text;
|
|
1317
1317
|
break;
|
|
1318
|
-
} else if (
|
|
1319
|
-
let
|
|
1318
|
+
} else if (f?.type === "list") {
|
|
1319
|
+
let w = f, _ = w.raw + `
|
|
1320
1320
|
` + n.join(`
|
|
1321
|
-
`), O = this.list(
|
|
1322
|
-
|
|
1321
|
+
`), O = this.list(_);
|
|
1322
|
+
l[l.length - 1] = O, r = r.substring(0, r.length - f.raw.length) + O.raw, s = s.substring(0, s.length - w.raw.length) + O.raw, n = _.substring(l.at(-1).raw.length).split(`
|
|
1323
1323
|
`);
|
|
1324
1324
|
continue;
|
|
1325
1325
|
}
|
|
1326
1326
|
}
|
|
1327
|
-
return { type: "blockquote", raw: r, tokens:
|
|
1327
|
+
return { type: "blockquote", raw: r, tokens: l, text: s };
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
1330
|
list(t) {
|
|
@@ -1332,56 +1332,56 @@ ${p}` : p;
|
|
|
1332
1332
|
if (e) {
|
|
1333
1333
|
let n = e[1].trim(), r = n.length > 1, s = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: !1, items: [] };
|
|
1334
1334
|
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
1335
|
-
let
|
|
1335
|
+
let l = this.rules.other.listItemRegex(n), o = !1;
|
|
1336
1336
|
for (; t; ) {
|
|
1337
|
-
let c = !1, b = "",
|
|
1338
|
-
if (!(e =
|
|
1337
|
+
let c = !1, b = "", u = "";
|
|
1338
|
+
if (!(e = l.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1339
1339
|
b = e[0], t = t.substring(b.length);
|
|
1340
|
-
let
|
|
1341
|
-
`, 1)[0], e[1].length),
|
|
1342
|
-
`, 1)[0],
|
|
1343
|
-
if (this.options.pedantic ? (
|
|
1344
|
-
`, t = t.substring(
|
|
1345
|
-
let O = this.rules.other.nextBulletRegex(
|
|
1340
|
+
let m = ai(e[2].split(`
|
|
1341
|
+
`, 1)[0], e[1].length), f = t.split(`
|
|
1342
|
+
`, 1)[0], w = !m.trim(), _ = 0;
|
|
1343
|
+
if (this.options.pedantic ? (_ = 2, u = m.trimStart()) : w ? _ = e[1].length + 1 : (_ = m.search(this.rules.other.nonSpaceChar), _ = _ > 4 ? 1 : _, u = m.slice(_), _ += e[1].length), w && this.rules.other.blankLine.test(f) && (b += f + `
|
|
1344
|
+
`, t = t.substring(f.length + 1), c = !0), !c) {
|
|
1345
|
+
let O = this.rules.other.nextBulletRegex(_), ie = this.rules.other.hrRegex(_), be = this.rules.other.fencesBeginRegex(_), G = this.rules.other.headingBeginRegex(_), P = this.rules.other.htmlBeginRegex(_), de = this.rules.other.blockquoteBeginRegex(_);
|
|
1346
1346
|
for (; t; ) {
|
|
1347
1347
|
let ae = t.split(`
|
|
1348
1348
|
`, 1)[0], Q;
|
|
1349
|
-
if (
|
|
1350
|
-
if (Q.search(this.rules.other.nonSpaceChar) >=
|
|
1351
|
-
` + Q.slice(
|
|
1349
|
+
if (f = ae, this.options.pedantic ? (f = f.replace(this.rules.other.listReplaceNesting, " "), Q = f) : Q = f.replace(this.rules.other.tabCharGlobal, " "), be.test(f) || G.test(f) || P.test(f) || de.test(f) || O.test(f) || ie.test(f)) break;
|
|
1350
|
+
if (Q.search(this.rules.other.nonSpaceChar) >= _ || !f.trim()) u += `
|
|
1351
|
+
` + Q.slice(_);
|
|
1352
1352
|
else {
|
|
1353
|
-
if (
|
|
1354
|
-
|
|
1355
|
-
` +
|
|
1353
|
+
if (w || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || be.test(m) || G.test(m) || ie.test(m)) break;
|
|
1354
|
+
u += `
|
|
1355
|
+
` + f;
|
|
1356
1356
|
}
|
|
1357
|
-
|
|
1358
|
-
`, t = t.substring(ae.length + 1),
|
|
1357
|
+
w = !f.trim(), b += ae + `
|
|
1358
|
+
`, t = t.substring(ae.length + 1), m = Q.slice(_);
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
s.loose || (
|
|
1361
|
+
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(b) && (o = !0)), s.items.push({ type: "list_item", raw: b, task: !!this.options.gfm && this.rules.other.listIsTask.test(u), loose: !1, text: u, tokens: [] }), s.raw += b;
|
|
1362
1362
|
}
|
|
1363
|
-
let
|
|
1364
|
-
if (
|
|
1363
|
+
let d = s.items.at(-1);
|
|
1364
|
+
if (d) d.raw = d.raw.trimEnd(), d.text = d.text.trimEnd();
|
|
1365
1365
|
else return;
|
|
1366
1366
|
s.raw = s.raw.trimEnd();
|
|
1367
1367
|
for (let c of s.items) {
|
|
1368
1368
|
if (this.lexer.state.top = !1, c.tokens = this.lexer.blockTokens(c.text, []), c.task) {
|
|
1369
1369
|
if (c.text = c.text.replace(this.rules.other.listReplaceTask, ""), c.tokens[0]?.type === "text" || c.tokens[0]?.type === "paragraph") {
|
|
1370
1370
|
c.tokens[0].raw = c.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), c.tokens[0].text = c.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
1371
|
-
for (let
|
|
1372
|
-
this.lexer.inlineQueue[
|
|
1371
|
+
for (let u = this.lexer.inlineQueue.length - 1; u >= 0; u--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)) {
|
|
1372
|
+
this.lexer.inlineQueue[u].src = this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask, "");
|
|
1373
1373
|
break;
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
1376
|
let b = this.rules.other.listTaskCheckbox.exec(c.raw);
|
|
1377
1377
|
if (b) {
|
|
1378
|
-
let
|
|
1379
|
-
c.checked =
|
|
1378
|
+
let u = { type: "checkbox", raw: b[0] + " ", checked: b[0] !== "[ ]" };
|
|
1379
|
+
c.checked = u.checked, s.loose ? c.tokens[0] && ["paragraph", "text"].includes(c.tokens[0].type) && "tokens" in c.tokens[0] && c.tokens[0].tokens ? (c.tokens[0].raw = u.raw + c.tokens[0].raw, c.tokens[0].text = u.raw + c.tokens[0].text, c.tokens[0].tokens.unshift(u)) : c.tokens.unshift({ type: "paragraph", raw: u.raw, text: u.raw, tokens: [u] }) : c.tokens.unshift(u);
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
1382
1382
|
if (!s.loose) {
|
|
1383
|
-
let b = c.tokens.filter((
|
|
1384
|
-
s.loose =
|
|
1383
|
+
let b = c.tokens.filter((m) => m.type === "space"), u = b.length > 0 && b.some((m) => this.rules.other.anyLine.test(m.raw));
|
|
1384
|
+
s.loose = u;
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
1387
|
if (s.loose) for (let c of s.items) {
|
|
@@ -1402,7 +1402,7 @@ ${p}` : p;
|
|
|
1402
1402
|
let e = this.rules.block.def.exec(t);
|
|
1403
1403
|
if (e) {
|
|
1404
1404
|
let n = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
1405
|
-
return { type: "def", tag: n, raw:
|
|
1405
|
+
return { type: "def", tag: n, raw: ye(e[0], `
|
|
1406
1406
|
`), href: r, title: s };
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
@@ -1410,20 +1410,20 @@ ${p}` : p;
|
|
|
1410
1410
|
let e = this.rules.block.table.exec(t);
|
|
1411
1411
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
1412
1412
|
let n = Jn(e[1]), r = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1413
|
-
`) : [],
|
|
1413
|
+
`) : [], l = { type: "table", raw: ye(e[0], `
|
|
1414
1414
|
`), header: [], align: [], rows: [] };
|
|
1415
1415
|
if (n.length === r.length) {
|
|
1416
|
-
for (let
|
|
1417
|
-
for (let
|
|
1418
|
-
for (let
|
|
1419
|
-
return
|
|
1416
|
+
for (let o of r) this.rules.other.tableAlignRight.test(o) ? l.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? l.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? l.align.push("left") : l.align.push(null);
|
|
1417
|
+
for (let o = 0; o < n.length; o++) l.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: !0, align: l.align[o] });
|
|
1418
|
+
for (let o of s) l.rows.push(Jn(o, l.header.length).map((d, c) => ({ text: d, tokens: this.lexer.inline(d), header: !1, align: l.align[c] })));
|
|
1419
|
+
return l;
|
|
1420
1420
|
}
|
|
1421
1421
|
}
|
|
1422
1422
|
lheading(t) {
|
|
1423
1423
|
let e = this.rules.block.lheading.exec(t);
|
|
1424
1424
|
if (e) {
|
|
1425
1425
|
let n = e[1].trim();
|
|
1426
|
-
return { type: "heading", raw:
|
|
1426
|
+
return { type: "heading", raw: ye(e[0], `
|
|
1427
1427
|
`), depth: e[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
@@ -1453,20 +1453,20 @@ ${p}` : p;
|
|
|
1453
1453
|
let n = e[2].trim();
|
|
1454
1454
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1455
1455
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1456
|
-
let
|
|
1457
|
-
if ((n.length -
|
|
1456
|
+
let l = ye(n.slice(0, -1), "\\");
|
|
1457
|
+
if ((n.length - l.length) % 2 === 0) return;
|
|
1458
1458
|
} else {
|
|
1459
|
-
let
|
|
1460
|
-
if (
|
|
1461
|
-
if (
|
|
1462
|
-
let
|
|
1463
|
-
e[2] = e[2].substring(0,
|
|
1459
|
+
let l = ii(e[2], "()");
|
|
1460
|
+
if (l === -2) return;
|
|
1461
|
+
if (l > -1) {
|
|
1462
|
+
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
|
|
1463
|
+
e[2] = e[2].substring(0, l), e[0] = e[0].substring(0, o).trim(), e[3] = "";
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
1466
|
let r = e[2], s = "";
|
|
1467
1467
|
if (this.options.pedantic) {
|
|
1468
|
-
let
|
|
1469
|
-
|
|
1468
|
+
let l = this.rules.other.pedanticHrefTitle.exec(r);
|
|
1469
|
+
l && (r = l[1], s = l[3]);
|
|
1470
1470
|
} else s = e[3] ? e[3].slice(1, -1) : "";
|
|
1471
1471
|
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), ts(e, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
1472
1472
|
}
|
|
@@ -1476,8 +1476,8 @@ ${p}` : p;
|
|
|
1476
1476
|
if ((n = this.rules.inline.reflink.exec(t)) || (n = this.rules.inline.nolink.exec(t))) {
|
|
1477
1477
|
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = e[r.toLowerCase()];
|
|
1478
1478
|
if (!s) {
|
|
1479
|
-
let
|
|
1480
|
-
return { type: "text", raw:
|
|
1479
|
+
let l = n[0].charAt(0);
|
|
1480
|
+
return { type: "text", raw: l, text: l };
|
|
1481
1481
|
}
|
|
1482
1482
|
return ts(n, s, n[0], this.lexer, this.rules);
|
|
1483
1483
|
}
|
|
@@ -1485,25 +1485,25 @@ ${p}` : p;
|
|
|
1485
1485
|
emStrong(t, e, n = "") {
|
|
1486
1486
|
let r = this.rules.inline.emStrongLDelim.exec(t);
|
|
1487
1487
|
if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1488
|
-
let s = [...r[0]].length - 1,
|
|
1488
|
+
let s = [...r[0]].length - 1, l, o, d = s, c = 0, b = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1489
1489
|
for (b.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = b.exec(e)) !== null; ) {
|
|
1490
|
-
if (
|
|
1491
|
-
if (
|
|
1492
|
-
|
|
1490
|
+
if (l = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !l) continue;
|
|
1491
|
+
if (o = [...l].length, r[3] || r[4]) {
|
|
1492
|
+
d += o;
|
|
1493
1493
|
continue;
|
|
1494
|
-
} else if ((r[5] || r[6]) && s % 3 && !((s +
|
|
1495
|
-
c +=
|
|
1494
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
1495
|
+
c += o;
|
|
1496
1496
|
continue;
|
|
1497
1497
|
}
|
|
1498
|
-
if (
|
|
1499
|
-
|
|
1500
|
-
let
|
|
1501
|
-
if (Math.min(s,
|
|
1502
|
-
let
|
|
1503
|
-
return { type: "em", raw:
|
|
1498
|
+
if (d -= o, d > 0) continue;
|
|
1499
|
+
o = Math.min(o, o + d + c);
|
|
1500
|
+
let u = [...r[0]][0].length, m = t.slice(0, s + r.index + u + o);
|
|
1501
|
+
if (Math.min(s, o) % 2) {
|
|
1502
|
+
let w = m.slice(1, -1);
|
|
1503
|
+
return { type: "em", raw: m, text: w, tokens: this.lexer.inlineTokens(w) };
|
|
1504
1504
|
}
|
|
1505
|
-
let
|
|
1506
|
-
return { type: "strong", raw:
|
|
1505
|
+
let f = m.slice(2, -2);
|
|
1506
|
+
return { type: "strong", raw: m, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
1507
1507
|
}
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
@@ -1521,17 +1521,17 @@ ${p}` : p;
|
|
|
1521
1521
|
del(t, e, n = "") {
|
|
1522
1522
|
let r = this.rules.inline.delLDelim.exec(t);
|
|
1523
1523
|
if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1524
|
-
let s = [...r[0]].length - 1,
|
|
1524
|
+
let s = [...r[0]].length - 1, l, o, d = s, c = this.rules.inline.delRDelim;
|
|
1525
1525
|
for (c.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = c.exec(e)) !== null; ) {
|
|
1526
|
-
if (
|
|
1526
|
+
if (l = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !l || (o = [...l].length, o !== s)) continue;
|
|
1527
1527
|
if (r[3] || r[4]) {
|
|
1528
|
-
|
|
1528
|
+
d += o;
|
|
1529
1529
|
continue;
|
|
1530
1530
|
}
|
|
1531
|
-
if (
|
|
1532
|
-
|
|
1533
|
-
let b = [...r[0]][0].length,
|
|
1534
|
-
return { type: "del", raw:
|
|
1531
|
+
if (d -= o, d > 0) continue;
|
|
1532
|
+
o = Math.min(o, o + d);
|
|
1533
|
+
let b = [...r[0]][0].length, u = t.slice(0, s + r.index + b + o), m = u.slice(s, -s);
|
|
1534
|
+
return { type: "del", raw: u, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
1537
|
}
|
|
@@ -1564,19 +1564,19 @@ ${p}` : p;
|
|
|
1564
1564
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
|
-
},
|
|
1567
|
+
}, p(He, "w"), He), Ae, he = (Ae = class {
|
|
1568
1568
|
constructor(t) {
|
|
1569
1569
|
I(this, "tokens");
|
|
1570
1570
|
I(this, "options");
|
|
1571
1571
|
I(this, "state");
|
|
1572
1572
|
I(this, "inlineQueue");
|
|
1573
1573
|
I(this, "tokenizer");
|
|
1574
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Le, this.options.tokenizer = this.options.tokenizer || new
|
|
1575
|
-
let e = { other: K, block:
|
|
1576
|
-
this.options.pedantic ? (e.block =
|
|
1574
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Le, this.options.tokenizer = this.options.tokenizer || new yt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1575
|
+
let e = { other: K, block: kt.normal, inline: it.normal };
|
|
1576
|
+
this.options.pedantic ? (e.block = kt.pedantic, e.inline = it.pedantic) : this.options.gfm && (e.block = kt.gfm, this.options.breaks ? e.inline = it.breaks : e.inline = it.gfm), this.tokenizer.rules = e;
|
|
1577
1577
|
}
|
|
1578
1578
|
static get rules() {
|
|
1579
|
-
return { block:
|
|
1579
|
+
return { block: kt, inline: it };
|
|
1580
1580
|
}
|
|
1581
1581
|
static lex(t, e) {
|
|
1582
1582
|
return new Ae(e).lex(t);
|
|
@@ -1603,21 +1603,21 @@ ${p}` : p;
|
|
|
1603
1603
|
break;
|
|
1604
1604
|
}
|
|
1605
1605
|
let s;
|
|
1606
|
-
if (this.options.extensions?.block?.some((
|
|
1606
|
+
if (this.options.extensions?.block?.some((o) => (s = o.call({ lexer: this }, t, e)) ? (t = t.substring(s.raw.length), e.push(s), !0) : !1)) continue;
|
|
1607
1607
|
if (s = this.tokenizer.space(t)) {
|
|
1608
1608
|
t = t.substring(s.raw.length);
|
|
1609
|
-
let
|
|
1610
|
-
s.raw.length === 1 &&
|
|
1609
|
+
let o = e.at(-1);
|
|
1610
|
+
s.raw.length === 1 && o !== void 0 ? o.raw += `
|
|
1611
1611
|
` : e.push(s);
|
|
1612
1612
|
continue;
|
|
1613
1613
|
}
|
|
1614
1614
|
if (s = this.tokenizer.code(t)) {
|
|
1615
1615
|
t = t.substring(s.raw.length);
|
|
1616
|
-
let
|
|
1617
|
-
|
|
1616
|
+
let o = e.at(-1);
|
|
1617
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
1618
1618
|
`) ? "" : `
|
|
1619
|
-
`) + s.raw,
|
|
1620
|
-
` + s.text, this.inlineQueue.at(-1).src =
|
|
1619
|
+
`) + s.raw, o.text += `
|
|
1620
|
+
` + s.text, this.inlineQueue.at(-1).src = o.text) : e.push(s);
|
|
1621
1621
|
continue;
|
|
1622
1622
|
}
|
|
1623
1623
|
if (s = this.tokenizer.fences(t)) {
|
|
@@ -1646,11 +1646,11 @@ ${p}` : p;
|
|
|
1646
1646
|
}
|
|
1647
1647
|
if (s = this.tokenizer.def(t)) {
|
|
1648
1648
|
t = t.substring(s.raw.length);
|
|
1649
|
-
let
|
|
1650
|
-
|
|
1649
|
+
let o = e.at(-1);
|
|
1650
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
1651
1651
|
`) ? "" : `
|
|
1652
|
-
`) + s.raw,
|
|
1653
|
-
` + s.raw, this.inlineQueue.at(-1).src =
|
|
1652
|
+
`) + s.raw, o.text += `
|
|
1653
|
+
` + s.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[s.tag] || (this.tokens.links[s.tag] = { href: s.href, title: s.title }, e.push(s));
|
|
1654
1654
|
continue;
|
|
1655
1655
|
}
|
|
1656
1656
|
if (s = this.tokenizer.table(t)) {
|
|
@@ -1661,28 +1661,28 @@ ${p}` : p;
|
|
|
1661
1661
|
t = t.substring(s.raw.length), e.push(s);
|
|
1662
1662
|
continue;
|
|
1663
1663
|
}
|
|
1664
|
-
let
|
|
1664
|
+
let l = t;
|
|
1665
1665
|
if (this.options.extensions?.startBlock) {
|
|
1666
|
-
let
|
|
1666
|
+
let o = 1 / 0, d = t.slice(1), c;
|
|
1667
1667
|
this.options.extensions.startBlock.forEach((b) => {
|
|
1668
|
-
c = b.call({ lexer: this },
|
|
1669
|
-
}),
|
|
1668
|
+
c = b.call({ lexer: this }, d), typeof c == "number" && c >= 0 && (o = Math.min(o, c));
|
|
1669
|
+
}), o < 1 / 0 && o >= 0 && (l = t.substring(0, o + 1));
|
|
1670
1670
|
}
|
|
1671
|
-
if (this.state.top && (s = this.tokenizer.paragraph(
|
|
1672
|
-
let
|
|
1673
|
-
n &&
|
|
1671
|
+
if (this.state.top && (s = this.tokenizer.paragraph(l))) {
|
|
1672
|
+
let o = e.at(-1);
|
|
1673
|
+
n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
1674
1674
|
`) ? "" : `
|
|
1675
|
-
`) + s.raw,
|
|
1676
|
-
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
1675
|
+
`) + s.raw, o.text += `
|
|
1676
|
+
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : e.push(s), n = l.length !== t.length, t = t.substring(s.raw.length);
|
|
1677
1677
|
continue;
|
|
1678
1678
|
}
|
|
1679
1679
|
if (s = this.tokenizer.text(t)) {
|
|
1680
1680
|
t = t.substring(s.raw.length);
|
|
1681
|
-
let
|
|
1682
|
-
|
|
1681
|
+
let o = e.at(-1);
|
|
1682
|
+
o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
1683
1683
|
`) ? "" : `
|
|
1684
|
-
`) + s.raw,
|
|
1685
|
-
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
1684
|
+
`) + s.raw, o.text += `
|
|
1685
|
+
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : e.push(s);
|
|
1686
1686
|
continue;
|
|
1687
1687
|
}
|
|
1688
1688
|
if (t) {
|
|
@@ -1706,16 +1706,16 @@ ${p}` : p;
|
|
|
1706
1706
|
let s;
|
|
1707
1707
|
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) s = r[2] ? r[2].length : 0, n = n.slice(0, r.index + s) + "[" + "a".repeat(r[0].length - s - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1708
1708
|
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
1709
|
-
let
|
|
1709
|
+
let l = !1, o = "", d = 1 / 0;
|
|
1710
1710
|
for (; t; ) {
|
|
1711
|
-
if (t.length <
|
|
1711
|
+
if (t.length < d) d = t.length;
|
|
1712
1712
|
else {
|
|
1713
1713
|
this.infiniteLoopError(t.charCodeAt(0));
|
|
1714
1714
|
break;
|
|
1715
1715
|
}
|
|
1716
|
-
|
|
1716
|
+
l || (o = ""), l = !1;
|
|
1717
1717
|
let c;
|
|
1718
|
-
if (this.options.extensions?.inline?.some((
|
|
1718
|
+
if (this.options.extensions?.inline?.some((u) => (c = u.call({ lexer: this }, t, e)) ? (t = t.substring(c.raw.length), e.push(c), !0) : !1)) continue;
|
|
1719
1719
|
if (c = this.tokenizer.escape(t)) {
|
|
1720
1720
|
t = t.substring(c.raw.length), e.push(c);
|
|
1721
1721
|
continue;
|
|
@@ -1730,11 +1730,11 @@ ${p}` : p;
|
|
|
1730
1730
|
}
|
|
1731
1731
|
if (c = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1732
1732
|
t = t.substring(c.raw.length);
|
|
1733
|
-
let
|
|
1734
|
-
c.type === "text" &&
|
|
1733
|
+
let u = e.at(-1);
|
|
1734
|
+
c.type === "text" && u?.type === "text" ? (u.raw += c.raw, u.text += c.text) : e.push(c);
|
|
1735
1735
|
continue;
|
|
1736
1736
|
}
|
|
1737
|
-
if (c = this.tokenizer.emStrong(t, n,
|
|
1737
|
+
if (c = this.tokenizer.emStrong(t, n, o)) {
|
|
1738
1738
|
t = t.substring(c.raw.length), e.push(c);
|
|
1739
1739
|
continue;
|
|
1740
1740
|
}
|
|
@@ -1746,7 +1746,7 @@ ${p}` : p;
|
|
|
1746
1746
|
t = t.substring(c.raw.length), e.push(c);
|
|
1747
1747
|
continue;
|
|
1748
1748
|
}
|
|
1749
|
-
if (c = this.tokenizer.del(t, n,
|
|
1749
|
+
if (c = this.tokenizer.del(t, n, o)) {
|
|
1750
1750
|
t = t.substring(c.raw.length), e.push(c);
|
|
1751
1751
|
continue;
|
|
1752
1752
|
}
|
|
@@ -1760,15 +1760,15 @@ ${p}` : p;
|
|
|
1760
1760
|
}
|
|
1761
1761
|
let b = t;
|
|
1762
1762
|
if (this.options.extensions?.startInline) {
|
|
1763
|
-
let
|
|
1764
|
-
this.options.extensions.startInline.forEach((
|
|
1765
|
-
|
|
1766
|
-
}),
|
|
1763
|
+
let u = 1 / 0, m = t.slice(1), f;
|
|
1764
|
+
this.options.extensions.startInline.forEach((w) => {
|
|
1765
|
+
f = w.call({ lexer: this }, m), typeof f == "number" && f >= 0 && (u = Math.min(u, f));
|
|
1766
|
+
}), u < 1 / 0 && u >= 0 && (b = t.substring(0, u + 1));
|
|
1767
1767
|
}
|
|
1768
1768
|
if (c = this.tokenizer.inlineText(b)) {
|
|
1769
|
-
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (
|
|
1770
|
-
let
|
|
1771
|
-
|
|
1769
|
+
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), l = !0;
|
|
1770
|
+
let u = e.at(-1);
|
|
1771
|
+
u?.type === "text" ? (u.raw += c.raw, u.text += c.text) : e.push(c);
|
|
1772
1772
|
continue;
|
|
1773
1773
|
}
|
|
1774
1774
|
if (t) {
|
|
@@ -1783,7 +1783,7 @@ ${p}` : p;
|
|
|
1783
1783
|
if (this.options.silent) console.error(e);
|
|
1784
1784
|
else throw new Error(e);
|
|
1785
1785
|
}
|
|
1786
|
-
},
|
|
1786
|
+
}, p(Ae, "l"), Ae), Ge, Tt = (Ge = class {
|
|
1787
1787
|
constructor(t) {
|
|
1788
1788
|
I(this, "options");
|
|
1789
1789
|
I(this, "parser");
|
|
@@ -1795,8 +1795,8 @@ ${p}` : p;
|
|
|
1795
1795
|
code({ text: t, lang: e, escaped: n }) {
|
|
1796
1796
|
let r = (e || "").match(K.notSpaceStart)?.[0], s = t.replace(K.endingNewline, "") + `
|
|
1797
1797
|
`;
|
|
1798
|
-
return r ? '<pre><code class="language-' +
|
|
1799
|
-
` : "<pre><code>" + (n ? s :
|
|
1798
|
+
return r ? '<pre><code class="language-' + me(r) + '">' + (n ? s : me(s, !0)) + `</code></pre>
|
|
1799
|
+
` : "<pre><code>" + (n ? s : me(s, !0)) + `</code></pre>
|
|
1800
1800
|
`;
|
|
1801
1801
|
}
|
|
1802
1802
|
blockquote({ tokens: t }) {
|
|
@@ -1820,12 +1820,12 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1820
1820
|
}
|
|
1821
1821
|
list(t) {
|
|
1822
1822
|
let e = t.ordered, n = t.start, r = "";
|
|
1823
|
-
for (let
|
|
1824
|
-
let
|
|
1825
|
-
r += this.listitem(
|
|
1823
|
+
for (let o = 0; o < t.items.length; o++) {
|
|
1824
|
+
let d = t.items[o];
|
|
1825
|
+
r += this.listitem(d);
|
|
1826
1826
|
}
|
|
1827
|
-
let s = e ? "ol" : "ul",
|
|
1828
|
-
return "<" + s +
|
|
1827
|
+
let s = e ? "ol" : "ul", l = e && n !== 1 ? ' start="' + n + '"' : "";
|
|
1828
|
+
return "<" + s + l + `>
|
|
1829
1829
|
` + r + "</" + s + `>
|
|
1830
1830
|
`;
|
|
1831
1831
|
}
|
|
@@ -1846,9 +1846,9 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1846
1846
|
e += this.tablerow({ text: n });
|
|
1847
1847
|
let r = "";
|
|
1848
1848
|
for (let s = 0; s < t.rows.length; s++) {
|
|
1849
|
-
let
|
|
1849
|
+
let l = t.rows[s];
|
|
1850
1850
|
n = "";
|
|
1851
|
-
for (let
|
|
1851
|
+
for (let o = 0; o < l.length; o++) n += this.tablecell(l[o]);
|
|
1852
1852
|
r += this.tablerow({ text: n });
|
|
1853
1853
|
}
|
|
1854
1854
|
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
@@ -1874,7 +1874,7 @@ ${t}</tr>
|
|
|
1874
1874
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1875
1875
|
}
|
|
1876
1876
|
codespan({ text: t }) {
|
|
1877
|
-
return `<code>${
|
|
1877
|
+
return `<code>${me(t, !0)}</code>`;
|
|
1878
1878
|
}
|
|
1879
1879
|
br(t) {
|
|
1880
1880
|
return "<br>";
|
|
@@ -1886,21 +1886,21 @@ ${t}</tr>
|
|
|
1886
1886
|
let r = this.parser.parseInline(n), s = Qn(t);
|
|
1887
1887
|
if (s === null) return r;
|
|
1888
1888
|
t = s;
|
|
1889
|
-
let
|
|
1890
|
-
return e && (
|
|
1889
|
+
let l = '<a href="' + t + '"';
|
|
1890
|
+
return e && (l += ' title="' + me(e) + '"'), l += ">" + r + "</a>", l;
|
|
1891
1891
|
}
|
|
1892
1892
|
image({ href: t, title: e, text: n, tokens: r }) {
|
|
1893
1893
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1894
1894
|
let s = Qn(t);
|
|
1895
|
-
if (s === null) return
|
|
1895
|
+
if (s === null) return me(n);
|
|
1896
1896
|
t = s;
|
|
1897
|
-
let
|
|
1898
|
-
return e && (
|
|
1897
|
+
let l = `<img src="${t}" alt="${me(n)}"`;
|
|
1898
|
+
return e && (l += ` title="${me(e)}"`), l += ">", l;
|
|
1899
1899
|
}
|
|
1900
1900
|
text(t) {
|
|
1901
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
1901
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : me(t.text);
|
|
1902
1902
|
}
|
|
1903
|
-
},
|
|
1903
|
+
}, p(Ge, "y"), Ge), je, un = (je = class {
|
|
1904
1904
|
strong({ text: t }) {
|
|
1905
1905
|
return t;
|
|
1906
1906
|
}
|
|
@@ -1931,12 +1931,12 @@ ${t}</tr>
|
|
|
1931
1931
|
checkbox({ raw: t }) {
|
|
1932
1932
|
return t;
|
|
1933
1933
|
}
|
|
1934
|
-
},
|
|
1934
|
+
}, p(je, "L"), je), Ee, pe = (Ee = class {
|
|
1935
1935
|
constructor(t) {
|
|
1936
1936
|
I(this, "options");
|
|
1937
1937
|
I(this, "renderer");
|
|
1938
1938
|
I(this, "textRenderer");
|
|
1939
|
-
this.options = t || Le, this.options.renderer = this.options.renderer || new
|
|
1939
|
+
this.options = t || Le, this.options.renderer = this.options.renderer || new Tt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new un();
|
|
1940
1940
|
}
|
|
1941
1941
|
static parse(t, e) {
|
|
1942
1942
|
return new Ee(e).parse(t);
|
|
@@ -1950,9 +1950,9 @@ ${t}</tr>
|
|
|
1950
1950
|
for (let n = 0; n < t.length; n++) {
|
|
1951
1951
|
let r = t[n];
|
|
1952
1952
|
if (this.options.extensions?.renderers?.[r.type]) {
|
|
1953
|
-
let
|
|
1954
|
-
if (
|
|
1955
|
-
e +=
|
|
1953
|
+
let l = r, o = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1954
|
+
if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(l.type)) {
|
|
1955
|
+
e += o || "";
|
|
1956
1956
|
continue;
|
|
1957
1957
|
}
|
|
1958
1958
|
}
|
|
@@ -2007,9 +2007,9 @@ ${t}</tr>
|
|
|
2007
2007
|
break;
|
|
2008
2008
|
}
|
|
2009
2009
|
default: {
|
|
2010
|
-
let
|
|
2011
|
-
if (this.options.silent) return console.error(
|
|
2012
|
-
throw new Error(
|
|
2010
|
+
let l = 'Token with "' + s.type + '" type was not found.';
|
|
2011
|
+
if (this.options.silent) return console.error(l), "";
|
|
2012
|
+
throw new Error(l);
|
|
2013
2013
|
}
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
@@ -2021,68 +2021,68 @@ ${t}</tr>
|
|
|
2021
2021
|
for (let r = 0; r < t.length; r++) {
|
|
2022
2022
|
let s = t[r];
|
|
2023
2023
|
if (this.options.extensions?.renderers?.[s.type]) {
|
|
2024
|
-
let
|
|
2025
|
-
if (
|
|
2026
|
-
n +=
|
|
2024
|
+
let o = this.options.extensions.renderers[s.type].call({ parser: this }, s);
|
|
2025
|
+
if (o !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(s.type)) {
|
|
2026
|
+
n += o || "";
|
|
2027
2027
|
continue;
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
|
-
let
|
|
2031
|
-
switch (
|
|
2030
|
+
let l = s;
|
|
2031
|
+
switch (l.type) {
|
|
2032
2032
|
case "escape": {
|
|
2033
|
-
n += e.text(
|
|
2033
|
+
n += e.text(l);
|
|
2034
2034
|
break;
|
|
2035
2035
|
}
|
|
2036
2036
|
case "html": {
|
|
2037
|
-
n += e.html(
|
|
2037
|
+
n += e.html(l);
|
|
2038
2038
|
break;
|
|
2039
2039
|
}
|
|
2040
2040
|
case "link": {
|
|
2041
|
-
n += e.link(
|
|
2041
|
+
n += e.link(l);
|
|
2042
2042
|
break;
|
|
2043
2043
|
}
|
|
2044
2044
|
case "image": {
|
|
2045
|
-
n += e.image(
|
|
2045
|
+
n += e.image(l);
|
|
2046
2046
|
break;
|
|
2047
2047
|
}
|
|
2048
2048
|
case "checkbox": {
|
|
2049
|
-
n += e.checkbox(
|
|
2049
|
+
n += e.checkbox(l);
|
|
2050
2050
|
break;
|
|
2051
2051
|
}
|
|
2052
2052
|
case "strong": {
|
|
2053
|
-
n += e.strong(
|
|
2053
|
+
n += e.strong(l);
|
|
2054
2054
|
break;
|
|
2055
2055
|
}
|
|
2056
2056
|
case "em": {
|
|
2057
|
-
n += e.em(
|
|
2057
|
+
n += e.em(l);
|
|
2058
2058
|
break;
|
|
2059
2059
|
}
|
|
2060
2060
|
case "codespan": {
|
|
2061
|
-
n += e.codespan(
|
|
2061
|
+
n += e.codespan(l);
|
|
2062
2062
|
break;
|
|
2063
2063
|
}
|
|
2064
2064
|
case "br": {
|
|
2065
|
-
n += e.br(
|
|
2065
|
+
n += e.br(l);
|
|
2066
2066
|
break;
|
|
2067
2067
|
}
|
|
2068
2068
|
case "del": {
|
|
2069
|
-
n += e.del(
|
|
2069
|
+
n += e.del(l);
|
|
2070
2070
|
break;
|
|
2071
2071
|
}
|
|
2072
2072
|
case "text": {
|
|
2073
|
-
n += e.text(
|
|
2073
|
+
n += e.text(l);
|
|
2074
2074
|
break;
|
|
2075
2075
|
}
|
|
2076
2076
|
default: {
|
|
2077
|
-
let
|
|
2078
|
-
if (this.options.silent) return console.error(
|
|
2079
|
-
throw new Error(
|
|
2077
|
+
let o = 'Token with "' + l.type + '" type was not found.';
|
|
2078
|
+
if (this.options.silent) return console.error(o), "";
|
|
2079
|
+
throw new Error(o);
|
|
2080
2080
|
}
|
|
2081
2081
|
}
|
|
2082
2082
|
}
|
|
2083
2083
|
return n;
|
|
2084
2084
|
}
|
|
2085
|
-
},
|
|
2085
|
+
}, p(Ee, "l"), Ee), Se, ot = (Se = class {
|
|
2086
2086
|
constructor(t) {
|
|
2087
2087
|
I(this, "options");
|
|
2088
2088
|
I(this, "block");
|
|
@@ -2101,22 +2101,22 @@ ${t}</tr>
|
|
|
2101
2101
|
return t;
|
|
2102
2102
|
}
|
|
2103
2103
|
provideLexer(t = this.block) {
|
|
2104
|
-
return t ?
|
|
2104
|
+
return t ? he.lex : he.lexInline;
|
|
2105
2105
|
}
|
|
2106
2106
|
provideParser(t = this.block) {
|
|
2107
|
-
return t ?
|
|
2107
|
+
return t ? pe.parse : pe.parseInline;
|
|
2108
2108
|
}
|
|
2109
|
-
},
|
|
2109
|
+
}, p(Se, "P"), I(Se, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Se, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Se), We, oi = (We = class {
|
|
2110
2110
|
constructor(...t) {
|
|
2111
|
-
I(this, "defaults",
|
|
2111
|
+
I(this, "defaults", tn());
|
|
2112
2112
|
I(this, "options", this.setOptions);
|
|
2113
2113
|
I(this, "parse", this.parseMarkdown(!0));
|
|
2114
2114
|
I(this, "parseInline", this.parseMarkdown(!1));
|
|
2115
|
-
I(this, "Parser",
|
|
2116
|
-
I(this, "Renderer",
|
|
2117
|
-
I(this, "TextRenderer",
|
|
2118
|
-
I(this, "Lexer",
|
|
2119
|
-
I(this, "Tokenizer",
|
|
2115
|
+
I(this, "Parser", pe);
|
|
2116
|
+
I(this, "Renderer", Tt);
|
|
2117
|
+
I(this, "TextRenderer", un);
|
|
2118
|
+
I(this, "Lexer", he);
|
|
2119
|
+
I(this, "Tokenizer", yt);
|
|
2120
2120
|
I(this, "Hooks", ot);
|
|
2121
2121
|
this.use(...t);
|
|
2122
2122
|
}
|
|
@@ -2125,8 +2125,8 @@ ${t}</tr>
|
|
|
2125
2125
|
for (let r of t) switch (n = n.concat(e.call(this, r)), r.type) {
|
|
2126
2126
|
case "table": {
|
|
2127
2127
|
let s = r;
|
|
2128
|
-
for (let
|
|
2129
|
-
for (let
|
|
2128
|
+
for (let l of s.header) n = n.concat(this.walkTokens(l.tokens, e));
|
|
2129
|
+
for (let l of s.rows) for (let o of l) n = n.concat(this.walkTokens(o.tokens, e));
|
|
2130
2130
|
break;
|
|
2131
2131
|
}
|
|
2132
2132
|
case "list": {
|
|
@@ -2136,9 +2136,9 @@ ${t}</tr>
|
|
|
2136
2136
|
}
|
|
2137
2137
|
default: {
|
|
2138
2138
|
let s = r;
|
|
2139
|
-
this.defaults.extensions?.childTokens?.[s.type] ? this.defaults.extensions.childTokens[s.type].forEach((
|
|
2140
|
-
let
|
|
2141
|
-
n = n.concat(this.walkTokens(
|
|
2139
|
+
this.defaults.extensions?.childTokens?.[s.type] ? this.defaults.extensions.childTokens[s.type].forEach((l) => {
|
|
2140
|
+
let o = s[l].flat(1 / 0);
|
|
2141
|
+
n = n.concat(this.walkTokens(o, e));
|
|
2142
2142
|
}) : s.tokens && (n = n.concat(this.walkTokens(s.tokens, e)));
|
|
2143
2143
|
}
|
|
2144
2144
|
}
|
|
@@ -2151,73 +2151,73 @@ ${t}</tr>
|
|
|
2151
2151
|
if (r.async = this.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((s) => {
|
|
2152
2152
|
if (!s.name) throw new Error("extension name required");
|
|
2153
2153
|
if ("renderer" in s) {
|
|
2154
|
-
let
|
|
2155
|
-
|
|
2156
|
-
let
|
|
2157
|
-
return
|
|
2154
|
+
let l = e.renderers[s.name];
|
|
2155
|
+
l ? e.renderers[s.name] = function(...o) {
|
|
2156
|
+
let d = s.renderer.apply(this, o);
|
|
2157
|
+
return d === !1 && (d = l.apply(this, o)), d;
|
|
2158
2158
|
} : e.renderers[s.name] = s.renderer;
|
|
2159
2159
|
}
|
|
2160
2160
|
if ("tokenizer" in s) {
|
|
2161
2161
|
if (!s.level || s.level !== "block" && s.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
2162
|
-
let
|
|
2163
|
-
|
|
2162
|
+
let l = e[s.level];
|
|
2163
|
+
l ? l.unshift(s.tokenizer) : e[s.level] = [s.tokenizer], s.start && (s.level === "block" ? e.startBlock ? e.startBlock.push(s.start) : e.startBlock = [s.start] : s.level === "inline" && (e.startInline ? e.startInline.push(s.start) : e.startInline = [s.start]));
|
|
2164
2164
|
}
|
|
2165
2165
|
"childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
|
|
2166
2166
|
}), r.extensions = e), n.renderer) {
|
|
2167
|
-
let s = this.defaults.renderer || new
|
|
2168
|
-
for (let
|
|
2169
|
-
if (!(
|
|
2170
|
-
if (["options", "parser"].includes(
|
|
2171
|
-
let
|
|
2172
|
-
s[
|
|
2173
|
-
let
|
|
2174
|
-
return
|
|
2167
|
+
let s = this.defaults.renderer || new Tt(this.defaults);
|
|
2168
|
+
for (let l in n.renderer) {
|
|
2169
|
+
if (!(l in s)) throw new Error(`renderer '${l}' does not exist`);
|
|
2170
|
+
if (["options", "parser"].includes(l)) continue;
|
|
2171
|
+
let o = l, d = n.renderer[o], c = s[o];
|
|
2172
|
+
s[o] = (...b) => {
|
|
2173
|
+
let u = d.apply(s, b);
|
|
2174
|
+
return u === !1 && (u = c.apply(s, b)), u || "";
|
|
2175
2175
|
};
|
|
2176
2176
|
}
|
|
2177
2177
|
r.renderer = s;
|
|
2178
2178
|
}
|
|
2179
2179
|
if (n.tokenizer) {
|
|
2180
|
-
let s = this.defaults.tokenizer || new
|
|
2181
|
-
for (let
|
|
2182
|
-
if (!(
|
|
2183
|
-
if (["options", "rules", "lexer"].includes(
|
|
2184
|
-
let
|
|
2185
|
-
s[
|
|
2186
|
-
let
|
|
2187
|
-
return
|
|
2180
|
+
let s = this.defaults.tokenizer || new yt(this.defaults);
|
|
2181
|
+
for (let l in n.tokenizer) {
|
|
2182
|
+
if (!(l in s)) throw new Error(`tokenizer '${l}' does not exist`);
|
|
2183
|
+
if (["options", "rules", "lexer"].includes(l)) continue;
|
|
2184
|
+
let o = l, d = n.tokenizer[o], c = s[o];
|
|
2185
|
+
s[o] = (...b) => {
|
|
2186
|
+
let u = d.apply(s, b);
|
|
2187
|
+
return u === !1 && (u = c.apply(s, b)), u;
|
|
2188
2188
|
};
|
|
2189
2189
|
}
|
|
2190
2190
|
r.tokenizer = s;
|
|
2191
2191
|
}
|
|
2192
2192
|
if (n.hooks) {
|
|
2193
2193
|
let s = this.defaults.hooks || new ot();
|
|
2194
|
-
for (let
|
|
2195
|
-
if (!(
|
|
2196
|
-
if (["options", "block"].includes(
|
|
2197
|
-
let
|
|
2198
|
-
ot.passThroughHooks.has(
|
|
2199
|
-
if (this.defaults.async && ot.passThroughHooksRespectAsync.has(
|
|
2200
|
-
let
|
|
2201
|
-
return c.call(s,
|
|
2194
|
+
for (let l in n.hooks) {
|
|
2195
|
+
if (!(l in s)) throw new Error(`hook '${l}' does not exist`);
|
|
2196
|
+
if (["options", "block"].includes(l)) continue;
|
|
2197
|
+
let o = l, d = n.hooks[o], c = s[o];
|
|
2198
|
+
ot.passThroughHooks.has(l) ? s[o] = (b) => {
|
|
2199
|
+
if (this.defaults.async && ot.passThroughHooksRespectAsync.has(l)) return (async () => {
|
|
2200
|
+
let m = await d.call(s, b);
|
|
2201
|
+
return c.call(s, m);
|
|
2202
2202
|
})();
|
|
2203
|
-
let
|
|
2204
|
-
return c.call(s,
|
|
2205
|
-
} : s[
|
|
2203
|
+
let u = d.call(s, b);
|
|
2204
|
+
return c.call(s, u);
|
|
2205
|
+
} : s[o] = (...b) => {
|
|
2206
2206
|
if (this.defaults.async) return (async () => {
|
|
2207
|
-
let
|
|
2208
|
-
return
|
|
2207
|
+
let m = await d.apply(s, b);
|
|
2208
|
+
return m === !1 && (m = await c.apply(s, b)), m;
|
|
2209
2209
|
})();
|
|
2210
|
-
let
|
|
2211
|
-
return
|
|
2210
|
+
let u = d.apply(s, b);
|
|
2211
|
+
return u === !1 && (u = c.apply(s, b)), u;
|
|
2212
2212
|
};
|
|
2213
2213
|
}
|
|
2214
2214
|
r.hooks = s;
|
|
2215
2215
|
}
|
|
2216
2216
|
if (n.walkTokens) {
|
|
2217
|
-
let s = this.defaults.walkTokens,
|
|
2218
|
-
r.walkTokens = function(
|
|
2219
|
-
let
|
|
2220
|
-
return
|
|
2217
|
+
let s = this.defaults.walkTokens, l = n.walkTokens;
|
|
2218
|
+
r.walkTokens = function(o) {
|
|
2219
|
+
let d = [];
|
|
2220
|
+
return d.push(l.call(this, o)), s && (d = d.concat(s.call(this, o))), d;
|
|
2221
2221
|
};
|
|
2222
2222
|
}
|
|
2223
2223
|
this.defaults = { ...this.defaults, ...r };
|
|
@@ -2227,31 +2227,31 @@ ${t}</tr>
|
|
|
2227
2227
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
2228
2228
|
}
|
|
2229
2229
|
lexer(t, e) {
|
|
2230
|
-
return
|
|
2230
|
+
return he.lex(t, e ?? this.defaults);
|
|
2231
2231
|
}
|
|
2232
2232
|
parser(t, e) {
|
|
2233
|
-
return
|
|
2233
|
+
return pe.parse(t, e ?? this.defaults);
|
|
2234
2234
|
}
|
|
2235
2235
|
parseMarkdown(t) {
|
|
2236
2236
|
return (e, n) => {
|
|
2237
|
-
let r = { ...n }, s = { ...this.defaults, ...r },
|
|
2238
|
-
if (this.defaults.async === !0 && r.async === !1) return
|
|
2239
|
-
if (typeof e > "u" || e === null) return
|
|
2240
|
-
if (typeof e != "string") return
|
|
2237
|
+
let r = { ...n }, s = { ...this.defaults, ...r }, l = this.onError(!!s.silent, !!s.async);
|
|
2238
|
+
if (this.defaults.async === !0 && r.async === !1) return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
2239
|
+
if (typeof e > "u" || e === null) return l(new Error("marked(): input parameter is undefined or null"));
|
|
2240
|
+
if (typeof e != "string") return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
2241
2241
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = t), s.async) return (async () => {
|
|
2242
|
-
let
|
|
2242
|
+
let o = s.hooks ? await s.hooks.preprocess(e) : e, d = await (s.hooks ? await s.hooks.provideLexer(t) : t ? he.lex : he.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(d) : d;
|
|
2243
2243
|
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
2244
|
-
let b = await (s.hooks ? await s.hooks.provideParser(t) : t ?
|
|
2244
|
+
let b = await (s.hooks ? await s.hooks.provideParser(t) : t ? pe.parse : pe.parseInline)(c, s);
|
|
2245
2245
|
return s.hooks ? await s.hooks.postprocess(b) : b;
|
|
2246
|
-
})().catch(
|
|
2246
|
+
})().catch(l);
|
|
2247
2247
|
try {
|
|
2248
2248
|
s.hooks && (e = s.hooks.preprocess(e));
|
|
2249
|
-
let
|
|
2250
|
-
s.hooks && (
|
|
2251
|
-
let
|
|
2252
|
-
return s.hooks && (
|
|
2253
|
-
} catch (
|
|
2254
|
-
return o
|
|
2249
|
+
let o = (s.hooks ? s.hooks.provideLexer(t) : t ? he.lex : he.lexInline)(e, s);
|
|
2250
|
+
s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
|
|
2251
|
+
let d = (s.hooks ? s.hooks.provideParser(t) : t ? pe.parse : pe.parseInline)(o, s);
|
|
2252
|
+
return s.hooks && (d = s.hooks.postprocess(d)), d;
|
|
2253
|
+
} catch (o) {
|
|
2254
|
+
return l(o);
|
|
2255
2255
|
}
|
|
2256
2256
|
};
|
|
2257
2257
|
}
|
|
@@ -2259,37 +2259,37 @@ ${t}</tr>
|
|
|
2259
2259
|
return (n) => {
|
|
2260
2260
|
if (n.message += `
|
|
2261
2261
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
2262
|
-
let r = "<p>An error occurred:</p><pre>" +
|
|
2262
|
+
let r = "<p>An error occurred:</p><pre>" + me(n.message + "", !0) + "</pre>";
|
|
2263
2263
|
return e ? Promise.resolve(r) : r;
|
|
2264
2264
|
}
|
|
2265
2265
|
if (e) return Promise.reject(n);
|
|
2266
2266
|
throw n;
|
|
2267
2267
|
};
|
|
2268
2268
|
}
|
|
2269
|
-
},
|
|
2269
|
+
}, p(We, "D"), We), Me = new oi();
|
|
2270
2270
|
function L(a, t) {
|
|
2271
|
-
return
|
|
2271
|
+
return Me.parse(a, t);
|
|
2272
2272
|
}
|
|
2273
|
-
|
|
2273
|
+
p(L, "g");
|
|
2274
2274
|
L.options = L.setOptions = function(a) {
|
|
2275
|
-
return
|
|
2275
|
+
return Me.setOptions(a), L.defaults = Me.defaults, ps(L.defaults), L;
|
|
2276
2276
|
};
|
|
2277
|
-
L.getDefaults =
|
|
2277
|
+
L.getDefaults = tn;
|
|
2278
2278
|
L.defaults = Le;
|
|
2279
2279
|
L.use = function(...a) {
|
|
2280
|
-
return
|
|
2280
|
+
return Me.use(...a), L.defaults = Me.defaults, ps(L.defaults), L;
|
|
2281
2281
|
};
|
|
2282
2282
|
L.walkTokens = function(a, t) {
|
|
2283
|
-
return
|
|
2283
|
+
return Me.walkTokens(a, t);
|
|
2284
2284
|
};
|
|
2285
|
-
L.parseInline =
|
|
2286
|
-
L.Parser =
|
|
2287
|
-
L.parser =
|
|
2288
|
-
L.Renderer =
|
|
2289
|
-
L.TextRenderer =
|
|
2290
|
-
L.Lexer =
|
|
2291
|
-
L.lexer =
|
|
2292
|
-
L.Tokenizer =
|
|
2285
|
+
L.parseInline = Me.parseInline;
|
|
2286
|
+
L.Parser = pe;
|
|
2287
|
+
L.parser = pe.parse;
|
|
2288
|
+
L.Renderer = Tt;
|
|
2289
|
+
L.TextRenderer = un;
|
|
2290
|
+
L.Lexer = he;
|
|
2291
|
+
L.lexer = he.lex;
|
|
2292
|
+
L.Tokenizer = yt;
|
|
2293
2293
|
L.Hooks = ot;
|
|
2294
2294
|
L.parse = L;
|
|
2295
2295
|
L.options;
|
|
@@ -2297,42 +2297,129 @@ L.setOptions;
|
|
|
2297
2297
|
L.use;
|
|
2298
2298
|
L.walkTokens;
|
|
2299
2299
|
L.parseInline;
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
const
|
|
2300
|
+
pe.parse;
|
|
2301
|
+
he.lex;
|
|
2302
|
+
const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
2303
|
+
__name: "ChatRichText",
|
|
2304
|
+
props: {
|
|
2305
|
+
text: {},
|
|
2306
|
+
inverted: { type: Boolean },
|
|
2307
|
+
streaming: { type: Boolean }
|
|
2308
|
+
},
|
|
2309
|
+
setup(a) {
|
|
2310
|
+
const t = a, e = rs(t.text);
|
|
2311
|
+
let n;
|
|
2312
|
+
qe(
|
|
2313
|
+
[() => t.text, () => t.streaming],
|
|
2314
|
+
([l, o]) => {
|
|
2315
|
+
if (!o) {
|
|
2316
|
+
n !== void 0 && (cancelAnimationFrame(n), n = void 0), e.value = l;
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
n === void 0 && (n = requestAnimationFrame(() => {
|
|
2320
|
+
n = void 0, e.value = t.text;
|
|
2321
|
+
}));
|
|
2322
|
+
}
|
|
2323
|
+
), is(() => {
|
|
2324
|
+
n !== void 0 && cancelAnimationFrame(n);
|
|
2325
|
+
});
|
|
2326
|
+
const r = new L.Renderer();
|
|
2327
|
+
r.link = ({ href: l, text: o }) => {
|
|
2328
|
+
let d = !1;
|
|
2329
|
+
if (typeof window < "u")
|
|
2330
|
+
try {
|
|
2331
|
+
d = new URL(l, window.location.href).origin === window.location.origin;
|
|
2332
|
+
} catch {
|
|
2333
|
+
d = !1;
|
|
2334
|
+
}
|
|
2335
|
+
return d ? `<a href="${l}">${o}</a>` : `<a href="${l}" target="_blank" rel="noopener noreferrer">${o}</a>`;
|
|
2336
|
+
}, L.setOptions({ breaks: !0, gfm: !0, renderer: r });
|
|
2337
|
+
const s = $(() => {
|
|
2338
|
+
const l = e.value;
|
|
2339
|
+
if (!l) return "";
|
|
2340
|
+
const o = L.parse(l, { async: !1 });
|
|
2341
|
+
return vr.sanitize(o, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2342
|
+
});
|
|
2343
|
+
return (l, o) => (y(), T("div", {
|
|
2344
|
+
class: E(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed", a.inverted ? "chat-msg-prose-invert" : ""]),
|
|
2345
|
+
innerHTML: s.value
|
|
2346
|
+
}, null, 10, ci));
|
|
2347
|
+
}
|
|
2348
|
+
}), hi = 80, pi = /* @__PURE__ */ ke({
|
|
2349
|
+
__name: "ChatScroller",
|
|
2350
|
+
setup(a, { expose: t }) {
|
|
2351
|
+
const e = Z(), n = Z();
|
|
2352
|
+
let r = !0, s;
|
|
2353
|
+
function l() {
|
|
2354
|
+
const c = e.value;
|
|
2355
|
+
c && (c.scrollTop = c.scrollHeight);
|
|
2356
|
+
}
|
|
2357
|
+
p(l, "scrollToBottom");
|
|
2358
|
+
function o() {
|
|
2359
|
+
const c = e.value;
|
|
2360
|
+
c && (r = c.scrollHeight - c.scrollTop - c.clientHeight <= hi);
|
|
2361
|
+
}
|
|
2362
|
+
p(o, "onScroll");
|
|
2363
|
+
function d() {
|
|
2364
|
+
r = !0, l();
|
|
2365
|
+
}
|
|
2366
|
+
return p(d, "pin"), t({ pin: d }), St(() => {
|
|
2367
|
+
requestAnimationFrame(() => {
|
|
2368
|
+
l(), requestAnimationFrame(l);
|
|
2369
|
+
}), n.value && (s = new ResizeObserver(() => {
|
|
2370
|
+
r && l();
|
|
2371
|
+
}), s.observe(n.value));
|
|
2372
|
+
}), is(() => {
|
|
2373
|
+
s?.disconnect();
|
|
2374
|
+
}), (c, b) => (y(), T("div", {
|
|
2375
|
+
ref_key: "viewport",
|
|
2376
|
+
ref: e,
|
|
2377
|
+
class: "overflow-y-auto overflow-x-hidden min-h-0 [overflow-anchor:none] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
2378
|
+
onScrollPassive: o
|
|
2379
|
+
}, [
|
|
2380
|
+
v("div", {
|
|
2381
|
+
ref_key: "content",
|
|
2382
|
+
ref: n
|
|
2383
|
+
}, [
|
|
2384
|
+
en(c.$slots, "default")
|
|
2385
|
+
], 512)
|
|
2386
|
+
], 544));
|
|
2387
|
+
}
|
|
2388
|
+
}), di = { class: "@container/chat flex flex-col h-full relative" }, fi = {
|
|
2303
2389
|
key: 0,
|
|
2304
2390
|
class: "pb-4"
|
|
2305
|
-
},
|
|
2391
|
+
}, gi = { class: "pt-4 pb-[120px] px-3 space-y-1" }, mi = {
|
|
2306
2392
|
key: 0,
|
|
2307
2393
|
class: "flex flex-col items-center justify-center px-4 min-h-full"
|
|
2308
|
-
},
|
|
2394
|
+
}, bi = { class: "relative mb-4 size-20 @sm/chat:size-24" }, xi = ["src", "alt"], ki = {
|
|
2309
2395
|
key: 0,
|
|
2310
2396
|
class: "mt-5 flex flex-col items-stretch gap-2 w-full max-w-xs"
|
|
2311
|
-
},
|
|
2397
|
+
}, wi = ["onClick"], vi = ["title"], yi = {
|
|
2312
2398
|
key: 1,
|
|
2313
2399
|
class: "flex justify-end px-2 pb-2"
|
|
2314
|
-
},
|
|
2400
|
+
}, Ti = {
|
|
2315
2401
|
key: 0,
|
|
2316
2402
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2317
|
-
},
|
|
2403
|
+
}, Si = ["data-issue-code", "data-issue-bucket"], Ai = { class: "flex flex-col gap-1 min-w-0" }, Ei = ["href"], _i = ["data-test"], Ri = {
|
|
2318
2404
|
key: 0,
|
|
2319
2405
|
class: "flex-shrink-0 size-7 @sm/chat:size-8"
|
|
2320
|
-
},
|
|
2406
|
+
}, Ci = ["src", "alt"], Ii = ["src", "alt"], Di = ["src"], Mi = ["href"], Li = {
|
|
2321
2407
|
key: 2,
|
|
2408
|
+
"data-test": "messaging-thinking-indicator",
|
|
2322
2409
|
class: "flex gap-2 justify-start items-center mb-4"
|
|
2323
|
-
},
|
|
2410
|
+
}, Oi = ["src", "alt"], zi = {
|
|
2324
2411
|
key: 0,
|
|
2325
2412
|
class: "flex items-center gap-2 px-2 pb-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
2326
|
-
},
|
|
2413
|
+
}, Pi = ["src", "alt"], Ni = { class: "max-w-20 truncate" }, $i = ["onClick"], Ui = {
|
|
2327
2414
|
key: 0,
|
|
2328
2415
|
class: "shrink-0 flex items-center justify-center size-14"
|
|
2329
|
-
},
|
|
2416
|
+
}, Bi = ["disabled"], Fi = {
|
|
2330
2417
|
key: 0,
|
|
2331
2418
|
class: "i-svg-spinners-ring-resize size-4"
|
|
2332
|
-
},
|
|
2419
|
+
}, Hi = {
|
|
2333
2420
|
key: 1,
|
|
2334
2421
|
class: "i-tabler-paperclip size-5"
|
|
2335
|
-
},
|
|
2422
|
+
}, Gi = ["placeholder", "disabled"], ji = ["disabled"], na = /* @__PURE__ */ ke({
|
|
2336
2423
|
__name: "ElAgentChat",
|
|
2337
2424
|
props: {
|
|
2338
2425
|
chatController: {},
|
|
@@ -2346,430 +2433,414 @@ const li = { class: "@container/chat flex flex-col h-full relative" }, oi = {
|
|
|
2346
2433
|
starterPrompts: {}
|
|
2347
2434
|
},
|
|
2348
2435
|
setup(a) {
|
|
2349
|
-
const t =
|
|
2350
|
-
t.link = ({ href: _, text: f }) => {
|
|
2351
|
-
let x = !1;
|
|
2352
|
-
if (typeof window < "u")
|
|
2353
|
-
try {
|
|
2354
|
-
x = new URL(_, window.location.href).origin === window.location.origin;
|
|
2355
|
-
} catch {
|
|
2356
|
-
x = !1;
|
|
2357
|
-
}
|
|
2358
|
-
return x ? `<a href="${_}">${f}</a>` : `<a href="${_}" target="_blank" rel="noopener noreferrer">${f}</a>`;
|
|
2359
|
-
}, L.setOptions({ breaks: !0, gfm: !0, renderer: t });
|
|
2360
|
-
function e(_) {
|
|
2361
|
-
if (!_)
|
|
2362
|
-
return "";
|
|
2363
|
-
const f = L.parse(_, { async: !1 });
|
|
2364
|
-
return kr.sanitize(f, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2365
|
-
}
|
|
2366
|
-
h(e, "renderMarkdown");
|
|
2367
|
-
const n = {
|
|
2436
|
+
const t = {
|
|
2368
2437
|
private: { icon: "i-tabler-lock", label: "Private", tooltip: "Only you can see this conversation" },
|
|
2369
2438
|
org: { icon: "i-tabler-users", label: "Workspace", tooltip: "Visible to workspace members" },
|
|
2370
2439
|
public: { icon: "i-tabler-globe", label: "Public", tooltip: "Anyone with the link can see this" }
|
|
2371
|
-
},
|
|
2440
|
+
}, e = [
|
|
2372
2441
|
"Brief me on tomorrow",
|
|
2373
2442
|
"Triage my inbox",
|
|
2374
2443
|
"What's on my plate this week"
|
|
2375
|
-
],
|
|
2376
|
-
() => a.starterPrompts ??
|
|
2377
|
-
),
|
|
2378
|
-
const
|
|
2379
|
-
return a.scope === "org" && a.scopeName && (
|
|
2380
|
-
}),
|
|
2381
|
-
function
|
|
2382
|
-
const
|
|
2383
|
-
return !M || M.sender !==
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
const
|
|
2444
|
+
], n = $(
|
|
2445
|
+
() => a.starterPrompts ?? e
|
|
2446
|
+
), r = $(() => {
|
|
2447
|
+
const A = { ...t[a.scope] };
|
|
2448
|
+
return a.scope === "org" && a.scopeName && (A.label = a.scopeName, A.tooltip = `Visible to ${a.scopeName} members`), A;
|
|
2449
|
+
}), s = Z(""), l = Z(!1), o = Z(), d = Z(), c = Z(), b = Z([]), u = Z(!1);
|
|
2450
|
+
function m(A, k) {
|
|
2451
|
+
const g = A[k], M = A[k + 1];
|
|
2452
|
+
return !M || M.sender !== g.sender;
|
|
2453
|
+
}
|
|
2454
|
+
p(m, "shouldShowAvatar");
|
|
2455
|
+
const f = $(() => a.chatController?.textState.value), w = $(() => f.value?.isConnected ?? !1), _ = $(() => f.value?.isThinking ?? !1), O = $(() => f.value?.connectionStatus === "disconnected" && !!f.value?.error), ie = $(() => f.value?.connectionStatus !== "connected" && !f.value?.error), be = $(() => f.value?.error), G = $(() => a.chatController?.sharedMessages.value ?? []), P = $(() => {
|
|
2456
|
+
if (!_.value) return;
|
|
2457
|
+
const A = G.value, k = A[A.length - 1];
|
|
2458
|
+
return k?.sender === "agent" ? k.id : void 0;
|
|
2459
|
+
}), de = $(() => _.value ? P.value === void 0 : !1), ae = $(() => f.value?.accountGated ?? !1), Q = $(() => !w.value || ae.value), _t = $(() => O.value ? "Agent is offline" : ie.value ? "Connecting..." : ae.value ? "Resolve the billing issue above to continue" : "Message"), ut = $(() => (s.value.trim() || b.value.length > 0) && !Q.value && !u.value), C = $(() => a.variant === "light"), q = $(
|
|
2387
2460
|
() => C.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2388
|
-
), we =
|
|
2389
|
-
|
|
2390
|
-
a.chatController && !
|
|
2461
|
+
), we = $(() => C.value ? "text-theme-300" : "text-white/30");
|
|
2462
|
+
St(async () => {
|
|
2463
|
+
a.chatController && !w.value && await a.chatController.startTextConversation();
|
|
2391
2464
|
});
|
|
2392
2465
|
function Oe() {
|
|
2393
2466
|
a.chatController?.newConversation();
|
|
2394
2467
|
}
|
|
2395
|
-
|
|
2396
|
-
async function
|
|
2397
|
-
const
|
|
2398
|
-
if (!
|
|
2468
|
+
p(Oe, "startNewConversation");
|
|
2469
|
+
async function ve() {
|
|
2470
|
+
const A = s.value.trim(), k = b.value.length > 0;
|
|
2471
|
+
if (!A && !k || !a.chatController || !w.value || u.value)
|
|
2399
2472
|
return;
|
|
2400
|
-
const
|
|
2401
|
-
|
|
2402
|
-
}
|
|
2403
|
-
h(ye, "sendMessage");
|
|
2404
|
-
async function Rt(_) {
|
|
2405
|
-
Q.value || (l.value = _, await ye());
|
|
2473
|
+
const g = s.value, M = k ? [...b.value] : void 0;
|
|
2474
|
+
s.value = "", b.value = [], d.value && (d.value.style.height = "auto", d.value.focus()), o.value?.pin(), await a.chatController.sendChatMessage(g, M);
|
|
2406
2475
|
}
|
|
2407
|
-
|
|
2408
|
-
async function
|
|
2409
|
-
|
|
2410
|
-
}
|
|
2411
|
-
h(Ct, "handleKeydown");
|
|
2412
|
-
function ht() {
|
|
2413
|
-
c.value && jt(() => {
|
|
2414
|
-
c.value.scrollTop = c.value.scrollHeight;
|
|
2415
|
-
});
|
|
2476
|
+
p(ve, "sendMessage");
|
|
2477
|
+
async function Rt(A) {
|
|
2478
|
+
Q.value || (s.value = A, await ve());
|
|
2416
2479
|
}
|
|
2417
|
-
|
|
2418
|
-
function
|
|
2419
|
-
|
|
2480
|
+
p(Rt, "sendStarterPrompt");
|
|
2481
|
+
async function Ct(A) {
|
|
2482
|
+
A.key === "Enter" && !A.shiftKey && (A.preventDefault(), await ve());
|
|
2420
2483
|
}
|
|
2421
|
-
|
|
2484
|
+
p(Ct, "handleKeydown");
|
|
2422
2485
|
function It() {
|
|
2423
|
-
|
|
2486
|
+
d.value && (d.value.style.height = "auto", d.value.style.height = `${Math.min(d.value.scrollHeight, 150)}px`);
|
|
2487
|
+
}
|
|
2488
|
+
p(It, "adjustTextareaHeight"), qe(s, () => Is(() => It()));
|
|
2489
|
+
function ht() {
|
|
2490
|
+
c.value?.click();
|
|
2424
2491
|
}
|
|
2425
|
-
|
|
2426
|
-
async function
|
|
2427
|
-
const
|
|
2428
|
-
if (!(!
|
|
2429
|
-
|
|
2492
|
+
p(ht, "triggerFileInput");
|
|
2493
|
+
async function Dt(A) {
|
|
2494
|
+
const k = A.target, g = k.files?.[0];
|
|
2495
|
+
if (!(!g || !a.uploadFn)) {
|
|
2496
|
+
u.value = !0;
|
|
2430
2497
|
try {
|
|
2431
|
-
const M = await a.uploadFn(
|
|
2432
|
-
|
|
2498
|
+
const M = await a.uploadFn(g);
|
|
2499
|
+
b.value = [...b.value, M];
|
|
2433
2500
|
} catch (M) {
|
|
2434
|
-
const
|
|
2435
|
-
a.chatController?.notify(`Upload failed — ${
|
|
2501
|
+
const j = M instanceof Error ? M.message : "Couldn't attach that file.";
|
|
2502
|
+
a.chatController?.notify(`Upload failed — ${j}`);
|
|
2436
2503
|
} finally {
|
|
2437
|
-
|
|
2504
|
+
u.value = !1, k.value = "";
|
|
2438
2505
|
}
|
|
2439
2506
|
}
|
|
2440
2507
|
}
|
|
2441
|
-
|
|
2442
|
-
function
|
|
2443
|
-
|
|
2508
|
+
p(Dt, "handleFileSelect");
|
|
2509
|
+
function pt(A) {
|
|
2510
|
+
b.value = b.value.filter((k, g) => g !== A);
|
|
2444
2511
|
}
|
|
2445
|
-
|
|
2446
|
-
function
|
|
2447
|
-
if (
|
|
2448
|
-
const
|
|
2449
|
-
return
|
|
2512
|
+
p(pt, "removeAttachment");
|
|
2513
|
+
function U(A, k) {
|
|
2514
|
+
if (k === 0) {
|
|
2515
|
+
const _e = A[k];
|
|
2516
|
+
return _e?.timestamp ? Ye(new Date(_e.timestamp)) : null;
|
|
2450
2517
|
}
|
|
2451
|
-
const
|
|
2452
|
-
if (!
|
|
2453
|
-
const
|
|
2454
|
-
return new Date(M.timestamp).getTime() -
|
|
2518
|
+
const g = A[k - 1], M = A[k];
|
|
2519
|
+
if (!g?.timestamp || !M?.timestamp) return null;
|
|
2520
|
+
const j = new Date(g.timestamp).getTime();
|
|
2521
|
+
return new Date(M.timestamp).getTime() - j > 36e5 ? Ye(new Date(M.timestamp)) : null;
|
|
2455
2522
|
}
|
|
2456
|
-
|
|
2457
|
-
function
|
|
2458
|
-
const
|
|
2523
|
+
p(U, "shouldShowTimeDivider");
|
|
2524
|
+
function Ye(A) {
|
|
2525
|
+
const k = /* @__PURE__ */ new Date(), g = A.toDateString() === k.toDateString(), M = new Date(k);
|
|
2459
2526
|
M.setDate(M.getDate() - 1);
|
|
2460
|
-
const
|
|
2461
|
-
if (
|
|
2462
|
-
if (
|
|
2463
|
-
const
|
|
2464
|
-
return `${
|
|
2527
|
+
const j = A.toDateString() === M.toDateString(), J = A.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2528
|
+
if (g) return J;
|
|
2529
|
+
if (j) return `Yesterday, ${J}`;
|
|
2530
|
+
const Ze = A.getFullYear() === k.getFullYear();
|
|
2531
|
+
return `${A.toLocaleDateString("en-US", {
|
|
2465
2532
|
weekday: "long",
|
|
2466
2533
|
month: "short",
|
|
2467
2534
|
day: "numeric",
|
|
2468
|
-
...
|
|
2469
|
-
})}, ${
|
|
2470
|
-
}
|
|
2471
|
-
return
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
C.value ? U("", !0) : (T(), S("div", oi, [
|
|
2475
|
-
Wt(Ys, {
|
|
2535
|
+
...Ze ? {} : { year: "numeric" }
|
|
2536
|
+
})}, ${J}`;
|
|
2537
|
+
}
|
|
2538
|
+
return p(Ye, "formatTimeDivider"), (A, k) => (y(), T("div", di, [
|
|
2539
|
+
C.value ? B("", !0) : (y(), T("div", fi, [
|
|
2540
|
+
Je(Xs, {
|
|
2476
2541
|
agent: a.agent,
|
|
2477
|
-
"is-online":
|
|
2542
|
+
"is-online": w.value
|
|
2478
2543
|
}, null, 8, ["agent", "is-online"])
|
|
2479
2544
|
])),
|
|
2480
|
-
|
|
2545
|
+
O.value ? (y(), T("div", {
|
|
2481
2546
|
key: 1,
|
|
2482
|
-
class:
|
|
2547
|
+
class: E(["py-16 flex flex-col items-center justify-center gap-3 text-sm", C.value ? "text-theme-400" : "text-white/60"])
|
|
2483
2548
|
}, [
|
|
2484
|
-
|
|
2485
|
-
class:
|
|
2549
|
+
v("i", {
|
|
2550
|
+
class: E(["i-heroicons-cloud-arrow-down size-8", C.value ? "text-theme-300" : "text-white/40"])
|
|
2486
2551
|
}, null, 2),
|
|
2487
|
-
|
|
2488
|
-
], 2)) :
|
|
2552
|
+
v("span", null, re(be.value), 1)
|
|
2553
|
+
], 2)) : ie.value ? (y(), T("div", {
|
|
2489
2554
|
key: 2,
|
|
2490
|
-
class:
|
|
2555
|
+
class: E(["py-16 flex flex-col items-center justify-center gap-2 text-sm", C.value ? "text-theme-400" : "text-theme-600"])
|
|
2491
2556
|
}, [
|
|
2492
|
-
|
|
2493
|
-
], 2)) : a.setupHint ? (
|
|
2557
|
+
Je(Ln, { class: "size-4" })
|
|
2558
|
+
], 2)) : a.setupHint ? (y(), T("div", {
|
|
2494
2559
|
key: 3,
|
|
2495
|
-
class:
|
|
2560
|
+
class: E(["flex items-center justify-center gap-1.5 py-2 text-[11px]", we.value])
|
|
2496
2561
|
}, [
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
], 2)) :
|
|
2500
|
-
|
|
2501
|
-
ref_key: "
|
|
2502
|
-
ref:
|
|
2503
|
-
class: "flex-1
|
|
2504
|
-
},
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
class: A([o.value.icon, "size-3"])
|
|
2540
|
-
}, null, 2),
|
|
2541
|
-
w("span", null, ie(o.value.label), 1)
|
|
2542
|
-
], 10, fi)
|
|
2543
|
-
])) : U("", !0),
|
|
2544
|
-
Y.value.length > 0 ? (T(), S("div", gi, [
|
|
2545
|
-
w("button", {
|
|
2546
|
-
type: "button",
|
|
2547
|
-
"data-test": "chat-new-session",
|
|
2548
|
-
class: A(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors", C.value ? "text-theme-400 hover:text-theme-700 hover:bg-theme-50" : "text-white/40 hover:text-white hover:bg-white/5"]),
|
|
2549
|
-
onClick: Oe
|
|
2550
|
-
}, [...f[8] || (f[8] = [
|
|
2551
|
-
w("i", { class: "i-tabler-refresh size-3" }, null, -1),
|
|
2552
|
-
w("span", null, "New chat", -1)
|
|
2553
|
-
])], 2)
|
|
2554
|
-
])) : U("", !0),
|
|
2555
|
-
(T(!0), S(Te, null, at(Y.value, (x, M) => (T(), S(Te, {
|
|
2556
|
-
key: x.id
|
|
2557
|
-
}, [
|
|
2558
|
-
Xe(Y.value, M) ? (T(), S("div", mi, [
|
|
2559
|
-
w("div", {
|
|
2560
|
-
class: A(["flex-1 h-px", q.value])
|
|
2561
|
-
}, null, 2),
|
|
2562
|
-
w("span", {
|
|
2563
|
-
class: A(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", we.value])
|
|
2564
|
-
}, ie(Xe(Y.value, M)), 3),
|
|
2565
|
-
w("div", {
|
|
2566
|
-
class: A(["flex-1 h-px", q.value])
|
|
2567
|
-
}, null, 2)
|
|
2568
|
-
])) : U("", !0),
|
|
2569
|
-
x.sender === "system" ? (T(), S("div", {
|
|
2570
|
-
key: 1,
|
|
2571
|
-
"data-test": "messaging-system-msg",
|
|
2572
|
-
"data-issue-code": x.issue?.code,
|
|
2573
|
-
"data-issue-bucket": x.issue?.bucket,
|
|
2574
|
-
class: A(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", C.value ? "text-theme-500" : "text-white/70"])
|
|
2575
|
-
}, [
|
|
2576
|
-
w("i", {
|
|
2577
|
-
class: A(["i-tabler-alert-circle size-4 mt-0.5 shrink-0", x.issue?.bucket === "account" ? C.value ? "text-amber-500" : "text-amber-300" : C.value ? "text-red-500" : "text-red-300"])
|
|
2578
|
-
}, null, 2),
|
|
2579
|
-
w("div", xi, [
|
|
2580
|
-
w("span", null, ie(x.text), 1),
|
|
2581
|
-
x.issue?.help ? (T(), S("span", {
|
|
2582
|
-
key: 0,
|
|
2583
|
-
class: A(["text-[12px]", C.value ? "text-theme-400" : "text-white/55"])
|
|
2584
|
-
}, ie(x.issue.help), 3)) : U("", !0),
|
|
2585
|
-
x.issue?.actionUrl ? (T(), S("a", {
|
|
2586
|
-
key: 1,
|
|
2587
|
-
href: x.issue.actionUrl,
|
|
2588
|
-
"data-test": "messaging-system-msg-action",
|
|
2589
|
-
class: A(["text-[12px] font-medium inline-flex items-center gap-1", C.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"])
|
|
2562
|
+
k[6] || (k[6] = v("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2563
|
+
v("span", null, re(a.setupHint), 1)
|
|
2564
|
+
], 2)) : B("", !0),
|
|
2565
|
+
Je(pi, {
|
|
2566
|
+
ref_key: "chatScroller",
|
|
2567
|
+
ref: o,
|
|
2568
|
+
class: "flex-1"
|
|
2569
|
+
}, {
|
|
2570
|
+
default: Ds(() => [
|
|
2571
|
+
v("div", gi, [
|
|
2572
|
+
G.value.length === 0 && !ie.value && !O.value ? (y(), T("div", mi, [
|
|
2573
|
+
v("div", bi, [
|
|
2574
|
+
v("img", {
|
|
2575
|
+
src: a.agent.avatarUrl.value,
|
|
2576
|
+
alt: a.agent.displayName.value,
|
|
2577
|
+
class: E(["size-full rounded-full object-cover ring-1", C.value ? "ring-black/5" : "ring-white/10"])
|
|
2578
|
+
}, null, 10, xi),
|
|
2579
|
+
w.value ? (y(), T("span", {
|
|
2580
|
+
key: 0,
|
|
2581
|
+
class: E(["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", C.value ? "bg-white" : "bg-theme-900"])
|
|
2582
|
+
}, [...k[7] || (k[7] = [
|
|
2583
|
+
v("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2584
|
+
])], 2)) : B("", !0)
|
|
2585
|
+
]),
|
|
2586
|
+
v("div", {
|
|
2587
|
+
class: E(["text-base @sm/chat:text-lg font-semibold", C.value ? "text-theme-900" : "text-white"])
|
|
2588
|
+
}, re(a.agent.displayName.value), 3),
|
|
2589
|
+
v("p", {
|
|
2590
|
+
class: E(["mt-1 text-center text-xs @sm/chat:text-sm", we.value])
|
|
2591
|
+
}, re(a.emptyStateMessage || "Tap a prompt to get started, or type your own."), 3),
|
|
2592
|
+
n.value.length > 0 && !Q.value ? (y(), T("div", ki, [
|
|
2593
|
+
(y(!0), T(Te, null, at(n.value, (g) => (y(), T("button", {
|
|
2594
|
+
key: g,
|
|
2595
|
+
type: "button",
|
|
2596
|
+
"data-test": "chat-starter-prompt",
|
|
2597
|
+
class: E(["text-left text-sm rounded-2xl px-4 py-2.5 transition-colors cursor-pointer", C.value ? "bg-theme-25 border border-theme-200 text-theme-700 hover:bg-theme-50 hover:border-theme-300" : "bg-white/5 border border-white/10 text-white/80 hover:bg-white/10 hover:border-white/20"]),
|
|
2598
|
+
onClick: /* @__PURE__ */ p((M) => Rt(g), "onClick")
|
|
2599
|
+
}, re(g), 11, wi))), 128))
|
|
2600
|
+
])) : B("", !0),
|
|
2601
|
+
v("div", {
|
|
2602
|
+
class: E(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", C.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2603
|
+
title: r.value.tooltip
|
|
2590
2604
|
}, [
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
}, null, 10, vi)) : U("", !0)
|
|
2611
|
-
])) : U("", !0),
|
|
2612
|
-
w("div", {
|
|
2613
|
-
class: A(x.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2605
|
+
v("i", {
|
|
2606
|
+
class: E([r.value.icon, "size-3"])
|
|
2607
|
+
}, null, 2),
|
|
2608
|
+
v("span", null, re(r.value.label), 1)
|
|
2609
|
+
], 10, vi)
|
|
2610
|
+
])) : B("", !0),
|
|
2611
|
+
G.value.length > 0 ? (y(), T("div", yi, [
|
|
2612
|
+
v("button", {
|
|
2613
|
+
type: "button",
|
|
2614
|
+
"data-test": "chat-new-session",
|
|
2615
|
+
class: E(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors", C.value ? "text-theme-400 hover:text-theme-700 hover:bg-theme-50" : "text-white/40 hover:text-white hover:bg-white/5"]),
|
|
2616
|
+
onClick: Oe
|
|
2617
|
+
}, [...k[8] || (k[8] = [
|
|
2618
|
+
v("i", { class: "i-tabler-refresh size-3" }, null, -1),
|
|
2619
|
+
v("span", null, "New chat", -1)
|
|
2620
|
+
])], 2)
|
|
2621
|
+
])) : B("", !0),
|
|
2622
|
+
(y(!0), T(Te, null, at(G.value, (g, M) => (y(), T(Te, {
|
|
2623
|
+
key: g.id
|
|
2614
2624
|
}, [
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2625
|
+
U(G.value, M) ? (y(), T("div", Ti, [
|
|
2626
|
+
v("div", {
|
|
2627
|
+
class: E(["flex-1 h-px", q.value])
|
|
2628
|
+
}, null, 2),
|
|
2629
|
+
v("span", {
|
|
2630
|
+
class: E(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", we.value])
|
|
2631
|
+
}, re(U(G.value, M)), 3),
|
|
2632
|
+
v("div", {
|
|
2633
|
+
class: E(["flex-1 h-px", q.value])
|
|
2634
|
+
}, null, 2)
|
|
2635
|
+
])) : B("", !0),
|
|
2636
|
+
g.sender === "system" ? (y(), T("div", {
|
|
2637
|
+
key: 1,
|
|
2638
|
+
"data-test": "messaging-system-msg",
|
|
2639
|
+
"data-issue-code": g.issue?.code,
|
|
2640
|
+
"data-issue-bucket": g.issue?.bucket,
|
|
2641
|
+
class: E(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", C.value ? "text-theme-500" : "text-white/70"])
|
|
2618
2642
|
}, [
|
|
2619
|
-
(
|
|
2620
|
-
|
|
2643
|
+
v("i", {
|
|
2644
|
+
class: E(["i-tabler-alert-circle size-4 mt-0.5 shrink-0", g.issue?.bucket === "account" ? C.value ? "text-amber-500" : "text-amber-300" : C.value ? "text-red-500" : "text-red-300"])
|
|
2645
|
+
}, null, 2),
|
|
2646
|
+
v("div", Ai, [
|
|
2647
|
+
v("span", null, re(g.text), 1),
|
|
2648
|
+
g.issue?.help ? (y(), T("span", {
|
|
2621
2649
|
key: 0,
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
}, null, 8, Ti)) : P.type === "audio" ? (T(), S("audio", {
|
|
2650
|
+
class: E(["text-[12px]", C.value ? "text-theme-400" : "text-white/55"])
|
|
2651
|
+
}, re(g.issue.help), 3)) : B("", !0),
|
|
2652
|
+
g.issue?.actionUrl ? (y(), T("a", {
|
|
2626
2653
|
key: 1,
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
class: "
|
|
2630
|
-
}, null, 8, Si)) : (T(), S("a", {
|
|
2631
|
-
key: 2,
|
|
2632
|
-
href: P.url,
|
|
2633
|
-
target: "_blank",
|
|
2634
|
-
rel: "noopener",
|
|
2635
|
-
class: A(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", C.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2654
|
+
href: g.issue.actionUrl,
|
|
2655
|
+
"data-test": "messaging-system-msg-action",
|
|
2656
|
+
class: E(["text-[12px] font-medium inline-flex items-center gap-1", C.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"])
|
|
2636
2657
|
}, [
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
], 10,
|
|
2640
|
-
]
|
|
2641
|
-
],
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
class:
|
|
2645
|
-
|
|
2646
|
-
|
|
2658
|
+
et(re(g.issue.actionLabel) + " ", 1),
|
|
2659
|
+
k[9] || (k[9] = v("i", { class: "i-tabler-arrow-right size-3" }, null, -1))
|
|
2660
|
+
], 10, Ei)) : B("", !0)
|
|
2661
|
+
])
|
|
2662
|
+
], 10, Si)) : (y(), T("div", {
|
|
2663
|
+
key: 2,
|
|
2664
|
+
"data-test": g.sender === "agent" ? "messaging-assistant-msg" : g.sender === "user" ? "messaging-user-msg" : void 0,
|
|
2665
|
+
class: E(["flex gap-2 items-end", {
|
|
2666
|
+
"justify-end": g.sender === "user",
|
|
2667
|
+
"justify-start": g.sender === "agent",
|
|
2668
|
+
"mb-4": m(G.value, M)
|
|
2669
|
+
}])
|
|
2647
2670
|
}, [
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2671
|
+
g.sender === "agent" ? (y(), T("div", Ri, [
|
|
2672
|
+
m(G.value, M) ? (y(), T("img", {
|
|
2673
|
+
key: 0,
|
|
2674
|
+
src: a.agent.avatarUrl.value,
|
|
2675
|
+
alt: a.agent.displayName.value,
|
|
2676
|
+
class: E(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", C.value ? "ring-1 ring-black/5" : ""])
|
|
2677
|
+
}, null, 10, Ci)) : B("", !0)
|
|
2678
|
+
])) : B("", !0),
|
|
2679
|
+
v("div", {
|
|
2680
|
+
class: E(g.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2681
|
+
}, [
|
|
2682
|
+
g.attachments?.length ? (y(), T("div", {
|
|
2683
|
+
key: 0,
|
|
2684
|
+
class: E(["mb-1 space-y-1", g.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2685
|
+
}, [
|
|
2686
|
+
(y(!0), T(Te, null, at(g.attachments, (j, J) => (y(), T(Te, { key: J }, [
|
|
2687
|
+
j.type === "image" ? (y(), T("img", {
|
|
2688
|
+
key: 0,
|
|
2689
|
+
src: j.url,
|
|
2690
|
+
alt: j.name,
|
|
2691
|
+
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2692
|
+
}, null, 8, Ii)) : j.type === "audio" ? (y(), T("audio", {
|
|
2693
|
+
key: 1,
|
|
2694
|
+
src: j.url,
|
|
2695
|
+
controls: "",
|
|
2696
|
+
class: "max-w-full"
|
|
2697
|
+
}, null, 8, Di)) : (y(), T("a", {
|
|
2698
|
+
key: 2,
|
|
2699
|
+
href: j.url,
|
|
2700
|
+
target: "_blank",
|
|
2701
|
+
rel: "noopener",
|
|
2702
|
+
class: E(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", C.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2703
|
+
}, [
|
|
2704
|
+
k[10] || (k[10] = v("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2705
|
+
et(" " + re(j.name), 1)
|
|
2706
|
+
], 10, Mi))
|
|
2707
|
+
], 64))), 128))
|
|
2708
|
+
], 2)) : B("", !0),
|
|
2709
|
+
g.text ? (y(), T("div", {
|
|
2710
|
+
key: 1,
|
|
2711
|
+
class: E(["rounded-2xl px-3.5 py-2", [
|
|
2712
|
+
g.sender === "user" ? "bg-primary-500 text-white rounded-br-[4px]" : C.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]"
|
|
2713
|
+
]])
|
|
2714
|
+
}, [
|
|
2715
|
+
Je(ui, {
|
|
2716
|
+
text: g.text,
|
|
2717
|
+
inverted: g.sender === "user" || !C.value,
|
|
2718
|
+
streaming: g.id === P.value,
|
|
2719
|
+
onClick: k[0] || (k[0] = Ms(() => {
|
|
2720
|
+
}, ["stop"]))
|
|
2721
|
+
}, null, 8, ["text", "inverted", "streaming"])
|
|
2722
|
+
], 2)) : B("", !0)
|
|
2723
|
+
], 2)
|
|
2724
|
+
], 10, _i))
|
|
2725
|
+
], 64))), 128)),
|
|
2726
|
+
de.value ? (y(), T("div", Li, [
|
|
2727
|
+
v("img", {
|
|
2728
|
+
src: a.agent.avatarUrl.value,
|
|
2729
|
+
alt: a.agent.displayName.value,
|
|
2730
|
+
class: E(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", C.value ? "ring-1 ring-black/5" : ""])
|
|
2731
|
+
}, null, 10, Oi),
|
|
2732
|
+
v("div", {
|
|
2733
|
+
class: E(["rounded-2xl px-3.5 py-2.5 flex items-center", C.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2734
|
+
}, [
|
|
2735
|
+
v("i", {
|
|
2736
|
+
class: E(["i-svg-spinners-3-dots-bounce size-7", C.value ? "text-theme-400" : "text-white/50"])
|
|
2737
|
+
}, null, 2)
|
|
2738
|
+
], 2)
|
|
2739
|
+
])) : B("", !0)
|
|
2740
|
+
])
|
|
2741
|
+
]),
|
|
2742
|
+
_: 1
|
|
2743
|
+
}, 512),
|
|
2744
|
+
v("div", {
|
|
2745
|
+
class: E(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", C.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"])
|
|
2675
2746
|
}, [
|
|
2676
|
-
|
|
2677
|
-
(
|
|
2747
|
+
b.value.length > 0 ? (y(), T("div", zi, [
|
|
2748
|
+
(y(!0), T(Te, null, at(b.value, (g, M) => (y(), T("div", {
|
|
2678
2749
|
key: M,
|
|
2679
2750
|
class: "relative shrink-0 group"
|
|
2680
2751
|
}, [
|
|
2681
|
-
|
|
2752
|
+
g.type === "image" ? (y(), T("img", {
|
|
2682
2753
|
key: 0,
|
|
2683
|
-
src:
|
|
2684
|
-
alt:
|
|
2685
|
-
class:
|
|
2686
|
-
}, null, 10,
|
|
2754
|
+
src: g.url,
|
|
2755
|
+
alt: g.name,
|
|
2756
|
+
class: E(["size-14 rounded-xl object-cover border", C.value ? "border-black/10" : "border-white/20"])
|
|
2757
|
+
}, null, 10, Pi)) : (y(), T("div", {
|
|
2687
2758
|
key: 1,
|
|
2688
|
-
class:
|
|
2759
|
+
class: E(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", C.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2689
2760
|
}, [
|
|
2690
|
-
|
|
2691
|
-
|
|
2761
|
+
k[11] || (k[11] = v("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2762
|
+
v("span", Ni, re(g.name), 1)
|
|
2692
2763
|
], 2)),
|
|
2693
|
-
|
|
2764
|
+
v("button", {
|
|
2694
2765
|
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",
|
|
2695
|
-
onClick: /* @__PURE__ */
|
|
2696
|
-
}, [...
|
|
2697
|
-
|
|
2698
|
-
])], 8,
|
|
2766
|
+
onClick: /* @__PURE__ */ p((j) => pt(M), "onClick")
|
|
2767
|
+
}, [...k[12] || (k[12] = [
|
|
2768
|
+
v("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2769
|
+
])], 8, $i)
|
|
2699
2770
|
]))), 128)),
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
])) :
|
|
2703
|
-
])) :
|
|
2704
|
-
a.uploadFn ? (
|
|
2771
|
+
u.value ? (y(), T("div", Ui, [
|
|
2772
|
+
Je(Ln, { class: "size-5" })
|
|
2773
|
+
])) : B("", !0)
|
|
2774
|
+
])) : B("", !0),
|
|
2775
|
+
a.uploadFn ? (y(), T("input", {
|
|
2705
2776
|
key: 1,
|
|
2706
2777
|
ref_key: "fileInput",
|
|
2707
|
-
ref:
|
|
2778
|
+
ref: c,
|
|
2708
2779
|
type: "file",
|
|
2709
2780
|
accept: "image/*,audio/*,video/*",
|
|
2710
2781
|
class: "hidden",
|
|
2711
|
-
onChange:
|
|
2712
|
-
}, null, 544)) :
|
|
2713
|
-
|
|
2714
|
-
class:
|
|
2782
|
+
onChange: Dt
|
|
2783
|
+
}, null, 544)) : B("", !0),
|
|
2784
|
+
v("div", {
|
|
2785
|
+
class: E(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", C.value ? l.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" : l.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2715
2786
|
}, [
|
|
2716
|
-
|
|
2717
|
-
class:
|
|
2787
|
+
v("button", {
|
|
2788
|
+
class: E(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
2718
2789
|
a.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
2719
2790
|
C.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2720
|
-
|
|
2791
|
+
u.value ? "opacity-50 pointer-events-none" : ""
|
|
2721
2792
|
]]),
|
|
2722
|
-
disabled: Q.value ||
|
|
2723
|
-
onClick:
|
|
2793
|
+
disabled: Q.value || u.value || !a.uploadFn,
|
|
2794
|
+
onClick: k[1] || (k[1] = (g) => a.uploadFn && ht())
|
|
2724
2795
|
}, [
|
|
2725
|
-
|
|
2726
|
-
], 10,
|
|
2727
|
-
|
|
2796
|
+
u.value ? (y(), T("i", Fi)) : (y(), T("i", Hi))
|
|
2797
|
+
], 10, Bi),
|
|
2798
|
+
ns(v("textarea", {
|
|
2728
2799
|
ref_key: "textarea",
|
|
2729
|
-
ref:
|
|
2730
|
-
"onUpdate:modelValue":
|
|
2800
|
+
ref: d,
|
|
2801
|
+
"onUpdate:modelValue": k[2] || (k[2] = (g) => s.value = g),
|
|
2731
2802
|
"data-test": "messaging-input",
|
|
2732
2803
|
rows: "1",
|
|
2733
2804
|
enterkeyhint: "send",
|
|
2734
2805
|
placeholder: _t.value,
|
|
2735
2806
|
disabled: Q.value,
|
|
2736
2807
|
style: { fontSize: "16px", resize: "none" },
|
|
2737
|
-
class:
|
|
2808
|
+
class: E(["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", C.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2738
2809
|
onKeydown: Ct,
|
|
2739
|
-
onFocus:
|
|
2740
|
-
onBlur:
|
|
2741
|
-
}, null, 42,
|
|
2742
|
-
[
|
|
2810
|
+
onFocus: k[3] || (k[3] = (g) => l.value = !0),
|
|
2811
|
+
onBlur: k[4] || (k[4] = (g) => l.value = !1)
|
|
2812
|
+
}, null, 42, Gi), [
|
|
2813
|
+
[ss, s.value]
|
|
2743
2814
|
]),
|
|
2744
|
-
|
|
2815
|
+
v("button", {
|
|
2745
2816
|
"data-test": "messaging-send-btn",
|
|
2746
|
-
class:
|
|
2817
|
+
class: E(["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", ut.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : C.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2747
2818
|
disabled: !ut.value,
|
|
2748
|
-
onClick:
|
|
2749
|
-
}, [...
|
|
2750
|
-
|
|
2751
|
-
])], 10,
|
|
2819
|
+
onClick: k[5] || (k[5] = (g) => ve())
|
|
2820
|
+
}, [...k[13] || (k[13] = [
|
|
2821
|
+
v("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2822
|
+
])], 10, ji)
|
|
2752
2823
|
], 2),
|
|
2753
|
-
|
|
2754
|
-
class:
|
|
2824
|
+
v("div", {
|
|
2825
|
+
class: E(["text-[10px] text-center mt-2.5 select-none opacity-70", C.value ? "text-theme-400" : "text-white/50"])
|
|
2755
2826
|
}, [
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
class:
|
|
2827
|
+
k[14] || (k[14] = et(" Press ", -1)),
|
|
2828
|
+
v("kbd", {
|
|
2829
|
+
class: E(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", C.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2759
2830
|
}, "Enter", 2),
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
class:
|
|
2831
|
+
k[15] || (k[15] = et(" to send, ", -1)),
|
|
2832
|
+
v("kbd", {
|
|
2833
|
+
class: E(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", C.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2763
2834
|
}, "Shift+Enter", 2),
|
|
2764
|
-
|
|
2835
|
+
k[16] || (k[16] = et(" for new line ", -1))
|
|
2765
2836
|
], 2)
|
|
2766
2837
|
], 2)
|
|
2767
2838
|
]));
|
|
2768
2839
|
}
|
|
2769
|
-
}),
|
|
2840
|
+
}), Wi = { class: "agent-wrap" }, qi = {
|
|
2770
2841
|
key: 0,
|
|
2771
2842
|
class: "flex items-center justify-center h-full"
|
|
2772
|
-
},
|
|
2843
|
+
}, sa = /* @__PURE__ */ ke({
|
|
2773
2844
|
__name: "AgentWrap",
|
|
2774
2845
|
props: {
|
|
2775
2846
|
sdk: {},
|
|
@@ -2783,11 +2854,11 @@ const li = { class: "@container/chat flex flex-col h-full relative" }, oi = {
|
|
|
2783
2854
|
apiBase: {}
|
|
2784
2855
|
},
|
|
2785
2856
|
setup(a) {
|
|
2786
|
-
const t =
|
|
2857
|
+
const t = Os("AgentWrap"), e = a, n = e.sdk || zs.getInstance({
|
|
2787
2858
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2788
2859
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2789
|
-
}), r =
|
|
2790
|
-
return
|
|
2860
|
+
}), r = Z(!e.agent), s = rs(e.agent ? new wt({ config: e.agent }) : void 0), l = Z();
|
|
2861
|
+
return St(async () => {
|
|
2791
2862
|
if (e.agent) {
|
|
2792
2863
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2793
2864
|
agentId: e.agent.agentId,
|
|
@@ -2796,7 +2867,7 @@ const li = { class: "@container/chat flex flex-col h-full relative" }, oi = {
|
|
|
2796
2867
|
return;
|
|
2797
2868
|
}
|
|
2798
2869
|
if (!e.handle) {
|
|
2799
|
-
|
|
2870
|
+
l.value = "No handle or agent provided", t.warn("AgentWrap mounted without handle or agent", {
|
|
2800
2871
|
propsReceived: {
|
|
2801
2872
|
handle: e.handle,
|
|
2802
2873
|
agent: e.agent,
|
|
@@ -2812,17 +2883,17 @@ const li = { class: "@container/chat flex flex-col h-full relative" }, oi = {
|
|
|
2812
2883
|
}
|
|
2813
2884
|
try {
|
|
2814
2885
|
r.value = !0, t.debug("Fetching public agent", { handle: e.handle });
|
|
2815
|
-
const
|
|
2816
|
-
|
|
2817
|
-
agentId:
|
|
2818
|
-
handle:
|
|
2819
|
-
}),
|
|
2886
|
+
const o = await n.user.getPublicAgent({ handle: e.handle });
|
|
2887
|
+
o ? (s.value = new wt({ config: o }), t.debug("Successfully fetched public agent", {
|
|
2888
|
+
agentId: o.agentId,
|
|
2889
|
+
handle: o.handle
|
|
2890
|
+
}), o.agentId && n.user.track({
|
|
2820
2891
|
event: "view_profile",
|
|
2821
|
-
agentId:
|
|
2892
|
+
agentId: o.agentId,
|
|
2822
2893
|
properties: {
|
|
2823
2894
|
viewSource: "widget"
|
|
2824
2895
|
}
|
|
2825
|
-
})) : (
|
|
2896
|
+
})) : (l.value = n.error.value || "Agent not found", t.error("Failed to fetch public agent - no data returned", {
|
|
2826
2897
|
handle: e.handle,
|
|
2827
2898
|
sdkError: n.error.value,
|
|
2828
2899
|
sdkState: {
|
|
@@ -2831,13 +2902,13 @@ const li = { class: "@container/chat flex flex-col h-full relative" }, oi = {
|
|
|
2831
2902
|
loading: n.loading.value
|
|
2832
2903
|
}
|
|
2833
2904
|
}));
|
|
2834
|
-
} catch (
|
|
2835
|
-
|
|
2905
|
+
} catch (o) {
|
|
2906
|
+
l.value = o instanceof Error ? o.message : "Failed to fetch agent", t.error("Exception while fetching public agent", {
|
|
2836
2907
|
handle: e.handle,
|
|
2837
|
-
error:
|
|
2838
|
-
message:
|
|
2839
|
-
stack:
|
|
2840
|
-
} :
|
|
2908
|
+
error: o instanceof Error ? {
|
|
2909
|
+
message: o.message,
|
|
2910
|
+
stack: o.stack
|
|
2911
|
+
} : o,
|
|
2841
2912
|
sdkState: {
|
|
2842
2913
|
isDev: n.isDev,
|
|
2843
2914
|
apiBase: n.apiBase,
|
|
@@ -2849,7 +2920,7 @@ const li = { class: "@container/chat flex flex-col h-full relative" }, oi = {
|
|
|
2849
2920
|
state: {
|
|
2850
2921
|
loading: r.value,
|
|
2851
2922
|
hasAgent: !!s.value,
|
|
2852
|
-
error:
|
|
2923
|
+
error: l.value
|
|
2853
2924
|
},
|
|
2854
2925
|
props: {
|
|
2855
2926
|
handle: e.handle,
|
|
@@ -2863,33 +2934,33 @@ const li = { class: "@container/chat flex flex-col h-full relative" }, oi = {
|
|
|
2863
2934
|
}
|
|
2864
2935
|
});
|
|
2865
2936
|
}
|
|
2866
|
-
}), (
|
|
2867
|
-
r.value ? (
|
|
2868
|
-
|
|
2869
|
-
])])) : s.value ?
|
|
2937
|
+
}), (o, d) => (y(), T("div", Wi, [
|
|
2938
|
+
r.value ? (y(), T("div", qi, [...d[0] || (d[0] = [
|
|
2939
|
+
v("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2940
|
+
])])) : s.value ? en(o.$slots, "default", {
|
|
2870
2941
|
key: 1,
|
|
2871
|
-
sdk:
|
|
2942
|
+
sdk: Xt(n),
|
|
2872
2943
|
agent: s.value,
|
|
2873
2944
|
context: a.context,
|
|
2874
2945
|
firstMessage: a.firstMessage,
|
|
2875
2946
|
buttonText: a.buttonText,
|
|
2876
2947
|
buttonIcon: a.buttonIcon,
|
|
2877
2948
|
loading: r.value
|
|
2878
|
-
}) :
|
|
2949
|
+
}) : B("", !0)
|
|
2879
2950
|
]));
|
|
2880
2951
|
}
|
|
2881
2952
|
});
|
|
2882
2953
|
export {
|
|
2883
2954
|
On as A,
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2955
|
+
sa as _,
|
|
2956
|
+
na as a,
|
|
2957
|
+
ea as b,
|
|
2958
|
+
Ji as c,
|
|
2959
|
+
ta as d,
|
|
2889
2960
|
Ln as e,
|
|
2890
|
-
|
|
2891
|
-
|
|
2961
|
+
Xs as f,
|
|
2962
|
+
Ki as g,
|
|
2892
2963
|
Pn as h,
|
|
2893
|
-
|
|
2964
|
+
Qi as p
|
|
2894
2965
|
};
|
|
2895
2966
|
//# sourceMappingURL=AgentWrap.vue_vue_type_script_setup_true_lang.js.map
|