@singlebase/elements 0.7.0 → 0.9.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.
Files changed (39) hide show
  1. package/dist/authui-display-C2o9gApg.cjs +961 -0
  2. package/dist/authui-display-C2o9gApg.cjs.map +1 -0
  3. package/dist/{authui-display-BM_F3-5e.js → authui-display-CRUABt43.js} +1009 -862
  4. package/dist/authui-display-CRUABt43.js.map +1 -0
  5. package/dist/authui.cjs +1 -1
  6. package/dist/authui.js +2 -2
  7. package/dist/{chat-ezUmd9II.cjs → chat-Bj6DrOaW.cjs} +237 -168
  8. package/dist/chat-Bj6DrOaW.cjs.map +1 -0
  9. package/dist/{chat-BH_3e1jT.js → chat-DNiqYF6F.js} +1098 -825
  10. package/dist/chat-DNiqYF6F.js.map +1 -0
  11. package/dist/chat-messages.d.ts +5 -0
  12. package/dist/chat.cjs +1 -1
  13. package/dist/chat.js +1 -1
  14. package/dist/elements/authui-account.d.ts +0 -1
  15. package/dist/elements/authui-buttons.d.ts +1 -1
  16. package/dist/elements/authui.d.ts +25 -1
  17. package/dist/elements/chat.d.ts +76 -4
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.js +3 -3
  20. package/dist/messages.d.ts +34 -3
  21. package/dist/singlebase-elements.min.js +3113 -2664
  22. package/dist/singlebase-elements.min.js.map +1 -1
  23. package/dist/{uploader-COP8PkJ6.cjs → uploader-C57vgFME.cjs} +27 -1
  24. package/dist/uploader-C57vgFME.cjs.map +1 -0
  25. package/dist/{uploader-tdMU9Gxv.js → uploader-Cz9yfzfV.js} +27 -1
  26. package/dist/uploader-Cz9yfzfV.js.map +1 -0
  27. package/dist/uploader.cjs +1 -1
  28. package/dist/uploader.js +1 -1
  29. package/dist/utils/auth-errors.d.ts +7 -0
  30. package/dist/utils/oauth.d.ts +24 -0
  31. package/dist/utils/password.d.ts +16 -0
  32. package/package.json +3 -3
  33. package/dist/authui-display-BM_F3-5e.js.map +0 -1
  34. package/dist/authui-display-CMVHTNFz.cjs +0 -956
  35. package/dist/authui-display-CMVHTNFz.cjs.map +0 -1
  36. package/dist/chat-BH_3e1jT.js.map +0 -1
  37. package/dist/chat-ezUmd9II.cjs.map +0 -1
  38. package/dist/uploader-COP8PkJ6.cjs.map +0 -1
  39. package/dist/uploader-tdMU9Gxv.js.map +0 -1
