@pagelines/sdk 1.0.446 → 1.0.447
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var Dn = Object.defineProperty;
|
|
2
2
|
var ws = (l, t, e) => t in l ? Dn(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { SettingsObject as ys, Agent as kt, getDefaultAvatarUrl as
|
|
3
|
+
var h = (l, t) => Dn(l, "name", { value: t, configurable: !0 });
|
|
4
|
+
var D = (l, t, e) => ws(l, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { defineComponent as De, openBlock as A, createElementBlock as E, createElementVNode as T, normalizeClass as _, ref as V, watch as nt, computed as F, createCommentVNode as G, renderSlot as Zn, onMounted as Qt, Fragment as _e, renderList as xt, withDirectives as Xn, vModelText as Kn, unref as Yt, toDisplayString as pe, nextTick as Bt, createVNode as Ft, createTextVNode as ft, shallowRef as vs } from "vue";
|
|
6
|
+
import { SettingsObject as ys, Agent as kt, getDefaultAvatarUrl as Qn, createLogger as Ts } from "@pagelines/core";
|
|
7
7
|
import { P as Ss } from "./sdkClient.js";
|
|
8
8
|
const As = { class: "spinner max-w-sm" }, Es = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
},
|
|
11
|
+
}, In = /* @__PURE__ */ De({
|
|
12
12
|
__name: "FSpinner",
|
|
13
13
|
props: {
|
|
14
14
|
width: { type: String, default: "" },
|
|
@@ -33,23 +33,23 @@ const As = { class: "spinner max-w-sm" }, Es = {
|
|
|
33
33
|
}), _s = [
|
|
34
34
|
{ pattern: /\bNO_REP\w*\b/g, label: "NO_REPLY — bot chose not to respond" },
|
|
35
35
|
{ pattern: /\bHEARTBEAT_OK\b/g, label: "HEARTBEAT_OK — scheduled check, nothing to do" }
|
|
36
|
-
], Rs = 9e4,
|
|
36
|
+
], Rs = 9e4, cn = class cn extends ys {
|
|
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", V({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
D(this, "agentMode", V("self"));
|
|
51
|
+
D(this, "sharedMessages", V([]));
|
|
52
|
+
D(this, "_agent");
|
|
53
53
|
this._agent = e.agent instanceof kt ? e.agent : new kt({ config: e.agent }), this.setupModeWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
@@ -103,7 +103,7 @@ Current User:
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
setupModeWatcher() {
|
|
106
|
-
|
|
106
|
+
nt(this.agentMode, async (e, n) => {
|
|
107
107
|
this.logger.info(`Mode changed from ${n} to ${e}`), this.isTextMode && (n === "talk" || n === "chat") && await this.endConversation();
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -125,7 +125,7 @@ Current User:
|
|
|
125
125
|
}
|
|
126
126
|
this.isConnecting = !0, this.isTextMode = !0, this.updateState(this.textState, { isActive: !0, connectionStatus: "connecting" });
|
|
127
127
|
try {
|
|
128
|
-
if (!this.
|
|
128
|
+
if (!this.chatEnabled) {
|
|
129
129
|
this.isConnecting = !1, this.updateState(this.textState, {
|
|
130
130
|
isConnected: !1,
|
|
131
131
|
connectionStatus: "disconnected",
|
|
@@ -153,7 +153,7 @@ Current User:
|
|
|
153
153
|
if (!this.isTextMode)
|
|
154
154
|
return;
|
|
155
155
|
const { chatStreamFn: s } = this.settings;
|
|
156
|
-
if (!
|
|
156
|
+
if (!this.chatEnabled) {
|
|
157
157
|
this.addMessage("Agent is currently offline.", "system");
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
@@ -165,39 +165,51 @@ Current User:
|
|
|
165
165
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
166
166
|
const a = `stream-${Date.now()}`;
|
|
167
167
|
let o = !1;
|
|
168
|
-
const c = /* @__PURE__ */
|
|
168
|
+
const c = /* @__PURE__ */ h((f) => {
|
|
169
169
|
o || (o = !0, this.sharedMessages.value = [
|
|
170
170
|
...this.sharedMessages.value,
|
|
171
171
|
{ id: a, text: "", sender: "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
172
172
|
]);
|
|
173
173
|
const m = this.sharedMessages.value, y = m[m.length - 1];
|
|
174
|
-
y?.id === a && (y.text +=
|
|
175
|
-
}, "onDelta"), d = /* @__PURE__ */
|
|
174
|
+
y?.id === a && (y.text += f, this.sharedMessages.value = [...m]);
|
|
175
|
+
}, "onDelta"), d = /* @__PURE__ */ h((f) => {
|
|
176
|
+
if (!o) {
|
|
177
|
+
g("empty_stream — assistant returned no content");
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
176
180
|
const m = this.sharedMessages.value, y = m[m.length - 1];
|
|
177
181
|
if (y?.id === a && y.text) {
|
|
178
182
|
let S = y.text;
|
|
179
|
-
for (const
|
|
180
|
-
|
|
183
|
+
for (const z of _s)
|
|
184
|
+
z.pattern.test(S) && (console.debug(`[chat] filtered directive: ${z.label}`), S = S.replace(z.pattern, "").trim(), z.pattern.lastIndex = 0);
|
|
181
185
|
S ? S !== y.text && (y.text = S, this.sharedMessages.value = [...m]) : this.sharedMessages.value = m.slice(0, -1);
|
|
182
186
|
}
|
|
183
|
-
|
|
184
|
-
}, "onDone"),
|
|
187
|
+
f && (this.conversationId = f), this.updateState(this.textState, { isThinking: !1 });
|
|
188
|
+
}, "onDone"), g = /* @__PURE__ */ h((f) => {
|
|
185
189
|
const m = this.sharedMessages.value, y = m[m.length - 1];
|
|
186
|
-
y?.id === a && !y.text && (this.sharedMessages.value = m.slice(0, -1))
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
if (y?.id === a && !y.text && (this.sharedMessages.value = m.slice(0, -1)), typeof f == "object" && f.code && f.error) {
|
|
191
|
+
(/* @__PURE__ */ new Set([
|
|
192
|
+
"CREDIT_LIMIT",
|
|
193
|
+
"OVERAGE_CAP",
|
|
194
|
+
"EMPTY_STREAM",
|
|
195
|
+
"RATE_LIMIT"
|
|
196
|
+
])).has(f.code) ? (this.addMessage(f.error, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(f.error));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const S = typeof f == "string" ? f : f.error, z = this.mapChatError(S);
|
|
200
|
+
this.isTransientError(S) ? (this.addMessage(z, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(z));
|
|
201
|
+
}, "onError"), p = /* @__PURE__ */ h((f) => {
|
|
202
|
+
this.addMessage(f, "system");
|
|
191
203
|
}, "onStatus");
|
|
192
204
|
try {
|
|
193
|
-
const
|
|
205
|
+
const f = s ? s({
|
|
194
206
|
message: e,
|
|
195
207
|
attachments: n,
|
|
196
208
|
conversationId: this.conversationId,
|
|
197
209
|
history: this.buildHistory(),
|
|
198
210
|
onDelta: c,
|
|
199
211
|
onDone: d,
|
|
200
|
-
onError:
|
|
212
|
+
onError: g,
|
|
201
213
|
onStatus: p
|
|
202
214
|
}) : r.chatStream({
|
|
203
215
|
handle: this._agent.handle.value,
|
|
@@ -209,15 +221,15 @@ Current User:
|
|
|
209
221
|
context: this.getDynamicSettings().context || void 0,
|
|
210
222
|
onDelta: c,
|
|
211
223
|
onDone: d,
|
|
212
|
-
onError:
|
|
224
|
+
onError: g,
|
|
213
225
|
onStatus: p
|
|
214
226
|
});
|
|
215
227
|
await Promise.race([
|
|
216
|
-
|
|
228
|
+
f,
|
|
217
229
|
new Promise((m, y) => setTimeout(() => y(new Error("timed out")), Rs))
|
|
218
230
|
]);
|
|
219
|
-
} catch (
|
|
220
|
-
f
|
|
231
|
+
} catch (f) {
|
|
232
|
+
g(f.message || "Something went wrong");
|
|
221
233
|
}
|
|
222
234
|
}
|
|
223
235
|
buildHistory() {
|
|
@@ -241,30 +253,30 @@ Current User:
|
|
|
241
253
|
await this.endConversation();
|
|
242
254
|
}
|
|
243
255
|
};
|
|
244
|
-
|
|
245
|
-
let
|
|
246
|
-
function
|
|
256
|
+
h(cn, "AgentChatController");
|
|
257
|
+
let Mn = cn;
|
|
258
|
+
function Ln(l) {
|
|
247
259
|
return l ? typeof l == "string" ? l : l.src || "" : "";
|
|
248
260
|
}
|
|
249
|
-
|
|
261
|
+
h(Ln, "getImageSrc");
|
|
250
262
|
function Ei(l) {
|
|
251
|
-
return
|
|
263
|
+
return Ln(l.cover) || Ln(l.avatar) || Qn(l.name);
|
|
252
264
|
}
|
|
253
|
-
|
|
254
|
-
function
|
|
265
|
+
h(Ei, "getAgentAvatarUrl");
|
|
266
|
+
function zn(l) {
|
|
255
267
|
const t = l.target;
|
|
256
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
268
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = Qn());
|
|
257
269
|
}
|
|
258
|
-
|
|
270
|
+
h(zn, "handleImageError");
|
|
259
271
|
function _i(l) {
|
|
260
272
|
const { template: t, agent: e } = l;
|
|
261
273
|
return t.replace(/{name}/g, e.name || "Digital Agent").replace(/{title}/g, e.title || "").replace(/{handle}/g, e.handle || "").replace(/{orgName}/g, e.org?.name || "");
|
|
262
274
|
}
|
|
263
|
-
|
|
264
|
-
const
|
|
275
|
+
h(_i, "parseButtonTemplate");
|
|
276
|
+
const Cs = {
|
|
265
277
|
key: 0,
|
|
266
278
|
class: "absolute inset-0 flex items-center justify-center"
|
|
267
|
-
}, Ri = /* @__PURE__ */
|
|
279
|
+
}, Ri = /* @__PURE__ */ De({
|
|
268
280
|
__name: "ElAgentButton",
|
|
269
281
|
props: {
|
|
270
282
|
theme: { default: "primary" },
|
|
@@ -291,7 +303,7 @@ const Ds = {
|
|
|
291
303
|
return (s, r) => (A(), E("button", {
|
|
292
304
|
class: _(["relative inline-flex items-center justify-center gap-2 font-medium rounded-full backdrop-blur-sm border-2 text-white transition-all duration-200 focus:outline-none active:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer", [t.value, e.value]])
|
|
293
305
|
}, [
|
|
294
|
-
l.loading ? (A(), E("div",
|
|
306
|
+
l.loading ? (A(), E("div", Cs, [...r[0] || (r[0] = [
|
|
295
307
|
T("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
296
308
|
])])) : G("", !0),
|
|
297
309
|
T("span", {
|
|
@@ -301,7 +313,7 @@ const Ds = {
|
|
|
301
313
|
key: 0,
|
|
302
314
|
class: _([l.icon, n.value])
|
|
303
315
|
}, null, 2)) : G("", !0),
|
|
304
|
-
|
|
316
|
+
Zn(s.$slots, "default"),
|
|
305
317
|
l.iconAfter ? (A(), E("i", {
|
|
306
318
|
key: 1,
|
|
307
319
|
class: _([l.iconAfter, n.value])
|
|
@@ -309,7 +321,7 @@ const Ds = {
|
|
|
309
321
|
], 2)
|
|
310
322
|
], 2));
|
|
311
323
|
}
|
|
312
|
-
}),
|
|
324
|
+
}), Ds = ["value"], Ci = /* @__PURE__ */ De({
|
|
313
325
|
__name: "AgentInputEmail",
|
|
314
326
|
props: {
|
|
315
327
|
modelValue: { default: "" }
|
|
@@ -325,9 +337,9 @@ const Ds = {
|
|
|
325
337
|
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",
|
|
326
338
|
style: { "font-size": "16px" },
|
|
327
339
|
onInput: s[0] || (s[0] = (r) => e("update:modelValue", r.target.value))
|
|
328
|
-
}, null, 40,
|
|
340
|
+
}, null, 40, Ds));
|
|
329
341
|
}
|
|
330
|
-
}), Is = { class: "flex gap-1.5 justify-center" }, Ms = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"],
|
|
342
|
+
}), Is = { class: "flex gap-1.5 justify-center" }, Ms = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], Di = /* @__PURE__ */ De({
|
|
331
343
|
__name: "AgentInputOneTimeCode",
|
|
332
344
|
props: {
|
|
333
345
|
modelValue: {},
|
|
@@ -337,25 +349,25 @@ const Ds = {
|
|
|
337
349
|
emits: ["update:modelValue", "autoSubmit"],
|
|
338
350
|
setup(l, { emit: t }) {
|
|
339
351
|
const e = l, n = t, s = V([]), r = V(Array.from({ length: e.length }).fill("")), a = V(!1);
|
|
340
|
-
|
|
352
|
+
Qt(() => {
|
|
341
353
|
e.modelValue && (r.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && s.value[0]?.focus();
|
|
342
|
-
}),
|
|
354
|
+
}), nt(() => e.modelValue, (p) => {
|
|
343
355
|
r.value = p ? p.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
344
|
-
}),
|
|
356
|
+
}), nt(r, () => {
|
|
345
357
|
const p = r.value.filter(Boolean).join("");
|
|
346
358
|
n("update:modelValue", p), p.length === e.length && n("autoSubmit", p);
|
|
347
359
|
}, { deep: !0 });
|
|
348
|
-
function o(p,
|
|
349
|
-
|
|
350
|
-
const m = (
|
|
360
|
+
function o(p, f) {
|
|
361
|
+
f.preventDefault(), a.value = !0;
|
|
362
|
+
const m = (f.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
351
363
|
if (m.length === e.length)
|
|
352
364
|
r.value = m.split(""), setTimeout(() => {
|
|
353
365
|
s.value[e.length - 1]?.focus(), a.value = !1;
|
|
354
366
|
}, 10);
|
|
355
367
|
else {
|
|
356
368
|
const y = [...r.value];
|
|
357
|
-
m.split("").slice(0, e.length - p).forEach((
|
|
358
|
-
y[p +
|
|
369
|
+
m.split("").slice(0, e.length - p).forEach((z, de) => {
|
|
370
|
+
y[p + de] = z;
|
|
359
371
|
}), r.value = y;
|
|
360
372
|
const S = Math.min(p + m.length, e.length - 1);
|
|
361
373
|
setTimeout(() => {
|
|
@@ -363,46 +375,46 @@ const Ds = {
|
|
|
363
375
|
}, 10);
|
|
364
376
|
}
|
|
365
377
|
}
|
|
366
|
-
|
|
367
|
-
function c(p,
|
|
368
|
-
const m =
|
|
378
|
+
h(o, "onPaste");
|
|
379
|
+
function c(p, f) {
|
|
380
|
+
const m = f.target.value.slice(-1).replace(/\D/g, "");
|
|
369
381
|
r.value[p] = m, m && p < e.length - 1 && s.value[p + 1]?.focus();
|
|
370
382
|
}
|
|
371
|
-
|
|
372
|
-
function d(p,
|
|
373
|
-
|
|
383
|
+
h(c, "onInput");
|
|
384
|
+
function d(p, f) {
|
|
385
|
+
f.key === "Backspace" ? (f.preventDefault(), r.value[p] = "", p > 0 && s.value[p - 1]?.focus()) : f.key === "ArrowLeft" && p > 0 ? s.value[p - 1]?.focus() : f.key === "ArrowRight" && p < e.length - 1 && s.value[p + 1]?.focus();
|
|
374
386
|
}
|
|
375
|
-
|
|
376
|
-
function
|
|
387
|
+
h(d, "onKeydown");
|
|
388
|
+
function g(p) {
|
|
377
389
|
if (s.value[p]?.select(), !a.value && r.value[p])
|
|
378
|
-
for (let
|
|
379
|
-
r.value[
|
|
390
|
+
for (let f = p; f < e.length; f++)
|
|
391
|
+
r.value[f] = "";
|
|
380
392
|
}
|
|
381
|
-
return
|
|
382
|
-
(A(!0), E(
|
|
393
|
+
return h(g, "onFocus"), (p, f) => (A(), E("div", Is, [
|
|
394
|
+
(A(!0), E(_e, null, xt(l.length, (m) => Xn((A(), E("input", {
|
|
383
395
|
key: m,
|
|
384
396
|
ref_for: !0,
|
|
385
|
-
ref: /* @__PURE__ */
|
|
386
|
-
"onUpdate:modelValue": /* @__PURE__ */
|
|
397
|
+
ref: /* @__PURE__ */ h((y) => s.value[m - 1] = y, "ref"),
|
|
398
|
+
"onUpdate:modelValue": /* @__PURE__ */ h((y) => r.value[m - 1] = y, "onUpdate:modelValue"),
|
|
387
399
|
type: "text",
|
|
388
400
|
inputmode: "numeric",
|
|
389
401
|
autocomplete: "one-time-code",
|
|
390
402
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
391
403
|
style: { "font-size": "16px" },
|
|
392
404
|
maxlength: "1",
|
|
393
|
-
onInput: /* @__PURE__ */
|
|
394
|
-
onKeydown: /* @__PURE__ */
|
|
395
|
-
onPaste: /* @__PURE__ */
|
|
396
|
-
onFocus: /* @__PURE__ */
|
|
405
|
+
onInput: /* @__PURE__ */ h((y) => c(m - 1, y), "onInput"),
|
|
406
|
+
onKeydown: /* @__PURE__ */ h((y) => d(m - 1, y), "onKeydown"),
|
|
407
|
+
onPaste: /* @__PURE__ */ h((y) => o(m - 1, y), "onPaste"),
|
|
408
|
+
onFocus: /* @__PURE__ */ h((y) => g(m - 1), "onFocus")
|
|
397
409
|
}, null, 40, Ms)), [
|
|
398
|
-
[
|
|
410
|
+
[Kn, r.value[m - 1]]
|
|
399
411
|
])), 128))
|
|
400
412
|
]));
|
|
401
413
|
}
|
|
402
|
-
}), Ls = { class: "relative flex-shrink-0" }, zs = ["src", "alt"], Os = { class: "absolute top-1 right-1" },
|
|
414
|
+
}), Ls = { class: "relative flex-shrink-0" }, zs = ["src", "alt"], Os = { class: "absolute top-1 right-1" }, Ps = {
|
|
403
415
|
key: 1,
|
|
404
416
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
405
|
-
},
|
|
417
|
+
}, Ns = { class: "min-w-0" }, $s = /* @__PURE__ */ De({
|
|
406
418
|
__name: "ElModeHeader",
|
|
407
419
|
props: {
|
|
408
420
|
agent: {},
|
|
@@ -425,39 +437,39 @@ const Ds = {
|
|
|
425
437
|
alt: l.agent.displayName.value,
|
|
426
438
|
class: "w-full h-full object-cover",
|
|
427
439
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
428
|
-
(...n) =>
|
|
440
|
+
(...n) => Yt(zn) && Yt(zn)(...n))
|
|
429
441
|
}, null, 40, zs)
|
|
430
442
|
], 2),
|
|
431
443
|
T("div", Os, [
|
|
432
|
-
l.isOnline ? (A(), E(
|
|
444
|
+
l.isOnline ? (A(), E(_e, { key: 0 }, [
|
|
433
445
|
e[1] || (e[1] = T("div", {
|
|
434
446
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
435
447
|
style: { "animation-duration": "3s" }
|
|
436
448
|
}, null, -1)),
|
|
437
449
|
e[2] || (e[2] = T("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
438
|
-
], 64)) : (A(), E("div",
|
|
450
|
+
], 64)) : (A(), E("div", Ps))
|
|
439
451
|
])
|
|
440
452
|
]),
|
|
441
|
-
T("div",
|
|
453
|
+
T("div", Ns, [
|
|
442
454
|
T("h1", {
|
|
443
455
|
class: _(["font-light text-white mb-1 truncate", [
|
|
444
456
|
l.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
445
457
|
l.layout === "horizontal" ? "text-white/95" : ""
|
|
446
458
|
]])
|
|
447
|
-
},
|
|
459
|
+
}, pe(l.agent.displayName.value), 3),
|
|
448
460
|
T("p", {
|
|
449
461
|
class: _(["font-light line-clamp-1", [
|
|
450
462
|
l.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
451
463
|
l.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
452
464
|
]])
|
|
453
|
-
},
|
|
465
|
+
}, pe(l.layout === "horizontal" ? l.agent.title.value || "Digital Agent" : l.agent.title.value), 3)
|
|
454
466
|
])
|
|
455
467
|
], 2));
|
|
456
468
|
}
|
|
457
469
|
});
|
|
458
470
|
const {
|
|
459
|
-
entries:
|
|
460
|
-
setPrototypeOf:
|
|
471
|
+
entries: Jn,
|
|
472
|
+
setPrototypeOf: On,
|
|
461
473
|
isFrozen: Us,
|
|
462
474
|
getPrototypeOf: Bs,
|
|
463
475
|
getOwnPropertyDescriptor: Fs
|
|
@@ -465,48 +477,48 @@ const {
|
|
|
465
477
|
let {
|
|
466
478
|
freeze: Z,
|
|
467
479
|
seal: te,
|
|
468
|
-
create:
|
|
480
|
+
create: et
|
|
469
481
|
} = Object, {
|
|
470
|
-
apply:
|
|
471
|
-
construct:
|
|
482
|
+
apply: Zt,
|
|
483
|
+
construct: Xt
|
|
472
484
|
} = typeof Reflect < "u" && Reflect;
|
|
473
|
-
Z || (Z = /* @__PURE__ */
|
|
485
|
+
Z || (Z = /* @__PURE__ */ h(function(t) {
|
|
474
486
|
return t;
|
|
475
487
|
}, "freeze"));
|
|
476
|
-
te || (te = /* @__PURE__ */
|
|
488
|
+
te || (te = /* @__PURE__ */ h(function(t) {
|
|
477
489
|
return t;
|
|
478
490
|
}, "seal"));
|
|
479
|
-
|
|
491
|
+
Zt || (Zt = /* @__PURE__ */ h(function(t, e) {
|
|
480
492
|
for (var n = arguments.length, s = new Array(n > 2 ? n - 2 : 0), r = 2; r < n; r++)
|
|
481
493
|
s[r - 2] = arguments[r];
|
|
482
494
|
return t.apply(e, s);
|
|
483
495
|
}, "apply"));
|
|
484
|
-
|
|
496
|
+
Xt || (Xt = /* @__PURE__ */ h(function(t) {
|
|
485
497
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
486
498
|
n[s - 1] = arguments[s];
|
|
487
499
|
return new t(...n);
|
|
488
500
|
}, "construct"));
|
|
489
|
-
const
|
|
501
|
+
const Ve = X(Array.prototype.forEach), Hs = X(Array.prototype.lastIndexOf), Pn = X(Array.prototype.pop), Ye = X(Array.prototype.push), Gs = X(Array.prototype.splice), bt = X(String.prototype.toLowerCase), Ht = X(String.prototype.toString), Gt = X(String.prototype.match), Ne = X(String.prototype.replace), Ws = X(String.prototype.indexOf), js = X(String.prototype.trim), ie = X(Object.prototype.hasOwnProperty), q = X(RegExp.prototype.test), Ze = qs(TypeError);
|
|
490
502
|
function X(l) {
|
|
491
503
|
return function(t) {
|
|
492
504
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
493
505
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
494
506
|
n[s - 1] = arguments[s];
|
|
495
|
-
return
|
|
507
|
+
return Zt(l, t, n);
|
|
496
508
|
};
|
|
497
509
|
}
|
|
498
|
-
|
|
510
|
+
h(X, "unapply");
|
|
499
511
|
function qs(l) {
|
|
500
512
|
return function() {
|
|
501
513
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
502
514
|
e[n] = arguments[n];
|
|
503
|
-
return
|
|
515
|
+
return Xt(l, e);
|
|
504
516
|
};
|
|
505
517
|
}
|
|
506
|
-
|
|
518
|
+
h(qs, "unconstruct");
|
|
507
519
|
function R(l, t) {
|
|
508
520
|
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : bt;
|
|
509
|
-
|
|
521
|
+
On && On(l, null);
|
|
510
522
|
let n = t.length;
|
|
511
523
|
for (; n--; ) {
|
|
512
524
|
let s = t[n];
|
|
@@ -518,21 +530,21 @@ function R(l, t) {
|
|
|
518
530
|
}
|
|
519
531
|
return l;
|
|
520
532
|
}
|
|
521
|
-
|
|
533
|
+
h(R, "addToSet");
|
|
522
534
|
function Vs(l) {
|
|
523
535
|
for (let t = 0; t < l.length; t++)
|
|
524
|
-
|
|
536
|
+
ie(l, t) || (l[t] = null);
|
|
525
537
|
return l;
|
|
526
538
|
}
|
|
527
|
-
|
|
528
|
-
function
|
|
529
|
-
const t =
|
|
530
|
-
for (const [e, n] of
|
|
531
|
-
|
|
539
|
+
h(Vs, "cleanArray");
|
|
540
|
+
function ue(l) {
|
|
541
|
+
const t = et(null);
|
|
542
|
+
for (const [e, n] of Jn(l))
|
|
543
|
+
ie(l, e) && (Array.isArray(n) ? t[e] = Vs(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = ue(n) : t[e] = n);
|
|
532
544
|
return t;
|
|
533
545
|
}
|
|
534
|
-
|
|
535
|
-
function
|
|
546
|
+
h(ue, "clone");
|
|
547
|
+
function Xe(l, t) {
|
|
536
548
|
for (; l !== null; ) {
|
|
537
549
|
const n = Fs(l, t);
|
|
538
550
|
if (n) {
|
|
@@ -546,39 +558,39 @@ function Ye(l, t) {
|
|
|
546
558
|
function e() {
|
|
547
559
|
return null;
|
|
548
560
|
}
|
|
549
|
-
return
|
|
561
|
+
return h(e, "fallbackValue"), e;
|
|
550
562
|
}
|
|
551
|
-
|
|
552
|
-
const Nn = Z(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]),
|
|
563
|
+
h(Xe, "lookupGetter");
|
|
564
|
+
const Nn = Z(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Wt = Z(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), jt = Z(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Ys = Z(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), qt = Z(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Zs = Z(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), $n = Z(["#text"]), Un = Z(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Vt = Z(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Bn = Z(["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"]), gt = Z(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Xs = te(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Ks = te(/<%[\w\W]*|[\w\W]*%>/gm), Qs = te(/\$\{[\w\W]*/gm), Js = te(/^data-[\-\w.\u00B7-\uFFFF]+$/), er = te(/^aria-[\-\w]+$/), es = te(
|
|
553
565
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
554
566
|
// eslint-disable-line no-useless-escape
|
|
555
567
|
), tr = te(/^(?:\w+script|data):/i), nr = te(
|
|
556
568
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
557
569
|
// eslint-disable-line no-control-regex
|
|
558
|
-
),
|
|
559
|
-
var
|
|
570
|
+
), ts = te(/^html$/i), sr = te(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
571
|
+
var Fn = /* @__PURE__ */ Object.freeze({
|
|
560
572
|
__proto__: null,
|
|
561
573
|
ARIA_ATTR: er,
|
|
562
574
|
ATTR_WHITESPACE: nr,
|
|
563
575
|
CUSTOM_ELEMENT: sr,
|
|
564
576
|
DATA_ATTR: Js,
|
|
565
|
-
DOCTYPE_NAME:
|
|
577
|
+
DOCTYPE_NAME: ts,
|
|
566
578
|
ERB_EXPR: Ks,
|
|
567
|
-
IS_ALLOWED_URI:
|
|
579
|
+
IS_ALLOWED_URI: es,
|
|
568
580
|
IS_SCRIPT_OR_DATA: tr,
|
|
569
581
|
MUSTACHE_EXPR: Xs,
|
|
570
582
|
TMPLIT_EXPR: Qs
|
|
571
583
|
});
|
|
572
|
-
const
|
|
584
|
+
const Ke = {
|
|
573
585
|
element: 1,
|
|
574
586
|
text: 3,
|
|
575
587
|
// Deprecated
|
|
576
588
|
progressingInstruction: 7,
|
|
577
589
|
comment: 8,
|
|
578
590
|
document: 9
|
|
579
|
-
}, rr = /* @__PURE__ */
|
|
591
|
+
}, rr = /* @__PURE__ */ h(function() {
|
|
580
592
|
return typeof window > "u" ? null : window;
|
|
581
|
-
}, "getGlobal"), ir = /* @__PURE__ */
|
|
593
|
+
}, "getGlobal"), ir = /* @__PURE__ */ h(function(t, e) {
|
|
582
594
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
583
595
|
return null;
|
|
584
596
|
let n = null;
|
|
@@ -597,7 +609,7 @@ const Ze = {
|
|
|
597
609
|
} catch {
|
|
598
610
|
return console.warn("TrustedTypes policy " + r + " could not be created."), null;
|
|
599
611
|
}
|
|
600
|
-
}, "_createTrustedTypesPolicy"),
|
|
612
|
+
}, "_createTrustedTypesPolicy"), Hn = /* @__PURE__ */ h(function() {
|
|
601
613
|
return {
|
|
602
614
|
afterSanitizeAttributes: [],
|
|
603
615
|
afterSanitizeElements: [],
|
|
@@ -610,10 +622,10 @@ const Ze = {
|
|
|
610
622
|
uponSanitizeShadowNode: []
|
|
611
623
|
};
|
|
612
624
|
}, "_createHooksMap");
|
|
613
|
-
function
|
|
625
|
+
function ns() {
|
|
614
626
|
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : rr();
|
|
615
|
-
const t = /* @__PURE__ */
|
|
616
|
-
if (t.version = "3.
|
|
627
|
+
const t = /* @__PURE__ */ h((v) => ns(v), "DOMPurify");
|
|
628
|
+
if (t.version = "3.4.0", t.removed = [], !l || !l.document || l.document.nodeType !== Ke.document || !l.Element)
|
|
617
629
|
return t.isSupported = !1, t;
|
|
618
630
|
let {
|
|
619
631
|
document: e
|
|
@@ -624,43 +636,43 @@ function ts() {
|
|
|
624
636
|
Node: o,
|
|
625
637
|
Element: c,
|
|
626
638
|
NodeFilter: d,
|
|
627
|
-
NamedNodeMap:
|
|
639
|
+
NamedNodeMap: g = l.NamedNodeMap || l.MozNamedAttrMap,
|
|
628
640
|
HTMLFormElement: p,
|
|
629
|
-
DOMParser:
|
|
641
|
+
DOMParser: f,
|
|
630
642
|
trustedTypes: m
|
|
631
|
-
} = l, y = c.prototype, S =
|
|
643
|
+
} = l, y = c.prototype, S = Xe(y, "cloneNode"), z = Xe(y, "remove"), de = Xe(y, "nextSibling"), me = Xe(y, "childNodes"), ne = Xe(y, "parentNode");
|
|
632
644
|
if (typeof a == "function") {
|
|
633
|
-
const
|
|
634
|
-
|
|
645
|
+
const v = e.createElement("template");
|
|
646
|
+
v.content && v.content.ownerDocument && (e = v.content.ownerDocument);
|
|
635
647
|
}
|
|
636
648
|
let $, j = "";
|
|
637
649
|
const {
|
|
638
650
|
implementation: se,
|
|
639
|
-
createNodeIterator:
|
|
640
|
-
createDocumentFragment:
|
|
651
|
+
createNodeIterator: fe,
|
|
652
|
+
createDocumentFragment: rt,
|
|
641
653
|
getElementsByTagName: L
|
|
642
654
|
} = e, {
|
|
643
|
-
importNode:
|
|
655
|
+
importNode: it
|
|
644
656
|
} = n;
|
|
645
|
-
let U =
|
|
646
|
-
t.isSupported = typeof
|
|
657
|
+
let U = Hn();
|
|
658
|
+
t.isSupported = typeof Jn == "function" && typeof ne == "function" && se && se.createHTMLDocument !== void 0;
|
|
647
659
|
const {
|
|
648
|
-
MUSTACHE_EXPR:
|
|
649
|
-
ERB_EXPR:
|
|
650
|
-
TMPLIT_EXPR:
|
|
660
|
+
MUSTACHE_EXPR: ve,
|
|
661
|
+
ERB_EXPR: Me,
|
|
662
|
+
TMPLIT_EXPR: ye,
|
|
651
663
|
DATA_ATTR: At,
|
|
652
664
|
ARIA_ATTR: Et,
|
|
653
665
|
IS_SCRIPT_OR_DATA: _t,
|
|
654
|
-
ATTR_WHITESPACE:
|
|
655
|
-
CUSTOM_ELEMENT:
|
|
656
|
-
} =
|
|
666
|
+
ATTR_WHITESPACE: at,
|
|
667
|
+
CUSTOM_ELEMENT: lt
|
|
668
|
+
} = Fn;
|
|
657
669
|
let {
|
|
658
|
-
IS_ALLOWED_URI:
|
|
659
|
-
} =
|
|
660
|
-
const
|
|
670
|
+
IS_ALLOWED_URI: Ge
|
|
671
|
+
} = Fn, b = null;
|
|
672
|
+
const w = R({}, [...Nn, ...Wt, ...jt, ...qt, ...$n]);
|
|
661
673
|
let k = null;
|
|
662
|
-
const
|
|
663
|
-
let
|
|
674
|
+
const O = R({}, [...Un, ...Vt, ...Bn, ...gt]);
|
|
675
|
+
let C = Object.seal(et(null, {
|
|
664
676
|
tagNameCheck: {
|
|
665
677
|
writable: !0,
|
|
666
678
|
configurable: !1,
|
|
@@ -679,8 +691,8 @@ function ts() {
|
|
|
679
691
|
enumerable: !0,
|
|
680
692
|
value: !1
|
|
681
693
|
}
|
|
682
|
-
})), J = null,
|
|
683
|
-
const ee = Object.seal(
|
|
694
|
+
})), J = null, Te = null;
|
|
695
|
+
const ee = Object.seal(et(null, {
|
|
684
696
|
tagCheck: {
|
|
685
697
|
writable: !0,
|
|
686
698
|
configurable: !1,
|
|
@@ -694,169 +706,169 @@ function ts() {
|
|
|
694
706
|
value: null
|
|
695
707
|
}
|
|
696
708
|
}));
|
|
697
|
-
let
|
|
698
|
-
const
|
|
699
|
-
let It = !0,
|
|
709
|
+
let un = !0, Rt = !0, hn = !1, pn = !0, Se = !1, We = !0, Ae = !1, Ct = !1, Dt = !1, Le = !1, ot = !1, ct = !1, dn = !0, fn = !1;
|
|
710
|
+
const ds = "user-content-";
|
|
711
|
+
let It = !0, je = !1, ze = {}, oe = null;
|
|
700
712
|
const Mt = R({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
701
|
-
let
|
|
702
|
-
const
|
|
713
|
+
let gn = null;
|
|
714
|
+
const mn = R({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
703
715
|
let Lt = null;
|
|
704
|
-
const
|
|
705
|
-
let
|
|
706
|
-
const
|
|
707
|
-
let
|
|
708
|
-
const
|
|
709
|
-
let
|
|
710
|
-
const
|
|
711
|
-
let B = null,
|
|
712
|
-
const
|
|
716
|
+
const xn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ut = "http://www.w3.org/1998/Math/MathML", ht = "http://www.w3.org/2000/svg", ce = "http://www.w3.org/1999/xhtml";
|
|
717
|
+
let Oe = ce, zt = !1, Ot = null;
|
|
718
|
+
const fs = R({}, [ut, ht, ce], Ht);
|
|
719
|
+
let pt = R({}, ["mi", "mo", "mn", "ms", "mtext"]), dt = R({}, ["annotation-xml"]);
|
|
720
|
+
const gs = R({}, ["title", "style", "font", "a", "script"]);
|
|
721
|
+
let qe = null;
|
|
722
|
+
const ms = ["application/xhtml+xml", "text/html"], xs = "text/html";
|
|
723
|
+
let B = null, Pe = null;
|
|
724
|
+
const bs = e.createElement("form"), bn = /* @__PURE__ */ h(function(i) {
|
|
713
725
|
return i instanceof RegExp || i instanceof Function;
|
|
714
|
-
}, "isRegexOrFunction"),
|
|
726
|
+
}, "isRegexOrFunction"), Pt = /* @__PURE__ */ h(function() {
|
|
715
727
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
716
|
-
if (!(
|
|
717
|
-
if ((!i || typeof i != "object") && (i = {}), i =
|
|
718
|
-
|
|
728
|
+
if (!(Pe && Pe === i)) {
|
|
729
|
+
if ((!i || typeof i != "object") && (i = {}), i = ue(i), qe = // eslint-disable-next-line unicorn/prefer-includes
|
|
730
|
+
ms.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? xs : i.PARSER_MEDIA_TYPE, B = qe === "application/xhtml+xml" ? Ht : bt, b = ie(i, "ALLOWED_TAGS") ? R({}, i.ALLOWED_TAGS, B) : w, k = ie(i, "ALLOWED_ATTR") ? R({}, i.ALLOWED_ATTR, B) : O, Ot = ie(i, "ALLOWED_NAMESPACES") ? R({}, i.ALLOWED_NAMESPACES, Ht) : fs, Lt = ie(i, "ADD_URI_SAFE_ATTR") ? R(ue(xn), i.ADD_URI_SAFE_ATTR, B) : xn, gn = ie(i, "ADD_DATA_URI_TAGS") ? R(ue(mn), i.ADD_DATA_URI_TAGS, B) : mn, oe = ie(i, "FORBID_CONTENTS") ? R({}, i.FORBID_CONTENTS, B) : Mt, J = ie(i, "FORBID_TAGS") ? R({}, i.FORBID_TAGS, B) : ue({}), Te = ie(i, "FORBID_ATTR") ? R({}, i.FORBID_ATTR, B) : ue({}), ze = ie(i, "USE_PROFILES") ? i.USE_PROFILES : !1, un = i.ALLOW_ARIA_ATTR !== !1, Rt = i.ALLOW_DATA_ATTR !== !1, hn = i.ALLOW_UNKNOWN_PROTOCOLS || !1, pn = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Se = i.SAFE_FOR_TEMPLATES || !1, We = i.SAFE_FOR_XML !== !1, Ae = i.WHOLE_DOCUMENT || !1, Le = i.RETURN_DOM || !1, ot = i.RETURN_DOM_FRAGMENT || !1, ct = i.RETURN_TRUSTED_TYPE || !1, Dt = i.FORCE_BODY || !1, dn = i.SANITIZE_DOM !== !1, fn = i.SANITIZE_NAMED_PROPS || !1, It = i.KEEP_CONTENT !== !1, je = i.IN_PLACE || !1, Ge = i.ALLOWED_URI_REGEXP || es, Oe = i.NAMESPACE || ce, pt = i.MATHML_TEXT_INTEGRATION_POINTS || pt, dt = i.HTML_INTEGRATION_POINTS || dt, C = i.CUSTOM_ELEMENT_HANDLING || et(null), i.CUSTOM_ELEMENT_HANDLING && bn(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (C.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && bn(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (C.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (C.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Se && (Rt = !1), ot && (Le = !0), ze && (b = R({}, $n), k = et(null), ze.html === !0 && (R(b, Nn), R(k, Un)), ze.svg === !0 && (R(b, Wt), R(k, Vt), R(k, gt)), ze.svgFilters === !0 && (R(b, jt), R(k, Vt), R(k, gt)), ze.mathMl === !0 && (R(b, qt), R(k, Bn), R(k, gt))), ee.tagCheck = null, ee.attributeCheck = null, i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? ee.tagCheck = i.ADD_TAGS : (b === w && (b = ue(b)), R(b, i.ADD_TAGS, B))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? ee.attributeCheck = i.ADD_ATTR : (k === O && (k = ue(k)), R(k, i.ADD_ATTR, B))), i.ADD_URI_SAFE_ATTR && R(Lt, i.ADD_URI_SAFE_ATTR, B), i.FORBID_CONTENTS && (oe === Mt && (oe = ue(oe)), R(oe, i.FORBID_CONTENTS, B)), i.ADD_FORBID_CONTENTS && (oe === Mt && (oe = ue(oe)), R(oe, i.ADD_FORBID_CONTENTS, B)), It && (b["#text"] = !0), Ae && R(b, ["html", "head", "body"]), b.table && (R(b, ["tbody"]), delete J.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
719
731
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
720
|
-
throw
|
|
732
|
+
throw Ze('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
721
733
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
722
|
-
throw
|
|
734
|
+
throw Ze('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
723
735
|
$ = i.TRUSTED_TYPES_POLICY, j = $.createHTML("");
|
|
724
736
|
} else
|
|
725
737
|
$ === void 0 && ($ = ir(m, s)), $ !== null && typeof j == "string" && (j = $.createHTML(""));
|
|
726
|
-
Z && Z(i),
|
|
738
|
+
Z && Z(i), Pe = i;
|
|
727
739
|
}
|
|
728
|
-
}, "_parseConfig"),
|
|
729
|
-
let
|
|
730
|
-
(!
|
|
731
|
-
namespaceURI:
|
|
740
|
+
}, "_parseConfig"), kn = R({}, [...Wt, ...jt, ...Ys]), wn = R({}, [...qt, ...Zs]), ks = /* @__PURE__ */ h(function(i) {
|
|
741
|
+
let u = ne(i);
|
|
742
|
+
(!u || !u.tagName) && (u = {
|
|
743
|
+
namespaceURI: Oe,
|
|
732
744
|
tagName: "template"
|
|
733
745
|
});
|
|
734
|
-
const x = bt(i.tagName),
|
|
735
|
-
return Ot[i.namespaceURI] ? i.namespaceURI ===
|
|
736
|
-
}, "_checkValidNamespace"),
|
|
737
|
-
|
|
746
|
+
const x = bt(i.tagName), P = bt(u.tagName);
|
|
747
|
+
return Ot[i.namespaceURI] ? i.namespaceURI === ht ? u.namespaceURI === ce ? x === "svg" : u.namespaceURI === ut ? x === "svg" && (P === "annotation-xml" || pt[P]) : !!kn[x] : i.namespaceURI === ut ? u.namespaceURI === ce ? x === "math" : u.namespaceURI === ht ? x === "math" && dt[P] : !!wn[x] : i.namespaceURI === ce ? u.namespaceURI === ht && !dt[P] || u.namespaceURI === ut && !pt[P] ? !1 : !wn[x] && (gs[x] || !kn[x]) : !!(qe === "application/xhtml+xml" && Ot[i.namespaceURI]) : !1;
|
|
748
|
+
}, "_checkValidNamespace"), re = /* @__PURE__ */ h(function(i) {
|
|
749
|
+
Ye(t.removed, {
|
|
738
750
|
element: i
|
|
739
751
|
});
|
|
740
752
|
try {
|
|
741
753
|
ne(i).removeChild(i);
|
|
742
754
|
} catch {
|
|
743
|
-
|
|
755
|
+
z(i);
|
|
744
756
|
}
|
|
745
|
-
}, "_forceRemove"),
|
|
757
|
+
}, "_forceRemove"), Ee = /* @__PURE__ */ h(function(i, u) {
|
|
746
758
|
try {
|
|
747
|
-
|
|
748
|
-
attribute:
|
|
749
|
-
from:
|
|
759
|
+
Ye(t.removed, {
|
|
760
|
+
attribute: u.getAttributeNode(i),
|
|
761
|
+
from: u
|
|
750
762
|
});
|
|
751
763
|
} catch {
|
|
752
|
-
|
|
764
|
+
Ye(t.removed, {
|
|
753
765
|
attribute: null,
|
|
754
|
-
from:
|
|
766
|
+
from: u
|
|
755
767
|
});
|
|
756
768
|
}
|
|
757
|
-
if (
|
|
758
|
-
if (
|
|
769
|
+
if (u.removeAttribute(i), i === "is")
|
|
770
|
+
if (Le || ot)
|
|
759
771
|
try {
|
|
760
|
-
|
|
772
|
+
re(u);
|
|
761
773
|
} catch {
|
|
762
774
|
}
|
|
763
775
|
else
|
|
764
776
|
try {
|
|
765
|
-
|
|
777
|
+
u.setAttribute(i, "");
|
|
766
778
|
} catch {
|
|
767
779
|
}
|
|
768
|
-
}, "_removeAttribute"),
|
|
769
|
-
let
|
|
770
|
-
if (
|
|
780
|
+
}, "_removeAttribute"), vn = /* @__PURE__ */ h(function(i) {
|
|
781
|
+
let u = null, x = null;
|
|
782
|
+
if (Dt)
|
|
771
783
|
i = "<remove></remove>" + i;
|
|
772
784
|
else {
|
|
773
|
-
const
|
|
774
|
-
x =
|
|
785
|
+
const N = Gt(i, /^[\r\n\t ]+/);
|
|
786
|
+
x = N && N[0];
|
|
775
787
|
}
|
|
776
|
-
|
|
777
|
-
const
|
|
778
|
-
if (
|
|
788
|
+
qe === "application/xhtml+xml" && Oe === ce && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
789
|
+
const P = $ ? $.createHTML(i) : i;
|
|
790
|
+
if (Oe === ce)
|
|
779
791
|
try {
|
|
780
|
-
|
|
792
|
+
u = new f().parseFromString(P, qe);
|
|
781
793
|
} catch {
|
|
782
794
|
}
|
|
783
|
-
if (!
|
|
784
|
-
|
|
795
|
+
if (!u || !u.documentElement) {
|
|
796
|
+
u = se.createDocument(Oe, "template", null);
|
|
785
797
|
try {
|
|
786
|
-
|
|
798
|
+
u.documentElement.innerHTML = zt ? j : P;
|
|
787
799
|
} catch {
|
|
788
800
|
}
|
|
789
801
|
}
|
|
790
|
-
const W =
|
|
791
|
-
return i && x && W.insertBefore(e.createTextNode(x), W.childNodes[0] || null),
|
|
792
|
-
}, "_initDocument"),
|
|
793
|
-
return
|
|
802
|
+
const W = u.body || u.documentElement;
|
|
803
|
+
return i && x && W.insertBefore(e.createTextNode(x), W.childNodes[0] || null), Oe === ce ? L.call(u, Ae ? "html" : "body")[0] : Ae ? u.documentElement : W;
|
|
804
|
+
}, "_initDocument"), yn = /* @__PURE__ */ h(function(i) {
|
|
805
|
+
return fe.call(
|
|
794
806
|
i.ownerDocument || i,
|
|
795
807
|
i,
|
|
796
808
|
// eslint-disable-next-line no-bitwise
|
|
797
809
|
d.SHOW_ELEMENT | d.SHOW_COMMENT | d.SHOW_TEXT | d.SHOW_PROCESSING_INSTRUCTION | d.SHOW_CDATA_SECTION,
|
|
798
810
|
null
|
|
799
811
|
);
|
|
800
|
-
}, "_createNodeIterator"),
|
|
801
|
-
return i instanceof p && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof
|
|
802
|
-
}, "_isClobbered"),
|
|
812
|
+
}, "_createNodeIterator"), Nt = /* @__PURE__ */ h(function(i) {
|
|
813
|
+
return i instanceof p && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof g) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
814
|
+
}, "_isClobbered"), $t = /* @__PURE__ */ h(function(i) {
|
|
803
815
|
return typeof o == "function" && i instanceof o;
|
|
804
816
|
}, "_isNode");
|
|
805
|
-
function
|
|
806
|
-
|
|
807
|
-
x.call(t, i,
|
|
817
|
+
function ge(v, i, u) {
|
|
818
|
+
Ve(v, (x) => {
|
|
819
|
+
x.call(t, i, u, Pe);
|
|
808
820
|
});
|
|
809
821
|
}
|
|
810
|
-
|
|
811
|
-
const Tn = /* @__PURE__ */
|
|
812
|
-
let
|
|
813
|
-
if (
|
|
814
|
-
return
|
|
822
|
+
h(ge, "_executeHooks");
|
|
823
|
+
const Tn = /* @__PURE__ */ h(function(i) {
|
|
824
|
+
let u = null;
|
|
825
|
+
if (ge(U.beforeSanitizeElements, i, null), Nt(i))
|
|
826
|
+
return re(i), !0;
|
|
815
827
|
const x = B(i.nodeName);
|
|
816
|
-
if (
|
|
828
|
+
if (ge(U.uponSanitizeElement, i, {
|
|
817
829
|
tagName: x,
|
|
818
830
|
allowedTags: b
|
|
819
|
-
}),
|
|
820
|
-
return
|
|
821
|
-
if (!(ee.tagCheck instanceof Function && ee.tagCheck(x)) &&
|
|
822
|
-
if (!J[x] && An(x) && (
|
|
831
|
+
}), We && i.hasChildNodes() && !$t(i.firstElementChild) && q(/<[/\w!]/g, i.innerHTML) && q(/<[/\w!]/g, i.textContent) || We && i.namespaceURI === ce && x === "style" && $t(i.firstElementChild) || i.nodeType === Ke.progressingInstruction || We && i.nodeType === Ke.comment && q(/<[/\w]/g, i.data))
|
|
832
|
+
return re(i), !0;
|
|
833
|
+
if (J[x] || !(ee.tagCheck instanceof Function && ee.tagCheck(x)) && !b[x]) {
|
|
834
|
+
if (!J[x] && An(x) && (C.tagNameCheck instanceof RegExp && q(C.tagNameCheck, x) || C.tagNameCheck instanceof Function && C.tagNameCheck(x)))
|
|
823
835
|
return !1;
|
|
824
|
-
if (It && !
|
|
825
|
-
const
|
|
826
|
-
if (W &&
|
|
827
|
-
const
|
|
828
|
-
for (let K =
|
|
829
|
-
const
|
|
830
|
-
|
|
836
|
+
if (It && !oe[x]) {
|
|
837
|
+
const P = ne(i) || i.parentNode, W = me(i) || i.childNodes;
|
|
838
|
+
if (W && P) {
|
|
839
|
+
const N = W.length;
|
|
840
|
+
for (let K = N - 1; K >= 0; --K) {
|
|
841
|
+
const Q = S(W[K], !0);
|
|
842
|
+
Q.__removalCount = (i.__removalCount || 0) + 1, P.insertBefore(Q, de(i));
|
|
831
843
|
}
|
|
832
844
|
}
|
|
833
845
|
}
|
|
834
|
-
return
|
|
846
|
+
return re(i), !0;
|
|
835
847
|
}
|
|
836
|
-
return i instanceof c && !
|
|
837
|
-
|
|
838
|
-
}), i.textContent !==
|
|
848
|
+
return i instanceof c && !ks(i) || (x === "noscript" || x === "noembed" || x === "noframes") && q(/<\/no(script|embed|frames)/i, i.innerHTML) ? (re(i), !0) : (Se && i.nodeType === Ke.text && (u = i.textContent, Ve([ve, Me, ye], (P) => {
|
|
849
|
+
u = Ne(u, P, " ");
|
|
850
|
+
}), i.textContent !== u && (Ye(t.removed, {
|
|
839
851
|
element: i.cloneNode()
|
|
840
|
-
}), i.textContent =
|
|
841
|
-
}, "_sanitizeElements"), Sn = /* @__PURE__ */
|
|
842
|
-
if (
|
|
852
|
+
}), i.textContent = u)), ge(U.afterSanitizeElements, i, null), !1);
|
|
853
|
+
}, "_sanitizeElements"), Sn = /* @__PURE__ */ h(function(i, u, x) {
|
|
854
|
+
if (Te[u] || dn && (u === "id" || u === "name") && (x in e || x in bs))
|
|
843
855
|
return !1;
|
|
844
|
-
if (!(Rt && !
|
|
845
|
-
if (!(
|
|
846
|
-
if (!(ee.attributeCheck instanceof Function && ee.attributeCheck(
|
|
847
|
-
if (!k[
|
|
856
|
+
if (!(Rt && !Te[u] && q(At, u))) {
|
|
857
|
+
if (!(un && q(Et, u))) {
|
|
858
|
+
if (!(ee.attributeCheck instanceof Function && ee.attributeCheck(u, i))) {
|
|
859
|
+
if (!k[u] || Te[u]) {
|
|
848
860
|
if (
|
|
849
861
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
850
862
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
851
863
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
852
|
-
!(An(i) && (
|
|
864
|
+
!(An(i) && (C.tagNameCheck instanceof RegExp && q(C.tagNameCheck, i) || C.tagNameCheck instanceof Function && C.tagNameCheck(i)) && (C.attributeNameCheck instanceof RegExp && q(C.attributeNameCheck, u) || C.attributeNameCheck instanceof Function && C.attributeNameCheck(u, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
853
865
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
854
|
-
|
|
866
|
+
u === "is" && C.allowCustomizedBuiltInElements && (C.tagNameCheck instanceof RegExp && q(C.tagNameCheck, x) || C.tagNameCheck instanceof Function && C.tagNameCheck(x)))
|
|
855
867
|
) return !1;
|
|
856
|
-
} else if (!Lt[
|
|
857
|
-
if (!q(
|
|
858
|
-
if (!((
|
|
859
|
-
if (!(
|
|
868
|
+
} else if (!Lt[u]) {
|
|
869
|
+
if (!q(Ge, Ne(x, at, ""))) {
|
|
870
|
+
if (!((u === "src" || u === "xlink:href" || u === "href") && i !== "script" && Ws(x, "data:") === 0 && gn[i])) {
|
|
871
|
+
if (!(hn && !q(_t, Ne(x, at, "")))) {
|
|
860
872
|
if (x)
|
|
861
873
|
return !1;
|
|
862
874
|
}
|
|
@@ -867,14 +879,14 @@ function ts() {
|
|
|
867
879
|
}
|
|
868
880
|
}
|
|
869
881
|
return !0;
|
|
870
|
-
}, "_isValidAttribute"), An = /* @__PURE__ */
|
|
871
|
-
return i !== "annotation-xml" &&
|
|
872
|
-
}, "_isBasicCustomElement"), En = /* @__PURE__ */
|
|
873
|
-
|
|
882
|
+
}, "_isValidAttribute"), An = /* @__PURE__ */ h(function(i) {
|
|
883
|
+
return i !== "annotation-xml" && Gt(i, lt);
|
|
884
|
+
}, "_isBasicCustomElement"), En = /* @__PURE__ */ h(function(i) {
|
|
885
|
+
ge(U.beforeSanitizeAttributes, i, null);
|
|
874
886
|
const {
|
|
875
|
-
attributes:
|
|
887
|
+
attributes: u
|
|
876
888
|
} = i;
|
|
877
|
-
if (!
|
|
889
|
+
if (!u || Nt(i))
|
|
878
890
|
return;
|
|
879
891
|
const x = {
|
|
880
892
|
attrName: "",
|
|
@@ -883,42 +895,42 @@ function ts() {
|
|
|
883
895
|
allowedAttributes: k,
|
|
884
896
|
forceKeepAttr: void 0
|
|
885
897
|
};
|
|
886
|
-
let
|
|
887
|
-
for (;
|
|
888
|
-
const W =
|
|
889
|
-
name:
|
|
898
|
+
let P = u.length;
|
|
899
|
+
for (; P--; ) {
|
|
900
|
+
const W = u[P], {
|
|
901
|
+
name: N,
|
|
890
902
|
namespaceURI: K,
|
|
891
|
-
value:
|
|
892
|
-
} = W,
|
|
893
|
-
let H =
|
|
894
|
-
if (x.attrName =
|
|
895
|
-
|
|
903
|
+
value: Q
|
|
904
|
+
} = W, xe = B(N), Ut = Q;
|
|
905
|
+
let H = N === "value" ? Ut : js(Ut);
|
|
906
|
+
if (x.attrName = xe, x.attrValue = H, x.keepAttr = !0, x.forceKeepAttr = void 0, ge(U.uponSanitizeAttribute, i, x), H = x.attrValue, fn && (xe === "id" || xe === "name") && (Ee(N, i), H = ds + H), We && q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, H)) {
|
|
907
|
+
Ee(N, i);
|
|
896
908
|
continue;
|
|
897
909
|
}
|
|
898
|
-
if (
|
|
899
|
-
|
|
910
|
+
if (xe === "attributename" && Gt(H, "href")) {
|
|
911
|
+
Ee(N, i);
|
|
900
912
|
continue;
|
|
901
913
|
}
|
|
902
914
|
if (x.forceKeepAttr)
|
|
903
915
|
continue;
|
|
904
916
|
if (!x.keepAttr) {
|
|
905
|
-
|
|
917
|
+
Ee(N, i);
|
|
906
918
|
continue;
|
|
907
919
|
}
|
|
908
|
-
if (!
|
|
909
|
-
|
|
920
|
+
if (!pn && q(/\/>/i, H)) {
|
|
921
|
+
Ee(N, i);
|
|
910
922
|
continue;
|
|
911
923
|
}
|
|
912
|
-
|
|
913
|
-
H =
|
|
924
|
+
Se && Ve([ve, Me, ye], (Cn) => {
|
|
925
|
+
H = Ne(H, Cn, " ");
|
|
914
926
|
});
|
|
915
|
-
const
|
|
916
|
-
if (!Sn(
|
|
917
|
-
|
|
927
|
+
const Rn = B(i.nodeName);
|
|
928
|
+
if (!Sn(Rn, xe, H)) {
|
|
929
|
+
Ee(N, i);
|
|
918
930
|
continue;
|
|
919
931
|
}
|
|
920
932
|
if ($ && typeof m == "object" && typeof m.getAttributeType == "function" && !K)
|
|
921
|
-
switch (m.getAttributeType(
|
|
933
|
+
switch (m.getAttributeType(Rn, xe)) {
|
|
922
934
|
case "TrustedHTML": {
|
|
923
935
|
H = $.createHTML(H);
|
|
924
936
|
break;
|
|
@@ -928,124 +940,131 @@ function ts() {
|
|
|
928
940
|
break;
|
|
929
941
|
}
|
|
930
942
|
}
|
|
931
|
-
if (H !==
|
|
943
|
+
if (H !== Ut)
|
|
932
944
|
try {
|
|
933
|
-
K ? i.setAttributeNS(K,
|
|
945
|
+
K ? i.setAttributeNS(K, N, H) : i.setAttribute(N, H), Nt(i) ? re(i) : Pn(t.removed);
|
|
934
946
|
} catch {
|
|
935
|
-
|
|
947
|
+
Ee(N, i);
|
|
936
948
|
}
|
|
937
949
|
}
|
|
938
|
-
|
|
939
|
-
}, "_sanitizeAttributes"),
|
|
940
|
-
let
|
|
941
|
-
const x =
|
|
942
|
-
for (
|
|
943
|
-
|
|
944
|
-
|
|
950
|
+
ge(U.afterSanitizeAttributes, i, null);
|
|
951
|
+
}, "_sanitizeAttributes"), _n = /* @__PURE__ */ h(function(i) {
|
|
952
|
+
let u = null;
|
|
953
|
+
const x = yn(i);
|
|
954
|
+
for (ge(U.beforeSanitizeShadowDOM, i, null); u = x.nextNode(); )
|
|
955
|
+
ge(U.uponSanitizeShadowNode, u, null), Tn(u), En(u), u.content instanceof r && _n(u.content);
|
|
956
|
+
ge(U.afterSanitizeShadowDOM, i, null);
|
|
945
957
|
}, "_sanitizeShadowDOM");
|
|
946
|
-
return t.sanitize = function(
|
|
947
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
948
|
-
if (zt = !
|
|
949
|
-
if (typeof
|
|
950
|
-
if (
|
|
951
|
-
throw
|
|
958
|
+
return t.sanitize = function(v) {
|
|
959
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, x = null, P = null, W = null;
|
|
960
|
+
if (zt = !v, zt && (v = "<!-->"), typeof v != "string" && !$t(v))
|
|
961
|
+
if (typeof v.toString == "function") {
|
|
962
|
+
if (v = v.toString(), typeof v != "string")
|
|
963
|
+
throw Ze("dirty is not a string, aborting");
|
|
952
964
|
} else
|
|
953
|
-
throw
|
|
965
|
+
throw Ze("toString is not a function");
|
|
954
966
|
if (!t.isSupported)
|
|
955
|
-
return
|
|
956
|
-
if (
|
|
957
|
-
if (
|
|
958
|
-
const
|
|
959
|
-
if (!b[
|
|
960
|
-
throw
|
|
961
|
-
}
|
|
962
|
-
} else if (
|
|
963
|
-
|
|
967
|
+
return v;
|
|
968
|
+
if (Ct || Pt(i), t.removed = [], typeof v == "string" && (je = !1), je) {
|
|
969
|
+
if (v.nodeName) {
|
|
970
|
+
const Q = B(v.nodeName);
|
|
971
|
+
if (!b[Q] || J[Q])
|
|
972
|
+
throw Ze("root node is forbidden and cannot be sanitized in-place");
|
|
973
|
+
}
|
|
974
|
+
} else if (v instanceof o)
|
|
975
|
+
u = vn("<!---->"), x = u.ownerDocument.importNode(v, !0), x.nodeType === Ke.element && x.nodeName === "BODY" || x.nodeName === "HTML" ? u = x : u.appendChild(x);
|
|
964
976
|
else {
|
|
965
|
-
if (!
|
|
966
|
-
|
|
967
|
-
return $ &&
|
|
968
|
-
if (
|
|
969
|
-
return
|
|
977
|
+
if (!Le && !Se && !Ae && // eslint-disable-next-line unicorn/prefer-includes
|
|
978
|
+
v.indexOf("<") === -1)
|
|
979
|
+
return $ && ct ? $.createHTML(v) : v;
|
|
980
|
+
if (u = vn(v), !u)
|
|
981
|
+
return Le ? null : ct ? j : "";
|
|
970
982
|
}
|
|
971
|
-
|
|
972
|
-
const
|
|
973
|
-
for (;
|
|
974
|
-
Tn(
|
|
975
|
-
if (
|
|
976
|
-
return
|
|
977
|
-
if (
|
|
978
|
-
if (
|
|
979
|
-
|
|
980
|
-
|
|
983
|
+
u && Dt && re(u.firstChild);
|
|
984
|
+
const N = yn(je ? v : u);
|
|
985
|
+
for (; P = N.nextNode(); )
|
|
986
|
+
Tn(P), En(P), P.content instanceof r && _n(P.content);
|
|
987
|
+
if (je)
|
|
988
|
+
return v;
|
|
989
|
+
if (Le) {
|
|
990
|
+
if (Se) {
|
|
991
|
+
u.normalize();
|
|
992
|
+
let Q = u.innerHTML;
|
|
993
|
+
Ve([ve, Me, ye], (xe) => {
|
|
994
|
+
Q = Ne(Q, xe, " ");
|
|
995
|
+
}), u.innerHTML = Q;
|
|
996
|
+
}
|
|
997
|
+
if (ot)
|
|
998
|
+
for (W = rt.call(u.ownerDocument); u.firstChild; )
|
|
999
|
+
W.appendChild(u.firstChild);
|
|
981
1000
|
else
|
|
982
|
-
W =
|
|
983
|
-
return (k.shadowroot || k.shadowrootmode) && (W =
|
|
1001
|
+
W = u;
|
|
1002
|
+
return (k.shadowroot || k.shadowrootmode) && (W = it.call(n, W, !0)), W;
|
|
984
1003
|
}
|
|
985
|
-
let K =
|
|
986
|
-
return
|
|
987
|
-
` + K),
|
|
988
|
-
K =
|
|
989
|
-
}), $ &&
|
|
1004
|
+
let K = Ae ? u.outerHTML : u.innerHTML;
|
|
1005
|
+
return Ae && b["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && q(ts, u.ownerDocument.doctype.name) && (K = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
|
|
1006
|
+
` + K), Se && Ve([ve, Me, ye], (Q) => {
|
|
1007
|
+
K = Ne(K, Q, " ");
|
|
1008
|
+
}), $ && ct ? $.createHTML(K) : K;
|
|
990
1009
|
}, t.setConfig = function() {
|
|
991
|
-
let
|
|
992
|
-
|
|
1010
|
+
let v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1011
|
+
Pt(v), Ct = !0;
|
|
993
1012
|
}, t.clearConfig = function() {
|
|
994
|
-
|
|
995
|
-
}, t.isValidAttribute = function(
|
|
996
|
-
|
|
997
|
-
const x = B(
|
|
998
|
-
return Sn(x,
|
|
999
|
-
}, t.addHook = function(
|
|
1000
|
-
typeof i == "function" &&
|
|
1001
|
-
}, t.removeHook = function(
|
|
1013
|
+
Pe = null, Ct = !1;
|
|
1014
|
+
}, t.isValidAttribute = function(v, i, u) {
|
|
1015
|
+
Pe || Pt({});
|
|
1016
|
+
const x = B(v), P = B(i);
|
|
1017
|
+
return Sn(x, P, u);
|
|
1018
|
+
}, t.addHook = function(v, i) {
|
|
1019
|
+
typeof i == "function" && Ye(U[v], i);
|
|
1020
|
+
}, t.removeHook = function(v, i) {
|
|
1002
1021
|
if (i !== void 0) {
|
|
1003
|
-
const
|
|
1004
|
-
return
|
|
1022
|
+
const u = Hs(U[v], i);
|
|
1023
|
+
return u === -1 ? void 0 : Gs(U[v], u, 1)[0];
|
|
1005
1024
|
}
|
|
1006
|
-
return
|
|
1007
|
-
}, t.removeHooks = function(
|
|
1008
|
-
U[
|
|
1025
|
+
return Pn(U[v]);
|
|
1026
|
+
}, t.removeHooks = function(v) {
|
|
1027
|
+
U[v] = [];
|
|
1009
1028
|
}, t.removeAllHooks = function() {
|
|
1010
|
-
U =
|
|
1029
|
+
U = Hn();
|
|
1011
1030
|
}, t;
|
|
1012
1031
|
}
|
|
1013
|
-
|
|
1014
|
-
var ar =
|
|
1015
|
-
function
|
|
1032
|
+
h(ns, "createDOMPurify");
|
|
1033
|
+
var ar = ns();
|
|
1034
|
+
function Jt() {
|
|
1016
1035
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1017
1036
|
}
|
|
1018
|
-
|
|
1019
|
-
var
|
|
1020
|
-
function
|
|
1021
|
-
|
|
1037
|
+
h(Jt, "M");
|
|
1038
|
+
var Ie = Jt();
|
|
1039
|
+
function ss(l) {
|
|
1040
|
+
Ie = l;
|
|
1022
1041
|
}
|
|
1023
|
-
|
|
1024
|
-
var
|
|
1042
|
+
h(ss, "G");
|
|
1043
|
+
var Re = { exec: /* @__PURE__ */ h(() => null, "exec") };
|
|
1025
1044
|
function I(l, t = "") {
|
|
1026
|
-
let e = typeof l == "string" ? l : l.source, n = { replace: /* @__PURE__ */
|
|
1045
|
+
let e = typeof l == "string" ? l : l.source, n = { replace: /* @__PURE__ */ h((s, r) => {
|
|
1027
1046
|
let a = typeof r == "string" ? r : r.source;
|
|
1028
1047
|
return a = a.replace(Y.caret, "$1"), e = e.replace(s, a), n;
|
|
1029
|
-
}, "replace"), getRegex: /* @__PURE__ */
|
|
1048
|
+
}, "replace"), getRegex: /* @__PURE__ */ h(() => new RegExp(e, t), "getRegex") };
|
|
1030
1049
|
return n;
|
|
1031
1050
|
}
|
|
1032
|
-
|
|
1051
|
+
h(I, "k");
|
|
1033
1052
|
var lr = (() => {
|
|
1034
1053
|
try {
|
|
1035
1054
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
1036
1055
|
} catch {
|
|
1037
1056
|
return !1;
|
|
1038
1057
|
}
|
|
1039
|
-
})(), Y = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */
|
|
1040
|
-
]`).replace("lheading",
|
|
1041
|
-
function
|
|
1058
|
+
})(), Y = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ h((l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ h((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ h((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ h((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ h((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ h((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ h((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}>`), "blockquoteBeginRegex") }, or = /^(?:[ \t]*(?:\n|$))+/, cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ur = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, st = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, hr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, en = / {0,3}(?:[*+-]|\d{1,9}[.)])/, rs = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, is = I(rs).replace(/bull/g, en).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), pr = I(rs).replace(/bull/g, en).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(), tn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, dr = /^[^\n]+/, nn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, fr = I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", nn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), gr = I(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, en).getRegex(), Tt = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", sn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, mr = I("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", sn).replace("tag", Tt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), as = I(tn).replace("hr", st).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Tt).getRegex(), xr = I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", as).getRegex(), rn = { blockquote: xr, code: cr, def: fr, fences: ur, heading: hr, hr: st, html: mr, lheading: is, list: gr, newline: or, paragraph: as, table: Re, text: dr }, Gn = I("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", st).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Tt).getRegex(), br = { ...rn, lheading: pr, table: Gn, paragraph: I(tn).replace("hr", st).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Gn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Tt).getRegex() }, kr = { ...rn, html: I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", sn).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: Re, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: I(tn).replace("hr", st).replace("heading", ` *#{1,6} *[^
|
|
1059
|
+
]`).replace("lheading", is).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, wr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, vr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ls = /^( {2,}|\\)\n(?!\s*$)/, yr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, He = /[\p{P}\p{S}]/u, St = /[\s\p{P}\p{S}]/u, an = /[^\s\p{P}\p{S}]/u, Tr = I(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, St).getRegex(), os = /(?!~)[\p{P}\p{S}]/u, Sr = /(?!~)[\s\p{P}\p{S}]/u, Ar = /(?:[^\s\p{P}\p{S}]|~)/u, Er = I(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", lr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), cs = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, _r = I(cs, "u").replace(/punct/g, He).getRegex(), Rr = I(cs, "u").replace(/punct/g, os).getRegex(), us = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Cr = I(us, "gu").replace(/notPunctSpace/g, an).replace(/punctSpace/g, St).replace(/punct/g, He).getRegex(), Dr = I(us, "gu").replace(/notPunctSpace/g, Ar).replace(/punctSpace/g, Sr).replace(/punct/g, os).getRegex(), Ir = I("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, an).replace(/punctSpace/g, St).replace(/punct/g, He).getRegex(), Mr = I(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, He).getRegex(), Lr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", zr = I(Lr, "gu").replace(/notPunctSpace/g, an).replace(/punctSpace/g, St).replace(/punct/g, He).getRegex(), Or = I(/\\(punct)/, "gu").replace(/punct/g, He).getRegex(), Pr = I(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Nr = I(sn).replace("(?:-->|$)", "-->").getRegex(), $r = I("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Nr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), wt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ur = I(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", wt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), hs = I(/^!?\[(label)\]\[(ref)\]/).replace("label", wt).replace("ref", nn).getRegex(), ps = I(/^!?\[(ref)\](?:\[\])?/).replace("ref", nn).getRegex(), Br = I("reflink|nolink(?!\\()", "g").replace("reflink", hs).replace("nolink", ps).getRegex(), Wn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, ln = { _backpedal: Re, anyPunctuation: Or, autolink: Pr, blockSkip: Er, br: ls, code: vr, del: Re, delLDelim: Re, delRDelim: Re, emStrongLDelim: _r, emStrongRDelimAst: Cr, emStrongRDelimUnd: Ir, escape: wr, link: Ur, nolink: ps, punctuation: Tr, reflink: hs, reflinkSearch: Br, tag: $r, text: yr, url: Re }, Fr = { ...ln, link: I(/^!?\[(label)\]\((.*?)\)/).replace("label", wt).getRegex(), reflink: I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", wt).getRegex() }, Kt = { ...ln, emStrongRDelimAst: Dr, emStrongLDelim: Rr, delLDelim: Mr, delRDelim: zr, url: I(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Wn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: I(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Wn).getRegex() }, Hr = { ...Kt, br: I(ls).replace("{2,}", "*").getRegex(), text: I(Kt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, mt = { normal: rn, gfm: br, pedantic: kr }, Qe = { normal: ln, gfm: Kt, breaks: Hr, pedantic: Fr }, Gr = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, jn = /* @__PURE__ */ h((l) => Gr[l], "ke");
|
|
1060
|
+
function he(l, t) {
|
|
1042
1061
|
if (t) {
|
|
1043
|
-
if (Y.escapeTest.test(l)) return l.replace(Y.escapeReplace,
|
|
1044
|
-
} else if (Y.escapeTestNoEncode.test(l)) return l.replace(Y.escapeReplaceNoEncode,
|
|
1062
|
+
if (Y.escapeTest.test(l)) return l.replace(Y.escapeReplace, jn);
|
|
1063
|
+
} else if (Y.escapeTestNoEncode.test(l)) return l.replace(Y.escapeReplaceNoEncode, jn);
|
|
1045
1064
|
return l;
|
|
1046
1065
|
}
|
|
1047
|
-
|
|
1048
|
-
function
|
|
1066
|
+
h(he, "T");
|
|
1067
|
+
function qn(l) {
|
|
1049
1068
|
try {
|
|
1050
1069
|
l = encodeURI(l).replace(Y.percentDecode, "%");
|
|
1051
1070
|
} catch {
|
|
@@ -1053,8 +1072,8 @@ function jn(l) {
|
|
|
1053
1072
|
}
|
|
1054
1073
|
return l;
|
|
1055
1074
|
}
|
|
1056
|
-
|
|
1057
|
-
function
|
|
1075
|
+
h(qn, "J");
|
|
1076
|
+
function Vn(l, t) {
|
|
1058
1077
|
let e = l.replace(Y.findPipe, (r, a, o) => {
|
|
1059
1078
|
let c = !1, d = a;
|
|
1060
1079
|
for (; --d >= 0 && o[d] === "\\"; ) c = !c;
|
|
@@ -1065,8 +1084,8 @@ function qn(l, t) {
|
|
|
1065
1084
|
for (; s < n.length; s++) n[s] = n[s].trim().replace(Y.slashPipe, "|");
|
|
1066
1085
|
return n;
|
|
1067
1086
|
}
|
|
1068
|
-
|
|
1069
|
-
function
|
|
1087
|
+
h(Vn, "V");
|
|
1088
|
+
function Je(l, t, e) {
|
|
1070
1089
|
let n = l.length;
|
|
1071
1090
|
if (n === 0) return "";
|
|
1072
1091
|
let s = 0;
|
|
@@ -1074,7 +1093,7 @@ function Ke(l, t, e) {
|
|
|
1074
1093
|
s++;
|
|
1075
1094
|
return l.slice(0, n - s);
|
|
1076
1095
|
}
|
|
1077
|
-
|
|
1096
|
+
h(Je, "I");
|
|
1078
1097
|
function Wr(l, t) {
|
|
1079
1098
|
if (l.indexOf(t[1]) === -1) return -1;
|
|
1080
1099
|
let e = 0;
|
|
@@ -1083,7 +1102,7 @@ function Wr(l, t) {
|
|
|
1083
1102
|
else if (l[n] === t[1] && (e--, e < 0)) return n;
|
|
1084
1103
|
return e > 0 ? -2 : -1;
|
|
1085
1104
|
}
|
|
1086
|
-
|
|
1105
|
+
h(Wr, "de");
|
|
1087
1106
|
function jr(l, t = 0) {
|
|
1088
1107
|
let e = t, n = "";
|
|
1089
1108
|
for (let s of l) if (s === " ") {
|
|
@@ -1092,14 +1111,14 @@ function jr(l, t = 0) {
|
|
|
1092
1111
|
} else n += s, e++;
|
|
1093
1112
|
return n;
|
|
1094
1113
|
}
|
|
1095
|
-
|
|
1096
|
-
function
|
|
1114
|
+
h(jr, "ge");
|
|
1115
|
+
function Yn(l, t, e, n, s) {
|
|
1097
1116
|
let r = t.href, a = t.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
|
|
1098
1117
|
n.state.inLink = !0;
|
|
1099
1118
|
let c = { type: l[0].charAt(0) === "!" ? "image" : "link", raw: e, href: r, title: a, text: o, tokens: n.inlineTokens(o) };
|
|
1100
1119
|
return n.state.inLink = !1, c;
|
|
1101
1120
|
}
|
|
1102
|
-
|
|
1121
|
+
h(Yn, "fe");
|
|
1103
1122
|
function qr(l, t, e) {
|
|
1104
1123
|
let n = l.match(e.other.indentCodeCompensation);
|
|
1105
1124
|
if (n === null) return t;
|
|
@@ -1113,13 +1132,13 @@ function qr(l, t, e) {
|
|
|
1113
1132
|
}).join(`
|
|
1114
1133
|
`);
|
|
1115
1134
|
}
|
|
1116
|
-
|
|
1117
|
-
var
|
|
1135
|
+
h(qr, "nt");
|
|
1136
|
+
var $e, vt = ($e = class {
|
|
1118
1137
|
constructor(t) {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
this.options = t ||
|
|
1138
|
+
D(this, "options");
|
|
1139
|
+
D(this, "rules");
|
|
1140
|
+
D(this, "lexer");
|
|
1141
|
+
this.options = t || Ie;
|
|
1123
1142
|
}
|
|
1124
1143
|
space(t) {
|
|
1125
1144
|
let e = this.rules.block.newline.exec(t);
|
|
@@ -1129,7 +1148,7 @@ var Ne, vt = (Ne = class {
|
|
|
1129
1148
|
let e = this.rules.block.code.exec(t);
|
|
1130
1149
|
if (e) {
|
|
1131
1150
|
let n = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
1132
|
-
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n :
|
|
1151
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : Je(n, `
|
|
1133
1152
|
`) };
|
|
1134
1153
|
}
|
|
1135
1154
|
}
|
|
@@ -1145,7 +1164,7 @@ var Ne, vt = (Ne = class {
|
|
|
1145
1164
|
if (e) {
|
|
1146
1165
|
let n = e[2].trim();
|
|
1147
1166
|
if (this.rules.other.endingHash.test(n)) {
|
|
1148
|
-
let s =
|
|
1167
|
+
let s = Je(n, "#");
|
|
1149
1168
|
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
1150
1169
|
}
|
|
1151
1170
|
return { type: "heading", raw: e[0], depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
@@ -1153,13 +1172,13 @@ var Ne, vt = (Ne = class {
|
|
|
1153
1172
|
}
|
|
1154
1173
|
hr(t) {
|
|
1155
1174
|
let e = this.rules.block.hr.exec(t);
|
|
1156
|
-
if (e) return { type: "hr", raw:
|
|
1175
|
+
if (e) return { type: "hr", raw: Je(e[0], `
|
|
1157
1176
|
`) };
|
|
1158
1177
|
}
|
|
1159
1178
|
blockquote(t) {
|
|
1160
1179
|
let e = this.rules.block.blockquote.exec(t);
|
|
1161
1180
|
if (e) {
|
|
1162
|
-
let n =
|
|
1181
|
+
let n = Je(e[0], `
|
|
1163
1182
|
`).split(`
|
|
1164
1183
|
`), s = "", r = "", a = [];
|
|
1165
1184
|
for (; n.length > 0; ) {
|
|
@@ -1168,27 +1187,27 @@ var Ne, vt = (Ne = class {
|
|
|
1168
1187
|
else if (!o) c.push(n[d]);
|
|
1169
1188
|
else break;
|
|
1170
1189
|
n = n.slice(d);
|
|
1171
|
-
let
|
|
1172
|
-
`), p =
|
|
1190
|
+
let g = c.join(`
|
|
1191
|
+
`), p = g.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1173
1192
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1174
1193
|
s = s ? `${s}
|
|
1175
|
-
${
|
|
1194
|
+
${g}` : g, r = r ? `${r}
|
|
1176
1195
|
${p}` : p;
|
|
1177
|
-
let
|
|
1178
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, a, !0), this.lexer.state.top =
|
|
1196
|
+
let f = this.lexer.state.top;
|
|
1197
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, a, !0), this.lexer.state.top = f, n.length === 0) break;
|
|
1179
1198
|
let m = a.at(-1);
|
|
1180
1199
|
if (m?.type === "code") break;
|
|
1181
1200
|
if (m?.type === "blockquote") {
|
|
1182
1201
|
let y = m, S = y.raw + `
|
|
1183
1202
|
` + n.join(`
|
|
1184
|
-
`),
|
|
1185
|
-
a[a.length - 1] =
|
|
1203
|
+
`), z = this.blockquote(S);
|
|
1204
|
+
a[a.length - 1] = z, s = s.substring(0, s.length - y.raw.length) + z.raw, r = r.substring(0, r.length - y.text.length) + z.text;
|
|
1186
1205
|
break;
|
|
1187
1206
|
} else if (m?.type === "list") {
|
|
1188
1207
|
let y = m, S = y.raw + `
|
|
1189
1208
|
` + n.join(`
|
|
1190
|
-
`),
|
|
1191
|
-
a[a.length - 1] =
|
|
1209
|
+
`), z = this.list(S);
|
|
1210
|
+
a[a.length - 1] = z, s = s.substring(0, s.length - m.raw.length) + z.raw, r = r.substring(0, r.length - y.raw.length) + z.raw, n = S.substring(a.at(-1).raw.length).split(`
|
|
1192
1211
|
`);
|
|
1193
1212
|
continue;
|
|
1194
1213
|
}
|
|
@@ -1203,31 +1222,31 @@ ${p}` : p;
|
|
|
1203
1222
|
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
1204
1223
|
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
1205
1224
|
for (; t; ) {
|
|
1206
|
-
let d = !1,
|
|
1225
|
+
let d = !1, g = "", p = "";
|
|
1207
1226
|
if (!(e = a.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1208
|
-
|
|
1209
|
-
let
|
|
1227
|
+
g = e[0], t = t.substring(g.length);
|
|
1228
|
+
let f = jr(e[2].split(`
|
|
1210
1229
|
`, 1)[0], e[1].length), m = t.split(`
|
|
1211
|
-
`, 1)[0], y = !
|
|
1212
|
-
if (this.options.pedantic ? (S = 2, p =
|
|
1230
|
+
`, 1)[0], y = !f.trim(), S = 0;
|
|
1231
|
+
if (this.options.pedantic ? (S = 2, p = f.trimStart()) : y ? S = e[1].length + 1 : (S = f.search(this.rules.other.nonSpaceChar), S = S > 4 ? 1 : S, p = f.slice(S), S += e[1].length), y && this.rules.other.blankLine.test(m) && (g += m + `
|
|
1213
1232
|
`, t = t.substring(m.length + 1), d = !0), !d) {
|
|
1214
|
-
let
|
|
1233
|
+
let z = this.rules.other.nextBulletRegex(S), de = this.rules.other.hrRegex(S), me = this.rules.other.fencesBeginRegex(S), ne = this.rules.other.headingBeginRegex(S), $ = this.rules.other.htmlBeginRegex(S), j = this.rules.other.blockquoteBeginRegex(S);
|
|
1215
1234
|
for (; t; ) {
|
|
1216
1235
|
let se = t.split(`
|
|
1217
|
-
`, 1)[0],
|
|
1218
|
-
if (m = se, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "),
|
|
1219
|
-
if (
|
|
1220
|
-
` +
|
|
1236
|
+
`, 1)[0], fe;
|
|
1237
|
+
if (m = se, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), fe = m) : fe = m.replace(this.rules.other.tabCharGlobal, " "), me.test(m) || ne.test(m) || $.test(m) || j.test(m) || z.test(m) || de.test(m)) break;
|
|
1238
|
+
if (fe.search(this.rules.other.nonSpaceChar) >= S || !m.trim()) p += `
|
|
1239
|
+
` + fe.slice(S);
|
|
1221
1240
|
else {
|
|
1222
|
-
if (y ||
|
|
1241
|
+
if (y || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || me.test(f) || ne.test(f) || de.test(f)) break;
|
|
1223
1242
|
p += `
|
|
1224
1243
|
` + m;
|
|
1225
1244
|
}
|
|
1226
|
-
y = !m.trim(),
|
|
1227
|
-
`, t = t.substring(se.length + 1),
|
|
1245
|
+
y = !m.trim(), g += se + `
|
|
1246
|
+
`, t = t.substring(se.length + 1), f = fe.slice(S);
|
|
1228
1247
|
}
|
|
1229
1248
|
}
|
|
1230
|
-
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
1249
|
+
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(g) && (o = !0)), r.items.push({ type: "list_item", raw: g, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: !1, text: p, tokens: [] }), r.raw += g;
|
|
1231
1250
|
}
|
|
1232
1251
|
let c = r.items.at(-1);
|
|
1233
1252
|
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
@@ -1242,20 +1261,20 @@ ${p}` : p;
|
|
|
1242
1261
|
break;
|
|
1243
1262
|
}
|
|
1244
1263
|
}
|
|
1245
|
-
let
|
|
1246
|
-
if (
|
|
1247
|
-
let p = { type: "checkbox", raw:
|
|
1264
|
+
let g = this.rules.other.listTaskCheckbox.exec(d.raw);
|
|
1265
|
+
if (g) {
|
|
1266
|
+
let p = { type: "checkbox", raw: g[0] + " ", checked: g[0] !== "[ ]" };
|
|
1248
1267
|
d.checked = p.checked, r.loose ? d.tokens[0] && ["paragraph", "text"].includes(d.tokens[0].type) && "tokens" in d.tokens[0] && d.tokens[0].tokens ? (d.tokens[0].raw = p.raw + d.tokens[0].raw, d.tokens[0].text = p.raw + d.tokens[0].text, d.tokens[0].tokens.unshift(p)) : d.tokens.unshift({ type: "paragraph", raw: p.raw, text: p.raw, tokens: [p] }) : d.tokens.unshift(p);
|
|
1249
1268
|
}
|
|
1250
1269
|
}
|
|
1251
1270
|
if (!r.loose) {
|
|
1252
|
-
let
|
|
1271
|
+
let g = d.tokens.filter((f) => f.type === "space"), p = g.length > 0 && g.some((f) => this.rules.other.anyLine.test(f.raw));
|
|
1253
1272
|
r.loose = p;
|
|
1254
1273
|
}
|
|
1255
1274
|
}
|
|
1256
1275
|
if (r.loose) for (let d of r.items) {
|
|
1257
1276
|
d.loose = !0;
|
|
1258
|
-
for (let
|
|
1277
|
+
for (let g of d.tokens) g.type === "text" && (g.type = "paragraph");
|
|
1259
1278
|
}
|
|
1260
1279
|
return r;
|
|
1261
1280
|
}
|
|
@@ -1274,12 +1293,12 @@ ${p}` : p;
|
|
|
1274
1293
|
table(t) {
|
|
1275
1294
|
let e = this.rules.block.table.exec(t);
|
|
1276
1295
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
1277
|
-
let n =
|
|
1296
|
+
let n = Vn(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1278
1297
|
`) : [], a = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
1279
1298
|
if (n.length === s.length) {
|
|
1280
1299
|
for (let o of s) this.rules.other.tableAlignRight.test(o) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? a.align.push("left") : a.align.push(null);
|
|
1281
1300
|
for (let o = 0; o < n.length; o++) a.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: !0, align: a.align[o] });
|
|
1282
|
-
for (let o of r) a.rows.push(
|
|
1301
|
+
for (let o of r) a.rows.push(Vn(o, a.header.length).map((c, d) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: a.align[d] })));
|
|
1283
1302
|
return a;
|
|
1284
1303
|
}
|
|
1285
1304
|
}
|
|
@@ -1316,7 +1335,7 @@ ${p}` : p;
|
|
|
1316
1335
|
let n = e[2].trim();
|
|
1317
1336
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1318
1337
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1319
|
-
let a =
|
|
1338
|
+
let a = Je(n.slice(0, -1), "\\");
|
|
1320
1339
|
if ((n.length - a.length) % 2 === 0) return;
|
|
1321
1340
|
} else {
|
|
1322
1341
|
let a = Wr(e[2], "()");
|
|
@@ -1331,7 +1350,7 @@ ${p}` : p;
|
|
|
1331
1350
|
let a = this.rules.other.pedanticHrefTitle.exec(s);
|
|
1332
1351
|
a && (s = a[1], r = a[3]);
|
|
1333
1352
|
} else r = e[3] ? e[3].slice(1, -1) : "";
|
|
1334
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)),
|
|
1353
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), Yn(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
1335
1354
|
}
|
|
1336
1355
|
}
|
|
1337
1356
|
reflink(t, e) {
|
|
@@ -1342,14 +1361,14 @@ ${p}` : p;
|
|
|
1342
1361
|
let a = n[0].charAt(0);
|
|
1343
1362
|
return { type: "text", raw: a, text: a };
|
|
1344
1363
|
}
|
|
1345
|
-
return
|
|
1364
|
+
return Yn(n, r, n[0], this.lexer, this.rules);
|
|
1346
1365
|
}
|
|
1347
1366
|
}
|
|
1348
1367
|
emStrong(t, e, n = "") {
|
|
1349
1368
|
let s = this.rules.inline.emStrongLDelim.exec(t);
|
|
1350
1369
|
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1351
|
-
let r = [...s[0]].length - 1, a, o, c = r, d = 0,
|
|
1352
|
-
for (
|
|
1370
|
+
let r = [...s[0]].length - 1, a, o, c = r, d = 0, g = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1371
|
+
for (g.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = g.exec(e)) !== null; ) {
|
|
1353
1372
|
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a) continue;
|
|
1354
1373
|
if (o = [...a].length, s[3] || s[4]) {
|
|
1355
1374
|
c += o;
|
|
@@ -1360,13 +1379,13 @@ ${p}` : p;
|
|
|
1360
1379
|
}
|
|
1361
1380
|
if (c -= o, c > 0) continue;
|
|
1362
1381
|
o = Math.min(o, o + c + d);
|
|
1363
|
-
let p = [...s[0]][0].length,
|
|
1382
|
+
let p = [...s[0]][0].length, f = t.slice(0, r + s.index + p + o);
|
|
1364
1383
|
if (Math.min(r, o) % 2) {
|
|
1365
|
-
let y =
|
|
1366
|
-
return { type: "em", raw:
|
|
1384
|
+
let y = f.slice(1, -1);
|
|
1385
|
+
return { type: "em", raw: f, text: y, tokens: this.lexer.inlineTokens(y) };
|
|
1367
1386
|
}
|
|
1368
|
-
let m =
|
|
1369
|
-
return { type: "strong", raw:
|
|
1387
|
+
let m = f.slice(2, -2);
|
|
1388
|
+
return { type: "strong", raw: f, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1370
1389
|
}
|
|
1371
1390
|
}
|
|
1372
1391
|
}
|
|
@@ -1393,8 +1412,8 @@ ${p}` : p;
|
|
|
1393
1412
|
}
|
|
1394
1413
|
if (c -= o, c > 0) continue;
|
|
1395
1414
|
o = Math.min(o, o + c);
|
|
1396
|
-
let
|
|
1397
|
-
return { type: "del", raw: p, text:
|
|
1415
|
+
let g = [...s[0]][0].length, p = t.slice(0, r + s.index + g + o), f = p.slice(r, -r);
|
|
1416
|
+
return { type: "del", raw: p, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
1398
1417
|
}
|
|
1399
1418
|
}
|
|
1400
1419
|
}
|
|
@@ -1427,25 +1446,25 @@ ${p}` : p;
|
|
|
1427
1446
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1428
1447
|
}
|
|
1429
1448
|
}
|
|
1430
|
-
},
|
|
1449
|
+
}, h($e, "w"), $e), ke, ae = (ke = class {
|
|
1431
1450
|
constructor(t) {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t ||
|
|
1438
|
-
let e = { other: Y, block:
|
|
1439
|
-
this.options.pedantic ? (e.block =
|
|
1451
|
+
D(this, "tokens");
|
|
1452
|
+
D(this, "options");
|
|
1453
|
+
D(this, "state");
|
|
1454
|
+
D(this, "inlineQueue");
|
|
1455
|
+
D(this, "tokenizer");
|
|
1456
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Ie, this.options.tokenizer = this.options.tokenizer || new vt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1457
|
+
let e = { other: Y, block: mt.normal, inline: Qe.normal };
|
|
1458
|
+
this.options.pedantic ? (e.block = mt.pedantic, e.inline = Qe.pedantic) : this.options.gfm && (e.block = mt.gfm, this.options.breaks ? e.inline = Qe.breaks : e.inline = Qe.gfm), this.tokenizer.rules = e;
|
|
1440
1459
|
}
|
|
1441
1460
|
static get rules() {
|
|
1442
|
-
return { block:
|
|
1461
|
+
return { block: mt, inline: Qe };
|
|
1443
1462
|
}
|
|
1444
1463
|
static lex(t, e) {
|
|
1445
|
-
return new
|
|
1464
|
+
return new ke(e).lex(t);
|
|
1446
1465
|
}
|
|
1447
1466
|
static lexInline(t, e) {
|
|
1448
|
-
return new
|
|
1467
|
+
return new ke(e).inlineTokens(t);
|
|
1449
1468
|
}
|
|
1450
1469
|
lex(t) {
|
|
1451
1470
|
t = t.replace(Y.carriageReturn, `
|
|
@@ -1569,7 +1588,7 @@ ${p}` : p;
|
|
|
1569
1588
|
for (; t; ) {
|
|
1570
1589
|
a || (o = ""), a = !1;
|
|
1571
1590
|
let c;
|
|
1572
|
-
if (this.options.extensions?.inline?.some((
|
|
1591
|
+
if (this.options.extensions?.inline?.some((g) => (c = g.call({ lexer: this }, t, e)) ? (t = t.substring(c.raw.length), e.push(c), !0) : !1)) continue;
|
|
1573
1592
|
if (c = this.tokenizer.escape(t)) {
|
|
1574
1593
|
t = t.substring(c.raw.length), e.push(c);
|
|
1575
1594
|
continue;
|
|
@@ -1584,8 +1603,8 @@ ${p}` : p;
|
|
|
1584
1603
|
}
|
|
1585
1604
|
if (c = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1586
1605
|
t = t.substring(c.raw.length);
|
|
1587
|
-
let
|
|
1588
|
-
c.type === "text" &&
|
|
1606
|
+
let g = e.at(-1);
|
|
1607
|
+
c.type === "text" && g?.type === "text" ? (g.raw += c.raw, g.text += c.text) : e.push(c);
|
|
1589
1608
|
continue;
|
|
1590
1609
|
}
|
|
1591
1610
|
if (c = this.tokenizer.emStrong(t, n, o)) {
|
|
@@ -1614,32 +1633,32 @@ ${p}` : p;
|
|
|
1614
1633
|
}
|
|
1615
1634
|
let d = t;
|
|
1616
1635
|
if (this.options.extensions?.startInline) {
|
|
1617
|
-
let
|
|
1636
|
+
let g = 1 / 0, p = t.slice(1), f;
|
|
1618
1637
|
this.options.extensions.startInline.forEach((m) => {
|
|
1619
|
-
|
|
1620
|
-
}),
|
|
1638
|
+
f = m.call({ lexer: this }, p), typeof f == "number" && f >= 0 && (g = Math.min(g, f));
|
|
1639
|
+
}), g < 1 / 0 && g >= 0 && (d = t.substring(0, g + 1));
|
|
1621
1640
|
}
|
|
1622
1641
|
if (c = this.tokenizer.inlineText(d)) {
|
|
1623
1642
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), a = !0;
|
|
1624
|
-
let
|
|
1625
|
-
|
|
1643
|
+
let g = e.at(-1);
|
|
1644
|
+
g?.type === "text" ? (g.raw += c.raw, g.text += c.text) : e.push(c);
|
|
1626
1645
|
continue;
|
|
1627
1646
|
}
|
|
1628
1647
|
if (t) {
|
|
1629
|
-
let
|
|
1648
|
+
let g = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
1630
1649
|
if (this.options.silent) {
|
|
1631
|
-
console.error(
|
|
1650
|
+
console.error(g);
|
|
1632
1651
|
break;
|
|
1633
|
-
} else throw new Error(
|
|
1652
|
+
} else throw new Error(g);
|
|
1634
1653
|
}
|
|
1635
1654
|
}
|
|
1636
1655
|
return e;
|
|
1637
1656
|
}
|
|
1638
|
-
},
|
|
1657
|
+
}, h(ke, "u"), ke), Ue, yt = (Ue = class {
|
|
1639
1658
|
constructor(t) {
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
this.options = t ||
|
|
1659
|
+
D(this, "options");
|
|
1660
|
+
D(this, "parser");
|
|
1661
|
+
this.options = t || Ie;
|
|
1643
1662
|
}
|
|
1644
1663
|
space(t) {
|
|
1645
1664
|
return "";
|
|
@@ -1647,8 +1666,8 @@ ${p}` : p;
|
|
|
1647
1666
|
code({ text: t, lang: e, escaped: n }) {
|
|
1648
1667
|
let s = (e || "").match(Y.notSpaceStart)?.[0], r = t.replace(Y.endingNewline, "") + `
|
|
1649
1668
|
`;
|
|
1650
|
-
return s ? '<pre><code class="language-' +
|
|
1651
|
-
` : "<pre><code>" + (n ? r :
|
|
1669
|
+
return s ? '<pre><code class="language-' + he(s) + '">' + (n ? r : he(r, !0)) + `</code></pre>
|
|
1670
|
+
` : "<pre><code>" + (n ? r : he(r, !0)) + `</code></pre>
|
|
1652
1671
|
`;
|
|
1653
1672
|
}
|
|
1654
1673
|
blockquote({ tokens: t }) {
|
|
@@ -1726,7 +1745,7 @@ ${t}</tr>
|
|
|
1726
1745
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1727
1746
|
}
|
|
1728
1747
|
codespan({ text: t }) {
|
|
1729
|
-
return `<code>${
|
|
1748
|
+
return `<code>${he(t, !0)}</code>`;
|
|
1730
1749
|
}
|
|
1731
1750
|
br(t) {
|
|
1732
1751
|
return "<br>";
|
|
@@ -1735,24 +1754,24 @@ ${t}</tr>
|
|
|
1735
1754
|
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
1736
1755
|
}
|
|
1737
1756
|
link({ href: t, title: e, tokens: n }) {
|
|
1738
|
-
let s = this.parser.parseInline(n), r =
|
|
1757
|
+
let s = this.parser.parseInline(n), r = qn(t);
|
|
1739
1758
|
if (r === null) return s;
|
|
1740
1759
|
t = r;
|
|
1741
1760
|
let a = '<a href="' + t + '"';
|
|
1742
|
-
return e && (a += ' title="' +
|
|
1761
|
+
return e && (a += ' title="' + he(e) + '"'), a += ">" + s + "</a>", a;
|
|
1743
1762
|
}
|
|
1744
1763
|
image({ href: t, title: e, text: n, tokens: s }) {
|
|
1745
1764
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1746
|
-
let r =
|
|
1747
|
-
if (r === null) return
|
|
1765
|
+
let r = qn(t);
|
|
1766
|
+
if (r === null) return he(n);
|
|
1748
1767
|
t = r;
|
|
1749
|
-
let a = `<img src="${t}" alt="${
|
|
1750
|
-
return e && (a += ` title="${
|
|
1768
|
+
let a = `<img src="${t}" alt="${he(n)}"`;
|
|
1769
|
+
return e && (a += ` title="${he(e)}"`), a += ">", a;
|
|
1751
1770
|
}
|
|
1752
1771
|
text(t) {
|
|
1753
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
1772
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : he(t.text);
|
|
1754
1773
|
}
|
|
1755
|
-
},
|
|
1774
|
+
}, h(Ue, "y"), Ue), Be, on = (Be = class {
|
|
1756
1775
|
strong({ text: t }) {
|
|
1757
1776
|
return t;
|
|
1758
1777
|
}
|
|
@@ -1783,18 +1802,18 @@ ${t}</tr>
|
|
|
1783
1802
|
checkbox({ raw: t }) {
|
|
1784
1803
|
return t;
|
|
1785
1804
|
}
|
|
1786
|
-
},
|
|
1805
|
+
}, h(Be, "$"), Be), we, le = (we = class {
|
|
1787
1806
|
constructor(t) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
this.options = t ||
|
|
1807
|
+
D(this, "options");
|
|
1808
|
+
D(this, "renderer");
|
|
1809
|
+
D(this, "textRenderer");
|
|
1810
|
+
this.options = t || Ie, this.options.renderer = this.options.renderer || new yt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new on();
|
|
1792
1811
|
}
|
|
1793
1812
|
static parse(t, e) {
|
|
1794
|
-
return new
|
|
1813
|
+
return new we(e).parse(t);
|
|
1795
1814
|
}
|
|
1796
1815
|
static parseInline(t, e) {
|
|
1797
|
-
return new
|
|
1816
|
+
return new we(e).parseInline(t);
|
|
1798
1817
|
}
|
|
1799
1818
|
parse(t) {
|
|
1800
1819
|
this.renderer.parser = this;
|
|
@@ -1934,11 +1953,11 @@ ${t}</tr>
|
|
|
1934
1953
|
}
|
|
1935
1954
|
return n;
|
|
1936
1955
|
}
|
|
1937
|
-
},
|
|
1956
|
+
}, h(we, "u"), we), be, tt = (be = class {
|
|
1938
1957
|
constructor(t) {
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
this.options = t ||
|
|
1958
|
+
D(this, "options");
|
|
1959
|
+
D(this, "block");
|
|
1960
|
+
this.options = t || Ie;
|
|
1942
1961
|
}
|
|
1943
1962
|
preprocess(t) {
|
|
1944
1963
|
return t;
|
|
@@ -1953,23 +1972,23 @@ ${t}</tr>
|
|
|
1953
1972
|
return t;
|
|
1954
1973
|
}
|
|
1955
1974
|
provideLexer(t = this.block) {
|
|
1956
|
-
return t ?
|
|
1975
|
+
return t ? ae.lex : ae.lexInline;
|
|
1957
1976
|
}
|
|
1958
1977
|
provideParser(t = this.block) {
|
|
1959
|
-
return t ?
|
|
1978
|
+
return t ? le.parse : le.parseInline;
|
|
1960
1979
|
}
|
|
1961
|
-
},
|
|
1980
|
+
}, h(be, "P"), D(be, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), D(be, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), be), Fe, Vr = (Fe = class {
|
|
1962
1981
|
constructor(...t) {
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1982
|
+
D(this, "defaults", Jt());
|
|
1983
|
+
D(this, "options", this.setOptions);
|
|
1984
|
+
D(this, "parse", this.parseMarkdown(!0));
|
|
1985
|
+
D(this, "parseInline", this.parseMarkdown(!1));
|
|
1986
|
+
D(this, "Parser", le);
|
|
1987
|
+
D(this, "Renderer", yt);
|
|
1988
|
+
D(this, "TextRenderer", on);
|
|
1989
|
+
D(this, "Lexer", ae);
|
|
1990
|
+
D(this, "Tokenizer", vt);
|
|
1991
|
+
D(this, "Hooks", tt);
|
|
1973
1992
|
this.use(...t);
|
|
1974
1993
|
}
|
|
1975
1994
|
walkTokens(t, e) {
|
|
@@ -2021,9 +2040,9 @@ ${t}</tr>
|
|
|
2021
2040
|
if (!(a in r)) throw new Error(`renderer '${a}' does not exist`);
|
|
2022
2041
|
if (["options", "parser"].includes(a)) continue;
|
|
2023
2042
|
let o = a, c = n.renderer[o], d = r[o];
|
|
2024
|
-
r[o] = (...
|
|
2025
|
-
let p = c.apply(r,
|
|
2026
|
-
return p === !1 && (p = d.apply(r,
|
|
2043
|
+
r[o] = (...g) => {
|
|
2044
|
+
let p = c.apply(r, g);
|
|
2045
|
+
return p === !1 && (p = d.apply(r, g)), p || "";
|
|
2027
2046
|
};
|
|
2028
2047
|
}
|
|
2029
2048
|
s.renderer = r;
|
|
@@ -2034,33 +2053,33 @@ ${t}</tr>
|
|
|
2034
2053
|
if (!(a in r)) throw new Error(`tokenizer '${a}' does not exist`);
|
|
2035
2054
|
if (["options", "rules", "lexer"].includes(a)) continue;
|
|
2036
2055
|
let o = a, c = n.tokenizer[o], d = r[o];
|
|
2037
|
-
r[o] = (...
|
|
2038
|
-
let p = c.apply(r,
|
|
2039
|
-
return p === !1 && (p = d.apply(r,
|
|
2056
|
+
r[o] = (...g) => {
|
|
2057
|
+
let p = c.apply(r, g);
|
|
2058
|
+
return p === !1 && (p = d.apply(r, g)), p;
|
|
2040
2059
|
};
|
|
2041
2060
|
}
|
|
2042
2061
|
s.tokenizer = r;
|
|
2043
2062
|
}
|
|
2044
2063
|
if (n.hooks) {
|
|
2045
|
-
let r = this.defaults.hooks || new
|
|
2064
|
+
let r = this.defaults.hooks || new tt();
|
|
2046
2065
|
for (let a in n.hooks) {
|
|
2047
2066
|
if (!(a in r)) throw new Error(`hook '${a}' does not exist`);
|
|
2048
2067
|
if (["options", "block"].includes(a)) continue;
|
|
2049
2068
|
let o = a, c = n.hooks[o], d = r[o];
|
|
2050
|
-
|
|
2051
|
-
if (this.defaults.async &&
|
|
2052
|
-
let
|
|
2053
|
-
return d.call(r,
|
|
2069
|
+
tt.passThroughHooks.has(a) ? r[o] = (g) => {
|
|
2070
|
+
if (this.defaults.async && tt.passThroughHooksRespectAsync.has(a)) return (async () => {
|
|
2071
|
+
let f = await c.call(r, g);
|
|
2072
|
+
return d.call(r, f);
|
|
2054
2073
|
})();
|
|
2055
|
-
let p = c.call(r,
|
|
2074
|
+
let p = c.call(r, g);
|
|
2056
2075
|
return d.call(r, p);
|
|
2057
|
-
} : r[o] = (...
|
|
2076
|
+
} : r[o] = (...g) => {
|
|
2058
2077
|
if (this.defaults.async) return (async () => {
|
|
2059
|
-
let
|
|
2060
|
-
return
|
|
2078
|
+
let f = await c.apply(r, g);
|
|
2079
|
+
return f === !1 && (f = await d.apply(r, g)), f;
|
|
2061
2080
|
})();
|
|
2062
|
-
let p = c.apply(r,
|
|
2063
|
-
return p === !1 && (p = d.apply(r,
|
|
2081
|
+
let p = c.apply(r, g);
|
|
2082
|
+
return p === !1 && (p = d.apply(r, g)), p;
|
|
2064
2083
|
};
|
|
2065
2084
|
}
|
|
2066
2085
|
s.hooks = r;
|
|
@@ -2079,10 +2098,10 @@ ${t}</tr>
|
|
|
2079
2098
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
2080
2099
|
}
|
|
2081
2100
|
lexer(t, e) {
|
|
2082
|
-
return
|
|
2101
|
+
return ae.lex(t, e ?? this.defaults);
|
|
2083
2102
|
}
|
|
2084
2103
|
parser(t, e) {
|
|
2085
|
-
return
|
|
2104
|
+
return le.parse(t, e ?? this.defaults);
|
|
2086
2105
|
}
|
|
2087
2106
|
parseMarkdown(t) {
|
|
2088
2107
|
return (e, n) => {
|
|
@@ -2091,16 +2110,16 @@ ${t}</tr>
|
|
|
2091
2110
|
if (typeof e > "u" || e === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
2092
2111
|
if (typeof e != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
2093
2112
|
if (r.hooks && (r.hooks.options = r, r.hooks.block = t), r.async) return (async () => {
|
|
2094
|
-
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer(t) : t ?
|
|
2113
|
+
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer(t) : t ? ae.lex : ae.lexInline)(o, r), d = r.hooks ? await r.hooks.processAllTokens(c) : c;
|
|
2095
2114
|
r.walkTokens && await Promise.all(this.walkTokens(d, r.walkTokens));
|
|
2096
|
-
let
|
|
2097
|
-
return r.hooks ? await r.hooks.postprocess(
|
|
2115
|
+
let g = await (r.hooks ? await r.hooks.provideParser(t) : t ? le.parse : le.parseInline)(d, r);
|
|
2116
|
+
return r.hooks ? await r.hooks.postprocess(g) : g;
|
|
2098
2117
|
})().catch(a);
|
|
2099
2118
|
try {
|
|
2100
2119
|
r.hooks && (e = r.hooks.preprocess(e));
|
|
2101
|
-
let o = (r.hooks ? r.hooks.provideLexer(t) : t ?
|
|
2120
|
+
let o = (r.hooks ? r.hooks.provideLexer(t) : t ? ae.lex : ae.lexInline)(e, r);
|
|
2102
2121
|
r.hooks && (o = r.hooks.processAllTokens(o)), r.walkTokens && this.walkTokens(o, r.walkTokens);
|
|
2103
|
-
let c = (r.hooks ? r.hooks.provideParser(t) : t ?
|
|
2122
|
+
let c = (r.hooks ? r.hooks.provideParser(t) : t ? le.parse : le.parseInline)(o, r);
|
|
2104
2123
|
return r.hooks && (c = r.hooks.postprocess(c)), c;
|
|
2105
2124
|
} catch (o) {
|
|
2106
2125
|
return a(o);
|
|
@@ -2111,46 +2130,46 @@ ${t}</tr>
|
|
|
2111
2130
|
return (n) => {
|
|
2112
2131
|
if (n.message += `
|
|
2113
2132
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
2114
|
-
let s = "<p>An error occurred:</p><pre>" +
|
|
2133
|
+
let s = "<p>An error occurred:</p><pre>" + he(n.message + "", !0) + "</pre>";
|
|
2115
2134
|
return e ? Promise.resolve(s) : s;
|
|
2116
2135
|
}
|
|
2117
2136
|
if (e) return Promise.reject(n);
|
|
2118
2137
|
throw n;
|
|
2119
2138
|
};
|
|
2120
2139
|
}
|
|
2121
|
-
},
|
|
2140
|
+
}, h(Fe, "D"), Fe), Ce = new Vr();
|
|
2122
2141
|
function M(l, t) {
|
|
2123
|
-
return
|
|
2142
|
+
return Ce.parse(l, t);
|
|
2124
2143
|
}
|
|
2125
|
-
|
|
2144
|
+
h(M, "g");
|
|
2126
2145
|
M.options = M.setOptions = function(l) {
|
|
2127
|
-
return
|
|
2146
|
+
return Ce.setOptions(l), M.defaults = Ce.defaults, ss(M.defaults), M;
|
|
2128
2147
|
};
|
|
2129
|
-
M.getDefaults =
|
|
2130
|
-
M.defaults =
|
|
2148
|
+
M.getDefaults = Jt;
|
|
2149
|
+
M.defaults = Ie;
|
|
2131
2150
|
M.use = function(...l) {
|
|
2132
|
-
return
|
|
2151
|
+
return Ce.use(...l), M.defaults = Ce.defaults, ss(M.defaults), M;
|
|
2133
2152
|
};
|
|
2134
2153
|
M.walkTokens = function(l, t) {
|
|
2135
|
-
return
|
|
2154
|
+
return Ce.walkTokens(l, t);
|
|
2136
2155
|
};
|
|
2137
|
-
M.parseInline =
|
|
2138
|
-
M.Parser =
|
|
2139
|
-
M.parser =
|
|
2156
|
+
M.parseInline = Ce.parseInline;
|
|
2157
|
+
M.Parser = le;
|
|
2158
|
+
M.parser = le.parse;
|
|
2140
2159
|
M.Renderer = yt;
|
|
2141
|
-
M.TextRenderer =
|
|
2142
|
-
M.Lexer =
|
|
2143
|
-
M.lexer =
|
|
2160
|
+
M.TextRenderer = on;
|
|
2161
|
+
M.Lexer = ae;
|
|
2162
|
+
M.lexer = ae.lex;
|
|
2144
2163
|
M.Tokenizer = vt;
|
|
2145
|
-
M.Hooks =
|
|
2164
|
+
M.Hooks = tt;
|
|
2146
2165
|
M.parse = M;
|
|
2147
2166
|
M.options;
|
|
2148
2167
|
M.setOptions;
|
|
2149
2168
|
M.use;
|
|
2150
2169
|
M.walkTokens;
|
|
2151
2170
|
M.parseInline;
|
|
2152
|
-
|
|
2153
|
-
|
|
2171
|
+
le.parse;
|
|
2172
|
+
ae.lex;
|
|
2154
2173
|
const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
2155
2174
|
key: 0,
|
|
2156
2175
|
class: "pb-4"
|
|
@@ -2178,7 +2197,7 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2178
2197
|
}, xi = {
|
|
2179
2198
|
key: 1,
|
|
2180
2199
|
class: "i-tabler-paperclip size-5"
|
|
2181
|
-
}, bi = ["placeholder", "disabled"], ki = ["disabled"], Ii = /* @__PURE__ */
|
|
2200
|
+
}, bi = ["placeholder", "disabled"], ki = ["disabled"], Ii = /* @__PURE__ */ De({
|
|
2182
2201
|
__name: "ElAgentChat",
|
|
2183
2202
|
props: {
|
|
2184
2203
|
chatController: {},
|
|
@@ -2192,14 +2211,14 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2192
2211
|
},
|
|
2193
2212
|
setup(l) {
|
|
2194
2213
|
const t = new M.Renderer();
|
|
2195
|
-
t.link = ({ href: b, text:
|
|
2214
|
+
t.link = ({ href: b, text: w }) => `<a href="${b}" target="_blank" rel="noopener noreferrer">${w}</a>`, M.setOptions({ breaks: !0, gfm: !0, renderer: t });
|
|
2196
2215
|
function e(b) {
|
|
2197
2216
|
if (!b)
|
|
2198
2217
|
return "";
|
|
2199
|
-
const
|
|
2200
|
-
return ar.sanitize(
|
|
2218
|
+
const w = M.parse(b, { async: !1 });
|
|
2219
|
+
return ar.sanitize(w, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2201
2220
|
}
|
|
2202
|
-
|
|
2221
|
+
h(e, "renderMarkdown");
|
|
2203
2222
|
const n = {
|
|
2204
2223
|
private: "",
|
|
2205
2224
|
org: "",
|
|
@@ -2211,105 +2230,105 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2211
2230
|
}, r = F(() => l.setupHint ?? n[l.scope]), a = F(() => {
|
|
2212
2231
|
const b = { ...s[l.scope] };
|
|
2213
2232
|
return l.scope === "org" && l.scopeName && (b.label = l.scopeName, b.tooltip = `Visible to ${l.scopeName} members`), b;
|
|
2214
|
-
}), o = V(""), c = V(!1), d = V(),
|
|
2215
|
-
function y(b,
|
|
2216
|
-
const k = b[
|
|
2217
|
-
return !
|
|
2233
|
+
}), o = V(""), c = V(!1), d = V(), g = V(), p = V(), f = V([]), m = V(!1);
|
|
2234
|
+
function y(b, w) {
|
|
2235
|
+
const k = b[w], O = b[w + 1];
|
|
2236
|
+
return !O || O.sender !== k.sender;
|
|
2218
2237
|
}
|
|
2219
|
-
|
|
2220
|
-
const S = F(() => l.chatController?.textState.value),
|
|
2238
|
+
h(y, "shouldShowAvatar");
|
|
2239
|
+
const S = F(() => l.chatController?.textState.value), z = F(() => S.value?.isConnected ?? !1), de = F(() => S.value?.isThinking ?? !1), me = F(() => S.value?.connectionStatus === "disconnected" && !!S.value?.error), ne = F(() => S.value?.connectionStatus !== "connected" && !S.value?.error), $ = F(() => S.value?.error), j = F(() => l.chatController?.sharedMessages.value?.filter((b) => b.sender !== "system") ?? []), se = F(() => !z.value), fe = F(() => me.value ? "Agent is offline" : ne.value ? "Connecting..." : "Message"), rt = F(() => (o.value.trim() || f.value.length > 0) && !se.value && !m.value), L = F(() => l.variant === "light"), it = F(
|
|
2221
2240
|
() => L.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2222
2241
|
), U = F(() => L.value ? "text-theme-300" : "text-white/30");
|
|
2223
|
-
|
|
2224
|
-
if (l.chatController && !
|
|
2242
|
+
Qt(async () => {
|
|
2243
|
+
if (l.chatController && !z.value)
|
|
2225
2244
|
try {
|
|
2226
2245
|
await l.chatController.startTextConversation();
|
|
2227
2246
|
} catch (b) {
|
|
2228
2247
|
console.error("Failed to start text conversation:", b);
|
|
2229
2248
|
}
|
|
2230
2249
|
});
|
|
2231
|
-
async function
|
|
2232
|
-
const b = o.value.trim(),
|
|
2233
|
-
if (!b && !
|
|
2250
|
+
async function ve() {
|
|
2251
|
+
const b = o.value.trim(), w = f.value.length > 0;
|
|
2252
|
+
if (!b && !w || !l.chatController || !z.value || m.value)
|
|
2234
2253
|
return;
|
|
2235
|
-
const k = o.value,
|
|
2236
|
-
o.value = "",
|
|
2254
|
+
const k = o.value, O = w ? [...f.value] : void 0;
|
|
2255
|
+
o.value = "", f.value = [], g.value && (g.value.style.height = "auto", g.value.focus());
|
|
2237
2256
|
try {
|
|
2238
|
-
await l.chatController.sendChatMessage(k,
|
|
2239
|
-
} catch (
|
|
2240
|
-
console.error("Error sending message:",
|
|
2257
|
+
await l.chatController.sendChatMessage(k, O), ye();
|
|
2258
|
+
} catch (C) {
|
|
2259
|
+
console.error("Error sending message:", C);
|
|
2241
2260
|
}
|
|
2242
2261
|
}
|
|
2243
|
-
|
|
2244
|
-
function
|
|
2245
|
-
b.key === "Enter" && !b.shiftKey && (b.preventDefault(),
|
|
2262
|
+
h(ve, "sendMessage");
|
|
2263
|
+
function Me(b) {
|
|
2264
|
+
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), ve());
|
|
2246
2265
|
}
|
|
2247
|
-
|
|
2248
|
-
function
|
|
2249
|
-
d.value &&
|
|
2266
|
+
h(Me, "handleKeydown");
|
|
2267
|
+
function ye() {
|
|
2268
|
+
d.value && Bt(() => {
|
|
2250
2269
|
d.value.scrollTop = d.value.scrollHeight;
|
|
2251
2270
|
});
|
|
2252
2271
|
}
|
|
2253
|
-
|
|
2272
|
+
h(ye, "scrollToBottom");
|
|
2254
2273
|
function At() {
|
|
2255
|
-
|
|
2274
|
+
g.value && (g.value.style.height = "auto", g.value.style.height = `${Math.min(g.value.scrollHeight, 150)}px`);
|
|
2256
2275
|
}
|
|
2257
|
-
|
|
2276
|
+
h(At, "adjustTextareaHeight"), nt(o, () => Bt(() => At()));
|
|
2258
2277
|
function Et() {
|
|
2259
2278
|
p.value?.click();
|
|
2260
2279
|
}
|
|
2261
|
-
|
|
2280
|
+
h(Et, "triggerFileInput");
|
|
2262
2281
|
async function _t(b) {
|
|
2263
|
-
const
|
|
2282
|
+
const w = b.target, k = w.files?.[0];
|
|
2264
2283
|
if (!(!k || !l.uploadFn)) {
|
|
2265
2284
|
m.value = !0;
|
|
2266
2285
|
try {
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2269
|
-
} catch (
|
|
2270
|
-
console.error("Upload failed:",
|
|
2286
|
+
const O = await l.uploadFn(k);
|
|
2287
|
+
f.value = [...f.value, O];
|
|
2288
|
+
} catch (O) {
|
|
2289
|
+
console.error("Upload failed:", O);
|
|
2271
2290
|
} finally {
|
|
2272
|
-
m.value = !1,
|
|
2291
|
+
m.value = !1, w.value = "";
|
|
2273
2292
|
}
|
|
2274
2293
|
}
|
|
2275
2294
|
}
|
|
2276
|
-
|
|
2277
|
-
function
|
|
2278
|
-
|
|
2295
|
+
h(_t, "handleFileSelect");
|
|
2296
|
+
function at(b) {
|
|
2297
|
+
f.value = f.value.filter((w, k) => k !== b);
|
|
2279
2298
|
}
|
|
2280
|
-
|
|
2281
|
-
function
|
|
2282
|
-
if (
|
|
2283
|
-
const ee = b[
|
|
2284
|
-
return ee?.timestamp ?
|
|
2285
|
-
}
|
|
2286
|
-
const k = b[
|
|
2287
|
-
if (!k?.timestamp || !
|
|
2288
|
-
const
|
|
2289
|
-
return new Date(
|
|
2299
|
+
h(at, "removeAttachment");
|
|
2300
|
+
function lt(b, w) {
|
|
2301
|
+
if (w === 0) {
|
|
2302
|
+
const ee = b[w];
|
|
2303
|
+
return ee?.timestamp ? Ge(new Date(ee.timestamp)) : null;
|
|
2304
|
+
}
|
|
2305
|
+
const k = b[w - 1], O = b[w];
|
|
2306
|
+
if (!k?.timestamp || !O?.timestamp) return null;
|
|
2307
|
+
const C = new Date(k.timestamp).getTime();
|
|
2308
|
+
return new Date(O.timestamp).getTime() - C > 36e5 ? Ge(new Date(O.timestamp)) : null;
|
|
2290
2309
|
}
|
|
2291
|
-
|
|
2292
|
-
function
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
const
|
|
2310
|
+
h(lt, "shouldShowTimeDivider");
|
|
2311
|
+
function Ge(b) {
|
|
2312
|
+
const w = /* @__PURE__ */ new Date(), k = b.toDateString() === w.toDateString(), O = new Date(w);
|
|
2313
|
+
O.setDate(O.getDate() - 1);
|
|
2314
|
+
const C = b.toDateString() === O.toDateString(), J = b.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2296
2315
|
if (k) return J;
|
|
2297
|
-
if (
|
|
2298
|
-
const
|
|
2316
|
+
if (C) return `Yesterday, ${J}`;
|
|
2317
|
+
const Te = b.getFullYear() === w.getFullYear();
|
|
2299
2318
|
return `${b.toLocaleDateString("en-US", {
|
|
2300
2319
|
weekday: "long",
|
|
2301
2320
|
month: "short",
|
|
2302
2321
|
day: "numeric",
|
|
2303
|
-
...
|
|
2322
|
+
...Te ? {} : { year: "numeric" }
|
|
2304
2323
|
})}, ${J}`;
|
|
2305
2324
|
}
|
|
2306
|
-
return
|
|
2307
|
-
b.length > 0 &&
|
|
2308
|
-
}, { immediate: !0, deep: !0 }), (b,
|
|
2325
|
+
return h(Ge, "formatTimeDivider"), nt(j, (b) => {
|
|
2326
|
+
b.length > 0 && Bt(() => ye());
|
|
2327
|
+
}, { immediate: !0, deep: !0 }), (b, w) => (A(), E("div", Yr, [
|
|
2309
2328
|
L.value ? G("", !0) : (A(), E("div", Zr, [
|
|
2310
|
-
|
|
2329
|
+
Ft($s, {
|
|
2311
2330
|
agent: l.agent,
|
|
2312
|
-
"is-online":
|
|
2331
|
+
"is-online": z.value
|
|
2313
2332
|
}, null, 8, ["agent", "is-online"])
|
|
2314
2333
|
])),
|
|
2315
2334
|
me.value ? (A(), E("div", {
|
|
@@ -2319,18 +2338,18 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2319
2338
|
T("i", {
|
|
2320
2339
|
class: _(["i-heroicons-cloud-arrow-down size-8", L.value ? "text-theme-300" : "text-white/40"])
|
|
2321
2340
|
}, null, 2),
|
|
2322
|
-
T("span", null,
|
|
2341
|
+
T("span", null, pe($.value), 1)
|
|
2323
2342
|
], 2)) : ne.value ? (A(), E("div", {
|
|
2324
2343
|
key: 2,
|
|
2325
2344
|
class: _(["py-16 flex flex-col items-center justify-center gap-2 text-sm", L.value ? "text-theme-400" : "text-theme-600"])
|
|
2326
2345
|
}, [
|
|
2327
|
-
|
|
2346
|
+
Ft(In, { class: "size-4" })
|
|
2328
2347
|
], 2)) : r.value ? (A(), E("div", {
|
|
2329
2348
|
key: 3,
|
|
2330
2349
|
class: _(["flex items-center justify-center gap-1.5 py-2 text-[11px]", U.value])
|
|
2331
2350
|
}, [
|
|
2332
|
-
|
|
2333
|
-
T("span", null,
|
|
2351
|
+
w[5] || (w[5] = T("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2352
|
+
T("span", null, pe(r.value), 1)
|
|
2334
2353
|
], 2)) : G("", !0),
|
|
2335
2354
|
T("div", {
|
|
2336
2355
|
ref_key: "messagesContainer",
|
|
@@ -2344,19 +2363,19 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2344
2363
|
alt: l.agent.displayName.value,
|
|
2345
2364
|
class: _(["size-full rounded-full object-cover ring-1", L.value ? "ring-black/5" : "ring-white/10"])
|
|
2346
2365
|
}, null, 10, Qr),
|
|
2347
|
-
|
|
2366
|
+
z.value ? (A(), E("span", {
|
|
2348
2367
|
key: 0,
|
|
2349
2368
|
class: _(["absolute top-[85%] left-[85%] -translate-x-1/2 -translate-y-1/2 size-[18%] min-w-2.5 min-h-2.5 flex items-center justify-center rounded-full", L.value ? "bg-white" : "bg-theme-900"])
|
|
2350
|
-
}, [...
|
|
2369
|
+
}, [...w[6] || (w[6] = [
|
|
2351
2370
|
T("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2352
2371
|
])], 2)) : G("", !0)
|
|
2353
2372
|
]),
|
|
2354
2373
|
T("div", {
|
|
2355
2374
|
class: _(["text-base @sm/chat:text-lg font-semibold", L.value ? "text-theme-900" : "text-white"])
|
|
2356
|
-
},
|
|
2375
|
+
}, pe(l.agent.displayName.value), 3),
|
|
2357
2376
|
T("p", {
|
|
2358
2377
|
class: _(["mt-1 text-center text-xs @sm/chat:text-sm", U.value])
|
|
2359
|
-
},
|
|
2378
|
+
}, pe(l.emptyStateMessage || "Send a message to get started"), 3),
|
|
2360
2379
|
T("div", {
|
|
2361
2380
|
class: _(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", L.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2362
2381
|
title: a.value.tooltip
|
|
@@ -2364,21 +2383,21 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2364
2383
|
T("i", {
|
|
2365
2384
|
class: _([a.value.icon, "size-3"])
|
|
2366
2385
|
}, null, 2),
|
|
2367
|
-
T("span", null,
|
|
2386
|
+
T("span", null, pe(a.value.label), 1)
|
|
2368
2387
|
], 10, Jr)
|
|
2369
2388
|
])) : G("", !0),
|
|
2370
|
-
(A(!0), E(
|
|
2389
|
+
(A(!0), E(_e, null, xt(j.value, (k, O) => (A(), E(_e, {
|
|
2371
2390
|
key: k.id
|
|
2372
2391
|
}, [
|
|
2373
|
-
|
|
2392
|
+
lt(j.value, O) ? (A(), E("div", ei, [
|
|
2374
2393
|
T("div", {
|
|
2375
|
-
class: _(["flex-1 h-px",
|
|
2394
|
+
class: _(["flex-1 h-px", it.value])
|
|
2376
2395
|
}, null, 2),
|
|
2377
2396
|
T("span", {
|
|
2378
2397
|
class: _(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", U.value])
|
|
2379
|
-
},
|
|
2398
|
+
}, pe(lt(j.value, O)), 3),
|
|
2380
2399
|
T("div", {
|
|
2381
|
-
class: _(["flex-1 h-px",
|
|
2400
|
+
class: _(["flex-1 h-px", it.value])
|
|
2382
2401
|
}, null, 2)
|
|
2383
2402
|
])) : G("", !0),
|
|
2384
2403
|
T("div", {
|
|
@@ -2386,11 +2405,11 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2386
2405
|
class: _(["flex gap-2 items-end", {
|
|
2387
2406
|
"justify-end": k.sender === "user",
|
|
2388
2407
|
"justify-start": k.sender === "agent",
|
|
2389
|
-
"mb-4": y(j.value,
|
|
2408
|
+
"mb-4": y(j.value, O)
|
|
2390
2409
|
}])
|
|
2391
2410
|
}, [
|
|
2392
2411
|
k.sender === "agent" ? (A(), E("div", ni, [
|
|
2393
|
-
y(j.value,
|
|
2412
|
+
y(j.value, O) ? (A(), E("img", {
|
|
2394
2413
|
key: 0,
|
|
2395
2414
|
src: l.agent.avatarUrl.value,
|
|
2396
2415
|
alt: l.agent.displayName.value,
|
|
@@ -2404,26 +2423,26 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2404
2423
|
key: 0,
|
|
2405
2424
|
class: _(["mb-1 space-y-1", k.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2406
2425
|
}, [
|
|
2407
|
-
(A(!0), E(
|
|
2408
|
-
|
|
2426
|
+
(A(!0), E(_e, null, xt(k.attachments, (C, J) => (A(), E(_e, { key: J }, [
|
|
2427
|
+
C.type === "image" ? (A(), E("img", {
|
|
2409
2428
|
key: 0,
|
|
2410
|
-
src:
|
|
2411
|
-
alt:
|
|
2429
|
+
src: C.url,
|
|
2430
|
+
alt: C.name,
|
|
2412
2431
|
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2413
|
-
}, null, 8, ri)) :
|
|
2432
|
+
}, null, 8, ri)) : C.type === "audio" ? (A(), E("audio", {
|
|
2414
2433
|
key: 1,
|
|
2415
|
-
src:
|
|
2434
|
+
src: C.url,
|
|
2416
2435
|
controls: "",
|
|
2417
2436
|
class: "max-w-full"
|
|
2418
2437
|
}, null, 8, ii)) : (A(), E("a", {
|
|
2419
2438
|
key: 2,
|
|
2420
|
-
href:
|
|
2439
|
+
href: C.url,
|
|
2421
2440
|
target: "_blank",
|
|
2422
2441
|
rel: "noopener",
|
|
2423
2442
|
class: _(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", L.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2424
2443
|
}, [
|
|
2425
|
-
|
|
2426
|
-
|
|
2444
|
+
w[7] || (w[7] = T("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2445
|
+
ft(" " + pe(C.name), 1)
|
|
2427
2446
|
], 10, ai))
|
|
2428
2447
|
], 64))), 128))
|
|
2429
2448
|
], 2)) : G("", !0),
|
|
@@ -2441,7 +2460,7 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2441
2460
|
], 2)
|
|
2442
2461
|
], 10, ti)
|
|
2443
2462
|
], 64))), 128)),
|
|
2444
|
-
|
|
2463
|
+
de.value ? (A(), E("div", oi, [
|
|
2445
2464
|
T("img", {
|
|
2446
2465
|
src: l.agent.avatarUrl.value,
|
|
2447
2466
|
alt: l.agent.displayName.value,
|
|
@@ -2459,9 +2478,9 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2459
2478
|
T("div", {
|
|
2460
2479
|
class: _(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", L.value ? "bg-gradient-to-t from-white via-white/95 to-white/70" : "bg-gradient-to-t from-black/80 via-black/70 to-black/40"])
|
|
2461
2480
|
}, [
|
|
2462
|
-
|
|
2463
|
-
(A(!0), E(
|
|
2464
|
-
key:
|
|
2481
|
+
f.value.length > 0 ? (A(), E("div", ui, [
|
|
2482
|
+
(A(!0), E(_e, null, xt(f.value, (k, O) => (A(), E("div", {
|
|
2483
|
+
key: O,
|
|
2465
2484
|
class: "relative shrink-0 group"
|
|
2466
2485
|
}, [
|
|
2467
2486
|
k.type === "image" ? (A(), E("img", {
|
|
@@ -2473,18 +2492,18 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2473
2492
|
key: 1,
|
|
2474
2493
|
class: _(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", L.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2475
2494
|
}, [
|
|
2476
|
-
|
|
2477
|
-
T("span", pi,
|
|
2495
|
+
w[8] || (w[8] = T("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2496
|
+
T("span", pi, pe(k.name), 1)
|
|
2478
2497
|
], 2)),
|
|
2479
2498
|
T("button", {
|
|
2480
2499
|
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",
|
|
2481
|
-
onClick: /* @__PURE__ */
|
|
2482
|
-
}, [...
|
|
2500
|
+
onClick: /* @__PURE__ */ h((C) => at(O), "onClick")
|
|
2501
|
+
}, [...w[9] || (w[9] = [
|
|
2483
2502
|
T("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2484
2503
|
])], 8, di)
|
|
2485
2504
|
]))), 128)),
|
|
2486
2505
|
m.value ? (A(), E("div", fi, [
|
|
2487
|
-
|
|
2506
|
+
Ft(In, { class: "size-5" })
|
|
2488
2507
|
])) : G("", !0)
|
|
2489
2508
|
])) : G("", !0),
|
|
2490
2509
|
l.uploadFn ? (A(), E("input", {
|
|
@@ -2506,48 +2525,48 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2506
2525
|
m.value ? "opacity-50 pointer-events-none" : ""
|
|
2507
2526
|
]]),
|
|
2508
2527
|
disabled: se.value || m.value || !l.uploadFn,
|
|
2509
|
-
onClick:
|
|
2528
|
+
onClick: w[0] || (w[0] = (k) => l.uploadFn && Et())
|
|
2510
2529
|
}, [
|
|
2511
2530
|
m.value ? (A(), E("i", mi)) : (A(), E("i", xi))
|
|
2512
2531
|
], 10, gi),
|
|
2513
|
-
|
|
2532
|
+
Xn(T("textarea", {
|
|
2514
2533
|
ref_key: "textarea",
|
|
2515
|
-
ref:
|
|
2516
|
-
"onUpdate:modelValue":
|
|
2534
|
+
ref: g,
|
|
2535
|
+
"onUpdate:modelValue": w[1] || (w[1] = (k) => o.value = k),
|
|
2517
2536
|
"data-test": "messaging-input",
|
|
2518
2537
|
rows: "1",
|
|
2519
2538
|
enterkeyhint: "send",
|
|
2520
|
-
placeholder:
|
|
2539
|
+
placeholder: fe.value,
|
|
2521
2540
|
disabled: se.value,
|
|
2522
2541
|
style: { fontSize: "16px", resize: "none" },
|
|
2523
2542
|
class: _(["flex-1 min-w-0 bg-transparent px-1 py-2 focus:outline-none disabled:opacity-50 overflow-y-auto leading-relaxed [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", L.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2524
|
-
onKeydown:
|
|
2525
|
-
onFocus:
|
|
2526
|
-
onBlur:
|
|
2543
|
+
onKeydown: Me,
|
|
2544
|
+
onFocus: w[2] || (w[2] = (k) => c.value = !0),
|
|
2545
|
+
onBlur: w[3] || (w[3] = (k) => c.value = !1)
|
|
2527
2546
|
}, null, 42, bi), [
|
|
2528
|
-
[
|
|
2547
|
+
[Kn, o.value]
|
|
2529
2548
|
]),
|
|
2530
2549
|
T("button", {
|
|
2531
2550
|
"data-test": "messaging-send-btn",
|
|
2532
|
-
class: _(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10",
|
|
2533
|
-
disabled: !
|
|
2534
|
-
onClick:
|
|
2535
|
-
}, [...
|
|
2551
|
+
class: _(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10", rt.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : L.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2552
|
+
disabled: !rt.value,
|
|
2553
|
+
onClick: w[4] || (w[4] = (k) => ve())
|
|
2554
|
+
}, [...w[10] || (w[10] = [
|
|
2536
2555
|
T("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2537
2556
|
])], 10, ki)
|
|
2538
2557
|
], 2),
|
|
2539
2558
|
T("div", {
|
|
2540
2559
|
class: _(["text-[10px] text-center mt-2.5 select-none opacity-70", L.value ? "text-theme-400" : "text-white/50"])
|
|
2541
2560
|
}, [
|
|
2542
|
-
|
|
2561
|
+
w[11] || (w[11] = ft(" Press ", -1)),
|
|
2543
2562
|
T("kbd", {
|
|
2544
2563
|
class: _(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", L.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2545
2564
|
}, "Enter", 2),
|
|
2546
|
-
|
|
2565
|
+
w[12] || (w[12] = ft(" to send, ", -1)),
|
|
2547
2566
|
T("kbd", {
|
|
2548
2567
|
class: _(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", L.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2549
2568
|
}, "Shift+Enter", 2),
|
|
2550
|
-
|
|
2569
|
+
w[13] || (w[13] = ft(" for new line ", -1))
|
|
2551
2570
|
], 2)
|
|
2552
2571
|
], 2)
|
|
2553
2572
|
]));
|
|
@@ -2555,7 +2574,7 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2555
2574
|
}), wi = { class: "agent-wrap" }, vi = {
|
|
2556
2575
|
key: 0,
|
|
2557
2576
|
class: "flex items-center justify-center h-full"
|
|
2558
|
-
}, Mi = /* @__PURE__ */
|
|
2577
|
+
}, Mi = /* @__PURE__ */ De({
|
|
2559
2578
|
__name: "AgentWrap",
|
|
2560
2579
|
props: {
|
|
2561
2580
|
sdk: {},
|
|
@@ -2573,7 +2592,7 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2573
2592
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2574
2593
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2575
2594
|
}), s = V(!e.agent), r = vs(e.agent ? new kt({ config: e.agent }) : void 0), a = V();
|
|
2576
|
-
return
|
|
2595
|
+
return Qt(async () => {
|
|
2577
2596
|
if (e.agent) {
|
|
2578
2597
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2579
2598
|
agentId: e.agent.agentId,
|
|
@@ -2652,9 +2671,9 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2652
2671
|
}), (o, c) => (A(), E("div", wi, [
|
|
2653
2672
|
s.value ? (A(), E("div", vi, [...c[0] || (c[0] = [
|
|
2654
2673
|
T("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2655
|
-
])])) : r.value ?
|
|
2674
|
+
])])) : r.value ? Zn(o.$slots, "default", {
|
|
2656
2675
|
key: 1,
|
|
2657
|
-
sdk:
|
|
2676
|
+
sdk: Yt(n),
|
|
2658
2677
|
agent: r.value,
|
|
2659
2678
|
context: l.context,
|
|
2660
2679
|
firstMessage: l.firstMessage,
|
|
@@ -2666,16 +2685,16 @@ const Yr = { class: "@container/chat flex flex-col h-full relative" }, Zr = {
|
|
|
2666
2685
|
}
|
|
2667
2686
|
});
|
|
2668
2687
|
export {
|
|
2669
|
-
|
|
2688
|
+
Mn as A,
|
|
2670
2689
|
Mi as _,
|
|
2671
2690
|
Ii as a,
|
|
2672
|
-
|
|
2691
|
+
Ci as b,
|
|
2673
2692
|
Ri as c,
|
|
2674
|
-
|
|
2675
|
-
|
|
2693
|
+
Di as d,
|
|
2694
|
+
In as e,
|
|
2676
2695
|
$s as f,
|
|
2677
2696
|
Ei as g,
|
|
2678
|
-
|
|
2697
|
+
zn as h,
|
|
2679
2698
|
_i as p
|
|
2680
2699
|
};
|
|
2681
2700
|
//# sourceMappingURL=AgentWrap.vue_vue_type_script_setup_true_lang.js.map
|