@frontera-sdk/chat-ui 1.50.40

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 (148) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +348 -0
  3. package/dist/af-DK_CjRn6-OPBHDTNZ.js +197 -0
  4. package/dist/agent-picker.d.ts +38 -0
  5. package/dist/agent-picker.js +8 -0
  6. package/dist/as-BPtSu6VN-O4ZZEAJG.js +11 -0
  7. package/dist/be-CrQ0smca-5HIE5K27.js +11 -0
  8. package/dist/bg-CrQqGwni-3IRVPZQ7.js +11 -0
  9. package/dist/bn-NCLZcWHi-XOZJFNIB.js +11 -0
  10. package/dist/ca-SUf6Y2Om-V6F2EBCA.js +38 -0
  11. package/dist/capture-NO5ZIGP6.js +1652 -0
  12. package/dist/chat.css +3555 -0
  13. package/dist/chat.d.ts +161 -0
  14. package/dist/chat.js +60498 -0
  15. package/dist/chunk-2KEBRV3W.js +191 -0
  16. package/dist/chunk-6BPHEBCF.js +639 -0
  17. package/dist/chunk-6HYPVNVA.js +25 -0
  18. package/dist/chunk-7ADM3CKD.js +10 -0
  19. package/dist/chunk-AFVU5VT6.js +5601 -0
  20. package/dist/chunk-BEJ3HQG4.js +93 -0
  21. package/dist/chunk-CCVPZVFK.js +28 -0
  22. package/dist/chunk-DGDHKMDB.js +10 -0
  23. package/dist/chunk-FXKXDR5K.js +2166 -0
  24. package/dist/chunk-GTQH7MPF.js +129 -0
  25. package/dist/chunk-I7SXWUAN.js +1258 -0
  26. package/dist/chunk-IQRPGFLI.js +234 -0
  27. package/dist/chunk-IXDM5R55.js +23 -0
  28. package/dist/chunk-JD6ETTXC.js +178 -0
  29. package/dist/chunk-OP4MLJDA.js +215 -0
  30. package/dist/chunk-PQZ2CS26.js +2315 -0
  31. package/dist/chunk-PR4QN5HX.js +38 -0
  32. package/dist/chunk-PUIVKDV5.js +271 -0
  33. package/dist/chunk-QSSFBZAS.js +6914 -0
  34. package/dist/chunk-RAKKA3WU.js +5896 -0
  35. package/dist/chunk-RB2Y4NYC.js +681 -0
  36. package/dist/chunk-VDZH5Z3K.js +72 -0
  37. package/dist/chunk-WMN6BPPS.js +49 -0
  38. package/dist/chunk-WO6DJLFE.js +10857 -0
  39. package/dist/chunk-X5E2DJVO.js +47634 -0
  40. package/dist/chunk-XJFTVKLW.js +2687 -0
  41. package/dist/chunk-ZS6PXIZP.js +187 -0
  42. package/dist/client.d.ts +89 -0
  43. package/dist/client.js +20 -0
  44. package/dist/composer.d.ts +23 -0
  45. package/dist/composer.js +89 -0
  46. package/dist/cop-C3sk0IUo-CIZA2H43.js +11 -0
  47. package/dist/credential.d.ts +75 -0
  48. package/dist/credential.js +3 -0
  49. package/dist/cs-CmAteokq-HAKEQPB4.js +17 -0
  50. package/dist/cu-CBUlrW6Y-QTZ6ZLA4.js +32 -0
  51. package/dist/cy-BBPa6z2x-MX6DGDNW.js +11 -0
  52. package/dist/da-CCDXfXtG-5YEOHMG3.js +11 -0
  53. package/dist/de-1901-CWoAOigE-63QFSF2A.js +11 -0
  54. package/dist/de-1996-BL6awyxG-R2PHKMAB.js +11 -0
  55. package/dist/de-ch-1901-hVThVHVb-JSDB53OZ.js +11 -0
  56. package/dist/el-monoton-D3aKqTz2-2V4OOFBB.js +11 -0
  57. package/dist/el-polyton-ogVWcTzh-3U7NGQMT.js +11 -0
  58. package/dist/en-gb-B7Al27b_-UKCBQFSU.js +21 -0
  59. package/dist/es-DcaaHPU_-NOBXSOZK.js +11 -0
  60. package/dist/esm-MHF25KDL.js +3 -0
  61. package/dist/et-B_spaleu-5UAYIW62.js +11 -0
  62. package/dist/eu-Ctv_kq9Z-V5DREOPN.js +11 -0
  63. package/dist/fi-RW5VB8Yp-YSXBK7LW.js +11 -0
  64. package/dist/fr-BC2onEz9-7KH5T76G.js +11 -0
  65. package/dist/frame.d.ts +59 -0
  66. package/dist/frame.js +111 -0
  67. package/dist/fur-AC12wySk-4PD2Y72H.js +11 -0
  68. package/dist/ga-Cn6LkudM-RRAAJT3N.js +58 -0
  69. package/dist/gl-DZGc-K_G-KYSXXTCY.js +11 -0
  70. package/dist/grc-DOlGgO8T-2HXBZVJ5.js +11 -0
  71. package/dist/gu-Bjl0l-cf-4CFSVZHZ.js +11 -0
  72. package/dist/header.d.ts +78 -0
  73. package/dist/header.js +18 -0
  74. package/dist/hi-DsAaTPCC-KMCFBWK7.js +11 -0
  75. package/dist/hr-DT1SBBes-X2TIX6EI.js +11 -0
  76. package/dist/hsb-DC_ITc1e-PXLERA7R.js +46 -0
  77. package/dist/hu-DVk7Y_ka-PJPVU54B.js +11 -0
  78. package/dist/hy-e995ysyO-MZBRFX52.js +11 -0
  79. package/dist/ia-Cr4TJH0c-D3O2FHGP.js +22 -0
  80. package/dist/id-DifDyWg9-MZ2BGHWI.js +58 -0
  81. package/dist/is-BT8UVRze-CZZCKEFI.js +11 -0
  82. package/dist/it-Bt_Meacx-T4Y5JYV6.js +11 -0
  83. package/dist/ka-jyoLzyDE-ES6EXZLW.js +11 -0
  84. package/dist/kmr-Cfwhwuff-TSW2R2KS.js +11 -0
  85. package/dist/kn-C6Lov-DP-B4BL47CE.js +11 -0
  86. package/dist/la-DuvHjUWw-6K7TFU6X.js +11 -0
  87. package/dist/la-x-classic-yTyAOQEt-YWTKMM2L.js +11 -0
  88. package/dist/la-x-liturgic-CXeQb4FY-B772L5E7.js +11 -0
  89. package/dist/lib-3ZKX25RJ.js +4511 -0
  90. package/dist/lt-BBe8DlDF-4YINVOZR.js +11 -0
  91. package/dist/lv-Q2BBHnzp-TMVQ3MX2.js +11 -0
  92. package/dist/message.d.ts +64 -0
  93. package/dist/message.js +18 -0
  94. package/dist/ml-2xLVYkVY-NGZLAPIN.js +11 -0
  95. package/dist/mn-cyrl-lHM4n0oC-DGBYYUT3.js +11 -0
  96. package/dist/mn-cyrl-x-lmc-3aetruI8-QHJABMOO.js +11 -0
  97. package/dist/mr-CjWJPVmH-X5UHV65O.js +11 -0
  98. package/dist/mul-ethi-D_CMSMEq-H7UMQSOQ.js +11 -0
  99. package/dist/nb-DI8u59ch-J4CAVI4Y.js +122 -0
  100. package/dist/new-session-Dw7JOgzu.d.ts +141 -0
  101. package/dist/new-session.d.ts +4 -0
  102. package/dist/new-session.js +10 -0
  103. package/dist/nl-BHQJ6Gvn-7BH55RA7.js +52 -0
  104. package/dist/nn-ntZvarUK-KKNCHHJ4.js +122 -0
  105. package/dist/no-B8ItS0F3-3ZXIRJ6U.js +120 -0
  106. package/dist/oauth-callback.d.ts +35 -0
  107. package/dist/oauth-callback.js +18 -0
  108. package/dist/oc-P_i3-xLA-XZM6E5YZ.js +11 -0
  109. package/dist/or-50rxpoq4-5VELAFMJ.js +11 -0
  110. package/dist/pa-C54UG8eN-WEJPMZ6Z.js +11 -0
  111. package/dist/parts.d.ts +49 -0
  112. package/dist/parts.js +106 -0
  113. package/dist/pdf-cover-thumbnail-inner-4N2Q5AAG.js +36 -0
  114. package/dist/pdf-deck-view-inner-FZVLAEQR.js +575 -0
  115. package/dist/pdf-document-view-inner-6DF54JWK.js +585 -0
  116. package/dist/pdf-viewer-inner-GPES3KG2.js +256 -0
  117. package/dist/pending-cards.d.ts +26 -0
  118. package/dist/pending-cards.js +9 -0
  119. package/dist/pi-B9cgjyG1-GD5ASDDU.js +11 -0
  120. package/dist/pl-9fg-ESVt-UMX7MCJM.js +32 -0
  121. package/dist/platform.css +4013 -0
  122. package/dist/pms-BRGfm5gS-SSE3AUW5.js +11 -0
  123. package/dist/pt-Cum2_NUC-W35JYVR4.js +11 -0
  124. package/dist/rm-C0MIK9N4-IWL4YTNT.js +11 -0
  125. package/dist/ro-0fmdH0HA-46WUTOYH.js +11 -0
  126. package/dist/ru-v4l-ayaq-BUGK6XCN.js +196 -0
  127. package/dist/sa-CKY9c_Vq-4KIJOI5Y.js +11 -0
  128. package/dist/sh-cyrl-BpCRFOmq-DSLQ4UY2.js +128 -0
  129. package/dist/sh-latn-sRy4Tuaj-UNQOR63V.js +128 -0
  130. package/dist/sk-_iOeDNrQ-NCTQKH25.js +17 -0
  131. package/dist/sl-DpiklF-D-6GG5TDVN.js +11 -0
  132. package/dist/sr-cyrl-Dpzrbd0W-4Q5226YJ.js +142 -0
  133. package/dist/sv-CFm5y56M-VTWNPZ7I.js +11 -0
  134. package/dist/ta-BcghgTbD-NRT35DW6.js +11 -0
  135. package/dist/te-B5Spl2Jk-5VE6CLN4.js +11 -0
  136. package/dist/th-DWX5iPSo-N5GMOQOP.js +11 -0
  137. package/dist/theme.d.ts +49 -0
  138. package/dist/theme.js +3 -0
  139. package/dist/tk-BMbKB10q-HGWWY5L3.js +11 -0
  140. package/dist/tr-CIHIuzqc-6ISBNYLV.js +11 -0
  141. package/dist/types-BDqLaBfH.d.ts +60 -0
  142. package/dist/uk-Dir3oxLs-YQ3QZRI4.js +11 -0
  143. package/dist/univer-workbook-BSSUE5TG.css +3555 -0
  144. package/dist/univer-workbook-N5IIN7CH.js +290849 -0
  145. package/dist/vega-chart-block-NQADYNWQ.js +2857 -0
  146. package/dist/zh-latn-pinyin-BdYb-Ey_-RB542AHF.js +11 -0
  147. package/package.json +137 -0
  148. package/src/styles.css +996 -0
