@singlebase/elements 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{authui-display-BCZBP7HR.js → authui-display-CKfGK5va.js} +519 -503
- package/dist/authui-display-CKfGK5va.js.map +1 -0
- package/dist/{authui-display-CLGFSqRi.cjs → authui-display-aWNht0cW.cjs} +38 -58
- package/dist/authui-display-aWNht0cW.cjs.map +1 -0
- package/dist/authui.cjs +1 -1
- package/dist/authui.js +2 -2
- package/dist/chat-C-gsskho.cjs +3258 -0
- package/dist/chat-C-gsskho.cjs.map +1 -0
- package/dist/{chat-bXaRWel7.js → chat-CEh6RygY.js} +1957 -1137
- package/dist/chat-CEh6RygY.js.map +1 -0
- package/dist/chat-messages.d.ts +11 -5
- package/dist/chat.cjs +1 -1
- package/dist/chat.d.ts +4 -3
- package/dist/chat.js +8 -6
- package/dist/elements/authui-base.d.ts +2 -0
- package/dist/elements/authui-buttons.d.ts +1 -1
- package/dist/elements/authui-display.d.ts +1 -1
- package/dist/elements/authui.d.ts +5 -1
- package/dist/elements/chat.d.ts +153 -10
- package/dist/elements/uploader.d.ts +14 -0
- package/dist/{files-BOwtpYyQ.js → files-DDJWPzZW.js} +82 -35
- package/dist/files-DDJWPzZW.js.map +1 -0
- package/dist/files-DyxcjZsx.cjs +75 -0
- package/dist/files-DyxcjZsx.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +24 -22
- package/dist/singlebase-elements.min.js +3799 -2892
- package/dist/singlebase-elements.min.js.map +1 -1
- package/dist/styles/branding.d.ts +5 -0
- package/dist/styles/tokens.d.ts +2 -0
- package/dist/{uploader-DGV2y9uT.cjs → uploader-660JIgIN.cjs} +53 -76
- package/dist/uploader-660JIgIN.cjs.map +1 -0
- package/dist/{uploader-abQoem5q.js → uploader-vfczkX51.js} +294 -271
- package/dist/uploader-vfczkX51.js.map +1 -0
- package/dist/uploader.cjs +1 -1
- package/dist/uploader.js +2 -2
- package/dist/utils/branding.d.ts +8 -0
- package/dist/utils/markdown.d.ts +69 -12
- package/dist/utils/svg.d.ts +10 -0
- package/package.json +3 -3
- package/dist/authui-display-BCZBP7HR.js.map +0 -1
- package/dist/authui-display-CLGFSqRi.cjs.map +0 -1
- package/dist/chat-DRenTJlI.cjs +0 -3001
- package/dist/chat-DRenTJlI.cjs.map +0 -1
- package/dist/chat-bXaRWel7.js.map +0 -1
- package/dist/files-BOwtpYyQ.js.map +0 -1
- package/dist/files-DW8A4Jl-.cjs +0 -38
- package/dist/files-DW8A4Jl-.cjs.map +0 -1
- package/dist/uploader-DGV2y9uT.cjs.map +0 -1
- package/dist/uploader-abQoem5q.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ft = Object.defineProperty;
|
|
2
|
+
var bt = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var p = (n, e, t) => (
|
|
8
|
-
import { css as
|
|
9
|
-
import { property as
|
|
10
|
-
import { repeat as
|
|
11
|
-
import { getDefaultClient as
|
|
12
|
-
import {
|
|
5
|
+
var Ut = (n, e, t) => e in n ? Ft(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
6
|
+
var M = (n, e, t) => Ut(n, typeof e != "symbol" ? e + "" : e, t), xt = (n, e, t) => e.has(n) || bt("Cannot " + t);
|
|
7
|
+
var p = (n, e, t) => (xt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), h = (n, e, t) => e.has(n) ? bt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), u = (n, e, t, s) => (xt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
|
|
8
|
+
import { css as Pt, LitElement as Kt, html as o, nothing as f, svg as I } from "lit";
|
|
9
|
+
import { property as v, state as y, customElement as Wt } from "lit/decorators.js";
|
|
10
|
+
import { repeat as Jt } from "lit/directives/repeat.js";
|
|
11
|
+
import { getDefaultClient as Ht } from "@singlebase/core";
|
|
12
|
+
import { a as L, e as vt, j as Gt, t as qt, b as Vt } from "./files-DDJWPzZW.js";
|
|
13
13
|
if (typeof CSS < "u" && "registerProperty" in CSS)
|
|
14
14
|
try {
|
|
15
15
|
CSS.registerProperty({
|
|
@@ -20,7 +20,7 @@ if (typeof CSS < "u" && "registerProperty" in CSS)
|
|
|
20
20
|
});
|
|
21
21
|
} catch {
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const Xt = Pt`
|
|
24
24
|
:host {
|
|
25
25
|
--c-ink: var(--sb-ink, #16181a);
|
|
26
26
|
--c-ink2: var(--sb-ink-2, #41464b);
|
|
@@ -37,7 +37,7 @@ const wt = bt`
|
|
|
37
37
|
--c-danger: var(--sb-danger, #b4231a);
|
|
38
38
|
--c-ok: var(--sb-ok, #0f6b4a);
|
|
39
39
|
--c-mono: var(--sb-mono, "Geist Mono", ui-monospace, monospace);
|
|
40
|
-
--c-r: var(--sb-radius, 4px);
|
|
40
|
+
--c-r: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
41
41
|
--c-r2: calc(var(--c-r) * 1.5);
|
|
42
42
|
--c-r3: calc(var(--c-r) * 2);
|
|
43
43
|
--c-r4: calc(var(--c-r) * 3);
|
|
@@ -482,6 +482,17 @@ const wt = bt`
|
|
|
482
482
|
outline: none;
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
+
.side-extra {
|
|
486
|
+
display: none;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.side-extra.filled {
|
|
490
|
+
display: block;
|
|
491
|
+
padding: 12px 16px;
|
|
492
|
+
border-top: 1px solid var(--c-line);
|
|
493
|
+
font-size: 12.5px;
|
|
494
|
+
}
|
|
495
|
+
|
|
485
496
|
.side-note {
|
|
486
497
|
font-size: 12.5px;
|
|
487
498
|
color: var(--c-muted);
|
|
@@ -654,6 +665,21 @@ const wt = bt`
|
|
|
654
665
|
|
|
655
666
|
/* ── welcome ──────────────────────────────────────────── */
|
|
656
667
|
|
|
668
|
+
.welcome-slot {
|
|
669
|
+
min-height: 100%;
|
|
670
|
+
display: flex;
|
|
671
|
+
flex-direction: column;
|
|
672
|
+
justify-content: center;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
::slotted([slot="welcome"]) {
|
|
676
|
+
box-sizing: border-box;
|
|
677
|
+
width: 100%;
|
|
678
|
+
max-width: 640px;
|
|
679
|
+
margin: 0 auto;
|
|
680
|
+
padding: 28px 18px;
|
|
681
|
+
}
|
|
682
|
+
|
|
657
683
|
.welcome {
|
|
658
684
|
max-width: 640px;
|
|
659
685
|
min-height: 100%;
|
|
@@ -1050,6 +1076,168 @@ const wt = bt`
|
|
|
1050
1076
|
padding: 1px 5px;
|
|
1051
1077
|
}
|
|
1052
1078
|
|
|
1079
|
+
.answer h3.h1 {
|
|
1080
|
+
font-size: 18px;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
.answer h3.h2 {
|
|
1084
|
+
font-size: 16.5px;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
.answer h3.h4 {
|
|
1088
|
+
font-size: 14.5px;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
.answer hr {
|
|
1092
|
+
width: 100%;
|
|
1093
|
+
border: none;
|
|
1094
|
+
border-top: 1px solid var(--c-line);
|
|
1095
|
+
margin: 4px 0;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
.answer li.task {
|
|
1099
|
+
list-style: none;
|
|
1100
|
+
margin-left: -18px;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
.answer li.task input {
|
|
1104
|
+
margin: 0 6px 0 0;
|
|
1105
|
+
vertical-align: -1px;
|
|
1106
|
+
accent-color: var(--c-brand);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
.callout {
|
|
1110
|
+
display: flex;
|
|
1111
|
+
flex-direction: column;
|
|
1112
|
+
gap: 4px;
|
|
1113
|
+
font-size: 13.5px;
|
|
1114
|
+
line-height: 1.6;
|
|
1115
|
+
padding: 10px 14px;
|
|
1116
|
+
border: 1px solid var(--c-line);
|
|
1117
|
+
border-left: 3px solid var(--callout, var(--c-ink));
|
|
1118
|
+
border-radius: var(--c-r2);
|
|
1119
|
+
background: color-mix(in srgb, var(--callout, var(--c-ink)) 7%, var(--c-bg));
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
.callout-title {
|
|
1123
|
+
font-weight: 600;
|
|
1124
|
+
color: var(--callout, var(--c-ink));
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
.callout.note {
|
|
1128
|
+
--callout: oklch(0.55 0.15 255);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
.callout.tip {
|
|
1132
|
+
--callout: oklch(0.55 0.12 160);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
.callout.important {
|
|
1136
|
+
--callout: oklch(0.52 0.17 300);
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
.callout.warning {
|
|
1140
|
+
--callout: oklch(0.6 0.14 70);
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
.callout.caution {
|
|
1144
|
+
--callout: var(--c-danger);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
.jtree {
|
|
1148
|
+
padding: 10px 14px;
|
|
1149
|
+
overflow-x: auto;
|
|
1150
|
+
font-family: var(--c-mono);
|
|
1151
|
+
font-size: 12.5px;
|
|
1152
|
+
line-height: 1.7;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
.jtree summary {
|
|
1156
|
+
cursor: pointer;
|
|
1157
|
+
list-style-position: outside;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
.jkids {
|
|
1161
|
+
padding-left: 16px;
|
|
1162
|
+
border-left: 1px solid var(--c-line);
|
|
1163
|
+
margin-left: 4px;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
.jkey {
|
|
1167
|
+
color: var(--c-ink2);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
.jmeta {
|
|
1171
|
+
color: var(--c-muted);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
.jv.string {
|
|
1175
|
+
color: oklch(0.52 0.12 160);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
.jv.number {
|
|
1179
|
+
color: oklch(0.55 0.15 255);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
.jv.boolean,
|
|
1183
|
+
.jv.null {
|
|
1184
|
+
color: oklch(0.52 0.17 300);
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
.table th button.sort {
|
|
1188
|
+
display: inline-flex;
|
|
1189
|
+
align-items: center;
|
|
1190
|
+
gap: 4px;
|
|
1191
|
+
font: inherit;
|
|
1192
|
+
color: inherit;
|
|
1193
|
+
background: none;
|
|
1194
|
+
border: none;
|
|
1195
|
+
padding: 0;
|
|
1196
|
+
cursor: pointer;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
.table th .arrow {
|
|
1200
|
+
font-size: 10px;
|
|
1201
|
+
opacity: 0.5;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
.table th[aria-sort="ascending"] .arrow,
|
|
1205
|
+
.table th[aria-sort="descending"] .arrow {
|
|
1206
|
+
opacity: 1;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
.table-note {
|
|
1210
|
+
padding: 7px 12px;
|
|
1211
|
+
font-size: 12px;
|
|
1212
|
+
color: var(--c-muted);
|
|
1213
|
+
border-top: 1px solid var(--c-line2);
|
|
1214
|
+
background: var(--c-bg2);
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
figure.svg {
|
|
1218
|
+
margin: 0;
|
|
1219
|
+
display: flex;
|
|
1220
|
+
flex-direction: column;
|
|
1221
|
+
gap: 6px;
|
|
1222
|
+
align-items: flex-start;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
figure.svg img {
|
|
1226
|
+
display: block;
|
|
1227
|
+
width: min(100%, 480px);
|
|
1228
|
+
height: auto;
|
|
1229
|
+
max-height: 420px;
|
|
1230
|
+
object-fit: contain;
|
|
1231
|
+
padding: 12px;
|
|
1232
|
+
border: 1px solid var(--c-line);
|
|
1233
|
+
border-radius: var(--c-r2);
|
|
1234
|
+
background: #ffffff;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
.custom-block {
|
|
1238
|
+
min-width: 0;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1053
1241
|
.quote {
|
|
1054
1242
|
font-size: 13.5px;
|
|
1055
1243
|
line-height: 1.6;
|
|
@@ -1707,6 +1895,10 @@ const wt = bt`
|
|
|
1707
1895
|
padding: 0 12px 12px;
|
|
1708
1896
|
}
|
|
1709
1897
|
|
|
1898
|
+
.composer-wrap.reader {
|
|
1899
|
+
padding-top: 10px;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1710
1902
|
.composer-col {
|
|
1711
1903
|
max-width: 760px;
|
|
1712
1904
|
margin: 0 auto;
|
|
@@ -1891,8 +2083,7 @@ const wt = bt`
|
|
|
1891
2083
|
color: var(--c-danger);
|
|
1892
2084
|
}
|
|
1893
2085
|
|
|
1894
|
-
.footnote
|
|
1895
|
-
.branding {
|
|
2086
|
+
.footnote {
|
|
1896
2087
|
text-align: center;
|
|
1897
2088
|
font-size: 11.5px;
|
|
1898
2089
|
color: var(--c-muted);
|
|
@@ -1903,19 +2094,6 @@ const wt = bt`
|
|
|
1903
2094
|
margin-top: -4px;
|
|
1904
2095
|
}
|
|
1905
2096
|
|
|
1906
|
-
.branding a {
|
|
1907
|
-
font-family: var(--c-mono);
|
|
1908
|
-
font-size: 10.5px;
|
|
1909
|
-
letter-spacing: 0.06em;
|
|
1910
|
-
text-transform: uppercase;
|
|
1911
|
-
color: var(--c-muted);
|
|
1912
|
-
text-decoration: none;
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
.branding a:hover {
|
|
1916
|
-
color: var(--c-ink);
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
2097
|
.toast {
|
|
1920
2098
|
position: absolute;
|
|
1921
2099
|
left: 50%;
|
|
@@ -2273,19 +2451,15 @@ const wt = bt`
|
|
|
2273
2451
|
height: auto;
|
|
2274
2452
|
}
|
|
2275
2453
|
}
|
|
2276
|
-
`,
|
|
2454
|
+
`, Yt = {
|
|
2277
2455
|
eyebrowChat: "Chat",
|
|
2278
2456
|
eyebrowRag: "Grounded answers",
|
|
2279
|
-
eyebrowRich: "Charts · tables · images",
|
|
2280
2457
|
headingChat: "What can I help with?",
|
|
2281
2458
|
headingRag: "Ask your knowledge base",
|
|
2282
|
-
headingRich: "Ask for a chart or a table",
|
|
2283
2459
|
descriptionChat: "Ask anything. Attach text files to give it more context.",
|
|
2284
2460
|
descriptionRag: "Answers are grounded in your sources, with a citation for every claim. Attach text files to search them too.",
|
|
2285
|
-
descriptionRich: "Answers come back with charts, tables and images when they help. Attach CSV or JSON files to use your own data.",
|
|
2286
2461
|
placeholderChat: "Message {name}…",
|
|
2287
2462
|
placeholderRag: "Ask about your sources…",
|
|
2288
|
-
placeholderRich: "Ask for a chart, table or breakdown…",
|
|
2289
2463
|
footnote: "{name} can make mistakes. Check important details.",
|
|
2290
2464
|
attach: "Attach files",
|
|
2291
2465
|
send: "Send message",
|
|
@@ -2295,7 +2469,6 @@ const wt = bt`
|
|
|
2295
2469
|
dropSub: "Text, Markdown, CSV and JSON files are added as context.",
|
|
2296
2470
|
thinking: "Thinking",
|
|
2297
2471
|
searching: "Searching sources",
|
|
2298
|
-
building: "Building charts and tables",
|
|
2299
2472
|
chats: "Chats",
|
|
2300
2473
|
newChat: "New chat",
|
|
2301
2474
|
searchChats: "Search chats",
|
|
@@ -2350,6 +2523,17 @@ const wt = bt`
|
|
|
2350
2523
|
copyReference: "Copy passage with reference",
|
|
2351
2524
|
alsoCited: "Also cited",
|
|
2352
2525
|
close: "Close",
|
|
2526
|
+
renderingChart: "Rendering chart",
|
|
2527
|
+
renderingSvg: "Rendering drawing",
|
|
2528
|
+
copySvg: "Copy SVG",
|
|
2529
|
+
showRaw: "View raw",
|
|
2530
|
+
showFormatted: "View formatted",
|
|
2531
|
+
showingRows: "Showing {n} of {total} rows",
|
|
2532
|
+
calloutNote: "Note",
|
|
2533
|
+
calloutTip: "Tip",
|
|
2534
|
+
calloutImportant: "Important",
|
|
2535
|
+
calloutWarning: "Warning",
|
|
2536
|
+
calloutCaution: "Caution",
|
|
2353
2537
|
undo: "Undo",
|
|
2354
2538
|
chatDeleted: "Chat deleted",
|
|
2355
2539
|
messageDeleted: "Message deleted",
|
|
@@ -2374,70 +2558,128 @@ const wt = bt`
|
|
|
2374
2558
|
dismiss: "Dismiss",
|
|
2375
2559
|
brandingLabel: "Chat by Singlebase"
|
|
2376
2560
|
};
|
|
2377
|
-
function
|
|
2378
|
-
return {
|
|
2561
|
+
function Qt(n) {
|
|
2562
|
+
return { ...Yt, ...n ?? {} };
|
|
2379
2563
|
}
|
|
2380
|
-
const
|
|
2381
|
-
function
|
|
2564
|
+
const Zt = /^\|.*\|$/, wt = /^\|[\s:|-]+\|$/, yt = /^!\[([^\]]*)\]\(([^)]*)\)$/, kt = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/, $t = /^\[( |x|X)\]\s+/, es = /^(-{3,}|\*{3,}|_{3,})$/, ts = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*(.*)$/i, ss = ["note", "tip", "important", "warning", "caution"];
|
|
2565
|
+
function is(n) {
|
|
2382
2566
|
const e = [], t = (n ?? "").replace(/\r/g, "").split("```");
|
|
2383
|
-
return t.forEach((
|
|
2384
|
-
if (
|
|
2385
|
-
const a =
|
|
2386
|
-
`),
|
|
2387
|
-
|
|
2388
|
-
const x = c ? null : Ot(l);
|
|
2389
|
-
e.push(x ? { type: "chart", spec: x } : { type: "chartPending" });
|
|
2390
|
-
} else
|
|
2391
|
-
e.push({ type: "code", lang: o || "code", text: l });
|
|
2567
|
+
return t.forEach((s, i) => {
|
|
2568
|
+
if (i % 2 === 1) {
|
|
2569
|
+
const a = s.indexOf(`
|
|
2570
|
+
`), r = (a > -1 ? s.slice(0, a) : s).trim(), l = (a > -1 ? s.slice(a + 1) : "").replace(/\n$/, "");
|
|
2571
|
+
e.push(as(r, l, i === t.length - 1));
|
|
2392
2572
|
return;
|
|
2393
2573
|
}
|
|
2394
|
-
for (const a of
|
|
2395
|
-
|
|
2396
|
-
o && e.push(...pt(o));
|
|
2397
|
-
}
|
|
2574
|
+
for (const a of s.split(/\n{2,}/))
|
|
2575
|
+
a.trim() && e.push(...Bt(a));
|
|
2398
2576
|
}), e;
|
|
2399
2577
|
}
|
|
2400
|
-
function
|
|
2578
|
+
function as(n, e, t) {
|
|
2579
|
+
const [s = "", ...i] = n.split(/\s+/), a = s.toLowerCase();
|
|
2580
|
+
if (a === "chart") {
|
|
2581
|
+
const r = t ? null : os(e);
|
|
2582
|
+
return r ? { type: "chart", spec: r } : { type: "pending", kind: "chart" };
|
|
2583
|
+
}
|
|
2584
|
+
if (a === "svg")
|
|
2585
|
+
return t || !/<svg[\s>]/i.test(e) ? { type: "pending", kind: "svg" } : { type: "svg", source: e.trim() };
|
|
2586
|
+
if (!t && (a === "csv" || a === "tsv")) {
|
|
2587
|
+
const r = rs(e, a === "tsv" ? " " : ",");
|
|
2588
|
+
if (r.length > 1)
|
|
2589
|
+
return { type: "table", head: r[0], rows: r.slice(1), align: r[0].map(() => null) };
|
|
2590
|
+
}
|
|
2591
|
+
if (!t && a === "json")
|
|
2592
|
+
try {
|
|
2593
|
+
return { type: "json", value: JSON.parse(e), source: e };
|
|
2594
|
+
} catch {
|
|
2595
|
+
}
|
|
2596
|
+
if (a === "callout") {
|
|
2597
|
+
const r = (i[0] ?? "").toLowerCase(), l = ss.includes(r);
|
|
2598
|
+
return {
|
|
2599
|
+
type: "callout",
|
|
2600
|
+
kind: l ? r : "note",
|
|
2601
|
+
title: (l ? i.slice(1) : i).join(" "),
|
|
2602
|
+
text: e.trim()
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2605
|
+
return { type: "code", lang: a || "code", text: e };
|
|
2606
|
+
}
|
|
2607
|
+
function Bt(n) {
|
|
2401
2608
|
const e = n.split(`
|
|
2402
|
-
`).
|
|
2403
|
-
if (
|
|
2404
|
-
const i =
|
|
2405
|
-
(
|
|
2406
|
-
);
|
|
2407
|
-
return [
|
|
2609
|
+
`).filter((i) => i.trim()), t = e.map((i) => i.trim());
|
|
2610
|
+
if (t.length > 1 && t.every((i) => Zt.test(i))) {
|
|
2611
|
+
const i = (m) => m.replace(/^\||\|$/g, "").split("|").map((b) => b.trim()), a = t.findIndex((m) => wt.test(m)), r = a > -1 ? i(t[a]).map(
|
|
2612
|
+
(m) => /^:-+:$/.test(m) ? "center" : /^-+:$/.test(m) ? "right" : /^:-+$/.test(m) ? "left" : null
|
|
2613
|
+
) : [], l = t.filter((m) => !wt.test(m)).map(i), c = l[0] ?? [];
|
|
2614
|
+
return [
|
|
2615
|
+
{ type: "table", head: c, rows: l.slice(1), align: c.map((m, b) => r[b] ?? null) }
|
|
2616
|
+
];
|
|
2408
2617
|
}
|
|
2409
|
-
if (
|
|
2618
|
+
if (t.length === 1 && es.test(t[0])) return [{ type: "hr" }];
|
|
2619
|
+
if (t.every((i) => yt.test(i)))
|
|
2410
2620
|
return [
|
|
2411
2621
|
{
|
|
2412
2622
|
type: "img",
|
|
2413
|
-
images:
|
|
2414
|
-
const
|
|
2415
|
-
return { alt:
|
|
2623
|
+
images: t.map((i) => {
|
|
2624
|
+
const a = i.match(yt);
|
|
2625
|
+
return { alt: a[1], src: a[2] };
|
|
2416
2626
|
})
|
|
2417
2627
|
}
|
|
2418
2628
|
];
|
|
2419
|
-
if (
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
return [
|
|
2629
|
+
if (t.every((i) => i.startsWith(">"))) {
|
|
2630
|
+
const i = t.map((r) => r.replace(/^>\s?/, "")), a = i[0].match(ts);
|
|
2631
|
+
return a ? [
|
|
2423
2632
|
{
|
|
2424
|
-
type: "
|
|
2425
|
-
|
|
2426
|
-
|
|
2633
|
+
type: "callout",
|
|
2634
|
+
kind: a[1].toLowerCase(),
|
|
2635
|
+
title: a[2].trim(),
|
|
2636
|
+
text: i.slice(1).join(`
|
|
2637
|
+
`).trim()
|
|
2427
2638
|
}
|
|
2428
|
-
];
|
|
2429
|
-
|
|
2430
|
-
if (
|
|
2639
|
+
] : [{ type: "quote", text: i.join(" ") }];
|
|
2640
|
+
}
|
|
2641
|
+
if (kt.test(e[0])) {
|
|
2642
|
+
const i = [];
|
|
2643
|
+
for (const a of e) {
|
|
2644
|
+
const r = a.match(kt);
|
|
2645
|
+
if (r) {
|
|
2646
|
+
const l = r[3].match($t);
|
|
2647
|
+
i.push({
|
|
2648
|
+
text: l ? r[3].replace($t, "") : r[3],
|
|
2649
|
+
depth: Math.min(3, Math.floor(r[1].replace(/\t/g, " ").length / 2)),
|
|
2650
|
+
checked: l ? l[1] !== " " : null
|
|
2651
|
+
});
|
|
2652
|
+
} else
|
|
2653
|
+
i[i.length - 1].text += ` ${a.trim()}`;
|
|
2654
|
+
}
|
|
2655
|
+
return [{ type: "list", ordered: /^\s*\d/.test(e[0]), items: i }];
|
|
2656
|
+
}
|
|
2657
|
+
const s = t[0].match(/^(#{1,4})\s+(.*)$/);
|
|
2658
|
+
if (s) {
|
|
2431
2659
|
const i = e.slice(1).join(`
|
|
2432
2660
|
`);
|
|
2433
2661
|
return [
|
|
2434
|
-
{ type: "h", level:
|
|
2435
|
-
...i ?
|
|
2662
|
+
{ type: "h", level: s[1].length, text: s[2] },
|
|
2663
|
+
...i ? Bt(i) : []
|
|
2436
2664
|
];
|
|
2437
2665
|
}
|
|
2438
|
-
return [{ type: "p", text:
|
|
2666
|
+
return [{ type: "p", text: t.join(" ") }];
|
|
2439
2667
|
}
|
|
2440
|
-
function
|
|
2668
|
+
function rs(n, e = ",") {
|
|
2669
|
+
var c;
|
|
2670
|
+
const t = [];
|
|
2671
|
+
let s = [], i = "", a = !1;
|
|
2672
|
+
const r = n.replace(/\r/g, "");
|
|
2673
|
+
for (let m = 0; m < r.length; m++) {
|
|
2674
|
+
const b = r[m];
|
|
2675
|
+
a ? b === '"' && r[m + 1] === '"' ? (i += '"', m++) : b === '"' ? a = !1 : i += b : b === '"' && i === "" ? a = !0 : b === e ? (s.push(i.trim()), i = "") : b === `
|
|
2676
|
+
` ? (s.push(i.trim()), s.some(Boolean) && t.push(s), s = [], i = "") : i += b;
|
|
2677
|
+
}
|
|
2678
|
+
s.push(i.trim()), s.some(Boolean) && t.push(s);
|
|
2679
|
+
const l = ((c = t[0]) == null ? void 0 : c.length) ?? 0;
|
|
2680
|
+
return t.map((m) => m.length < l ? [...m, ...Array(l - m.length).fill("")] : m);
|
|
2681
|
+
}
|
|
2682
|
+
function os(n) {
|
|
2441
2683
|
let e;
|
|
2442
2684
|
try {
|
|
2443
2685
|
e = JSON.parse(n);
|
|
@@ -2445,136 +2687,226 @@ function Ot(n) {
|
|
|
2445
2687
|
return null;
|
|
2446
2688
|
}
|
|
2447
2689
|
if (!e || typeof e != "object") return null;
|
|
2448
|
-
const t = (Array.isArray(e.series) ? e.series : []).filter((
|
|
2449
|
-
name: String(
|
|
2450
|
-
values:
|
|
2690
|
+
const t = (Array.isArray(e.series) ? e.series : []).filter((i) => i && Array.isArray(i.values)).map((i, a) => ({
|
|
2691
|
+
name: String(i.name ?? `Series ${a + 1}`),
|
|
2692
|
+
values: i.values.map((r) => Number(r) || 0)
|
|
2451
2693
|
}));
|
|
2452
2694
|
if (!t.length) return null;
|
|
2453
|
-
const
|
|
2695
|
+
const s = Array.isArray(e.labels) ? e.labels.map(String) : t[0].values.map((i, a) => String(a + 1));
|
|
2454
2696
|
return {
|
|
2455
2697
|
type: e.type === "line" ? "line" : "bar",
|
|
2456
2698
|
title: String(e.title ?? ""),
|
|
2457
2699
|
unit: String(e.unit ?? ""),
|
|
2458
|
-
labels:
|
|
2700
|
+
labels: s,
|
|
2459
2701
|
series: t
|
|
2460
2702
|
};
|
|
2461
2703
|
}
|
|
2462
|
-
const
|
|
2463
|
-
|
|
2704
|
+
const Ct = new RegExp(
|
|
2705
|
+
[
|
|
2706
|
+
/\*\*([^*]+)\*\*/.source,
|
|
2707
|
+
// 1 bold
|
|
2708
|
+
/~~([^~]+)~~/.source,
|
|
2709
|
+
// 2 strike
|
|
2710
|
+
/`([^`]+)`/.source,
|
|
2711
|
+
// 3 code
|
|
2712
|
+
/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/.source,
|
|
2713
|
+
// 4, 5 link
|
|
2714
|
+
/(https?:\/\/[^\s<>()]*[^\s<>().,;:!?'"\]])/.source,
|
|
2715
|
+
// 6 bare link
|
|
2716
|
+
new RegExp("(?<![\\w*])\\*(?![\\s*])([^*\\n]+?)\\*(?![\\w*])").source,
|
|
2717
|
+
// 7 *italic*
|
|
2718
|
+
new RegExp("(?<![\\w_])_(?![\\s_])([^_\\n]+?)_(?![\\w_])").source,
|
|
2719
|
+
// 8 _italic_
|
|
2720
|
+
/\s?\[(\d+(?:\s*,\s*\d+)*)\]/.source
|
|
2721
|
+
// 9 citation
|
|
2722
|
+
].join("|"),
|
|
2723
|
+
"g"
|
|
2724
|
+
);
|
|
2725
|
+
function ns(n, e = 0) {
|
|
2464
2726
|
const t = [];
|
|
2465
|
-
let
|
|
2466
|
-
|
|
2467
|
-
const a = (
|
|
2468
|
-
if (!
|
|
2727
|
+
let s = 0, i;
|
|
2728
|
+
Ct.lastIndex = 0;
|
|
2729
|
+
const a = (r) => {
|
|
2730
|
+
if (!r) return;
|
|
2469
2731
|
const l = t[t.length - 1];
|
|
2470
|
-
(l == null ? void 0 : l.type) === "text" ? l.text +=
|
|
2732
|
+
(l == null ? void 0 : l.type) === "text" ? l.text += r : t.push({ type: "text", text: r });
|
|
2471
2733
|
};
|
|
2472
|
-
for (;
|
|
2473
|
-
if (a(n.slice(
|
|
2474
|
-
else if (
|
|
2475
|
-
else if (
|
|
2734
|
+
for (; i = Ct.exec(n); ) {
|
|
2735
|
+
if (a(n.slice(s, i.index)), i[1] !== void 0) t.push({ type: "bold", text: i[1] });
|
|
2736
|
+
else if (i[2] !== void 0) t.push({ type: "strike", text: i[2] });
|
|
2737
|
+
else if (i[3] !== void 0) t.push({ type: "code", text: i[3] });
|
|
2738
|
+
else if (i[4] !== void 0) t.push({ type: "link", text: i[4], href: i[5] });
|
|
2739
|
+
else if (i[6] !== void 0) t.push({ type: "link", text: i[6], href: i[6] });
|
|
2740
|
+
else if (i[7] !== void 0) t.push({ type: "italic", text: i[7] });
|
|
2741
|
+
else if (i[8] !== void 0) t.push({ type: "italic", text: i[8] });
|
|
2476
2742
|
else {
|
|
2477
|
-
const l =
|
|
2478
|
-
e ? l.forEach((c) => t.push({ type: "cite", n: c })) : a(
|
|
2743
|
+
const l = i[9].split(",").map((c) => Number(c.trim())).filter((c) => c >= 1 && c <= e);
|
|
2744
|
+
e ? l.forEach((c) => t.push({ type: "cite", n: c })) : a(i[0]);
|
|
2479
2745
|
}
|
|
2480
|
-
|
|
2746
|
+
s = i.index + i[0].length;
|
|
2481
2747
|
}
|
|
2482
|
-
return a(n.slice(
|
|
2748
|
+
return a(n.slice(s)), t;
|
|
2749
|
+
}
|
|
2750
|
+
function ls(n) {
|
|
2751
|
+
if (((n ?? "").match(/```/g) ?? []).length % 2 === 1) return n;
|
|
2752
|
+
const e = n.lastIndexOf(`
|
|
2753
|
+
|
|
2754
|
+
`), t = e > -1 ? n.slice(0, e + 2) : "";
|
|
2755
|
+
let s = e > -1 ? n.slice(e + 2) : n;
|
|
2756
|
+
const i = s.split(`
|
|
2757
|
+
`), a = i[i.length - 1];
|
|
2758
|
+
a.trimStart().startsWith("|") && !a.trimEnd().endsWith("|") && i.pop(), s = i.join(`
|
|
2759
|
+
`), s = s.replace(/!?\[[^\]\n]*(\]\([^)\n]*)?$/, "");
|
|
2760
|
+
for (const r of ["**", "~~", "`"])
|
|
2761
|
+
if ((s.split(r).length - 1) % 2 === 1) {
|
|
2762
|
+
const c = s.lastIndexOf(r);
|
|
2763
|
+
s = s.slice(0, c) + s.slice(c + r.length);
|
|
2764
|
+
}
|
|
2765
|
+
return t + s;
|
|
2483
2766
|
}
|
|
2484
|
-
function
|
|
2767
|
+
function Tt(n) {
|
|
2485
2768
|
const e = /* @__PURE__ */ new Set();
|
|
2486
2769
|
for (const t of (n ?? "").match(/\[(\d+(?:\s*,\s*\d+)*)\]/g) ?? [])
|
|
2487
|
-
t.replace(/[[\]]/g, "").split(",").forEach((
|
|
2770
|
+
t.replace(/[[\]]/g, "").split(",").forEach((s) => e.add(Number(s.trim())));
|
|
2488
2771
|
return e;
|
|
2489
2772
|
}
|
|
2490
|
-
function
|
|
2491
|
-
return
|
|
2492
|
-
|
|
2493
|
-
|
|
2773
|
+
function cs(n) {
|
|
2774
|
+
return [
|
|
2775
|
+
["", ...n.series.map((e) => e.name)],
|
|
2776
|
+
...n.labels.map((e, t) => [
|
|
2494
2777
|
e,
|
|
2495
|
-
...n.series.map((
|
|
2778
|
+
...n.series.map((s) => s.values[t] === void 0 ? "" : `${s.values[t]}${n.unit}`)
|
|
2496
2779
|
])
|
|
2497
|
-
|
|
2780
|
+
];
|
|
2498
2781
|
}
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
return "";
|
|
2525
|
-
case "img":
|
|
2526
|
-
return i.images.map((s) => `Image: ${s.alt || "untitled"}`).join(`
|
|
2527
|
-
`);
|
|
2528
|
-
case "table":
|
|
2529
|
-
return [i.head, ...i.rows].map((s) => s.map(He).join(" · ")).join(`
|
|
2530
|
-
`);
|
|
2531
|
-
case "list":
|
|
2532
|
-
return i.items.map((s) => `- ${He(s)}`).join(`
|
|
2533
|
-
`);
|
|
2534
|
-
case "code":
|
|
2535
|
-
case "raw":
|
|
2536
|
-
return i.text;
|
|
2537
|
-
default:
|
|
2538
|
-
return He(i.text);
|
|
2782
|
+
const St = (n) => n.map((e) => e.join(" · ")).join(`
|
|
2783
|
+
`), ds = {
|
|
2784
|
+
note: "Note",
|
|
2785
|
+
tip: "Tip",
|
|
2786
|
+
important: "Important",
|
|
2787
|
+
warning: "Warning",
|
|
2788
|
+
caution: "Caution"
|
|
2789
|
+
};
|
|
2790
|
+
function ps(n, e) {
|
|
2791
|
+
if (e === "rich") return n;
|
|
2792
|
+
const t = e === "plain";
|
|
2793
|
+
return n.map((s) => {
|
|
2794
|
+
switch (s.type) {
|
|
2795
|
+
case "chart": {
|
|
2796
|
+
const [i, ...a] = cs(s.spec);
|
|
2797
|
+
return t ? {
|
|
2798
|
+
type: "raw",
|
|
2799
|
+
text: [s.spec.title, St([i, ...a])].filter(Boolean).join(`
|
|
2800
|
+
`)
|
|
2801
|
+
} : {
|
|
2802
|
+
type: "table",
|
|
2803
|
+
head: s.spec.title ? [s.spec.title, ...i.slice(1)] : i,
|
|
2804
|
+
rows: a,
|
|
2805
|
+
align: i.map(() => null)
|
|
2806
|
+
};
|
|
2539
2807
|
}
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2808
|
+
case "pending":
|
|
2809
|
+
return s.kind === "svg" && !t ? s : { type: "raw", text: "" };
|
|
2810
|
+
case "callout":
|
|
2811
|
+
return {
|
|
2812
|
+
type: "quote",
|
|
2813
|
+
text: `**${s.title || ds[s.kind]}** ${s.text}`.trim()
|
|
2814
|
+
};
|
|
2815
|
+
case "img":
|
|
2816
|
+
return {
|
|
2817
|
+
type: "p",
|
|
2818
|
+
text: s.images.map((i) => `Image: ${i.alt || "untitled"}`).join(" · ")
|
|
2819
|
+
};
|
|
2820
|
+
case "table":
|
|
2821
|
+
return t ? { type: "raw", text: St([s.head, ...s.rows]) } : s;
|
|
2822
|
+
case "json":
|
|
2823
|
+
return t ? { type: "code", lang: "json", text: s.source } : s;
|
|
2824
|
+
case "svg":
|
|
2825
|
+
return t ? { type: "code", lang: "svg", text: s.source } : s;
|
|
2826
|
+
default:
|
|
2827
|
+
return s;
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2546
2830
|
}
|
|
2547
|
-
function
|
|
2831
|
+
function Ot(n) {
|
|
2548
2832
|
const e = n ?? "", t = e.search(/FOLLOWUPS:/i);
|
|
2549
2833
|
if (t < 0) return { text: e.trim(), followups: [] };
|
|
2550
|
-
const
|
|
2551
|
-
return { text: e.slice(0, t).trim(), followups:
|
|
2834
|
+
const i = e.slice(t).replace(/^FOLLOWUPS:/i, "").split(/\||\n/).map((a) => a.replace(/^\s*(?:[-*↳→]|\d+[.)])\s*/, "").trim()).filter(Boolean).slice(0, 3);
|
|
2835
|
+
return { text: e.slice(0, t).trim(), followups: i };
|
|
2552
2836
|
}
|
|
2553
|
-
function
|
|
2554
|
-
return (n ?? "").replace(
|
|
2837
|
+
function hs(n) {
|
|
2838
|
+
return (n ?? "").replace(
|
|
2839
|
+
/```(\w*)[\s\S]*?(```|$)/g,
|
|
2840
|
+
(e, t) => t === "chart" ? "[Chart] " : t === "svg" ? "[Drawing] " : "[Code] "
|
|
2841
|
+
).replace(/!\[([^\]]*)\]\([^)]*\)/g, "[Image: $1]").replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g, "$1").replace(/\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/gi, "").replace(/[*#>`~]/g, "").replace(/\|/g, " ").replace(/\s?\[\d+(?:\s*,\s*\d+)*\]/g, "").replace(/\s+/g, " ").trim();
|
|
2555
2842
|
}
|
|
2556
|
-
function
|
|
2557
|
-
const t =
|
|
2843
|
+
function us(n, e = 48) {
|
|
2844
|
+
const t = hs(n);
|
|
2558
2845
|
if (t.length <= e) return t;
|
|
2559
|
-
const
|
|
2560
|
-
return (
|
|
2846
|
+
const s = t.slice(0, e), i = s.lastIndexOf(" ");
|
|
2847
|
+
return (i > e / 2 ? s.slice(0, i) : s).trim();
|
|
2561
2848
|
}
|
|
2562
|
-
function
|
|
2849
|
+
function gs(n) {
|
|
2563
2850
|
return String(n ?? "").split(`
|
|
2564
2851
|
`)[0].trim().replace(/^["'“”‘’]+|["'“”‘’]+$/g, "").replace(/^title:\s*/i, "").replace(/[.!?:;,]+$/, "").trim().slice(0, 80);
|
|
2565
2852
|
}
|
|
2566
|
-
function
|
|
2853
|
+
function It(n, e = !1) {
|
|
2567
2854
|
return /^https?:\/\//i.test(n) ? !0 : e && /^(blob:|data:image\/)/i.test(n);
|
|
2568
2855
|
}
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2856
|
+
const ms = 2e5, fs = /* @__PURE__ */ new Set([
|
|
2857
|
+
"script",
|
|
2858
|
+
"foreignobject",
|
|
2859
|
+
"iframe",
|
|
2860
|
+
"object",
|
|
2861
|
+
"embed",
|
|
2862
|
+
"image",
|
|
2863
|
+
"audio",
|
|
2864
|
+
"video",
|
|
2865
|
+
"animate",
|
|
2866
|
+
"set",
|
|
2867
|
+
"animatemotion",
|
|
2868
|
+
"animatetransform",
|
|
2869
|
+
"handler",
|
|
2870
|
+
"listener"
|
|
2871
|
+
]);
|
|
2872
|
+
function bs(n) {
|
|
2873
|
+
if (!n || n.length > ms || typeof DOMParser > "u") return null;
|
|
2874
|
+
const e = new DOMParser().parseFromString(n, "image/svg+xml"), t = e.documentElement;
|
|
2875
|
+
if (!t || t.nodeName.toLowerCase() !== "svg" || e.querySelector("parsererror"))
|
|
2876
|
+
return null;
|
|
2877
|
+
const s = (a) => {
|
|
2878
|
+
for (const r of Array.from(a.children)) {
|
|
2879
|
+
const l = r.nodeName.toLowerCase();
|
|
2880
|
+
if (fs.has(l)) r.remove();
|
|
2881
|
+
else if (l === "a") {
|
|
2882
|
+
const c = Array.from(r.childNodes);
|
|
2883
|
+
r.replaceWith(...c), c.forEach((m) => m instanceof Element && s(m));
|
|
2884
|
+
} else s(r);
|
|
2885
|
+
}
|
|
2886
|
+
for (const r of Array.from(a.attributes)) {
|
|
2887
|
+
const l = r.name.toLowerCase(), c = r.value.trim().toLowerCase(), m = (l === "href" || l.endsWith(":href")) && !c.startsWith("#"), b = c.includes("javascript:") || /url\(\s*['"]?(?!#)/.test(c);
|
|
2888
|
+
(l.startsWith("on") || m || b) && a.removeAttribute(r.name);
|
|
2889
|
+
}
|
|
2890
|
+
};
|
|
2891
|
+
s(t);
|
|
2892
|
+
for (const a of Array.from(t.querySelectorAll("style")))
|
|
2893
|
+
a.textContent = (a.textContent ?? "").replace(/@import[^;]*;?/gi, "").replace(/url\(\s*['"]?(?!#)[^)]*\)/gi, "none");
|
|
2894
|
+
t.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
2895
|
+
const i = new XMLSerializer().serializeToString(t);
|
|
2896
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`;
|
|
2897
|
+
}
|
|
2898
|
+
var Dt = Object.defineProperty, xs = Object.getOwnPropertyDescriptor, vs = (n, e, t) => e in n ? Dt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, g = (n, e, t, s) => {
|
|
2899
|
+
for (var i = s > 1 ? void 0 : s ? xs(e, t) : e, a = n.length - 1, r; a >= 0; a--)
|
|
2900
|
+
(r = n[a]) && (i = (s ? r(e, t, i) : r(i)) || i);
|
|
2901
|
+
return s && i && Dt(e, t, i), i;
|
|
2902
|
+
}, ws = (n, e, t) => vs(n, e + "", t);
|
|
2903
|
+
const Mt = [
|
|
2575
2904
|
"embed",
|
|
2576
2905
|
"mode",
|
|
2577
|
-
"
|
|
2906
|
+
"format",
|
|
2907
|
+
"renderers",
|
|
2908
|
+
"beforeSend",
|
|
2909
|
+
"afterParse",
|
|
2578
2910
|
"glow",
|
|
2579
2911
|
"position",
|
|
2580
2912
|
"sidebar",
|
|
@@ -2583,14 +2915,32 @@ const st = [
|
|
|
2583
2915
|
"logoUrl",
|
|
2584
2916
|
"heading",
|
|
2585
2917
|
"description",
|
|
2918
|
+
"eyebrow",
|
|
2586
2919
|
"prompts",
|
|
2587
2920
|
"bubbleText",
|
|
2588
2921
|
"greetingBubble",
|
|
2589
2922
|
"unreadBadge",
|
|
2590
2923
|
"allowUpload",
|
|
2591
2924
|
"allowExport",
|
|
2925
|
+
"allowRaw",
|
|
2926
|
+
"allowCopy",
|
|
2927
|
+
"allowRegenerate",
|
|
2928
|
+
"allowBookmark",
|
|
2929
|
+
"allowDelete",
|
|
2930
|
+
"allowRename",
|
|
2931
|
+
"allowFeedback",
|
|
2932
|
+
"showTime",
|
|
2933
|
+
"showComposer",
|
|
2934
|
+
"footnote",
|
|
2935
|
+
"brandingText",
|
|
2936
|
+
"brandingUrl",
|
|
2592
2937
|
"branding",
|
|
2593
2938
|
"followups",
|
|
2939
|
+
"showFollowups",
|
|
2940
|
+
"showSources",
|
|
2941
|
+
"showNewChat",
|
|
2942
|
+
"showBookmarked",
|
|
2943
|
+
"allowSearch",
|
|
2594
2944
|
"autoTitle",
|
|
2595
2945
|
"model",
|
|
2596
2946
|
"params",
|
|
@@ -2598,8 +2948,9 @@ const st = [
|
|
|
2598
2948
|
"retrieval",
|
|
2599
2949
|
"metadata",
|
|
2600
2950
|
"messages",
|
|
2601
|
-
"theme"
|
|
2602
|
-
|
|
2951
|
+
"theme",
|
|
2952
|
+
"radius"
|
|
2953
|
+
], ft = {
|
|
2603
2954
|
fromAttribute: (n) => {
|
|
2604
2955
|
if (n)
|
|
2605
2956
|
try {
|
|
@@ -2610,22 +2961,32 @@ const st = [
|
|
|
2610
2961
|
}
|
|
2611
2962
|
},
|
|
2612
2963
|
toAttribute: (n) => JSON.stringify(n ?? null)
|
|
2613
|
-
},
|
|
2964
|
+
}, O = {
|
|
2614
2965
|
fromAttribute: (n) => n === null ? !0 : n !== "false",
|
|
2615
2966
|
toAttribute: (n) => n ? null : "false"
|
|
2616
|
-
},
|
|
2617
|
-
fromAttribute: (n) => n === null ?
|
|
2618
|
-
toAttribute: (n) => n ===
|
|
2619
|
-
},
|
|
2967
|
+
}, ys = {
|
|
2968
|
+
fromAttribute: (n) => n === null ? "auto" : n === "" || n === "true" ? "open" : n === "false" ? "closed" : ["auto", "open", "closed", "none"].includes(n) ? n : "auto",
|
|
2969
|
+
toAttribute: (n) => n === "auto" ? null : n
|
|
2970
|
+
}, ks = 272, $s = 820, Cs = 940, zt = 5, _t = 512 * 1024, Ts = /\.(md|markdown|txt|csv|tsv|json|html?|ya?ml|xml|log)$/i, Ss = 5e3, Os = 200, Lt = 2e3, Is = {
|
|
2971
|
+
note: "calloutNote",
|
|
2972
|
+
tip: "calloutTip",
|
|
2973
|
+
important: "calloutImportant",
|
|
2974
|
+
warning: "calloutWarning",
|
|
2975
|
+
caution: "calloutCaution"
|
|
2976
|
+
}, Ms = 2600, N = [
|
|
2620
2977
|
"var(--c-ink)",
|
|
2621
2978
|
"oklch(0.58 0.13 255)",
|
|
2622
2979
|
"oklch(0.63 0.1 175)",
|
|
2623
2980
|
"oklch(0.74 0.12 70)"
|
|
2624
|
-
],
|
|
2981
|
+
], jt = {
|
|
2625
2982
|
chat: "Be helpful and concise. Use Markdown when it helps: headings, lists, **bold**, code blocks and tables.",
|
|
2626
|
-
rag: "Answer ONLY from the sources provided with each message, numbered in the order given. Put a citation like [1] right after each claim it supports. If the sources don't cover the question, say so plainly."
|
|
2627
|
-
|
|
2628
|
-
|
|
2983
|
+
rag: "Answer ONLY from the sources provided with each message, numbered in the order given. Put a citation like [1] right after each claim it supports. If the sources don't cover the question, say so plainly."
|
|
2984
|
+
}, zs = {
|
|
2985
|
+
raw: "Reply in plain text. Don't use Markdown or any other markup.",
|
|
2986
|
+
plain: "Format with light Markdown only: short paragraphs, lists, **bold**, *italics*, `inline code`, code blocks and links. Don't use tables, charts, callouts, images or other special blocks.",
|
|
2987
|
+
advanced: `You can use Markdown: headings, lists, task lists, **bold**, *italics*, links, code blocks and pipe tables. For data, use a fenced "csv" block or a fenced "json" block. For a diagram or illustration, write a self-contained fenced "svg" block with a viewBox, and no scripts, links or external images. Don't use charts, callouts or images.`,
|
|
2988
|
+
rich: 'When the answer is about data, lead with one sentence stating the key finding, with key numbers in **bold**, then show the data visually. You can use Markdown: headings, lists, task lists, **bold**, *italics*, links, code blocks and pipe tables. For data, use a fenced "csv" block or a fenced "json" block. For a diagram or illustration, write a self-contained fenced "svg" block with a viewBox, and no scripts, links or external images. For trends and comparisons, use a fenced "chart" block containing only JSON: {"type":"bar"|"line","title":string,"unit":string,"labels":[string],"series":[{"name":string,"values":[number]}]}. For notes and warnings, use callouts: a quote starting with [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] or [!CAUTION]. Images use .'
|
|
2989
|
+
}, _s = "After the answer, on a final line write FOLLOWUPS: followed by three short follow-up questions the user might ask next, separated by |.", Nt = {
|
|
2629
2990
|
chat: [
|
|
2630
2991
|
["Write", "Draft a short welcome email for new users"],
|
|
2631
2992
|
["Explain", "Explain how refresh tokens work, simply"],
|
|
@@ -2637,27 +2998,22 @@ const st = [
|
|
|
2637
2998
|
["Summarize", "Summarize the most important points"],
|
|
2638
2999
|
["Find", "Where is the refund policy described?"],
|
|
2639
3000
|
["Explain", "Explain the setup steps in plain language"]
|
|
2640
|
-
],
|
|
2641
|
-
rich: [
|
|
2642
|
-
["Bar chart", "Compare the five most spoken languages in a bar chart"],
|
|
2643
|
-
["Line chart", "Show world population from 1950 to 2020"],
|
|
2644
|
-
["Table", "List the planets with their diameters in a table"],
|
|
2645
|
-
["Breakdown", "Break down a $4,000 monthly budget by category"]
|
|
2646
3001
|
]
|
|
2647
|
-
},
|
|
2648
|
-
sidebar: () =>
|
|
2649
|
-
|
|
3002
|
+
}, z = (n, e = "") => o`<svg class="i ${e}" viewBox="0 0 16 16" aria-hidden="true">${n}</svg>`, k = {
|
|
3003
|
+
sidebar: () => z(
|
|
3004
|
+
I`<rect x="2" y="2.5" width="12" height="11" rx="1.5"></rect><path d="M6 2.5v11"></path>`
|
|
2650
3005
|
),
|
|
2651
|
-
plus: () =>
|
|
2652
|
-
bookmark: (n = !1) =>
|
|
2653
|
-
download: () =>
|
|
2654
|
-
trash: () =>
|
|
2655
|
-
pencil: () =>
|
|
2656
|
-
copy: () =>
|
|
2657
|
-
|
|
3006
|
+
plus: () => z(I`<path d="M8 3v10M3 8h10"></path>`),
|
|
3007
|
+
bookmark: (n = !1) => z(I`<path d="M4.5 2.5h7v11L8 11l-3.5 2.5z"></path>`, n ? "filled" : ""),
|
|
3008
|
+
download: () => z(I`<path d="M8 2.5v8M4.5 7.5L8 11l3.5-3.5M2.5 13.5h11"></path>`),
|
|
3009
|
+
trash: () => z(I`<path d="M2.5 4.5h11M6.5 4.5v-2h3v2M4 4.5l.7 9h6.6l.7-9"></path>`),
|
|
3010
|
+
pencil: () => z(I`<path d="M10.5 2.5l3 3L6 13H3v-3z"></path>`),
|
|
3011
|
+
copy: () => z(
|
|
3012
|
+
I`<rect x="5.5" y="5.5" width="8" height="8" rx="1.5"></rect><path d="M10.5 5.5v-2a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2"></path>`
|
|
2658
3013
|
),
|
|
2659
|
-
|
|
2660
|
-
|
|
3014
|
+
raw: () => z(I`<path d="M5.5 4.5L2 8l3.5 3.5M10.5 4.5L14 8l-3.5 3.5"></path>`),
|
|
3015
|
+
refresh: () => z(I`<path d="M13.5 8A5.5 5.5 0 1 1 11.9 4.1M13.5 2v3.5H10"></path>`),
|
|
3016
|
+
thumb: (n = !1) => o`<svg
|
|
2661
3017
|
class="i"
|
|
2662
3018
|
viewBox="0 0 16 16"
|
|
2663
3019
|
aria-hidden="true"
|
|
@@ -2667,16 +3023,16 @@ const st = [
|
|
|
2667
3023
|
d="M5 7v6.5H2.5V7zM5 7l2.5-4.5a1.3 1.3 0 0 1 1.9 1.4L9 6.5h3.6a1 1 0 0 1 1 1.2l-1 4.8a1 1 0 0 1-1 .8H5"
|
|
2668
3024
|
></path>
|
|
2669
3025
|
</svg>`,
|
|
2670
|
-
expand: () =>
|
|
2671
|
-
restore: () =>
|
|
2672
|
-
minimize: () =>
|
|
2673
|
-
close: () =>
|
|
2674
|
-
clip: () =>
|
|
2675
|
-
|
|
3026
|
+
expand: () => z(I`<path d="M9.5 2.5h4v4M13.5 2.5L9 7M6.5 13.5h-4v-4M2.5 13.5L7 9"></path>`),
|
|
3027
|
+
restore: () => z(I`<path d="M13.5 6.5h-4v-4M9.5 6.5l4-4M2.5 9.5h4v4M6.5 9.5l-4 4"></path>`),
|
|
3028
|
+
minimize: () => z(I`<path d="M4 8h8"></path>`),
|
|
3029
|
+
close: () => z(I`<path d="M4 4l8 8M12 4l-8 8"></path>`),
|
|
3030
|
+
clip: () => z(
|
|
3031
|
+
I`<path d="M13 7.5l-5.3 5.3a3 3 0 0 1-4.3-4.3L9 2.9a2 2 0 0 1 2.9 2.9L6.4 11.3a1 1 0 0 1-1.4-1.4L10 5"></path>`
|
|
2676
3032
|
),
|
|
2677
|
-
up: () =>
|
|
2678
|
-
stop: () =>
|
|
2679
|
-
chat: () =>
|
|
3033
|
+
up: () => z(I`<path d="M8 13V3M3.5 7.5L8 3l4.5 4.5"></path>`),
|
|
3034
|
+
stop: () => z(I`<rect x="4.5" y="4.5" width="7" height="7" rx="1"></rect>`),
|
|
3035
|
+
chat: () => o`<svg
|
|
2680
3036
|
width="22"
|
|
2681
3037
|
height="22"
|
|
2682
3038
|
viewBox="0 0 22 22"
|
|
@@ -2687,7 +3043,7 @@ const st = [
|
|
|
2687
3043
|
d="M4 5.5A2.5 2.5 0 0 1 6.5 3h9A2.5 2.5 0 0 1 18 5.5v7a2.5 2.5 0 0 1-2.5 2.5H9l-4 3.5V15H6.5"
|
|
2688
3044
|
></path>
|
|
2689
3045
|
</svg>`,
|
|
2690
|
-
chevronDown: () =>
|
|
3046
|
+
chevronDown: () => o`<svg
|
|
2691
3047
|
width="20"
|
|
2692
3048
|
height="20"
|
|
2693
3049
|
viewBox="0 0 20 20"
|
|
@@ -2697,150 +3053,176 @@ const st = [
|
|
|
2697
3053
|
<path d="M5 8l5 5 5-5"></path>
|
|
2698
3054
|
</svg>`
|
|
2699
3055
|
};
|
|
2700
|
-
let
|
|
2701
|
-
const
|
|
2702
|
-
function
|
|
3056
|
+
let Ls = 0;
|
|
3057
|
+
const mt = () => `m${Date.now().toString(36)}${(Ls++).toString(36)}`;
|
|
3058
|
+
function At(n) {
|
|
2703
3059
|
var t;
|
|
2704
3060
|
const e = n;
|
|
2705
3061
|
return (e == null ? void 0 : e.message) === "NOT_FOUND" || (e == null ? void 0 : e.code) === "NOT_FOUND" || ((t = e == null ? void 0 : e.details) == null ? void 0 : t.status) === 404;
|
|
2706
3062
|
}
|
|
2707
|
-
function
|
|
3063
|
+
function js(n) {
|
|
2708
3064
|
const e = n;
|
|
2709
3065
|
return (e == null ? void 0 : e.code) || (e == null ? void 0 : e.message) || "UNKNOWN";
|
|
2710
3066
|
}
|
|
2711
|
-
const
|
|
3067
|
+
const Ns = () => typeof matchMedia < "u" && matchMedia("(prefers-reduced-motion: reduce)").matches, ut = (n, e) => (Number.isInteger(n) ? n.toLocaleString("en-US") : n.toFixed(1)) + e, Rt = (n) => {
|
|
2712
3068
|
const e = n.lastIndexOf(".");
|
|
2713
3069
|
return e > 0 ? n.slice(e + 1, e + 5).toUpperCase() : "FILE";
|
|
2714
3070
|
};
|
|
2715
|
-
function
|
|
2716
|
-
const t = n ?? {},
|
|
3071
|
+
function gt(n, e) {
|
|
3072
|
+
const t = n ?? {}, s = t.metadata && typeof t.metadata == "object" ? t.metadata : {}, i = (...l) => l.find((c) => typeof c == "string" && c.trim()), a = i(t.content, t.text, t.page_content, t.body, t.snippet, t.chunk, s.content) ?? JSON.stringify(t, null, 2), r = [t.score, t.relevance, t._score, s.score].find((l) => typeof l == "number");
|
|
2717
3073
|
return {
|
|
2718
3074
|
n: e,
|
|
2719
|
-
title:
|
|
2720
|
-
path:
|
|
2721
|
-
collection:
|
|
2722
|
-
updated:
|
|
3075
|
+
title: i(t.title, t.name, t.filename, s.title, s.name) ?? `Source ${e}`,
|
|
3076
|
+
path: i(t.path, t.url, t.key, t.source, s.path, s.url) ?? "",
|
|
3077
|
+
collection: i(t.collection, t.namespace, t.dbname, s.collection) ?? "",
|
|
3078
|
+
updated: i(t.updated, t._modified_at, s.updated) ?? "",
|
|
2723
3079
|
text: a,
|
|
2724
|
-
score:
|
|
3080
|
+
score: r === void 0 ? null : Math.max(0, Math.min(1, r))
|
|
2725
3081
|
};
|
|
2726
3082
|
}
|
|
2727
|
-
function
|
|
3083
|
+
function As(n) {
|
|
2728
3084
|
const e = [], t = [];
|
|
2729
|
-
for (const
|
|
2730
|
-
if (/\.csv$/i.test(
|
|
2731
|
-
else if (/\.json$/i.test(
|
|
3085
|
+
for (const s of n)
|
|
3086
|
+
if (/\.csv$/i.test(s.name)) e.push({ type: "csv", data: s.content });
|
|
3087
|
+
else if (/\.json$/i.test(s.name))
|
|
2732
3088
|
try {
|
|
2733
|
-
e.push({ type: "json", data: JSON.parse(
|
|
3089
|
+
e.push({ type: "json", data: JSON.parse(s.content) });
|
|
2734
3090
|
} catch {
|
|
2735
|
-
t.push({ title:
|
|
3091
|
+
t.push({ title: s.name, content: s.content });
|
|
2736
3092
|
}
|
|
2737
|
-
else t.push({ title:
|
|
3093
|
+
else t.push({ title: s.name, content: s.content });
|
|
2738
3094
|
return t.length && e.push({ type: "docs", payload: { documents: t } }), e;
|
|
2739
3095
|
}
|
|
2740
|
-
function
|
|
3096
|
+
function Rs(n) {
|
|
2741
3097
|
const e = n ? Date.parse(n) : NaN;
|
|
2742
3098
|
if (Number.isNaN(e)) return "older";
|
|
2743
3099
|
const t = /* @__PURE__ */ new Date();
|
|
2744
3100
|
t.setHours(0, 0, 0, 0);
|
|
2745
|
-
const
|
|
2746
|
-
return e >= t.getTime() ? "today" : e >= t.getTime() -
|
|
3101
|
+
const s = 864e5;
|
|
3102
|
+
return e >= t.getTime() ? "today" : e >= t.getTime() - s ? "yesterday" : e >= t.getTime() - 7 * s ? "week" : "older";
|
|
2747
3103
|
}
|
|
2748
|
-
var
|
|
2749
|
-
let d = (
|
|
3104
|
+
var A, R, E, B, D, F, U, P, K, W, J, H, G, q, V, X, Y, Q, Z, ee, te, se, ie, ae, re, oe, ne, le, ce, de, pe, he, ue, ge, me, fe, be, xe, ve, we, ye, ke, $e, Ce, Te, Se, Oe, Ie, Me, ze, _e, Le, je, Ne, Ae, Re, Ee, Be, De, Fe, Ue, Pe, Ke, We, Je, He, Ge, qe, Ve, Xe, Ye, Qe, Ze, et, tt, st, it, at, rt, ot, nt, lt, ct, dt, pt, ht, Et;
|
|
3105
|
+
let d = (Et = class extends Kt {
|
|
2750
3106
|
constructor() {
|
|
2751
3107
|
super(...arguments);
|
|
2752
|
-
h(this,
|
|
2753
|
-
h(this,
|
|
3108
|
+
h(this, A, null);
|
|
3109
|
+
h(this, R, {});
|
|
2754
3110
|
h(this, E);
|
|
2755
|
-
h(this,
|
|
2756
|
-
h(this,
|
|
2757
|
-
h(this,
|
|
2758
|
-
h(this,
|
|
2759
|
-
h(this,
|
|
2760
|
-
h(this,
|
|
2761
|
-
h(this,
|
|
2762
|
-
h(this,
|
|
2763
|
-
h(this, H,
|
|
2764
|
-
h(this,
|
|
2765
|
-
h(this,
|
|
2766
|
-
h(this, q, "right");
|
|
2767
|
-
h(this, G);
|
|
3111
|
+
h(this, B);
|
|
3112
|
+
h(this, D, "chat");
|
|
3113
|
+
h(this, F, "advanced");
|
|
3114
|
+
h(this, U, {});
|
|
3115
|
+
h(this, P, null);
|
|
3116
|
+
h(this, K, null);
|
|
3117
|
+
h(this, W, "subtle");
|
|
3118
|
+
h(this, J, !0);
|
|
3119
|
+
h(this, H, !0);
|
|
3120
|
+
h(this, G, !0);
|
|
3121
|
+
h(this, q, !0);
|
|
2768
3122
|
h(this, V, !0);
|
|
2769
|
-
h(this, X,
|
|
2770
|
-
h(this, Y,
|
|
3123
|
+
h(this, X, !0);
|
|
3124
|
+
h(this, Y, !0);
|
|
2771
3125
|
h(this, Q, "");
|
|
2772
|
-
h(this, Z,
|
|
3126
|
+
h(this, Z, {});
|
|
2773
3127
|
h(this, ee, "");
|
|
2774
|
-
h(this, te,
|
|
2775
|
-
h(this,
|
|
2776
|
-
h(this,
|
|
2777
|
-
h(this, ae,
|
|
2778
|
-
h(this, re,
|
|
2779
|
-
h(this, ne, !0);
|
|
3128
|
+
h(this, te, []);
|
|
3129
|
+
h(this, se, {});
|
|
3130
|
+
h(this, ie, "page");
|
|
3131
|
+
h(this, ae, "right");
|
|
3132
|
+
h(this, re, "auto");
|
|
2780
3133
|
h(this, oe, !0);
|
|
2781
|
-
h(this,
|
|
2782
|
-
h(this,
|
|
2783
|
-
h(this,
|
|
3134
|
+
h(this, ne, "");
|
|
3135
|
+
h(this, le, "Assistant");
|
|
3136
|
+
h(this, ce, "");
|
|
3137
|
+
h(this, de, "");
|
|
2784
3138
|
h(this, pe, "");
|
|
2785
|
-
h(this, he
|
|
2786
|
-
h(this, ue,
|
|
2787
|
-
h(this, ge,
|
|
2788
|
-
h(this, me,
|
|
2789
|
-
h(this,
|
|
2790
|
-
h(this,
|
|
2791
|
-
h(this, xe,
|
|
2792
|
-
h(this, ve,
|
|
2793
|
-
h(this,
|
|
2794
|
-
h(this,
|
|
2795
|
-
h(this,
|
|
2796
|
-
h(this, $e, !
|
|
2797
|
-
h(this,
|
|
2798
|
-
h(this,
|
|
2799
|
-
h(this, Se, !
|
|
3139
|
+
h(this, he);
|
|
3140
|
+
h(this, ue, "");
|
|
3141
|
+
h(this, ge, "");
|
|
3142
|
+
h(this, me, !1);
|
|
3143
|
+
h(this, fe, !1);
|
|
3144
|
+
h(this, be, !0);
|
|
3145
|
+
h(this, xe, !0);
|
|
3146
|
+
h(this, ve, !0);
|
|
3147
|
+
h(this, we, !0);
|
|
3148
|
+
h(this, ye, !0);
|
|
3149
|
+
h(this, ke, !0);
|
|
3150
|
+
h(this, $e, !0);
|
|
3151
|
+
h(this, Ce, !0);
|
|
3152
|
+
h(this, Te, !0);
|
|
3153
|
+
h(this, Se, !0);
|
|
3154
|
+
h(this, Oe);
|
|
3155
|
+
h(this, Ie, !1);
|
|
3156
|
+
h(this, Me, !0);
|
|
2800
3157
|
h(this, ze, "");
|
|
2801
|
-
h(this,
|
|
2802
|
-
h(this,
|
|
2803
|
-
h(this,
|
|
2804
|
-
h(this,
|
|
2805
|
-
h(this,
|
|
2806
|
-
h(this, je, !1);
|
|
2807
|
-
h(this, Ae, !1);
|
|
2808
|
-
h(this, Ee, !1);
|
|
2809
|
-
h(this, Ne, !1);
|
|
2810
|
-
h(this, Be, !1);
|
|
2811
|
-
h(this, De, !1);
|
|
3158
|
+
h(this, _e, "");
|
|
3159
|
+
h(this, Le, []);
|
|
3160
|
+
h(this, je, "idle");
|
|
3161
|
+
h(this, Ne, null);
|
|
3162
|
+
h(this, Ae, "");
|
|
2812
3163
|
h(this, Re, !1);
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
3164
|
+
h(this, Ee, []);
|
|
3165
|
+
h(this, Be, !1);
|
|
3166
|
+
h(this, De, "");
|
|
3167
|
+
h(this, Fe, !1);
|
|
3168
|
+
h(this, Ue, "");
|
|
3169
|
+
h(this, Pe, []);
|
|
3170
|
+
h(this, Ke, "");
|
|
3171
|
+
h(this, We, null);
|
|
3172
|
+
h(this, Je, 0);
|
|
3173
|
+
h(this, He, null);
|
|
3174
|
+
h(this, Ge, !1);
|
|
3175
|
+
h(this, qe, "");
|
|
3176
|
+
h(this, Ve, "");
|
|
3177
|
+
h(this, Xe, !1);
|
|
3178
|
+
h(this, Ye, "");
|
|
3179
|
+
h(this, Qe, null);
|
|
3180
|
+
h(this, Ze, "");
|
|
3181
|
+
h(this, et, /* @__PURE__ */ new Set());
|
|
3182
|
+
h(this, tt, /* @__PURE__ */ new Set());
|
|
3183
|
+
h(this, st, !1);
|
|
3184
|
+
h(this, it, /* @__PURE__ */ new Map());
|
|
3185
|
+
h(this, at, "");
|
|
3186
|
+
h(this, rt, !1);
|
|
3187
|
+
h(this, ot, !1);
|
|
3188
|
+
h(this, nt, !1);
|
|
3189
|
+
h(this, lt, !1);
|
|
3190
|
+
h(this, ct, !1);
|
|
3191
|
+
h(this, dt, !1);
|
|
3192
|
+
h(this, pt, !1);
|
|
3193
|
+
h(this, ht, !1);
|
|
3194
|
+
M(this, "run", 0);
|
|
3195
|
+
M(this, "abort", null);
|
|
3196
|
+
M(this, "revealTimer");
|
|
3197
|
+
M(this, "timers", /* @__PURE__ */ new Set());
|
|
3198
|
+
M(this, "toastTimer");
|
|
3199
|
+
M(this, "stick", !0);
|
|
3200
|
+
M(this, "renamed", /* @__PURE__ */ new Set());
|
|
3201
|
+
M(this, "observer", null);
|
|
3202
|
+
M(this, "observed", null);
|
|
3203
|
+
M(this, "media", null);
|
|
3204
|
+
M(this, "focusNext", "");
|
|
3205
|
+
M(this, "bubbleScheduled", !1);
|
|
3206
|
+
M(this, "pendingChatId", "");
|
|
3207
|
+
M(this, "onNetwork", () => {
|
|
2826
3208
|
this.offline = navigator.onLine === !1;
|
|
2827
3209
|
});
|
|
2828
|
-
|
|
3210
|
+
M(this, "onMedia", () => {
|
|
2829
3211
|
var e;
|
|
2830
3212
|
this.mobile = !!((e = this.media) != null && e.matches);
|
|
2831
3213
|
});
|
|
2832
3214
|
}
|
|
2833
3215
|
get client() {
|
|
2834
|
-
return p(this,
|
|
3216
|
+
return p(this, A);
|
|
2835
3217
|
}
|
|
2836
3218
|
set client(e) {
|
|
2837
|
-
u(this,
|
|
3219
|
+
u(this, A, e);
|
|
2838
3220
|
}
|
|
2839
3221
|
get messages() {
|
|
2840
|
-
return p(this,
|
|
3222
|
+
return p(this, R);
|
|
2841
3223
|
}
|
|
2842
3224
|
set messages(e) {
|
|
2843
|
-
u(this,
|
|
3225
|
+
u(this, R, e);
|
|
2844
3226
|
}
|
|
2845
3227
|
get theme() {
|
|
2846
3228
|
return p(this, E);
|
|
@@ -2848,360 +3230,510 @@ let d = (dt = class extends ft {
|
|
|
2848
3230
|
set theme(e) {
|
|
2849
3231
|
u(this, E, e);
|
|
2850
3232
|
}
|
|
2851
|
-
get
|
|
2852
|
-
return p(this, N);
|
|
2853
|
-
}
|
|
2854
|
-
set mode(e) {
|
|
2855
|
-
u(this, N, e);
|
|
2856
|
-
}
|
|
2857
|
-
get renderAs() {
|
|
3233
|
+
get radius() {
|
|
2858
3234
|
return p(this, B);
|
|
2859
3235
|
}
|
|
2860
|
-
set
|
|
3236
|
+
set radius(e) {
|
|
2861
3237
|
u(this, B, e);
|
|
2862
3238
|
}
|
|
2863
|
-
get
|
|
3239
|
+
get mode() {
|
|
2864
3240
|
return p(this, D);
|
|
2865
3241
|
}
|
|
2866
|
-
set
|
|
3242
|
+
set mode(e) {
|
|
2867
3243
|
u(this, D, e);
|
|
2868
3244
|
}
|
|
2869
|
-
get
|
|
2870
|
-
return p(this,
|
|
3245
|
+
get format() {
|
|
3246
|
+
return p(this, F);
|
|
2871
3247
|
}
|
|
2872
|
-
set
|
|
2873
|
-
u(this,
|
|
3248
|
+
set format(e) {
|
|
3249
|
+
u(this, F, e);
|
|
2874
3250
|
}
|
|
2875
|
-
get
|
|
3251
|
+
get renderers() {
|
|
2876
3252
|
return p(this, U);
|
|
2877
3253
|
}
|
|
2878
|
-
set
|
|
3254
|
+
set renderers(e) {
|
|
2879
3255
|
u(this, U, e);
|
|
2880
3256
|
}
|
|
2881
|
-
get
|
|
2882
|
-
return p(this,
|
|
3257
|
+
get beforeSend() {
|
|
3258
|
+
return p(this, P);
|
|
2883
3259
|
}
|
|
2884
|
-
set
|
|
2885
|
-
u(this,
|
|
3260
|
+
set beforeSend(e) {
|
|
3261
|
+
u(this, P, e);
|
|
2886
3262
|
}
|
|
2887
|
-
get
|
|
3263
|
+
get afterParse() {
|
|
2888
3264
|
return p(this, K);
|
|
2889
3265
|
}
|
|
2890
|
-
set
|
|
3266
|
+
set afterParse(e) {
|
|
2891
3267
|
u(this, K, e);
|
|
2892
3268
|
}
|
|
2893
|
-
get
|
|
2894
|
-
return p(this,
|
|
3269
|
+
get glow() {
|
|
3270
|
+
return p(this, W);
|
|
2895
3271
|
}
|
|
2896
|
-
set
|
|
2897
|
-
u(this,
|
|
3272
|
+
set glow(e) {
|
|
3273
|
+
u(this, W, e);
|
|
2898
3274
|
}
|
|
2899
|
-
get
|
|
3275
|
+
get followups() {
|
|
3276
|
+
return p(this, J);
|
|
3277
|
+
}
|
|
3278
|
+
set followups(e) {
|
|
3279
|
+
u(this, J, e);
|
|
3280
|
+
}
|
|
3281
|
+
get showSources() {
|
|
2900
3282
|
return p(this, H);
|
|
2901
3283
|
}
|
|
2902
|
-
set
|
|
3284
|
+
set showSources(e) {
|
|
2903
3285
|
u(this, H, e);
|
|
2904
3286
|
}
|
|
2905
|
-
get
|
|
2906
|
-
return p(this,
|
|
3287
|
+
get showNewChat() {
|
|
3288
|
+
return p(this, G);
|
|
2907
3289
|
}
|
|
2908
|
-
set
|
|
2909
|
-
u(this,
|
|
3290
|
+
set showNewChat(e) {
|
|
3291
|
+
u(this, G, e);
|
|
2910
3292
|
}
|
|
2911
|
-
get
|
|
2912
|
-
return p(this,
|
|
3293
|
+
get showBookmarked() {
|
|
3294
|
+
return p(this, q);
|
|
2913
3295
|
}
|
|
2914
|
-
set
|
|
2915
|
-
u(this,
|
|
3296
|
+
set showBookmarked(e) {
|
|
3297
|
+
u(this, q, e);
|
|
3298
|
+
}
|
|
3299
|
+
get showFollowups() {
|
|
3300
|
+
return p(this, V);
|
|
3301
|
+
}
|
|
3302
|
+
set showFollowups(e) {
|
|
3303
|
+
u(this, V, e);
|
|
3304
|
+
}
|
|
3305
|
+
get allowSearch() {
|
|
3306
|
+
return p(this, X);
|
|
3307
|
+
}
|
|
3308
|
+
set allowSearch(e) {
|
|
3309
|
+
u(this, X, e);
|
|
3310
|
+
}
|
|
3311
|
+
get autoTitle() {
|
|
3312
|
+
return p(this, Y);
|
|
3313
|
+
}
|
|
3314
|
+
set autoTitle(e) {
|
|
3315
|
+
u(this, Y, e);
|
|
3316
|
+
}
|
|
3317
|
+
get model() {
|
|
3318
|
+
return p(this, Q);
|
|
3319
|
+
}
|
|
3320
|
+
set model(e) {
|
|
3321
|
+
u(this, Q, e);
|
|
3322
|
+
}
|
|
3323
|
+
get params() {
|
|
3324
|
+
return p(this, Z);
|
|
3325
|
+
}
|
|
3326
|
+
set params(e) {
|
|
3327
|
+
u(this, Z, e);
|
|
3328
|
+
}
|
|
3329
|
+
get systemMessage() {
|
|
3330
|
+
return p(this, ee);
|
|
3331
|
+
}
|
|
3332
|
+
set systemMessage(e) {
|
|
3333
|
+
u(this, ee, e);
|
|
3334
|
+
}
|
|
3335
|
+
get retrieval() {
|
|
3336
|
+
return p(this, te);
|
|
3337
|
+
}
|
|
3338
|
+
set retrieval(e) {
|
|
3339
|
+
u(this, te, e);
|
|
3340
|
+
}
|
|
3341
|
+
get metadata() {
|
|
3342
|
+
return p(this, se);
|
|
3343
|
+
}
|
|
3344
|
+
set metadata(e) {
|
|
3345
|
+
u(this, se, e);
|
|
3346
|
+
}
|
|
3347
|
+
get embed() {
|
|
3348
|
+
return p(this, ie);
|
|
3349
|
+
}
|
|
3350
|
+
set embed(e) {
|
|
3351
|
+
u(this, ie, e);
|
|
2916
3352
|
}
|
|
2917
3353
|
get position() {
|
|
2918
|
-
return p(this,
|
|
3354
|
+
return p(this, ae);
|
|
2919
3355
|
}
|
|
2920
3356
|
set position(e) {
|
|
2921
|
-
u(this,
|
|
3357
|
+
u(this, ae, e);
|
|
2922
3358
|
}
|
|
2923
3359
|
get sidebar() {
|
|
2924
|
-
return p(this,
|
|
3360
|
+
return p(this, re);
|
|
2925
3361
|
}
|
|
2926
3362
|
set sidebar(e) {
|
|
2927
|
-
u(this,
|
|
3363
|
+
u(this, re, e);
|
|
2928
3364
|
}
|
|
2929
3365
|
get showTitle() {
|
|
2930
|
-
return p(this,
|
|
3366
|
+
return p(this, oe);
|
|
2931
3367
|
}
|
|
2932
3368
|
set showTitle(e) {
|
|
2933
|
-
u(this,
|
|
3369
|
+
u(this, oe, e);
|
|
2934
3370
|
}
|
|
2935
3371
|
get chatIdAttr() {
|
|
2936
|
-
return p(this,
|
|
3372
|
+
return p(this, ne);
|
|
2937
3373
|
}
|
|
2938
3374
|
set chatIdAttr(e) {
|
|
2939
|
-
u(this,
|
|
3375
|
+
u(this, ne, e);
|
|
2940
3376
|
}
|
|
2941
3377
|
get assistantName() {
|
|
2942
|
-
return p(this,
|
|
3378
|
+
return p(this, le);
|
|
2943
3379
|
}
|
|
2944
3380
|
set assistantName(e) {
|
|
2945
|
-
u(this,
|
|
3381
|
+
u(this, le, e);
|
|
2946
3382
|
}
|
|
2947
3383
|
get logoUrl() {
|
|
2948
|
-
return p(this,
|
|
3384
|
+
return p(this, ce);
|
|
2949
3385
|
}
|
|
2950
3386
|
set logoUrl(e) {
|
|
2951
|
-
u(this,
|
|
3387
|
+
u(this, ce, e);
|
|
2952
3388
|
}
|
|
2953
3389
|
get heading() {
|
|
2954
|
-
return p(this,
|
|
3390
|
+
return p(this, de);
|
|
2955
3391
|
}
|
|
2956
3392
|
set heading(e) {
|
|
2957
|
-
u(this,
|
|
3393
|
+
u(this, de, e);
|
|
2958
3394
|
}
|
|
2959
3395
|
get description() {
|
|
2960
|
-
return p(this,
|
|
3396
|
+
return p(this, pe);
|
|
2961
3397
|
}
|
|
2962
3398
|
set description(e) {
|
|
2963
|
-
u(this,
|
|
3399
|
+
u(this, pe, e);
|
|
3400
|
+
}
|
|
3401
|
+
get eyebrow() {
|
|
3402
|
+
return p(this, he);
|
|
3403
|
+
}
|
|
3404
|
+
set eyebrow(e) {
|
|
3405
|
+
u(this, he, e);
|
|
2964
3406
|
}
|
|
2965
3407
|
get prompts() {
|
|
2966
|
-
return p(this,
|
|
3408
|
+
return p(this, ue);
|
|
2967
3409
|
}
|
|
2968
3410
|
set prompts(e) {
|
|
2969
|
-
u(this,
|
|
3411
|
+
u(this, ue, e);
|
|
2970
3412
|
}
|
|
2971
3413
|
get bubbleText() {
|
|
2972
|
-
return p(this,
|
|
3414
|
+
return p(this, ge);
|
|
2973
3415
|
}
|
|
2974
3416
|
set bubbleText(e) {
|
|
2975
|
-
u(this,
|
|
3417
|
+
u(this, ge, e);
|
|
2976
3418
|
}
|
|
2977
3419
|
get greetingBubble() {
|
|
2978
|
-
return p(this,
|
|
3420
|
+
return p(this, me);
|
|
2979
3421
|
}
|
|
2980
3422
|
set greetingBubble(e) {
|
|
2981
|
-
u(this,
|
|
3423
|
+
u(this, me, e);
|
|
2982
3424
|
}
|
|
2983
3425
|
get unreadBadge() {
|
|
2984
|
-
return p(this,
|
|
3426
|
+
return p(this, fe);
|
|
2985
3427
|
}
|
|
2986
3428
|
set unreadBadge(e) {
|
|
2987
|
-
u(this,
|
|
3429
|
+
u(this, fe, e);
|
|
2988
3430
|
}
|
|
2989
3431
|
get allowUpload() {
|
|
2990
|
-
return p(this,
|
|
3432
|
+
return p(this, be);
|
|
2991
3433
|
}
|
|
2992
3434
|
set allowUpload(e) {
|
|
2993
|
-
u(this,
|
|
3435
|
+
u(this, be, e);
|
|
2994
3436
|
}
|
|
2995
3437
|
get allowExport() {
|
|
2996
|
-
return p(this,
|
|
3438
|
+
return p(this, xe);
|
|
2997
3439
|
}
|
|
2998
3440
|
set allowExport(e) {
|
|
2999
|
-
u(this,
|
|
3441
|
+
u(this, xe, e);
|
|
3442
|
+
}
|
|
3443
|
+
get allowCopy() {
|
|
3444
|
+
return p(this, ve);
|
|
3445
|
+
}
|
|
3446
|
+
set allowCopy(e) {
|
|
3447
|
+
u(this, ve, e);
|
|
3448
|
+
}
|
|
3449
|
+
get allowRegenerate() {
|
|
3450
|
+
return p(this, we);
|
|
3451
|
+
}
|
|
3452
|
+
set allowRegenerate(e) {
|
|
3453
|
+
u(this, we, e);
|
|
3454
|
+
}
|
|
3455
|
+
get allowBookmark() {
|
|
3456
|
+
return p(this, ye);
|
|
3457
|
+
}
|
|
3458
|
+
set allowBookmark(e) {
|
|
3459
|
+
u(this, ye, e);
|
|
3460
|
+
}
|
|
3461
|
+
get allowDelete() {
|
|
3462
|
+
return p(this, ke);
|
|
3463
|
+
}
|
|
3464
|
+
set allowDelete(e) {
|
|
3465
|
+
u(this, ke, e);
|
|
3466
|
+
}
|
|
3467
|
+
get allowRename() {
|
|
3468
|
+
return p(this, $e);
|
|
3469
|
+
}
|
|
3470
|
+
set allowRename(e) {
|
|
3471
|
+
u(this, $e, e);
|
|
3472
|
+
}
|
|
3473
|
+
get allowFeedback() {
|
|
3474
|
+
return p(this, Ce);
|
|
3475
|
+
}
|
|
3476
|
+
set allowFeedback(e) {
|
|
3477
|
+
u(this, Ce, e);
|
|
3478
|
+
}
|
|
3479
|
+
get showComposer() {
|
|
3480
|
+
return p(this, Te);
|
|
3481
|
+
}
|
|
3482
|
+
set showComposer(e) {
|
|
3483
|
+
u(this, Te, e);
|
|
3484
|
+
}
|
|
3485
|
+
get showTime() {
|
|
3486
|
+
return p(this, Se);
|
|
3487
|
+
}
|
|
3488
|
+
set showTime(e) {
|
|
3489
|
+
u(this, Se, e);
|
|
3490
|
+
}
|
|
3491
|
+
get footnote() {
|
|
3492
|
+
return p(this, Oe);
|
|
3493
|
+
}
|
|
3494
|
+
set footnote(e) {
|
|
3495
|
+
u(this, Oe, e);
|
|
3496
|
+
}
|
|
3497
|
+
get allowRaw() {
|
|
3498
|
+
return p(this, Ie);
|
|
3499
|
+
}
|
|
3500
|
+
set allowRaw(e) {
|
|
3501
|
+
u(this, Ie, e);
|
|
3000
3502
|
}
|
|
3001
3503
|
get branding() {
|
|
3002
|
-
return p(this,
|
|
3504
|
+
return p(this, Me);
|
|
3003
3505
|
}
|
|
3004
3506
|
set branding(e) {
|
|
3005
|
-
u(this,
|
|
3507
|
+
u(this, Me, e);
|
|
3508
|
+
}
|
|
3509
|
+
get brandingText() {
|
|
3510
|
+
return p(this, ze);
|
|
3511
|
+
}
|
|
3512
|
+
set brandingText(e) {
|
|
3513
|
+
u(this, ze, e);
|
|
3514
|
+
}
|
|
3515
|
+
get brandingUrl() {
|
|
3516
|
+
return p(this, _e);
|
|
3517
|
+
}
|
|
3518
|
+
set brandingUrl(e) {
|
|
3519
|
+
u(this, _e, e);
|
|
3006
3520
|
}
|
|
3007
3521
|
get chatList() {
|
|
3008
|
-
return p(this,
|
|
3522
|
+
return p(this, Le);
|
|
3009
3523
|
}
|
|
3010
3524
|
set chatList(e) {
|
|
3011
|
-
u(this,
|
|
3525
|
+
u(this, Le, e);
|
|
3012
3526
|
}
|
|
3013
3527
|
get listState() {
|
|
3014
|
-
return p(this,
|
|
3528
|
+
return p(this, je);
|
|
3015
3529
|
}
|
|
3016
3530
|
set listState(e) {
|
|
3017
|
-
u(this,
|
|
3531
|
+
u(this, je, e);
|
|
3018
3532
|
}
|
|
3019
3533
|
get activeId() {
|
|
3020
|
-
return p(this,
|
|
3534
|
+
return p(this, Ne);
|
|
3021
3535
|
}
|
|
3022
3536
|
set activeId(e) {
|
|
3023
|
-
u(this,
|
|
3537
|
+
u(this, Ne, e);
|
|
3024
3538
|
}
|
|
3025
3539
|
get chatTitle() {
|
|
3026
|
-
return p(this,
|
|
3540
|
+
return p(this, Ae);
|
|
3027
3541
|
}
|
|
3028
3542
|
set chatTitle(e) {
|
|
3029
|
-
u(this,
|
|
3543
|
+
u(this, Ae, e);
|
|
3030
3544
|
}
|
|
3031
3545
|
get bookmarked() {
|
|
3032
|
-
return p(this,
|
|
3546
|
+
return p(this, Re);
|
|
3033
3547
|
}
|
|
3034
3548
|
set bookmarked(e) {
|
|
3035
|
-
u(this,
|
|
3549
|
+
u(this, Re, e);
|
|
3036
3550
|
}
|
|
3037
3551
|
get msgs() {
|
|
3038
|
-
return p(this,
|
|
3552
|
+
return p(this, Ee);
|
|
3039
3553
|
}
|
|
3040
3554
|
set msgs(e) {
|
|
3041
|
-
u(this,
|
|
3555
|
+
u(this, Ee, e);
|
|
3042
3556
|
}
|
|
3043
3557
|
get loadingThread() {
|
|
3044
|
-
return p(this,
|
|
3558
|
+
return p(this, Be);
|
|
3045
3559
|
}
|
|
3046
3560
|
set loadingThread(e) {
|
|
3047
|
-
u(this,
|
|
3561
|
+
u(this, Be, e);
|
|
3048
3562
|
}
|
|
3049
3563
|
get threadError() {
|
|
3050
|
-
return p(this,
|
|
3564
|
+
return p(this, De);
|
|
3051
3565
|
}
|
|
3052
3566
|
set threadError(e) {
|
|
3053
|
-
u(this,
|
|
3567
|
+
u(this, De, e);
|
|
3054
3568
|
}
|
|
3055
3569
|
get busy() {
|
|
3056
|
-
return p(this,
|
|
3570
|
+
return p(this, Fe);
|
|
3057
3571
|
}
|
|
3058
3572
|
set busy(e) {
|
|
3059
|
-
u(this,
|
|
3573
|
+
u(this, Fe, e);
|
|
3060
3574
|
}
|
|
3061
3575
|
get draft() {
|
|
3062
|
-
return p(this,
|
|
3576
|
+
return p(this, Ue);
|
|
3063
3577
|
}
|
|
3064
3578
|
set draft(e) {
|
|
3065
|
-
u(this,
|
|
3579
|
+
u(this, Ue, e);
|
|
3066
3580
|
}
|
|
3067
3581
|
get files() {
|
|
3068
|
-
return p(this,
|
|
3582
|
+
return p(this, Pe);
|
|
3069
3583
|
}
|
|
3070
3584
|
set files(e) {
|
|
3071
|
-
u(this,
|
|
3585
|
+
u(this, Pe, e);
|
|
3072
3586
|
}
|
|
3073
3587
|
get search() {
|
|
3074
|
-
return p(this,
|
|
3588
|
+
return p(this, Ke);
|
|
3075
3589
|
}
|
|
3076
3590
|
set search(e) {
|
|
3077
|
-
u(this,
|
|
3591
|
+
u(this, Ke, e);
|
|
3078
3592
|
}
|
|
3079
3593
|
get sidebarOpen() {
|
|
3080
|
-
return p(this,
|
|
3594
|
+
return p(this, We);
|
|
3081
3595
|
}
|
|
3082
3596
|
set sidebarOpen(e) {
|
|
3083
|
-
u(this,
|
|
3597
|
+
u(this, We, e);
|
|
3084
3598
|
}
|
|
3085
3599
|
get width() {
|
|
3086
|
-
return p(this,
|
|
3600
|
+
return p(this, Je);
|
|
3087
3601
|
}
|
|
3088
3602
|
set width(e) {
|
|
3089
|
-
u(this,
|
|
3603
|
+
u(this, Je, e);
|
|
3090
3604
|
}
|
|
3091
3605
|
get panel() {
|
|
3092
|
-
return p(this,
|
|
3606
|
+
return p(this, He);
|
|
3093
3607
|
}
|
|
3094
3608
|
set panel(e) {
|
|
3095
|
-
u(this,
|
|
3609
|
+
u(this, He, e);
|
|
3096
3610
|
}
|
|
3097
3611
|
get menuOpen() {
|
|
3098
|
-
return p(this,
|
|
3612
|
+
return p(this, Ge);
|
|
3099
3613
|
}
|
|
3100
3614
|
set menuOpen(e) {
|
|
3101
|
-
u(this,
|
|
3615
|
+
u(this, Ge, e);
|
|
3102
3616
|
}
|
|
3103
3617
|
get editingKey() {
|
|
3104
|
-
return p(this,
|
|
3618
|
+
return p(this, qe);
|
|
3105
3619
|
}
|
|
3106
3620
|
set editingKey(e) {
|
|
3107
|
-
u(this,
|
|
3621
|
+
u(this, qe, e);
|
|
3108
3622
|
}
|
|
3109
3623
|
get editDraft() {
|
|
3110
|
-
return p(this,
|
|
3624
|
+
return p(this, Ve);
|
|
3111
3625
|
}
|
|
3112
3626
|
set editDraft(e) {
|
|
3113
|
-
u(this,
|
|
3627
|
+
u(this, Ve, e);
|
|
3114
3628
|
}
|
|
3115
3629
|
get editingTitle() {
|
|
3116
|
-
return p(this,
|
|
3630
|
+
return p(this, Xe);
|
|
3117
3631
|
}
|
|
3118
3632
|
set editingTitle(e) {
|
|
3119
|
-
u(this,
|
|
3633
|
+
u(this, Xe, e);
|
|
3120
3634
|
}
|
|
3121
3635
|
get renamingId() {
|
|
3122
|
-
return p(this,
|
|
3636
|
+
return p(this, Ye);
|
|
3123
3637
|
}
|
|
3124
3638
|
set renamingId(e) {
|
|
3125
|
-
u(this,
|
|
3639
|
+
u(this, Ye, e);
|
|
3126
3640
|
}
|
|
3127
3641
|
get toast() {
|
|
3128
|
-
return p(this,
|
|
3642
|
+
return p(this, Qe);
|
|
3129
3643
|
}
|
|
3130
3644
|
set toast(e) {
|
|
3131
|
-
u(this,
|
|
3645
|
+
u(this, Qe, e);
|
|
3132
3646
|
}
|
|
3133
3647
|
get copiedKey() {
|
|
3134
|
-
return p(this,
|
|
3648
|
+
return p(this, Ze);
|
|
3135
3649
|
}
|
|
3136
3650
|
set copiedKey(e) {
|
|
3137
|
-
u(this,
|
|
3651
|
+
u(this, Ze, e);
|
|
3138
3652
|
}
|
|
3139
3653
|
get retrievalOpen() {
|
|
3140
|
-
return p(this,
|
|
3654
|
+
return p(this, et);
|
|
3141
3655
|
}
|
|
3142
3656
|
set retrievalOpen(e) {
|
|
3143
|
-
u(this,
|
|
3657
|
+
u(this, et, e);
|
|
3658
|
+
}
|
|
3659
|
+
get rawKeys() {
|
|
3660
|
+
return p(this, tt);
|
|
3661
|
+
}
|
|
3662
|
+
set rawKeys(e) {
|
|
3663
|
+
u(this, tt, e);
|
|
3664
|
+
}
|
|
3665
|
+
get hasSidebarContent() {
|
|
3666
|
+
return p(this, st);
|
|
3667
|
+
}
|
|
3668
|
+
set hasSidebarContent(e) {
|
|
3669
|
+
u(this, st, e);
|
|
3670
|
+
}
|
|
3671
|
+
get sorts() {
|
|
3672
|
+
return p(this, it);
|
|
3673
|
+
}
|
|
3674
|
+
set sorts(e) {
|
|
3675
|
+
u(this, it, e);
|
|
3144
3676
|
}
|
|
3145
3677
|
get arrivedKey() {
|
|
3146
|
-
return p(this,
|
|
3678
|
+
return p(this, at);
|
|
3147
3679
|
}
|
|
3148
3680
|
set arrivedKey(e) {
|
|
3149
|
-
u(this,
|
|
3681
|
+
u(this, at, e);
|
|
3150
3682
|
}
|
|
3151
3683
|
get dragging() {
|
|
3152
|
-
return p(this,
|
|
3684
|
+
return p(this, rt);
|
|
3153
3685
|
}
|
|
3154
3686
|
set dragging(e) {
|
|
3155
|
-
u(this,
|
|
3687
|
+
u(this, rt, e);
|
|
3156
3688
|
}
|
|
3157
3689
|
get showJump() {
|
|
3158
|
-
return p(this,
|
|
3690
|
+
return p(this, ot);
|
|
3159
3691
|
}
|
|
3160
3692
|
set showJump(e) {
|
|
3161
|
-
u(this,
|
|
3693
|
+
u(this, ot, e);
|
|
3162
3694
|
}
|
|
3163
3695
|
get offline() {
|
|
3164
|
-
return p(this,
|
|
3696
|
+
return p(this, nt);
|
|
3165
3697
|
}
|
|
3166
3698
|
set offline(e) {
|
|
3167
|
-
u(this,
|
|
3699
|
+
u(this, nt, e);
|
|
3168
3700
|
}
|
|
3169
3701
|
get isOpen() {
|
|
3170
|
-
return p(this,
|
|
3702
|
+
return p(this, lt);
|
|
3171
3703
|
}
|
|
3172
3704
|
set isOpen(e) {
|
|
3173
|
-
u(this,
|
|
3705
|
+
u(this, lt, e);
|
|
3174
3706
|
}
|
|
3175
3707
|
get expanded() {
|
|
3176
|
-
return p(this,
|
|
3708
|
+
return p(this, ct);
|
|
3177
3709
|
}
|
|
3178
3710
|
set expanded(e) {
|
|
3179
|
-
u(this,
|
|
3711
|
+
u(this, ct, e);
|
|
3180
3712
|
}
|
|
3181
3713
|
get bubble() {
|
|
3182
|
-
return p(this,
|
|
3714
|
+
return p(this, dt);
|
|
3183
3715
|
}
|
|
3184
3716
|
set bubble(e) {
|
|
3185
|
-
u(this,
|
|
3717
|
+
u(this, dt, e);
|
|
3186
3718
|
}
|
|
3187
3719
|
get seen() {
|
|
3188
|
-
return p(this,
|
|
3720
|
+
return p(this, pt);
|
|
3189
3721
|
}
|
|
3190
3722
|
set seen(e) {
|
|
3191
|
-
u(this,
|
|
3723
|
+
u(this, pt, e);
|
|
3192
3724
|
}
|
|
3193
3725
|
get mobile() {
|
|
3194
|
-
return p(this,
|
|
3726
|
+
return p(this, ht);
|
|
3195
3727
|
}
|
|
3196
3728
|
set mobile(e) {
|
|
3197
|
-
u(this,
|
|
3729
|
+
u(this, ht, e);
|
|
3198
3730
|
}
|
|
3199
3731
|
get msg() {
|
|
3200
|
-
return
|
|
3732
|
+
return Qt(this.messages);
|
|
3201
3733
|
}
|
|
3202
3734
|
/** An explicit `.client`, else the page default. */
|
|
3203
3735
|
get resolvedClient() {
|
|
3204
|
-
return this.client ??
|
|
3736
|
+
return this.client ?? Ht() ?? null;
|
|
3205
3737
|
}
|
|
3206
3738
|
/** The open conversation's id, or null for a new chat. */
|
|
3207
3739
|
get chatId() {
|
|
@@ -3211,18 +3743,46 @@ let d = (dt = class extends ft {
|
|
|
3211
3743
|
get thread() {
|
|
3212
3744
|
return this.msgs;
|
|
3213
3745
|
}
|
|
3746
|
+
/** `format`, falling back to the default for anything unknown. */
|
|
3747
|
+
get formatLevel() {
|
|
3748
|
+
return ["raw", "plain", "advanced", "rich"].includes(this.format) ? this.format : "advanced";
|
|
3749
|
+
}
|
|
3214
3750
|
/** The loaded chat list. */
|
|
3215
3751
|
get chats() {
|
|
3216
3752
|
return this.chatList;
|
|
3217
3753
|
}
|
|
3754
|
+
/**
|
|
3755
|
+
* Every setting in one object, keyed by property name:
|
|
3756
|
+
*
|
|
3757
|
+
* chat.config = { client, mode: "rag", format: "rich", retrieval: [...], chatId: "…" };
|
|
3758
|
+
*
|
|
3759
|
+
* Unknown keys are ignored. `chatId` opens that chat; reading `config`
|
|
3760
|
+
* returns the current settings with `chatId` as the open chat.
|
|
3761
|
+
*/
|
|
3218
3762
|
set config(e) {
|
|
3763
|
+
if (!e) return;
|
|
3219
3764
|
const t = this;
|
|
3220
|
-
|
|
3221
|
-
|
|
3765
|
+
"client" in e && (this.client = e.client ?? null);
|
|
3766
|
+
for (const s of Mt)
|
|
3767
|
+
s in e && (t[s] = e[s]);
|
|
3768
|
+
e.chatId && e.chatId !== this.activeId && (this.hasUpdated ? this.openChat(e.chatId) : this.chatIdAttr = e.chatId);
|
|
3769
|
+
}
|
|
3770
|
+
/**
|
|
3771
|
+
* Changes settings on the fly. Only the keys you pass change; the chat keeps
|
|
3772
|
+
* its conversation and re-renders in place. Returns the element, so calls chain.
|
|
3773
|
+
*
|
|
3774
|
+
* chat.configure({ format: "rich" }).configure({ theme: "dark" });
|
|
3775
|
+
*/
|
|
3776
|
+
configure(e) {
|
|
3777
|
+
return this.config = e, this;
|
|
3222
3778
|
}
|
|
3223
3779
|
get config() {
|
|
3224
3780
|
const e = this;
|
|
3225
|
-
return
|
|
3781
|
+
return {
|
|
3782
|
+
client: this.client,
|
|
3783
|
+
chatId: this.activeId ?? "",
|
|
3784
|
+
...Object.fromEntries(Mt.map((t) => [t, e[t]]))
|
|
3785
|
+
};
|
|
3226
3786
|
}
|
|
3227
3787
|
// ── lifecycle ─────────────────────────────────────────────
|
|
3228
3788
|
connectedCallback() {
|
|
@@ -3238,7 +3798,7 @@ let d = (dt = class extends ft {
|
|
|
3238
3798
|
const t = this.retrieval;
|
|
3239
3799
|
this.retrieval = t && typeof t == "object" ? [t] : [];
|
|
3240
3800
|
}
|
|
3241
|
-
e.has("params") && (!this.params || typeof this.params != "object") && (this.params = {}), e.has("metadata") && (!this.metadata || typeof this.metadata != "object") && (this.metadata = {}), e.has("sidebar") && this.sidebar
|
|
3801
|
+
e.has("params") && (!this.params || typeof this.params != "object") && (this.params = {}), e.has("metadata") && (!this.metadata || typeof this.metadata != "object") && (this.metadata = {}), e.has("sidebar") && (this.sidebar === "open" ? this.sidebarOpen = !0 : this.sidebar === "closed" || this.sidebar === "none" ? this.sidebarOpen = !1 : this.width && (this.sidebarOpen = this.docked)), this.embed === "launcher" && this.greetingBubble && !this.bubbleScheduled && (this.bubbleScheduled = !0, this.later(() => {
|
|
3242
3802
|
!this.isOpen && !this.seen && (this.bubble = !0);
|
|
3243
3803
|
}, 1200));
|
|
3244
3804
|
}
|
|
@@ -3248,70 +3808,70 @@ let d = (dt = class extends ft {
|
|
|
3248
3808
|
updated() {
|
|
3249
3809
|
var t;
|
|
3250
3810
|
const e = this.renderRoot.querySelector(".root");
|
|
3251
|
-
if (e !== this.observed && ((t = this.observer) == null || t.disconnect(), this.observed = e, e && typeof ResizeObserver < "u" && (this.observer ?? (this.observer = new ResizeObserver(([
|
|
3252
|
-
const
|
|
3253
|
-
|
|
3254
|
-
})), this.observer.observe(e))), this.sidebarOpen && this.listState === "idle" && this.resolvedClient && this.loadChats(), this.focusNext) {
|
|
3255
|
-
const
|
|
3811
|
+
if (e !== this.observed && ((t = this.observer) == null || t.disconnect(), this.observed = e, e && typeof ResizeObserver < "u" && (this.observer ?? (this.observer = new ResizeObserver(([s]) => {
|
|
3812
|
+
const i = Math.round(s.contentRect.width);
|
|
3813
|
+
i !== this.width && (this.width = i, this.sidebarOpen === null && (this.sidebarOpen = this.sidebar === "auto" && this.docked));
|
|
3814
|
+
})), this.observer.observe(e))), this.sidebarOpen && this.listState === "idle" && this.resolvedClient && this.loadChats(), this.pendingChatId && this.resolvedClient && this.openChat(this.pendingChatId), this.focusNext) {
|
|
3815
|
+
const s = this.renderRoot.querySelector(
|
|
3256
3816
|
this.focusNext
|
|
3257
3817
|
);
|
|
3258
|
-
this.focusNext = "",
|
|
3818
|
+
this.focusNext = "", s && (s.focus(), "select" in s && s.tagName === "INPUT" && s.select());
|
|
3259
3819
|
}
|
|
3260
3820
|
}
|
|
3261
3821
|
later(e, t) {
|
|
3262
|
-
const
|
|
3263
|
-
this.timers.delete(
|
|
3822
|
+
const s = setTimeout(() => {
|
|
3823
|
+
this.timers.delete(s), e();
|
|
3264
3824
|
}, t);
|
|
3265
|
-
this.timers.add(
|
|
3825
|
+
this.timers.add(s);
|
|
3266
3826
|
}
|
|
3267
3827
|
emit(e, t) {
|
|
3268
3828
|
this.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
|
|
3269
3829
|
}
|
|
3270
3830
|
get docked() {
|
|
3271
|
-
return this.embed === "page" && this.width >=
|
|
3831
|
+
return this.embed === "page" && this.width >= $s;
|
|
3272
3832
|
}
|
|
3273
3833
|
get panelDocked() {
|
|
3274
|
-
const e = this.docked && this.sidebarOpen ?
|
|
3275
|
-
return this.width - e >=
|
|
3834
|
+
const e = this.docked && this.sidebarOpen ? ks : 0;
|
|
3835
|
+
return this.width - e >= Cs;
|
|
3276
3836
|
}
|
|
3277
3837
|
// ── public API ────────────────────────────────────────────
|
|
3278
3838
|
/** Starts a new, empty conversation. */
|
|
3279
3839
|
newChat() {
|
|
3280
|
-
this.halt(), this.activeId = null, this.chatTitle = "", this.bookmarked = !1, this.msgs = [], this.threadError = "", this.resetViewState(), this.focusNext = "textarea.input";
|
|
3840
|
+
this.halt(), this.pendingChatId = "", this.loadingThread = !1, this.activeId = null, this.chatTitle = "", this.bookmarked = !1, this.msgs = [], this.threadError = "", this.resetViewState(), this.focusNext = "textarea.input";
|
|
3281
3841
|
}
|
|
3282
3842
|
/** Opens a saved conversation. */
|
|
3283
3843
|
async openChat(e) {
|
|
3284
3844
|
const t = this.resolvedClient;
|
|
3285
3845
|
if (!e) return;
|
|
3286
3846
|
this.halt();
|
|
3287
|
-
const
|
|
3288
|
-
if (this.activeId = e, this.chatTitle = (
|
|
3289
|
-
this.
|
|
3847
|
+
const s = this.chatList.find((a) => a._id === e);
|
|
3848
|
+
if (this.activeId = e, this.chatTitle = (s == null ? void 0 : s.title) ?? "", this.bookmarked = !!(s != null && s.bookmarked), this.msgs = [], this.threadError = "", this.resetViewState(), !t) {
|
|
3849
|
+
this.pendingChatId = e, this.loadingThread = !0;
|
|
3290
3850
|
return;
|
|
3291
3851
|
}
|
|
3292
|
-
const
|
|
3293
|
-
this.loadingThread = !0;
|
|
3852
|
+
const i = ++this.run;
|
|
3853
|
+
this.pendingChatId = "", this.loadingThread = !0;
|
|
3294
3854
|
try {
|
|
3295
3855
|
const a = await t.llm.call("get_chat", {
|
|
3296
3856
|
_id: e
|
|
3297
3857
|
});
|
|
3298
|
-
if (
|
|
3299
|
-
this.chatTitle = (a == null ? void 0 : a.title) ?? "", this.bookmarked = !!(a != null && a.bookmarked), this.msgs = ((a == null ? void 0 : a.messages) ?? []).filter((
|
|
3858
|
+
if (i !== this.run) return;
|
|
3859
|
+
this.chatTitle = (a == null ? void 0 : a.title) ?? "", this.bookmarked = !!(a != null && a.bookmarked), this.msgs = ((a == null ? void 0 : a.messages) ?? []).filter((r) => r && (r.role === "user" || r.role === "assistant")).map((r) => this.fromServer(r)), this.upsertChat({ ...s, ...a, _id: e }), this.stick = !0, this.scrollToBottom();
|
|
3300
3860
|
} catch (a) {
|
|
3301
|
-
if (
|
|
3302
|
-
|
|
3861
|
+
if (i !== this.run) return;
|
|
3862
|
+
At(a) ? (this.chatList = this.chatList.filter((r) => r._id !== e), this.newChat(), this.showToast(this.msg.errNotFound)) : this.threadError = this.msg.errLoad;
|
|
3303
3863
|
} finally {
|
|
3304
|
-
|
|
3864
|
+
i === this.run && (this.loadingThread = !1);
|
|
3305
3865
|
}
|
|
3306
3866
|
}
|
|
3307
3867
|
/** Sends a message; with no argument, sends the composer's text. */
|
|
3308
3868
|
async send(e) {
|
|
3309
3869
|
const t = (typeof e == "string" ? e : this.draft).trim();
|
|
3310
3870
|
if (!t || this.busy) return;
|
|
3311
|
-
const
|
|
3871
|
+
const s = this.files;
|
|
3312
3872
|
this.draft = "", this.files = [];
|
|
3313
|
-
const
|
|
3314
|
-
|
|
3873
|
+
const i = this.renderRoot.querySelector("textarea.input");
|
|
3874
|
+
i && (i.style.height = "auto"), await this.runTurn(this.userMessage(t, s));
|
|
3315
3875
|
}
|
|
3316
3876
|
/** Stops waiting for, or revealing, the current reply. */
|
|
3317
3877
|
stop() {
|
|
@@ -3321,14 +3881,14 @@ let d = (dt = class extends ft {
|
|
|
3321
3881
|
}
|
|
3322
3882
|
/** Downloads the open conversation, or copies it as Markdown. */
|
|
3323
3883
|
exportChat(e = "md") {
|
|
3324
|
-
var
|
|
3884
|
+
var _;
|
|
3325
3885
|
if (!this.msgs.length) return;
|
|
3326
3886
|
this.menuOpen = !1;
|
|
3327
|
-
const t = this.chatTitle || this.msg.untitled,
|
|
3328
|
-
const
|
|
3329
|
-
return `[${
|
|
3330
|
-
}),
|
|
3331
|
-
let l, c = "text/markdown",
|
|
3887
|
+
const t = this.chatTitle || this.msg.untitled, s = (x) => x.role === "user" ? this.msg.you : this.assistantName, i = (x) => new Date(x || Date.now()).toLocaleString(), a = (x) => x.sources.map((T, $) => {
|
|
3888
|
+
const j = gt(T, $ + 1);
|
|
3889
|
+
return `[${j.n}] ${j.title}${j.path ? ` — ${j.path}` : ""}`;
|
|
3890
|
+
}), r = (x) => (x.attachments ?? []).map((T) => T.name);
|
|
3891
|
+
let l, c = "text/markdown", m = "md";
|
|
3332
3892
|
if (e === "json" ? (l = JSON.stringify(
|
|
3333
3893
|
{
|
|
3334
3894
|
exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3336,42 +3896,42 @@ let d = (dt = class extends ft {
|
|
|
3336
3896
|
title: t,
|
|
3337
3897
|
mode: this.mode,
|
|
3338
3898
|
bookmarked: this.bookmarked,
|
|
3339
|
-
messages: this.msgs.map((
|
|
3340
|
-
role:
|
|
3341
|
-
text:
|
|
3342
|
-
at: new Date(
|
|
3343
|
-
bookmarked:
|
|
3344
|
-
attachments:
|
|
3345
|
-
sources: a(
|
|
3899
|
+
messages: this.msgs.map((x) => ({
|
|
3900
|
+
role: x.role,
|
|
3901
|
+
text: x.content,
|
|
3902
|
+
at: new Date(x.at || Date.now()).toISOString(),
|
|
3903
|
+
bookmarked: x.bookmarked,
|
|
3904
|
+
attachments: r(x),
|
|
3905
|
+
sources: a(x)
|
|
3346
3906
|
}))
|
|
3347
3907
|
},
|
|
3348
3908
|
null,
|
|
3349
3909
|
2
|
|
3350
|
-
), c = "application/json",
|
|
3910
|
+
), c = "application/json", m = "json") : e === "txt" ? (l = `${t}
|
|
3351
3911
|
${"=".repeat(t.length)}
|
|
3352
3912
|
|
|
3353
3913
|
` + this.msgs.map(
|
|
3354
|
-
(
|
|
3355
|
-
`${
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
a(
|
|
3359
|
-
${a(
|
|
3914
|
+
(x) => [
|
|
3915
|
+
`${s(x)} · ${i(x.at)}`,
|
|
3916
|
+
r(x).length ? `Attachments: ${r(x).join(", ")}` : "",
|
|
3917
|
+
x.content,
|
|
3918
|
+
a(x).length ? `Sources:
|
|
3919
|
+
${a(x).join(`
|
|
3360
3920
|
`)}` : ""
|
|
3361
3921
|
].filter(Boolean).join(`
|
|
3362
3922
|
`)
|
|
3363
3923
|
).join(`
|
|
3364
3924
|
|
|
3365
|
-
`), c = "text/plain",
|
|
3925
|
+
`), c = "text/plain", m = "txt") : l = `# ${t}
|
|
3366
3926
|
|
|
3367
3927
|
` + this.msgs.map(
|
|
3368
|
-
(
|
|
3369
|
-
`### ${
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
a(
|
|
3928
|
+
(x) => [
|
|
3929
|
+
`### ${s(x)} · ${i(x.at)}`,
|
|
3930
|
+
r(x).length ? `Attachments: ${r(x).join(", ")}` : "",
|
|
3931
|
+
x.content,
|
|
3932
|
+
a(x).length ? `**Sources**
|
|
3373
3933
|
|
|
3374
|
-
${a(
|
|
3934
|
+
${a(x).map((T) => `- ${T}`).join(`
|
|
3375
3935
|
`)}` : ""
|
|
3376
3936
|
].filter(Boolean).join(`
|
|
3377
3937
|
|
|
@@ -3382,12 +3942,12 @@ ${a(k).map((L) => `- ${L}`).join(`
|
|
|
3382
3942
|
|
|
3383
3943
|
`) + `
|
|
3384
3944
|
`, this.emit("singlebase-chat-export", { chatId: this.activeId, format: e }), e === "copy") {
|
|
3385
|
-
(
|
|
3945
|
+
(_ = navigator.clipboard) == null || _.writeText(l).catch(() => {
|
|
3386
3946
|
}), this.showToast(this.msg.copiedMarkdown);
|
|
3387
3947
|
return;
|
|
3388
3948
|
}
|
|
3389
|
-
const
|
|
3390
|
-
|
|
3949
|
+
const C = `${t.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "chat"}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.${m}`, S = URL.createObjectURL(new Blob([l], { type: c })), w = document.createElement("a");
|
|
3950
|
+
w.href = S, w.download = C, document.body.appendChild(w), w.click(), w.remove(), setTimeout(() => URL.revokeObjectURL(S), 2e3), this.showToast(L(this.msg.exported, { name: C }));
|
|
3391
3951
|
}
|
|
3392
3952
|
/** Inline and launcher: fill the window. */
|
|
3393
3953
|
expand() {
|
|
@@ -3407,7 +3967,7 @@ ${a(k).map((L) => `- ${L}`).join(`
|
|
|
3407
3967
|
// ── turns ─────────────────────────────────────────────────
|
|
3408
3968
|
userMessage(e, t = []) {
|
|
3409
3969
|
return {
|
|
3410
|
-
key:
|
|
3970
|
+
key: mt(),
|
|
3411
3971
|
id: null,
|
|
3412
3972
|
role: "user",
|
|
3413
3973
|
content: e,
|
|
@@ -3422,23 +3982,24 @@ ${a(k).map((L) => `- ${L}`).join(`
|
|
|
3422
3982
|
systemPrompt() {
|
|
3423
3983
|
return [
|
|
3424
3984
|
this.systemMessage,
|
|
3425
|
-
|
|
3426
|
-
this.
|
|
3985
|
+
jt[this.mode] ?? jt.chat,
|
|
3986
|
+
zs[this.formatLevel],
|
|
3987
|
+
this.followups ? _s : ""
|
|
3427
3988
|
].filter(Boolean).join(`
|
|
3428
3989
|
|
|
3429
3990
|
`);
|
|
3430
3991
|
}
|
|
3431
3992
|
payloadFor(e) {
|
|
3432
3993
|
const t = { message: e.content, format: "markdown" };
|
|
3433
|
-
this.activeId ? t._id = this.activeId : (t.title =
|
|
3434
|
-
const
|
|
3435
|
-
(Object.keys(this.metadata ?? {}).length ||
|
|
3436
|
-
const
|
|
3437
|
-
return
|
|
3994
|
+
this.activeId ? t._id = this.activeId : (t.title = us(e.content), t.system_message = this.systemPrompt()), this.model && (t.model = this.model), Object.keys(this.params ?? {}).length && (t.params = this.params);
|
|
3995
|
+
const s = (e.attachments ?? []).map((a) => a.name);
|
|
3996
|
+
(Object.keys(this.metadata ?? {}).length || s.length) && (t.metadata = { ...this.metadata, ...s.length ? { attachments: s } : {} });
|
|
3997
|
+
const i = [...this.retrieval ?? [], ...As(e.attachments ?? [])];
|
|
3998
|
+
return i.length && (t.retrieval = i), t;
|
|
3438
3999
|
}
|
|
3439
4000
|
async runTurn(e) {
|
|
3440
4001
|
const t = {
|
|
3441
|
-
key:
|
|
4002
|
+
key: mt(),
|
|
3442
4003
|
id: null,
|
|
3443
4004
|
role: "assistant",
|
|
3444
4005
|
content: "",
|
|
@@ -3449,57 +4010,79 @@ ${a(k).map((L) => `- ${L}`).join(`
|
|
|
3449
4010
|
phase: "pending"
|
|
3450
4011
|
};
|
|
3451
4012
|
this.msgs = [...this.msgs, e, t], this.busy = !0, this.panel = null, this.stick = !0, this.scrollToBottom(), this.emit("singlebase-chat-send", { chatId: this.activeId, text: e.content });
|
|
3452
|
-
const
|
|
3453
|
-
if (!
|
|
4013
|
+
const s = this.resolvedClient;
|
|
4014
|
+
if (!s) {
|
|
3454
4015
|
this.failTurn(t, this.msg.errNoClient, "NO_CLIENT"), this.busy = !1;
|
|
3455
4016
|
return;
|
|
3456
4017
|
}
|
|
3457
|
-
const
|
|
4018
|
+
const i = ++this.run, a = new AbortController();
|
|
3458
4019
|
this.abort = a;
|
|
3459
|
-
const
|
|
4020
|
+
const r = !this.activeId;
|
|
4021
|
+
let l = this.payloadFor(e);
|
|
4022
|
+
if (this.beforeSend) {
|
|
4023
|
+
let c;
|
|
4024
|
+
try {
|
|
4025
|
+
c = await this.beforeSend(l, { chatId: this.activeId, isNew: r, message: e });
|
|
4026
|
+
} catch (b) {
|
|
4027
|
+
c = b;
|
|
4028
|
+
}
|
|
4029
|
+
if (i !== this.run) return;
|
|
4030
|
+
if (c === !1) {
|
|
4031
|
+
this.msgs = this.msgs.filter((b) => b !== e && b !== t), this.draft = e.content, this.busy = !1, this.abort = null;
|
|
4032
|
+
return;
|
|
4033
|
+
}
|
|
4034
|
+
if (!(!!c && typeof c == "object" && typeof c.message == "string") || !c.message.trim()) {
|
|
4035
|
+
console.error(
|
|
4036
|
+
"[singlebase-chat] beforeSend must return the request object (with a message) or false to cancel; the message was not sent.",
|
|
4037
|
+
c
|
|
4038
|
+
), this.failTurn(t, this.msg.errGeneric, "BEFORE_SEND_INVALID"), this.busy = !1, this.abort = null;
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
l = c;
|
|
4042
|
+
}
|
|
3460
4043
|
try {
|
|
3461
|
-
const c = await
|
|
3462
|
-
if (
|
|
3463
|
-
_id:
|
|
4044
|
+
const c = await s.llm.call("chat", l, { signal: a.signal }), m = (c == null ? void 0 : c._id) || (c == null ? void 0 : c.chat_id) || this.activeId;
|
|
4045
|
+
if (r && m && this.upsertChat({
|
|
4046
|
+
_id: m,
|
|
3464
4047
|
title: (c == null ? void 0 : c.title) || l.title,
|
|
3465
4048
|
bookmarked: !!(c != null && c.bookmarked),
|
|
3466
4049
|
_modified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
3467
|
-
}),
|
|
3468
|
-
|
|
3469
|
-
const
|
|
3470
|
-
e.id =
|
|
3471
|
-
id:
|
|
4050
|
+
}), i !== this.run) return;
|
|
4051
|
+
m && (this.activeId = m), r ? (this.chatTitle = (c == null ? void 0 : c.title) || l.title, this.bookmarked = !!(c != null && c.bookmarked)) : m && this.touchChat(m);
|
|
4052
|
+
const b = (c == null ? void 0 : c.message) ?? {}, C = typeof b.content == "string" ? b.content : (c == null ? void 0 : c.json) !== void 0 ? JSON.stringify(c.json, null, 2) : "", { text: S, followups: w } = Ot(C);
|
|
4053
|
+
e.id = b.reply_to ?? null, Object.assign(t, {
|
|
4054
|
+
id: b._id ?? null,
|
|
3472
4055
|
content: S,
|
|
3473
|
-
sources: Array.isArray(
|
|
3474
|
-
followups:
|
|
3475
|
-
execTime: typeof
|
|
3476
|
-
model:
|
|
4056
|
+
sources: Array.isArray(b.sources) ? b.sources : [],
|
|
4057
|
+
followups: w,
|
|
4058
|
+
execTime: typeof b.exec_time == "number" ? b.exec_time : void 0,
|
|
4059
|
+
model: b.model,
|
|
3477
4060
|
at: Date.now()
|
|
3478
|
-
}), this.emit("singlebase-chat-response", { chatId:
|
|
4061
|
+
}), this.emit("singlebase-chat-response", { chatId: m, message: t }), await this.reveal(t, i), r && m && this.autoTitle && this.retitle(m, e.content, t.content);
|
|
3479
4062
|
} catch (c) {
|
|
3480
|
-
if (
|
|
3481
|
-
const
|
|
3482
|
-
|
|
4063
|
+
if (i !== this.run) return;
|
|
4064
|
+
const m = At(c);
|
|
4065
|
+
m && (this.chatList = this.chatList.filter((b) => b._id !== this.activeId), this.activeId = null), this.failTurn(t, m ? this.msg.errNotFound : this.msg.errGeneric, js(c));
|
|
3483
4066
|
} finally {
|
|
3484
|
-
|
|
4067
|
+
i === this.run && (this.busy = !1, this.abort = null, this.stick && this.scrollToBottom());
|
|
3485
4068
|
}
|
|
3486
4069
|
}
|
|
3487
|
-
failTurn(e, t,
|
|
3488
|
-
e.phase = "error", e.error = t, this.msgs = [...this.msgs], this.emit("singlebase-chat-error", { chatId: this.activeId, code:
|
|
4070
|
+
failTurn(e, t, s) {
|
|
4071
|
+
e.phase = "error", e.error = t, this.msgs = [...this.msgs], this.emit("singlebase-chat-error", { chatId: this.activeId, code: s, message: t });
|
|
3489
4072
|
}
|
|
3490
4073
|
/**
|
|
3491
4074
|
* The service answers in one piece; this reveals it progressively so it
|
|
3492
4075
|
* reads like a stream. Capped at about a second and a half.
|
|
3493
4076
|
*/
|
|
3494
4077
|
reveal(e, t) {
|
|
3495
|
-
const
|
|
4078
|
+
const s = e.content.length, i = () => {
|
|
3496
4079
|
e.phase = "done", this.msgs = [...this.msgs], this.arrivedKey = e.key, this.later(() => {
|
|
3497
4080
|
this.arrivedKey === e.key && (this.arrivedKey = "");
|
|
3498
|
-
},
|
|
4081
|
+
}, Ms), this.stick ? this.scrollToBottom() : this.showJump = !0;
|
|
3499
4082
|
};
|
|
3500
|
-
if (!
|
|
3501
|
-
return
|
|
3502
|
-
const a = e.content,
|
|
4083
|
+
if (!s || Ns())
|
|
4084
|
+
return i(), Promise.resolve();
|
|
4085
|
+
const a = e.content, r = Math.max(4, Math.ceil(s / 90));
|
|
3503
4086
|
let l = 0;
|
|
3504
4087
|
return e.phase = "streaming", e.content = "", new Promise((c) => {
|
|
3505
4088
|
this.revealTimer = setInterval(() => {
|
|
@@ -3507,8 +4090,8 @@ ${a(k).map((L) => `- ${L}`).join(`
|
|
|
3507
4090
|
clearInterval(this.revealTimer), c();
|
|
3508
4091
|
return;
|
|
3509
4092
|
}
|
|
3510
|
-
if (l = Math.min(
|
|
3511
|
-
clearInterval(this.revealTimer),
|
|
4093
|
+
if (l = Math.min(s, l + r), e.content = a.slice(0, l), l >= s) {
|
|
4094
|
+
clearInterval(this.revealTimer), i(), c();
|
|
3512
4095
|
return;
|
|
3513
4096
|
}
|
|
3514
4097
|
this.msgs = [...this.msgs], this.stick && this.scrollToBottom();
|
|
@@ -3520,23 +4103,23 @@ ${a(k).map((L) => `- ${L}`).join(`
|
|
|
3520
4103
|
var e;
|
|
3521
4104
|
this.run++, (e = this.abort) == null || e.abort(), this.abort = null, clearInterval(this.revealTimer), this.busy = !1;
|
|
3522
4105
|
}
|
|
3523
|
-
async retitle(e, t,
|
|
3524
|
-
const
|
|
3525
|
-
if (!(!
|
|
4106
|
+
async retitle(e, t, s) {
|
|
4107
|
+
const i = this.resolvedClient;
|
|
4108
|
+
if (!(!i || this.renamed.has(e)))
|
|
3526
4109
|
try {
|
|
3527
|
-
const a = await
|
|
4110
|
+
const a = await i.llm.call("generate", {
|
|
3528
4111
|
user_input: `user: ${t}
|
|
3529
|
-
assistant: ${
|
|
4112
|
+
assistant: ${s.slice(0, 1500)}`,
|
|
3530
4113
|
custom_instructions: "Write a concise title (3–6 words, sentence case, no quotes, no trailing punctuation) for this conversation.",
|
|
3531
4114
|
format: "text"
|
|
3532
|
-
}),
|
|
3533
|
-
if (!
|
|
3534
|
-
await
|
|
4115
|
+
}), r = gs(a == null ? void 0 : a.result);
|
|
4116
|
+
if (!r || this.renamed.has(e)) return;
|
|
4117
|
+
await i.llm.call("update_chat", { _id: e, title: r }), this.applyTitle(e, r, !0);
|
|
3535
4118
|
} catch {
|
|
3536
4119
|
}
|
|
3537
4120
|
}
|
|
3538
|
-
applyTitle(e, t,
|
|
3539
|
-
this.chatList = this.chatList.map((
|
|
4121
|
+
applyTitle(e, t, s) {
|
|
4122
|
+
this.chatList = this.chatList.map((i) => i._id === e ? { ...i, title: t } : i), this.activeId === e && (this.chatTitle = t), this.emit("singlebase-chat-title", { chatId: e, title: t, auto: s });
|
|
3540
4123
|
}
|
|
3541
4124
|
/**
|
|
3542
4125
|
* Enter and blur both land here. Saving on Enter directly (not via blur())
|
|
@@ -3549,28 +4132,28 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3549
4132
|
this.renamingId === e && (this.renamingId = "", this.renameChat(e, t));
|
|
3550
4133
|
}
|
|
3551
4134
|
async renameChat(e, t) {
|
|
3552
|
-
var a,
|
|
3553
|
-
const
|
|
3554
|
-
if (!(!
|
|
3555
|
-
this.renamed.add(e), this.applyTitle(e,
|
|
4135
|
+
var a, r;
|
|
4136
|
+
const s = t.trim().slice(0, 80), i = ((a = this.chatList.find((l) => l._id === e)) == null ? void 0 : a.title) ?? this.chatTitle;
|
|
4137
|
+
if (!(!s || s === i)) {
|
|
4138
|
+
this.renamed.add(e), this.applyTitle(e, s, !1);
|
|
3556
4139
|
try {
|
|
3557
|
-
await ((
|
|
4140
|
+
await ((r = this.resolvedClient) == null ? void 0 : r.llm.call("update_chat", { _id: e, title: s }));
|
|
3558
4141
|
} catch {
|
|
3559
|
-
this.applyTitle(e,
|
|
4142
|
+
this.applyTitle(e, i ?? "", !1), this.showToast(this.msg.errGeneric);
|
|
3560
4143
|
}
|
|
3561
4144
|
}
|
|
3562
4145
|
}
|
|
3563
4146
|
fromServer(e) {
|
|
3564
|
-
const t = e.role === "assistant", { text:
|
|
4147
|
+
const t = e.role === "assistant", { text: s, followups: i } = t ? Ot(String(e.content ?? "")) : { text: String(e.content ?? ""), followups: [] };
|
|
3565
4148
|
return {
|
|
3566
|
-
key:
|
|
4149
|
+
key: mt(),
|
|
3567
4150
|
id: e._id ?? null,
|
|
3568
4151
|
role: t ? "assistant" : "user",
|
|
3569
|
-
content:
|
|
4152
|
+
content: s,
|
|
3570
4153
|
at: Date.parse(e._created_at ?? "") || 0,
|
|
3571
4154
|
bookmarked: !!e.bookmarked,
|
|
3572
4155
|
sources: Array.isArray(e.sources) ? e.sources : [],
|
|
3573
|
-
followups:
|
|
4156
|
+
followups: i,
|
|
3574
4157
|
phase: "done",
|
|
3575
4158
|
execTime: typeof e.exec_time == "number" ? e.exec_time : void 0,
|
|
3576
4159
|
model: e.model
|
|
@@ -3590,11 +4173,11 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3590
4173
|
}
|
|
3591
4174
|
}
|
|
3592
4175
|
upsertChat(e) {
|
|
3593
|
-
const t = this.chatList.filter((
|
|
3594
|
-
this.chatList = [{ ...
|
|
4176
|
+
const t = this.chatList.filter((i) => i._id !== e._id), s = this.chatList.find((i) => i._id === e._id);
|
|
4177
|
+
this.chatList = [{ ...s, ...e }, ...t];
|
|
3595
4178
|
}
|
|
3596
4179
|
touchChat(e) {
|
|
3597
|
-
const t = this.chatList.find((
|
|
4180
|
+
const t = this.chatList.find((s) => s._id === e);
|
|
3598
4181
|
t && this.upsertChat({ ...t, _modified_at: (/* @__PURE__ */ new Date()).toISOString() });
|
|
3599
4182
|
}
|
|
3600
4183
|
// ── actions ───────────────────────────────────────────────
|
|
@@ -3602,44 +4185,48 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3602
4185
|
this.panel = null, this.menuOpen = !1, this.editingKey = "", this.editingTitle = !1, this.showJump = !1, this.retrievalOpen = /* @__PURE__ */ new Set(), this.sidebarOpen && !this.docked && (this.sidebarOpen = !1);
|
|
3603
4186
|
}
|
|
3604
4187
|
async deleteOnServer(e) {
|
|
3605
|
-
const t = this.resolvedClient,
|
|
3606
|
-
if (!(!t || !
|
|
3607
|
-
for (const
|
|
3608
|
-
|
|
4188
|
+
const t = this.resolvedClient, s = this.activeId;
|
|
4189
|
+
if (!(!t || !s))
|
|
4190
|
+
for (const i of e)
|
|
4191
|
+
i && await t.llm.call("delete_chat_message", { _id: s, message_id: i }).catch(() => {
|
|
3609
4192
|
});
|
|
3610
4193
|
}
|
|
3611
4194
|
async regenerate() {
|
|
3612
4195
|
if (this.busy) return;
|
|
3613
|
-
const e = this.msgs.map((
|
|
4196
|
+
const e = this.msgs.map((i) => i.role).lastIndexOf("assistant"), t = this.msgs[e - 1];
|
|
3614
4197
|
if (e < 1 || (t == null ? void 0 : t.role) !== "user") return;
|
|
3615
|
-
const
|
|
3616
|
-
this.msgs = this.msgs.slice(0, e - 1), await this.deleteOnServer(
|
|
4198
|
+
const s = this.msgs.slice(e - 1);
|
|
4199
|
+
this.msgs = this.msgs.slice(0, e - 1), await this.deleteOnServer(s.map((i) => i.id)), await this.runTurn(this.userMessage(t.content, t.attachments));
|
|
3617
4200
|
}
|
|
3618
4201
|
async retry(e) {
|
|
3619
4202
|
if (this.busy) return;
|
|
3620
|
-
const t = this.msgs.indexOf(e),
|
|
3621
|
-
(
|
|
4203
|
+
const t = this.msgs.indexOf(e), s = this.msgs[t - 1];
|
|
4204
|
+
(s == null ? void 0 : s.role) === "user" && (this.msgs = this.msgs.slice(0, t - 1), await this.runTurn(this.userMessage(s.content, s.attachments)));
|
|
3622
4205
|
}
|
|
3623
4206
|
async saveEdit(e) {
|
|
3624
|
-
const t = this.editDraft.trim(),
|
|
3625
|
-
if (this.editingKey = "", !t ||
|
|
3626
|
-
const
|
|
3627
|
-
this.msgs = this.msgs.slice(0,
|
|
4207
|
+
const t = this.editDraft.trim(), s = this.msgs.indexOf(e);
|
|
4208
|
+
if (this.editingKey = "", !t || s < 0 || this.busy) return;
|
|
4209
|
+
const i = this.msgs.slice(s);
|
|
4210
|
+
this.msgs = this.msgs.slice(0, s), await this.deleteOnServer(i.map((a) => a.id)), await this.runTurn(this.userMessage(t, e.attachments));
|
|
4211
|
+
}
|
|
4212
|
+
toggleRaw(e) {
|
|
4213
|
+
const t = new Set(this.rawKeys);
|
|
4214
|
+
t.has(e) ? t.delete(e) : t.add(e), this.rawKeys = t;
|
|
3628
4215
|
}
|
|
3629
4216
|
copy(e, t) {
|
|
3630
|
-
var
|
|
3631
|
-
(
|
|
4217
|
+
var s;
|
|
4218
|
+
(s = navigator.clipboard) == null || s.writeText(t).catch(() => {
|
|
3632
4219
|
}), this.copiedKey = e, this.later(() => {
|
|
3633
4220
|
this.copiedKey === e && (this.copiedKey = "");
|
|
3634
4221
|
}, 1400);
|
|
3635
4222
|
}
|
|
3636
4223
|
async toggleMessageBookmark(e) {
|
|
3637
|
-
var
|
|
4224
|
+
var s;
|
|
3638
4225
|
const t = this.activeId;
|
|
3639
4226
|
if (!(!t || !e.id)) {
|
|
3640
4227
|
e.bookmarked = !e.bookmarked, this.msgs = [...this.msgs], this.showToast(e.bookmarked ? this.msg.messageBookmarked : this.msg.bookmarkRemoved), this.emit("singlebase-chat-bookmark", { chatId: t, messageId: e.id, bookmarked: e.bookmarked });
|
|
3641
4228
|
try {
|
|
3642
|
-
await ((
|
|
4229
|
+
await ((s = this.resolvedClient) == null ? void 0 : s.llm.call("bookmark_chat_message", {
|
|
3643
4230
|
_id: t,
|
|
3644
4231
|
message_id: e.id,
|
|
3645
4232
|
bookmarked: e.bookmarked
|
|
@@ -3650,28 +4237,28 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3650
4237
|
}
|
|
3651
4238
|
}
|
|
3652
4239
|
async toggleChatBookmark(e) {
|
|
3653
|
-
var a,
|
|
3654
|
-
const t = ((a = this.chatList.find((l) => l._id === e)) == null ? void 0 : a.bookmarked) ?? (e === this.activeId ? this.bookmarked : !1),
|
|
4240
|
+
var a, r;
|
|
4241
|
+
const t = ((a = this.chatList.find((l) => l._id === e)) == null ? void 0 : a.bookmarked) ?? (e === this.activeId ? this.bookmarked : !1), s = !t, i = (l) => {
|
|
3655
4242
|
this.chatList = this.chatList.map(
|
|
3656
4243
|
(c) => c._id === e ? { ...c, bookmarked: l } : c
|
|
3657
4244
|
), e === this.activeId && (this.bookmarked = l);
|
|
3658
4245
|
};
|
|
3659
|
-
s
|
|
4246
|
+
i(s), this.showToast(s ? this.msg.chatBookmarked : this.msg.chatUnbookmarked), this.emit("singlebase-chat-bookmark", { chatId: e, bookmarked: s });
|
|
3660
4247
|
try {
|
|
3661
|
-
await ((
|
|
4248
|
+
await ((r = this.resolvedClient) == null ? void 0 : r.llm.call("bookmark_chat", { _id: e, bookmarked: s }));
|
|
3662
4249
|
} catch {
|
|
3663
|
-
|
|
4250
|
+
i(t), this.showToast(this.msg.errGeneric);
|
|
3664
4251
|
}
|
|
3665
4252
|
}
|
|
3666
4253
|
/** Removed at once; the server call waits out the undo window. */
|
|
3667
4254
|
deleteMessage(e) {
|
|
3668
|
-
var
|
|
3669
|
-
const t = this.activeId,
|
|
3670
|
-
|
|
4255
|
+
var i;
|
|
4256
|
+
const t = this.activeId, s = this.msgs.indexOf(e);
|
|
4257
|
+
s < 0 || (this.msgs = this.msgs.filter((a) => a !== e), ((i = this.panel) == null ? void 0 : i.key) === e.key && (this.panel = null), this.showToast(this.msg.messageDeleted, {
|
|
3671
4258
|
undo: () => {
|
|
3672
4259
|
if (this.activeId !== t) return;
|
|
3673
4260
|
const a = [...this.msgs];
|
|
3674
|
-
a.splice(
|
|
4261
|
+
a.splice(s, 0, e), this.msgs = a;
|
|
3675
4262
|
},
|
|
3676
4263
|
commit: () => {
|
|
3677
4264
|
var a;
|
|
@@ -3681,19 +4268,19 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3681
4268
|
}));
|
|
3682
4269
|
}
|
|
3683
4270
|
deleteChat(e) {
|
|
3684
|
-
const t = this.chatList.findIndex((
|
|
4271
|
+
const t = this.chatList.findIndex((r) => r._id === e), s = this.chatList[t] ?? {
|
|
3685
4272
|
_id: e,
|
|
3686
4273
|
title: this.chatTitle,
|
|
3687
4274
|
bookmarked: this.bookmarked
|
|
3688
|
-
},
|
|
3689
|
-
this.chatList = this.chatList.filter((
|
|
4275
|
+
}, i = e === this.activeId, a = i ? { title: this.chatTitle, bookmarked: this.bookmarked, msgs: this.msgs } : null;
|
|
4276
|
+
this.chatList = this.chatList.filter((r) => r._id !== e), i && this.newChat(), this.showToast(this.msg.chatDeleted, {
|
|
3690
4277
|
undo: () => {
|
|
3691
|
-
const
|
|
3692
|
-
|
|
4278
|
+
const r = [...this.chatList];
|
|
4279
|
+
r.splice(Math.max(0, t), 0, s), this.chatList = r, a && !this.activeId && !this.msgs.length && (this.activeId = e, this.chatTitle = a.title, this.bookmarked = a.bookmarked, this.msgs = a.msgs);
|
|
3693
4280
|
},
|
|
3694
4281
|
commit: () => {
|
|
3695
|
-
var
|
|
3696
|
-
this.emit("singlebase-chat-delete", { chatId: e }), (
|
|
4282
|
+
var r;
|
|
4283
|
+
this.emit("singlebase-chat-delete", { chatId: e }), (r = this.resolvedClient) == null || r.llm.call("delete_chat", { _id: e }).catch(() => {
|
|
3697
4284
|
});
|
|
3698
4285
|
}
|
|
3699
4286
|
});
|
|
@@ -3709,10 +4296,10 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3709
4296
|
// ── toasts ────────────────────────────────────────────────
|
|
3710
4297
|
showToast(e, t = {}) {
|
|
3711
4298
|
this.flushToast();
|
|
3712
|
-
const
|
|
3713
|
-
this.toast =
|
|
3714
|
-
this.toast ===
|
|
3715
|
-
},
|
|
4299
|
+
const s = { key: Date.now(), text: e, ...t };
|
|
4300
|
+
this.toast = s, this.toastTimer = setTimeout(() => {
|
|
4301
|
+
this.toast === s && this.flushToast();
|
|
4302
|
+
}, Ss);
|
|
3716
4303
|
}
|
|
3717
4304
|
/** Ends the current toast, committing whatever it was holding back. */
|
|
3718
4305
|
flushToast() {
|
|
@@ -3729,26 +4316,26 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3729
4316
|
async addFiles(e) {
|
|
3730
4317
|
const t = Array.from(e ?? []);
|
|
3731
4318
|
if (!t.length) return;
|
|
3732
|
-
const
|
|
3733
|
-
for (const
|
|
3734
|
-
if (this.files.length +
|
|
3735
|
-
this.showToast(
|
|
4319
|
+
const s = [];
|
|
4320
|
+
for (const i of t) {
|
|
4321
|
+
if (this.files.length + s.length >= zt) {
|
|
4322
|
+
this.showToast(L(this.msg.tooManyFiles, { n: zt }));
|
|
3736
4323
|
break;
|
|
3737
4324
|
}
|
|
3738
|
-
if (!
|
|
3739
|
-
this.showToast(
|
|
4325
|
+
if (!Ts.test(i.name) && !i.type.startsWith("text/")) {
|
|
4326
|
+
this.showToast(L(this.msg.fileType, { name: i.name }));
|
|
3740
4327
|
continue;
|
|
3741
4328
|
}
|
|
3742
|
-
if (
|
|
4329
|
+
if (i.size > _t) {
|
|
3743
4330
|
this.showToast(
|
|
3744
|
-
|
|
4331
|
+
L(this.msg.fileTooLarge, { name: i.name, size: vt(_t) })
|
|
3745
4332
|
);
|
|
3746
4333
|
continue;
|
|
3747
4334
|
}
|
|
3748
|
-
|
|
4335
|
+
s.push({ name: i.name, size: i.size, content: await i.text() });
|
|
3749
4336
|
}
|
|
3750
|
-
|
|
3751
|
-
files:
|
|
4337
|
+
s.length && (this.files = [...this.files, ...s], this.emit("singlebase-chat-files", {
|
|
4338
|
+
files: s.map(({ name: i, size: a }) => ({ name: i, size: a }))
|
|
3752
4339
|
}));
|
|
3753
4340
|
}
|
|
3754
4341
|
// ── scrolling ─────────────────────────────────────────────
|
|
@@ -3786,7 +4373,7 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3786
4373
|
// ── drag and drop ─────────────────────────────────────────
|
|
3787
4374
|
onDragEnter(e) {
|
|
3788
4375
|
var t;
|
|
3789
|
-
!this.allowUpload || !Array.from(((t = e.dataTransfer) == null ? void 0 : t.types) ?? []).includes("Files")
|
|
4376
|
+
!this.allowUpload || !this.showComposer || Array.from(((t = e.dataTransfer) == null ? void 0 : t.types) ?? []).includes("Files") && (e.preventDefault(), this.dragging = !0);
|
|
3790
4377
|
}
|
|
3791
4378
|
onDragLeave(e) {
|
|
3792
4379
|
e.currentTarget.contains(e.relatedTarget) || (this.dragging = !1);
|
|
@@ -3803,16 +4390,16 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3803
4390
|
this.embed === "inline" ? "inline boxed" : "",
|
|
3804
4391
|
this.expanded ? "expanded boxed" : ""
|
|
3805
4392
|
].join(" ");
|
|
3806
|
-
return
|
|
4393
|
+
return o`<div class=${e} part="frame">${this.renderWorkspace()}</div>`;
|
|
3807
4394
|
}
|
|
3808
4395
|
renderLauncher() {
|
|
3809
4396
|
const e = this.msg, t = [
|
|
3810
4397
|
"frame launcher boxed",
|
|
3811
4398
|
this.expanded ? "expanded" : "",
|
|
3812
4399
|
this.mobile ? "full" : ""
|
|
3813
|
-
].join(" "),
|
|
4400
|
+
].join(" "), s = this.isOpen ? o`<div class=${t} role="dialog" aria-label=${this.assistantName} part="frame">
|
|
3814
4401
|
${this.renderWorkspace()}
|
|
3815
|
-
</div>` :
|
|
4402
|
+
</div>` : f, i = this.bubble && !this.isOpen ? o`<div class="bubble" part="bubble">
|
|
3816
4403
|
<button type="button" class="bubble-text" @click=${() => this.open()}>
|
|
3817
4404
|
${this.bubbleText || e.bubbleText}
|
|
3818
4405
|
</button>
|
|
@@ -3823,9 +4410,9 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3823
4410
|
title=${e.dismiss}
|
|
3824
4411
|
@click=${() => this.bubble = !1}
|
|
3825
4412
|
>
|
|
3826
|
-
${
|
|
4413
|
+
${k.close()}
|
|
3827
4414
|
</button>
|
|
3828
|
-
</div>` :
|
|
4415
|
+
</div>` : f, r = this.isOpen && (this.expanded || this.mobile) ? f : o`<button
|
|
3829
4416
|
type="button"
|
|
3830
4417
|
class="launcher-btn"
|
|
3831
4418
|
part="launcher"
|
|
@@ -3833,23 +4420,23 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3833
4420
|
aria-expanded=${this.isOpen ? "true" : "false"}
|
|
3834
4421
|
@click=${() => this.isOpen ? this.close() : this.open()}
|
|
3835
4422
|
>
|
|
3836
|
-
${this.isOpen ?
|
|
3837
|
-
${this.unreadBadge && !this.seen && !this.isOpen ?
|
|
4423
|
+
${this.isOpen ? k.chevronDown() : k.chat()}
|
|
4424
|
+
${this.unreadBadge && !this.seen && !this.isOpen ? o`<span class="badge"></span>` : f}
|
|
3838
4425
|
</button>`;
|
|
3839
|
-
return
|
|
4426
|
+
return o`${s}${i}${r}`;
|
|
3840
4427
|
}
|
|
3841
4428
|
renderWorkspace() {
|
|
3842
4429
|
const e = !this.docked;
|
|
3843
|
-
return
|
|
3844
|
-
${this.sidebarOpen && e ?
|
|
3845
|
-
${this.sidebarOpen ? this.renderSidebar(e) :
|
|
4430
|
+
return o`<div class="root" @keydown=${this.onKeydown}>
|
|
4431
|
+
${this.sidebarOpen && e ? o`<div class="scrim" @click=${() => this.sidebarOpen = !1}></div>` : f}
|
|
4432
|
+
${this.sidebarOpen && this.sidebar !== "none" ? this.renderSidebar(e) : f}
|
|
3846
4433
|
<main
|
|
3847
4434
|
class="main"
|
|
3848
4435
|
@dragenter=${this.onDragEnter}
|
|
3849
4436
|
@dragover=${(t) => t.preventDefault()}
|
|
3850
4437
|
>
|
|
3851
4438
|
${this.renderHeader()}
|
|
3852
|
-
${this.offline ?
|
|
4439
|
+
${this.offline ? o`<div class="banner" role="status">${this.msg.offline}</div>` : f}
|
|
3853
4440
|
<div
|
|
3854
4441
|
class="scroller"
|
|
3855
4442
|
role="log"
|
|
@@ -3860,64 +4447,46 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3860
4447
|
>
|
|
3861
4448
|
${this.msgs.length || this.loadingThread || this.threadError ? this.renderThread() : this.renderWelcome()}
|
|
3862
4449
|
</div>
|
|
3863
|
-
${this.showJump ?
|
|
4450
|
+
${this.showJump ? o`<button type="button" class="jump" @click=${this.jumpToLatest}>
|
|
3864
4451
|
↓ ${this.msg.newReply}
|
|
3865
|
-
</button>` :
|
|
4452
|
+
</button>` : f}
|
|
3866
4453
|
${this.renderComposer()}
|
|
3867
|
-
${this.branding
|
|
3868
|
-
|
|
3869
|
-
>${this.msg.brandingLabel}</a
|
|
3870
|
-
>
|
|
3871
|
-
</div>` : m}
|
|
3872
|
-
${this.toast ? r`<div class="toast" role="status">
|
|
4454
|
+
${Gt(this.branding, this.brandingText, this.msg.brandingLabel, this.brandingUrl)}
|
|
4455
|
+
${this.toast ? o`<div class="toast" role="status">
|
|
3873
4456
|
<span>${this.toast.text}</span>
|
|
3874
|
-
${this.toast.undo ?
|
|
3875
|
-
</div>` :
|
|
3876
|
-
${this.dragging ?
|
|
4457
|
+
${this.toast.undo ? o`<button type="button" @click=${this.undo}>${this.msg.undo}</button>` : f}
|
|
4458
|
+
</div>` : f}
|
|
4459
|
+
${this.dragging ? o`<div
|
|
3877
4460
|
class="drop"
|
|
3878
4461
|
@dragover=${(t) => t.preventDefault()}
|
|
3879
4462
|
@dragleave=${this.onDragLeave}
|
|
3880
4463
|
@drop=${this.onDrop}
|
|
3881
4464
|
>
|
|
3882
4465
|
<strong>${this.msg.dropTitle}</strong><span>${this.msg.dropSub}</span>
|
|
3883
|
-
</div>` :
|
|
4466
|
+
</div>` : f}
|
|
3884
4467
|
</main>
|
|
3885
4468
|
${this.renderPanel()}
|
|
3886
4469
|
</div>`;
|
|
3887
4470
|
}
|
|
3888
4471
|
renderSidebar(e) {
|
|
3889
|
-
const t = this.msg,
|
|
3890
|
-
(
|
|
3891
|
-
), a = [
|
|
3892
|
-
[t.groupBookmarked,
|
|
3893
|
-
[
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
]
|
|
3897
|
-
[
|
|
3898
|
-
t.groupYesterday,
|
|
3899
|
-
s.filter(
|
|
3900
|
-
(l) => !l.bookmarked && Pe(l._modified_at ?? l._created_at) === "yesterday"
|
|
3901
|
-
)
|
|
3902
|
-
],
|
|
3903
|
-
[
|
|
3904
|
-
t.groupWeek,
|
|
3905
|
-
s.filter((l) => !l.bookmarked && Pe(l._modified_at ?? l._created_at) === "week")
|
|
3906
|
-
],
|
|
3907
|
-
[
|
|
3908
|
-
t.groupOlder,
|
|
3909
|
-
s.filter((l) => !l.bookmarked && Pe(l._modified_at ?? l._created_at) === "older")
|
|
3910
|
-
]
|
|
4472
|
+
const t = this.msg, s = this.allowSearch ? this.search.trim().toLowerCase() : "", i = this.chatList.filter(
|
|
4473
|
+
(m) => !s || (m.title ?? "").toLowerCase().includes(s)
|
|
4474
|
+
), a = (m) => this.showBookmarked && !!m.bookmarked, r = (m) => i.filter((b) => !a(b) && Rs(b._modified_at ?? b._created_at) === m), l = [
|
|
4475
|
+
[t.groupBookmarked, i.filter(a)],
|
|
4476
|
+
[t.groupToday, r("today")],
|
|
4477
|
+
[t.groupYesterday, r("yesterday")],
|
|
4478
|
+
[t.groupWeek, r("week")],
|
|
4479
|
+
[t.groupOlder, r("older")]
|
|
3911
4480
|
];
|
|
3912
|
-
let
|
|
3913
|
-
return this.listState === "loading" && !this.chatList.length ?
|
|
3914
|
-
${[1, 2, 3, 4].map(() =>
|
|
3915
|
-
</div>` :
|
|
3916
|
-
([
|
|
3917
|
-
${
|
|
3918
|
-
) :
|
|
3919
|
-
>${
|
|
3920
|
-
>`,
|
|
4481
|
+
let c;
|
|
4482
|
+
return this.listState === "loading" && !this.chatList.length ? c = o`<div aria-label=${t.loadingChats}>
|
|
4483
|
+
${[1, 2, 3, 4].map(() => o`<div class="skeleton"></div>`)}
|
|
4484
|
+
</div>` : i.length ? c = l.filter(([, m]) => m.length).map(
|
|
4485
|
+
([m, b]) => o`<div class="group">${m}</div>
|
|
4486
|
+
${b.map((C) => this.renderThreadRow(C))}`
|
|
4487
|
+
) : c = o`<span class="side-note"
|
|
4488
|
+
>${s ? L(t.noMatch, { query: this.search.trim() }) : t.noChats}</span
|
|
4489
|
+
>`, o`<aside
|
|
3921
4490
|
class="sidebar ${e ? "overlay" : "docked"}"
|
|
3922
4491
|
part="sidebar"
|
|
3923
4492
|
aria-label=${t.chats}
|
|
@@ -3931,133 +4500,149 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
3931
4500
|
aria-label=${t.hideSidebar}
|
|
3932
4501
|
@click=${() => this.sidebarOpen = !1}
|
|
3933
4502
|
>
|
|
3934
|
-
${
|
|
4503
|
+
${k.sidebar()}
|
|
3935
4504
|
</button>
|
|
3936
4505
|
</div>
|
|
3937
4506
|
<div class="side-tools">
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
4507
|
+
${this.showNewChat ? o`<button type="button" class="new-chat" @click=${() => this.newChat()}>
|
|
4508
|
+
${k.plus()}<span>${t.newChat}</span>
|
|
4509
|
+
</button>` : f}
|
|
4510
|
+
${this.allowSearch ? o`<input
|
|
4511
|
+
class="search"
|
|
4512
|
+
type="search"
|
|
4513
|
+
placeholder=${t.searchChats}
|
|
4514
|
+
aria-label=${t.searchChats}
|
|
4515
|
+
.value=${this.search}
|
|
4516
|
+
@input=${(m) => this.search = m.target.value}
|
|
4517
|
+
/>` : f}
|
|
4518
|
+
</div>
|
|
4519
|
+
<div class="threads">${c}</div>
|
|
4520
|
+
<div class="side-extra ${this.hasSidebarContent ? "filled" : ""}" part="sidebar-extra">
|
|
4521
|
+
<slot
|
|
4522
|
+
name="sidebar"
|
|
4523
|
+
@slotchange=${(m) => this.hasSidebarContent = m.target.assignedNodes().length > 0}
|
|
4524
|
+
></slot>
|
|
3949
4525
|
</div>
|
|
3950
|
-
<div class="threads">${o}</div>
|
|
3951
4526
|
</aside>`;
|
|
3952
4527
|
}
|
|
3953
4528
|
renderThreadRow(e) {
|
|
3954
|
-
const t = this.msg,
|
|
4529
|
+
const t = this.msg, s = e._id === this.activeId, i = e.title || t.untitled;
|
|
3955
4530
|
if (this.renamingId === e._id)
|
|
3956
|
-
return
|
|
4531
|
+
return o`<div class="thread active">
|
|
3957
4532
|
<input
|
|
3958
4533
|
class="thread-rename"
|
|
3959
4534
|
maxlength="80"
|
|
3960
|
-
.value=${
|
|
4535
|
+
.value=${i}
|
|
3961
4536
|
aria-label=${t.renameChat}
|
|
3962
|
-
@keydown=${(
|
|
3963
|
-
|
|
4537
|
+
@keydown=${(r) => {
|
|
4538
|
+
r.key === "Enter" && this.commitRename(e._id, r.target.value), r.key === "Escape" && (r.stopPropagation(), this.renamingId = "");
|
|
3964
4539
|
}}
|
|
3965
|
-
@blur=${(
|
|
4540
|
+
@blur=${(r) => this.commitRename(e._id, r.target.value)}
|
|
3966
4541
|
/>
|
|
3967
4542
|
</div>`;
|
|
3968
|
-
const a = (
|
|
3969
|
-
l.stopPropagation(),
|
|
4543
|
+
const a = (r) => (l) => {
|
|
4544
|
+
l.stopPropagation(), r();
|
|
3970
4545
|
};
|
|
3971
|
-
return
|
|
3972
|
-
class="thread ${
|
|
4546
|
+
return o`<div
|
|
4547
|
+
class="thread ${s ? "active" : ""}"
|
|
3973
4548
|
role="button"
|
|
3974
4549
|
tabindex="0"
|
|
3975
|
-
aria-current=${
|
|
4550
|
+
aria-current=${s ? "true" : "false"}
|
|
3976
4551
|
@click=${() => this.openChat(e._id)}
|
|
3977
|
-
@keydown=${(
|
|
4552
|
+
@keydown=${(r) => r.key === "Enter" && this.openChat(e._id)}
|
|
3978
4553
|
>
|
|
3979
|
-
<span class="thread-title">${
|
|
4554
|
+
<span class="thread-title">${i}</span>
|
|
3980
4555
|
<span class="thread-actions">
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
4556
|
+
${this.allowBookmark ? o`<button
|
|
4557
|
+
type="button"
|
|
4558
|
+
class="icon sm ${e.bookmarked ? "on" : ""}"
|
|
4559
|
+
title=${e.bookmarked ? t.unbookmarkChat : t.bookmarkChat}
|
|
4560
|
+
aria-label=${e.bookmarked ? t.unbookmarkChat : t.bookmarkChat}
|
|
4561
|
+
@click=${a(() => this.toggleChatBookmark(e._id))}
|
|
4562
|
+
>
|
|
4563
|
+
${k.bookmark(!!e.bookmarked)}
|
|
4564
|
+
</button>` : f}
|
|
4565
|
+
${this.allowRename ? o`<button
|
|
4566
|
+
type="button"
|
|
4567
|
+
class="icon sm"
|
|
4568
|
+
title=${t.renameChat}
|
|
4569
|
+
aria-label=${t.renameChat}
|
|
4570
|
+
@click=${a(() => {
|
|
3996
4571
|
this.renamingId = e._id, this.focusNext = "input.thread-rename";
|
|
3997
4572
|
})}
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4573
|
+
>
|
|
4574
|
+
${k.pencil()}
|
|
4575
|
+
</button>` : f}
|
|
4576
|
+
${this.allowDelete ? o`<button
|
|
4577
|
+
type="button"
|
|
4578
|
+
class="icon sm danger"
|
|
4579
|
+
title=${t.deleteChat}
|
|
4580
|
+
aria-label=${t.deleteChat}
|
|
4581
|
+
@click=${a(() => this.deleteChat(e._id))}
|
|
4582
|
+
>
|
|
4583
|
+
${k.trash()}
|
|
4584
|
+
</button>` : f}
|
|
4010
4585
|
</span>
|
|
4011
4586
|
</div>`;
|
|
4012
4587
|
}
|
|
4013
4588
|
renderHeader() {
|
|
4014
|
-
const e = this.msg, t = !!this.activeId,
|
|
4015
|
-
let a =
|
|
4016
|
-
return this.showTitle && (a = this.editingTitle ?
|
|
4589
|
+
const e = this.msg, t = !!this.activeId, s = (this.embed === "inline" || this.embed === "launcher") && !this.mobile, i = this.embed === "launcher" ? () => this.close() : this.expanded ? () => this.collapse() : null;
|
|
4590
|
+
let a = f;
|
|
4591
|
+
return this.showTitle && (a = this.editingTitle ? o`<input
|
|
4017
4592
|
class="title-input"
|
|
4018
4593
|
maxlength="80"
|
|
4019
4594
|
.value=${this.chatTitle}
|
|
4020
4595
|
aria-label=${e.renameChat}
|
|
4021
|
-
@keydown=${(
|
|
4022
|
-
|
|
4596
|
+
@keydown=${(r) => {
|
|
4597
|
+
r.key === "Enter" && this.commitTitle(r.target.value), r.key === "Escape" && (r.stopPropagation(), this.editingTitle = !1);
|
|
4023
4598
|
}}
|
|
4024
|
-
@blur=${(
|
|
4025
|
-
/>` :
|
|
4599
|
+
@blur=${(r) => this.commitTitle(r.target.value)}
|
|
4600
|
+
/>` : o`<button
|
|
4026
4601
|
type="button"
|
|
4027
4602
|
class="title"
|
|
4028
4603
|
part="title"
|
|
4029
|
-
?disabled=${!t}
|
|
4030
|
-
title=${t ? e.renameChat : ""}
|
|
4604
|
+
?disabled=${!t || !this.allowRename}
|
|
4605
|
+
title=${t && this.allowRename ? e.renameChat : ""}
|
|
4031
4606
|
@click=${() => {
|
|
4032
4607
|
this.editingTitle = !0, this.focusNext = "input.title-input";
|
|
4033
4608
|
}}
|
|
4034
4609
|
>
|
|
4035
4610
|
${this.chatTitle || e.untitled}
|
|
4036
|
-
</button>`),
|
|
4611
|
+
</button>`), o`<header class="header" part="header">
|
|
4037
4612
|
<div class="header-left">
|
|
4038
|
-
${this.sidebarOpen && this.docked ?
|
|
4613
|
+
${this.sidebar === "none" || this.sidebarOpen && this.docked ? f : o`<button
|
|
4039
4614
|
type="button"
|
|
4040
4615
|
class="icon"
|
|
4041
4616
|
title=${e.showChats}
|
|
4042
4617
|
aria-label=${e.showChats}
|
|
4043
4618
|
@click=${() => this.sidebarOpen = !0}
|
|
4044
4619
|
>
|
|
4045
|
-
${
|
|
4620
|
+
${k.sidebar()}
|
|
4046
4621
|
</button>`}
|
|
4047
4622
|
${a}
|
|
4048
4623
|
</div>
|
|
4049
4624
|
<div class="header-right">
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
${this.
|
|
4625
|
+
${this.sidebar === "none" && this.showNewChat ? o`<button
|
|
4626
|
+
type="button"
|
|
4627
|
+
class="icon"
|
|
4628
|
+
?disabled=${!this.msgs.length && !t}
|
|
4629
|
+
title=${e.newChat}
|
|
4630
|
+
aria-label=${e.newChat}
|
|
4631
|
+
@click=${() => this.newChat()}
|
|
4632
|
+
>
|
|
4633
|
+
${k.plus()}
|
|
4634
|
+
</button>` : f}
|
|
4635
|
+
${this.allowBookmark ? o`<button
|
|
4636
|
+
type="button"
|
|
4637
|
+
class="icon ${this.bookmarked ? "on" : ""}"
|
|
4638
|
+
?disabled=${!t}
|
|
4639
|
+
title=${this.bookmarked ? e.unbookmarkChat : e.bookmarkChat}
|
|
4640
|
+
aria-label=${this.bookmarked ? e.unbookmarkChat : e.bookmarkChat}
|
|
4641
|
+
@click=${() => this.activeId && this.toggleChatBookmark(this.activeId)}
|
|
4642
|
+
>
|
|
4643
|
+
${k.bookmark(this.bookmarked)}
|
|
4644
|
+
</button>` : f}
|
|
4645
|
+
${this.allowExport ? o`<div class="menu-wrap">
|
|
4061
4646
|
<button
|
|
4062
4647
|
type="button"
|
|
4063
4648
|
class="icon ${this.menuOpen ? "on" : ""}"
|
|
@@ -4068,38 +4653,38 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
4068
4653
|
aria-expanded=${this.menuOpen ? "true" : "false"}
|
|
4069
4654
|
@click=${() => this.menuOpen = !this.menuOpen}
|
|
4070
4655
|
>
|
|
4071
|
-
${
|
|
4656
|
+
${k.download()}
|
|
4072
4657
|
</button>
|
|
4073
|
-
${this.menuOpen ? this.renderExportMenu() :
|
|
4074
|
-
</div>` :
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
${
|
|
4658
|
+
${this.menuOpen ? this.renderExportMenu() : f}
|
|
4659
|
+
</div>` : f}
|
|
4660
|
+
${this.allowDelete ? o`<button
|
|
4661
|
+
type="button"
|
|
4662
|
+
class="icon danger"
|
|
4663
|
+
?disabled=${!t}
|
|
4664
|
+
title=${e.deleteChat}
|
|
4665
|
+
aria-label=${e.deleteChat}
|
|
4666
|
+
@click=${() => this.activeId && this.deleteChat(this.activeId)}
|
|
4667
|
+
>
|
|
4668
|
+
${k.trash()}
|
|
4669
|
+
</button>` : f}
|
|
4670
|
+
${s || i ? o`<span class="divider"></span> ${s ? o`<button
|
|
4086
4671
|
type="button"
|
|
4087
4672
|
class="icon"
|
|
4088
4673
|
title=${this.expanded ? e.restore : e.expand}
|
|
4089
4674
|
aria-label=${this.expanded ? e.restore : e.expand}
|
|
4090
4675
|
@click=${() => this.expanded ? this.collapse() : this.expand()}
|
|
4091
4676
|
>
|
|
4092
|
-
${this.expanded ?
|
|
4093
|
-
</button>` :
|
|
4094
|
-
${
|
|
4677
|
+
${this.expanded ? k.restore() : k.expand()}
|
|
4678
|
+
</button>` : f}
|
|
4679
|
+
${i ? o`<button
|
|
4095
4680
|
type="button"
|
|
4096
4681
|
class="icon"
|
|
4097
4682
|
title=${e.minimize}
|
|
4098
4683
|
aria-label=${e.minimize}
|
|
4099
|
-
@click=${
|
|
4684
|
+
@click=${i}
|
|
4100
4685
|
>
|
|
4101
|
-
${
|
|
4102
|
-
</button>` :
|
|
4686
|
+
${k.minimize()}
|
|
4687
|
+
</button>` : f}` : f}
|
|
4103
4688
|
</div>
|
|
4104
4689
|
</header>`;
|
|
4105
4690
|
}
|
|
@@ -4110,80 +4695,85 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
4110
4695
|
[e.exportText, ".txt", "txt"],
|
|
4111
4696
|
[e.exportCopy, "", "copy"]
|
|
4112
4697
|
];
|
|
4113
|
-
return
|
|
4698
|
+
return o`<div class="menu-scrim" @click=${() => this.menuOpen = !1}></div>
|
|
4114
4699
|
<div class="menu" role="menu">
|
|
4115
4700
|
<span class="label">${e.exportHeading}</span>
|
|
4116
4701
|
${t.map(
|
|
4117
|
-
([
|
|
4702
|
+
([s, i, a]) => o`<button
|
|
4118
4703
|
type="button"
|
|
4119
4704
|
role="menuitem"
|
|
4120
4705
|
class="menu-item"
|
|
4121
4706
|
@click=${() => this.exportChat(a)}
|
|
4122
4707
|
>
|
|
4123
|
-
<span>${
|
|
4708
|
+
<span>${s}</span><span class="ext">${i}</span>
|
|
4124
4709
|
</button>`
|
|
4125
4710
|
)}
|
|
4126
4711
|
</div>`;
|
|
4127
4712
|
}
|
|
4713
|
+
/** The suggestion cards. `[]` or `"none"` shows none; unset uses the mode's. */
|
|
4128
4714
|
promptList() {
|
|
4129
4715
|
const e = this.prompts;
|
|
4130
|
-
return Array.isArray(e)
|
|
4716
|
+
return Array.isArray(e) ? e.map((t) => typeof t == "string" ? { text: t } : t).filter((t) => t == null ? void 0 : t.text).slice(0, 4) : typeof e == "string" && e.trim().toLowerCase() === "none" ? [] : typeof e == "string" && e.trim() ? e.split("|").map((t) => t.trim()).filter(Boolean).slice(0, 4).map((t) => ({ text: t })) : (Nt[this.mode] ?? Nt.chat).map(([t, s]) => ({
|
|
4131
4717
|
label: t,
|
|
4132
|
-
text:
|
|
4718
|
+
text: s
|
|
4133
4719
|
}));
|
|
4134
4720
|
}
|
|
4135
4721
|
renderWelcome() {
|
|
4136
|
-
const e = this.msg, t = this.mode === "rag" ? "Rag" :
|
|
4137
|
-
return
|
|
4138
|
-
<
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4722
|
+
const e = this.msg, t = this.mode === "rag" ? "Rag" : "Chat", s = (r) => e[`${r}${t}`], i = this.eyebrow ?? s("eyebrow"), a = this.promptList();
|
|
4723
|
+
return o`<div class="welcome-slot">
|
|
4724
|
+
<slot name="welcome"
|
|
4725
|
+
><div class="welcome" part="welcome">
|
|
4726
|
+
<div class="welcome-head">
|
|
4727
|
+
${this.logoUrl && It(this.logoUrl, !0) ? o`<img class="welcome-logo" src=${this.logoUrl} alt="" />` : f}
|
|
4728
|
+
${i ? o`<span class="label">${i}</span>` : f}
|
|
4729
|
+
<h2>${this.heading || s("heading")}</h2>
|
|
4730
|
+
<p>${this.description || s("description")}</p>
|
|
4731
|
+
</div>
|
|
4732
|
+
${a.length ? o`<div class="prompts">
|
|
4733
|
+
${a.map(
|
|
4734
|
+
(r) => o`<button
|
|
4735
|
+
type="button"
|
|
4736
|
+
class="prompt"
|
|
4737
|
+
part="prompt"
|
|
4738
|
+
@click=${() => this.send(r.text)}
|
|
4739
|
+
>
|
|
4740
|
+
<span class="label">${r.label || "Suggested"}</span>
|
|
4741
|
+
<span class="prompt-text">${r.text}</span>
|
|
4742
|
+
</button>`
|
|
4155
4743
|
)}
|
|
4156
|
-
|
|
4744
|
+
</div>` : f}
|
|
4745
|
+
</div></slot
|
|
4746
|
+
>
|
|
4157
4747
|
</div>`;
|
|
4158
4748
|
}
|
|
4159
4749
|
renderThread() {
|
|
4160
4750
|
const e = this.msgs.map((t) => t.role).lastIndexOf("assistant");
|
|
4161
|
-
return
|
|
4162
|
-
${this.threadError ?
|
|
4751
|
+
return o`<div class="thread-view">
|
|
4752
|
+
${this.threadError ? o`<div class="error-card" role="alert">
|
|
4163
4753
|
<span>${this.threadError}</span>
|
|
4164
|
-
${this.activeId ?
|
|
4754
|
+
${this.activeId ? o`<button
|
|
4165
4755
|
type="button"
|
|
4166
4756
|
class="btn"
|
|
4167
4757
|
@click=${() => this.openChat(this.activeId)}
|
|
4168
4758
|
>
|
|
4169
4759
|
${this.msg.retry}
|
|
4170
|
-
</button>` :
|
|
4171
|
-
</div>` :
|
|
4172
|
-
${this.loadingThread ?
|
|
4173
|
-
${
|
|
4760
|
+
</button>` : f}
|
|
4761
|
+
</div>` : f}
|
|
4762
|
+
${this.loadingThread ? o`${[1, 2].map(() => o`<div class="skeleton" style="height:48px"></div>`)}` : f}
|
|
4763
|
+
${Jt(
|
|
4174
4764
|
this.msgs,
|
|
4175
4765
|
(t) => t.key,
|
|
4176
|
-
(t,
|
|
4766
|
+
(t, s) => t.role === "user" ? this.renderUser(t) : this.renderBot(t, s === e)
|
|
4177
4767
|
)}
|
|
4178
4768
|
</div>`;
|
|
4179
4769
|
}
|
|
4180
4770
|
renderUser(e) {
|
|
4181
|
-
const t = this.msg,
|
|
4182
|
-
return
|
|
4183
|
-
${
|
|
4184
|
-
${
|
|
4185
|
-
</div>` :
|
|
4186
|
-
${this.editingKey === e.key ?
|
|
4771
|
+
const t = this.msg, s = e.at ? new Date(e.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "", i = e.attachments ?? [];
|
|
4772
|
+
return o`<div class="msg user" part="message user">
|
|
4773
|
+
${i.length ? o`<div class="attachments">
|
|
4774
|
+
${i.map((a) => o`<span class="doc-chip"><span class="ext">${Rt(a.name)}</span><span class="name">${a.name}</span></span>`)}
|
|
4775
|
+
</div>` : f}
|
|
4776
|
+
${this.editingKey === e.key ? o`<div class="edit-box">
|
|
4187
4777
|
<textarea
|
|
4188
4778
|
rows="3"
|
|
4189
4779
|
class="edit-input"
|
|
@@ -4201,11 +4791,11 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
4201
4791
|
${t.saveResend}
|
|
4202
4792
|
</button>
|
|
4203
4793
|
</div>
|
|
4204
|
-
</div>` :
|
|
4794
|
+
</div>` : o`<div class="bubble-user">${e.content}</div>
|
|
4205
4795
|
<div class="toolbar">
|
|
4206
|
-
${e.bookmarked ?
|
|
4207
|
-
|
|
4208
|
-
${this.busy ?
|
|
4796
|
+
${this.allowBookmark && e.bookmarked ? o`<span class="saved">${k.bookmark(!0)}${t.saved}</span>` : f}
|
|
4797
|
+
${this.showTime ? o`<span class="time">${s}</span>` : f}
|
|
4798
|
+
${this.busy ? f : o`<button
|
|
4209
4799
|
type="button"
|
|
4210
4800
|
class="icon"
|
|
4211
4801
|
title=${t.edit}
|
|
@@ -4214,322 +4804,471 @@ assistant: ${i.slice(0, 1500)}`,
|
|
|
4214
4804
|
this.editingKey = e.key, this.editDraft = e.content, this.focusNext = "textarea.edit-input";
|
|
4215
4805
|
}}
|
|
4216
4806
|
>
|
|
4217
|
-
${
|
|
4807
|
+
${k.pencil()}
|
|
4218
4808
|
</button>`}
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
${e.id ?
|
|
4809
|
+
${this.allowCopy ? o`<button
|
|
4810
|
+
type="button"
|
|
4811
|
+
class="icon"
|
|
4812
|
+
title=${this.copiedKey === e.key ? t.copied : t.copy}
|
|
4813
|
+
aria-label=${t.copy}
|
|
4814
|
+
@click=${() => this.copy(e.key, e.content)}
|
|
4815
|
+
>
|
|
4816
|
+
${k.copy()}
|
|
4817
|
+
</button>` : f}
|
|
4818
|
+
${this.allowBookmark && e.id ? o`<button
|
|
4229
4819
|
type="button"
|
|
4230
4820
|
class="icon ${e.bookmarked ? "on" : ""}"
|
|
4231
4821
|
title=${e.bookmarked ? t.unbookmarkMessage : t.bookmarkMessage}
|
|
4232
4822
|
aria-label=${e.bookmarked ? t.unbookmarkMessage : t.bookmarkMessage}
|
|
4233
4823
|
@click=${() => this.toggleMessageBookmark(e)}
|
|
4234
4824
|
>
|
|
4235
|
-
${
|
|
4236
|
-
</button>` :
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4825
|
+
${k.bookmark(e.bookmarked)}
|
|
4826
|
+
</button>` : f}
|
|
4827
|
+
${this.allowDelete ? o`<button
|
|
4828
|
+
type="button"
|
|
4829
|
+
class="icon danger"
|
|
4830
|
+
title=${t.deleteMessage}
|
|
4831
|
+
aria-label=${t.deleteMessage}
|
|
4832
|
+
@click=${() => this.deleteMessage(e)}
|
|
4833
|
+
>
|
|
4834
|
+
${k.trash()}
|
|
4835
|
+
</button>` : f}
|
|
4246
4836
|
</div>`}
|
|
4247
4837
|
</div>`;
|
|
4248
4838
|
}
|
|
4249
4839
|
pillLabel() {
|
|
4250
|
-
return this.mode === "rag" ? this.msg.searching : this.
|
|
4840
|
+
return this.mode === "rag" ? this.msg.searching : this.msg.thinking;
|
|
4251
4841
|
}
|
|
4252
4842
|
renderBot(e, t) {
|
|
4253
|
-
const
|
|
4843
|
+
const s = this.msg, i = e.phase === "pending", a = e.phase === "done", r = e.sources.length, l = Tt(e.content), c = e.sources.map((w, _) => gt(w, _ + 1)), m = l.size ? c.filter((w) => l.has(w.n)) : c, b = e.at ? new Date(e.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "", C = e.content + (m.length ? `
|
|
4254
4844
|
|
|
4255
4845
|
Sources:
|
|
4256
|
-
${
|
|
4846
|
+
${m.map((w) => `[${w.n}] ${w.title}`).join(`
|
|
4257
4847
|
`)}` : ""), S = this.retrievalOpen.has(e.key);
|
|
4258
|
-
return
|
|
4259
|
-
${
|
|
4260
|
-
${this.arrivedKey === e.key ?
|
|
4848
|
+
return o`<div class="msg bot" part="message assistant">
|
|
4849
|
+
${i ? o`<div class="halo"></div>` : f}
|
|
4850
|
+
${this.arrivedKey === e.key ? o`<div class="arrived">
|
|
4261
4851
|
<div class="wash"></div>
|
|
4262
4852
|
<div class="ring"></div>
|
|
4263
4853
|
<div class="sweep"></div>
|
|
4264
|
-
</div>` :
|
|
4854
|
+
</div>` : f}
|
|
4265
4855
|
<div class="bot-body">
|
|
4266
|
-
${e.bookmarked ?
|
|
4267
|
-
${
|
|
4856
|
+
${this.allowBookmark && e.bookmarked ? o`<span class="saved">${k.bookmark(!0)}${s.saved}</span>` : f}
|
|
4857
|
+
${i ? o`<div class="pill" role="status">
|
|
4268
4858
|
<span class="ring"></span><span class="dot"></span>
|
|
4269
4859
|
<span class="shimmer">${this.pillLabel()}</span>
|
|
4270
|
-
</div>` :
|
|
4271
|
-
${
|
|
4860
|
+
</div>` : f}
|
|
4861
|
+
${this.showSources && r && !i ? o`<div class="retrieval">
|
|
4272
4862
|
<button
|
|
4273
4863
|
type="button"
|
|
4274
4864
|
class="retrieval-toggle"
|
|
4275
4865
|
aria-expanded=${S ? "true" : "false"}
|
|
4276
4866
|
@click=${() => {
|
|
4277
|
-
const
|
|
4278
|
-
|
|
4867
|
+
const w = new Set(this.retrievalOpen);
|
|
4868
|
+
w.has(e.key) ? w.delete(e.key) : w.add(e.key), this.retrievalOpen = w;
|
|
4279
4869
|
}}
|
|
4280
4870
|
>
|
|
4281
4871
|
<span class="chev">${S ? "▾" : "▸"}</span>
|
|
4282
|
-
<span style="flex:1">${
|
|
4283
|
-
${e.execTime !== void 0 ?
|
|
4872
|
+
<span style="flex:1">${L(s.searchedSources, { n: r })}</span>
|
|
4873
|
+
${e.execTime !== void 0 ? o`<span class="ms">${e.execTime.toFixed(1)}s</span>` : f}
|
|
4284
4874
|
</button>
|
|
4285
|
-
${S ?
|
|
4875
|
+
${S ? o`<div class="retrieval-list">
|
|
4286
4876
|
${c.map(
|
|
4287
|
-
(
|
|
4877
|
+
(w) => o`<button
|
|
4288
4878
|
type="button"
|
|
4289
4879
|
class="passage"
|
|
4290
|
-
@click=${() => this.panel = { key: e.key, n:
|
|
4880
|
+
@click=${() => this.panel = { key: e.key, n: w.n }}
|
|
4291
4881
|
>
|
|
4292
|
-
<span class="n">${
|
|
4882
|
+
<span class="n">${w.n}</span>
|
|
4293
4883
|
<span class="what"
|
|
4294
|
-
><span>${
|
|
4884
|
+
><span>${w.title}</span><span>${w.collection || w.path}</span></span
|
|
4295
4885
|
>
|
|
4296
|
-
${
|
|
4297
|
-
><span class="score">${
|
|
4886
|
+
${w.score !== null ? o`<span class="relevance"
|
|
4887
|
+
><span class="score">${w.score.toFixed(2)}</span>
|
|
4298
4888
|
<span class="relevance-track"
|
|
4299
4889
|
><span
|
|
4300
4890
|
class="relevance-fill"
|
|
4301
|
-
style="width:${Math.round(
|
|
4891
|
+
style="width:${Math.round(w.score * 100)}%"
|
|
4302
4892
|
></span></span
|
|
4303
|
-
></span>` :
|
|
4893
|
+
></span>` : o`<span></span>`}
|
|
4304
4894
|
</button>`
|
|
4305
4895
|
)}
|
|
4306
|
-
</div>` :
|
|
4307
|
-
</div>` :
|
|
4308
|
-
${
|
|
4309
|
-
${e.phase === "streaming" ?
|
|
4310
|
-
${e.phase === "error" ?
|
|
4896
|
+
</div>` : f}
|
|
4897
|
+
</div>` : f}
|
|
4898
|
+
${i ? f : this.renderAnswer(e)}
|
|
4899
|
+
${e.phase === "streaming" ? o`<span class="caret"></span>` : f}
|
|
4900
|
+
${e.phase === "error" ? o`<div class="error-card" role="alert">
|
|
4311
4901
|
<span>${e.error}</span>
|
|
4312
4902
|
<button type="button" class="btn" @click=${() => this.retry(e)}>
|
|
4313
|
-
${
|
|
4903
|
+
${s.retry}
|
|
4314
4904
|
</button>
|
|
4315
|
-
</div>` :
|
|
4316
|
-
${a &&
|
|
4317
|
-
<span class="label">${l.size ?
|
|
4905
|
+
</div>` : f}
|
|
4906
|
+
${this.showSources && a && m.length ? o`<div class="cards">
|
|
4907
|
+
<span class="label">${l.size ? s.sourcesCited : s.sourcesRetrieved}</span>
|
|
4318
4908
|
<div class="card-grid">
|
|
4319
|
-
${
|
|
4320
|
-
(
|
|
4321
|
-
var
|
|
4322
|
-
return
|
|
4909
|
+
${m.map(
|
|
4910
|
+
(w) => {
|
|
4911
|
+
var _;
|
|
4912
|
+
return o`<button
|
|
4323
4913
|
type="button"
|
|
4324
|
-
class="source-card ${((
|
|
4325
|
-
@click=${() => this.panel = { key: e.key, n:
|
|
4914
|
+
class="source-card ${((_ = this.panel) == null ? void 0 : _.key) === e.key && this.panel.n === w.n ? "active" : ""}"
|
|
4915
|
+
@click=${() => this.panel = { key: e.key, n: w.n }}
|
|
4326
4916
|
>
|
|
4327
4917
|
<span class="top"
|
|
4328
|
-
><span class="num">${
|
|
4329
|
-
>${
|
|
4918
|
+
><span class="num">${w.n}</span
|
|
4919
|
+
>${w.collection ? o`<span class="label">${w.collection}</span>` : f}</span
|
|
4330
4920
|
>
|
|
4331
|
-
<span class="t">${
|
|
4332
|
-
<span class="s">${
|
|
4921
|
+
<span class="t">${w.title}</span>
|
|
4922
|
+
<span class="s">${w.text}</span>
|
|
4333
4923
|
</button>`;
|
|
4334
4924
|
}
|
|
4335
4925
|
)}
|
|
4336
4926
|
</div>
|
|
4337
|
-
</div>` :
|
|
4338
|
-
${a ?
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
${
|
|
4927
|
+
</div>` : f}
|
|
4928
|
+
${a ? o`<div class="toolbar ${t ? "pinned" : ""}">
|
|
4929
|
+
${this.allowCopy ? o`<button
|
|
4930
|
+
type="button"
|
|
4931
|
+
class="icon"
|
|
4932
|
+
title=${this.copiedKey === e.key ? s.copied : s.copy}
|
|
4933
|
+
aria-label=${s.copy}
|
|
4934
|
+
@click=${() => this.copy(e.key, C)}
|
|
4935
|
+
>
|
|
4936
|
+
${k.copy()}
|
|
4937
|
+
</button>` : f}
|
|
4938
|
+
${this.allowRaw && this.formatLevel !== "raw" && e.content ? o`<button
|
|
4939
|
+
type="button"
|
|
4940
|
+
class="icon ${this.rawKeys.has(e.key) ? "on" : ""}"
|
|
4941
|
+
title=${this.rawKeys.has(e.key) ? s.showFormatted : s.showRaw}
|
|
4942
|
+
aria-label=${s.showRaw}
|
|
4943
|
+
aria-pressed=${this.rawKeys.has(e.key) ? "true" : "false"}
|
|
4944
|
+
@click=${() => this.toggleRaw(e.key)}
|
|
4945
|
+
>
|
|
4946
|
+
${k.raw()}
|
|
4947
|
+
</button>` : f}
|
|
4948
|
+
${this.allowRegenerate && t && !this.busy ? o`<button
|
|
4349
4949
|
type="button"
|
|
4350
4950
|
class="icon"
|
|
4351
|
-
title=${
|
|
4352
|
-
aria-label=${
|
|
4951
|
+
title=${s.regenerate}
|
|
4952
|
+
aria-label=${s.regenerate}
|
|
4353
4953
|
@click=${() => this.regenerate()}
|
|
4354
4954
|
>
|
|
4355
|
-
${
|
|
4356
|
-
</button>` :
|
|
4357
|
-
${e.id ?
|
|
4955
|
+
${k.refresh()}
|
|
4956
|
+
</button>` : f}
|
|
4957
|
+
${this.allowBookmark && e.id ? o`<button
|
|
4358
4958
|
type="button"
|
|
4359
4959
|
class="icon ${e.bookmarked ? "on" : ""}"
|
|
4360
|
-
title=${e.bookmarked ?
|
|
4361
|
-
aria-label=${e.bookmarked ?
|
|
4960
|
+
title=${e.bookmarked ? s.unbookmarkMessage : s.bookmarkMessage}
|
|
4961
|
+
aria-label=${e.bookmarked ? s.unbookmarkMessage : s.bookmarkMessage}
|
|
4362
4962
|
@click=${() => this.toggleMessageBookmark(e)}
|
|
4363
4963
|
>
|
|
4364
|
-
${
|
|
4365
|
-
</button>` :
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
${e.stopped ?
|
|
4964
|
+
${k.bookmark(e.bookmarked)}
|
|
4965
|
+
</button>` : f}
|
|
4966
|
+
${this.allowDelete ? o`<button
|
|
4967
|
+
type="button"
|
|
4968
|
+
class="icon danger"
|
|
4969
|
+
title=${s.deleteMessage}
|
|
4970
|
+
aria-label=${s.deleteMessage}
|
|
4971
|
+
@click=${() => this.deleteMessage(e)}
|
|
4972
|
+
>
|
|
4973
|
+
${k.trash()}
|
|
4974
|
+
</button>` : f}
|
|
4975
|
+
${this.showTime ? o`<span class="time">${b}</span>` : f}
|
|
4976
|
+
${e.stopped ? o`<span class="note">${s.stopped}</span>` : f}
|
|
4377
4977
|
<span class="spacer"></span>
|
|
4378
|
-
${e.feedback ?
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
</div>` :
|
|
4399
|
-
${a && t && !this.busy && e.followups.length ?
|
|
4978
|
+
${this.allowFeedback ? e.feedback ? o`<span class="note"
|
|
4979
|
+
>${e.feedback === "up" ? s.markedHelpful : s.thanksFeedback}</span
|
|
4980
|
+
>` : o`<button
|
|
4981
|
+
type="button"
|
|
4982
|
+
class="icon"
|
|
4983
|
+
title=${s.helpful}
|
|
4984
|
+
aria-label=${s.helpful}
|
|
4985
|
+
@click=${() => this.feedback(e, "up")}
|
|
4986
|
+
>
|
|
4987
|
+
${k.thumb()}
|
|
4988
|
+
</button>
|
|
4989
|
+
<button
|
|
4990
|
+
type="button"
|
|
4991
|
+
class="icon"
|
|
4992
|
+
title=${s.notHelpful}
|
|
4993
|
+
aria-label=${s.notHelpful}
|
|
4994
|
+
@click=${() => this.feedback(e, "down")}
|
|
4995
|
+
>
|
|
4996
|
+
${k.thumb(!0)}
|
|
4997
|
+
</button>` : f}
|
|
4998
|
+
</div>` : f}
|
|
4999
|
+
${this.showFollowups && a && t && !this.busy && e.followups.length ? o`<div class="followups">
|
|
4400
5000
|
${e.followups.map(
|
|
4401
|
-
(
|
|
4402
|
-
<span class="arrow">↳</span><span>${
|
|
5001
|
+
(w) => o`<button type="button" class="followup" @click=${() => this.send(w)}>
|
|
5002
|
+
<span class="arrow">↳</span><span>${w}</span>
|
|
4403
5003
|
</button>`
|
|
4404
5004
|
)}
|
|
4405
|
-
</div>` :
|
|
5005
|
+
</div>` : f}
|
|
4406
5006
|
</div>
|
|
4407
5007
|
</div>`;
|
|
4408
5008
|
}
|
|
4409
5009
|
renderAnswer(e) {
|
|
4410
|
-
if (e.phase === "error" && !e.content) return
|
|
5010
|
+
if (e.phase === "error" && !e.content) return f;
|
|
4411
5011
|
if (e.phase === "done" && !e.content)
|
|
4412
|
-
return e.stopped ?
|
|
4413
|
-
const t =
|
|
4414
|
-
|
|
4415
|
-
|
|
5012
|
+
return e.stopped ? f : o`<div class="answer"><p class="note">${this.msg.emptyReply}</p></div>`;
|
|
5013
|
+
const t = this.formatLevel;
|
|
5014
|
+
if (t === "raw" || this.allowRaw && this.rawKeys.has(e.key))
|
|
5015
|
+
return o`<div class="answer" part="answer"><p class="raw">${e.content}</p></div>`;
|
|
5016
|
+
const s = e.phase === "streaming" ? ls(e.content) : e.content;
|
|
5017
|
+
let i = ps(is(s), t);
|
|
5018
|
+
if (this.afterParse)
|
|
5019
|
+
try {
|
|
5020
|
+
const r = this.afterParse(i, { message: e, format: t });
|
|
5021
|
+
Array.isArray(r) ? i = r : console.warn(
|
|
5022
|
+
"[singlebase-chat] afterParse must return an array of blocks; showing the original."
|
|
5023
|
+
);
|
|
5024
|
+
} catch (r) {
|
|
5025
|
+
console.warn("[singlebase-chat] afterParse failed; showing the original.", r);
|
|
5026
|
+
}
|
|
5027
|
+
const a = e.sources.length;
|
|
5028
|
+
return o`<div class="answer" part="answer">
|
|
5029
|
+
${i.map((r, l) => this.renderBlock(r, e, a, l))}
|
|
4416
5030
|
</div>`;
|
|
4417
5031
|
}
|
|
4418
|
-
renderInline(e, t,
|
|
4419
|
-
return
|
|
5032
|
+
renderInline(e, t, s) {
|
|
5033
|
+
return ns(e, s).map((i) => {
|
|
4420
5034
|
var a;
|
|
4421
|
-
switch (
|
|
5035
|
+
switch (i.type) {
|
|
4422
5036
|
case "bold":
|
|
4423
|
-
return
|
|
5037
|
+
return o`<strong>${i.text}</strong>`;
|
|
5038
|
+
case "italic":
|
|
5039
|
+
return o`<em>${i.text}</em>`;
|
|
5040
|
+
case "strike":
|
|
5041
|
+
return o`<s>${i.text}</s>`;
|
|
4424
5042
|
case "code":
|
|
4425
|
-
return
|
|
5043
|
+
return o`<code class="inline">${i.text}</code>`;
|
|
4426
5044
|
case "link":
|
|
4427
|
-
return
|
|
4428
|
-
>${
|
|
5045
|
+
return o`<a href=${i.href} target="_blank" rel="noopener noreferrer nofollow"
|
|
5046
|
+
>${i.text}</a
|
|
4429
5047
|
>`;
|
|
4430
5048
|
case "cite": {
|
|
4431
|
-
const
|
|
4432
|
-
return
|
|
5049
|
+
const r = ((a = this.panel) == null ? void 0 : a.key) === t.key && this.panel.n === i.n ? "cite active" : "cite", l = L(this.msg.openSource, { n: i.n });
|
|
5050
|
+
return o`<button type="button" class=${r} aria-label=${l} @click=${() => this.panel = { key: t.key, n: i.n }}>${i.n}</button>`;
|
|
4433
5051
|
}
|
|
4434
5052
|
default:
|
|
4435
|
-
return
|
|
5053
|
+
return i.text;
|
|
4436
5054
|
}
|
|
4437
5055
|
});
|
|
4438
5056
|
}
|
|
4439
|
-
renderBlock(e, t,
|
|
5057
|
+
renderBlock(e, t, s, i) {
|
|
4440
5058
|
switch (e.type) {
|
|
4441
5059
|
case "p":
|
|
4442
|
-
return
|
|
5060
|
+
return o`<p>${this.renderInline(e.text, t, s)}</p>`;
|
|
4443
5061
|
case "raw":
|
|
4444
|
-
return
|
|
5062
|
+
return o`<p class="raw">${e.text}</p>`;
|
|
4445
5063
|
case "h":
|
|
4446
|
-
return
|
|
4447
|
-
case "
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
);
|
|
4451
|
-
return e.ordered ? r`<ol>
|
|
4452
|
-
${a}
|
|
4453
|
-
</ol>` : r`<ul>
|
|
4454
|
-
${a}
|
|
4455
|
-
</ul>`;
|
|
4456
|
-
}
|
|
5064
|
+
return o`<h3 class="h${e.level}">${this.renderInline(e.text, t, s)}</h3>`;
|
|
5065
|
+
case "hr":
|
|
5066
|
+
return o`<hr />`;
|
|
5067
|
+
case "list":
|
|
5068
|
+
return this.renderList(e.ordered, e.items, t, s);
|
|
4457
5069
|
case "quote":
|
|
4458
|
-
return
|
|
4459
|
-
case "
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
</button>
|
|
4467
|
-
</div>
|
|
4468
|
-
<pre><code>${e.text}</code></pre>
|
|
5070
|
+
return o`<div class="quote">${this.renderInline(e.text, t, s)}</div>`;
|
|
5071
|
+
case "callout":
|
|
5072
|
+
return o`<div class="callout ${e.kind}" role="note" part="callout">
|
|
5073
|
+
<strong class="callout-title"
|
|
5074
|
+
>${e.title || this.msg[Is[e.kind]]}</strong
|
|
5075
|
+
>
|
|
5076
|
+
${e.text.split(`
|
|
5077
|
+
`).filter((a) => a.trim()).map((a) => o`<p>${this.renderInline(a, t, s)}</p>`)}
|
|
4469
5078
|
</div>`;
|
|
4470
|
-
|
|
5079
|
+
case "code":
|
|
5080
|
+
return this.renderCustom(e.lang, e.text, t) ?? this.renderCode(e.lang, e.text, `${t.key}:${i}`);
|
|
4471
5081
|
case "table":
|
|
4472
|
-
return
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
)}
|
|
4485
|
-
|
|
4486
|
-
|
|
5082
|
+
return this.renderTable(
|
|
5083
|
+
e.head,
|
|
5084
|
+
e.rows,
|
|
5085
|
+
e.align,
|
|
5086
|
+
t,
|
|
5087
|
+
s,
|
|
5088
|
+
`${t.key}:${i}`
|
|
5089
|
+
);
|
|
5090
|
+
case "json":
|
|
5091
|
+
return this.renderJsonBlock(e.value, e.source, `${t.key}:${i}`);
|
|
5092
|
+
case "svg": {
|
|
5093
|
+
const a = bs(e.source);
|
|
5094
|
+
if (!a) return this.renderCode("svg", e.source, `${t.key}:${i}`);
|
|
5095
|
+
const r = `${t.key}:${i}`;
|
|
5096
|
+
return o`<figure class="svg" part="svg">
|
|
5097
|
+
<img src=${a} alt="Drawing" />
|
|
5098
|
+
<figcaption>
|
|
5099
|
+
<button type="button" class="text-btn" @click=${() => this.copy(r, e.source)}>
|
|
5100
|
+
${this.copiedKey === r ? this.msg.copied : this.msg.copySvg}
|
|
5101
|
+
</button>
|
|
5102
|
+
</figcaption>
|
|
5103
|
+
</figure>`;
|
|
5104
|
+
}
|
|
5105
|
+
case "pending":
|
|
5106
|
+
return o`<div class="chart-pending">
|
|
5107
|
+
<span class="label"
|
|
5108
|
+
>${e.kind === "svg" ? this.msg.renderingSvg : this.msg.renderingChart}</span
|
|
5109
|
+
>
|
|
4487
5110
|
</div>`;
|
|
4488
5111
|
case "chart":
|
|
4489
5112
|
return this.renderChart(e.spec);
|
|
4490
|
-
case "chartPending":
|
|
4491
|
-
return r`<div class="chart-pending"><span class="label">Rendering chart</span></div>`;
|
|
4492
5113
|
case "img":
|
|
4493
|
-
return
|
|
5114
|
+
return o`<div class="gallery ${e.images.length > 1 ? "many" : ""}">
|
|
4494
5115
|
${e.images.map(
|
|
4495
|
-
(a) =>
|
|
4496
|
-
${a.src &&
|
|
5116
|
+
(a) => o`<figure>
|
|
5117
|
+
${a.src && It(a.src, !0) ? o`<img
|
|
4497
5118
|
src=${a.src}
|
|
4498
5119
|
alt=${a.alt}
|
|
4499
5120
|
loading="lazy"
|
|
4500
5121
|
referrerpolicy="no-referrer"
|
|
4501
|
-
/>` :
|
|
4502
|
-
${a.alt ?
|
|
5122
|
+
/>` : o`<div class="img-missing"><span class="label">Image</span></div>`}
|
|
5123
|
+
${a.alt ? o`<figcaption>${a.alt}</figcaption>` : f}
|
|
4503
5124
|
</figure>`
|
|
4504
5125
|
)}
|
|
4505
5126
|
</div>`;
|
|
4506
5127
|
default:
|
|
4507
|
-
return
|
|
5128
|
+
return f;
|
|
4508
5129
|
}
|
|
4509
5130
|
}
|
|
5131
|
+
renderList(e, t, s, i) {
|
|
5132
|
+
const a = t.map(
|
|
5133
|
+
(r) => o`<li
|
|
5134
|
+
class=${r.checked === null ? "" : "task"}
|
|
5135
|
+
style=${r.depth ? `margin-left:${r.depth * 20}px` : ""}
|
|
5136
|
+
>
|
|
5137
|
+
${r.checked === null ? f : o`<input type="checkbox" disabled .checked=${r.checked} aria-hidden="true" />`}
|
|
5138
|
+
${this.renderInline(r.text, s, i)}
|
|
5139
|
+
</li>`
|
|
5140
|
+
);
|
|
5141
|
+
return e ? o`<ol>
|
|
5142
|
+
${a}
|
|
5143
|
+
</ol>` : o`<ul>
|
|
5144
|
+
${a}
|
|
5145
|
+
</ul>`;
|
|
5146
|
+
}
|
|
5147
|
+
renderCode(e, t, s) {
|
|
5148
|
+
return o`<div class="code">
|
|
5149
|
+
<div class="code-head">
|
|
5150
|
+
<span class="label">${e}</span>
|
|
5151
|
+
<button type="button" class="text-btn" @click=${() => this.copy(s, t)}>
|
|
5152
|
+
${this.copiedKey === s ? this.msg.copied : this.msg.copy}
|
|
5153
|
+
</button>
|
|
5154
|
+
</div>
|
|
5155
|
+
<pre><code>${t}</code></pre>
|
|
5156
|
+
</div>`;
|
|
5157
|
+
}
|
|
5158
|
+
/** A host renderer for this language, at the rich level only. */
|
|
5159
|
+
renderCustom(e, t, s) {
|
|
5160
|
+
var a;
|
|
5161
|
+
const i = this.formatLevel === "rich" ? (a = this.renderers) == null ? void 0 : a[e] : void 0;
|
|
5162
|
+
if (typeof i != "function" || s.phase === "streaming") return null;
|
|
5163
|
+
try {
|
|
5164
|
+
const r = i(t, { lang: e, message: s });
|
|
5165
|
+
return r == null ? null : o`<div class="custom-block">${r}</div>`;
|
|
5166
|
+
} catch (r) {
|
|
5167
|
+
return console.warn(`[singlebase-chat] the "${e}" renderer failed; showing the source`, r), null;
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
renderTable(e, t, s, i, a, r) {
|
|
5171
|
+
const l = (x) => /^[-+]?[$€£¥]?\s?[\d,.]+\s?%?$/.test(x.trim()) && /\d/.test(x), c = (x) => Number(x.replace(/[^\d.+-]/g, "")), m = e.map((x, T) => {
|
|
5172
|
+
if (s[T]) return s[T];
|
|
5173
|
+
const $ = t.map((j) => j[T] ?? "").filter(Boolean);
|
|
5174
|
+
return $.length && $.filter(l).length / $.length >= 0.8 ? "right" : null;
|
|
5175
|
+
}), b = this.sorts.get(r);
|
|
5176
|
+
let C = t;
|
|
5177
|
+
b && (C = [...t].sort((x, T) => {
|
|
5178
|
+
const $ = x[b.col] ?? "", j = T[b.col] ?? "";
|
|
5179
|
+
return (l($) && l(j) ? c($) - c(j) : $.localeCompare(j, void 0, { numeric: !0 })) * b.dir;
|
|
5180
|
+
}));
|
|
5181
|
+
const S = C.length;
|
|
5182
|
+
C = C.slice(0, Os);
|
|
5183
|
+
const w = (x) => {
|
|
5184
|
+
const T = new Map(this.sorts), $ = T.get(r);
|
|
5185
|
+
($ == null ? void 0 : $.col) === x && $.dir === -1 ? T.delete(r) : T.set(r, { col: x, dir: ($ == null ? void 0 : $.col) === x ? -1 : 1 }), this.sorts = T;
|
|
5186
|
+
}, _ = (x) => m[x] ? `text-align:${m[x]}` : "";
|
|
5187
|
+
return o`<div class="table" part="table">
|
|
5188
|
+
<table>
|
|
5189
|
+
<thead>
|
|
5190
|
+
<tr>
|
|
5191
|
+
${e.map((x, T) => {
|
|
5192
|
+
const $ = (b == null ? void 0 : b.col) === T ? b.dir === 1 ? "ascending" : "descending" : "none";
|
|
5193
|
+
return o`<th style=${_(T)} aria-sort=${$}>
|
|
5194
|
+
${t.length > 1 ? o`<button type="button" class="sort" @click=${() => w(T)}>
|
|
5195
|
+
${this.renderInline(x, i, a)}<span class="arrow"
|
|
5196
|
+
>${$ === "ascending" ? "↑" : $ === "descending" ? "↓" : "↕"}</span
|
|
5197
|
+
>
|
|
5198
|
+
</button>` : this.renderInline(x, i, a)}
|
|
5199
|
+
</th>`;
|
|
5200
|
+
})}
|
|
5201
|
+
</tr>
|
|
5202
|
+
</thead>
|
|
5203
|
+
<tbody>
|
|
5204
|
+
${C.map(
|
|
5205
|
+
(x) => o`<tr>
|
|
5206
|
+
${e.map(
|
|
5207
|
+
(T, $) => o`<td style=${_($)}>
|
|
5208
|
+
${this.renderInline(x[$] ?? "", i, a)}
|
|
5209
|
+
</td>`
|
|
5210
|
+
)}
|
|
5211
|
+
</tr>`
|
|
5212
|
+
)}
|
|
5213
|
+
</tbody>
|
|
5214
|
+
</table>
|
|
5215
|
+
${S > C.length ? o`<div class="table-note">
|
|
5216
|
+
${L(this.msg.showingRows, { n: C.length, total: S })}
|
|
5217
|
+
</div>` : f}
|
|
5218
|
+
</div>`;
|
|
5219
|
+
}
|
|
5220
|
+
renderJsonBlock(e, t, s) {
|
|
5221
|
+
let i = 0;
|
|
5222
|
+
const a = (l) => {
|
|
5223
|
+
i++, i <= Lt && l && typeof l == "object" && Object.values(l).forEach(a);
|
|
5224
|
+
};
|
|
5225
|
+
if (a(e), i > Lt) return this.renderCode("json", t, s);
|
|
5226
|
+
const r = (l, c, m) => {
|
|
5227
|
+
const b = m === void 0 ? f : o`<span class="jkey">${m}</span>: `;
|
|
5228
|
+
if (l && typeof l == "object") {
|
|
5229
|
+
const S = Object.entries(l), w = Array.isArray(l) ? `[${S.length}]` : `{${S.length}}`;
|
|
5230
|
+
return o`<details class="jnode" ?open=${c < 2}>
|
|
5231
|
+
<summary>${b}<span class="jmeta">${w}</span></summary>
|
|
5232
|
+
<div class="jkids">${S.map(([_, x]) => r(x, c + 1, _))}</div>
|
|
5233
|
+
</details>`;
|
|
5234
|
+
}
|
|
5235
|
+
return o`<div class="jleaf">
|
|
5236
|
+
${b}<span class="jv ${l === null ? "null" : typeof l}">${JSON.stringify(l)}</span>
|
|
5237
|
+
</div>`;
|
|
5238
|
+
};
|
|
5239
|
+
return o`<div class="code json" part="json">
|
|
5240
|
+
<div class="code-head">
|
|
5241
|
+
<span class="label">json</span>
|
|
5242
|
+
<button type="button" class="text-btn" @click=${() => this.copy(s, t)}>
|
|
5243
|
+
${this.copiedKey === s ? this.msg.copied : this.msg.copy}
|
|
5244
|
+
</button>
|
|
5245
|
+
</div>
|
|
5246
|
+
<div class="jtree">${r(e, 0)}</div>
|
|
5247
|
+
</div>`;
|
|
5248
|
+
}
|
|
4510
5249
|
renderChart(e) {
|
|
4511
|
-
const t = e.series.length > 1 ?
|
|
5250
|
+
const t = e.series.length > 1 ? o`<span class="legend">
|
|
4512
5251
|
${e.series.map(
|
|
4513
|
-
(
|
|
5252
|
+
(r, l) => o`<span
|
|
4514
5253
|
><span
|
|
4515
5254
|
class="swatch"
|
|
4516
|
-
style="background:${
|
|
5255
|
+
style="background:${N[l % N.length]}"
|
|
4517
5256
|
></span
|
|
4518
|
-
>${
|
|
5257
|
+
>${r.name}</span
|
|
4519
5258
|
>`
|
|
4520
5259
|
)}
|
|
4521
|
-
</span>` :
|
|
5260
|
+
</span>` : f, s = o`<div class="chart-head">
|
|
4522
5261
|
<span class="chart-title">${e.title}</span>${t}
|
|
4523
5262
|
</div>`;
|
|
4524
5263
|
if (e.type === "line") {
|
|
4525
|
-
const
|
|
4526
|
-
return
|
|
4527
|
-
${
|
|
5264
|
+
const r = Math.max(0, ...e.series.flatMap((b) => b.values)), l = Math.pow(10, Math.floor(Math.log10(r || 1))), c = Math.ceil(r / l * 2) / 2 * l || 1, m = Math.max(e.labels.length, ...e.series.map((b) => b.values.length));
|
|
5265
|
+
return o`<figure class="chart" part="chart" aria-label=${e.title}>
|
|
5266
|
+
${s}
|
|
4528
5267
|
<div class="line-chart">
|
|
4529
5268
|
<div class="plot">
|
|
4530
5269
|
${[1, 0.5, 0].map(
|
|
4531
|
-
(
|
|
4532
|
-
<span>${
|
|
5270
|
+
(b) => o`<div class="tick ${b === 0 ? "base" : ""}" style="top:${(1 - b) * 100}%">
|
|
5271
|
+
<span>${ut(Math.round(c * b), e.unit)}</span>
|
|
4533
5272
|
</div>`
|
|
4534
5273
|
)}
|
|
4535
5274
|
<svg
|
|
@@ -4539,141 +5278,143 @@ ${x.map((b) => `[${b.n}] ${b.title}`).join(`
|
|
|
4539
5278
|
aria-label=${e.title}
|
|
4540
5279
|
>
|
|
4541
5280
|
${e.series.map(
|
|
4542
|
-
(
|
|
4543
|
-
points=${
|
|
4544
|
-
(S,
|
|
5281
|
+
(b, C) => I`<polyline pathLength="1" stroke=${N[C % N.length]}
|
|
5282
|
+
points=${b.values.map(
|
|
5283
|
+
(S, w) => `${(m > 1 ? w / (m - 1) * 600 : 300).toFixed(1)},${(170 - S / c * 170).toFixed(1)}`
|
|
4545
5284
|
).join(
|
|
4546
5285
|
" "
|
|
4547
|
-
)}><title>${
|
|
5286
|
+
)}><title>${b.name}: ${b.values.map((S) => ut(S, e.unit)).join(", ")}</title></polyline>`
|
|
4548
5287
|
)}
|
|
4549
5288
|
</svg>
|
|
4550
5289
|
</div>
|
|
4551
|
-
<div class="x-labels">${e.labels.map((
|
|
5290
|
+
<div class="x-labels">${e.labels.map((b) => o`<span>${b}</span>`)}</div>
|
|
4552
5291
|
</div>
|
|
4553
5292
|
</figure>`;
|
|
4554
5293
|
}
|
|
4555
|
-
const
|
|
4556
|
-
(
|
|
4557
|
-
), a = Math.max(0, ...
|
|
4558
|
-
return
|
|
4559
|
-
${
|
|
5294
|
+
const i = e.labels.map(
|
|
5295
|
+
(r, l) => e.series.reduce((c, m) => c + (m.values[l] || 0), 0)
|
|
5296
|
+
), a = Math.max(0, ...i) || 1;
|
|
5297
|
+
return o`<figure class="chart" part="chart" aria-label=${e.title}>
|
|
5298
|
+
${s}
|
|
4560
5299
|
<div class="bars">
|
|
4561
5300
|
${e.labels.map(
|
|
4562
|
-
(
|
|
4563
|
-
<span class="bar-label">${
|
|
5301
|
+
(r, l) => o`<div class="bar-row" title="${r}: ${ut(i[l], e.unit)}">
|
|
5302
|
+
<span class="bar-label">${r}</span>
|
|
4564
5303
|
<span class="bar-track"
|
|
4565
|
-
><span class="bar-fill" style="width:${Math.max(0,
|
|
5304
|
+
><span class="bar-fill" style="width:${Math.max(0, i[l]) / a * 100}%">
|
|
4566
5305
|
${e.series.map(
|
|
4567
|
-
(c,
|
|
4568
|
-
style="flex:${Math.max(0, c.values[l] || 0)};background:${e.series.length > 1 ?
|
|
5306
|
+
(c, m) => o`<span
|
|
5307
|
+
style="flex:${Math.max(0, c.values[l] || 0)};background:${e.series.length > 1 ? N[m % N.length] : "var(--c-ink)"}"
|
|
4569
5308
|
></span>`
|
|
4570
5309
|
)}
|
|
4571
5310
|
</span></span
|
|
4572
5311
|
>
|
|
4573
|
-
<span class="bar-value">${
|
|
5312
|
+
<span class="bar-value">${ut(i[l], e.unit)}</span>
|
|
4574
5313
|
</div>`
|
|
4575
5314
|
)}
|
|
4576
5315
|
</div>
|
|
4577
5316
|
</figure>`;
|
|
4578
5317
|
}
|
|
4579
5318
|
renderPanel() {
|
|
4580
|
-
if (!this.panel) return
|
|
4581
|
-
const e = this.msgs.find((
|
|
4582
|
-
if (!e || !t) return
|
|
4583
|
-
const
|
|
4584
|
-
— ${
|
|
4585
|
-
${
|
|
4586
|
-
|
|
4587
|
-
|
|
5319
|
+
if (!this.panel) return f;
|
|
5320
|
+
const e = this.msgs.find((b) => b.key === this.panel.key), t = e == null ? void 0 : e.sources[this.panel.n - 1];
|
|
5321
|
+
if (!e || !t) return f;
|
|
5322
|
+
const s = this.msg, i = gt(t, this.panel.n), a = Tt(e.content), r = e.sources.map((b, C) => gt(b, C + 1)).filter((b) => b.n !== i.n && (!a.size || a.has(b.n))), l = `ref:${e.key}:${i.n}`, c = `"${i.text}"
|
|
5323
|
+
— ${i.title} [${i.n}]${i.path ? `
|
|
5324
|
+
${i.path}` : ""}${i.updated ? ` · Updated ${i.updated}` : ""}`, m = [
|
|
5325
|
+
i.updated ? `Updated ${i.updated}` : "",
|
|
5326
|
+
i.score !== null ? `Relevance ${i.score.toFixed(2)}` : ""
|
|
4588
5327
|
].filter(Boolean).join(" · ");
|
|
4589
|
-
return
|
|
5328
|
+
return o`<aside
|
|
4590
5329
|
class="panel ${this.panelDocked ? "docked" : "overlay"}"
|
|
4591
5330
|
part="panel"
|
|
4592
5331
|
role="region"
|
|
4593
|
-
aria-label=${
|
|
5332
|
+
aria-label=${L(s.sourceLabel, { n: i.n })}
|
|
4594
5333
|
>
|
|
4595
5334
|
<div class="panel-head">
|
|
4596
5335
|
<span class="label"
|
|
4597
|
-
>${
|
|
5336
|
+
>${L(s.sourceLabel, { n: i.n })}${i.collection ? ` · ${i.collection}` : ""}</span
|
|
4598
5337
|
>
|
|
4599
5338
|
<button type="button" class="text-btn underline" @click=${() => this.panel = null}>
|
|
4600
|
-
${
|
|
5339
|
+
${s.close}
|
|
4601
5340
|
</button>
|
|
4602
5341
|
</div>
|
|
4603
5342
|
<div class="panel-body">
|
|
4604
5343
|
<div class="panel-meta">
|
|
4605
|
-
<h3>${
|
|
4606
|
-
${
|
|
4607
|
-
${
|
|
5344
|
+
<h3>${i.title}</h3>
|
|
5345
|
+
${i.path ? o`<span class="path">${i.path}</span>` : f}
|
|
5346
|
+
${m ? o`<span class="meta">${m}</span>` : f}
|
|
4608
5347
|
</div>
|
|
4609
5348
|
<div class="passage-box">
|
|
4610
|
-
<span class="text">${
|
|
5349
|
+
<span class="text">${i.text}</span>
|
|
4611
5350
|
<div class="passage-foot">
|
|
4612
|
-
<span class="label">${
|
|
5351
|
+
<span class="label">${s.citedPassage}</span>
|
|
4613
5352
|
<button
|
|
4614
5353
|
type="button"
|
|
4615
5354
|
class="copy-ref"
|
|
4616
|
-
title=${
|
|
4617
|
-
aria-label=${
|
|
5355
|
+
title=${s.copyReference}
|
|
5356
|
+
aria-label=${s.copyReference}
|
|
4618
5357
|
@click=${() => this.copy(l, c)}
|
|
4619
5358
|
>
|
|
4620
|
-
${
|
|
5359
|
+
${k.copy()}<span>${this.copiedKey === l ? s.copied : s.copy}</span>
|
|
4621
5360
|
</button>
|
|
4622
5361
|
</div>
|
|
4623
5362
|
</div>
|
|
4624
5363
|
</div>
|
|
4625
|
-
${
|
|
4626
|
-
<span class="label">${
|
|
5364
|
+
${r.length ? o`<div class="panel-foot">
|
|
5365
|
+
<span class="label">${s.alsoCited}</span>
|
|
4627
5366
|
<div class="chips">
|
|
4628
|
-
${
|
|
4629
|
-
(
|
|
5367
|
+
${r.map(
|
|
5368
|
+
(b) => o`<button
|
|
4630
5369
|
type="button"
|
|
4631
5370
|
class="chip"
|
|
4632
|
-
@click=${() => this.panel = { key: e.key, n:
|
|
5371
|
+
@click=${() => this.panel = { key: e.key, n: b.n }}
|
|
4633
5372
|
>
|
|
4634
|
-
${
|
|
5373
|
+
${b.n} · ${b.title}
|
|
4635
5374
|
</button>`
|
|
4636
5375
|
)}
|
|
4637
5376
|
</div>
|
|
4638
|
-
</div>` :
|
|
5377
|
+
</div>` : f}
|
|
4639
5378
|
</aside>`;
|
|
4640
5379
|
}
|
|
4641
5380
|
renderComposer() {
|
|
4642
|
-
const e = this.msg, t = this.mode === "rag" ? e.placeholderRag :
|
|
4643
|
-
|
|
5381
|
+
const e = this.msg, t = this.mode === "rag" ? e.placeholderRag : L(e.placeholderChat, { name: this.assistantName }), s = !this.draft.trim(), i = this.footnote === "" ? f : o`<span class="footnote" part="footnote"
|
|
5382
|
+
>${this.footnote ?? L(e.footnote, { name: this.assistantName })}</span
|
|
5383
|
+
>`;
|
|
5384
|
+
return this.showComposer ? o`<div class="composer-wrap">
|
|
4644
5385
|
<div class="composer-col">
|
|
4645
5386
|
<input
|
|
4646
5387
|
type="file"
|
|
4647
5388
|
multiple
|
|
4648
5389
|
hidden
|
|
4649
5390
|
accept=".md,.markdown,.txt,.csv,.tsv,.json,.html,.htm,.yaml,.yml,.xml,.log,text/*"
|
|
4650
|
-
@change=${(
|
|
4651
|
-
const
|
|
4652
|
-
this.addFiles(
|
|
5391
|
+
@change=${(a) => {
|
|
5392
|
+
const r = a.target;
|
|
5393
|
+
this.addFiles(r.files).then(() => r.value = "");
|
|
4653
5394
|
}}
|
|
4654
5395
|
/>
|
|
4655
5396
|
<div class="composer-box">
|
|
4656
|
-
${this.busy ?
|
|
5397
|
+
${this.busy ? o`<div class="composer-glow"></div>` : f}
|
|
4657
5398
|
<div class="composer ${this.busy ? "busy" : ""}" part="composer">
|
|
4658
|
-
${this.files.length ?
|
|
5399
|
+
${this.files.length ? o`<div class="pending-files">
|
|
4659
5400
|
${this.files.map(
|
|
4660
|
-
(
|
|
4661
|
-
<span class="ext">${
|
|
5401
|
+
(a) => o`<div class="pending-file">
|
|
5402
|
+
<span class="ext">${Rt(a.name)}</span>
|
|
4662
5403
|
<span class="meta"
|
|
4663
|
-
><span class="name">${
|
|
4664
|
-
><span class="size">${
|
|
5404
|
+
><span class="name">${a.name}</span
|
|
5405
|
+
><span class="size">${vt(a.size)}</span></span
|
|
4665
5406
|
>
|
|
4666
5407
|
<button
|
|
4667
5408
|
type="button"
|
|
4668
5409
|
aria-label=${e.removeFile}
|
|
4669
5410
|
title=${e.removeFile}
|
|
4670
|
-
@click=${() => this.files = this.files.filter((
|
|
5411
|
+
@click=${() => this.files = this.files.filter((r) => r !== a)}
|
|
4671
5412
|
>
|
|
4672
5413
|
×
|
|
4673
5414
|
</button>
|
|
4674
5415
|
</div>`
|
|
4675
5416
|
)}
|
|
4676
|
-
</div>` :
|
|
5417
|
+
</div>` : f}
|
|
4677
5418
|
<textarea
|
|
4678
5419
|
class="input"
|
|
4679
5420
|
rows="1"
|
|
@@ -4685,242 +5426,321 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, x = [
|
|
|
4685
5426
|
></textarea>
|
|
4686
5427
|
<div class="composer-row">
|
|
4687
5428
|
<div>
|
|
4688
|
-
${this.allowUpload ?
|
|
5429
|
+
${this.allowUpload ? o`<button
|
|
4689
5430
|
type="button"
|
|
4690
5431
|
class="attach"
|
|
4691
5432
|
title=${e.attach}
|
|
4692
5433
|
aria-label=${e.attach}
|
|
4693
5434
|
@click=${() => {
|
|
4694
|
-
var
|
|
4695
|
-
return (
|
|
5435
|
+
var a;
|
|
5436
|
+
return (a = this.renderRoot.querySelector("input[type=file]")) == null ? void 0 : a.click();
|
|
4696
5437
|
}}
|
|
4697
5438
|
>
|
|
4698
|
-
${
|
|
4699
|
-
</button>` :
|
|
5439
|
+
${k.clip()}
|
|
5440
|
+
</button>` : f}
|
|
4700
5441
|
</div>
|
|
4701
|
-
${this.busy ?
|
|
5442
|
+
${this.busy ? o`<button
|
|
4702
5443
|
type="button"
|
|
4703
5444
|
class="send stop"
|
|
4704
5445
|
title=${e.stop}
|
|
4705
5446
|
aria-label=${e.stop}
|
|
4706
5447
|
@click=${() => this.stop()}
|
|
4707
5448
|
>
|
|
4708
|
-
${
|
|
4709
|
-
</button>` :
|
|
5449
|
+
${k.stop()}
|
|
5450
|
+
</button>` : o`<button
|
|
4710
5451
|
type="button"
|
|
4711
5452
|
class="send"
|
|
4712
5453
|
title=${e.send}
|
|
4713
5454
|
aria-label=${e.send}
|
|
4714
|
-
?disabled=${
|
|
5455
|
+
?disabled=${s}
|
|
4715
5456
|
@click=${() => this.send()}
|
|
4716
5457
|
>
|
|
4717
|
-
${
|
|
5458
|
+
${k.up()}
|
|
4718
5459
|
</button>`}
|
|
4719
5460
|
</div>
|
|
4720
5461
|
</div>
|
|
4721
|
-
${this.busy ?
|
|
5462
|
+
${this.busy ? o`<div class="composer-ring"><div class="ring"></div></div>` : f}
|
|
4722
5463
|
</div>
|
|
4723
|
-
|
|
5464
|
+
${i}
|
|
4724
5465
|
</div>
|
|
4725
|
-
</div
|
|
5466
|
+
</div>` : o`<div class="composer-wrap reader">
|
|
5467
|
+
<div class="composer-col">${i}</div>
|
|
5468
|
+
</div>`;
|
|
4726
5469
|
}
|
|
4727
|
-
},
|
|
4728
|
-
|
|
5470
|
+
}, A = new WeakMap(), R = new WeakMap(), E = new WeakMap(), B = new WeakMap(), D = new WeakMap(), F = new WeakMap(), U = new WeakMap(), P = new WeakMap(), K = new WeakMap(), W = new WeakMap(), J = new WeakMap(), H = new WeakMap(), G = new WeakMap(), q = new WeakMap(), V = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), ee = new WeakMap(), te = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), re = new WeakMap(), oe = new WeakMap(), ne = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), pe = new WeakMap(), he = new WeakMap(), ue = new WeakMap(), ge = new WeakMap(), me = new WeakMap(), fe = new WeakMap(), be = new WeakMap(), xe = new WeakMap(), ve = new WeakMap(), we = new WeakMap(), ye = new WeakMap(), ke = new WeakMap(), $e = new WeakMap(), Ce = new WeakMap(), Te = new WeakMap(), Se = new WeakMap(), Oe = new WeakMap(), Ie = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), _e = new WeakMap(), Le = new WeakMap(), je = new WeakMap(), Ne = new WeakMap(), Ae = new WeakMap(), Re = new WeakMap(), Ee = new WeakMap(), Be = new WeakMap(), De = new WeakMap(), Fe = new WeakMap(), Ue = new WeakMap(), Pe = new WeakMap(), Ke = new WeakMap(), We = new WeakMap(), Je = new WeakMap(), He = new WeakMap(), Ge = new WeakMap(), qe = new WeakMap(), Ve = new WeakMap(), Xe = new WeakMap(), Ye = new WeakMap(), Qe = new WeakMap(), Ze = new WeakMap(), et = new WeakMap(), tt = new WeakMap(), st = new WeakMap(), it = new WeakMap(), at = new WeakMap(), rt = new WeakMap(), ot = new WeakMap(), nt = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), pt = new WeakMap(), ht = new WeakMap(), Et);
|
|
5471
|
+
ws(d, "styles", [qt, Vt, Xt]);
|
|
4729
5472
|
g([
|
|
4730
|
-
|
|
5473
|
+
v({ attribute: !1 })
|
|
4731
5474
|
], d.prototype, "client", 1);
|
|
4732
5475
|
g([
|
|
4733
|
-
|
|
5476
|
+
v({ attribute: !1 })
|
|
4734
5477
|
], d.prototype, "messages", 1);
|
|
4735
5478
|
g([
|
|
4736
|
-
|
|
5479
|
+
v({ reflect: !0 })
|
|
4737
5480
|
], d.prototype, "theme", 1);
|
|
4738
5481
|
g([
|
|
4739
|
-
|
|
5482
|
+
v({ reflect: !0 })
|
|
5483
|
+
], d.prototype, "radius", 1);
|
|
5484
|
+
g([
|
|
5485
|
+
v({ reflect: !0 })
|
|
4740
5486
|
], d.prototype, "mode", 1);
|
|
4741
5487
|
g([
|
|
4742
|
-
|
|
4743
|
-
], d.prototype, "
|
|
5488
|
+
v({ reflect: !0 })
|
|
5489
|
+
], d.prototype, "format", 1);
|
|
5490
|
+
g([
|
|
5491
|
+
v({ attribute: !1 })
|
|
5492
|
+
], d.prototype, "renderers", 1);
|
|
4744
5493
|
g([
|
|
4745
|
-
|
|
5494
|
+
v({ attribute: !1 })
|
|
5495
|
+
], d.prototype, "beforeSend", 1);
|
|
5496
|
+
g([
|
|
5497
|
+
v({ attribute: !1 })
|
|
5498
|
+
], d.prototype, "afterParse", 1);
|
|
5499
|
+
g([
|
|
5500
|
+
v({ reflect: !0 })
|
|
4746
5501
|
], d.prototype, "glow", 1);
|
|
4747
5502
|
g([
|
|
4748
|
-
|
|
5503
|
+
v({ converter: O })
|
|
4749
5504
|
], d.prototype, "followups", 1);
|
|
4750
5505
|
g([
|
|
4751
|
-
|
|
5506
|
+
v({ converter: O, attribute: "show-sources" })
|
|
5507
|
+
], d.prototype, "showSources", 1);
|
|
5508
|
+
g([
|
|
5509
|
+
v({ converter: O, attribute: "show-new-chat" })
|
|
5510
|
+
], d.prototype, "showNewChat", 1);
|
|
5511
|
+
g([
|
|
5512
|
+
v({ converter: O, attribute: "show-bookmarked" })
|
|
5513
|
+
], d.prototype, "showBookmarked", 1);
|
|
5514
|
+
g([
|
|
5515
|
+
v({ converter: O, attribute: "show-followups" })
|
|
5516
|
+
], d.prototype, "showFollowups", 1);
|
|
5517
|
+
g([
|
|
5518
|
+
v({ converter: O, attribute: "allow-search" })
|
|
5519
|
+
], d.prototype, "allowSearch", 1);
|
|
5520
|
+
g([
|
|
5521
|
+
v({ converter: O, attribute: "auto-title" })
|
|
4752
5522
|
], d.prototype, "autoTitle", 1);
|
|
4753
5523
|
g([
|
|
4754
|
-
|
|
5524
|
+
v()
|
|
4755
5525
|
], d.prototype, "model", 1);
|
|
4756
5526
|
g([
|
|
4757
|
-
|
|
5527
|
+
v({ converter: ft })
|
|
4758
5528
|
], d.prototype, "params", 1);
|
|
4759
5529
|
g([
|
|
4760
|
-
|
|
5530
|
+
v({ attribute: "system-message" })
|
|
4761
5531
|
], d.prototype, "systemMessage", 1);
|
|
4762
5532
|
g([
|
|
4763
|
-
|
|
5533
|
+
v({ converter: ft })
|
|
4764
5534
|
], d.prototype, "retrieval", 1);
|
|
4765
5535
|
g([
|
|
4766
|
-
|
|
5536
|
+
v({ converter: ft })
|
|
4767
5537
|
], d.prototype, "metadata", 1);
|
|
4768
5538
|
g([
|
|
4769
|
-
|
|
5539
|
+
v({ reflect: !0 })
|
|
4770
5540
|
], d.prototype, "embed", 1);
|
|
4771
5541
|
g([
|
|
4772
|
-
|
|
5542
|
+
v({ reflect: !0 })
|
|
4773
5543
|
], d.prototype, "position", 1);
|
|
4774
5544
|
g([
|
|
4775
|
-
|
|
5545
|
+
v({ converter: ys })
|
|
4776
5546
|
], d.prototype, "sidebar", 1);
|
|
4777
5547
|
g([
|
|
4778
|
-
|
|
5548
|
+
v({ converter: O, attribute: "show-title" })
|
|
4779
5549
|
], d.prototype, "showTitle", 1);
|
|
4780
5550
|
g([
|
|
4781
|
-
|
|
5551
|
+
v({ attribute: "chat-id" })
|
|
4782
5552
|
], d.prototype, "chatIdAttr", 1);
|
|
4783
5553
|
g([
|
|
4784
|
-
|
|
5554
|
+
v({ attribute: "assistant-name" })
|
|
4785
5555
|
], d.prototype, "assistantName", 1);
|
|
4786
5556
|
g([
|
|
4787
|
-
|
|
5557
|
+
v({ attribute: "logo-url" })
|
|
4788
5558
|
], d.prototype, "logoUrl", 1);
|
|
4789
5559
|
g([
|
|
4790
|
-
|
|
5560
|
+
v()
|
|
4791
5561
|
], d.prototype, "heading", 1);
|
|
4792
5562
|
g([
|
|
4793
|
-
|
|
5563
|
+
v()
|
|
4794
5564
|
], d.prototype, "description", 1);
|
|
4795
5565
|
g([
|
|
4796
|
-
|
|
5566
|
+
v()
|
|
5567
|
+
], d.prototype, "eyebrow", 1);
|
|
5568
|
+
g([
|
|
5569
|
+
v()
|
|
4797
5570
|
], d.prototype, "prompts", 1);
|
|
4798
5571
|
g([
|
|
4799
|
-
|
|
5572
|
+
v({ attribute: "bubble-text" })
|
|
4800
5573
|
], d.prototype, "bubbleText", 1);
|
|
4801
5574
|
g([
|
|
4802
|
-
|
|
5575
|
+
v({ type: Boolean, attribute: "greeting-bubble" })
|
|
4803
5576
|
], d.prototype, "greetingBubble", 1);
|
|
4804
5577
|
g([
|
|
4805
|
-
|
|
5578
|
+
v({ type: Boolean, attribute: "unread-badge" })
|
|
4806
5579
|
], d.prototype, "unreadBadge", 1);
|
|
4807
5580
|
g([
|
|
4808
|
-
|
|
5581
|
+
v({ converter: O, attribute: "allow-upload" })
|
|
4809
5582
|
], d.prototype, "allowUpload", 1);
|
|
4810
5583
|
g([
|
|
4811
|
-
|
|
5584
|
+
v({ converter: O, attribute: "allow-export" })
|
|
4812
5585
|
], d.prototype, "allowExport", 1);
|
|
4813
5586
|
g([
|
|
4814
|
-
|
|
4815
|
-
], d.prototype, "
|
|
5587
|
+
v({ converter: O, attribute: "allow-copy" })
|
|
5588
|
+
], d.prototype, "allowCopy", 1);
|
|
5589
|
+
g([
|
|
5590
|
+
v({ converter: O, attribute: "allow-regenerate" })
|
|
5591
|
+
], d.prototype, "allowRegenerate", 1);
|
|
5592
|
+
g([
|
|
5593
|
+
v({ converter: O, attribute: "allow-bookmark" })
|
|
5594
|
+
], d.prototype, "allowBookmark", 1);
|
|
5595
|
+
g([
|
|
5596
|
+
v({ converter: O, attribute: "allow-delete" })
|
|
5597
|
+
], d.prototype, "allowDelete", 1);
|
|
5598
|
+
g([
|
|
5599
|
+
v({ converter: O, attribute: "allow-rename" })
|
|
5600
|
+
], d.prototype, "allowRename", 1);
|
|
5601
|
+
g([
|
|
5602
|
+
v({ converter: O, attribute: "allow-feedback" })
|
|
5603
|
+
], d.prototype, "allowFeedback", 1);
|
|
5604
|
+
g([
|
|
5605
|
+
v({ converter: O, attribute: "show-composer" })
|
|
5606
|
+
], d.prototype, "showComposer", 1);
|
|
5607
|
+
g([
|
|
5608
|
+
v({ converter: O, attribute: "show-time" })
|
|
5609
|
+
], d.prototype, "showTime", 1);
|
|
4816
5610
|
g([
|
|
4817
5611
|
v()
|
|
5612
|
+
], d.prototype, "footnote", 1);
|
|
5613
|
+
g([
|
|
5614
|
+
v({ type: Boolean, attribute: "allow-raw" })
|
|
5615
|
+
], d.prototype, "allowRaw", 1);
|
|
5616
|
+
g([
|
|
5617
|
+
v({ converter: O })
|
|
5618
|
+
], d.prototype, "branding", 1);
|
|
5619
|
+
g([
|
|
5620
|
+
v({ attribute: "branding-text" })
|
|
5621
|
+
], d.prototype, "brandingText", 1);
|
|
5622
|
+
g([
|
|
5623
|
+
v({ attribute: "branding-url" })
|
|
5624
|
+
], d.prototype, "brandingUrl", 1);
|
|
5625
|
+
g([
|
|
5626
|
+
y()
|
|
4818
5627
|
], d.prototype, "chatList", 1);
|
|
4819
5628
|
g([
|
|
4820
|
-
|
|
5629
|
+
y()
|
|
4821
5630
|
], d.prototype, "listState", 1);
|
|
4822
5631
|
g([
|
|
4823
|
-
|
|
5632
|
+
y()
|
|
4824
5633
|
], d.prototype, "activeId", 1);
|
|
4825
5634
|
g([
|
|
4826
|
-
|
|
5635
|
+
y()
|
|
4827
5636
|
], d.prototype, "chatTitle", 1);
|
|
4828
5637
|
g([
|
|
4829
|
-
|
|
5638
|
+
y()
|
|
4830
5639
|
], d.prototype, "bookmarked", 1);
|
|
4831
5640
|
g([
|
|
4832
|
-
|
|
5641
|
+
y()
|
|
4833
5642
|
], d.prototype, "msgs", 1);
|
|
4834
5643
|
g([
|
|
4835
|
-
|
|
5644
|
+
y()
|
|
4836
5645
|
], d.prototype, "loadingThread", 1);
|
|
4837
5646
|
g([
|
|
4838
|
-
|
|
5647
|
+
y()
|
|
4839
5648
|
], d.prototype, "threadError", 1);
|
|
4840
5649
|
g([
|
|
4841
|
-
|
|
5650
|
+
y()
|
|
4842
5651
|
], d.prototype, "busy", 1);
|
|
4843
5652
|
g([
|
|
4844
|
-
|
|
5653
|
+
y()
|
|
4845
5654
|
], d.prototype, "draft", 1);
|
|
4846
5655
|
g([
|
|
4847
|
-
|
|
5656
|
+
y()
|
|
4848
5657
|
], d.prototype, "files", 1);
|
|
4849
5658
|
g([
|
|
4850
|
-
|
|
5659
|
+
y()
|
|
4851
5660
|
], d.prototype, "search", 1);
|
|
4852
5661
|
g([
|
|
4853
|
-
|
|
5662
|
+
y()
|
|
4854
5663
|
], d.prototype, "sidebarOpen", 1);
|
|
4855
5664
|
g([
|
|
4856
|
-
|
|
5665
|
+
y()
|
|
4857
5666
|
], d.prototype, "width", 1);
|
|
4858
5667
|
g([
|
|
4859
|
-
|
|
5668
|
+
y()
|
|
4860
5669
|
], d.prototype, "panel", 1);
|
|
4861
5670
|
g([
|
|
4862
|
-
|
|
5671
|
+
y()
|
|
4863
5672
|
], d.prototype, "menuOpen", 1);
|
|
4864
5673
|
g([
|
|
4865
|
-
|
|
5674
|
+
y()
|
|
4866
5675
|
], d.prototype, "editingKey", 1);
|
|
4867
5676
|
g([
|
|
4868
|
-
|
|
5677
|
+
y()
|
|
4869
5678
|
], d.prototype, "editDraft", 1);
|
|
4870
5679
|
g([
|
|
4871
|
-
|
|
5680
|
+
y()
|
|
4872
5681
|
], d.prototype, "editingTitle", 1);
|
|
4873
5682
|
g([
|
|
4874
|
-
|
|
5683
|
+
y()
|
|
4875
5684
|
], d.prototype, "renamingId", 1);
|
|
4876
5685
|
g([
|
|
4877
|
-
|
|
5686
|
+
y()
|
|
4878
5687
|
], d.prototype, "toast", 1);
|
|
4879
5688
|
g([
|
|
4880
|
-
|
|
5689
|
+
y()
|
|
4881
5690
|
], d.prototype, "copiedKey", 1);
|
|
4882
5691
|
g([
|
|
4883
|
-
|
|
5692
|
+
y()
|
|
4884
5693
|
], d.prototype, "retrievalOpen", 1);
|
|
4885
5694
|
g([
|
|
4886
|
-
|
|
5695
|
+
y()
|
|
5696
|
+
], d.prototype, "rawKeys", 1);
|
|
5697
|
+
g([
|
|
5698
|
+
y()
|
|
5699
|
+
], d.prototype, "hasSidebarContent", 1);
|
|
5700
|
+
g([
|
|
5701
|
+
y()
|
|
5702
|
+
], d.prototype, "sorts", 1);
|
|
5703
|
+
g([
|
|
5704
|
+
y()
|
|
4887
5705
|
], d.prototype, "arrivedKey", 1);
|
|
4888
5706
|
g([
|
|
4889
|
-
|
|
5707
|
+
y()
|
|
4890
5708
|
], d.prototype, "dragging", 1);
|
|
4891
5709
|
g([
|
|
4892
|
-
|
|
5710
|
+
y()
|
|
4893
5711
|
], d.prototype, "showJump", 1);
|
|
4894
5712
|
g([
|
|
4895
|
-
|
|
5713
|
+
y()
|
|
4896
5714
|
], d.prototype, "offline", 1);
|
|
4897
5715
|
g([
|
|
4898
|
-
|
|
5716
|
+
y()
|
|
4899
5717
|
], d.prototype, "isOpen", 1);
|
|
4900
5718
|
g([
|
|
4901
|
-
|
|
5719
|
+
y()
|
|
4902
5720
|
], d.prototype, "expanded", 1);
|
|
4903
5721
|
g([
|
|
4904
|
-
|
|
5722
|
+
y()
|
|
4905
5723
|
], d.prototype, "bubble", 1);
|
|
4906
5724
|
g([
|
|
4907
|
-
|
|
5725
|
+
y()
|
|
4908
5726
|
], d.prototype, "seen", 1);
|
|
4909
5727
|
g([
|
|
4910
|
-
|
|
5728
|
+
y()
|
|
4911
5729
|
], d.prototype, "mobile", 1);
|
|
4912
5730
|
d = g([
|
|
4913
|
-
|
|
5731
|
+
Wt("singlebase-chat")
|
|
4914
5732
|
], d);
|
|
4915
5733
|
export {
|
|
4916
5734
|
d as S,
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
5735
|
+
ps as a,
|
|
5736
|
+
gt as b,
|
|
5737
|
+
Tt as c,
|
|
5738
|
+
Yt as d,
|
|
5739
|
+
is as e,
|
|
5740
|
+
Ot as f,
|
|
5741
|
+
bs as g,
|
|
5742
|
+
ns as p,
|
|
5743
|
+
Qt as r,
|
|
5744
|
+
ls as s
|
|
4925
5745
|
};
|
|
4926
|
-
//# sourceMappingURL=chat-
|
|
5746
|
+
//# sourceMappingURL=chat-CEh6RygY.js.map
|