@@ -1,15 +1,15 @@
1
- var Ut = Object.defineProperty;
2
- var wt = (n) => {
1
+ var es = Object.defineProperty;
2
+ var _t = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var Wt = (n, e, t) => e in n ? Ut(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
- var M = (n, e, t) => Wt(n, typeof e != "symbol" ? e + "" : e, t), yt = (n, e, t) => e.has(n) || wt("Cannot " + t);
7
- var p = (n, e, t) => (yt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), h = (n, e, t) => e.has(n) ? wt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), u = (n, e, t, s) => (yt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
8
- import { css as Ht, LitElement as Jt, html as o, nothing as m, svg as O } from "lit";
9
- import { property as v, state as y, customElement as Gt } from "lit/decorators.js";
10
- import { repeat as qt } from "lit/directives/repeat.js";
11
- import { getDefaultClient as Vt } from "@singlebase/core";
12
- import { a as _, e as kt, j as Xt, t as Yt, b as Qt } from "./files-DS-H-3yN.js";
5
+ var ts = (n, e, t) => e in n ? es(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var O = (n, e, t) => ts(n, typeof e != "symbol" ? e + "" : e, t), zt = (n, e, t) => e.has(n) || _t("Cannot " + t);
7
+ var p = (n, e, t) => (zt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), h = (n, e, t) => e.has(n) ? _t("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), u = (n, e, t, s) => (zt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
8
+ import { css as ss, LitElement as is, html as o, nothing as b, svg as _ } from "lit";
9
+ import { property as x, state as k, customElement as as } from "lit/decorators.js";
10
+ import { repeat as rs } from "lit/directives/repeat.js";
11
+ import { getDefaultClient as os } from "@singlebase/core";
12
+ import { a as j, e as Lt, j as ns, t as ls, b as cs } from "./files-DS-H-3yN.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 Zt = Ht`
23
+ const ds = ss`
24
24
  :host {
25
25
  --c-ink: var(--sb-ink, #16181a);
26
26
  --c-ink2: var(--sb-ink-2, #41464b);
@@ -745,6 +745,20 @@ const Zt = Ht`
745
745
  box-shadow: 0 6px 18px -10px rgba(22, 24, 26, 0.25);
746
746
  }
747
747
 
748
+ /* A starter question that hasn't arrived yet. */
749
+ .prompt.skeleton {
750
+ min-height: 62px;
751
+ cursor: default;
752
+ background: var(--c-soft, rgba(22, 24, 26, 0.04));
753
+ border-style: dashed;
754
+ animation: aiBreathe 1.6s ease-in-out infinite;
755
+ }
756
+
757
+ .prompt.skeleton:hover {
758
+ border-color: var(--c-line);
759
+ box-shadow: none;
760
+ }
761
+
748
762
  .prompt .label {
749
763
  font-size: 10.5px;
750
764
  letter-spacing: 0.06em;
@@ -1727,6 +1741,12 @@ const Zt = Ht`
1727
1741
  background: var(--c-bg);
1728
1742
  }
1729
1743
 
1744
+ .source-card .nums {
1745
+ display: inline-flex;
1746
+ flex-wrap: wrap;
1747
+ gap: 3px;
1748
+ }
1749
+
1730
1750
  .source-card .t {
1731
1751
  font-size: 13px;
1732
1752
  font-weight: 500;
@@ -1825,6 +1845,19 @@ const Zt = Ht`
1825
1845
  border: 1px solid var(--c-strong);
1826
1846
  }
1827
1847
 
1848
+ /* The passage the reader clicked, among several from one document. */
1849
+ .passage-box.current {
1850
+ border-color: var(--c-ink);
1851
+ box-shadow: 0 0 0 1px var(--c-ink);
1852
+ }
1853
+
1854
+ .passage-head {
1855
+ display: flex;
1856
+ align-items: center;
1857
+ gap: 8px;
1858
+ min-width: 0;
1859
+ }
1860
+
1828
1861
  .passage-box .text {
1829
1862
  font-size: 13px;
1830
1863
  line-height: 1.6;
@@ -2456,7 +2489,7 @@ const Zt = Ht`
2456
2489
  height: auto;
2457
2490
  }
2458
2491
  }
2459
- `, es = {
2492
+ `, ps = {
2460
2493
  eyebrowChat: "Chat",
2461
2494
  eyebrowRag: "Grounded answers",
2462
2495
  headingChat: "What can I help with?",
@@ -2504,6 +2537,10 @@ const Zt = Ht`
2504
2537
  restore: "Restore size",
2505
2538
  minimize: "Minimize chat",
2506
2539
  exportHeading: "Export this chat",
2540
+ viewOptions: "View options",
2541
+ viewHeading: "Show in answers",
2542
+ viewFollowups: "Suggested questions",
2543
+ viewSources: "Sources",
2507
2544
  exportMarkdown: "Markdown",
2508
2545
  exportJson: "JSON",
2509
2546
  exportText: "Plain text",
@@ -2532,6 +2569,7 @@ const Zt = Ht`
2532
2569
  sourceLabel: "Source {n}",
2533
2570
  openSource: "Open source {n}",
2534
2571
  citedPassage: "Cited passage",
2572
+ passageCount: "{n} passages",
2535
2573
  copyReference: "Copy passage with reference",
2536
2574
  alsoCited: "Also cited",
2537
2575
  close: "Close",
@@ -2570,33 +2608,33 @@ const Zt = Ht`
2570
2608
  closeChat: "Close chat",
2571
2609
  dismiss: "Dismiss"
2572
2610
  };
2573
- function ts(n) {
2574
- return { ...es, ...n ?? {} };
2611
+ function hs(n) {
2612
+ return { ...ps, ...n ?? {} };
2575
2613
  }
2576
- const ss = /^\|.*\|$/, $t = /^\|[\s:|-]+\|$/, Ct = /^!\[([^\]]*)\]\(([^)]*)\)$/, Tt = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/, St = /^\[( |x|X)\]\s+/, is = /^(-{3,}|\*{3,}|_{3,})$/, as = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*(.*)$/i, rs = ["note", "tip", "important", "warning", "caution"];
2577
- function os(n) {
2614
+ const us = /^\|.*\|$/, jt = /^\|[\s:|-]+\|$/, At = /^!\[([^\]]*)\]\(([^)]*)\)$/, Rt = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/, Nt = /^\[( |x|X)\]\s+/, gs = /^(-{3,}|\*{3,}|_{3,})$/, ms = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*(.*)$/i, fs = ["note", "tip", "important", "warning", "caution"];
2615
+ function bs(n) {
2578
2616
  const e = [], t = (n ?? "").replace(/\r/g, "").split("```");
2579
2617
  return t.forEach((s, i) => {
2580
2618
  if (i % 2 === 1) {
2581
2619
  const a = s.indexOf(`
2582
2620
  `), r = (a > -1 ? s.slice(0, a) : s).trim(), c = (a > -1 ? s.slice(a + 1) : "").replace(/\n$/, "");
2583
- e.push(ns(r, c, i === t.length - 1));
2621
+ e.push(vs(r, c, i === t.length - 1));
2584
2622
  return;
2585
2623
  }
2586
2624
  for (const a of s.split(/\n{2,}/))
2587
- a.trim() && e.push(...Kt(a));
2625
+ a.trim() && e.push(...Yt(a));
2588
2626
  }), e;
2589
2627
  }
2590
- function ns(n, e, t) {
2628
+ function vs(n, e, t) {
2591
2629
  const [s = "", ...i] = n.split(/\s+/), a = s.toLowerCase();
2592
2630
  if (a === "chart") {
2593
- const r = t ? null : cs(e);
2631
+ const r = t ? null : ws(e);
2594
2632
  return r ? { type: "chart", spec: r } : { type: "pending", kind: "chart" };
2595
2633
  }
2596
2634
  if (a === "svg")
2597
2635
  return t || !/<svg[\s>]/i.test(e) ? { type: "pending", kind: "svg" } : { type: "svg", source: e.trim() };
2598
2636
  if (!t && (a === "csv" || a === "tsv")) {
2599
- const r = ls(e, a === "tsv" ? " " : ",");
2637
+ const r = xs(e, a === "tsv" ? " " : ",");
2600
2638
  if (r.length > 1)
2601
2639
  return { type: "table", head: r[0], rows: r.slice(1), align: r[0].map(() => null) };
2602
2640
  }
@@ -2606,7 +2644,7 @@ function ns(n, e, t) {
2606
2644
  } catch {
2607
2645
  }
2608
2646
  if (a === "callout") {
2609
- const r = (i[0] ?? "").toLowerCase(), c = rs.includes(r);
2647
+ const r = (i[0] ?? "").toLowerCase(), c = fs.includes(r);
2610
2648
  return {
2611
2649
  type: "callout",
2612
2650
  kind: c ? r : "note",
@@ -2616,30 +2654,30 @@ function ns(n, e, t) {
2616
2654
  }
2617
2655
  return { type: "code", lang: a || "code", text: e };
2618
2656
  }
2619
- function Kt(n) {
2657
+ function Yt(n) {
2620
2658
  const e = n.split(`
2621
2659
  `).filter((i) => i.trim()), t = e.map((i) => i.trim());
2622
- if (t.length > 1 && t.every((i) => ss.test(i))) {
2623
- const i = (f) => f.replace(/^\||\|$/g, "").split("|").map((b) => b.trim()), a = t.findIndex((f) => $t.test(f)), r = a > -1 ? i(t[a]).map(
2624
- (f) => /^:-+:$/.test(f) ? "center" : /^-+:$/.test(f) ? "right" : /^:-+$/.test(f) ? "left" : null
2625
- ) : [], c = t.filter((f) => !$t.test(f)).map(i), l = c[0] ?? [];
2660
+ if (t.length > 1 && t.every((i) => us.test(i))) {
2661
+ const i = (m) => m.replace(/^\||\|$/g, "").split("|").map((v) => v.trim()), a = t.findIndex((m) => jt.test(m)), r = a > -1 ? i(t[a]).map(
2662
+ (m) => /^:-+:$/.test(m) ? "center" : /^-+:$/.test(m) ? "right" : /^:-+$/.test(m) ? "left" : null
2663
+ ) : [], c = t.filter((m) => !jt.test(m)).map(i), l = c[0] ?? [];
2626
2664
  return [
2627
- { type: "table", head: l, rows: c.slice(1), align: l.map((f, b) => r[b] ?? null) }
2665
+ { type: "table", head: l, rows: c.slice(1), align: l.map((m, v) => r[v] ?? null) }
2628
2666
  ];
2629
2667
  }
2630
- if (t.length === 1 && is.test(t[0])) return [{ type: "hr" }];
2631
- if (t.every((i) => Ct.test(i)))
2668
+ if (t.length === 1 && gs.test(t[0])) return [{ type: "hr" }];
2669
+ if (t.every((i) => At.test(i)))
2632
2670
  return [
2633
2671
  {
2634
2672
  type: "img",
2635
2673
  images: t.map((i) => {
2636
- const a = i.match(Ct);
2674
+ const a = i.match(At);
2637
2675
  return { alt: a[1], src: a[2] };
2638
2676
  })
2639
2677
  }
2640
2678
  ];
2641
2679
  if (t.every((i) => i.startsWith(">"))) {
2642
- const i = t.map((r) => r.replace(/^>\s?/, "")), a = i[0].match(as);
2680
+ const i = t.map((r) => r.replace(/^>\s?/, "")), a = i[0].match(ms);
2643
2681
  return a ? [
2644
2682
  {
2645
2683
  type: "callout",
@@ -2650,14 +2688,14 @@ function Kt(n) {
2650
2688
  }
2651
2689
  ] : [{ type: "quote", text: i.join(" ") }];
2652
2690
  }
2653
- if (Tt.test(e[0])) {
2691
+ if (Rt.test(e[0])) {
2654
2692
  const i = [];
2655
2693
  for (const a of e) {
2656
- const r = a.match(Tt);
2694
+ const r = a.match(Rt);
2657
2695
  if (r) {
2658
- const c = r[3].match(St);
2696
+ const c = r[3].match(Nt);
2659
2697
  i.push({
2660
- text: c ? r[3].replace(St, "") : r[3],
2698
+ text: c ? r[3].replace(Nt, "") : r[3],
2661
2699
  depth: Math.min(3, Math.floor(r[1].replace(/\t/g, " ").length / 2)),
2662
2700
  checked: c ? c[1] !== " " : null
2663
2701
  });
@@ -2672,26 +2710,26 @@ function Kt(n) {
2672
2710
  `);
2673
2711
  return [
2674
2712
  { type: "h", level: s[1].length, text: s[2] },
2675
- ...i ? Kt(i) : []
2713
+ ...i ? Yt(i) : []
2676
2714
  ];
2677
2715
  }
2678
2716
  return [{ type: "p", text: t.join(" ") }];
2679
2717
  }
2680
- function ls(n, e = ",") {
2718
+ function xs(n, e = ",") {
2681
2719
  var l;
2682
2720
  const t = [];
2683
2721
  let s = [], i = "", a = !1;
2684
2722
  const r = n.replace(/\r/g, "");
2685
- for (let f = 0; f < r.length; f++) {
2686
- const b = r[f];
2687
- a ? b === '"' && r[f + 1] === '"' ? (i += '"', f++) : b === '"' ? a = !1 : i += b : b === '"' && i === "" ? a = !0 : b === e ? (s.push(i.trim()), i = "") : b === `
2688
- ` ? (s.push(i.trim()), s.some(Boolean) && t.push(s), s = [], i = "") : i += b;
2723
+ for (let m = 0; m < r.length; m++) {
2724
+ const v = r[m];
2725
+ a ? v === '"' && r[m + 1] === '"' ? (i += '"', m++) : v === '"' ? a = !1 : i += v : v === '"' && i === "" ? a = !0 : v === e ? (s.push(i.trim()), i = "") : v === `
2726
+ ` ? (s.push(i.trim()), s.some(Boolean) && t.push(s), s = [], i = "") : i += v;
2689
2727
  }
2690
2728
  s.push(i.trim()), s.some(Boolean) && t.push(s);
2691
2729
  const c = ((l = t[0]) == null ? void 0 : l.length) ?? 0;
2692
- return t.map((f) => f.length < c ? [...f, ...Array(c - f.length).fill("")] : f);
2730
+ return t.map((m) => m.length < c ? [...m, ...Array(c - m.length).fill("")] : m);
2693
2731
  }
2694
- function cs(n) {
2732
+ function ws(n) {
2695
2733
  let e;
2696
2734
  try {
2697
2735
  e = JSON.parse(n);
@@ -2713,7 +2751,7 @@ function cs(n) {
2713
2751
  series: t
2714
2752
  };
2715
2753
  }
2716
- const It = new RegExp(
2754
+ const Et = new RegExp(
2717
2755
  [
2718
2756
  /\*\*([^*]+)\*\*/.source,
2719
2757
  // 1 bold
@@ -2734,16 +2772,16 @@ const It = new RegExp(
2734
2772
  ].join("|"),
2735
2773
  "g"
2736
2774
  );
2737
- function ds(n, e = 0) {
2775
+ function ys(n, e = 0) {
2738
2776
  const t = [];
2739
2777
  let s = 0, i;
2740
- It.lastIndex = 0;
2778
+ Et.lastIndex = 0;
2741
2779
  const a = (r) => {
2742
2780
  if (!r) return;
2743
2781
  const c = t[t.length - 1];
2744
2782
  (c == null ? void 0 : c.type) === "text" ? c.text += r : t.push({ type: "text", text: r });
2745
2783
  };
2746
- for (; i = It.exec(n); ) {
2784
+ for (; i = Et.exec(n); ) {
2747
2785
  if (a(n.slice(s, i.index)), i[1] !== void 0) t.push({ type: "bold", text: i[1] });
2748
2786
  else if (i[2] !== void 0) t.push({ type: "strike", text: i[2] });
2749
2787
  else if (i[3] !== void 0) t.push({ type: "code", text: i[3] });
@@ -2759,7 +2797,7 @@ function ds(n, e = 0) {
2759
2797
  }
2760
2798
  return a(n.slice(s)), t;
2761
2799
  }
2762
- function ps(n) {
2800
+ function ks(n) {
2763
2801
  if (((n ?? "").match(/```/g) ?? []).length % 2 === 1) return n;
2764
2802
  const e = n.lastIndexOf(`
2765
2803
 
@@ -2776,13 +2814,13 @@ function ps(n) {
2776
2814
  }
2777
2815
  return t + s;
2778
2816
  }
2779
- function Ot(n) {
2817
+ function Bt(n) {
2780
2818
  const e = /* @__PURE__ */ new Set();
2781
2819
  for (const t of (n ?? "").match(/\[(\d+(?:\s*,\s*\d+)*)\]/g) ?? [])
2782
2820
  t.replace(/[[\]]/g, "").split(",").forEach((s) => e.add(Number(s.trim())));
2783
2821
  return e;
2784
2822
  }
2785
- function hs(n) {
2823
+ function $s(n) {
2786
2824
  return [
2787
2825
  ["", ...n.series.map((e) => e.name)],
2788
2826
  ...n.labels.map((e, t) => [
@@ -2791,24 +2829,24 @@ function hs(n) {
2791
2829
  ])
2792
2830
  ];
2793
2831
  }
2794
- const Mt = (n) => n.map((e) => e.join(" · ")).join(`
2795
- `), us = {
2832
+ const Ft = (n) => n.map((e) => e.join(" · ")).join(`
2833
+ `), Cs = {
2796
2834
  note: "Note",
2797
2835
  tip: "Tip",
2798
2836
  important: "Important",
2799
2837
  warning: "Warning",
2800
2838
  caution: "Caution"
2801
2839
  };
2802
- function gs(n, e) {
2840
+ function Ss(n, e) {
2803
2841
  if (e === "rich") return n;
2804
2842
  const t = e === "plain";
2805
2843
  return n.map((s) => {
2806
2844
  switch (s.type) {
2807
2845
  case "chart": {
2808
- const [i, ...a] = hs(s.spec);
2846
+ const [i, ...a] = $s(s.spec);
2809
2847
  return t ? {
2810
2848
  type: "raw",
2811
- text: [s.spec.title, Mt([i, ...a])].filter(Boolean).join(`
2849
+ text: [s.spec.title, Ft([i, ...a])].filter(Boolean).join(`
2812
2850
  `)
2813
2851
  } : {
2814
2852
  type: "table",
@@ -2822,7 +2860,7 @@ function gs(n, e) {
2822
2860
  case "callout":
2823
2861
  return {
2824
2862
  type: "quote",
2825
- text: `**${s.title || us[s.kind]}** ${s.text}`.trim()
2863
+ text: `**${s.title || Cs[s.kind]}** ${s.text}`.trim()
2826
2864
  };
2827
2865
  case "img":
2828
2866
  return {
@@ -2830,7 +2868,7 @@ function gs(n, e) {
2830
2868
  text: s.images.map((i) => `Image: ${i.alt || "untitled"}`).join(" · ")
2831
2869
  };
2832
2870
  case "table":
2833
- return t ? { type: "raw", text: Mt([s.head, ...s.rows]) } : s;
2871
+ return t ? { type: "raw", text: Ft([s.head, ...s.rows]) } : s;
2834
2872
  case "json":
2835
2873
  return t ? { type: "code", lang: "json", text: s.source } : s;
2836
2874
  case "svg":
@@ -2840,32 +2878,32 @@ function gs(n, e) {
2840
2878
  }
2841
2879
  });
2842
2880
  }
2843
- function zt(n) {
2881
+ function Dt(n) {
2844
2882
  const e = n ?? "", t = e.search(/FOLLOWUPS:/i);
2845
2883
  if (t < 0) return { text: e.trim(), followups: [] };
2846
2884
  const i = e.slice(t).replace(/^FOLLOWUPS:/i, "").split(/\||\n/).map((a) => a.replace(/^\s*(?:[-*↳→]|\d+[.)])\s*/, "").trim()).filter(Boolean).slice(0, 3);
2847
2885
  return { text: e.slice(0, t).trim(), followups: i };
2848
2886
  }
2849
- function ms(n) {
2887
+ function Ts(n) {
2850
2888
  return (n ?? "").replace(
2851
2889
  /```(\w*)[\s\S]*?(```|$)/g,
2852
2890
  (e, t) => t === "chart" ? "[Chart] " : t === "svg" ? "[Drawing] " : "[Code] "
2853
2891
  ).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();
2854
2892
  }
2855
- function fs(n, e = 48) {
2856
- const t = ms(n);
2893
+ function Kt(n, e = 48) {
2894
+ const t = Ts(n);
2857
2895
  if (t.length <= e) return t;
2858
2896
  const s = t.slice(0, e), i = s.lastIndexOf(" ");
2859
2897
  return (i > e / 2 ? s.slice(0, i) : s).trim();
2860
2898
  }
2861
- function bs(n) {
2899
+ function Os(n) {
2862
2900
  return String(n ?? "").split(`
2863
2901
  `)[0].trim().replace(/^["'“”‘’]+|["'“”‘’]+$/g, "").replace(/^title:\s*/i, "").replace(/[.!?:;,]+$/, "").trim().slice(0, 80);
2864
2902
  }
2865
- function _t(n, e = !1) {
2903
+ function Pt(n, e = !1) {
2866
2904
  return /^https?:\/\//i.test(n) ? !0 : e && /^(blob:|data:image\/)/i.test(n);
2867
2905
  }
2868
- const xs = 2e5, vs = /* @__PURE__ */ new Set([
2906
+ const Is = 2e5, Ms = /* @__PURE__ */ new Set([
2869
2907
  "script",
2870
2908
  "foreignobject",
2871
2909
  "iframe",
@@ -2881,23 +2919,23 @@ const xs = 2e5, vs = /* @__PURE__ */ new Set([
2881
2919
  "handler",
2882
2920
  "listener"
2883
2921
  ]);
2884
- function ws(n) {
2885
- if (!n || n.length > xs || typeof DOMParser > "u") return null;
2922
+ function _s(n) {
2923
+ if (!n || n.length > Is || typeof DOMParser > "u") return null;
2886
2924
  const e = new DOMParser().parseFromString(n, "image/svg+xml"), t = e.documentElement;
2887
2925
  if (!t || t.nodeName.toLowerCase() !== "svg" || e.querySelector("parsererror"))
2888
2926
  return null;
2889
2927
  const s = (a) => {
2890
2928
  for (const r of Array.from(a.children)) {
2891
2929
  const c = r.nodeName.toLowerCase();
2892
- if (vs.has(c)) r.remove();
2930
+ if (Ms.has(c)) r.remove();
2893
2931
  else if (c === "a") {
2894
2932
  const l = Array.from(r.childNodes);
2895
- r.replaceWith(...l), l.forEach((f) => f instanceof Element && s(f));
2933
+ r.replaceWith(...l), l.forEach((m) => m instanceof Element && s(m));
2896
2934
  } else s(r);
2897
2935
  }
2898
2936
  for (const r of Array.from(a.attributes)) {
2899
- const c = r.name.toLowerCase(), l = r.value.trim().toLowerCase(), f = (c === "href" || c.endsWith(":href")) && !l.startsWith("#"), b = l.includes("javascript:") || /url\(\s*['"]?(?!#)/.test(l);
2900
- (c.startsWith("on") || f || b) && a.removeAttribute(r.name);
2937
+ const c = r.name.toLowerCase(), l = r.value.trim().toLowerCase(), m = (c === "href" || c.endsWith(":href")) && !l.startsWith("#"), v = l.includes("javascript:") || /url\(\s*['"]?(?!#)/.test(l);
2938
+ (c.startsWith("on") || m || v) && a.removeAttribute(r.name);
2901
2939
  }
2902
2940
  };
2903
2941
  s(t);
@@ -2907,12 +2945,12 @@ function ws(n) {
2907
2945
  const i = new XMLSerializer().serializeToString(t);
2908
2946
  return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`;
2909
2947
  }
2910
- var Pt = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, ks = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, g = (n, e, t, s) => {
2911
- for (var i = s > 1 ? void 0 : s ? ys(e, t) : e, a = n.length - 1, r; a >= 0; a--)
2948
+ var Qt = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, Ls = (n, e, t) => e in n ? Qt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, g = (n, e, t, s) => {
2949
+ for (var i = s > 1 ? void 0 : s ? zs(e, t) : e, a = n.length - 1, r; a >= 0; a--)
2912
2950
  (r = n[a]) && (i = (s ? r(e, t, i) : r(i)) || i);
2913
- return s && i && Pt(e, t, i), i;
2914
- }, $s = (n, e, t) => ks(n, e + "", t);
2915
- const Lt = [
2951
+ return s && i && Qt(e, t, i), i;
2952
+ }, js = (n, e, t) => Ls(n, e + "", t);
2953
+ const Ut = [
2916
2954
  "embed",
2917
2955
  "mode",
2918
2956
  "format",
@@ -2929,6 +2967,7 @@ const Lt = [
2929
2967
  "description",
2930
2968
  "eyebrow",
2931
2969
  "prompts",
2970
+ "chatKey",
2932
2971
  "bubbleText",
2933
2972
  "greetingBubble",
2934
2973
  "unreadBadge",
@@ -2951,6 +2990,7 @@ const Lt = [
2951
2990
  "saveAttachments",
2952
2991
  "showFollowups",
2953
2992
  "showSources",
2993
+ "allowViewOptions",
2954
2994
  "showNewChat",
2955
2995
  "showBookmarked",
2956
2996
  "allowSearch",
@@ -2963,7 +3003,7 @@ const Lt = [
2963
3003
  "messages",
2964
3004
  "theme",
2965
3005
  "radius"
2966
- ], vt = {
3006
+ ], Mt = {
2967
3007
  fromAttribute: (n) => {
2968
3008
  if (n)
2969
3009
  try {
@@ -2974,33 +3014,33 @@ const Lt = [
2974
3014
  }
2975
3015
  },
2976
3016
  toAttribute: (n) => JSON.stringify(n ?? null)
2977
- }, I = {
3017
+ }, M = {
2978
3018
  fromAttribute: (n) => n === null ? !0 : n !== "false",
2979
3019
  toAttribute: (n) => n ? null : "false"
2980
- }, Cs = {
3020
+ }, As = {
2981
3021
  fromAttribute: (n) => n === null ? "auto" : n === "" || n === "true" ? "open" : n === "false" ? "closed" : ["auto", "open", "closed", "none"].includes(n) ? n : "auto",
2982
3022
  toAttribute: (n) => n === "auto" ? null : n
2983
- }, Ts = 272, Ss = 820, Is = 940, At = 5, jt = 512 * 1024, Os = /\.(md|markdown|txt|csv|tsv|json|html?|ya?ml|xml|log)$/i, Ms = 5e3, zs = 200, Nt = 2e3, _s = {
3023
+ }, Rs = 272, Ns = 820, Es = 940, Ht = 5, Wt = 512 * 1024, Bs = /\.(md|markdown|txt|csv|tsv|json|html?|ya?ml|xml|log)$/i, Fs = 5e3, Ds = 200, Vt = 2e3, Ks = {
2984
3024
  note: "calloutNote",
2985
3025
  tip: "calloutTip",
2986
3026
  important: "calloutImportant",
2987
3027
  warning: "calloutWarning",
2988
3028
  caution: "calloutCaution"
2989
- }, Ls = 2600, j = [
3029
+ }, Ps = 2600, A = [
2990
3030
  "var(--c-ink)",
2991
3031
  "oklch(0.58 0.13 255)",
2992
3032
  "oklch(0.63 0.1 175)",
2993
3033
  "oklch(0.74 0.12 70)"
2994
- ], Rt = {
3034
+ ], Jt = {
2995
3035
  chat: "Be helpful and concise. Use Markdown when it helps: headings, lists, **bold**, code blocks and tables.",
2996
3036
  rag: "Prefer the sources provided with each message, numbered in the order given, and put a citation like [1] right after each claim they support. If they don't cover the question, you may answer from general knowledge, but say clearly that it isn't from the sources.",
2997
3037
  kb: "Answer ONLY from the sources provided with each message, numbered in the order given. Put a citation like [1] right after each claim. Do not use outside knowledge. If the sources don't contain the answer, say that you can't find it in the available sources."
2998
- }, As = {
3038
+ }, Us = {
2999
3039
  raw: "Reply in plain text. Don't use Markdown or any other markup.",
3000
3040
  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.",
3001
3041
  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.`,
3002
3042
  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 ![alt](https://…).'
3003
- }, js = "After the answer, on a final line write FOLLOWUPS: followed by three short follow-up questions the user might ask next, separated by |.", Et = {
3043
+ }, Hs = "After the answer, on a final line write FOLLOWUPS: followed by three short follow-up questions the user might ask next, separated by |.", qt = {
3004
3044
  chat: [
3005
3045
  ["Write", "Draft a short welcome email for new users"],
3006
3046
  ["Explain", "Explain how refresh tokens work, simply"],
@@ -3019,20 +3059,20 @@ const Lt = [
3019
3059
  ["Limits", "What are the plan limits?"],
3020
3060
  ["Policy", "What happens when my account is deleted?"]
3021
3061
  ]
3022
- }, z = (n, e = "") => o`<svg class="i ${e}" viewBox="0 0 16 16" aria-hidden="true">${n}</svg>`, k = {
3062
+ }, z = (n, e = "") => o`<svg class="i ${e}" viewBox="0 0 16 16" aria-hidden="true">${n}</svg>`, $ = {
3023
3063
  sidebar: () => z(
3024
- O`<rect x="2" y="2.5" width="12" height="11" rx="1.5"></rect><path d="M6 2.5v11"></path>`
3064
+ _`<rect x="2" y="2.5" width="12" height="11" rx="1.5"></rect><path d="M6 2.5v11"></path>`
3025
3065
  ),
3026
- plus: () => z(O`<path d="M8 3v10M3 8h10"></path>`),
3027
- bookmark: (n = !1) => z(O`<path d="M4.5 2.5h7v11L8 11l-3.5 2.5z"></path>`, n ? "filled" : ""),
3028
- download: () => z(O`<path d="M8 2.5v8M4.5 7.5L8 11l3.5-3.5M2.5 13.5h11"></path>`),
3029
- trash: () => z(O`<path d="M2.5 4.5h11M6.5 4.5v-2h3v2M4 4.5l.7 9h6.6l.7-9"></path>`),
3030
- pencil: () => z(O`<path d="M10.5 2.5l3 3L6 13H3v-3z"></path>`),
3066
+ plus: () => z(_`<path d="M8 3v10M3 8h10"></path>`),
3067
+ bookmark: (n = !1) => z(_`<path d="M4.5 2.5h7v11L8 11l-3.5 2.5z"></path>`, n ? "filled" : ""),
3068
+ download: () => z(_`<path d="M8 2.5v8M4.5 7.5L8 11l3.5-3.5M2.5 13.5h11"></path>`),
3069
+ trash: () => z(_`<path d="M2.5 4.5h11M6.5 4.5v-2h3v2M4 4.5l.7 9h6.6l.7-9"></path>`),
3070
+ pencil: () => z(_`<path d="M10.5 2.5l3 3L6 13H3v-3z"></path>`),
3031
3071
  copy: () => z(
3032
- O`<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>`
3072
+ _`<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>`
3033
3073
  ),
3034
- raw: () => z(O`<path d="M5.5 4.5L2 8l3.5 3.5M10.5 4.5L14 8l-3.5 3.5"></path>`),
3035
- refresh: () => z(O`<path d="M13.5 8A5.5 5.5 0 1 1 11.9 4.1M13.5 2v3.5H10"></path>`),
3074
+ raw: () => z(_`<path d="M5.5 4.5L2 8l3.5 3.5M10.5 4.5L14 8l-3.5 3.5"></path>`),
3075
+ refresh: () => z(_`<path d="M13.5 8A5.5 5.5 0 1 1 11.9 4.1M13.5 2v3.5H10"></path>`),
3036
3076
  thumb: (n = !1) => o`<svg
3037
3077
  class="i"
3038
3078
  viewBox="0 0 16 16"
@@ -3043,15 +3083,19 @@ const Lt = [
3043
3083
  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"
3044
3084
  ></path>
3045
3085
  </svg>`,
3046
- expand: () => z(O`<path d="M9.5 2.5h4v4M13.5 2.5L9 7M6.5 13.5h-4v-4M2.5 13.5L7 9"></path>`),
3047
- restore: () => z(O`<path d="M13.5 6.5h-4v-4M9.5 6.5l4-4M2.5 9.5h4v4M6.5 9.5l-4 4"></path>`),
3048
- minimize: () => z(O`<path d="M4 8h8"></path>`),
3049
- close: () => z(O`<path d="M4 4l8 8M12 4l-8 8"></path>`),
3086
+ expand: () => z(_`<path d="M9.5 2.5h4v4M13.5 2.5L9 7M6.5 13.5h-4v-4M2.5 13.5L7 9"></path>`),
3087
+ restore: () => z(_`<path d="M13.5 6.5h-4v-4M9.5 6.5l4-4M2.5 9.5h4v4M6.5 9.5l-4 4"></path>`),
3088
+ minimize: () => z(_`<path d="M4 8h8"></path>`),
3089
+ view: () => z(
3090
+ _`<path d="M2.5 4.5h7M12.5 4.5h1M2.5 11.5h1M6.5 11.5h7"></path><circle cx="11" cy="4.5" r="1.5"></circle><circle cx="5" cy="11.5" r="1.5"></circle>`
3091
+ ),
3092
+ check: () => z(_`<path d="M3.5 8.5l3 3 6-7"></path>`),
3093
+ close: () => z(_`<path d="M4 4l8 8M12 4l-8 8"></path>`),
3050
3094
  clip: () => z(
3051
- O`<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>`
3095
+ _`<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>`
3052
3096
  ),
3053
- up: () => z(O`<path d="M8 13V3M3.5 7.5L8 3l4.5 4.5"></path>`),
3054
- stop: () => z(O`<rect x="4.5" y="4.5" width="7" height="7" rx="1"></rect>`),
3097
+ up: () => z(_`<path d="M8 13V3M3.5 7.5L8 3l4.5 4.5"></path>`),
3098
+ stop: () => z(_`<rect x="4.5" y="4.5" width="7" height="7" rx="1"></rect>`),
3055
3099
  chat: () => o`<svg
3056
3100
  width="22"
3057
3101
  height="22"
@@ -3073,35 +3117,60 @@ const Lt = [
3073
3117
  <path d="M5 8l5 5 5-5"></path>
3074
3118
  </svg>`
3075
3119
  };
3076
- let Ns = 0;
3077
- const bt = () => `m${Date.now().toString(36)}${(Ns++).toString(36)}`;
3078
- function Bt(n) {
3120
+ let Ws = 0;
3121
+ const St = () => `m${Date.now().toString(36)}${(Ws++).toString(36)}`, Zt = "singlebase-chat:view";
3122
+ function Vs() {
3123
+ var n;
3124
+ try {
3125
+ const e = JSON.parse(((n = globalThis.localStorage) == null ? void 0 : n.getItem(Zt)) ?? "{}");
3126
+ return { followups: (e == null ? void 0 : e.followups) === !0, sources: (e == null ? void 0 : e.sources) === !0 };
3127
+ } catch {
3128
+ return {};
3129
+ }
3130
+ }
3131
+ function Js(n) {
3132
+ var e;
3133
+ try {
3134
+ (e = globalThis.localStorage) == null || e.setItem(Zt, JSON.stringify(n));
3135
+ } catch {
3136
+ }
3137
+ }
3138
+ function Tt(n) {
3079
3139
  var t;
3080
3140
  const e = n;
3081
3141
  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;
3082
3142
  }
3083
- function Rs(n) {
3143
+ function qs(n) {
3084
3144
  const e = n;
3085
3145
  return (e == null ? void 0 : e.code) || (e == null ? void 0 : e.message) || "UNKNOWN";
3086
3146
  }
3087
- const Es = () => typeof matchMedia < "u" && matchMedia("(prefers-reduced-motion: reduce)").matches, mt = (n, e) => (Number.isInteger(n) ? n.toLocaleString("en-US") : n.toFixed(1)) + e, xt = (n) => {
3147
+ const Gs = () => typeof matchMedia < "u" && matchMedia("(prefers-reduced-motion: reduce)").matches, yt = (n, e) => (Number.isInteger(n) ? n.toLocaleString("en-US") : n.toFixed(1)) + e, Ot = (n) => {
3088
3148
  const e = n.lastIndexOf(".");
3089
3149
  return e > 0 ? n.slice(e + 1, e + 5).toUpperCase() : "FILE";
3090
3150
  };
3091
- function ft(n, e) {
3092
- const t = n ?? {}, s = t.metadata && typeof t.metadata == "object" ? t.metadata : {}, i = (...l) => l.find((f) => typeof f == "string" && f.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"), c = typeof t.n == "number" && t.n > 0 ? t.n : e;
3151
+ function kt(n, e) {
3152
+ const t = n ?? {}, s = t.metadata && typeof t.metadata == "object" ? t.metadata : {}, i = (...T) => T.find((I) => typeof I == "string" && I.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((T) => typeof T == "number"), c = typeof t.n == "number" && t.n > 0 ? t.n : e, l = i(t.title, t.name, t.filename, s.title, s.name) ?? `Source ${c}`, m = i(t.path, t.url, t.key, s.path, s.url) ?? "", v = i(t.collection, t.namespace, t.dbname, s.collection) ?? "", S = i(t.document_id, t.id, t._id, t.attachment_id, t.file_id, s.document_id) ?? (m || l);
3093
3153
  return {
3094
3154
  n: c,
3095
- title: i(t.title, t.name, t.filename, s.title, s.name) ?? `Source ${c}`,
3155
+ doc: `${typeof t.type == "string" ? t.type : ""}|${v}|${S}`,
3156
+ title: l,
3096
3157
  section: i(t.section, t.heading, s.section) ?? "",
3097
- path: i(t.path, t.url, t.key, s.path, s.url) ?? "",
3098
- collection: i(t.collection, t.namespace, t.dbname, s.collection) ?? "",
3158
+ path: m,
3159
+ collection: v,
3099
3160
  updated: i(t.updated, t._modified_at, s.updated) ?? "",
3100
3161
  text: a,
3101
3162
  score: r === void 0 ? null : Math.max(0, Math.min(1, r))
3102
3163
  };
3103
3164
  }
3104
- function Dt(n) {
3165
+ function It(n) {
3166
+ const e = /* @__PURE__ */ new Map();
3167
+ for (const t of n) {
3168
+ const s = e.get(t.doc);
3169
+ s ? s.items.push(t) : e.set(t.doc, { doc: t.doc, first: t, items: [t] });
3170
+ }
3171
+ return [...e.values()];
3172
+ }
3173
+ function Gt(n) {
3105
3174
  return Array.isArray(n) ? n.filter((e) => e && typeof e == "object" && (e._id || e.id)).filter((e) => e.saved !== !1 && e.status !== "failed").map((e) => ({
3106
3175
  id: String(e._id ?? e.id),
3107
3176
  name: String(e.name ?? "file"),
@@ -3111,20 +3180,20 @@ function Dt(n) {
3111
3180
  status: e.status
3112
3181
  })) : [];
3113
3182
  }
3114
- function Bs(n) {
3183
+ function Xs(n) {
3115
3184
  const e = [], t = [];
3116
3185
  for (const s of n)
3117
- if (/\.csv$/i.test(s.name)) e.push({ type: "csv", data: s.content });
3186
+ if (/\.csv$/i.test(s.name)) e.push({ source: "csv", data: s.content });
3118
3187
  else if (/\.json$/i.test(s.name))
3119
3188
  try {
3120
- e.push({ type: "json", data: JSON.parse(s.content) });
3189
+ e.push({ source: "json", data: JSON.parse(s.content) });
3121
3190
  } catch {
3122
3191
  t.push({ title: s.name, content: s.content });
3123
3192
  }
3124
3193
  else t.push({ title: s.name, content: s.content });
3125
- return t.length && e.push({ type: "docs", payload: { documents: t } }), e;
3194
+ return t.length && e.push({ source: "docs", payload: { documents: t } }), e;
3126
3195
  }
3127
- function Ds(n) {
3196
+ function Ys(n) {
3128
3197
  const e = n ? Date.parse(n) : NaN;
3129
3198
  if (Number.isNaN(e)) return "older";
3130
3199
  const t = /* @__PURE__ */ new Date();
@@ -3132,130 +3201,145 @@ function Ds(n) {
3132
3201
  const s = 864e5;
3133
3202
  return e >= t.getTime() ? "today" : e >= t.getTime() - s ? "yesterday" : e >= t.getTime() - 7 * s ? "week" : "older";
3134
3203
  }
3135
- var N, R, E, B, D, F, K, P, U, W, H, J, 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, Ie, Oe, Me, ze, _e, Le, Ae, je, Ne, Re, Ee, Be, De, Fe, Ke, Pe, Ue, We, He, Je, Ge, qe, Ve, Xe, Ye, Qe, Ze, et, tt, st, it, at, rt, ot, nt, lt, ct, dt, pt, ht, ut, gt, Ft;
3136
- let d = (Ft = class extends Jt {
3204
+ var R, N, E, B, F, D, K, P, U, H, W, V, J, q, G, X, Y, Q, Z, ee, te, se, ie, ae, re, oe, ne, le, ce, de, pe, he, ue, ge, me, fe, be, ve, xe, we, ye, ke, $e, Ce, Se, Te, Oe, Ie, Me, _e, ze, Le, je, Ae, Re, Ne, Ee, Be, Fe, De, Ke, Pe, Ue, He, We, Ve, Je, qe, Ge, Xe, Ye, Qe, Ze, et, tt, st, it, at, rt, ot, nt, lt, ct, dt, pt, ht, ut, gt, mt, ft, bt, vt, xt, wt, Xt;
3205
+ let d = (Xt = class extends is {
3137
3206
  constructor() {
3138
3207
  super(...arguments);
3139
- h(this, N, null);
3140
- h(this, R, {});
3208
+ h(this, R, null);
3209
+ h(this, N, {});
3141
3210
  h(this, E);
3142
3211
  h(this, B);
3143
- h(this, D, "chat");
3144
- h(this, F, "advanced");
3212
+ h(this, F, "chat");
3213
+ h(this, D, "advanced");
3145
3214
  h(this, K, {});
3146
3215
  h(this, P, null);
3147
3216
  h(this, U, null);
3148
- h(this, W, "subtle");
3149
- h(this, H, "");
3150
- h(this, J, "retrieval");
3151
- h(this, G, !0);
3217
+ h(this, H, "subtle");
3218
+ h(this, W, "");
3219
+ h(this, V, "payload");
3220
+ h(this, J, !0);
3152
3221
  h(this, q, !0);
3153
- h(this, V, !0);
3222
+ h(this, G, !0);
3154
3223
  h(this, X, !0);
3155
3224
  h(this, Y, !0);
3156
3225
  h(this, Q, !0);
3157
- h(this, Z, !0);
3226
+ h(this, Z, !1);
3158
3227
  h(this, ee, !0);
3159
- h(this, te, "");
3160
- h(this, se, {});
3161
- h(this, ie, "");
3162
- h(this, ae, []);
3163
- h(this, re, {});
3164
- h(this, oe, "page");
3165
- h(this, ne, "right");
3166
- h(this, le, "auto");
3167
- h(this, ce, !0);
3168
- h(this, de, "");
3169
- h(this, pe, "Assistant");
3228
+ h(this, te, !0);
3229
+ h(this, se, "");
3230
+ h(this, ie, {});
3231
+ h(this, ae, "");
3232
+ h(this, re, []);
3233
+ h(this, oe, {});
3234
+ h(this, ne, "page");
3235
+ h(this, le, "right");
3236
+ h(this, ce, "auto");
3237
+ h(this, de, !0);
3238
+ h(this, pe, "");
3170
3239
  h(this, he, "");
3171
- h(this, ue, "");
3240
+ h(this, ue, "Assistant");
3172
3241
  h(this, ge, "");
3173
- h(this, me);
3242
+ h(this, me, "");
3174
3243
  h(this, fe, "");
3175
- h(this, be, "");
3176
- h(this, xe, !1);
3177
- h(this, ve, !1);
3178
- h(this, we, !0);
3179
- h(this, ye, !0);
3244
+ h(this, be);
3245
+ h(this, ve, "");
3246
+ h(this, xe, "");
3247
+ h(this, we, !1);
3248
+ h(this, ye, !1);
3180
3249
  h(this, ke, !0);
3181
3250
  h(this, $e, !0);
3182
3251
  h(this, Ce, !0);
3183
- h(this, Te, !0);
3184
3252
  h(this, Se, !0);
3185
- h(this, Ie, !0);
3253
+ h(this, Te, !0);
3186
3254
  h(this, Oe, !0);
3255
+ h(this, Ie, !0);
3187
3256
  h(this, Me, !0);
3188
- h(this, ze);
3189
- h(this, _e, !1);
3190
- h(this, Le, !0);
3191
- h(this, Ae, []);
3192
- h(this, je, "idle");
3193
- h(this, Ne, null);
3194
- h(this, Re, "");
3195
- h(this, Ee, !1);
3196
- h(this, Be, []);
3197
- h(this, De, !1);
3198
- h(this, Fe, "");
3257
+ h(this, _e, !0);
3258
+ h(this, ze, !0);
3259
+ h(this, Le);
3260
+ h(this, je, !1);
3261
+ h(this, Ae, !0);
3262
+ h(this, Re, []);
3263
+ h(this, Ne, "idle");
3264
+ h(this, Ee, null);
3265
+ h(this, Be, "");
3266
+ h(this, Fe, !1);
3267
+ h(this, De, []);
3199
3268
  h(this, Ke, !1);
3200
3269
  h(this, Pe, "");
3201
- h(this, Ue, []);
3202
- h(this, We, "");
3203
- h(this, He, null);
3204
- h(this, Je, 0);
3205
- h(this, Ge, null);
3206
- h(this, qe, !1);
3270
+ h(this, Ue, !1);
3271
+ h(this, He, "");
3272
+ h(this, We, []);
3207
3273
  h(this, Ve, "");
3208
- h(this, Xe, "");
3274
+ h(this, Je, null);
3275
+ h(this, qe, 0);
3276
+ h(this, Ge, null);
3277
+ h(this, Xe, !1);
3209
3278
  h(this, Ye, !1);
3210
- h(this, Qe, "");
3211
- h(this, Ze, null);
3279
+ h(this, Qe, Vs());
3280
+ h(this, Ze, "");
3212
3281
  h(this, et, "");
3213
- h(this, tt, /* @__PURE__ */ new Set());
3214
- h(this, st, /* @__PURE__ */ new Set());
3215
- h(this, it, []);
3216
- h(this, at, !1);
3217
- h(this, rt, /* @__PURE__ */ new Map());
3218
- h(this, ot, "");
3219
- h(this, nt, !1);
3282
+ h(this, tt, !1);
3283
+ h(this, st, "");
3284
+ h(this, it, null);
3285
+ h(this, at, "");
3286
+ h(this, rt, /* @__PURE__ */ new Set());
3287
+ h(this, ot, /* @__PURE__ */ new Set());
3288
+ h(this, nt, []);
3220
3289
  h(this, lt, !1);
3221
- h(this, ct, !1);
3222
- h(this, dt, !1);
3290
+ h(this, ct, /* @__PURE__ */ new Map());
3291
+ h(this, dt, "");
3223
3292
  h(this, pt, !1);
3224
3293
  h(this, ht, !1);
3225
3294
  h(this, ut, !1);
3226
3295
  h(this, gt, !1);
3227
- M(this, "run", 0);
3228
- M(this, "abort", null);
3229
- M(this, "revealTimer");
3230
- M(this, "timers", /* @__PURE__ */ new Set());
3231
- M(this, "toastTimer");
3232
- M(this, "stick", !0);
3233
- M(this, "renamed", /* @__PURE__ */ new Set());
3234
- M(this, "observer", null);
3235
- M(this, "observed", null);
3236
- M(this, "media", null);
3237
- M(this, "focusNext", "");
3238
- M(this, "bubbleScheduled", !1);
3239
- M(this, "pendingChatId", "");
3240
- M(this, "onNetwork", () => {
3296
+ h(this, mt, !1);
3297
+ h(this, ft, !1);
3298
+ h(this, bt, !1);
3299
+ h(this, vt, !1);
3300
+ O(this, "run", 0);
3301
+ O(this, "abort", null);
3302
+ O(this, "revealTimer");
3303
+ O(this, "timers", /* @__PURE__ */ new Set());
3304
+ O(this, "toastTimer");
3305
+ O(this, "stick", !0);
3306
+ O(this, "renamed", /* @__PURE__ */ new Set());
3307
+ O(this, "observer", null);
3308
+ O(this, "observed", null);
3309
+ O(this, "resizeTimer");
3310
+ O(this, "shownPassage", "");
3311
+ O(this, "media", null);
3312
+ O(this, "focusNext", "");
3313
+ O(this, "bubbleScheduled", !1);
3314
+ O(this, "pendingChatId", "");
3315
+ h(this, xt, []);
3316
+ h(this, wt, !1);
3317
+ /** The key the open conversation is created under, until the user leaves it. */
3318
+ O(this, "boundKey", "");
3319
+ /** The open chat was prepared but has no messages yet. */
3320
+ O(this, "prepared", !1);
3321
+ O(this, "syncedKey", "");
3322
+ O(this, "syncSignature", "");
3323
+ O(this, "syncRun", 0);
3324
+ O(this, "onNetwork", () => {
3241
3325
  this.offline = navigator.onLine === !1;
3242
3326
  });
3243
- M(this, "onMedia", () => {
3327
+ O(this, "onMedia", () => {
3244
3328
  var e;
3245
3329
  this.mobile = !!((e = this.media) != null && e.matches);
3246
3330
  });
3247
3331
  }
3248
3332
  get client() {
3249
- return p(this, N);
3333
+ return p(this, R);
3250
3334
  }
3251
3335
  set client(e) {
3252
- u(this, N, e);
3336
+ u(this, R, e);
3253
3337
  }
3254
3338
  get messages() {
3255
- return p(this, R);
3339
+ return p(this, N);
3256
3340
  }
3257
3341
  set messages(e) {
3258
- u(this, R, e);
3342
+ u(this, N, e);
3259
3343
  }
3260
3344
  get theme() {
3261
3345
  return p(this, E);
@@ -3270,16 +3354,16 @@ let d = (Ft = class extends Jt {
3270
3354
  u(this, B, e);
3271
3355
  }
3272
3356
  get mode() {
3273
- return p(this, D);
3357
+ return p(this, F);
3274
3358
  }
3275
3359
  set mode(e) {
3276
- u(this, D, e);
3360
+ u(this, F, e);
3277
3361
  }
3278
3362
  get format() {
3279
- return p(this, F);
3363
+ return p(this, D);
3280
3364
  }
3281
3365
  set format(e) {
3282
- u(this, F, e);
3366
+ u(this, D, e);
3283
3367
  }
3284
3368
  get renderers() {
3285
3369
  return p(this, K);
@@ -3300,28 +3384,28 @@ let d = (Ft = class extends Jt {
3300
3384
  u(this, U, e);
3301
3385
  }
3302
3386
  get glow() {
3303
- return p(this, W);
3387
+ return p(this, H);
3304
3388
  }
3305
3389
  set glow(e) {
3306
- u(this, W, e);
3390
+ u(this, H, e);
3307
3391
  }
3308
3392
  get docsets() {
3309
- return p(this, H);
3393
+ return p(this, W);
3310
3394
  }
3311
3395
  set docsets(e) {
3312
- u(this, H, e);
3396
+ u(this, W, e);
3313
3397
  }
3314
3398
  get attachmentsMode() {
3315
- return p(this, J);
3399
+ return p(this, V);
3316
3400
  }
3317
3401
  set attachmentsMode(e) {
3318
- u(this, J, e);
3402
+ u(this, V, e);
3319
3403
  }
3320
3404
  get saveAttachments() {
3321
- return p(this, G);
3405
+ return p(this, J);
3322
3406
  }
3323
3407
  set saveAttachments(e) {
3324
- u(this, G, e);
3408
+ u(this, J, e);
3325
3409
  }
3326
3410
  get followups() {
3327
3411
  return p(this, q);
@@ -3330,10 +3414,10 @@ let d = (Ft = class extends Jt {
3330
3414
  u(this, q, e);
3331
3415
  }
3332
3416
  get showSources() {
3333
- return p(this, V);
3417
+ return p(this, G);
3334
3418
  }
3335
3419
  set showSources(e) {
3336
- u(this, V, e);
3420
+ u(this, G, e);
3337
3421
  }
3338
3422
  get showNewChat() {
3339
3423
  return p(this, X);
@@ -3353,293 +3437,305 @@ let d = (Ft = class extends Jt {
3353
3437
  set showFollowups(e) {
3354
3438
  u(this, Q, e);
3355
3439
  }
3356
- get allowSearch() {
3440
+ get allowViewOptions() {
3357
3441
  return p(this, Z);
3358
3442
  }
3359
- set allowSearch(e) {
3443
+ set allowViewOptions(e) {
3360
3444
  u(this, Z, e);
3361
3445
  }
3362
- get autoTitle() {
3446
+ get allowSearch() {
3363
3447
  return p(this, ee);
3364
3448
  }
3365
- set autoTitle(e) {
3449
+ set allowSearch(e) {
3366
3450
  u(this, ee, e);
3367
3451
  }
3368
- get model() {
3452
+ get autoTitle() {
3369
3453
  return p(this, te);
3370
3454
  }
3371
- set model(e) {
3455
+ set autoTitle(e) {
3372
3456
  u(this, te, e);
3373
3457
  }
3374
- get params() {
3458
+ get model() {
3375
3459
  return p(this, se);
3376
3460
  }
3377
- set params(e) {
3461
+ set model(e) {
3378
3462
  u(this, se, e);
3379
3463
  }
3380
- get systemMessage() {
3464
+ get params() {
3381
3465
  return p(this, ie);
3382
3466
  }
3383
- set systemMessage(e) {
3467
+ set params(e) {
3384
3468
  u(this, ie, e);
3385
3469
  }
3386
- get retrieval() {
3470
+ get systemMessage() {
3387
3471
  return p(this, ae);
3388
3472
  }
3389
- set retrieval(e) {
3473
+ set systemMessage(e) {
3390
3474
  u(this, ae, e);
3391
3475
  }
3392
- get metadata() {
3476
+ get retrieval() {
3393
3477
  return p(this, re);
3394
3478
  }
3395
- set metadata(e) {
3479
+ set retrieval(e) {
3396
3480
  u(this, re, e);
3397
3481
  }
3398
- get embed() {
3482
+ get metadata() {
3399
3483
  return p(this, oe);
3400
3484
  }
3401
- set embed(e) {
3485
+ set metadata(e) {
3402
3486
  u(this, oe, e);
3403
3487
  }
3404
- get position() {
3488
+ get embed() {
3405
3489
  return p(this, ne);
3406
3490
  }
3407
- set position(e) {
3491
+ set embed(e) {
3408
3492
  u(this, ne, e);
3409
3493
  }
3410
- get sidebar() {
3494
+ get position() {
3411
3495
  return p(this, le);
3412
3496
  }
3413
- set sidebar(e) {
3497
+ set position(e) {
3414
3498
  u(this, le, e);
3415
3499
  }
3416
- get showTitle() {
3500
+ get sidebar() {
3417
3501
  return p(this, ce);
3418
3502
  }
3419
- set showTitle(e) {
3503
+ set sidebar(e) {
3420
3504
  u(this, ce, e);
3421
3505
  }
3422
- get chatIdAttr() {
3506
+ get showTitle() {
3423
3507
  return p(this, de);
3424
3508
  }
3425
- set chatIdAttr(e) {
3509
+ set showTitle(e) {
3426
3510
  u(this, de, e);
3427
3511
  }
3428
- get assistantName() {
3512
+ get chatIdAttr() {
3429
3513
  return p(this, pe);
3430
3514
  }
3431
- set assistantName(e) {
3515
+ set chatIdAttr(e) {
3432
3516
  u(this, pe, e);
3433
3517
  }
3434
- get logoUrl() {
3518
+ get chatKey() {
3435
3519
  return p(this, he);
3436
3520
  }
3437
- set logoUrl(e) {
3521
+ set chatKey(e) {
3438
3522
  u(this, he, e);
3439
3523
  }
3440
- get heading() {
3524
+ get assistantName() {
3441
3525
  return p(this, ue);
3442
3526
  }
3443
- set heading(e) {
3527
+ set assistantName(e) {
3444
3528
  u(this, ue, e);
3445
3529
  }
3446
- get description() {
3530
+ get logoUrl() {
3447
3531
  return p(this, ge);
3448
3532
  }
3449
- set description(e) {
3533
+ set logoUrl(e) {
3450
3534
  u(this, ge, e);
3451
3535
  }
3452
- get eyebrow() {
3536
+ get heading() {
3453
3537
  return p(this, me);
3454
3538
  }
3455
- set eyebrow(e) {
3539
+ set heading(e) {
3456
3540
  u(this, me, e);
3457
3541
  }
3458
- get prompts() {
3542
+ get description() {
3459
3543
  return p(this, fe);
3460
3544
  }
3461
- set prompts(e) {
3545
+ set description(e) {
3462
3546
  u(this, fe, e);
3463
3547
  }
3464
- get bubbleText() {
3548
+ get eyebrow() {
3465
3549
  return p(this, be);
3466
3550
  }
3467
- set bubbleText(e) {
3551
+ set eyebrow(e) {
3468
3552
  u(this, be, e);
3469
3553
  }
3470
- get greetingBubble() {
3554
+ get prompts() {
3555
+ return p(this, ve);
3556
+ }
3557
+ set prompts(e) {
3558
+ u(this, ve, e);
3559
+ }
3560
+ get bubbleText() {
3471
3561
  return p(this, xe);
3472
3562
  }
3473
- set greetingBubble(e) {
3563
+ set bubbleText(e) {
3474
3564
  u(this, xe, e);
3475
3565
  }
3566
+ get greetingBubble() {
3567
+ return p(this, we);
3568
+ }
3569
+ set greetingBubble(e) {
3570
+ u(this, we, e);
3571
+ }
3476
3572
  get unreadBadge() {
3477
- return p(this, ve);
3573
+ return p(this, ye);
3478
3574
  }
3479
3575
  set unreadBadge(e) {
3480
- u(this, ve, e);
3576
+ u(this, ye, e);
3481
3577
  }
3482
3578
  get allowUpload() {
3483
- return p(this, we);
3579
+ return p(this, ke);
3484
3580
  }
3485
3581
  set allowUpload(e) {
3486
- u(this, we, e);
3582
+ u(this, ke, e);
3487
3583
  }
3488
3584
  get allowExport() {
3489
- return p(this, ye);
3585
+ return p(this, $e);
3490
3586
  }
3491
3587
  set allowExport(e) {
3492
- u(this, ye, e);
3588
+ u(this, $e, e);
3493
3589
  }
3494
3590
  get allowCopy() {
3495
- return p(this, ke);
3591
+ return p(this, Ce);
3496
3592
  }
3497
3593
  set allowCopy(e) {
3498
- u(this, ke, e);
3594
+ u(this, Ce, e);
3499
3595
  }
3500
3596
  get allowRegenerate() {
3501
- return p(this, $e);
3597
+ return p(this, Se);
3502
3598
  }
3503
3599
  set allowRegenerate(e) {
3504
- u(this, $e, e);
3600
+ u(this, Se, e);
3505
3601
  }
3506
3602
  get allowBookmark() {
3507
- return p(this, Ce);
3603
+ return p(this, Te);
3508
3604
  }
3509
3605
  set allowBookmark(e) {
3510
- u(this, Ce, e);
3606
+ u(this, Te, e);
3511
3607
  }
3512
3608
  get allowDelete() {
3513
- return p(this, Te);
3609
+ return p(this, Oe);
3514
3610
  }
3515
3611
  set allowDelete(e) {
3516
- u(this, Te, e);
3612
+ u(this, Oe, e);
3517
3613
  }
3518
3614
  get allowRename() {
3519
- return p(this, Se);
3615
+ return p(this, Ie);
3520
3616
  }
3521
3617
  set allowRename(e) {
3522
- u(this, Se, e);
3618
+ u(this, Ie, e);
3523
3619
  }
3524
3620
  get allowFeedback() {
3525
- return p(this, Ie);
3621
+ return p(this, Me);
3526
3622
  }
3527
3623
  set allowFeedback(e) {
3528
- u(this, Ie, e);
3624
+ u(this, Me, e);
3529
3625
  }
3530
3626
  get showComposer() {
3531
- return p(this, Oe);
3627
+ return p(this, _e);
3532
3628
  }
3533
3629
  set showComposer(e) {
3534
- u(this, Oe, e);
3630
+ u(this, _e, e);
3535
3631
  }
3536
3632
  get showTime() {
3537
- return p(this, Me);
3633
+ return p(this, ze);
3538
3634
  }
3539
3635
  set showTime(e) {
3540
- u(this, Me, e);
3636
+ u(this, ze, e);
3541
3637
  }
3542
3638
  get footnote() {
3543
- return p(this, ze);
3639
+ return p(this, Le);
3544
3640
  }
3545
3641
  set footnote(e) {
3546
- u(this, ze, e);
3642
+ u(this, Le, e);
3547
3643
  }
3548
3644
  get allowRaw() {
3549
- return p(this, _e);
3645
+ return p(this, je);
3550
3646
  }
3551
3647
  set allowRaw(e) {
3552
- u(this, _e, e);
3648
+ u(this, je, e);
3553
3649
  }
3554
3650
  get branding() {
3555
- return p(this, Le);
3651
+ return p(this, Ae);
3556
3652
  }
3557
3653
  set branding(e) {
3558
- u(this, Le, e);
3654
+ u(this, Ae, e);
3559
3655
  }
3560
3656
  get chatList() {
3561
- return p(this, Ae);
3657
+ return p(this, Re);
3562
3658
  }
3563
3659
  set chatList(e) {
3564
- u(this, Ae, e);
3660
+ u(this, Re, e);
3565
3661
  }
3566
3662
  get listState() {
3567
- return p(this, je);
3663
+ return p(this, Ne);
3568
3664
  }
3569
3665
  set listState(e) {
3570
- u(this, je, e);
3666
+ u(this, Ne, e);
3571
3667
  }
3572
3668
  get activeId() {
3573
- return p(this, Ne);
3669
+ return p(this, Ee);
3574
3670
  }
3575
3671
  set activeId(e) {
3576
- u(this, Ne, e);
3672
+ u(this, Ee, e);
3577
3673
  }
3578
3674
  get chatTitle() {
3579
- return p(this, Re);
3675
+ return p(this, Be);
3580
3676
  }
3581
3677
  set chatTitle(e) {
3582
- u(this, Re, e);
3678
+ u(this, Be, e);
3583
3679
  }
3584
3680
  get bookmarked() {
3585
- return p(this, Ee);
3681
+ return p(this, Fe);
3586
3682
  }
3587
3683
  set bookmarked(e) {
3588
- u(this, Ee, e);
3684
+ u(this, Fe, e);
3589
3685
  }
3590
3686
  get msgs() {
3591
- return p(this, Be);
3687
+ return p(this, De);
3592
3688
  }
3593
3689
  set msgs(e) {
3594
- u(this, Be, e);
3690
+ u(this, De, e);
3595
3691
  }
3596
3692
  get loadingThread() {
3597
- return p(this, De);
3693
+ return p(this, Ke);
3598
3694
  }
3599
3695
  set loadingThread(e) {
3600
- u(this, De, e);
3696
+ u(this, Ke, e);
3601
3697
  }
3602
3698
  get threadError() {
3603
- return p(this, Fe);
3699
+ return p(this, Pe);
3604
3700
  }
3605
3701
  set threadError(e) {
3606
- u(this, Fe, e);
3702
+ u(this, Pe, e);
3607
3703
  }
3608
3704
  get busy() {
3609
- return p(this, Ke);
3705
+ return p(this, Ue);
3610
3706
  }
3611
3707
  set busy(e) {
3612
- u(this, Ke, e);
3708
+ u(this, Ue, e);
3613
3709
  }
3614
3710
  get draft() {
3615
- return p(this, Pe);
3711
+ return p(this, He);
3616
3712
  }
3617
3713
  set draft(e) {
3618
- u(this, Pe, e);
3714
+ u(this, He, e);
3619
3715
  }
3620
3716
  get files() {
3621
- return p(this, Ue);
3717
+ return p(this, We);
3622
3718
  }
3623
3719
  set files(e) {
3624
- u(this, Ue, e);
3720
+ u(this, We, e);
3625
3721
  }
3626
3722
  get search() {
3627
- return p(this, We);
3723
+ return p(this, Ve);
3628
3724
  }
3629
3725
  set search(e) {
3630
- u(this, We, e);
3726
+ u(this, Ve, e);
3631
3727
  }
3632
3728
  get sidebarOpen() {
3633
- return p(this, He);
3729
+ return p(this, Je);
3634
3730
  }
3635
3731
  set sidebarOpen(e) {
3636
- u(this, He, e);
3732
+ u(this, Je, e);
3637
3733
  }
3638
3734
  get width() {
3639
- return p(this, Je);
3735
+ return p(this, qe);
3640
3736
  }
3641
3737
  set width(e) {
3642
- u(this, Je, e);
3738
+ u(this, qe, e);
3643
3739
  }
3644
3740
  get panel() {
3645
3741
  return p(this, Ge);
@@ -3648,137 +3744,161 @@ let d = (Ft = class extends Jt {
3648
3744
  u(this, Ge, e);
3649
3745
  }
3650
3746
  get menuOpen() {
3651
- return p(this, qe);
3747
+ return p(this, Xe);
3652
3748
  }
3653
3749
  set menuOpen(e) {
3654
- u(this, qe, e);
3750
+ u(this, Xe, e);
3751
+ }
3752
+ get viewOpen() {
3753
+ return p(this, Ye);
3754
+ }
3755
+ set viewOpen(e) {
3756
+ u(this, Ye, e);
3757
+ }
3758
+ get viewHidden() {
3759
+ return p(this, Qe);
3760
+ }
3761
+ set viewHidden(e) {
3762
+ u(this, Qe, e);
3655
3763
  }
3656
3764
  get editingKey() {
3657
- return p(this, Ve);
3765
+ return p(this, Ze);
3658
3766
  }
3659
3767
  set editingKey(e) {
3660
- u(this, Ve, e);
3768
+ u(this, Ze, e);
3661
3769
  }
3662
3770
  get editDraft() {
3663
- return p(this, Xe);
3771
+ return p(this, et);
3664
3772
  }
3665
3773
  set editDraft(e) {
3666
- u(this, Xe, e);
3774
+ u(this, et, e);
3667
3775
  }
3668
3776
  get editingTitle() {
3669
- return p(this, Ye);
3777
+ return p(this, tt);
3670
3778
  }
3671
3779
  set editingTitle(e) {
3672
- u(this, Ye, e);
3780
+ u(this, tt, e);
3673
3781
  }
3674
3782
  get renamingId() {
3675
- return p(this, Qe);
3783
+ return p(this, st);
3676
3784
  }
3677
3785
  set renamingId(e) {
3678
- u(this, Qe, e);
3786
+ u(this, st, e);
3679
3787
  }
3680
3788
  get toast() {
3681
- return p(this, Ze);
3789
+ return p(this, it);
3682
3790
  }
3683
3791
  set toast(e) {
3684
- u(this, Ze, e);
3792
+ u(this, it, e);
3685
3793
  }
3686
3794
  get copiedKey() {
3687
- return p(this, et);
3795
+ return p(this, at);
3688
3796
  }
3689
3797
  set copiedKey(e) {
3690
- u(this, et, e);
3798
+ u(this, at, e);
3691
3799
  }
3692
3800
  get retrievalOpen() {
3693
- return p(this, tt);
3801
+ return p(this, rt);
3694
3802
  }
3695
3803
  set retrievalOpen(e) {
3696
- u(this, tt, e);
3804
+ u(this, rt, e);
3697
3805
  }
3698
3806
  get rawKeys() {
3699
- return p(this, st);
3807
+ return p(this, ot);
3700
3808
  }
3701
3809
  set rawKeys(e) {
3702
- u(this, st, e);
3810
+ u(this, ot, e);
3703
3811
  }
3704
3812
  get savedFiles() {
3705
- return p(this, it);
3813
+ return p(this, nt);
3706
3814
  }
3707
3815
  set savedFiles(e) {
3708
- u(this, it, e);
3816
+ u(this, nt, e);
3709
3817
  }
3710
3818
  get hasSidebarContent() {
3711
- return p(this, at);
3819
+ return p(this, lt);
3712
3820
  }
3713
3821
  set hasSidebarContent(e) {
3714
- u(this, at, e);
3822
+ u(this, lt, e);
3715
3823
  }
3716
3824
  get sorts() {
3717
- return p(this, rt);
3825
+ return p(this, ct);
3718
3826
  }
3719
3827
  set sorts(e) {
3720
- u(this, rt, e);
3828
+ u(this, ct, e);
3721
3829
  }
3722
3830
  get arrivedKey() {
3723
- return p(this, ot);
3831
+ return p(this, dt);
3724
3832
  }
3725
3833
  set arrivedKey(e) {
3726
- u(this, ot, e);
3834
+ u(this, dt, e);
3727
3835
  }
3728
3836
  get dragging() {
3729
- return p(this, nt);
3837
+ return p(this, pt);
3730
3838
  }
3731
3839
  set dragging(e) {
3732
- u(this, nt, e);
3840
+ u(this, pt, e);
3733
3841
  }
3734
3842
  get showJump() {
3735
- return p(this, lt);
3843
+ return p(this, ht);
3736
3844
  }
3737
3845
  set showJump(e) {
3738
- u(this, lt, e);
3846
+ u(this, ht, e);
3739
3847
  }
3740
3848
  get offline() {
3741
- return p(this, ct);
3849
+ return p(this, ut);
3742
3850
  }
3743
3851
  set offline(e) {
3744
- u(this, ct, e);
3852
+ u(this, ut, e);
3745
3853
  }
3746
3854
  get isOpen() {
3747
- return p(this, dt);
3855
+ return p(this, gt);
3748
3856
  }
3749
3857
  set isOpen(e) {
3750
- u(this, dt, e);
3858
+ u(this, gt, e);
3751
3859
  }
3752
3860
  get expanded() {
3753
- return p(this, pt);
3861
+ return p(this, mt);
3754
3862
  }
3755
3863
  set expanded(e) {
3756
- u(this, pt, e);
3864
+ u(this, mt, e);
3757
3865
  }
3758
3866
  get bubble() {
3759
- return p(this, ht);
3867
+ return p(this, ft);
3760
3868
  }
3761
3869
  set bubble(e) {
3762
- u(this, ht, e);
3870
+ u(this, ft, e);
3763
3871
  }
3764
3872
  get seen() {
3765
- return p(this, ut);
3873
+ return p(this, bt);
3766
3874
  }
3767
3875
  set seen(e) {
3768
- u(this, ut, e);
3876
+ u(this, bt, e);
3769
3877
  }
3770
3878
  get mobile() {
3771
- return p(this, gt);
3879
+ return p(this, vt);
3772
3880
  }
3773
3881
  set mobile(e) {
3774
- u(this, gt, e);
3882
+ u(this, vt, e);
3883
+ }
3884
+ get starterList() {
3885
+ return p(this, xt);
3886
+ }
3887
+ set starterList(e) {
3888
+ u(this, xt, e);
3889
+ }
3890
+ get startersLoading() {
3891
+ return p(this, wt);
3892
+ }
3893
+ set startersLoading(e) {
3894
+ u(this, wt, e);
3775
3895
  }
3776
3896
  get msg() {
3777
- return ts(this.messages);
3897
+ return hs(this.messages);
3778
3898
  }
3779
3899
  /** An explicit `.client`, else the page default. */
3780
3900
  get resolvedClient() {
3781
- return this.client ?? Vt() ?? null;
3901
+ return this.client ?? os() ?? null;
3782
3902
  }
3783
3903
  /** The open conversation's id, or null for a new chat. */
3784
3904
  get chatId() {
@@ -3788,6 +3908,10 @@ let d = (Ft = class extends Jt {
3788
3908
  get thread() {
3789
3909
  return this.msgs;
3790
3910
  }
3911
+ /** The starter questions from `prompts="auto"`, if any. */
3912
+ get starters() {
3913
+ return this.starterList;
3914
+ }
3791
3915
  /** `format`, falling back to the default for anything unknown. */
3792
3916
  /** `docsets` as a clean list of ids. */
3793
3917
  get docsetIds() {
@@ -3817,7 +3941,7 @@ let d = (Ft = class extends Jt {
3817
3941
  if (!e) return;
3818
3942
  const t = this;
3819
3943
  "client" in e && (this.client = e.client ?? null);
3820
- for (const s of Lt)
3944
+ for (const s of Ut)
3821
3945
  s in e && (t[s] = e[s]);
3822
3946
  e.chatId && e.chatId !== this.activeId && (this.hasUpdated ? this.openChat(e.chatId) : this.chatIdAttr = e.chatId);
3823
3947
  }
@@ -3835,7 +3959,7 @@ let d = (Ft = class extends Jt {
3835
3959
  return {
3836
3960
  client: this.client,
3837
3961
  chatId: this.activeId ?? "",
3838
- ...Object.fromEntries(Lt.map((t) => [t, e[t]]))
3962
+ ...Object.fromEntries(Ut.map((t) => [t, e[t]]))
3839
3963
  };
3840
3964
  }
3841
3965
  // ── lifecycle ─────────────────────────────────────────────
@@ -3845,7 +3969,7 @@ let d = (Ft = class extends Jt {
3845
3969
  }
3846
3970
  disconnectedCallback() {
3847
3971
  var e, t;
3848
- super.disconnectedCallback(), window.removeEventListener("online", this.onNetwork), window.removeEventListener("offline", this.onNetwork), (e = this.media) == null || e.removeEventListener("change", this.onMedia), (t = this.observer) == null || t.disconnect(), this.observer = null, this.observed = null, this.flushToast(), this.halt(), this.timers.forEach(clearTimeout), this.timers.clear();
3972
+ super.disconnectedCallback(), window.removeEventListener("online", this.onNetwork), window.removeEventListener("offline", this.onNetwork), (e = this.media) == null || e.removeEventListener("change", this.onMedia), (t = this.observer) == null || t.disconnect(), clearTimeout(this.resizeTimer), this.observer = null, this.observed = null, this.flushToast(), this.halt(), this.timers.forEach(clearTimeout), this.timers.clear();
3849
3973
  }
3850
3974
  willUpdate(e) {
3851
3975
  if (e.has("retrieval") && !Array.isArray(this.retrieval)) {
@@ -3860,16 +3984,20 @@ let d = (Ft = class extends Jt {
3860
3984
  this.chatIdAttr && this.openChat(this.chatIdAttr);
3861
3985
  }
3862
3986
  updated() {
3863
- var t;
3987
+ var s, i;
3864
3988
  const e = this.renderRoot.querySelector(".root");
3865
- if (e !== this.observed && ((t = this.observer) == null || t.disconnect(), this.observed = e, e && typeof ResizeObserver < "u" && (this.observer ?? (this.observer = new ResizeObserver(([s]) => {
3866
- const i = Math.round(s.contentRect.width);
3867
- i !== this.width && (this.width = i, this.sidebarOpen === null && (this.sidebarOpen = this.sidebar === "auto" && this.docked));
3868
- })), this.observer.observe(e))), this.sidebarOpen && this.listState === "idle" && this.resolvedClient && this.loadChats(), this.pendingChatId && this.resolvedClient && this.openChat(this.pendingChatId), this.focusNext) {
3869
- const s = this.renderRoot.querySelector(
3989
+ e !== this.observed && ((s = this.observer) == null || s.disconnect(), this.observed = e, e && typeof ResizeObserver < "u" && (this.observer ?? (this.observer = new ResizeObserver(([a]) => {
3990
+ const r = Math.round(a.contentRect.width);
3991
+ r !== this.width && (clearTimeout(this.resizeTimer), this.resizeTimer = setTimeout(() => {
3992
+ this.width = r, this.sidebarOpen === null && (this.sidebarOpen = this.sidebar === "auto" && this.docked);
3993
+ }));
3994
+ })), this.observer.observe(e))), this.sidebarOpen && this.listState === "idle" && this.resolvedClient && this.loadChats(), this.pendingChatId && this.resolvedClient && this.openChat(this.pendingChatId), this.syncKeyedChat();
3995
+ const t = this.panel ? `${this.panel.key}:${this.panel.n}` : "";
3996
+ if (t !== this.shownPassage && (this.shownPassage = t, (i = this.renderRoot.querySelector(".passage-box.current")) == null || i.scrollIntoView({ block: "nearest" })), this.focusNext) {
3997
+ const a = this.renderRoot.querySelector(
3870
3998
  this.focusNext
3871
3999
  );
3872
- this.focusNext = "", s && (s.focus(), "select" in s && s.tagName === "INPUT" && s.select());
4000
+ this.focusNext = "", a && (a.focus(), "select" in a && a.tagName === "INPUT" && a.select());
3873
4001
  }
3874
4002
  }
3875
4003
  later(e, t) {
@@ -3882,22 +4010,22 @@ let d = (Ft = class extends Jt {
3882
4010
  this.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
3883
4011
  }
3884
4012
  get docked() {
3885
- return this.embed === "page" && this.width >= Ss;
4013
+ return this.embed === "page" && this.width >= Ns;
3886
4014
  }
3887
4015
  get panelDocked() {
3888
- const e = this.docked && this.sidebarOpen ? Ts : 0;
3889
- return this.width - e >= Is;
4016
+ const e = this.docked && this.sidebarOpen ? Rs : 0;
4017
+ return this.width - e >= Es;
3890
4018
  }
3891
4019
  // ── public API ────────────────────────────────────────────
3892
4020
  /** Starts a new, empty conversation. */
3893
4021
  newChat() {
3894
- this.halt(), this.pendingChatId = "", this.savedFiles = [], this.loadingThread = !1, this.activeId = null, this.chatTitle = "", this.bookmarked = !1, this.msgs = [], this.threadError = "", this.resetViewState(), this.focusNext = "textarea.input";
4022
+ this.halt(), this.leaveKeyedChat(), this.pendingChatId = "", this.savedFiles = [], this.loadingThread = !1, this.activeId = null, this.chatTitle = "", this.bookmarked = !1, this.msgs = [], this.threadError = "", this.resetViewState(), this.focusNext = "textarea.input";
3895
4023
  }
3896
4024
  /** Opens a saved conversation. */
3897
4025
  async openChat(e) {
3898
4026
  const t = this.resolvedClient;
3899
4027
  if (!e) return;
3900
- this.halt(), this.savedFiles = [];
4028
+ this.halt(), this.leaveKeyedChat(), this.savedFiles = [];
3901
4029
  const s = this.chatList.find((a) => a._id === e);
3902
4030
  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) {
3903
4031
  this.pendingChatId = e, this.loadingThread = !0;
@@ -3910,14 +4038,90 @@ let d = (Ft = class extends Jt {
3910
4038
  _id: e
3911
4039
  });
3912
4040
  if (i !== this.run) return;
3913
- 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.savedFiles = Dt(a == null ? void 0 : a.attachments), this.upsertChat({ ...s, ...a, _id: e }), this.stick = !0, this.scrollToBottom();
4041
+ this.showChat(a), this.upsertChat({ ...s, ...a, _id: e });
3914
4042
  } catch (a) {
3915
4043
  if (i !== this.run) return;
3916
- Bt(a) ? (this.chatList = this.chatList.filter((r) => r._id !== e), this.newChat(), this.showToast(this.msg.errNotFound)) : this.threadError = this.msg.errLoad;
4044
+ Tt(a) ? (this.chatList = this.chatList.filter((r) => r._id !== e), this.newChat(), this.showToast(this.msg.errNotFound)) : this.threadError = this.msg.errLoad;
3917
4045
  } finally {
3918
4046
  i === this.run && (this.loadingThread = !1);
3919
4047
  }
3920
4048
  }
4049
+ /** Suggested questions under answers: the page's setting, then the reader's. */
4050
+ get followupsVisible() {
4051
+ return this.showFollowups && !(this.allowViewOptions && this.viewHidden.followups);
4052
+ }
4053
+ /** Source cards and the "searched" row: the page's setting, then the reader's. */
4054
+ get sourcesVisible() {
4055
+ return this.showSources && !(this.allowViewOptions && this.viewHidden.sources);
4056
+ }
4057
+ toggleView(e) {
4058
+ this.viewHidden = { ...this.viewHidden, [e]: !this.viewHidden[e] }, Js(this.viewHidden), this.emit("singlebase-chat-view", {
4059
+ followups: this.followupsVisible,
4060
+ sources: this.sourcesVisible
4061
+ });
4062
+ }
4063
+ /** Puts a chat from `llm.get_chat` (or `llm.prepare_chat`) on screen. */
4064
+ showChat(e) {
4065
+ this.chatTitle = (e == null ? void 0 : e.title) ?? "", this.bookmarked = !!(e != null && e.bookmarked), this.msgs = ((e == null ? void 0 : e.messages) ?? []).filter((t) => t && (t.role === "user" || t.role === "assistant")).map((t) => this.fromServer(t)), this.savedFiles = Gt(e == null ? void 0 : e.attachments), this.stick = !0, this.scrollToBottom();
4066
+ }
4067
+ // ── chat key and starter questions ────────────────────────
4068
+ get wantsStarters() {
4069
+ return typeof this.prompts == "string" && this.prompts.trim().toLowerCase() === "auto";
4070
+ }
4071
+ /** The user moved to another conversation: stop tying messages to the key. */
4072
+ leaveKeyedChat() {
4073
+ this.syncRun += 1, this.boundKey = "", this.prepared = !1, this.startersLoading = !1;
4074
+ }
4075
+ /** Docsets first, then the page's own retrieval entries. */
4076
+ baseRetrieval() {
4077
+ const e = this.docsetIds;
4078
+ return [
4079
+ ...e.length ? [{ source: "docset", ids: e }] : [],
4080
+ ...this.retrieval ?? []
4081
+ ];
4082
+ }
4083
+ /**
4084
+ * Opens the chat for `chat-key`, and with `prompts="auto"` prepares the chat
4085
+ * with its context so the service returns stored starter questions.
4086
+ *
4087
+ * It runs when the key or the context changes. A change of context alone
4088
+ * never replaces a conversation that already has messages.
4089
+ */
4090
+ async syncKeyedChat() {
4091
+ const e = this.resolvedClient, t = this.chatKey.trim(), s = this.wantsStarters;
4092
+ if (!e || !t && !s || this.chatIdAttr || this.pendingChatId) return;
4093
+ const i = this.baseRetrieval(), a = JSON.stringify([t, s, this.mode, i]);
4094
+ if (a === this.syncSignature) return;
4095
+ this.syncSignature = a;
4096
+ const r = t !== this.syncedKey;
4097
+ if (this.syncedKey = t, !r && (this.msgs.length || this.busy)) return;
4098
+ r && (this.halt(), this.activeId = null, this.chatTitle = "", this.bookmarked = !1, this.msgs = [], this.savedFiles = [], this.threadError = "");
4099
+ const c = ++this.syncRun;
4100
+ this.boundKey = t, this.prepared = !1, this.starterList = [], this.startersLoading = s, this.loadingThread = !!t;
4101
+ try {
4102
+ let l = null;
4103
+ if (s) {
4104
+ const m = {
4105
+ system_message: this.systemPrompt(),
4106
+ mode: this.mode,
4107
+ starters: 4
4108
+ };
4109
+ t && (m.key = t), this.model && (m.model = this.model), Object.keys(this.params ?? {}).length && (m.params = this.params), Object.keys(this.metadata ?? {}).length && (m.metadata = this.metadata), i.length && (m.retrieval = i);
4110
+ try {
4111
+ l = await e.llm.call("prepare_chat", m);
4112
+ } catch (v) {
4113
+ if (!t) throw v;
4114
+ }
4115
+ }
4116
+ if (!(l != null && l._id) && t && (l = await e.llm.call("get_chat", { key: t })), c !== this.syncRun || this.msgs.length || this.busy) return;
4117
+ l != null && l._id && (this.activeId = l._id, this.showChat(l), this.prepared = this.msgs.length === 0, this.prepared || this.upsertChat(l), this.starterList = Array.isArray(l.starters) ? l.starters.map((m) => String(m).trim()).filter(Boolean) : [], this.starterList.length && this.emit("singlebase-chat-starters", { chatId: l._id, starters: this.starterList }));
4118
+ } catch (l) {
4119
+ if (c !== this.syncRun) return;
4120
+ t && !s && !Tt(l) && (this.threadError = this.msg.errLoad);
4121
+ } finally {
4122
+ c === this.syncRun && (this.startersLoading = !1, this.loadingThread = !1);
4123
+ }
4124
+ }
3921
4125
  /** Sends a message; with no argument, sends the composer's text. */
3922
4126
  async send(e) {
3923
4127
  const t = (typeof e == "string" ? e : this.draft).trim();
@@ -3935,14 +4139,14 @@ let d = (Ft = class extends Jt {
3935
4139
  }
3936
4140
  /** Downloads the open conversation, or copies it as Markdown. */
3937
4141
  exportChat(e = "md") {
3938
- var L;
4142
+ var w;
3939
4143
  if (!this.msgs.length) return;
3940
4144
  this.menuOpen = !1;
3941
- 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((S, $) => {
3942
- const A = ft(S, $ + 1);
3943
- return `[${A.n}] ${A.title}${A.path ? ` — ${A.path}` : ""}`;
3944
- }), r = (x) => (x.attachments ?? []).map((S) => S.name);
3945
- let c, l = "text/markdown", f = "md";
4145
+ const t = this.chatTitle || this.msg.untitled, s = (f) => f.role === "user" ? this.msg.you : this.assistantName, i = (f) => new Date(f || Date.now()).toLocaleString(), a = (f) => f.sources.map((y, C) => {
4146
+ const L = kt(y, C + 1);
4147
+ return `[${L.n}] ${L.title}${L.path ? ` — ${L.path}` : ""}`;
4148
+ }), r = (f) => (f.attachments ?? []).map((y) => y.name);
4149
+ let c, l = "text/markdown", m = "md";
3946
4150
  if (e === "json" ? (c = JSON.stringify(
3947
4151
  {
3948
4152
  exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -3950,42 +4154,42 @@ let d = (Ft = class extends Jt {
3950
4154
  title: t,
3951
4155
  mode: this.mode,
3952
4156
  bookmarked: this.bookmarked,
3953
- messages: this.msgs.map((x) => ({
3954
- role: x.role,
3955
- text: x.content,
3956
- at: new Date(x.at || Date.now()).toISOString(),
3957
- bookmarked: x.bookmarked,
3958
- attachments: r(x),
3959
- sources: a(x)
4157
+ messages: this.msgs.map((f) => ({
4158
+ role: f.role,
4159
+ text: f.content,
4160
+ at: new Date(f.at || Date.now()).toISOString(),
4161
+ bookmarked: f.bookmarked,
4162
+ attachments: r(f),
4163
+ sources: a(f)
3960
4164
  }))
3961
4165
  },
3962
4166
  null,
3963
4167
  2
3964
- ), l = "application/json", f = "json") : e === "txt" ? (c = `${t}
4168
+ ), l = "application/json", m = "json") : e === "txt" ? (c = `${t}
3965
4169
  ${"=".repeat(t.length)}
3966
4170
 
3967
4171
  ` + this.msgs.map(
3968
- (x) => [
3969
- `${s(x)} · ${i(x.at)}`,
3970
- r(x).length ? `Attachments: ${r(x).join(", ")}` : "",
3971
- x.content,
3972
- a(x).length ? `Sources:
3973
- ${a(x).join(`
4172
+ (f) => [
4173
+ `${s(f)} · ${i(f.at)}`,
4174
+ r(f).length ? `Attachments: ${r(f).join(", ")}` : "",
4175
+ f.content,
4176
+ a(f).length ? `Sources:
4177
+ ${a(f).join(`
3974
4178
  `)}` : ""
3975
4179
  ].filter(Boolean).join(`
3976
4180
  `)
3977
4181
  ).join(`
3978
4182
 
3979
- `), l = "text/plain", f = "txt") : c = `# ${t}
4183
+ `), l = "text/plain", m = "txt") : c = `# ${t}
3980
4184
 
3981
4185
  ` + this.msgs.map(
3982
- (x) => [
3983
- `### ${s(x)} · ${i(x.at)}`,
3984
- r(x).length ? `Attachments: ${r(x).join(", ")}` : "",
3985
- x.content,
3986
- a(x).length ? `**Sources**
4186
+ (f) => [
4187
+ `### ${s(f)} · ${i(f.at)}`,
4188
+ r(f).length ? `Attachments: ${r(f).join(", ")}` : "",
4189
+ f.content,
4190
+ a(f).length ? `**Sources**
3987
4191
 
3988
- ${a(x).map((S) => `- ${S}`).join(`
4192
+ ${a(f).map((y) => `- ${y}`).join(`
3989
4193
  `)}` : ""
3990
4194
  ].filter(Boolean).join(`
3991
4195
 
@@ -3996,12 +4200,12 @@ ${a(x).map((S) => `- ${S}`).join(`
3996
4200
 
3997
4201
  `) + `
3998
4202
  `, this.emit("singlebase-chat-export", { chatId: this.activeId, format: e }), e === "copy") {
3999
- (L = navigator.clipboard) == null || L.writeText(c).catch(() => {
4203
+ (w = navigator.clipboard) == null || w.writeText(c).catch(() => {
4000
4204
  }), this.showToast(this.msg.copiedMarkdown);
4001
4205
  return;
4002
4206
  }
4003
- const C = `${t.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "chat"}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.${f}`, T = URL.createObjectURL(new Blob([c], { type: l })), w = document.createElement("a");
4004
- w.href = T, w.download = C, document.body.appendChild(w), w.click(), w.remove(), setTimeout(() => URL.revokeObjectURL(T), 2e3), this.showToast(_(this.msg.exported, { name: C }));
4207
+ const S = `${t.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "chat"}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.${m}`, T = URL.createObjectURL(new Blob([c], { type: l })), I = document.createElement("a");
4208
+ I.href = T, I.download = S, document.body.appendChild(I), I.click(), I.remove(), setTimeout(() => URL.revokeObjectURL(T), 2e3), this.showToast(j(this.msg.exported, { name: S }));
4005
4209
  }
4006
4210
  /** Inline and launcher: fill the window. */
4007
4211
  expand() {
@@ -4021,7 +4225,7 @@ ${a(x).map((S) => `- ${S}`).join(`
4021
4225
  // ── turns ─────────────────────────────────────────────────
4022
4226
  userMessage(e, t = []) {
4023
4227
  return {
4024
- key: bt(),
4228
+ key: St(),
4025
4229
  id: null,
4026
4230
  role: "user",
4027
4231
  content: e,
@@ -4036,37 +4240,33 @@ ${a(x).map((S) => `- ${S}`).join(`
4036
4240
  systemPrompt() {
4037
4241
  return [
4038
4242
  this.systemMessage,
4039
- Rt[this.mode] ?? Rt.chat,
4040
- As[this.formatLevel],
4041
- this.followups ? js : ""
4243
+ Jt[this.mode] ?? Jt.chat,
4244
+ Us[this.formatLevel],
4245
+ this.followups ? Hs : ""
4042
4246
  ].filter(Boolean).join(`
4043
4247
 
4044
4248
  `);
4045
4249
  }
4046
4250
  payloadFor(e) {
4047
4251
  const t = { message: e.content, format: "markdown" };
4048
- this.activeId ? t._id = this.activeId : (t.title = fs(e.content), t.system_message = this.systemPrompt()), t.mode = this.mode, this.model && (t.model = this.model), Object.keys(this.params ?? {}).length && (t.params = this.params);
4252
+ this.activeId ? (t._id = this.activeId, this.prepared && (t.title = Kt(e.content))) : (t.title = Kt(e.content), t.system_message = this.systemPrompt(), this.boundKey && (t.key = this.boundKey)), t.mode = this.mode, this.model && (t.model = this.model), Object.keys(this.params ?? {}).length && (t.params = this.params);
4049
4253
  const s = e.attachments ?? [], i = this.attachmentsMode === "payload";
4050
- i && s.length && (t.attachments = s.map((l) => ({
4254
+ i && s.length && (t.attachments = s.map((c) => ({
4051
4255
  type: "content",
4052
- content: l.content,
4053
- name: l.name,
4054
- ...l.mime ? { mime: l.mime } : {},
4055
- size: l.size,
4256
+ content: c.content,
4257
+ name: c.name,
4258
+ ...c.mime ? { mime: c.mime } : {},
4259
+ size: c.size,
4056
4260
  save_attachment: this.saveAttachments
4057
4261
  })));
4058
- const a = i ? [] : s.map((l) => l.name);
4262
+ const a = i ? [] : s.map((c) => c.name);
4059
4263
  (Object.keys(this.metadata ?? {}).length || a.length) && (t.metadata = { ...this.metadata, ...a.length ? { attachments: a } : {} });
4060
- const r = this.docsetIds, c = [
4061
- ...r.length ? [{ source: "docset", ids: r }] : [],
4062
- ...this.retrieval ?? [],
4063
- ...i ? [] : Bs(s)
4064
- ];
4065
- return c.length && (t.retrieval = c), t;
4264
+ const r = [...this.baseRetrieval(), ...i ? [] : Xs(s)];
4265
+ return r.length && (t.retrieval = r), t;
4066
4266
  }
4067
4267
  async runTurn(e) {
4068
4268
  const t = {
4069
- key: bt(),
4269
+ key: St(),
4070
4270
  id: null,
4071
4271
  role: "assistant",
4072
4272
  content: "",
@@ -4084,18 +4284,18 @@ ${a(x).map((S) => `- ${S}`).join(`
4084
4284
  }
4085
4285
  const i = ++this.run, a = new AbortController();
4086
4286
  this.abort = a;
4087
- const r = !this.activeId;
4287
+ const r = !this.activeId || this.prepared;
4088
4288
  let c = this.payloadFor(e);
4089
4289
  if (this.beforeSend) {
4090
4290
  let l;
4091
4291
  try {
4092
4292
  l = await this.beforeSend(c, { chatId: this.activeId, isNew: r, message: e });
4093
- } catch (b) {
4094
- l = b;
4293
+ } catch (v) {
4294
+ l = v;
4095
4295
  }
4096
4296
  if (i !== this.run) return;
4097
4297
  if (l === !1) {
4098
- this.msgs = this.msgs.filter((b) => b !== e && b !== t), this.draft = e.content, this.busy = !1, this.abort = null;
4298
+ this.msgs = this.msgs.filter((v) => v !== e && v !== t), this.draft = e.content, this.busy = !1, this.abort = null;
4099
4299
  return;
4100
4300
  }
4101
4301
  if (!(!!l && typeof l == "object" && typeof l.message == "string") || !l.message.trim()) {
@@ -4108,30 +4308,30 @@ ${a(x).map((S) => `- ${S}`).join(`
4108
4308
  c = l;
4109
4309
  }
4110
4310
  try {
4111
- const l = await s.llm.call("chat", c, { signal: a.signal }), f = (l == null ? void 0 : l._id) || (l == null ? void 0 : l.chat_id) || this.activeId;
4112
- if (r && f && this.upsertChat({
4113
- _id: f,
4311
+ const l = await s.llm.call("chat", c, { signal: a.signal }), m = (l == null ? void 0 : l._id) || (l == null ? void 0 : l.chat_id) || this.activeId;
4312
+ if (r && m && this.upsertChat({
4313
+ _id: m,
4114
4314
  title: (l == null ? void 0 : l.title) || c.title,
4115
4315
  bookmarked: !!(l != null && l.bookmarked),
4116
4316
  _modified_at: (/* @__PURE__ */ new Date()).toISOString()
4117
4317
  }), i !== this.run) return;
4118
- f && (this.activeId = f), r && (this.chatTitle = (l == null ? void 0 : l.title) || c.title, this.bookmarked = !!(l != null && l.bookmarked));
4119
- const b = (l == null ? void 0 : l.message) ?? {}, C = typeof b.content == "string" ? b.content : (l == null ? void 0 : l.json) !== void 0 ? JSON.stringify(l.json, null, 2) : "", { text: T, followups: w } = zt(C);
4120
- e.id = b.reply_to ?? null, this.applyAttachmentResults(l == null ? void 0 : l.attachments), Object.assign(t, {
4121
- id: b._id ?? null,
4318
+ m && (this.activeId = m), this.prepared = !1, r && (this.chatTitle = (l == null ? void 0 : l.title) || c.title, this.bookmarked = !!(l != null && l.bookmarked));
4319
+ const v = (l == null ? void 0 : l.message) ?? {}, S = typeof v.content == "string" ? v.content : (l == null ? void 0 : l.json) !== void 0 ? JSON.stringify(l.json, null, 2) : "", { text: T, followups: I } = Dt(S);
4320
+ e.id = v.reply_to ?? null, this.applyAttachmentResults(l == null ? void 0 : l.attachments), Object.assign(t, {
4321
+ id: v._id ?? null,
4122
4322
  content: T,
4123
- sources: Array.isArray(b.sources) ? b.sources : [],
4124
- followups: w,
4125
- execTime: typeof b.exec_time == "number" ? b.exec_time : void 0,
4126
- model: b.model,
4323
+ sources: Array.isArray(v.sources) ? v.sources : [],
4324
+ followups: I,
4325
+ execTime: typeof v.exec_time == "number" ? v.exec_time : void 0,
4326
+ model: v.model,
4127
4327
  at: Date.now()
4128
- }), this.emit("singlebase-chat-response", { chatId: f, message: t }), await this.reveal(t, i), r && f && this.autoTitle && this.retitle(f, e.content, t.content);
4328
+ }), 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);
4129
4329
  } catch (l) {
4130
4330
  if (i !== this.run) return;
4131
- const f = Bt(l);
4132
- f && (this.chatList = this.chatList.filter((T) => T._id !== this.activeId), this.activeId = null);
4133
- const b = Rs(l), C = f ? this.msg.errNotFound : b === "KB_SOURCE_REQUIRED" ? this.msg.errKbSource : this.msg.errGeneric;
4134
- this.failTurn(t, C, b);
4331
+ const m = Tt(l);
4332
+ m && (this.chatList = this.chatList.filter((T) => T._id !== this.activeId), this.activeId = null);
4333
+ const v = qs(l), S = m ? this.msg.errNotFound : v === "KB_SOURCE_REQUIRED" ? this.msg.errKbSource : this.msg.errGeneric;
4334
+ this.failTurn(t, S, v);
4135
4335
  } finally {
4136
4336
  i === this.run && (this.busy = !1, this.abort = null, this.stick && this.scrollToBottom());
4137
4337
  }
@@ -4147,9 +4347,9 @@ ${a(x).map((S) => `- ${S}`).join(`
4147
4347
  const s = e.content.length, i = () => {
4148
4348
  e.phase = "done", this.msgs = [...this.msgs], this.arrivedKey = e.key, this.later(() => {
4149
4349
  this.arrivedKey === e.key && (this.arrivedKey = "");
4150
- }, Ls), this.stick ? this.scrollToBottom() : this.showJump = !0;
4350
+ }, Ps), this.stick ? this.scrollToBottom() : this.showJump = !0;
4151
4351
  };
4152
- if (!s || Es())
4352
+ if (!s || Gs())
4153
4353
  return i(), Promise.resolve();
4154
4354
  const a = e.content, r = Math.max(4, Math.ceil(s / 90));
4155
4355
  let c = 0;
@@ -4181,7 +4381,7 @@ ${a(x).map((S) => `- ${S}`).join(`
4181
4381
  assistant: ${s.slice(0, 1500)}`,
4182
4382
  custom_instructions: "Write a concise title (3–6 words, sentence case, no quotes, no trailing punctuation) for this conversation.",
4183
4383
  format: "text"
4184
- }), r = bs(a == null ? void 0 : a.result);
4384
+ }), r = Os(a == null ? void 0 : a.result);
4185
4385
  if (!r || this.renamed.has(e)) return;
4186
4386
  await i.llm.call("update_chat", { _id: e, title: r }), this.applyTitle(e, r, !0);
4187
4387
  } catch {
@@ -4213,9 +4413,9 @@ assistant: ${s.slice(0, 1500)}`,
4213
4413
  }
4214
4414
  }
4215
4415
  fromServer(e) {
4216
- const t = e.role === "assistant", { text: s, followups: i } = t ? zt(String(e.content ?? "")) : { text: String(e.content ?? ""), followups: [] };
4416
+ const t = e.role === "assistant", { text: s, followups: i } = t ? Dt(String(e.content ?? "")) : { text: String(e.content ?? ""), followups: [] };
4217
4417
  return {
4218
- key: bt(),
4418
+ key: St(),
4219
4419
  id: e._id ?? null,
4220
4420
  role: t ? "assistant" : "user",
4221
4421
  content: s,
@@ -4262,7 +4462,7 @@ assistant: ${s.slice(0, 1500)}`,
4262
4462
  }
4263
4463
  // ── actions ───────────────────────────────────────────────
4264
4464
  resetViewState() {
4265
- 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);
4465
+ this.panel = null, this.menuOpen = !1, this.viewOpen = !1, this.editingKey = "", this.editingTitle = !1, this.showJump = !1, this.retrievalOpen = /* @__PURE__ */ new Set(), this.sidebarOpen && !this.docked && (this.sidebarOpen = !1);
4266
4466
  }
4267
4467
  async deleteOnServer(e) {
4268
4468
  const t = this.resolvedClient, s = this.activeId;
@@ -4296,10 +4496,10 @@ assistant: ${s.slice(0, 1500)}`,
4296
4496
  /** Adds newly saved files, and says which ones the service couldn't read. */
4297
4497
  applyAttachmentResults(e) {
4298
4498
  if (!Array.isArray(e)) return;
4299
- const t = Dt(e).filter((i) => !this.savedFiles.some((a) => a.id === i.id));
4499
+ const t = Gt(e).filter((i) => !this.savedFiles.some((a) => a.id === i.id));
4300
4500
  t.length && (this.savedFiles = [...this.savedFiles, ...t]);
4301
4501
  const s = e.filter((i) => (i == null ? void 0 : i.status) === "failed").map((i) => String(i.name ?? "file"));
4302
- s.length && this.showToast(_(this.msg.attachmentFailed, { name: s.join(", ") }));
4502
+ s.length && this.showToast(j(this.msg.attachmentFailed, { name: s.join(", ") }));
4303
4503
  }
4304
4504
  /** Removes a file the service keeps on this chat. */
4305
4505
  async removeSavedFile(e) {
@@ -4403,7 +4603,7 @@ assistant: ${s.slice(0, 1500)}`,
4403
4603
  const s = { key: Date.now(), text: e, ...t };
4404
4604
  this.toast = s, this.toastTimer = setTimeout(() => {
4405
4605
  this.toast === s && this.flushToast();
4406
- }, Ms);
4606
+ }, Fs);
4407
4607
  }
4408
4608
  /** Ends the current toast, committing whatever it was holding back. */
4409
4609
  flushToast() {
@@ -4422,17 +4622,17 @@ assistant: ${s.slice(0, 1500)}`,
4422
4622
  if (!t.length) return;
4423
4623
  const s = [];
4424
4624
  for (const i of t) {
4425
- if (this.files.length + s.length >= At) {
4426
- this.showToast(_(this.msg.tooManyFiles, { n: At }));
4625
+ if (this.files.length + s.length >= Ht) {
4626
+ this.showToast(j(this.msg.tooManyFiles, { n: Ht }));
4427
4627
  break;
4428
4628
  }
4429
- if (!Os.test(i.name) && !i.type.startsWith("text/")) {
4430
- this.showToast(_(this.msg.fileType, { name: i.name }));
4629
+ if (!Bs.test(i.name) && !i.type.startsWith("text/")) {
4630
+ this.showToast(j(this.msg.fileType, { name: i.name }));
4431
4631
  continue;
4432
4632
  }
4433
- if (i.size > jt) {
4633
+ if (i.size > Wt) {
4434
4634
  this.showToast(
4435
- _(this.msg.fileTooLarge, { name: i.name, size: kt(jt) })
4635
+ j(this.msg.fileTooLarge, { name: i.name, size: Lt(Wt) })
4436
4636
  );
4437
4637
  continue;
4438
4638
  }
@@ -4464,6 +4664,7 @@ assistant: ${s.slice(0, 1500)}`,
4464
4664
  onKeydown(e) {
4465
4665
  if (e.key === "Escape") {
4466
4666
  if (this.menuOpen) this.menuOpen = !1;
4667
+ else if (this.viewOpen) this.viewOpen = !1;
4467
4668
  else if (this.panel) this.panel = null;
4468
4669
  else if (this.sidebarOpen && !this.docked) this.sidebarOpen = !1;
4469
4670
  else if (this.expanded) this.collapse();
@@ -4508,7 +4709,7 @@ assistant: ${s.slice(0, 1500)}`,
4508
4709
  this.mobile ? "full" : ""
4509
4710
  ].join(" "), s = this.isOpen ? o`<div class=${t} role="dialog" aria-label=${this.assistantName} part="frame">
4510
4711
  ${this.renderWorkspace()}
4511
- </div>` : m, i = this.bubble && !this.isOpen ? o`<div class="bubble" part="bubble">
4712
+ </div>` : b, i = this.bubble && !this.isOpen ? o`<div class="bubble" part="bubble">
4512
4713
  <button type="button" class="bubble-text" @click=${() => this.open()}>
4513
4714
  ${this.bubbleText || e.bubbleText}
4514
4715
  </button>
@@ -4519,9 +4720,9 @@ assistant: ${s.slice(0, 1500)}`,
4519
4720
  title=${e.dismiss}
4520
4721
  @click=${() => this.bubble = !1}
4521
4722
  >
4522
- ${k.close()}
4723
+ ${$.close()}
4523
4724
  </button>
4524
- </div>` : m, r = this.isOpen && (this.expanded || this.mobile) ? m : o`<button
4725
+ </div>` : b, r = this.isOpen && (this.expanded || this.mobile) ? b : o`<button
4525
4726
  type="button"
4526
4727
  class="launcher-btn"
4527
4728
  part="launcher"
@@ -4529,23 +4730,23 @@ assistant: ${s.slice(0, 1500)}`,
4529
4730
  aria-expanded=${this.isOpen ? "true" : "false"}
4530
4731
  @click=${() => this.isOpen ? this.close() : this.open()}
4531
4732
  >
4532
- ${this.isOpen ? k.chevronDown() : k.chat()}
4533
- ${this.unreadBadge && !this.seen && !this.isOpen ? o`<span class="badge"></span>` : m}
4733
+ ${this.isOpen ? $.chevronDown() : $.chat()}
4734
+ ${this.unreadBadge && !this.seen && !this.isOpen ? o`<span class="badge"></span>` : b}
4534
4735
  </button>`;
4535
4736
  return o`${s}${i}${r}`;
4536
4737
  }
4537
4738
  renderWorkspace() {
4538
4739
  const e = !this.docked;
4539
4740
  return o`<div class="root" @keydown=${this.onKeydown}>
4540
- ${this.sidebarOpen && e ? o`<div class="scrim" @click=${() => this.sidebarOpen = !1}></div>` : m}
4541
- ${this.sidebarOpen && this.sidebar !== "none" ? this.renderSidebar(e) : m}
4741
+ ${this.sidebarOpen && e ? o`<div class="scrim" @click=${() => this.sidebarOpen = !1}></div>` : b}
4742
+ ${this.sidebarOpen && this.sidebar !== "none" ? this.renderSidebar(e) : b}
4542
4743
  <main
4543
4744
  class="main"
4544
4745
  @dragenter=${this.onDragEnter}
4545
4746
  @dragover=${(t) => t.preventDefault()}
4546
4747
  >
4547
4748
  ${this.renderHeader()}
4548
- ${this.offline ? o`<div class="banner" role="status">${this.msg.offline}</div>` : m}
4749
+ ${this.offline ? o`<div class="banner" role="status">${this.msg.offline}</div>` : b}
4549
4750
  <div
4550
4751
  class="scroller"
4551
4752
  role="log"
@@ -4558,12 +4759,12 @@ assistant: ${s.slice(0, 1500)}`,
4558
4759
  </div>
4559
4760
  ${this.showJump ? o`<button type="button" class="jump" @click=${this.jumpToLatest}>
4560
4761
  ↓ ${this.msg.newReply}
4561
- </button>` : m}
4562
- ${this.renderComposer()} ${Xt(this.branding, "Chat")}
4762
+ </button>` : b}
4763
+ ${this.renderComposer()} ${ns(this.branding, "Chat")}
4563
4764
  ${this.toast ? o`<div class="toast" role="status">
4564
4765
  <span>${this.toast.text}</span>
4565
- ${this.toast.undo ? o`<button type="button" @click=${this.undo}>${this.msg.undo}</button>` : m}
4566
- </div>` : m}
4766
+ ${this.toast.undo ? o`<button type="button" @click=${this.undo}>${this.msg.undo}</button>` : b}
4767
+ </div>` : b}
4567
4768
  ${this.dragging ? o`<div
4568
4769
  class="drop"
4569
4770
  @dragover=${(t) => t.preventDefault()}
@@ -4571,15 +4772,15 @@ assistant: ${s.slice(0, 1500)}`,
4571
4772
  @drop=${this.onDrop}
4572
4773
  >
4573
4774
  <strong>${this.msg.dropTitle}</strong><span>${this.msg.dropSub}</span>
4574
- </div>` : m}
4775
+ </div>` : b}
4575
4776
  </main>
4576
4777
  ${this.renderPanel()}
4577
4778
  </div>`;
4578
4779
  }
4579
4780
  renderSidebar(e) {
4580
4781
  const t = this.msg, s = this.allowSearch ? this.search.trim().toLowerCase() : "", i = this.chatList.filter(
4581
- (f) => !s || (f.title ?? "").toLowerCase().includes(s)
4582
- ), a = (f) => this.showBookmarked && !!f.bookmarked, r = (f) => i.filter((b) => !a(b) && Ds(b._modified_at ?? b._created_at) === f), c = [
4782
+ (m) => !s || (m.title ?? "").toLowerCase().includes(s)
4783
+ ), a = (m) => this.showBookmarked && !!m.bookmarked, r = (m) => i.filter((v) => !a(v) && Ys(v._modified_at ?? v._created_at) === m), c = [
4583
4784
  [t.groupBookmarked, i.filter(a)],
4584
4785
  [t.groupToday, r("today")],
4585
4786
  [t.groupYesterday, r("yesterday")],
@@ -4589,11 +4790,11 @@ assistant: ${s.slice(0, 1500)}`,
4589
4790
  let l;
4590
4791
  return this.listState === "loading" && !this.chatList.length ? l = o`<div aria-label=${t.loadingChats}>
4591
4792
  ${[1, 2, 3, 4].map(() => o`<div class="skeleton"></div>`)}
4592
- </div>` : i.length ? l = c.filter(([, f]) => f.length).map(
4593
- ([f, b]) => o`<div class="group">${f}</div>
4594
- ${b.map((C) => this.renderThreadRow(C))}`
4793
+ </div>` : i.length ? l = c.filter(([, m]) => m.length).map(
4794
+ ([m, v]) => o`<div class="group">${m}</div>
4795
+ ${v.map((S) => this.renderThreadRow(S))}`
4595
4796
  ) : l = o`<span class="side-note"
4596
- >${s ? _(t.noMatch, { query: this.search.trim() }) : t.noChats}</span
4797
+ >${s ? j(t.noMatch, { query: this.search.trim() }) : t.noChats}</span
4597
4798
  >`, o`<aside
4598
4799
  class="sidebar ${e ? "overlay" : "docked"}"
4599
4800
  part="sidebar"
@@ -4608,27 +4809,27 @@ assistant: ${s.slice(0, 1500)}`,
4608
4809
  aria-label=${t.hideSidebar}
4609
4810
  @click=${() => this.sidebarOpen = !1}
4610
4811
  >
4611
- ${k.sidebar()}
4812
+ ${$.sidebar()}
4612
4813
  </button>
4613
4814
  </div>
4614
4815
  <div class="side-tools">
4615
4816
  ${this.showNewChat ? o`<button type="button" class="new-chat" @click=${() => this.newChat()}>
4616
- ${k.plus()}<span>${t.newChat}</span>
4617
- </button>` : m}
4817
+ ${$.plus()}<span>${t.newChat}</span>
4818
+ </button>` : b}
4618
4819
  ${this.allowSearch ? o`<input
4619
4820
  class="search"
4620
4821
  type="search"
4621
4822
  placeholder=${t.searchChats}
4622
4823
  aria-label=${t.searchChats}
4623
4824
  .value=${this.search}
4624
- @input=${(f) => this.search = f.target.value}
4625
- />` : m}
4825
+ @input=${(m) => this.search = m.target.value}
4826
+ />` : b}
4626
4827
  </div>
4627
4828
  <div class="threads">${l}</div>
4628
4829
  <div class="side-extra ${this.hasSidebarContent ? "filled" : ""}" part="sidebar-extra">
4629
4830
  <slot
4630
4831
  name="sidebar"
4631
- @slotchange=${(f) => this.hasSidebarContent = f.target.assignedNodes().length > 0}
4832
+ @slotchange=${(m) => this.hasSidebarContent = m.target.assignedNodes().length > 0}
4632
4833
  ></slot>
4633
4834
  </div>
4634
4835
  </aside>`;
@@ -4668,8 +4869,8 @@ assistant: ${s.slice(0, 1500)}`,
4668
4869
  aria-label=${e.bookmarked ? t.unbookmarkChat : t.bookmarkChat}
4669
4870
  @click=${a(() => this.toggleChatBookmark(e._id))}
4670
4871
  >
4671
- ${k.bookmark(!!e.bookmarked)}
4672
- </button>` : m}
4872
+ ${$.bookmark(!!e.bookmarked)}
4873
+ </button>` : b}
4673
4874
  ${this.allowRename ? o`<button
4674
4875
  type="button"
4675
4876
  class="icon sm"
@@ -4679,8 +4880,8 @@ assistant: ${s.slice(0, 1500)}`,
4679
4880
  this.renamingId = e._id, this.focusNext = "input.thread-rename";
4680
4881
  })}
4681
4882
  >
4682
- ${k.pencil()}
4683
- </button>` : m}
4883
+ ${$.pencil()}
4884
+ </button>` : b}
4684
4885
  ${this.allowDelete ? o`<button
4685
4886
  type="button"
4686
4887
  class="icon sm danger"
@@ -4688,14 +4889,14 @@ assistant: ${s.slice(0, 1500)}`,
4688
4889
  aria-label=${t.deleteChat}
4689
4890
  @click=${a(() => this.deleteChat(e._id))}
4690
4891
  >
4691
- ${k.trash()}
4692
- </button>` : m}
4892
+ ${$.trash()}
4893
+ </button>` : b}
4693
4894
  </span>
4694
4895
  </div>`;
4695
4896
  }
4696
4897
  renderHeader() {
4697
4898
  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;
4698
- let a = m;
4899
+ let a = b;
4699
4900
  return this.showTitle && (a = this.editingTitle ? o`<input
4700
4901
  class="title-input"
4701
4902
  maxlength="80"
@@ -4718,14 +4919,14 @@ assistant: ${s.slice(0, 1500)}`,
4718
4919
  ${this.chatTitle || e.untitled}
4719
4920
  </button>`), o`<header class="header" part="header">
4720
4921
  <div class="header-left">
4721
- ${this.sidebar === "none" || this.sidebarOpen && this.docked ? m : o`<button
4922
+ ${this.sidebar === "none" || this.sidebarOpen && this.docked ? b : o`<button
4722
4923
  type="button"
4723
4924
  class="icon"
4724
4925
  title=${e.showChats}
4725
4926
  aria-label=${e.showChats}
4726
4927
  @click=${() => this.sidebarOpen = !0}
4727
4928
  >
4728
- ${k.sidebar()}
4929
+ ${$.sidebar()}
4729
4930
  </button>`}
4730
4931
  ${a}
4731
4932
  </div>
@@ -4738,8 +4939,8 @@ assistant: ${s.slice(0, 1500)}`,
4738
4939
  aria-label=${e.newChat}
4739
4940
  @click=${() => this.newChat()}
4740
4941
  >
4741
- ${k.plus()}
4742
- </button>` : m}
4942
+ ${$.plus()}
4943
+ </button>` : b}
4743
4944
  ${this.allowBookmark ? o`<button
4744
4945
  type="button"
4745
4946
  class="icon ${this.bookmarked ? "on" : ""}"
@@ -4748,8 +4949,24 @@ assistant: ${s.slice(0, 1500)}`,
4748
4949
  aria-label=${this.bookmarked ? e.unbookmarkChat : e.bookmarkChat}
4749
4950
  @click=${() => this.activeId && this.toggleChatBookmark(this.activeId)}
4750
4951
  >
4751
- ${k.bookmark(this.bookmarked)}
4752
- </button>` : m}
4952
+ ${$.bookmark(this.bookmarked)}
4953
+ </button>` : b}
4954
+ ${this.allowViewOptions && (this.showFollowups || this.showSources) ? o`<div class="menu-wrap">
4955
+ <button
4956
+ type="button"
4957
+ class="icon ${this.viewOpen ? "on" : ""}"
4958
+ title=${e.viewOptions}
4959
+ aria-label=${e.viewOptions}
4960
+ aria-haspopup="menu"
4961
+ aria-expanded=${this.viewOpen ? "true" : "false"}
4962
+ @click=${() => {
4963
+ this.menuOpen = !1, this.viewOpen = !this.viewOpen;
4964
+ }}
4965
+ >
4966
+ ${$.view()}
4967
+ </button>
4968
+ ${this.viewOpen ? this.renderViewMenu() : b}
4969
+ </div>` : b}
4753
4970
  ${this.allowExport ? o`<div class="menu-wrap">
4754
4971
  <button
4755
4972
  type="button"
@@ -4759,12 +4976,14 @@ assistant: ${s.slice(0, 1500)}`,
4759
4976
  aria-label=${e.exportChat}
4760
4977
  aria-haspopup="menu"
4761
4978
  aria-expanded=${this.menuOpen ? "true" : "false"}
4762
- @click=${() => this.menuOpen = !this.menuOpen}
4979
+ @click=${() => {
4980
+ this.viewOpen = !1, this.menuOpen = !this.menuOpen;
4981
+ }}
4763
4982
  >
4764
- ${k.download()}
4983
+ ${$.download()}
4765
4984
  </button>
4766
- ${this.menuOpen ? this.renderExportMenu() : m}
4767
- </div>` : m}
4985
+ ${this.menuOpen ? this.renderExportMenu() : b}
4986
+ </div>` : b}
4768
4987
  ${this.allowDelete ? o`<button
4769
4988
  type="button"
4770
4989
  class="icon danger"
@@ -4773,8 +4992,8 @@ assistant: ${s.slice(0, 1500)}`,
4773
4992
  aria-label=${e.deleteChat}
4774
4993
  @click=${() => this.activeId && this.deleteChat(this.activeId)}
4775
4994
  >
4776
- ${k.trash()}
4777
- </button>` : m}
4995
+ ${$.trash()}
4996
+ </button>` : b}
4778
4997
  ${s || i ? o`<span class="divider"></span> ${s ? o`<button
4779
4998
  type="button"
4780
4999
  class="icon"
@@ -4782,8 +5001,8 @@ assistant: ${s.slice(0, 1500)}`,
4782
5001
  aria-label=${this.expanded ? e.restore : e.expand}
4783
5002
  @click=${() => this.expanded ? this.collapse() : this.expand()}
4784
5003
  >
4785
- ${this.expanded ? k.restore() : k.expand()}
4786
- </button>` : m}
5004
+ ${this.expanded ? $.restore() : $.expand()}
5005
+ </button>` : b}
4787
5006
  ${i ? o`<button
4788
5007
  type="button"
4789
5008
  class="icon"
@@ -4791,11 +5010,30 @@ assistant: ${s.slice(0, 1500)}`,
4791
5010
  aria-label=${e.minimize}
4792
5011
  @click=${i}
4793
5012
  >
4794
- ${k.minimize()}
4795
- </button>` : m}` : m}
5013
+ ${$.minimize()}
5014
+ </button>` : b}` : b}
4796
5015
  </div>
4797
5016
  </header>`;
4798
5017
  }
5018
+ /** Lets the reader hide suggested questions and sources for a cleaner view. */
5019
+ renderViewMenu() {
5020
+ const e = this.msg, t = [];
5021
+ return this.showFollowups && t.push([e.viewFollowups, "followups", this.followupsVisible]), this.showSources && t.push([e.viewSources, "sources", this.sourcesVisible]), o`<div class="menu-scrim" @click=${() => this.viewOpen = !1}></div>
5022
+ <div class="menu" role="menu">
5023
+ <span class="label">${e.viewHeading}</span>
5024
+ ${t.map(
5025
+ ([s, i, a]) => o`<button
5026
+ type="button"
5027
+ role="menuitemcheckbox"
5028
+ aria-checked=${a ? "true" : "false"}
5029
+ class="menu-item"
5030
+ @click=${() => this.toggleView(i)}
5031
+ >
5032
+ <span>${s}</span><span class="ext">${a ? $.check() : b}</span>
5033
+ </button>`
5034
+ )}
5035
+ </div>`;
5036
+ }
4799
5037
  renderExportMenu() {
4800
5038
  const e = this.msg, t = [
4801
5039
  [e.exportMarkdown, ".md", "md"],
@@ -4820,8 +5058,8 @@ assistant: ${s.slice(0, 1500)}`,
4820
5058
  }
4821
5059
  /** The suggestion cards. `[]` or `"none"` shows none; unset uses the mode's. */
4822
5060
  promptList() {
4823
- const e = this.prompts;
4824
- 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 })) : (Et[this.mode] ?? Et.chat).map(([t, s]) => ({
5061
+ const e = this.wantsStarters ? "" : this.prompts;
5062
+ return this.wantsStarters && this.starterList.length ? this.starterList.slice(0, 4).map((t) => ({ text: t })) : 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 })) : (qt[this.mode] ?? qt.chat).map(([t, s]) => ({
4825
5063
  label: t,
4826
5064
  text: s
4827
5065
  }));
@@ -4832,24 +5070,26 @@ assistant: ${s.slice(0, 1500)}`,
4832
5070
  <slot name="welcome"
4833
5071
  ><div class="welcome" part="welcome">
4834
5072
  <div class="welcome-head">
4835
- ${this.logoUrl && _t(this.logoUrl, !0) ? o`<img class="welcome-logo" src=${this.logoUrl} alt="" />` : m}
4836
- ${i ? o`<span class="label">${i}</span>` : m}
5073
+ ${this.logoUrl && Pt(this.logoUrl, !0) ? o`<img class="welcome-logo" src=${this.logoUrl} alt="" />` : b}
5074
+ ${i ? o`<span class="label">${i}</span>` : b}
4837
5075
  <h2>${this.heading || s("heading")}</h2>
4838
5076
  <p>${this.description || s("description")}</p>
4839
5077
  </div>
4840
- ${a.length ? o`<div class="prompts">
4841
- ${a.map(
5078
+ ${this.startersLoading ? o`<div class="prompts" aria-hidden="true">
5079
+ ${[0, 1, 2, 3].map(() => o`<div class="prompt skeleton"></div>`)}
5080
+ </div>` : a.length ? o`<div class="prompts">
5081
+ ${a.map(
4842
5082
  (r) => o`<button
4843
- type="button"
4844
- class="prompt"
4845
- part="prompt"
4846
- @click=${() => this.send(r.text)}
4847
- >
4848
- <span class="label">${r.label || "Suggested"}</span>
4849
- <span class="prompt-text">${r.text}</span>
4850
- </button>`
5083
+ type="button"
5084
+ class="prompt"
5085
+ part="prompt"
5086
+ @click=${() => this.send(r.text)}
5087
+ >
5088
+ <span class="label">${r.label || "Suggested"}</span>
5089
+ <span class="prompt-text">${r.text}</span>
5090
+ </button>`
4851
5091
  )}
4852
- </div>` : m}
5092
+ </div>` : b}
4853
5093
  </div></slot
4854
5094
  >
4855
5095
  </div>`;
@@ -4865,10 +5105,10 @@ assistant: ${s.slice(0, 1500)}`,
4865
5105
  @click=${() => this.openChat(this.activeId)}
4866
5106
  >
4867
5107
  ${this.msg.retry}
4868
- </button>` : m}
4869
- </div>` : m}
4870
- ${this.loadingThread ? o`${[1, 2].map(() => o`<div class="skeleton" style="height:48px"></div>`)}` : m}
4871
- ${qt(
5108
+ </button>` : b}
5109
+ </div>` : b}
5110
+ ${this.loadingThread ? o`${[1, 2].map(() => o`<div class="skeleton" style="height:48px"></div>`)}` : b}
5111
+ ${rs(
4872
5112
  this.msgs,
4873
5113
  (t) => t.key,
4874
5114
  (t, s) => t.role === "user" ? this.renderUser(t) : this.renderBot(t, s === e)
@@ -4879,8 +5119,8 @@ assistant: ${s.slice(0, 1500)}`,
4879
5119
  const t = this.msg, s = e.at ? new Date(e.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "", i = e.attachments ?? [];
4880
5120
  return o`<div class="msg user" part="message user">
4881
5121
  ${i.length ? o`<div class="attachments">
4882
- ${i.map((a) => o`<span class="doc-chip"><span class="ext">${xt(a.name)}</span><span class="name">${a.name}</span></span>`)}
4883
- </div>` : m}
5122
+ ${i.map((a) => o`<span class="doc-chip"><span class="ext">${Ot(a.name)}</span><span class="name">${a.name}</span></span>`)}
5123
+ </div>` : b}
4884
5124
  ${this.editingKey === e.key ? o`<div class="edit-box">
4885
5125
  <textarea
4886
5126
  rows="3"
@@ -4901,9 +5141,9 @@ assistant: ${s.slice(0, 1500)}`,
4901
5141
  </div>
4902
5142
  </div>` : o`<div class="bubble-user">${e.content}</div>
4903
5143
  <div class="toolbar">
4904
- ${this.allowBookmark && e.bookmarked ? o`<span class="saved">${k.bookmark(!0)}${t.saved}</span>` : m}
4905
- ${this.showTime ? o`<span class="time">${s}</span>` : m}
4906
- ${this.busy ? m : o`<button
5144
+ ${this.allowBookmark && e.bookmarked ? o`<span class="saved">${$.bookmark(!0)}${t.saved}</span>` : b}
5145
+ ${this.showTime ? o`<span class="time">${s}</span>` : b}
5146
+ ${this.busy ? b : o`<button
4907
5147
  type="button"
4908
5148
  class="icon"
4909
5149
  title=${t.edit}
@@ -4912,7 +5152,7 @@ assistant: ${s.slice(0, 1500)}`,
4912
5152
  this.editingKey = e.key, this.editDraft = e.content, this.focusNext = "textarea.edit-input";
4913
5153
  }}
4914
5154
  >
4915
- ${k.pencil()}
5155
+ ${$.pencil()}
4916
5156
  </button>`}
4917
5157
  ${this.allowCopy ? o`<button
4918
5158
  type="button"
@@ -4921,8 +5161,8 @@ assistant: ${s.slice(0, 1500)}`,
4921
5161
  aria-label=${t.copy}
4922
5162
  @click=${() => this.copy(e.key, e.content)}
4923
5163
  >
4924
- ${k.copy()}
4925
- </button>` : m}
5164
+ ${$.copy()}
5165
+ </button>` : b}
4926
5166
  ${this.allowBookmark && e.id ? o`<button
4927
5167
  type="button"
4928
5168
  class="icon ${e.bookmarked ? "on" : ""}"
@@ -4930,8 +5170,8 @@ assistant: ${s.slice(0, 1500)}`,
4930
5170
  aria-label=${e.bookmarked ? t.unbookmarkMessage : t.bookmarkMessage}
4931
5171
  @click=${() => this.toggleMessageBookmark(e)}
4932
5172
  >
4933
- ${k.bookmark(e.bookmarked)}
4934
- </button>` : m}
5173
+ ${$.bookmark(e.bookmarked)}
5174
+ </button>` : b}
4935
5175
  ${this.allowDelete ? o`<button
4936
5176
  type="button"
4937
5177
  class="icon danger"
@@ -4939,8 +5179,8 @@ assistant: ${s.slice(0, 1500)}`,
4939
5179
  aria-label=${t.deleteMessage}
4940
5180
  @click=${() => this.deleteMessage(e)}
4941
5181
  >
4942
- ${k.trash()}
4943
- </button>` : m}
5182
+ ${$.trash()}
5183
+ </button>` : b}
4944
5184
  </div>`}
4945
5185
  </div>`;
4946
5186
  }
@@ -4948,102 +5188,105 @@ assistant: ${s.slice(0, 1500)}`,
4948
5188
  return this.mode === "rag" || this.mode === "kb" ? this.msg.searching : this.msg.thinking;
4949
5189
  }
4950
5190
  renderBot(e, t) {
4951
- const s = this.msg, i = e.phase === "pending", a = e.phase === "done", r = e.sources.length, c = Ot(e.content), l = e.sources.map((w, L) => ft(w, L + 1)), f = c.size ? l.filter((w) => c.has(w.n)) : l, b = e.at ? new Date(e.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "", C = e.content + (f.length ? `
5191
+ const s = this.msg, i = e.phase === "pending", a = e.phase === "done", r = e.sources.length, c = Bt(e.content), l = e.sources.map((f, y) => kt(f, y + 1)), m = It(c.size ? l.filter((f) => c.has(f.n)) : l), v = It(l), S = (f) => {
5192
+ var y;
5193
+ return ((y = this.panel) == null ? void 0 : y.key) === e.key && f.items.some((C) => C.n === this.panel.n);
5194
+ }, T = e.at ? new Date(e.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "", I = e.content + (m.length ? `
4952
5195
 
4953
5196
  Sources:
4954
- ${f.map((w) => `[${w.n}] ${w.title}`).join(`
4955
- `)}` : ""), T = this.retrievalOpen.has(e.key);
5197
+ ${m.map((f) => `${f.items.map((y) => `[${y.n}]`).join("")} ${f.first.title}`).join(`
5198
+ `)}` : ""), w = this.retrievalOpen.has(e.key);
4956
5199
  return o`<div class="msg bot" part="message assistant">
4957
- ${i ? o`<div class="halo"></div>` : m}
5200
+ ${i ? o`<div class="halo"></div>` : b}
4958
5201
  ${this.arrivedKey === e.key ? o`<div class="arrived">
4959
5202
  <div class="wash"></div>
4960
5203
  <div class="ring"></div>
4961
5204
  <div class="sweep"></div>
4962
- </div>` : m}
5205
+ </div>` : b}
4963
5206
  <div class="bot-body">
4964
- ${this.allowBookmark && e.bookmarked ? o`<span class="saved">${k.bookmark(!0)}${s.saved}</span>` : m}
5207
+ ${this.allowBookmark && e.bookmarked ? o`<span class="saved">${$.bookmark(!0)}${s.saved}</span>` : b}
4965
5208
  ${i ? o`<div class="pill" role="status">
4966
5209
  <span class="ring"></span><span class="dot"></span>
4967
5210
  <span class="shimmer">${this.pillLabel()}</span>
4968
- </div>` : m}
4969
- ${this.showSources && r && !i ? o`<div class="retrieval">
5211
+ </div>` : b}
5212
+ ${this.sourcesVisible && r && !i ? o`<div class="retrieval">
4970
5213
  <button
4971
5214
  type="button"
4972
5215
  class="retrieval-toggle"
4973
- aria-expanded=${T ? "true" : "false"}
5216
+ aria-expanded=${w ? "true" : "false"}
4974
5217
  @click=${() => {
4975
- const w = new Set(this.retrievalOpen);
4976
- w.has(e.key) ? w.delete(e.key) : w.add(e.key), this.retrievalOpen = w;
5218
+ const f = new Set(this.retrievalOpen);
5219
+ f.has(e.key) ? f.delete(e.key) : f.add(e.key), this.retrievalOpen = f;
4977
5220
  }}
4978
5221
  >
4979
- <span class="chev">${T ? "▾" : "▸"}</span>
4980
- <span style="flex:1">${_(s.searchedSources, { n: r })}</span>
4981
- ${e.execTime !== void 0 ? o`<span class="ms">${e.execTime.toFixed(1)}s</span>` : m}
5222
+ <span class="chev">${w ? "▾" : "▸"}</span>
5223
+ <span style="flex:1">${j(s.searchedSources, { n: v.length })}</span>
5224
+ ${e.execTime !== void 0 ? o`<span class="ms">${e.execTime.toFixed(1)}s</span>` : b}
4982
5225
  </button>
4983
- ${T ? o`<div class="retrieval-list">
4984
- ${l.map(
4985
- (w) => o`<button
4986
- type="button"
4987
- class="passage"
4988
- @click=${() => this.panel = { key: e.key, n: w.n }}
5226
+ ${w ? o`<div class="retrieval-list">
5227
+ ${v.map((f) => {
5228
+ const y = f.first, C = f.items.map((Ct) => Ct.score).filter((Ct) => Ct !== null), L = C.length ? Math.max(...C) : null, $t = f.items.length > 1 ? j(s.passageCount, { n: f.items.length }) : y.section;
5229
+ return o`<button
5230
+ type="button"
5231
+ class="passage"
5232
+ @click=${() => this.panel = { key: e.key, n: y.n }}
5233
+ >
5234
+ <span class="n">${y.n}</span>
5235
+ <span class="what"
5236
+ ><span>${y.title}${$t ? ` · ${$t}` : ""}</span
5237
+ ><span>${y.collection || y.path}</span></span
4989
5238
  >
4990
- <span class="n">${w.n}</span>
4991
- <span class="what"
4992
- ><span>${w.title}${w.section ? ` · ${w.section}` : ""}</span
4993
- ><span>${w.collection || w.path}</span></span
4994
- >
4995
- ${w.score !== null ? o`<span class="relevance"
4996
- ><span class="score">${w.score.toFixed(2)}</span>
4997
- <span class="relevance-track"
4998
- ><span
4999
- class="relevance-fill"
5000
- style="width:${Math.round(w.score * 100)}%"
5001
- ></span></span
5002
- ></span>` : o`<span></span>`}
5003
- </button>`
5004
- )}
5005
- </div>` : m}
5006
- </div>` : m}
5007
- ${i ? m : this.renderAnswer(e)}
5008
- ${e.phase === "streaming" ? o`<span class="caret"></span>` : m}
5239
+ ${L !== null ? o`<span class="relevance"
5240
+ ><span class="score">${L.toFixed(2)}</span>
5241
+ <span class="relevance-track"
5242
+ ><span
5243
+ class="relevance-fill"
5244
+ style="width:${Math.round(L * 100)}%"
5245
+ ></span></span
5246
+ ></span>` : o`<span></span>`}
5247
+ </button>`;
5248
+ })}
5249
+ </div>` : b}
5250
+ </div>` : b}
5251
+ ${i ? b : this.renderAnswer(e)}
5252
+ ${e.phase === "streaming" ? o`<span class="caret"></span>` : b}
5009
5253
  ${e.phase === "error" ? o`<div class="error-card" role="alert">
5010
5254
  <span>${e.error}</span>
5011
5255
  <button type="button" class="btn" @click=${() => this.retry(e)}>
5012
5256
  ${s.retry}
5013
5257
  </button>
5014
- </div>` : m}
5015
- ${this.showSources && a && f.length ? o`<div class="cards">
5258
+ </div>` : b}
5259
+ ${this.sourcesVisible && a && m.length ? o`<div class="cards">
5016
5260
  <span class="label">${c.size ? s.sourcesCited : s.sourcesRetrieved}</span>
5017
5261
  <div class="card-grid">
5018
- ${f.map(
5019
- (w) => {
5020
- var L;
5021
- return o`<button
5022
- type="button"
5023
- class="source-card ${((L = this.panel) == null ? void 0 : L.key) === e.key && this.panel.n === w.n ? "active" : ""}"
5024
- @click=${() => this.panel = { key: e.key, n: w.n }}
5262
+ ${m.map((f) => {
5263
+ const y = f.first, C = f.items.length > 1 ? j(s.passageCount, { n: f.items.length }) : y.section;
5264
+ return o`<button
5265
+ type="button"
5266
+ class="source-card ${S(f) ? "active" : ""}"
5267
+ @click=${() => this.panel = { key: e.key, n: y.n }}
5268
+ >
5269
+ <span class="top"
5270
+ ><span class="nums"
5271
+ >${f.items.map((L) => o`<span class="num">${L.n}</span>`)}</span
5272
+ >${y.collection ? o`<span class="label">${y.collection}</span>` : b}</span
5025
5273
  >
5026
- <span class="top"
5027
- ><span class="num">${w.n}</span
5028
- >${w.collection ? o`<span class="label">${w.collection}</span>` : m}</span
5029
- >
5030
- <span class="t">${w.title}${w.section ? ` · ${w.section}` : ""}</span>
5031
- <span class="s">${w.text}</span>
5032
- </button>`;
5033
- }
5034
- )}
5274
+ <span class="t">${y.title}${C ? ` · ${C}` : ""}</span>
5275
+ <span class="s">${y.text}</span>
5276
+ </button>`;
5277
+ })}
5035
5278
  </div>
5036
- </div>` : m}
5279
+ </div>` : b}
5037
5280
  ${a ? o`<div class="toolbar ${t ? "pinned" : ""}">
5038
5281
  ${this.allowCopy ? o`<button
5039
5282
  type="button"
5040
5283
  class="icon"
5041
5284
  title=${this.copiedKey === e.key ? s.copied : s.copy}
5042
5285
  aria-label=${s.copy}
5043
- @click=${() => this.copy(e.key, C)}
5286
+ @click=${() => this.copy(e.key, I)}
5044
5287
  >
5045
- ${k.copy()}
5046
- </button>` : m}
5288
+ ${$.copy()}
5289
+ </button>` : b}
5047
5290
  ${this.allowRaw && this.formatLevel !== "raw" && e.content ? o`<button
5048
5291
  type="button"
5049
5292
  class="icon ${this.rawKeys.has(e.key) ? "on" : ""}"
@@ -5052,8 +5295,8 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5052
5295
  aria-pressed=${this.rawKeys.has(e.key) ? "true" : "false"}
5053
5296
  @click=${() => this.toggleRaw(e.key)}
5054
5297
  >
5055
- ${k.raw()}
5056
- </button>` : m}
5298
+ ${$.raw()}
5299
+ </button>` : b}
5057
5300
  ${this.allowRegenerate && t && !this.busy ? o`<button
5058
5301
  type="button"
5059
5302
  class="icon"
@@ -5061,8 +5304,8 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5061
5304
  aria-label=${s.regenerate}
5062
5305
  @click=${() => this.regenerate()}
5063
5306
  >
5064
- ${k.refresh()}
5065
- </button>` : m}
5307
+ ${$.refresh()}
5308
+ </button>` : b}
5066
5309
  ${this.allowBookmark && e.id ? o`<button
5067
5310
  type="button"
5068
5311
  class="icon ${e.bookmarked ? "on" : ""}"
@@ -5070,8 +5313,8 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5070
5313
  aria-label=${e.bookmarked ? s.unbookmarkMessage : s.bookmarkMessage}
5071
5314
  @click=${() => this.toggleMessageBookmark(e)}
5072
5315
  >
5073
- ${k.bookmark(e.bookmarked)}
5074
- </button>` : m}
5316
+ ${$.bookmark(e.bookmarked)}
5317
+ </button>` : b}
5075
5318
  ${this.allowDelete ? o`<button
5076
5319
  type="button"
5077
5320
  class="icon danger"
@@ -5079,10 +5322,10 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5079
5322
  aria-label=${s.deleteMessage}
5080
5323
  @click=${() => this.deleteMessage(e)}
5081
5324
  >
5082
- ${k.trash()}
5083
- </button>` : m}
5084
- ${this.showTime ? o`<span class="time">${b}</span>` : m}
5085
- ${e.stopped ? o`<span class="note">${s.stopped}</span>` : m}
5325
+ ${$.trash()}
5326
+ </button>` : b}
5327
+ ${this.showTime ? o`<span class="time">${T}</span>` : b}
5328
+ ${e.stopped ? o`<span class="note">${s.stopped}</span>` : b}
5086
5329
  <span class="spacer"></span>
5087
5330
  ${this.allowFeedback ? e.feedback ? o`<span class="note"
5088
5331
  >${e.feedback === "up" ? s.markedHelpful : s.thanksFeedback}</span
@@ -5093,7 +5336,7 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5093
5336
  aria-label=${s.helpful}
5094
5337
  @click=${() => this.feedback(e, "up")}
5095
5338
  >
5096
- ${k.thumb()}
5339
+ ${$.thumb()}
5097
5340
  </button>
5098
5341
  <button
5099
5342
  type="button"
@@ -5102,28 +5345,28 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5102
5345
  aria-label=${s.notHelpful}
5103
5346
  @click=${() => this.feedback(e, "down")}
5104
5347
  >
5105
- ${k.thumb(!0)}
5106
- </button>` : m}
5107
- </div>` : m}
5108
- ${this.showFollowups && a && t && !this.busy && e.followups.length ? o`<div class="followups">
5348
+ ${$.thumb(!0)}
5349
+ </button>` : b}
5350
+ </div>` : b}
5351
+ ${this.followupsVisible && a && t && !this.busy && e.followups.length ? o`<div class="followups">
5109
5352
  ${e.followups.map(
5110
- (w) => o`<button type="button" class="followup" @click=${() => this.send(w)}>
5111
- <span class="arrow">↳</span><span>${w}</span>
5353
+ (f) => o`<button type="button" class="followup" @click=${() => this.send(f)}>
5354
+ <span class="arrow">↳</span><span>${f}</span>
5112
5355
  </button>`
5113
5356
  )}
5114
- </div>` : m}
5357
+ </div>` : b}
5115
5358
  </div>
5116
5359
  </div>`;
5117
5360
  }
5118
5361
  renderAnswer(e) {
5119
- if (e.phase === "error" && !e.content) return m;
5362
+ if (e.phase === "error" && !e.content) return b;
5120
5363
  if (e.phase === "done" && !e.content)
5121
- return e.stopped ? m : o`<div class="answer"><p class="note">${this.msg.emptyReply}</p></div>`;
5364
+ return e.stopped ? b : o`<div class="answer"><p class="note">${this.msg.emptyReply}</p></div>`;
5122
5365
  const t = this.formatLevel;
5123
5366
  if (t === "raw" || this.allowRaw && this.rawKeys.has(e.key))
5124
5367
  return o`<div class="answer" part="answer"><p class="raw">${e.content}</p></div>`;
5125
- const s = e.phase === "streaming" ? ps(e.content) : e.content;
5126
- let i = gs(os(s), t);
5368
+ const s = e.phase === "streaming" ? ks(e.content) : e.content;
5369
+ let i = Ss(bs(s), t);
5127
5370
  if (this.afterParse)
5128
5371
  try {
5129
5372
  const r = this.afterParse(i, { message: e, format: t });
@@ -5134,7 +5377,7 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5134
5377
  console.warn("[singlebase-chat] afterParse failed; showing the original.", r);
5135
5378
  }
5136
5379
  const a = e.sources.reduce(
5137
- (r, c, l) => Math.max(r, ft(c, l + 1).n),
5380
+ (r, c, l) => Math.max(r, kt(c, l + 1).n),
5138
5381
  0
5139
5382
  );
5140
5383
  return o`<div class="answer" part="answer">
@@ -5142,7 +5385,7 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5142
5385
  </div>`;
5143
5386
  }
5144
5387
  renderInline(e, t, s) {
5145
- return ds(e, s).map((i) => {
5388
+ return ys(e, s).map((i) => {
5146
5389
  var a;
5147
5390
  switch (i.type) {
5148
5391
  case "bold":
@@ -5158,7 +5401,7 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5158
5401
  >${i.text}</a
5159
5402
  >`;
5160
5403
  case "cite": {
5161
- const r = ((a = this.panel) == null ? void 0 : a.key) === t.key && this.panel.n === i.n ? "cite active" : "cite", c = _(this.msg.openSource, { n: i.n });
5404
+ const r = ((a = this.panel) == null ? void 0 : a.key) === t.key && this.panel.n === i.n ? "cite active" : "cite", c = j(this.msg.openSource, { n: i.n });
5162
5405
  return o`<button type="button" class=${r} aria-label=${c} @click=${() => this.panel = { key: t.key, n: i.n }}>${i.n}</button>`;
5163
5406
  }
5164
5407
  default:
@@ -5183,7 +5426,7 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5183
5426
  case "callout":
5184
5427
  return o`<div class="callout ${e.kind}" role="note" part="callout">
5185
5428
  <strong class="callout-title"
5186
- >${e.title || this.msg[_s[e.kind]]}</strong
5429
+ >${e.title || this.msg[Ks[e.kind]]}</strong
5187
5430
  >
5188
5431
  ${e.text.split(`
5189
5432
  `).filter((a) => a.trim()).map((a) => o`<p>${this.renderInline(a, t, s)}</p>`)}
@@ -5202,7 +5445,7 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5202
5445
  case "json":
5203
5446
  return this.renderJsonBlock(e.value, e.source, `${t.key}:${i}`);
5204
5447
  case "svg": {
5205
- const a = ws(e.source);
5448
+ const a = _s(e.source);
5206
5449
  if (!a) return this.renderCode("svg", e.source, `${t.key}:${i}`);
5207
5450
  const r = `${t.key}:${i}`;
5208
5451
  return o`<figure class="svg" part="svg">
@@ -5226,18 +5469,18 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5226
5469
  return o`<div class="gallery ${e.images.length > 1 ? "many" : ""}">
5227
5470
  ${e.images.map(
5228
5471
  (a) => o`<figure>
5229
- ${a.src && _t(a.src, !0) ? o`<img
5472
+ ${a.src && Pt(a.src, !0) ? o`<img
5230
5473
  src=${a.src}
5231
5474
  alt=${a.alt}
5232
5475
  loading="lazy"
5233
5476
  referrerpolicy="no-referrer"
5234
5477
  />` : o`<div class="img-missing"><span class="label">Image</span></div>`}
5235
- ${a.alt ? o`<figcaption>${a.alt}</figcaption>` : m}
5478
+ ${a.alt ? o`<figcaption>${a.alt}</figcaption>` : b}
5236
5479
  </figure>`
5237
5480
  )}
5238
5481
  </div>`;
5239
5482
  default:
5240
- return m;
5483
+ return b;
5241
5484
  }
5242
5485
  }
5243
5486
  renderList(e, t, s, i) {
@@ -5246,7 +5489,7 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5246
5489
  class=${r.checked === null ? "" : "task"}
5247
5490
  style=${r.depth ? `margin-left:${r.depth * 20}px` : ""}
5248
5491
  >
5249
- ${r.checked === null ? m : o`<input type="checkbox" disabled .checked=${r.checked} aria-hidden="true" />`}
5492
+ ${r.checked === null ? b : o`<input type="checkbox" disabled .checked=${r.checked} aria-hidden="true" />`}
5250
5493
  ${this.renderInline(r.text, s, i)}
5251
5494
  </li>`
5252
5495
  );
@@ -5280,72 +5523,72 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5280
5523
  }
5281
5524
  }
5282
5525
  renderTable(e, t, s, i, a, r) {
5283
- const c = (x) => /^[-+]?[$€£¥]?\s?[\d,.]+\s?%?$/.test(x.trim()) && /\d/.test(x), l = (x) => Number(x.replace(/[^\d.+-]/g, "")), f = e.map((x, S) => {
5284
- if (s[S]) return s[S];
5285
- const $ = t.map((A) => A[S] ?? "").filter(Boolean);
5286
- return $.length && $.filter(c).length / $.length >= 0.8 ? "right" : null;
5287
- }), b = this.sorts.get(r);
5288
- let C = t;
5289
- b && (C = [...t].sort((x, S) => {
5290
- const $ = x[b.col] ?? "", A = S[b.col] ?? "";
5291
- return (c($) && c(A) ? l($) - l(A) : $.localeCompare(A, void 0, { numeric: !0 })) * b.dir;
5526
+ const c = (f) => /^[-+]?[$€£¥]?\s?[\d,.]+\s?%?$/.test(f.trim()) && /\d/.test(f), l = (f) => Number(f.replace(/[^\d.+-]/g, "")), m = e.map((f, y) => {
5527
+ if (s[y]) return s[y];
5528
+ const C = t.map((L) => L[y] ?? "").filter(Boolean);
5529
+ return C.length && C.filter(c).length / C.length >= 0.8 ? "right" : null;
5530
+ }), v = this.sorts.get(r);
5531
+ let S = t;
5532
+ v && (S = [...t].sort((f, y) => {
5533
+ const C = f[v.col] ?? "", L = y[v.col] ?? "";
5534
+ return (c(C) && c(L) ? l(C) - l(L) : C.localeCompare(L, void 0, { numeric: !0 })) * v.dir;
5292
5535
  }));
5293
- const T = C.length;
5294
- C = C.slice(0, zs);
5295
- const w = (x) => {
5296
- const S = new Map(this.sorts), $ = S.get(r);
5297
- ($ == null ? void 0 : $.col) === x && $.dir === -1 ? S.delete(r) : S.set(r, { col: x, dir: ($ == null ? void 0 : $.col) === x ? -1 : 1 }), this.sorts = S;
5298
- }, L = (x) => f[x] ? `text-align:${f[x]}` : "";
5536
+ const T = S.length;
5537
+ S = S.slice(0, Ds);
5538
+ const I = (f) => {
5539
+ const y = new Map(this.sorts), C = y.get(r);
5540
+ (C == null ? void 0 : C.col) === f && C.dir === -1 ? y.delete(r) : y.set(r, { col: f, dir: (C == null ? void 0 : C.col) === f ? -1 : 1 }), this.sorts = y;
5541
+ }, w = (f) => m[f] ? `text-align:${m[f]}` : "";
5299
5542
  return o`<div class="table" part="table">
5300
5543
  <table>
5301
5544
  <thead>
5302
5545
  <tr>
5303
- ${e.map((x, S) => {
5304
- const $ = (b == null ? void 0 : b.col) === S ? b.dir === 1 ? "ascending" : "descending" : "none";
5305
- return o`<th style=${L(S)} aria-sort=${$}>
5306
- ${t.length > 1 ? o`<button type="button" class="sort" @click=${() => w(S)}>
5307
- ${this.renderInline(x, i, a)}<span class="arrow"
5308
- >${$ === "ascending" ? "↑" : $ === "descending" ? "↓" : "↕"}</span
5546
+ ${e.map((f, y) => {
5547
+ const C = (v == null ? void 0 : v.col) === y ? v.dir === 1 ? "ascending" : "descending" : "none";
5548
+ return o`<th style=${w(y)} aria-sort=${C}>
5549
+ ${t.length > 1 ? o`<button type="button" class="sort" @click=${() => I(y)}>
5550
+ ${this.renderInline(f, i, a)}<span class="arrow"
5551
+ >${C === "ascending" ? "↑" : C === "descending" ? "↓" : "↕"}</span
5309
5552
  >
5310
- </button>` : this.renderInline(x, i, a)}
5553
+ </button>` : this.renderInline(f, i, a)}
5311
5554
  </th>`;
5312
5555
  })}
5313
5556
  </tr>
5314
5557
  </thead>
5315
5558
  <tbody>
5316
- ${C.map(
5317
- (x) => o`<tr>
5559
+ ${S.map(
5560
+ (f) => o`<tr>
5318
5561
  ${e.map(
5319
- (S, $) => o`<td style=${L($)}>
5320
- ${this.renderInline(x[$] ?? "", i, a)}
5562
+ (y, C) => o`<td style=${w(C)}>
5563
+ ${this.renderInline(f[C] ?? "", i, a)}
5321
5564
  </td>`
5322
5565
  )}
5323
5566
  </tr>`
5324
5567
  )}
5325
5568
  </tbody>
5326
5569
  </table>
5327
- ${T > C.length ? o`<div class="table-note">
5328
- ${_(this.msg.showingRows, { n: C.length, total: T })}
5329
- </div>` : m}
5570
+ ${T > S.length ? o`<div class="table-note">
5571
+ ${j(this.msg.showingRows, { n: S.length, total: T })}
5572
+ </div>` : b}
5330
5573
  </div>`;
5331
5574
  }
5332
5575
  renderJsonBlock(e, t, s) {
5333
5576
  let i = 0;
5334
5577
  const a = (c) => {
5335
- i++, i <= Nt && c && typeof c == "object" && Object.values(c).forEach(a);
5578
+ i++, i <= Vt && c && typeof c == "object" && Object.values(c).forEach(a);
5336
5579
  };
5337
- if (a(e), i > Nt) return this.renderCode("json", t, s);
5338
- const r = (c, l, f) => {
5339
- const b = f === void 0 ? m : o`<span class="jkey">${f}</span>: `;
5580
+ if (a(e), i > Vt) return this.renderCode("json", t, s);
5581
+ const r = (c, l, m) => {
5582
+ const v = m === void 0 ? b : o`<span class="jkey">${m}</span>: `;
5340
5583
  if (c && typeof c == "object") {
5341
- const T = Object.entries(c), w = Array.isArray(c) ? `[${T.length}]` : `{${T.length}}`;
5584
+ const T = Object.entries(c), I = Array.isArray(c) ? `[${T.length}]` : `{${T.length}}`;
5342
5585
  return o`<details class="jnode" ?open=${l < 2}>
5343
- <summary>${b}<span class="jmeta">${w}</span></summary>
5344
- <div class="jkids">${T.map(([L, x]) => r(x, l + 1, L))}</div>
5586
+ <summary>${v}<span class="jmeta">${I}</span></summary>
5587
+ <div class="jkids">${T.map(([w, f]) => r(f, l + 1, w))}</div>
5345
5588
  </details>`;
5346
5589
  }
5347
5590
  return o`<div class="jleaf">
5348
- ${b}<span class="jv ${c === null ? "null" : typeof c}">${JSON.stringify(c)}</span>
5591
+ ${v}<span class="jv ${c === null ? "null" : typeof c}">${JSON.stringify(c)}</span>
5349
5592
  </div>`;
5350
5593
  };
5351
5594
  return o`<div class="code json" part="json">
@@ -5364,23 +5607,23 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5364
5607
  (r, c) => o`<span
5365
5608
  ><span
5366
5609
  class="swatch"
5367
- style="background:${j[c % j.length]}"
5610
+ style="background:${A[c % A.length]}"
5368
5611
  ></span
5369
5612
  >${r.name}</span
5370
5613
  >`
5371
5614
  )}
5372
- </span>` : m, s = o`<div class="chart-head">
5615
+ </span>` : b, s = o`<div class="chart-head">
5373
5616
  <span class="chart-title">${e.title}</span>${t}
5374
5617
  </div>`;
5375
5618
  if (e.type === "line") {
5376
- const r = Math.max(0, ...e.series.flatMap((b) => b.values)), c = Math.pow(10, Math.floor(Math.log10(r || 1))), l = Math.ceil(r / c * 2) / 2 * c || 1, f = Math.max(e.labels.length, ...e.series.map((b) => b.values.length));
5619
+ const r = Math.max(0, ...e.series.flatMap((v) => v.values)), c = Math.pow(10, Math.floor(Math.log10(r || 1))), l = Math.ceil(r / c * 2) / 2 * c || 1, m = Math.max(e.labels.length, ...e.series.map((v) => v.values.length));
5377
5620
  return o`<figure class="chart" part="chart" aria-label=${e.title}>
5378
5621
  ${s}
5379
5622
  <div class="line-chart">
5380
5623
  <div class="plot">
5381
5624
  ${[1, 0.5, 0].map(
5382
- (b) => o`<div class="tick ${b === 0 ? "base" : ""}" style="top:${(1 - b) * 100}%">
5383
- <span>${mt(Math.round(l * b), e.unit)}</span>
5625
+ (v) => o`<div class="tick ${v === 0 ? "base" : ""}" style="top:${(1 - v) * 100}%">
5626
+ <span>${yt(Math.round(l * v), e.unit)}</span>
5384
5627
  </div>`
5385
5628
  )}
5386
5629
  <svg
@@ -5390,64 +5633,66 @@ ${f.map((w) => `[${w.n}] ${w.title}`).join(`
5390
5633
  aria-label=${e.title}
5391
5634
  >
5392
5635
  ${e.series.map(
5393
- (b, C) => O`<polyline pathLength="1" stroke=${j[C % j.length]}
5394
- points=${b.values.map(
5395
- (T, w) => `${(f > 1 ? w / (f - 1) * 600 : 300).toFixed(1)},${(170 - T / l * 170).toFixed(1)}`
5636
+ (v, S) => _`<polyline pathLength="1" stroke=${A[S % A.length]}
5637
+ points=${v.values.map(
5638
+ (T, I) => `${(m > 1 ? I / (m - 1) * 600 : 300).toFixed(1)},${(170 - T / l * 170).toFixed(1)}`
5396
5639
  ).join(
5397
5640
  " "
5398
- )}><title>${b.name}: ${b.values.map((T) => mt(T, e.unit)).join(", ")}</title></polyline>`
5641
+ )}><title>${v.name}: ${v.values.map((T) => yt(T, e.unit)).join(", ")}</title></polyline>`
5399
5642
  )}
5400
5643
  </svg>
5401
5644
  </div>
5402
- <div class="x-labels">${e.labels.map((b) => o`<span>${b}</span>`)}</div>
5645
+ <div class="x-labels">${e.labels.map((v) => o`<span>${v}</span>`)}</div>
5403
5646
  </div>
5404
5647
  </figure>`;
5405
5648
  }
5406
5649
  const i = e.labels.map(
5407
- (r, c) => e.series.reduce((l, f) => l + (f.values[c] || 0), 0)
5650
+ (r, c) => e.series.reduce((l, m) => l + (m.values[c] || 0), 0)
5408
5651
  ), a = Math.max(0, ...i) || 1;
5409
5652
  return o`<figure class="chart" part="chart" aria-label=${e.title}>
5410
5653
  ${s}
5411
5654
  <div class="bars">
5412
5655
  ${e.labels.map(
5413
- (r, c) => o`<div class="bar-row" title="${r}: ${mt(i[c], e.unit)}">
5656
+ (r, c) => o`<div class="bar-row" title="${r}: ${yt(i[c], e.unit)}">
5414
5657
  <span class="bar-label">${r}</span>
5415
5658
  <span class="bar-track"
5416
5659
  ><span class="bar-fill" style="width:${Math.max(0, i[c]) / a * 100}%">
5417
5660
  ${e.series.map(
5418
- (l, f) => o`<span
5419
- style="flex:${Math.max(0, l.values[c] || 0)};background:${e.series.length > 1 ? j[f % j.length] : "var(--c-ink)"}"
5661
+ (l, m) => o`<span
5662
+ style="flex:${Math.max(0, l.values[c] || 0)};background:${e.series.length > 1 ? A[m % A.length] : "var(--c-ink)"}"
5420
5663
  ></span>`
5421
5664
  )}
5422
5665
  </span></span
5423
5666
  >
5424
- <span class="bar-value">${mt(i[c], e.unit)}</span>
5667
+ <span class="bar-value">${yt(i[c], e.unit)}</span>
5425
5668
  </div>`
5426
5669
  )}
5427
5670
  </div>
5428
5671
  </figure>`;
5429
5672
  }
5430
5673
  renderPanel() {
5431
- if (!this.panel) return m;
5432
- const e = this.msgs.find((b) => b.key === this.panel.key);
5433
- if (!e) return m;
5434
- const t = e.sources.map((b, C) => ft(b, C + 1)), s = t.find((b) => b.n === this.panel.n);
5435
- if (!s) return m;
5436
- const i = this.msg, a = Ot(e.content), r = t.filter((b) => b.n !== s.n && (!a.size || a.has(b.n))), c = `ref:${e.key}:${s.n}`, l = `"${s.text}"
5437
- — ${s.title} [${s.n}]${s.path ? `
5438
- ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5674
+ var I;
5675
+ if (!this.panel) return b;
5676
+ const e = this.msgs.find((w) => w.key === this.panel.key);
5677
+ if (!e) return b;
5678
+ const t = e.sources.map((w, f) => kt(w, f + 1)), s = t.find((w) => w.n === this.panel.n);
5679
+ if (!s) return b;
5680
+ const i = this.msg, a = Bt(e.content), r = t.filter((w) => w.n === s.n || !a.size || a.has(w.n)), c = It(r), l = ((I = c.find((w) => w.doc === s.doc)) == null ? void 0 : I.items) ?? [s], m = c.filter((w) => w.doc !== s.doc), v = l.map((w) => w.score).filter((w) => w !== null), S = [
5439
5681
  s.updated ? `Updated ${s.updated}` : "",
5440
- s.score !== null ? `Relevance ${s.score.toFixed(2)}` : ""
5441
- ].filter(Boolean).join(" · ");
5682
+ v.length ? `Relevance ${Math.max(...v).toFixed(2)}` : "",
5683
+ l.length > 1 ? j(i.passageCount, { n: l.length }) : ""
5684
+ ].filter(Boolean).join(" · "), T = (w) => `"${w.text}"
5685
+ — ${w.title} [${w.n}]${w.path ? `
5686
+ ${w.path}` : ""}${w.updated ? ` · Updated ${w.updated}` : ""}`;
5442
5687
  return o`<aside
5443
5688
  class="panel ${this.panelDocked ? "docked" : "overlay"}"
5444
5689
  part="panel"
5445
5690
  role="region"
5446
- aria-label=${_(i.sourceLabel, { n: s.n })}
5691
+ aria-label=${j(i.sourceLabel, { n: s.n })}
5447
5692
  >
5448
5693
  <div class="panel-head">
5449
5694
  <span class="label"
5450
- >${_(i.sourceLabel, { n: s.n })}${s.collection ? ` · ${s.collection}` : ""}</span
5695
+ >${j(i.sourceLabel, { n: l.map((w) => w.n).join(", ") })}${s.collection ? ` · ${s.collection}` : ""}</span
5451
5696
  >
5452
5697
  <button type="button" class="text-btn underline" @click=${() => this.panel = null}>
5453
5698
  ${i.close}
@@ -5456,45 +5701,55 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5456
5701
  <div class="panel-body">
5457
5702
  <div class="panel-meta">
5458
5703
  <h3>${s.title}</h3>
5459
- ${s.section ? o`<span class="meta">${s.section}</span>` : m}
5460
- ${s.path ? o`<span class="path">${s.path}</span>` : m}
5461
- ${f ? o`<span class="meta">${f}</span>` : m}
5462
- </div>
5463
- <div class="passage-box">
5464
- <span class="text">${s.text}</span>
5465
- <div class="passage-foot">
5466
- <span class="label">${i.citedPassage}</span>
5467
- <button
5468
- type="button"
5469
- class="copy-ref"
5470
- title=${i.copyReference}
5471
- aria-label=${i.copyReference}
5472
- @click=${() => this.copy(c, l)}
5473
- >
5474
- ${k.copy()}<span>${this.copiedKey === c ? i.copied : i.copy}</span>
5475
- </button>
5476
- </div>
5704
+ ${l.length === 1 && s.section ? o`<span class="meta">${s.section}</span>` : b}
5705
+ ${s.path ? o`<span class="path">${s.path}</span>` : b}
5706
+ ${S ? o`<span class="meta">${S}</span>` : b}
5477
5707
  </div>
5708
+ ${l.map((w) => {
5709
+ const f = `ref:${e.key}:${w.n}`;
5710
+ return o`<div
5711
+ class="passage-box ${l.length > 1 && w.n === s.n ? "current" : ""}"
5712
+ data-n=${w.n}
5713
+ >
5714
+ ${l.length > 1 ? o`<span class="passage-head"
5715
+ ><span class="num">${w.n}</span
5716
+ >${w.section ? o`<span class="meta">${w.section}</span>` : b}</span
5717
+ >` : b}
5718
+ <span class="text">${w.text}</span>
5719
+ <div class="passage-foot">
5720
+ <span class="label">${i.citedPassage}</span>
5721
+ <button
5722
+ type="button"
5723
+ class="copy-ref"
5724
+ title=${i.copyReference}
5725
+ aria-label=${i.copyReference}
5726
+ @click=${() => this.copy(f, T(w))}
5727
+ >
5728
+ ${$.copy()}<span>${this.copiedKey === f ? i.copied : i.copy}</span>
5729
+ </button>
5730
+ </div>
5731
+ </div>`;
5732
+ })}
5478
5733
  </div>
5479
- ${r.length ? o`<div class="panel-foot">
5734
+ ${m.length ? o`<div class="panel-foot">
5480
5735
  <span class="label">${i.alsoCited}</span>
5481
5736
  <div class="chips">
5482
- ${r.map(
5483
- (b) => o`<button
5737
+ ${m.map(
5738
+ (w) => o`<button
5484
5739
  type="button"
5485
5740
  class="chip"
5486
- @click=${() => this.panel = { key: e.key, n: b.n }}
5741
+ @click=${() => this.panel = { key: e.key, n: w.first.n }}
5487
5742
  >
5488
- ${b.n} · ${b.title}
5743
+ ${w.items.map((f) => f.n).join(", ")} · ${w.first.title}
5489
5744
  </button>`
5490
5745
  )}
5491
5746
  </div>
5492
- </div>` : m}
5747
+ </div>` : b}
5493
5748
  </aside>`;
5494
5749
  }
5495
5750
  renderComposer() {
5496
- const e = this.msg, t = this.mode === "rag" ? e.placeholderRag : this.mode === "kb" ? e.placeholderKb : _(e.placeholderChat, { name: this.assistantName }), s = !this.draft.trim(), i = this.footnote === "" ? m : o`<span class="footnote" part="footnote"
5497
- >${this.footnote ?? _(e.footnote, { name: this.assistantName })}</span
5751
+ const e = this.msg, t = this.mode === "rag" ? e.placeholderRag : this.mode === "kb" ? e.placeholderKb : j(e.placeholderChat, { name: this.assistantName }), s = !this.draft.trim(), i = this.footnote === "" ? b : o`<span class="footnote" part="footnote"
5752
+ >${this.footnote ?? j(e.footnote, { name: this.assistantName })}</span
5498
5753
  >`;
5499
5754
  return this.showComposer ? o`<div class="composer-wrap">
5500
5755
  <div class="composer-col">
@@ -5509,12 +5764,12 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5509
5764
  }}
5510
5765
  />
5511
5766
  <div class="composer-box">
5512
- ${this.busy ? o`<div class="composer-glow"></div>` : m}
5767
+ ${this.busy ? o`<div class="composer-glow"></div>` : b}
5513
5768
  <div class="composer ${this.busy ? "busy" : ""}" part="composer">
5514
5769
  ${this.savedFiles.length ? o`<div class="pending-files" part="saved-files">
5515
5770
  ${this.savedFiles.map(
5516
5771
  (a) => o`<div class="pending-file kept">
5517
- <span class="ext">${xt(a.name)}</span>
5772
+ <span class="ext">${Ot(a.name)}</span>
5518
5773
  <span class="meta"
5519
5774
  ><span class="name">${a.name}</span
5520
5775
  ><span class="size">${e.inThisChat}</span></span
@@ -5529,14 +5784,14 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5529
5784
  </button>
5530
5785
  </div>`
5531
5786
  )}
5532
- </div>` : m}
5787
+ </div>` : b}
5533
5788
  ${this.files.length ? o`<div class="pending-files">
5534
5789
  ${this.files.map(
5535
5790
  (a) => o`<div class="pending-file">
5536
- <span class="ext">${xt(a.name)}</span>
5791
+ <span class="ext">${Ot(a.name)}</span>
5537
5792
  <span class="meta"
5538
5793
  ><span class="name">${a.name}</span
5539
- ><span class="size">${kt(a.size)}</span></span
5794
+ ><span class="size">${Lt(a.size)}</span></span
5540
5795
  >
5541
5796
  <button
5542
5797
  type="button"
@@ -5548,7 +5803,7 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5548
5803
  </button>
5549
5804
  </div>`
5550
5805
  )}
5551
- </div>` : m}
5806
+ </div>` : b}
5552
5807
  <textarea
5553
5808
  class="input"
5554
5809
  rows="1"
@@ -5570,8 +5825,8 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5570
5825
  return (a = this.renderRoot.querySelector("input[type=file]")) == null ? void 0 : a.click();
5571
5826
  }}
5572
5827
  >
5573
- ${k.clip()}
5574
- </button>` : m}
5828
+ ${$.clip()}
5829
+ </button>` : b}
5575
5830
  </div>
5576
5831
  ${this.busy ? o`<button
5577
5832
  type="button"
@@ -5580,7 +5835,7 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5580
5835
  aria-label=${e.stop}
5581
5836
  @click=${() => this.stop()}
5582
5837
  >
5583
- ${k.stop()}
5838
+ ${$.stop()}
5584
5839
  </button>` : o`<button
5585
5840
  type="button"
5586
5841
  class="send"
@@ -5589,11 +5844,11 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5589
5844
  ?disabled=${s}
5590
5845
  @click=${() => this.send()}
5591
5846
  >
5592
- ${k.up()}
5847
+ ${$.up()}
5593
5848
  </button>`}
5594
5849
  </div>
5595
5850
  </div>
5596
- ${this.busy ? o`<div class="composer-ring"><div class="ring"></div></div>` : m}
5851
+ ${this.busy ? o`<div class="composer-ring"><div class="ring"></div></div>` : b}
5597
5852
  </div>
5598
5853
  ${i}
5599
5854
  </div>
@@ -5601,286 +5856,304 @@ ${s.path}` : ""}${s.updated ? ` · Updated ${s.updated}` : ""}`, f = [
5601
5856
  <div class="composer-col">${i}</div>
5602
5857
  </div>`;
5603
5858
  }
5604
- }, N = new WeakMap(), R = new WeakMap(), E = new WeakMap(), B = new WeakMap(), D = new WeakMap(), F = new WeakMap(), K = new WeakMap(), P = new WeakMap(), U = new WeakMap(), W = new WeakMap(), H = new WeakMap(), J = 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(), Ie = new WeakMap(), Oe = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), _e = new WeakMap(), Le = new WeakMap(), Ae = new WeakMap(), je = new WeakMap(), Ne = new WeakMap(), Re = new WeakMap(), Ee = new WeakMap(), Be = new WeakMap(), De = new WeakMap(), Fe = new WeakMap(), Ke = new WeakMap(), Pe = new WeakMap(), Ue = new WeakMap(), We = new WeakMap(), He = new WeakMap(), Je = 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(), ut = new WeakMap(), gt = new WeakMap(), Ft);
5605
- $s(d, "styles", [Yt, Qt, Zt]);
5859
+ }, R = new WeakMap(), N = new WeakMap(), E = new WeakMap(), B = new WeakMap(), F = new WeakMap(), D = new WeakMap(), K = new WeakMap(), P = new WeakMap(), U = new WeakMap(), H = new WeakMap(), W = new WeakMap(), V = new WeakMap(), J = new WeakMap(), q = new WeakMap(), G = 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(), ve = new WeakMap(), xe = new WeakMap(), we = new WeakMap(), ye = new WeakMap(), ke = new WeakMap(), $e = new WeakMap(), Ce = new WeakMap(), Se = new WeakMap(), Te = new WeakMap(), Oe = new WeakMap(), Ie = new WeakMap(), Me = new WeakMap(), _e = new WeakMap(), ze = new WeakMap(), Le = new WeakMap(), je = new WeakMap(), Ae = new WeakMap(), Re = new WeakMap(), Ne = new WeakMap(), Ee = new WeakMap(), Be = new WeakMap(), Fe = new WeakMap(), De = new WeakMap(), Ke = new WeakMap(), Pe = new WeakMap(), Ue = new WeakMap(), He = new WeakMap(), We = new WeakMap(), Ve = new WeakMap(), Je = new WeakMap(), qe = new WeakMap(), Ge = 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(), ut = new WeakMap(), gt = new WeakMap(), mt = new WeakMap(), ft = new WeakMap(), bt = new WeakMap(), vt = new WeakMap(), xt = new WeakMap(), wt = new WeakMap(), Xt);
5860
+ js(d, "styles", [ls, cs, ds]);
5606
5861
  g([
5607
- v({ attribute: !1 })
5862
+ x({ attribute: !1 })
5608
5863
  ], d.prototype, "client", 1);
5609
5864
  g([
5610
- v({ attribute: !1 })
5865
+ x({ attribute: !1 })
5611
5866
  ], d.prototype, "messages", 1);
5612
5867
  g([
5613
- v({ reflect: !0 })
5868
+ x({ reflect: !0 })
5614
5869
  ], d.prototype, "theme", 1);
5615
5870
  g([
5616
- v({ reflect: !0 })
5871
+ x({ reflect: !0 })
5617
5872
  ], d.prototype, "radius", 1);
5618
5873
  g([
5619
- v({ reflect: !0 })
5874
+ x({ reflect: !0 })
5620
5875
  ], d.prototype, "mode", 1);
5621
5876
  g([
5622
- v({ reflect: !0 })
5877
+ x({ reflect: !0 })
5623
5878
  ], d.prototype, "format", 1);
5624
5879
  g([
5625
- v({ attribute: !1 })
5880
+ x({ attribute: !1 })
5626
5881
  ], d.prototype, "renderers", 1);
5627
5882
  g([
5628
- v({ attribute: !1 })
5883
+ x({ attribute: !1 })
5629
5884
  ], d.prototype, "beforeSend", 1);
5630
5885
  g([
5631
- v({ attribute: !1 })
5886
+ x({ attribute: !1 })
5632
5887
  ], d.prototype, "afterParse", 1);
5633
5888
  g([
5634
- v({ reflect: !0 })
5889
+ x({ reflect: !0 })
5635
5890
  ], d.prototype, "glow", 1);
5636
5891
  g([
5637
- v()
5892
+ x()
5638
5893
  ], d.prototype, "docsets", 1);
5639
5894
  g([
5640
- v({ attribute: "attachments-mode" })
5895
+ x({ attribute: "attachments-mode" })
5641
5896
  ], d.prototype, "attachmentsMode", 1);
5642
5897
  g([
5643
- v({ converter: I, attribute: "save-attachments" })
5898
+ x({ converter: M, attribute: "save-attachments" })
5644
5899
  ], d.prototype, "saveAttachments", 1);
5645
5900
  g([
5646
- v({ converter: I })
5901
+ x({ converter: M })
5647
5902
  ], d.prototype, "followups", 1);
5648
5903
  g([
5649
- v({ converter: I, attribute: "show-sources" })
5904
+ x({ converter: M, attribute: "show-sources" })
5650
5905
  ], d.prototype, "showSources", 1);
5651
5906
  g([
5652
- v({ converter: I, attribute: "show-new-chat" })
5907
+ x({ converter: M, attribute: "show-new-chat" })
5653
5908
  ], d.prototype, "showNewChat", 1);
5654
5909
  g([
5655
- v({ converter: I, attribute: "show-bookmarked" })
5910
+ x({ converter: M, attribute: "show-bookmarked" })
5656
5911
  ], d.prototype, "showBookmarked", 1);
5657
5912
  g([
5658
- v({ converter: I, attribute: "show-followups" })
5913
+ x({ converter: M, attribute: "show-followups" })
5659
5914
  ], d.prototype, "showFollowups", 1);
5660
5915
  g([
5661
- v({ converter: I, attribute: "allow-search" })
5916
+ x({ type: Boolean, attribute: "allow-view-options" })
5917
+ ], d.prototype, "allowViewOptions", 1);
5918
+ g([
5919
+ x({ converter: M, attribute: "allow-search" })
5662
5920
  ], d.prototype, "allowSearch", 1);
5663
5921
  g([
5664
- v({ converter: I, attribute: "auto-title" })
5922
+ x({ converter: M, attribute: "auto-title" })
5665
5923
  ], d.prototype, "autoTitle", 1);
5666
5924
  g([
5667
- v()
5925
+ x()
5668
5926
  ], d.prototype, "model", 1);
5669
5927
  g([
5670
- v({ converter: vt })
5928
+ x({ converter: Mt })
5671
5929
  ], d.prototype, "params", 1);
5672
5930
  g([
5673
- v({ attribute: "system-message" })
5931
+ x({ attribute: "system-message" })
5674
5932
  ], d.prototype, "systemMessage", 1);
5675
5933
  g([
5676
- v({ converter: vt })
5934
+ x({ converter: Mt })
5677
5935
  ], d.prototype, "retrieval", 1);
5678
5936
  g([
5679
- v({ converter: vt })
5937
+ x({ converter: Mt })
5680
5938
  ], d.prototype, "metadata", 1);
5681
5939
  g([
5682
- v({ reflect: !0 })
5940
+ x({ reflect: !0 })
5683
5941
  ], d.prototype, "embed", 1);
5684
5942
  g([
5685
- v({ reflect: !0 })
5943
+ x({ reflect: !0 })
5686
5944
  ], d.prototype, "position", 1);
5687
5945
  g([
5688
- v({ converter: Cs })
5946
+ x({ converter: As })
5689
5947
  ], d.prototype, "sidebar", 1);
5690
5948
  g([
5691
- v({ converter: I, attribute: "show-title" })
5949
+ x({ converter: M, attribute: "show-title" })
5692
5950
  ], d.prototype, "showTitle", 1);
5693
5951
  g([
5694
- v({ attribute: "chat-id" })
5952
+ x({ attribute: "chat-id" })
5695
5953
  ], d.prototype, "chatIdAttr", 1);
5696
5954
  g([
5697
- v({ attribute: "assistant-name" })
5955
+ x({ attribute: "chat-key" })
5956
+ ], d.prototype, "chatKey", 1);
5957
+ g([
5958
+ x({ attribute: "assistant-name" })
5698
5959
  ], d.prototype, "assistantName", 1);
5699
5960
  g([
5700
- v({ attribute: "logo-url" })
5961
+ x({ attribute: "logo-url" })
5701
5962
  ], d.prototype, "logoUrl", 1);
5702
5963
  g([
5703
- v()
5964
+ x()
5704
5965
  ], d.prototype, "heading", 1);
5705
5966
  g([
5706
- v()
5967
+ x()
5707
5968
  ], d.prototype, "description", 1);
5708
5969
  g([
5709
- v()
5970
+ x()
5710
5971
  ], d.prototype, "eyebrow", 1);
5711
5972
  g([
5712
- v()
5973
+ x()
5713
5974
  ], d.prototype, "prompts", 1);
5714
5975
  g([
5715
- v({ attribute: "bubble-text" })
5976
+ x({ attribute: "bubble-text" })
5716
5977
  ], d.prototype, "bubbleText", 1);
5717
5978
  g([
5718
- v({ type: Boolean, attribute: "greeting-bubble" })
5979
+ x({ type: Boolean, attribute: "greeting-bubble" })
5719
5980
  ], d.prototype, "greetingBubble", 1);
5720
5981
  g([
5721
- v({ type: Boolean, attribute: "unread-badge" })
5982
+ x({ type: Boolean, attribute: "unread-badge" })
5722
5983
  ], d.prototype, "unreadBadge", 1);
5723
5984
  g([
5724
- v({ converter: I, attribute: "allow-upload" })
5985
+ x({ converter: M, attribute: "allow-upload" })
5725
5986
  ], d.prototype, "allowUpload", 1);
5726
5987
  g([
5727
- v({ converter: I, attribute: "allow-export" })
5988
+ x({ converter: M, attribute: "allow-export" })
5728
5989
  ], d.prototype, "allowExport", 1);
5729
5990
  g([
5730
- v({ converter: I, attribute: "allow-copy" })
5991
+ x({ converter: M, attribute: "allow-copy" })
5731
5992
  ], d.prototype, "allowCopy", 1);
5732
5993
  g([
5733
- v({ converter: I, attribute: "allow-regenerate" })
5994
+ x({ converter: M, attribute: "allow-regenerate" })
5734
5995
  ], d.prototype, "allowRegenerate", 1);
5735
5996
  g([
5736
- v({ converter: I, attribute: "allow-bookmark" })
5997
+ x({ converter: M, attribute: "allow-bookmark" })
5737
5998
  ], d.prototype, "allowBookmark", 1);
5738
5999
  g([
5739
- v({ converter: I, attribute: "allow-delete" })
6000
+ x({ converter: M, attribute: "allow-delete" })
5740
6001
  ], d.prototype, "allowDelete", 1);
5741
6002
  g([
5742
- v({ converter: I, attribute: "allow-rename" })
6003
+ x({ converter: M, attribute: "allow-rename" })
5743
6004
  ], d.prototype, "allowRename", 1);
5744
6005
  g([
5745
- v({ converter: I, attribute: "allow-feedback" })
6006
+ x({ converter: M, attribute: "allow-feedback" })
5746
6007
  ], d.prototype, "allowFeedback", 1);
5747
6008
  g([
5748
- v({ converter: I, attribute: "show-composer" })
6009
+ x({ converter: M, attribute: "show-composer" })
5749
6010
  ], d.prototype, "showComposer", 1);
5750
6011
  g([
5751
- v({ converter: I, attribute: "show-time" })
6012
+ x({ converter: M, attribute: "show-time" })
5752
6013
  ], d.prototype, "showTime", 1);
5753
6014
  g([
5754
- v()
6015
+ x()
5755
6016
  ], d.prototype, "footnote", 1);
5756
6017
  g([
5757
- v({ type: Boolean, attribute: "allow-raw" })
6018
+ x({ type: Boolean, attribute: "allow-raw" })
5758
6019
  ], d.prototype, "allowRaw", 1);
5759
6020
  g([
5760
- v({ converter: I })
6021
+ x({ converter: M })
5761
6022
  ], d.prototype, "branding", 1);
5762
6023
  g([
5763
- y()
6024
+ k()
5764
6025
  ], d.prototype, "chatList", 1);
5765
6026
  g([
5766
- y()
6027
+ k()
5767
6028
  ], d.prototype, "listState", 1);
5768
6029
  g([
5769
- y()
6030
+ k()
5770
6031
  ], d.prototype, "activeId", 1);
5771
6032
  g([
5772
- y()
6033
+ k()
5773
6034
  ], d.prototype, "chatTitle", 1);
5774
6035
  g([
5775
- y()
6036
+ k()
5776
6037
  ], d.prototype, "bookmarked", 1);
5777
6038
  g([
5778
- y()
6039
+ k()
5779
6040
  ], d.prototype, "msgs", 1);
5780
6041
  g([
5781
- y()
6042
+ k()
5782
6043
  ], d.prototype, "loadingThread", 1);
5783
6044
  g([
5784
- y()
6045
+ k()
5785
6046
  ], d.prototype, "threadError", 1);
5786
6047
  g([
5787
- y()
6048
+ k()
5788
6049
  ], d.prototype, "busy", 1);
5789
6050
  g([
5790
- y()
6051
+ k()
5791
6052
  ], d.prototype, "draft", 1);
5792
6053
  g([
5793
- y()
6054
+ k()
5794
6055
  ], d.prototype, "files", 1);
5795
6056
  g([
5796
- y()
6057
+ k()
5797
6058
  ], d.prototype, "search", 1);
5798
6059
  g([
5799
- y()
6060
+ k()
5800
6061
  ], d.prototype, "sidebarOpen", 1);
5801
6062
  g([
5802
- y()
6063
+ k()
5803
6064
  ], d.prototype, "width", 1);
5804
6065
  g([
5805
- y()
6066
+ k()
5806
6067
  ], d.prototype, "panel", 1);
5807
6068
  g([
5808
- y()
6069
+ k()
5809
6070
  ], d.prototype, "menuOpen", 1);
5810
6071
  g([
5811
- y()
6072
+ k()
6073
+ ], d.prototype, "viewOpen", 1);
6074
+ g([
6075
+ k()
6076
+ ], d.prototype, "viewHidden", 1);
6077
+ g([
6078
+ k()
5812
6079
  ], d.prototype, "editingKey", 1);
5813
6080
  g([
5814
- y()
6081
+ k()
5815
6082
  ], d.prototype, "editDraft", 1);
5816
6083
  g([
5817
- y()
6084
+ k()
5818
6085
  ], d.prototype, "editingTitle", 1);
5819
6086
  g([
5820
- y()
6087
+ k()
5821
6088
  ], d.prototype, "renamingId", 1);
5822
6089
  g([
5823
- y()
6090
+ k()
5824
6091
  ], d.prototype, "toast", 1);
5825
6092
  g([
5826
- y()
6093
+ k()
5827
6094
  ], d.prototype, "copiedKey", 1);
5828
6095
  g([
5829
- y()
6096
+ k()
5830
6097
  ], d.prototype, "retrievalOpen", 1);
5831
6098
  g([
5832
- y()
6099
+ k()
5833
6100
  ], d.prototype, "rawKeys", 1);
5834
6101
  g([
5835
- y()
6102
+ k()
5836
6103
  ], d.prototype, "savedFiles", 1);
5837
6104
  g([
5838
- y()
6105
+ k()
5839
6106
  ], d.prototype, "hasSidebarContent", 1);
5840
6107
  g([
5841
- y()
6108
+ k()
5842
6109
  ], d.prototype, "sorts", 1);
5843
6110
  g([
5844
- y()
6111
+ k()
5845
6112
  ], d.prototype, "arrivedKey", 1);
5846
6113
  g([
5847
- y()
6114
+ k()
5848
6115
  ], d.prototype, "dragging", 1);
5849
6116
  g([
5850
- y()
6117
+ k()
5851
6118
  ], d.prototype, "showJump", 1);
5852
6119
  g([
5853
- y()
6120
+ k()
5854
6121
  ], d.prototype, "offline", 1);
5855
6122
  g([
5856
- y()
6123
+ k()
5857
6124
  ], d.prototype, "isOpen", 1);
5858
6125
  g([
5859
- y()
6126
+ k()
5860
6127
  ], d.prototype, "expanded", 1);
5861
6128
  g([
5862
- y()
6129
+ k()
5863
6130
  ], d.prototype, "bubble", 1);
5864
6131
  g([
5865
- y()
6132
+ k()
5866
6133
  ], d.prototype, "seen", 1);
5867
6134
  g([
5868
- y()
6135
+ k()
5869
6136
  ], d.prototype, "mobile", 1);
6137
+ g([
6138
+ k()
6139
+ ], d.prototype, "starterList", 1);
6140
+ g([
6141
+ k()
6142
+ ], d.prototype, "startersLoading", 1);
5870
6143
  d = g([
5871
- Gt("singlebase-chat")
6144
+ as("singlebase-chat")
5872
6145
  ], d);
5873
6146
  export {
5874
6147
  d as S,
5875
- gs as a,
5876
- ft as b,
5877
- Ot as c,
5878
- es as d,
5879
- os as e,
5880
- zt as f,
5881
- ws as g,
5882
- ds as p,
5883
- ts as r,
5884
- ps as s
6148
+ Ss as a,
6149
+ kt as b,
6150
+ Bt as c,
6151
+ ps as d,
6152
+ bs as e,
6153
+ Dt as f,
6154
+ _s as g,
6155
+ ys as p,
6156
+ hs as r,
6157
+ ks as s
5885
6158
  };
5886
- //# sourceMappingURL=chat-BH_3e1jT.js.map
6159
+ //# sourceMappingURL=chat-DNiqYF6F.js.map