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