@pagelines/sdk 1.0.877 → 1.0.879
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/README.md +68 -68
- package/dist/BotProvider.js +777 -0
- package/dist/BotProvider.js.map +1 -0
- package/dist/{AgentWidgetInline.js → BotWidgetInline.js} +8 -8
- package/dist/BotWidgetInline.js.map +1 -0
- package/dist/{AgentWidgetModal.js → BotWidgetModal.js} +7 -7
- package/dist/BotWidgetModal.js.map +1 -0
- package/dist/{AgentWrap.js → BotWrap.js} +1202 -1155
- package/dist/BotWrap.js.map +1 -0
- package/dist/{agent/AgentController.d.ts → bot/BotController.d.ts} +36 -18
- package/dist/bot/index.d.ts +14 -0
- package/dist/{agent → bot}/schema.d.ts +6 -6
- package/dist/{agent/ui/AgentAvatar.vue.d.ts → bot/ui/BotAvatar.vue.d.ts} +6 -6
- package/dist/{agent/ui/AgentChat.vue.d.ts → bot/ui/BotChat.vue.d.ts} +5 -5
- package/dist/{agent/ui/AgentProvider.vue.d.ts → bot/ui/BotProvider.vue.d.ts} +3 -3
- package/dist/{agent/ui/AgentWrap.vue.d.ts → bot/ui/BotWrap.vue.d.ts} +3 -4
- package/dist/{agent/ui/ElAgentAbout.vue.d.ts → bot/ui/ElBotAbout.vue.d.ts} +2 -2
- package/dist/{agent/ui/ElAgentChat.vue.d.ts → bot/ui/ElBotChat.vue.d.ts} +5 -5
- package/dist/{agent/ui/ElAgentChatPreview.vue.d.ts → bot/ui/ElBotChatPreview.vue.d.ts} +1 -1
- package/dist/{agent/ui/ElAgentHeader.vue.d.ts → bot/ui/ElBotHeader.vue.d.ts} +2 -2
- package/dist/{agent/ui/ElAgentModeSidebar.vue.d.ts → bot/ui/ElBotModeSidebar.vue.d.ts} +2 -2
- package/dist/{agent/ui/ElAgentSidebar.vue.d.ts → bot/ui/ElBotSidebar.vue.d.ts} +2 -2
- package/dist/bot/ui/ElCreateBot.vue.d.ts +12 -0
- package/dist/{agent → bot}/ui/ElModeHeader.vue.d.ts +2 -2
- package/dist/{agent → bot}/ui/ElProvisioningStatus.vue.d.ts +1 -1
- package/dist/{agent → bot}/ui/VoiceMode.vue.d.ts +4 -4
- package/dist/{agent → bot}/utils.d.ts +5 -5
- package/dist/{agent → bot}/voice/provider.d.ts +2 -2
- package/dist/{agent → bot}/voice/providers/livekit/provider.d.ts +8 -7
- package/dist/{agent → bot}/voice/voice-session-client.d.ts +2 -1
- package/dist/{agent → bot}/work-journal.d.ts +1 -1
- package/dist/{agent.js → bot.js} +89 -84
- package/dist/bot.js.map +1 -0
- package/dist/clients/BillingClient.d.ts +1 -1
- package/dist/clients/BotClient.d.ts +26 -0
- package/dist/clients/ChatClient.d.ts +6 -5
- package/dist/clients/ComputerClient.d.ts +16 -0
- package/dist/clients/UserClient.d.ts +4 -7
- package/dist/clients/types.d.ts +7 -2
- package/dist/contract/build.d.ts +1 -2
- package/dist/index.d.ts +3 -2
- package/dist/provider.js +1 -1
- package/dist/provider.js.map +1 -1
- package/dist/provider2.js +28 -36
- package/dist/provider2.js.map +1 -1
- package/dist/sdk.css +1 -1
- package/dist/sdk.js +4 -4
- package/dist/sdkClient.d.ts +33 -376
- package/dist/sdkClient.js +168 -170
- package/dist/sdkClient.js.map +1 -1
- package/dist/useWidgetState.js +9 -9
- package/dist/useWidgetState.js.map +1 -1
- package/dist/widget/PLWidget.d.ts +6 -6
- package/dist/widget/composables/useWidgetState.d.ts +3 -402
- package/dist/widget/index.d.ts +2 -2
- package/dist/widget/mode.d.ts +2 -2
- package/dist/widget/ui/{AgentWidgetInline.vue.d.ts → BotWidgetInline.vue.d.ts} +2 -2
- package/dist/widget/ui/{AgentWidgetModal.vue.d.ts → BotWidgetModal.vue.d.ts} +2 -2
- package/dist/widget/ui/{AgentWidgetPopup.vue.d.ts → BotWidgetPopup.vue.d.ts} +4 -4
- package/dist/widget.js +206 -206
- package/dist/widget.js.map +1 -1
- package/package.json +5 -5
- package/dist/AgentProvider.js +0 -764
- package/dist/AgentProvider.js.map +0 -1
- package/dist/AgentWidgetInline.js.map +0 -1
- package/dist/AgentWidgetModal.js.map +0 -1
- package/dist/AgentWrap.js.map +0 -1
- package/dist/agent/index.d.ts +0 -14
- package/dist/agent/ui/ElCreateAgent.vue.d.ts +0 -277
- package/dist/agent.js.map +0 -1
- package/dist/clients/AgentClient.d.ts +0 -48
- /package/dist/{agent → bot}/VoiceRecorderController.d.ts +0 -0
- /package/dist/{agent/ui/AgentInputEmail.vue.d.ts → bot/ui/BotInputEmail.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentInputOneTimeCode.vue.d.ts → bot/ui/BotInputOneTimeCode.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentSidebarClose.vue.d.ts → bot/ui/BotSidebarClose.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentToolActivityGroup.vue.d.ts → bot/ui/BotToolActivityGroup.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentWidget.vue.d.ts → bot/ui/BotWidget.vue.d.ts} +0 -0
- /package/dist/{agent → bot}/ui/ChatCardBlock.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ChatRichText.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ChatScroller.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ChatVisualBlock.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ElAuthGate.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ElAuthPanel.vue.d.ts +0 -0
- /package/dist/{agent/ui/ElAgentButton.vue.d.ts → bot/ui/ElBotButton.vue.d.ts} +0 -0
- /package/dist/{agent → bot}/ui/ElSidebar.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/VoiceHistogramController.d.ts +0 -0
- /package/dist/{agent → bot}/ui/chat-diagram-layout.d.ts +0 -0
- /package/dist/{agent → bot}/ui/chat-visual-format.d.ts +0 -0
- /package/dist/{agent → bot}/ui/voice-mode-presentation.d.ts +0 -0
- /package/dist/{agent → bot}/voice/voice-error-copy.d.ts +0 -0
- /package/dist/{agent → bot}/voice/voice-work-state.d.ts +0 -0
- /package/dist/widget/ui/{AgentWidgetOnboard.vue.d.ts → BotWidgetOnboard.vue.d.ts} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { c as t, t as n } from "./sdkClient.js";
|
|
3
|
+
import { CHAT_ISSUE_COPY as r, CUSTOMER_COMPUTER_STATE_LABEL as i, SettingsObject as a, createLogger as o, customerComputerState as s, getDefaultAvatarUrl as c, isAssistantSilenceControl as u, parseChatCardFencePayload as f, parseChatVisualFencePayload as p } from "@pagelines/core";
|
|
4
|
+
import { Fragment as m, Transition as h, computed as _, createBlock as v, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createTextVNode as C, createVNode as T, defineComponent as k, nextTick as te, normalizeClass as A, normalizeStyle as j, onBeforeUnmount as ne, onMounted as re, onUnmounted as ie, openBlock as M, ref as P, renderList as F, renderSlot as ae, resolveDynamicComponent as oe, shallowRef as I, toDisplayString as R, unref as B, useTemplateRef as se, vModelText as ce, watch as ue, withCtx as de, withDirectives as pe, withKeys as he, withModifiers as _e } from "vue";
|
|
5
5
|
//#region \0plugin-vue:export-helper
|
|
6
|
-
var
|
|
6
|
+
var ve = /* @__PURE__ */ e((e, t) => {
|
|
7
7
|
let n = e.__vccOpts || e;
|
|
8
8
|
for (let [e, r] of t) n[e] = r;
|
|
9
9
|
return n;
|
|
10
|
-
}, "default"),
|
|
10
|
+
}, "default"), ye = {}, H = { class: "spinner max-w-sm" };
|
|
11
11
|
function _sfc_render(e, t) {
|
|
12
|
-
return
|
|
12
|
+
return M(), x("div", H, [...t[0] || (t[0] = [S("svg", {
|
|
13
13
|
class: "ring-circular h-full w-full origin-center",
|
|
14
14
|
viewBox: "25 25 50 50"
|
|
15
15
|
}, [S("circle", {
|
|
@@ -23,30 +23,9 @@ function _sfc_render(e, t) {
|
|
|
23
23
|
"stroke-miterlimit": "30"
|
|
24
24
|
})], -1)])]);
|
|
25
25
|
}
|
|
26
|
-
var
|
|
27
|
-
{
|
|
28
|
-
mode: "self",
|
|
29
|
-
label: "Overview",
|
|
30
|
-
icon: "i-tabler-user-square-rounded"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
mode: "talk",
|
|
34
|
-
label: "Talk",
|
|
35
|
-
icon: "i-tabler-phone"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
mode: "chat",
|
|
39
|
-
label: "Chat",
|
|
40
|
-
icon: "i-tabler-message-circle"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
mode: "info",
|
|
44
|
-
label: "About",
|
|
45
|
-
icon: "i-tabler-user-circle"
|
|
46
|
-
}
|
|
47
|
-
];
|
|
26
|
+
var be = /*#__PURE__*/ ve(ye, [["render", _sfc_render]]);
|
|
48
27
|
//#endregion
|
|
49
|
-
//#region
|
|
28
|
+
//#region bot/VoiceRecorderController.ts
|
|
50
29
|
function formatVoiceRecordingDuration(e) {
|
|
51
30
|
let t = Math.max(0, Math.floor(e.ms / 1e3));
|
|
52
31
|
return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
|
|
@@ -61,12 +40,12 @@ function recorderMimeType() {
|
|
|
61
40
|
"audio/webm"
|
|
62
41
|
].find((e) => MediaRecorder.isTypeSupported?.(e)) || "";
|
|
63
42
|
}
|
|
64
|
-
var
|
|
43
|
+
var U = 400, VoiceRecorderController = class extends a {
|
|
65
44
|
constructor(e) {
|
|
66
|
-
super("VoiceRecorderController", e), t(this, "state",
|
|
45
|
+
super("VoiceRecorderController", e), t(this, "state", P({
|
|
67
46
|
phase: "idle",
|
|
68
47
|
elapsedMs: 0
|
|
69
|
-
})), t(this, "isActive",
|
|
48
|
+
})), t(this, "isActive", _(() => this.state.value.phase !== "idle")), t(this, "isBusy", _(() => this.state.value.phase !== "idle")), t(this, "elapsedLabel", _(() => formatVoiceRecordingDuration({ ms: this.state.value.elapsedMs }))), t(this, "statusText", _(() => this.state.value.phase === "preparing" ? "Starting microphone" : this.state.value.phase === "sending" ? "Sending voice message" : "Release to send")), t(this, "recorder", void 0), t(this, "stream", void 0), t(this, "chunks", []), t(this, "timer", void 0), t(this, "startedAt", 0), t(this, "cancelOnStop", !1), t(this, "stopAfterStart", !1), t(this, "startToken", 0);
|
|
70
49
|
}
|
|
71
50
|
get canUseBrowserRecording() {
|
|
72
51
|
return !!this.settings.getUserMedia || typeof navigator < "u" && !!navigator.mediaDevices?.getUserMedia && typeof MediaRecorder < "u";
|
|
@@ -95,7 +74,7 @@ var q = 400, VoiceRecorderController = class extends o {
|
|
|
95
74
|
this.stream = t, this.recorder = r, this.chunks = [], r.addEventListener("dataavailable", (e) => {
|
|
96
75
|
e.data.size > 0 && this.chunks.push(e.data);
|
|
97
76
|
}), r.addEventListener("stop", async () => {
|
|
98
|
-
let e = new Blob(this.chunks, { type: r.mimeType || n || "audio/webm" }), t = this.now() - this.startedAt, i = !this.cancelOnStop && e.size > 0 && t >=
|
|
77
|
+
let e = new Blob(this.chunks, { type: r.mimeType || n || "audio/webm" }), t = this.now() - this.startedAt, i = !this.cancelOnStop && e.size > 0 && t >= U;
|
|
99
78
|
if (this.stopCapture(), !i) {
|
|
100
79
|
this.reset();
|
|
101
80
|
return;
|
|
@@ -174,11 +153,11 @@ var q = 400, VoiceRecorderController = class extends o {
|
|
|
174
153
|
}
|
|
175
154
|
};
|
|
176
155
|
//#endregion
|
|
177
|
-
//#region
|
|
156
|
+
//#region bot/work-journal.ts
|
|
178
157
|
function durableJournalOutcome(e) {
|
|
179
158
|
return e.turnOutcome === "failed" ? "failed" : e.turnOutcome === "stopped" ? "stopped" : e.sender === "system" ? "failed" : "completed";
|
|
180
159
|
}
|
|
181
|
-
var
|
|
160
|
+
var W = {
|
|
182
161
|
finishing: "Finishing up",
|
|
183
162
|
slowHint: "Taking longer than usual.",
|
|
184
163
|
completed: "Work complete",
|
|
@@ -186,7 +165,7 @@ var ye = {
|
|
|
186
165
|
stopped: "Stopped",
|
|
187
166
|
notifyHint: "Taking longer than usual. You can leave and I’ll notify you when it’s ready.",
|
|
188
167
|
leaveHint: "Taking longer than usual. You can leave this chat while I work."
|
|
189
|
-
},
|
|
168
|
+
}, G = 1e4, Se = 15e3, Ce = 6e4, we = 3;
|
|
190
169
|
function toMs(e) {
|
|
191
170
|
if (!e) return;
|
|
192
171
|
let t = Date.parse(e);
|
|
@@ -240,7 +219,7 @@ function buildWorkJournalModel(e) {
|
|
|
240
219
|
terminal: {
|
|
241
220
|
id: "work-complete",
|
|
242
221
|
tone: "completed",
|
|
243
|
-
label:
|
|
222
|
+
label: W.completed
|
|
244
223
|
}
|
|
245
224
|
};
|
|
246
225
|
if (n === "failed") {
|
|
@@ -254,7 +233,7 @@ function buildWorkJournalModel(e) {
|
|
|
254
233
|
terminal: {
|
|
255
234
|
id: "work-failed",
|
|
256
235
|
tone: "failed",
|
|
257
|
-
label:
|
|
236
|
+
label: W.failed,
|
|
258
237
|
...o && e?.note ? { note: e.note } : {}
|
|
259
238
|
}
|
|
260
239
|
};
|
|
@@ -268,25 +247,25 @@ function buildWorkJournalModel(e) {
|
|
|
268
247
|
terminal: {
|
|
269
248
|
id: "work-stopped",
|
|
270
249
|
tone: "stopped",
|
|
271
|
-
label:
|
|
250
|
+
label: W.stopped
|
|
272
251
|
}
|
|
273
252
|
};
|
|
274
253
|
}
|
|
275
254
|
let { visibleRows: s, hiddenRows: c } = splitRows(milestoneRows(t, /* @__PURE__ */ new Set())), u = t.filter((e) => e.status === "started").sort(byEvent).pop(), f = t.reduce((e, t) => Math.max(e, eventMs(t)), a ?? -Infinity), p = Number.isFinite(f) ? f : r, m = t.reduce((e, t) => {
|
|
276
255
|
let n = toMs(t.startedAt) ?? toMs(t.endedAt);
|
|
277
256
|
return n === void 0 ? e : Math.min(e, n);
|
|
278
|
-
}, Infinity), h = p +
|
|
257
|
+
}, Infinity), h = p + G, _ = (Number.isFinite(m) ? m : p) + Ce, v = r >= h, b = u || v ? {
|
|
279
258
|
id: u?.activityId ?? "work-active",
|
|
280
259
|
tone: "active",
|
|
281
|
-
label: u?.label ??
|
|
282
|
-
} : void 0,
|
|
260
|
+
label: u?.label ?? W.finishing
|
|
261
|
+
} : void 0, x = v ? r >= _ ? i ? W.notifyHint : W.leaveHint : W.slowHint : void 0, S = [h, _].filter((e) => e > r).sort((e, t) => e - t)[0];
|
|
283
262
|
return {
|
|
284
263
|
outcome: n,
|
|
285
264
|
visibleRows: s,
|
|
286
265
|
hiddenRows: c,
|
|
287
|
-
...
|
|
288
|
-
...
|
|
289
|
-
...
|
|
266
|
+
...b ? { terminal: b } : {},
|
|
267
|
+
...x ? { hint: x } : {},
|
|
268
|
+
...S === void 0 ? {} : { nextBoundaryAtMs: S }
|
|
290
269
|
};
|
|
291
270
|
}
|
|
292
271
|
function buildLiveTurnBlocks(e) {
|
|
@@ -344,12 +323,12 @@ function buildLiveTurnBlocks(e) {
|
|
|
344
323
|
}), s;
|
|
345
324
|
}
|
|
346
325
|
//#endregion
|
|
347
|
-
//#region
|
|
326
|
+
//#region bot/BotController.ts
|
|
348
327
|
var Te = /* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP"]), Ee = /* @__PURE__ */ new Set([
|
|
349
328
|
...Te,
|
|
350
329
|
"EMPTY_STREAM",
|
|
351
330
|
"RATE_LIMIT"
|
|
352
|
-
]), De = /* @__PURE__ */ new Set(["
|
|
331
|
+
]), De = /* @__PURE__ */ new Set(["bot_deleted", "BOT_DELETED"]), Oe = {
|
|
353
332
|
CREDIT_LIMIT: "billing_budget_reached",
|
|
354
333
|
OVERAGE_CAP: "billing_runaway_cap"
|
|
355
334
|
};
|
|
@@ -375,7 +354,7 @@ function presentChatStreamError(e) {
|
|
|
375
354
|
bucket: t,
|
|
376
355
|
...n
|
|
377
356
|
},
|
|
378
|
-
sendBlockedReason: "
|
|
357
|
+
sendBlockedReason: "bot_deleted"
|
|
379
358
|
} : {
|
|
380
359
|
surface: "transient",
|
|
381
360
|
issue: {
|
|
@@ -387,9 +366,9 @@ function presentChatStreamError(e) {
|
|
|
387
366
|
}
|
|
388
367
|
function transcriptMessageForChatStreamError(e) {
|
|
389
368
|
let t = Oe[e.code];
|
|
390
|
-
return t ?
|
|
369
|
+
return t ? r[t].oneLine : e.error;
|
|
391
370
|
}
|
|
392
|
-
var
|
|
371
|
+
var BotChatController = class extends a {
|
|
393
372
|
isQueuedMessage(e) {
|
|
394
373
|
return this.queuedMessageIdSet.value.has(e);
|
|
395
374
|
}
|
|
@@ -402,9 +381,9 @@ var AgentChatController = class extends o {
|
|
|
402
381
|
return this.conversationId;
|
|
403
382
|
}
|
|
404
383
|
createVoiceClient(e) {
|
|
405
|
-
let { sdk: t, createVoiceClientFn: n } = this.settings, r = this.
|
|
384
|
+
let { sdk: t, createVoiceClientFn: n } = this.settings, r = this._bot.botId.value, i = this._bot.orgId.value;
|
|
406
385
|
if (!(!t?.activeUser.value || !r || !i)) return n?.({
|
|
407
|
-
|
|
386
|
+
botId: r,
|
|
408
387
|
orgId: i,
|
|
409
388
|
conversationId: this.conversationId,
|
|
410
389
|
handlers: e
|
|
@@ -414,19 +393,19 @@ var AgentChatController = class extends o {
|
|
|
414
393
|
await this.settings.refreshMessagesFn?.();
|
|
415
394
|
}
|
|
416
395
|
constructor(e) {
|
|
417
|
-
super("
|
|
396
|
+
super("BotChatController", e), t(this, "isTextMode", !1), t(this, "lastMessage", {
|
|
418
397
|
hash: "",
|
|
419
398
|
time: 0
|
|
420
|
-
}), t(this, "isConnecting", !1), t(this, "turnEpoch", 0), t(this, "nextStreamToken", 0), t(this, "runningStreamToken", void 0), t(this, "suppressedStreamTokens", /* @__PURE__ */ new Set()), t(this, "queuedMessageIdSet",
|
|
399
|
+
}), t(this, "isConnecting", !1), t(this, "turnEpoch", 0), t(this, "nextStreamToken", 0), t(this, "runningStreamToken", void 0), t(this, "suppressedStreamTokens", /* @__PURE__ */ new Set()), t(this, "queuedMessageIdSet", P(/* @__PURE__ */ new Set())), t(this, "queuedMessageIds", _(() => this.queuedMessageIdSet.value)), t(this, "boundaryTimer", void 0), t(this, "nowMs", I(Date.now())), t(this, "toolActivityTiming", I({})), t(this, "lastVisibleProgressAtMs", I()), t(this, "liveSegments", I([])), t(this, "liveStreamMessageId", I(void 0)), t(this, "conversationId", void 0), t(this, "textState", P({
|
|
421
400
|
isActive: !1,
|
|
422
401
|
isConnected: !1,
|
|
423
402
|
isThinking: !1,
|
|
424
403
|
connectionStatus: "disconnected"
|
|
425
|
-
})), t(this, "
|
|
404
|
+
})), t(this, "botMode", P("self")), t(this, "sharedMessages", P([])), t(this, "composerState", P({
|
|
426
405
|
text: "",
|
|
427
406
|
pendingAttachments: [],
|
|
428
407
|
isUploading: !1
|
|
429
|
-
})), t(this, "workJournal",
|
|
408
|
+
})), t(this, "workJournal", _(() => {
|
|
430
409
|
let e = this.textState.value.isThinking ? "running" : this.textState.value.turnOutcome;
|
|
431
410
|
if (!e) return;
|
|
432
411
|
let t = this.textState.value.toolActivities;
|
|
@@ -437,7 +416,7 @@ var AgentChatController = class extends o {
|
|
|
437
416
|
canNotifyOnCompletion: !1,
|
|
438
417
|
lastVisibleProgressAtMs: this.lastVisibleProgressAtMs.value
|
|
439
418
|
});
|
|
440
|
-
})), t(this, "liveTurnBlocks",
|
|
419
|
+
})), t(this, "liveTurnBlocks", _(() => {
|
|
441
420
|
if (!this.textState.value.isThinking) return [];
|
|
442
421
|
let e = this.textState.value.toolActivities ?? [], t = this.liveSegments.value;
|
|
443
422
|
return !t.length && !e.length ? [] : buildLiveTurnBlocks({
|
|
@@ -447,29 +426,29 @@ var AgentChatController = class extends o {
|
|
|
447
426
|
canNotifyOnCompletion: !1,
|
|
448
427
|
lastVisibleProgressAtMs: this.lastVisibleProgressAtMs.value
|
|
449
428
|
});
|
|
450
|
-
})), t(this, "canUseComposer",
|
|
429
|
+
})), t(this, "canUseComposer", _(() => this.textState.value.sendBlockedReason !== "bot_deleted" && !this.composerState.value.isUploading)), t(this, "canAttachFile", _(() => !!this.settings.uploadFileFn)), t(this, "canRecordAudio", _(() => this.canAttachFile.value && this.canUseComposer.value && !this.composerState.value.text.trim() && this.composerState.value.pendingAttachments.length === 0)), t(this, "voiceRecorder", new VoiceRecorderController({
|
|
451
430
|
getCanRecord: () => this.canRecordAudio.value,
|
|
452
431
|
getUploadFn: () => {
|
|
453
432
|
let e = this.settings.uploadFileFn;
|
|
454
433
|
return e ? (t) => e({ file: t }) : void 0;
|
|
455
434
|
},
|
|
456
435
|
getChatController: () => this
|
|
457
|
-
})), t(this, "canSend",
|
|
436
|
+
})), t(this, "canSend", _(() => (this.composerState.value.text.trim().length > 0 || this.composerState.value.pendingAttachments.length > 0) && this.canUseComposer.value && !this.voiceRecorder.isBusy.value)), t(this, "canStop", _(() => this.textState.value.isThinking && !this.composerState.value.isUploading && !this.voiceRecorder.isBusy.value)), t(this, "composerAction", _(() => this.canSend.value ? "send" : this.canStop.value ? "stop" : "idle")), t(this, "composerShowsSecondaryStop", _(() => this.canStop.value && this.composerAction.value === "send")), t(this, "canStartVoice", _(() => {
|
|
458
437
|
let e = this.settings.sdk;
|
|
459
|
-
return this.textState.value.sendBlockedReason !== "
|
|
460
|
-
})), t(this, "
|
|
438
|
+
return this.textState.value.sendBlockedReason !== "bot_deleted" && !!e?.activeUser.value && !!this._bot.botId.value && !!this._bot.orgId.value && !!this.settings.createVoiceClientFn && voiceBrowserSupported();
|
|
439
|
+
})), t(this, "_bot", void 0), t(this, "localMessageSeq", 0), this._bot = e.bot, this.setupModeWatcher(), this.setupAvailabilityWatcher(), this.setupBoundaryWatcher();
|
|
461
440
|
}
|
|
462
441
|
get chatEnabled() {
|
|
463
|
-
let e = this.
|
|
464
|
-
return this.
|
|
442
|
+
let e = this._bot.state.value.lifecycle;
|
|
443
|
+
return this._bot.lifecycle.value === void 0 ? this._bot.desiredStatus.value === "active" : e === "running";
|
|
465
444
|
}
|
|
466
445
|
get chatUnavailableReason() {
|
|
467
446
|
if (this.chatEnabled) return;
|
|
468
|
-
let e = this.
|
|
469
|
-
return t === "starting" ? `${e} is waking up` : t === "stopping" ? `${e} is going to sleep` : t === "stopped" ? `${e} is asleep` : this.
|
|
447
|
+
let e = this._bot.displayName.value, t = this._bot.state.value.lifecycle;
|
|
448
|
+
return t === "starting" ? `${e} is waking up` : t === "stopping" ? `${e} is going to sleep` : t === "stopped" ? `${e} is asleep` : this._bot.desiredStatus.value === "active" ? `${e} is unavailable` : `${e} is offline`;
|
|
470
449
|
}
|
|
471
450
|
mapChatError(e) {
|
|
472
|
-
return e.includes("429") || e.includes("Too many") ? "Too many messages. Please wait a moment." : e.includes("503") || e.includes("not available") ? "
|
|
451
|
+
return e.includes("429") || e.includes("Too many") ? "Too many messages. Please wait a moment." : e.includes("503") || e.includes("not available") ? "Bot is currently offline." : e.includes("timed out") ? "This request timed out. Try again in a few minutes." : e.includes("starting up") ? "Bot is starting up. Please try again." : e.includes("404") ? "Bot not found." : e.includes("[no-reply]") ? "The reply didn't make it back. Refresh to see if it landed." : e.includes("[stream-open]") || e.includes("[stream-read]") ? "Lost connection mid-reply. Try again." : e.includes("[api]") ? "Couldn't send. Try again." : "Something went wrong. Try again.";
|
|
473
452
|
}
|
|
474
453
|
isTransientError(e) {
|
|
475
454
|
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]");
|
|
@@ -497,6 +476,20 @@ var AgentChatController = class extends o {
|
|
|
497
476
|
notify(e) {
|
|
498
477
|
e && this.addMessage(e, "system");
|
|
499
478
|
}
|
|
479
|
+
get canReportMessages() {
|
|
480
|
+
return !!this.settings.reportMessageFn;
|
|
481
|
+
}
|
|
482
|
+
async reportMessage(e) {
|
|
483
|
+
let t = this.settings.reportMessageFn;
|
|
484
|
+
if (t) try {
|
|
485
|
+
await t({ messageId: e }), this.notify("Reported. Our team will review this message.");
|
|
486
|
+
} catch (t) {
|
|
487
|
+
this.logger.warn("reportMessage failed", {
|
|
488
|
+
messageId: e,
|
|
489
|
+
error: t instanceof Error ? t.message : String(t)
|
|
490
|
+
}), this.notify("Could not report that message.");
|
|
491
|
+
}
|
|
492
|
+
}
|
|
500
493
|
setComposerText(e) {
|
|
501
494
|
this.composerState.value = {
|
|
502
495
|
...this.composerState.value,
|
|
@@ -534,14 +527,14 @@ var AgentChatController = class extends o {
|
|
|
534
527
|
};
|
|
535
528
|
}
|
|
536
529
|
addOfflineSystemReply() {
|
|
537
|
-
let e = this.
|
|
530
|
+
let e = this._bot.displayName.value || "Your assistant", t = this._bot.state.value.blocker;
|
|
538
531
|
if (t) {
|
|
539
532
|
let e = t.actionUrl.startsWith("pagelines://") ? this.settings.billingUrl : t.actionUrl, n = [`${t.title}.${t.help ? ` ${t.help}` : ""}`, t.actionLabel && e ? `[${t.actionLabel}](${e})` : t.actionLabel || ""].filter(Boolean).join(" "), r = this.sharedMessages.value[this.sharedMessages.value.length - 1];
|
|
540
533
|
if (r?.sender === "system" && r.text === n) return;
|
|
541
534
|
this.addMessage(n, "system");
|
|
542
535
|
return;
|
|
543
536
|
}
|
|
544
|
-
let n = this.chatUnavailableReason ?? `${e} is unavailable`, r = this.
|
|
537
|
+
let n = this.chatUnavailableReason ?? `${e} is unavailable`, r = this._bot.state.value.lifecycle === "stopped" || this._bot.desiredStatus.value !== "active", i = this.settings.manageUrl, a = r ? i ? `${n}, so your message can't be answered yet. [Wake ${e}](${i}), then send again.` : `${n}, so your message can't be answered yet. Wake it from the dashboard, then send again.` : `${n}. Give it a moment and send again.`, o = this.sharedMessages.value[this.sharedMessages.value.length - 1];
|
|
545
538
|
o?.sender === "system" && o.text === a || this.addMessage(a, "system");
|
|
546
539
|
}
|
|
547
540
|
async sendComposerMessage() {
|
|
@@ -565,21 +558,8 @@ var AgentChatController = class extends o {
|
|
|
565
558
|
this.composerAction.value === "send" && await this.sendComposerMessage();
|
|
566
559
|
}
|
|
567
560
|
getDynamicSettings() {
|
|
568
|
-
let { sdk: e } = this.settings;
|
|
569
|
-
if (!e) return {
|
|
570
|
-
context: this.settings.context || "",
|
|
571
|
-
firstMessage: this.settings.firstMessage || ""
|
|
572
|
-
};
|
|
573
|
-
let t = e.activeUser.value, n = t?.agents?.find((e) => e.agentId === t.primaryAgentId), r = t ? `
|
|
574
|
-
|
|
575
|
-
Current User:
|
|
576
|
-
- Name: ${n?.name || "Anonymous"}
|
|
577
|
-
- Email: ${t.email}
|
|
578
|
-
- Title: ${n?.title || ""}
|
|
579
|
-
- About: ${n?.summary || ""}
|
|
580
|
-
` : "";
|
|
581
561
|
return {
|
|
582
|
-
context:
|
|
562
|
+
context: this.settings.context || "",
|
|
583
563
|
firstMessage: this.settings.firstMessage || ""
|
|
584
564
|
};
|
|
585
565
|
}
|
|
@@ -606,7 +586,7 @@ Current User:
|
|
|
606
586
|
});
|
|
607
587
|
}
|
|
608
588
|
setupBoundaryWatcher() {
|
|
609
|
-
|
|
589
|
+
ue(() => this.workJournal.value?.nextBoundaryAtMs, (e) => {
|
|
610
590
|
this.scheduleBoundary(e);
|
|
611
591
|
});
|
|
612
592
|
}
|
|
@@ -668,12 +648,12 @@ Current User:
|
|
|
668
648
|
});
|
|
669
649
|
}
|
|
670
650
|
setupModeWatcher() {
|
|
671
|
-
|
|
651
|
+
ue(this.botMode, async (e, t) => {
|
|
672
652
|
this.logger.info(`Mode changed from ${t} to ${e}`), this.isTextMode && (t === "talk" || t === "chat") && await this.endConversation();
|
|
673
653
|
});
|
|
674
654
|
}
|
|
675
655
|
setupAvailabilityWatcher() {
|
|
676
|
-
|
|
656
|
+
ue(() => [this.chatEnabled, this._bot.state.value.lifecycle], ([e]) => {
|
|
677
657
|
if (!(!this.isTextMode || this.isConnecting)) {
|
|
678
658
|
if (e) {
|
|
679
659
|
this.textState.value.isConnected || this.updateState(this.textState, {
|
|
@@ -703,7 +683,7 @@ Current User:
|
|
|
703
683
|
});
|
|
704
684
|
}
|
|
705
685
|
async setMode(e) {
|
|
706
|
-
this.
|
|
686
|
+
this.botMode.value !== e && (this.botMode.value = e);
|
|
707
687
|
}
|
|
708
688
|
async startTextConversation(e = {}) {
|
|
709
689
|
if (this.isConnecting) {
|
|
@@ -749,10 +729,10 @@ Current User:
|
|
|
749
729
|
this.addOfflineSystemReply();
|
|
750
730
|
return;
|
|
751
731
|
}
|
|
752
|
-
if (this.textState.value.sendBlockedReason === "
|
|
732
|
+
if (this.textState.value.sendBlockedReason === "bot_deleted") return;
|
|
753
733
|
let { sdk: r } = this.settings;
|
|
754
|
-
if (!n && !this.
|
|
755
|
-
this.handleError(/* @__PURE__ */ Error("
|
|
734
|
+
if (!n && !this._bot.handle.value) {
|
|
735
|
+
this.handleError(/* @__PURE__ */ Error("Bot handle required for chat"));
|
|
756
736
|
return;
|
|
757
737
|
}
|
|
758
738
|
let i = this.textState.value.isThinking, a = this.sharedMessages.value.length;
|
|
@@ -765,7 +745,15 @@ Current User:
|
|
|
765
745
|
transientIssue: void 0,
|
|
766
746
|
turnOutcome: void 0
|
|
767
747
|
}));
|
|
768
|
-
let
|
|
748
|
+
let f = `stream-${Date.now()}-${c}`, p = !1, m = !1, isCurrentTurn = () => s === this.turnEpoch && !this.suppressedStreamTokens.has(c), onUserMessage = (e) => {
|
|
749
|
+
if (s !== this.turnEpoch || !o) return;
|
|
750
|
+
let t = this.sharedMessages.value;
|
|
751
|
+
if (this.sharedMessages.value = t.some((t) => t.id === e.id) ? t.filter((t) => t.id !== o || t.id === e.id) : t.map((t) => t.id === o ? e : t), this.queuedMessageIdSet.value.has(o)) {
|
|
752
|
+
let t = new Set(this.queuedMessageIdSet.value);
|
|
753
|
+
t.delete(o), t.add(e.id), this.queuedMessageIdSet.value = t;
|
|
754
|
+
}
|
|
755
|
+
o = e.id;
|
|
756
|
+
}, claimLiveTurn = () => {
|
|
769
757
|
this.runningStreamToken !== c && (this.runningStreamToken = c, this.consumeQueuedThrough(o), this.resetWorkJournalTiming(), this.updateState(this.textState, {
|
|
770
758
|
isThinking: !0,
|
|
771
759
|
workingDescription: void 0,
|
|
@@ -775,10 +763,10 @@ Current User:
|
|
|
775
763
|
}));
|
|
776
764
|
}, onDelta = (e, t = "assistant") => {
|
|
777
765
|
if (!isCurrentTurn()) return;
|
|
778
|
-
claimLiveTurn(), this.updateState(this.textState, { workingDescription: void 0 }), t === "assistant" && (this.lastVisibleProgressAtMs.value = Date.now()), p || (p = !0, this.liveStreamMessageId.value =
|
|
779
|
-
id:
|
|
766
|
+
claimLiveTurn(), this.updateState(this.textState, { workingDescription: void 0 }), t === "assistant" && (this.lastVisibleProgressAtMs.value = Date.now()), p || (p = !0, this.liveStreamMessageId.value = f, this.sharedMessages.value = [...this.sharedMessages.value, {
|
|
767
|
+
id: f,
|
|
780
768
|
text: "",
|
|
781
|
-
sender: t === "system" ? "system" : "
|
|
769
|
+
sender: t === "system" ? "system" : "bot",
|
|
782
770
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
783
771
|
}]);
|
|
784
772
|
let n = this.liveSegments.value, r = n[n.length - 1];
|
|
@@ -790,11 +778,11 @@ Current User:
|
|
|
790
778
|
content: e
|
|
791
779
|
}];
|
|
792
780
|
let i = this.sharedMessages.value, a = i[i.length - 1];
|
|
793
|
-
a?.id ===
|
|
781
|
+
a?.id === f && (a.text += e, this.sharedMessages.value = [...i]);
|
|
794
782
|
}, onMessage = (e) => {
|
|
795
783
|
if (!isCurrentTurn()) return;
|
|
796
|
-
if (claimLiveTurn(), m = !0, e.sender === "
|
|
797
|
-
this.liveSegments.value = [], this.liveStreamMessageId.value = void 0, this.sharedMessages.value = this.sharedMessages.value.filter((e) => e.id !==
|
|
784
|
+
if (claimLiveTurn(), m = !0, e.sender === "bot" && u(e.text)) {
|
|
785
|
+
this.liveSegments.value = [], this.liveStreamMessageId.value = void 0, this.sharedMessages.value = this.sharedMessages.value.filter((e) => e.id !== f);
|
|
798
786
|
return;
|
|
799
787
|
}
|
|
800
788
|
p = !0;
|
|
@@ -809,17 +797,12 @@ Current User:
|
|
|
809
797
|
toolActivities: [],
|
|
810
798
|
turnOutcome: void 0
|
|
811
799
|
});
|
|
812
|
-
let i = this.sharedMessages.value, a = i.findIndex((e) => e.id === r.id);
|
|
813
|
-
|
|
800
|
+
let i = this.sharedMessages.value.filter((e) => e.id !== f), a = i.findIndex((e) => e.id === r.id);
|
|
801
|
+
a >= 0 ? this.sharedMessages.value = [
|
|
814
802
|
...i.slice(0, a),
|
|
815
803
|
r,
|
|
816
804
|
...i.slice(a + 1)
|
|
817
|
-
];
|
|
818
|
-
else {
|
|
819
|
-
let e = i[i.length - 1];
|
|
820
|
-
this.sharedMessages.value = e?.id === u ? [...i.slice(0, -1), r] : [...i, r];
|
|
821
|
-
}
|
|
822
|
-
r.sender === "system" && r.issue?.bucket === "account" ? this.updateState(this.textState, { sendBlockedReason: "account" }) : r.sender === "system" && r.issue?.code && De.has(r.issue.code) && this.updateState(this.textState, { sendBlockedReason: "agent_deleted" });
|
|
805
|
+
] : this.sharedMessages.value = [...i, r], r.sender === "system" && r.issue?.bucket === "account" ? this.updateState(this.textState, { sendBlockedReason: "account" }) : r.sender === "system" && r.issue?.code && De.has(r.issue.code) && this.updateState(this.textState, { sendBlockedReason: "bot_deleted" });
|
|
823
806
|
}, onDone = (e) => {
|
|
824
807
|
if (!isCurrentTurn()) return;
|
|
825
808
|
if (!p && !m) {
|
|
@@ -828,7 +811,7 @@ Current User:
|
|
|
828
811
|
}
|
|
829
812
|
this.finishToolActivities("completed");
|
|
830
813
|
let t = this.sharedMessages.value, n = t[t.length - 1];
|
|
831
|
-
n?.id ===
|
|
814
|
+
n?.id === f && n.sender === "bot" && u(n.text) && (this.sharedMessages.value = t.slice(0, -1)), e && (this.conversationId = e), this.updateState(this.textState, {
|
|
832
815
|
isThinking: !1,
|
|
833
816
|
workingDescription: void 0,
|
|
834
817
|
transientIssue: void 0
|
|
@@ -848,7 +831,7 @@ Current User:
|
|
|
848
831
|
turnOutcome: "failed"
|
|
849
832
|
}), this.finishToolActivities("failed");
|
|
850
833
|
let r = this.sharedMessages.value, i = r[r.length - 1];
|
|
851
|
-
if (i?.id ===
|
|
834
|
+
if (i?.id === f && !i.text && (this.sharedMessages.value = r.slice(0, -1)), typeof n == "object" && n.code && n.error) {
|
|
852
835
|
let e = presentChatStreamError(n);
|
|
853
836
|
e.surface === "transient" ? this.updateState(this.textState, {
|
|
854
837
|
isThinking: !1,
|
|
@@ -894,13 +877,14 @@ Current User:
|
|
|
894
877
|
history: this.buildHistory(),
|
|
895
878
|
onDelta,
|
|
896
879
|
onMessage,
|
|
880
|
+
onUserMessage,
|
|
897
881
|
onDone,
|
|
898
882
|
onError,
|
|
899
883
|
onStatus,
|
|
900
884
|
onToolActivity,
|
|
901
885
|
onWorkingEnd
|
|
902
886
|
}) : r.chat.chatStreamPublic({
|
|
903
|
-
handle: this.
|
|
887
|
+
handle: this._bot.handle.value,
|
|
904
888
|
message: e,
|
|
905
889
|
attachments: t,
|
|
906
890
|
anonymousId: r.user.generateAnonId(),
|
|
@@ -915,6 +899,8 @@ Current User:
|
|
|
915
899
|
}));
|
|
916
900
|
} catch (e) {
|
|
917
901
|
onError(e.message || "Something went wrong");
|
|
902
|
+
} finally {
|
|
903
|
+
this.runningStreamToken === c && (this.runningStreamToken = void 0);
|
|
918
904
|
}
|
|
919
905
|
}
|
|
920
906
|
async stopChatTurn() {
|
|
@@ -936,7 +922,7 @@ Current User:
|
|
|
936
922
|
}
|
|
937
923
|
}
|
|
938
924
|
buildHistory() {
|
|
939
|
-
return this.sharedMessages.value.filter((e) => e.sender === "user" || e.sender === "
|
|
925
|
+
return this.sharedMessages.value.filter((e) => e.sender === "user" || e.sender === "bot").slice(-20).map((e) => ({
|
|
940
926
|
role: e.sender === "user" ? "user" : "assistant",
|
|
941
927
|
content: e.text,
|
|
942
928
|
...e.attachments?.length ? { attachments: e.attachments } : {}
|
|
@@ -944,13 +930,25 @@ Current User:
|
|
|
944
930
|
}
|
|
945
931
|
loadMessages(e) {
|
|
946
932
|
this.conversationId = e.conversationId;
|
|
947
|
-
let t = this.sharedMessages.value, n = e.messages.filter((e) => e.sender !== "
|
|
948
|
-
this.sharedMessages.value = [
|
|
933
|
+
let t = this.sharedMessages.value, n = e.messages.filter((e) => e.sender !== "bot" || !u(e.text)), r = new Set(n.map((e) => e.id)), i = t.filter((e) => !r.has(e.id)), a = n[0]?.sequence, isBeforePage = (e) => !!a && !!e.sequence && e.sequence < a;
|
|
934
|
+
if (this.sharedMessages.value = [
|
|
935
|
+
...i.filter(isBeforePage),
|
|
936
|
+
...n,
|
|
937
|
+
...i.filter((e) => !isBeforePage(e))
|
|
938
|
+
], this.runningStreamToken !== void 0) return;
|
|
939
|
+
let o = new Set(this.sharedMessages.value.flatMap((e) => e.toolActivities?.map((e) => e.turnId) ?? [])), s = new Set(this.textState.value.turnOutcome === "stopped" ? this.textState.value.toolActivities?.map((e) => e.turnId) : []), c = (e.activeToolActivities ?? []).filter((e) => !o.has(e.turnId) && !s.has(e.turnId));
|
|
940
|
+
c.length ? (c.forEach((e) => this.rememberToolActivity(e)), this.updateState(this.textState, {
|
|
949
941
|
isThinking: !0,
|
|
950
942
|
workingDescription: void 0,
|
|
951
|
-
toolActivities:
|
|
952
|
-
transientIssue: void 0
|
|
953
|
-
|
|
943
|
+
toolActivities: c,
|
|
944
|
+
transientIssue: void 0,
|
|
945
|
+
turnOutcome: void 0
|
|
946
|
+
})) : this.textState.value.toolActivities?.some((e) => o.has(e.turnId)) && this.updateState(this.textState, {
|
|
947
|
+
isThinking: !1,
|
|
948
|
+
workingDescription: void 0,
|
|
949
|
+
toolActivities: [],
|
|
950
|
+
turnOutcome: void 0
|
|
951
|
+
});
|
|
954
952
|
}
|
|
955
953
|
async destroy() {
|
|
956
954
|
this.clearBoundaryTimer(), this.voiceRecorder.teardown(), await this.endConversation();
|
|
@@ -965,28 +963,28 @@ function voiceBrowserSupported() {
|
|
|
965
963
|
return typeof navigator < "u" && !!navigator.mediaDevices?.getUserMedia && typeof RTCPeerConnection < "u";
|
|
966
964
|
}
|
|
967
965
|
//#endregion
|
|
968
|
-
//#region
|
|
966
|
+
//#region bot/utils.ts
|
|
969
967
|
function getImageSrc(e) {
|
|
970
968
|
return e ? typeof e == "string" ? e : e.src || "" : "";
|
|
971
969
|
}
|
|
972
|
-
function
|
|
973
|
-
return getImageSrc(e.cover) || getImageSrc(e.avatar) ||
|
|
970
|
+
function getBotAvatarUrl(e) {
|
|
971
|
+
return getImageSrc(e.cover) || getImageSrc(e.avatar) || c(e.name);
|
|
974
972
|
}
|
|
975
973
|
function handleImageError(e) {
|
|
976
974
|
let t = e.target;
|
|
977
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
975
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = c());
|
|
978
976
|
}
|
|
979
977
|
function parseButtonTemplate(e) {
|
|
980
|
-
let { template: t,
|
|
981
|
-
return t.replace(/{name}/g, n.name || "Assistant").replace(/{title}/g, n.title || "").replace(/{handle}/g, n.handle || "")
|
|
978
|
+
let { template: t, bot: n } = e;
|
|
979
|
+
return t.replace(/{name}/g, n.name || "Assistant").replace(/{title}/g, n.title || "").replace(/{handle}/g, n.handle || "");
|
|
982
980
|
}
|
|
983
981
|
//#endregion
|
|
984
|
-
//#region
|
|
982
|
+
//#region bot/ui/ElBotButton.vue?vue&type=script&setup=true&lang.ts
|
|
985
983
|
var ke = {
|
|
986
984
|
key: 0,
|
|
987
985
|
class: "absolute inset-0 flex items-center justify-center"
|
|
988
986
|
}, Ae = /* @__PURE__ */ k({
|
|
989
|
-
__name: "
|
|
987
|
+
__name: "ElBotButton",
|
|
990
988
|
props: {
|
|
991
989
|
theme: { default: "primary" },
|
|
992
990
|
size: { default: "lg" },
|
|
@@ -998,40 +996,40 @@ var ke = {
|
|
|
998
996
|
iconAfter: {}
|
|
999
997
|
},
|
|
1000
998
|
setup(e) {
|
|
1001
|
-
let t =
|
|
999
|
+
let t = _(() => ({
|
|
1002
1000
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
1003
1001
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
1004
1002
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
1005
1003
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20",
|
|
1006
1004
|
dark: "bg-theme-900 border-transparent hover:bg-theme-800"
|
|
1007
|
-
})[e.theme]), n =
|
|
1005
|
+
})[e.theme]), n = _(() => ({
|
|
1008
1006
|
sm: "px-4 py-2 text-sm",
|
|
1009
1007
|
md: "px-6 py-3 text-base",
|
|
1010
1008
|
lg: "px-8 py-4 text-base"
|
|
1011
|
-
})[e.size]), r =
|
|
1009
|
+
})[e.size]), r = _(() => ({
|
|
1012
1010
|
sm: "size-4",
|
|
1013
1011
|
md: "size-4",
|
|
1014
1012
|
lg: "size-5"
|
|
1015
1013
|
})[e.size]);
|
|
1016
|
-
return (i, a) => (
|
|
1017
|
-
e.icon ? (
|
|
1014
|
+
return (i, a) => (M(), x("button", { 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, n.value]]) }, [e.loading ? (M(), x("div", ke, [...a[0] || (a[0] = [S("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)])])) : b("", !0), S("span", { class: A(["flex items-center gap-2 transition-opacity duration-200", e.loading ? "opacity-0" : "opacity-100"]) }, [
|
|
1015
|
+
e.icon ? (M(), x("i", {
|
|
1018
1016
|
key: 0,
|
|
1019
|
-
class:
|
|
1017
|
+
class: A([e.icon, r.value])
|
|
1020
1018
|
}, null, 2)) : b("", !0),
|
|
1021
|
-
|
|
1022
|
-
e.iconAfter ? (
|
|
1019
|
+
ae(i.$slots, "default"),
|
|
1020
|
+
e.iconAfter ? (M(), x("i", {
|
|
1023
1021
|
key: 1,
|
|
1024
|
-
class:
|
|
1022
|
+
class: A([e.iconAfter, r.value])
|
|
1025
1023
|
}, null, 2)) : b("", !0)
|
|
1026
1024
|
], 2)], 2));
|
|
1027
1025
|
}
|
|
1028
1026
|
}), je = ["value"], Me = /* @__PURE__ */ k({
|
|
1029
|
-
__name: "
|
|
1027
|
+
__name: "BotInputEmail",
|
|
1030
1028
|
props: { modelValue: { default: "" } },
|
|
1031
1029
|
emits: ["update:modelValue"],
|
|
1032
1030
|
setup(e, { emit: t }) {
|
|
1033
1031
|
let n = t;
|
|
1034
|
-
return (t, r) => (
|
|
1032
|
+
return (t, r) => (M(), x("input", {
|
|
1035
1033
|
name: "username",
|
|
1036
1034
|
type: "email",
|
|
1037
1035
|
inputmode: "email",
|
|
@@ -1047,7 +1045,7 @@ var ke = {
|
|
|
1047
1045
|
}, null, 40, je));
|
|
1048
1046
|
}
|
|
1049
1047
|
}), Ne = ["placeholder", "value"], Pe = /* @__PURE__ */ k({
|
|
1050
|
-
__name: "
|
|
1048
|
+
__name: "BotInputOneTimeCode",
|
|
1051
1049
|
props: {
|
|
1052
1050
|
modelValue: {},
|
|
1053
1051
|
length: {},
|
|
@@ -1055,15 +1053,15 @@ var ke = {
|
|
|
1055
1053
|
},
|
|
1056
1054
|
emits: ["update:modelValue", "autoSubmit"],
|
|
1057
1055
|
setup(e, { emit: t }) {
|
|
1058
|
-
let n = e, r = t, i =
|
|
1059
|
-
|
|
1056
|
+
let n = e, r = t, i = P(null), a = _(() => "0".repeat(n.length));
|
|
1057
|
+
re(() => {
|
|
1060
1058
|
n.focusFirst && !("ontouchstart" in window) && i.value?.focus();
|
|
1061
1059
|
});
|
|
1062
1060
|
function onInput(e) {
|
|
1063
1061
|
let t = e.target.value.replace(/\D/g, "").slice(0, n.length);
|
|
1064
1062
|
r("update:modelValue", t), t.length === n.length && r("autoSubmit", t);
|
|
1065
1063
|
}
|
|
1066
|
-
return (t, n) => (
|
|
1064
|
+
return (t, n) => (M(), x("input", {
|
|
1067
1065
|
ref_key: "input",
|
|
1068
1066
|
ref: i,
|
|
1069
1067
|
name: "one-time-code",
|
|
@@ -1087,7 +1085,7 @@ var ke = {
|
|
|
1087
1085
|
}, ze = { class: "min-w-0" }, Be = /* @__PURE__ */ k({
|
|
1088
1086
|
__name: "ElModeHeader",
|
|
1089
1087
|
props: {
|
|
1090
|
-
|
|
1088
|
+
bot: {},
|
|
1091
1089
|
size: { default: "md" },
|
|
1092
1090
|
isOnline: {
|
|
1093
1091
|
type: Boolean,
|
|
@@ -1096,20 +1094,20 @@ var ke = {
|
|
|
1096
1094
|
layout: { default: "centered" }
|
|
1097
1095
|
},
|
|
1098
1096
|
setup(e) {
|
|
1099
|
-
return (t, n) => (
|
|
1100
|
-
src: e.
|
|
1101
|
-
alt: e.
|
|
1097
|
+
return (t, n) => (M(), x("div", { class: A(["flex gap-4", [e.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"]]) }, [S("div", Fe, [S("div", { class: A(["rounded-full overflow-hidden border-white", e.size === "lg" ? "w-20 h-20 sm:w-24 sm:h-24 border-4" : "w-16 sm:size-16 border-2"]) }, [S("img", {
|
|
1098
|
+
src: e.bot.avatarUrl.value,
|
|
1099
|
+
alt: e.bot.displayName.value,
|
|
1102
1100
|
class: "w-full h-full object-cover",
|
|
1103
|
-
onError: n[0] || (n[0] = (...e) =>
|
|
1104
|
-
}, null, 40, Ie)], 2), S("div", Le, [e.isOnline ? (
|
|
1101
|
+
onError: n[0] || (n[0] = (...e) => B(handleImageError) && B(handleImageError)(...e))
|
|
1102
|
+
}, null, 40, Ie)], 2), S("div", Le, [e.isOnline ? (M(), x(m, { key: 0 }, [n[1] || (n[1] = S("div", {
|
|
1105
1103
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
1106
1104
|
style: { "animation-duration": "3s" }
|
|
1107
|
-
}, null, -1)), n[2] || (n[2] = S("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))], 64)) : (
|
|
1105
|
+
}, null, -1)), n[2] || (n[2] = S("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))], 64)) : (M(), x("div", Re))])]), S("div", ze, [S("h1", { class: A(["font-light text-white mb-1 truncate", [e.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight", e.layout === "horizontal" ? "text-white/95" : ""]]) }, R(e.bot.displayName.value), 3), S("p", { class: A(["font-light line-clamp-1", [e.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base", e.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"]]) }, R(e.layout === "horizontal" ? e.bot.title.value || "Assistant" : e.bot.title.value), 3)])], 2));
|
|
1108
1106
|
}
|
|
1109
1107
|
}), Ve = { class: "relative shrink-0 rounded-full" }, He = ["src", "alt"], Ue = ["src", "alt"], We = ["aria-label"], Ge = /* @__PURE__ */ k({
|
|
1110
|
-
__name: "
|
|
1108
|
+
__name: "BotAvatar",
|
|
1111
1109
|
props: {
|
|
1112
|
-
|
|
1110
|
+
bot: {},
|
|
1113
1111
|
showStatus: {
|
|
1114
1112
|
type: Boolean,
|
|
1115
1113
|
default: !0
|
|
@@ -1129,38 +1127,38 @@ var ke = {
|
|
|
1129
1127
|
amber: "bg-amber-500",
|
|
1130
1128
|
red: "bg-red-500",
|
|
1131
1129
|
grey: "bg-theme-300"
|
|
1132
|
-
}, n =
|
|
1133
|
-
let n = e.
|
|
1130
|
+
}, n = _(() => {
|
|
1131
|
+
let n = e.bot.state.value;
|
|
1134
1132
|
return e.showStatus && n.lifecycle !== "unknown" ? t[n.color] : null;
|
|
1135
1133
|
}), r = {
|
|
1136
1134
|
width: "clamp(7px, 14%, 14px)",
|
|
1137
1135
|
height: "clamp(7px, 14%, 14px)",
|
|
1138
1136
|
top: "calc(14.6% - clamp(3.5px, 7%, 7px))",
|
|
1139
1137
|
right: "calc(14.6% - clamp(3.5px, 7%, 7px))"
|
|
1140
|
-
}, i =
|
|
1141
|
-
return (t, a) => (
|
|
1138
|
+
}, i = _(() => e.isLight ? "ring-white" : "ring-theme-900");
|
|
1139
|
+
return (t, a) => (M(), x("div", Ve, [
|
|
1142
1140
|
S("img", {
|
|
1143
|
-
src: e.
|
|
1144
|
-
alt: e.
|
|
1145
|
-
class:
|
|
1141
|
+
src: e.bot.avatarUrl.value,
|
|
1142
|
+
alt: e.bot.displayName.value,
|
|
1143
|
+
class: A(["size-full rounded-full object-cover ring-1", e.isLight ? "ring-black/5" : "ring-white/10"])
|
|
1146
1144
|
}, null, 10, He),
|
|
1147
|
-
e.showOwnerMark && e.
|
|
1145
|
+
e.showOwnerMark && e.bot.ownerMarkUrl.value ? (M(), x("img", {
|
|
1148
1146
|
key: 0,
|
|
1149
|
-
src: e.
|
|
1150
|
-
alt: e.
|
|
1151
|
-
class:
|
|
1147
|
+
src: e.bot.ownerMarkUrl.value,
|
|
1148
|
+
alt: e.bot.owner.value?.fullName ? `Owned by ${e.bot.owner.value.fullName}` : "Owner",
|
|
1149
|
+
class: A(["absolute z-10 size-[36%] -bottom-[3%] -left-[3%] rounded-full object-cover ring-2", i.value])
|
|
1152
1150
|
}, null, 10, Ue)) : b("", !0),
|
|
1153
|
-
n.value ? (
|
|
1151
|
+
n.value ? (M(), x("span", {
|
|
1154
1152
|
key: 1,
|
|
1155
1153
|
role: "status",
|
|
1156
|
-
"aria-label": e.
|
|
1157
|
-
class:
|
|
1154
|
+
"aria-label": e.bot.state.value.tooltip,
|
|
1155
|
+
class: A(["absolute z-10 rounded-full ring-2", [n.value, i.value]]),
|
|
1158
1156
|
style: r
|
|
1159
1157
|
}, null, 10, We)) : b("", !0),
|
|
1160
|
-
n.value && e.
|
|
1158
|
+
n.value && e.bot.state.value.lifecycle === "running" ? (M(), x("span", {
|
|
1161
1159
|
key: 2,
|
|
1162
1160
|
"aria-hidden": "true",
|
|
1163
|
-
class:
|
|
1161
|
+
class: A(["pointer-events-none absolute rounded-full animate-ping opacity-50 [animation-duration:3s]", n.value]),
|
|
1164
1162
|
style: r
|
|
1165
1163
|
}, null, 2)) : b("", !0)
|
|
1166
1164
|
]));
|
|
@@ -1180,24 +1178,24 @@ var ke = {
|
|
|
1180
1178
|
key: 0,
|
|
1181
1179
|
class: "sr-only"
|
|
1182
1180
|
}, et = /* @__PURE__ */ k({
|
|
1183
|
-
__name: "
|
|
1181
|
+
__name: "BotToolActivityGroup",
|
|
1184
1182
|
props: {
|
|
1185
1183
|
model: {},
|
|
1186
1184
|
isLight: { type: Boolean }
|
|
1187
1185
|
},
|
|
1188
1186
|
setup(e) {
|
|
1189
|
-
let t = e, n =
|
|
1187
|
+
let t = e, n = I(!1);
|
|
1190
1188
|
function toggle() {
|
|
1191
1189
|
n.value = !n.value;
|
|
1192
1190
|
}
|
|
1193
|
-
let r =
|
|
1191
|
+
let r = _(() => t.model.outcome === "completed"), i = _(() => t.model.hiddenRows.length), a = _(() => t.model.hint ?? (t.model.terminal?.tone === "active" ? t.model.terminal.label : void 0)), o = _(() => {
|
|
1194
1192
|
let e = t.model;
|
|
1195
1193
|
return r.value ? n.value ? e.hiddenRows : [] : [
|
|
1196
1194
|
...n.value ? e.hiddenRows : [],
|
|
1197
1195
|
...e.visibleRows,
|
|
1198
1196
|
...e.terminal ? [e.terminal] : []
|
|
1199
1197
|
];
|
|
1200
|
-
}), s =
|
|
1198
|
+
}), s = _(() => t.isLight ? {
|
|
1201
1199
|
spine: "bg-theme-200",
|
|
1202
1200
|
dashed: "border-theme-300",
|
|
1203
1201
|
doneMark: "text-theme-400",
|
|
@@ -1215,7 +1213,7 @@ var ke = {
|
|
|
1215
1213
|
stoppedSquare: "bg-white/55",
|
|
1216
1214
|
muted: "text-white/55",
|
|
1217
1215
|
ring: "focus-visible:ring-white"
|
|
1218
|
-
}), c =
|
|
1216
|
+
}), c = _(() => {
|
|
1219
1217
|
let e = t.isLight;
|
|
1220
1218
|
return {
|
|
1221
1219
|
done: {
|
|
@@ -1258,16 +1256,16 @@ var ke = {
|
|
|
1258
1256
|
}
|
|
1259
1257
|
};
|
|
1260
1258
|
});
|
|
1261
|
-
return (t, u) => (
|
|
1262
|
-
a.value ? (
|
|
1263
|
-
r.value ? (
|
|
1259
|
+
return (t, u) => (M(), x("div", { class: A(["w-full py-0.5", s.value.muted]) }, [
|
|
1260
|
+
a.value ? (M(), x("span", Ke, R(a.value), 1)) : b("", !0),
|
|
1261
|
+
r.value ? (M(), x("button", {
|
|
1264
1262
|
key: 1,
|
|
1265
1263
|
type: "button",
|
|
1266
1264
|
"data-test": "messaging-tool-activity-summary",
|
|
1267
1265
|
"data-journal-disclosure": "",
|
|
1268
1266
|
"aria-expanded": n.value,
|
|
1269
1267
|
disabled: i.value === 0,
|
|
1270
|
-
class:
|
|
1268
|
+
class: A(["flex min-h-11 items-center gap-x-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-default", s.value.ring]),
|
|
1271
1269
|
onClick: toggle
|
|
1272
1270
|
}, [
|
|
1273
1271
|
u[0] || (u[0] = S("i", {
|
|
@@ -1275,47 +1273,47 @@ var ke = {
|
|
|
1275
1273
|
class: "i-tabler-circle-check size-3.5 shrink-0 text-green-600",
|
|
1276
1274
|
"aria-hidden": "true"
|
|
1277
1275
|
}, null, -1)),
|
|
1278
|
-
S("span", { class:
|
|
1279
|
-
i.value ? (
|
|
1276
|
+
S("span", { class: A(["text-[12.5px] font-medium leading-none", s.value.muted]) }, R(e.model.terminal?.label), 3),
|
|
1277
|
+
i.value ? (M(), x("i", {
|
|
1280
1278
|
key: 0,
|
|
1281
|
-
class:
|
|
1279
|
+
class: A(["size-[13px] shrink-0", [n.value ? "i-tabler-chevron-down" : "i-tabler-chevron-right", s.value.muted]]),
|
|
1282
1280
|
"aria-hidden": "true"
|
|
1283
1281
|
}, null, 2)) : b("", !0)
|
|
1284
|
-
], 10, qe)) : i.value ? (
|
|
1282
|
+
], 10, qe)) : i.value ? (M(), x("button", {
|
|
1285
1283
|
key: 2,
|
|
1286
1284
|
type: "button",
|
|
1287
1285
|
"data-test": "messaging-tool-activity-summary",
|
|
1288
1286
|
"data-journal-disclosure": "",
|
|
1289
1287
|
"aria-expanded": n.value,
|
|
1290
|
-
class:
|
|
1288
|
+
class: A(["flex min-h-11 w-full gap-x-2.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2", s.value.ring]),
|
|
1291
1289
|
onClick: toggle
|
|
1292
1290
|
}, [S("span", Ye, [S("span", {
|
|
1293
1291
|
"data-journal-spine": "dashed",
|
|
1294
|
-
class:
|
|
1295
|
-
}, null, 2)]), S("span", { class:
|
|
1296
|
-
class:
|
|
1292
|
+
class: A(["w-0 border-l border-dashed", s.value.dashed])
|
|
1293
|
+
}, null, 2)]), S("span", { class: A(["flex min-h-[20px] items-center gap-0.5 pb-2 text-[12px] leading-none", s.value.muted]) }, [C(R(i.value) + " earlier updates ", 1), S("i", {
|
|
1294
|
+
class: A(["size-3 shrink-0", n.value ? "i-tabler-chevron-down" : "i-tabler-chevron-right"]),
|
|
1297
1295
|
"aria-hidden": "true"
|
|
1298
1296
|
}, null, 2)], 2)], 10, Je)) : b("", !0),
|
|
1299
|
-
(
|
|
1297
|
+
(M(!0), x(m, null, F(o.value, (e, t) => (M(), x("div", {
|
|
1300
1298
|
key: e.id,
|
|
1301
1299
|
"data-test": "messaging-tool-activity-row",
|
|
1302
1300
|
"data-journal-row": e.tone,
|
|
1303
|
-
class:
|
|
1304
|
-
}, [S("div", Ze, [S("span", Qe, [(
|
|
1301
|
+
class: A([r.value ? "pl-[22px]" : "", "flex gap-x-2.5"])
|
|
1302
|
+
}, [S("div", Ze, [S("span", Qe, [(M(), v(oe(c.value[e.tone].station.tag), {
|
|
1305
1303
|
"data-journal-station": e.tone,
|
|
1306
|
-
class:
|
|
1307
|
-
}, null, 8, ["data-journal-station", "class"]))]), t === o.value.length - 1 ? b("", !0) : (
|
|
1304
|
+
class: A(c.value[e.tone].station.class)
|
|
1305
|
+
}, null, 8, ["data-journal-station", "class"]))]), t === o.value.length - 1 ? b("", !0) : (M(), x("span", {
|
|
1308
1306
|
key: 0,
|
|
1309
|
-
class:
|
|
1310
|
-
}, null, 2))]), S("div", { class:
|
|
1307
|
+
class: A(["w-px flex-1", s.value.spine])
|
|
1308
|
+
}, null, 2))]), S("div", { class: A(["min-w-0 flex-1", t === o.value.length - 1 ? "" : "pb-2"]) }, [S("span", { class: A(["relative block leading-snug", c.value[e.tone].label]) }, [C(R(e.label), 1), c.value[e.tone].statusWord ? (M(), x("span", $e, ", " + R(c.value[e.tone].statusWord), 1)) : b("", !0)], 2), e.note ? (M(), x("p", {
|
|
1311
1309
|
key: 0,
|
|
1312
|
-
class:
|
|
1313
|
-
},
|
|
1314
|
-
!r.value && e.model.hint ? (
|
|
1310
|
+
class: A(["pt-0.5 text-[11.5px] leading-snug", s.value.muted])
|
|
1311
|
+
}, R(e.note), 3)) : b("", !0)], 2)], 10, Xe))), 128)),
|
|
1312
|
+
!r.value && e.model.hint ? (M(), x("p", {
|
|
1315
1313
|
key: 3,
|
|
1316
1314
|
"data-test": "messaging-tool-activity-hint",
|
|
1317
|
-
class:
|
|
1318
|
-
},
|
|
1315
|
+
class: A(["pl-[30px] pt-2.5 text-[12px] leading-snug", s.value.muted])
|
|
1316
|
+
}, R(e.model.hint), 3)) : b("", !0)
|
|
1319
1317
|
], 2));
|
|
1320
1318
|
}
|
|
1321
1319
|
});
|
|
@@ -1360,10 +1358,10 @@ function _unsupportedIterableToArray(e, t) {
|
|
|
1360
1358
|
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? _arrayLikeToArray(e, t) : void 0;
|
|
1361
1359
|
}
|
|
1362
1360
|
}
|
|
1363
|
-
var tt = Object.entries, nt = Object.setPrototypeOf,
|
|
1364
|
-
|
|
1361
|
+
var tt = Object.entries, nt = Object.setPrototypeOf, rt = Object.isFrozen, it = Object.getPrototypeOf, at = Object.getOwnPropertyDescriptor, K = Object.freeze, q = Object.seal, J = Object.create, st = typeof Reflect < "u" && Reflect, ct = st.apply, lt = st.construct;
|
|
1362
|
+
K || (K = function freeze(e) {
|
|
1365
1363
|
return e;
|
|
1366
|
-
}),
|
|
1364
|
+
}), q || (q = function seal(e) {
|
|
1367
1365
|
return e;
|
|
1368
1366
|
}), ct || (ct = function apply(e, t) {
|
|
1369
1367
|
var n = [...arguments].slice(2);
|
|
@@ -1371,7 +1369,7 @@ X || (X = function freeze(e) {
|
|
|
1371
1369
|
}), lt || (lt = function construct(e) {
|
|
1372
1370
|
return new e(...[...arguments].slice(1));
|
|
1373
1371
|
});
|
|
1374
|
-
var ut = unapply(Array.prototype.forEach), dt = unapply(Array.prototype.lastIndexOf), ft = unapply(Array.prototype.pop), pt = unapply(Array.prototype.push), mt = unapply(Array.prototype.splice), ht = Array.isArray, gt = unapply(String.prototype.toLowerCase), _t = unapply(String.prototype.toString), vt = unapply(String.prototype.match), yt = unapply(String.prototype.replace), bt = unapply(String.prototype.indexOf), xt = unapply(String.prototype.trim), St = unapply(Number.prototype.toString),
|
|
1372
|
+
var ut = unapply(Array.prototype.forEach), dt = unapply(Array.prototype.lastIndexOf), ft = unapply(Array.prototype.pop), pt = unapply(Array.prototype.push), mt = unapply(Array.prototype.splice), ht = Array.isArray, gt = unapply(String.prototype.toLowerCase), _t = unapply(String.prototype.toString), vt = unapply(String.prototype.match), yt = unapply(String.prototype.replace), bt = unapply(String.prototype.indexOf), xt = unapply(String.prototype.trim), St = unapply(Number.prototype.toString), Ct = unapply(Boolean.prototype.toString), wt = typeof BigInt > "u" ? null : unapply(BigInt.prototype.toString), X = typeof Symbol > "u" ? null : unapply(Symbol.prototype.toString), Z = unapply(Object.prototype.hasOwnProperty), Tt = unapply(Object.prototype.toString), Q = unapply(RegExp.prototype.test), Et = unconstruct(TypeError);
|
|
1375
1373
|
function unapply(e) {
|
|
1376
1374
|
return function(t) {
|
|
1377
1375
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
@@ -1392,22 +1390,22 @@ function addToSet(e, t) {
|
|
|
1392
1390
|
let i = t[r];
|
|
1393
1391
|
if (typeof i == "string") {
|
|
1394
1392
|
let e = n(i);
|
|
1395
|
-
e !== i && (
|
|
1393
|
+
e !== i && (rt(t) || (t[r] = e), i = e);
|
|
1396
1394
|
}
|
|
1397
1395
|
e[i] = !0;
|
|
1398
1396
|
}
|
|
1399
1397
|
return e;
|
|
1400
1398
|
}
|
|
1401
1399
|
function cleanArray(e) {
|
|
1402
|
-
for (let t = 0; t < e.length; t++)
|
|
1400
|
+
for (let t = 0; t < e.length; t++) Z(e, t) || (e[t] = null);
|
|
1403
1401
|
return e;
|
|
1404
1402
|
}
|
|
1405
1403
|
function clone(e) {
|
|
1406
|
-
let t =
|
|
1404
|
+
let t = J(null);
|
|
1407
1405
|
for (let r of tt(e)) {
|
|
1408
1406
|
var n = _slicedToArray(r, 2);
|
|
1409
1407
|
let i = n[0], a = n[1];
|
|
1410
|
-
|
|
1408
|
+
Z(e, i) && (ht(a) ? t[i] = cleanArray(a) : a && typeof a == "object" && a.constructor === Object ? t[i] = clone(a) : t[i] = a);
|
|
1411
1409
|
}
|
|
1412
1410
|
return t;
|
|
1413
1411
|
}
|
|
@@ -1415,31 +1413,31 @@ function stringifyValue(e) {
|
|
|
1415
1413
|
switch (typeof e) {
|
|
1416
1414
|
case "string": return e;
|
|
1417
1415
|
case "number": return St(e);
|
|
1418
|
-
case "boolean": return
|
|
1419
|
-
case "bigint": return
|
|
1420
|
-
case "symbol": return
|
|
1421
|
-
case "undefined": return
|
|
1416
|
+
case "boolean": return Ct(e);
|
|
1417
|
+
case "bigint": return wt ? wt(e) : "0";
|
|
1418
|
+
case "symbol": return X ? X(e) : "Symbol()";
|
|
1419
|
+
case "undefined": return Tt(e);
|
|
1422
1420
|
case "function":
|
|
1423
1421
|
case "object": {
|
|
1424
|
-
if (e === null) return
|
|
1422
|
+
if (e === null) return Tt(e);
|
|
1425
1423
|
let t = e, n = lookupGetter(t, "toString");
|
|
1426
1424
|
if (typeof n == "function") {
|
|
1427
1425
|
let e = n(t);
|
|
1428
|
-
return typeof e == "string" ? e :
|
|
1426
|
+
return typeof e == "string" ? e : Tt(e);
|
|
1429
1427
|
}
|
|
1430
|
-
return
|
|
1428
|
+
return Tt(e);
|
|
1431
1429
|
}
|
|
1432
|
-
default: return
|
|
1430
|
+
default: return Tt(e);
|
|
1433
1431
|
}
|
|
1434
1432
|
}
|
|
1435
1433
|
function lookupGetter(e, t) {
|
|
1436
1434
|
for (; e !== null;) {
|
|
1437
|
-
let n =
|
|
1435
|
+
let n = at(e, t);
|
|
1438
1436
|
if (n) {
|
|
1439
1437
|
if (n.get) return unapply(n.get);
|
|
1440
1438
|
if (typeof n.value == "function") return unapply(n.value);
|
|
1441
1439
|
}
|
|
1442
|
-
e =
|
|
1440
|
+
e = it(e);
|
|
1443
1441
|
}
|
|
1444
1442
|
function fallbackValue() {
|
|
1445
1443
|
return null;
|
|
@@ -1448,12 +1446,12 @@ function lookupGetter(e, t) {
|
|
|
1448
1446
|
}
|
|
1449
1447
|
function isRegex(e) {
|
|
1450
1448
|
try {
|
|
1451
|
-
return
|
|
1449
|
+
return Q(e, ""), !0;
|
|
1452
1450
|
} catch {
|
|
1453
1451
|
return !1;
|
|
1454
1452
|
}
|
|
1455
1453
|
}
|
|
1456
|
-
var
|
|
1454
|
+
var Dt = K(/* @__PURE__ */ "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".split(".")), Ot = K(/* @__PURE__ */ "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".split(".")), kt = K([
|
|
1457
1455
|
"feBlend",
|
|
1458
1456
|
"feColorMatrix",
|
|
1459
1457
|
"feComponentTransfer",
|
|
@@ -1479,7 +1477,7 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1479
1477
|
"feSpotLight",
|
|
1480
1478
|
"feTile",
|
|
1481
1479
|
"feTurbulence"
|
|
1482
|
-
]),
|
|
1480
|
+
]), At = K([
|
|
1483
1481
|
"animate",
|
|
1484
1482
|
"color-profile",
|
|
1485
1483
|
"cursor",
|
|
@@ -1502,7 +1500,7 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1502
1500
|
"solidcolor",
|
|
1503
1501
|
"unknown",
|
|
1504
1502
|
"use"
|
|
1505
|
-
]),
|
|
1503
|
+
]), jt = K(/* @__PURE__ */ "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".split(".")), Mt = K([
|
|
1506
1504
|
"maction",
|
|
1507
1505
|
"maligngroup",
|
|
1508
1506
|
"malignmark",
|
|
@@ -1518,13 +1516,13 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1518
1516
|
"annotation-xml",
|
|
1519
1517
|
"mprescripts",
|
|
1520
1518
|
"none"
|
|
1521
|
-
]),
|
|
1519
|
+
]), Nt = K(["#text"]), Pt = K(/* @__PURE__ */ "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".split(".")), Ft = K(/* @__PURE__ */ "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.dominant-baseline.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-orientation.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".split(".")), It = K(/* @__PURE__ */ "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".split(".")), Lt = K([
|
|
1522
1520
|
"xlink:href",
|
|
1523
1521
|
"xml:id",
|
|
1524
1522
|
"xlink:title",
|
|
1525
1523
|
"xml:space",
|
|
1526
1524
|
"xmlns:xlink"
|
|
1527
|
-
]),
|
|
1525
|
+
]), Rt = q(/{{[\w\W]*|^[\w\W]*}}/g), zt = q(/<%[\w\W]*|^[\w\W]*%>/g), Bt = q(/\${[\w\W]*/g), Vt = q(/^data-[\-\w.\u00B7-\uFFFF]+$/), Ht = q(/^aria-[\-\w]+$/), Ut = q(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Wt = q(/^(?:\w+script|data):/i), Gt = q(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Kt = q(/^html$/i), qt = q(/^[a-z][.\w]*(-[.\w]+)+$/i), Jt = q(/<[/\w!]/g), Yt = q(/<[/\w]/g), Xt = q(/<\/no(script|embed|frames)/i), Zt = q(/\/>/i), Qt = {
|
|
1528
1526
|
element: 1,
|
|
1529
1527
|
attribute: 2,
|
|
1530
1528
|
text: 3,
|
|
@@ -1537,9 +1535,9 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1537
1535
|
documentType: 10,
|
|
1538
1536
|
documentFragment: 11,
|
|
1539
1537
|
notation: 12
|
|
1540
|
-
},
|
|
1538
|
+
}, $t = function getGlobal() {
|
|
1541
1539
|
return typeof window > "u" ? null : window;
|
|
1542
|
-
},
|
|
1540
|
+
}, en = function _createTrustedTypesPolicy(e, t) {
|
|
1543
1541
|
if (typeof e != "object" || typeof e.createPolicy != "function") return null;
|
|
1544
1542
|
let n = null, r = "data-tt-policy-suffix";
|
|
1545
1543
|
t && t.hasAttribute(r) && (n = t.getAttribute(r));
|
|
@@ -1556,7 +1554,7 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1556
1554
|
} catch {
|
|
1557
1555
|
return console.warn("TrustedTypes policy " + i + " could not be created."), null;
|
|
1558
1556
|
}
|
|
1559
|
-
},
|
|
1557
|
+
}, tn = function _createHooksMap() {
|
|
1560
1558
|
return {
|
|
1561
1559
|
afterSanitizeAttributes: [],
|
|
1562
1560
|
afterSanitizeElements: [],
|
|
@@ -1568,53 +1566,53 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1568
1566
|
uponSanitizeElement: [],
|
|
1569
1567
|
uponSanitizeShadowNode: []
|
|
1570
1568
|
};
|
|
1571
|
-
},
|
|
1572
|
-
return
|
|
1569
|
+
}, nn = function _resolveSetOption(e, t, n, r) {
|
|
1570
|
+
return Z(e, t) && ht(e[t]) ? addToSet(r.base ? clone(r.base) : {}, e[t], r.transform) : n;
|
|
1573
1571
|
};
|
|
1574
1572
|
function createDOMPurify() {
|
|
1575
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
1576
|
-
if (DOMPurify.version = "3.4.12", DOMPurify.removed = [], !e || !e.document || e.document.nodeType !==
|
|
1573
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : $t(), DOMPurify = (e) => createDOMPurify(e);
|
|
1574
|
+
if (DOMPurify.version = "3.4.12", DOMPurify.removed = [], !e || !e.document || e.document.nodeType !== Qt.document || !e.Element) return DOMPurify.isSupported = !1, DOMPurify;
|
|
1577
1575
|
let t = e.document, n = t, r = n.currentScript;
|
|
1578
1576
|
e.DocumentFragment;
|
|
1579
1577
|
let i = e.HTMLTemplateElement, a = e.Node, o = e.Element, s = e.NodeFilter;
|
|
1580
1578
|
e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
|
|
1581
|
-
let c = e.DOMParser, u = e.trustedTypes, f = o.prototype, p = lookupGetter(f, "cloneNode"), m = lookupGetter(f, "remove"), h = lookupGetter(f, "nextSibling"), _ = lookupGetter(f, "childNodes"), v = lookupGetter(f, "parentNode"),
|
|
1579
|
+
let c = e.DOMParser, u = e.trustedTypes, f = o.prototype, p = lookupGetter(f, "cloneNode"), m = lookupGetter(f, "remove"), h = lookupGetter(f, "nextSibling"), _ = lookupGetter(f, "childNodes"), v = lookupGetter(f, "parentNode"), b = lookupGetter(f, "shadowRoot"), x = lookupGetter(f, "attributes"), S = a && a.prototype ? lookupGetter(a.prototype, "nodeType") : null, C = a && a.prototype ? lookupGetter(a.prototype, "nodeName") : null;
|
|
1582
1580
|
if (typeof i == "function") {
|
|
1583
1581
|
let e = t.createElement("template");
|
|
1584
1582
|
e.content && e.content.ownerDocument && (t = e.content.ownerDocument);
|
|
1585
1583
|
}
|
|
1586
|
-
let
|
|
1587
|
-
if (j > 0) throw
|
|
1588
|
-
},
|
|
1589
|
-
|
|
1584
|
+
let T, k = "", te, A = !1, j = 0, ne = function _assertNotInTrustedTypesPolicy() {
|
|
1585
|
+
if (j > 0) throw Et("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
|
|
1586
|
+
}, re = function _createTrustedHTML(e) {
|
|
1587
|
+
ne(), j++;
|
|
1590
1588
|
try {
|
|
1591
|
-
return
|
|
1589
|
+
return T.createHTML(e);
|
|
1592
1590
|
} finally {
|
|
1593
1591
|
j--;
|
|
1594
1592
|
}
|
|
1595
|
-
},
|
|
1596
|
-
|
|
1593
|
+
}, ie = function _createTrustedScriptURL(e) {
|
|
1594
|
+
ne(), j++;
|
|
1597
1595
|
try {
|
|
1598
|
-
return
|
|
1596
|
+
return T.createScriptURL(e);
|
|
1599
1597
|
} finally {
|
|
1600
1598
|
j--;
|
|
1601
1599
|
}
|
|
1602
|
-
},
|
|
1603
|
-
return A || (
|
|
1604
|
-
},
|
|
1605
|
-
DOMPurify.isSupported = typeof tt == "function" && typeof v == "function" &&
|
|
1606
|
-
let
|
|
1600
|
+
}, M = function _getDefaultTrustedTypesPolicy() {
|
|
1601
|
+
return A || (te = en(u, r), A = !0), te;
|
|
1602
|
+
}, P = t, F = P.implementation, ae = P.createNodeIterator, oe = P.createDocumentFragment, I = P.getElementsByTagName, R = n.importNode, B = tn();
|
|
1603
|
+
DOMPurify.isSupported = typeof tt == "function" && typeof v == "function" && F && F.createHTMLDocument !== void 0;
|
|
1604
|
+
let se = Rt, ce = zt, ue = Bt, de = Vt, pe = Ht, he = Wt, _e = Gt, ve = qt, ye = Ut, H = null, be = addToSet({}, [
|
|
1605
|
+
...Dt,
|
|
1606
|
+
...Ot,
|
|
1607
1607
|
...kt,
|
|
1608
|
-
...At,
|
|
1609
1608
|
...jt,
|
|
1610
|
-
...Nt
|
|
1611
|
-
|
|
1612
|
-
|
|
1609
|
+
...Nt
|
|
1610
|
+
]), U = null, W = addToSet({}, [
|
|
1611
|
+
...Pt,
|
|
1612
|
+
...Ft,
|
|
1613
1613
|
...It,
|
|
1614
|
-
...Lt
|
|
1615
|
-
|
|
1616
|
-
...zt
|
|
1617
|
-
]), q = Object.seal(at(null, {
|
|
1614
|
+
...Lt
|
|
1615
|
+
]), G = Object.seal(J(null, {
|
|
1618
1616
|
tagNameCheck: {
|
|
1619
1617
|
writable: !0,
|
|
1620
1618
|
configurable: !1,
|
|
@@ -1633,7 +1631,7 @@ function createDOMPurify() {
|
|
|
1633
1631
|
enumerable: !0,
|
|
1634
1632
|
value: !1
|
|
1635
1633
|
}
|
|
1636
|
-
})),
|
|
1634
|
+
})), Se = null, Ce = null, we = Object.seal(J(null, {
|
|
1637
1635
|
tagCheck: {
|
|
1638
1636
|
writable: !0,
|
|
1639
1637
|
configurable: !1,
|
|
@@ -1646,14 +1644,14 @@ function createDOMPurify() {
|
|
|
1646
1644
|
enumerable: !0,
|
|
1647
1645
|
value: null
|
|
1648
1646
|
}
|
|
1649
|
-
})),
|
|
1647
|
+
})), Te = !0, Ee = !0, De = !1, Oe = !0, ke = !1, Ae = !0, je = !1, Me = !1, Ne = null, Pe = null, Fe = !1, Ie = !1, Le = !1, Re = !1, ze = !0, Be = !1, Ve = "user-content-", He = !0, Ue = !1, We = {}, Ge = null, Ke = addToSet({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), qe = null, Je = addToSet({}, [
|
|
1650
1648
|
"audio",
|
|
1651
1649
|
"video",
|
|
1652
1650
|
"img",
|
|
1653
1651
|
"source",
|
|
1654
1652
|
"image",
|
|
1655
1653
|
"track"
|
|
1656
|
-
]),
|
|
1654
|
+
]), Ye = null, Xe = addToSet({}, [
|
|
1657
1655
|
"alt",
|
|
1658
1656
|
"class",
|
|
1659
1657
|
"for",
|
|
@@ -1668,75 +1666,75 @@ function createDOMPurify() {
|
|
|
1668
1666
|
"value",
|
|
1669
1667
|
"style",
|
|
1670
1668
|
"xmlns"
|
|
1671
|
-
]),
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
], _t),
|
|
1669
|
+
]), Ze = "http://www.w3.org/1998/Math/MathML", Qe = "http://www.w3.org/2000/svg", $e = "http://www.w3.org/1999/xhtml", et = $e, nt = !1, rt = null, it = addToSet({}, [
|
|
1670
|
+
Ze,
|
|
1671
|
+
Qe,
|
|
1672
|
+
$e
|
|
1673
|
+
], _t), at = K([
|
|
1676
1674
|
"mi",
|
|
1677
1675
|
"mo",
|
|
1678
1676
|
"mn",
|
|
1679
1677
|
"ms",
|
|
1680
1678
|
"mtext"
|
|
1681
|
-
]),
|
|
1679
|
+
]), st = addToSet({}, at), ct = K(["annotation-xml"]), lt = addToSet({}, ct), St = addToSet({}, [
|
|
1682
1680
|
"title",
|
|
1683
1681
|
"style",
|
|
1684
1682
|
"font",
|
|
1685
1683
|
"a",
|
|
1686
1684
|
"script"
|
|
1687
|
-
]),
|
|
1685
|
+
]), Ct = null, wt = ["application/xhtml+xml", "text/html"], X = null, Tt = null, rn = t.createElement("form"), an = function isRegexOrFunction(e) {
|
|
1688
1686
|
return e instanceof RegExp || e instanceof Function;
|
|
1689
1687
|
}, on = function _parseConfig() {
|
|
1690
1688
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1691
|
-
if (
|
|
1692
|
-
(!e || typeof e != "object") && (e = {}), e = clone(e),
|
|
1693
|
-
transform:
|
|
1689
|
+
if (Tt && Tt === e) return;
|
|
1690
|
+
(!e || typeof e != "object") && (e = {}), e = clone(e), Ct = wt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, X = Ct === "application/xhtml+xml" ? _t : gt, H = nn(e, "ALLOWED_TAGS", be, { transform: X }), U = nn(e, "ALLOWED_ATTR", W, { transform: X }), rt = nn(e, "ALLOWED_NAMESPACES", it, { transform: _t }), Ye = nn(e, "ADD_URI_SAFE_ATTR", Xe, {
|
|
1691
|
+
transform: X,
|
|
1692
|
+
base: Xe
|
|
1693
|
+
}), qe = nn(e, "ADD_DATA_URI_TAGS", Je, {
|
|
1694
|
+
transform: X,
|
|
1694
1695
|
base: Je
|
|
1695
|
-
}), Ge =
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
}), Ue = an(e, "FORBID_CONTENTS", We, { transform: Q }), ye = an(e, "FORBID_TAGS", clone({}), { transform: Q }), be = an(e, "FORBID_ATTR", clone({}), { transform: Q }), He = Tt(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? clone(e.USE_PROFILES) : e.USE_PROFILES : !1, Ce = e.ALLOW_ARIA_ATTR !== !1, we = e.ALLOW_DATA_ATTR !== !1, Te = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Ee = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, De = e.SAFE_FOR_TEMPLATES || !1, Oe = e.SAFE_FOR_XML !== !1, ke = e.WHOLE_DOCUMENT || !1, Pe = e.RETURN_DOM || !1, Fe = e.RETURN_DOM_FRAGMENT || !1, Ie = e.RETURN_TRUSTED_TYPE || !1, Ne = e.FORCE_BODY || !1, Le = e.SANITIZE_DOM !== !1, Re = e.SANITIZE_NAMED_PROPS || !1, Be = e.KEEP_CONTENT !== !1, Ve = e.IN_PLACE || !1, he = isRegex(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Gt, Qe = typeof e.NAMESPACE == "string" ? e.NAMESPACE : Ze, rt = Tt(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? clone(e.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, J), st = Tt(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? clone(e.HTML_INTEGRATION_POINTS) : addToSet({}, it);
|
|
1699
|
-
let t = Tt(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? clone(e.CUSTOM_ELEMENT_HANDLING) : at(null);
|
|
1700
|
-
if (q = at(null), Tt(t, "tagNameCheck") && Et(t.tagNameCheck) && (q.tagNameCheck = t.tagNameCheck), Tt(t, "attributeNameCheck") && Et(t.attributeNameCheck) && (q.attributeNameCheck = t.attributeNameCheck), Tt(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (q.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), Z(q), De && (we = !1), Fe && (Pe = !0), He && (G = addToSet({}, Ft), K = at(null), He.html === !0 && (addToSet(G, kt), addToSet(K, It)), He.svg === !0 && (addToSet(G, At), addToSet(K, Lt), addToSet(K, zt)), He.svgFilters === !0 && (addToSet(G, jt), addToSet(K, Lt), addToSet(K, zt)), He.mathMl === !0 && (addToSet(G, Nt), addToSet(K, Rt), addToSet(K, zt))), Se.tagCheck = null, Se.attributeCheck = null, Tt(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? Se.tagCheck = e.ADD_TAGS : ht(e.ADD_TAGS) && (G === _e && (G = clone(G)), addToSet(G, e.ADD_TAGS, Q))), Tt(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? Se.attributeCheck = e.ADD_ATTR : ht(e.ADD_ATTR) && (K === ve && (K = clone(K)), addToSet(K, e.ADD_ATTR, Q))), Tt(e, "ADD_URI_SAFE_ATTR") && ht(e.ADD_URI_SAFE_ATTR) && addToSet(qe, e.ADD_URI_SAFE_ATTR, Q), Tt(e, "FORBID_CONTENTS") && ht(e.FORBID_CONTENTS) && (Ue === We && (Ue = clone(Ue)), addToSet(Ue, e.FORBID_CONTENTS, Q)), Tt(e, "ADD_FORBID_CONTENTS") && ht(e.ADD_FORBID_CONTENTS) && (Ue === We && (Ue = clone(Ue)), addToSet(Ue, e.ADD_FORBID_CONTENTS, Q)), Be && (G["#text"] = !0), ke && addToSet(G, [
|
|
1696
|
+
}), Ge = nn(e, "FORBID_CONTENTS", Ke, { transform: X }), Se = nn(e, "FORBID_TAGS", clone({}), { transform: X }), Ce = nn(e, "FORBID_ATTR", clone({}), { transform: X }), We = Z(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? clone(e.USE_PROFILES) : e.USE_PROFILES : !1, Te = e.ALLOW_ARIA_ATTR !== !1, Ee = e.ALLOW_DATA_ATTR !== !1, De = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Oe = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, ke = e.SAFE_FOR_TEMPLATES || !1, Ae = e.SAFE_FOR_XML !== !1, je = e.WHOLE_DOCUMENT || !1, Ie = e.RETURN_DOM || !1, Le = e.RETURN_DOM_FRAGMENT || !1, Re = e.RETURN_TRUSTED_TYPE || !1, Fe = e.FORCE_BODY || !1, ze = e.SANITIZE_DOM !== !1, Be = e.SANITIZE_NAMED_PROPS || !1, He = e.KEEP_CONTENT !== !1, Ue = e.IN_PLACE || !1, ye = isRegex(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Ut, et = typeof e.NAMESPACE == "string" ? e.NAMESPACE : $e, st = Z(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? clone(e.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, at), lt = Z(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? clone(e.HTML_INTEGRATION_POINTS) : addToSet({}, ct);
|
|
1697
|
+
let t = Z(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? clone(e.CUSTOM_ELEMENT_HANDLING) : J(null);
|
|
1698
|
+
if (G = J(null), Z(t, "tagNameCheck") && an(t.tagNameCheck) && (G.tagNameCheck = t.tagNameCheck), Z(t, "attributeNameCheck") && an(t.attributeNameCheck) && (G.attributeNameCheck = t.attributeNameCheck), Z(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (G.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), q(G), ke && (Ee = !1), Le && (Ie = !0), We && (H = addToSet({}, Nt), U = J(null), We.html === !0 && (addToSet(H, Dt), addToSet(U, Pt)), We.svg === !0 && (addToSet(H, Ot), addToSet(U, Ft), addToSet(U, Lt)), We.svgFilters === !0 && (addToSet(H, kt), addToSet(U, Ft), addToSet(U, Lt)), We.mathMl === !0 && (addToSet(H, jt), addToSet(U, It), addToSet(U, Lt))), we.tagCheck = null, we.attributeCheck = null, Z(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? we.tagCheck = e.ADD_TAGS : ht(e.ADD_TAGS) && (H === be && (H = clone(H)), addToSet(H, e.ADD_TAGS, X))), Z(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? we.attributeCheck = e.ADD_ATTR : ht(e.ADD_ATTR) && (U === W && (U = clone(U)), addToSet(U, e.ADD_ATTR, X))), Z(e, "ADD_URI_SAFE_ATTR") && ht(e.ADD_URI_SAFE_ATTR) && addToSet(Ye, e.ADD_URI_SAFE_ATTR, X), Z(e, "FORBID_CONTENTS") && ht(e.FORBID_CONTENTS) && (Ge === Ke && (Ge = clone(Ge)), addToSet(Ge, e.FORBID_CONTENTS, X)), Z(e, "ADD_FORBID_CONTENTS") && ht(e.ADD_FORBID_CONTENTS) && (Ge === Ke && (Ge = clone(Ge)), addToSet(Ge, e.ADD_FORBID_CONTENTS, X)), He && (H["#text"] = !0), je && addToSet(H, [
|
|
1701
1699
|
"html",
|
|
1702
1700
|
"head",
|
|
1703
1701
|
"body"
|
|
1704
|
-
]),
|
|
1705
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw
|
|
1706
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw
|
|
1707
|
-
let t =
|
|
1708
|
-
|
|
1702
|
+
]), H.table && (addToSet(H, ["tbody"]), delete Se.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
1703
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw Et("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
1704
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw Et("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
1705
|
+
let t = T;
|
|
1706
|
+
T = e.TRUSTED_TYPES_POLICY;
|
|
1709
1707
|
try {
|
|
1710
|
-
|
|
1708
|
+
k = re("");
|
|
1711
1709
|
} catch (e) {
|
|
1712
|
-
throw
|
|
1710
|
+
throw T = t, e;
|
|
1713
1711
|
}
|
|
1714
|
-
} else e.TRUSTED_TYPES_POLICY === null ? (
|
|
1715
|
-
|
|
1712
|
+
} else e.TRUSTED_TYPES_POLICY === null ? (T = void 0, k = "") : (T === void 0 && (T = M()), T && typeof k == "string" && (k = re("")));
|
|
1713
|
+
K && K(e), Tt = e;
|
|
1716
1714
|
}, sn = addToSet({}, [
|
|
1717
|
-
...
|
|
1718
|
-
...
|
|
1719
|
-
...
|
|
1720
|
-
]), cn = addToSet({}, [...
|
|
1721
|
-
return t.namespaceURI ===
|
|
1715
|
+
...Ot,
|
|
1716
|
+
...kt,
|
|
1717
|
+
...At
|
|
1718
|
+
]), cn = addToSet({}, [...jt, ...Mt]), ln = function _checkSvgNamespace(e, t, n) {
|
|
1719
|
+
return t.namespaceURI === $e ? e === "svg" : t.namespaceURI === Ze ? e === "svg" && (n === "annotation-xml" || st[n]) : !!sn[e];
|
|
1722
1720
|
}, un = function _checkMathMlNamespace(e, t, n) {
|
|
1723
|
-
return t.namespaceURI ===
|
|
1721
|
+
return t.namespaceURI === $e ? e === "math" : t.namespaceURI === Qe ? e === "math" && lt[n] : !!cn[e];
|
|
1724
1722
|
}, dn = function _checkHtmlNamespace(e, t, n) {
|
|
1725
|
-
return t.namespaceURI ===
|
|
1723
|
+
return t.namespaceURI === Qe && !lt[n] || t.namespaceURI === Ze && !st[n] ? !1 : !cn[e] && (St[e] || !sn[e]);
|
|
1726
1724
|
}, fn = function _checkValidNamespace(e) {
|
|
1727
1725
|
let t = v(e);
|
|
1728
1726
|
(!t || !t.tagName) && (t = {
|
|
1729
|
-
namespaceURI:
|
|
1727
|
+
namespaceURI: et,
|
|
1730
1728
|
tagName: "template"
|
|
1731
1729
|
});
|
|
1732
1730
|
let n = gt(e.tagName), r = gt(t.tagName);
|
|
1733
|
-
return
|
|
1731
|
+
return rt[e.namespaceURI] ? e.namespaceURI === Qe ? ln(n, t, r) : e.namespaceURI === Ze ? un(n, t, r) : e.namespaceURI === $e ? dn(n, t, r) : !!(Ct === "application/xhtml+xml" && rt[e.namespaceURI]) : !1;
|
|
1734
1732
|
}, pn = function _forceRemove(e) {
|
|
1735
1733
|
pt(DOMPurify.removed, { element: e });
|
|
1736
1734
|
try {
|
|
1737
1735
|
v(e).removeChild(e);
|
|
1738
1736
|
} catch {
|
|
1739
|
-
if (m(e), !v(e)) throw
|
|
1737
|
+
if (m(e), !v(e)) throw Et("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
1740
1738
|
}
|
|
1741
1739
|
}, mn = function _neutralizeRoot(e) {
|
|
1742
1740
|
_n(e);
|
|
@@ -1751,7 +1749,7 @@ function createDOMPurify() {
|
|
|
1751
1749
|
} catch {}
|
|
1752
1750
|
});
|
|
1753
1751
|
}
|
|
1754
|
-
let n =
|
|
1752
|
+
let n = x(e);
|
|
1755
1753
|
if (n) for (let t = n.length - 1; t >= 0; --t) {
|
|
1756
1754
|
let r = n[t], i = r && r.name;
|
|
1757
1755
|
if (typeof i == "string") try {
|
|
@@ -1770,17 +1768,17 @@ function createDOMPurify() {
|
|
|
1770
1768
|
from: t
|
|
1771
1769
|
});
|
|
1772
1770
|
}
|
|
1773
|
-
if (t.removeAttribute(e), e === "is") if (
|
|
1771
|
+
if (t.removeAttribute(e), e === "is") if (Ie || Le) try {
|
|
1774
1772
|
pn(t);
|
|
1775
1773
|
} catch {}
|
|
1776
1774
|
else try {
|
|
1777
1775
|
t.setAttribute(e, "");
|
|
1778
1776
|
} catch {}
|
|
1779
1777
|
}, gn = function _stripDisallowedAttributes(e) {
|
|
1780
|
-
let t =
|
|
1778
|
+
let t = x(e);
|
|
1781
1779
|
if (t) for (let n = t.length - 1; n >= 0; --n) {
|
|
1782
1780
|
let r = t[n], i = r && r.name;
|
|
1783
|
-
if (!(typeof i != "string" ||
|
|
1781
|
+
if (!(typeof i != "string" || U[X(i)])) try {
|
|
1784
1782
|
e.removeAttribute(i);
|
|
1785
1783
|
} catch {}
|
|
1786
1784
|
}
|
|
@@ -1788,23 +1786,23 @@ function createDOMPurify() {
|
|
|
1788
1786
|
let t = [e];
|
|
1789
1787
|
for (; t.length > 0;) {
|
|
1790
1788
|
let e = t.pop();
|
|
1791
|
-
(
|
|
1789
|
+
(S ? S(e) : e.nodeType) === Qt.element && gn(e);
|
|
1792
1790
|
let n = _(e);
|
|
1793
1791
|
if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
|
|
1794
1792
|
}
|
|
1795
1793
|
}, vn = function _neutralizePatchLinkage(e) {
|
|
1796
|
-
if (!
|
|
1794
|
+
if (!Ae) return;
|
|
1797
1795
|
let t = [e];
|
|
1798
1796
|
for (; t.length > 0;) {
|
|
1799
|
-
let e = t.pop(), n =
|
|
1800
|
-
if (n ===
|
|
1797
|
+
let e = t.pop(), n = S ? S(e) : e.nodeType;
|
|
1798
|
+
if (n === Qt.processingInstruction || n === Qt.comment && Q(Yt, e.data)) {
|
|
1801
1799
|
try {
|
|
1802
1800
|
m(e);
|
|
1803
1801
|
} catch {}
|
|
1804
1802
|
continue;
|
|
1805
1803
|
}
|
|
1806
|
-
if (n ===
|
|
1807
|
-
let t = e, n =
|
|
1804
|
+
if (n === Qt.element) {
|
|
1805
|
+
let t = e, n = X(C ? C(e) : e.nodeName);
|
|
1808
1806
|
try {
|
|
1809
1807
|
t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for");
|
|
1810
1808
|
} catch {}
|
|
@@ -1814,100 +1812,100 @@ function createDOMPurify() {
|
|
|
1814
1812
|
}
|
|
1815
1813
|
}, yn = function _initDocument(e) {
|
|
1816
1814
|
let n = null, r = null;
|
|
1817
|
-
if (
|
|
1815
|
+
if (Fe) e = "<remove></remove>" + e;
|
|
1818
1816
|
else {
|
|
1819
1817
|
let t = vt(e, /^[\r\n\t ]+/);
|
|
1820
1818
|
r = t && t[0];
|
|
1821
1819
|
}
|
|
1822
|
-
|
|
1823
|
-
let i =
|
|
1824
|
-
if (
|
|
1825
|
-
n = new c().parseFromString(i,
|
|
1820
|
+
Ct === "application/xhtml+xml" && et === $e && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
1821
|
+
let i = T ? re(e) : e;
|
|
1822
|
+
if (et === $e) try {
|
|
1823
|
+
n = new c().parseFromString(i, Ct);
|
|
1826
1824
|
} catch {}
|
|
1827
1825
|
if (!n || !n.documentElement) {
|
|
1828
|
-
n =
|
|
1826
|
+
n = F.createDocument(et, "template", null);
|
|
1829
1827
|
try {
|
|
1830
|
-
n.documentElement.innerHTML =
|
|
1828
|
+
n.documentElement.innerHTML = nt ? k : i;
|
|
1831
1829
|
} catch {}
|
|
1832
1830
|
}
|
|
1833
1831
|
let a = n.body || n.documentElement;
|
|
1834
|
-
return e && r && a.insertBefore(t.createTextNode(r), a.childNodes[0] || null),
|
|
1832
|
+
return e && r && a.insertBefore(t.createTextNode(r), a.childNodes[0] || null), et === $e ? I.call(n, je ? "html" : "body")[0] : je ? n.documentElement : a;
|
|
1835
1833
|
}, bn = function _createNodeIterator(e) {
|
|
1836
|
-
return
|
|
1834
|
+
return ae.call(e.ownerDocument || e, e, s.SHOW_ELEMENT | s.SHOW_COMMENT | s.SHOW_TEXT | s.SHOW_PROCESSING_INSTRUCTION | s.SHOW_CDATA_SECTION, null);
|
|
1837
1835
|
}, xn = function _stripTemplateExpressions(e) {
|
|
1838
|
-
return e = yt(e,
|
|
1836
|
+
return e = yt(e, se, " "), e = yt(e, ce, " "), e = yt(e, ue, " "), e;
|
|
1839
1837
|
}, Sn = function _scrubTemplateExpressions(e) {
|
|
1840
1838
|
e.normalize();
|
|
1841
|
-
let t =
|
|
1839
|
+
let t = ae.call(e.ownerDocument || e, e, s.SHOW_TEXT | s.SHOW_COMMENT | s.SHOW_CDATA_SECTION | s.SHOW_PROCESSING_INSTRUCTION, null), n = t.nextNode();
|
|
1842
1840
|
for (; n;) n.data = xn(n.data), n = t.nextNode();
|
|
1843
1841
|
let r = e.querySelectorAll?.call(e, "template");
|
|
1844
1842
|
r && ut(r, (e) => {
|
|
1845
1843
|
wn(e.content) && Sn(e.content);
|
|
1846
1844
|
});
|
|
1847
1845
|
}, Cn = function _isClobbered(e) {
|
|
1848
|
-
let t =
|
|
1849
|
-
return typeof t != "string" ||
|
|
1846
|
+
let t = C ? C(e) : null;
|
|
1847
|
+
return typeof t != "string" || X(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== x(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== S(e) || e.childNodes !== _(e);
|
|
1850
1848
|
}, wn = function _isDocumentFragment(e) {
|
|
1851
|
-
if (!
|
|
1849
|
+
if (!S || typeof e != "object" || !e) return !1;
|
|
1852
1850
|
try {
|
|
1853
|
-
return
|
|
1851
|
+
return S(e) === Qt.documentFragment;
|
|
1854
1852
|
} catch {
|
|
1855
1853
|
return !1;
|
|
1856
1854
|
}
|
|
1857
1855
|
}, Tn = function _isNode(e) {
|
|
1858
|
-
if (!
|
|
1856
|
+
if (!S || typeof e != "object" || !e) return !1;
|
|
1859
1857
|
try {
|
|
1860
|
-
return typeof
|
|
1858
|
+
return typeof S(e) == "number";
|
|
1861
1859
|
} catch {
|
|
1862
1860
|
return !1;
|
|
1863
1861
|
}
|
|
1864
1862
|
};
|
|
1865
1863
|
function _executeHooks(e, t, n) {
|
|
1866
1864
|
e.length !== 0 && ut(e, (e) => {
|
|
1867
|
-
e.call(DOMPurify, t, n,
|
|
1865
|
+
e.call(DOMPurify, t, n, Tt);
|
|
1868
1866
|
});
|
|
1869
1867
|
}
|
|
1870
1868
|
let En = function _isUnsafeNode(e, t) {
|
|
1871
|
-
return !!(
|
|
1869
|
+
return !!(Ae && e.hasChildNodes() && !Tn(e.firstElementChild) && Q(Jt, e.textContent) && Q(Jt, e.innerHTML) || Ae && e.namespaceURI === $e && t === "style" && Tn(e.firstElementChild) || e.nodeType === Qt.processingInstruction || Ae && e.nodeType === Qt.comment && Q(Yt, e.data));
|
|
1872
1870
|
}, Dn = function _sanitizeDisallowedNode(e, t) {
|
|
1873
|
-
if (!
|
|
1874
|
-
if (
|
|
1871
|
+
if (!Se[t] && jn(t) && (G.tagNameCheck instanceof RegExp && Q(G.tagNameCheck, t) || G.tagNameCheck instanceof Function && G.tagNameCheck(t))) return !1;
|
|
1872
|
+
if (He && !Ge[t]) {
|
|
1875
1873
|
let t = v(e), n = _(e);
|
|
1876
1874
|
if (n && t) {
|
|
1877
1875
|
let r = n.length;
|
|
1878
1876
|
for (let i = r - 1; i >= 0; --i) {
|
|
1879
|
-
let r =
|
|
1877
|
+
let r = Ue ? n[i] : p(n[i], !0);
|
|
1880
1878
|
t.insertBefore(r, h(e));
|
|
1881
1879
|
}
|
|
1882
1880
|
}
|
|
1883
1881
|
}
|
|
1884
1882
|
return pn(e), !0;
|
|
1885
1883
|
}, On = function _sanitizeElements(e, t) {
|
|
1886
|
-
if (_executeHooks(
|
|
1884
|
+
if (_executeHooks(B.beforeSanitizeElements, e, null), e !== t && v(e) === null) return !0;
|
|
1887
1885
|
if (Cn(e)) return pn(e), !0;
|
|
1888
|
-
let n =
|
|
1889
|
-
if (_executeHooks(
|
|
1886
|
+
let n = X(C ? C(e) : e.nodeName);
|
|
1887
|
+
if (_executeHooks(B.uponSanitizeElement, e, {
|
|
1890
1888
|
tagName: n,
|
|
1891
|
-
allowedTags:
|
|
1889
|
+
allowedTags: H
|
|
1892
1890
|
}), e !== t && v(e) === null) return !0;
|
|
1893
1891
|
if (En(e, n)) return pn(e), !0;
|
|
1894
|
-
if (
|
|
1892
|
+
if (Se[n] || !(we.tagCheck instanceof Function && we.tagCheck(n)) && !H[n]) {
|
|
1895
1893
|
let t = Dn(e, n);
|
|
1896
|
-
return t === !1 && _executeHooks(
|
|
1894
|
+
return t === !1 && _executeHooks(B.afterSanitizeElements, e, null), t;
|
|
1897
1895
|
}
|
|
1898
|
-
if ((
|
|
1899
|
-
if (
|
|
1896
|
+
if ((S ? S(e) : e.nodeType) === Qt.element && !fn(e) || (n === "noscript" || n === "noembed" || n === "noframes") && Q(Xt, e.innerHTML)) return pn(e), !0;
|
|
1897
|
+
if (ke && e.nodeType === Qt.text) {
|
|
1900
1898
|
let t = xn(e.textContent);
|
|
1901
1899
|
e.textContent !== t && (pt(DOMPurify.removed, { element: e.cloneNode() }), e.textContent = t);
|
|
1902
1900
|
}
|
|
1903
|
-
return _executeHooks(
|
|
1901
|
+
return _executeHooks(B.afterSanitizeElements, e, null), !1;
|
|
1904
1902
|
}, kn = function _isValidAttribute(e, n, r) {
|
|
1905
|
-
if (
|
|
1906
|
-
let i =
|
|
1907
|
-
if (!(
|
|
1903
|
+
if (Ce[n] || Ae && n === "patchsrc" || Ae && n === "for" && e !== "label" && e !== "output" || ze && (n === "id" || n === "name") && (r in t || r in rn)) return !1;
|
|
1904
|
+
let i = U[n] || we.attributeCheck instanceof Function && we.attributeCheck(n, e);
|
|
1905
|
+
if (!(Ee && Q(de, n)) && !(Te && Q(pe, n))) {
|
|
1908
1906
|
if (!i) {
|
|
1909
|
-
if (!(jn(e) && (
|
|
1910
|
-
} else if (!
|
|
1907
|
+
if (!(jn(e) && (G.tagNameCheck instanceof RegExp && Q(G.tagNameCheck, e) || G.tagNameCheck instanceof Function && G.tagNameCheck(e)) && (G.attributeNameCheck instanceof RegExp && Q(G.attributeNameCheck, n) || G.attributeNameCheck instanceof Function && G.attributeNameCheck(n, e)) || n === "is" && G.allowCustomizedBuiltInElements && (G.tagNameCheck instanceof RegExp && Q(G.tagNameCheck, r) || G.tagNameCheck instanceof Function && G.tagNameCheck(r)))) return !1;
|
|
1908
|
+
} else if (!Ye[n] && !Q(ye, yt(r, _e, "")) && !((n === "src" || n === "xlink:href" || n === "href") && e !== "script" && bt(r, "data:") === 0 && qe[e]) && !(De && !Q(he, yt(r, _e, ""))) && r) return !1;
|
|
1911
1909
|
}
|
|
1912
1910
|
return !0;
|
|
1913
1911
|
}, An = addToSet({}, [
|
|
@@ -1920,11 +1918,11 @@ function createDOMPurify() {
|
|
|
1920
1918
|
"font-face-uri",
|
|
1921
1919
|
"missing-glyph"
|
|
1922
1920
|
]), jn = function _isBasicCustomElement(e) {
|
|
1923
|
-
return !An[gt(e)] &&
|
|
1921
|
+
return !An[gt(e)] && Q(ve, e);
|
|
1924
1922
|
}, Mn = function _applyTrustedTypesToAttribute(e, t, n, r) {
|
|
1925
|
-
if (
|
|
1926
|
-
case "TrustedHTML": return
|
|
1927
|
-
case "TrustedScriptURL": return
|
|
1923
|
+
if (T && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
|
|
1924
|
+
case "TrustedHTML": return re(r);
|
|
1925
|
+
case "TrustedScriptURL": return ie(r);
|
|
1928
1926
|
}
|
|
1929
1927
|
return r;
|
|
1930
1928
|
}, Nn = function _setAttributeValue(e, t, n, r) {
|
|
@@ -1934,19 +1932,19 @@ function createDOMPurify() {
|
|
|
1934
1932
|
hn(t, e);
|
|
1935
1933
|
}
|
|
1936
1934
|
}, Pn = function _sanitizeAttributes(e) {
|
|
1937
|
-
_executeHooks(
|
|
1935
|
+
_executeHooks(B.beforeSanitizeAttributes, e, null);
|
|
1938
1936
|
let t = e.attributes;
|
|
1939
1937
|
if (!t || Cn(e)) return;
|
|
1940
1938
|
let n = {
|
|
1941
1939
|
attrName: "",
|
|
1942
1940
|
attrValue: "",
|
|
1943
1941
|
keepAttr: !0,
|
|
1944
|
-
allowedAttributes:
|
|
1942
|
+
allowedAttributes: U,
|
|
1945
1943
|
forceKeepAttr: void 0
|
|
1946
|
-
}, r = t.length, i =
|
|
1944
|
+
}, r = t.length, i = X(e.nodeName);
|
|
1947
1945
|
for (; r--;) {
|
|
1948
|
-
let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, u =
|
|
1949
|
-
if (n.attrName = u, n.attrValue = p, n.keepAttr = !0, n.forceKeepAttr = void 0, _executeHooks(
|
|
1946
|
+
let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, u = X(o), f = c, p = o === "value" ? f : xt(f);
|
|
1947
|
+
if (n.attrName = u, n.attrValue = p, n.keepAttr = !0, n.forceKeepAttr = void 0, _executeHooks(B.uponSanitizeAttribute, e, n), p = n.attrValue, Be && (u === "id" || u === "name") && bt(p, Ve) !== 0 && (hn(o, e), p = Ve + p), Ae && Q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, p)) {
|
|
1950
1948
|
hn(o, e);
|
|
1951
1949
|
continue;
|
|
1952
1950
|
}
|
|
@@ -1959,25 +1957,25 @@ function createDOMPurify() {
|
|
|
1959
1957
|
hn(o, e);
|
|
1960
1958
|
continue;
|
|
1961
1959
|
}
|
|
1962
|
-
if (!
|
|
1960
|
+
if (!Oe && Q(Zt, p)) {
|
|
1963
1961
|
hn(o, e);
|
|
1964
1962
|
continue;
|
|
1965
1963
|
}
|
|
1966
|
-
if (
|
|
1964
|
+
if (ke && (p = xn(p)), !kn(i, u, p)) {
|
|
1967
1965
|
hn(o, e);
|
|
1968
1966
|
continue;
|
|
1969
1967
|
}
|
|
1970
1968
|
p = Mn(i, u, s, p), p !== f && Nn(e, o, s, p);
|
|
1971
1969
|
}
|
|
1972
1970
|
}
|
|
1973
|
-
_executeHooks(
|
|
1971
|
+
_executeHooks(B.afterSanitizeAttributes, e, null);
|
|
1974
1972
|
}, Fn = function _sanitizeShadowDOM(e) {
|
|
1975
1973
|
let t = null, n = bn(e);
|
|
1976
|
-
for (_executeHooks(
|
|
1977
|
-
let e =
|
|
1974
|
+
for (_executeHooks(B.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (_executeHooks(B.uponSanitizeShadowNode, t, null), On(t, e), Pn(t), wn(t.content) && Fn(t.content), (S ? S(t) : t.nodeType) === Qt.element) {
|
|
1975
|
+
let e = b(t);
|
|
1978
1976
|
wn(e) && (In(e), Fn(e));
|
|
1979
1977
|
}
|
|
1980
|
-
_executeHooks(
|
|
1978
|
+
_executeHooks(B.afterSanitizeShadowDOM, e, null);
|
|
1981
1979
|
}, In = function _sanitizeAttachedShadowRoots(e) {
|
|
1982
1980
|
let t = [{
|
|
1983
1981
|
node: e,
|
|
@@ -1989,14 +1987,14 @@ function createDOMPurify() {
|
|
|
1989
1987
|
Fn(e.shadow);
|
|
1990
1988
|
continue;
|
|
1991
1989
|
}
|
|
1992
|
-
let n = e.node, r = (
|
|
1990
|
+
let n = e.node, r = (S ? S(n) : n.nodeType) === Qt.element, i = _(n);
|
|
1993
1991
|
if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
|
|
1994
1992
|
node: i[e],
|
|
1995
1993
|
shadow: null
|
|
1996
1994
|
});
|
|
1997
1995
|
if (r) {
|
|
1998
|
-
let e =
|
|
1999
|
-
if (typeof e == "string" &&
|
|
1996
|
+
let e = C ? C(n) : null;
|
|
1997
|
+
if (typeof e == "string" && X(e) === "template") {
|
|
2000
1998
|
let e = n.content;
|
|
2001
1999
|
wn(e) && t.push({
|
|
2002
2000
|
node: e,
|
|
@@ -2005,7 +2003,7 @@ function createDOMPurify() {
|
|
|
2005
2003
|
}
|
|
2006
2004
|
}
|
|
2007
2005
|
if (r) {
|
|
2008
|
-
let e =
|
|
2006
|
+
let e = b(n);
|
|
2009
2007
|
wn(e) && t.push({
|
|
2010
2008
|
node: null,
|
|
2011
2009
|
shadow: e
|
|
@@ -2018,29 +2016,29 @@ function createDOMPurify() {
|
|
|
2018
2016
|
};
|
|
2019
2017
|
return DOMPurify.sanitize = function(e) {
|
|
2020
2018
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = null, i = null, a = null, o = null;
|
|
2021
|
-
if (
|
|
2019
|
+
if (nt = !e, nt && (e = "<!-->"), typeof e != "string" && !Tn(e) && (e = stringifyValue(e), typeof e != "string")) throw Et("dirty is not a string, aborting");
|
|
2022
2020
|
if (!DOMPurify.isSupported) return e;
|
|
2023
|
-
|
|
2024
|
-
let s =
|
|
2021
|
+
Me ? (H = Ne, U = Pe) : on(t), (B.uponSanitizeElement.length > 0 || B.uponSanitizeAttribute.length > 0) && (H = clone(H)), B.uponSanitizeAttribute.length > 0 && (U = clone(U)), DOMPurify.removed = [];
|
|
2022
|
+
let s = Ue && typeof e != "string" && Tn(e);
|
|
2025
2023
|
if (s) {
|
|
2026
2024
|
vn(e);
|
|
2027
|
-
let t =
|
|
2025
|
+
let t = C ? C(e) : e.nodeName;
|
|
2028
2026
|
if (typeof t == "string") {
|
|
2029
|
-
let n =
|
|
2030
|
-
if (!
|
|
2027
|
+
let n = X(t);
|
|
2028
|
+
if (!H[n] || Se[n]) throw mn(e), Et("root node is forbidden and cannot be sanitized in-place");
|
|
2031
2029
|
}
|
|
2032
|
-
if (Cn(e)) throw mn(e),
|
|
2030
|
+
if (Cn(e)) throw mn(e), Et("root node is clobbered and cannot be sanitized in-place");
|
|
2033
2031
|
try {
|
|
2034
2032
|
In(e);
|
|
2035
2033
|
} catch (t) {
|
|
2036
2034
|
throw mn(e), t;
|
|
2037
2035
|
}
|
|
2038
|
-
} else if (Tn(e)) r = yn("<!---->"), i = r.ownerDocument.importNode(e, !0), i.nodeType ===
|
|
2036
|
+
} else if (Tn(e)) r = yn("<!---->"), i = r.ownerDocument.importNode(e, !0), i.nodeType === Qt.element && i.nodeName === "BODY" || i.nodeName === "HTML" ? r = i : r.appendChild(i), In(i);
|
|
2039
2037
|
else {
|
|
2040
|
-
if (!
|
|
2041
|
-
if (r = yn(e), !r) return
|
|
2038
|
+
if (!Ie && !ke && !je && e.indexOf("<") === -1) return T && Re ? re(e) : e;
|
|
2039
|
+
if (r = yn(e), !r) return Ie ? null : Re ? k : "";
|
|
2042
2040
|
}
|
|
2043
|
-
r &&
|
|
2041
|
+
r && Fe && pn(r.firstChild);
|
|
2044
2042
|
let c = s ? e : r, u = bn(c);
|
|
2045
2043
|
try {
|
|
2046
2044
|
for (; a = u.nextNode();) On(a, c), Pn(a), wn(a.content) && Fn(a.content);
|
|
@@ -2051,40 +2049,40 @@ function createDOMPurify() {
|
|
|
2051
2049
|
}
|
|
2052
2050
|
if (s) return ut(DOMPurify.removed, (e) => {
|
|
2053
2051
|
e.element && _n(e.element);
|
|
2054
|
-
}),
|
|
2055
|
-
if (
|
|
2056
|
-
if (
|
|
2052
|
+
}), ke && Sn(e), e;
|
|
2053
|
+
if (Ie) {
|
|
2054
|
+
if (ke && Sn(r), Le) for (o = oe.call(r.ownerDocument); r.firstChild;) o.appendChild(r.firstChild);
|
|
2057
2055
|
else o = r;
|
|
2058
|
-
return (
|
|
2056
|
+
return (U.shadowroot || U.shadowrootmode) && (o = R.call(n, o, !0)), o;
|
|
2059
2057
|
}
|
|
2060
|
-
let f =
|
|
2061
|
-
return
|
|
2058
|
+
let f = je ? r.outerHTML : r.innerHTML;
|
|
2059
|
+
return je && H["!doctype"] && r.ownerDocument && r.ownerDocument.doctype && r.ownerDocument.doctype.name && Q(Kt, r.ownerDocument.doctype.name) && (f = "<!DOCTYPE " + r.ownerDocument.doctype.name + ">\n" + f), ke && (f = xn(f)), T && Re ? re(f) : f;
|
|
2062
2060
|
}, DOMPurify.setConfig = function() {
|
|
2063
2061
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2064
|
-
on(e),
|
|
2062
|
+
on(e), Me = !0, Ne = H, Pe = U;
|
|
2065
2063
|
}, DOMPurify.clearConfig = function() {
|
|
2066
|
-
|
|
2064
|
+
Tt = null, Me = !1, Ne = null, Pe = null, T = te, k = "";
|
|
2067
2065
|
}, DOMPurify.isValidAttribute = function(e, t, n) {
|
|
2068
|
-
|
|
2069
|
-
let r =
|
|
2066
|
+
Tt || on({});
|
|
2067
|
+
let r = X(e), i = X(t);
|
|
2070
2068
|
return kn(r, i, n);
|
|
2071
2069
|
}, DOMPurify.addHook = function(e, t) {
|
|
2072
|
-
typeof t == "function" &&
|
|
2070
|
+
typeof t == "function" && Z(B, e) && pt(B[e], t);
|
|
2073
2071
|
}, DOMPurify.removeHook = function(e, t) {
|
|
2074
|
-
if (
|
|
2072
|
+
if (Z(B, e)) {
|
|
2075
2073
|
if (t !== void 0) {
|
|
2076
|
-
let n = dt(
|
|
2077
|
-
return n === -1 ? void 0 : mt(
|
|
2074
|
+
let n = dt(B[e], t);
|
|
2075
|
+
return n === -1 ? void 0 : mt(B[e], n, 1)[0];
|
|
2078
2076
|
}
|
|
2079
|
-
return ft(
|
|
2077
|
+
return ft(B[e]);
|
|
2080
2078
|
}
|
|
2081
2079
|
}, DOMPurify.removeHooks = function(e) {
|
|
2082
|
-
|
|
2080
|
+
Z(B, e) && (B[e] = []);
|
|
2083
2081
|
}, DOMPurify.removeAllHooks = function() {
|
|
2084
|
-
|
|
2082
|
+
B = tn();
|
|
2085
2083
|
}, DOMPurify;
|
|
2086
2084
|
}
|
|
2087
|
-
var
|
|
2085
|
+
var rn = createDOMPurify(), _Class;
|
|
2088
2086
|
function z() {
|
|
2089
2087
|
return {
|
|
2090
2088
|
async: !1,
|
|
@@ -2099,11 +2097,11 @@ function z() {
|
|
|
2099
2097
|
walkTokens: null
|
|
2100
2098
|
};
|
|
2101
2099
|
}
|
|
2102
|
-
var
|
|
2100
|
+
var an = z();
|
|
2103
2101
|
function N(e) {
|
|
2104
|
-
|
|
2102
|
+
an = e;
|
|
2105
2103
|
}
|
|
2106
|
-
var
|
|
2104
|
+
var on = { exec: () => null };
|
|
2107
2105
|
function E(e) {
|
|
2108
2106
|
let t = [];
|
|
2109
2107
|
return (n) => {
|
|
@@ -2115,19 +2113,19 @@ function d(e, t = "") {
|
|
|
2115
2113
|
let n = typeof e == "string" ? e : e.source, r = {
|
|
2116
2114
|
replace: (e, t) => {
|
|
2117
2115
|
let i = typeof t == "string" ? t : t.source;
|
|
2118
|
-
return i = i.replace(
|
|
2116
|
+
return i = i.replace(cn.caret, "$1"), n = n.replace(e, i), r;
|
|
2119
2117
|
},
|
|
2120
2118
|
getRegex: () => new RegExp(n, t)
|
|
2121
2119
|
};
|
|
2122
2120
|
return r;
|
|
2123
2121
|
}
|
|
2124
|
-
var
|
|
2122
|
+
var sn = ((e = "") => {
|
|
2125
2123
|
try {
|
|
2126
2124
|
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
2127
2125
|
} catch {
|
|
2128
2126
|
return !1;
|
|
2129
2127
|
}
|
|
2130
|
-
})(),
|
|
2128
|
+
})(), cn = {
|
|
2131
2129
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
2132
2130
|
outputLinkReplace: /\\([\[\]])/g,
|
|
2133
2131
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -2184,112 +2182,112 @@ var ln = ((e = "") => {
|
|
|
2184
2182
|
headingBeginRegex: E((e) => RegExp(`^ {0,${e}}#`)),
|
|
2185
2183
|
htmlBeginRegex: E((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
|
|
2186
2184
|
blockquoteBeginRegex: E((e) => RegExp(`^ {0,${e}}>`))
|
|
2187
|
-
},
|
|
2188
|
-
blockquote: d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
2189
|
-
code:
|
|
2190
|
-
def:
|
|
2191
|
-
fences:
|
|
2192
|
-
heading:
|
|
2193
|
-
hr:
|
|
2194
|
-
html:
|
|
2195
|
-
lheading:
|
|
2196
|
-
list:
|
|
2197
|
-
newline:
|
|
2198
|
-
paragraph:
|
|
2199
|
-
table:
|
|
2200
|
-
text:
|
|
2201
|
-
},
|
|
2202
|
-
...
|
|
2203
|
-
lheading:
|
|
2204
|
-
table:
|
|
2205
|
-
paragraph: d(
|
|
2206
|
-
},
|
|
2207
|
-
...
|
|
2208
|
-
html: d("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",
|
|
2185
|
+
}, ln = /^(?:[ \t]*(?:\n|$))+/, un = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, dn = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, fn = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, pn = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, mn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, hn = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, gn = d(hn).replace(/bull/g, mn).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}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), _n = d(hn).replace(/bull/g, mn).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}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), vn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, yn = /^[^\n]+/, bn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, xn = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", bn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Sn = d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, mn).getRegex(), Cn = "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", wn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Tn = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\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", wn).replace("tag", Cn).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), le = (e) => d(vn).replace("hr", fn).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Cn).getRegex(), En = le(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), Dn = le(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), On = {
|
|
2186
|
+
blockquote: d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Dn).getRegex(),
|
|
2187
|
+
code: un,
|
|
2188
|
+
def: xn,
|
|
2189
|
+
fences: dn,
|
|
2190
|
+
heading: pn,
|
|
2191
|
+
hr: fn,
|
|
2192
|
+
html: Tn,
|
|
2193
|
+
lheading: gn,
|
|
2194
|
+
list: Sn,
|
|
2195
|
+
newline: ln,
|
|
2196
|
+
paragraph: En,
|
|
2197
|
+
table: on,
|
|
2198
|
+
text: yn
|
|
2199
|
+
}, kn = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", fn).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Cn).getRegex(), An = {
|
|
2200
|
+
...On,
|
|
2201
|
+
lheading: _n,
|
|
2202
|
+
table: kn,
|
|
2203
|
+
paragraph: d(vn).replace("hr", fn).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", kn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Cn).getRegex()
|
|
2204
|
+
}, jn = {
|
|
2205
|
+
...On,
|
|
2206
|
+
html: d("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", wn).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(),
|
|
2209
2207
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
2210
2208
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
2211
|
-
fences:
|
|
2209
|
+
fences: on,
|
|
2212
2210
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
2213
|
-
paragraph: d(
|
|
2214
|
-
},
|
|
2215
|
-
_backpedal:
|
|
2216
|
-
anyPunctuation:
|
|
2217
|
-
autolink:
|
|
2218
|
-
blockSkip:
|
|
2219
|
-
br:
|
|
2220
|
-
code:
|
|
2221
|
-
del:
|
|
2222
|
-
delLDelim:
|
|
2223
|
-
delRDelim:
|
|
2224
|
-
emStrongLDelim:
|
|
2225
|
-
emStrongRDelimAst:
|
|
2226
|
-
emStrongRDelimUnd:
|
|
2227
|
-
escape:
|
|
2228
|
-
link:
|
|
2229
|
-
nolink:
|
|
2230
|
-
punctuation:
|
|
2231
|
-
reflink:
|
|
2232
|
-
reflinkSearch:
|
|
2233
|
-
tag:
|
|
2234
|
-
text:
|
|
2235
|
-
url:
|
|
2211
|
+
paragraph: d(vn).replace("hr", fn).replace("heading", " *#{1,6} *[^\n]").replace("lheading", gn).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
2212
|
+
}, Mn = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Nn = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Pn = /^( {2,}|\\)\n(?!\s*$)/, Fn = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, In = /[\p{P}\p{S}]/u, Ln = /[\s\p{P}\p{S}]/u, Rn = /[^\s\p{P}\p{S}]/u, zn = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Ln).getRegex(), Bn = /(?!~)[\p{P}\p{S}]/u, Vn = /(?!~)[\s\p{P}\p{S}]/u, Hn = /(?:[^\s\p{P}\p{S}]|~)/u, Un = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", sn ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Wn = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Gn = d(Wn, "u").replace(/punct/g, In).getRegex(), Kn = d(Wn, "u").replace(/punct/g, Bn).getRegex(), qn = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Jn = d(qn, "gu").replace(/notPunctSpace/g, Rn).replace(/punctSpace/g, Ln).replace(/punct/g, In).getRegex(), Yn = d(qn, "gu").replace(/notPunctSpace/g, Hn).replace(/punctSpace/g, Vn).replace(/punct/g, Bn).getRegex(), Xn = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Rn).replace(/punctSpace/g, Ln).replace(/punct/g, In).getRegex(), Zn = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, In).getRegex(), Qn = d("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Rn).replace(/punctSpace/g, Ln).replace(/punct/g, In).getRegex(), $n = d(/\\(punct)/, "gu").replace(/punct/g, In).getRegex(), er = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), tr = d(wn).replace("(?:-->|$)", "-->").getRegex(), nr = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", tr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), rr = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, ir = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", rr).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ar = d(/^!?\[(label)\]\[(ref)\]/).replace("label", rr).replace("ref", bn).getRegex(), or = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", bn).getRegex(), sr = d("reflink|nolink(?!\\()", "g").replace("reflink", ar).replace("nolink", or).getRegex(), cr = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, lr = {
|
|
2213
|
+
_backpedal: on,
|
|
2214
|
+
anyPunctuation: $n,
|
|
2215
|
+
autolink: er,
|
|
2216
|
+
blockSkip: Un,
|
|
2217
|
+
br: Pn,
|
|
2218
|
+
code: Nn,
|
|
2219
|
+
del: on,
|
|
2220
|
+
delLDelim: on,
|
|
2221
|
+
delRDelim: on,
|
|
2222
|
+
emStrongLDelim: Gn,
|
|
2223
|
+
emStrongRDelimAst: Jn,
|
|
2224
|
+
emStrongRDelimUnd: Xn,
|
|
2225
|
+
escape: Mn,
|
|
2226
|
+
link: ir,
|
|
2227
|
+
nolink: or,
|
|
2228
|
+
punctuation: zn,
|
|
2229
|
+
reflink: ar,
|
|
2230
|
+
reflinkSearch: sr,
|
|
2231
|
+
tag: nr,
|
|
2232
|
+
text: Fn,
|
|
2233
|
+
url: on
|
|
2234
|
+
}, ur = {
|
|
2235
|
+
...lr,
|
|
2236
|
+
link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", rr).getRegex(),
|
|
2237
|
+
reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", rr).getRegex()
|
|
2238
|
+
}, dr = {
|
|
2239
|
+
...lr,
|
|
2240
|
+
emStrongRDelimAst: Yn,
|
|
2241
|
+
emStrongLDelim: Kn,
|
|
2242
|
+
delLDelim: Zn,
|
|
2243
|
+
delRDelim: Qn,
|
|
2244
|
+
url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", cr).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
2245
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
2246
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
2247
|
+
text: d(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", cr).getRegex()
|
|
2236
2248
|
}, fr = {
|
|
2237
2249
|
...dr,
|
|
2238
|
-
|
|
2239
|
-
|
|
2250
|
+
br: d(Pn).replace("{2,}", "*").getRegex(),
|
|
2251
|
+
text: d(dr.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
2240
2252
|
}, pr = {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
delLDelim: $n,
|
|
2245
|
-
delRDelim: er,
|
|
2246
|
-
url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ur).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
2247
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
2248
|
-
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
2249
|
-
text: d(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ur).getRegex()
|
|
2253
|
+
normal: On,
|
|
2254
|
+
gfm: An,
|
|
2255
|
+
pedantic: jn
|
|
2250
2256
|
}, mr = {
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2257
|
+
normal: lr,
|
|
2258
|
+
gfm: dr,
|
|
2259
|
+
breaks: fr,
|
|
2260
|
+
pedantic: ur
|
|
2254
2261
|
}, hr = {
|
|
2255
|
-
normal: An,
|
|
2256
|
-
gfm: Mn,
|
|
2257
|
-
pedantic: Nn
|
|
2258
|
-
}, gr = {
|
|
2259
|
-
normal: dr,
|
|
2260
|
-
gfm: pr,
|
|
2261
|
-
breaks: mr,
|
|
2262
|
-
pedantic: fr
|
|
2263
|
-
}, _r = {
|
|
2264
2262
|
"&": "&",
|
|
2265
2263
|
"<": "<",
|
|
2266
2264
|
">": ">",
|
|
2267
2265
|
"\"": """,
|
|
2268
2266
|
"'": "'"
|
|
2269
|
-
}, ge = (e) =>
|
|
2267
|
+
}, ge = (e) => hr[e];
|
|
2270
2268
|
function O(e, t) {
|
|
2271
2269
|
if (t) {
|
|
2272
|
-
if (
|
|
2273
|
-
} else if (
|
|
2270
|
+
if (cn.escapeTest.test(e)) return e.replace(cn.escapeReplace, ge);
|
|
2271
|
+
} else if (cn.escapeTestNoEncode.test(e)) return e.replace(cn.escapeReplaceNoEncode, ge);
|
|
2274
2272
|
return e;
|
|
2275
2273
|
}
|
|
2276
2274
|
function V(e) {
|
|
2277
2275
|
try {
|
|
2278
|
-
e = encodeURI(e).replace(
|
|
2276
|
+
e = encodeURI(e).replace(cn.percentDecode, "%");
|
|
2279
2277
|
} catch {
|
|
2280
2278
|
return null;
|
|
2281
2279
|
}
|
|
2282
2280
|
return e;
|
|
2283
2281
|
}
|
|
2284
2282
|
function Y(e, t) {
|
|
2285
|
-
let n = e.replace(
|
|
2283
|
+
let n = e.replace(cn.findPipe, (e, t, n) => {
|
|
2286
2284
|
let r = !1, i = t;
|
|
2287
2285
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
2288
2286
|
return r ? "|" : " |";
|
|
2289
|
-
}).split(
|
|
2287
|
+
}).split(cn.splitPipe), r = 0;
|
|
2290
2288
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
2291
2289
|
else for (; n.length < t;) n.push("");
|
|
2292
|
-
for (; r < n.length; r++) n[r] = n[r].trim().replace(
|
|
2290
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(cn.slashPipe, "|");
|
|
2293
2291
|
return n;
|
|
2294
2292
|
}
|
|
2295
2293
|
function $(e, t, n) {
|
|
@@ -2306,7 +2304,7 @@ function $(e, t, n) {
|
|
|
2306
2304
|
}
|
|
2307
2305
|
function ee(e) {
|
|
2308
2306
|
let t = e.split("\n"), n = t.length - 1;
|
|
2309
|
-
for (; n >= 0 &&
|
|
2307
|
+
for (; n >= 0 && cn.blankLine.test(t[n]);) n--;
|
|
2310
2308
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
2311
2309
|
}
|
|
2312
2310
|
function fe(e, t) {
|
|
@@ -2351,7 +2349,7 @@ function ot(e, t, n) {
|
|
|
2351
2349
|
}
|
|
2352
2350
|
var w = class {
|
|
2353
2351
|
constructor(e) {
|
|
2354
|
-
t(this, "options", void 0), t(this, "rules", void 0), t(this, "lexer", void 0), this.options = e ||
|
|
2352
|
+
t(this, "options", void 0), t(this, "rules", void 0), t(this, "lexer", void 0), this.options = e || an;
|
|
2355
2353
|
}
|
|
2356
2354
|
space(e) {
|
|
2357
2355
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -2801,24 +2799,24 @@ ${c}` : c;
|
|
|
2801
2799
|
};
|
|
2802
2800
|
}
|
|
2803
2801
|
}
|
|
2804
|
-
},
|
|
2802
|
+
}, gr = class l {
|
|
2805
2803
|
constructor(e) {
|
|
2806
|
-
t(this, "tokens", void 0), t(this, "options", void 0), t(this, "state", void 0), t(this, "inlineQueue", void 0), t(this, "tokenizer", void 0), this.tokens = [], this.tokens.links = Object.create(null), this.options = e ||
|
|
2804
|
+
t(this, "tokens", void 0), t(this, "options", void 0), t(this, "state", void 0), t(this, "inlineQueue", void 0), t(this, "tokenizer", void 0), this.tokens = [], this.tokens.links = Object.create(null), this.options = e || an, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
2807
2805
|
inLink: !1,
|
|
2808
2806
|
inRawBlock: !1,
|
|
2809
2807
|
top: !0
|
|
2810
2808
|
};
|
|
2811
2809
|
let n = {
|
|
2812
|
-
other:
|
|
2813
|
-
block:
|
|
2814
|
-
inline:
|
|
2810
|
+
other: cn,
|
|
2811
|
+
block: pr.normal,
|
|
2812
|
+
inline: mr.normal
|
|
2815
2813
|
};
|
|
2816
|
-
this.options.pedantic ? (n.block =
|
|
2814
|
+
this.options.pedantic ? (n.block = pr.pedantic, n.inline = mr.pedantic) : this.options.gfm && (n.block = pr.gfm, this.options.breaks ? n.inline = mr.breaks : n.inline = mr.gfm), this.tokenizer.rules = n;
|
|
2817
2815
|
}
|
|
2818
2816
|
static get rules() {
|
|
2819
2817
|
return {
|
|
2820
|
-
block:
|
|
2821
|
-
inline:
|
|
2818
|
+
block: pr,
|
|
2819
|
+
inline: mr
|
|
2822
2820
|
};
|
|
2823
2821
|
}
|
|
2824
2822
|
static lex(e, t) {
|
|
@@ -2828,7 +2826,7 @@ ${c}` : c;
|
|
|
2828
2826
|
return new l(t).inlineTokens(e);
|
|
2829
2827
|
}
|
|
2830
2828
|
lex(e) {
|
|
2831
|
-
e = e.replace(
|
|
2829
|
+
e = e.replace(cn.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
2832
2830
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
2833
2831
|
let t = this.inlineQueue[e];
|
|
2834
2832
|
this.inlineTokens(t.src, t.tokens);
|
|
@@ -2836,7 +2834,7 @@ ${c}` : c;
|
|
|
2836
2834
|
return this.inlineQueue = [], this.tokens;
|
|
2837
2835
|
}
|
|
2838
2836
|
blockTokens(e, t = [], n = !1) {
|
|
2839
|
-
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(
|
|
2837
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(cn.tabCharGlobal, " ").replace(cn.spaceLine, ""));
|
|
2840
2838
|
let r = Infinity;
|
|
2841
2839
|
for (; e;) {
|
|
2842
2840
|
if (e.length < r) r = e.length;
|
|
@@ -3020,13 +3018,13 @@ ${c}` : c;
|
|
|
3020
3018
|
}
|
|
3021
3019
|
}, y = class {
|
|
3022
3020
|
constructor(e) {
|
|
3023
|
-
t(this, "options", void 0), t(this, "parser", void 0), this.options = e ||
|
|
3021
|
+
t(this, "options", void 0), t(this, "parser", void 0), this.options = e || an;
|
|
3024
3022
|
}
|
|
3025
3023
|
space(e) {
|
|
3026
3024
|
return "";
|
|
3027
3025
|
}
|
|
3028
3026
|
code({ text: e, lang: t, escaped: n }) {
|
|
3029
|
-
let r = (t || "").match(
|
|
3027
|
+
let r = (t || "").match(cn.notSpaceStart)?.[0], i = e.replace(cn.endingNewline, "") + "\n";
|
|
3030
3028
|
return r ? "<pre><code class=\"language-" + O(r) + "\">" + (n ? i : O(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : O(i, !0)) + "</code></pre>\n";
|
|
3031
3029
|
}
|
|
3032
3030
|
blockquote({ tokens: e }) {
|
|
@@ -3154,9 +3152,9 @@ ${e}</tr>
|
|
|
3154
3152
|
checkbox({ raw: e }) {
|
|
3155
3153
|
return e;
|
|
3156
3154
|
}
|
|
3157
|
-
},
|
|
3155
|
+
}, _r = class l {
|
|
3158
3156
|
constructor(e) {
|
|
3159
|
-
t(this, "options", void 0), t(this, "renderer", void 0), t(this, "textRenderer", void 0), this.options = e ||
|
|
3157
|
+
t(this, "options", void 0), t(this, "renderer", void 0), t(this, "textRenderer", void 0), this.options = e || an, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
|
|
3160
3158
|
}
|
|
3161
3159
|
static parse(e, t) {
|
|
3162
3160
|
return new l(t).parse(e);
|
|
@@ -3302,9 +3300,9 @@ ${e}</tr>
|
|
|
3302
3300
|
}
|
|
3303
3301
|
return n;
|
|
3304
3302
|
}
|
|
3305
|
-
},
|
|
3303
|
+
}, vr = (_Class = class {
|
|
3306
3304
|
constructor(e) {
|
|
3307
|
-
t(this, "options", void 0), t(this, "block", void 0), this.options = e ||
|
|
3305
|
+
t(this, "options", void 0), t(this, "block", void 0), this.options = e || an;
|
|
3308
3306
|
}
|
|
3309
3307
|
preprocess(e) {
|
|
3310
3308
|
return e;
|
|
@@ -3319,10 +3317,10 @@ ${e}</tr>
|
|
|
3319
3317
|
return e;
|
|
3320
3318
|
}
|
|
3321
3319
|
provideLexer(e = this.block) {
|
|
3322
|
-
return e ?
|
|
3320
|
+
return e ? gr.lex : gr.lexInline;
|
|
3323
3321
|
}
|
|
3324
3322
|
provideParser(e = this.block) {
|
|
3325
|
-
return e ?
|
|
3323
|
+
return e ? _r.parse : _r.parseInline;
|
|
3326
3324
|
}
|
|
3327
3325
|
}, t(_Class, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
3328
3326
|
"preprocess",
|
|
@@ -3335,7 +3333,7 @@ ${e}</tr>
|
|
|
3335
3333
|
"processAllTokens"
|
|
3336
3334
|
])), _Class), D = class {
|
|
3337
3335
|
constructor(...e) {
|
|
3338
|
-
t(this, "defaults", z()), t(this, "options", this.setOptions), t(this, "parse", this.parseMarkdown(!0)), t(this, "parseInline", this.parseMarkdown(!1)), t(this, "Parser",
|
|
3336
|
+
t(this, "defaults", z()), t(this, "options", this.setOptions), t(this, "parse", this.parseMarkdown(!0)), t(this, "parseInline", this.parseMarkdown(!1)), t(this, "Parser", _r), t(this, "Renderer", y), t(this, "TextRenderer", L), t(this, "Lexer", gr), t(this, "Tokenizer", w), t(this, "Hooks", vr), this.use(...e);
|
|
3339
3337
|
}
|
|
3340
3338
|
walkTokens(e, t) {
|
|
3341
3339
|
let n = [];
|
|
@@ -3414,13 +3412,13 @@ ${e}</tr>
|
|
|
3414
3412
|
n.tokenizer = t;
|
|
3415
3413
|
}
|
|
3416
3414
|
if (e.hooks) {
|
|
3417
|
-
let t = this.defaults.hooks || new
|
|
3415
|
+
let t = this.defaults.hooks || new vr();
|
|
3418
3416
|
for (let n in e.hooks) {
|
|
3419
3417
|
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
3420
3418
|
if (["options", "block"].includes(n)) continue;
|
|
3421
3419
|
let r = n, i = e.hooks[r], a = t[r];
|
|
3422
|
-
|
|
3423
|
-
if (this.defaults.async &&
|
|
3420
|
+
vr.passThroughHooks.has(n) ? t[r] = (e) => {
|
|
3421
|
+
if (this.defaults.async && vr.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
3424
3422
|
let n = await i.call(t, e);
|
|
3425
3423
|
return a.call(t, n);
|
|
3426
3424
|
})();
|
|
@@ -3457,10 +3455,10 @@ ${e}</tr>
|
|
|
3457
3455
|
}, this;
|
|
3458
3456
|
}
|
|
3459
3457
|
lexer(e, t) {
|
|
3460
|
-
return
|
|
3458
|
+
return gr.lex(e, t ?? this.defaults);
|
|
3461
3459
|
}
|
|
3462
3460
|
parser(e, t) {
|
|
3463
|
-
return
|
|
3461
|
+
return _r.parse(e, t ?? this.defaults);
|
|
3464
3462
|
}
|
|
3465
3463
|
parseMarkdown(e) {
|
|
3466
3464
|
return (t, n) => {
|
|
@@ -3472,16 +3470,16 @@ ${e}</tr>
|
|
|
3472
3470
|
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
3473
3471
|
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
3474
3472
|
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
3475
|
-
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ?
|
|
3473
|
+
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? gr.lex : gr.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
|
|
3476
3474
|
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
3477
|
-
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ?
|
|
3475
|
+
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? _r.parse : _r.parseInline)(a, i);
|
|
3478
3476
|
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
3479
3477
|
})().catch(a);
|
|
3480
3478
|
try {
|
|
3481
3479
|
i.hooks && (t = i.hooks.preprocess(t));
|
|
3482
|
-
let n = (i.hooks ? i.hooks.provideLexer(e) : e ?
|
|
3480
|
+
let n = (i.hooks ? i.hooks.provideLexer(e) : e ? gr.lex : gr.lexInline)(t, i);
|
|
3483
3481
|
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
3484
|
-
let r = (i.hooks ? i.hooks.provideParser(e) : e ?
|
|
3482
|
+
let r = (i.hooks ? i.hooks.provideParser(e) : e ? _r.parse : _r.parseInline)(n, i);
|
|
3485
3483
|
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
3486
3484
|
} catch (e) {
|
|
3487
3485
|
return a(e);
|
|
@@ -3498,20 +3496,20 @@ ${e}</tr>
|
|
|
3498
3496
|
throw n;
|
|
3499
3497
|
};
|
|
3500
3498
|
}
|
|
3501
|
-
},
|
|
3499
|
+
}, yr = new D();
|
|
3502
3500
|
function g(e, t) {
|
|
3503
|
-
return
|
|
3501
|
+
return yr.parse(e, t);
|
|
3504
3502
|
}
|
|
3505
3503
|
g.options = g.setOptions = function(e) {
|
|
3506
|
-
return
|
|
3507
|
-
}, g.getDefaults = z, g.defaults =
|
|
3508
|
-
return
|
|
3504
|
+
return yr.setOptions(e), g.defaults = yr.defaults, N(g.defaults), g;
|
|
3505
|
+
}, g.getDefaults = z, g.defaults = an, g.use = function(...e) {
|
|
3506
|
+
return yr.use(...e), g.defaults = yr.defaults, N(g.defaults), g;
|
|
3509
3507
|
}, g.walkTokens = function(e, t) {
|
|
3510
|
-
return
|
|
3511
|
-
}, g.parseInline =
|
|
3508
|
+
return yr.walkTokens(e, t);
|
|
3509
|
+
}, g.parseInline = yr.parseInline, g.Parser = _r, g.parser = _r.parse, g.Renderer = y, g.TextRenderer = L, g.Lexer = gr, g.lexer = gr.lex, g.Tokenizer = w, g.Hooks = vr, g.parse = g, g.options, g.setOptions, g.use, g.walkTokens, g.parseInline, _r.parse, gr.lex;
|
|
3512
3510
|
//#endregion
|
|
3513
|
-
//#region
|
|
3514
|
-
var
|
|
3511
|
+
//#region bot/ui/ChatCardBlock.vue?vue&type=script&setup=true&lang.ts
|
|
3512
|
+
var br = ["aria-label"], xr = { class: "px-4 pb-2 pt-4" }, Sr = ["innerHTML"], Cr = ["onClick"], wr = /* @__PURE__ */ k({
|
|
3515
3513
|
__name: "ChatCardBlock",
|
|
3516
3514
|
props: {
|
|
3517
3515
|
spec: {},
|
|
@@ -3519,11 +3517,11 @@ var Sr = ["aria-label"], Cr = { class: "px-4 pb-2 pt-4" }, wr = ["innerHTML"], T
|
|
|
3519
3517
|
},
|
|
3520
3518
|
emits: ["action"],
|
|
3521
3519
|
setup(e, { emit: t }) {
|
|
3522
|
-
let n = e, r = t, i =
|
|
3520
|
+
let n = e, r = t, i = _(() => {
|
|
3523
3521
|
if (!n.spec.body) return "";
|
|
3524
3522
|
let e = g.parse(n.spec.body, { async: !1 });
|
|
3525
|
-
return
|
|
3526
|
-
}), a =
|
|
3523
|
+
return rn.sanitize(e, { ADD_ATTR: ["target"] });
|
|
3524
|
+
}), a = _(() => n.inverted ? "rgba(255, 255, 255, 0.22)" : "rgba(0, 0, 0, 0.16)"), o = _(() => n.inverted ? "rgba(255, 255, 255, 0.12)" : "color-mix(in oklch, var(--color-theme-200) 80%, transparent)"), s = _(() => n.inverted ? "rgba(255, 255, 255, 0.95)" : "var(--color-theme-900)"), c = _(() => n.inverted ? "rgba(255, 255, 255, 0.8)" : "var(--color-theme-800)"), u = _(() => n.inverted ? `inset 0 0 0 1px ${a.value}` : `inset 0 0 0 1px ${a.value}, 0 4px 16px rgba(15, 23, 42, 0.05)`), f = _(() => n.inverted ? "transparent" : "var(--color-theme-0)");
|
|
3527
3525
|
function actionStyle(e) {
|
|
3528
3526
|
return e === "primary" || e === "destructive" ? {
|
|
3529
3527
|
background: n.inverted ? "rgba(255, 255, 255, 0.92)" : "var(--color-theme-900)",
|
|
@@ -3533,45 +3531,45 @@ var Sr = ["aria-label"], Cr = { class: "px-4 pb-2 pt-4" }, wr = ["innerHTML"], T
|
|
|
3533
3531
|
color: s.value
|
|
3534
3532
|
};
|
|
3535
3533
|
}
|
|
3536
|
-
return (t, n) => (
|
|
3534
|
+
return (t, n) => (M(), x("div", {
|
|
3537
3535
|
"data-test": "chat-card",
|
|
3538
3536
|
class: "my-6 w-full self-start overflow-hidden rounded-2xl",
|
|
3539
|
-
style:
|
|
3537
|
+
style: j({
|
|
3540
3538
|
background: f.value,
|
|
3541
3539
|
boxShadow: u.value
|
|
3542
3540
|
}),
|
|
3543
3541
|
"aria-label": e.spec.title
|
|
3544
3542
|
}, [
|
|
3545
|
-
S("div",
|
|
3543
|
+
S("div", xr, [S("div", {
|
|
3546
3544
|
class: "text-[14px] font-semibold leading-tight",
|
|
3547
|
-
style:
|
|
3548
|
-
},
|
|
3549
|
-
i.value ? (
|
|
3545
|
+
style: j({ color: s.value })
|
|
3546
|
+
}, R(e.spec.title), 5)]),
|
|
3547
|
+
i.value ? (M(), x("div", {
|
|
3550
3548
|
key: 0,
|
|
3551
3549
|
class: "chat-msg-prose px-4 pb-4 pt-2 text-[14px] leading-relaxed",
|
|
3552
|
-
style:
|
|
3550
|
+
style: j({ color: c.value }),
|
|
3553
3551
|
innerHTML: i.value
|
|
3554
|
-
}, null, 12,
|
|
3555
|
-
e.spec.actions?.length ? (
|
|
3552
|
+
}, null, 12, Sr)) : b("", !0),
|
|
3553
|
+
e.spec.actions?.length ? (M(), x("div", {
|
|
3556
3554
|
key: 1,
|
|
3557
3555
|
class: "flex flex-wrap items-center gap-2 px-3 py-2.5",
|
|
3558
|
-
style:
|
|
3559
|
-
}, [(
|
|
3556
|
+
style: j({ borderTop: `1px solid ${o.value}` })
|
|
3557
|
+
}, [(M(!0), x(m, null, F(e.spec.actions, (e) => (M(), x("button", {
|
|
3560
3558
|
key: e.label,
|
|
3561
3559
|
type: "button",
|
|
3562
3560
|
"data-test": "chat-card-action",
|
|
3563
3561
|
class: "inline-flex h-10 items-center justify-center rounded-full px-5 text-[14px] font-semibold transition-colors duration-150 active:opacity-80",
|
|
3564
|
-
style:
|
|
3562
|
+
style: j(actionStyle(e.style)),
|
|
3565
3563
|
onClick: (t) => r("action", e.reply)
|
|
3566
|
-
},
|
|
3567
|
-
], 12,
|
|
3564
|
+
}, R(e.label), 13, Cr))), 128))], 4)) : b("", !0)
|
|
3565
|
+
], 12, br));
|
|
3568
3566
|
}
|
|
3569
|
-
}),
|
|
3567
|
+
}), Tr = 112, Er = 52, Dr = 14, Or = 54, kr = 34, Ar = 260;
|
|
3570
3568
|
function nodeWidthFor(e) {
|
|
3571
3569
|
let { orientation: t, maxRows: n, maxWidth: r } = e;
|
|
3572
|
-
if (t === "horizontal" || !r) return
|
|
3573
|
-
let i = r -
|
|
3574
|
-
return Math.min(
|
|
3570
|
+
if (t === "horizontal" || !r) return Tr;
|
|
3571
|
+
let i = r - Dr * 2 - (n - 1) * Or;
|
|
3572
|
+
return Math.min(Ar, Math.max(Tr, Math.floor(i / n)));
|
|
3575
3573
|
}
|
|
3576
3574
|
function orientationFor(e) {
|
|
3577
3575
|
return e.layout === "left-to-right" || e.layout === "radial" ? "horizontal" : e.layout === "top-to-bottom" ? "vertical" : e.diagramType === "sequence" ? "horizontal" : "vertical";
|
|
@@ -3608,11 +3606,11 @@ function buildLayout(e, t, n) {
|
|
|
3608
3606
|
orientation: t,
|
|
3609
3607
|
maxRows: o,
|
|
3610
3608
|
...n === void 0 ? {} : { maxWidth: n }
|
|
3611
|
-
}), u = t === "horizontal" ?
|
|
3609
|
+
}), u = t === "horizontal" ? Dr * 2 + s * c + (s - 1) * Or : Dr * 2 + o * c + (o - 1) * Or, f = t === "horizontal" ? Dr * 2 + o * Er + (o - 1) * kr : Dr * 2 + s * Er + (s - 1) * kr, p = [];
|
|
3612
3610
|
for (let [e, [, n]] of a.entries()) {
|
|
3613
|
-
let r = (o - n.length) * (t === "horizontal" ? 86 : c +
|
|
3611
|
+
let r = (o - n.length) * (t === "horizontal" ? 86 : c + Or) / 2;
|
|
3614
3612
|
for (let [i, a] of n.entries()) {
|
|
3615
|
-
let n = t === "horizontal" ?
|
|
3613
|
+
let n = t === "horizontal" ? Dr + e * (c + Or) : Dr + r + i * (c + Or), o = t === "horizontal" ? Dr + r + i * 86 : Dr + e * 86;
|
|
3616
3614
|
p.push({
|
|
3617
3615
|
id: a.id,
|
|
3618
3616
|
label: a.label,
|
|
@@ -3621,7 +3619,7 @@ function buildLayout(e, t, n) {
|
|
|
3621
3619
|
x: n,
|
|
3622
3620
|
y: o,
|
|
3623
3621
|
width: c,
|
|
3624
|
-
height:
|
|
3622
|
+
height: Er
|
|
3625
3623
|
});
|
|
3626
3624
|
}
|
|
3627
3625
|
}
|
|
@@ -3651,7 +3649,7 @@ function buildLayout(e, t, n) {
|
|
|
3651
3649
|
};
|
|
3652
3650
|
}
|
|
3653
3651
|
//#endregion
|
|
3654
|
-
//#region
|
|
3652
|
+
//#region bot/ui/chat-visual-format.ts
|
|
3655
3653
|
function formatChatVisualValue(e) {
|
|
3656
3654
|
let { value: t } = e, n = Math.abs(t);
|
|
3657
3655
|
return n >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : n >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : Number.isInteger(t) ? `${t}` : t.toFixed(1);
|
|
@@ -3698,14 +3696,14 @@ function formatChatVisualTick(e) {
|
|
|
3698
3696
|
let { prefix: r, suffix: i } = affixes(n);
|
|
3699
3697
|
return `${r}${formatChatVisualValue({ value: t })}${i}`;
|
|
3700
3698
|
}
|
|
3701
|
-
var
|
|
3699
|
+
var jr = 5.4, Mr = 10, Nr = 15, Pr = 16;
|
|
3702
3700
|
function planChatVisualXLabels(e) {
|
|
3703
3701
|
let { labels: t, plotWidth: n } = e;
|
|
3704
3702
|
if (!t.length || n <= 0) return {
|
|
3705
3703
|
mode: "horizontal",
|
|
3706
3704
|
entries: []
|
|
3707
3705
|
};
|
|
3708
|
-
let r = t.map((e) => e.length >
|
|
3706
|
+
let r = t.map((e) => e.length > Pr ? `${e.slice(0, Pr - 1).trimEnd()}\u2026` : e), i = t.length - 1;
|
|
3709
3707
|
if (i === 0) return {
|
|
3710
3708
|
mode: "horizontal",
|
|
3711
3709
|
entries: [{
|
|
@@ -3713,14 +3711,14 @@ function planChatVisualXLabels(e) {
|
|
|
3713
3711
|
text: r[0]
|
|
3714
3712
|
}]
|
|
3715
3713
|
};
|
|
3716
|
-
if ((Math.max(...r.map((e) => e.length *
|
|
3714
|
+
if ((Math.max(...r.map((e) => e.length * jr)) + Mr) * t.length <= n) return {
|
|
3717
3715
|
mode: "horizontal",
|
|
3718
3716
|
entries: r.map((e, t) => ({
|
|
3719
3717
|
index: t,
|
|
3720
3718
|
text: e
|
|
3721
3719
|
}))
|
|
3722
3720
|
};
|
|
3723
|
-
let a = Math.max(2, Math.floor(n /
|
|
3721
|
+
let a = Math.max(2, Math.floor(n / Nr));
|
|
3724
3722
|
if (t.length <= a) return {
|
|
3725
3723
|
mode: "angled",
|
|
3726
3724
|
entries: r.map((e, t) => ({
|
|
@@ -3739,23 +3737,23 @@ function planChatVisualXLabels(e) {
|
|
|
3739
3737
|
};
|
|
3740
3738
|
}
|
|
3741
3739
|
//#endregion
|
|
3742
|
-
//#region
|
|
3743
|
-
var
|
|
3740
|
+
//#region bot/ui/ChatVisualBlock.vue?vue&type=script&setup=true&lang.ts
|
|
3741
|
+
var Fr = [
|
|
3744
3742
|
"data-visual-type",
|
|
3745
3743
|
"data-chart-type",
|
|
3746
3744
|
"data-stacking",
|
|
3747
3745
|
"data-diagram-type",
|
|
3748
3746
|
"aria-label"
|
|
3749
|
-
],
|
|
3747
|
+
], Ir = { class: "mb-2.5" }, Lr = ["aria-label"], Rr = {
|
|
3750
3748
|
key: 0,
|
|
3751
3749
|
"data-test": "chat-visual-horizontal-bars",
|
|
3752
3750
|
class: "grid gap-3"
|
|
3753
|
-
},
|
|
3751
|
+
}, zr = { class: "mb-1 flex items-start justify-between gap-3 text-[12px]" }, Br = ["viewBox"], Vr = [
|
|
3754
3752
|
"x1",
|
|
3755
3753
|
"x2",
|
|
3756
3754
|
"y1",
|
|
3757
3755
|
"y2"
|
|
3758
|
-
],
|
|
3756
|
+
], Hr = ["x", "y"], Ur = [
|
|
3759
3757
|
"data-row-index",
|
|
3760
3758
|
"data-series-index",
|
|
3761
3759
|
"data-data-key",
|
|
@@ -3763,56 +3761,56 @@ var Lr = [
|
|
|
3763
3761
|
"y",
|
|
3764
3762
|
"width",
|
|
3765
3763
|
"height"
|
|
3766
|
-
],
|
|
3764
|
+
], Wr = ["data-trend-key", "d"], Gr = ["d"], Kr = ["cx", "cy"], qr = ["cx", "cy"], Jr = [
|
|
3767
3765
|
"x",
|
|
3768
3766
|
"y",
|
|
3769
3767
|
"text-anchor",
|
|
3770
3768
|
"transform"
|
|
3771
|
-
],
|
|
3769
|
+
], Yr = {
|
|
3772
3770
|
key: 2,
|
|
3773
3771
|
class: "mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5"
|
|
3774
|
-
},
|
|
3772
|
+
}, Xr = {
|
|
3775
3773
|
key: 1,
|
|
3776
3774
|
class: "grid gap-3"
|
|
3777
|
-
},
|
|
3775
|
+
}, Zr = { class: "mb-1 flex items-baseline justify-between gap-3 text-[12px]" }, Qr = { class: "shrink-0 tabular-nums" }, $r = {
|
|
3778
3776
|
key: 2,
|
|
3779
3777
|
class: "overflow-x-auto"
|
|
3780
|
-
},
|
|
3778
|
+
}, ei = ["viewBox", "aria-label"], ti = [
|
|
3781
3779
|
"data-from",
|
|
3782
3780
|
"data-to",
|
|
3783
3781
|
"x1",
|
|
3784
3782
|
"y1",
|
|
3785
3783
|
"x2",
|
|
3786
3784
|
"y2"
|
|
3787
|
-
],
|
|
3785
|
+
], ni = ["cx", "cy"], ri = ["x", "y"], ii = [
|
|
3788
3786
|
"data-node-id",
|
|
3789
3787
|
"data-node-kind",
|
|
3790
3788
|
"transform"
|
|
3791
|
-
],
|
|
3789
|
+
], ai = ["points"], oi = ["width", "height"], si = ["width", "height"], ci = {
|
|
3792
3790
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
3793
3791
|
class: "flex h-full min-w-0 flex-col items-center justify-center text-center"
|
|
3794
|
-
},
|
|
3792
|
+
}, li = /* @__PURE__ */ k({
|
|
3795
3793
|
__name: "ChatVisualBlock",
|
|
3796
3794
|
props: {
|
|
3797
3795
|
result: {},
|
|
3798
3796
|
inverted: { type: Boolean }
|
|
3799
3797
|
},
|
|
3800
3798
|
setup(e) {
|
|
3801
|
-
let t = e, n =
|
|
3802
|
-
|
|
3799
|
+
let t = e, n = P(), r = I(360), i;
|
|
3800
|
+
re(() => {
|
|
3803
3801
|
typeof ResizeObserver > "u" || !n.value || (i = new ResizeObserver((e) => {
|
|
3804
3802
|
let t = e[0]?.contentRect.width;
|
|
3805
3803
|
t && (r.value = Math.round(t));
|
|
3806
3804
|
}), i.observe(n.value));
|
|
3807
|
-
}),
|
|
3808
|
-
let a =
|
|
3805
|
+
}), ne(() => i?.disconnect());
|
|
3806
|
+
let a = _(() => Math.min(720, Math.max(280, r.value))), o = _(() => t.result.ok ? t.result.spec : null), s = _(() => o.value?.visualType === "chart" ? o.value : null), c = _(() => o.value?.visualType === "diagram" ? o.value : null);
|
|
3809
3807
|
function isCartesianChart(e) {
|
|
3810
3808
|
return e?.chartType === "bar" || e?.chartType === "line" || e?.chartType === "scatter";
|
|
3811
3809
|
}
|
|
3812
3810
|
function isPieChart(e) {
|
|
3813
3811
|
return e?.chartType === "pie";
|
|
3814
3812
|
}
|
|
3815
|
-
let u =
|
|
3813
|
+
let u = _(() => s.value?.data ?? []), f = _(() => isCartesianChart(s.value) ? s.value : null), p = _(() => f.value?.series ?? []), h = _(() => isPieChart(s.value) ? s.value : null), v = _(() => f.value?.chartType === "bar" && f.value.stacking === "stacked");
|
|
3816
3814
|
function numericValue(e) {
|
|
3817
3815
|
return typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
3818
3816
|
}
|
|
@@ -3844,7 +3842,7 @@ var Lr = [
|
|
|
3844
3842
|
intercept: (r - s * n) / t
|
|
3845
3843
|
};
|
|
3846
3844
|
}
|
|
3847
|
-
let
|
|
3845
|
+
let C = _(() => {
|
|
3848
3846
|
let e = [], t = f.value;
|
|
3849
3847
|
if (!t) return e;
|
|
3850
3848
|
if (t.chartType === "bar" && t.stacking === "stacked") for (let n of t.data) {
|
|
@@ -3874,8 +3872,8 @@ var Lr = [
|
|
|
3874
3872
|
let n = e > 0 ? e : 1, r = Math.floor(Math.log10(n)), i = n / 10 ** r, a;
|
|
3875
3873
|
return a = t ? i < 1.5 ? 1 : i < 3 ? 2 : i < 7 ? 5 : 10 : i <= 1 ? 1 : i <= 2 ? 2 : i <= 5 ? 5 : 10, a * 10 ** r;
|
|
3876
3874
|
}
|
|
3877
|
-
let
|
|
3878
|
-
let e =
|
|
3875
|
+
let T = _(() => {
|
|
3876
|
+
let e = C.value, t = e.length ? Math.max(0, ...e) : 1, n = e.length ? Math.min(0, ...e) : 0;
|
|
3879
3877
|
if (n === t) return {
|
|
3880
3878
|
min: 0,
|
|
3881
3879
|
max: t || 1,
|
|
@@ -3888,7 +3886,7 @@ var Lr = [
|
|
|
3888
3886
|
max: a,
|
|
3889
3887
|
ticks: o
|
|
3890
3888
|
};
|
|
3891
|
-
}),
|
|
3889
|
+
}), k = _(() => resolveSharedSeriesFormat({ series: p.value })), te = _(() => {
|
|
3892
3890
|
let e = f.value;
|
|
3893
3891
|
if (!e) return {
|
|
3894
3892
|
mode: "horizontal",
|
|
@@ -3899,8 +3897,8 @@ var Lr = [
|
|
|
3899
3897
|
labels: e.data.map((e) => String(e?.[t] ?? "")),
|
|
3900
3898
|
plotWidth: Math.max(200, a.value - 42)
|
|
3901
3899
|
});
|
|
3902
|
-
}), A =
|
|
3903
|
-
let e =
|
|
3900
|
+
}), A = _(() => {
|
|
3901
|
+
let e = k.value?.valueFormat, t = !!(k.value && (e === "currency" || e === "percent" || k.value.valuePrefix || k.value.valueSuffix)), n = e === "duration" ? 46 : t ? 38 : 30, r = te.value.mode === "angled";
|
|
3904
3902
|
return {
|
|
3905
3903
|
width: a.value,
|
|
3906
3904
|
height: 168 + (r ? 36 : 0),
|
|
@@ -3923,7 +3921,7 @@ var Lr = [
|
|
|
3923
3921
|
return t <= 1 ? n.left + r / 2 : n.left + r * e / (t - 1);
|
|
3924
3922
|
}
|
|
3925
3923
|
function yForValue(e) {
|
|
3926
|
-
let { min: t, max: n } =
|
|
3924
|
+
let { min: t, max: n } = T.value, r = A.value, i = r.height - r.top - r.bottom;
|
|
3927
3925
|
return r.top + (n - e) / (n - t || 1) * i;
|
|
3928
3926
|
}
|
|
3929
3927
|
function pathForSeries(e) {
|
|
@@ -3933,7 +3931,7 @@ var Lr = [
|
|
|
3933
3931
|
return `${r === 0 ? "M" : "L"} ${xForIndex(r, t.data.length).toFixed(1)} ${yForValue(i).toFixed(1)}`;
|
|
3934
3932
|
}).join(" ") : "";
|
|
3935
3933
|
}
|
|
3936
|
-
let
|
|
3934
|
+
let ie = _(() => {
|
|
3937
3935
|
let e = f.value;
|
|
3938
3936
|
if (!e?.trendLine || e.chartType !== "line" && e.chartType !== "scatter") return null;
|
|
3939
3937
|
let t = trendLinePoints(e, e.trendLine.dataKey), n = linearTrend(t);
|
|
@@ -3944,11 +3942,11 @@ var Lr = [
|
|
|
3944
3942
|
dataKey: e.trendLine.dataKey,
|
|
3945
3943
|
seriesIndex: s
|
|
3946
3944
|
};
|
|
3947
|
-
}),
|
|
3945
|
+
}), ae = _(() => {
|
|
3948
3946
|
let e = f.value;
|
|
3949
3947
|
if (!e || e.chartType !== "bar") return [];
|
|
3950
3948
|
let t = A.value, n = (t.width - t.left - t.right) / Math.max(e.data.length, 1), r = yForValue(0);
|
|
3951
|
-
if (
|
|
3949
|
+
if (v.value) {
|
|
3952
3950
|
let r = Math.max(4, Math.min(24, n * .42));
|
|
3953
3951
|
return e.data.flatMap((i, a) => {
|
|
3954
3952
|
let o = 0, s = 0, c = t.left + a * n + (n - r) / 2;
|
|
@@ -3981,12 +3979,12 @@ var Lr = [
|
|
|
3981
3979
|
dataKey: e.dataKey
|
|
3982
3980
|
};
|
|
3983
3981
|
}));
|
|
3984
|
-
}),
|
|
3982
|
+
}), oe = _(() => {
|
|
3985
3983
|
let e = f.value;
|
|
3986
3984
|
if (!e) return [];
|
|
3987
3985
|
let t = e.data;
|
|
3988
3986
|
if (!t.length) return [];
|
|
3989
|
-
let n = t.length - 1, r =
|
|
3987
|
+
let n = t.length - 1, r = te.value, i = r.mode === "angled";
|
|
3990
3988
|
return r.entries.map(({ index: e, text: r }) => ({
|
|
3991
3989
|
key: `${e}`,
|
|
3992
3990
|
label: r,
|
|
@@ -3994,9 +3992,9 @@ var Lr = [
|
|
|
3994
3992
|
anchor: i ? "end" : e === 0 ? "start" : e === n ? "end" : "middle",
|
|
3995
3993
|
angled: i
|
|
3996
3994
|
})).filter((e) => e.label);
|
|
3997
|
-
}),
|
|
3995
|
+
}), se = _(() => {
|
|
3998
3996
|
let e = f.value;
|
|
3999
|
-
if (!e || e.chartType !== "bar" || e.series.length !== 1 ||
|
|
3997
|
+
if (!e || e.chartType !== "bar" || e.series.length !== 1 || v.value) return [];
|
|
4000
3998
|
let t = e.series[0], n = e.data.map((n, r) => {
|
|
4001
3999
|
let i = categoryLabel(n, e.xKey), a = numericValue(n[t.dataKey]);
|
|
4002
4000
|
return !i || a === null ? null : {
|
|
@@ -4017,7 +4015,7 @@ var Lr = [
|
|
|
4017
4015
|
width: e.rawValue <= 0 ? 0 : Math.max(2, e.rawValue / r * 100),
|
|
4018
4016
|
seriesIndex: 0
|
|
4019
4017
|
}));
|
|
4020
|
-
}),
|
|
4018
|
+
}), ce = _(() => {
|
|
4021
4019
|
let e = f.value;
|
|
4022
4020
|
if (!e?.data.length) return [];
|
|
4023
4021
|
let t = e.data[e.data.length - 1];
|
|
@@ -4033,7 +4031,7 @@ var Lr = [
|
|
|
4033
4031
|
seriesIndex: n
|
|
4034
4032
|
};
|
|
4035
4033
|
});
|
|
4036
|
-
}),
|
|
4034
|
+
}), ue = _(() => {
|
|
4037
4035
|
let e = f.value;
|
|
4038
4036
|
if (!e?.data.length || e.chartType !== "line") return [];
|
|
4039
4037
|
let t = e.data.length - 1, n = e.data[t];
|
|
@@ -4046,8 +4044,8 @@ var Lr = [
|
|
|
4046
4044
|
seriesIndex: i
|
|
4047
4045
|
};
|
|
4048
4046
|
}).filter((e) => e !== null);
|
|
4049
|
-
}),
|
|
4050
|
-
let e =
|
|
4047
|
+
}), de = _(() => {
|
|
4048
|
+
let e = h.value;
|
|
4051
4049
|
if (!e) return [];
|
|
4052
4050
|
let t = e.data.map((t) => ({
|
|
4053
4051
|
name: String(t[e.nameKey] ?? ""),
|
|
@@ -4062,83 +4060,83 @@ var Lr = [
|
|
|
4062
4060
|
series: r
|
|
4063
4061
|
})
|
|
4064
4062
|
}));
|
|
4065
|
-
}),
|
|
4063
|
+
}), pe = _(() => c.value ? layoutChatDiagram(c.value, { maxWidth: r.value }) : null), he = [
|
|
4066
4064
|
"var(--color-theme-900)",
|
|
4067
4065
|
"var(--color-primary-500)",
|
|
4068
4066
|
"color-mix(in oklch, var(--color-primary-500) 55%, var(--color-theme-500))"
|
|
4069
|
-
],
|
|
4067
|
+
], _e = [
|
|
4070
4068
|
"rgba(255, 255, 255, 0.92)",
|
|
4071
4069
|
"color-mix(in oklch, white 30%, var(--color-primary-500))",
|
|
4072
4070
|
"rgba(255, 255, 255, 0.55)"
|
|
4073
4071
|
];
|
|
4074
4072
|
function seriesColor(e) {
|
|
4075
|
-
let n = t.inverted ?
|
|
4073
|
+
let n = t.inverted ? _e : he;
|
|
4076
4074
|
return n[e % n.length];
|
|
4077
4075
|
}
|
|
4078
4076
|
function diagramNodeFill(e) {
|
|
4079
4077
|
return t.inverted ? e === "decision" ? "rgba(255, 255, 255, 0.1)" : "rgba(255, 255, 255, 0.06)" : e === "decision" ? "color-mix(in oklch, var(--color-primary-500) 6%, var(--color-theme-0))" : e === "output" ? "color-mix(in oklch, var(--color-theme-900) 5%, var(--color-theme-0))" : "var(--color-theme-0)";
|
|
4080
4078
|
}
|
|
4081
4079
|
function diagramNodeStroke(e) {
|
|
4082
|
-
return t.inverted ? "rgba(255, 255, 255, 0.22)" :
|
|
4080
|
+
return t.inverted ? "rgba(255, 255, 255, 0.22)" : W.value;
|
|
4083
4081
|
}
|
|
4084
|
-
let
|
|
4085
|
-
return (e, r) => o.value ? (
|
|
4082
|
+
let ve = _(() => t.inverted ? "rgba(255, 255, 255, 0.95)" : "var(--color-theme-900)"), ye = _(() => t.inverted ? "rgba(255, 255, 255, 0.6)" : "var(--color-theme-500)"), H = _(() => t.inverted ? "rgba(255, 255, 255, 0.45)" : "color-mix(in oklch, var(--color-theme-900) 42%, transparent)"), be = _(() => t.inverted ? "rgba(255, 255, 255, 0.1)" : "color-mix(in oklch, var(--color-theme-900) 8%, transparent)"), U = _(() => t.inverted ? "rgba(255, 255, 255, 0.24)" : "color-mix(in oklch, var(--color-theme-900) 18%, transparent)"), W = _(() => t.inverted ? "rgba(255, 255, 255, 0.16)" : "color-mix(in oklch, var(--color-theme-300) 55%, transparent)"), G = _(() => t.inverted ? "rgba(255, 255, 255, 0.14)" : "color-mix(in oklch, var(--color-theme-900) 10%, transparent)"), Se = _(() => t.inverted ? "transparent" : "var(--color-theme-0)"), Ce = _(() => t.inverted ? "rgba(255, 255, 255, 0.18)" : "color-mix(in oklch, var(--color-theme-900) 16%, transparent)"), we = _(() => t.inverted ? "rgba(255, 255, 255, 0.12)" : "color-mix(in oklch, var(--color-theme-900) 9%, transparent)");
|
|
4083
|
+
return (e, r) => o.value ? (M(), x("section", {
|
|
4086
4084
|
key: 0,
|
|
4087
4085
|
"data-test": "chat-visual",
|
|
4088
4086
|
"data-visual-type": o.value.visualType,
|
|
4089
4087
|
"data-chart-type": s.value?.chartType,
|
|
4090
|
-
"data-stacking":
|
|
4088
|
+
"data-stacking": v.value ? "stacked" : void 0,
|
|
4091
4089
|
"data-diagram-type": c.value?.diagramType,
|
|
4092
4090
|
class: "my-6 w-full rounded-[20px] px-4 pb-3.5 pt-4",
|
|
4093
|
-
style:
|
|
4094
|
-
background:
|
|
4095
|
-
boxShadow: `inset 0 0 0 1px ${
|
|
4091
|
+
style: j({
|
|
4092
|
+
background: Se.value,
|
|
4093
|
+
boxShadow: `inset 0 0 0 1px ${G.value}`
|
|
4096
4094
|
}),
|
|
4097
4095
|
"aria-label": o.value.meta.title
|
|
4098
4096
|
}, [
|
|
4099
|
-
S("header",
|
|
4097
|
+
S("header", Ir, [S("h4", {
|
|
4100
4098
|
class: "text-[13px] font-semibold leading-tight",
|
|
4101
|
-
style:
|
|
4102
|
-
},
|
|
4099
|
+
style: j({ color: ve.value })
|
|
4100
|
+
}, R(o.value.meta.title), 5), o.value.meta.description ? (M(), x("p", {
|
|
4103
4101
|
key: 0,
|
|
4104
4102
|
class: "mt-0.5 text-[12px] leading-snug",
|
|
4105
|
-
style:
|
|
4106
|
-
},
|
|
4103
|
+
style: j({ color: ye.value })
|
|
4104
|
+
}, R(o.value.meta.description), 5)) : b("", !0)]),
|
|
4107
4105
|
S("div", {
|
|
4108
4106
|
ref_key: "bodyEl",
|
|
4109
4107
|
ref: n
|
|
4110
|
-
}, [f.value ? (
|
|
4108
|
+
}, [f.value ? (M(), x("div", {
|
|
4111
4109
|
key: 0,
|
|
4112
4110
|
role: "img",
|
|
4113
4111
|
"aria-label": o.value.meta.title
|
|
4114
|
-
}, [
|
|
4112
|
+
}, [se.value.length ? (M(), x("div", Rr, [(M(!0), x(m, null, F(se.value, (e) => (M(), x("div", {
|
|
4115
4113
|
key: e.key,
|
|
4116
4114
|
"data-test": "chat-visual-horizontal-bar",
|
|
4117
4115
|
class: "min-w-0"
|
|
4118
|
-
}, [S("div",
|
|
4116
|
+
}, [S("div", zr, [S("span", {
|
|
4119
4117
|
class: "line-clamp-2 min-w-0 font-medium leading-snug",
|
|
4120
|
-
style:
|
|
4121
|
-
},
|
|
4118
|
+
style: j({ color: ve.value })
|
|
4119
|
+
}, R(e.label), 5), S("span", {
|
|
4122
4120
|
class: "shrink-0 font-semibold tabular-nums",
|
|
4123
|
-
style:
|
|
4124
|
-
},
|
|
4121
|
+
style: j({ color: ve.value })
|
|
4122
|
+
}, R(e.value), 5)]), S("div", {
|
|
4125
4123
|
class: "h-2 w-full overflow-hidden rounded-full",
|
|
4126
|
-
style:
|
|
4124
|
+
style: j({ background: we.value })
|
|
4127
4125
|
}, [S("div", {
|
|
4128
4126
|
class: "h-full rounded-full",
|
|
4129
|
-
style:
|
|
4127
|
+
style: j({
|
|
4130
4128
|
width: `${e.width}%`,
|
|
4131
4129
|
background: seriesColor(e.seriesIndex)
|
|
4132
4130
|
})
|
|
4133
|
-
}, null, 4)], 4)]))), 128))])) : (
|
|
4131
|
+
}, null, 4)], 4)]))), 128))])) : (M(), x("svg", {
|
|
4134
4132
|
key: 1,
|
|
4135
4133
|
class: "block h-auto w-full overflow-visible",
|
|
4136
4134
|
viewBox: `0 0 ${A.value.width} ${A.value.height}`,
|
|
4137
|
-
style:
|
|
4135
|
+
style: j({ aspectRatio: `${A.value.width} / ${A.value.height}` }),
|
|
4138
4136
|
preserveAspectRatio: "xMidYMid meet",
|
|
4139
4137
|
"aria-hidden": "true"
|
|
4140
4138
|
}, [
|
|
4141
|
-
(
|
|
4139
|
+
(M(!0), x(m, null, F(T.value.ticks, (e) => (M(), x("line", {
|
|
4142
4140
|
key: `grid-${e}`,
|
|
4143
4141
|
x1: A.value.left,
|
|
4144
4142
|
x2: A.value.width - A.value.right,
|
|
@@ -4146,20 +4144,20 @@ var Lr = [
|
|
|
4146
4144
|
y2: yForValue(e),
|
|
4147
4145
|
"stroke-width": "1",
|
|
4148
4146
|
"vector-effect": "non-scaling-stroke",
|
|
4149
|
-
style:
|
|
4150
|
-
}, null, 12,
|
|
4151
|
-
S("g", null, [(
|
|
4147
|
+
style: j({ stroke: e === 0 ? U.value : be.value })
|
|
4148
|
+
}, null, 12, Vr))), 128)),
|
|
4149
|
+
S("g", null, [(M(!0), x(m, null, F(T.value.ticks, (e) => (M(), x("text", {
|
|
4152
4150
|
key: `y-${e}`,
|
|
4153
4151
|
x: A.value.left - 7,
|
|
4154
4152
|
y: yForValue(e) + 3,
|
|
4155
4153
|
"text-anchor": "end",
|
|
4156
4154
|
"font-size": "9.5",
|
|
4157
|
-
style:
|
|
4158
|
-
},
|
|
4155
|
+
style: j({ fill: H.value })
|
|
4156
|
+
}, R(B(formatChatVisualTick)({
|
|
4159
4157
|
value: e,
|
|
4160
|
-
shared:
|
|
4161
|
-
})), 13,
|
|
4162
|
-
f.value.chartType === "bar" ? (
|
|
4158
|
+
shared: k.value
|
|
4159
|
+
})), 13, Hr))), 128))]),
|
|
4160
|
+
f.value.chartType === "bar" ? (M(!0), x(m, { key: 0 }, F(ae.value, (e) => (M(), x("rect", {
|
|
4163
4161
|
key: e.key,
|
|
4164
4162
|
"data-test": "chat-visual-bar",
|
|
4165
4163
|
"data-row-index": e.rowIndex,
|
|
@@ -4170,22 +4168,22 @@ var Lr = [
|
|
|
4170
4168
|
width: e.width,
|
|
4171
4169
|
height: e.height,
|
|
4172
4170
|
rx: "2.5",
|
|
4173
|
-
style:
|
|
4174
|
-
}, null, 12,
|
|
4175
|
-
|
|
4171
|
+
style: j({ fill: seriesColor(e.seriesIndex) })
|
|
4172
|
+
}, null, 12, Ur))), 128)) : (M(), x(m, { key: 1 }, [
|
|
4173
|
+
ie.value ? (M(), x("path", {
|
|
4176
4174
|
key: 0,
|
|
4177
4175
|
"data-test": "chat-visual-trend-line",
|
|
4178
|
-
"data-trend-key":
|
|
4179
|
-
d:
|
|
4176
|
+
"data-trend-key": ie.value.dataKey,
|
|
4177
|
+
d: ie.value.path,
|
|
4180
4178
|
fill: "none",
|
|
4181
4179
|
"stroke-width": "1.4",
|
|
4182
4180
|
"stroke-linecap": "round",
|
|
4183
4181
|
"stroke-linejoin": "round",
|
|
4184
4182
|
"stroke-dasharray": "4 3",
|
|
4185
4183
|
"vector-effect": "non-scaling-stroke",
|
|
4186
|
-
style:
|
|
4187
|
-
}, null, 12,
|
|
4188
|
-
(
|
|
4184
|
+
style: j({ stroke: seriesColor(ie.value.seriesIndex) })
|
|
4185
|
+
}, null, 12, Wr)) : b("", !0),
|
|
4186
|
+
(M(!0), x(m, null, F(p.value, (e, t) => (M(), x("g", { key: e.dataKey }, [f.value.chartType === "line" ? (M(), x("path", {
|
|
4189
4187
|
key: 0,
|
|
4190
4188
|
d: pathForSeries(e.dataKey),
|
|
4191
4189
|
fill: "none",
|
|
@@ -4193,74 +4191,74 @@ var Lr = [
|
|
|
4193
4191
|
"stroke-linecap": "round",
|
|
4194
4192
|
"stroke-linejoin": "round",
|
|
4195
4193
|
"vector-effect": "non-scaling-stroke",
|
|
4196
|
-
style:
|
|
4197
|
-
}, null, 12,
|
|
4194
|
+
style: j({ stroke: seriesColor(t) })
|
|
4195
|
+
}, null, 12, Gr)) : b("", !0), (M(!0), x(m, null, F(u.value, (n, r) => (M(), x(m, { key: `${e.dataKey}-${r}` }, [f.value.chartType === "scatter" ? (M(), x("circle", {
|
|
4198
4196
|
key: 0,
|
|
4199
4197
|
cx: xForIndex(r, u.value.length),
|
|
4200
4198
|
cy: yForValue(numericValue(n[e.dataKey]) ?? 0),
|
|
4201
4199
|
r: "2.6",
|
|
4202
|
-
style:
|
|
4203
|
-
}, null, 12,
|
|
4204
|
-
(
|
|
4200
|
+
style: j({ fill: seriesColor(t) })
|
|
4201
|
+
}, null, 12, Kr)) : b("", !0)], 64))), 128))]))), 128)),
|
|
4202
|
+
(M(!0), x(m, null, F(ue.value, (e) => (M(), x("circle", {
|
|
4205
4203
|
key: `marker-${e.key}`,
|
|
4206
4204
|
cx: e.cx,
|
|
4207
4205
|
cy: e.cy,
|
|
4208
4206
|
r: "3",
|
|
4209
|
-
style:
|
|
4210
|
-
}, null, 12,
|
|
4207
|
+
style: j({ fill: seriesColor(e.seriesIndex) })
|
|
4208
|
+
}, null, 12, qr))), 128))
|
|
4211
4209
|
], 64)),
|
|
4212
|
-
(
|
|
4210
|
+
(M(!0), x(m, null, F(oe.value, (e) => (M(), x("text", {
|
|
4213
4211
|
key: e.key,
|
|
4214
4212
|
x: e.x,
|
|
4215
4213
|
y: e.angled ? A.value.height - A.value.bottom + 12 : A.value.height - 6,
|
|
4216
4214
|
"text-anchor": e.anchor,
|
|
4217
4215
|
"font-size": "9.5",
|
|
4218
|
-
transform: e.angled ? `rotate(${
|
|
4219
|
-
style:
|
|
4220
|
-
},
|
|
4221
|
-
], 12,
|
|
4216
|
+
transform: e.angled ? `rotate(${B(-40)} ${e.x} ${A.value.height - A.value.bottom + 12})` : void 0,
|
|
4217
|
+
style: j({ fill: H.value })
|
|
4218
|
+
}, R(e.label), 13, Jr))), 128))
|
|
4219
|
+
], 12, Br)), ce.value.length > 1 || f.value.chartType !== "bar" ? (M(), x("div", Yr, [(M(!0), x(m, null, F(ce.value, (e) => (M(), x("div", {
|
|
4222
4220
|
key: e.key,
|
|
4223
4221
|
class: "inline-flex items-center gap-1.5 text-[11.5px] leading-none"
|
|
4224
4222
|
}, [
|
|
4225
4223
|
S("span", {
|
|
4226
4224
|
class: "size-2.5 shrink-0 rounded-full",
|
|
4227
|
-
style:
|
|
4225
|
+
style: j({ background: seriesColor(e.seriesIndex) })
|
|
4228
4226
|
}, null, 4),
|
|
4229
|
-
S("span", { style:
|
|
4227
|
+
S("span", { style: j({ color: ye.value }) }, R(e.label), 5),
|
|
4230
4228
|
S("span", {
|
|
4231
4229
|
class: "font-semibold tabular-nums",
|
|
4232
|
-
style:
|
|
4233
|
-
},
|
|
4234
|
-
]))), 128))])) : b("", !0)], 8,
|
|
4230
|
+
style: j({ color: ve.value })
|
|
4231
|
+
}, R(e.value), 5)
|
|
4232
|
+
]))), 128))])) : b("", !0)], 8, Lr)) : h.value ? (M(), x("div", Xr, [(M(!0), x(m, null, F(de.value, (e, t) => (M(), x("div", { key: e.key }, [S("div", Zr, [S("span", {
|
|
4235
4233
|
class: "truncate font-medium",
|
|
4236
|
-
style:
|
|
4237
|
-
},
|
|
4234
|
+
style: j({ color: ve.value })
|
|
4235
|
+
}, R(e.name), 5), S("span", Qr, [S("span", {
|
|
4238
4236
|
class: "font-semibold",
|
|
4239
|
-
style:
|
|
4240
|
-
},
|
|
4237
|
+
style: j({ color: ve.value })
|
|
4238
|
+
}, R(e.display), 5), S("span", {
|
|
4241
4239
|
class: "ml-1.5",
|
|
4242
|
-
style:
|
|
4243
|
-
},
|
|
4240
|
+
style: j({ color: ye.value })
|
|
4241
|
+
}, R(Math.round(e.percent * 100)) + "%", 5)])]), S("div", {
|
|
4244
4242
|
class: "h-1.5 w-full overflow-hidden rounded-full",
|
|
4245
|
-
style:
|
|
4243
|
+
style: j({ background: we.value })
|
|
4246
4244
|
}, [S("div", {
|
|
4247
4245
|
class: "h-full rounded-full",
|
|
4248
|
-
style:
|
|
4246
|
+
style: j({
|
|
4249
4247
|
width: `${Math.max(2, e.percent * 100)}%`,
|
|
4250
4248
|
background: seriesColor(t)
|
|
4251
4249
|
})
|
|
4252
|
-
}, null, 4)], 4)]))), 128))])) : c.value &&
|
|
4250
|
+
}, null, 4)], 4)]))), 128))])) : c.value && pe.value ? (M(), x("div", $r, [(M(), x("svg", {
|
|
4253
4251
|
"data-test": "chat-visual-diagram-svg",
|
|
4254
4252
|
class: "block h-auto overflow-visible",
|
|
4255
|
-
viewBox: `0 0 ${
|
|
4256
|
-
style:
|
|
4257
|
-
width: `${
|
|
4258
|
-
aspectRatio: `${
|
|
4253
|
+
viewBox: `0 0 ${pe.value.width} ${pe.value.height}`,
|
|
4254
|
+
style: j({
|
|
4255
|
+
width: `${pe.value.width}px`,
|
|
4256
|
+
aspectRatio: `${pe.value.width} / ${pe.value.height}`
|
|
4259
4257
|
}),
|
|
4260
4258
|
role: "img",
|
|
4261
4259
|
"aria-label": o.value.meta.title
|
|
4262
4260
|
}, [
|
|
4263
|
-
(
|
|
4261
|
+
(M(!0), x(m, null, F(pe.value.edges, (e) => (M(), x("line", {
|
|
4264
4262
|
key: e.key,
|
|
4265
4263
|
"data-test": "chat-visual-diagram-edge",
|
|
4266
4264
|
"data-from": e.from,
|
|
@@ -4272,16 +4270,16 @@ var Lr = [
|
|
|
4272
4270
|
"stroke-width": "1.4",
|
|
4273
4271
|
"stroke-linecap": "round",
|
|
4274
4272
|
"vector-effect": "non-scaling-stroke",
|
|
4275
|
-
style:
|
|
4276
|
-
}, null, 12,
|
|
4277
|
-
(
|
|
4273
|
+
style: j({ stroke: Ce.value })
|
|
4274
|
+
}, null, 12, ti))), 128)),
|
|
4275
|
+
(M(!0), x(m, null, F(pe.value.edges, (e) => (M(), x("circle", {
|
|
4278
4276
|
key: `${e.key}-dot`,
|
|
4279
4277
|
cx: e.x2,
|
|
4280
4278
|
cy: e.y2,
|
|
4281
4279
|
r: "2.4",
|
|
4282
|
-
style:
|
|
4283
|
-
}, null, 12,
|
|
4284
|
-
(
|
|
4280
|
+
style: j({ fill: Ce.value })
|
|
4281
|
+
}, null, 12, ni))), 128)),
|
|
4282
|
+
(M(!0), x(m, null, F(pe.value.edges.filter((e) => e.label), (e) => (M(), x("foreignObject", {
|
|
4285
4283
|
key: `${e.key}-label`,
|
|
4286
4284
|
x: e.labelX - 55,
|
|
4287
4285
|
y: e.labelY - 12,
|
|
@@ -4290,59 +4288,59 @@ var Lr = [
|
|
|
4290
4288
|
}, [S("div", {
|
|
4291
4289
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
4292
4290
|
class: "flex h-full items-center justify-center px-1 text-center text-[10.5px] font-medium leading-none",
|
|
4293
|
-
style:
|
|
4294
|
-
color:
|
|
4291
|
+
style: j({
|
|
4292
|
+
color: ye.value,
|
|
4295
4293
|
background: t.inverted ? "var(--color-theme-900)" : "var(--color-theme-0)"
|
|
4296
4294
|
})
|
|
4297
|
-
},
|
|
4298
|
-
(
|
|
4295
|
+
}, R(e.label), 5)], 8, ri))), 128)),
|
|
4296
|
+
(M(!0), x(m, null, F(pe.value.nodes, (e) => (M(), x("g", {
|
|
4299
4297
|
key: e.id,
|
|
4300
4298
|
"data-test": "chat-visual-diagram-node",
|
|
4301
4299
|
"data-node-id": e.id,
|
|
4302
4300
|
"data-node-kind": e.kind,
|
|
4303
4301
|
transform: `translate(${e.x} ${e.y})`
|
|
4304
|
-
}, [e.kind === "decision" ? (
|
|
4302
|
+
}, [e.kind === "decision" ? (M(), x("polygon", {
|
|
4305
4303
|
key: 0,
|
|
4306
4304
|
points: `${e.width / 2},0 ${e.width},${e.height / 2} ${e.width / 2},${e.height} 0,${e.height / 2}`,
|
|
4307
4305
|
"stroke-width": "1",
|
|
4308
4306
|
"vector-effect": "non-scaling-stroke",
|
|
4309
|
-
style:
|
|
4307
|
+
style: j({
|
|
4310
4308
|
fill: diagramNodeFill(e.kind),
|
|
4311
4309
|
stroke: diagramNodeStroke(e.kind)
|
|
4312
4310
|
})
|
|
4313
|
-
}, null, 12,
|
|
4311
|
+
}, null, 12, ai)) : (M(), x("rect", {
|
|
4314
4312
|
key: 1,
|
|
4315
4313
|
width: e.width,
|
|
4316
4314
|
height: e.height,
|
|
4317
4315
|
rx: "9",
|
|
4318
4316
|
"stroke-width": "1",
|
|
4319
4317
|
"vector-effect": "non-scaling-stroke",
|
|
4320
|
-
style:
|
|
4318
|
+
style: j({
|
|
4321
4319
|
fill: diagramNodeFill(e.kind),
|
|
4322
4320
|
stroke: diagramNodeStroke(e.kind)
|
|
4323
4321
|
})
|
|
4324
|
-
}, null, 12,
|
|
4322
|
+
}, null, 12, oi)), (M(), x("foreignObject", {
|
|
4325
4323
|
x: "8",
|
|
4326
4324
|
y: "5",
|
|
4327
4325
|
width: e.width - 16,
|
|
4328
4326
|
height: e.height - 10
|
|
4329
|
-
}, [S("div",
|
|
4327
|
+
}, [S("div", ci, [S("div", {
|
|
4330
4328
|
class: "line-clamp-2 text-[13px] font-medium leading-snug",
|
|
4331
|
-
style:
|
|
4332
|
-
},
|
|
4329
|
+
style: j({ color: ve.value })
|
|
4330
|
+
}, R(e.label), 5), e.detail ? (M(), x("div", {
|
|
4333
4331
|
key: 0,
|
|
4334
4332
|
class: "mt-0.5 line-clamp-1 text-[10.5px] leading-none",
|
|
4335
|
-
style:
|
|
4336
|
-
},
|
|
4337
|
-
], 12,
|
|
4338
|
-
o.value.meta.footer ? (
|
|
4333
|
+
style: j({ color: ye.value })
|
|
4334
|
+
}, R(e.detail), 5)) : b("", !0)])], 8, si))], 8, ii))), 128))
|
|
4335
|
+
], 12, ei))])) : b("", !0)], 512),
|
|
4336
|
+
o.value.meta.footer ? (M(), x("footer", {
|
|
4339
4337
|
key: 0,
|
|
4340
4338
|
class: "mt-3 text-[11px] leading-snug",
|
|
4341
|
-
style:
|
|
4342
|
-
},
|
|
4343
|
-
], 12,
|
|
4339
|
+
style: j({ color: H.value })
|
|
4340
|
+
}, R(o.value.meta.footer), 5)) : b("", !0)
|
|
4341
|
+
], 12, Fr)) : b("", !0);
|
|
4344
4342
|
}
|
|
4345
|
-
}),
|
|
4343
|
+
}), ui = ["innerHTML"], di = /* @__PURE__ */ k({
|
|
4346
4344
|
__name: "ChatRichText",
|
|
4347
4345
|
props: {
|
|
4348
4346
|
text: {},
|
|
@@ -4351,8 +4349,8 @@ var Lr = [
|
|
|
4351
4349
|
},
|
|
4352
4350
|
emits: ["action"],
|
|
4353
4351
|
setup(e, { emit: t }) {
|
|
4354
|
-
let n = e, r = t, i =
|
|
4355
|
-
|
|
4352
|
+
let n = e, r = t, i = I(n.text), a;
|
|
4353
|
+
ue([() => n.text, () => n.streaming], ([e, t]) => {
|
|
4356
4354
|
if (!t) {
|
|
4357
4355
|
a !== void 0 && (cancelAnimationFrame(a), a = void 0), i.value = e;
|
|
4358
4356
|
return;
|
|
@@ -4360,7 +4358,7 @@ var Lr = [
|
|
|
4360
4358
|
a === void 0 && (a = requestAnimationFrame(() => {
|
|
4361
4359
|
a = void 0, i.value = n.text;
|
|
4362
4360
|
}));
|
|
4363
|
-
}),
|
|
4361
|
+
}), ne(() => {
|
|
4364
4362
|
a !== void 0 && cancelAnimationFrame(a);
|
|
4365
4363
|
});
|
|
4366
4364
|
let o = new g.Renderer();
|
|
@@ -4382,7 +4380,7 @@ var Lr = [
|
|
|
4382
4380
|
function renderMarkdown(e) {
|
|
4383
4381
|
if (!e) return "";
|
|
4384
4382
|
let t = g.parse(e, { async: !1 });
|
|
4385
|
-
return
|
|
4383
|
+
return rn.sanitize(t, {
|
|
4386
4384
|
ADD_ATTR: ["target"],
|
|
4387
4385
|
ADD_DATA_URI_TAGS: ["img"]
|
|
4388
4386
|
});
|
|
@@ -4448,7 +4446,7 @@ var Lr = [
|
|
|
4448
4446
|
});
|
|
4449
4447
|
let n = c[1], s = c[2].trim();
|
|
4450
4448
|
if (n === "pl-card") {
|
|
4451
|
-
let e =
|
|
4449
|
+
let e = f(s);
|
|
4452
4450
|
e.ok ? r.push({
|
|
4453
4451
|
kind: "card",
|
|
4454
4452
|
key: `card-${o}`,
|
|
@@ -4463,7 +4461,7 @@ var Lr = [
|
|
|
4463
4461
|
html: renderMarkdown(`\`\`\`\n${s}\n\`\`\``)
|
|
4464
4462
|
}));
|
|
4465
4463
|
} else {
|
|
4466
|
-
let e =
|
|
4464
|
+
let e = p(s);
|
|
4467
4465
|
if (e.ok) r.push({
|
|
4468
4466
|
kind: "visual",
|
|
4469
4467
|
key: `visual-${o}`,
|
|
@@ -4487,9 +4485,9 @@ var Lr = [
|
|
|
4487
4485
|
}
|
|
4488
4486
|
a = c.index + c[0].length, o += 1, c = i.exec(t);
|
|
4489
4487
|
}
|
|
4490
|
-
let u = t.slice(a),
|
|
4491
|
-
if (
|
|
4492
|
-
let e = renderMarkdown(u.slice(0,
|
|
4488
|
+
let u = t.slice(a), m = n ? s.exec(u) : null;
|
|
4489
|
+
if (m) {
|
|
4490
|
+
let e = renderMarkdown(u.slice(0, m.index));
|
|
4493
4491
|
return e && r.push({
|
|
4494
4492
|
kind: "markdown",
|
|
4495
4493
|
key: `md-${o}`,
|
|
@@ -4506,35 +4504,35 @@ var Lr = [
|
|
|
4506
4504
|
html: h
|
|
4507
4505
|
}), r;
|
|
4508
4506
|
}
|
|
4509
|
-
let c =
|
|
4507
|
+
let c = _(() => {
|
|
4510
4508
|
let e = i.value;
|
|
4511
4509
|
return e ? richTextSegments({
|
|
4512
4510
|
text: e,
|
|
4513
4511
|
streaming: !!n.streaming
|
|
4514
4512
|
}) : [];
|
|
4515
4513
|
});
|
|
4516
|
-
return (t, n) => (
|
|
4514
|
+
return (t, n) => (M(), x("div", {
|
|
4517
4515
|
class: "chat-msg-rich break-words text-[14px] leading-[1.55] @sm/chat:text-[15px] @sm/chat:leading-[1.5]",
|
|
4518
4516
|
onErrorCapture: onRichTextAssetError
|
|
4519
|
-
}, [(
|
|
4517
|
+
}, [(M(!0), x(m, null, F(c.value, (t) => (M(), x(m, { key: t.key }, [t.kind === "markdown" ? (M(), x("div", {
|
|
4520
4518
|
key: 0,
|
|
4521
|
-
class:
|
|
4519
|
+
class: A(["chat-msg-prose", e.inverted ? "chat-msg-prose-invert" : ""]),
|
|
4522
4520
|
innerHTML: t.html
|
|
4523
|
-
}, null, 10,
|
|
4521
|
+
}, null, 10, ui)) : t.kind === "visual" ? (M(), v(li, {
|
|
4524
4522
|
key: 1,
|
|
4525
4523
|
result: t.result,
|
|
4526
4524
|
inverted: e.inverted
|
|
4527
|
-
}, null, 8, ["result", "inverted"])) : t.kind === "card" ? (
|
|
4525
|
+
}, null, 8, ["result", "inverted"])) : t.kind === "card" ? (M(), v(wr, {
|
|
4528
4526
|
key: 2,
|
|
4529
4527
|
spec: t.spec,
|
|
4530
4528
|
inverted: e.inverted,
|
|
4531
4529
|
onAction: n[0] || (n[0] = (e) => r("action", e))
|
|
4532
|
-
}, null, 8, ["spec", "inverted"])) : (
|
|
4530
|
+
}, null, 8, ["spec", "inverted"])) : (M(), x("div", {
|
|
4533
4531
|
key: 3,
|
|
4534
4532
|
"data-test": "chat-visual-pending",
|
|
4535
4533
|
role: "status",
|
|
4536
4534
|
class: "my-6 flex items-center gap-2.5 rounded-[20px] px-4 py-5 text-[12px] font-medium",
|
|
4537
|
-
style:
|
|
4535
|
+
style: j({
|
|
4538
4536
|
background: e.inverted ? "transparent" : "var(--color-theme-0)",
|
|
4539
4537
|
boxShadow: `inset 0 0 0 1px ${e.inverted ? "rgba(255, 255, 255, 0.14)" : "color-mix(in oklch, var(--color-theme-900) 8%, transparent)"}`,
|
|
4540
4538
|
color: e.inverted ? "rgba(255, 255, 255, 0.6)" : "var(--color-theme-500)"
|
|
@@ -4544,20 +4542,20 @@ var Lr = [
|
|
|
4544
4542
|
style: { background: "currentcolor" }
|
|
4545
4543
|
}, null, -1), C(" Preparing chart… ", -1)])], 4))], 64))), 128))], 32));
|
|
4546
4544
|
}
|
|
4547
|
-
}),
|
|
4545
|
+
}), fi = 80, pi = 600, mi = /* @__PURE__ */ k({
|
|
4548
4546
|
__name: "ChatScroller",
|
|
4549
4547
|
setup(e, { expose: t }) {
|
|
4550
|
-
let n =
|
|
4548
|
+
let n = P(), r = P(), i = P(!0), a, o, s = 0;
|
|
4551
4549
|
function scrollToBottom() {
|
|
4552
4550
|
let e = n.value;
|
|
4553
4551
|
e && (e.scrollTop = e.scrollHeight);
|
|
4554
4552
|
}
|
|
4555
4553
|
function onScroll() {
|
|
4556
4554
|
let e = n.value;
|
|
4557
|
-
e && (i.value = e.scrollHeight - e.scrollTop - e.clientHeight <=
|
|
4555
|
+
e && (i.value = e.scrollHeight - e.scrollTop - e.clientHeight <= fi);
|
|
4558
4556
|
}
|
|
4559
4557
|
function markUserGesture() {
|
|
4560
|
-
s = Date.now() +
|
|
4558
|
+
s = Date.now() + pi;
|
|
4561
4559
|
}
|
|
4562
4560
|
function followPinned() {
|
|
4563
4561
|
i.value && Date.now() > s && scrollToBottom();
|
|
@@ -4567,19 +4565,19 @@ var Lr = [
|
|
|
4567
4565
|
scrollToBottom(), requestAnimationFrame(scrollToBottom);
|
|
4568
4566
|
});
|
|
4569
4567
|
}
|
|
4570
|
-
return t({ pin }),
|
|
4568
|
+
return t({ pin }), re(() => {
|
|
4571
4569
|
requestAnimationFrame(() => {
|
|
4572
4570
|
scrollToBottom(), requestAnimationFrame(scrollToBottom);
|
|
4573
4571
|
}), r.value && (a = new ResizeObserver(followPinned), a.observe(r.value), n.value && a.observe(n.value), o = new MutationObserver(followPinned), o.observe(r.value, {
|
|
4574
4572
|
childList: !0,
|
|
4575
4573
|
subtree: !0
|
|
4576
4574
|
}));
|
|
4577
|
-
}),
|
|
4575
|
+
}), ne(() => {
|
|
4578
4576
|
a?.disconnect(), o?.disconnect();
|
|
4579
|
-
}), (e, t) => (
|
|
4577
|
+
}), (e, t) => (M(), x("div", {
|
|
4580
4578
|
ref_key: "viewport",
|
|
4581
4579
|
ref: n,
|
|
4582
|
-
class:
|
|
4580
|
+
class: A(["overflow-y-auto overscroll-contain overflow-x-hidden min-h-0 flex flex-col [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", i.value ? "[overflow-anchor:none]" : ""]),
|
|
4583
4581
|
onScrollPassive: onScroll,
|
|
4584
4582
|
onWheelPassive: markUserGesture,
|
|
4585
4583
|
onTouchstartPassive: markUserGesture
|
|
@@ -4587,31 +4585,31 @@ var Lr = [
|
|
|
4587
4585
|
ref_key: "content",
|
|
4588
4586
|
ref: r,
|
|
4589
4587
|
class: "flex-1 flex flex-col"
|
|
4590
|
-
}, [
|
|
4588
|
+
}, [ae(e.$slots, "default")], 512)], 34));
|
|
4591
4589
|
}
|
|
4592
|
-
}),
|
|
4590
|
+
}), hi = {
|
|
4593
4591
|
VOICE_MIC_UNAVAILABLE: "I couldn't reach your microphone. Check that this site is allowed to use it, then try again.",
|
|
4594
|
-
|
|
4592
|
+
VOICE_BOT_UNAVAILABLE: "Your assistant didn't pick up. Give it a moment and start the call again.",
|
|
4595
4593
|
VOICE_CONNECT_TIMEOUT: "The call took too long to connect. Try again in a moment.",
|
|
4596
4594
|
VOICE_CONNECTION_LOST: "The call dropped. Start it again when you're ready.",
|
|
4597
4595
|
VOICE_UNAVAILABLE: "Voice isn't available right now. You can keep going by typing.",
|
|
4598
4596
|
VOICE_MINT_INVALID: "That call couldn't be started. Refresh the page and try again.",
|
|
4599
4597
|
VOICE_PROVIDER_ERROR: "The call ended unexpectedly. Try again, or keep going by typing."
|
|
4600
|
-
},
|
|
4598
|
+
}, gi = "The call ended unexpectedly. Try again, or keep going by typing.";
|
|
4601
4599
|
function voiceErrorMessage(e) {
|
|
4602
|
-
return e &&
|
|
4600
|
+
return e && hi[e] || gi;
|
|
4603
4601
|
}
|
|
4604
4602
|
//#endregion
|
|
4605
|
-
//#region
|
|
4606
|
-
var
|
|
4603
|
+
//#region bot/ui/VoiceHistogramController.ts
|
|
4604
|
+
var _i = [
|
|
4607
4605
|
0,
|
|
4608
4606
|
2,
|
|
4609
4607
|
4,
|
|
4610
4608
|
6,
|
|
4611
4609
|
8
|
|
4612
|
-
],
|
|
4610
|
+
], vi = 5, yi = 33, bi = .7, xi = .1, Si = 60, Ci = 320, wi = .55, Ti = .1, Ei = .32, Di = .9, Oi = _i.map(() => 0), ki = _i.map(() => vi), VoiceHistogramController = class {
|
|
4613
4611
|
constructor(e = typeof window > "u" ? void 0 : window) {
|
|
4614
|
-
t(this, "browser", void 0), t(this, "heights",
|
|
4612
|
+
t(this, "browser", void 0), t(this, "heights", I(ki)), t(this, "targetBars", Oi), t(this, "displayBars", Oi), t(this, "level", {
|
|
4615
4613
|
source: "mic",
|
|
4616
4614
|
level: 0
|
|
4617
4615
|
}), t(this, "isMuted", !1), t(this, "usesIdleWave", !1), t(this, "frameId", 0), t(this, "lastFrameAt", 0), t(this, "easeFrame", (e) => {
|
|
@@ -4620,12 +4618,12 @@ var yi = [
|
|
|
4620
4618
|
this.frameId = 0;
|
|
4621
4619
|
let n = Math.min(64, Math.max(0, e - this.lastFrameAt));
|
|
4622
4620
|
this.lastFrameAt = e;
|
|
4623
|
-
let r = this.usesIdleWave ?
|
|
4624
|
-
let r = e / 1e3 *
|
|
4625
|
-
return
|
|
4621
|
+
let r = this.usesIdleWave ? _i.map((t, n) => {
|
|
4622
|
+
let r = e / 1e3 * wi * 2 * Math.PI - n * Di;
|
|
4623
|
+
return Ti + Ei * (Math.sin(r) + 1) / 2;
|
|
4626
4624
|
}) : this.targetBars;
|
|
4627
4625
|
this.displayBars = this.displayBars.map((e, t) => {
|
|
4628
|
-
let i = r[t] ?? 0, a = i > e ?
|
|
4626
|
+
let i = r[t] ?? 0, a = i > e ? Si : Ci;
|
|
4629
4627
|
return e + (i - e) * (1 - Math.exp(-n / a));
|
|
4630
4628
|
}), this.publish();
|
|
4631
4629
|
let i = this.displayBars.every((e, t) => Math.abs((r[t] ?? 0) - e) <= 5e-4);
|
|
@@ -4645,20 +4643,20 @@ var yi = [
|
|
|
4645
4643
|
this.frameId && this.browser?.cancelAnimationFrame(this.frameId), this.frameId = 0;
|
|
4646
4644
|
}
|
|
4647
4645
|
updateTargets() {
|
|
4648
|
-
let gate = (e) => Math.max(0, e -
|
|
4649
|
-
this.targetBars =
|
|
4646
|
+
let gate = (e) => Math.max(0, e - xi) / (1 - xi), e = this.isMuted && this.level.source === "mic";
|
|
4647
|
+
this.targetBars = _i.map((t) => e ? 0 : gate(Math.min(1, Math.max(0, this.level.bands?.[t] ?? this.level.level)))), this.start();
|
|
4650
4648
|
}
|
|
4651
4649
|
start() {
|
|
4652
4650
|
if (!this.browser || this.browser.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
4653
|
-
this.displayBars = this.usesIdleWave ?
|
|
4651
|
+
this.displayBars = this.usesIdleWave ? Oi : this.targetBars, this.publish();
|
|
4654
4652
|
return;
|
|
4655
4653
|
}
|
|
4656
4654
|
this.frameId || (this.lastFrameAt = this.browser.performance.now(), this.frameId = this.browser.requestAnimationFrame(this.easeFrame));
|
|
4657
4655
|
}
|
|
4658
4656
|
publish() {
|
|
4659
|
-
this.heights.value = this.displayBars.map((e) => Math.round((
|
|
4657
|
+
this.heights.value = this.displayBars.map((e) => Math.round((vi + Math.min(1, Math.max(0, e)) ** bi * yi) * 10) / 10);
|
|
4660
4658
|
}
|
|
4661
|
-
},
|
|
4659
|
+
}, Ai = {
|
|
4662
4660
|
connecting: {
|
|
4663
4661
|
label: "Connecting",
|
|
4664
4662
|
tone: "bg-amber-500",
|
|
@@ -4693,10 +4691,10 @@ var yi = [
|
|
|
4693
4691
|
}
|
|
4694
4692
|
};
|
|
4695
4693
|
function deriveActivity(e) {
|
|
4696
|
-
return e.hadError ? "error" : e.sessionState === "live" ? e.speaking.
|
|
4694
|
+
return e.hadError ? "error" : e.sessionState === "live" ? e.speaking.bot ? "speaking" : e.speaking.user ? "listening" : e.work.active ? "working" : e.providerThinking ? "thinking" : "listening" : "connecting";
|
|
4697
4695
|
}
|
|
4698
4696
|
function deriveVoiceModePresentation(e) {
|
|
4699
|
-
let t = deriveActivity(e), n =
|
|
4697
|
+
let t = deriveActivity(e), n = Ai[t], r = t === "working" ? e.work.description || "Working on it" : n.label, i = t === "working" ? r : n.visibleText ?? "", a = e.takingLonger && (t === "thinking" || t === "working"), o = a ? `${i} ${W.slowHint}` : i;
|
|
4700
4698
|
return {
|
|
4701
4699
|
activity: t,
|
|
4702
4700
|
label: a ? o : r,
|
|
@@ -4707,82 +4705,82 @@ function deriveVoiceModePresentation(e) {
|
|
|
4707
4705
|
};
|
|
4708
4706
|
}
|
|
4709
4707
|
//#endregion
|
|
4710
|
-
//#region
|
|
4711
|
-
var
|
|
4708
|
+
//#region bot/ui/VoiceMode.vue?vue&type=script&setup=true&lang.ts
|
|
4709
|
+
var ji = ["data-voice-state", "data-voice-activity"], Mi = ["src"], Ni = {
|
|
4712
4710
|
key: 1,
|
|
4713
4711
|
"data-test": "voice-background-fallback",
|
|
4714
4712
|
"aria-hidden": "true",
|
|
4715
4713
|
class: "pointer-events-none absolute inset-0 bg-[#0A1522]"
|
|
4716
|
-
},
|
|
4714
|
+
}, Pi = {
|
|
4717
4715
|
"data-test": "voice-stage",
|
|
4718
4716
|
class: "relative z-10 flex flex-1 flex-col items-center px-8"
|
|
4719
|
-
},
|
|
4717
|
+
}, Fi = { "data-voice-assistant-avatar": "" }, Ii = {
|
|
4720
4718
|
"data-test": "voice-lower-stage",
|
|
4721
4719
|
class: "flex flex-1 flex-col items-center pt-10"
|
|
4722
|
-
},
|
|
4720
|
+
}, Li = {
|
|
4723
4721
|
"data-test": "voice-histogram",
|
|
4724
4722
|
"aria-hidden": "true",
|
|
4725
4723
|
class: "flex h-[38px] items-center gap-[5px]"
|
|
4726
|
-
},
|
|
4724
|
+
}, Ri = {
|
|
4727
4725
|
"data-test": "voice-presence-status",
|
|
4728
4726
|
role: "status",
|
|
4729
4727
|
"aria-live": "polite",
|
|
4730
4728
|
class: "sr-only"
|
|
4731
|
-
},
|
|
4729
|
+
}, zi = ["data-taking-longer"], Bi = { class: "absolute inset-x-0 bottom-0 z-20 flex items-center justify-between px-14 pb-[max(3rem,env(safe-area-inset-bottom))] sm:px-12" }, Vi = [
|
|
4732
4730
|
"disabled",
|
|
4733
4731
|
"aria-label",
|
|
4734
4732
|
"aria-pressed",
|
|
4735
4733
|
"title"
|
|
4736
|
-
],
|
|
4734
|
+
], Hi = /* @__PURE__ */ k({
|
|
4737
4735
|
__name: "VoiceMode",
|
|
4738
4736
|
props: {
|
|
4739
|
-
|
|
4737
|
+
bot: {},
|
|
4740
4738
|
chatController: {},
|
|
4741
4739
|
isLight: { type: Boolean },
|
|
4742
4740
|
backdropSrc: {}
|
|
4743
4741
|
},
|
|
4744
4742
|
emits: ["end"],
|
|
4745
4743
|
setup(e, { expose: t, emit: n }) {
|
|
4746
|
-
let r = n, i =
|
|
4744
|
+
let r = n, i = I(!1), a = I(!1), o = I({
|
|
4747
4745
|
user: !1,
|
|
4748
|
-
|
|
4749
|
-
}), s =
|
|
4746
|
+
bot: !1
|
|
4747
|
+
}), s = I({ active: !1 }), c = I(!1), u = I(!1), f = I(), p = _(() => f.value?.state.value ?? "idle"), h = _(() => f.value?.isMuted.value ?? !1), v = new VoiceHistogramController(), b = v.heights, C = se("endButton"), k = se("muteButton"), te = !1, ne, P, ae = _(() => deriveVoiceModePresentation({
|
|
4750
4748
|
sessionState: p.value,
|
|
4751
4749
|
hadError: i.value,
|
|
4752
4750
|
providerThinking: a.value,
|
|
4753
4751
|
speaking: o.value,
|
|
4754
4752
|
work: s.value,
|
|
4755
|
-
isMuted:
|
|
4753
|
+
isMuted: h.value,
|
|
4756
4754
|
takingLonger: c.value
|
|
4757
|
-
})),
|
|
4758
|
-
if (
|
|
4759
|
-
if (
|
|
4755
|
+
})), oe = _(() => {
|
|
4756
|
+
if (ae.value.activity === "thinking") return "thinking";
|
|
4757
|
+
if (ae.value.activity === "working") return `working:${s.value.description ?? ""}`;
|
|
4760
4758
|
});
|
|
4761
|
-
|
|
4759
|
+
ue(() => ae.value.usesIdleWave, (e) => v.setIdleWave(e), { immediate: !0 }), ue(h, (e) => v.setMuted(e), { immediate: !0 }), ue(oe, (e) => {
|
|
4762
4760
|
P && clearTimeout(P), c.value = !1, e && (P = setTimeout(() => {
|
|
4763
4761
|
P = void 0, c.value = !0;
|
|
4764
|
-
},
|
|
4762
|
+
}, G), P.unref?.());
|
|
4765
4763
|
}, { immediate: !0 });
|
|
4766
4764
|
async function end() {
|
|
4767
|
-
|
|
4765
|
+
te = !0, await f.value?.end();
|
|
4768
4766
|
}
|
|
4769
4767
|
t({ end });
|
|
4770
4768
|
function emitEnd() {
|
|
4771
|
-
|
|
4769
|
+
te || (te = !0, r("end"));
|
|
4772
4770
|
}
|
|
4773
4771
|
function trapFocus(e) {
|
|
4774
|
-
e.shiftKey && document.activeElement ===
|
|
4772
|
+
e.shiftKey && document.activeElement === C.value ? (e.preventDefault(), k.value?.focus()) : !e.shiftKey && document.activeElement === k.value && (e.preventDefault(), C.value?.focus());
|
|
4775
4773
|
}
|
|
4776
4774
|
async function toggleMute() {
|
|
4777
4775
|
let e = f.value;
|
|
4778
4776
|
!e || u.value || (u.value = !0, await e.toggleMuted(), u.value = !1);
|
|
4779
4777
|
}
|
|
4780
|
-
return
|
|
4781
|
-
|
|
4778
|
+
return re(async () => {
|
|
4779
|
+
C.value?.focus({ preventScroll: !0 });
|
|
4782
4780
|
let t = e.chatController?.createVoiceClient({
|
|
4783
|
-
onLevel: (e) =>
|
|
4781
|
+
onLevel: (e) => v.updateLevel(e),
|
|
4784
4782
|
onStateChange: (e) => {
|
|
4785
|
-
e === "ended" && (i.value ?
|
|
4783
|
+
e === "ended" && (i.value ? ne = setTimeout(emitEnd, 1600) : emitEnd());
|
|
4786
4784
|
},
|
|
4787
4785
|
onThinkingChange: (e) => {
|
|
4788
4786
|
a.value = e;
|
|
@@ -4808,16 +4806,16 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4808
4806
|
return;
|
|
4809
4807
|
}
|
|
4810
4808
|
f.value = t, await t.start();
|
|
4811
|
-
}),
|
|
4812
|
-
|
|
4813
|
-
}), (t, n) => (
|
|
4809
|
+
}), ie(() => {
|
|
4810
|
+
te = !0, ne && clearTimeout(ne), P && clearTimeout(P), v.stop(), f.value?.end();
|
|
4811
|
+
}), (t, n) => (M(), x("div", {
|
|
4814
4812
|
"data-test": "voice-mode",
|
|
4815
4813
|
"data-voice-state": p.value,
|
|
4816
|
-
"data-voice-activity":
|
|
4814
|
+
"data-voice-activity": ae.value.activity,
|
|
4817
4815
|
class: "relative flex min-h-0 flex-1 flex-col overflow-hidden bg-[#0A1522] text-white",
|
|
4818
|
-
onKeydown:
|
|
4816
|
+
onKeydown: he(trapFocus, ["tab"])
|
|
4819
4817
|
}, [
|
|
4820
|
-
e.backdropSrc ? (
|
|
4818
|
+
e.backdropSrc ? (M(), x("img", {
|
|
4821
4819
|
key: 0,
|
|
4822
4820
|
"data-test": "voice-background-image",
|
|
4823
4821
|
src: e.backdropSrc,
|
|
@@ -4825,44 +4823,44 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4825
4823
|
"aria-hidden": "true",
|
|
4826
4824
|
draggable: "false",
|
|
4827
4825
|
class: "pointer-events-none absolute inset-0 size-full object-cover"
|
|
4828
|
-
}, null, 8,
|
|
4826
|
+
}, null, 8, Mi)) : (M(), x("div", Ni)),
|
|
4829
4827
|
n[2] || (n[2] = S("div", {
|
|
4830
4828
|
"data-test": "voice-background-overlay",
|
|
4831
4829
|
"aria-hidden": "true",
|
|
4832
4830
|
class: "pointer-events-none absolute inset-0 bg-gradient-to-b from-[#050F19]/82 via-[#050F19]/90 to-[#050F19]/99"
|
|
4833
4831
|
}, null, -1)),
|
|
4834
|
-
S("div",
|
|
4832
|
+
S("div", Pi, [
|
|
4835
4833
|
n[0] || (n[0] = S("div", {
|
|
4836
4834
|
"data-test": "voice-stage-spacer",
|
|
4837
4835
|
"aria-hidden": "true",
|
|
4838
4836
|
class: "flex-1"
|
|
4839
4837
|
}, null, -1)),
|
|
4840
|
-
S("div",
|
|
4841
|
-
|
|
4838
|
+
S("div", Fi, [T(Ge, {
|
|
4839
|
+
bot: e.bot,
|
|
4842
4840
|
"show-status": !1,
|
|
4843
4841
|
"show-owner-mark": !1,
|
|
4844
4842
|
"is-light": !1,
|
|
4845
4843
|
class: "size-32"
|
|
4846
|
-
}, null, 8, ["
|
|
4847
|
-
S("div",
|
|
4848
|
-
S("div",
|
|
4844
|
+
}, null, 8, ["bot"])]),
|
|
4845
|
+
S("div", Ii, [
|
|
4846
|
+
S("div", Li, [(M(!0), x(m, null, F(B(b), (e, t) => (M(), x("span", {
|
|
4849
4847
|
key: t,
|
|
4850
4848
|
"data-test": "voice-histogram-bar",
|
|
4851
|
-
class:
|
|
4852
|
-
style:
|
|
4849
|
+
class: A(["w-[5px] rounded-full transition-colors duration-150", ae.value.tone]),
|
|
4850
|
+
style: j({ height: `${e}px` })
|
|
4853
4851
|
}, null, 6))), 128))]),
|
|
4854
|
-
S("div",
|
|
4852
|
+
S("div", Ri, R(ae.value.label), 1),
|
|
4855
4853
|
S("p", {
|
|
4856
4854
|
"data-test": "voice-visible-status",
|
|
4857
|
-
"data-taking-longer":
|
|
4855
|
+
"data-taking-longer": ae.value.takingLonger || void 0,
|
|
4858
4856
|
"aria-hidden": "true",
|
|
4859
4857
|
class: "mt-5 min-h-5 text-center text-sm font-medium tracking-wide text-white/80"
|
|
4860
|
-
},
|
|
4858
|
+
}, R(ae.value.visibleStatus), 9, zi)
|
|
4861
4859
|
])
|
|
4862
4860
|
]),
|
|
4863
|
-
S("div",
|
|
4861
|
+
S("div", Bi, [S("button", {
|
|
4864
4862
|
ref_key: "endButton",
|
|
4865
|
-
ref:
|
|
4863
|
+
ref: C,
|
|
4866
4864
|
type: "button",
|
|
4867
4865
|
"data-test": "voice-end-btn",
|
|
4868
4866
|
class: "flex size-16 cursor-pointer items-center justify-center rounded-full bg-white/10 text-white ring-1 ring-white/20 transition-colors hover:bg-white/15 active:bg-white/25",
|
|
@@ -4874,39 +4872,39 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4874
4872
|
"aria-hidden": "true"
|
|
4875
4873
|
}, null, -1)])], 512), S("button", {
|
|
4876
4874
|
ref_key: "muteButton",
|
|
4877
|
-
ref:
|
|
4875
|
+
ref: k,
|
|
4878
4876
|
type: "button",
|
|
4879
4877
|
"data-test": "voice-mute-btn",
|
|
4880
|
-
class:
|
|
4878
|
+
class: A(["flex size-16 items-center justify-center rounded-full ring-1 transition-colors active:opacity-70", [h.value ? "bg-white text-[#050F19] ring-white" : "bg-white/10 text-white ring-white/20", p.value === "live" && !u.value ? "cursor-pointer" : "cursor-default opacity-50"]]),
|
|
4881
4879
|
disabled: p.value !== "live" || u.value,
|
|
4882
|
-
"aria-label":
|
|
4883
|
-
"aria-pressed":
|
|
4884
|
-
title:
|
|
4880
|
+
"aria-label": h.value ? "Unmute microphone" : "Mute microphone",
|
|
4881
|
+
"aria-pressed": h.value,
|
|
4882
|
+
title: h.value ? "Unmute microphone" : "Mute microphone",
|
|
4885
4883
|
onClick: toggleMute
|
|
4886
4884
|
}, [S("i", {
|
|
4887
|
-
class:
|
|
4885
|
+
class: A([h.value ? "i-tabler-microphone-off" : "i-tabler-microphone", "size-[25px]"]),
|
|
4888
4886
|
"aria-hidden": "true"
|
|
4889
|
-
}, null, 2)], 10,
|
|
4890
|
-
], 40,
|
|
4887
|
+
}, null, 2)], 10, Vi)])
|
|
4888
|
+
], 40, ji));
|
|
4891
4889
|
}
|
|
4892
|
-
}),
|
|
4890
|
+
}), Ui = {
|
|
4893
4891
|
key: 0,
|
|
4894
4892
|
class: "pb-4"
|
|
4895
|
-
},
|
|
4893
|
+
}, Wi = {
|
|
4896
4894
|
key: 1,
|
|
4897
4895
|
"data-test": "messaging-sdk-header",
|
|
4898
4896
|
class: "shrink-0 border-b border-theme-100 px-4 py-3"
|
|
4899
|
-
},
|
|
4897
|
+
}, Gi = { class: "min-w-0 flex-1" }, Ki = { class: "truncate text-base font-semibold leading-tight text-theme-900" }, qi = { class: "mt-1 truncate text-sm leading-tight text-theme-500" }, Ji = {
|
|
4900
4898
|
key: 0,
|
|
4901
4899
|
class: "shrink-0 rounded-full bg-theme-50 px-2.5 py-1 font-mono text-[11px] font-medium text-theme-500"
|
|
4902
|
-
},
|
|
4900
|
+
}, Yi = ["aria-label"], Xi = {
|
|
4903
4901
|
key: 0,
|
|
4904
4902
|
"data-test": "messaging-empty-state",
|
|
4905
4903
|
class: "flex flex-col items-center justify-center px-4"
|
|
4906
|
-
},
|
|
4904
|
+
}, Zi = ["title"], Qi = {
|
|
4907
4905
|
key: 0,
|
|
4908
4906
|
class: "flex items-center gap-3 py-3 px-2"
|
|
4909
|
-
},
|
|
4907
|
+
}, $i = ["data-journal-outcome"], ea = [
|
|
4910
4908
|
"data-message-id",
|
|
4911
4909
|
"data-message-sender",
|
|
4912
4910
|
"data-conversation-id",
|
|
@@ -4917,7 +4915,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4917
4915
|
"data-issue-action-label",
|
|
4918
4916
|
"data-issue-action-url",
|
|
4919
4917
|
"data-streaming"
|
|
4920
|
-
],
|
|
4918
|
+
], ta = { class: "flex items-center gap-3" }, na = ["href"], ra = [
|
|
4921
4919
|
"data-message-id",
|
|
4922
4920
|
"data-message-sender",
|
|
4923
4921
|
"data-conversation-id",
|
|
@@ -4926,7 +4924,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4926
4924
|
"data-issue-code",
|
|
4927
4925
|
"data-issue-bucket",
|
|
4928
4926
|
"data-streaming"
|
|
4929
|
-
],
|
|
4927
|
+
], ia = [
|
|
4930
4928
|
"data-test",
|
|
4931
4929
|
"data-message-id",
|
|
4932
4930
|
"data-message-sender",
|
|
@@ -4936,14 +4934,19 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4936
4934
|
"data-streaming",
|
|
4937
4935
|
"data-queued",
|
|
4938
4936
|
"aria-label"
|
|
4939
|
-
],
|
|
4937
|
+
], aa = ["src", "alt"], oa = ["src"], sa = ["href"], ca = {
|
|
4940
4938
|
key: 0,
|
|
4941
4939
|
"data-test": "messaging-message-text-part"
|
|
4942
|
-
},
|
|
4940
|
+
}, la = [
|
|
4943
4941
|
"src",
|
|
4944
4942
|
"alt",
|
|
4945
4943
|
"data-attachment-placement"
|
|
4946
|
-
],
|
|
4944
|
+
], ua = ["src", "data-attachment-placement"], da = ["href", "data-attachment-placement"], fa = [
|
|
4945
|
+
"data-copied",
|
|
4946
|
+
"title",
|
|
4947
|
+
"aria-label",
|
|
4948
|
+
"onClick"
|
|
4949
|
+
], pa = ["onClick"], ma = ["data-journal-outcome"], ha = ["data-journal-outcome"], ga = ["data-test", "data-working-description"], _a = {
|
|
4947
4950
|
key: 0,
|
|
4948
4951
|
class: "truncate"
|
|
4949
4952
|
}, va = {
|
|
@@ -4987,11 +4990,11 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4987
4990
|
key: 2,
|
|
4988
4991
|
"data-test": "messaging-ai-notice",
|
|
4989
4992
|
class: "mx-auto max-w-[640px] @5xl/chat:max-w-[720px] pt-3 text-center text-[11.5px] leading-none text-theme-300"
|
|
4990
|
-
}, Ja = /*#__PURE__*/
|
|
4991
|
-
__name: "
|
|
4993
|
+
}, Ja = /*#__PURE__*/ ve(/* @__PURE__ */ k({
|
|
4994
|
+
__name: "ElBotChat",
|
|
4992
4995
|
props: {
|
|
4993
4996
|
chatController: {},
|
|
4994
|
-
|
|
4997
|
+
bot: {},
|
|
4995
4998
|
variant: { default: "dark" },
|
|
4996
4999
|
scope: { default: "private" },
|
|
4997
5000
|
scopeName: {},
|
|
@@ -5024,35 +5027,35 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5024
5027
|
label: "Public",
|
|
5025
5028
|
tooltip: "Anyone with the link can see this"
|
|
5026
5029
|
}
|
|
5027
|
-
}, n =
|
|
5030
|
+
}, n = _(() => {
|
|
5028
5031
|
let n = { ...t[e.scope] };
|
|
5029
5032
|
return e.scope === "org" && e.scopeName && (n.label = e.scopeName, n.tooltip = `Visible to ${e.scopeName} members`), n;
|
|
5030
|
-
}), r =
|
|
5033
|
+
}), r = P(), a = P(), o = P();
|
|
5031
5034
|
function containsMarkdownLink(e) {
|
|
5032
5035
|
return e ? /\[[^\]]+\]\([^)]+\)/.test(e) : !1;
|
|
5033
5036
|
}
|
|
5034
5037
|
function isSystemExplainerMessage(e) {
|
|
5035
|
-
return e.sender === "system" && (!!e.issue || e.id ===
|
|
5038
|
+
return e.sender === "system" && (!!e.issue || e.id === W.value);
|
|
5036
5039
|
}
|
|
5037
5040
|
function isGroupEnd(e, t) {
|
|
5038
5041
|
let n = e[t], r = e[t + 1];
|
|
5039
5042
|
return !r || r.sender !== n.sender;
|
|
5040
5043
|
}
|
|
5041
|
-
let
|
|
5042
|
-
for (let e =
|
|
5043
|
-
let t =
|
|
5044
|
+
let c = _(() => e.chatController?.textState.value), u = _(() => c.value?.isConnected ?? !1), f = _(() => c.value?.isThinking ?? !1), p = _(() => c.value?.connectionStatus !== "connected" && !c.value?.error), k = _(() => e.chatController?.liveTurnBlocks?.value ?? []), ne = _(() => {
|
|
5045
|
+
for (let e = k.value.length - 1; e >= 0; e--) {
|
|
5046
|
+
let t = k.value[e];
|
|
5044
5047
|
if (t?.kind === "text") return t.id;
|
|
5045
5048
|
}
|
|
5046
|
-
}),
|
|
5049
|
+
}), oe = _(() => e.chatController?.liveStreamMessageId?.value), B = _(() => {
|
|
5047
5050
|
let t = e.chatController?.sharedMessages.value ?? [];
|
|
5048
|
-
return
|
|
5049
|
-
}),
|
|
5050
|
-
if (!e.chatController?.workJournal?.value) return
|
|
5051
|
-
}),
|
|
5052
|
-
if (!
|
|
5051
|
+
return k.value.length && oe.value ? t.filter((e) => e.id !== oe.value) : t;
|
|
5052
|
+
}), se = _(() => {
|
|
5053
|
+
if (!e.chatController?.workJournal?.value) return c.value?.workingDescription?.trim() || void 0;
|
|
5054
|
+
}), ve = _(() => e.chatController?.workJournal?.value), ye = _(() => {
|
|
5055
|
+
if (!ve.value && !k.value.length) return;
|
|
5053
5056
|
let e = B.value, t = e[e.length - 1];
|
|
5054
|
-
if (t) return t.sender === "
|
|
5055
|
-
}),
|
|
5057
|
+
if (t) return t.sender === "bot" || t.sender === "system" ? e.length >= 2 ? e[e.length - 2].id : void 0 : t.id;
|
|
5058
|
+
}), H = _(() => {
|
|
5056
5059
|
let t = {};
|
|
5057
5060
|
for (let n of B.value) {
|
|
5058
5061
|
if (n.sender === "user" || !n.toolActivities?.length) continue;
|
|
@@ -5066,7 +5069,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5066
5069
|
return t;
|
|
5067
5070
|
});
|
|
5068
5071
|
function messageWorkJournal(e) {
|
|
5069
|
-
return
|
|
5072
|
+
return H.value[e.id];
|
|
5070
5073
|
}
|
|
5071
5074
|
function inlineOffset(e, t) {
|
|
5072
5075
|
return e.placement?.kind !== "inline" || !Number.isFinite(e.placement.offset) ? null : Math.max(0, Math.min(t.length, Math.trunc(e.placement.offset)));
|
|
@@ -5082,7 +5085,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5082
5085
|
}
|
|
5083
5086
|
function messageRenderParts(e) {
|
|
5084
5087
|
let t = e.text ?? "";
|
|
5085
|
-
if (e.sender !== "
|
|
5088
|
+
if (e.sender !== "bot") return t ? [{
|
|
5086
5089
|
kind: "text",
|
|
5087
5090
|
key: `${e.id}:text`,
|
|
5088
5091
|
text: t
|
|
@@ -5114,64 +5117,78 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5114
5117
|
text: t.slice(i)
|
|
5115
5118
|
}), r;
|
|
5116
5119
|
}
|
|
5117
|
-
let
|
|
5120
|
+
let U = _(() => c.value?.transientIssue), W = _(() => {
|
|
5118
5121
|
if (!f.value) return;
|
|
5119
5122
|
let e = B.value, t = e[e.length - 1];
|
|
5120
|
-
return t?.sender === "
|
|
5121
|
-
}),
|
|
5122
|
-
if (
|
|
5123
|
-
let t = e.
|
|
5124
|
-
return
|
|
5125
|
-
}),
|
|
5123
|
+
return t?.sender === "bot" || t?.sender === "system" ? t.id : void 0;
|
|
5124
|
+
}), G = _(() => !f.value || se.value || ve.value || k.value.length ? !1 : W.value === void 0), Se = _(() => !!se.value || G.value), Ce = _(() => c.value?.sendBlockedReason), we = _(() => Ce.value === "bot_deleted"), Te = _(() => p.value ? "Connecting..." : Ce.value === "bot_deleted" ? "This assistant was deleted" : "Send a message"), Ee = _(() => s(e.bot.state.value)), De = _(() => {
|
|
5125
|
+
if (Qe.value || !Ee.value || Ee.value === "awake") return;
|
|
5126
|
+
let t = e.bot.displayName.value || e.bot.name.value || "Your assistant";
|
|
5127
|
+
return Ee.value === "changing" ? `${t} will be right back…` : Ee.value === "stuck" ? `${t} needs attention.` : `${t} is ${i[Ee.value].toLowerCase()}.`;
|
|
5128
|
+
}), Oe = _(() => e.chatController?.composerState?.value ?? {
|
|
5126
5129
|
text: "",
|
|
5127
5130
|
pendingAttachments: [],
|
|
5128
5131
|
isUploading: !1
|
|
5129
|
-
}),
|
|
5130
|
-
get: () =>
|
|
5132
|
+
}), ke = _({
|
|
5133
|
+
get: () => Oe.value.text,
|
|
5131
5134
|
set: (t) => e.chatController?.setComposerText?.({ text: t })
|
|
5132
|
-
}),
|
|
5135
|
+
}), Ae = _(() => Oe.value.pendingAttachments), je = _(() => Oe.value.isUploading), Me = _(() => e.chatController?.voiceRecorder), Ne = _(() => Me.value?.isBusy.value ?? !1), Pe = _(() => e.chatController?.canAttachFile?.value ?? !1), Fe = _(() => e.chatController?.canRecordAudio?.value ?? !1), Ie = _(() => e.chatController?.composerAction?.value ?? "idle"), Le = _(() => Ie.value !== "idle"), Re = _(() => e.chatController?.composerShowsSecondaryStop?.value ?? !1), ze = _(() => e.chatController?.queuedMessageIds?.value);
|
|
5133
5136
|
function isQueuedMessage(e) {
|
|
5134
|
-
return
|
|
5135
|
-
}
|
|
5136
|
-
let
|
|
5137
|
-
|
|
5138
|
-
return e === "
|
|
5139
|
-
}
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5137
|
+
return ze.value?.has(e) ?? !1;
|
|
5138
|
+
}
|
|
5139
|
+
let Ve = P(), He;
|
|
5140
|
+
function canCopyMessage(e) {
|
|
5141
|
+
return e.sender === "bot" && e.id !== W.value && !!e.text?.trim();
|
|
5142
|
+
}
|
|
5143
|
+
async function copyMessage(t) {
|
|
5144
|
+
try {
|
|
5145
|
+
await navigator.clipboard.writeText(t.text), Ve.value = t.id, clearTimeout(He), He = setTimeout(() => {
|
|
5146
|
+
Ve.value = void 0;
|
|
5147
|
+
}, 1500);
|
|
5148
|
+
} catch (t) {
|
|
5149
|
+
console.warn("ElBotChat: copy to clipboard rejected", t), e.chatController?.notify?.("Could not copy that message.");
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5152
|
+
ie(() => clearTimeout(He));
|
|
5153
|
+
let Ue = _(() => e.chatController?.canReportMessages ?? !1), We = _(() => Ie.value === "stop" ? "Stop reply" : Re.value ? "Send — answered after current work" : "Send message"), Ke = _(() => Fe.value && !Ne.value && !!Me.value?.canUseBrowserRecording), qe = _(() => Me.value?.isActive.value ?? !1), Je = _(() => Me.value?.state.value.phase === "sending"), Ye = _(() => Me.value?.elapsedLabel.value ?? "0:00"), Xe = _(() => {
|
|
5154
|
+
let e = Me.value?.state.value.phase;
|
|
5155
|
+
return e === "preparing" || e === "sending" ? Me.value?.statusText.value ?? "Starting microphone" : lt.value ? "Release to send" : "Click mic to send";
|
|
5156
|
+
}), Ze = _(() => Me.value?.state.value.phase === "sending" ? "Sending voice message" : qe.value ? lt.value ? "Release to send voice message" : "Stop and send voice message" : "Record voice message"), Qe = P(!1), $e = P(), tt = P(), nt = P(), rt = 0, it = _(() => e.chatController?.canStartVoice?.value ?? !1);
|
|
5157
|
+
ue([() => e.bot.avatar.value?.src, it], ([e, t]) => {
|
|
5158
|
+
let n = ++rt;
|
|
5159
|
+
if (nt.value = void 0, !t || !e || typeof Image > "u") return;
|
|
5143
5160
|
let r = new Image();
|
|
5144
5161
|
r.onload = () => {
|
|
5145
|
-
n ===
|
|
5162
|
+
n === rt && (nt.value = e);
|
|
5146
5163
|
}, r.src = e;
|
|
5147
5164
|
}, { immediate: !0 });
|
|
5148
|
-
let
|
|
5165
|
+
let at = _(() => it.value && !Qe.value && !qe.value && Ie.value === "idle"), K = _(() => !u.value), q = _(() => K.value ? `Voice available when ${e.bot.displayName.value || e.bot.name.value || "the assistant"} is awake` : "Start voice conversation");
|
|
5149
5166
|
function startVoiceConversation() {
|
|
5150
|
-
|
|
5167
|
+
!at.value || K.value || (tt.value = nt.value, Qe.value = !0);
|
|
5151
5168
|
}
|
|
5152
5169
|
async function endVoiceConversation() {
|
|
5153
|
-
if (!
|
|
5154
|
-
let t =
|
|
5155
|
-
|
|
5170
|
+
if (!Qe.value) return;
|
|
5171
|
+
let t = $e.value;
|
|
5172
|
+
Qe.value = !1, tt.value = void 0, await te(), await t?.end(), window.matchMedia("(pointer: coarse)").matches || a.value?.focus(), await e.chatController?.refreshMessages();
|
|
5156
5173
|
}
|
|
5157
|
-
let J =
|
|
5158
|
-
|
|
5174
|
+
let J = _(() => e.variant === "light"), st = _(() => J.value ? "bg-theme-200/70" : "bg-white/15"), ct = _(() => J.value ? "text-theme-300" : "text-white/30");
|
|
5175
|
+
re(async () => {
|
|
5159
5176
|
e.chatController && !u.value && await e.chatController.startTextConversation();
|
|
5160
|
-
}),
|
|
5177
|
+
}), ie(() => {
|
|
5161
5178
|
e.chatController?.voiceRecorder?.teardown();
|
|
5162
5179
|
});
|
|
5163
5180
|
async function sendMessage() {
|
|
5164
|
-
!e.chatController ||
|
|
5181
|
+
!e.chatController || Ie.value !== "send" || (a.value && (a.value.style.height = "auto", window.matchMedia("(pointer: coarse)").matches ? (a.value.blur(), requestAnimationFrame(() => {
|
|
5165
5182
|
let e = document.activeElement;
|
|
5166
5183
|
e && (e.tagName === "TEXTAREA" || e.tagName === "INPUT") && e.blur();
|
|
5167
|
-
})) :
|
|
5184
|
+
})) : a.value.focus()), r.value?.pin(), await e.chatController.sendComposerMessage());
|
|
5168
5185
|
}
|
|
5169
5186
|
async function handleCardAction(t) {
|
|
5170
|
-
!e.chatController ||
|
|
5187
|
+
!e.chatController || we.value || (r.value?.pin(), await e.chatController.sendChatMessage(t));
|
|
5171
5188
|
}
|
|
5172
5189
|
async function handleComposerAction() {
|
|
5173
5190
|
if (e.chatController) {
|
|
5174
|
-
if (
|
|
5191
|
+
if (Ie.value === "send") {
|
|
5175
5192
|
await sendMessage();
|
|
5176
5193
|
return;
|
|
5177
5194
|
}
|
|
@@ -5182,44 +5199,44 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5182
5199
|
e.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), await sendMessage());
|
|
5183
5200
|
}
|
|
5184
5201
|
function focusComposer(e) {
|
|
5185
|
-
|
|
5202
|
+
qe.value || we.value || e.target instanceof Element && e.target.closest("button, a, textarea") || a.value?.focus();
|
|
5186
5203
|
}
|
|
5187
5204
|
function adjustTextareaHeight() {
|
|
5188
|
-
|
|
5205
|
+
a.value && (a.value.style.height = "auto", a.value.style.height = `${Math.min(a.value.scrollHeight, 150)}px`);
|
|
5189
5206
|
}
|
|
5190
|
-
|
|
5207
|
+
ue(ke, () => te(() => adjustTextareaHeight()));
|
|
5191
5208
|
function triggerFileInput() {
|
|
5192
5209
|
o.value?.click();
|
|
5193
5210
|
}
|
|
5194
5211
|
async function handleFileSelect(t) {
|
|
5195
5212
|
let n = t.target, r = n.files?.[0];
|
|
5196
|
-
!r || !e.chatController ||
|
|
5213
|
+
!r || !e.chatController || Ne.value || (await e.chatController.attachFile({ file: r }), n.value = "");
|
|
5197
5214
|
}
|
|
5198
5215
|
function removeAttachment(t) {
|
|
5199
5216
|
e.chatController?.removeAttachment({ index: t });
|
|
5200
5217
|
}
|
|
5201
5218
|
function startRecording() {
|
|
5202
|
-
|
|
5219
|
+
Me.value?.start();
|
|
5203
5220
|
}
|
|
5204
5221
|
function finishRecording(e) {
|
|
5205
|
-
|
|
5222
|
+
Me.value?.finish(e);
|
|
5206
5223
|
}
|
|
5207
|
-
let
|
|
5224
|
+
let lt = I(!1), ut = !1;
|
|
5208
5225
|
function onRecordPointerDown(e) {
|
|
5209
|
-
e.pointerType === "touch" && (
|
|
5226
|
+
e.pointerType === "touch" && (ut = !0, lt.value = !0, e.currentTarget.setPointerCapture?.(e.pointerId), startRecording());
|
|
5210
5227
|
}
|
|
5211
5228
|
function onRecordPointerUp(e) {
|
|
5212
|
-
e.pointerType !== "touch" || !
|
|
5229
|
+
e.pointerType !== "touch" || !lt.value || (lt.value = !1, finishRecording({ cancelled: !1 }));
|
|
5213
5230
|
}
|
|
5214
5231
|
function onRecordPointerCancel(e) {
|
|
5215
|
-
e.pointerType !== "touch" || !
|
|
5232
|
+
e.pointerType !== "touch" || !lt.value || (lt.value = !1, ut = !1, finishRecording({ cancelled: !0 }));
|
|
5216
5233
|
}
|
|
5217
5234
|
function toggleRecording() {
|
|
5218
|
-
|
|
5235
|
+
qe.value ? finishRecording({ cancelled: !1 }) : startRecording();
|
|
5219
5236
|
}
|
|
5220
5237
|
function onRecordClick() {
|
|
5221
|
-
if (
|
|
5222
|
-
|
|
5238
|
+
if (ut) {
|
|
5239
|
+
ut = !1;
|
|
5223
5240
|
return;
|
|
5224
5241
|
}
|
|
5225
5242
|
toggleRecording();
|
|
@@ -5251,237 +5268,267 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5251
5268
|
...o ? {} : { year: "numeric" }
|
|
5252
5269
|
})}, ${a}`;
|
|
5253
5270
|
}
|
|
5254
|
-
return (t,
|
|
5271
|
+
return (t, i) => (M(), x("div", {
|
|
5255
5272
|
"data-test": "messaging-root",
|
|
5256
|
-
class:
|
|
5273
|
+
class: A(["@container/chat relative flex h-full flex-col", B.value.length === 0 ? "min-h-0 [justify-content:safe_center] overflow-y-auto" : ""])
|
|
5257
5274
|
}, [
|
|
5258
|
-
e.showHeader && !J.value ? (
|
|
5259
|
-
|
|
5275
|
+
e.showHeader && !J.value ? (M(), x("div", Ui, [T(Be, {
|
|
5276
|
+
bot: e.bot,
|
|
5260
5277
|
"is-online": u.value
|
|
5261
|
-
}, null, 8, ["
|
|
5278
|
+
}, null, 8, ["bot", "is-online"])])) : e.showHeader ? (M(), x("div", Wi, [S("div", { class: A(["flex items-center gap-3", e.centered ? "max-w-[640px] @5xl/chat:max-w-[720px] mx-auto" : ""]) }, [
|
|
5262
5279
|
T(Ge, {
|
|
5263
|
-
|
|
5280
|
+
bot: e.bot,
|
|
5264
5281
|
"is-light": J.value,
|
|
5265
5282
|
class: "size-10"
|
|
5266
|
-
}, null, 8, ["
|
|
5267
|
-
S("div",
|
|
5268
|
-
e.headerMeta ? (
|
|
5283
|
+
}, null, 8, ["bot", "is-light"]),
|
|
5284
|
+
S("div", Gi, [S("div", Ki, R(e.bot.displayName.value), 1), S("div", qi, R(e.bot.title.value || "Assistant"), 1)]),
|
|
5285
|
+
e.headerMeta ? (M(), x("span", Ji, R(e.headerMeta), 1)) : b("", !0)
|
|
5269
5286
|
], 2)])) : b("", !0),
|
|
5270
|
-
T(
|
|
5271
|
-
default:
|
|
5287
|
+
T(h, { name: "voice-call" }, {
|
|
5288
|
+
default: de(() => [Qe.value ? (M(), x("div", {
|
|
5272
5289
|
key: 0,
|
|
5273
5290
|
"data-test": "voice-call-overlay",
|
|
5274
5291
|
role: "dialog",
|
|
5275
5292
|
"aria-modal": "true",
|
|
5276
|
-
"aria-label": `Voice conversation with ${e.
|
|
5293
|
+
"aria-label": `Voice conversation with ${e.bot.displayName.value}`,
|
|
5277
5294
|
class: "fixed inset-0 z-[100] flex items-stretch justify-stretch bg-[#050F19] sm:items-center sm:justify-center sm:bg-[#050F19]/45 sm:p-6",
|
|
5278
|
-
onKeydown:
|
|
5279
|
-
}, [T(
|
|
5295
|
+
onKeydown: i[0] || (i[0] = he((e) => endVoiceConversation(), ["esc"]))
|
|
5296
|
+
}, [T(Hi, {
|
|
5280
5297
|
ref_key: "voiceMode",
|
|
5281
|
-
ref:
|
|
5282
|
-
|
|
5298
|
+
ref: $e,
|
|
5299
|
+
bot: e.bot,
|
|
5283
5300
|
"chat-controller": e.chatController,
|
|
5284
|
-
"backdrop-src":
|
|
5301
|
+
"backdrop-src": tt.value,
|
|
5285
5302
|
"is-light": !1,
|
|
5286
5303
|
class: "voice-call-card h-full w-full sm:max-h-[620px] sm:max-w-[420px] sm:flex-none sm:rounded-[32px] sm:shadow-[0_32px_80px_rgba(5,15,25,0.45)]",
|
|
5287
5304
|
onEnd: endVoiceConversation
|
|
5288
5305
|
}, null, 8, [
|
|
5289
|
-
"
|
|
5306
|
+
"bot",
|
|
5290
5307
|
"chat-controller",
|
|
5291
5308
|
"backdrop-src"
|
|
5292
|
-
])], 40,
|
|
5309
|
+
])], 40, Yi)) : b("", !0)]),
|
|
5293
5310
|
_: 1
|
|
5294
5311
|
}),
|
|
5295
|
-
p.value ? (
|
|
5312
|
+
p.value ? (M(), x("div", {
|
|
5296
5313
|
key: 2,
|
|
5297
|
-
class:
|
|
5298
|
-
}, [T(
|
|
5314
|
+
class: A(["py-16 flex flex-col items-center justify-center gap-2 text-sm", J.value ? "text-theme-400" : "text-theme-600"])
|
|
5315
|
+
}, [T(be, { class: "size-4" })], 2)) : e.setupHint ? (M(), x("div", {
|
|
5299
5316
|
key: 3,
|
|
5300
|
-
class:
|
|
5301
|
-
}, [
|
|
5302
|
-
T(
|
|
5317
|
+
class: A(["flex items-center justify-center gap-1.5 py-2 text-[11px]", ct.value])
|
|
5318
|
+
}, [i[14] || (i[14] = S("i", { class: "i-tabler-tool size-3" }, null, -1)), S("span", null, R(e.setupHint), 1)], 2)) : b("", !0),
|
|
5319
|
+
T(mi, {
|
|
5303
5320
|
ref_key: "chatScroller",
|
|
5304
5321
|
ref: r,
|
|
5305
|
-
inert:
|
|
5306
|
-
"aria-hidden":
|
|
5307
|
-
class:
|
|
5322
|
+
inert: Qe.value,
|
|
5323
|
+
"aria-hidden": Qe.value ? "true" : void 0,
|
|
5324
|
+
class: A(B.value.length === 0 ? "flex-none" : "flex-1")
|
|
5308
5325
|
}, {
|
|
5309
|
-
default:
|
|
5310
|
-
B.value.length === 0 && !p.value ? (
|
|
5311
|
-
|
|
5326
|
+
default: de(() => [S("div", { class: A([B.value.length === 0 ? "flex flex-col items-center justify-center px-3 py-4" : e.centered ? "pt-20 pb-5 px-3 @lg/chat:px-8 space-y-2" : "pt-4 pb-[120px] px-3 @lg/chat:px-8 space-y-2", e.centered ? B.value.length === 0 ? "max-w-[900px] mx-auto w-full" : "max-w-[640px] @5xl/chat:max-w-[720px] mx-auto w-full" : ""]) }, [
|
|
5327
|
+
B.value.length === 0 && !p.value ? (M(), x("div", Xi, [ae(t.$slots, "empty-heading", {
|
|
5328
|
+
bot: e.bot,
|
|
5312
5329
|
isLight: J.value
|
|
5313
5330
|
}, () => [T(Ge, {
|
|
5314
|
-
|
|
5331
|
+
bot: e.bot,
|
|
5315
5332
|
"is-light": J.value,
|
|
5316
5333
|
class: "mb-4 size-20 @sm/chat:size-24"
|
|
5317
|
-
}, null, 8, ["
|
|
5318
|
-
class:
|
|
5334
|
+
}, null, 8, ["bot", "is-light"]), S("div", { class: A(["text-base @sm/chat:text-lg font-semibold", J.value ? "text-theme-900" : "text-white"]) }, R(e.bot.displayName.value), 3)], !0), e.emptyStateMessage === "" ? b("", !0) : (M(), x(m, { key: 0 }, [S("p", { class: A(["mt-1 text-center text-xs @sm/chat:text-sm", ct.value]) }, R(e.emptyStateMessage || "Type your message to get started."), 3), S("div", {
|
|
5335
|
+
class: A(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", J.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
5319
5336
|
title: n.value.tooltip
|
|
5320
|
-
}, [S("i", { class:
|
|
5321
|
-
(
|
|
5322
|
-
shouldShowTimeDivider(B.value,
|
|
5323
|
-
S("div", { class:
|
|
5324
|
-
S("span", { class:
|
|
5325
|
-
S("div", { class:
|
|
5337
|
+
}, [S("i", { class: A([n.value.icon, "size-3"]) }, null, 2), S("span", null, R(n.value.label), 1)], 10, Zi)], 64))])) : b("", !0),
|
|
5338
|
+
(M(!0), x(m, null, F(B.value, (t, n) => (M(), x(m, { key: t.id }, [
|
|
5339
|
+
shouldShowTimeDivider(B.value, n) ? (M(), x("div", Qi, [
|
|
5340
|
+
S("div", { class: A(["flex-1 h-px", st.value]) }, null, 2),
|
|
5341
|
+
S("span", { class: A(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", ct.value]) }, R(shouldShowTimeDivider(B.value, n)), 3),
|
|
5342
|
+
S("div", { class: A(["flex-1 h-px", st.value]) }, null, 2)
|
|
5326
5343
|
])) : b("", !0),
|
|
5327
|
-
messageWorkJournal(
|
|
5344
|
+
messageWorkJournal(t) ? (M(), x("div", {
|
|
5328
5345
|
key: 1,
|
|
5329
5346
|
"data-test": "messaging-message-tool-activity",
|
|
5330
|
-
"data-journal-outcome": messageWorkJournal(
|
|
5347
|
+
"data-journal-outcome": messageWorkJournal(t)?.outcome,
|
|
5331
5348
|
class: "mb-4 w-full"
|
|
5332
5349
|
}, [T(et, {
|
|
5333
|
-
model: messageWorkJournal(
|
|
5350
|
+
model: messageWorkJournal(t),
|
|
5334
5351
|
"is-light": J.value
|
|
5335
|
-
}, null, 8, ["model", "is-light"])], 8,
|
|
5336
|
-
isSystemExplainerMessage(
|
|
5352
|
+
}, null, 8, ["model", "is-light"])], 8, $i)) : b("", !0),
|
|
5353
|
+
isSystemExplainerMessage(t) ? (M(), x("section", {
|
|
5337
5354
|
key: 2,
|
|
5338
5355
|
"data-test": "messaging-system-msg",
|
|
5339
|
-
"data-message-id":
|
|
5340
|
-
"data-message-sender":
|
|
5341
|
-
"data-conversation-id":
|
|
5342
|
-
"data-message-sequence":
|
|
5343
|
-
"data-system-kind":
|
|
5344
|
-
"data-issue-code":
|
|
5345
|
-
"data-issue-bucket":
|
|
5346
|
-
"data-issue-action-label":
|
|
5347
|
-
"data-issue-action-url":
|
|
5348
|
-
"data-streaming":
|
|
5356
|
+
"data-message-id": t.id,
|
|
5357
|
+
"data-message-sender": t.sender,
|
|
5358
|
+
"data-conversation-id": t.conversationId,
|
|
5359
|
+
"data-message-sequence": t.sequence,
|
|
5360
|
+
"data-system-kind": t.systemKind,
|
|
5361
|
+
"data-issue-code": t.issue?.code,
|
|
5362
|
+
"data-issue-bucket": t.issue?.bucket,
|
|
5363
|
+
"data-issue-action-label": t.issue?.actionLabel,
|
|
5364
|
+
"data-issue-action-url": t.issue?.actionUrl,
|
|
5365
|
+
"data-streaming": t.id === W.value ? "true" : void 0,
|
|
5349
5366
|
class: "mb-6 w-full"
|
|
5350
|
-
}, [S("div", { class:
|
|
5367
|
+
}, [S("div", { class: A(["mb-1.5 text-center text-[10.5px] font-medium", ct.value]) }, "System message", 2), S("div", ta, [
|
|
5351
5368
|
S("span", {
|
|
5352
5369
|
"data-test": "messaging-system-divider-line",
|
|
5353
5370
|
"aria-hidden": "true",
|
|
5354
|
-
class:
|
|
5371
|
+
class: A(["hidden h-px flex-1 opacity-60 @md/chat:block", st.value])
|
|
5355
5372
|
}, null, 2),
|
|
5356
|
-
S("div", { class:
|
|
5373
|
+
S("div", { class: A(["w-[46ch] min-w-0 max-w-full rounded-2xl px-5 py-3.5 text-center text-[13px] ring-1 [&_.chat-msg-rich]:max-w-none [&_.chat-msg-rich]:text-[13px] [&_.chat-msg-rich]:italic [&_.chat-msg-rich]:leading-[1.6]", J.value ? "text-theme-700 ring-theme-200/50" : "text-white/85 ring-white/10"]) }, [t.text ? (M(), v(di, {
|
|
5357
5374
|
key: 0,
|
|
5358
|
-
text:
|
|
5375
|
+
text: t.text,
|
|
5359
5376
|
inverted: !J.value,
|
|
5360
|
-
streaming:
|
|
5361
|
-
onClick:
|
|
5377
|
+
streaming: t.id === W.value,
|
|
5378
|
+
onClick: i[1] || (i[1] = _e(() => {}, ["stop"])),
|
|
5362
5379
|
onAction: handleCardAction
|
|
5363
5380
|
}, null, 8, [
|
|
5364
5381
|
"text",
|
|
5365
5382
|
"inverted",
|
|
5366
5383
|
"streaming"
|
|
5367
|
-
])) :
|
|
5384
|
+
])) : t.issue?.help ? (M(), v(di, {
|
|
5368
5385
|
key: 1,
|
|
5369
|
-
text:
|
|
5386
|
+
text: t.issue.help,
|
|
5370
5387
|
inverted: !J.value
|
|
5371
|
-
}, null, 8, ["text", "inverted"])) : b("", !0),
|
|
5388
|
+
}, null, 8, ["text", "inverted"])) : b("", !0), t.issue?.actionUrl && !containsMarkdownLink(t.text) ? (M(), x("a", {
|
|
5372
5389
|
key: 2,
|
|
5373
|
-
href:
|
|
5390
|
+
href: t.issue.actionUrl,
|
|
5374
5391
|
"data-test": "messaging-system-msg-action",
|
|
5375
|
-
class:
|
|
5376
|
-
onClick:
|
|
5377
|
-
}, [C(
|
|
5392
|
+
class: A(["mt-2 text-[12px] font-medium inline-flex items-center gap-1", J.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"]),
|
|
5393
|
+
onClick: i[2] || (i[2] = _e(() => {}, ["stop"]))
|
|
5394
|
+
}, [C(R(t.issue.actionLabel) + " ", 1), i[15] || (i[15] = S("i", { class: "i-tabler-arrow-right size-3" }, null, -1))], 10, na)) : b("", !0)], 2),
|
|
5378
5395
|
S("span", {
|
|
5379
5396
|
"data-test": "messaging-system-divider-line",
|
|
5380
5397
|
"aria-hidden": "true",
|
|
5381
|
-
class:
|
|
5398
|
+
class: A(["hidden h-px flex-1 opacity-60 @md/chat:block", st.value])
|
|
5382
5399
|
}, null, 2)
|
|
5383
|
-
])], 8,
|
|
5400
|
+
])], 8, ea)) : t.sender === "system" ? (M(), x("div", {
|
|
5384
5401
|
key: 3,
|
|
5385
5402
|
"data-test": "messaging-system-status-msg",
|
|
5386
|
-
"data-message-id":
|
|
5387
|
-
"data-message-sender":
|
|
5388
|
-
"data-conversation-id":
|
|
5389
|
-
"data-message-sequence":
|
|
5390
|
-
"data-system-kind":
|
|
5391
|
-
"data-issue-code":
|
|
5392
|
-
"data-issue-bucket":
|
|
5393
|
-
"data-streaming":
|
|
5394
|
-
class:
|
|
5395
|
-
}, [
|
|
5403
|
+
"data-message-id": t.id,
|
|
5404
|
+
"data-message-sender": t.sender,
|
|
5405
|
+
"data-conversation-id": t.conversationId,
|
|
5406
|
+
"data-message-sequence": t.sequence,
|
|
5407
|
+
"data-system-kind": t.systemKind,
|
|
5408
|
+
"data-issue-code": t.issue?.code,
|
|
5409
|
+
"data-issue-bucket": t.issue?.bucket,
|
|
5410
|
+
"data-streaming": t.id === W.value ? "true" : void 0,
|
|
5411
|
+
class: A(["mb-4 flex w-fit max-w-[85%] items-start gap-2 rounded-2xl px-3 py-2 text-[13px] leading-relaxed ring-1", J.value ? "bg-theme-100 text-theme-600 ring-theme-200" : "bg-white/10 text-white/70 ring-white/10"])
|
|
5412
|
+
}, [i[16] || (i[16] = S("i", {
|
|
5396
5413
|
class: "i-tabler-info-circle size-4 mt-0.5 shrink-0",
|
|
5397
5414
|
"aria-hidden": "true"
|
|
5398
|
-
}, null, -1)), T(
|
|
5399
|
-
text:
|
|
5415
|
+
}, null, -1)), T(di, {
|
|
5416
|
+
text: t.text,
|
|
5400
5417
|
inverted: !J.value,
|
|
5401
|
-
onClick:
|
|
5402
|
-
}, null, 8, ["text", "inverted"])], 10,
|
|
5418
|
+
onClick: i[3] || (i[3] = _e(() => {}, ["stop"]))
|
|
5419
|
+
}, null, 8, ["text", "inverted"])], 10, ra)) : (M(), x("div", {
|
|
5403
5420
|
key: 4,
|
|
5404
|
-
"data-test":
|
|
5405
|
-
"data-message-id":
|
|
5406
|
-
"data-message-sender":
|
|
5407
|
-
"data-conversation-id":
|
|
5408
|
-
"data-message-sequence":
|
|
5409
|
-
"data-system-kind":
|
|
5410
|
-
"data-streaming":
|
|
5411
|
-
"data-queued": isQueuedMessage(
|
|
5412
|
-
"aria-label": isQueuedMessage(
|
|
5413
|
-
class:
|
|
5414
|
-
"justify-end":
|
|
5415
|
-
"justify-start":
|
|
5416
|
-
"mb-6": isGroupEnd(B.value,
|
|
5417
|
-
"opacity-70": isQueuedMessage(
|
|
5421
|
+
"data-test": t.sender === "bot" ? "messaging-assistant-msg" : t.sender === "user" ? "messaging-user-msg" : void 0,
|
|
5422
|
+
"data-message-id": t.id,
|
|
5423
|
+
"data-message-sender": t.sender,
|
|
5424
|
+
"data-conversation-id": t.conversationId,
|
|
5425
|
+
"data-message-sequence": t.sequence,
|
|
5426
|
+
"data-system-kind": t.systemKind,
|
|
5427
|
+
"data-streaming": t.id === W.value ? "true" : void 0,
|
|
5428
|
+
"data-queued": isQueuedMessage(t.id) ? "true" : void 0,
|
|
5429
|
+
"aria-label": isQueuedMessage(t.id) ? "Sent — will be answered after the current work finishes" : void 0,
|
|
5430
|
+
class: A(["flex gap-2 items-end", {
|
|
5431
|
+
"justify-end": t.sender === "user",
|
|
5432
|
+
"justify-start": t.sender === "bot",
|
|
5433
|
+
"mb-6": isGroupEnd(B.value, n),
|
|
5434
|
+
"opacity-70": isQueuedMessage(t.id)
|
|
5418
5435
|
}])
|
|
5419
5436
|
}, [S("div", {
|
|
5420
5437
|
"data-test": "messaging-message-body",
|
|
5421
|
-
class:
|
|
5422
|
-
}, [
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
key:
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5438
|
+
class: A(t.sender === "user" ? "min-w-0 ml-3 @sm/chat:ml-[2em]" : "w-full min-w-0 pr-3 @sm/chat:pr-[2em]")
|
|
5439
|
+
}, [
|
|
5440
|
+
blockAttachmentsForMessage(t).length ? (M(), x("div", {
|
|
5441
|
+
key: 0,
|
|
5442
|
+
class: A(["mb-1 space-y-1", t.sender === "user" ? "flex flex-col items-end" : ""])
|
|
5443
|
+
}, [(M(!0), x(m, null, F(blockAttachmentsForMessage(t), ({ attachment: e, index: t }) => (M(), x(m, { key: attachmentKey(e, t) }, [e.type === "image" ? (M(), x("img", {
|
|
5444
|
+
key: 0,
|
|
5445
|
+
src: e.src,
|
|
5446
|
+
alt: e.filename,
|
|
5447
|
+
"data-test": "messaging-attachment",
|
|
5448
|
+
"data-attachment-placement": "block",
|
|
5449
|
+
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
5450
|
+
}, null, 8, aa)) : e.type === "audio" ? (M(), x("audio", {
|
|
5451
|
+
key: 1,
|
|
5452
|
+
src: e.src,
|
|
5453
|
+
controls: "",
|
|
5454
|
+
"data-test": "messaging-attachment",
|
|
5455
|
+
"data-attachment-placement": "block",
|
|
5456
|
+
class: "max-w-full"
|
|
5457
|
+
}, null, 8, oa)) : (M(), x("a", {
|
|
5458
|
+
key: 2,
|
|
5459
|
+
href: e.src,
|
|
5460
|
+
target: "_blank",
|
|
5461
|
+
rel: "noopener",
|
|
5462
|
+
"data-test": "messaging-attachment",
|
|
5463
|
+
"data-attachment-placement": "block",
|
|
5464
|
+
class: A(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", J.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
5465
|
+
}, [i[17] || (i[17] = S("i", { class: "i-tabler-file size-3.5" }, null, -1)), C(" " + R(e.filename), 1)], 10, sa))], 64))), 128))], 2)) : b("", !0),
|
|
5466
|
+
messageRenderParts(t).length ? (M(), x("div", {
|
|
5467
|
+
key: 1,
|
|
5468
|
+
"data-test": "messaging-message-content",
|
|
5469
|
+
class: A(t.sender === "user" ? J.value ? "rounded-[14px] px-4 py-2.5 bg-theme-50 text-theme-900" : "rounded-[14px] px-4 py-2.5 bg-white/10 text-white" : J.value ? "text-theme-800" : "text-white/95")
|
|
5470
|
+
}, [(M(!0), x(m, null, F(messageRenderParts(t), (e) => (M(), x(m, { key: e.key }, [e.kind === "text" && e.text ? (M(), x("div", ca, [T(di, {
|
|
5471
|
+
text: e.text,
|
|
5472
|
+
inverted: t.sender === "user" || !J.value,
|
|
5473
|
+
streaming: t.id === W.value,
|
|
5474
|
+
onClick: i[4] || (i[4] = _e(() => {}, ["stop"])),
|
|
5475
|
+
onAction: handleCardAction
|
|
5476
|
+
}, null, 8, [
|
|
5477
|
+
"text",
|
|
5478
|
+
"inverted",
|
|
5479
|
+
"streaming"
|
|
5480
|
+
])])) : e.kind === "attachment" && e.attachment.type === "image" ? (M(), x("img", {
|
|
5481
|
+
key: 1,
|
|
5482
|
+
src: e.attachment.src,
|
|
5483
|
+
alt: e.attachment.filename,
|
|
5484
|
+
"data-test": "messaging-attachment",
|
|
5485
|
+
"data-attachment-placement": e.placement,
|
|
5486
|
+
class: "my-2 rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
5487
|
+
}, null, 8, la)) : e.kind === "attachment" && e.attachment.type === "audio" ? (M(), x("audio", {
|
|
5488
|
+
key: 2,
|
|
5489
|
+
src: e.attachment.src,
|
|
5490
|
+
controls: "",
|
|
5491
|
+
"data-test": "messaging-attachment",
|
|
5492
|
+
"data-attachment-placement": e.placement,
|
|
5493
|
+
class: "my-2 max-w-full"
|
|
5494
|
+
}, null, 8, ua)) : e.kind === "attachment" ? (M(), x("a", {
|
|
5495
|
+
key: 3,
|
|
5496
|
+
href: e.attachment.src,
|
|
5497
|
+
target: "_blank",
|
|
5498
|
+
rel: "noopener",
|
|
5499
|
+
"data-test": "messaging-attachment",
|
|
5500
|
+
"data-attachment-placement": e.placement,
|
|
5501
|
+
class: A(["my-2 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", J.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
5502
|
+
}, [i[18] || (i[18] = S("i", { class: "i-tabler-file size-3.5" }, null, -1)), C(" " + R(e.attachment.filename), 1)], 10, da)) : b("", !0)], 64))), 128))], 2)) : b("", !0),
|
|
5503
|
+
canCopyMessage(t) ? (M(), x("div", {
|
|
5504
|
+
key: 2,
|
|
5505
|
+
"data-test": "messaging-message-actions",
|
|
5506
|
+
class: A(["-ml-1.5 flex items-center gap-0.5 pt-0.5", J.value ? "text-theme-400" : "text-white/45"])
|
|
5507
|
+
}, [S("button", {
|
|
5508
|
+
type: "button",
|
|
5509
|
+
"data-test": "messaging-message-copy",
|
|
5510
|
+
"data-copied": Ve.value === t.id || void 0,
|
|
5511
|
+
title: Ve.value === t.id ? "Copied" : "Copy",
|
|
5512
|
+
"aria-label": Ve.value === t.id ? "Copied" : "Copy",
|
|
5513
|
+
class: A(["grid size-8 cursor-pointer place-items-center rounded-md transition-colors", J.value ? "hover:bg-theme-100 hover:text-theme-900" : "hover:bg-white/10 hover:text-white"]),
|
|
5514
|
+
onClick: _e((e) => copyMessage(t), ["stop"])
|
|
5515
|
+
}, [S("i", {
|
|
5516
|
+
class: A(["size-4", Ve.value === t.id ? "i-tabler-check" : "i-tabler-copy"]),
|
|
5517
|
+
"aria-hidden": "true"
|
|
5518
|
+
}, null, 2)], 10, fa), Ue.value ? (M(), x("button", {
|
|
5519
|
+
key: 0,
|
|
5520
|
+
type: "button",
|
|
5521
|
+
"data-test": "messaging-message-report",
|
|
5522
|
+
title: "Report",
|
|
5523
|
+
"aria-label": "Report",
|
|
5524
|
+
class: A(["grid size-8 cursor-pointer place-items-center rounded-md transition-colors", J.value ? "hover:bg-theme-100 hover:text-theme-900" : "hover:bg-white/10 hover:text-white"]),
|
|
5525
|
+
onClick: _e((n) => e.chatController?.reportMessage(t.id), ["stop"])
|
|
5526
|
+
}, [...i[19] || (i[19] = [S("i", {
|
|
5527
|
+
class: "i-tabler-flag size-4",
|
|
5528
|
+
"aria-hidden": "true"
|
|
5529
|
+
}, null, -1)])], 10, pa)) : b("", !0)], 2)) : b("", !0)
|
|
5530
|
+
], 2)], 10, ia)),
|
|
5531
|
+
t.id === ye.value ? (M(), x(m, { key: 5 }, [k.value.length ? (M(!0), x(m, { key: 0 }, F(k.value, (e) => (M(), x(m, { key: e.id }, [e.kind === "work" ? (M(), x("div", {
|
|
5485
5532
|
key: 0,
|
|
5486
5533
|
"data-test": "messaging-tool-activity",
|
|
5487
5534
|
"data-journal-outcome": e.journal.outcome,
|
|
@@ -5489,50 +5536,50 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5489
5536
|
}, [T(et, {
|
|
5490
5537
|
model: e.journal,
|
|
5491
5538
|
"is-light": J.value
|
|
5492
|
-
}, null, 8, ["model", "is-light"])], 8, ma)) : e.kind === "text" && e.content ? (
|
|
5539
|
+
}, null, 8, ["model", "is-light"])], 8, ma)) : e.kind === "text" && e.content ? (M(), x("div", {
|
|
5493
5540
|
key: 1,
|
|
5494
5541
|
"data-test": "messaging-live-text-block",
|
|
5495
|
-
class:
|
|
5496
|
-
}, [T(
|
|
5542
|
+
class: A(["mb-4", J.value ? "text-theme-800" : "text-white/95"])
|
|
5543
|
+
}, [T(di, {
|
|
5497
5544
|
text: e.content,
|
|
5498
5545
|
inverted: !J.value,
|
|
5499
|
-
streaming: e.id ===
|
|
5500
|
-
onClick:
|
|
5546
|
+
streaming: e.id === ne.value,
|
|
5547
|
+
onClick: i[5] || (i[5] = _e(() => {}, ["stop"])),
|
|
5501
5548
|
onAction: handleCardAction
|
|
5502
5549
|
}, null, 8, [
|
|
5503
5550
|
"text",
|
|
5504
5551
|
"inverted",
|
|
5505
5552
|
"streaming"
|
|
5506
|
-
])], 2)) : (
|
|
5553
|
+
])], 2)) : (M(), x("div", {
|
|
5507
5554
|
key: 2,
|
|
5508
5555
|
"data-test": "messaging-tool-activity-tail",
|
|
5509
5556
|
"aria-label": "Assistant is still working",
|
|
5510
|
-
class:
|
|
5511
|
-
}, [...
|
|
5557
|
+
class: A(["chat-live-enter mb-4 grid h-[17px] w-5 place-items-center", J.value ? "text-theme-500" : "text-white/70"])
|
|
5558
|
+
}, [...i[20] || (i[20] = [S("span", {
|
|
5512
5559
|
class: "chat-dots chat-dots--mini",
|
|
5513
5560
|
"aria-hidden": "true"
|
|
5514
5561
|
}, [
|
|
5515
5562
|
S("span"),
|
|
5516
5563
|
S("span"),
|
|
5517
5564
|
S("span")
|
|
5518
|
-
], -1)])], 2))], 64))), 128)) :
|
|
5565
|
+
], -1)])], 2))], 64))), 128)) : ve.value ? (M(), x("div", {
|
|
5519
5566
|
key: 1,
|
|
5520
5567
|
"data-test": "messaging-tool-activity",
|
|
5521
|
-
"data-journal-outcome":
|
|
5568
|
+
"data-journal-outcome": ve.value.outcome,
|
|
5522
5569
|
class: "chat-live-enter mb-4 w-full"
|
|
5523
5570
|
}, [T(et, {
|
|
5524
|
-
model:
|
|
5571
|
+
model: ve.value,
|
|
5525
5572
|
"is-light": J.value
|
|
5526
5573
|
}, null, 8, ["model", "is-light"])], 8, ha)) : b("", !0)], 64)) : b("", !0)
|
|
5527
5574
|
], 64))), 128)),
|
|
5528
|
-
|
|
5575
|
+
Se.value ? (M(), x("div", {
|
|
5529
5576
|
key: 1,
|
|
5530
|
-
"data-test":
|
|
5531
|
-
"data-working-description":
|
|
5577
|
+
"data-test": se.value ? "messaging-working-state" : "messaging-thinking-indicator",
|
|
5578
|
+
"data-working-description": se.value,
|
|
5532
5579
|
role: "status",
|
|
5533
5580
|
"aria-live": "polite",
|
|
5534
|
-
class:
|
|
5535
|
-
}, [
|
|
5581
|
+
class: A(["chat-live-enter relative mb-4 flex h-[17px] items-center gap-2.5 pl-0.5 text-[13.5px] leading-snug", J.value ? "text-theme-500" : "text-white/50"])
|
|
5582
|
+
}, [i[21] || (i[21] = S("span", {
|
|
5536
5583
|
"data-test": "messaging-thinking-dots",
|
|
5537
5584
|
class: "chat-dots shrink-0",
|
|
5538
5585
|
"aria-hidden": "true"
|
|
@@ -5540,25 +5587,25 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5540
5587
|
S("span"),
|
|
5541
5588
|
S("span"),
|
|
5542
5589
|
S("span")
|
|
5543
|
-
], -1)),
|
|
5544
|
-
|
|
5590
|
+
], -1)), se.value ? (M(), x("span", _a, R(se.value), 1)) : (M(), x("span", va, "Thinking"))], 10, ga)) : b("", !0),
|
|
5591
|
+
U.value ? (M(), x("div", {
|
|
5545
5592
|
key: 2,
|
|
5546
5593
|
"data-test": "messaging-transient-issue",
|
|
5547
|
-
"data-issue-code":
|
|
5594
|
+
"data-issue-code": U.value.code,
|
|
5548
5595
|
role: "alert",
|
|
5549
|
-
class:
|
|
5596
|
+
class: A(["chat-live-enter mb-4 flex items-start gap-2 px-2 text-[13px] leading-snug", J.value ? "text-theme-600" : "text-white/60"])
|
|
5550
5597
|
}, [
|
|
5551
|
-
|
|
5598
|
+
i[23] || (i[23] = S("i", {
|
|
5552
5599
|
class: "i-tabler-alert-circle size-3.5 shrink-0 text-red-500",
|
|
5553
5600
|
"aria-hidden": "true"
|
|
5554
5601
|
}, null, -1)),
|
|
5555
|
-
S("span", ba, [S("span", xa, [C(U
|
|
5556
|
-
|
|
5602
|
+
S("span", ba, [S("span", xa, [C(R(U.value.message), 1), U.value.help ? (M(), x(m, { key: 0 }, [C(":")], 64)) : b("", !0)]), U.value.help ? (M(), x(m, { key: 0 }, [i[22] || (i[22] = C(R(" "), -1)), S("span", Sa, R(U.value.help), 1)], 64)) : b("", !0)]),
|
|
5603
|
+
U.value.actionUrl && U.value.actionLabel ? (M(), x("a", {
|
|
5557
5604
|
key: 0,
|
|
5558
|
-
href:
|
|
5605
|
+
href: U.value.actionUrl,
|
|
5559
5606
|
class: "shrink-0 underline underline-offset-2",
|
|
5560
|
-
onClick:
|
|
5561
|
-
}, U
|
|
5607
|
+
onClick: i[6] || (i[6] = _e(() => {}, ["stop"]))
|
|
5608
|
+
}, R(U.value.actionLabel), 9, Ca)) : b("", !0)
|
|
5562
5609
|
], 10, ya)) : b("", !0)
|
|
5563
5610
|
], 2)]),
|
|
5564
5611
|
_: 3
|
|
@@ -5569,40 +5616,40 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5569
5616
|
]),
|
|
5570
5617
|
S("div", {
|
|
5571
5618
|
"data-test": "messaging-composer-footer",
|
|
5572
|
-
inert:
|
|
5573
|
-
"aria-hidden":
|
|
5574
|
-
class:
|
|
5619
|
+
inert: Qe.value,
|
|
5620
|
+
"aria-hidden": Qe.value ? "true" : void 0,
|
|
5621
|
+
class: A(["left-0 right-0 z-30 px-3 @lg/chat:px-8 pb-[max(env(safe-area-inset-bottom),1rem)]", [
|
|
5575
5622
|
B.value.length === 0 || e.centered ? "relative shrink-0" : "absolute bottom-0",
|
|
5576
5623
|
e.centered && B.value.length > 0 ? "pt-0 sm:pb-7" : "pt-3",
|
|
5577
5624
|
J.value ? e.centered ? "bg-transparent" : "bg-theme-0" : "bg-gradient-to-t from-black/90 via-black/60 to-transparent"
|
|
5578
5625
|
]])
|
|
5579
|
-
}, [
|
|
5626
|
+
}, [ae(t.$slots, "composer", {}, () => [De.value ? (M(), x("div", {
|
|
5580
5627
|
key: 0,
|
|
5581
5628
|
"data-test": "messaging-seat",
|
|
5582
|
-
"data-seat-state":
|
|
5629
|
+
"data-seat-state": Ee.value,
|
|
5583
5630
|
role: "status",
|
|
5584
5631
|
"aria-live": "polite",
|
|
5585
|
-
class:
|
|
5586
|
-
},
|
|
5587
|
-
|
|
5632
|
+
class: A(["py-3 text-center text-[14px]", J.value ? "text-theme-500" : "text-white/70"])
|
|
5633
|
+
}, R(De.value), 11, Ta)) : (M(), x(m, { key: 1 }, [
|
|
5634
|
+
Ae.value.length > 0 ? (M(), x("div", {
|
|
5588
5635
|
key: 0,
|
|
5589
|
-
class:
|
|
5590
|
-
}, [(
|
|
5636
|
+
class: A(["flex items-center gap-2 px-2 pb-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", e.centered ? "max-w-[640px] @5xl/chat:max-w-[720px] mx-auto" : ""])
|
|
5637
|
+
}, [(M(!0), x(m, null, F(Ae.value, (e, t) => (M(), x("div", {
|
|
5591
5638
|
key: t,
|
|
5592
5639
|
class: "relative shrink-0 group"
|
|
5593
|
-
}, [e.type === "image" ? (
|
|
5640
|
+
}, [e.type === "image" ? (M(), x("img", {
|
|
5594
5641
|
key: 0,
|
|
5595
5642
|
src: e.src,
|
|
5596
5643
|
alt: e.filename,
|
|
5597
|
-
class:
|
|
5598
|
-
}, null, 10, Ea)) : (
|
|
5644
|
+
class: A(["size-14 rounded-xl object-cover border", J.value ? "border-black/10" : "border-white/20"])
|
|
5645
|
+
}, null, 10, Ea)) : (M(), x("div", {
|
|
5599
5646
|
key: 1,
|
|
5600
|
-
class:
|
|
5601
|
-
}, [
|
|
5647
|
+
class: A(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", J.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
5648
|
+
}, [i[24] || (i[24] = S("i", { class: "i-tabler-file size-4" }, null, -1)), S("span", Da, R(e.filename), 1)], 2)), S("button", {
|
|
5602
5649
|
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 duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] cursor-pointer",
|
|
5603
5650
|
onClick: (e) => removeAttachment(t)
|
|
5604
|
-
}, [...
|
|
5605
|
-
|
|
5651
|
+
}, [...i[25] || (i[25] = [S("i", { class: "i-tabler-x size-3" }, null, -1)])], 8, Oa)]))), 128)), je.value ? (M(), x("div", ka, [T(be, { class: "size-5" })])) : b("", !0)], 2)) : b("", !0),
|
|
5652
|
+
Pe.value ? (M(), x("input", {
|
|
5606
5653
|
key: 1,
|
|
5607
5654
|
ref_key: "fileInput",
|
|
5608
5655
|
ref: o,
|
|
@@ -5613,22 +5660,22 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5613
5660
|
}, null, 544)) : b("", !0),
|
|
5614
5661
|
S("div", {
|
|
5615
5662
|
"data-test": "messaging-composer",
|
|
5616
|
-
"data-composer-action":
|
|
5617
|
-
class:
|
|
5663
|
+
"data-composer-action": Ie.value,
|
|
5664
|
+
class: A(["w-full cursor-text rounded-2xl px-4 pb-2.5 pt-4 transition-colors duration-200", [e.centered ? "mx-auto max-w-[640px] @5xl/chat:max-w-[740px] @5xl/chat:px-5 @5xl/chat:pt-3.5 @5xl/chat:pb-3" : "", J.value ? "bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04),0_12px_32px_rgba(15,23,42,0.07)] ring-1 ring-theme-950/20 hover:ring-theme-950/30 focus-within:ring-theme-950/30" : "bg-white/10 backdrop-blur-xl ring-1 ring-white/15 hover:ring-white/25 focus-within:bg-white/15 focus-within:ring-white/25"]]),
|
|
5618
5665
|
onClick: focusComposer
|
|
5619
|
-
}, [
|
|
5666
|
+
}, [qe.value ? (M(), x("div", {
|
|
5620
5667
|
key: 1,
|
|
5621
5668
|
"data-test": "messaging-recording-state",
|
|
5622
|
-
class:
|
|
5669
|
+
class: A(["flex min-w-0 items-center gap-2 py-1", J.value ? "text-theme-700" : "text-white/80"])
|
|
5623
5670
|
}, [
|
|
5624
|
-
|
|
5625
|
-
S("span", Ma,
|
|
5626
|
-
S("span", { class:
|
|
5627
|
-
], 2)) :
|
|
5671
|
+
i[26] || (i[26] = S("span", { class: "size-2.5 shrink-0 rounded-full bg-red-500" }, null, -1)),
|
|
5672
|
+
S("span", Ma, R(Ye.value), 1),
|
|
5673
|
+
S("span", { class: A(["min-w-0 truncate text-sm", J.value ? "text-theme-400" : "text-white/45"]) }, R(Xe.value), 3)
|
|
5674
|
+
], 2)) : pe((M(), x("textarea", {
|
|
5628
5675
|
key: 0,
|
|
5629
5676
|
ref_key: "textarea",
|
|
5630
|
-
ref:
|
|
5631
|
-
"onUpdate:modelValue":
|
|
5677
|
+
ref: a,
|
|
5678
|
+
"onUpdate:modelValue": i[7] || (i[7] = (e) => ke.value = e),
|
|
5632
5679
|
"data-test": "messaging-input",
|
|
5633
5680
|
rows: "1",
|
|
5634
5681
|
enterkeyhint: "send",
|
|
@@ -5637,60 +5684,60 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5637
5684
|
autocapitalize: "sentences",
|
|
5638
5685
|
autocorrect: "on",
|
|
5639
5686
|
spellcheck: "true",
|
|
5640
|
-
placeholder:
|
|
5641
|
-
disabled:
|
|
5687
|
+
placeholder: Te.value,
|
|
5688
|
+
disabled: we.value,
|
|
5642
5689
|
style: {
|
|
5643
5690
|
fontSize: "16px",
|
|
5644
5691
|
resize: "none"
|
|
5645
5692
|
},
|
|
5646
|
-
class:
|
|
5693
|
+
class: A(["block w-full bg-transparent leading-snug focus:outline-none disabled:opacity-50 overflow-y-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", J.value ? "text-theme-900 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
5647
5694
|
onKeydown: handleKeydown
|
|
5648
|
-
}, null, 42, ja)), [[
|
|
5695
|
+
}, null, 42, ja)), [[ce, ke.value]]), S("div", Na, [
|
|
5649
5696
|
S("button", {
|
|
5650
|
-
class:
|
|
5651
|
-
|
|
5697
|
+
class: A(["-ml-2 flex size-8 items-center justify-center transition-opacity hover:opacity-70 pointer-coarse:size-11", [
|
|
5698
|
+
Pe.value ? "cursor-pointer" : "cursor-default",
|
|
5652
5699
|
J.value ? "text-theme-500" : "text-white/50",
|
|
5653
|
-
|
|
5700
|
+
je.value || Ne.value ? "opacity-50 pointer-events-none" : ""
|
|
5654
5701
|
]]),
|
|
5655
|
-
disabled:
|
|
5656
|
-
"aria-label":
|
|
5657
|
-
title:
|
|
5658
|
-
onClick:
|
|
5659
|
-
}, [
|
|
5660
|
-
|
|
5702
|
+
disabled: we.value || je.value || Ne.value || !Pe.value,
|
|
5703
|
+
"aria-label": Pe.value ? "Attach file" : "File attachments unavailable",
|
|
5704
|
+
title: Pe.value ? "Attach file" : "File attachments unavailable",
|
|
5705
|
+
onClick: i[8] || (i[8] = (e) => Pe.value && triggerFileInput())
|
|
5706
|
+
}, [je.value ? (M(), x("i", Fa)) : (M(), x("i", Ia)), S("span", La, R(Pe.value ? "Attach file" : "File attachments unavailable"), 1)], 10, Pa),
|
|
5707
|
+
i[30] || (i[30] = S("div", { class: "flex-1" }, null, -1)),
|
|
5661
5708
|
S("div", Ra, [
|
|
5662
|
-
|
|
5709
|
+
qe.value && !Je.value && !Qe.value ? (M(), x("button", {
|
|
5663
5710
|
key: 0,
|
|
5664
5711
|
"data-test": "messaging-record-discard-btn",
|
|
5665
|
-
class:
|
|
5712
|
+
class: A(["flex size-8 cursor-pointer items-center justify-center transition-opacity hover:opacity-70 pointer-coarse:size-11", J.value ? "text-theme-400" : "text-white/40"]),
|
|
5666
5713
|
"aria-label": "Discard recording",
|
|
5667
5714
|
title: "Discard recording",
|
|
5668
|
-
onClick:
|
|
5669
|
-
}, [...
|
|
5715
|
+
onClick: i[9] || (i[9] = (e) => finishRecording({ cancelled: !0 }))
|
|
5716
|
+
}, [...i[27] || (i[27] = [S("i", {
|
|
5670
5717
|
class: "i-tabler-x size-[18px]",
|
|
5671
5718
|
"aria-hidden": "true"
|
|
5672
5719
|
}, null, -1)])], 2)) : b("", !0),
|
|
5673
|
-
(
|
|
5720
|
+
(Ke.value || qe.value) && !Je.value && !Qe.value ? (M(), x("button", {
|
|
5674
5721
|
key: 1,
|
|
5675
5722
|
"data-test": "messaging-record-audio-btn",
|
|
5676
|
-
class:
|
|
5677
|
-
"aria-label":
|
|
5678
|
-
title:
|
|
5679
|
-
onPointerdown:
|
|
5680
|
-
onPointerup:
|
|
5681
|
-
onPointercancel:
|
|
5723
|
+
class: A(["flex size-8 cursor-pointer items-center justify-center transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] hover:opacity-70 pointer-coarse:size-11", qe.value ? J.value ? "text-theme-900 scale-110" : "text-white scale-110" : J.value ? "text-theme-500" : "text-white/60"]),
|
|
5724
|
+
"aria-label": Ze.value,
|
|
5725
|
+
title: Ze.value,
|
|
5726
|
+
onPointerdown: _e(onRecordPointerDown, ["prevent"]),
|
|
5727
|
+
onPointerup: _e(onRecordPointerUp, ["prevent"]),
|
|
5728
|
+
onPointercancel: _e(onRecordPointerCancel, ["prevent"]),
|
|
5682
5729
|
onClick: onRecordClick,
|
|
5683
|
-
onKeydown:
|
|
5684
|
-
}, [S("i", { class:
|
|
5685
|
-
|
|
5730
|
+
onKeydown: i[10] || (i[10] = he(_e((e) => finishRecording({ cancelled: !0 }), ["prevent"]), ["escape"]))
|
|
5731
|
+
}, [S("i", { class: A([qe.value ? "i-tabler-microphone-filled" : "i-tabler-microphone", "size-[18px]"]) }, null, 2), S("span", Ba, R(Ze.value), 1)], 42, za)) : b("", !0),
|
|
5732
|
+
at.value ? (M(), x("button", {
|
|
5686
5733
|
key: 2,
|
|
5687
5734
|
"data-test": "messaging-voice-start-btn",
|
|
5688
|
-
class:
|
|
5689
|
-
disabled:
|
|
5690
|
-
"aria-label":
|
|
5691
|
-
title:
|
|
5692
|
-
onClick:
|
|
5693
|
-
}, [S("span", Ha, [(
|
|
5735
|
+
class: A(["flex size-8 items-center justify-center rounded-full transition-colors duration-150 pointer-coarse:size-11", [J.value ? "bg-theme-900 text-theme-0 hover:bg-theme-800" : "bg-theme-0 text-theme-950 hover:bg-theme-100", K.value ? "cursor-not-allowed opacity-40" : "cursor-pointer"]]),
|
|
5736
|
+
disabled: K.value,
|
|
5737
|
+
"aria-label": q.value,
|
|
5738
|
+
title: q.value,
|
|
5739
|
+
onClick: i[11] || (i[11] = (e) => startVoiceConversation())
|
|
5740
|
+
}, [S("span", Ha, [(M(), x(m, null, F([
|
|
5694
5741
|
7,
|
|
5695
5742
|
13,
|
|
5696
5743
|
16,
|
|
@@ -5699,33 +5746,33 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5699
5746
|
], (e) => S("span", {
|
|
5700
5747
|
key: e,
|
|
5701
5748
|
class: "w-[2px] rounded-full bg-current",
|
|
5702
|
-
style:
|
|
5703
|
-
}, null, 4)), 64))]),
|
|
5749
|
+
style: j({ height: `${e}px` })
|
|
5750
|
+
}, null, 4)), 64))]), i[28] || (i[28] = S("span", { class: "sr-only" }, "Start voice conversation", -1))], 10, Va)) : qe.value ? b("", !0) : (M(), x(m, { key: 3 }, [Re.value ? (M(), x("button", {
|
|
5704
5751
|
key: 0,
|
|
5705
5752
|
"data-test": "messaging-secondary-stop-btn",
|
|
5706
|
-
class:
|
|
5753
|
+
class: A(["mr-2 flex size-8 cursor-pointer items-center justify-center rounded-full transition-colors duration-150 pointer-coarse:size-11", J.value ? "bg-theme-100 text-theme-700 hover:bg-theme-200" : "bg-white/10 text-white/70 hover:bg-white/15"]),
|
|
5707
5754
|
"aria-label": "Stop work",
|
|
5708
5755
|
title: "Stop work",
|
|
5709
|
-
onClick:
|
|
5710
|
-
}, [...
|
|
5756
|
+
onClick: i[12] || (i[12] = (t) => e.chatController?.stopChatTurn())
|
|
5757
|
+
}, [...i[29] || (i[29] = [S("i", {
|
|
5711
5758
|
class: "i-tabler-player-stop-filled size-3.5",
|
|
5712
5759
|
"aria-hidden": "true"
|
|
5713
5760
|
}, null, -1), S("span", { class: "sr-only" }, "Stop work", -1)])], 2)) : b("", !0), S("button", {
|
|
5714
5761
|
"data-test": "messaging-send-btn",
|
|
5715
|
-
"data-composer-action":
|
|
5716
|
-
class:
|
|
5717
|
-
disabled: !
|
|
5718
|
-
"aria-label":
|
|
5719
|
-
title:
|
|
5720
|
-
onClick:
|
|
5721
|
-
}, [
|
|
5762
|
+
"data-composer-action": Ie.value,
|
|
5763
|
+
class: A(["flex size-8 items-center justify-center rounded-full transition-colors duration-150 pointer-coarse:size-11", Le.value ? J.value ? "bg-theme-900 text-theme-0 hover:bg-theme-800 cursor-pointer" : "bg-theme-0 text-theme-950 hover:bg-theme-100 cursor-pointer" : J.value ? "bg-theme-100 text-theme-400" : "bg-white/10 text-white/30"]),
|
|
5764
|
+
disabled: !Le.value,
|
|
5765
|
+
"aria-label": We.value,
|
|
5766
|
+
title: We.value,
|
|
5767
|
+
onClick: i[13] || (i[13] = (e) => handleComposerAction())
|
|
5768
|
+
}, [Ie.value === "stop" ? (M(), x("i", Wa)) : (M(), x("i", Ga)), S("span", Ka, R(We.value), 1)], 10, Ua)], 64))
|
|
5722
5769
|
])
|
|
5723
5770
|
])], 10, Aa),
|
|
5724
|
-
e.centered && B.value.length > 0 ? (
|
|
5771
|
+
e.centered && B.value.length > 0 ? (M(), x("p", qa, R(e.bot.displayName.value) + " is AI and can make mistakes. ", 1)) : b("", !0)
|
|
5725
5772
|
], 64))], !0)], 10, wa)
|
|
5726
5773
|
], 2));
|
|
5727
5774
|
}
|
|
5728
|
-
}), [["__scopeId", "data-v-
|
|
5775
|
+
}), [["__scopeId", "data-v-05d471e7"]]), Ya = { class: "bot-wrap" }, Xa = {
|
|
5729
5776
|
key: 0,
|
|
5730
5777
|
class: "flex items-center justify-center h-full"
|
|
5731
5778
|
}, Za = {
|
|
@@ -5733,12 +5780,12 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5733
5780
|
class: "flex h-full flex-col items-center justify-center gap-4 px-6 text-center",
|
|
5734
5781
|
role: "status",
|
|
5735
5782
|
"aria-live": "polite",
|
|
5736
|
-
"data-test": "
|
|
5783
|
+
"data-test": "bot-unavailable"
|
|
5737
5784
|
}, Qa = /* @__PURE__ */ k({
|
|
5738
|
-
__name: "
|
|
5785
|
+
__name: "BotWrap",
|
|
5739
5786
|
props: {
|
|
5740
5787
|
sdk: {},
|
|
5741
|
-
|
|
5788
|
+
bot: {},
|
|
5742
5789
|
handle: {},
|
|
5743
5790
|
context: {},
|
|
5744
5791
|
clientContext: {},
|
|
@@ -5751,102 +5798,102 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5751
5798
|
apiBase: {}
|
|
5752
5799
|
},
|
|
5753
5800
|
setup(e) {
|
|
5754
|
-
let t =
|
|
5801
|
+
let t = o("BotWrap"), r = e, i = r.sdk || n.getInstance({
|
|
5755
5802
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
5756
|
-
...
|
|
5757
|
-
}),
|
|
5758
|
-
async function
|
|
5759
|
-
if (
|
|
5760
|
-
t.debug("
|
|
5761
|
-
|
|
5762
|
-
handle:
|
|
5763
|
-
}),
|
|
5803
|
+
...r.apiBase && { apiBase: r.apiBase }
|
|
5804
|
+
}), a = I(!r.bot), s = I(r.bot), c = I();
|
|
5805
|
+
async function loadBot() {
|
|
5806
|
+
if (r.bot) {
|
|
5807
|
+
t.debug("Bot provided via props, skipping fetch", {
|
|
5808
|
+
botId: r.bot.botId.value,
|
|
5809
|
+
handle: r.bot.handle.value
|
|
5810
|
+
}), a.value = !1;
|
|
5764
5811
|
return;
|
|
5765
5812
|
}
|
|
5766
|
-
if (!
|
|
5767
|
-
|
|
5813
|
+
if (!r.handle) {
|
|
5814
|
+
c.value = "No handle or bot provided", t.warn("BotWrap mounted without handle or bot", {
|
|
5768
5815
|
propsReceived: {
|
|
5769
|
-
handle:
|
|
5770
|
-
|
|
5771
|
-
context:
|
|
5772
|
-
apiBase:
|
|
5816
|
+
handle: r.handle,
|
|
5817
|
+
bot: r.bot,
|
|
5818
|
+
context: r.clientContext ?? r.context,
|
|
5819
|
+
apiBase: r.apiBase
|
|
5773
5820
|
},
|
|
5774
5821
|
sdkState: {
|
|
5775
|
-
isDev:
|
|
5776
|
-
apiBase:
|
|
5822
|
+
isDev: i.isDev,
|
|
5823
|
+
apiBase: i.apiBase
|
|
5777
5824
|
}
|
|
5778
|
-
}),
|
|
5825
|
+
}), a.value = !1;
|
|
5779
5826
|
return;
|
|
5780
5827
|
}
|
|
5781
5828
|
try {
|
|
5782
|
-
|
|
5783
|
-
let e = await
|
|
5784
|
-
e ? (
|
|
5785
|
-
|
|
5786
|
-
handle: e.handle
|
|
5787
|
-
}), e.
|
|
5829
|
+
a.value = !0, c.value = void 0, t.debug("Fetching public bot", { handle: r.handle });
|
|
5830
|
+
let e = await i.user.getPublicBot({ handle: r.handle });
|
|
5831
|
+
e ? (s.value = e, t.debug("Successfully fetched public bot", {
|
|
5832
|
+
botId: e.botId.value,
|
|
5833
|
+
handle: e.handle.value
|
|
5834
|
+
}), e.botId.value && i.user.track({
|
|
5788
5835
|
event: "view_profile",
|
|
5789
|
-
|
|
5836
|
+
botId: e.botId.value,
|
|
5790
5837
|
properties: { viewSource: "widget" }
|
|
5791
|
-
})) : (
|
|
5792
|
-
handle:
|
|
5793
|
-
sdkError:
|
|
5838
|
+
})) : (c.value = i.error.value || "Bot not found", t.error("Failed to fetch public bot - no data returned", {
|
|
5839
|
+
handle: r.handle,
|
|
5840
|
+
sdkError: i.error.value,
|
|
5794
5841
|
sdkState: {
|
|
5795
|
-
isDev:
|
|
5796
|
-
apiBase:
|
|
5797
|
-
loading:
|
|
5842
|
+
isDev: i.isDev,
|
|
5843
|
+
apiBase: i.apiBase,
|
|
5844
|
+
loading: i.loading.value
|
|
5798
5845
|
}
|
|
5799
5846
|
}));
|
|
5800
5847
|
} catch (e) {
|
|
5801
|
-
|
|
5802
|
-
handle:
|
|
5848
|
+
c.value = e instanceof Error ? e.message : "Failed to fetch bot", t.error("Exception while fetching public bot", {
|
|
5849
|
+
handle: r.handle,
|
|
5803
5850
|
error: e instanceof Error ? {
|
|
5804
5851
|
message: e.message,
|
|
5805
5852
|
stack: e.stack
|
|
5806
5853
|
} : e,
|
|
5807
5854
|
sdkState: {
|
|
5808
|
-
isDev:
|
|
5809
|
-
apiBase:
|
|
5810
|
-
error:
|
|
5855
|
+
isDev: i.isDev,
|
|
5856
|
+
apiBase: i.apiBase,
|
|
5857
|
+
error: i.error.value
|
|
5811
5858
|
}
|
|
5812
5859
|
});
|
|
5813
5860
|
} finally {
|
|
5814
|
-
|
|
5861
|
+
a.value = !1, s.value || t.debug("BotWrap component will render unavailable state", {
|
|
5815
5862
|
state: {
|
|
5816
|
-
loading:
|
|
5817
|
-
|
|
5818
|
-
error:
|
|
5863
|
+
loading: a.value,
|
|
5864
|
+
hasBot: !!s.value,
|
|
5865
|
+
error: c.value
|
|
5819
5866
|
},
|
|
5820
5867
|
props: {
|
|
5821
|
-
handle:
|
|
5822
|
-
context:
|
|
5823
|
-
apiBase:
|
|
5868
|
+
handle: r.handle,
|
|
5869
|
+
context: r.clientContext ?? r.context,
|
|
5870
|
+
apiBase: r.apiBase
|
|
5824
5871
|
},
|
|
5825
5872
|
sdkState: {
|
|
5826
|
-
isDev:
|
|
5827
|
-
apiBase:
|
|
5828
|
-
error:
|
|
5873
|
+
isDev: i.isDev,
|
|
5874
|
+
apiBase: i.apiBase,
|
|
5875
|
+
error: i.error.value
|
|
5829
5876
|
}
|
|
5830
5877
|
});
|
|
5831
5878
|
}
|
|
5832
5879
|
}
|
|
5833
|
-
return
|
|
5834
|
-
sdk:
|
|
5835
|
-
|
|
5880
|
+
return re(loadBot), (t, n) => (M(), x("div", Ya, [a.value ? (M(), x("div", Xa, [S("div", { class: A(["size-6 animate-spin rounded-full border-b-2", r.bare ? "border-theme-400" : "border-white"]) }, null, 2)])) : s.value ? ae(t.$slots, "default", {
|
|
5881
|
+
sdk: B(i),
|
|
5882
|
+
bot: s.value,
|
|
5836
5883
|
context: e.clientContext ?? e.context,
|
|
5837
5884
|
firstMessage: e.firstMessage,
|
|
5838
5885
|
buttonText: e.buttonText,
|
|
5839
5886
|
buttonIcon: e.buttonIcon,
|
|
5840
|
-
loading:
|
|
5841
|
-
}, void 0, void 0, 1) :
|
|
5887
|
+
loading: a.value
|
|
5888
|
+
}, void 0, void 0, 1) : c.value ? (M(), x("div", Za, [n[0] || (n[0] = S("p", { class: "text-sm font-medium text-theme-600" }, " This assistant is unavailable right now. ", -1)), S("button", {
|
|
5842
5889
|
type: "button",
|
|
5843
5890
|
class: "min-h-11 rounded-full bg-theme-900 px-5 text-sm font-semibold text-theme-0 transition-colors hover:bg-theme-700",
|
|
5844
|
-
"data-test": "
|
|
5845
|
-
onClick:
|
|
5891
|
+
"data-test": "bot-unavailable-retry",
|
|
5892
|
+
onClick: loadBot
|
|
5846
5893
|
}, " Try again ")])) : b("", !0)]));
|
|
5847
5894
|
}
|
|
5848
5895
|
});
|
|
5849
5896
|
//#endregion
|
|
5850
|
-
export { Be as a, Ae as c, parseButtonTemplate as d,
|
|
5897
|
+
export { Be as a, Ae as c, parseButtonTemplate as d, BotChatController as f, di as i, getBotAvatarUrl as l, ve as m, Ja as n, Pe as o, be as p, Hi as r, Me as s, Qa as t, handleImageError as u };
|
|
5851
5898
|
|
|
5852
|
-
//# sourceMappingURL=
|
|
5899
|
+
//# sourceMappingURL=BotWrap.js.map
|