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