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