@pagelines/sdk 1.0.878 → 1.0.880
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} +1174 -1145
- package/dist/BotWrap.js.map +1 -0
- package/dist/{agent/AgentController.d.ts → bot/BotController.d.ts} +35 -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 +4 -4
- package/dist/{agent → bot}/voice/voice-session-client.d.ts +1 -1
- package/dist/{agent → bot}/work-journal.d.ts +1 -1
- package/dist/{agent.js → bot.js} +83 -80
- 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 +14 -14
- 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,7 @@ 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) => {
|
|
769
749
|
if (s !== this.turnEpoch || !o) return;
|
|
770
750
|
let t = this.sharedMessages.value;
|
|
771
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)) {
|
|
@@ -783,10 +763,10 @@ Current User:
|
|
|
783
763
|
}));
|
|
784
764
|
}, onDelta = (e, t = "assistant") => {
|
|
785
765
|
if (!isCurrentTurn()) return;
|
|
786
|
-
claimLiveTurn(), this.updateState(this.textState, { workingDescription: void 0 }), t === "assistant" && (this.lastVisibleProgressAtMs.value = Date.now()), p || (p = !0, this.liveStreamMessageId.value =
|
|
787
|
-
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,
|
|
788
768
|
text: "",
|
|
789
|
-
sender: t === "system" ? "system" : "
|
|
769
|
+
sender: t === "system" ? "system" : "bot",
|
|
790
770
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
791
771
|
}]);
|
|
792
772
|
let n = this.liveSegments.value, r = n[n.length - 1];
|
|
@@ -798,11 +778,11 @@ Current User:
|
|
|
798
778
|
content: e
|
|
799
779
|
}];
|
|
800
780
|
let i = this.sharedMessages.value, a = i[i.length - 1];
|
|
801
|
-
a?.id ===
|
|
781
|
+
a?.id === f && (a.text += e, this.sharedMessages.value = [...i]);
|
|
802
782
|
}, onMessage = (e) => {
|
|
803
783
|
if (!isCurrentTurn()) return;
|
|
804
|
-
if (claimLiveTurn(), m = !0, e.sender === "
|
|
805
|
-
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);
|
|
806
786
|
return;
|
|
807
787
|
}
|
|
808
788
|
p = !0;
|
|
@@ -817,12 +797,12 @@ Current User:
|
|
|
817
797
|
toolActivities: [],
|
|
818
798
|
turnOutcome: void 0
|
|
819
799
|
});
|
|
820
|
-
let i = this.sharedMessages.value.filter((e) => e.id !==
|
|
800
|
+
let i = this.sharedMessages.value.filter((e) => e.id !== f), a = i.findIndex((e) => e.id === r.id);
|
|
821
801
|
a >= 0 ? this.sharedMessages.value = [
|
|
822
802
|
...i.slice(0, a),
|
|
823
803
|
r,
|
|
824
804
|
...i.slice(a + 1)
|
|
825
|
-
] : 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: "
|
|
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" });
|
|
826
806
|
}, onDone = (e) => {
|
|
827
807
|
if (!isCurrentTurn()) return;
|
|
828
808
|
if (!p && !m) {
|
|
@@ -831,7 +811,7 @@ Current User:
|
|
|
831
811
|
}
|
|
832
812
|
this.finishToolActivities("completed");
|
|
833
813
|
let t = this.sharedMessages.value, n = t[t.length - 1];
|
|
834
|
-
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, {
|
|
835
815
|
isThinking: !1,
|
|
836
816
|
workingDescription: void 0,
|
|
837
817
|
transientIssue: void 0
|
|
@@ -851,7 +831,7 @@ Current User:
|
|
|
851
831
|
turnOutcome: "failed"
|
|
852
832
|
}), this.finishToolActivities("failed");
|
|
853
833
|
let r = this.sharedMessages.value, i = r[r.length - 1];
|
|
854
|
-
if (i?.id ===
|
|
834
|
+
if (i?.id === f && !i.text && (this.sharedMessages.value = r.slice(0, -1)), typeof n == "object" && n.code && n.error) {
|
|
855
835
|
let e = presentChatStreamError(n);
|
|
856
836
|
e.surface === "transient" ? this.updateState(this.textState, {
|
|
857
837
|
isThinking: !1,
|
|
@@ -904,7 +884,7 @@ Current User:
|
|
|
904
884
|
onToolActivity,
|
|
905
885
|
onWorkingEnd
|
|
906
886
|
}) : r.chat.chatStreamPublic({
|
|
907
|
-
handle: this.
|
|
887
|
+
handle: this._bot.handle.value,
|
|
908
888
|
message: e,
|
|
909
889
|
attachments: t,
|
|
910
890
|
anonymousId: r.user.generateAnonId(),
|
|
@@ -942,7 +922,7 @@ Current User:
|
|
|
942
922
|
}
|
|
943
923
|
}
|
|
944
924
|
buildHistory() {
|
|
945
|
-
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) => ({
|
|
946
926
|
role: e.sender === "user" ? "user" : "assistant",
|
|
947
927
|
content: e.text,
|
|
948
928
|
...e.attachments?.length ? { attachments: e.attachments } : {}
|
|
@@ -950,7 +930,7 @@ Current User:
|
|
|
950
930
|
}
|
|
951
931
|
loadMessages(e) {
|
|
952
932
|
this.conversationId = e.conversationId;
|
|
953
|
-
let t = this.sharedMessages.value, n = e.messages.filter((e) => e.sender !== "
|
|
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;
|
|
954
934
|
if (this.sharedMessages.value = [
|
|
955
935
|
...i.filter(isBeforePage),
|
|
956
936
|
...n,
|
|
@@ -983,28 +963,28 @@ function voiceBrowserSupported() {
|
|
|
983
963
|
return typeof navigator < "u" && !!navigator.mediaDevices?.getUserMedia && typeof RTCPeerConnection < "u";
|
|
984
964
|
}
|
|
985
965
|
//#endregion
|
|
986
|
-
//#region
|
|
966
|
+
//#region bot/utils.ts
|
|
987
967
|
function getImageSrc(e) {
|
|
988
968
|
return e ? typeof e == "string" ? e : e.src || "" : "";
|
|
989
969
|
}
|
|
990
|
-
function
|
|
991
|
-
return getImageSrc(e.cover) || getImageSrc(e.avatar) ||
|
|
970
|
+
function getBotAvatarUrl(e) {
|
|
971
|
+
return getImageSrc(e.cover) || getImageSrc(e.avatar) || c(e.name);
|
|
992
972
|
}
|
|
993
973
|
function handleImageError(e) {
|
|
994
974
|
let t = e.target;
|
|
995
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
975
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = c());
|
|
996
976
|
}
|
|
997
977
|
function parseButtonTemplate(e) {
|
|
998
|
-
let { template: t,
|
|
999
|
-
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 || "");
|
|
1000
980
|
}
|
|
1001
981
|
//#endregion
|
|
1002
|
-
//#region
|
|
982
|
+
//#region bot/ui/ElBotButton.vue?vue&type=script&setup=true&lang.ts
|
|
1003
983
|
var ke = {
|
|
1004
984
|
key: 0,
|
|
1005
985
|
class: "absolute inset-0 flex items-center justify-center"
|
|
1006
986
|
}, Ae = /* @__PURE__ */ k({
|
|
1007
|
-
__name: "
|
|
987
|
+
__name: "ElBotButton",
|
|
1008
988
|
props: {
|
|
1009
989
|
theme: { default: "primary" },
|
|
1010
990
|
size: { default: "lg" },
|
|
@@ -1016,40 +996,40 @@ var ke = {
|
|
|
1016
996
|
iconAfter: {}
|
|
1017
997
|
},
|
|
1018
998
|
setup(e) {
|
|
1019
|
-
let t =
|
|
999
|
+
let t = _(() => ({
|
|
1020
1000
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
1021
1001
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
1022
1002
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
1023
1003
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20",
|
|
1024
1004
|
dark: "bg-theme-900 border-transparent hover:bg-theme-800"
|
|
1025
|
-
})[e.theme]), n =
|
|
1005
|
+
})[e.theme]), n = _(() => ({
|
|
1026
1006
|
sm: "px-4 py-2 text-sm",
|
|
1027
1007
|
md: "px-6 py-3 text-base",
|
|
1028
1008
|
lg: "px-8 py-4 text-base"
|
|
1029
|
-
})[e.size]), r =
|
|
1009
|
+
})[e.size]), r = _(() => ({
|
|
1030
1010
|
sm: "size-4",
|
|
1031
1011
|
md: "size-4",
|
|
1032
1012
|
lg: "size-5"
|
|
1033
1013
|
})[e.size]);
|
|
1034
|
-
return (i, a) => (
|
|
1035
|
-
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", {
|
|
1036
1016
|
key: 0,
|
|
1037
|
-
class:
|
|
1017
|
+
class: A([e.icon, r.value])
|
|
1038
1018
|
}, null, 2)) : b("", !0),
|
|
1039
|
-
|
|
1040
|
-
e.iconAfter ? (
|
|
1019
|
+
ae(i.$slots, "default"),
|
|
1020
|
+
e.iconAfter ? (M(), x("i", {
|
|
1041
1021
|
key: 1,
|
|
1042
|
-
class:
|
|
1022
|
+
class: A([e.iconAfter, r.value])
|
|
1043
1023
|
}, null, 2)) : b("", !0)
|
|
1044
1024
|
], 2)], 2));
|
|
1045
1025
|
}
|
|
1046
1026
|
}), je = ["value"], Me = /* @__PURE__ */ k({
|
|
1047
|
-
__name: "
|
|
1027
|
+
__name: "BotInputEmail",
|
|
1048
1028
|
props: { modelValue: { default: "" } },
|
|
1049
1029
|
emits: ["update:modelValue"],
|
|
1050
1030
|
setup(e, { emit: t }) {
|
|
1051
1031
|
let n = t;
|
|
1052
|
-
return (t, r) => (
|
|
1032
|
+
return (t, r) => (M(), x("input", {
|
|
1053
1033
|
name: "username",
|
|
1054
1034
|
type: "email",
|
|
1055
1035
|
inputmode: "email",
|
|
@@ -1065,7 +1045,7 @@ var ke = {
|
|
|
1065
1045
|
}, null, 40, je));
|
|
1066
1046
|
}
|
|
1067
1047
|
}), Ne = ["placeholder", "value"], Pe = /* @__PURE__ */ k({
|
|
1068
|
-
__name: "
|
|
1048
|
+
__name: "BotInputOneTimeCode",
|
|
1069
1049
|
props: {
|
|
1070
1050
|
modelValue: {},
|
|
1071
1051
|
length: {},
|
|
@@ -1073,15 +1053,15 @@ var ke = {
|
|
|
1073
1053
|
},
|
|
1074
1054
|
emits: ["update:modelValue", "autoSubmit"],
|
|
1075
1055
|
setup(e, { emit: t }) {
|
|
1076
|
-
let n = e, r = t, i =
|
|
1077
|
-
|
|
1056
|
+
let n = e, r = t, i = P(null), a = _(() => "0".repeat(n.length));
|
|
1057
|
+
re(() => {
|
|
1078
1058
|
n.focusFirst && !("ontouchstart" in window) && i.value?.focus();
|
|
1079
1059
|
});
|
|
1080
1060
|
function onInput(e) {
|
|
1081
1061
|
let t = e.target.value.replace(/\D/g, "").slice(0, n.length);
|
|
1082
1062
|
r("update:modelValue", t), t.length === n.length && r("autoSubmit", t);
|
|
1083
1063
|
}
|
|
1084
|
-
return (t, n) => (
|
|
1064
|
+
return (t, n) => (M(), x("input", {
|
|
1085
1065
|
ref_key: "input",
|
|
1086
1066
|
ref: i,
|
|
1087
1067
|
name: "one-time-code",
|
|
@@ -1105,7 +1085,7 @@ var ke = {
|
|
|
1105
1085
|
}, ze = { class: "min-w-0" }, Be = /* @__PURE__ */ k({
|
|
1106
1086
|
__name: "ElModeHeader",
|
|
1107
1087
|
props: {
|
|
1108
|
-
|
|
1088
|
+
bot: {},
|
|
1109
1089
|
size: { default: "md" },
|
|
1110
1090
|
isOnline: {
|
|
1111
1091
|
type: Boolean,
|
|
@@ -1114,20 +1094,20 @@ var ke = {
|
|
|
1114
1094
|
layout: { default: "centered" }
|
|
1115
1095
|
},
|
|
1116
1096
|
setup(e) {
|
|
1117
|
-
return (t, n) => (
|
|
1118
|
-
src: e.
|
|
1119
|
-
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,
|
|
1120
1100
|
class: "w-full h-full object-cover",
|
|
1121
|
-
onError: n[0] || (n[0] = (...e) =>
|
|
1122
|
-
}, 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", {
|
|
1123
1103
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
1124
1104
|
style: { "animation-duration": "3s" }
|
|
1125
|
-
}, 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));
|
|
1126
1106
|
}
|
|
1127
1107
|
}), Ve = { class: "relative shrink-0 rounded-full" }, He = ["src", "alt"], Ue = ["src", "alt"], We = ["aria-label"], Ge = /* @__PURE__ */ k({
|
|
1128
|
-
__name: "
|
|
1108
|
+
__name: "BotAvatar",
|
|
1129
1109
|
props: {
|
|
1130
|
-
|
|
1110
|
+
bot: {},
|
|
1131
1111
|
showStatus: {
|
|
1132
1112
|
type: Boolean,
|
|
1133
1113
|
default: !0
|
|
@@ -1147,38 +1127,38 @@ var ke = {
|
|
|
1147
1127
|
amber: "bg-amber-500",
|
|
1148
1128
|
red: "bg-red-500",
|
|
1149
1129
|
grey: "bg-theme-300"
|
|
1150
|
-
}, n =
|
|
1151
|
-
let n = e.
|
|
1130
|
+
}, n = _(() => {
|
|
1131
|
+
let n = e.bot.state.value;
|
|
1152
1132
|
return e.showStatus && n.lifecycle !== "unknown" ? t[n.color] : null;
|
|
1153
1133
|
}), r = {
|
|
1154
1134
|
width: "clamp(7px, 14%, 14px)",
|
|
1155
1135
|
height: "clamp(7px, 14%, 14px)",
|
|
1156
1136
|
top: "calc(14.6% - clamp(3.5px, 7%, 7px))",
|
|
1157
1137
|
right: "calc(14.6% - clamp(3.5px, 7%, 7px))"
|
|
1158
|
-
}, i =
|
|
1159
|
-
return (t, a) => (
|
|
1138
|
+
}, i = _(() => e.isLight ? "ring-white" : "ring-theme-900");
|
|
1139
|
+
return (t, a) => (M(), x("div", Ve, [
|
|
1160
1140
|
S("img", {
|
|
1161
|
-
src: e.
|
|
1162
|
-
alt: e.
|
|
1163
|
-
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"])
|
|
1164
1144
|
}, null, 10, He),
|
|
1165
|
-
e.showOwnerMark && e.
|
|
1145
|
+
e.showOwnerMark && e.bot.ownerMarkUrl.value ? (M(), x("img", {
|
|
1166
1146
|
key: 0,
|
|
1167
|
-
src: e.
|
|
1168
|
-
alt: e.
|
|
1169
|
-
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])
|
|
1170
1150
|
}, null, 10, Ue)) : b("", !0),
|
|
1171
|
-
n.value ? (
|
|
1151
|
+
n.value ? (M(), x("span", {
|
|
1172
1152
|
key: 1,
|
|
1173
1153
|
role: "status",
|
|
1174
|
-
"aria-label": e.
|
|
1175
|
-
class:
|
|
1154
|
+
"aria-label": e.bot.state.value.tooltip,
|
|
1155
|
+
class: A(["absolute z-10 rounded-full ring-2", [n.value, i.value]]),
|
|
1176
1156
|
style: r
|
|
1177
1157
|
}, null, 10, We)) : b("", !0),
|
|
1178
|
-
n.value && e.
|
|
1158
|
+
n.value && e.bot.state.value.lifecycle === "running" ? (M(), x("span", {
|
|
1179
1159
|
key: 2,
|
|
1180
1160
|
"aria-hidden": "true",
|
|
1181
|
-
class:
|
|
1161
|
+
class: A(["pointer-events-none absolute rounded-full animate-ping opacity-50 [animation-duration:3s]", n.value]),
|
|
1182
1162
|
style: r
|
|
1183
1163
|
}, null, 2)) : b("", !0)
|
|
1184
1164
|
]));
|
|
@@ -1198,24 +1178,24 @@ var ke = {
|
|
|
1198
1178
|
key: 0,
|
|
1199
1179
|
class: "sr-only"
|
|
1200
1180
|
}, et = /* @__PURE__ */ k({
|
|
1201
|
-
__name: "
|
|
1181
|
+
__name: "BotToolActivityGroup",
|
|
1202
1182
|
props: {
|
|
1203
1183
|
model: {},
|
|
1204
1184
|
isLight: { type: Boolean }
|
|
1205
1185
|
},
|
|
1206
1186
|
setup(e) {
|
|
1207
|
-
let t = e, n =
|
|
1187
|
+
let t = e, n = I(!1);
|
|
1208
1188
|
function toggle() {
|
|
1209
1189
|
n.value = !n.value;
|
|
1210
1190
|
}
|
|
1211
|
-
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 = _(() => {
|
|
1212
1192
|
let e = t.model;
|
|
1213
1193
|
return r.value ? n.value ? e.hiddenRows : [] : [
|
|
1214
1194
|
...n.value ? e.hiddenRows : [],
|
|
1215
1195
|
...e.visibleRows,
|
|
1216
1196
|
...e.terminal ? [e.terminal] : []
|
|
1217
1197
|
];
|
|
1218
|
-
}), s =
|
|
1198
|
+
}), s = _(() => t.isLight ? {
|
|
1219
1199
|
spine: "bg-theme-200",
|
|
1220
1200
|
dashed: "border-theme-300",
|
|
1221
1201
|
doneMark: "text-theme-400",
|
|
@@ -1233,7 +1213,7 @@ var ke = {
|
|
|
1233
1213
|
stoppedSquare: "bg-white/55",
|
|
1234
1214
|
muted: "text-white/55",
|
|
1235
1215
|
ring: "focus-visible:ring-white"
|
|
1236
|
-
}), c =
|
|
1216
|
+
}), c = _(() => {
|
|
1237
1217
|
let e = t.isLight;
|
|
1238
1218
|
return {
|
|
1239
1219
|
done: {
|
|
@@ -1276,16 +1256,16 @@ var ke = {
|
|
|
1276
1256
|
}
|
|
1277
1257
|
};
|
|
1278
1258
|
});
|
|
1279
|
-
return (t, u) => (
|
|
1280
|
-
a.value ? (
|
|
1281
|
-
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", {
|
|
1282
1262
|
key: 1,
|
|
1283
1263
|
type: "button",
|
|
1284
1264
|
"data-test": "messaging-tool-activity-summary",
|
|
1285
1265
|
"data-journal-disclosure": "",
|
|
1286
1266
|
"aria-expanded": n.value,
|
|
1287
1267
|
disabled: i.value === 0,
|
|
1288
|
-
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]),
|
|
1289
1269
|
onClick: toggle
|
|
1290
1270
|
}, [
|
|
1291
1271
|
u[0] || (u[0] = S("i", {
|
|
@@ -1293,47 +1273,47 @@ var ke = {
|
|
|
1293
1273
|
class: "i-tabler-circle-check size-3.5 shrink-0 text-green-600",
|
|
1294
1274
|
"aria-hidden": "true"
|
|
1295
1275
|
}, null, -1)),
|
|
1296
|
-
S("span", { class:
|
|
1297
|
-
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", {
|
|
1298
1278
|
key: 0,
|
|
1299
|
-
class:
|
|
1279
|
+
class: A(["size-[13px] shrink-0", [n.value ? "i-tabler-chevron-down" : "i-tabler-chevron-right", s.value.muted]]),
|
|
1300
1280
|
"aria-hidden": "true"
|
|
1301
1281
|
}, null, 2)) : b("", !0)
|
|
1302
|
-
], 10, qe)) : i.value ? (
|
|
1282
|
+
], 10, qe)) : i.value ? (M(), x("button", {
|
|
1303
1283
|
key: 2,
|
|
1304
1284
|
type: "button",
|
|
1305
1285
|
"data-test": "messaging-tool-activity-summary",
|
|
1306
1286
|
"data-journal-disclosure": "",
|
|
1307
1287
|
"aria-expanded": n.value,
|
|
1308
|
-
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]),
|
|
1309
1289
|
onClick: toggle
|
|
1310
1290
|
}, [S("span", Ye, [S("span", {
|
|
1311
1291
|
"data-journal-spine": "dashed",
|
|
1312
|
-
class:
|
|
1313
|
-
}, null, 2)]), S("span", { class:
|
|
1314
|
-
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"]),
|
|
1315
1295
|
"aria-hidden": "true"
|
|
1316
1296
|
}, null, 2)], 2)], 10, Je)) : b("", !0),
|
|
1317
|
-
(
|
|
1297
|
+
(M(!0), x(m, null, F(o.value, (e, t) => (M(), x("div", {
|
|
1318
1298
|
key: e.id,
|
|
1319
1299
|
"data-test": "messaging-tool-activity-row",
|
|
1320
1300
|
"data-journal-row": e.tone,
|
|
1321
|
-
class:
|
|
1322
|
-
}, [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), {
|
|
1323
1303
|
"data-journal-station": e.tone,
|
|
1324
|
-
class:
|
|
1325
|
-
}, 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", {
|
|
1326
1306
|
key: 0,
|
|
1327
|
-
class:
|
|
1328
|
-
}, 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", {
|
|
1329
1309
|
key: 0,
|
|
1330
|
-
class:
|
|
1331
|
-
},
|
|
1332
|
-
!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", {
|
|
1333
1313
|
key: 3,
|
|
1334
1314
|
"data-test": "messaging-tool-activity-hint",
|
|
1335
|
-
class:
|
|
1336
|
-
},
|
|
1315
|
+
class: A(["pl-[30px] pt-2.5 text-[12px] leading-snug", s.value.muted])
|
|
1316
|
+
}, R(e.model.hint), 3)) : b("", !0)
|
|
1337
1317
|
], 2));
|
|
1338
1318
|
}
|
|
1339
1319
|
});
|
|
@@ -1378,10 +1358,10 @@ function _unsupportedIterableToArray(e, t) {
|
|
|
1378
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;
|
|
1379
1359
|
}
|
|
1380
1360
|
}
|
|
1381
|
-
var tt = Object.entries, nt = Object.setPrototypeOf,
|
|
1382
|
-
|
|
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) {
|
|
1383
1363
|
return e;
|
|
1384
|
-
}),
|
|
1364
|
+
}), q || (q = function seal(e) {
|
|
1385
1365
|
return e;
|
|
1386
1366
|
}), ct || (ct = function apply(e, t) {
|
|
1387
1367
|
var n = [...arguments].slice(2);
|
|
@@ -1389,7 +1369,7 @@ X || (X = function freeze(e) {
|
|
|
1389
1369
|
}), lt || (lt = function construct(e) {
|
|
1390
1370
|
return new e(...[...arguments].slice(1));
|
|
1391
1371
|
});
|
|
1392
|
-
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);
|
|
1393
1373
|
function unapply(e) {
|
|
1394
1374
|
return function(t) {
|
|
1395
1375
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
@@ -1410,22 +1390,22 @@ function addToSet(e, t) {
|
|
|
1410
1390
|
let i = t[r];
|
|
1411
1391
|
if (typeof i == "string") {
|
|
1412
1392
|
let e = n(i);
|
|
1413
|
-
e !== i && (
|
|
1393
|
+
e !== i && (rt(t) || (t[r] = e), i = e);
|
|
1414
1394
|
}
|
|
1415
1395
|
e[i] = !0;
|
|
1416
1396
|
}
|
|
1417
1397
|
return e;
|
|
1418
1398
|
}
|
|
1419
1399
|
function cleanArray(e) {
|
|
1420
|
-
for (let t = 0; t < e.length; t++)
|
|
1400
|
+
for (let t = 0; t < e.length; t++) Z(e, t) || (e[t] = null);
|
|
1421
1401
|
return e;
|
|
1422
1402
|
}
|
|
1423
1403
|
function clone(e) {
|
|
1424
|
-
let t =
|
|
1404
|
+
let t = J(null);
|
|
1425
1405
|
for (let r of tt(e)) {
|
|
1426
1406
|
var n = _slicedToArray(r, 2);
|
|
1427
1407
|
let i = n[0], a = n[1];
|
|
1428
|
-
|
|
1408
|
+
Z(e, i) && (ht(a) ? t[i] = cleanArray(a) : a && typeof a == "object" && a.constructor === Object ? t[i] = clone(a) : t[i] = a);
|
|
1429
1409
|
}
|
|
1430
1410
|
return t;
|
|
1431
1411
|
}
|
|
@@ -1433,31 +1413,31 @@ function stringifyValue(e) {
|
|
|
1433
1413
|
switch (typeof e) {
|
|
1434
1414
|
case "string": return e;
|
|
1435
1415
|
case "number": return St(e);
|
|
1436
|
-
case "boolean": return
|
|
1437
|
-
case "bigint": return
|
|
1438
|
-
case "symbol": return
|
|
1439
|
-
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);
|
|
1440
1420
|
case "function":
|
|
1441
1421
|
case "object": {
|
|
1442
|
-
if (e === null) return
|
|
1422
|
+
if (e === null) return Tt(e);
|
|
1443
1423
|
let t = e, n = lookupGetter(t, "toString");
|
|
1444
1424
|
if (typeof n == "function") {
|
|
1445
1425
|
let e = n(t);
|
|
1446
|
-
return typeof e == "string" ? e :
|
|
1426
|
+
return typeof e == "string" ? e : Tt(e);
|
|
1447
1427
|
}
|
|
1448
|
-
return
|
|
1428
|
+
return Tt(e);
|
|
1449
1429
|
}
|
|
1450
|
-
default: return
|
|
1430
|
+
default: return Tt(e);
|
|
1451
1431
|
}
|
|
1452
1432
|
}
|
|
1453
1433
|
function lookupGetter(e, t) {
|
|
1454
1434
|
for (; e !== null;) {
|
|
1455
|
-
let n =
|
|
1435
|
+
let n = at(e, t);
|
|
1456
1436
|
if (n) {
|
|
1457
1437
|
if (n.get) return unapply(n.get);
|
|
1458
1438
|
if (typeof n.value == "function") return unapply(n.value);
|
|
1459
1439
|
}
|
|
1460
|
-
e =
|
|
1440
|
+
e = it(e);
|
|
1461
1441
|
}
|
|
1462
1442
|
function fallbackValue() {
|
|
1463
1443
|
return null;
|
|
@@ -1466,12 +1446,12 @@ function lookupGetter(e, t) {
|
|
|
1466
1446
|
}
|
|
1467
1447
|
function isRegex(e) {
|
|
1468
1448
|
try {
|
|
1469
|
-
return
|
|
1449
|
+
return Q(e, ""), !0;
|
|
1470
1450
|
} catch {
|
|
1471
1451
|
return !1;
|
|
1472
1452
|
}
|
|
1473
1453
|
}
|
|
1474
|
-
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([
|
|
1475
1455
|
"feBlend",
|
|
1476
1456
|
"feColorMatrix",
|
|
1477
1457
|
"feComponentTransfer",
|
|
@@ -1497,7 +1477,7 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1497
1477
|
"feSpotLight",
|
|
1498
1478
|
"feTile",
|
|
1499
1479
|
"feTurbulence"
|
|
1500
|
-
]),
|
|
1480
|
+
]), At = K([
|
|
1501
1481
|
"animate",
|
|
1502
1482
|
"color-profile",
|
|
1503
1483
|
"cursor",
|
|
@@ -1520,7 +1500,7 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1520
1500
|
"solidcolor",
|
|
1521
1501
|
"unknown",
|
|
1522
1502
|
"use"
|
|
1523
|
-
]),
|
|
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([
|
|
1524
1504
|
"maction",
|
|
1525
1505
|
"maligngroup",
|
|
1526
1506
|
"malignmark",
|
|
@@ -1536,13 +1516,13 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1536
1516
|
"annotation-xml",
|
|
1537
1517
|
"mprescripts",
|
|
1538
1518
|
"none"
|
|
1539
|
-
]),
|
|
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([
|
|
1540
1520
|
"xlink:href",
|
|
1541
1521
|
"xml:id",
|
|
1542
1522
|
"xlink:title",
|
|
1543
1523
|
"xml:space",
|
|
1544
1524
|
"xmlns:xlink"
|
|
1545
|
-
]),
|
|
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 = {
|
|
1546
1526
|
element: 1,
|
|
1547
1527
|
attribute: 2,
|
|
1548
1528
|
text: 3,
|
|
@@ -1555,9 +1535,9 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1555
1535
|
documentType: 10,
|
|
1556
1536
|
documentFragment: 11,
|
|
1557
1537
|
notation: 12
|
|
1558
|
-
},
|
|
1538
|
+
}, $t = function getGlobal() {
|
|
1559
1539
|
return typeof window > "u" ? null : window;
|
|
1560
|
-
},
|
|
1540
|
+
}, en = function _createTrustedTypesPolicy(e, t) {
|
|
1561
1541
|
if (typeof e != "object" || typeof e.createPolicy != "function") return null;
|
|
1562
1542
|
let n = null, r = "data-tt-policy-suffix";
|
|
1563
1543
|
t && t.hasAttribute(r) && (n = t.getAttribute(r));
|
|
@@ -1574,7 +1554,7 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1574
1554
|
} catch {
|
|
1575
1555
|
return console.warn("TrustedTypes policy " + i + " could not be created."), null;
|
|
1576
1556
|
}
|
|
1577
|
-
},
|
|
1557
|
+
}, tn = function _createHooksMap() {
|
|
1578
1558
|
return {
|
|
1579
1559
|
afterSanitizeAttributes: [],
|
|
1580
1560
|
afterSanitizeElements: [],
|
|
@@ -1586,53 +1566,53 @@ var kt = X(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bd
|
|
|
1586
1566
|
uponSanitizeElement: [],
|
|
1587
1567
|
uponSanitizeShadowNode: []
|
|
1588
1568
|
};
|
|
1589
|
-
},
|
|
1590
|
-
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;
|
|
1591
1571
|
};
|
|
1592
1572
|
function createDOMPurify() {
|
|
1593
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
1594
|
-
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;
|
|
1595
1575
|
let t = e.document, n = t, r = n.currentScript;
|
|
1596
1576
|
e.DocumentFragment;
|
|
1597
1577
|
let i = e.HTMLTemplateElement, a = e.Node, o = e.Element, s = e.NodeFilter;
|
|
1598
1578
|
e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
|
|
1599
|
-
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;
|
|
1600
1580
|
if (typeof i == "function") {
|
|
1601
1581
|
let e = t.createElement("template");
|
|
1602
1582
|
e.content && e.content.ownerDocument && (t = e.content.ownerDocument);
|
|
1603
1583
|
}
|
|
1604
|
-
let
|
|
1605
|
-
if (j > 0) throw
|
|
1606
|
-
},
|
|
1607
|
-
|
|
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++;
|
|
1608
1588
|
try {
|
|
1609
|
-
return
|
|
1589
|
+
return T.createHTML(e);
|
|
1610
1590
|
} finally {
|
|
1611
1591
|
j--;
|
|
1612
1592
|
}
|
|
1613
|
-
},
|
|
1614
|
-
|
|
1593
|
+
}, ie = function _createTrustedScriptURL(e) {
|
|
1594
|
+
ne(), j++;
|
|
1615
1595
|
try {
|
|
1616
|
-
return
|
|
1596
|
+
return T.createScriptURL(e);
|
|
1617
1597
|
} finally {
|
|
1618
1598
|
j--;
|
|
1619
1599
|
}
|
|
1620
|
-
},
|
|
1621
|
-
return A || (
|
|
1622
|
-
},
|
|
1623
|
-
DOMPurify.isSupported = typeof tt == "function" && typeof v == "function" &&
|
|
1624
|
-
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,
|
|
1625
1607
|
...kt,
|
|
1626
|
-
...At,
|
|
1627
1608
|
...jt,
|
|
1628
|
-
...Nt
|
|
1629
|
-
|
|
1630
|
-
|
|
1609
|
+
...Nt
|
|
1610
|
+
]), U = null, W = addToSet({}, [
|
|
1611
|
+
...Pt,
|
|
1612
|
+
...Ft,
|
|
1631
1613
|
...It,
|
|
1632
|
-
...Lt
|
|
1633
|
-
|
|
1634
|
-
...zt
|
|
1635
|
-
]), q = Object.seal(at(null, {
|
|
1614
|
+
...Lt
|
|
1615
|
+
]), G = Object.seal(J(null, {
|
|
1636
1616
|
tagNameCheck: {
|
|
1637
1617
|
writable: !0,
|
|
1638
1618
|
configurable: !1,
|
|
@@ -1651,7 +1631,7 @@ function createDOMPurify() {
|
|
|
1651
1631
|
enumerable: !0,
|
|
1652
1632
|
value: !1
|
|
1653
1633
|
}
|
|
1654
|
-
})),
|
|
1634
|
+
})), Se = null, Ce = null, we = Object.seal(J(null, {
|
|
1655
1635
|
tagCheck: {
|
|
1656
1636
|
writable: !0,
|
|
1657
1637
|
configurable: !1,
|
|
@@ -1664,14 +1644,14 @@ function createDOMPurify() {
|
|
|
1664
1644
|
enumerable: !0,
|
|
1665
1645
|
value: null
|
|
1666
1646
|
}
|
|
1667
|
-
})),
|
|
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({}, [
|
|
1668
1648
|
"audio",
|
|
1669
1649
|
"video",
|
|
1670
1650
|
"img",
|
|
1671
1651
|
"source",
|
|
1672
1652
|
"image",
|
|
1673
1653
|
"track"
|
|
1674
|
-
]),
|
|
1654
|
+
]), Ye = null, Xe = addToSet({}, [
|
|
1675
1655
|
"alt",
|
|
1676
1656
|
"class",
|
|
1677
1657
|
"for",
|
|
@@ -1686,75 +1666,75 @@ function createDOMPurify() {
|
|
|
1686
1666
|
"value",
|
|
1687
1667
|
"style",
|
|
1688
1668
|
"xmlns"
|
|
1689
|
-
]),
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
], _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([
|
|
1694
1674
|
"mi",
|
|
1695
1675
|
"mo",
|
|
1696
1676
|
"mn",
|
|
1697
1677
|
"ms",
|
|
1698
1678
|
"mtext"
|
|
1699
|
-
]),
|
|
1679
|
+
]), st = addToSet({}, at), ct = K(["annotation-xml"]), lt = addToSet({}, ct), St = addToSet({}, [
|
|
1700
1680
|
"title",
|
|
1701
1681
|
"style",
|
|
1702
1682
|
"font",
|
|
1703
1683
|
"a",
|
|
1704
1684
|
"script"
|
|
1705
|
-
]),
|
|
1685
|
+
]), Ct = null, wt = ["application/xhtml+xml", "text/html"], X = null, Tt = null, rn = t.createElement("form"), an = function isRegexOrFunction(e) {
|
|
1706
1686
|
return e instanceof RegExp || e instanceof Function;
|
|
1707
1687
|
}, on = function _parseConfig() {
|
|
1708
1688
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1709
|
-
if (
|
|
1710
|
-
(!e || typeof e != "object") && (e = {}), e = clone(e),
|
|
1711
|
-
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,
|
|
1712
1695
|
base: Je
|
|
1713
|
-
}), Ge =
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
}), 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);
|
|
1717
|
-
let t = Tt(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? clone(e.CUSTOM_ELEMENT_HANDLING) : at(null);
|
|
1718
|
-
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, [
|
|
1719
1699
|
"html",
|
|
1720
1700
|
"head",
|
|
1721
1701
|
"body"
|
|
1722
|
-
]),
|
|
1723
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw
|
|
1724
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw
|
|
1725
|
-
let t =
|
|
1726
|
-
|
|
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;
|
|
1727
1707
|
try {
|
|
1728
|
-
|
|
1708
|
+
k = re("");
|
|
1729
1709
|
} catch (e) {
|
|
1730
|
-
throw
|
|
1710
|
+
throw T = t, e;
|
|
1731
1711
|
}
|
|
1732
|
-
} else e.TRUSTED_TYPES_POLICY === null ? (
|
|
1733
|
-
|
|
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;
|
|
1734
1714
|
}, sn = addToSet({}, [
|
|
1735
|
-
...
|
|
1736
|
-
...
|
|
1737
|
-
...
|
|
1738
|
-
]), cn = addToSet({}, [...
|
|
1739
|
-
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];
|
|
1740
1720
|
}, un = function _checkMathMlNamespace(e, t, n) {
|
|
1741
|
-
return t.namespaceURI ===
|
|
1721
|
+
return t.namespaceURI === $e ? e === "math" : t.namespaceURI === Qe ? e === "math" && lt[n] : !!cn[e];
|
|
1742
1722
|
}, dn = function _checkHtmlNamespace(e, t, n) {
|
|
1743
|
-
return t.namespaceURI ===
|
|
1723
|
+
return t.namespaceURI === Qe && !lt[n] || t.namespaceURI === Ze && !st[n] ? !1 : !cn[e] && (St[e] || !sn[e]);
|
|
1744
1724
|
}, fn = function _checkValidNamespace(e) {
|
|
1745
1725
|
let t = v(e);
|
|
1746
1726
|
(!t || !t.tagName) && (t = {
|
|
1747
|
-
namespaceURI:
|
|
1727
|
+
namespaceURI: et,
|
|
1748
1728
|
tagName: "template"
|
|
1749
1729
|
});
|
|
1750
1730
|
let n = gt(e.tagName), r = gt(t.tagName);
|
|
1751
|
-
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;
|
|
1752
1732
|
}, pn = function _forceRemove(e) {
|
|
1753
1733
|
pt(DOMPurify.removed, { element: e });
|
|
1754
1734
|
try {
|
|
1755
1735
|
v(e).removeChild(e);
|
|
1756
1736
|
} catch {
|
|
1757
|
-
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");
|
|
1758
1738
|
}
|
|
1759
1739
|
}, mn = function _neutralizeRoot(e) {
|
|
1760
1740
|
_n(e);
|
|
@@ -1769,7 +1749,7 @@ function createDOMPurify() {
|
|
|
1769
1749
|
} catch {}
|
|
1770
1750
|
});
|
|
1771
1751
|
}
|
|
1772
|
-
let n =
|
|
1752
|
+
let n = x(e);
|
|
1773
1753
|
if (n) for (let t = n.length - 1; t >= 0; --t) {
|
|
1774
1754
|
let r = n[t], i = r && r.name;
|
|
1775
1755
|
if (typeof i == "string") try {
|
|
@@ -1788,17 +1768,17 @@ function createDOMPurify() {
|
|
|
1788
1768
|
from: t
|
|
1789
1769
|
});
|
|
1790
1770
|
}
|
|
1791
|
-
if (t.removeAttribute(e), e === "is") if (
|
|
1771
|
+
if (t.removeAttribute(e), e === "is") if (Ie || Le) try {
|
|
1792
1772
|
pn(t);
|
|
1793
1773
|
} catch {}
|
|
1794
1774
|
else try {
|
|
1795
1775
|
t.setAttribute(e, "");
|
|
1796
1776
|
} catch {}
|
|
1797
1777
|
}, gn = function _stripDisallowedAttributes(e) {
|
|
1798
|
-
let t =
|
|
1778
|
+
let t = x(e);
|
|
1799
1779
|
if (t) for (let n = t.length - 1; n >= 0; --n) {
|
|
1800
1780
|
let r = t[n], i = r && r.name;
|
|
1801
|
-
if (!(typeof i != "string" ||
|
|
1781
|
+
if (!(typeof i != "string" || U[X(i)])) try {
|
|
1802
1782
|
e.removeAttribute(i);
|
|
1803
1783
|
} catch {}
|
|
1804
1784
|
}
|
|
@@ -1806,23 +1786,23 @@ function createDOMPurify() {
|
|
|
1806
1786
|
let t = [e];
|
|
1807
1787
|
for (; t.length > 0;) {
|
|
1808
1788
|
let e = t.pop();
|
|
1809
|
-
(
|
|
1789
|
+
(S ? S(e) : e.nodeType) === Qt.element && gn(e);
|
|
1810
1790
|
let n = _(e);
|
|
1811
1791
|
if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
|
|
1812
1792
|
}
|
|
1813
1793
|
}, vn = function _neutralizePatchLinkage(e) {
|
|
1814
|
-
if (!
|
|
1794
|
+
if (!Ae) return;
|
|
1815
1795
|
let t = [e];
|
|
1816
1796
|
for (; t.length > 0;) {
|
|
1817
|
-
let e = t.pop(), n =
|
|
1818
|
-
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)) {
|
|
1819
1799
|
try {
|
|
1820
1800
|
m(e);
|
|
1821
1801
|
} catch {}
|
|
1822
1802
|
continue;
|
|
1823
1803
|
}
|
|
1824
|
-
if (n ===
|
|
1825
|
-
let t = e, n =
|
|
1804
|
+
if (n === Qt.element) {
|
|
1805
|
+
let t = e, n = X(C ? C(e) : e.nodeName);
|
|
1826
1806
|
try {
|
|
1827
1807
|
t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for");
|
|
1828
1808
|
} catch {}
|
|
@@ -1832,100 +1812,100 @@ function createDOMPurify() {
|
|
|
1832
1812
|
}
|
|
1833
1813
|
}, yn = function _initDocument(e) {
|
|
1834
1814
|
let n = null, r = null;
|
|
1835
|
-
if (
|
|
1815
|
+
if (Fe) e = "<remove></remove>" + e;
|
|
1836
1816
|
else {
|
|
1837
1817
|
let t = vt(e, /^[\r\n\t ]+/);
|
|
1838
1818
|
r = t && t[0];
|
|
1839
1819
|
}
|
|
1840
|
-
|
|
1841
|
-
let i =
|
|
1842
|
-
if (
|
|
1843
|
-
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);
|
|
1844
1824
|
} catch {}
|
|
1845
1825
|
if (!n || !n.documentElement) {
|
|
1846
|
-
n =
|
|
1826
|
+
n = F.createDocument(et, "template", null);
|
|
1847
1827
|
try {
|
|
1848
|
-
n.documentElement.innerHTML =
|
|
1828
|
+
n.documentElement.innerHTML = nt ? k : i;
|
|
1849
1829
|
} catch {}
|
|
1850
1830
|
}
|
|
1851
1831
|
let a = n.body || n.documentElement;
|
|
1852
|
-
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;
|
|
1853
1833
|
}, bn = function _createNodeIterator(e) {
|
|
1854
|
-
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);
|
|
1855
1835
|
}, xn = function _stripTemplateExpressions(e) {
|
|
1856
|
-
return e = yt(e,
|
|
1836
|
+
return e = yt(e, se, " "), e = yt(e, ce, " "), e = yt(e, ue, " "), e;
|
|
1857
1837
|
}, Sn = function _scrubTemplateExpressions(e) {
|
|
1858
1838
|
e.normalize();
|
|
1859
|
-
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();
|
|
1860
1840
|
for (; n;) n.data = xn(n.data), n = t.nextNode();
|
|
1861
1841
|
let r = e.querySelectorAll?.call(e, "template");
|
|
1862
1842
|
r && ut(r, (e) => {
|
|
1863
1843
|
wn(e.content) && Sn(e.content);
|
|
1864
1844
|
});
|
|
1865
1845
|
}, Cn = function _isClobbered(e) {
|
|
1866
|
-
let t =
|
|
1867
|
-
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);
|
|
1868
1848
|
}, wn = function _isDocumentFragment(e) {
|
|
1869
|
-
if (!
|
|
1849
|
+
if (!S || typeof e != "object" || !e) return !1;
|
|
1870
1850
|
try {
|
|
1871
|
-
return
|
|
1851
|
+
return S(e) === Qt.documentFragment;
|
|
1872
1852
|
} catch {
|
|
1873
1853
|
return !1;
|
|
1874
1854
|
}
|
|
1875
1855
|
}, Tn = function _isNode(e) {
|
|
1876
|
-
if (!
|
|
1856
|
+
if (!S || typeof e != "object" || !e) return !1;
|
|
1877
1857
|
try {
|
|
1878
|
-
return typeof
|
|
1858
|
+
return typeof S(e) == "number";
|
|
1879
1859
|
} catch {
|
|
1880
1860
|
return !1;
|
|
1881
1861
|
}
|
|
1882
1862
|
};
|
|
1883
1863
|
function _executeHooks(e, t, n) {
|
|
1884
1864
|
e.length !== 0 && ut(e, (e) => {
|
|
1885
|
-
e.call(DOMPurify, t, n,
|
|
1865
|
+
e.call(DOMPurify, t, n, Tt);
|
|
1886
1866
|
});
|
|
1887
1867
|
}
|
|
1888
1868
|
let En = function _isUnsafeNode(e, t) {
|
|
1889
|
-
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));
|
|
1890
1870
|
}, Dn = function _sanitizeDisallowedNode(e, t) {
|
|
1891
|
-
if (!
|
|
1892
|
-
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]) {
|
|
1893
1873
|
let t = v(e), n = _(e);
|
|
1894
1874
|
if (n && t) {
|
|
1895
1875
|
let r = n.length;
|
|
1896
1876
|
for (let i = r - 1; i >= 0; --i) {
|
|
1897
|
-
let r =
|
|
1877
|
+
let r = Ue ? n[i] : p(n[i], !0);
|
|
1898
1878
|
t.insertBefore(r, h(e));
|
|
1899
1879
|
}
|
|
1900
1880
|
}
|
|
1901
1881
|
}
|
|
1902
1882
|
return pn(e), !0;
|
|
1903
1883
|
}, On = function _sanitizeElements(e, t) {
|
|
1904
|
-
if (_executeHooks(
|
|
1884
|
+
if (_executeHooks(B.beforeSanitizeElements, e, null), e !== t && v(e) === null) return !0;
|
|
1905
1885
|
if (Cn(e)) return pn(e), !0;
|
|
1906
|
-
let n =
|
|
1907
|
-
if (_executeHooks(
|
|
1886
|
+
let n = X(C ? C(e) : e.nodeName);
|
|
1887
|
+
if (_executeHooks(B.uponSanitizeElement, e, {
|
|
1908
1888
|
tagName: n,
|
|
1909
|
-
allowedTags:
|
|
1889
|
+
allowedTags: H
|
|
1910
1890
|
}), e !== t && v(e) === null) return !0;
|
|
1911
1891
|
if (En(e, n)) return pn(e), !0;
|
|
1912
|
-
if (
|
|
1892
|
+
if (Se[n] || !(we.tagCheck instanceof Function && we.tagCheck(n)) && !H[n]) {
|
|
1913
1893
|
let t = Dn(e, n);
|
|
1914
|
-
return t === !1 && _executeHooks(
|
|
1894
|
+
return t === !1 && _executeHooks(B.afterSanitizeElements, e, null), t;
|
|
1915
1895
|
}
|
|
1916
|
-
if ((
|
|
1917
|
-
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) {
|
|
1918
1898
|
let t = xn(e.textContent);
|
|
1919
1899
|
e.textContent !== t && (pt(DOMPurify.removed, { element: e.cloneNode() }), e.textContent = t);
|
|
1920
1900
|
}
|
|
1921
|
-
return _executeHooks(
|
|
1901
|
+
return _executeHooks(B.afterSanitizeElements, e, null), !1;
|
|
1922
1902
|
}, kn = function _isValidAttribute(e, n, r) {
|
|
1923
|
-
if (
|
|
1924
|
-
let i =
|
|
1925
|
-
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))) {
|
|
1926
1906
|
if (!i) {
|
|
1927
|
-
if (!(jn(e) && (
|
|
1928
|
-
} 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;
|
|
1929
1909
|
}
|
|
1930
1910
|
return !0;
|
|
1931
1911
|
}, An = addToSet({}, [
|
|
@@ -1938,11 +1918,11 @@ function createDOMPurify() {
|
|
|
1938
1918
|
"font-face-uri",
|
|
1939
1919
|
"missing-glyph"
|
|
1940
1920
|
]), jn = function _isBasicCustomElement(e) {
|
|
1941
|
-
return !An[gt(e)] &&
|
|
1921
|
+
return !An[gt(e)] && Q(ve, e);
|
|
1942
1922
|
}, Mn = function _applyTrustedTypesToAttribute(e, t, n, r) {
|
|
1943
|
-
if (
|
|
1944
|
-
case "TrustedHTML": return
|
|
1945
|
-
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);
|
|
1946
1926
|
}
|
|
1947
1927
|
return r;
|
|
1948
1928
|
}, Nn = function _setAttributeValue(e, t, n, r) {
|
|
@@ -1952,19 +1932,19 @@ function createDOMPurify() {
|
|
|
1952
1932
|
hn(t, e);
|
|
1953
1933
|
}
|
|
1954
1934
|
}, Pn = function _sanitizeAttributes(e) {
|
|
1955
|
-
_executeHooks(
|
|
1935
|
+
_executeHooks(B.beforeSanitizeAttributes, e, null);
|
|
1956
1936
|
let t = e.attributes;
|
|
1957
1937
|
if (!t || Cn(e)) return;
|
|
1958
1938
|
let n = {
|
|
1959
1939
|
attrName: "",
|
|
1960
1940
|
attrValue: "",
|
|
1961
1941
|
keepAttr: !0,
|
|
1962
|
-
allowedAttributes:
|
|
1942
|
+
allowedAttributes: U,
|
|
1963
1943
|
forceKeepAttr: void 0
|
|
1964
|
-
}, r = t.length, i =
|
|
1944
|
+
}, r = t.length, i = X(e.nodeName);
|
|
1965
1945
|
for (; r--;) {
|
|
1966
|
-
let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, u =
|
|
1967
|
-
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)) {
|
|
1968
1948
|
hn(o, e);
|
|
1969
1949
|
continue;
|
|
1970
1950
|
}
|
|
@@ -1977,25 +1957,25 @@ function createDOMPurify() {
|
|
|
1977
1957
|
hn(o, e);
|
|
1978
1958
|
continue;
|
|
1979
1959
|
}
|
|
1980
|
-
if (!
|
|
1960
|
+
if (!Oe && Q(Zt, p)) {
|
|
1981
1961
|
hn(o, e);
|
|
1982
1962
|
continue;
|
|
1983
1963
|
}
|
|
1984
|
-
if (
|
|
1964
|
+
if (ke && (p = xn(p)), !kn(i, u, p)) {
|
|
1985
1965
|
hn(o, e);
|
|
1986
1966
|
continue;
|
|
1987
1967
|
}
|
|
1988
1968
|
p = Mn(i, u, s, p), p !== f && Nn(e, o, s, p);
|
|
1989
1969
|
}
|
|
1990
1970
|
}
|
|
1991
|
-
_executeHooks(
|
|
1971
|
+
_executeHooks(B.afterSanitizeAttributes, e, null);
|
|
1992
1972
|
}, Fn = function _sanitizeShadowDOM(e) {
|
|
1993
1973
|
let t = null, n = bn(e);
|
|
1994
|
-
for (_executeHooks(
|
|
1995
|
-
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);
|
|
1996
1976
|
wn(e) && (In(e), Fn(e));
|
|
1997
1977
|
}
|
|
1998
|
-
_executeHooks(
|
|
1978
|
+
_executeHooks(B.afterSanitizeShadowDOM, e, null);
|
|
1999
1979
|
}, In = function _sanitizeAttachedShadowRoots(e) {
|
|
2000
1980
|
let t = [{
|
|
2001
1981
|
node: e,
|
|
@@ -2007,14 +1987,14 @@ function createDOMPurify() {
|
|
|
2007
1987
|
Fn(e.shadow);
|
|
2008
1988
|
continue;
|
|
2009
1989
|
}
|
|
2010
|
-
let n = e.node, r = (
|
|
1990
|
+
let n = e.node, r = (S ? S(n) : n.nodeType) === Qt.element, i = _(n);
|
|
2011
1991
|
if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
|
|
2012
1992
|
node: i[e],
|
|
2013
1993
|
shadow: null
|
|
2014
1994
|
});
|
|
2015
1995
|
if (r) {
|
|
2016
|
-
let e =
|
|
2017
|
-
if (typeof e == "string" &&
|
|
1996
|
+
let e = C ? C(n) : null;
|
|
1997
|
+
if (typeof e == "string" && X(e) === "template") {
|
|
2018
1998
|
let e = n.content;
|
|
2019
1999
|
wn(e) && t.push({
|
|
2020
2000
|
node: e,
|
|
@@ -2023,7 +2003,7 @@ function createDOMPurify() {
|
|
|
2023
2003
|
}
|
|
2024
2004
|
}
|
|
2025
2005
|
if (r) {
|
|
2026
|
-
let e =
|
|
2006
|
+
let e = b(n);
|
|
2027
2007
|
wn(e) && t.push({
|
|
2028
2008
|
node: null,
|
|
2029
2009
|
shadow: e
|
|
@@ -2036,29 +2016,29 @@ function createDOMPurify() {
|
|
|
2036
2016
|
};
|
|
2037
2017
|
return DOMPurify.sanitize = function(e) {
|
|
2038
2018
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = null, i = null, a = null, o = null;
|
|
2039
|
-
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");
|
|
2040
2020
|
if (!DOMPurify.isSupported) return e;
|
|
2041
|
-
|
|
2042
|
-
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);
|
|
2043
2023
|
if (s) {
|
|
2044
2024
|
vn(e);
|
|
2045
|
-
let t =
|
|
2025
|
+
let t = C ? C(e) : e.nodeName;
|
|
2046
2026
|
if (typeof t == "string") {
|
|
2047
|
-
let n =
|
|
2048
|
-
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");
|
|
2049
2029
|
}
|
|
2050
|
-
if (Cn(e)) throw mn(e),
|
|
2030
|
+
if (Cn(e)) throw mn(e), Et("root node is clobbered and cannot be sanitized in-place");
|
|
2051
2031
|
try {
|
|
2052
2032
|
In(e);
|
|
2053
2033
|
} catch (t) {
|
|
2054
2034
|
throw mn(e), t;
|
|
2055
2035
|
}
|
|
2056
|
-
} 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);
|
|
2057
2037
|
else {
|
|
2058
|
-
if (!
|
|
2059
|
-
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 : "";
|
|
2060
2040
|
}
|
|
2061
|
-
r &&
|
|
2041
|
+
r && Fe && pn(r.firstChild);
|
|
2062
2042
|
let c = s ? e : r, u = bn(c);
|
|
2063
2043
|
try {
|
|
2064
2044
|
for (; a = u.nextNode();) On(a, c), Pn(a), wn(a.content) && Fn(a.content);
|
|
@@ -2069,40 +2049,40 @@ function createDOMPurify() {
|
|
|
2069
2049
|
}
|
|
2070
2050
|
if (s) return ut(DOMPurify.removed, (e) => {
|
|
2071
2051
|
e.element && _n(e.element);
|
|
2072
|
-
}),
|
|
2073
|
-
if (
|
|
2074
|
-
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);
|
|
2075
2055
|
else o = r;
|
|
2076
|
-
return (
|
|
2056
|
+
return (U.shadowroot || U.shadowrootmode) && (o = R.call(n, o, !0)), o;
|
|
2077
2057
|
}
|
|
2078
|
-
let f =
|
|
2079
|
-
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;
|
|
2080
2060
|
}, DOMPurify.setConfig = function() {
|
|
2081
2061
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2082
|
-
on(e),
|
|
2062
|
+
on(e), Me = !0, Ne = H, Pe = U;
|
|
2083
2063
|
}, DOMPurify.clearConfig = function() {
|
|
2084
|
-
|
|
2064
|
+
Tt = null, Me = !1, Ne = null, Pe = null, T = te, k = "";
|
|
2085
2065
|
}, DOMPurify.isValidAttribute = function(e, t, n) {
|
|
2086
|
-
|
|
2087
|
-
let r =
|
|
2066
|
+
Tt || on({});
|
|
2067
|
+
let r = X(e), i = X(t);
|
|
2088
2068
|
return kn(r, i, n);
|
|
2089
2069
|
}, DOMPurify.addHook = function(e, t) {
|
|
2090
|
-
typeof t == "function" &&
|
|
2070
|
+
typeof t == "function" && Z(B, e) && pt(B[e], t);
|
|
2091
2071
|
}, DOMPurify.removeHook = function(e, t) {
|
|
2092
|
-
if (
|
|
2072
|
+
if (Z(B, e)) {
|
|
2093
2073
|
if (t !== void 0) {
|
|
2094
|
-
let n = dt(
|
|
2095
|
-
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];
|
|
2096
2076
|
}
|
|
2097
|
-
return ft(
|
|
2077
|
+
return ft(B[e]);
|
|
2098
2078
|
}
|
|
2099
2079
|
}, DOMPurify.removeHooks = function(e) {
|
|
2100
|
-
|
|
2080
|
+
Z(B, e) && (B[e] = []);
|
|
2101
2081
|
}, DOMPurify.removeAllHooks = function() {
|
|
2102
|
-
|
|
2082
|
+
B = tn();
|
|
2103
2083
|
}, DOMPurify;
|
|
2104
2084
|
}
|
|
2105
|
-
var
|
|
2085
|
+
var rn = createDOMPurify(), _Class;
|
|
2106
2086
|
function z() {
|
|
2107
2087
|
return {
|
|
2108
2088
|
async: !1,
|
|
@@ -2117,11 +2097,11 @@ function z() {
|
|
|
2117
2097
|
walkTokens: null
|
|
2118
2098
|
};
|
|
2119
2099
|
}
|
|
2120
|
-
var
|
|
2100
|
+
var an = z();
|
|
2121
2101
|
function N(e) {
|
|
2122
|
-
|
|
2102
|
+
an = e;
|
|
2123
2103
|
}
|
|
2124
|
-
var
|
|
2104
|
+
var on = { exec: () => null };
|
|
2125
2105
|
function E(e) {
|
|
2126
2106
|
let t = [];
|
|
2127
2107
|
return (n) => {
|
|
@@ -2133,19 +2113,19 @@ function d(e, t = "") {
|
|
|
2133
2113
|
let n = typeof e == "string" ? e : e.source, r = {
|
|
2134
2114
|
replace: (e, t) => {
|
|
2135
2115
|
let i = typeof t == "string" ? t : t.source;
|
|
2136
|
-
return i = i.replace(
|
|
2116
|
+
return i = i.replace(cn.caret, "$1"), n = n.replace(e, i), r;
|
|
2137
2117
|
},
|
|
2138
2118
|
getRegex: () => new RegExp(n, t)
|
|
2139
2119
|
};
|
|
2140
2120
|
return r;
|
|
2141
2121
|
}
|
|
2142
|
-
var
|
|
2122
|
+
var sn = ((e = "") => {
|
|
2143
2123
|
try {
|
|
2144
2124
|
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
2145
2125
|
} catch {
|
|
2146
2126
|
return !1;
|
|
2147
2127
|
}
|
|
2148
|
-
})(),
|
|
2128
|
+
})(), cn = {
|
|
2149
2129
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
2150
2130
|
outputLinkReplace: /\\([\[\]])/g,
|
|
2151
2131
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -2202,112 +2182,112 @@ var ln = ((e = "") => {
|
|
|
2202
2182
|
headingBeginRegex: E((e) => RegExp(`^ {0,${e}}#`)),
|
|
2203
2183
|
htmlBeginRegex: E((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
|
|
2204
2184
|
blockquoteBeginRegex: E((e) => RegExp(`^ {0,${e}}>`))
|
|
2205
|
-
},
|
|
2206
|
-
blockquote: d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
2207
|
-
code:
|
|
2208
|
-
def:
|
|
2209
|
-
fences:
|
|
2210
|
-
heading:
|
|
2211
|
-
hr:
|
|
2212
|
-
html:
|
|
2213
|
-
lheading:
|
|
2214
|
-
list:
|
|
2215
|
-
newline:
|
|
2216
|
-
paragraph:
|
|
2217
|
-
table:
|
|
2218
|
-
text:
|
|
2219
|
-
},
|
|
2220
|
-
...
|
|
2221
|
-
lheading:
|
|
2222
|
-
table:
|
|
2223
|
-
paragraph: d(
|
|
2224
|
-
},
|
|
2225
|
-
...
|
|
2226
|
-
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(),
|
|
2227
2207
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
2228
2208
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
2229
|
-
fences:
|
|
2209
|
+
fences: on,
|
|
2230
2210
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
2231
|
-
paragraph: d(
|
|
2232
|
-
},
|
|
2233
|
-
_backpedal:
|
|
2234
|
-
anyPunctuation:
|
|
2235
|
-
autolink:
|
|
2236
|
-
blockSkip:
|
|
2237
|
-
br:
|
|
2238
|
-
code:
|
|
2239
|
-
del:
|
|
2240
|
-
delLDelim:
|
|
2241
|
-
delRDelim:
|
|
2242
|
-
emStrongLDelim:
|
|
2243
|
-
emStrongRDelimAst:
|
|
2244
|
-
emStrongRDelimUnd:
|
|
2245
|
-
escape:
|
|
2246
|
-
link:
|
|
2247
|
-
nolink:
|
|
2248
|
-
punctuation:
|
|
2249
|
-
reflink:
|
|
2250
|
-
reflinkSearch:
|
|
2251
|
-
tag:
|
|
2252
|
-
text:
|
|
2253
|
-
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()
|
|
2254
2248
|
}, fr = {
|
|
2255
2249
|
...dr,
|
|
2256
|
-
|
|
2257
|
-
|
|
2250
|
+
br: d(Pn).replace("{2,}", "*").getRegex(),
|
|
2251
|
+
text: d(dr.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
2258
2252
|
}, pr = {
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
delLDelim: $n,
|
|
2263
|
-
delRDelim: er,
|
|
2264
|
-
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(),
|
|
2265
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
2266
|
-
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
2267
|
-
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
|
|
2268
2256
|
}, mr = {
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2257
|
+
normal: lr,
|
|
2258
|
+
gfm: dr,
|
|
2259
|
+
breaks: fr,
|
|
2260
|
+
pedantic: ur
|
|
2272
2261
|
}, hr = {
|
|
2273
|
-
normal: An,
|
|
2274
|
-
gfm: Mn,
|
|
2275
|
-
pedantic: Nn
|
|
2276
|
-
}, gr = {
|
|
2277
|
-
normal: dr,
|
|
2278
|
-
gfm: pr,
|
|
2279
|
-
breaks: mr,
|
|
2280
|
-
pedantic: fr
|
|
2281
|
-
}, _r = {
|
|
2282
2262
|
"&": "&",
|
|
2283
2263
|
"<": "<",
|
|
2284
2264
|
">": ">",
|
|
2285
2265
|
"\"": """,
|
|
2286
2266
|
"'": "'"
|
|
2287
|
-
}, ge = (e) =>
|
|
2267
|
+
}, ge = (e) => hr[e];
|
|
2288
2268
|
function O(e, t) {
|
|
2289
2269
|
if (t) {
|
|
2290
|
-
if (
|
|
2291
|
-
} 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);
|
|
2292
2272
|
return e;
|
|
2293
2273
|
}
|
|
2294
2274
|
function V(e) {
|
|
2295
2275
|
try {
|
|
2296
|
-
e = encodeURI(e).replace(
|
|
2276
|
+
e = encodeURI(e).replace(cn.percentDecode, "%");
|
|
2297
2277
|
} catch {
|
|
2298
2278
|
return null;
|
|
2299
2279
|
}
|
|
2300
2280
|
return e;
|
|
2301
2281
|
}
|
|
2302
2282
|
function Y(e, t) {
|
|
2303
|
-
let n = e.replace(
|
|
2283
|
+
let n = e.replace(cn.findPipe, (e, t, n) => {
|
|
2304
2284
|
let r = !1, i = t;
|
|
2305
2285
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
2306
2286
|
return r ? "|" : " |";
|
|
2307
|
-
}).split(
|
|
2287
|
+
}).split(cn.splitPipe), r = 0;
|
|
2308
2288
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
2309
2289
|
else for (; n.length < t;) n.push("");
|
|
2310
|
-
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, "|");
|
|
2311
2291
|
return n;
|
|
2312
2292
|
}
|
|
2313
2293
|
function $(e, t, n) {
|
|
@@ -2324,7 +2304,7 @@ function $(e, t, n) {
|
|
|
2324
2304
|
}
|
|
2325
2305
|
function ee(e) {
|
|
2326
2306
|
let t = e.split("\n"), n = t.length - 1;
|
|
2327
|
-
for (; n >= 0 &&
|
|
2307
|
+
for (; n >= 0 && cn.blankLine.test(t[n]);) n--;
|
|
2328
2308
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
2329
2309
|
}
|
|
2330
2310
|
function fe(e, t) {
|
|
@@ -2369,7 +2349,7 @@ function ot(e, t, n) {
|
|
|
2369
2349
|
}
|
|
2370
2350
|
var w = class {
|
|
2371
2351
|
constructor(e) {
|
|
2372
|
-
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;
|
|
2373
2353
|
}
|
|
2374
2354
|
space(e) {
|
|
2375
2355
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -2819,24 +2799,24 @@ ${c}` : c;
|
|
|
2819
2799
|
};
|
|
2820
2800
|
}
|
|
2821
2801
|
}
|
|
2822
|
-
},
|
|
2802
|
+
}, gr = class l {
|
|
2823
2803
|
constructor(e) {
|
|
2824
|
-
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 = {
|
|
2825
2805
|
inLink: !1,
|
|
2826
2806
|
inRawBlock: !1,
|
|
2827
2807
|
top: !0
|
|
2828
2808
|
};
|
|
2829
2809
|
let n = {
|
|
2830
|
-
other:
|
|
2831
|
-
block:
|
|
2832
|
-
inline:
|
|
2810
|
+
other: cn,
|
|
2811
|
+
block: pr.normal,
|
|
2812
|
+
inline: mr.normal
|
|
2833
2813
|
};
|
|
2834
|
-
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;
|
|
2835
2815
|
}
|
|
2836
2816
|
static get rules() {
|
|
2837
2817
|
return {
|
|
2838
|
-
block:
|
|
2839
|
-
inline:
|
|
2818
|
+
block: pr,
|
|
2819
|
+
inline: mr
|
|
2840
2820
|
};
|
|
2841
2821
|
}
|
|
2842
2822
|
static lex(e, t) {
|
|
@@ -2846,7 +2826,7 @@ ${c}` : c;
|
|
|
2846
2826
|
return new l(t).inlineTokens(e);
|
|
2847
2827
|
}
|
|
2848
2828
|
lex(e) {
|
|
2849
|
-
e = e.replace(
|
|
2829
|
+
e = e.replace(cn.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
2850
2830
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
2851
2831
|
let t = this.inlineQueue[e];
|
|
2852
2832
|
this.inlineTokens(t.src, t.tokens);
|
|
@@ -2854,7 +2834,7 @@ ${c}` : c;
|
|
|
2854
2834
|
return this.inlineQueue = [], this.tokens;
|
|
2855
2835
|
}
|
|
2856
2836
|
blockTokens(e, t = [], n = !1) {
|
|
2857
|
-
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, ""));
|
|
2858
2838
|
let r = Infinity;
|
|
2859
2839
|
for (; e;) {
|
|
2860
2840
|
if (e.length < r) r = e.length;
|
|
@@ -3038,13 +3018,13 @@ ${c}` : c;
|
|
|
3038
3018
|
}
|
|
3039
3019
|
}, y = class {
|
|
3040
3020
|
constructor(e) {
|
|
3041
|
-
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;
|
|
3042
3022
|
}
|
|
3043
3023
|
space(e) {
|
|
3044
3024
|
return "";
|
|
3045
3025
|
}
|
|
3046
3026
|
code({ text: e, lang: t, escaped: n }) {
|
|
3047
|
-
let r = (t || "").match(
|
|
3027
|
+
let r = (t || "").match(cn.notSpaceStart)?.[0], i = e.replace(cn.endingNewline, "") + "\n";
|
|
3048
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";
|
|
3049
3029
|
}
|
|
3050
3030
|
blockquote({ tokens: e }) {
|
|
@@ -3172,9 +3152,9 @@ ${e}</tr>
|
|
|
3172
3152
|
checkbox({ raw: e }) {
|
|
3173
3153
|
return e;
|
|
3174
3154
|
}
|
|
3175
|
-
},
|
|
3155
|
+
}, _r = class l {
|
|
3176
3156
|
constructor(e) {
|
|
3177
|
-
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();
|
|
3178
3158
|
}
|
|
3179
3159
|
static parse(e, t) {
|
|
3180
3160
|
return new l(t).parse(e);
|
|
@@ -3320,9 +3300,9 @@ ${e}</tr>
|
|
|
3320
3300
|
}
|
|
3321
3301
|
return n;
|
|
3322
3302
|
}
|
|
3323
|
-
},
|
|
3303
|
+
}, vr = (_Class = class {
|
|
3324
3304
|
constructor(e) {
|
|
3325
|
-
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;
|
|
3326
3306
|
}
|
|
3327
3307
|
preprocess(e) {
|
|
3328
3308
|
return e;
|
|
@@ -3337,10 +3317,10 @@ ${e}</tr>
|
|
|
3337
3317
|
return e;
|
|
3338
3318
|
}
|
|
3339
3319
|
provideLexer(e = this.block) {
|
|
3340
|
-
return e ?
|
|
3320
|
+
return e ? gr.lex : gr.lexInline;
|
|
3341
3321
|
}
|
|
3342
3322
|
provideParser(e = this.block) {
|
|
3343
|
-
return e ?
|
|
3323
|
+
return e ? _r.parse : _r.parseInline;
|
|
3344
3324
|
}
|
|
3345
3325
|
}, t(_Class, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
3346
3326
|
"preprocess",
|
|
@@ -3353,7 +3333,7 @@ ${e}</tr>
|
|
|
3353
3333
|
"processAllTokens"
|
|
3354
3334
|
])), _Class), D = class {
|
|
3355
3335
|
constructor(...e) {
|
|
3356
|
-
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);
|
|
3357
3337
|
}
|
|
3358
3338
|
walkTokens(e, t) {
|
|
3359
3339
|
let n = [];
|
|
@@ -3432,13 +3412,13 @@ ${e}</tr>
|
|
|
3432
3412
|
n.tokenizer = t;
|
|
3433
3413
|
}
|
|
3434
3414
|
if (e.hooks) {
|
|
3435
|
-
let t = this.defaults.hooks || new
|
|
3415
|
+
let t = this.defaults.hooks || new vr();
|
|
3436
3416
|
for (let n in e.hooks) {
|
|
3437
3417
|
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
3438
3418
|
if (["options", "block"].includes(n)) continue;
|
|
3439
3419
|
let r = n, i = e.hooks[r], a = t[r];
|
|
3440
|
-
|
|
3441
|
-
if (this.defaults.async &&
|
|
3420
|
+
vr.passThroughHooks.has(n) ? t[r] = (e) => {
|
|
3421
|
+
if (this.defaults.async && vr.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
3442
3422
|
let n = await i.call(t, e);
|
|
3443
3423
|
return a.call(t, n);
|
|
3444
3424
|
})();
|
|
@@ -3475,10 +3455,10 @@ ${e}</tr>
|
|
|
3475
3455
|
}, this;
|
|
3476
3456
|
}
|
|
3477
3457
|
lexer(e, t) {
|
|
3478
|
-
return
|
|
3458
|
+
return gr.lex(e, t ?? this.defaults);
|
|
3479
3459
|
}
|
|
3480
3460
|
parser(e, t) {
|
|
3481
|
-
return
|
|
3461
|
+
return _r.parse(e, t ?? this.defaults);
|
|
3482
3462
|
}
|
|
3483
3463
|
parseMarkdown(e) {
|
|
3484
3464
|
return (t, n) => {
|
|
@@ -3490,16 +3470,16 @@ ${e}</tr>
|
|
|
3490
3470
|
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
3491
3471
|
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
3492
3472
|
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
3493
|
-
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;
|
|
3494
3474
|
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
3495
|
-
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);
|
|
3496
3476
|
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
3497
3477
|
})().catch(a);
|
|
3498
3478
|
try {
|
|
3499
3479
|
i.hooks && (t = i.hooks.preprocess(t));
|
|
3500
|
-
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);
|
|
3501
3481
|
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
3502
|
-
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);
|
|
3503
3483
|
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
3504
3484
|
} catch (e) {
|
|
3505
3485
|
return a(e);
|
|
@@ -3516,20 +3496,20 @@ ${e}</tr>
|
|
|
3516
3496
|
throw n;
|
|
3517
3497
|
};
|
|
3518
3498
|
}
|
|
3519
|
-
},
|
|
3499
|
+
}, yr = new D();
|
|
3520
3500
|
function g(e, t) {
|
|
3521
|
-
return
|
|
3501
|
+
return yr.parse(e, t);
|
|
3522
3502
|
}
|
|
3523
3503
|
g.options = g.setOptions = function(e) {
|
|
3524
|
-
return
|
|
3525
|
-
}, g.getDefaults = z, g.defaults =
|
|
3526
|
-
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;
|
|
3527
3507
|
}, g.walkTokens = function(e, t) {
|
|
3528
|
-
return
|
|
3529
|
-
}, 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;
|
|
3530
3510
|
//#endregion
|
|
3531
|
-
//#region
|
|
3532
|
-
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({
|
|
3533
3513
|
__name: "ChatCardBlock",
|
|
3534
3514
|
props: {
|
|
3535
3515
|
spec: {},
|
|
@@ -3537,11 +3517,11 @@ var Sr = ["aria-label"], Cr = { class: "px-4 pb-2 pt-4" }, wr = ["innerHTML"], T
|
|
|
3537
3517
|
},
|
|
3538
3518
|
emits: ["action"],
|
|
3539
3519
|
setup(e, { emit: t }) {
|
|
3540
|
-
let n = e, r = t, i =
|
|
3520
|
+
let n = e, r = t, i = _(() => {
|
|
3541
3521
|
if (!n.spec.body) return "";
|
|
3542
3522
|
let e = g.parse(n.spec.body, { async: !1 });
|
|
3543
|
-
return
|
|
3544
|
-
}), 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)");
|
|
3545
3525
|
function actionStyle(e) {
|
|
3546
3526
|
return e === "primary" || e === "destructive" ? {
|
|
3547
3527
|
background: n.inverted ? "rgba(255, 255, 255, 0.92)" : "var(--color-theme-900)",
|
|
@@ -3551,45 +3531,45 @@ var Sr = ["aria-label"], Cr = { class: "px-4 pb-2 pt-4" }, wr = ["innerHTML"], T
|
|
|
3551
3531
|
color: s.value
|
|
3552
3532
|
};
|
|
3553
3533
|
}
|
|
3554
|
-
return (t, n) => (
|
|
3534
|
+
return (t, n) => (M(), x("div", {
|
|
3555
3535
|
"data-test": "chat-card",
|
|
3556
3536
|
class: "my-6 w-full self-start overflow-hidden rounded-2xl",
|
|
3557
|
-
style:
|
|
3537
|
+
style: j({
|
|
3558
3538
|
background: f.value,
|
|
3559
3539
|
boxShadow: u.value
|
|
3560
3540
|
}),
|
|
3561
3541
|
"aria-label": e.spec.title
|
|
3562
3542
|
}, [
|
|
3563
|
-
S("div",
|
|
3543
|
+
S("div", xr, [S("div", {
|
|
3564
3544
|
class: "text-[14px] font-semibold leading-tight",
|
|
3565
|
-
style:
|
|
3566
|
-
},
|
|
3567
|
-
i.value ? (
|
|
3545
|
+
style: j({ color: s.value })
|
|
3546
|
+
}, R(e.spec.title), 5)]),
|
|
3547
|
+
i.value ? (M(), x("div", {
|
|
3568
3548
|
key: 0,
|
|
3569
3549
|
class: "chat-msg-prose px-4 pb-4 pt-2 text-[14px] leading-relaxed",
|
|
3570
|
-
style:
|
|
3550
|
+
style: j({ color: c.value }),
|
|
3571
3551
|
innerHTML: i.value
|
|
3572
|
-
}, null, 12,
|
|
3573
|
-
e.spec.actions?.length ? (
|
|
3552
|
+
}, null, 12, Sr)) : b("", !0),
|
|
3553
|
+
e.spec.actions?.length ? (M(), x("div", {
|
|
3574
3554
|
key: 1,
|
|
3575
3555
|
class: "flex flex-wrap items-center gap-2 px-3 py-2.5",
|
|
3576
|
-
style:
|
|
3577
|
-
}, [(
|
|
3556
|
+
style: j({ borderTop: `1px solid ${o.value}` })
|
|
3557
|
+
}, [(M(!0), x(m, null, F(e.spec.actions, (e) => (M(), x("button", {
|
|
3578
3558
|
key: e.label,
|
|
3579
3559
|
type: "button",
|
|
3580
3560
|
"data-test": "chat-card-action",
|
|
3581
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",
|
|
3582
|
-
style:
|
|
3562
|
+
style: j(actionStyle(e.style)),
|
|
3583
3563
|
onClick: (t) => r("action", e.reply)
|
|
3584
|
-
},
|
|
3585
|
-
], 12,
|
|
3564
|
+
}, R(e.label), 13, Cr))), 128))], 4)) : b("", !0)
|
|
3565
|
+
], 12, br));
|
|
3586
3566
|
}
|
|
3587
|
-
}),
|
|
3567
|
+
}), Tr = 112, Er = 52, Dr = 14, Or = 54, kr = 34, Ar = 260;
|
|
3588
3568
|
function nodeWidthFor(e) {
|
|
3589
3569
|
let { orientation: t, maxRows: n, maxWidth: r } = e;
|
|
3590
|
-
if (t === "horizontal" || !r) return
|
|
3591
|
-
let i = r -
|
|
3592
|
-
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)));
|
|
3593
3573
|
}
|
|
3594
3574
|
function orientationFor(e) {
|
|
3595
3575
|
return e.layout === "left-to-right" || e.layout === "radial" ? "horizontal" : e.layout === "top-to-bottom" ? "vertical" : e.diagramType === "sequence" ? "horizontal" : "vertical";
|
|
@@ -3626,11 +3606,11 @@ function buildLayout(e, t, n) {
|
|
|
3626
3606
|
orientation: t,
|
|
3627
3607
|
maxRows: o,
|
|
3628
3608
|
...n === void 0 ? {} : { maxWidth: n }
|
|
3629
|
-
}), 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 = [];
|
|
3630
3610
|
for (let [e, [, n]] of a.entries()) {
|
|
3631
|
-
let r = (o - n.length) * (t === "horizontal" ? 86 : c +
|
|
3611
|
+
let r = (o - n.length) * (t === "horizontal" ? 86 : c + Or) / 2;
|
|
3632
3612
|
for (let [i, a] of n.entries()) {
|
|
3633
|
-
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;
|
|
3634
3614
|
p.push({
|
|
3635
3615
|
id: a.id,
|
|
3636
3616
|
label: a.label,
|
|
@@ -3639,7 +3619,7 @@ function buildLayout(e, t, n) {
|
|
|
3639
3619
|
x: n,
|
|
3640
3620
|
y: o,
|
|
3641
3621
|
width: c,
|
|
3642
|
-
height:
|
|
3622
|
+
height: Er
|
|
3643
3623
|
});
|
|
3644
3624
|
}
|
|
3645
3625
|
}
|
|
@@ -3669,7 +3649,7 @@ function buildLayout(e, t, n) {
|
|
|
3669
3649
|
};
|
|
3670
3650
|
}
|
|
3671
3651
|
//#endregion
|
|
3672
|
-
//#region
|
|
3652
|
+
//#region bot/ui/chat-visual-format.ts
|
|
3673
3653
|
function formatChatVisualValue(e) {
|
|
3674
3654
|
let { value: t } = e, n = Math.abs(t);
|
|
3675
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);
|
|
@@ -3716,14 +3696,14 @@ function formatChatVisualTick(e) {
|
|
|
3716
3696
|
let { prefix: r, suffix: i } = affixes(n);
|
|
3717
3697
|
return `${r}${formatChatVisualValue({ value: t })}${i}`;
|
|
3718
3698
|
}
|
|
3719
|
-
var
|
|
3699
|
+
var jr = 5.4, Mr = 10, Nr = 15, Pr = 16;
|
|
3720
3700
|
function planChatVisualXLabels(e) {
|
|
3721
3701
|
let { labels: t, plotWidth: n } = e;
|
|
3722
3702
|
if (!t.length || n <= 0) return {
|
|
3723
3703
|
mode: "horizontal",
|
|
3724
3704
|
entries: []
|
|
3725
3705
|
};
|
|
3726
|
-
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;
|
|
3727
3707
|
if (i === 0) return {
|
|
3728
3708
|
mode: "horizontal",
|
|
3729
3709
|
entries: [{
|
|
@@ -3731,14 +3711,14 @@ function planChatVisualXLabels(e) {
|
|
|
3731
3711
|
text: r[0]
|
|
3732
3712
|
}]
|
|
3733
3713
|
};
|
|
3734
|
-
if ((Math.max(...r.map((e) => e.length *
|
|
3714
|
+
if ((Math.max(...r.map((e) => e.length * jr)) + Mr) * t.length <= n) return {
|
|
3735
3715
|
mode: "horizontal",
|
|
3736
3716
|
entries: r.map((e, t) => ({
|
|
3737
3717
|
index: t,
|
|
3738
3718
|
text: e
|
|
3739
3719
|
}))
|
|
3740
3720
|
};
|
|
3741
|
-
let a = Math.max(2, Math.floor(n /
|
|
3721
|
+
let a = Math.max(2, Math.floor(n / Nr));
|
|
3742
3722
|
if (t.length <= a) return {
|
|
3743
3723
|
mode: "angled",
|
|
3744
3724
|
entries: r.map((e, t) => ({
|
|
@@ -3757,23 +3737,23 @@ function planChatVisualXLabels(e) {
|
|
|
3757
3737
|
};
|
|
3758
3738
|
}
|
|
3759
3739
|
//#endregion
|
|
3760
|
-
//#region
|
|
3761
|
-
var
|
|
3740
|
+
//#region bot/ui/ChatVisualBlock.vue?vue&type=script&setup=true&lang.ts
|
|
3741
|
+
var Fr = [
|
|
3762
3742
|
"data-visual-type",
|
|
3763
3743
|
"data-chart-type",
|
|
3764
3744
|
"data-stacking",
|
|
3765
3745
|
"data-diagram-type",
|
|
3766
3746
|
"aria-label"
|
|
3767
|
-
],
|
|
3747
|
+
], Ir = { class: "mb-2.5" }, Lr = ["aria-label"], Rr = {
|
|
3768
3748
|
key: 0,
|
|
3769
3749
|
"data-test": "chat-visual-horizontal-bars",
|
|
3770
3750
|
class: "grid gap-3"
|
|
3771
|
-
},
|
|
3751
|
+
}, zr = { class: "mb-1 flex items-start justify-between gap-3 text-[12px]" }, Br = ["viewBox"], Vr = [
|
|
3772
3752
|
"x1",
|
|
3773
3753
|
"x2",
|
|
3774
3754
|
"y1",
|
|
3775
3755
|
"y2"
|
|
3776
|
-
],
|
|
3756
|
+
], Hr = ["x", "y"], Ur = [
|
|
3777
3757
|
"data-row-index",
|
|
3778
3758
|
"data-series-index",
|
|
3779
3759
|
"data-data-key",
|
|
@@ -3781,56 +3761,56 @@ var Lr = [
|
|
|
3781
3761
|
"y",
|
|
3782
3762
|
"width",
|
|
3783
3763
|
"height"
|
|
3784
|
-
],
|
|
3764
|
+
], Wr = ["data-trend-key", "d"], Gr = ["d"], Kr = ["cx", "cy"], qr = ["cx", "cy"], Jr = [
|
|
3785
3765
|
"x",
|
|
3786
3766
|
"y",
|
|
3787
3767
|
"text-anchor",
|
|
3788
3768
|
"transform"
|
|
3789
|
-
],
|
|
3769
|
+
], Yr = {
|
|
3790
3770
|
key: 2,
|
|
3791
3771
|
class: "mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5"
|
|
3792
|
-
},
|
|
3772
|
+
}, Xr = {
|
|
3793
3773
|
key: 1,
|
|
3794
3774
|
class: "grid gap-3"
|
|
3795
|
-
},
|
|
3775
|
+
}, Zr = { class: "mb-1 flex items-baseline justify-between gap-3 text-[12px]" }, Qr = { class: "shrink-0 tabular-nums" }, $r = {
|
|
3796
3776
|
key: 2,
|
|
3797
3777
|
class: "overflow-x-auto"
|
|
3798
|
-
},
|
|
3778
|
+
}, ei = ["viewBox", "aria-label"], ti = [
|
|
3799
3779
|
"data-from",
|
|
3800
3780
|
"data-to",
|
|
3801
3781
|
"x1",
|
|
3802
3782
|
"y1",
|
|
3803
3783
|
"x2",
|
|
3804
3784
|
"y2"
|
|
3805
|
-
],
|
|
3785
|
+
], ni = ["cx", "cy"], ri = ["x", "y"], ii = [
|
|
3806
3786
|
"data-node-id",
|
|
3807
3787
|
"data-node-kind",
|
|
3808
3788
|
"transform"
|
|
3809
|
-
],
|
|
3789
|
+
], ai = ["points"], oi = ["width", "height"], si = ["width", "height"], ci = {
|
|
3810
3790
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
3811
3791
|
class: "flex h-full min-w-0 flex-col items-center justify-center text-center"
|
|
3812
|
-
},
|
|
3792
|
+
}, li = /* @__PURE__ */ k({
|
|
3813
3793
|
__name: "ChatVisualBlock",
|
|
3814
3794
|
props: {
|
|
3815
3795
|
result: {},
|
|
3816
3796
|
inverted: { type: Boolean }
|
|
3817
3797
|
},
|
|
3818
3798
|
setup(e) {
|
|
3819
|
-
let t = e, n =
|
|
3820
|
-
|
|
3799
|
+
let t = e, n = P(), r = I(360), i;
|
|
3800
|
+
re(() => {
|
|
3821
3801
|
typeof ResizeObserver > "u" || !n.value || (i = new ResizeObserver((e) => {
|
|
3822
3802
|
let t = e[0]?.contentRect.width;
|
|
3823
3803
|
t && (r.value = Math.round(t));
|
|
3824
3804
|
}), i.observe(n.value));
|
|
3825
|
-
}),
|
|
3826
|
-
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);
|
|
3827
3807
|
function isCartesianChart(e) {
|
|
3828
3808
|
return e?.chartType === "bar" || e?.chartType === "line" || e?.chartType === "scatter";
|
|
3829
3809
|
}
|
|
3830
3810
|
function isPieChart(e) {
|
|
3831
3811
|
return e?.chartType === "pie";
|
|
3832
3812
|
}
|
|
3833
|
-
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");
|
|
3834
3814
|
function numericValue(e) {
|
|
3835
3815
|
return typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
3836
3816
|
}
|
|
@@ -3862,7 +3842,7 @@ var Lr = [
|
|
|
3862
3842
|
intercept: (r - s * n) / t
|
|
3863
3843
|
};
|
|
3864
3844
|
}
|
|
3865
|
-
let
|
|
3845
|
+
let C = _(() => {
|
|
3866
3846
|
let e = [], t = f.value;
|
|
3867
3847
|
if (!t) return e;
|
|
3868
3848
|
if (t.chartType === "bar" && t.stacking === "stacked") for (let n of t.data) {
|
|
@@ -3892,8 +3872,8 @@ var Lr = [
|
|
|
3892
3872
|
let n = e > 0 ? e : 1, r = Math.floor(Math.log10(n)), i = n / 10 ** r, a;
|
|
3893
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;
|
|
3894
3874
|
}
|
|
3895
|
-
let
|
|
3896
|
-
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;
|
|
3897
3877
|
if (n === t) return {
|
|
3898
3878
|
min: 0,
|
|
3899
3879
|
max: t || 1,
|
|
@@ -3906,7 +3886,7 @@ var Lr = [
|
|
|
3906
3886
|
max: a,
|
|
3907
3887
|
ticks: o
|
|
3908
3888
|
};
|
|
3909
|
-
}),
|
|
3889
|
+
}), k = _(() => resolveSharedSeriesFormat({ series: p.value })), te = _(() => {
|
|
3910
3890
|
let e = f.value;
|
|
3911
3891
|
if (!e) return {
|
|
3912
3892
|
mode: "horizontal",
|
|
@@ -3917,8 +3897,8 @@ var Lr = [
|
|
|
3917
3897
|
labels: e.data.map((e) => String(e?.[t] ?? "")),
|
|
3918
3898
|
plotWidth: Math.max(200, a.value - 42)
|
|
3919
3899
|
});
|
|
3920
|
-
}), A =
|
|
3921
|
-
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";
|
|
3922
3902
|
return {
|
|
3923
3903
|
width: a.value,
|
|
3924
3904
|
height: 168 + (r ? 36 : 0),
|
|
@@ -3941,7 +3921,7 @@ var Lr = [
|
|
|
3941
3921
|
return t <= 1 ? n.left + r / 2 : n.left + r * e / (t - 1);
|
|
3942
3922
|
}
|
|
3943
3923
|
function yForValue(e) {
|
|
3944
|
-
let { min: t, max: n } =
|
|
3924
|
+
let { min: t, max: n } = T.value, r = A.value, i = r.height - r.top - r.bottom;
|
|
3945
3925
|
return r.top + (n - e) / (n - t || 1) * i;
|
|
3946
3926
|
}
|
|
3947
3927
|
function pathForSeries(e) {
|
|
@@ -3951,7 +3931,7 @@ var Lr = [
|
|
|
3951
3931
|
return `${r === 0 ? "M" : "L"} ${xForIndex(r, t.data.length).toFixed(1)} ${yForValue(i).toFixed(1)}`;
|
|
3952
3932
|
}).join(" ") : "";
|
|
3953
3933
|
}
|
|
3954
|
-
let
|
|
3934
|
+
let ie = _(() => {
|
|
3955
3935
|
let e = f.value;
|
|
3956
3936
|
if (!e?.trendLine || e.chartType !== "line" && e.chartType !== "scatter") return null;
|
|
3957
3937
|
let t = trendLinePoints(e, e.trendLine.dataKey), n = linearTrend(t);
|
|
@@ -3962,11 +3942,11 @@ var Lr = [
|
|
|
3962
3942
|
dataKey: e.trendLine.dataKey,
|
|
3963
3943
|
seriesIndex: s
|
|
3964
3944
|
};
|
|
3965
|
-
}),
|
|
3945
|
+
}), ae = _(() => {
|
|
3966
3946
|
let e = f.value;
|
|
3967
3947
|
if (!e || e.chartType !== "bar") return [];
|
|
3968
3948
|
let t = A.value, n = (t.width - t.left - t.right) / Math.max(e.data.length, 1), r = yForValue(0);
|
|
3969
|
-
if (
|
|
3949
|
+
if (v.value) {
|
|
3970
3950
|
let r = Math.max(4, Math.min(24, n * .42));
|
|
3971
3951
|
return e.data.flatMap((i, a) => {
|
|
3972
3952
|
let o = 0, s = 0, c = t.left + a * n + (n - r) / 2;
|
|
@@ -3999,12 +3979,12 @@ var Lr = [
|
|
|
3999
3979
|
dataKey: e.dataKey
|
|
4000
3980
|
};
|
|
4001
3981
|
}));
|
|
4002
|
-
}),
|
|
3982
|
+
}), oe = _(() => {
|
|
4003
3983
|
let e = f.value;
|
|
4004
3984
|
if (!e) return [];
|
|
4005
3985
|
let t = e.data;
|
|
4006
3986
|
if (!t.length) return [];
|
|
4007
|
-
let n = t.length - 1, r =
|
|
3987
|
+
let n = t.length - 1, r = te.value, i = r.mode === "angled";
|
|
4008
3988
|
return r.entries.map(({ index: e, text: r }) => ({
|
|
4009
3989
|
key: `${e}`,
|
|
4010
3990
|
label: r,
|
|
@@ -4012,9 +3992,9 @@ var Lr = [
|
|
|
4012
3992
|
anchor: i ? "end" : e === 0 ? "start" : e === n ? "end" : "middle",
|
|
4013
3993
|
angled: i
|
|
4014
3994
|
})).filter((e) => e.label);
|
|
4015
|
-
}),
|
|
3995
|
+
}), se = _(() => {
|
|
4016
3996
|
let e = f.value;
|
|
4017
|
-
if (!e || e.chartType !== "bar" || e.series.length !== 1 ||
|
|
3997
|
+
if (!e || e.chartType !== "bar" || e.series.length !== 1 || v.value) return [];
|
|
4018
3998
|
let t = e.series[0], n = e.data.map((n, r) => {
|
|
4019
3999
|
let i = categoryLabel(n, e.xKey), a = numericValue(n[t.dataKey]);
|
|
4020
4000
|
return !i || a === null ? null : {
|
|
@@ -4035,7 +4015,7 @@ var Lr = [
|
|
|
4035
4015
|
width: e.rawValue <= 0 ? 0 : Math.max(2, e.rawValue / r * 100),
|
|
4036
4016
|
seriesIndex: 0
|
|
4037
4017
|
}));
|
|
4038
|
-
}),
|
|
4018
|
+
}), ce = _(() => {
|
|
4039
4019
|
let e = f.value;
|
|
4040
4020
|
if (!e?.data.length) return [];
|
|
4041
4021
|
let t = e.data[e.data.length - 1];
|
|
@@ -4051,7 +4031,7 @@ var Lr = [
|
|
|
4051
4031
|
seriesIndex: n
|
|
4052
4032
|
};
|
|
4053
4033
|
});
|
|
4054
|
-
}),
|
|
4034
|
+
}), ue = _(() => {
|
|
4055
4035
|
let e = f.value;
|
|
4056
4036
|
if (!e?.data.length || e.chartType !== "line") return [];
|
|
4057
4037
|
let t = e.data.length - 1, n = e.data[t];
|
|
@@ -4064,8 +4044,8 @@ var Lr = [
|
|
|
4064
4044
|
seriesIndex: i
|
|
4065
4045
|
};
|
|
4066
4046
|
}).filter((e) => e !== null);
|
|
4067
|
-
}),
|
|
4068
|
-
let e =
|
|
4047
|
+
}), de = _(() => {
|
|
4048
|
+
let e = h.value;
|
|
4069
4049
|
if (!e) return [];
|
|
4070
4050
|
let t = e.data.map((t) => ({
|
|
4071
4051
|
name: String(t[e.nameKey] ?? ""),
|
|
@@ -4080,83 +4060,83 @@ var Lr = [
|
|
|
4080
4060
|
series: r
|
|
4081
4061
|
})
|
|
4082
4062
|
}));
|
|
4083
|
-
}),
|
|
4063
|
+
}), pe = _(() => c.value ? layoutChatDiagram(c.value, { maxWidth: r.value }) : null), he = [
|
|
4084
4064
|
"var(--color-theme-900)",
|
|
4085
4065
|
"var(--color-primary-500)",
|
|
4086
4066
|
"color-mix(in oklch, var(--color-primary-500) 55%, var(--color-theme-500))"
|
|
4087
|
-
],
|
|
4067
|
+
], _e = [
|
|
4088
4068
|
"rgba(255, 255, 255, 0.92)",
|
|
4089
4069
|
"color-mix(in oklch, white 30%, var(--color-primary-500))",
|
|
4090
4070
|
"rgba(255, 255, 255, 0.55)"
|
|
4091
4071
|
];
|
|
4092
4072
|
function seriesColor(e) {
|
|
4093
|
-
let n = t.inverted ?
|
|
4073
|
+
let n = t.inverted ? _e : he;
|
|
4094
4074
|
return n[e % n.length];
|
|
4095
4075
|
}
|
|
4096
4076
|
function diagramNodeFill(e) {
|
|
4097
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)";
|
|
4098
4078
|
}
|
|
4099
4079
|
function diagramNodeStroke(e) {
|
|
4100
|
-
return t.inverted ? "rgba(255, 255, 255, 0.22)" :
|
|
4080
|
+
return t.inverted ? "rgba(255, 255, 255, 0.22)" : W.value;
|
|
4101
4081
|
}
|
|
4102
|
-
let
|
|
4103
|
-
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", {
|
|
4104
4084
|
key: 0,
|
|
4105
4085
|
"data-test": "chat-visual",
|
|
4106
4086
|
"data-visual-type": o.value.visualType,
|
|
4107
4087
|
"data-chart-type": s.value?.chartType,
|
|
4108
|
-
"data-stacking":
|
|
4088
|
+
"data-stacking": v.value ? "stacked" : void 0,
|
|
4109
4089
|
"data-diagram-type": c.value?.diagramType,
|
|
4110
4090
|
class: "my-6 w-full rounded-[20px] px-4 pb-3.5 pt-4",
|
|
4111
|
-
style:
|
|
4112
|
-
background:
|
|
4113
|
-
boxShadow: `inset 0 0 0 1px ${
|
|
4091
|
+
style: j({
|
|
4092
|
+
background: Se.value,
|
|
4093
|
+
boxShadow: `inset 0 0 0 1px ${G.value}`
|
|
4114
4094
|
}),
|
|
4115
4095
|
"aria-label": o.value.meta.title
|
|
4116
4096
|
}, [
|
|
4117
|
-
S("header",
|
|
4097
|
+
S("header", Ir, [S("h4", {
|
|
4118
4098
|
class: "text-[13px] font-semibold leading-tight",
|
|
4119
|
-
style:
|
|
4120
|
-
},
|
|
4099
|
+
style: j({ color: ve.value })
|
|
4100
|
+
}, R(o.value.meta.title), 5), o.value.meta.description ? (M(), x("p", {
|
|
4121
4101
|
key: 0,
|
|
4122
4102
|
class: "mt-0.5 text-[12px] leading-snug",
|
|
4123
|
-
style:
|
|
4124
|
-
},
|
|
4103
|
+
style: j({ color: ye.value })
|
|
4104
|
+
}, R(o.value.meta.description), 5)) : b("", !0)]),
|
|
4125
4105
|
S("div", {
|
|
4126
4106
|
ref_key: "bodyEl",
|
|
4127
4107
|
ref: n
|
|
4128
|
-
}, [f.value ? (
|
|
4108
|
+
}, [f.value ? (M(), x("div", {
|
|
4129
4109
|
key: 0,
|
|
4130
4110
|
role: "img",
|
|
4131
4111
|
"aria-label": o.value.meta.title
|
|
4132
|
-
}, [
|
|
4112
|
+
}, [se.value.length ? (M(), x("div", Rr, [(M(!0), x(m, null, F(se.value, (e) => (M(), x("div", {
|
|
4133
4113
|
key: e.key,
|
|
4134
4114
|
"data-test": "chat-visual-horizontal-bar",
|
|
4135
4115
|
class: "min-w-0"
|
|
4136
|
-
}, [S("div",
|
|
4116
|
+
}, [S("div", zr, [S("span", {
|
|
4137
4117
|
class: "line-clamp-2 min-w-0 font-medium leading-snug",
|
|
4138
|
-
style:
|
|
4139
|
-
},
|
|
4118
|
+
style: j({ color: ve.value })
|
|
4119
|
+
}, R(e.label), 5), S("span", {
|
|
4140
4120
|
class: "shrink-0 font-semibold tabular-nums",
|
|
4141
|
-
style:
|
|
4142
|
-
},
|
|
4121
|
+
style: j({ color: ve.value })
|
|
4122
|
+
}, R(e.value), 5)]), S("div", {
|
|
4143
4123
|
class: "h-2 w-full overflow-hidden rounded-full",
|
|
4144
|
-
style:
|
|
4124
|
+
style: j({ background: we.value })
|
|
4145
4125
|
}, [S("div", {
|
|
4146
4126
|
class: "h-full rounded-full",
|
|
4147
|
-
style:
|
|
4127
|
+
style: j({
|
|
4148
4128
|
width: `${e.width}%`,
|
|
4149
4129
|
background: seriesColor(e.seriesIndex)
|
|
4150
4130
|
})
|
|
4151
|
-
}, null, 4)], 4)]))), 128))])) : (
|
|
4131
|
+
}, null, 4)], 4)]))), 128))])) : (M(), x("svg", {
|
|
4152
4132
|
key: 1,
|
|
4153
4133
|
class: "block h-auto w-full overflow-visible",
|
|
4154
4134
|
viewBox: `0 0 ${A.value.width} ${A.value.height}`,
|
|
4155
|
-
style:
|
|
4135
|
+
style: j({ aspectRatio: `${A.value.width} / ${A.value.height}` }),
|
|
4156
4136
|
preserveAspectRatio: "xMidYMid meet",
|
|
4157
4137
|
"aria-hidden": "true"
|
|
4158
4138
|
}, [
|
|
4159
|
-
(
|
|
4139
|
+
(M(!0), x(m, null, F(T.value.ticks, (e) => (M(), x("line", {
|
|
4160
4140
|
key: `grid-${e}`,
|
|
4161
4141
|
x1: A.value.left,
|
|
4162
4142
|
x2: A.value.width - A.value.right,
|
|
@@ -4164,20 +4144,20 @@ var Lr = [
|
|
|
4164
4144
|
y2: yForValue(e),
|
|
4165
4145
|
"stroke-width": "1",
|
|
4166
4146
|
"vector-effect": "non-scaling-stroke",
|
|
4167
|
-
style:
|
|
4168
|
-
}, null, 12,
|
|
4169
|
-
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", {
|
|
4170
4150
|
key: `y-${e}`,
|
|
4171
4151
|
x: A.value.left - 7,
|
|
4172
4152
|
y: yForValue(e) + 3,
|
|
4173
4153
|
"text-anchor": "end",
|
|
4174
4154
|
"font-size": "9.5",
|
|
4175
|
-
style:
|
|
4176
|
-
},
|
|
4155
|
+
style: j({ fill: H.value })
|
|
4156
|
+
}, R(B(formatChatVisualTick)({
|
|
4177
4157
|
value: e,
|
|
4178
|
-
shared:
|
|
4179
|
-
})), 13,
|
|
4180
|
-
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", {
|
|
4181
4161
|
key: e.key,
|
|
4182
4162
|
"data-test": "chat-visual-bar",
|
|
4183
4163
|
"data-row-index": e.rowIndex,
|
|
@@ -4188,22 +4168,22 @@ var Lr = [
|
|
|
4188
4168
|
width: e.width,
|
|
4189
4169
|
height: e.height,
|
|
4190
4170
|
rx: "2.5",
|
|
4191
|
-
style:
|
|
4192
|
-
}, null, 12,
|
|
4193
|
-
|
|
4171
|
+
style: j({ fill: seriesColor(e.seriesIndex) })
|
|
4172
|
+
}, null, 12, Ur))), 128)) : (M(), x(m, { key: 1 }, [
|
|
4173
|
+
ie.value ? (M(), x("path", {
|
|
4194
4174
|
key: 0,
|
|
4195
4175
|
"data-test": "chat-visual-trend-line",
|
|
4196
|
-
"data-trend-key":
|
|
4197
|
-
d:
|
|
4176
|
+
"data-trend-key": ie.value.dataKey,
|
|
4177
|
+
d: ie.value.path,
|
|
4198
4178
|
fill: "none",
|
|
4199
4179
|
"stroke-width": "1.4",
|
|
4200
4180
|
"stroke-linecap": "round",
|
|
4201
4181
|
"stroke-linejoin": "round",
|
|
4202
4182
|
"stroke-dasharray": "4 3",
|
|
4203
4183
|
"vector-effect": "non-scaling-stroke",
|
|
4204
|
-
style:
|
|
4205
|
-
}, null, 12,
|
|
4206
|
-
(
|
|
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", {
|
|
4207
4187
|
key: 0,
|
|
4208
4188
|
d: pathForSeries(e.dataKey),
|
|
4209
4189
|
fill: "none",
|
|
@@ -4211,74 +4191,74 @@ var Lr = [
|
|
|
4211
4191
|
"stroke-linecap": "round",
|
|
4212
4192
|
"stroke-linejoin": "round",
|
|
4213
4193
|
"vector-effect": "non-scaling-stroke",
|
|
4214
|
-
style:
|
|
4215
|
-
}, 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", {
|
|
4216
4196
|
key: 0,
|
|
4217
4197
|
cx: xForIndex(r, u.value.length),
|
|
4218
4198
|
cy: yForValue(numericValue(n[e.dataKey]) ?? 0),
|
|
4219
4199
|
r: "2.6",
|
|
4220
|
-
style:
|
|
4221
|
-
}, null, 12,
|
|
4222
|
-
(
|
|
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", {
|
|
4223
4203
|
key: `marker-${e.key}`,
|
|
4224
4204
|
cx: e.cx,
|
|
4225
4205
|
cy: e.cy,
|
|
4226
4206
|
r: "3",
|
|
4227
|
-
style:
|
|
4228
|
-
}, null, 12,
|
|
4207
|
+
style: j({ fill: seriesColor(e.seriesIndex) })
|
|
4208
|
+
}, null, 12, qr))), 128))
|
|
4229
4209
|
], 64)),
|
|
4230
|
-
(
|
|
4210
|
+
(M(!0), x(m, null, F(oe.value, (e) => (M(), x("text", {
|
|
4231
4211
|
key: e.key,
|
|
4232
4212
|
x: e.x,
|
|
4233
4213
|
y: e.angled ? A.value.height - A.value.bottom + 12 : A.value.height - 6,
|
|
4234
4214
|
"text-anchor": e.anchor,
|
|
4235
4215
|
"font-size": "9.5",
|
|
4236
|
-
transform: e.angled ? `rotate(${
|
|
4237
|
-
style:
|
|
4238
|
-
},
|
|
4239
|
-
], 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", {
|
|
4240
4220
|
key: e.key,
|
|
4241
4221
|
class: "inline-flex items-center gap-1.5 text-[11.5px] leading-none"
|
|
4242
4222
|
}, [
|
|
4243
4223
|
S("span", {
|
|
4244
4224
|
class: "size-2.5 shrink-0 rounded-full",
|
|
4245
|
-
style:
|
|
4225
|
+
style: j({ background: seriesColor(e.seriesIndex) })
|
|
4246
4226
|
}, null, 4),
|
|
4247
|
-
S("span", { style:
|
|
4227
|
+
S("span", { style: j({ color: ye.value }) }, R(e.label), 5),
|
|
4248
4228
|
S("span", {
|
|
4249
4229
|
class: "font-semibold tabular-nums",
|
|
4250
|
-
style:
|
|
4251
|
-
},
|
|
4252
|
-
]))), 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", {
|
|
4253
4233
|
class: "truncate font-medium",
|
|
4254
|
-
style:
|
|
4255
|
-
},
|
|
4234
|
+
style: j({ color: ve.value })
|
|
4235
|
+
}, R(e.name), 5), S("span", Qr, [S("span", {
|
|
4256
4236
|
class: "font-semibold",
|
|
4257
|
-
style:
|
|
4258
|
-
},
|
|
4237
|
+
style: j({ color: ve.value })
|
|
4238
|
+
}, R(e.display), 5), S("span", {
|
|
4259
4239
|
class: "ml-1.5",
|
|
4260
|
-
style:
|
|
4261
|
-
},
|
|
4240
|
+
style: j({ color: ye.value })
|
|
4241
|
+
}, R(Math.round(e.percent * 100)) + "%", 5)])]), S("div", {
|
|
4262
4242
|
class: "h-1.5 w-full overflow-hidden rounded-full",
|
|
4263
|
-
style:
|
|
4243
|
+
style: j({ background: we.value })
|
|
4264
4244
|
}, [S("div", {
|
|
4265
4245
|
class: "h-full rounded-full",
|
|
4266
|
-
style:
|
|
4246
|
+
style: j({
|
|
4267
4247
|
width: `${Math.max(2, e.percent * 100)}%`,
|
|
4268
4248
|
background: seriesColor(t)
|
|
4269
4249
|
})
|
|
4270
|
-
}, null, 4)], 4)]))), 128))])) : c.value &&
|
|
4250
|
+
}, null, 4)], 4)]))), 128))])) : c.value && pe.value ? (M(), x("div", $r, [(M(), x("svg", {
|
|
4271
4251
|
"data-test": "chat-visual-diagram-svg",
|
|
4272
4252
|
class: "block h-auto overflow-visible",
|
|
4273
|
-
viewBox: `0 0 ${
|
|
4274
|
-
style:
|
|
4275
|
-
width: `${
|
|
4276
|
-
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}`
|
|
4277
4257
|
}),
|
|
4278
4258
|
role: "img",
|
|
4279
4259
|
"aria-label": o.value.meta.title
|
|
4280
4260
|
}, [
|
|
4281
|
-
(
|
|
4261
|
+
(M(!0), x(m, null, F(pe.value.edges, (e) => (M(), x("line", {
|
|
4282
4262
|
key: e.key,
|
|
4283
4263
|
"data-test": "chat-visual-diagram-edge",
|
|
4284
4264
|
"data-from": e.from,
|
|
@@ -4290,16 +4270,16 @@ var Lr = [
|
|
|
4290
4270
|
"stroke-width": "1.4",
|
|
4291
4271
|
"stroke-linecap": "round",
|
|
4292
4272
|
"vector-effect": "non-scaling-stroke",
|
|
4293
|
-
style:
|
|
4294
|
-
}, null, 12,
|
|
4295
|
-
(
|
|
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", {
|
|
4296
4276
|
key: `${e.key}-dot`,
|
|
4297
4277
|
cx: e.x2,
|
|
4298
4278
|
cy: e.y2,
|
|
4299
4279
|
r: "2.4",
|
|
4300
|
-
style:
|
|
4301
|
-
}, null, 12,
|
|
4302
|
-
(
|
|
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", {
|
|
4303
4283
|
key: `${e.key}-label`,
|
|
4304
4284
|
x: e.labelX - 55,
|
|
4305
4285
|
y: e.labelY - 12,
|
|
@@ -4308,59 +4288,59 @@ var Lr = [
|
|
|
4308
4288
|
}, [S("div", {
|
|
4309
4289
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
4310
4290
|
class: "flex h-full items-center justify-center px-1 text-center text-[10.5px] font-medium leading-none",
|
|
4311
|
-
style:
|
|
4312
|
-
color:
|
|
4291
|
+
style: j({
|
|
4292
|
+
color: ye.value,
|
|
4313
4293
|
background: t.inverted ? "var(--color-theme-900)" : "var(--color-theme-0)"
|
|
4314
4294
|
})
|
|
4315
|
-
},
|
|
4316
|
-
(
|
|
4295
|
+
}, R(e.label), 5)], 8, ri))), 128)),
|
|
4296
|
+
(M(!0), x(m, null, F(pe.value.nodes, (e) => (M(), x("g", {
|
|
4317
4297
|
key: e.id,
|
|
4318
4298
|
"data-test": "chat-visual-diagram-node",
|
|
4319
4299
|
"data-node-id": e.id,
|
|
4320
4300
|
"data-node-kind": e.kind,
|
|
4321
4301
|
transform: `translate(${e.x} ${e.y})`
|
|
4322
|
-
}, [e.kind === "decision" ? (
|
|
4302
|
+
}, [e.kind === "decision" ? (M(), x("polygon", {
|
|
4323
4303
|
key: 0,
|
|
4324
4304
|
points: `${e.width / 2},0 ${e.width},${e.height / 2} ${e.width / 2},${e.height} 0,${e.height / 2}`,
|
|
4325
4305
|
"stroke-width": "1",
|
|
4326
4306
|
"vector-effect": "non-scaling-stroke",
|
|
4327
|
-
style:
|
|
4307
|
+
style: j({
|
|
4328
4308
|
fill: diagramNodeFill(e.kind),
|
|
4329
4309
|
stroke: diagramNodeStroke(e.kind)
|
|
4330
4310
|
})
|
|
4331
|
-
}, null, 12,
|
|
4311
|
+
}, null, 12, ai)) : (M(), x("rect", {
|
|
4332
4312
|
key: 1,
|
|
4333
4313
|
width: e.width,
|
|
4334
4314
|
height: e.height,
|
|
4335
4315
|
rx: "9",
|
|
4336
4316
|
"stroke-width": "1",
|
|
4337
4317
|
"vector-effect": "non-scaling-stroke",
|
|
4338
|
-
style:
|
|
4318
|
+
style: j({
|
|
4339
4319
|
fill: diagramNodeFill(e.kind),
|
|
4340
4320
|
stroke: diagramNodeStroke(e.kind)
|
|
4341
4321
|
})
|
|
4342
|
-
}, null, 12,
|
|
4322
|
+
}, null, 12, oi)), (M(), x("foreignObject", {
|
|
4343
4323
|
x: "8",
|
|
4344
4324
|
y: "5",
|
|
4345
4325
|
width: e.width - 16,
|
|
4346
4326
|
height: e.height - 10
|
|
4347
|
-
}, [S("div",
|
|
4327
|
+
}, [S("div", ci, [S("div", {
|
|
4348
4328
|
class: "line-clamp-2 text-[13px] font-medium leading-snug",
|
|
4349
|
-
style:
|
|
4350
|
-
},
|
|
4329
|
+
style: j({ color: ve.value })
|
|
4330
|
+
}, R(e.label), 5), e.detail ? (M(), x("div", {
|
|
4351
4331
|
key: 0,
|
|
4352
4332
|
class: "mt-0.5 line-clamp-1 text-[10.5px] leading-none",
|
|
4353
|
-
style:
|
|
4354
|
-
},
|
|
4355
|
-
], 12,
|
|
4356
|
-
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", {
|
|
4357
4337
|
key: 0,
|
|
4358
4338
|
class: "mt-3 text-[11px] leading-snug",
|
|
4359
|
-
style:
|
|
4360
|
-
},
|
|
4361
|
-
], 12,
|
|
4339
|
+
style: j({ color: H.value })
|
|
4340
|
+
}, R(o.value.meta.footer), 5)) : b("", !0)
|
|
4341
|
+
], 12, Fr)) : b("", !0);
|
|
4362
4342
|
}
|
|
4363
|
-
}),
|
|
4343
|
+
}), ui = ["innerHTML"], di = /* @__PURE__ */ k({
|
|
4364
4344
|
__name: "ChatRichText",
|
|
4365
4345
|
props: {
|
|
4366
4346
|
text: {},
|
|
@@ -4369,8 +4349,8 @@ var Lr = [
|
|
|
4369
4349
|
},
|
|
4370
4350
|
emits: ["action"],
|
|
4371
4351
|
setup(e, { emit: t }) {
|
|
4372
|
-
let n = e, r = t, i =
|
|
4373
|
-
|
|
4352
|
+
let n = e, r = t, i = I(n.text), a;
|
|
4353
|
+
ue([() => n.text, () => n.streaming], ([e, t]) => {
|
|
4374
4354
|
if (!t) {
|
|
4375
4355
|
a !== void 0 && (cancelAnimationFrame(a), a = void 0), i.value = e;
|
|
4376
4356
|
return;
|
|
@@ -4378,7 +4358,7 @@ var Lr = [
|
|
|
4378
4358
|
a === void 0 && (a = requestAnimationFrame(() => {
|
|
4379
4359
|
a = void 0, i.value = n.text;
|
|
4380
4360
|
}));
|
|
4381
|
-
}),
|
|
4361
|
+
}), ne(() => {
|
|
4382
4362
|
a !== void 0 && cancelAnimationFrame(a);
|
|
4383
4363
|
});
|
|
4384
4364
|
let o = new g.Renderer();
|
|
@@ -4400,7 +4380,7 @@ var Lr = [
|
|
|
4400
4380
|
function renderMarkdown(e) {
|
|
4401
4381
|
if (!e) return "";
|
|
4402
4382
|
let t = g.parse(e, { async: !1 });
|
|
4403
|
-
return
|
|
4383
|
+
return rn.sanitize(t, {
|
|
4404
4384
|
ADD_ATTR: ["target"],
|
|
4405
4385
|
ADD_DATA_URI_TAGS: ["img"]
|
|
4406
4386
|
});
|
|
@@ -4466,7 +4446,7 @@ var Lr = [
|
|
|
4466
4446
|
});
|
|
4467
4447
|
let n = c[1], s = c[2].trim();
|
|
4468
4448
|
if (n === "pl-card") {
|
|
4469
|
-
let e =
|
|
4449
|
+
let e = f(s);
|
|
4470
4450
|
e.ok ? r.push({
|
|
4471
4451
|
kind: "card",
|
|
4472
4452
|
key: `card-${o}`,
|
|
@@ -4481,7 +4461,7 @@ var Lr = [
|
|
|
4481
4461
|
html: renderMarkdown(`\`\`\`\n${s}\n\`\`\``)
|
|
4482
4462
|
}));
|
|
4483
4463
|
} else {
|
|
4484
|
-
let e =
|
|
4464
|
+
let e = p(s);
|
|
4485
4465
|
if (e.ok) r.push({
|
|
4486
4466
|
kind: "visual",
|
|
4487
4467
|
key: `visual-${o}`,
|
|
@@ -4505,9 +4485,9 @@ var Lr = [
|
|
|
4505
4485
|
}
|
|
4506
4486
|
a = c.index + c[0].length, o += 1, c = i.exec(t);
|
|
4507
4487
|
}
|
|
4508
|
-
let u = t.slice(a),
|
|
4509
|
-
if (
|
|
4510
|
-
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));
|
|
4511
4491
|
return e && r.push({
|
|
4512
4492
|
kind: "markdown",
|
|
4513
4493
|
key: `md-${o}`,
|
|
@@ -4524,35 +4504,35 @@ var Lr = [
|
|
|
4524
4504
|
html: h
|
|
4525
4505
|
}), r;
|
|
4526
4506
|
}
|
|
4527
|
-
let c =
|
|
4507
|
+
let c = _(() => {
|
|
4528
4508
|
let e = i.value;
|
|
4529
4509
|
return e ? richTextSegments({
|
|
4530
4510
|
text: e,
|
|
4531
4511
|
streaming: !!n.streaming
|
|
4532
4512
|
}) : [];
|
|
4533
4513
|
});
|
|
4534
|
-
return (t, n) => (
|
|
4514
|
+
return (t, n) => (M(), x("div", {
|
|
4535
4515
|
class: "chat-msg-rich break-words text-[14px] leading-[1.55] @sm/chat:text-[15px] @sm/chat:leading-[1.5]",
|
|
4536
4516
|
onErrorCapture: onRichTextAssetError
|
|
4537
|
-
}, [(
|
|
4517
|
+
}, [(M(!0), x(m, null, F(c.value, (t) => (M(), x(m, { key: t.key }, [t.kind === "markdown" ? (M(), x("div", {
|
|
4538
4518
|
key: 0,
|
|
4539
|
-
class:
|
|
4519
|
+
class: A(["chat-msg-prose", e.inverted ? "chat-msg-prose-invert" : ""]),
|
|
4540
4520
|
innerHTML: t.html
|
|
4541
|
-
}, null, 10,
|
|
4521
|
+
}, null, 10, ui)) : t.kind === "visual" ? (M(), v(li, {
|
|
4542
4522
|
key: 1,
|
|
4543
4523
|
result: t.result,
|
|
4544
4524
|
inverted: e.inverted
|
|
4545
|
-
}, null, 8, ["result", "inverted"])) : t.kind === "card" ? (
|
|
4525
|
+
}, null, 8, ["result", "inverted"])) : t.kind === "card" ? (M(), v(wr, {
|
|
4546
4526
|
key: 2,
|
|
4547
4527
|
spec: t.spec,
|
|
4548
4528
|
inverted: e.inverted,
|
|
4549
4529
|
onAction: n[0] || (n[0] = (e) => r("action", e))
|
|
4550
|
-
}, null, 8, ["spec", "inverted"])) : (
|
|
4530
|
+
}, null, 8, ["spec", "inverted"])) : (M(), x("div", {
|
|
4551
4531
|
key: 3,
|
|
4552
4532
|
"data-test": "chat-visual-pending",
|
|
4553
4533
|
role: "status",
|
|
4554
4534
|
class: "my-6 flex items-center gap-2.5 rounded-[20px] px-4 py-5 text-[12px] font-medium",
|
|
4555
|
-
style:
|
|
4535
|
+
style: j({
|
|
4556
4536
|
background: e.inverted ? "transparent" : "var(--color-theme-0)",
|
|
4557
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)"}`,
|
|
4558
4538
|
color: e.inverted ? "rgba(255, 255, 255, 0.6)" : "var(--color-theme-500)"
|
|
@@ -4562,20 +4542,20 @@ var Lr = [
|
|
|
4562
4542
|
style: { background: "currentcolor" }
|
|
4563
4543
|
}, null, -1), C(" Preparing chart… ", -1)])], 4))], 64))), 128))], 32));
|
|
4564
4544
|
}
|
|
4565
|
-
}),
|
|
4545
|
+
}), fi = 80, pi = 600, mi = /* @__PURE__ */ k({
|
|
4566
4546
|
__name: "ChatScroller",
|
|
4567
4547
|
setup(e, { expose: t }) {
|
|
4568
|
-
let n =
|
|
4548
|
+
let n = P(), r = P(), i = P(!0), a, o, s = 0;
|
|
4569
4549
|
function scrollToBottom() {
|
|
4570
4550
|
let e = n.value;
|
|
4571
4551
|
e && (e.scrollTop = e.scrollHeight);
|
|
4572
4552
|
}
|
|
4573
4553
|
function onScroll() {
|
|
4574
4554
|
let e = n.value;
|
|
4575
|
-
e && (i.value = e.scrollHeight - e.scrollTop - e.clientHeight <=
|
|
4555
|
+
e && (i.value = e.scrollHeight - e.scrollTop - e.clientHeight <= fi);
|
|
4576
4556
|
}
|
|
4577
4557
|
function markUserGesture() {
|
|
4578
|
-
s = Date.now() +
|
|
4558
|
+
s = Date.now() + pi;
|
|
4579
4559
|
}
|
|
4580
4560
|
function followPinned() {
|
|
4581
4561
|
i.value && Date.now() > s && scrollToBottom();
|
|
@@ -4585,19 +4565,19 @@ var Lr = [
|
|
|
4585
4565
|
scrollToBottom(), requestAnimationFrame(scrollToBottom);
|
|
4586
4566
|
});
|
|
4587
4567
|
}
|
|
4588
|
-
return t({ pin }),
|
|
4568
|
+
return t({ pin }), re(() => {
|
|
4589
4569
|
requestAnimationFrame(() => {
|
|
4590
4570
|
scrollToBottom(), requestAnimationFrame(scrollToBottom);
|
|
4591
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, {
|
|
4592
4572
|
childList: !0,
|
|
4593
4573
|
subtree: !0
|
|
4594
4574
|
}));
|
|
4595
|
-
}),
|
|
4575
|
+
}), ne(() => {
|
|
4596
4576
|
a?.disconnect(), o?.disconnect();
|
|
4597
|
-
}), (e, t) => (
|
|
4577
|
+
}), (e, t) => (M(), x("div", {
|
|
4598
4578
|
ref_key: "viewport",
|
|
4599
4579
|
ref: n,
|
|
4600
|
-
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]" : ""]),
|
|
4601
4581
|
onScrollPassive: onScroll,
|
|
4602
4582
|
onWheelPassive: markUserGesture,
|
|
4603
4583
|
onTouchstartPassive: markUserGesture
|
|
@@ -4605,31 +4585,31 @@ var Lr = [
|
|
|
4605
4585
|
ref_key: "content",
|
|
4606
4586
|
ref: r,
|
|
4607
4587
|
class: "flex-1 flex flex-col"
|
|
4608
|
-
}, [
|
|
4588
|
+
}, [ae(e.$slots, "default")], 512)], 34));
|
|
4609
4589
|
}
|
|
4610
|
-
}),
|
|
4590
|
+
}), hi = {
|
|
4611
4591
|
VOICE_MIC_UNAVAILABLE: "I couldn't reach your microphone. Check that this site is allowed to use it, then try again.",
|
|
4612
|
-
|
|
4592
|
+
VOICE_BOT_UNAVAILABLE: "Your assistant didn't pick up. Give it a moment and start the call again.",
|
|
4613
4593
|
VOICE_CONNECT_TIMEOUT: "The call took too long to connect. Try again in a moment.",
|
|
4614
4594
|
VOICE_CONNECTION_LOST: "The call dropped. Start it again when you're ready.",
|
|
4615
4595
|
VOICE_UNAVAILABLE: "Voice isn't available right now. You can keep going by typing.",
|
|
4616
4596
|
VOICE_MINT_INVALID: "That call couldn't be started. Refresh the page and try again.",
|
|
4617
4597
|
VOICE_PROVIDER_ERROR: "The call ended unexpectedly. Try again, or keep going by typing."
|
|
4618
|
-
},
|
|
4598
|
+
}, gi = "The call ended unexpectedly. Try again, or keep going by typing.";
|
|
4619
4599
|
function voiceErrorMessage(e) {
|
|
4620
|
-
return e &&
|
|
4600
|
+
return e && hi[e] || gi;
|
|
4621
4601
|
}
|
|
4622
4602
|
//#endregion
|
|
4623
|
-
//#region
|
|
4624
|
-
var
|
|
4603
|
+
//#region bot/ui/VoiceHistogramController.ts
|
|
4604
|
+
var _i = [
|
|
4625
4605
|
0,
|
|
4626
4606
|
2,
|
|
4627
4607
|
4,
|
|
4628
4608
|
6,
|
|
4629
4609
|
8
|
|
4630
|
-
],
|
|
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 {
|
|
4631
4611
|
constructor(e = typeof window > "u" ? void 0 : window) {
|
|
4632
|
-
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", {
|
|
4633
4613
|
source: "mic",
|
|
4634
4614
|
level: 0
|
|
4635
4615
|
}), t(this, "isMuted", !1), t(this, "usesIdleWave", !1), t(this, "frameId", 0), t(this, "lastFrameAt", 0), t(this, "easeFrame", (e) => {
|
|
@@ -4638,12 +4618,12 @@ var yi = [
|
|
|
4638
4618
|
this.frameId = 0;
|
|
4639
4619
|
let n = Math.min(64, Math.max(0, e - this.lastFrameAt));
|
|
4640
4620
|
this.lastFrameAt = e;
|
|
4641
|
-
let r = this.usesIdleWave ?
|
|
4642
|
-
let r = e / 1e3 *
|
|
4643
|
-
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;
|
|
4644
4624
|
}) : this.targetBars;
|
|
4645
4625
|
this.displayBars = this.displayBars.map((e, t) => {
|
|
4646
|
-
let i = r[t] ?? 0, a = i > e ?
|
|
4626
|
+
let i = r[t] ?? 0, a = i > e ? Si : Ci;
|
|
4647
4627
|
return e + (i - e) * (1 - Math.exp(-n / a));
|
|
4648
4628
|
}), this.publish();
|
|
4649
4629
|
let i = this.displayBars.every((e, t) => Math.abs((r[t] ?? 0) - e) <= 5e-4);
|
|
@@ -4663,20 +4643,20 @@ var yi = [
|
|
|
4663
4643
|
this.frameId && this.browser?.cancelAnimationFrame(this.frameId), this.frameId = 0;
|
|
4664
4644
|
}
|
|
4665
4645
|
updateTargets() {
|
|
4666
|
-
let gate = (e) => Math.max(0, e -
|
|
4667
|
-
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();
|
|
4668
4648
|
}
|
|
4669
4649
|
start() {
|
|
4670
4650
|
if (!this.browser || this.browser.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
4671
|
-
this.displayBars = this.usesIdleWave ?
|
|
4651
|
+
this.displayBars = this.usesIdleWave ? Oi : this.targetBars, this.publish();
|
|
4672
4652
|
return;
|
|
4673
4653
|
}
|
|
4674
4654
|
this.frameId || (this.lastFrameAt = this.browser.performance.now(), this.frameId = this.browser.requestAnimationFrame(this.easeFrame));
|
|
4675
4655
|
}
|
|
4676
4656
|
publish() {
|
|
4677
|
-
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);
|
|
4678
4658
|
}
|
|
4679
|
-
},
|
|
4659
|
+
}, Ai = {
|
|
4680
4660
|
connecting: {
|
|
4681
4661
|
label: "Connecting",
|
|
4682
4662
|
tone: "bg-amber-500",
|
|
@@ -4711,10 +4691,10 @@ var yi = [
|
|
|
4711
4691
|
}
|
|
4712
4692
|
};
|
|
4713
4693
|
function deriveActivity(e) {
|
|
4714
|
-
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";
|
|
4715
4695
|
}
|
|
4716
4696
|
function deriveVoiceModePresentation(e) {
|
|
4717
|
-
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;
|
|
4718
4698
|
return {
|
|
4719
4699
|
activity: t,
|
|
4720
4700
|
label: a ? o : r,
|
|
@@ -4725,82 +4705,82 @@ function deriveVoiceModePresentation(e) {
|
|
|
4725
4705
|
};
|
|
4726
4706
|
}
|
|
4727
4707
|
//#endregion
|
|
4728
|
-
//#region
|
|
4729
|
-
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 = {
|
|
4730
4710
|
key: 1,
|
|
4731
4711
|
"data-test": "voice-background-fallback",
|
|
4732
4712
|
"aria-hidden": "true",
|
|
4733
4713
|
class: "pointer-events-none absolute inset-0 bg-[#0A1522]"
|
|
4734
|
-
},
|
|
4714
|
+
}, Pi = {
|
|
4735
4715
|
"data-test": "voice-stage",
|
|
4736
4716
|
class: "relative z-10 flex flex-1 flex-col items-center px-8"
|
|
4737
|
-
},
|
|
4717
|
+
}, Fi = { "data-voice-assistant-avatar": "" }, Ii = {
|
|
4738
4718
|
"data-test": "voice-lower-stage",
|
|
4739
4719
|
class: "flex flex-1 flex-col items-center pt-10"
|
|
4740
|
-
},
|
|
4720
|
+
}, Li = {
|
|
4741
4721
|
"data-test": "voice-histogram",
|
|
4742
4722
|
"aria-hidden": "true",
|
|
4743
4723
|
class: "flex h-[38px] items-center gap-[5px]"
|
|
4744
|
-
},
|
|
4724
|
+
}, Ri = {
|
|
4745
4725
|
"data-test": "voice-presence-status",
|
|
4746
4726
|
role: "status",
|
|
4747
4727
|
"aria-live": "polite",
|
|
4748
4728
|
class: "sr-only"
|
|
4749
|
-
},
|
|
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 = [
|
|
4750
4730
|
"disabled",
|
|
4751
4731
|
"aria-label",
|
|
4752
4732
|
"aria-pressed",
|
|
4753
4733
|
"title"
|
|
4754
|
-
],
|
|
4734
|
+
], Hi = /* @__PURE__ */ k({
|
|
4755
4735
|
__name: "VoiceMode",
|
|
4756
4736
|
props: {
|
|
4757
|
-
|
|
4737
|
+
bot: {},
|
|
4758
4738
|
chatController: {},
|
|
4759
4739
|
isLight: { type: Boolean },
|
|
4760
4740
|
backdropSrc: {}
|
|
4761
4741
|
},
|
|
4762
4742
|
emits: ["end"],
|
|
4763
4743
|
setup(e, { expose: t, emit: n }) {
|
|
4764
|
-
let r = n, i =
|
|
4744
|
+
let r = n, i = I(!1), a = I(!1), o = I({
|
|
4765
4745
|
user: !1,
|
|
4766
|
-
|
|
4767
|
-
}), 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({
|
|
4768
4748
|
sessionState: p.value,
|
|
4769
4749
|
hadError: i.value,
|
|
4770
4750
|
providerThinking: a.value,
|
|
4771
4751
|
speaking: o.value,
|
|
4772
4752
|
work: s.value,
|
|
4773
|
-
isMuted:
|
|
4753
|
+
isMuted: h.value,
|
|
4774
4754
|
takingLonger: c.value
|
|
4775
|
-
})),
|
|
4776
|
-
if (
|
|
4777
|
-
if (
|
|
4755
|
+
})), oe = _(() => {
|
|
4756
|
+
if (ae.value.activity === "thinking") return "thinking";
|
|
4757
|
+
if (ae.value.activity === "working") return `working:${s.value.description ?? ""}`;
|
|
4778
4758
|
});
|
|
4779
|
-
|
|
4759
|
+
ue(() => ae.value.usesIdleWave, (e) => v.setIdleWave(e), { immediate: !0 }), ue(h, (e) => v.setMuted(e), { immediate: !0 }), ue(oe, (e) => {
|
|
4780
4760
|
P && clearTimeout(P), c.value = !1, e && (P = setTimeout(() => {
|
|
4781
4761
|
P = void 0, c.value = !0;
|
|
4782
|
-
},
|
|
4762
|
+
}, G), P.unref?.());
|
|
4783
4763
|
}, { immediate: !0 });
|
|
4784
4764
|
async function end() {
|
|
4785
|
-
|
|
4765
|
+
te = !0, await f.value?.end();
|
|
4786
4766
|
}
|
|
4787
4767
|
t({ end });
|
|
4788
4768
|
function emitEnd() {
|
|
4789
|
-
|
|
4769
|
+
te || (te = !0, r("end"));
|
|
4790
4770
|
}
|
|
4791
4771
|
function trapFocus(e) {
|
|
4792
|
-
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());
|
|
4793
4773
|
}
|
|
4794
4774
|
async function toggleMute() {
|
|
4795
4775
|
let e = f.value;
|
|
4796
4776
|
!e || u.value || (u.value = !0, await e.toggleMuted(), u.value = !1);
|
|
4797
4777
|
}
|
|
4798
|
-
return
|
|
4799
|
-
|
|
4778
|
+
return re(async () => {
|
|
4779
|
+
C.value?.focus({ preventScroll: !0 });
|
|
4800
4780
|
let t = e.chatController?.createVoiceClient({
|
|
4801
|
-
onLevel: (e) =>
|
|
4781
|
+
onLevel: (e) => v.updateLevel(e),
|
|
4802
4782
|
onStateChange: (e) => {
|
|
4803
|
-
e === "ended" && (i.value ?
|
|
4783
|
+
e === "ended" && (i.value ? ne = setTimeout(emitEnd, 1600) : emitEnd());
|
|
4804
4784
|
},
|
|
4805
4785
|
onThinkingChange: (e) => {
|
|
4806
4786
|
a.value = e;
|
|
@@ -4826,16 +4806,16 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4826
4806
|
return;
|
|
4827
4807
|
}
|
|
4828
4808
|
f.value = t, await t.start();
|
|
4829
|
-
}),
|
|
4830
|
-
|
|
4831
|
-
}), (t, n) => (
|
|
4809
|
+
}), ie(() => {
|
|
4810
|
+
te = !0, ne && clearTimeout(ne), P && clearTimeout(P), v.stop(), f.value?.end();
|
|
4811
|
+
}), (t, n) => (M(), x("div", {
|
|
4832
4812
|
"data-test": "voice-mode",
|
|
4833
4813
|
"data-voice-state": p.value,
|
|
4834
|
-
"data-voice-activity":
|
|
4814
|
+
"data-voice-activity": ae.value.activity,
|
|
4835
4815
|
class: "relative flex min-h-0 flex-1 flex-col overflow-hidden bg-[#0A1522] text-white",
|
|
4836
|
-
onKeydown:
|
|
4816
|
+
onKeydown: he(trapFocus, ["tab"])
|
|
4837
4817
|
}, [
|
|
4838
|
-
e.backdropSrc ? (
|
|
4818
|
+
e.backdropSrc ? (M(), x("img", {
|
|
4839
4819
|
key: 0,
|
|
4840
4820
|
"data-test": "voice-background-image",
|
|
4841
4821
|
src: e.backdropSrc,
|
|
@@ -4843,44 +4823,44 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4843
4823
|
"aria-hidden": "true",
|
|
4844
4824
|
draggable: "false",
|
|
4845
4825
|
class: "pointer-events-none absolute inset-0 size-full object-cover"
|
|
4846
|
-
}, null, 8,
|
|
4826
|
+
}, null, 8, Mi)) : (M(), x("div", Ni)),
|
|
4847
4827
|
n[2] || (n[2] = S("div", {
|
|
4848
4828
|
"data-test": "voice-background-overlay",
|
|
4849
4829
|
"aria-hidden": "true",
|
|
4850
4830
|
class: "pointer-events-none absolute inset-0 bg-gradient-to-b from-[#050F19]/82 via-[#050F19]/90 to-[#050F19]/99"
|
|
4851
4831
|
}, null, -1)),
|
|
4852
|
-
S("div",
|
|
4832
|
+
S("div", Pi, [
|
|
4853
4833
|
n[0] || (n[0] = S("div", {
|
|
4854
4834
|
"data-test": "voice-stage-spacer",
|
|
4855
4835
|
"aria-hidden": "true",
|
|
4856
4836
|
class: "flex-1"
|
|
4857
4837
|
}, null, -1)),
|
|
4858
|
-
S("div",
|
|
4859
|
-
|
|
4838
|
+
S("div", Fi, [T(Ge, {
|
|
4839
|
+
bot: e.bot,
|
|
4860
4840
|
"show-status": !1,
|
|
4861
4841
|
"show-owner-mark": !1,
|
|
4862
4842
|
"is-light": !1,
|
|
4863
4843
|
class: "size-32"
|
|
4864
|
-
}, null, 8, ["
|
|
4865
|
-
S("div",
|
|
4866
|
-
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", {
|
|
4867
4847
|
key: t,
|
|
4868
4848
|
"data-test": "voice-histogram-bar",
|
|
4869
|
-
class:
|
|
4870
|
-
style:
|
|
4849
|
+
class: A(["w-[5px] rounded-full transition-colors duration-150", ae.value.tone]),
|
|
4850
|
+
style: j({ height: `${e}px` })
|
|
4871
4851
|
}, null, 6))), 128))]),
|
|
4872
|
-
S("div",
|
|
4852
|
+
S("div", Ri, R(ae.value.label), 1),
|
|
4873
4853
|
S("p", {
|
|
4874
4854
|
"data-test": "voice-visible-status",
|
|
4875
|
-
"data-taking-longer":
|
|
4855
|
+
"data-taking-longer": ae.value.takingLonger || void 0,
|
|
4876
4856
|
"aria-hidden": "true",
|
|
4877
4857
|
class: "mt-5 min-h-5 text-center text-sm font-medium tracking-wide text-white/80"
|
|
4878
|
-
},
|
|
4858
|
+
}, R(ae.value.visibleStatus), 9, zi)
|
|
4879
4859
|
])
|
|
4880
4860
|
]),
|
|
4881
|
-
S("div",
|
|
4861
|
+
S("div", Bi, [S("button", {
|
|
4882
4862
|
ref_key: "endButton",
|
|
4883
|
-
ref:
|
|
4863
|
+
ref: C,
|
|
4884
4864
|
type: "button",
|
|
4885
4865
|
"data-test": "voice-end-btn",
|
|
4886
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",
|
|
@@ -4892,39 +4872,39 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4892
4872
|
"aria-hidden": "true"
|
|
4893
4873
|
}, null, -1)])], 512), S("button", {
|
|
4894
4874
|
ref_key: "muteButton",
|
|
4895
|
-
ref:
|
|
4875
|
+
ref: k,
|
|
4896
4876
|
type: "button",
|
|
4897
4877
|
"data-test": "voice-mute-btn",
|
|
4898
|
-
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"]]),
|
|
4899
4879
|
disabled: p.value !== "live" || u.value,
|
|
4900
|
-
"aria-label":
|
|
4901
|
-
"aria-pressed":
|
|
4902
|
-
title:
|
|
4880
|
+
"aria-label": h.value ? "Unmute microphone" : "Mute microphone",
|
|
4881
|
+
"aria-pressed": h.value,
|
|
4882
|
+
title: h.value ? "Unmute microphone" : "Mute microphone",
|
|
4903
4883
|
onClick: toggleMute
|
|
4904
4884
|
}, [S("i", {
|
|
4905
|
-
class:
|
|
4885
|
+
class: A([h.value ? "i-tabler-microphone-off" : "i-tabler-microphone", "size-[25px]"]),
|
|
4906
4886
|
"aria-hidden": "true"
|
|
4907
|
-
}, null, 2)], 10,
|
|
4908
|
-
], 40,
|
|
4887
|
+
}, null, 2)], 10, Vi)])
|
|
4888
|
+
], 40, ji));
|
|
4909
4889
|
}
|
|
4910
|
-
}),
|
|
4890
|
+
}), Ui = {
|
|
4911
4891
|
key: 0,
|
|
4912
4892
|
class: "pb-4"
|
|
4913
|
-
},
|
|
4893
|
+
}, Wi = {
|
|
4914
4894
|
key: 1,
|
|
4915
4895
|
"data-test": "messaging-sdk-header",
|
|
4916
4896
|
class: "shrink-0 border-b border-theme-100 px-4 py-3"
|
|
4917
|
-
},
|
|
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 = {
|
|
4918
4898
|
key: 0,
|
|
4919
4899
|
class: "shrink-0 rounded-full bg-theme-50 px-2.5 py-1 font-mono text-[11px] font-medium text-theme-500"
|
|
4920
|
-
},
|
|
4900
|
+
}, Yi = ["aria-label"], Xi = {
|
|
4921
4901
|
key: 0,
|
|
4922
4902
|
"data-test": "messaging-empty-state",
|
|
4923
4903
|
class: "flex flex-col items-center justify-center px-4"
|
|
4924
|
-
},
|
|
4904
|
+
}, Zi = ["title"], Qi = {
|
|
4925
4905
|
key: 0,
|
|
4926
4906
|
class: "flex items-center gap-3 py-3 px-2"
|
|
4927
|
-
},
|
|
4907
|
+
}, $i = ["data-journal-outcome"], ea = [
|
|
4928
4908
|
"data-message-id",
|
|
4929
4909
|
"data-message-sender",
|
|
4930
4910
|
"data-conversation-id",
|
|
@@ -4935,7 +4915,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4935
4915
|
"data-issue-action-label",
|
|
4936
4916
|
"data-issue-action-url",
|
|
4937
4917
|
"data-streaming"
|
|
4938
|
-
],
|
|
4918
|
+
], ta = { class: "flex items-center gap-3" }, na = ["href"], ra = [
|
|
4939
4919
|
"data-message-id",
|
|
4940
4920
|
"data-message-sender",
|
|
4941
4921
|
"data-conversation-id",
|
|
@@ -4944,7 +4924,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4944
4924
|
"data-issue-code",
|
|
4945
4925
|
"data-issue-bucket",
|
|
4946
4926
|
"data-streaming"
|
|
4947
|
-
],
|
|
4927
|
+
], ia = [
|
|
4948
4928
|
"data-test",
|
|
4949
4929
|
"data-message-id",
|
|
4950
4930
|
"data-message-sender",
|
|
@@ -4954,14 +4934,19 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
4954
4934
|
"data-streaming",
|
|
4955
4935
|
"data-queued",
|
|
4956
4936
|
"aria-label"
|
|
4957
|
-
],
|
|
4937
|
+
], aa = ["src", "alt"], oa = ["src"], sa = ["href"], ca = {
|
|
4958
4938
|
key: 0,
|
|
4959
4939
|
"data-test": "messaging-message-text-part"
|
|
4960
|
-
},
|
|
4940
|
+
}, la = [
|
|
4961
4941
|
"src",
|
|
4962
4942
|
"alt",
|
|
4963
4943
|
"data-attachment-placement"
|
|
4964
|
-
],
|
|
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 = {
|
|
4965
4950
|
key: 0,
|
|
4966
4951
|
class: "truncate"
|
|
4967
4952
|
}, va = {
|
|
@@ -5005,11 +4990,11 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5005
4990
|
key: 2,
|
|
5006
4991
|
"data-test": "messaging-ai-notice",
|
|
5007
4992
|
class: "mx-auto max-w-[640px] @5xl/chat:max-w-[720px] pt-3 text-center text-[11.5px] leading-none text-theme-300"
|
|
5008
|
-
}, Ja = /*#__PURE__*/
|
|
5009
|
-
__name: "
|
|
4993
|
+
}, Ja = /*#__PURE__*/ ve(/* @__PURE__ */ k({
|
|
4994
|
+
__name: "ElBotChat",
|
|
5010
4995
|
props: {
|
|
5011
4996
|
chatController: {},
|
|
5012
|
-
|
|
4997
|
+
bot: {},
|
|
5013
4998
|
variant: { default: "dark" },
|
|
5014
4999
|
scope: { default: "private" },
|
|
5015
5000
|
scopeName: {},
|
|
@@ -5042,35 +5027,35 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5042
5027
|
label: "Public",
|
|
5043
5028
|
tooltip: "Anyone with the link can see this"
|
|
5044
5029
|
}
|
|
5045
|
-
}, n =
|
|
5030
|
+
}, n = _(() => {
|
|
5046
5031
|
let n = { ...t[e.scope] };
|
|
5047
5032
|
return e.scope === "org" && e.scopeName && (n.label = e.scopeName, n.tooltip = `Visible to ${e.scopeName} members`), n;
|
|
5048
|
-
}), r =
|
|
5033
|
+
}), r = P(), a = P(), o = P();
|
|
5049
5034
|
function containsMarkdownLink(e) {
|
|
5050
5035
|
return e ? /\[[^\]]+\]\([^)]+\)/.test(e) : !1;
|
|
5051
5036
|
}
|
|
5052
5037
|
function isSystemExplainerMessage(e) {
|
|
5053
|
-
return e.sender === "system" && (!!e.issue || e.id ===
|
|
5038
|
+
return e.sender === "system" && (!!e.issue || e.id === W.value);
|
|
5054
5039
|
}
|
|
5055
5040
|
function isGroupEnd(e, t) {
|
|
5056
5041
|
let n = e[t], r = e[t + 1];
|
|
5057
5042
|
return !r || r.sender !== n.sender;
|
|
5058
5043
|
}
|
|
5059
|
-
let
|
|
5060
|
-
for (let e =
|
|
5061
|
-
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];
|
|
5062
5047
|
if (t?.kind === "text") return t.id;
|
|
5063
5048
|
}
|
|
5064
|
-
}),
|
|
5049
|
+
}), oe = _(() => e.chatController?.liveStreamMessageId?.value), B = _(() => {
|
|
5065
5050
|
let t = e.chatController?.sharedMessages.value ?? [];
|
|
5066
|
-
return
|
|
5067
|
-
}),
|
|
5068
|
-
if (!e.chatController?.workJournal?.value) return
|
|
5069
|
-
}),
|
|
5070
|
-
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;
|
|
5071
5056
|
let e = B.value, t = e[e.length - 1];
|
|
5072
|
-
if (t) return t.sender === "
|
|
5073
|
-
}),
|
|
5057
|
+
if (t) return t.sender === "bot" || t.sender === "system" ? e.length >= 2 ? e[e.length - 2].id : void 0 : t.id;
|
|
5058
|
+
}), H = _(() => {
|
|
5074
5059
|
let t = {};
|
|
5075
5060
|
for (let n of B.value) {
|
|
5076
5061
|
if (n.sender === "user" || !n.toolActivities?.length) continue;
|
|
@@ -5084,7 +5069,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5084
5069
|
return t;
|
|
5085
5070
|
});
|
|
5086
5071
|
function messageWorkJournal(e) {
|
|
5087
|
-
return
|
|
5072
|
+
return H.value[e.id];
|
|
5088
5073
|
}
|
|
5089
5074
|
function inlineOffset(e, t) {
|
|
5090
5075
|
return e.placement?.kind !== "inline" || !Number.isFinite(e.placement.offset) ? null : Math.max(0, Math.min(t.length, Math.trunc(e.placement.offset)));
|
|
@@ -5100,7 +5085,7 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5100
5085
|
}
|
|
5101
5086
|
function messageRenderParts(e) {
|
|
5102
5087
|
let t = e.text ?? "";
|
|
5103
|
-
if (e.sender !== "
|
|
5088
|
+
if (e.sender !== "bot") return t ? [{
|
|
5104
5089
|
kind: "text",
|
|
5105
5090
|
key: `${e.id}:text`,
|
|
5106
5091
|
text: t
|
|
@@ -5132,64 +5117,78 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5132
5117
|
text: t.slice(i)
|
|
5133
5118
|
}), r;
|
|
5134
5119
|
}
|
|
5135
|
-
let
|
|
5120
|
+
let U = _(() => c.value?.transientIssue), W = _(() => {
|
|
5136
5121
|
if (!f.value) return;
|
|
5137
5122
|
let e = B.value, t = e[e.length - 1];
|
|
5138
|
-
return t?.sender === "
|
|
5139
|
-
}),
|
|
5140
|
-
if (
|
|
5141
|
-
let t = e.
|
|
5142
|
-
return
|
|
5143
|
-
}),
|
|
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 ?? {
|
|
5144
5129
|
text: "",
|
|
5145
5130
|
pendingAttachments: [],
|
|
5146
5131
|
isUploading: !1
|
|
5147
|
-
}),
|
|
5148
|
-
get: () =>
|
|
5132
|
+
}), ke = _({
|
|
5133
|
+
get: () => Oe.value.text,
|
|
5149
5134
|
set: (t) => e.chatController?.setComposerText?.({ text: t })
|
|
5150
|
-
}),
|
|
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);
|
|
5151
5136
|
function isQueuedMessage(e) {
|
|
5152
|
-
return
|
|
5153
|
-
}
|
|
5154
|
-
let
|
|
5155
|
-
|
|
5156
|
-
return e === "
|
|
5157
|
-
}
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
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;
|
|
5161
5160
|
let r = new Image();
|
|
5162
5161
|
r.onload = () => {
|
|
5163
|
-
n ===
|
|
5162
|
+
n === rt && (nt.value = e);
|
|
5164
5163
|
}, r.src = e;
|
|
5165
5164
|
}, { immediate: !0 });
|
|
5166
|
-
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");
|
|
5167
5166
|
function startVoiceConversation() {
|
|
5168
|
-
|
|
5167
|
+
!at.value || K.value || (tt.value = nt.value, Qe.value = !0);
|
|
5169
5168
|
}
|
|
5170
5169
|
async function endVoiceConversation() {
|
|
5171
|
-
if (!
|
|
5172
|
-
let t =
|
|
5173
|
-
|
|
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();
|
|
5174
5173
|
}
|
|
5175
|
-
let J =
|
|
5176
|
-
|
|
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 () => {
|
|
5177
5176
|
e.chatController && !u.value && await e.chatController.startTextConversation();
|
|
5178
|
-
}),
|
|
5177
|
+
}), ie(() => {
|
|
5179
5178
|
e.chatController?.voiceRecorder?.teardown();
|
|
5180
5179
|
});
|
|
5181
5180
|
async function sendMessage() {
|
|
5182
|
-
!e.chatController ||
|
|
5181
|
+
!e.chatController || Ie.value !== "send" || (a.value && (a.value.style.height = "auto", window.matchMedia("(pointer: coarse)").matches ? (a.value.blur(), requestAnimationFrame(() => {
|
|
5183
5182
|
let e = document.activeElement;
|
|
5184
5183
|
e && (e.tagName === "TEXTAREA" || e.tagName === "INPUT") && e.blur();
|
|
5185
|
-
})) :
|
|
5184
|
+
})) : a.value.focus()), r.value?.pin(), await e.chatController.sendComposerMessage());
|
|
5186
5185
|
}
|
|
5187
5186
|
async function handleCardAction(t) {
|
|
5188
|
-
!e.chatController ||
|
|
5187
|
+
!e.chatController || we.value || (r.value?.pin(), await e.chatController.sendChatMessage(t));
|
|
5189
5188
|
}
|
|
5190
5189
|
async function handleComposerAction() {
|
|
5191
5190
|
if (e.chatController) {
|
|
5192
|
-
if (
|
|
5191
|
+
if (Ie.value === "send") {
|
|
5193
5192
|
await sendMessage();
|
|
5194
5193
|
return;
|
|
5195
5194
|
}
|
|
@@ -5200,44 +5199,44 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5200
5199
|
e.isComposing || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), await sendMessage());
|
|
5201
5200
|
}
|
|
5202
5201
|
function focusComposer(e) {
|
|
5203
|
-
|
|
5202
|
+
qe.value || we.value || e.target instanceof Element && e.target.closest("button, a, textarea") || a.value?.focus();
|
|
5204
5203
|
}
|
|
5205
5204
|
function adjustTextareaHeight() {
|
|
5206
|
-
|
|
5205
|
+
a.value && (a.value.style.height = "auto", a.value.style.height = `${Math.min(a.value.scrollHeight, 150)}px`);
|
|
5207
5206
|
}
|
|
5208
|
-
|
|
5207
|
+
ue(ke, () => te(() => adjustTextareaHeight()));
|
|
5209
5208
|
function triggerFileInput() {
|
|
5210
5209
|
o.value?.click();
|
|
5211
5210
|
}
|
|
5212
5211
|
async function handleFileSelect(t) {
|
|
5213
5212
|
let n = t.target, r = n.files?.[0];
|
|
5214
|
-
!r || !e.chatController ||
|
|
5213
|
+
!r || !e.chatController || Ne.value || (await e.chatController.attachFile({ file: r }), n.value = "");
|
|
5215
5214
|
}
|
|
5216
5215
|
function removeAttachment(t) {
|
|
5217
5216
|
e.chatController?.removeAttachment({ index: t });
|
|
5218
5217
|
}
|
|
5219
5218
|
function startRecording() {
|
|
5220
|
-
|
|
5219
|
+
Me.value?.start();
|
|
5221
5220
|
}
|
|
5222
5221
|
function finishRecording(e) {
|
|
5223
|
-
|
|
5222
|
+
Me.value?.finish(e);
|
|
5224
5223
|
}
|
|
5225
|
-
let
|
|
5224
|
+
let lt = I(!1), ut = !1;
|
|
5226
5225
|
function onRecordPointerDown(e) {
|
|
5227
|
-
e.pointerType === "touch" && (
|
|
5226
|
+
e.pointerType === "touch" && (ut = !0, lt.value = !0, e.currentTarget.setPointerCapture?.(e.pointerId), startRecording());
|
|
5228
5227
|
}
|
|
5229
5228
|
function onRecordPointerUp(e) {
|
|
5230
|
-
e.pointerType !== "touch" || !
|
|
5229
|
+
e.pointerType !== "touch" || !lt.value || (lt.value = !1, finishRecording({ cancelled: !1 }));
|
|
5231
5230
|
}
|
|
5232
5231
|
function onRecordPointerCancel(e) {
|
|
5233
|
-
e.pointerType !== "touch" || !
|
|
5232
|
+
e.pointerType !== "touch" || !lt.value || (lt.value = !1, ut = !1, finishRecording({ cancelled: !0 }));
|
|
5234
5233
|
}
|
|
5235
5234
|
function toggleRecording() {
|
|
5236
|
-
|
|
5235
|
+
qe.value ? finishRecording({ cancelled: !1 }) : startRecording();
|
|
5237
5236
|
}
|
|
5238
5237
|
function onRecordClick() {
|
|
5239
|
-
if (
|
|
5240
|
-
|
|
5238
|
+
if (ut) {
|
|
5239
|
+
ut = !1;
|
|
5241
5240
|
return;
|
|
5242
5241
|
}
|
|
5243
5242
|
toggleRecording();
|
|
@@ -5269,237 +5268,267 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5269
5268
|
...o ? {} : { year: "numeric" }
|
|
5270
5269
|
})}, ${a}`;
|
|
5271
5270
|
}
|
|
5272
|
-
return (t,
|
|
5271
|
+
return (t, i) => (M(), x("div", {
|
|
5273
5272
|
"data-test": "messaging-root",
|
|
5274
|
-
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" : ""])
|
|
5275
5274
|
}, [
|
|
5276
|
-
e.showHeader && !J.value ? (
|
|
5277
|
-
|
|
5275
|
+
e.showHeader && !J.value ? (M(), x("div", Ui, [T(Be, {
|
|
5276
|
+
bot: e.bot,
|
|
5278
5277
|
"is-online": u.value
|
|
5279
|
-
}, 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" : ""]) }, [
|
|
5280
5279
|
T(Ge, {
|
|
5281
|
-
|
|
5280
|
+
bot: e.bot,
|
|
5282
5281
|
"is-light": J.value,
|
|
5283
5282
|
class: "size-10"
|
|
5284
|
-
}, null, 8, ["
|
|
5285
|
-
S("div",
|
|
5286
|
-
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)
|
|
5287
5286
|
], 2)])) : b("", !0),
|
|
5288
|
-
T(
|
|
5289
|
-
default:
|
|
5287
|
+
T(h, { name: "voice-call" }, {
|
|
5288
|
+
default: de(() => [Qe.value ? (M(), x("div", {
|
|
5290
5289
|
key: 0,
|
|
5291
5290
|
"data-test": "voice-call-overlay",
|
|
5292
5291
|
role: "dialog",
|
|
5293
5292
|
"aria-modal": "true",
|
|
5294
|
-
"aria-label": `Voice conversation with ${e.
|
|
5293
|
+
"aria-label": `Voice conversation with ${e.bot.displayName.value}`,
|
|
5295
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",
|
|
5296
|
-
onKeydown:
|
|
5297
|
-
}, [T(
|
|
5295
|
+
onKeydown: i[0] || (i[0] = he((e) => endVoiceConversation(), ["esc"]))
|
|
5296
|
+
}, [T(Hi, {
|
|
5298
5297
|
ref_key: "voiceMode",
|
|
5299
|
-
ref:
|
|
5300
|
-
|
|
5298
|
+
ref: $e,
|
|
5299
|
+
bot: e.bot,
|
|
5301
5300
|
"chat-controller": e.chatController,
|
|
5302
|
-
"backdrop-src":
|
|
5301
|
+
"backdrop-src": tt.value,
|
|
5303
5302
|
"is-light": !1,
|
|
5304
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)]",
|
|
5305
5304
|
onEnd: endVoiceConversation
|
|
5306
5305
|
}, null, 8, [
|
|
5307
|
-
"
|
|
5306
|
+
"bot",
|
|
5308
5307
|
"chat-controller",
|
|
5309
5308
|
"backdrop-src"
|
|
5310
|
-
])], 40,
|
|
5309
|
+
])], 40, Yi)) : b("", !0)]),
|
|
5311
5310
|
_: 1
|
|
5312
5311
|
}),
|
|
5313
|
-
p.value ? (
|
|
5312
|
+
p.value ? (M(), x("div", {
|
|
5314
5313
|
key: 2,
|
|
5315
|
-
class:
|
|
5316
|
-
}, [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", {
|
|
5317
5316
|
key: 3,
|
|
5318
|
-
class:
|
|
5319
|
-
}, [
|
|
5320
|
-
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, {
|
|
5321
5320
|
ref_key: "chatScroller",
|
|
5322
5321
|
ref: r,
|
|
5323
|
-
inert:
|
|
5324
|
-
"aria-hidden":
|
|
5325
|
-
class:
|
|
5322
|
+
inert: Qe.value,
|
|
5323
|
+
"aria-hidden": Qe.value ? "true" : void 0,
|
|
5324
|
+
class: A(B.value.length === 0 ? "flex-none" : "flex-1")
|
|
5326
5325
|
}, {
|
|
5327
|
-
default:
|
|
5328
|
-
B.value.length === 0 && !p.value ? (
|
|
5329
|
-
|
|
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,
|
|
5330
5329
|
isLight: J.value
|
|
5331
5330
|
}, () => [T(Ge, {
|
|
5332
|
-
|
|
5331
|
+
bot: e.bot,
|
|
5333
5332
|
"is-light": J.value,
|
|
5334
5333
|
class: "mb-4 size-20 @sm/chat:size-24"
|
|
5335
|
-
}, null, 8, ["
|
|
5336
|
-
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"]),
|
|
5337
5336
|
title: n.value.tooltip
|
|
5338
|
-
}, [S("i", { class:
|
|
5339
|
-
(
|
|
5340
|
-
shouldShowTimeDivider(B.value,
|
|
5341
|
-
S("div", { class:
|
|
5342
|
-
S("span", { class:
|
|
5343
|
-
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)
|
|
5344
5343
|
])) : b("", !0),
|
|
5345
|
-
messageWorkJournal(
|
|
5344
|
+
messageWorkJournal(t) ? (M(), x("div", {
|
|
5346
5345
|
key: 1,
|
|
5347
5346
|
"data-test": "messaging-message-tool-activity",
|
|
5348
|
-
"data-journal-outcome": messageWorkJournal(
|
|
5347
|
+
"data-journal-outcome": messageWorkJournal(t)?.outcome,
|
|
5349
5348
|
class: "mb-4 w-full"
|
|
5350
5349
|
}, [T(et, {
|
|
5351
|
-
model: messageWorkJournal(
|
|
5350
|
+
model: messageWorkJournal(t),
|
|
5352
5351
|
"is-light": J.value
|
|
5353
|
-
}, null, 8, ["model", "is-light"])], 8,
|
|
5354
|
-
isSystemExplainerMessage(
|
|
5352
|
+
}, null, 8, ["model", "is-light"])], 8, $i)) : b("", !0),
|
|
5353
|
+
isSystemExplainerMessage(t) ? (M(), x("section", {
|
|
5355
5354
|
key: 2,
|
|
5356
5355
|
"data-test": "messaging-system-msg",
|
|
5357
|
-
"data-message-id":
|
|
5358
|
-
"data-message-sender":
|
|
5359
|
-
"data-conversation-id":
|
|
5360
|
-
"data-message-sequence":
|
|
5361
|
-
"data-system-kind":
|
|
5362
|
-
"data-issue-code":
|
|
5363
|
-
"data-issue-bucket":
|
|
5364
|
-
"data-issue-action-label":
|
|
5365
|
-
"data-issue-action-url":
|
|
5366
|
-
"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,
|
|
5367
5366
|
class: "mb-6 w-full"
|
|
5368
|
-
}, [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, [
|
|
5369
5368
|
S("span", {
|
|
5370
5369
|
"data-test": "messaging-system-divider-line",
|
|
5371
5370
|
"aria-hidden": "true",
|
|
5372
|
-
class:
|
|
5371
|
+
class: A(["hidden h-px flex-1 opacity-60 @md/chat:block", st.value])
|
|
5373
5372
|
}, null, 2),
|
|
5374
|
-
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, {
|
|
5375
5374
|
key: 0,
|
|
5376
|
-
text:
|
|
5375
|
+
text: t.text,
|
|
5377
5376
|
inverted: !J.value,
|
|
5378
|
-
streaming:
|
|
5379
|
-
onClick:
|
|
5377
|
+
streaming: t.id === W.value,
|
|
5378
|
+
onClick: i[1] || (i[1] = _e(() => {}, ["stop"])),
|
|
5380
5379
|
onAction: handleCardAction
|
|
5381
5380
|
}, null, 8, [
|
|
5382
5381
|
"text",
|
|
5383
5382
|
"inverted",
|
|
5384
5383
|
"streaming"
|
|
5385
|
-
])) :
|
|
5384
|
+
])) : t.issue?.help ? (M(), v(di, {
|
|
5386
5385
|
key: 1,
|
|
5387
|
-
text:
|
|
5386
|
+
text: t.issue.help,
|
|
5388
5387
|
inverted: !J.value
|
|
5389
|
-
}, null, 8, ["text", "inverted"])) : b("", !0),
|
|
5388
|
+
}, null, 8, ["text", "inverted"])) : b("", !0), t.issue?.actionUrl && !containsMarkdownLink(t.text) ? (M(), x("a", {
|
|
5390
5389
|
key: 2,
|
|
5391
|
-
href:
|
|
5390
|
+
href: t.issue.actionUrl,
|
|
5392
5391
|
"data-test": "messaging-system-msg-action",
|
|
5393
|
-
class:
|
|
5394
|
-
onClick:
|
|
5395
|
-
}, [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),
|
|
5396
5395
|
S("span", {
|
|
5397
5396
|
"data-test": "messaging-system-divider-line",
|
|
5398
5397
|
"aria-hidden": "true",
|
|
5399
|
-
class:
|
|
5398
|
+
class: A(["hidden h-px flex-1 opacity-60 @md/chat:block", st.value])
|
|
5400
5399
|
}, null, 2)
|
|
5401
|
-
])], 8,
|
|
5400
|
+
])], 8, ea)) : t.sender === "system" ? (M(), x("div", {
|
|
5402
5401
|
key: 3,
|
|
5403
5402
|
"data-test": "messaging-system-status-msg",
|
|
5404
|
-
"data-message-id":
|
|
5405
|
-
"data-message-sender":
|
|
5406
|
-
"data-conversation-id":
|
|
5407
|
-
"data-message-sequence":
|
|
5408
|
-
"data-system-kind":
|
|
5409
|
-
"data-issue-code":
|
|
5410
|
-
"data-issue-bucket":
|
|
5411
|
-
"data-streaming":
|
|
5412
|
-
class:
|
|
5413
|
-
}, [
|
|
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", {
|
|
5414
5413
|
class: "i-tabler-info-circle size-4 mt-0.5 shrink-0",
|
|
5415
5414
|
"aria-hidden": "true"
|
|
5416
|
-
}, null, -1)), T(
|
|
5417
|
-
text:
|
|
5415
|
+
}, null, -1)), T(di, {
|
|
5416
|
+
text: t.text,
|
|
5418
5417
|
inverted: !J.value,
|
|
5419
|
-
onClick:
|
|
5420
|
-
}, null, 8, ["text", "inverted"])], 10,
|
|
5418
|
+
onClick: i[3] || (i[3] = _e(() => {}, ["stop"]))
|
|
5419
|
+
}, null, 8, ["text", "inverted"])], 10, ra)) : (M(), x("div", {
|
|
5421
5420
|
key: 4,
|
|
5422
|
-
"data-test":
|
|
5423
|
-
"data-message-id":
|
|
5424
|
-
"data-message-sender":
|
|
5425
|
-
"data-conversation-id":
|
|
5426
|
-
"data-message-sequence":
|
|
5427
|
-
"data-system-kind":
|
|
5428
|
-
"data-streaming":
|
|
5429
|
-
"data-queued": isQueuedMessage(
|
|
5430
|
-
"aria-label": isQueuedMessage(
|
|
5431
|
-
class:
|
|
5432
|
-
"justify-end":
|
|
5433
|
-
"justify-start":
|
|
5434
|
-
"mb-6": isGroupEnd(B.value,
|
|
5435
|
-
"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)
|
|
5436
5435
|
}])
|
|
5437
5436
|
}, [S("div", {
|
|
5438
5437
|
"data-test": "messaging-message-body",
|
|
5439
|
-
class:
|
|
5440
|
-
}, [
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
key:
|
|
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
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
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", {
|
|
5503
5532
|
key: 0,
|
|
5504
5533
|
"data-test": "messaging-tool-activity",
|
|
5505
5534
|
"data-journal-outcome": e.journal.outcome,
|
|
@@ -5507,50 +5536,50 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5507
5536
|
}, [T(et, {
|
|
5508
5537
|
model: e.journal,
|
|
5509
5538
|
"is-light": J.value
|
|
5510
|
-
}, 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", {
|
|
5511
5540
|
key: 1,
|
|
5512
5541
|
"data-test": "messaging-live-text-block",
|
|
5513
|
-
class:
|
|
5514
|
-
}, [T(
|
|
5542
|
+
class: A(["mb-4", J.value ? "text-theme-800" : "text-white/95"])
|
|
5543
|
+
}, [T(di, {
|
|
5515
5544
|
text: e.content,
|
|
5516
5545
|
inverted: !J.value,
|
|
5517
|
-
streaming: e.id ===
|
|
5518
|
-
onClick:
|
|
5546
|
+
streaming: e.id === ne.value,
|
|
5547
|
+
onClick: i[5] || (i[5] = _e(() => {}, ["stop"])),
|
|
5519
5548
|
onAction: handleCardAction
|
|
5520
5549
|
}, null, 8, [
|
|
5521
5550
|
"text",
|
|
5522
5551
|
"inverted",
|
|
5523
5552
|
"streaming"
|
|
5524
|
-
])], 2)) : (
|
|
5553
|
+
])], 2)) : (M(), x("div", {
|
|
5525
5554
|
key: 2,
|
|
5526
5555
|
"data-test": "messaging-tool-activity-tail",
|
|
5527
5556
|
"aria-label": "Assistant is still working",
|
|
5528
|
-
class:
|
|
5529
|
-
}, [...
|
|
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", {
|
|
5530
5559
|
class: "chat-dots chat-dots--mini",
|
|
5531
5560
|
"aria-hidden": "true"
|
|
5532
5561
|
}, [
|
|
5533
5562
|
S("span"),
|
|
5534
5563
|
S("span"),
|
|
5535
5564
|
S("span")
|
|
5536
|
-
], -1)])], 2))], 64))), 128)) :
|
|
5565
|
+
], -1)])], 2))], 64))), 128)) : ve.value ? (M(), x("div", {
|
|
5537
5566
|
key: 1,
|
|
5538
5567
|
"data-test": "messaging-tool-activity",
|
|
5539
|
-
"data-journal-outcome":
|
|
5568
|
+
"data-journal-outcome": ve.value.outcome,
|
|
5540
5569
|
class: "chat-live-enter mb-4 w-full"
|
|
5541
5570
|
}, [T(et, {
|
|
5542
|
-
model:
|
|
5571
|
+
model: ve.value,
|
|
5543
5572
|
"is-light": J.value
|
|
5544
5573
|
}, null, 8, ["model", "is-light"])], 8, ha)) : b("", !0)], 64)) : b("", !0)
|
|
5545
5574
|
], 64))), 128)),
|
|
5546
|
-
|
|
5575
|
+
Se.value ? (M(), x("div", {
|
|
5547
5576
|
key: 1,
|
|
5548
|
-
"data-test":
|
|
5549
|
-
"data-working-description":
|
|
5577
|
+
"data-test": se.value ? "messaging-working-state" : "messaging-thinking-indicator",
|
|
5578
|
+
"data-working-description": se.value,
|
|
5550
5579
|
role: "status",
|
|
5551
5580
|
"aria-live": "polite",
|
|
5552
|
-
class:
|
|
5553
|
-
}, [
|
|
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", {
|
|
5554
5583
|
"data-test": "messaging-thinking-dots",
|
|
5555
5584
|
class: "chat-dots shrink-0",
|
|
5556
5585
|
"aria-hidden": "true"
|
|
@@ -5558,25 +5587,25 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5558
5587
|
S("span"),
|
|
5559
5588
|
S("span"),
|
|
5560
5589
|
S("span")
|
|
5561
|
-
], -1)),
|
|
5562
|
-
|
|
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", {
|
|
5563
5592
|
key: 2,
|
|
5564
5593
|
"data-test": "messaging-transient-issue",
|
|
5565
|
-
"data-issue-code":
|
|
5594
|
+
"data-issue-code": U.value.code,
|
|
5566
5595
|
role: "alert",
|
|
5567
|
-
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"])
|
|
5568
5597
|
}, [
|
|
5569
|
-
|
|
5598
|
+
i[23] || (i[23] = S("i", {
|
|
5570
5599
|
class: "i-tabler-alert-circle size-3.5 shrink-0 text-red-500",
|
|
5571
5600
|
"aria-hidden": "true"
|
|
5572
5601
|
}, null, -1)),
|
|
5573
|
-
S("span", ba, [S("span", xa, [C(U
|
|
5574
|
-
|
|
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", {
|
|
5575
5604
|
key: 0,
|
|
5576
|
-
href:
|
|
5605
|
+
href: U.value.actionUrl,
|
|
5577
5606
|
class: "shrink-0 underline underline-offset-2",
|
|
5578
|
-
onClick:
|
|
5579
|
-
}, U
|
|
5607
|
+
onClick: i[6] || (i[6] = _e(() => {}, ["stop"]))
|
|
5608
|
+
}, R(U.value.actionLabel), 9, Ca)) : b("", !0)
|
|
5580
5609
|
], 10, ya)) : b("", !0)
|
|
5581
5610
|
], 2)]),
|
|
5582
5611
|
_: 3
|
|
@@ -5587,40 +5616,40 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5587
5616
|
]),
|
|
5588
5617
|
S("div", {
|
|
5589
5618
|
"data-test": "messaging-composer-footer",
|
|
5590
|
-
inert:
|
|
5591
|
-
"aria-hidden":
|
|
5592
|
-
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)]", [
|
|
5593
5622
|
B.value.length === 0 || e.centered ? "relative shrink-0" : "absolute bottom-0",
|
|
5594
5623
|
e.centered && B.value.length > 0 ? "pt-0 sm:pb-7" : "pt-3",
|
|
5595
5624
|
J.value ? e.centered ? "bg-transparent" : "bg-theme-0" : "bg-gradient-to-t from-black/90 via-black/60 to-transparent"
|
|
5596
5625
|
]])
|
|
5597
|
-
}, [
|
|
5626
|
+
}, [ae(t.$slots, "composer", {}, () => [De.value ? (M(), x("div", {
|
|
5598
5627
|
key: 0,
|
|
5599
5628
|
"data-test": "messaging-seat",
|
|
5600
|
-
"data-seat-state":
|
|
5629
|
+
"data-seat-state": Ee.value,
|
|
5601
5630
|
role: "status",
|
|
5602
5631
|
"aria-live": "polite",
|
|
5603
|
-
class:
|
|
5604
|
-
},
|
|
5605
|
-
|
|
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", {
|
|
5606
5635
|
key: 0,
|
|
5607
|
-
class:
|
|
5608
|
-
}, [(
|
|
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", {
|
|
5609
5638
|
key: t,
|
|
5610
5639
|
class: "relative shrink-0 group"
|
|
5611
|
-
}, [e.type === "image" ? (
|
|
5640
|
+
}, [e.type === "image" ? (M(), x("img", {
|
|
5612
5641
|
key: 0,
|
|
5613
5642
|
src: e.src,
|
|
5614
5643
|
alt: e.filename,
|
|
5615
|
-
class:
|
|
5616
|
-
}, 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", {
|
|
5617
5646
|
key: 1,
|
|
5618
|
-
class:
|
|
5619
|
-
}, [
|
|
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", {
|
|
5620
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",
|
|
5621
5650
|
onClick: (e) => removeAttachment(t)
|
|
5622
|
-
}, [...
|
|
5623
|
-
|
|
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", {
|
|
5624
5653
|
key: 1,
|
|
5625
5654
|
ref_key: "fileInput",
|
|
5626
5655
|
ref: o,
|
|
@@ -5631,22 +5660,22 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5631
5660
|
}, null, 544)) : b("", !0),
|
|
5632
5661
|
S("div", {
|
|
5633
5662
|
"data-test": "messaging-composer",
|
|
5634
|
-
"data-composer-action":
|
|
5635
|
-
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"]]),
|
|
5636
5665
|
onClick: focusComposer
|
|
5637
|
-
}, [
|
|
5666
|
+
}, [qe.value ? (M(), x("div", {
|
|
5638
5667
|
key: 1,
|
|
5639
5668
|
"data-test": "messaging-recording-state",
|
|
5640
|
-
class:
|
|
5669
|
+
class: A(["flex min-w-0 items-center gap-2 py-1", J.value ? "text-theme-700" : "text-white/80"])
|
|
5641
5670
|
}, [
|
|
5642
|
-
|
|
5643
|
-
S("span", Ma,
|
|
5644
|
-
S("span", { class:
|
|
5645
|
-
], 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", {
|
|
5646
5675
|
key: 0,
|
|
5647
5676
|
ref_key: "textarea",
|
|
5648
|
-
ref:
|
|
5649
|
-
"onUpdate:modelValue":
|
|
5677
|
+
ref: a,
|
|
5678
|
+
"onUpdate:modelValue": i[7] || (i[7] = (e) => ke.value = e),
|
|
5650
5679
|
"data-test": "messaging-input",
|
|
5651
5680
|
rows: "1",
|
|
5652
5681
|
enterkeyhint: "send",
|
|
@@ -5655,60 +5684,60 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5655
5684
|
autocapitalize: "sentences",
|
|
5656
5685
|
autocorrect: "on",
|
|
5657
5686
|
spellcheck: "true",
|
|
5658
|
-
placeholder:
|
|
5659
|
-
disabled:
|
|
5687
|
+
placeholder: Te.value,
|
|
5688
|
+
disabled: we.value,
|
|
5660
5689
|
style: {
|
|
5661
5690
|
fontSize: "16px",
|
|
5662
5691
|
resize: "none"
|
|
5663
5692
|
},
|
|
5664
|
-
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"]),
|
|
5665
5694
|
onKeydown: handleKeydown
|
|
5666
|
-
}, null, 42, ja)), [[
|
|
5695
|
+
}, null, 42, ja)), [[ce, ke.value]]), S("div", Na, [
|
|
5667
5696
|
S("button", {
|
|
5668
|
-
class:
|
|
5669
|
-
|
|
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",
|
|
5670
5699
|
J.value ? "text-theme-500" : "text-white/50",
|
|
5671
|
-
|
|
5700
|
+
je.value || Ne.value ? "opacity-50 pointer-events-none" : ""
|
|
5672
5701
|
]]),
|
|
5673
|
-
disabled:
|
|
5674
|
-
"aria-label":
|
|
5675
|
-
title:
|
|
5676
|
-
onClick:
|
|
5677
|
-
}, [
|
|
5678
|
-
|
|
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)),
|
|
5679
5708
|
S("div", Ra, [
|
|
5680
|
-
|
|
5709
|
+
qe.value && !Je.value && !Qe.value ? (M(), x("button", {
|
|
5681
5710
|
key: 0,
|
|
5682
5711
|
"data-test": "messaging-record-discard-btn",
|
|
5683
|
-
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"]),
|
|
5684
5713
|
"aria-label": "Discard recording",
|
|
5685
5714
|
title: "Discard recording",
|
|
5686
|
-
onClick:
|
|
5687
|
-
}, [...
|
|
5715
|
+
onClick: i[9] || (i[9] = (e) => finishRecording({ cancelled: !0 }))
|
|
5716
|
+
}, [...i[27] || (i[27] = [S("i", {
|
|
5688
5717
|
class: "i-tabler-x size-[18px]",
|
|
5689
5718
|
"aria-hidden": "true"
|
|
5690
5719
|
}, null, -1)])], 2)) : b("", !0),
|
|
5691
|
-
(
|
|
5720
|
+
(Ke.value || qe.value) && !Je.value && !Qe.value ? (M(), x("button", {
|
|
5692
5721
|
key: 1,
|
|
5693
5722
|
"data-test": "messaging-record-audio-btn",
|
|
5694
|
-
class:
|
|
5695
|
-
"aria-label":
|
|
5696
|
-
title:
|
|
5697
|
-
onPointerdown:
|
|
5698
|
-
onPointerup:
|
|
5699
|
-
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"]),
|
|
5700
5729
|
onClick: onRecordClick,
|
|
5701
|
-
onKeydown:
|
|
5702
|
-
}, [S("i", { class:
|
|
5703
|
-
|
|
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", {
|
|
5704
5733
|
key: 2,
|
|
5705
5734
|
"data-test": "messaging-voice-start-btn",
|
|
5706
|
-
class:
|
|
5707
|
-
disabled:
|
|
5708
|
-
"aria-label":
|
|
5709
|
-
title:
|
|
5710
|
-
onClick:
|
|
5711
|
-
}, [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([
|
|
5712
5741
|
7,
|
|
5713
5742
|
13,
|
|
5714
5743
|
16,
|
|
@@ -5717,33 +5746,33 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5717
5746
|
], (e) => S("span", {
|
|
5718
5747
|
key: e,
|
|
5719
5748
|
class: "w-[2px] rounded-full bg-current",
|
|
5720
|
-
style:
|
|
5721
|
-
}, 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", {
|
|
5722
5751
|
key: 0,
|
|
5723
5752
|
"data-test": "messaging-secondary-stop-btn",
|
|
5724
|
-
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"]),
|
|
5725
5754
|
"aria-label": "Stop work",
|
|
5726
5755
|
title: "Stop work",
|
|
5727
|
-
onClick:
|
|
5728
|
-
}, [...
|
|
5756
|
+
onClick: i[12] || (i[12] = (t) => e.chatController?.stopChatTurn())
|
|
5757
|
+
}, [...i[29] || (i[29] = [S("i", {
|
|
5729
5758
|
class: "i-tabler-player-stop-filled size-3.5",
|
|
5730
5759
|
"aria-hidden": "true"
|
|
5731
5760
|
}, null, -1), S("span", { class: "sr-only" }, "Stop work", -1)])], 2)) : b("", !0), S("button", {
|
|
5732
5761
|
"data-test": "messaging-send-btn",
|
|
5733
|
-
"data-composer-action":
|
|
5734
|
-
class:
|
|
5735
|
-
disabled: !
|
|
5736
|
-
"aria-label":
|
|
5737
|
-
title:
|
|
5738
|
-
onClick:
|
|
5739
|
-
}, [
|
|
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))
|
|
5740
5769
|
])
|
|
5741
5770
|
])], 10, Aa),
|
|
5742
|
-
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)
|
|
5743
5772
|
], 64))], !0)], 10, wa)
|
|
5744
5773
|
], 2));
|
|
5745
5774
|
}
|
|
5746
|
-
}), [["__scopeId", "data-v-
|
|
5775
|
+
}), [["__scopeId", "data-v-05d471e7"]]), Ya = { class: "bot-wrap" }, Xa = {
|
|
5747
5776
|
key: 0,
|
|
5748
5777
|
class: "flex items-center justify-center h-full"
|
|
5749
5778
|
}, Za = {
|
|
@@ -5751,12 +5780,12 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5751
5780
|
class: "flex h-full flex-col items-center justify-center gap-4 px-6 text-center",
|
|
5752
5781
|
role: "status",
|
|
5753
5782
|
"aria-live": "polite",
|
|
5754
|
-
"data-test": "
|
|
5783
|
+
"data-test": "bot-unavailable"
|
|
5755
5784
|
}, Qa = /* @__PURE__ */ k({
|
|
5756
|
-
__name: "
|
|
5785
|
+
__name: "BotWrap",
|
|
5757
5786
|
props: {
|
|
5758
5787
|
sdk: {},
|
|
5759
|
-
|
|
5788
|
+
bot: {},
|
|
5760
5789
|
handle: {},
|
|
5761
5790
|
context: {},
|
|
5762
5791
|
clientContext: {},
|
|
@@ -5769,102 +5798,102 @@ var Ni = ["data-voice-state", "data-voice-activity"], Pi = ["src"], Fi = {
|
|
|
5769
5798
|
apiBase: {}
|
|
5770
5799
|
},
|
|
5771
5800
|
setup(e) {
|
|
5772
|
-
let t =
|
|
5801
|
+
let t = o("BotWrap"), r = e, i = r.sdk || n.getInstance({
|
|
5773
5802
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
5774
|
-
...
|
|
5775
|
-
}),
|
|
5776
|
-
async function
|
|
5777
|
-
if (
|
|
5778
|
-
t.debug("
|
|
5779
|
-
|
|
5780
|
-
handle:
|
|
5781
|
-
}),
|
|
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;
|
|
5782
5811
|
return;
|
|
5783
5812
|
}
|
|
5784
|
-
if (!
|
|
5785
|
-
|
|
5813
|
+
if (!r.handle) {
|
|
5814
|
+
c.value = "No handle or bot provided", t.warn("BotWrap mounted without handle or bot", {
|
|
5786
5815
|
propsReceived: {
|
|
5787
|
-
handle:
|
|
5788
|
-
|
|
5789
|
-
context:
|
|
5790
|
-
apiBase:
|
|
5816
|
+
handle: r.handle,
|
|
5817
|
+
bot: r.bot,
|
|
5818
|
+
context: r.clientContext ?? r.context,
|
|
5819
|
+
apiBase: r.apiBase
|
|
5791
5820
|
},
|
|
5792
5821
|
sdkState: {
|
|
5793
|
-
isDev:
|
|
5794
|
-
apiBase:
|
|
5822
|
+
isDev: i.isDev,
|
|
5823
|
+
apiBase: i.apiBase
|
|
5795
5824
|
}
|
|
5796
|
-
}),
|
|
5825
|
+
}), a.value = !1;
|
|
5797
5826
|
return;
|
|
5798
5827
|
}
|
|
5799
5828
|
try {
|
|
5800
|
-
|
|
5801
|
-
let e = await
|
|
5802
|
-
e ? (
|
|
5803
|
-
|
|
5804
|
-
handle: e.handle
|
|
5805
|
-
}), 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({
|
|
5806
5835
|
event: "view_profile",
|
|
5807
|
-
|
|
5836
|
+
botId: e.botId.value,
|
|
5808
5837
|
properties: { viewSource: "widget" }
|
|
5809
|
-
})) : (
|
|
5810
|
-
handle:
|
|
5811
|
-
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,
|
|
5812
5841
|
sdkState: {
|
|
5813
|
-
isDev:
|
|
5814
|
-
apiBase:
|
|
5815
|
-
loading:
|
|
5842
|
+
isDev: i.isDev,
|
|
5843
|
+
apiBase: i.apiBase,
|
|
5844
|
+
loading: i.loading.value
|
|
5816
5845
|
}
|
|
5817
5846
|
}));
|
|
5818
5847
|
} catch (e) {
|
|
5819
|
-
|
|
5820
|
-
handle:
|
|
5848
|
+
c.value = e instanceof Error ? e.message : "Failed to fetch bot", t.error("Exception while fetching public bot", {
|
|
5849
|
+
handle: r.handle,
|
|
5821
5850
|
error: e instanceof Error ? {
|
|
5822
5851
|
message: e.message,
|
|
5823
5852
|
stack: e.stack
|
|
5824
5853
|
} : e,
|
|
5825
5854
|
sdkState: {
|
|
5826
|
-
isDev:
|
|
5827
|
-
apiBase:
|
|
5828
|
-
error:
|
|
5855
|
+
isDev: i.isDev,
|
|
5856
|
+
apiBase: i.apiBase,
|
|
5857
|
+
error: i.error.value
|
|
5829
5858
|
}
|
|
5830
5859
|
});
|
|
5831
5860
|
} finally {
|
|
5832
|
-
|
|
5861
|
+
a.value = !1, s.value || t.debug("BotWrap component will render unavailable state", {
|
|
5833
5862
|
state: {
|
|
5834
|
-
loading:
|
|
5835
|
-
|
|
5836
|
-
error:
|
|
5863
|
+
loading: a.value,
|
|
5864
|
+
hasBot: !!s.value,
|
|
5865
|
+
error: c.value
|
|
5837
5866
|
},
|
|
5838
5867
|
props: {
|
|
5839
|
-
handle:
|
|
5840
|
-
context:
|
|
5841
|
-
apiBase:
|
|
5868
|
+
handle: r.handle,
|
|
5869
|
+
context: r.clientContext ?? r.context,
|
|
5870
|
+
apiBase: r.apiBase
|
|
5842
5871
|
},
|
|
5843
5872
|
sdkState: {
|
|
5844
|
-
isDev:
|
|
5845
|
-
apiBase:
|
|
5846
|
-
error:
|
|
5873
|
+
isDev: i.isDev,
|
|
5874
|
+
apiBase: i.apiBase,
|
|
5875
|
+
error: i.error.value
|
|
5847
5876
|
}
|
|
5848
5877
|
});
|
|
5849
5878
|
}
|
|
5850
5879
|
}
|
|
5851
|
-
return
|
|
5852
|
-
sdk:
|
|
5853
|
-
|
|
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,
|
|
5854
5883
|
context: e.clientContext ?? e.context,
|
|
5855
5884
|
firstMessage: e.firstMessage,
|
|
5856
5885
|
buttonText: e.buttonText,
|
|
5857
5886
|
buttonIcon: e.buttonIcon,
|
|
5858
|
-
loading:
|
|
5859
|
-
}, 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", {
|
|
5860
5889
|
type: "button",
|
|
5861
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",
|
|
5862
|
-
"data-test": "
|
|
5863
|
-
onClick:
|
|
5891
|
+
"data-test": "bot-unavailable-retry",
|
|
5892
|
+
onClick: loadBot
|
|
5864
5893
|
}, " Try again ")])) : b("", !0)]));
|
|
5865
5894
|
}
|
|
5866
5895
|
});
|
|
5867
5896
|
//#endregion
|
|
5868
|
-
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 };
|
|
5869
5898
|
|
|
5870
|
-
//# sourceMappingURL=
|
|
5899
|
+
//# sourceMappingURL=BotWrap.js.map
|