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