@pagelines/sdk 1.0.501 → 1.0.503
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js +794 -795
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/agent/AgentController.d.ts +10 -0
- package/dist/agent/ui/ElCreateAgent.vue.d.ts +2 -2
- package/dist/demo/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/widget/composables/useWidgetState.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var Mn = Object.defineProperty;
|
|
2
2
|
var _s = (a, t, e) => t in a ? Mn(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
-
var
|
|
3
|
+
var h = (a, t) => Mn(a, "name", { value: t, configurable: !0 });
|
|
4
4
|
var C = (a, t, e) => _s(a, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { SettingsObject as Cs, Agent as
|
|
5
|
+
import { defineComponent as Me, openBlock as T, createElementBlock as S, createElementVNode as w, normalizeClass as A, ref as ee, watch as ot, computed as W, createCommentVNode as B, renderSlot as ns, onMounted as tn, Fragment as Te, renderList as it, withDirectives as ss, vModelText as rs, unref as Kt, toDisplayString as ie, nextTick as jt, createVNode as Wt, createTextVNode as Je, withModifiers as Rs, shallowRef as Is } from "vue";
|
|
6
|
+
import { SettingsObject as Cs, Agent as yt, getDefaultAvatarUrl as is, createLogger as Ds } from "@pagelines/core";
|
|
7
7
|
import { P as Ms } from "./sdkClient.js";
|
|
8
8
|
const Ls = { class: "spinner max-w-sm" }, Os = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
}, Ln = /* @__PURE__ */
|
|
11
|
+
}, Ln = /* @__PURE__ */ Me({
|
|
12
12
|
__name: "FSpinner",
|
|
13
13
|
props: {
|
|
14
14
|
width: { type: String, default: "" },
|
|
@@ -17,7 +17,7 @@ const Ls = { class: "spinner max-w-sm" }, Os = {
|
|
|
17
17
|
setup(a) {
|
|
18
18
|
return (t, e) => (T(), S("div", Ls, [
|
|
19
19
|
(T(), S("svg", Os, [
|
|
20
|
-
|
|
20
|
+
w("circle", {
|
|
21
21
|
class: A([a.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
@@ -33,7 +33,7 @@ const Ls = { class: "spinner max-w-sm" }, Os = {
|
|
|
33
33
|
}), zs = [
|
|
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
|
-
], Ps = 9e4,
|
|
36
|
+
], Ps = 9e4, pn = class pn extends Cs {
|
|
37
37
|
constructor(e) {
|
|
38
38
|
super("AgentChatController", e);
|
|
39
39
|
C(this, "isTextMode", !1);
|
|
@@ -41,16 +41,16 @@ const Ls = { class: "spinner max-w-sm" }, Os = {
|
|
|
41
41
|
C(this, "isConnecting", !1);
|
|
42
42
|
// Chat conversation tracking (server-managed persistence)
|
|
43
43
|
C(this, "conversationId");
|
|
44
|
-
C(this, "textState",
|
|
44
|
+
C(this, "textState", ee({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
C(this, "agentMode",
|
|
51
|
-
C(this, "sharedMessages",
|
|
50
|
+
C(this, "agentMode", ee("self"));
|
|
51
|
+
C(this, "sharedMessages", ee([]));
|
|
52
52
|
C(this, "_agent");
|
|
53
|
-
this._agent = e.agent instanceof
|
|
53
|
+
this._agent = e.agent instanceof yt ? e.agent : new yt({ config: e.agent }), this.setupModeWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
56
56
|
return this._agent.chatAvailable.value;
|
|
@@ -81,6 +81,18 @@ const Ls = { class: "spinner max-w-sm" }, Os = {
|
|
|
81
81
|
{ id: Date.now().toString(), text: e, sender: n, timestamp: (/* @__PURE__ */ new Date()).toISOString(), attachments: r, ...s ? { issue: s } : {} }
|
|
82
82
|
]);
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Surface a one-shot system bubble in the chat transcript.
|
|
86
|
+
*
|
|
87
|
+
* The single public entry for adjacent surfaces (file upload, voice, attach)
|
|
88
|
+
* to feed user-visible feedback into the same channel as send/stream errors.
|
|
89
|
+
* Without this, the chat surface had to fall back to `console.error` for
|
|
90
|
+
* upload failures — invisible to the user, the canonical "always give
|
|
91
|
+
* feedback" miss flagged in design.md → Action Feedback Contract.
|
|
92
|
+
*/
|
|
93
|
+
notify(e) {
|
|
94
|
+
e && this.addMessage(e, "system");
|
|
95
|
+
}
|
|
84
96
|
getDynamicSettings() {
|
|
85
97
|
const { sdk: e } = this.settings;
|
|
86
98
|
if (!e) return { context: this.settings.context || "", firstMessage: this.settings.firstMessage || "" };
|
|
@@ -110,7 +122,7 @@ Current User:
|
|
|
110
122
|
});
|
|
111
123
|
}
|
|
112
124
|
setupModeWatcher() {
|
|
113
|
-
|
|
125
|
+
ot(this.agentMode, async (e, n) => {
|
|
114
126
|
this.logger.info(`Mode changed from ${n} to ${e}`), this.isTextMode && (n === "talk" || n === "chat") && await this.endConversation();
|
|
115
127
|
});
|
|
116
128
|
}
|
|
@@ -196,40 +208,40 @@ Current User:
|
|
|
196
208
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
197
209
|
const o = `stream-${Date.now()}`;
|
|
198
210
|
let l = !1;
|
|
199
|
-
const
|
|
211
|
+
const m = /* @__PURE__ */ h((d) => {
|
|
200
212
|
l || (l = !0, this.sharedMessages.value = [
|
|
201
213
|
...this.sharedMessages.value,
|
|
202
214
|
{ id: o, text: "", sender: "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
203
215
|
]);
|
|
204
|
-
const g = this.sharedMessages.value,
|
|
205
|
-
|
|
206
|
-
}, "onDelta"), c = /* @__PURE__ */
|
|
216
|
+
const g = this.sharedMessages.value, y = g[g.length - 1];
|
|
217
|
+
y?.id === o && (y.text += d, this.sharedMessages.value = [...g]);
|
|
218
|
+
}, "onDelta"), c = /* @__PURE__ */ h((d) => {
|
|
207
219
|
if (!l) {
|
|
208
|
-
|
|
220
|
+
b("empty_stream — assistant returned no content");
|
|
209
221
|
return;
|
|
210
222
|
}
|
|
211
|
-
const g = this.sharedMessages.value,
|
|
212
|
-
if (
|
|
213
|
-
let E =
|
|
223
|
+
const g = this.sharedMessages.value, y = g[g.length - 1];
|
|
224
|
+
if (y?.id === o && y.text) {
|
|
225
|
+
let E = y.text;
|
|
214
226
|
for (const O of zs)
|
|
215
227
|
O.pattern.test(E) && (console.debug(`[chat] filtered directive: ${O.label}`), E = E.replace(O.pattern, "").trim(), O.pattern.lastIndex = 0);
|
|
216
|
-
E ? E !==
|
|
228
|
+
E ? E !== y.text && (y.text = E, this.sharedMessages.value = [...g]) : this.sharedMessages.value = g.slice(0, -1);
|
|
217
229
|
}
|
|
218
230
|
d && (this.conversationId = d), this.updateState(this.textState, { isThinking: !1 });
|
|
219
|
-
}, "onDone"),
|
|
220
|
-
const g = this.sharedMessages.value,
|
|
221
|
-
if (
|
|
222
|
-
const { bucket:
|
|
223
|
-
if (
|
|
224
|
-
const
|
|
225
|
-
this.addMessage(d.error, "system", void 0,
|
|
231
|
+
}, "onDone"), b = /* @__PURE__ */ h((d) => {
|
|
232
|
+
const g = this.sharedMessages.value, y = g[g.length - 1];
|
|
233
|
+
if (y?.id === o && !y.text && (this.sharedMessages.value = g.slice(0, -1)), typeof d == "object" && d.code && d.error) {
|
|
234
|
+
const { bucket: ae, actionUrl: ce, actionLabel: ne, help: N } = d;
|
|
235
|
+
if (ae !== void 0 || (/* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP", "EMPTY_STREAM", "RATE_LIMIT"])).has(d.code)) {
|
|
236
|
+
const Q = ae && ce && ne ? { code: d.code, bucket: ae, actionLabel: ne, actionUrl: ce, ...N ? { help: N } : {} } : void 0;
|
|
237
|
+
this.addMessage(d.error, "system", void 0, Q), ae === "account" ? this.updateState(this.textState, { isThinking: !1, accountGated: !0 }) : this.updateState(this.textState, { isThinking: !1 });
|
|
226
238
|
} else
|
|
227
239
|
this.handleError(new Error(d.error));
|
|
228
240
|
return;
|
|
229
241
|
}
|
|
230
242
|
const E = typeof d == "string" ? d : d.error, O = this.mapChatError(E);
|
|
231
243
|
this.isTransientError(E) ? (this.logger.warn("Chat turn failed (transient):", { raw: E, friendly: O }), this.addMessage(O, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(O), E);
|
|
232
|
-
}, "onError"),
|
|
244
|
+
}, "onError"), p = /* @__PURE__ */ h((d) => {
|
|
233
245
|
this.addMessage(d, "system");
|
|
234
246
|
}, "onStatus");
|
|
235
247
|
try {
|
|
@@ -238,27 +250,27 @@ Current User:
|
|
|
238
250
|
attachments: n,
|
|
239
251
|
conversationId: this.conversationId,
|
|
240
252
|
history: this.buildHistory(),
|
|
241
|
-
onDelta:
|
|
253
|
+
onDelta: m,
|
|
242
254
|
onDone: c,
|
|
243
|
-
onError:
|
|
244
|
-
onStatus:
|
|
255
|
+
onError: b,
|
|
256
|
+
onStatus: p
|
|
245
257
|
}) : s.chat.chatStreamPublic({
|
|
246
258
|
handle: this._agent.handle.value,
|
|
247
259
|
message: e,
|
|
248
260
|
attachments: n,
|
|
249
261
|
anonymousId: s.user.generateAnonId(),
|
|
250
262
|
context: this.getDynamicSettings().context || void 0,
|
|
251
|
-
onDelta:
|
|
263
|
+
onDelta: m,
|
|
252
264
|
onDone: c,
|
|
253
|
-
onError:
|
|
254
|
-
onStatus:
|
|
265
|
+
onError: b,
|
|
266
|
+
onStatus: p
|
|
255
267
|
});
|
|
256
268
|
await Promise.race([
|
|
257
269
|
d,
|
|
258
|
-
new Promise((g,
|
|
270
|
+
new Promise((g, y) => setTimeout(() => y(new Error("timed out")), Ps))
|
|
259
271
|
]);
|
|
260
272
|
} catch (d) {
|
|
261
|
-
|
|
273
|
+
b(d.message || "Something went wrong");
|
|
262
274
|
}
|
|
263
275
|
}
|
|
264
276
|
buildHistory() {
|
|
@@ -282,30 +294,30 @@ Current User:
|
|
|
282
294
|
await this.endConversation();
|
|
283
295
|
}
|
|
284
296
|
};
|
|
285
|
-
|
|
286
|
-
let On =
|
|
297
|
+
h(pn, "AgentChatController");
|
|
298
|
+
let On = pn;
|
|
287
299
|
function zn(a) {
|
|
288
300
|
return a ? typeof a == "string" ? a : a.src || "" : "";
|
|
289
301
|
}
|
|
290
|
-
|
|
302
|
+
h(zn, "getImageSrc");
|
|
291
303
|
function Gi(a) {
|
|
292
304
|
return zn(a.cover) || zn(a.avatar) || is(a.name);
|
|
293
305
|
}
|
|
294
|
-
|
|
306
|
+
h(Gi, "getAgentAvatarUrl");
|
|
295
307
|
function Pn(a) {
|
|
296
308
|
const t = a.target;
|
|
297
309
|
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = is());
|
|
298
310
|
}
|
|
299
|
-
|
|
311
|
+
h(Pn, "handleImageError");
|
|
300
312
|
function ji(a) {
|
|
301
313
|
const { template: t, agent: e } = a;
|
|
302
314
|
return t.replace(/{name}/g, e.name || "Assistant").replace(/{title}/g, e.title || "").replace(/{handle}/g, e.handle || "").replace(/{orgName}/g, e.org?.name || "");
|
|
303
315
|
}
|
|
304
|
-
|
|
316
|
+
h(ji, "parseButtonTemplate");
|
|
305
317
|
const Ns = {
|
|
306
318
|
key: 0,
|
|
307
319
|
class: "absolute inset-0 flex items-center justify-center"
|
|
308
|
-
}, Wi = /* @__PURE__ */
|
|
320
|
+
}, Wi = /* @__PURE__ */ Me({
|
|
309
321
|
__name: "ElAgentButton",
|
|
310
322
|
props: {
|
|
311
323
|
theme: { default: "primary" },
|
|
@@ -315,16 +327,16 @@ const Ns = {
|
|
|
315
327
|
iconAfter: {}
|
|
316
328
|
},
|
|
317
329
|
setup(a) {
|
|
318
|
-
const t =
|
|
330
|
+
const t = W(() => ({
|
|
319
331
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
320
332
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
321
333
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
322
334
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"
|
|
323
|
-
})[a.theme]), e =
|
|
335
|
+
})[a.theme]), e = W(() => ({
|
|
324
336
|
sm: "px-4 py-2 text-sm",
|
|
325
337
|
md: "px-6 py-3 text-base",
|
|
326
338
|
lg: "px-8 py-4 text-base"
|
|
327
|
-
})[a.size]), n =
|
|
339
|
+
})[a.size]), n = W(() => ({
|
|
328
340
|
sm: "size-4",
|
|
329
341
|
md: "size-4",
|
|
330
342
|
lg: "size-5"
|
|
@@ -333,9 +345,9 @@ const Ns = {
|
|
|
333
345
|
class: A(["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]])
|
|
334
346
|
}, [
|
|
335
347
|
a.loading ? (T(), S("div", Ns, [...s[0] || (s[0] = [
|
|
336
|
-
|
|
348
|
+
w("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
337
349
|
])])) : B("", !0),
|
|
338
|
-
|
|
350
|
+
w("span", {
|
|
339
351
|
class: A(["flex items-center gap-2 transition-opacity duration-200", a.loading ? "opacity-0" : "opacity-100"])
|
|
340
352
|
}, [
|
|
341
353
|
a.icon ? (T(), S("i", {
|
|
@@ -350,7 +362,7 @@ const Ns = {
|
|
|
350
362
|
], 2)
|
|
351
363
|
], 2));
|
|
352
364
|
}
|
|
353
|
-
}), $s = ["value"], qi = /* @__PURE__ */
|
|
365
|
+
}), $s = ["value"], qi = /* @__PURE__ */ Me({
|
|
354
366
|
__name: "AgentInputEmail",
|
|
355
367
|
props: {
|
|
356
368
|
modelValue: { default: "" }
|
|
@@ -368,7 +380,7 @@ const Ns = {
|
|
|
368
380
|
onInput: r[0] || (r[0] = (s) => e("update:modelValue", s.target.value))
|
|
369
381
|
}, null, 40, $s));
|
|
370
382
|
}
|
|
371
|
-
}), Bs = { class: "flex gap-1.5 justify-center" }, Us = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], Vi = /* @__PURE__ */
|
|
383
|
+
}), Bs = { class: "flex gap-1.5 justify-center" }, Us = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], Vi = /* @__PURE__ */ Me({
|
|
372
384
|
__name: "AgentInputOneTimeCode",
|
|
373
385
|
props: {
|
|
374
386
|
modelValue: {},
|
|
@@ -377,16 +389,16 @@ const Ns = {
|
|
|
377
389
|
},
|
|
378
390
|
emits: ["update:modelValue", "autoSubmit"],
|
|
379
391
|
setup(a, { emit: t }) {
|
|
380
|
-
const e = a, n = t, r =
|
|
381
|
-
|
|
392
|
+
const e = a, n = t, r = ee([]), s = ee(Array.from({ length: e.length }).fill("")), o = ee(!1);
|
|
393
|
+
tn(() => {
|
|
382
394
|
e.modelValue && (s.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && r.value[0]?.focus();
|
|
383
|
-
}),
|
|
384
|
-
s.value =
|
|
385
|
-
}),
|
|
386
|
-
const
|
|
387
|
-
n("update:modelValue",
|
|
395
|
+
}), ot(() => e.modelValue, (p) => {
|
|
396
|
+
s.value = p ? p.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
397
|
+
}), ot(s, () => {
|
|
398
|
+
const p = s.value.filter(Boolean).join("");
|
|
399
|
+
n("update:modelValue", p), p.length === e.length && n("autoSubmit", p);
|
|
388
400
|
}, { deep: !0 });
|
|
389
|
-
function l(
|
|
401
|
+
function l(p, d) {
|
|
390
402
|
d.preventDefault(), o.value = !0;
|
|
391
403
|
const g = (d.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
392
404
|
if (g.length === e.length)
|
|
@@ -394,47 +406,47 @@ const Ns = {
|
|
|
394
406
|
r.value[e.length - 1]?.focus(), o.value = !1;
|
|
395
407
|
}, 10);
|
|
396
408
|
else {
|
|
397
|
-
const
|
|
398
|
-
g.split("").slice(0, e.length -
|
|
399
|
-
|
|
400
|
-
}), s.value =
|
|
401
|
-
const E = Math.min(
|
|
409
|
+
const y = [...s.value];
|
|
410
|
+
g.split("").slice(0, e.length - p).forEach((O, ae) => {
|
|
411
|
+
y[p + ae] = O;
|
|
412
|
+
}), s.value = y;
|
|
413
|
+
const E = Math.min(p + g.length, e.length - 1);
|
|
402
414
|
setTimeout(() => {
|
|
403
415
|
r.value[E]?.focus(), o.value = !1;
|
|
404
416
|
}, 10);
|
|
405
417
|
}
|
|
406
418
|
}
|
|
407
|
-
|
|
408
|
-
function
|
|
419
|
+
h(l, "onPaste");
|
|
420
|
+
function m(p, d) {
|
|
409
421
|
const g = d.target.value.slice(-1).replace(/\D/g, "");
|
|
410
|
-
s.value[
|
|
422
|
+
s.value[p] = g, g && p < e.length - 1 && r.value[p + 1]?.focus();
|
|
411
423
|
}
|
|
412
|
-
|
|
413
|
-
function c(
|
|
414
|
-
d.key === "Backspace" ? (d.preventDefault(), s.value[
|
|
424
|
+
h(m, "onInput");
|
|
425
|
+
function c(p, d) {
|
|
426
|
+
d.key === "Backspace" ? (d.preventDefault(), s.value[p] = "", p > 0 && r.value[p - 1]?.focus()) : d.key === "ArrowLeft" && p > 0 ? r.value[p - 1]?.focus() : d.key === "ArrowRight" && p < e.length - 1 && r.value[p + 1]?.focus();
|
|
415
427
|
}
|
|
416
|
-
|
|
417
|
-
function
|
|
418
|
-
if (r.value[
|
|
419
|
-
for (let d =
|
|
428
|
+
h(c, "onKeydown");
|
|
429
|
+
function b(p) {
|
|
430
|
+
if (r.value[p]?.select(), !o.value && s.value[p])
|
|
431
|
+
for (let d = p; d < e.length; d++)
|
|
420
432
|
s.value[d] = "";
|
|
421
433
|
}
|
|
422
|
-
return
|
|
423
|
-
(T(!0), S(
|
|
434
|
+
return h(b, "onFocus"), (p, d) => (T(), S("div", Bs, [
|
|
435
|
+
(T(!0), S(Te, null, it(a.length, (g) => ss((T(), S("input", {
|
|
424
436
|
key: g,
|
|
425
437
|
ref_for: !0,
|
|
426
|
-
ref: /* @__PURE__ */
|
|
427
|
-
"onUpdate:modelValue": /* @__PURE__ */
|
|
438
|
+
ref: /* @__PURE__ */ h((y) => r.value[g - 1] = y, "ref"),
|
|
439
|
+
"onUpdate:modelValue": /* @__PURE__ */ h((y) => s.value[g - 1] = y, "onUpdate:modelValue"),
|
|
428
440
|
type: "text",
|
|
429
441
|
inputmode: "numeric",
|
|
430
442
|
autocomplete: "one-time-code",
|
|
431
443
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
432
444
|
style: { "font-size": "16px" },
|
|
433
445
|
maxlength: "1",
|
|
434
|
-
onInput: /* @__PURE__ */
|
|
435
|
-
onKeydown: /* @__PURE__ */
|
|
436
|
-
onPaste: /* @__PURE__ */
|
|
437
|
-
onFocus: /* @__PURE__ */
|
|
446
|
+
onInput: /* @__PURE__ */ h((y) => m(g - 1, y), "onInput"),
|
|
447
|
+
onKeydown: /* @__PURE__ */ h((y) => c(g - 1, y), "onKeydown"),
|
|
448
|
+
onPaste: /* @__PURE__ */ h((y) => l(g - 1, y), "onPaste"),
|
|
449
|
+
onFocus: /* @__PURE__ */ h((y) => b(g - 1), "onFocus")
|
|
438
450
|
}, null, 40, Us)), [
|
|
439
451
|
[rs, s.value[g - 1]]
|
|
440
452
|
])), 128))
|
|
@@ -443,7 +455,7 @@ const Ns = {
|
|
|
443
455
|
}), Fs = { class: "relative flex-shrink-0" }, Hs = ["src", "alt"], Gs = { class: "absolute top-1 right-1" }, js = {
|
|
444
456
|
key: 1,
|
|
445
457
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
446
|
-
}, Ws = { class: "min-w-0" }, qs = /* @__PURE__ */
|
|
458
|
+
}, Ws = { class: "min-w-0" }, qs = /* @__PURE__ */ Me({
|
|
447
459
|
__name: "ElModeHeader",
|
|
448
460
|
props: {
|
|
449
461
|
agent: {},
|
|
@@ -457,36 +469,36 @@ const Ns = {
|
|
|
457
469
|
a.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
458
470
|
]])
|
|
459
471
|
}, [
|
|
460
|
-
|
|
461
|
-
|
|
472
|
+
w("div", Fs, [
|
|
473
|
+
w("div", {
|
|
462
474
|
class: A(["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"])
|
|
463
475
|
}, [
|
|
464
|
-
|
|
476
|
+
w("img", {
|
|
465
477
|
src: a.agent.avatarUrl.value,
|
|
466
478
|
alt: a.agent.displayName.value,
|
|
467
479
|
class: "w-full h-full object-cover",
|
|
468
480
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
469
|
-
(...n) =>
|
|
481
|
+
(...n) => Kt(Pn) && Kt(Pn)(...n))
|
|
470
482
|
}, null, 40, Hs)
|
|
471
483
|
], 2),
|
|
472
|
-
|
|
473
|
-
a.isOnline ? (T(), S(
|
|
474
|
-
e[1] || (e[1] =
|
|
484
|
+
w("div", Gs, [
|
|
485
|
+
a.isOnline ? (T(), S(Te, { key: 0 }, [
|
|
486
|
+
e[1] || (e[1] = w("div", {
|
|
475
487
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
476
488
|
style: { "animation-duration": "3s" }
|
|
477
489
|
}, null, -1)),
|
|
478
|
-
e[2] || (e[2] =
|
|
490
|
+
e[2] || (e[2] = w("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
479
491
|
], 64)) : (T(), S("div", js))
|
|
480
492
|
])
|
|
481
493
|
]),
|
|
482
|
-
|
|
483
|
-
|
|
494
|
+
w("div", Ws, [
|
|
495
|
+
w("h1", {
|
|
484
496
|
class: A(["font-light text-white mb-1 truncate", [
|
|
485
497
|
a.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
486
498
|
a.layout === "horizontal" ? "text-white/95" : ""
|
|
487
499
|
]])
|
|
488
500
|
}, ie(a.agent.displayName.value), 3),
|
|
489
|
-
|
|
501
|
+
w("p", {
|
|
490
502
|
class: A(["font-light line-clamp-1", [
|
|
491
503
|
a.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
492
504
|
a.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
@@ -504,50 +516,50 @@ const {
|
|
|
504
516
|
getOwnPropertyDescriptor: Zs
|
|
505
517
|
} = Object;
|
|
506
518
|
let {
|
|
507
|
-
freeze:
|
|
508
|
-
seal:
|
|
509
|
-
create:
|
|
519
|
+
freeze: te,
|
|
520
|
+
seal: oe,
|
|
521
|
+
create: He
|
|
510
522
|
} = Object, {
|
|
511
|
-
apply:
|
|
512
|
-
construct:
|
|
523
|
+
apply: Qt,
|
|
524
|
+
construct: Jt
|
|
513
525
|
} = typeof Reflect < "u" && Reflect;
|
|
514
|
-
|
|
526
|
+
te || (te = /* @__PURE__ */ h(function(t) {
|
|
515
527
|
return t;
|
|
516
528
|
}, "freeze"));
|
|
517
|
-
|
|
529
|
+
oe || (oe = /* @__PURE__ */ h(function(t) {
|
|
518
530
|
return t;
|
|
519
531
|
}, "seal"));
|
|
520
|
-
|
|
532
|
+
Qt || (Qt = /* @__PURE__ */ h(function(t, e) {
|
|
521
533
|
for (var n = arguments.length, r = new Array(n > 2 ? n - 2 : 0), s = 2; s < n; s++)
|
|
522
534
|
r[s - 2] = arguments[s];
|
|
523
535
|
return t.apply(e, r);
|
|
524
536
|
}, "apply"));
|
|
525
|
-
|
|
537
|
+
Jt || (Jt = /* @__PURE__ */ h(function(t) {
|
|
526
538
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++)
|
|
527
539
|
n[r - 1] = arguments[r];
|
|
528
540
|
return new t(...n);
|
|
529
541
|
}, "construct"));
|
|
530
|
-
const
|
|
531
|
-
function
|
|
542
|
+
const et = G(Array.prototype.forEach), Xs = G(Array.prototype.lastIndexOf), $n = G(Array.prototype.pop), tt = G(Array.prototype.push), Ks = G(Array.prototype.splice), J = Array.isArray, at = G(String.prototype.toLowerCase), qt = G(String.prototype.toString), Bn = G(String.prototype.match), Fe = G(String.prototype.replace), Un = G(String.prototype.indexOf), Qs = G(String.prototype.trim), Js = G(Number.prototype.toString), er = G(Boolean.prototype.toString), Fn = typeof BigInt > "u" ? null : G(BigInt.prototype.toString), Hn = typeof Symbol > "u" ? null : G(Symbol.prototype.toString), $ = G(Object.prototype.hasOwnProperty), nt = G(Object.prototype.toString), Z = G(RegExp.prototype.test), xt = tr(TypeError);
|
|
543
|
+
function G(a) {
|
|
532
544
|
return function(t) {
|
|
533
545
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
534
546
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++)
|
|
535
547
|
n[r - 1] = arguments[r];
|
|
536
|
-
return
|
|
548
|
+
return Qt(a, t, n);
|
|
537
549
|
};
|
|
538
550
|
}
|
|
539
|
-
|
|
551
|
+
h(G, "unapply");
|
|
540
552
|
function tr(a) {
|
|
541
553
|
return function() {
|
|
542
554
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
543
555
|
e[n] = arguments[n];
|
|
544
|
-
return
|
|
556
|
+
return Jt(a, e);
|
|
545
557
|
};
|
|
546
558
|
}
|
|
547
|
-
|
|
559
|
+
h(tr, "unconstruct");
|
|
548
560
|
function R(a, t) {
|
|
549
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
550
|
-
if (Nn && Nn(a, null), !
|
|
561
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : at;
|
|
562
|
+
if (Nn && Nn(a, null), !J(t))
|
|
551
563
|
return a;
|
|
552
564
|
let n = t.length;
|
|
553
565
|
for (; n--; ) {
|
|
@@ -560,20 +572,20 @@ function R(a, t) {
|
|
|
560
572
|
}
|
|
561
573
|
return a;
|
|
562
574
|
}
|
|
563
|
-
|
|
575
|
+
h(R, "addToSet");
|
|
564
576
|
function nr(a) {
|
|
565
577
|
for (let t = 0; t < a.length; t++)
|
|
566
578
|
$(a, t) || (a[t] = null);
|
|
567
579
|
return a;
|
|
568
580
|
}
|
|
569
|
-
|
|
581
|
+
h(nr, "cleanArray");
|
|
570
582
|
function re(a) {
|
|
571
|
-
const t =
|
|
583
|
+
const t = He(null);
|
|
572
584
|
for (const [e, n] of as(a))
|
|
573
|
-
$(a, e) && (
|
|
585
|
+
$(a, e) && (J(n) ? t[e] = nr(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = re(n) : t[e] = n);
|
|
574
586
|
return t;
|
|
575
587
|
}
|
|
576
|
-
|
|
588
|
+
h(re, "clone");
|
|
577
589
|
function sr(a) {
|
|
578
590
|
switch (typeof a) {
|
|
579
591
|
case "string":
|
|
@@ -587,55 +599,55 @@ function sr(a) {
|
|
|
587
599
|
case "symbol":
|
|
588
600
|
return Hn ? Hn(a) : "Symbol()";
|
|
589
601
|
case "undefined":
|
|
590
|
-
return
|
|
602
|
+
return nt(a);
|
|
591
603
|
case "function":
|
|
592
604
|
case "object": {
|
|
593
605
|
if (a === null)
|
|
594
|
-
return
|
|
595
|
-
const t = a, e =
|
|
606
|
+
return nt(a);
|
|
607
|
+
const t = a, e = Ge(t, "toString");
|
|
596
608
|
if (typeof e == "function") {
|
|
597
609
|
const n = e(t);
|
|
598
|
-
return typeof n == "string" ? n :
|
|
610
|
+
return typeof n == "string" ? n : nt(n);
|
|
599
611
|
}
|
|
600
|
-
return
|
|
612
|
+
return nt(a);
|
|
601
613
|
}
|
|
602
614
|
default:
|
|
603
|
-
return
|
|
615
|
+
return nt(a);
|
|
604
616
|
}
|
|
605
617
|
}
|
|
606
|
-
|
|
607
|
-
function
|
|
618
|
+
h(sr, "stringifyValue");
|
|
619
|
+
function Ge(a, t) {
|
|
608
620
|
for (; a !== null; ) {
|
|
609
621
|
const n = Zs(a, t);
|
|
610
622
|
if (n) {
|
|
611
623
|
if (n.get)
|
|
612
|
-
return
|
|
624
|
+
return G(n.get);
|
|
613
625
|
if (typeof n.value == "function")
|
|
614
|
-
return
|
|
626
|
+
return G(n.value);
|
|
615
627
|
}
|
|
616
628
|
a = Ys(a);
|
|
617
629
|
}
|
|
618
630
|
function e() {
|
|
619
631
|
return null;
|
|
620
632
|
}
|
|
621
|
-
return
|
|
633
|
+
return h(e, "fallbackValue"), e;
|
|
622
634
|
}
|
|
623
|
-
|
|
635
|
+
h(Ge, "lookupGetter");
|
|
624
636
|
function rr(a) {
|
|
625
637
|
try {
|
|
626
|
-
return
|
|
638
|
+
return Z(a, ""), !0;
|
|
627
639
|
} catch {
|
|
628
640
|
return !1;
|
|
629
641
|
}
|
|
630
642
|
}
|
|
631
|
-
|
|
632
|
-
const Gn =
|
|
643
|
+
h(rr, "isRegex");
|
|
644
|
+
const Gn = te(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Vt = te(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Yt = te(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ir = te(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Zt = te(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), ar = te(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), jn = te(["#text"]), Wn = te(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]), Xt = te(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), qn = te(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), kt = te(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), lr = oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm), or = oe(/<%[\w\W]*|[\w\W]*%>/gm), cr = oe(/\$\{[\w\W]*/gm), ur = oe(/^data-[\-\w.\u00B7-\uFFFF]+$/), hr = oe(/^aria-[\-\w]+$/), ls = oe(
|
|
633
645
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
634
646
|
// eslint-disable-line no-useless-escape
|
|
635
|
-
), pr =
|
|
647
|
+
), pr = oe(/^(?:\w+script|data):/i), dr = oe(
|
|
636
648
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
637
649
|
// eslint-disable-line no-control-regex
|
|
638
|
-
), os =
|
|
650
|
+
), os = oe(/^html$/i), fr = oe(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
639
651
|
var Vn = /* @__PURE__ */ Object.freeze({
|
|
640
652
|
__proto__: null,
|
|
641
653
|
ARIA_ATTR: hr,
|
|
@@ -649,16 +661,16 @@ var Vn = /* @__PURE__ */ Object.freeze({
|
|
|
649
661
|
MUSTACHE_EXPR: lr,
|
|
650
662
|
TMPLIT_EXPR: cr
|
|
651
663
|
});
|
|
652
|
-
const
|
|
664
|
+
const st = {
|
|
653
665
|
element: 1,
|
|
654
666
|
text: 3,
|
|
655
667
|
// Deprecated
|
|
656
668
|
progressingInstruction: 7,
|
|
657
669
|
comment: 8,
|
|
658
670
|
document: 9
|
|
659
|
-
}, gr = /* @__PURE__ */
|
|
671
|
+
}, gr = /* @__PURE__ */ h(function() {
|
|
660
672
|
return typeof window > "u" ? null : window;
|
|
661
|
-
}, "getGlobal"), mr = /* @__PURE__ */
|
|
673
|
+
}, "getGlobal"), mr = /* @__PURE__ */ h(function(t, e) {
|
|
662
674
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
663
675
|
return null;
|
|
664
676
|
let n = null;
|
|
@@ -677,7 +689,7 @@ const rt = {
|
|
|
677
689
|
} catch {
|
|
678
690
|
return console.warn("TrustedTypes policy " + s + " could not be created."), null;
|
|
679
691
|
}
|
|
680
|
-
}, "_createTrustedTypesPolicy"), Yn = /* @__PURE__ */
|
|
692
|
+
}, "_createTrustedTypesPolicy"), Yn = /* @__PURE__ */ h(function() {
|
|
681
693
|
return {
|
|
682
694
|
afterSanitizeAttributes: [],
|
|
683
695
|
afterSanitizeElements: [],
|
|
@@ -692,8 +704,8 @@ const rt = {
|
|
|
692
704
|
}, "_createHooksMap");
|
|
693
705
|
function cs() {
|
|
694
706
|
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : gr();
|
|
695
|
-
const t = /* @__PURE__ */
|
|
696
|
-
if (t.version = "3.4.1", t.removed = [], !a || !a.document || a.document.nodeType !==
|
|
707
|
+
const t = /* @__PURE__ */ h((v) => cs(v), "DOMPurify");
|
|
708
|
+
if (t.version = "3.4.1", t.removed = [], !a || !a.document || a.document.nodeType !== st.document || !a.Element)
|
|
697
709
|
return t.isSupported = !1, t;
|
|
698
710
|
let {
|
|
699
711
|
document: e
|
|
@@ -702,45 +714,45 @@ function cs() {
|
|
|
702
714
|
DocumentFragment: s,
|
|
703
715
|
HTMLTemplateElement: o,
|
|
704
716
|
Node: l,
|
|
705
|
-
Element:
|
|
717
|
+
Element: m,
|
|
706
718
|
NodeFilter: c,
|
|
707
|
-
NamedNodeMap:
|
|
708
|
-
HTMLFormElement:
|
|
719
|
+
NamedNodeMap: b = a.NamedNodeMap || a.MozNamedAttrMap,
|
|
720
|
+
HTMLFormElement: p,
|
|
709
721
|
DOMParser: d,
|
|
710
722
|
trustedTypes: g
|
|
711
|
-
} = a,
|
|
723
|
+
} = a, y = m.prototype, E = Ge(y, "cloneNode"), O = Ge(y, "remove"), ae = Ge(y, "nextSibling"), ce = Ge(y, "childNodes"), ne = Ge(y, "parentNode");
|
|
712
724
|
if (typeof o == "function") {
|
|
713
725
|
const v = e.createElement("template");
|
|
714
726
|
v.content && v.content.ownerDocument && (e = v.content.ownerDocument);
|
|
715
727
|
}
|
|
716
|
-
let
|
|
728
|
+
let N, Y = "";
|
|
717
729
|
const {
|
|
718
|
-
implementation:
|
|
719
|
-
createNodeIterator:
|
|
720
|
-
createDocumentFragment:
|
|
721
|
-
getElementsByTagName:
|
|
730
|
+
implementation: ue,
|
|
731
|
+
createNodeIterator: Q,
|
|
732
|
+
createDocumentFragment: _t,
|
|
733
|
+
getElementsByTagName: ut
|
|
722
734
|
} = e, {
|
|
723
|
-
importNode:
|
|
735
|
+
importNode: I
|
|
724
736
|
} = n;
|
|
725
|
-
let
|
|
726
|
-
t.isSupported = typeof as == "function" && typeof
|
|
737
|
+
let q = Yn();
|
|
738
|
+
t.isSupported = typeof as == "function" && typeof ne == "function" && ue && ue.createHTMLDocument !== void 0;
|
|
727
739
|
const {
|
|
728
|
-
MUSTACHE_EXPR:
|
|
729
|
-
ERB_EXPR:
|
|
730
|
-
TMPLIT_EXPR:
|
|
731
|
-
DATA_ATTR:
|
|
732
|
-
ARIA_ATTR:
|
|
733
|
-
IS_SCRIPT_OR_DATA:
|
|
740
|
+
MUSTACHE_EXPR: we,
|
|
741
|
+
ERB_EXPR: Oe,
|
|
742
|
+
TMPLIT_EXPR: ye,
|
|
743
|
+
DATA_ATTR: Rt,
|
|
744
|
+
ARIA_ATTR: It,
|
|
745
|
+
IS_SCRIPT_OR_DATA: ht,
|
|
734
746
|
ATTR_WHITESPACE: pt,
|
|
735
|
-
CUSTOM_ELEMENT:
|
|
747
|
+
CUSTOM_ELEMENT: Ct
|
|
736
748
|
} = Vn;
|
|
737
749
|
let {
|
|
738
|
-
IS_ALLOWED_URI:
|
|
739
|
-
} = Vn,
|
|
740
|
-
const
|
|
741
|
-
let
|
|
742
|
-
const
|
|
743
|
-
let
|
|
750
|
+
IS_ALLOWED_URI: dt
|
|
751
|
+
} = Vn, U = null;
|
|
752
|
+
const Ze = R({}, [...Gn, ...Vt, ...Yt, ...Zt, ...jn]);
|
|
753
|
+
let F = null;
|
|
754
|
+
const _ = R({}, [...Wn, ...Xt, ...qn, ...kt]);
|
|
755
|
+
let f = Object.seal(He(null, {
|
|
744
756
|
tagNameCheck: {
|
|
745
757
|
writable: !0,
|
|
746
758
|
configurable: !1,
|
|
@@ -759,8 +771,8 @@ function cs() {
|
|
|
759
771
|
enumerable: !0,
|
|
760
772
|
value: !1
|
|
761
773
|
}
|
|
762
|
-
})),
|
|
763
|
-
const
|
|
774
|
+
})), x = null, M = null;
|
|
775
|
+
const P = Object.seal(He(null, {
|
|
764
776
|
tagCheck: {
|
|
765
777
|
writable: !0,
|
|
766
778
|
configurable: !1,
|
|
@@ -774,72 +786,72 @@ function cs() {
|
|
|
774
786
|
value: null
|
|
775
787
|
}
|
|
776
788
|
}));
|
|
777
|
-
let
|
|
789
|
+
let xe = !0, ze = !0, Pe = !1, dn = !0, _e = !1, Xe = !0, Re = !1, Dt = !1, Mt = !1, Ne = !1, ft = !1, gt = !1, fn = !0, gn = !1;
|
|
778
790
|
const mn = "user-content-";
|
|
779
|
-
let
|
|
780
|
-
const
|
|
791
|
+
let Lt = !0, Ke = !1, $e = {}, ge = null;
|
|
792
|
+
const Ot = 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"]);
|
|
781
793
|
let bn = null;
|
|
782
794
|
const xn = R({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
783
|
-
let
|
|
784
|
-
const kn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
|
|
785
|
-
let
|
|
786
|
-
const ws = R({}, [
|
|
787
|
-
let
|
|
795
|
+
let zt = null;
|
|
796
|
+
const kn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), mt = "http://www.w3.org/1998/Math/MathML", bt = "http://www.w3.org/2000/svg", me = "http://www.w3.org/1999/xhtml";
|
|
797
|
+
let Be = me, Pt = !1, Nt = null;
|
|
798
|
+
const ws = R({}, [mt, bt, me], qt);
|
|
799
|
+
let $t = R({}, ["mi", "mo", "mn", "ms", "mtext"]), Bt = R({}, ["annotation-xml"]);
|
|
788
800
|
const ys = R({}, ["title", "style", "font", "a", "script"]);
|
|
789
|
-
let
|
|
801
|
+
let Qe = null;
|
|
790
802
|
const vs = ["application/xhtml+xml", "text/html"], Ts = "text/html";
|
|
791
|
-
let
|
|
792
|
-
const Ss = e.createElement("form"), wn = /* @__PURE__ */
|
|
803
|
+
let j = null, Ue = null;
|
|
804
|
+
const Ss = e.createElement("form"), wn = /* @__PURE__ */ h(function(i) {
|
|
793
805
|
return i instanceof RegExp || i instanceof Function;
|
|
794
|
-
}, "isRegexOrFunction"),
|
|
806
|
+
}, "isRegexOrFunction"), Ut = /* @__PURE__ */ h(function() {
|
|
795
807
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
796
|
-
if (
|
|
808
|
+
if (Ue && Ue === i)
|
|
797
809
|
return;
|
|
798
|
-
(!i || typeof i != "object") && (i = {}), i = re(i),
|
|
799
|
-
vs.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? Ts : i.PARSER_MEDIA_TYPE,
|
|
800
|
-
const u = $(i, "CUSTOM_ELEMENT_HANDLING") && i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING == "object" ? re(i.CUSTOM_ELEMENT_HANDLING) :
|
|
801
|
-
if (
|
|
810
|
+
(!i || typeof i != "object") && (i = {}), i = re(i), Qe = // eslint-disable-next-line unicorn/prefer-includes
|
|
811
|
+
vs.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? Ts : i.PARSER_MEDIA_TYPE, j = Qe === "application/xhtml+xml" ? qt : at, U = $(i, "ALLOWED_TAGS") && J(i.ALLOWED_TAGS) ? R({}, i.ALLOWED_TAGS, j) : Ze, F = $(i, "ALLOWED_ATTR") && J(i.ALLOWED_ATTR) ? R({}, i.ALLOWED_ATTR, j) : _, Nt = $(i, "ALLOWED_NAMESPACES") && J(i.ALLOWED_NAMESPACES) ? R({}, i.ALLOWED_NAMESPACES, qt) : ws, zt = $(i, "ADD_URI_SAFE_ATTR") && J(i.ADD_URI_SAFE_ATTR) ? R(re(kn), i.ADD_URI_SAFE_ATTR, j) : kn, bn = $(i, "ADD_DATA_URI_TAGS") && J(i.ADD_DATA_URI_TAGS) ? R(re(xn), i.ADD_DATA_URI_TAGS, j) : xn, ge = $(i, "FORBID_CONTENTS") && J(i.FORBID_CONTENTS) ? R({}, i.FORBID_CONTENTS, j) : Ot, x = $(i, "FORBID_TAGS") && J(i.FORBID_TAGS) ? R({}, i.FORBID_TAGS, j) : re({}), M = $(i, "FORBID_ATTR") && J(i.FORBID_ATTR) ? R({}, i.FORBID_ATTR, j) : re({}), $e = $(i, "USE_PROFILES") ? i.USE_PROFILES && typeof i.USE_PROFILES == "object" ? re(i.USE_PROFILES) : i.USE_PROFILES : !1, xe = i.ALLOW_ARIA_ATTR !== !1, ze = i.ALLOW_DATA_ATTR !== !1, Pe = i.ALLOW_UNKNOWN_PROTOCOLS || !1, dn = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, _e = i.SAFE_FOR_TEMPLATES || !1, Xe = i.SAFE_FOR_XML !== !1, Re = i.WHOLE_DOCUMENT || !1, Ne = i.RETURN_DOM || !1, ft = i.RETURN_DOM_FRAGMENT || !1, gt = i.RETURN_TRUSTED_TYPE || !1, Mt = i.FORCE_BODY || !1, fn = i.SANITIZE_DOM !== !1, gn = i.SANITIZE_NAMED_PROPS || !1, Lt = i.KEEP_CONTENT !== !1, Ke = i.IN_PLACE || !1, dt = rr(i.ALLOWED_URI_REGEXP) ? i.ALLOWED_URI_REGEXP : ls, Be = typeof i.NAMESPACE == "string" ? i.NAMESPACE : me, $t = $(i, "MATHML_TEXT_INTEGRATION_POINTS") && i.MATHML_TEXT_INTEGRATION_POINTS && typeof i.MATHML_TEXT_INTEGRATION_POINTS == "object" ? re(i.MATHML_TEXT_INTEGRATION_POINTS) : R({}, ["mi", "mo", "mn", "ms", "mtext"]), Bt = $(i, "HTML_INTEGRATION_POINTS") && i.HTML_INTEGRATION_POINTS && typeof i.HTML_INTEGRATION_POINTS == "object" ? re(i.HTML_INTEGRATION_POINTS) : R({}, ["annotation-xml"]);
|
|
812
|
+
const u = $(i, "CUSTOM_ELEMENT_HANDLING") && i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING == "object" ? re(i.CUSTOM_ELEMENT_HANDLING) : He(null);
|
|
813
|
+
if (f = He(null), $(u, "tagNameCheck") && wn(u.tagNameCheck) && (f.tagNameCheck = u.tagNameCheck), $(u, "attributeNameCheck") && wn(u.attributeNameCheck) && (f.attributeNameCheck = u.attributeNameCheck), $(u, "allowCustomizedBuiltInElements") && typeof u.allowCustomizedBuiltInElements == "boolean" && (f.allowCustomizedBuiltInElements = u.allowCustomizedBuiltInElements), _e && (ze = !1), ft && (Ne = !0), $e && (U = R({}, jn), F = He(null), $e.html === !0 && (R(U, Gn), R(F, Wn)), $e.svg === !0 && (R(U, Vt), R(F, Xt), R(F, kt)), $e.svgFilters === !0 && (R(U, Yt), R(F, Xt), R(F, kt)), $e.mathMl === !0 && (R(U, Zt), R(F, qn), R(F, kt))), P.tagCheck = null, P.attributeCheck = null, $(i, "ADD_TAGS") && (typeof i.ADD_TAGS == "function" ? P.tagCheck = i.ADD_TAGS : J(i.ADD_TAGS) && (U === Ze && (U = re(U)), R(U, i.ADD_TAGS, j))), $(i, "ADD_ATTR") && (typeof i.ADD_ATTR == "function" ? P.attributeCheck = i.ADD_ATTR : J(i.ADD_ATTR) && (F === _ && (F = re(F)), R(F, i.ADD_ATTR, j))), $(i, "ADD_URI_SAFE_ATTR") && J(i.ADD_URI_SAFE_ATTR) && R(zt, i.ADD_URI_SAFE_ATTR, j), $(i, "FORBID_CONTENTS") && J(i.FORBID_CONTENTS) && (ge === Ot && (ge = re(ge)), R(ge, i.FORBID_CONTENTS, j)), $(i, "ADD_FORBID_CONTENTS") && J(i.ADD_FORBID_CONTENTS) && (ge === Ot && (ge = re(ge)), R(ge, i.ADD_FORBID_CONTENTS, j)), Lt && (U["#text"] = !0), Re && R(U, ["html", "head", "body"]), U.table && (R(U, ["tbody"]), delete x.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
802
814
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
803
|
-
throw
|
|
815
|
+
throw xt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
804
816
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
805
|
-
throw
|
|
806
|
-
|
|
817
|
+
throw xt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
818
|
+
N = i.TRUSTED_TYPES_POLICY, Y = N.createHTML("");
|
|
807
819
|
} else
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}, "_parseConfig"), yn = R({}, [...
|
|
811
|
-
let u =
|
|
820
|
+
N === void 0 && (N = mr(g, r)), N !== null && typeof Y == "string" && (Y = N.createHTML(""));
|
|
821
|
+
te && te(i), Ue = i;
|
|
822
|
+
}, "_parseConfig"), yn = R({}, [...Vt, ...Yt, ...ir]), vn = R({}, [...Zt, ...ar]), As = /* @__PURE__ */ h(function(i) {
|
|
823
|
+
let u = ne(i);
|
|
812
824
|
(!u || !u.tagName) && (u = {
|
|
813
|
-
namespaceURI:
|
|
825
|
+
namespaceURI: Be,
|
|
814
826
|
tagName: "template"
|
|
815
827
|
});
|
|
816
|
-
const k =
|
|
817
|
-
return
|
|
818
|
-
}, "_checkValidNamespace"),
|
|
819
|
-
|
|
828
|
+
const k = at(i.tagName), z = at(u.tagName);
|
|
829
|
+
return Nt[i.namespaceURI] ? i.namespaceURI === bt ? u.namespaceURI === me ? k === "svg" : u.namespaceURI === mt ? k === "svg" && (z === "annotation-xml" || $t[z]) : !!yn[k] : i.namespaceURI === mt ? u.namespaceURI === me ? k === "math" : u.namespaceURI === bt ? k === "math" && Bt[z] : !!vn[k] : i.namespaceURI === me ? u.namespaceURI === bt && !Bt[z] || u.namespaceURI === mt && !$t[z] ? !1 : !vn[k] && (ys[k] || !yn[k]) : !!(Qe === "application/xhtml+xml" && Nt[i.namespaceURI]) : !1;
|
|
830
|
+
}, "_checkValidNamespace"), he = /* @__PURE__ */ h(function(i) {
|
|
831
|
+
tt(t.removed, {
|
|
820
832
|
element: i
|
|
821
833
|
});
|
|
822
834
|
try {
|
|
823
|
-
|
|
835
|
+
ne(i).removeChild(i);
|
|
824
836
|
} catch {
|
|
825
837
|
O(i);
|
|
826
838
|
}
|
|
827
|
-
}, "_forceRemove"),
|
|
839
|
+
}, "_forceRemove"), Ie = /* @__PURE__ */ h(function(i, u) {
|
|
828
840
|
try {
|
|
829
|
-
|
|
841
|
+
tt(t.removed, {
|
|
830
842
|
attribute: u.getAttributeNode(i),
|
|
831
843
|
from: u
|
|
832
844
|
});
|
|
833
845
|
} catch {
|
|
834
|
-
|
|
846
|
+
tt(t.removed, {
|
|
835
847
|
attribute: null,
|
|
836
848
|
from: u
|
|
837
849
|
});
|
|
838
850
|
}
|
|
839
851
|
if (u.removeAttribute(i), i === "is")
|
|
840
|
-
if (
|
|
852
|
+
if (Ne || ft)
|
|
841
853
|
try {
|
|
842
|
-
|
|
854
|
+
he(u);
|
|
843
855
|
} catch {
|
|
844
856
|
}
|
|
845
857
|
else
|
|
@@ -847,98 +859,98 @@ function cs() {
|
|
|
847
859
|
u.setAttribute(i, "");
|
|
848
860
|
} catch {
|
|
849
861
|
}
|
|
850
|
-
}, "_removeAttribute"), Tn = /* @__PURE__ */
|
|
862
|
+
}, "_removeAttribute"), Tn = /* @__PURE__ */ h(function(i) {
|
|
851
863
|
let u = null, k = null;
|
|
852
|
-
if (
|
|
864
|
+
if (Mt)
|
|
853
865
|
i = "<remove></remove>" + i;
|
|
854
866
|
else {
|
|
855
867
|
const H = Bn(i, /^[\r\n\t ]+/);
|
|
856
868
|
k = H && H[0];
|
|
857
869
|
}
|
|
858
|
-
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
870
|
+
Qe === "application/xhtml+xml" && Be === me && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
871
|
+
const z = N ? N.createHTML(i) : i;
|
|
872
|
+
if (Be === me)
|
|
861
873
|
try {
|
|
862
|
-
u = new d().parseFromString(
|
|
874
|
+
u = new d().parseFromString(z, Qe);
|
|
863
875
|
} catch {
|
|
864
876
|
}
|
|
865
877
|
if (!u || !u.documentElement) {
|
|
866
|
-
u =
|
|
878
|
+
u = ue.createDocument(Be, "template", null);
|
|
867
879
|
try {
|
|
868
|
-
u.documentElement.innerHTML =
|
|
880
|
+
u.documentElement.innerHTML = Pt ? Y : z;
|
|
869
881
|
} catch {
|
|
870
882
|
}
|
|
871
883
|
}
|
|
872
|
-
const
|
|
873
|
-
return i && k &&
|
|
874
|
-
}, "_initDocument"), Sn = /* @__PURE__ */
|
|
875
|
-
return
|
|
884
|
+
const X = u.body || u.documentElement;
|
|
885
|
+
return i && k && X.insertBefore(e.createTextNode(k), X.childNodes[0] || null), Be === me ? ut.call(u, Re ? "html" : "body")[0] : Re ? u.documentElement : X;
|
|
886
|
+
}, "_initDocument"), Sn = /* @__PURE__ */ h(function(i) {
|
|
887
|
+
return Q.call(
|
|
876
888
|
i.ownerDocument || i,
|
|
877
889
|
i,
|
|
878
890
|
// eslint-disable-next-line no-bitwise
|
|
879
891
|
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
880
892
|
null
|
|
881
893
|
);
|
|
882
|
-
}, "_createNodeIterator"),
|
|
883
|
-
return i instanceof
|
|
884
|
-
}, "_isClobbered"),
|
|
894
|
+
}, "_createNodeIterator"), Ft = /* @__PURE__ */ h(function(i) {
|
|
895
|
+
return i instanceof p && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof b) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
896
|
+
}, "_isClobbered"), Ht = /* @__PURE__ */ h(function(i) {
|
|
885
897
|
return typeof l == "function" && i instanceof l;
|
|
886
898
|
}, "_isNode");
|
|
887
|
-
function
|
|
888
|
-
|
|
889
|
-
k.call(t, i, u,
|
|
899
|
+
function ke(v, i, u) {
|
|
900
|
+
et(v, (k) => {
|
|
901
|
+
k.call(t, i, u, Ue);
|
|
890
902
|
});
|
|
891
903
|
}
|
|
892
|
-
|
|
893
|
-
const An = /* @__PURE__ */
|
|
904
|
+
h(ke, "_executeHooks");
|
|
905
|
+
const An = /* @__PURE__ */ h(function(i) {
|
|
894
906
|
let u = null;
|
|
895
|
-
if (
|
|
896
|
-
return
|
|
897
|
-
const k =
|
|
898
|
-
if (
|
|
907
|
+
if (ke(q.beforeSanitizeElements, i, null), Ft(i))
|
|
908
|
+
return he(i), !0;
|
|
909
|
+
const k = j(i.nodeName);
|
|
910
|
+
if (ke(q.uponSanitizeElement, i, {
|
|
899
911
|
tagName: k,
|
|
900
|
-
allowedTags:
|
|
901
|
-
}),
|
|
902
|
-
return
|
|
903
|
-
if (
|
|
904
|
-
if (!
|
|
912
|
+
allowedTags: U
|
|
913
|
+
}), Xe && i.hasChildNodes() && !Ht(i.firstElementChild) && Z(/<[/\w!]/g, i.innerHTML) && Z(/<[/\w!]/g, i.textContent) || Xe && i.namespaceURI === me && k === "style" && Ht(i.firstElementChild) || i.nodeType === st.progressingInstruction || Xe && i.nodeType === st.comment && Z(/<[/\w]/g, i.data))
|
|
914
|
+
return he(i), !0;
|
|
915
|
+
if (x[k] || !(P.tagCheck instanceof Function && P.tagCheck(k)) && !U[k]) {
|
|
916
|
+
if (!x[k] && _n(k) && (f.tagNameCheck instanceof RegExp && Z(f.tagNameCheck, k) || f.tagNameCheck instanceof Function && f.tagNameCheck(k)))
|
|
905
917
|
return !1;
|
|
906
|
-
if (
|
|
907
|
-
const
|
|
908
|
-
if (
|
|
909
|
-
const H =
|
|
918
|
+
if (Lt && !ge[k]) {
|
|
919
|
+
const z = ne(i) || i.parentNode, X = ce(i) || i.childNodes;
|
|
920
|
+
if (X && z) {
|
|
921
|
+
const H = X.length;
|
|
910
922
|
for (let se = H - 1; se >= 0; --se) {
|
|
911
|
-
const
|
|
912
|
-
|
|
923
|
+
const le = E(X[se], !0);
|
|
924
|
+
z.insertBefore(le, ae(i));
|
|
913
925
|
}
|
|
914
926
|
}
|
|
915
927
|
}
|
|
916
|
-
return
|
|
928
|
+
return he(i), !0;
|
|
917
929
|
}
|
|
918
|
-
return i instanceof
|
|
919
|
-
u =
|
|
920
|
-
}), i.textContent !== u && (
|
|
930
|
+
return i instanceof m && !As(i) || (k === "noscript" || k === "noembed" || k === "noframes") && Z(/<\/no(script|embed|frames)/i, i.innerHTML) ? (he(i), !0) : (_e && i.nodeType === st.text && (u = i.textContent, et([we, Oe, ye], (z) => {
|
|
931
|
+
u = Fe(u, z, " ");
|
|
932
|
+
}), i.textContent !== u && (tt(t.removed, {
|
|
921
933
|
element: i.cloneNode()
|
|
922
|
-
}), i.textContent = u)),
|
|
923
|
-
}, "_sanitizeElements"), En = /* @__PURE__ */
|
|
924
|
-
if (
|
|
934
|
+
}), i.textContent = u)), ke(q.afterSanitizeElements, i, null), !1);
|
|
935
|
+
}, "_sanitizeElements"), En = /* @__PURE__ */ h(function(i, u, k) {
|
|
936
|
+
if (M[u] || fn && (u === "id" || u === "name") && (k in e || k in Ss))
|
|
925
937
|
return !1;
|
|
926
|
-
if (!(
|
|
927
|
-
if (!(
|
|
928
|
-
if (!(
|
|
929
|
-
if (!
|
|
938
|
+
if (!(ze && !M[u] && Z(Rt, u))) {
|
|
939
|
+
if (!(xe && Z(It, u))) {
|
|
940
|
+
if (!(P.attributeCheck instanceof Function && P.attributeCheck(u, i))) {
|
|
941
|
+
if (!F[u] || M[u]) {
|
|
930
942
|
if (
|
|
931
943
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
932
944
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
933
945
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
934
|
-
!(_n(i) && (
|
|
946
|
+
!(_n(i) && (f.tagNameCheck instanceof RegExp && Z(f.tagNameCheck, i) || f.tagNameCheck instanceof Function && f.tagNameCheck(i)) && (f.attributeNameCheck instanceof RegExp && Z(f.attributeNameCheck, u) || f.attributeNameCheck instanceof Function && f.attributeNameCheck(u, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
935
947
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
936
|
-
u === "is" &&
|
|
948
|
+
u === "is" && f.allowCustomizedBuiltInElements && (f.tagNameCheck instanceof RegExp && Z(f.tagNameCheck, k) || f.tagNameCheck instanceof Function && f.tagNameCheck(k)))
|
|
937
949
|
) return !1;
|
|
938
|
-
} else if (!
|
|
939
|
-
if (!
|
|
950
|
+
} else if (!zt[u]) {
|
|
951
|
+
if (!Z(dt, Fe(k, pt, ""))) {
|
|
940
952
|
if (!((u === "src" || u === "xlink:href" || u === "href") && i !== "script" && Un(k, "data:") === 0 && bn[i])) {
|
|
941
|
-
if (!(
|
|
953
|
+
if (!(Pe && !Z(ht, Fe(k, pt, "")))) {
|
|
942
954
|
if (k)
|
|
943
955
|
return !1;
|
|
944
956
|
}
|
|
@@ -949,210 +961,210 @@ function cs() {
|
|
|
949
961
|
}
|
|
950
962
|
}
|
|
951
963
|
return !0;
|
|
952
|
-
}, "_isValidAttribute"), Es = R({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), _n = /* @__PURE__ */
|
|
953
|
-
return !Es[
|
|
954
|
-
}, "_isBasicCustomElement"), Rn = /* @__PURE__ */
|
|
955
|
-
|
|
964
|
+
}, "_isValidAttribute"), Es = R({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), _n = /* @__PURE__ */ h(function(i) {
|
|
965
|
+
return !Es[at(i)] && Z(Ct, i);
|
|
966
|
+
}, "_isBasicCustomElement"), Rn = /* @__PURE__ */ h(function(i) {
|
|
967
|
+
ke(q.beforeSanitizeAttributes, i, null);
|
|
956
968
|
const {
|
|
957
969
|
attributes: u
|
|
958
970
|
} = i;
|
|
959
|
-
if (!u ||
|
|
971
|
+
if (!u || Ft(i))
|
|
960
972
|
return;
|
|
961
973
|
const k = {
|
|
962
974
|
attrName: "",
|
|
963
975
|
attrValue: "",
|
|
964
976
|
keepAttr: !0,
|
|
965
|
-
allowedAttributes:
|
|
977
|
+
allowedAttributes: F,
|
|
966
978
|
forceKeepAttr: void 0
|
|
967
979
|
};
|
|
968
|
-
let
|
|
969
|
-
for (;
|
|
970
|
-
const
|
|
980
|
+
let z = u.length;
|
|
981
|
+
for (; z--; ) {
|
|
982
|
+
const X = u[z], {
|
|
971
983
|
name: H,
|
|
972
984
|
namespaceURI: se,
|
|
973
|
-
value:
|
|
974
|
-
} =
|
|
975
|
-
let
|
|
976
|
-
if (k.attrName =
|
|
977
|
-
|
|
985
|
+
value: le
|
|
986
|
+
} = X, pe = j(H), Gt = le;
|
|
987
|
+
let V = H === "value" ? Gt : Qs(Gt);
|
|
988
|
+
if (k.attrName = pe, k.attrValue = V, k.keepAttr = !0, k.forceKeepAttr = void 0, ke(q.uponSanitizeAttribute, i, k), V = k.attrValue, gn && (pe === "id" || pe === "name") && Un(V, mn) !== 0 && (Ie(H, i), V = mn + V), Xe && Z(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, V)) {
|
|
989
|
+
Ie(H, i);
|
|
978
990
|
continue;
|
|
979
991
|
}
|
|
980
|
-
if (
|
|
981
|
-
|
|
992
|
+
if (pe === "attributename" && Bn(V, "href")) {
|
|
993
|
+
Ie(H, i);
|
|
982
994
|
continue;
|
|
983
995
|
}
|
|
984
996
|
if (k.forceKeepAttr)
|
|
985
997
|
continue;
|
|
986
998
|
if (!k.keepAttr) {
|
|
987
|
-
|
|
999
|
+
Ie(H, i);
|
|
988
1000
|
continue;
|
|
989
1001
|
}
|
|
990
|
-
if (!
|
|
991
|
-
|
|
1002
|
+
if (!dn && Z(/\/>/i, V)) {
|
|
1003
|
+
Ie(H, i);
|
|
992
1004
|
continue;
|
|
993
1005
|
}
|
|
994
|
-
|
|
995
|
-
|
|
1006
|
+
_e && et([we, Oe, ye], (Dn) => {
|
|
1007
|
+
V = Fe(V, Dn, " ");
|
|
996
1008
|
});
|
|
997
|
-
const Cn =
|
|
998
|
-
if (!En(Cn,
|
|
999
|
-
|
|
1009
|
+
const Cn = j(i.nodeName);
|
|
1010
|
+
if (!En(Cn, pe, V)) {
|
|
1011
|
+
Ie(H, i);
|
|
1000
1012
|
continue;
|
|
1001
1013
|
}
|
|
1002
|
-
if (
|
|
1003
|
-
switch (g.getAttributeType(Cn,
|
|
1014
|
+
if (N && typeof g == "object" && typeof g.getAttributeType == "function" && !se)
|
|
1015
|
+
switch (g.getAttributeType(Cn, pe)) {
|
|
1004
1016
|
case "TrustedHTML": {
|
|
1005
|
-
|
|
1017
|
+
V = N.createHTML(V);
|
|
1006
1018
|
break;
|
|
1007
1019
|
}
|
|
1008
1020
|
case "TrustedScriptURL": {
|
|
1009
|
-
|
|
1021
|
+
V = N.createScriptURL(V);
|
|
1010
1022
|
break;
|
|
1011
1023
|
}
|
|
1012
1024
|
}
|
|
1013
|
-
if (
|
|
1025
|
+
if (V !== Gt)
|
|
1014
1026
|
try {
|
|
1015
|
-
se ? i.setAttributeNS(se, H,
|
|
1027
|
+
se ? i.setAttributeNS(se, H, V) : i.setAttribute(H, V), Ft(i) ? he(i) : $n(t.removed);
|
|
1016
1028
|
} catch {
|
|
1017
|
-
|
|
1029
|
+
Ie(H, i);
|
|
1018
1030
|
}
|
|
1019
1031
|
}
|
|
1020
|
-
|
|
1021
|
-
}, "_sanitizeAttributes"), In = /* @__PURE__ */
|
|
1032
|
+
ke(q.afterSanitizeAttributes, i, null);
|
|
1033
|
+
}, "_sanitizeAttributes"), In = /* @__PURE__ */ h(function(i) {
|
|
1022
1034
|
let u = null;
|
|
1023
1035
|
const k = Sn(i);
|
|
1024
|
-
for (
|
|
1025
|
-
|
|
1026
|
-
|
|
1036
|
+
for (ke(q.beforeSanitizeShadowDOM, i, null); u = k.nextNode(); )
|
|
1037
|
+
ke(q.uponSanitizeShadowNode, u, null), An(u), Rn(u), u.content instanceof s && In(u.content);
|
|
1038
|
+
ke(q.afterSanitizeShadowDOM, i, null);
|
|
1027
1039
|
}, "_sanitizeShadowDOM");
|
|
1028
1040
|
return t.sanitize = function(v) {
|
|
1029
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, k = null,
|
|
1030
|
-
if (
|
|
1031
|
-
throw
|
|
1041
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, k = null, z = null, X = null;
|
|
1042
|
+
if (Pt = !v, Pt && (v = "<!-->"), typeof v != "string" && !Ht(v) && (v = sr(v), typeof v != "string"))
|
|
1043
|
+
throw xt("dirty is not a string, aborting");
|
|
1032
1044
|
if (!t.isSupported)
|
|
1033
1045
|
return v;
|
|
1034
|
-
if (
|
|
1035
|
-
const
|
|
1036
|
-
if (typeof
|
|
1037
|
-
const
|
|
1038
|
-
if (!
|
|
1039
|
-
throw
|
|
1046
|
+
if (Dt || Ut(i), t.removed = [], typeof v == "string" && (Ke = !1), Ke) {
|
|
1047
|
+
const le = v.nodeName;
|
|
1048
|
+
if (typeof le == "string") {
|
|
1049
|
+
const pe = j(le);
|
|
1050
|
+
if (!U[pe] || x[pe])
|
|
1051
|
+
throw xt("root node is forbidden and cannot be sanitized in-place");
|
|
1040
1052
|
}
|
|
1041
1053
|
} else if (v instanceof l)
|
|
1042
|
-
u = Tn("<!---->"), k = u.ownerDocument.importNode(v, !0), k.nodeType ===
|
|
1054
|
+
u = Tn("<!---->"), k = u.ownerDocument.importNode(v, !0), k.nodeType === st.element && k.nodeName === "BODY" || k.nodeName === "HTML" ? u = k : u.appendChild(k);
|
|
1043
1055
|
else {
|
|
1044
|
-
if (!
|
|
1056
|
+
if (!Ne && !_e && !Re && // eslint-disable-next-line unicorn/prefer-includes
|
|
1045
1057
|
v.indexOf("<") === -1)
|
|
1046
|
-
return
|
|
1058
|
+
return N && gt ? N.createHTML(v) : v;
|
|
1047
1059
|
if (u = Tn(v), !u)
|
|
1048
|
-
return
|
|
1060
|
+
return Ne ? null : gt ? Y : "";
|
|
1049
1061
|
}
|
|
1050
|
-
u &&
|
|
1051
|
-
const H = Sn(
|
|
1052
|
-
for (;
|
|
1053
|
-
An(
|
|
1054
|
-
if (
|
|
1062
|
+
u && Mt && he(u.firstChild);
|
|
1063
|
+
const H = Sn(Ke ? v : u);
|
|
1064
|
+
for (; z = H.nextNode(); )
|
|
1065
|
+
An(z), Rn(z), z.content instanceof s && In(z.content);
|
|
1066
|
+
if (Ke)
|
|
1055
1067
|
return v;
|
|
1056
|
-
if (
|
|
1057
|
-
if (
|
|
1068
|
+
if (Ne) {
|
|
1069
|
+
if (_e) {
|
|
1058
1070
|
u.normalize();
|
|
1059
|
-
let
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
}), u.innerHTML =
|
|
1063
|
-
}
|
|
1064
|
-
if (
|
|
1065
|
-
for (
|
|
1066
|
-
|
|
1071
|
+
let le = u.innerHTML;
|
|
1072
|
+
et([we, Oe, ye], (pe) => {
|
|
1073
|
+
le = Fe(le, pe, " ");
|
|
1074
|
+
}), u.innerHTML = le;
|
|
1075
|
+
}
|
|
1076
|
+
if (ft)
|
|
1077
|
+
for (X = _t.call(u.ownerDocument); u.firstChild; )
|
|
1078
|
+
X.appendChild(u.firstChild);
|
|
1067
1079
|
else
|
|
1068
|
-
|
|
1069
|
-
return (
|
|
1070
|
-
}
|
|
1071
|
-
let se =
|
|
1072
|
-
return
|
|
1073
|
-
` + se),
|
|
1074
|
-
se =
|
|
1075
|
-
}),
|
|
1080
|
+
X = u;
|
|
1081
|
+
return (F.shadowroot || F.shadowrootmode) && (X = I.call(n, X, !0)), X;
|
|
1082
|
+
}
|
|
1083
|
+
let se = Re ? u.outerHTML : u.innerHTML;
|
|
1084
|
+
return Re && U["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && Z(os, u.ownerDocument.doctype.name) && (se = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
|
|
1085
|
+
` + se), _e && et([we, Oe, ye], (le) => {
|
|
1086
|
+
se = Fe(se, le, " ");
|
|
1087
|
+
}), N && gt ? N.createHTML(se) : se;
|
|
1076
1088
|
}, t.setConfig = function() {
|
|
1077
1089
|
let v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1078
|
-
|
|
1090
|
+
Ut(v), Dt = !0;
|
|
1079
1091
|
}, t.clearConfig = function() {
|
|
1080
|
-
|
|
1092
|
+
Ue = null, Dt = !1;
|
|
1081
1093
|
}, t.isValidAttribute = function(v, i, u) {
|
|
1082
|
-
|
|
1083
|
-
const k =
|
|
1084
|
-
return En(k,
|
|
1094
|
+
Ue || Ut({});
|
|
1095
|
+
const k = j(v), z = j(i);
|
|
1096
|
+
return En(k, z, u);
|
|
1085
1097
|
}, t.addHook = function(v, i) {
|
|
1086
|
-
typeof i == "function" &&
|
|
1098
|
+
typeof i == "function" && tt(q[v], i);
|
|
1087
1099
|
}, t.removeHook = function(v, i) {
|
|
1088
1100
|
if (i !== void 0) {
|
|
1089
|
-
const u = Xs(
|
|
1090
|
-
return u === -1 ? void 0 : Ks(
|
|
1101
|
+
const u = Xs(q[v], i);
|
|
1102
|
+
return u === -1 ? void 0 : Ks(q[v], u, 1)[0];
|
|
1091
1103
|
}
|
|
1092
|
-
return $n(
|
|
1104
|
+
return $n(q[v]);
|
|
1093
1105
|
}, t.removeHooks = function(v) {
|
|
1094
|
-
|
|
1106
|
+
q[v] = [];
|
|
1095
1107
|
}, t.removeAllHooks = function() {
|
|
1096
|
-
|
|
1108
|
+
q = Yn();
|
|
1097
1109
|
}, t;
|
|
1098
1110
|
}
|
|
1099
|
-
|
|
1111
|
+
h(cs, "createDOMPurify");
|
|
1100
1112
|
var br = cs();
|
|
1101
|
-
function
|
|
1113
|
+
function nn() {
|
|
1102
1114
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1103
1115
|
}
|
|
1104
|
-
|
|
1105
|
-
var
|
|
1116
|
+
h(nn, "z");
|
|
1117
|
+
var Le = nn();
|
|
1106
1118
|
function us(a) {
|
|
1107
|
-
|
|
1119
|
+
Le = a;
|
|
1108
1120
|
}
|
|
1109
|
-
|
|
1110
|
-
var
|
|
1121
|
+
h(us, "G");
|
|
1122
|
+
var Ce = { exec: /* @__PURE__ */ h(() => null, "exec") };
|
|
1111
1123
|
function D(a, t = "") {
|
|
1112
|
-
let e = typeof a == "string" ? a : a.source, n = { replace: /* @__PURE__ */
|
|
1124
|
+
let e = typeof a == "string" ? a : a.source, n = { replace: /* @__PURE__ */ h((r, s) => {
|
|
1113
1125
|
let o = typeof s == "string" ? s : s.source;
|
|
1114
|
-
return o = o.replace(
|
|
1115
|
-
}, "replace"), getRegex: /* @__PURE__ */
|
|
1126
|
+
return o = o.replace(K.caret, "$1"), e = e.replace(r, o), n;
|
|
1127
|
+
}, "replace"), getRegex: /* @__PURE__ */ h(() => new RegExp(e, t), "getRegex") };
|
|
1116
1128
|
return n;
|
|
1117
1129
|
}
|
|
1118
|
-
|
|
1130
|
+
h(D, "k");
|
|
1119
1131
|
var xr = ((a = "") => {
|
|
1120
1132
|
try {
|
|
1121
1133
|
return !!new RegExp("(?<=1)(?<!1)" + a);
|
|
1122
1134
|
} catch {
|
|
1123
1135
|
return !1;
|
|
1124
1136
|
}
|
|
1125
|
-
})(),
|
|
1126
|
-
]`).replace("lheading", ps).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Dr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Mr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, fs = /^( {2,}|\\)\n(?!\s*$)/, Lr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1127
|
-
function
|
|
1137
|
+
})(), K = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ h((a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}>`), "blockquoteBeginRegex") }, kr = /^(?:[ \t]*(?:\n|$))+/, wr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, yr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ct = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, vr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, sn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, hs = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ps = D(hs).replace(/bull/g, sn).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(), Tr = D(hs).replace(/bull/g, sn).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(), rn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Sr = /^[^\n]+/, an = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Ar = D(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", an).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Er = D(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, sn).getRegex(), At = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", ln = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _r = D("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ln).replace("tag", At).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ds = D(rn).replace("hr", ct).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", At).getRegex(), Rr = D(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ds).getRegex(), on = { blockquote: Rr, code: wr, def: Ar, fences: yr, heading: vr, hr: ct, html: _r, lheading: ps, list: Er, newline: kr, paragraph: ds, table: Ce, text: Sr }, Zn = D("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ct).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", At).getRegex(), Ir = { ...on, lheading: Tr, table: Zn, paragraph: D(rn).replace("hr", ct).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Zn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", At).getRegex() }, Cr = { ...on, html: D(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ln).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: Ce, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: D(rn).replace("hr", ct).replace("heading", ` *#{1,6} *[^
|
|
1138
|
+
]`).replace("lheading", ps).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Dr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Mr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, fs = /^( {2,}|\\)\n(?!\s*$)/, Lr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ye = /[\p{P}\p{S}]/u, Et = /[\s\p{P}\p{S}]/u, cn = /[^\s\p{P}\p{S}]/u, Or = D(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Et).getRegex(), gs = /(?!~)[\p{P}\p{S}]/u, zr = /(?!~)[\s\p{P}\p{S}]/u, Pr = /(?:[^\s\p{P}\p{S}]|~)/u, Nr = D(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", xr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ms = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, $r = D(ms, "u").replace(/punct/g, Ye).getRegex(), Br = D(ms, "u").replace(/punct/g, gs).getRegex(), bs = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ur = D(bs, "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Et).replace(/punct/g, Ye).getRegex(), Fr = D(bs, "gu").replace(/notPunctSpace/g, Pr).replace(/punctSpace/g, zr).replace(/punct/g, gs).getRegex(), Hr = D("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Et).replace(/punct/g, Ye).getRegex(), Gr = D(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, Ye).getRegex(), jr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Wr = D(jr, "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Et).replace(/punct/g, Ye).getRegex(), qr = D(/\\(punct)/, "gu").replace(/punct/g, Ye).getRegex(), Vr = D(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Yr = D(ln).replace("(?:-->|$)", "-->").getRegex(), Zr = D("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Yr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), vt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Xr = D(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", vt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), xs = D(/^!?\[(label)\]\[(ref)\]/).replace("label", vt).replace("ref", an).getRegex(), ks = D(/^!?\[(ref)\](?:\[\])?/).replace("ref", an).getRegex(), Kr = D("reflink|nolink(?!\\()", "g").replace("reflink", xs).replace("nolink", ks).getRegex(), Xn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, un = { _backpedal: Ce, anyPunctuation: qr, autolink: Vr, blockSkip: Nr, br: fs, code: Mr, del: Ce, delLDelim: Ce, delRDelim: Ce, emStrongLDelim: $r, emStrongRDelimAst: Ur, emStrongRDelimUnd: Hr, escape: Dr, link: Xr, nolink: ks, punctuation: Or, reflink: xs, reflinkSearch: Kr, tag: Zr, text: Lr, url: Ce }, Qr = { ...un, link: D(/^!?\[(label)\]\((.*?)\)/).replace("label", vt).getRegex(), reflink: D(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", vt).getRegex() }, en = { ...un, emStrongRDelimAst: Fr, emStrongLDelim: Br, delLDelim: Gr, delRDelim: Wr, url: D(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Xn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: D(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Xn).getRegex() }, Jr = { ...en, br: D(fs).replace("{2,}", "*").getRegex(), text: D(en.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, wt = { normal: on, gfm: Ir, pedantic: Cr }, rt = { normal: un, gfm: en, breaks: Jr, pedantic: Qr }, ei = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Kn = /* @__PURE__ */ h((a) => ei[a], "de");
|
|
1139
|
+
function be(a, t) {
|
|
1128
1140
|
if (t) {
|
|
1129
|
-
if (
|
|
1130
|
-
} else if (
|
|
1141
|
+
if (K.escapeTest.test(a)) return a.replace(K.escapeReplace, Kn);
|
|
1142
|
+
} else if (K.escapeTestNoEncode.test(a)) return a.replace(K.escapeReplaceNoEncode, Kn);
|
|
1131
1143
|
return a;
|
|
1132
1144
|
}
|
|
1133
|
-
|
|
1145
|
+
h(be, "O");
|
|
1134
1146
|
function Qn(a) {
|
|
1135
1147
|
try {
|
|
1136
|
-
a = encodeURI(a).replace(
|
|
1148
|
+
a = encodeURI(a).replace(K.percentDecode, "%");
|
|
1137
1149
|
} catch {
|
|
1138
1150
|
return null;
|
|
1139
1151
|
}
|
|
1140
1152
|
return a;
|
|
1141
1153
|
}
|
|
1142
|
-
|
|
1154
|
+
h(Qn, "J");
|
|
1143
1155
|
function Jn(a, t) {
|
|
1144
|
-
let e = a.replace(
|
|
1145
|
-
let
|
|
1146
|
-
for (; --c >= 0 && l[c] === "\\"; )
|
|
1147
|
-
return
|
|
1148
|
-
}), n = e.split(
|
|
1156
|
+
let e = a.replace(K.findPipe, (s, o, l) => {
|
|
1157
|
+
let m = !1, c = o;
|
|
1158
|
+
for (; --c >= 0 && l[c] === "\\"; ) m = !m;
|
|
1159
|
+
return m ? "|" : " |";
|
|
1160
|
+
}), n = e.split(K.splitPipe), r = 0;
|
|
1149
1161
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
1150
1162
|
else for (; n.length < t; ) n.push("");
|
|
1151
|
-
for (; r < n.length; r++) n[r] = n[r].trim().replace(
|
|
1163
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(K.slashPipe, "|");
|
|
1152
1164
|
return n;
|
|
1153
1165
|
}
|
|
1154
|
-
|
|
1155
|
-
function
|
|
1166
|
+
h(Jn, "V");
|
|
1167
|
+
function ve(a, t, e) {
|
|
1156
1168
|
let n = a.length;
|
|
1157
1169
|
if (n === 0) return "";
|
|
1158
1170
|
let r = 0;
|
|
@@ -1160,15 +1172,15 @@ function Te(a, t, e) {
|
|
|
1160
1172
|
r++;
|
|
1161
1173
|
return a.slice(0, n - r);
|
|
1162
1174
|
}
|
|
1163
|
-
|
|
1175
|
+
h(ve, "$");
|
|
1164
1176
|
function es(a) {
|
|
1165
1177
|
let t = a.split(`
|
|
1166
1178
|
`), e = t.length - 1;
|
|
1167
|
-
for (; e >= 0 &&
|
|
1179
|
+
for (; e >= 0 && K.blankLine.test(t[e]); ) e--;
|
|
1168
1180
|
return t.length - e <= 2 ? a : t.slice(0, e + 1).join(`
|
|
1169
1181
|
`);
|
|
1170
1182
|
}
|
|
1171
|
-
|
|
1183
|
+
h(es, "Y");
|
|
1172
1184
|
function ti(a, t) {
|
|
1173
1185
|
if (a.indexOf(t[1]) === -1) return -1;
|
|
1174
1186
|
let e = 0;
|
|
@@ -1177,7 +1189,7 @@ function ti(a, t) {
|
|
|
1177
1189
|
else if (a[n] === t[1] && (e--, e < 0)) return n;
|
|
1178
1190
|
return e > 0 ? -2 : -1;
|
|
1179
1191
|
}
|
|
1180
|
-
|
|
1192
|
+
h(ti, "ge");
|
|
1181
1193
|
function ni(a, t = 0) {
|
|
1182
1194
|
let e = t, n = "";
|
|
1183
1195
|
for (let r of a) if (r === " ") {
|
|
@@ -1186,14 +1198,14 @@ function ni(a, t = 0) {
|
|
|
1186
1198
|
} else n += r, e++;
|
|
1187
1199
|
return n;
|
|
1188
1200
|
}
|
|
1189
|
-
|
|
1201
|
+
h(ni, "fe");
|
|
1190
1202
|
function ts(a, t, e, n, r) {
|
|
1191
1203
|
let s = t.href, o = t.title || null, l = a[1].replace(r.other.outputLinkReplace, "$1");
|
|
1192
1204
|
n.state.inLink = !0;
|
|
1193
|
-
let
|
|
1194
|
-
return n.state.inLink = !1,
|
|
1205
|
+
let m = { type: a[0].charAt(0) === "!" ? "image" : "link", raw: e, href: s, title: o, text: l, tokens: n.inlineTokens(l) };
|
|
1206
|
+
return n.state.inLink = !1, m;
|
|
1195
1207
|
}
|
|
1196
|
-
|
|
1208
|
+
h(ts, "me");
|
|
1197
1209
|
function si(a, t, e) {
|
|
1198
1210
|
let n = a.match(e.other.indentCodeCompensation);
|
|
1199
1211
|
if (n === null) return t;
|
|
@@ -1207,13 +1219,13 @@ function si(a, t, e) {
|
|
|
1207
1219
|
}).join(`
|
|
1208
1220
|
`);
|
|
1209
1221
|
}
|
|
1210
|
-
|
|
1211
|
-
var
|
|
1222
|
+
h(si, "rt");
|
|
1223
|
+
var je, Tt = (je = class {
|
|
1212
1224
|
constructor(t) {
|
|
1213
1225
|
C(this, "options");
|
|
1214
1226
|
C(this, "rules");
|
|
1215
1227
|
C(this, "lexer");
|
|
1216
|
-
this.options = t ||
|
|
1228
|
+
this.options = t || Le;
|
|
1217
1229
|
}
|
|
1218
1230
|
space(t) {
|
|
1219
1231
|
let e = this.rules.block.newline.exec(t);
|
|
@@ -1238,51 +1250,51 @@ var Ge, At = (Ge = class {
|
|
|
1238
1250
|
if (e) {
|
|
1239
1251
|
let n = e[2].trim();
|
|
1240
1252
|
if (this.rules.other.endingHash.test(n)) {
|
|
1241
|
-
let r =
|
|
1253
|
+
let r = ve(n, "#");
|
|
1242
1254
|
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
1243
1255
|
}
|
|
1244
|
-
return { type: "heading", raw:
|
|
1256
|
+
return { type: "heading", raw: ve(e[0], `
|
|
1245
1257
|
`), depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
1246
1258
|
}
|
|
1247
1259
|
}
|
|
1248
1260
|
hr(t) {
|
|
1249
1261
|
let e = this.rules.block.hr.exec(t);
|
|
1250
|
-
if (e) return { type: "hr", raw:
|
|
1262
|
+
if (e) return { type: "hr", raw: ve(e[0], `
|
|
1251
1263
|
`) };
|
|
1252
1264
|
}
|
|
1253
1265
|
blockquote(t) {
|
|
1254
1266
|
let e = this.rules.block.blockquote.exec(t);
|
|
1255
1267
|
if (e) {
|
|
1256
|
-
let n =
|
|
1268
|
+
let n = ve(e[0], `
|
|
1257
1269
|
`).split(`
|
|
1258
1270
|
`), r = "", s = "", o = [];
|
|
1259
1271
|
for (; n.length > 0; ) {
|
|
1260
|
-
let l = !1,
|
|
1261
|
-
for (c = 0; c < n.length; c++) if (this.rules.other.blockquoteStart.test(n[c]))
|
|
1262
|
-
else if (!l)
|
|
1272
|
+
let l = !1, m = [], c;
|
|
1273
|
+
for (c = 0; c < n.length; c++) if (this.rules.other.blockquoteStart.test(n[c])) m.push(n[c]), l = !0;
|
|
1274
|
+
else if (!l) m.push(n[c]);
|
|
1263
1275
|
else break;
|
|
1264
1276
|
n = n.slice(c);
|
|
1265
|
-
let
|
|
1266
|
-
`),
|
|
1277
|
+
let b = m.join(`
|
|
1278
|
+
`), p = b.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1267
1279
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1268
1280
|
r = r ? `${r}
|
|
1269
|
-
${
|
|
1270
|
-
${
|
|
1281
|
+
${b}` : b, s = s ? `${s}
|
|
1282
|
+
${p}` : p;
|
|
1271
1283
|
let d = this.lexer.state.top;
|
|
1272
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1284
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, o, !0), this.lexer.state.top = d, n.length === 0) break;
|
|
1273
1285
|
let g = o.at(-1);
|
|
1274
1286
|
if (g?.type === "code") break;
|
|
1275
1287
|
if (g?.type === "blockquote") {
|
|
1276
|
-
let
|
|
1288
|
+
let y = g, E = y.raw + `
|
|
1277
1289
|
` + n.join(`
|
|
1278
1290
|
`), O = this.blockquote(E);
|
|
1279
|
-
o[o.length - 1] = O, r = r.substring(0, r.length -
|
|
1291
|
+
o[o.length - 1] = O, r = r.substring(0, r.length - y.raw.length) + O.raw, s = s.substring(0, s.length - y.text.length) + O.text;
|
|
1280
1292
|
break;
|
|
1281
1293
|
} else if (g?.type === "list") {
|
|
1282
|
-
let
|
|
1294
|
+
let y = g, E = y.raw + `
|
|
1283
1295
|
` + n.join(`
|
|
1284
1296
|
`), O = this.list(E);
|
|
1285
|
-
o[o.length - 1] = O, r = r.substring(0, r.length - g.raw.length) + O.raw, s = s.substring(0, s.length -
|
|
1297
|
+
o[o.length - 1] = O, r = r.substring(0, r.length - g.raw.length) + O.raw, s = s.substring(0, s.length - y.raw.length) + O.raw, n = E.substring(o.at(-1).raw.length).split(`
|
|
1286
1298
|
`);
|
|
1287
1299
|
continue;
|
|
1288
1300
|
}
|
|
@@ -1297,59 +1309,59 @@ ${h}` : h;
|
|
|
1297
1309
|
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
1298
1310
|
let o = this.rules.other.listItemRegex(n), l = !1;
|
|
1299
1311
|
for (; t; ) {
|
|
1300
|
-
let c = !1,
|
|
1312
|
+
let c = !1, b = "", p = "";
|
|
1301
1313
|
if (!(e = o.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1302
|
-
|
|
1314
|
+
b = e[0], t = t.substring(b.length);
|
|
1303
1315
|
let d = ni(e[2].split(`
|
|
1304
1316
|
`, 1)[0], e[1].length), g = t.split(`
|
|
1305
|
-
`, 1)[0],
|
|
1306
|
-
if (this.options.pedantic ? (E = 2,
|
|
1317
|
+
`, 1)[0], y = !d.trim(), E = 0;
|
|
1318
|
+
if (this.options.pedantic ? (E = 2, p = d.trimStart()) : y ? E = e[1].length + 1 : (E = d.search(this.rules.other.nonSpaceChar), E = E > 4 ? 1 : E, p = d.slice(E), E += e[1].length), y && this.rules.other.blankLine.test(g) && (b += g + `
|
|
1307
1319
|
`, t = t.substring(g.length + 1), c = !0), !c) {
|
|
1308
|
-
let O = this.rules.other.nextBulletRegex(E),
|
|
1320
|
+
let O = this.rules.other.nextBulletRegex(E), ae = this.rules.other.hrRegex(E), ce = this.rules.other.fencesBeginRegex(E), ne = this.rules.other.headingBeginRegex(E), N = this.rules.other.htmlBeginRegex(E), Y = this.rules.other.blockquoteBeginRegex(E);
|
|
1309
1321
|
for (; t; ) {
|
|
1310
|
-
let
|
|
1311
|
-
`, 1)[0],
|
|
1312
|
-
if (g =
|
|
1313
|
-
if (
|
|
1314
|
-
` +
|
|
1322
|
+
let ue = t.split(`
|
|
1323
|
+
`, 1)[0], Q;
|
|
1324
|
+
if (g = ue, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), Q = g) : Q = g.replace(this.rules.other.tabCharGlobal, " "), ce.test(g) || ne.test(g) || N.test(g) || Y.test(g) || O.test(g) || ae.test(g)) break;
|
|
1325
|
+
if (Q.search(this.rules.other.nonSpaceChar) >= E || !g.trim()) p += `
|
|
1326
|
+
` + Q.slice(E);
|
|
1315
1327
|
else {
|
|
1316
|
-
if (
|
|
1317
|
-
|
|
1328
|
+
if (y || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ce.test(d) || ne.test(d) || ae.test(d)) break;
|
|
1329
|
+
p += `
|
|
1318
1330
|
` + g;
|
|
1319
1331
|
}
|
|
1320
|
-
|
|
1321
|
-
`, t = t.substring(
|
|
1332
|
+
y = !g.trim(), b += ue + `
|
|
1333
|
+
`, t = t.substring(ue.length + 1), d = Q.slice(E);
|
|
1322
1334
|
}
|
|
1323
1335
|
}
|
|
1324
|
-
s.loose || (l ? s.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
1336
|
+
s.loose || (l ? s.loose = !0 : this.rules.other.doubleBlankLine.test(b) && (l = !0)), s.items.push({ type: "list_item", raw: b, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: !1, text: p, tokens: [] }), s.raw += b;
|
|
1325
1337
|
}
|
|
1326
|
-
let
|
|
1327
|
-
if (
|
|
1338
|
+
let m = s.items.at(-1);
|
|
1339
|
+
if (m) m.raw = m.raw.trimEnd(), m.text = m.text.trimEnd();
|
|
1328
1340
|
else return;
|
|
1329
1341
|
s.raw = s.raw.trimEnd();
|
|
1330
1342
|
for (let c of s.items) {
|
|
1331
1343
|
if (this.lexer.state.top = !1, c.tokens = this.lexer.blockTokens(c.text, []), c.task) {
|
|
1332
1344
|
if (c.text = c.text.replace(this.rules.other.listReplaceTask, ""), c.tokens[0]?.type === "text" || c.tokens[0]?.type === "paragraph") {
|
|
1333
1345
|
c.tokens[0].raw = c.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), c.tokens[0].text = c.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
1334
|
-
for (let
|
|
1335
|
-
this.lexer.inlineQueue[
|
|
1346
|
+
for (let p = this.lexer.inlineQueue.length - 1; p >= 0; p--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)) {
|
|
1347
|
+
this.lexer.inlineQueue[p].src = this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask, "");
|
|
1336
1348
|
break;
|
|
1337
1349
|
}
|
|
1338
1350
|
}
|
|
1339
|
-
let
|
|
1340
|
-
if (
|
|
1341
|
-
let
|
|
1342
|
-
c.checked =
|
|
1351
|
+
let b = this.rules.other.listTaskCheckbox.exec(c.raw);
|
|
1352
|
+
if (b) {
|
|
1353
|
+
let p = { type: "checkbox", raw: b[0] + " ", checked: b[0] !== "[ ]" };
|
|
1354
|
+
c.checked = p.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 = p.raw + c.tokens[0].raw, c.tokens[0].text = p.raw + c.tokens[0].text, c.tokens[0].tokens.unshift(p)) : c.tokens.unshift({ type: "paragraph", raw: p.raw, text: p.raw, tokens: [p] }) : c.tokens.unshift(p);
|
|
1343
1355
|
}
|
|
1344
1356
|
}
|
|
1345
1357
|
if (!s.loose) {
|
|
1346
|
-
let
|
|
1347
|
-
s.loose =
|
|
1358
|
+
let b = c.tokens.filter((d) => d.type === "space"), p = b.length > 0 && b.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
1359
|
+
s.loose = p;
|
|
1348
1360
|
}
|
|
1349
1361
|
}
|
|
1350
1362
|
if (s.loose) for (let c of s.items) {
|
|
1351
1363
|
c.loose = !0;
|
|
1352
|
-
for (let
|
|
1364
|
+
for (let b of c.tokens) b.type === "text" && (b.type = "paragraph");
|
|
1353
1365
|
}
|
|
1354
1366
|
return s;
|
|
1355
1367
|
}
|
|
@@ -1365,7 +1377,7 @@ ${h}` : h;
|
|
|
1365
1377
|
let e = this.rules.block.def.exec(t);
|
|
1366
1378
|
if (e) {
|
|
1367
1379
|
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];
|
|
1368
|
-
return { type: "def", tag: n, raw:
|
|
1380
|
+
return { type: "def", tag: n, raw: ve(e[0], `
|
|
1369
1381
|
`), href: r, title: s };
|
|
1370
1382
|
}
|
|
1371
1383
|
}
|
|
@@ -1373,12 +1385,12 @@ ${h}` : h;
|
|
|
1373
1385
|
let e = this.rules.block.table.exec(t);
|
|
1374
1386
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
1375
1387
|
let n = Jn(e[1]), r = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1376
|
-
`) : [], o = { type: "table", raw:
|
|
1388
|
+
`) : [], o = { type: "table", raw: ve(e[0], `
|
|
1377
1389
|
`), header: [], align: [], rows: [] };
|
|
1378
1390
|
if (n.length === r.length) {
|
|
1379
1391
|
for (let l of r) this.rules.other.tableAlignRight.test(l) ? o.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? o.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? o.align.push("left") : o.align.push(null);
|
|
1380
1392
|
for (let l = 0; l < n.length; l++) o.header.push({ text: n[l], tokens: this.lexer.inline(n[l]), header: !0, align: o.align[l] });
|
|
1381
|
-
for (let l of s) o.rows.push(Jn(l, o.header.length).map((
|
|
1393
|
+
for (let l of s) o.rows.push(Jn(l, o.header.length).map((m, c) => ({ text: m, tokens: this.lexer.inline(m), header: !1, align: o.align[c] })));
|
|
1382
1394
|
return o;
|
|
1383
1395
|
}
|
|
1384
1396
|
}
|
|
@@ -1386,7 +1398,7 @@ ${h}` : h;
|
|
|
1386
1398
|
let e = this.rules.block.lheading.exec(t);
|
|
1387
1399
|
if (e) {
|
|
1388
1400
|
let n = e[1].trim();
|
|
1389
|
-
return { type: "heading", raw:
|
|
1401
|
+
return { type: "heading", raw: ve(e[0], `
|
|
1390
1402
|
`), depth: e[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
1391
1403
|
}
|
|
1392
1404
|
}
|
|
@@ -1416,7 +1428,7 @@ ${h}` : h;
|
|
|
1416
1428
|
let n = e[2].trim();
|
|
1417
1429
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1418
1430
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1419
|
-
let o =
|
|
1431
|
+
let o = ve(n.slice(0, -1), "\\");
|
|
1420
1432
|
if ((n.length - o.length) % 2 === 0) return;
|
|
1421
1433
|
} else {
|
|
1422
1434
|
let o = ti(e[2], "()");
|
|
@@ -1448,22 +1460,22 @@ ${h}` : h;
|
|
|
1448
1460
|
emStrong(t, e, n = "") {
|
|
1449
1461
|
let r = this.rules.inline.emStrongLDelim.exec(t);
|
|
1450
1462
|
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))) {
|
|
1451
|
-
let s = [...r[0]].length - 1, o, l,
|
|
1452
|
-
for (
|
|
1463
|
+
let s = [...r[0]].length - 1, o, l, m = s, c = 0, b = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1464
|
+
for (b.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = b.exec(e)) !== null; ) {
|
|
1453
1465
|
if (o = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !o) continue;
|
|
1454
1466
|
if (l = [...o].length, r[3] || r[4]) {
|
|
1455
|
-
|
|
1467
|
+
m += l;
|
|
1456
1468
|
continue;
|
|
1457
1469
|
} else if ((r[5] || r[6]) && s % 3 && !((s + l) % 3)) {
|
|
1458
1470
|
c += l;
|
|
1459
1471
|
continue;
|
|
1460
1472
|
}
|
|
1461
|
-
if (
|
|
1462
|
-
l = Math.min(l, l +
|
|
1463
|
-
let
|
|
1473
|
+
if (m -= l, m > 0) continue;
|
|
1474
|
+
l = Math.min(l, l + m + c);
|
|
1475
|
+
let p = [...r[0]][0].length, d = t.slice(0, s + r.index + p + l);
|
|
1464
1476
|
if (Math.min(s, l) % 2) {
|
|
1465
|
-
let
|
|
1466
|
-
return { type: "em", raw: d, text:
|
|
1477
|
+
let y = d.slice(1, -1);
|
|
1478
|
+
return { type: "em", raw: d, text: y, tokens: this.lexer.inlineTokens(y) };
|
|
1467
1479
|
}
|
|
1468
1480
|
let g = d.slice(2, -2);
|
|
1469
1481
|
return { type: "strong", raw: d, text: g, tokens: this.lexer.inlineTokens(g) };
|
|
@@ -1484,17 +1496,17 @@ ${h}` : h;
|
|
|
1484
1496
|
del(t, e, n = "") {
|
|
1485
1497
|
let r = this.rules.inline.delLDelim.exec(t);
|
|
1486
1498
|
if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1487
|
-
let s = [...r[0]].length - 1, o, l,
|
|
1499
|
+
let s = [...r[0]].length - 1, o, l, m = s, c = this.rules.inline.delRDelim;
|
|
1488
1500
|
for (c.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = c.exec(e)) !== null; ) {
|
|
1489
1501
|
if (o = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !o || (l = [...o].length, l !== s)) continue;
|
|
1490
1502
|
if (r[3] || r[4]) {
|
|
1491
|
-
|
|
1503
|
+
m += l;
|
|
1492
1504
|
continue;
|
|
1493
1505
|
}
|
|
1494
|
-
if (
|
|
1495
|
-
l = Math.min(l, l +
|
|
1496
|
-
let
|
|
1497
|
-
return { type: "del", raw:
|
|
1506
|
+
if (m -= l, m > 0) continue;
|
|
1507
|
+
l = Math.min(l, l + m);
|
|
1508
|
+
let b = [...r[0]][0].length, p = t.slice(0, s + r.index + b + l), d = p.slice(s, -s);
|
|
1509
|
+
return { type: "del", raw: p, text: d, tokens: this.lexer.inlineTokens(d) };
|
|
1498
1510
|
}
|
|
1499
1511
|
}
|
|
1500
1512
|
}
|
|
@@ -1527,28 +1539,28 @@ ${h}` : h;
|
|
|
1527
1539
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1528
1540
|
}
|
|
1529
1541
|
}
|
|
1530
|
-
},
|
|
1542
|
+
}, h(je, "w"), je), Ae, de = (Ae = class {
|
|
1531
1543
|
constructor(t) {
|
|
1532
1544
|
C(this, "tokens");
|
|
1533
1545
|
C(this, "options");
|
|
1534
1546
|
C(this, "state");
|
|
1535
1547
|
C(this, "inlineQueue");
|
|
1536
1548
|
C(this, "tokenizer");
|
|
1537
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t ||
|
|
1538
|
-
let e = { other:
|
|
1539
|
-
this.options.pedantic ? (e.block =
|
|
1549
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Le, this.options.tokenizer = this.options.tokenizer || new Tt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1550
|
+
let e = { other: K, block: wt.normal, inline: rt.normal };
|
|
1551
|
+
this.options.pedantic ? (e.block = wt.pedantic, e.inline = rt.pedantic) : this.options.gfm && (e.block = wt.gfm, this.options.breaks ? e.inline = rt.breaks : e.inline = rt.gfm), this.tokenizer.rules = e;
|
|
1540
1552
|
}
|
|
1541
1553
|
static get rules() {
|
|
1542
|
-
return { block:
|
|
1554
|
+
return { block: wt, inline: rt };
|
|
1543
1555
|
}
|
|
1544
1556
|
static lex(t, e) {
|
|
1545
|
-
return new
|
|
1557
|
+
return new Ae(e).lex(t);
|
|
1546
1558
|
}
|
|
1547
1559
|
static lexInline(t, e) {
|
|
1548
|
-
return new
|
|
1560
|
+
return new Ae(e).inlineTokens(t);
|
|
1549
1561
|
}
|
|
1550
1562
|
lex(t) {
|
|
1551
|
-
t = t.replace(
|
|
1563
|
+
t = t.replace(K.carriageReturn, `
|
|
1552
1564
|
`), this.blockTokens(t, this.tokens);
|
|
1553
1565
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1554
1566
|
let n = this.inlineQueue[e];
|
|
@@ -1557,7 +1569,7 @@ ${h}` : h;
|
|
|
1557
1569
|
return this.inlineQueue = [], this.tokens;
|
|
1558
1570
|
}
|
|
1559
1571
|
blockTokens(t, e = [], n = !1) {
|
|
1560
|
-
this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(
|
|
1572
|
+
this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(K.tabCharGlobal, " ").replace(K.spaceLine, ""));
|
|
1561
1573
|
let r = 1 / 0;
|
|
1562
1574
|
for (; t; ) {
|
|
1563
1575
|
if (t.length < r) r = t.length;
|
|
@@ -1626,9 +1638,9 @@ ${h}` : h;
|
|
|
1626
1638
|
}
|
|
1627
1639
|
let o = t;
|
|
1628
1640
|
if (this.options.extensions?.startBlock) {
|
|
1629
|
-
let l = 1 / 0,
|
|
1630
|
-
this.options.extensions.startBlock.forEach((
|
|
1631
|
-
c =
|
|
1641
|
+
let l = 1 / 0, m = t.slice(1), c;
|
|
1642
|
+
this.options.extensions.startBlock.forEach((b) => {
|
|
1643
|
+
c = b.call({ lexer: this }, m), typeof c == "number" && c >= 0 && (l = Math.min(l, c));
|
|
1632
1644
|
}), l < 1 / 0 && l >= 0 && (o = t.substring(0, l + 1));
|
|
1633
1645
|
}
|
|
1634
1646
|
if (this.state.top && (s = this.tokenizer.paragraph(o))) {
|
|
@@ -1669,16 +1681,16 @@ ${h}` : h;
|
|
|
1669
1681
|
let s;
|
|
1670
1682
|
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) s = r[2] ? r[2].length : 0, n = n.slice(0, r.index + s) + "[" + "a".repeat(r[0].length - s - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1671
1683
|
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
1672
|
-
let o = !1, l = "",
|
|
1684
|
+
let o = !1, l = "", m = 1 / 0;
|
|
1673
1685
|
for (; t; ) {
|
|
1674
|
-
if (t.length <
|
|
1686
|
+
if (t.length < m) m = t.length;
|
|
1675
1687
|
else {
|
|
1676
1688
|
this.infiniteLoopError(t.charCodeAt(0));
|
|
1677
1689
|
break;
|
|
1678
1690
|
}
|
|
1679
1691
|
o || (l = ""), o = !1;
|
|
1680
1692
|
let c;
|
|
1681
|
-
if (this.options.extensions?.inline?.some((
|
|
1693
|
+
if (this.options.extensions?.inline?.some((p) => (c = p.call({ lexer: this }, t, e)) ? (t = t.substring(c.raw.length), e.push(c), !0) : !1)) continue;
|
|
1682
1694
|
if (c = this.tokenizer.escape(t)) {
|
|
1683
1695
|
t = t.substring(c.raw.length), e.push(c);
|
|
1684
1696
|
continue;
|
|
@@ -1693,8 +1705,8 @@ ${h}` : h;
|
|
|
1693
1705
|
}
|
|
1694
1706
|
if (c = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1695
1707
|
t = t.substring(c.raw.length);
|
|
1696
|
-
let
|
|
1697
|
-
c.type === "text" &&
|
|
1708
|
+
let p = e.at(-1);
|
|
1709
|
+
c.type === "text" && p?.type === "text" ? (p.raw += c.raw, p.text += c.text) : e.push(c);
|
|
1698
1710
|
continue;
|
|
1699
1711
|
}
|
|
1700
1712
|
if (c = this.tokenizer.emStrong(t, n, l)) {
|
|
@@ -1721,17 +1733,17 @@ ${h}` : h;
|
|
|
1721
1733
|
t = t.substring(c.raw.length), e.push(c);
|
|
1722
1734
|
continue;
|
|
1723
1735
|
}
|
|
1724
|
-
let
|
|
1736
|
+
let b = t;
|
|
1725
1737
|
if (this.options.extensions?.startInline) {
|
|
1726
|
-
let
|
|
1727
|
-
this.options.extensions.startInline.forEach((
|
|
1728
|
-
g =
|
|
1729
|
-
}),
|
|
1738
|
+
let p = 1 / 0, d = t.slice(1), g;
|
|
1739
|
+
this.options.extensions.startInline.forEach((y) => {
|
|
1740
|
+
g = y.call({ lexer: this }, d), typeof g == "number" && g >= 0 && (p = Math.min(p, g));
|
|
1741
|
+
}), p < 1 / 0 && p >= 0 && (b = t.substring(0, p + 1));
|
|
1730
1742
|
}
|
|
1731
|
-
if (c = this.tokenizer.inlineText(
|
|
1743
|
+
if (c = this.tokenizer.inlineText(b)) {
|
|
1732
1744
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (l = c.raw.slice(-1)), o = !0;
|
|
1733
|
-
let
|
|
1734
|
-
|
|
1745
|
+
let p = e.at(-1);
|
|
1746
|
+
p?.type === "text" ? (p.raw += c.raw, p.text += c.text) : e.push(c);
|
|
1735
1747
|
continue;
|
|
1736
1748
|
}
|
|
1737
1749
|
if (t) {
|
|
@@ -1746,20 +1758,20 @@ ${h}` : h;
|
|
|
1746
1758
|
if (this.options.silent) console.error(e);
|
|
1747
1759
|
else throw new Error(e);
|
|
1748
1760
|
}
|
|
1749
|
-
},
|
|
1761
|
+
}, h(Ae, "l"), Ae), We, St = (We = class {
|
|
1750
1762
|
constructor(t) {
|
|
1751
1763
|
C(this, "options");
|
|
1752
1764
|
C(this, "parser");
|
|
1753
|
-
this.options = t ||
|
|
1765
|
+
this.options = t || Le;
|
|
1754
1766
|
}
|
|
1755
1767
|
space(t) {
|
|
1756
1768
|
return "";
|
|
1757
1769
|
}
|
|
1758
1770
|
code({ text: t, lang: e, escaped: n }) {
|
|
1759
|
-
let r = (e || "").match(
|
|
1771
|
+
let r = (e || "").match(K.notSpaceStart)?.[0], s = t.replace(K.endingNewline, "") + `
|
|
1760
1772
|
`;
|
|
1761
|
-
return r ? '<pre><code class="language-' +
|
|
1762
|
-
` : "<pre><code>" + (n ? s :
|
|
1773
|
+
return r ? '<pre><code class="language-' + be(r) + '">' + (n ? s : be(s, !0)) + `</code></pre>
|
|
1774
|
+
` : "<pre><code>" + (n ? s : be(s, !0)) + `</code></pre>
|
|
1763
1775
|
`;
|
|
1764
1776
|
}
|
|
1765
1777
|
blockquote({ tokens: t }) {
|
|
@@ -1784,8 +1796,8 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1784
1796
|
list(t) {
|
|
1785
1797
|
let e = t.ordered, n = t.start, r = "";
|
|
1786
1798
|
for (let l = 0; l < t.items.length; l++) {
|
|
1787
|
-
let
|
|
1788
|
-
r += this.listitem(
|
|
1799
|
+
let m = t.items[l];
|
|
1800
|
+
r += this.listitem(m);
|
|
1789
1801
|
}
|
|
1790
1802
|
let s = e ? "ol" : "ul", o = e && n !== 1 ? ' start="' + n + '"' : "";
|
|
1791
1803
|
return "<" + s + o + `>
|
|
@@ -1837,7 +1849,7 @@ ${t}</tr>
|
|
|
1837
1849
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1838
1850
|
}
|
|
1839
1851
|
codespan({ text: t }) {
|
|
1840
|
-
return `<code>${
|
|
1852
|
+
return `<code>${be(t, !0)}</code>`;
|
|
1841
1853
|
}
|
|
1842
1854
|
br(t) {
|
|
1843
1855
|
return "<br>";
|
|
@@ -1850,20 +1862,20 @@ ${t}</tr>
|
|
|
1850
1862
|
if (s === null) return r;
|
|
1851
1863
|
t = s;
|
|
1852
1864
|
let o = '<a href="' + t + '"';
|
|
1853
|
-
return e && (o += ' title="' +
|
|
1865
|
+
return e && (o += ' title="' + be(e) + '"'), o += ">" + r + "</a>", o;
|
|
1854
1866
|
}
|
|
1855
1867
|
image({ href: t, title: e, text: n, tokens: r }) {
|
|
1856
1868
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1857
1869
|
let s = Qn(t);
|
|
1858
|
-
if (s === null) return
|
|
1870
|
+
if (s === null) return be(n);
|
|
1859
1871
|
t = s;
|
|
1860
|
-
let o = `<img src="${t}" alt="${
|
|
1861
|
-
return e && (o += ` title="${
|
|
1872
|
+
let o = `<img src="${t}" alt="${be(n)}"`;
|
|
1873
|
+
return e && (o += ` title="${be(e)}"`), o += ">", o;
|
|
1862
1874
|
}
|
|
1863
1875
|
text(t) {
|
|
1864
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
1876
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : be(t.text);
|
|
1865
1877
|
}
|
|
1866
|
-
},
|
|
1878
|
+
}, h(We, "y"), We), qe, hn = (qe = class {
|
|
1867
1879
|
strong({ text: t }) {
|
|
1868
1880
|
return t;
|
|
1869
1881
|
}
|
|
@@ -1894,18 +1906,18 @@ ${t}</tr>
|
|
|
1894
1906
|
checkbox({ raw: t }) {
|
|
1895
1907
|
return t;
|
|
1896
1908
|
}
|
|
1897
|
-
},
|
|
1909
|
+
}, h(qe, "L"), qe), Ee, fe = (Ee = class {
|
|
1898
1910
|
constructor(t) {
|
|
1899
1911
|
C(this, "options");
|
|
1900
1912
|
C(this, "renderer");
|
|
1901
1913
|
C(this, "textRenderer");
|
|
1902
|
-
this.options = t ||
|
|
1914
|
+
this.options = t || Le, this.options.renderer = this.options.renderer || new St(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new hn();
|
|
1903
1915
|
}
|
|
1904
1916
|
static parse(t, e) {
|
|
1905
|
-
return new
|
|
1917
|
+
return new Ee(e).parse(t);
|
|
1906
1918
|
}
|
|
1907
1919
|
static parseInline(t, e) {
|
|
1908
|
-
return new
|
|
1920
|
+
return new Ee(e).parseInline(t);
|
|
1909
1921
|
}
|
|
1910
1922
|
parse(t) {
|
|
1911
1923
|
this.renderer.parser = this;
|
|
@@ -2045,11 +2057,11 @@ ${t}</tr>
|
|
|
2045
2057
|
}
|
|
2046
2058
|
return n;
|
|
2047
2059
|
}
|
|
2048
|
-
},
|
|
2060
|
+
}, h(Ee, "l"), Ee), Se, lt = (Se = class {
|
|
2049
2061
|
constructor(t) {
|
|
2050
2062
|
C(this, "options");
|
|
2051
2063
|
C(this, "block");
|
|
2052
|
-
this.options = t ||
|
|
2064
|
+
this.options = t || Le;
|
|
2053
2065
|
}
|
|
2054
2066
|
preprocess(t) {
|
|
2055
2067
|
return t;
|
|
@@ -2064,23 +2076,23 @@ ${t}</tr>
|
|
|
2064
2076
|
return t;
|
|
2065
2077
|
}
|
|
2066
2078
|
provideLexer(t = this.block) {
|
|
2067
|
-
return t ?
|
|
2079
|
+
return t ? de.lex : de.lexInline;
|
|
2068
2080
|
}
|
|
2069
2081
|
provideParser(t = this.block) {
|
|
2070
|
-
return t ?
|
|
2082
|
+
return t ? fe.parse : fe.parseInline;
|
|
2071
2083
|
}
|
|
2072
|
-
},
|
|
2084
|
+
}, h(Se, "P"), C(Se, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), C(Se, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Se), Ve, ri = (Ve = class {
|
|
2073
2085
|
constructor(...t) {
|
|
2074
|
-
C(this, "defaults",
|
|
2086
|
+
C(this, "defaults", nn());
|
|
2075
2087
|
C(this, "options", this.setOptions);
|
|
2076
2088
|
C(this, "parse", this.parseMarkdown(!0));
|
|
2077
2089
|
C(this, "parseInline", this.parseMarkdown(!1));
|
|
2078
|
-
C(this, "Parser",
|
|
2079
|
-
C(this, "Renderer",
|
|
2080
|
-
C(this, "TextRenderer",
|
|
2081
|
-
C(this, "Lexer",
|
|
2082
|
-
C(this, "Tokenizer",
|
|
2083
|
-
C(this, "Hooks",
|
|
2090
|
+
C(this, "Parser", fe);
|
|
2091
|
+
C(this, "Renderer", St);
|
|
2092
|
+
C(this, "TextRenderer", hn);
|
|
2093
|
+
C(this, "Lexer", de);
|
|
2094
|
+
C(this, "Tokenizer", Tt);
|
|
2095
|
+
C(this, "Hooks", lt);
|
|
2084
2096
|
this.use(...t);
|
|
2085
2097
|
}
|
|
2086
2098
|
walkTokens(t, e) {
|
|
@@ -2116,8 +2128,8 @@ ${t}</tr>
|
|
|
2116
2128
|
if ("renderer" in s) {
|
|
2117
2129
|
let o = e.renderers[s.name];
|
|
2118
2130
|
o ? e.renderers[s.name] = function(...l) {
|
|
2119
|
-
let
|
|
2120
|
-
return
|
|
2131
|
+
let m = s.renderer.apply(this, l);
|
|
2132
|
+
return m === !1 && (m = o.apply(this, l)), m;
|
|
2121
2133
|
} : e.renderers[s.name] = s.renderer;
|
|
2122
2134
|
}
|
|
2123
2135
|
if ("tokenizer" in s) {
|
|
@@ -2127,51 +2139,51 @@ ${t}</tr>
|
|
|
2127
2139
|
}
|
|
2128
2140
|
"childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
|
|
2129
2141
|
}), r.extensions = e), n.renderer) {
|
|
2130
|
-
let s = this.defaults.renderer || new
|
|
2142
|
+
let s = this.defaults.renderer || new St(this.defaults);
|
|
2131
2143
|
for (let o in n.renderer) {
|
|
2132
2144
|
if (!(o in s)) throw new Error(`renderer '${o}' does not exist`);
|
|
2133
2145
|
if (["options", "parser"].includes(o)) continue;
|
|
2134
|
-
let l = o,
|
|
2135
|
-
s[l] = (...
|
|
2136
|
-
let
|
|
2137
|
-
return
|
|
2146
|
+
let l = o, m = n.renderer[l], c = s[l];
|
|
2147
|
+
s[l] = (...b) => {
|
|
2148
|
+
let p = m.apply(s, b);
|
|
2149
|
+
return p === !1 && (p = c.apply(s, b)), p || "";
|
|
2138
2150
|
};
|
|
2139
2151
|
}
|
|
2140
2152
|
r.renderer = s;
|
|
2141
2153
|
}
|
|
2142
2154
|
if (n.tokenizer) {
|
|
2143
|
-
let s = this.defaults.tokenizer || new
|
|
2155
|
+
let s = this.defaults.tokenizer || new Tt(this.defaults);
|
|
2144
2156
|
for (let o in n.tokenizer) {
|
|
2145
2157
|
if (!(o in s)) throw new Error(`tokenizer '${o}' does not exist`);
|
|
2146
2158
|
if (["options", "rules", "lexer"].includes(o)) continue;
|
|
2147
|
-
let l = o,
|
|
2148
|
-
s[l] = (...
|
|
2149
|
-
let
|
|
2150
|
-
return
|
|
2159
|
+
let l = o, m = n.tokenizer[l], c = s[l];
|
|
2160
|
+
s[l] = (...b) => {
|
|
2161
|
+
let p = m.apply(s, b);
|
|
2162
|
+
return p === !1 && (p = c.apply(s, b)), p;
|
|
2151
2163
|
};
|
|
2152
2164
|
}
|
|
2153
2165
|
r.tokenizer = s;
|
|
2154
2166
|
}
|
|
2155
2167
|
if (n.hooks) {
|
|
2156
|
-
let s = this.defaults.hooks || new
|
|
2168
|
+
let s = this.defaults.hooks || new lt();
|
|
2157
2169
|
for (let o in n.hooks) {
|
|
2158
2170
|
if (!(o in s)) throw new Error(`hook '${o}' does not exist`);
|
|
2159
2171
|
if (["options", "block"].includes(o)) continue;
|
|
2160
|
-
let l = o,
|
|
2161
|
-
|
|
2162
|
-
if (this.defaults.async &&
|
|
2163
|
-
let d = await
|
|
2172
|
+
let l = o, m = n.hooks[l], c = s[l];
|
|
2173
|
+
lt.passThroughHooks.has(o) ? s[l] = (b) => {
|
|
2174
|
+
if (this.defaults.async && lt.passThroughHooksRespectAsync.has(o)) return (async () => {
|
|
2175
|
+
let d = await m.call(s, b);
|
|
2164
2176
|
return c.call(s, d);
|
|
2165
2177
|
})();
|
|
2166
|
-
let
|
|
2167
|
-
return c.call(s,
|
|
2168
|
-
} : s[l] = (...
|
|
2178
|
+
let p = m.call(s, b);
|
|
2179
|
+
return c.call(s, p);
|
|
2180
|
+
} : s[l] = (...b) => {
|
|
2169
2181
|
if (this.defaults.async) return (async () => {
|
|
2170
|
-
let d = await
|
|
2171
|
-
return d === !1 && (d = await c.apply(s,
|
|
2182
|
+
let d = await m.apply(s, b);
|
|
2183
|
+
return d === !1 && (d = await c.apply(s, b)), d;
|
|
2172
2184
|
})();
|
|
2173
|
-
let
|
|
2174
|
-
return
|
|
2185
|
+
let p = m.apply(s, b);
|
|
2186
|
+
return p === !1 && (p = c.apply(s, b)), p;
|
|
2175
2187
|
};
|
|
2176
2188
|
}
|
|
2177
2189
|
r.hooks = s;
|
|
@@ -2179,8 +2191,8 @@ ${t}</tr>
|
|
|
2179
2191
|
if (n.walkTokens) {
|
|
2180
2192
|
let s = this.defaults.walkTokens, o = n.walkTokens;
|
|
2181
2193
|
r.walkTokens = function(l) {
|
|
2182
|
-
let
|
|
2183
|
-
return
|
|
2194
|
+
let m = [];
|
|
2195
|
+
return m.push(o.call(this, l)), s && (m = m.concat(s.call(this, l))), m;
|
|
2184
2196
|
};
|
|
2185
2197
|
}
|
|
2186
2198
|
this.defaults = { ...this.defaults, ...r };
|
|
@@ -2190,10 +2202,10 @@ ${t}</tr>
|
|
|
2190
2202
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
2191
2203
|
}
|
|
2192
2204
|
lexer(t, e) {
|
|
2193
|
-
return
|
|
2205
|
+
return de.lex(t, e ?? this.defaults);
|
|
2194
2206
|
}
|
|
2195
2207
|
parser(t, e) {
|
|
2196
|
-
return
|
|
2208
|
+
return fe.parse(t, e ?? this.defaults);
|
|
2197
2209
|
}
|
|
2198
2210
|
parseMarkdown(t) {
|
|
2199
2211
|
return (e, n) => {
|
|
@@ -2202,17 +2214,17 @@ ${t}</tr>
|
|
|
2202
2214
|
if (typeof e > "u" || e === null) return o(new Error("marked(): input parameter is undefined or null"));
|
|
2203
2215
|
if (typeof e != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
2204
2216
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = t), s.async) return (async () => {
|
|
2205
|
-
let l = s.hooks ? await s.hooks.preprocess(e) : e,
|
|
2217
|
+
let l = s.hooks ? await s.hooks.preprocess(e) : e, m = await (s.hooks ? await s.hooks.provideLexer(t) : t ? de.lex : de.lexInline)(l, s), c = s.hooks ? await s.hooks.processAllTokens(m) : m;
|
|
2206
2218
|
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
2207
|
-
let
|
|
2208
|
-
return s.hooks ? await s.hooks.postprocess(
|
|
2219
|
+
let b = await (s.hooks ? await s.hooks.provideParser(t) : t ? fe.parse : fe.parseInline)(c, s);
|
|
2220
|
+
return s.hooks ? await s.hooks.postprocess(b) : b;
|
|
2209
2221
|
})().catch(o);
|
|
2210
2222
|
try {
|
|
2211
2223
|
s.hooks && (e = s.hooks.preprocess(e));
|
|
2212
|
-
let l = (s.hooks ? s.hooks.provideLexer(t) : t ?
|
|
2224
|
+
let l = (s.hooks ? s.hooks.provideLexer(t) : t ? de.lex : de.lexInline)(e, s);
|
|
2213
2225
|
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
2214
|
-
let
|
|
2215
|
-
return s.hooks && (
|
|
2226
|
+
let m = (s.hooks ? s.hooks.provideParser(t) : t ? fe.parse : fe.parseInline)(l, s);
|
|
2227
|
+
return s.hooks && (m = s.hooks.postprocess(m)), m;
|
|
2216
2228
|
} catch (l) {
|
|
2217
2229
|
return o(l);
|
|
2218
2230
|
}
|
|
@@ -2222,46 +2234,46 @@ ${t}</tr>
|
|
|
2222
2234
|
return (n) => {
|
|
2223
2235
|
if (n.message += `
|
|
2224
2236
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
2225
|
-
let r = "<p>An error occurred:</p><pre>" +
|
|
2237
|
+
let r = "<p>An error occurred:</p><pre>" + be(n.message + "", !0) + "</pre>";
|
|
2226
2238
|
return e ? Promise.resolve(r) : r;
|
|
2227
2239
|
}
|
|
2228
2240
|
if (e) return Promise.reject(n);
|
|
2229
2241
|
throw n;
|
|
2230
2242
|
};
|
|
2231
2243
|
}
|
|
2232
|
-
},
|
|
2233
|
-
function
|
|
2234
|
-
return
|
|
2244
|
+
}, h(Ve, "D"), Ve), De = new ri();
|
|
2245
|
+
function L(a, t) {
|
|
2246
|
+
return De.parse(a, t);
|
|
2235
2247
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
return
|
|
2248
|
+
h(L, "g");
|
|
2249
|
+
L.options = L.setOptions = function(a) {
|
|
2250
|
+
return De.setOptions(a), L.defaults = De.defaults, us(L.defaults), L;
|
|
2239
2251
|
};
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
return
|
|
2252
|
+
L.getDefaults = nn;
|
|
2253
|
+
L.defaults = Le;
|
|
2254
|
+
L.use = function(...a) {
|
|
2255
|
+
return De.use(...a), L.defaults = De.defaults, us(L.defaults), L;
|
|
2244
2256
|
};
|
|
2245
|
-
|
|
2246
|
-
return
|
|
2257
|
+
L.walkTokens = function(a, t) {
|
|
2258
|
+
return De.walkTokens(a, t);
|
|
2247
2259
|
};
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2260
|
+
L.parseInline = De.parseInline;
|
|
2261
|
+
L.Parser = fe;
|
|
2262
|
+
L.parser = fe.parse;
|
|
2263
|
+
L.Renderer = St;
|
|
2264
|
+
L.TextRenderer = hn;
|
|
2265
|
+
L.Lexer = de;
|
|
2266
|
+
L.lexer = de.lex;
|
|
2267
|
+
L.Tokenizer = Tt;
|
|
2268
|
+
L.Hooks = lt;
|
|
2269
|
+
L.parse = L;
|
|
2270
|
+
L.options;
|
|
2271
|
+
L.setOptions;
|
|
2272
|
+
L.use;
|
|
2273
|
+
L.walkTokens;
|
|
2274
|
+
L.parseInline;
|
|
2275
|
+
fe.parse;
|
|
2276
|
+
de.lex;
|
|
2265
2277
|
const ii = { class: "@container/chat flex flex-col h-full relative" }, ai = {
|
|
2266
2278
|
key: 0,
|
|
2267
2279
|
class: "pb-4"
|
|
@@ -2295,7 +2307,7 @@ const ii = { class: "@container/chat flex flex-col h-full relative" }, ai = {
|
|
|
2295
2307
|
}, Oi = {
|
|
2296
2308
|
key: 1,
|
|
2297
2309
|
class: "i-tabler-paperclip size-5"
|
|
2298
|
-
}, zi = ["placeholder", "disabled"], Pi = ["disabled"], Yi = /* @__PURE__ */
|
|
2310
|
+
}, zi = ["placeholder", "disabled"], Pi = ["disabled"], Yi = /* @__PURE__ */ Me({
|
|
2299
2311
|
__name: "ElAgentChat",
|
|
2300
2312
|
props: {
|
|
2301
2313
|
chatController: {},
|
|
@@ -2309,435 +2321,422 @@ const ii = { class: "@container/chat flex flex-col h-full relative" }, ai = {
|
|
|
2309
2321
|
starterPrompts: {}
|
|
2310
2322
|
},
|
|
2311
2323
|
setup(a) {
|
|
2312
|
-
const t = new
|
|
2313
|
-
t.link = ({ href: _, text:
|
|
2314
|
-
let
|
|
2324
|
+
const t = new L.Renderer();
|
|
2325
|
+
t.link = ({ href: _, text: f }) => {
|
|
2326
|
+
let x = !1;
|
|
2315
2327
|
if (typeof window < "u")
|
|
2316
2328
|
try {
|
|
2317
|
-
|
|
2329
|
+
x = new URL(_, window.location.href).origin === window.location.origin;
|
|
2318
2330
|
} catch {
|
|
2319
|
-
|
|
2331
|
+
x = !1;
|
|
2320
2332
|
}
|
|
2321
|
-
return
|
|
2322
|
-
},
|
|
2333
|
+
return x ? `<a href="${_}">${f}</a>` : `<a href="${_}" target="_blank" rel="noopener noreferrer">${f}</a>`;
|
|
2334
|
+
}, L.setOptions({ breaks: !0, gfm: !0, renderer: t });
|
|
2323
2335
|
function e(_) {
|
|
2324
2336
|
if (!_)
|
|
2325
2337
|
return "";
|
|
2326
|
-
const
|
|
2327
|
-
return br.sanitize(
|
|
2338
|
+
const f = L.parse(_, { async: !1 });
|
|
2339
|
+
return br.sanitize(f, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2328
2340
|
}
|
|
2329
|
-
|
|
2341
|
+
h(e, "renderMarkdown");
|
|
2330
2342
|
const n = {
|
|
2331
|
-
private: "",
|
|
2332
|
-
org: "",
|
|
2333
|
-
public: ""
|
|
2334
|
-
}, r = {
|
|
2335
2343
|
private: { icon: "i-tabler-lock", label: "Private", tooltip: "Only you can see this conversation" },
|
|
2336
2344
|
org: { icon: "i-tabler-users", label: "Workspace", tooltip: "Visible to workspace members" },
|
|
2337
2345
|
public: { icon: "i-tabler-globe", label: "Public", tooltip: "Anyone with the link can see this" }
|
|
2338
|
-
},
|
|
2346
|
+
}, r = [
|
|
2339
2347
|
"Brief me on tomorrow",
|
|
2340
2348
|
"Triage my inbox",
|
|
2341
2349
|
"What's on my plate this week"
|
|
2342
|
-
],
|
|
2343
|
-
() => a.starterPrompts ??
|
|
2344
|
-
),
|
|
2345
|
-
const _ = { ...
|
|
2350
|
+
], s = W(
|
|
2351
|
+
() => a.starterPrompts ?? r
|
|
2352
|
+
), o = W(() => {
|
|
2353
|
+
const _ = { ...n[a.scope] };
|
|
2346
2354
|
return a.scope === "org" && a.scopeName && (_.label = a.scopeName, _.tooltip = `Visible to ${a.scopeName} members`), _;
|
|
2347
|
-
}),
|
|
2348
|
-
function
|
|
2349
|
-
const
|
|
2350
|
-
return !
|
|
2355
|
+
}), l = ee(""), m = ee(!1), c = ee(), b = ee(), p = ee(), d = ee([]), g = ee(!1);
|
|
2356
|
+
function y(_, f) {
|
|
2357
|
+
const x = _[f], M = _[f + 1];
|
|
2358
|
+
return !M || M.sender !== x.sender;
|
|
2351
2359
|
}
|
|
2352
|
-
|
|
2353
|
-
const
|
|
2360
|
+
h(y, "shouldShowAvatar");
|
|
2361
|
+
const E = W(() => a.chatController?.textState.value), O = W(() => E.value?.isConnected ?? !1), ae = W(() => E.value?.isThinking ?? !1), ce = W(() => E.value?.connectionStatus === "disconnected" && !!E.value?.error), ne = W(() => E.value?.connectionStatus !== "connected" && !E.value?.error), N = W(() => E.value?.error), Y = W(() => a.chatController?.sharedMessages.value ?? []), ue = W(() => E.value?.accountGated ?? !1), Q = W(() => !O.value || ue.value), _t = W(() => ce.value ? "Agent is offline" : ne.value ? "Connecting..." : ue.value ? "Resolve the billing issue above to continue" : "Message"), ut = W(() => (l.value.trim() || d.value.length > 0) && !Q.value && !g.value), I = W(() => a.variant === "light"), q = W(
|
|
2354
2362
|
() => I.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2355
|
-
),
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
try {
|
|
2359
|
-
await a.chatController.startTextConversation();
|
|
2360
|
-
} catch (_) {
|
|
2361
|
-
console.error("Failed to start text conversation:", _);
|
|
2362
|
-
}
|
|
2363
|
+
), we = W(() => I.value ? "text-theme-300" : "text-white/30");
|
|
2364
|
+
tn(async () => {
|
|
2365
|
+
a.chatController && !O.value && await a.chatController.startTextConversation();
|
|
2363
2366
|
});
|
|
2364
|
-
function
|
|
2367
|
+
function Oe() {
|
|
2365
2368
|
a.chatController?.newConversation();
|
|
2366
2369
|
}
|
|
2367
|
-
|
|
2368
|
-
async function
|
|
2369
|
-
const _ =
|
|
2370
|
-
if (!_ && !
|
|
2370
|
+
h(Oe, "startNewConversation");
|
|
2371
|
+
async function ye() {
|
|
2372
|
+
const _ = l.value.trim(), f = d.value.length > 0;
|
|
2373
|
+
if (!_ && !f || !a.chatController || !O.value || g.value)
|
|
2371
2374
|
return;
|
|
2372
|
-
const
|
|
2373
|
-
|
|
2374
|
-
try {
|
|
2375
|
-
await a.chatController.sendChatMessage(m, L), dt();
|
|
2376
|
-
} catch (Z) {
|
|
2377
|
-
console.error("Error sending message:", Z);
|
|
2378
|
-
}
|
|
2375
|
+
const x = l.value, M = f ? [...d.value] : void 0;
|
|
2376
|
+
l.value = "", d.value = [], b.value && (b.value.style.height = "auto", b.value.focus()), await a.chatController.sendChatMessage(x, M), ht();
|
|
2379
2377
|
}
|
|
2380
|
-
|
|
2381
|
-
async function
|
|
2382
|
-
|
|
2378
|
+
h(ye, "sendMessage");
|
|
2379
|
+
async function Rt(_) {
|
|
2380
|
+
Q.value || (l.value = _, await ye());
|
|
2383
2381
|
}
|
|
2384
|
-
|
|
2385
|
-
async function
|
|
2386
|
-
_.key === "Enter" && !_.shiftKey && (_.preventDefault(), await
|
|
2382
|
+
h(Rt, "sendStarterPrompt");
|
|
2383
|
+
async function It(_) {
|
|
2384
|
+
_.key === "Enter" && !_.shiftKey && (_.preventDefault(), await ye());
|
|
2387
2385
|
}
|
|
2388
|
-
|
|
2389
|
-
function
|
|
2390
|
-
|
|
2391
|
-
|
|
2386
|
+
h(It, "handleKeydown");
|
|
2387
|
+
function ht() {
|
|
2388
|
+
c.value && jt(() => {
|
|
2389
|
+
c.value.scrollTop = c.value.scrollHeight;
|
|
2392
2390
|
});
|
|
2393
2391
|
}
|
|
2394
|
-
|
|
2395
|
-
function
|
|
2396
|
-
|
|
2392
|
+
h(ht, "scrollToBottom");
|
|
2393
|
+
function pt() {
|
|
2394
|
+
b.value && (b.value.style.height = "auto", b.value.style.height = `${Math.min(b.value.scrollHeight, 150)}px`);
|
|
2397
2395
|
}
|
|
2398
|
-
|
|
2399
|
-
function
|
|
2400
|
-
|
|
2396
|
+
h(pt, "adjustTextareaHeight"), ot(l, () => jt(() => pt()));
|
|
2397
|
+
function Ct() {
|
|
2398
|
+
p.value?.click();
|
|
2401
2399
|
}
|
|
2402
|
-
|
|
2403
|
-
async function
|
|
2404
|
-
const
|
|
2405
|
-
if (!(!
|
|
2406
|
-
|
|
2400
|
+
h(Ct, "triggerFileInput");
|
|
2401
|
+
async function dt(_) {
|
|
2402
|
+
const f = _.target, x = f.files?.[0];
|
|
2403
|
+
if (!(!x || !a.uploadFn)) {
|
|
2404
|
+
g.value = !0;
|
|
2407
2405
|
try {
|
|
2408
|
-
const
|
|
2409
|
-
|
|
2410
|
-
} catch (
|
|
2411
|
-
|
|
2406
|
+
const M = await a.uploadFn(x);
|
|
2407
|
+
d.value = [...d.value, M];
|
|
2408
|
+
} catch (M) {
|
|
2409
|
+
const P = M instanceof Error ? M.message : "Couldn't attach that file.";
|
|
2410
|
+
a.chatController?.notify(`Upload failed — ${P}`);
|
|
2412
2411
|
} finally {
|
|
2413
|
-
|
|
2412
|
+
g.value = !1, f.value = "";
|
|
2414
2413
|
}
|
|
2415
2414
|
}
|
|
2416
2415
|
}
|
|
2417
|
-
|
|
2418
|
-
function
|
|
2419
|
-
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
function Ze(_,
|
|
2423
|
-
if (
|
|
2424
|
-
const
|
|
2425
|
-
return
|
|
2426
|
-
}
|
|
2427
|
-
const
|
|
2428
|
-
if (!
|
|
2429
|
-
const
|
|
2430
|
-
return new Date(
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
function
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
const
|
|
2437
|
-
if (
|
|
2438
|
-
if (
|
|
2439
|
-
const
|
|
2416
|
+
h(dt, "handleFileSelect");
|
|
2417
|
+
function U(_) {
|
|
2418
|
+
d.value = d.value.filter((f, x) => x !== _);
|
|
2419
|
+
}
|
|
2420
|
+
h(U, "removeAttachment");
|
|
2421
|
+
function Ze(_, f) {
|
|
2422
|
+
if (f === 0) {
|
|
2423
|
+
const Pe = _[f];
|
|
2424
|
+
return Pe?.timestamp ? F(new Date(Pe.timestamp)) : null;
|
|
2425
|
+
}
|
|
2426
|
+
const x = _[f - 1], M = _[f];
|
|
2427
|
+
if (!x?.timestamp || !M?.timestamp) return null;
|
|
2428
|
+
const P = new Date(x.timestamp).getTime();
|
|
2429
|
+
return new Date(M.timestamp).getTime() - P > 36e5 ? F(new Date(M.timestamp)) : null;
|
|
2430
|
+
}
|
|
2431
|
+
h(Ze, "shouldShowTimeDivider");
|
|
2432
|
+
function F(_) {
|
|
2433
|
+
const f = /* @__PURE__ */ new Date(), x = _.toDateString() === f.toDateString(), M = new Date(f);
|
|
2434
|
+
M.setDate(M.getDate() - 1);
|
|
2435
|
+
const P = _.toDateString() === M.toDateString(), xe = _.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2436
|
+
if (x) return xe;
|
|
2437
|
+
if (P) return `Yesterday, ${xe}`;
|
|
2438
|
+
const ze = _.getFullYear() === f.getFullYear();
|
|
2440
2439
|
return `${_.toLocaleDateString("en-US", {
|
|
2441
2440
|
weekday: "long",
|
|
2442
2441
|
month: "short",
|
|
2443
2442
|
day: "numeric",
|
|
2444
|
-
...
|
|
2445
|
-
})}, ${
|
|
2443
|
+
...ze ? {} : { year: "numeric" }
|
|
2444
|
+
})}, ${xe}`;
|
|
2446
2445
|
}
|
|
2447
|
-
return
|
|
2448
|
-
_.length > 0 &&
|
|
2449
|
-
}, { immediate: !0, deep: !0 }), (_,
|
|
2446
|
+
return h(F, "formatTimeDivider"), ot(Y, (_) => {
|
|
2447
|
+
_.length > 0 && jt(() => ht());
|
|
2448
|
+
}, { immediate: !0, deep: !0 }), (_, f) => (T(), S("div", ii, [
|
|
2450
2449
|
I.value ? B("", !0) : (T(), S("div", ai, [
|
|
2451
|
-
|
|
2450
|
+
Wt(qs, {
|
|
2452
2451
|
agent: a.agent,
|
|
2453
|
-
"is-online":
|
|
2452
|
+
"is-online": O.value
|
|
2454
2453
|
}, null, 8, ["agent", "is-online"])
|
|
2455
2454
|
])),
|
|
2456
|
-
|
|
2455
|
+
ce.value ? (T(), S("div", {
|
|
2457
2456
|
key: 1,
|
|
2458
2457
|
class: A(["py-16 flex flex-col items-center justify-center gap-3 text-sm", I.value ? "text-theme-400" : "text-white/60"])
|
|
2459
2458
|
}, [
|
|
2460
|
-
|
|
2459
|
+
w("i", {
|
|
2461
2460
|
class: A(["i-heroicons-cloud-arrow-down size-8", I.value ? "text-theme-300" : "text-white/40"])
|
|
2462
2461
|
}, null, 2),
|
|
2463
|
-
|
|
2464
|
-
], 2)) :
|
|
2462
|
+
w("span", null, ie(N.value), 1)
|
|
2463
|
+
], 2)) : ne.value ? (T(), S("div", {
|
|
2465
2464
|
key: 2,
|
|
2466
2465
|
class: A(["py-16 flex flex-col items-center justify-center gap-2 text-sm", I.value ? "text-theme-400" : "text-theme-600"])
|
|
2467
2466
|
}, [
|
|
2468
|
-
|
|
2469
|
-
], 2)) :
|
|
2467
|
+
Wt(Ln, { class: "size-4" })
|
|
2468
|
+
], 2)) : a.setupHint ? (T(), S("div", {
|
|
2470
2469
|
key: 3,
|
|
2471
|
-
class: A(["flex items-center justify-center gap-1.5 py-2 text-[11px]",
|
|
2470
|
+
class: A(["flex items-center justify-center gap-1.5 py-2 text-[11px]", we.value])
|
|
2472
2471
|
}, [
|
|
2473
|
-
|
|
2474
|
-
|
|
2472
|
+
f[6] || (f[6] = w("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2473
|
+
w("span", null, ie(a.setupHint), 1)
|
|
2475
2474
|
], 2)) : B("", !0),
|
|
2476
|
-
|
|
2475
|
+
w("div", {
|
|
2477
2476
|
ref_key: "messagesContainer",
|
|
2478
|
-
ref:
|
|
2477
|
+
ref: c,
|
|
2479
2478
|
class: "flex-1 overflow-y-auto overflow-x-hidden pt-4 pb-[120px] px-3 space-y-1 min-h-0 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"
|
|
2480
2479
|
}, [
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2480
|
+
Y.value.length === 0 && !ne.value && !ce.value ? (T(), S("div", li, [
|
|
2481
|
+
w("div", oi, [
|
|
2482
|
+
w("img", {
|
|
2484
2483
|
src: a.agent.avatarUrl.value,
|
|
2485
2484
|
alt: a.agent.displayName.value,
|
|
2486
2485
|
class: A(["size-full rounded-full object-cover ring-1", I.value ? "ring-black/5" : "ring-white/10"])
|
|
2487
2486
|
}, null, 10, ci),
|
|
2488
|
-
|
|
2487
|
+
O.value ? (T(), S("span", {
|
|
2489
2488
|
key: 0,
|
|
2490
2489
|
class: A(["absolute top-[85%] left-[85%] -translate-x-1/2 -translate-y-1/2 size-[18%] min-w-2.5 min-h-2.5 flex items-center justify-center rounded-full", I.value ? "bg-white" : "bg-theme-900"])
|
|
2491
|
-
}, [...
|
|
2492
|
-
|
|
2490
|
+
}, [...f[7] || (f[7] = [
|
|
2491
|
+
w("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2493
2492
|
])], 2)) : B("", !0)
|
|
2494
2493
|
]),
|
|
2495
|
-
|
|
2494
|
+
w("div", {
|
|
2496
2495
|
class: A(["text-base @sm/chat:text-lg font-semibold", I.value ? "text-theme-900" : "text-white"])
|
|
2497
2496
|
}, ie(a.agent.displayName.value), 3),
|
|
2498
|
-
|
|
2499
|
-
class: A(["mt-1 text-center text-xs @sm/chat:text-sm",
|
|
2497
|
+
w("p", {
|
|
2498
|
+
class: A(["mt-1 text-center text-xs @sm/chat:text-sm", we.value])
|
|
2500
2499
|
}, ie(a.emptyStateMessage || "Tap a prompt to get started, or type your own."), 3),
|
|
2501
|
-
|
|
2502
|
-
(T(!0), S(
|
|
2503
|
-
key:
|
|
2500
|
+
s.value.length > 0 && !Q.value ? (T(), S("div", ui, [
|
|
2501
|
+
(T(!0), S(Te, null, it(s.value, (x) => (T(), S("button", {
|
|
2502
|
+
key: x,
|
|
2504
2503
|
type: "button",
|
|
2505
2504
|
"data-test": "chat-starter-prompt",
|
|
2506
2505
|
class: A(["text-left text-sm rounded-2xl px-4 py-2.5 transition-colors cursor-pointer", I.value ? "bg-theme-25 border border-theme-200 text-theme-700 hover:bg-theme-50 hover:border-theme-300" : "bg-white/5 border border-white/10 text-white/80 hover:bg-white/10 hover:border-white/20"]),
|
|
2507
|
-
onClick: /* @__PURE__ */
|
|
2508
|
-
}, ie(
|
|
2506
|
+
onClick: /* @__PURE__ */ h((M) => Rt(x), "onClick")
|
|
2507
|
+
}, ie(x), 11, hi))), 128))
|
|
2509
2508
|
])) : B("", !0),
|
|
2510
|
-
|
|
2509
|
+
w("div", {
|
|
2511
2510
|
class: A(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", I.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2512
|
-
title:
|
|
2511
|
+
title: o.value.tooltip
|
|
2513
2512
|
}, [
|
|
2514
|
-
|
|
2515
|
-
class: A([
|
|
2513
|
+
w("i", {
|
|
2514
|
+
class: A([o.value.icon, "size-3"])
|
|
2516
2515
|
}, null, 2),
|
|
2517
|
-
|
|
2516
|
+
w("span", null, ie(o.value.label), 1)
|
|
2518
2517
|
], 10, pi)
|
|
2519
2518
|
])) : B("", !0),
|
|
2520
|
-
|
|
2521
|
-
|
|
2519
|
+
Y.value.length > 0 ? (T(), S("div", di, [
|
|
2520
|
+
w("button", {
|
|
2522
2521
|
type: "button",
|
|
2523
2522
|
"data-test": "chat-new-session",
|
|
2524
2523
|
class: A(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors", I.value ? "text-theme-400 hover:text-theme-700 hover:bg-theme-50" : "text-white/40 hover:text-white hover:bg-white/5"]),
|
|
2525
|
-
onClick:
|
|
2526
|
-
}, [...
|
|
2527
|
-
|
|
2528
|
-
|
|
2524
|
+
onClick: Oe
|
|
2525
|
+
}, [...f[8] || (f[8] = [
|
|
2526
|
+
w("i", { class: "i-tabler-refresh size-3" }, null, -1),
|
|
2527
|
+
w("span", null, "New chat", -1)
|
|
2529
2528
|
])], 2)
|
|
2530
2529
|
])) : B("", !0),
|
|
2531
|
-
(T(!0), S(
|
|
2532
|
-
key:
|
|
2530
|
+
(T(!0), S(Te, null, it(Y.value, (x, M) => (T(), S(Te, {
|
|
2531
|
+
key: x.id
|
|
2533
2532
|
}, [
|
|
2534
|
-
Ze(
|
|
2535
|
-
|
|
2536
|
-
class: A(["flex-1 h-px",
|
|
2533
|
+
Ze(Y.value, M) ? (T(), S("div", fi, [
|
|
2534
|
+
w("div", {
|
|
2535
|
+
class: A(["flex-1 h-px", q.value])
|
|
2537
2536
|
}, null, 2),
|
|
2538
|
-
|
|
2539
|
-
class: A(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase",
|
|
2540
|
-
}, ie(Ze(
|
|
2541
|
-
|
|
2542
|
-
class: A(["flex-1 h-px",
|
|
2537
|
+
w("span", {
|
|
2538
|
+
class: A(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", we.value])
|
|
2539
|
+
}, ie(Ze(Y.value, M)), 3),
|
|
2540
|
+
w("div", {
|
|
2541
|
+
class: A(["flex-1 h-px", q.value])
|
|
2543
2542
|
}, null, 2)
|
|
2544
2543
|
])) : B("", !0),
|
|
2545
|
-
|
|
2544
|
+
x.sender === "system" ? (T(), S("div", {
|
|
2546
2545
|
key: 1,
|
|
2547
2546
|
"data-test": "messaging-system-msg",
|
|
2548
|
-
"data-issue-code":
|
|
2549
|
-
"data-issue-bucket":
|
|
2547
|
+
"data-issue-code": x.issue?.code,
|
|
2548
|
+
"data-issue-bucket": x.issue?.bucket,
|
|
2550
2549
|
class: A(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", I.value ? "text-theme-500" : "text-white/70"])
|
|
2551
2550
|
}, [
|
|
2552
|
-
|
|
2553
|
-
class: A(["i-tabler-alert-circle size-4 mt-0.5 shrink-0",
|
|
2551
|
+
w("i", {
|
|
2552
|
+
class: A(["i-tabler-alert-circle size-4 mt-0.5 shrink-0", x.issue?.bucket === "account" ? I.value ? "text-amber-500" : "text-amber-300" : I.value ? "text-red-500" : "text-red-300"])
|
|
2554
2553
|
}, null, 2),
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2554
|
+
w("div", mi, [
|
|
2555
|
+
w("span", null, ie(x.text), 1),
|
|
2556
|
+
x.issue?.help ? (T(), S("span", {
|
|
2558
2557
|
key: 0,
|
|
2559
2558
|
class: A(["text-[12px]", I.value ? "text-theme-400" : "text-white/55"])
|
|
2560
|
-
}, ie(
|
|
2561
|
-
|
|
2559
|
+
}, ie(x.issue.help), 3)) : B("", !0),
|
|
2560
|
+
x.issue?.actionUrl ? (T(), S("a", {
|
|
2562
2561
|
key: 1,
|
|
2563
|
-
href:
|
|
2562
|
+
href: x.issue.actionUrl,
|
|
2564
2563
|
"data-test": "messaging-system-msg-action",
|
|
2565
2564
|
class: A(["text-[12px] font-medium inline-flex items-center gap-1", I.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"])
|
|
2566
2565
|
}, [
|
|
2567
|
-
|
|
2568
|
-
|
|
2566
|
+
Je(ie(x.issue.actionLabel) + " ", 1),
|
|
2567
|
+
f[9] || (f[9] = w("i", { class: "i-tabler-arrow-right size-3" }, null, -1))
|
|
2569
2568
|
], 10, bi)) : B("", !0)
|
|
2570
2569
|
])
|
|
2571
2570
|
], 10, gi)) : (T(), S("div", {
|
|
2572
2571
|
key: 2,
|
|
2573
|
-
"data-test":
|
|
2572
|
+
"data-test": x.sender === "agent" ? "messaging-assistant-msg" : x.sender === "user" ? "messaging-user-msg" : void 0,
|
|
2574
2573
|
class: A(["flex gap-2 items-end", {
|
|
2575
|
-
"justify-end":
|
|
2576
|
-
"justify-start":
|
|
2577
|
-
"mb-4":
|
|
2574
|
+
"justify-end": x.sender === "user",
|
|
2575
|
+
"justify-start": x.sender === "agent",
|
|
2576
|
+
"mb-4": y(Y.value, M)
|
|
2578
2577
|
}])
|
|
2579
2578
|
}, [
|
|
2580
|
-
|
|
2581
|
-
|
|
2579
|
+
x.sender === "agent" ? (T(), S("div", ki, [
|
|
2580
|
+
y(Y.value, M) ? (T(), S("img", {
|
|
2582
2581
|
key: 0,
|
|
2583
2582
|
src: a.agent.avatarUrl.value,
|
|
2584
2583
|
alt: a.agent.displayName.value,
|
|
2585
2584
|
class: A(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", I.value ? "ring-1 ring-black/5" : ""])
|
|
2586
2585
|
}, null, 10, wi)) : B("", !0)
|
|
2587
2586
|
])) : B("", !0),
|
|
2588
|
-
|
|
2589
|
-
class: A(
|
|
2587
|
+
w("div", {
|
|
2588
|
+
class: A(x.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2590
2589
|
}, [
|
|
2591
|
-
|
|
2590
|
+
x.attachments?.length ? (T(), S("div", {
|
|
2592
2591
|
key: 0,
|
|
2593
|
-
class: A(["mb-1 space-y-1",
|
|
2592
|
+
class: A(["mb-1 space-y-1", x.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2594
2593
|
}, [
|
|
2595
|
-
(T(!0), S(
|
|
2596
|
-
|
|
2594
|
+
(T(!0), S(Te, null, it(x.attachments, (P, xe) => (T(), S(Te, { key: xe }, [
|
|
2595
|
+
P.type === "image" ? (T(), S("img", {
|
|
2597
2596
|
key: 0,
|
|
2598
|
-
src:
|
|
2599
|
-
alt:
|
|
2597
|
+
src: P.url,
|
|
2598
|
+
alt: P.name,
|
|
2600
2599
|
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2601
|
-
}, null, 8, yi)) :
|
|
2600
|
+
}, null, 8, yi)) : P.type === "audio" ? (T(), S("audio", {
|
|
2602
2601
|
key: 1,
|
|
2603
|
-
src:
|
|
2602
|
+
src: P.url,
|
|
2604
2603
|
controls: "",
|
|
2605
2604
|
class: "max-w-full"
|
|
2606
2605
|
}, null, 8, vi)) : (T(), S("a", {
|
|
2607
2606
|
key: 2,
|
|
2608
|
-
href:
|
|
2607
|
+
href: P.url,
|
|
2609
2608
|
target: "_blank",
|
|
2610
2609
|
rel: "noopener",
|
|
2611
2610
|
class: A(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", I.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2612
2611
|
}, [
|
|
2613
|
-
|
|
2614
|
-
|
|
2612
|
+
f[10] || (f[10] = w("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2613
|
+
Je(" " + ie(P.name), 1)
|
|
2615
2614
|
], 10, Ti))
|
|
2616
2615
|
], 64))), 128))
|
|
2617
2616
|
], 2)) : B("", !0),
|
|
2618
|
-
|
|
2617
|
+
x.text ? (T(), S("div", {
|
|
2619
2618
|
key: 1,
|
|
2620
2619
|
class: A(["rounded-2xl px-3.5 py-2", [
|
|
2621
|
-
|
|
2620
|
+
x.sender === "user" ? "bg-primary-500 text-white rounded-br-[4px]" : I.value ? "bg-theme-50 text-theme-800 border border-black/[0.02] rounded-bl-[4px]" : "bg-white/15 backdrop-blur-sm text-white/95 rounded-bl-[4px]"
|
|
2622
2621
|
]])
|
|
2623
2622
|
}, [
|
|
2624
|
-
|
|
2625
|
-
class: A(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed",
|
|
2626
|
-
innerHTML: e(
|
|
2627
|
-
onClick:
|
|
2623
|
+
w("div", {
|
|
2624
|
+
class: A(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed", x.sender === "user" || !I.value ? "chat-msg-prose-invert" : ""]),
|
|
2625
|
+
innerHTML: e(x.text),
|
|
2626
|
+
onClick: f[0] || (f[0] = Rs(() => {
|
|
2628
2627
|
}, ["stop"]))
|
|
2629
2628
|
}, null, 10, Si)
|
|
2630
2629
|
], 2)) : B("", !0)
|
|
2631
2630
|
], 2)
|
|
2632
2631
|
], 10, xi))
|
|
2633
2632
|
], 64))), 128)),
|
|
2634
|
-
|
|
2635
|
-
|
|
2633
|
+
ae.value ? (T(), S("div", Ai, [
|
|
2634
|
+
w("img", {
|
|
2636
2635
|
src: a.agent.avatarUrl.value,
|
|
2637
2636
|
alt: a.agent.displayName.value,
|
|
2638
2637
|
class: A(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", I.value ? "ring-1 ring-black/5" : ""])
|
|
2639
2638
|
}, null, 10, Ei),
|
|
2640
|
-
|
|
2639
|
+
w("div", {
|
|
2641
2640
|
class: A(["rounded-2xl px-3.5 py-2.5 flex items-center", I.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2642
2641
|
}, [
|
|
2643
|
-
|
|
2642
|
+
w("i", {
|
|
2644
2643
|
class: A(["i-svg-spinners-3-dots-bounce size-7", I.value ? "text-theme-400" : "text-white/50"])
|
|
2645
2644
|
}, null, 2)
|
|
2646
2645
|
], 2)
|
|
2647
2646
|
])) : B("", !0)
|
|
2648
2647
|
], 512),
|
|
2649
|
-
|
|
2648
|
+
w("div", {
|
|
2650
2649
|
class: A(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", I.value ? "bg-gradient-to-t from-white via-white/95 to-white/70" : "bg-gradient-to-t from-black/80 via-black/70 to-black/40"])
|
|
2651
2650
|
}, [
|
|
2652
|
-
|
|
2653
|
-
(T(!0), S(
|
|
2654
|
-
key:
|
|
2651
|
+
d.value.length > 0 ? (T(), S("div", _i, [
|
|
2652
|
+
(T(!0), S(Te, null, it(d.value, (x, M) => (T(), S("div", {
|
|
2653
|
+
key: M,
|
|
2655
2654
|
class: "relative shrink-0 group"
|
|
2656
2655
|
}, [
|
|
2657
|
-
|
|
2656
|
+
x.type === "image" ? (T(), S("img", {
|
|
2658
2657
|
key: 0,
|
|
2659
|
-
src:
|
|
2660
|
-
alt:
|
|
2658
|
+
src: x.url,
|
|
2659
|
+
alt: x.name,
|
|
2661
2660
|
class: A(["size-14 rounded-xl object-cover border", I.value ? "border-black/10" : "border-white/20"])
|
|
2662
2661
|
}, null, 10, Ri)) : (T(), S("div", {
|
|
2663
2662
|
key: 1,
|
|
2664
2663
|
class: A(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", I.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2665
2664
|
}, [
|
|
2666
|
-
|
|
2667
|
-
|
|
2665
|
+
f[11] || (f[11] = w("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2666
|
+
w("span", Ii, ie(x.name), 1)
|
|
2668
2667
|
], 2)),
|
|
2669
|
-
|
|
2668
|
+
w("button", {
|
|
2670
2669
|
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",
|
|
2671
|
-
onClick: /* @__PURE__ */
|
|
2672
|
-
}, [...
|
|
2673
|
-
|
|
2670
|
+
onClick: /* @__PURE__ */ h((P) => U(M), "onClick")
|
|
2671
|
+
}, [...f[12] || (f[12] = [
|
|
2672
|
+
w("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2674
2673
|
])], 8, Ci)
|
|
2675
2674
|
]))), 128)),
|
|
2676
|
-
|
|
2677
|
-
|
|
2675
|
+
g.value ? (T(), S("div", Di, [
|
|
2676
|
+
Wt(Ln, { class: "size-5" })
|
|
2678
2677
|
])) : B("", !0)
|
|
2679
2678
|
])) : B("", !0),
|
|
2680
2679
|
a.uploadFn ? (T(), S("input", {
|
|
2681
2680
|
key: 1,
|
|
2682
2681
|
ref_key: "fileInput",
|
|
2683
|
-
ref:
|
|
2682
|
+
ref: p,
|
|
2684
2683
|
type: "file",
|
|
2685
2684
|
accept: "image/*,audio/*,video/*",
|
|
2686
2685
|
class: "hidden",
|
|
2687
|
-
onChange:
|
|
2686
|
+
onChange: dt
|
|
2688
2687
|
}, null, 544)) : B("", !0),
|
|
2689
|
-
|
|
2690
|
-
class: A(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", I.value ?
|
|
2688
|
+
w("div", {
|
|
2689
|
+
class: A(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", I.value ? m.value ? "bg-white ring-1 ring-black/10 shadow-[0_4px_16px_rgba(0,0,0,0.06)]" : "bg-theme-50 ring-1 ring-transparent hover:ring-black/5" : m.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2691
2690
|
}, [
|
|
2692
|
-
|
|
2691
|
+
w("button", {
|
|
2693
2692
|
class: A(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
2694
2693
|
a.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
2695
2694
|
I.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2696
|
-
|
|
2695
|
+
g.value ? "opacity-50 pointer-events-none" : ""
|
|
2697
2696
|
]]),
|
|
2698
|
-
disabled:
|
|
2699
|
-
onClick:
|
|
2697
|
+
disabled: Q.value || g.value || !a.uploadFn,
|
|
2698
|
+
onClick: f[1] || (f[1] = (x) => a.uploadFn && Ct())
|
|
2700
2699
|
}, [
|
|
2701
|
-
|
|
2700
|
+
g.value ? (T(), S("i", Li)) : (T(), S("i", Oi))
|
|
2702
2701
|
], 10, Mi),
|
|
2703
|
-
ss(
|
|
2702
|
+
ss(w("textarea", {
|
|
2704
2703
|
ref_key: "textarea",
|
|
2705
|
-
ref:
|
|
2706
|
-
"onUpdate:modelValue":
|
|
2704
|
+
ref: b,
|
|
2705
|
+
"onUpdate:modelValue": f[2] || (f[2] = (x) => l.value = x),
|
|
2707
2706
|
"data-test": "messaging-input",
|
|
2708
2707
|
rows: "1",
|
|
2709
2708
|
enterkeyhint: "send",
|
|
2710
|
-
placeholder:
|
|
2711
|
-
disabled:
|
|
2709
|
+
placeholder: _t.value,
|
|
2710
|
+
disabled: Q.value,
|
|
2712
2711
|
style: { fontSize: "16px", resize: "none" },
|
|
2713
2712
|
class: A(["flex-1 min-w-0 bg-transparent px-1 py-2 focus:outline-none disabled:opacity-50 overflow-y-auto leading-relaxed [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", I.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2714
|
-
onKeydown:
|
|
2715
|
-
onFocus:
|
|
2716
|
-
onBlur:
|
|
2713
|
+
onKeydown: It,
|
|
2714
|
+
onFocus: f[3] || (f[3] = (x) => m.value = !0),
|
|
2715
|
+
onBlur: f[4] || (f[4] = (x) => m.value = !1)
|
|
2717
2716
|
}, null, 42, zi), [
|
|
2718
|
-
[rs,
|
|
2717
|
+
[rs, l.value]
|
|
2719
2718
|
]),
|
|
2720
|
-
|
|
2719
|
+
w("button", {
|
|
2721
2720
|
"data-test": "messaging-send-btn",
|
|
2722
|
-
class: A(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10",
|
|
2723
|
-
disabled: !
|
|
2724
|
-
onClick:
|
|
2725
|
-
}, [...
|
|
2726
|
-
|
|
2721
|
+
class: A(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10", ut.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : I.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2722
|
+
disabled: !ut.value,
|
|
2723
|
+
onClick: f[5] || (f[5] = (x) => ye())
|
|
2724
|
+
}, [...f[13] || (f[13] = [
|
|
2725
|
+
w("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2727
2726
|
])], 10, Pi)
|
|
2728
2727
|
], 2),
|
|
2729
|
-
|
|
2728
|
+
w("div", {
|
|
2730
2729
|
class: A(["text-[10px] text-center mt-2.5 select-none opacity-70", I.value ? "text-theme-400" : "text-white/50"])
|
|
2731
2730
|
}, [
|
|
2732
|
-
|
|
2733
|
-
|
|
2731
|
+
f[14] || (f[14] = Je(" Press ", -1)),
|
|
2732
|
+
w("kbd", {
|
|
2734
2733
|
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", I.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2735
2734
|
}, "Enter", 2),
|
|
2736
|
-
|
|
2737
|
-
|
|
2735
|
+
f[15] || (f[15] = Je(" to send, ", -1)),
|
|
2736
|
+
w("kbd", {
|
|
2738
2737
|
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", I.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2739
2738
|
}, "Shift+Enter", 2),
|
|
2740
|
-
|
|
2739
|
+
f[16] || (f[16] = Je(" for new line ", -1))
|
|
2741
2740
|
], 2)
|
|
2742
2741
|
], 2)
|
|
2743
2742
|
]));
|
|
@@ -2745,7 +2744,7 @@ const ii = { class: "@container/chat flex flex-col h-full relative" }, ai = {
|
|
|
2745
2744
|
}), Ni = { class: "agent-wrap" }, $i = {
|
|
2746
2745
|
key: 0,
|
|
2747
2746
|
class: "flex items-center justify-center h-full"
|
|
2748
|
-
}, Zi = /* @__PURE__ */
|
|
2747
|
+
}, Zi = /* @__PURE__ */ Me({
|
|
2749
2748
|
__name: "AgentWrap",
|
|
2750
2749
|
props: {
|
|
2751
2750
|
sdk: {},
|
|
@@ -2762,8 +2761,8 @@ const ii = { class: "@container/chat flex flex-col h-full relative" }, ai = {
|
|
|
2762
2761
|
const t = Ds("AgentWrap"), e = a, n = e.sdk || Ms.getInstance({
|
|
2763
2762
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2764
2763
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2765
|
-
}), r =
|
|
2766
|
-
return
|
|
2764
|
+
}), r = ee(!e.agent), s = Is(e.agent ? new yt({ config: e.agent }) : void 0), o = ee();
|
|
2765
|
+
return tn(async () => {
|
|
2767
2766
|
if (e.agent) {
|
|
2768
2767
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2769
2768
|
agentId: e.agent.agentId,
|
|
@@ -2789,7 +2788,7 @@ const ii = { class: "@container/chat flex flex-col h-full relative" }, ai = {
|
|
|
2789
2788
|
try {
|
|
2790
2789
|
r.value = !0, t.debug("Fetching public agent", { handle: e.handle });
|
|
2791
2790
|
const l = await n.user.getPublicAgent({ handle: e.handle });
|
|
2792
|
-
l ? (s.value = new
|
|
2791
|
+
l ? (s.value = new yt({ config: l }), t.debug("Successfully fetched public agent", {
|
|
2793
2792
|
agentId: l.agentId,
|
|
2794
2793
|
handle: l.handle
|
|
2795
2794
|
}), l.agentId && n.user.track({
|
|
@@ -2839,12 +2838,12 @@ const ii = { class: "@container/chat flex flex-col h-full relative" }, ai = {
|
|
|
2839
2838
|
}
|
|
2840
2839
|
});
|
|
2841
2840
|
}
|
|
2842
|
-
}), (l,
|
|
2843
|
-
r.value ? (T(), S("div", $i, [...
|
|
2844
|
-
|
|
2841
|
+
}), (l, m) => (T(), S("div", Ni, [
|
|
2842
|
+
r.value ? (T(), S("div", $i, [...m[0] || (m[0] = [
|
|
2843
|
+
w("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2845
2844
|
])])) : s.value ? ns(l.$slots, "default", {
|
|
2846
2845
|
key: 1,
|
|
2847
|
-
sdk:
|
|
2846
|
+
sdk: Kt(n),
|
|
2848
2847
|
agent: s.value,
|
|
2849
2848
|
context: a.context,
|
|
2850
2849
|
firstMessage: a.firstMessage,
|