@@ -0,0 +1,681 @@
1
+ 'use client';
2
+ import { Sheet, SheetContent, SheetHeader, SheetTitle, Popover, PopoverTrigger, PopoverContent } from './chunk-2KEBRV3W.js';
3
+ import { useTranslation } from './chunk-QSSFBZAS.js';
4
+ import { useIsMobile } from './chunk-IXDM5R55.js';
5
+ import { AgentAvatar } from './chunk-FXKXDR5K.js';
6
+ import { cn } from './chunk-DGDHKMDB.js';
7
+ import { CrossMediumIcon, MagnifyingGlassIcon, Checkmark1Icon } from './chunk-AFVU5VT6.js';
8
+ import * as t from 'react';
9
+ import { memo, useState } from 'react';
10
+ import { Slot } from '@radix-ui/react-slot';
11
+ import * as w from '@radix-ui/react-dialog';
12
+ import { Primitive } from '@radix-ui/react-primitive';
13
+ import { useId } from '@radix-ui/react-id';
14
+ import { composeRefs } from '@radix-ui/react-compose-refs';
15
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
16
+
17
+ // src/vendor/ui/hooks/keep-caret.ts
18
+ function keepCaretOnTap(event) {
19
+ event.preventDefault();
20
+ }
21
+
22
+ // ../../node_modules/cmdk/dist/chunk-NZJY6EH4.mjs
23
+ var U = 1;
24
+ var Y = 0.9;
25
+ var H = 0.8;
26
+ var J = 0.17;
27
+ var p = 0.1;
28
+ var u = 0.999;
29
+ var $ = 0.9999;
30
+ var k = 0.99;
31
+ var m = /[\\\/_+.#"@\[\(\{&]/;
32
+ var B = /[\\\/_+.#"@\[\(\{&]/g;
33
+ var K = /[\s-]/;
34
+ var X = /[\s-]/g;
35
+ function G(_, C, h, P2, A, f, O) {
36
+ if (f === C.length) return A === _.length ? U : k;
37
+ var T2 = `${A},${f}`;
38
+ if (O[T2] !== void 0) return O[T2];
39
+ for (var L2 = P2.charAt(f), c = h.indexOf(L2, A), S = 0, E, N2, R, M; c >= 0; ) E = G(_, C, h, P2, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K.test(_.charAt(c - 1)) ? (E *= Y, M = _.slice(A, c - 1).match(X), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P2.charAt(f + 1) || P2.charAt(f + 1) === P2.charAt(f) && h.charAt(c - 1) !== P2.charAt(f)) && (N2 = G(_, C, h, P2, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L2, c + 1);
40
+ return O[T2] = S, S;
41
+ }
42
+ function D(_) {
43
+ return _.toLowerCase().replace(X, " ");
44
+ }
45
+ function W(_, C, h) {
46
+ return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
47
+ }
48
+ var N = '[cmdk-group=""]';
49
+ var Y2 = '[cmdk-group-items=""]';
50
+ var be = '[cmdk-group-heading=""]';
51
+ var le = '[cmdk-item=""]';
52
+ var ce = `${le}:not([aria-disabled="true"])`;
53
+ var Z = "cmdk-item-select";
54
+ var T = "data-value";
55
+ var Re = (r, o, n) => W(r, o, n);
56
+ var ue = t.createContext(void 0);
57
+ var K2 = () => t.useContext(ue);
58
+ var de = t.createContext(void 0);
59
+ var ee = () => t.useContext(de);
60
+ var fe = t.createContext(void 0);
61
+ var me = t.forwardRef((r, o) => {
62
+ let n = L(() => {
63
+ var e, a;
64
+ return { search: "", value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
65
+ }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId(), q = useId(), _ = useId(), I = t.useRef(null), v = ke();
66
+ k2(() => {
67
+ if (R !== void 0) {
68
+ let e = R.trim();
69
+ n.current.value = e, E.emit();
70
+ }
71
+ }, [R]), k2(() => {
72
+ v(6, ne);
73
+ }, []);
74
+ let E = t.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => {
75
+ var i, l, g, y;
76
+ if (!Object.is(n.current[e], a)) {
77
+ if (n.current[e] = a, e === "search") J2(), z(), v(1, W2);
78
+ else if (e === "value") {
79
+ if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
80
+ let h = document.getElementById(_);
81
+ h ? h.focus() : (i = document.getElementById($2)) == null || i.focus();
82
+ }
83
+ if (v(7, () => {
84
+ var h;
85
+ n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit();
86
+ }), s || v(5, ne), ((l = p2.current) == null ? void 0 : l.value) !== void 0) {
87
+ let h = a != null ? a : "";
88
+ (y = (g = p2.current).onValueChange) == null || y.call(g, h);
89
+ return;
90
+ }
91
+ }
92
+ E.emit();
93
+ }
94
+ }, emit: () => {
95
+ f.current.forEach((e) => e());
96
+ } }), []), U2 = t.useMemo(() => ({ value: (e, a, s) => {
97
+ var i;
98
+ a !== ((i = d.current.get(e)) == null ? void 0 : i.value) && (d.current.set(e, { value: a, keywords: s }), n.current.filtered.items.set(e, te(a, s)), v(2, () => {
99
+ z(), E.emit();
100
+ }));
101
+ }, item: (e, a) => (u2.current.add(e), a && (c.current.has(a) ? c.current.get(a).add(e) : c.current.set(a, /* @__PURE__ */ new Set([e]))), v(3, () => {
102
+ J2(), z(), n.current.value || W2(), E.emit();
103
+ }), () => {
104
+ d.current.delete(e), u2.current.delete(e), n.current.filtered.items.delete(e);
105
+ let s = M();
106
+ v(4, () => {
107
+ J2(), (s == null ? void 0 : s.getAttribute("id")) === e && W2(), E.emit();
108
+ });
109
+ }), group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => {
110
+ d.current.delete(e), c.current.delete(e);
111
+ }), filter: () => p2.current.shouldFilter, label: b || r["aria-label"], getDisablePointerSelection: () => p2.current.disablePointerSelection, listId: $2, inputId: _, labelId: q, listInnerRef: I }), []);
112
+ function te(e, a) {
113
+ var i, l;
114
+ let s = (l = (i = p2.current) == null ? void 0 : i.filter) != null ? l : Re;
115
+ return e ? s(e, n.current.search, a) : 0;
116
+ }
117
+ function z() {
118
+ if (!n.current.search || p2.current.shouldFilter === false) return;
119
+ let e = n.current.filtered.items, a = [];
120
+ n.current.filtered.groups.forEach((i) => {
121
+ let l = c.current.get(i), g = 0;
122
+ l.forEach((y) => {
123
+ let h = e.get(y);
124
+ g = Math.max(h, g);
125
+ }), a.push([i, g]);
126
+ });
127
+ let s = I.current;
128
+ V().sort((i, l) => {
129
+ var h, F;
130
+ let g = i.getAttribute("id"), y = l.getAttribute("id");
131
+ return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0);
132
+ }).forEach((i) => {
133
+ let l = i.closest(Y2);
134
+ l ? l.appendChild(i.parentElement === l ? i : i.closest(`${Y2} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`${Y2} > *`));
135
+ }), a.sort((i, l) => l[1] - i[1]).forEach((i) => {
136
+ var g;
137
+ let l = (g = I.current) == null ? void 0 : g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);
138
+ l == null || l.parentElement.appendChild(l);
139
+ });
140
+ }
141
+ function W2() {
142
+ let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T);
143
+ E.setState("value", a || void 0);
144
+ }
145
+ function J2() {
146
+ var a, s, i, l;
147
+ if (!n.current.search || p2.current.shouldFilter === false) {
148
+ n.current.filtered.count = u2.current.size;
149
+ return;
150
+ }
151
+ n.current.filtered.groups = /* @__PURE__ */ new Set();
152
+ let e = 0;
153
+ for (let g of u2.current) {
154
+ let y = (s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", h = (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : [], F = te(y, h);
155
+ n.current.filtered.items.set(g, F), F > 0 && e++;
156
+ }
157
+ for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) {
158
+ n.current.filtered.groups.add(g);
159
+ break;
160
+ }
161
+ n.current.filtered.count = e;
162
+ }
163
+ function ne() {
164
+ var a, s, i;
165
+ let e = M();
166
+ e && (((a = e.parentElement) == null ? void 0 : a.firstChild) === e && ((i = (s = e.closest(N)) == null ? void 0 : s.querySelector(be)) == null || i.scrollIntoView({ block: "nearest" })), e.scrollIntoView({ block: "nearest" }));
167
+ }
168
+ function M() {
169
+ var e;
170
+ return (e = I.current) == null ? void 0 : e.querySelector(`${le}[aria-selected="true"]`);
171
+ }
172
+ function V() {
173
+ var e;
174
+ return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
175
+ }
176
+ function X2(e) {
177
+ let s = V()[e];
178
+ s && E.setState("value", s.getAttribute(T));
179
+ }
180
+ function Q(e) {
181
+ var g;
182
+ let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e];
183
+ (g = p2.current) != null && g.loop && (l = i + e < 0 ? s[s.length - 1] : i + e === s.length ? s[0] : s[i + e]), l && E.setState("value", l.getAttribute(T));
184
+ }
185
+ function re(e) {
186
+ let a = M(), s = a == null ? void 0 : a.closest(N), i;
187
+ for (; s && !i; ) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
188
+ i ? E.setState("value", i.getAttribute(T)) : Q(e);
189
+ }
190
+ let oe = () => X2(V().length - 1), ie = (e) => {
191
+ e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
192
+ }, se = (e) => {
193
+ e.preventDefault(), e.metaKey ? X2(0) : e.altKey ? re(-1) : Q(-1);
194
+ };
195
+ return t.createElement(Primitive.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
196
+ var s;
197
+ (s = O.onKeyDown) == null || s.call(O, e);
198
+ let a = e.nativeEvent.isComposing || e.keyCode === 229;
199
+ if (!(e.defaultPrevented || a)) switch (e.key) {
200
+ case "n":
201
+ case "j": {
202
+ j && e.ctrlKey && ie(e);
203
+ break;
204
+ }
205
+ case "ArrowDown": {
206
+ ie(e);
207
+ break;
208
+ }
209
+ case "p":
210
+ case "k": {
211
+ j && e.ctrlKey && se(e);
212
+ break;
213
+ }
214
+ case "ArrowUp": {
215
+ se(e);
216
+ break;
217
+ }
218
+ case "Home": {
219
+ e.preventDefault(), X2(0);
220
+ break;
221
+ }
222
+ case "End": {
223
+ e.preventDefault(), oe();
224
+ break;
225
+ }
226
+ case "Enter": {
227
+ e.preventDefault();
228
+ let i = M();
229
+ if (i) {
230
+ let l = new Event(Z);
231
+ i.dispatchEvent(l);
232
+ }
233
+ }
234
+ }
235
+ } }, t.createElement("label", { "cmdk-label": "", htmlFor: U2.inputId, id: U2.labelId, style: Te }, b), B2(r, (e) => t.createElement(de.Provider, { value: E }, t.createElement(ue.Provider, { value: U2 }, e))));
236
+ });
237
+ var he = t.forwardRef((r, o) => {
238
+ var _, I;
239
+ let n = useId(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
240
+ k2(() => {
241
+ if (!p2) return d.item(n, c == null ? void 0 : c.id);
242
+ }, [p2]);
243
+ let b = ve(n, u2, [r.value, r.children, u2], r.keywords), m2 = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p2 || d.filter() === false ? true : v.search ? v.filtered.items.get(n) > 0 : true);
244
+ t.useEffect(() => {
245
+ let v = u2.current;
246
+ if (!(!v || r.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
247
+ }, [x, r.onSelect, r.disabled]);
248
+ function C() {
249
+ var v, E;
250
+ S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current);
251
+ }
252
+ function S() {
253
+ m2.setState("value", b.current, true);
254
+ }
255
+ if (!x) return null;
256
+ let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r;
257
+ return t.createElement(Primitive.div, { ref: composeRefs(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
258
+ });
259
+ var Ee = t.forwardRef((r, o) => {
260
+ let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
261
+ k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]);
262
+ let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]);
263
+ return t.createElement(Primitive.div, { ref: composeRefs(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
264
+ });
265
+ var ye = t.forwardRef((r, o) => {
266
+ let { alwaysRender: n, ...u2 } = r, c = t.useRef(null), d = P((f) => !f.search);
267
+ return !n && !d ? null : t.createElement(Primitive.div, { ref: composeRefs(c, o), ...u2, "cmdk-separator": "", role: "separator" });
268
+ });
269
+ var Se = t.forwardRef((r, o) => {
270
+ let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
271
+ return t.useEffect(() => {
272
+ r.value != null && d.setState("search", r.value);
273
+ }, [r.value]), t.createElement(Primitive.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
274
+ c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
275
+ } });
276
+ });
277
+ var Ce = t.forwardRef((r, o) => {
278
+ let { children: n, label: u2 = "Suggestions", ...c } = r, d = t.useRef(null), f = t.useRef(null), p2 = P((m2) => m2.selectedItemId), b = K2();
279
+ return t.useEffect(() => {
280
+ if (f.current && d.current) {
281
+ let m2 = f.current, R = d.current, x, C = new ResizeObserver(() => {
282
+ x = requestAnimationFrame(() => {
283
+ let S = m2.offsetHeight;
284
+ R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
285
+ });
286
+ });
287
+ return C.observe(m2), () => {
288
+ cancelAnimationFrame(x), C.unobserve(m2);
289
+ };
290
+ }
291
+ }, []), t.createElement(Primitive.div, { ref: composeRefs(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
292
+ });
293
+ var xe = t.forwardRef((r, o) => {
294
+ let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
295
+ return t.createElement(w.Root, { open: n, onOpenChange: u2 }, t.createElement(w.Portal, { container: f }, t.createElement(w.Overlay, { "cmdk-overlay": "", className: c }), t.createElement(w.Content, { "aria-label": r.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 }))));
296
+ });
297
+ var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
298
+ var Pe = t.forwardRef((r, o) => {
299
+ let { progress: n, children: u2, label: c = "Loading...", ...d } = r;
300
+ return t.createElement(Primitive.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
301
+ });
302
+ var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
303
+ function we(r, o) {
304
+ let n = r.nextElementSibling;
305
+ for (; n; ) {
306
+ if (n.matches(o)) return n;
307
+ n = n.nextElementSibling;
308
+ }
309
+ }
310
+ function De(r, o) {
311
+ let n = r.previousElementSibling;
312
+ for (; n; ) {
313
+ if (n.matches(o)) return n;
314
+ n = n.previousElementSibling;
315
+ }
316
+ }
317
+ function pe(r) {
318
+ let o = t.useRef(r);
319
+ return k2(() => {
320
+ o.current = r;
321
+ }), o;
322
+ }
323
+ var k2 = typeof window == "undefined" ? t.useEffect : t.useLayoutEffect;
324
+ function L(r) {
325
+ let o = t.useRef();
326
+ return o.current === void 0 && (o.current = r()), o;
327
+ }
328
+ function P(r) {
329
+ let o = ee(), n = () => r(o.snapshot());
330
+ return t.useSyncExternalStore(o.subscribe, n, n);
331
+ }
332
+ function ve(r, o, n, u2 = []) {
333
+ let c = t.useRef(), d = K2();
334
+ return k2(() => {
335
+ var b;
336
+ let f = (() => {
337
+ var m2;
338
+ for (let R of n) {
339
+ if (typeof R == "string") return R.trim();
340
+ if (typeof R == "object" && "current" in R) return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current;
341
+ }
342
+ })(), p2 = u2.map((m2) => m2.trim());
343
+ d.value(r, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
344
+ }), c;
345
+ }
346
+ var ke = () => {
347
+ let [r, o] = t.useState(), n = L(() => /* @__PURE__ */ new Map());
348
+ return k2(() => {
349
+ n.current.forEach((u2) => u2()), n.current = /* @__PURE__ */ new Map();
350
+ }, [r]), (u2, c) => {
351
+ n.current.set(u2, c), o({});
352
+ };
353
+ };
354
+ function Me(r) {
355
+ let o = r.type;
356
+ return typeof o == "function" ? o(r.props) : "render" in o ? o.render(r.props) : r;
357
+ }
358
+ function B2({ asChild: r, children: o }, n) {
359
+ return r && t.isValidElement(o) ? t.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o);
360
+ }
361
+ var Te = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
362
+ function Command({
363
+ className,
364
+ ...props
365
+ }) {
366
+ return /* @__PURE__ */ jsx(
367
+ _e,
368
+ {
369
+ "data-slot": "command",
370
+ className: cn(
371
+ "bg-surface-overlay text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
372
+ className
373
+ ),
374
+ ...props
375
+ }
376
+ );
377
+ }
378
+ function CommandInput({
379
+ className,
380
+ ...props
381
+ }) {
382
+ return /* @__PURE__ */ jsxs(
383
+ "div",
384
+ {
385
+ className: "flex items-center border-b px-3",
386
+ "data-slot": "command-input-wrapper",
387
+ "cmdk-input-wrapper": "",
388
+ children: [
389
+ /* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "mr-2 size-4 shrink-0 opacity-50" }),
390
+ /* @__PURE__ */ jsx(
391
+ _e.Input,
392
+ {
393
+ "data-slot": "command-input",
394
+ className: cn(
395
+ "placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-2.5 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
396
+ className
397
+ ),
398
+ ...props
399
+ }
400
+ )
401
+ ]
402
+ }
403
+ );
404
+ }
405
+ function CommandList({
406
+ className,
407
+ ...props
408
+ }) {
409
+ return /* @__PURE__ */ jsx(
410
+ _e.List,
411
+ {
412
+ "data-slot": "command-list",
413
+ className: cn(
414
+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto overscroll-contain [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border",
415
+ className
416
+ ),
417
+ ...props
418
+ }
419
+ );
420
+ }
421
+ function CommandEmpty({
422
+ ...props
423
+ }) {
424
+ return /* @__PURE__ */ jsx(
425
+ _e.Empty,
426
+ {
427
+ "data-slot": "command-empty",
428
+ className: "py-6 text-center text-sm",
429
+ ...props
430
+ }
431
+ );
432
+ }
433
+ function CommandItem({
434
+ className,
435
+ ...props
436
+ }) {
437
+ return /* @__PURE__ */ jsx(
438
+ _e.Item,
439
+ {
440
+ "data-slot": "command-item",
441
+ className: cn(
442
+ "data-[selected=true]:bg-surface-active hover:bg-surface-hover relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
443
+ className
444
+ ),
445
+ ...props
446
+ }
447
+ );
448
+ }
449
+ var NewSessionAgentSelector = memo(
450
+ function NewSessionAgentSelector2({
451
+ agents,
452
+ selectedAgent,
453
+ onSelect,
454
+ children
455
+ }) {
456
+ const isMobile = useIsMobile();
457
+ const [open, setOpen] = useState(false);
458
+ const rows = (variant) => agents.map((agent) => {
459
+ const isSelected = selectedAgent?.id === agent.id;
460
+ return /* @__PURE__ */ jsxs(
461
+ CommandItem,
462
+ {
463
+ value: `${agent.name} ${agent.slug ?? ""}`,
464
+ onSelect: () => {
465
+ onSelect(agent.id);
466
+ setOpen(false);
467
+ },
468
+ className: cn(
469
+ "gap-2 px-2 py-1.5 text-sm",
470
+ // Touch rows: 48px tall with 16px type, against the pointer
471
+ // row's 28px — the popover's density is a mis-tap on a thumb.
472
+ variant === "sheet" && "gap-3 rounded-lg px-3 py-3 text-base",
473
+ isSelected && "bg-surface-overlay-active"
474
+ ),
475
+ children: [
476
+ /* @__PURE__ */ jsx(
477
+ AgentAvatar,
478
+ {
479
+ name: agent.name,
480
+ seed: agent.avatarSeed,
481
+ config: agent.avatarConfig,
482
+ size: variant === "sheet" ? 20 : 14,
483
+ className: "shrink-0"
484
+ }
485
+ ),
486
+ /* @__PURE__ */ jsx("span", { className: "truncate flex-1", children: agent.name }),
487
+ variant === "sheet" && isSelected ? /* @__PURE__ */ jsx(Checkmark1Icon, { className: "size-4 shrink-0 text-muted-foreground", "aria-hidden": true }) : null
488
+ ]
489
+ },
490
+ agent.id
491
+ );
492
+ });
493
+ if (isMobile) {
494
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
495
+ /* @__PURE__ */ jsx(
496
+ Slot,
497
+ {
498
+ onClick: () => setOpen(true),
499
+ onPointerDown: keepCaretOnTap,
500
+ children
501
+ }
502
+ ),
503
+ /* @__PURE__ */ jsx(Sheet, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(
504
+ SheetContent,
505
+ {
506
+ side: "bottom",
507
+ showCloseButton: false,
508
+ showGrabber: false,
509
+ overlayClassName: "bg-transparent",
510
+ className: "top-[calc(3rem+env(safe-area-inset-top))] h-auto max-h-none gap-0 rounded-none border-t-0 bg-surface-chat p-0",
511
+ children: [
512
+ /* @__PURE__ */ jsx(SheetHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(SheetTitle, { children: "Select agent" }) }),
513
+ /* @__PURE__ */ jsxs(Command, { className: "min-h-0 flex-1 rounded-none bg-transparent", children: [
514
+ /* @__PURE__ */ jsxs(
515
+ "div",
516
+ {
517
+ className: cn(
518
+ "flex h-14 shrink-0 items-center gap-1 border-b border-border pl-1.5 pr-3",
519
+ // CommandInput ships its own bordered, padded wrapper; the
520
+ // row owns the border here so the ✕ sits on the same rule.
521
+ "[&_[cmdk-input-wrapper]]:min-w-0 [&_[cmdk-input-wrapper]]:flex-1 [&_[cmdk-input-wrapper]]:border-0 [&_[cmdk-input-wrapper]]:px-0"
522
+ ),
523
+ children: [
524
+ /* @__PURE__ */ jsx(
525
+ "button",
526
+ {
527
+ type: "button",
528
+ onClick: () => setOpen(false),
529
+ "aria-label": "Close agent picker",
530
+ className: "flex size-10 shrink-0 items-center justify-center rounded-md text-foreground transition-colors active:bg-surface-active",
531
+ children: /* @__PURE__ */ jsx(CrossMediumIcon, { className: "size-5", strokeWidth: 1.8, "aria-hidden": true })
532
+ }
533
+ ),
534
+ /* @__PURE__ */ jsx(
535
+ CommandInput,
536
+ {
537
+ placeholder: "Search agents...",
538
+ className: "h-14 text-base"
539
+ }
540
+ )
541
+ ]
542
+ }
543
+ ),
544
+ /* @__PURE__ */ jsxs(CommandList, { className: "scrollbar min-h-0 max-h-none flex-1 overscroll-contain p-2", children: [
545
+ /* @__PURE__ */ jsx(CommandEmpty, { children: "No agents found." }),
546
+ rows("sheet")
547
+ ] })
548
+ ] })
549
+ ]
550
+ }
551
+ ) })
552
+ ] });
553
+ }
554
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
555
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children }),
556
+ /* @__PURE__ */ jsx(PopoverContent, { align: "start", sideOffset: 4, className: "w-56 p-0", children: /* @__PURE__ */ jsxs(Command, { children: [
557
+ /* @__PURE__ */ jsx(CommandInput, { placeholder: "Search agents...", className: "h-9" }),
558
+ /* @__PURE__ */ jsxs(
559
+ CommandList,
560
+ {
561
+ className: "scrollbar p-1",
562
+ style: {
563
+ maxHeight: "min(500px, calc(var(--radix-popover-content-available-height) - 3rem))"
564
+ },
565
+ children: [
566
+ /* @__PURE__ */ jsx(CommandEmpty, { children: "No agents found." }),
567
+ rows("popover")
568
+ ]
569
+ }
570
+ )
571
+ ] }) })
572
+ ] });
573
+ }
574
+ );
575
+ var NAME_CLS = "inline-flex max-w-full items-center gap-2 whitespace-normal rounded-sm text-2xl font-medium text-foreground max-md:text-2xl";
576
+ function NewSessionGreeting({
577
+ agentName,
578
+ avatarSeed,
579
+ avatarConfig,
580
+ switcher,
581
+ cta
582
+ }) {
583
+ const { t: t2 } = useTranslation();
584
+ const nameContent = agentName ? /* @__PURE__ */ jsxs(Fragment, { children: [
585
+ /* @__PURE__ */ jsx(
586
+ AgentAvatar,
587
+ {
588
+ name: agentName,
589
+ seed: avatarSeed,
590
+ config: avatarConfig,
591
+ size: 32,
592
+ className: "shrink-0"
593
+ }
594
+ ),
595
+ agentName,
596
+ "?"
597
+ ] }) : null;
598
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto flex w-full max-w-view flex-col items-center px-4 pb-6 text-center", children: /* @__PURE__ */ jsx(
599
+ "h2",
600
+ {
601
+ "aria-label": agentName ? t2("shell.greeting.agentWorkCta", { agentName }) : void 0,
602
+ className: "new-session-greeting flex max-w-3xl flex-wrap items-center justify-center gap-x-2 text-2xl font-medium text-foreground max-md:text-2xl",
603
+ children: agentName ? /* @__PURE__ */ jsxs(Fragment, { children: [
604
+ /* @__PURE__ */ jsx("span", { children: t2("shell.greeting.agentWorkPrefix") }),
605
+ switcher ? /* @__PURE__ */ jsx(
606
+ NewSessionAgentSelector,
607
+ {
608
+ agents: switcher.agents,
609
+ selectedAgent: switcher.selectedAgent,
610
+ onSelect: switcher.onSelect,
611
+ children: /* @__PURE__ */ jsx(
612
+ "button",
613
+ {
614
+ type: "button",
615
+ "aria-label": `Change agent. Currently ${agentName}`,
616
+ className: `${NAME_CLS} underline decoration-dotted decoration-1 underline-offset-[6px] outline-none transition-colors hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring`,
617
+ children: nameContent
618
+ }
619
+ )
620
+ }
621
+ ) : (
622
+ // Locked: same orb, size and type as the picker — minus the
623
+ // affordance, so it doesn't invite a click that does nothing.
624
+ /* @__PURE__ */ jsx("span", { className: NAME_CLS, children: nameContent })
625
+ )
626
+ ] }) : cta ?? t2("shell.greeting.cta")
627
+ }
628
+ ) });
629
+ }
630
+ var DEFAULT_SHORTCUTS = [
631
+ { id: "slides" },
632
+ { id: "document" },
633
+ { id: "spreadsheet" },
634
+ { id: "pdf" }
635
+ ];
636
+ function buildDefaultShortcuts(translate) {
637
+ return DEFAULT_SHORTCUTS.map(({ id }) => ({
638
+ id,
639
+ label: translate(`shell.shortcut.${id}`),
640
+ description: translate(`shell.shortcutDesc.${id}`),
641
+ prompt: translate(`shell.prompt.${id}`)
642
+ }));
643
+ }
644
+ function NewSessionPrompt({
645
+ agentName,
646
+ switcher,
647
+ avatarConfig,
648
+ avatarSeed,
649
+ shortcuts,
650
+ onPick
651
+ }) {
652
+ const { t: t2 } = useTranslation();
653
+ const cards = shortcuts ?? [];
654
+ return /* @__PURE__ */ jsxs("div", { className: "fr-new-session", children: [
655
+ /* @__PURE__ */ jsx(
656
+ NewSessionGreeting,
657
+ {
658
+ agentName,
659
+ avatarConfig,
660
+ avatarSeed,
661
+ switcher,
662
+ cta: t2("shell.greeting.workCta")
663
+ }
664
+ ),
665
+ cards.length > 0 && /* @__PURE__ */ jsx("div", { className: "fr-shortcuts", children: cards.map((shortcut) => /* @__PURE__ */ jsxs(
666
+ "button",
667
+ {
668
+ type: "button",
669
+ className: "fr-shortcut",
670
+ onClick: () => onPick?.(shortcut),
671
+ children: [
672
+ /* @__PURE__ */ jsx("span", { className: "fr-shortcut-label", children: shortcut.label }),
673
+ /* @__PURE__ */ jsx("span", { className: "fr-shortcut-desc", children: shortcut.description })
674
+ ]
675
+ },
676
+ shortcut.id
677
+ )) })
678
+ ] });
679
+ }
680
+
681
+ export { DEFAULT_SHORTCUTS, NewSessionPrompt, buildDefaultShortcuts, keepCaretOnTap };