@burdenoff/fe-libs 2026.1112.4 → 2026.1112.6

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 (40) hide show
  1. package/dist/shared/assistant/api.d.ts +7 -0
  2. package/dist/shared/assistant/api.js +47 -45
  3. package/dist/shared/assistant/createSandboxAssistantTransport.js +2 -1
  4. package/dist/shared/assistant/gatewayClient.js +1 -0
  5. package/dist/shared/assistant/index.d.ts +4 -0
  6. package/dist/shared/assistant/keepAlive.d.ts +74 -0
  7. package/dist/shared/assistant/keepAlive.js +77 -0
  8. package/dist/shared/assistant/prewarm.d.ts +20 -0
  9. package/dist/shared/assistant/prewarm.js +25 -4
  10. package/dist/shared/assistant/runtime.d.ts +7 -2
  11. package/dist/shared/assistant/runtime.js +23 -22
  12. package/dist/shared/assistant/signInWarm.d.ts +60 -0
  13. package/dist/shared/assistant/signInWarm.js +111 -0
  14. package/dist/shared/assistant/snapshotPoller.d.ts +16 -0
  15. package/dist/shared/assistant/snapshotPoller.js +29 -22
  16. package/dist/shared/assistant/staleSession.d.ts +27 -0
  17. package/dist/shared/assistant/staleSession.js +15 -0
  18. package/dist/shared/assistant/turnProgress.d.ts +16 -0
  19. package/dist/shared/assistant/turnProgress.js +30 -4
  20. package/dist/shared/assistant/ui/AssistantChatArea.js +1286 -1271
  21. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +7 -0
  22. package/dist/shared/assistant/ui/AssistantOverlay.js +256 -248
  23. package/dist/shared/assistant/usageReporting.d.ts +18 -0
  24. package/dist/shared/assistant/usageReporting.js +17 -5
  25. package/dist/shared/assistant/useAssistantHeartbeat.d.ts +24 -4
  26. package/dist/shared/assistant/useAssistantHeartbeat.js +43 -24
  27. package/dist/shared/assistant/useAssistantSignInWarm.d.ts +19 -0
  28. package/dist/shared/assistant/useAssistantSignInWarm.js +55 -0
  29. package/dist/shared/assistant/writeProposals.d.ts +9 -0
  30. package/dist/shared/components/assistantWidget/AssistantWidget.d.ts +7 -0
  31. package/dist/shared/components/assistantWidget/AssistantWidget.js +289 -285
  32. package/dist/shared/graphql/fetch.d.ts +2 -1
  33. package/dist/shared/graphql/fetch.js +14 -11
  34. package/dist/shared/providers/shell/AuthTokenProvider.d.ts +6 -0
  35. package/dist/shared/providers/shell/AuthTokenProvider.js +4 -1
  36. package/dist/shared/providers/shell/index.d.ts +1 -1
  37. package/dist/shared/utils/gatewayFetchRewrite.js +1 -1
  38. package/dist/shared-assistant.js +374 -370
  39. package/dist/shared-providers-shell.js +12 -12
  40. package/package.json +1 -1
@@ -7,441 +7,449 @@ import { useAssistantVisualViewport as a } from "./useAssistantVisualViewport.js
7
7
  import { assistantPanelOwnsEscape as o } from "./panelOverlays.js";
8
8
  import { AssistantPanelPlaceholder as s } from "./AssistantPanelPlaceholder.js";
9
9
  import { scheduleAssistantPanelPreload as c, useAssistantPanelLoaded as l, useAssistantPanelModule as u } from "./assistantPanelLoader.js";
10
- import { ASSISTANT_COMPACT_DOCKED_DEFAULT_QUERY as d, ASSISTANT_DOCK_WIDTH_VAR as f, ASSISTANT_OVERLAY_DESKTOP_QUERY as p, ASSISTANT_OVERLAY_TOP_VAR as ee, ASSISTANT_PANEL_INSET_VAR as te, ASSISTANT_SHEET_BOTTOM_VAR as ne, ASSISTANT_WINDOW_BOTTOM_VAR as m, assistantCompactLauncherBottom as h, assistantCompactLauncherVisibility as re, assistantCompactOverlayClassName as ie, assistantCompactOverlayKeys as ae, assistantLauncherBottom as g, assistantLauncherRight as oe, assistantOverlayClassName as _, assistantOverlayEscapeAction as se, assistantOverlayKeys as v, assistantQuotaKindOf as y, assistantWindowBottom as ce, closestAround as le, createAssistantNavigate as b, isAssistantSurface as ue, isAssistantToggleShortcut as x, nextAssistantOpenState as S, publishedAssistantDockWidth as de, publishedAssistantPanelInset as C, publishedCompactDockWidth as fe, publishedCompactPanelInset as pe, readAssistantLayoutChoice as w, readAssistantLegacyDockChoice as T, readAssistantOverlayFlag as E, readAssistantWindowView as me, requestedAssistantOpenState as D, resolveCompactDocked as O, writeAssistantLayoutChoice as he, writeAssistantOverlayFlag as k, writeAssistantWindowView as ge } from "./assistantOverlayState.js";
11
- import { AskAboutLayer as _e } from "../askAbout/AskAboutLayer.js";
12
- import { createContext as A, useCallback as j, useContext as M, useEffect as N, useMemo as P, useRef as F, useState as I, useSyncExternalStore as L } from "react";
13
- import { Sparkles as R } from "lucide-react";
14
- import { jsx as z, jsxs as B } from "react/jsx-runtime";
10
+ import { ASSISTANT_COMPACT_DOCKED_DEFAULT_QUERY as d, ASSISTANT_DOCK_WIDTH_VAR as f, ASSISTANT_OVERLAY_DESKTOP_QUERY as p, ASSISTANT_OVERLAY_TOP_VAR as ee, ASSISTANT_PANEL_INSET_VAR as te, ASSISTANT_SHEET_BOTTOM_VAR as ne, ASSISTANT_WINDOW_BOTTOM_VAR as m, assistantCompactLauncherBottom as h, assistantCompactLauncherVisibility as re, assistantCompactOverlayClassName as ie, assistantCompactOverlayKeys as ae, assistantLauncherBottom as g, assistantLauncherRight as oe, assistantOverlayClassName as _, assistantOverlayEscapeAction as se, assistantOverlayKeys as v, assistantQuotaKindOf as ce, assistantWindowBottom as le, closestAround as ue, createAssistantNavigate as y, isAssistantSurface as de, isAssistantToggleShortcut as fe, nextAssistantOpenState as b, publishedAssistantDockWidth as pe, publishedAssistantPanelInset as me, publishedCompactDockWidth as x, publishedCompactPanelInset as he, readAssistantLayoutChoice as ge, readAssistantLegacyDockChoice as _e, readAssistantOverlayFlag as S, readAssistantWindowView as C, requestedAssistantOpenState as w, resolveCompactDocked as ve, writeAssistantLayoutChoice as T, writeAssistantOverlayFlag as E, writeAssistantWindowView as ye } from "./assistantOverlayState.js";
11
+ import { AskAboutLayer as be } from "../askAbout/AskAboutLayer.js";
12
+ import { useAssistantSignInWarm as xe } from "../useAssistantSignInWarm.js";
13
+ import { useAssistantProductOrNull as D } from "../product.js";
14
+ import { createContext as O, useCallback as k, useContext as A, useEffect as j, useMemo as M, useRef as N, useState as P, useSyncExternalStore as F } from "react";
15
+ import { Sparkles as I } from "lucide-react";
16
+ import { jsx as L, jsxs as R } from "react/jsx-runtime";
15
17
  // src/shared/assistant/ui/AssistantOverlay.tsx
16
- var V = A(null);
17
- function H() {
18
- return M(V);
18
+ var z = O(null);
19
+ function B() {
20
+ return A(z);
19
21
  }
20
- function U() {
21
- return M(V)?.dockWidthPx ?? 0;
22
+ function V() {
23
+ return A(z)?.dockWidthPx ?? 0;
22
24
  }
23
- function W() {
24
- return M(V)?.panelInsetPx ?? 0;
25
+ function H() {
26
+ return A(z)?.panelInsetPx ?? 0;
25
27
  }
26
- var G = () => typeof window > "u" ? void 0 : window.sessionStorage, K = () => typeof window > "u" ? void 0 : window.localStorage;
27
- function q(e) {
28
+ var U = () => typeof window > "u" ? void 0 : window.sessionStorage, W = () => typeof window > "u" ? void 0 : window.localStorage;
29
+ function G(e) {
28
30
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
29
31
  let t = window.matchMedia(p);
30
32
  return t.addEventListener("change", e), () => t.removeEventListener("change", e);
31
33
  }
32
- function J() {
34
+ function K() {
33
35
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(min-width: 640px)").matches;
34
36
  }
35
- function ve() {
36
- return L(q, J, () => !1);
37
+ function Se() {
38
+ return F(G, K, () => !1);
37
39
  }
38
- function Y(t, n) {
39
- let r = F(n);
40
- N(() => {
40
+ function Ce(t, n) {
41
+ let r = N(n);
42
+ j(() => {
41
43
  r.current = n;
42
- }, [n]), N(() => {
44
+ }, [n]), j(() => {
43
45
  if (!t || typeof window > "u") return;
44
- let n = e(t), i = (e) => r.current(y(e), e);
46
+ let n = e(t), i = (e) => r.current(ce(e), e);
45
47
  return window.addEventListener(n, i), () => window.removeEventListener(n, i);
46
48
  }, [t]);
47
49
  }
48
- var ye = () => {};
49
- function X(e) {
50
+ var we = () => {};
51
+ function q(e) {
50
52
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
51
53
  let t = window.matchMedia(d);
52
54
  return t.addEventListener("change", e), () => t.removeEventListener("change", e);
53
55
  }
54
- function Z() {
56
+ function J() {
55
57
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(min-width: 1280px)").matches;
56
58
  }
57
- var Q = () => () => {}, $ = () => !1;
58
- function be(e) {
59
- return L(e ? X : Q, e ? Z : $, $);
59
+ var Y = () => () => {}, X = () => !1;
60
+ function Te(e) {
61
+ return F(e ? q : Y, e ? J : X, X);
60
62
  }
61
- function xe({ keyPrefix: e, quota: t, presentation: n = "classic", children: r }) {
62
- let i = P(() => v(e), [e]), a = P(() => ae(e), [e]), o = n === "compact", s = F(o);
63
- N(() => {
63
+ function Ee({ keyPrefix: e, quota: t, presentation: n = "classic", children: r }) {
64
+ let i = M(() => v(e), [e]), a = M(() => ae(e), [e]), o = n === "compact", s = N(o);
65
+ j(() => {
64
66
  s.current = o;
65
67
  }, [o]);
66
- let [c, l] = I(() => E(G, i.openStorageKey)), [u, d] = I(() => E(K, i.dockStorageKey)), [p, ee] = I(() => {
68
+ let [c, l] = P(() => S(U, i.openStorageKey)), [u, d] = P(() => S(W, i.dockStorageKey)), [p, ee] = P(() => {
67
69
  if (!o) return "panel";
68
70
  try {
69
- let e = G()?.getItem(a.surfaceStorageKey);
70
- return ue(e) ? e : "panel";
71
+ let e = U()?.getItem(a.surfaceStorageKey);
72
+ return de(e) ? e : "panel";
71
73
  } catch {
72
74
  return "panel";
73
75
  }
74
- }), [ne, m] = I(() => o && E(G, a.minimizedStorageKey)), h = o && c && p === "window" && ne, [re, ie] = I(!1), g = o && c && p === "panel" && re, [oe] = I(() => o ? me(K, a.windowViewStorageKey) : null), [_, se] = I(null), y = _ ?? oe, ce = j((e) => {
76
+ }), [ne, m] = P(() => o && S(U, a.minimizedStorageKey)), h = o && c && p === "window" && ne, [re, ie] = P(!1), g = o && c && p === "panel" && re, [oe] = P(() => o ? C(W, a.windowViewStorageKey) : null), [_, se] = P(null), ce = _ ?? oe, le = k((e) => {
75
77
  s.current && se(e);
76
- }, []), [le] = I(() => o ? {
77
- explicit: w(K, a.layoutStorageKey),
78
- legacy: T(K, i.dockStorageKey)
78
+ }, []), [ue] = P(() => o ? {
79
+ explicit: ge(W, a.layoutStorageKey),
80
+ legacy: _e(W, i.dockStorageKey)
79
81
  } : {
80
82
  explicit: null,
81
83
  legacy: null
82
- }), [b, _e] = I(null), A = be(o), M = o ? O({
83
- explicit: b ?? le.explicit,
84
- legacy: le.legacy,
85
- wideViewport: A
86
- }) : u, L = F(M);
87
- N(() => {
88
- L.current = M;
89
- }, [M]);
90
- let R = F(null), B = F(c);
91
- N(() => {
92
- B.current = c;
84
+ }), [y, be] = P(null), xe = Te(o), D = o ? ve({
85
+ explicit: y ?? ue.explicit,
86
+ legacy: ue.legacy,
87
+ wideViewport: xe
88
+ }) : u, O = N(D);
89
+ j(() => {
90
+ O.current = D;
91
+ }, [D]);
92
+ let A = N(null), F = N(c);
93
+ j(() => {
94
+ F.current = c;
93
95
  }, [c]);
94
- let H = F(!1), U = c && (!o || p === "panel" && !h);
95
- N(() => {
96
- H.current = U;
97
- }, [U]);
98
- let W = j(() => {
99
- let e = R.current?.() === !0;
96
+ let I = N(!1), R = c && (!o || p === "panel" && !h);
97
+ j(() => {
98
+ I.current = R;
99
+ }, [R]);
100
+ let B = k(() => {
101
+ let e = A.current?.() === !0;
100
102
  return e && s.current && m(!1), e;
101
- }, []), q = j((e) => (R.current = e, () => {
102
- R.current === e && (R.current = null);
103
- }), []), J = j(() => {
103
+ }, []), V = k((e) => (A.current = e, () => {
104
+ A.current === e && (A.current = null);
105
+ }), []), H = k(() => {
104
106
  l(!0), ee("panel"), m(!1);
105
- }, []), X = j(() => {
106
- l(!1), m(!1), ie(!1), Ce(0);
107
- }, []), Z = j(() => {
108
- s.current ? J() : l(!0);
109
- }, [J]), Q = j(() => {
110
- W() || (s.current ? X() : l(!1));
111
- }, [W, X]), $ = j(() => {
107
+ }, []), G = k(() => {
108
+ l(!1), m(!1), ie(!1), Ee(0);
109
+ }, []), K = k(() => {
110
+ s.current ? H() : l(!0);
111
+ }, [H]), q = k(() => {
112
+ B() || (s.current ? G() : l(!1));
113
+ }, [B, G]), J = k(() => {
112
114
  if (s.current) {
113
- if (H.current) {
114
- if (W()) return;
115
- X();
116
- } else J();
117
- } else B.current && W() || l((e) => !e);
115
+ if (I.current) {
116
+ if (B()) return;
117
+ G();
118
+ } else H();
119
+ } else F.current && B() || l((e) => !e);
118
120
  }, [
119
- W,
120
- X,
121
- J
122
- ]), xe = j(() => {
121
+ B,
122
+ G,
123
+ H
124
+ ]), Y = k(() => {
123
125
  if (s.current) {
124
- let e = L.current ? "floating" : "docked";
125
- L.current = e === "docked", _e(e);
126
+ let e = O.current ? "floating" : "docked";
127
+ O.current = e === "docked", be(e);
126
128
  } else d((e) => !e);
127
- }, []), [Se, Ce] = I(0), we = j((e) => {
128
- Z(), s.current && e?.menu === "settings/avatar" && Ce((e) => e + 1);
129
- }, [Z]), Te = j(() => {
130
- s.current ? H.current || (l(!0), ee("window"), m(!1)) : l(!0);
131
- }, []), Ee = j(() => {
132
- s.current && B.current && !H.current && m(!0);
129
+ }, []), [X, Ee] = P(0), Z = k((e) => {
130
+ K(), s.current && e?.menu === "settings/avatar" && Ee((e) => e + 1);
131
+ }, [K]), De = k(() => {
132
+ s.current ? I.current || (l(!0), ee("window"), m(!1)) : l(!0);
133
+ }, []), Oe = k(() => {
134
+ s.current && F.current && !I.current && m(!0);
133
135
  }, []);
134
- N(() => {
135
- k(G, i.openStorageKey, c);
136
- }, [i.openStorageKey, c]), N(() => {
137
- o || k(K, i.dockStorageKey, u);
136
+ j(() => {
137
+ E(U, i.openStorageKey, c);
138
+ }, [i.openStorageKey, c]), j(() => {
139
+ o || E(W, i.dockStorageKey, u);
138
140
  }, [
139
141
  o,
140
142
  i.dockStorageKey,
141
143
  u
142
- ]), N(() => {
143
- o && b !== null && he(K, a.layoutStorageKey, b);
144
+ ]), j(() => {
145
+ o && y !== null && T(W, a.layoutStorageKey, y);
144
146
  }, [
145
147
  o,
146
148
  a.layoutStorageKey,
147
- b
148
- ]), N(() => {
149
- o && _ !== null && ge(K, a.windowViewStorageKey, _);
149
+ y
150
+ ]), j(() => {
151
+ o && _ !== null && ye(W, a.windowViewStorageKey, _);
150
152
  }, [
151
153
  o,
152
154
  a.windowViewStorageKey,
153
155
  _
154
- ]), N(() => {
156
+ ]), j(() => {
155
157
  if (o) try {
156
- G()?.setItem(a.surfaceStorageKey, p);
158
+ U()?.setItem(a.surfaceStorageKey, p);
157
159
  } catch {}
158
160
  }, [
159
161
  o,
160
162
  a.surfaceStorageKey,
161
163
  p
162
- ]), N(() => {
163
- o && k(G, a.minimizedStorageKey, h);
164
+ ]), j(() => {
165
+ o && E(U, a.minimizedStorageKey, h);
164
166
  }, [
165
167
  o,
166
168
  a.minimizedStorageKey,
167
169
  h
168
- ]), N(() => {
170
+ ]), j(() => {
169
171
  if (typeof window > "u") return;
170
172
  let e = (e) => {
171
- let t = D(e);
172
- s.current ? t === !0 ? J() : t === !1 ? B.current && !W() && X() : H.current ? W() || X() : J() : (!B.current || S(!0, t) || R.current?.() !== !0) && l((e) => S(e, t));
173
+ let t = w(e);
174
+ s.current ? t === !0 ? H() : t === !1 ? F.current && !B() && G() : I.current ? B() || G() : H() : (!F.current || b(!0, t) || A.current?.() !== !0) && l((e) => b(e, t));
173
175
  };
174
176
  return window.addEventListener(i.toggleEvent, e), () => window.removeEventListener(i.toggleEvent, e);
175
177
  }, [
176
178
  i.toggleEvent,
177
- J,
178
- X,
179
- W
180
- ]), N(() => {
179
+ H,
180
+ G,
181
+ B
182
+ ]), j(() => {
181
183
  if (typeof document > "u") return;
182
184
  let e = (e) => {
183
- x(e) && (e.preventDefault(), s.current ? H.current ? W() || X() : J() : B.current && R.current?.() === !0 || l((e) => !e));
185
+ fe(e) && (e.preventDefault(), s.current ? I.current ? B() || G() : H() : F.current && A.current?.() === !0 || l((e) => !e));
184
186
  };
185
187
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
186
188
  }, [
187
- J,
188
- X,
189
- W
190
- ]), Y(t?.product ?? null, t?.onExhausted ?? ye);
191
- let De = ve(), Oe = o ? fe({
189
+ H,
190
+ G,
191
+ B
192
+ ]), Ce(t?.product ?? null, t?.onExhausted ?? we);
193
+ let Q = Se(), ke = o ? x({
192
194
  isOpen: c,
193
- docked: M,
194
- isDesktop: De,
195
+ docked: D,
196
+ isDesktop: Q,
195
197
  surface: p,
196
198
  expanded: g
197
- }) : de({
199
+ }) : pe({
198
200
  isOpen: c,
199
201
  docked: u,
200
- isDesktop: De
201
- }), ke = o ? pe({
202
+ isDesktop: Q
203
+ }), $ = o ? he({
202
204
  isOpen: c,
203
- docked: M,
204
- isDesktop: De,
205
+ docked: D,
206
+ isDesktop: Q,
205
207
  surface: p,
206
208
  expanded: g
207
- }) : C({
209
+ }) : me({
208
210
  isOpen: c,
209
211
  docked: u,
210
- isDesktop: De
212
+ isDesktop: Q
211
213
  });
212
- N(() => {
214
+ j(() => {
213
215
  if (typeof document > "u") return;
214
216
  let e = document.documentElement.style;
215
- return e.setProperty(f, `${Oe}px`), () => {
217
+ return e.setProperty(f, `${ke}px`), () => {
216
218
  e.removeProperty(f);
217
219
  };
218
- }, [Oe]), N(() => {
220
+ }, [ke]), j(() => {
219
221
  if (typeof document > "u") return;
220
222
  let e = document.documentElement.style;
221
- return e.setProperty(te, `${ke}px`), () => {
223
+ return e.setProperty(te, `${$}px`), () => {
222
224
  e.removeProperty(te);
223
225
  };
224
- }, [ke]);
225
- let Ae = P(() => ({
226
+ }, [$]);
227
+ let Ae = M(() => ({
226
228
  isOpen: c,
227
- open: Z,
228
- close: Q,
229
- toggle: $,
230
- docked: M,
231
- toggleDock: xe,
232
- dockWidthPx: Oe,
233
- panelInsetPx: ke,
229
+ open: K,
230
+ close: q,
231
+ toggle: J,
232
+ docked: D,
233
+ toggleDock: Y,
234
+ dockWidthPx: ke,
235
+ panelInsetPx: $,
234
236
  keys: i,
235
- registerCloseGuard: q,
237
+ registerCloseGuard: V,
236
238
  presentation: n,
237
239
  surface: p,
238
240
  minimized: h,
239
- fullOpen: U,
240
- openFull: we,
241
- avatarSettingsRequest: Se,
242
- openWindow: Te,
243
- minimize: Ee,
241
+ fullOpen: R,
242
+ openFull: Z,
243
+ avatarSettingsRequest: X,
244
+ openWindow: De,
245
+ minimize: Oe,
244
246
  expanded: g,
245
247
  setExpanded: ie,
246
- windowView: o ? y : null,
247
- setWindowView: ce
248
+ windowView: o ? ce : null,
249
+ setWindowView: le
248
250
  }), [
249
251
  c,
250
- Z,
251
- Q,
252
- $,
253
- M,
254
- xe,
255
- Oe,
252
+ K,
253
+ q,
254
+ J,
255
+ D,
256
+ Y,
256
257
  ke,
258
+ $,
257
259
  i,
258
- q,
260
+ V,
259
261
  n,
260
262
  p,
261
263
  h,
262
- U,
263
- we,
264
- Se,
265
- Te,
266
- Ee,
264
+ R,
265
+ Z,
266
+ X,
267
+ De,
268
+ Oe,
267
269
  g,
268
270
  o,
269
- y,
270
- ce
271
+ ce,
272
+ le
271
273
  ]);
272
- return /* @__PURE__ */ z(V.Provider, {
274
+ return /* @__PURE__ */ L(z.Provider, {
273
275
  value: Ae,
274
276
  children: r
275
277
  });
276
278
  }
277
- function Se(e) {
279
+ function Z(e) {
278
280
  let { state: t, retry: n } = u();
279
- if (t.status !== "ready") return /* @__PURE__ */ z(s, {
281
+ if (t.status !== "ready") return /* @__PURE__ */ L(s, {
280
282
  failed: t.status === "failed",
281
283
  onRetry: n
282
284
  });
283
285
  let { AIAssistantPanel: r } = t.module;
284
- return /* @__PURE__ */ z(r, { ...e });
286
+ return /* @__PURE__ */ L(r, { ...e });
285
287
  }
286
- var Ce = (e, t) => /* @__PURE__ */ z(Se, {
288
+ var De = (e, t) => /* @__PURE__ */ L(Z, {
287
289
  ...e,
288
290
  ...t
289
291
  });
290
- function we(e) {
291
- let t = H();
292
- return t ? /* @__PURE__ */ z(Te, {
292
+ function Oe(e) {
293
+ let t = B();
294
+ return t ? /* @__PURE__ */ L(Q, {
293
295
  state: t,
294
296
  ...e
295
297
  }) : null;
296
298
  }
297
- function Te({ state: e, panelId: s = "ai-assistant", panelProps: u, renderPanel: d, navigate: f, isShellLessTarget: p, topOffsetPx: te = 56, launcherIcon: ae, launcherBottomInset: v = "1.5rem", showLauncher: y = !0, closeOnEscape: ue = !0 }) {
298
- let { isOpen: x, close: S, toggle: de, docked: C, toggleDock: fe, dockWidthPx: pe } = e, w = e.presentation === "compact", { surface: T, minimized: E, setExpanded: me } = e, D = t();
299
+ function Q({ state: e, panelId: s = "ai-assistant", panelProps: u, renderPanel: d, navigate: f, isShellLessTarget: p, topOffsetPx: te = 56, launcherIcon: ae, launcherBottomInset: v = "1.5rem", showLauncher: ce = !0, closeOnEscape: de = !0, warmOnSignIn: fe = !0 }) {
300
+ let { isOpen: b, close: pe, toggle: me, docked: x, toggleDock: he, dockWidthPx: ge } = e, _e = D()?.product ?? "";
301
+ xe({
302
+ product: _e,
303
+ enabled: fe,
304
+ panelOpen: b
305
+ });
306
+ let S = e.presentation === "compact", { surface: C, minimized: w, setExpanded: ve } = e, T = t();
299
307
  r(u?.serverHistory === !0);
300
- let [O, he] = I(!1), k = F(null), ge = F(null), A = ve(), [M, L] = I(0), [V, H] = I(0), U = l();
301
- N(() => {
302
- M !== 0 && k.current?.querySelector("[data-testid=\"assistant-input\"]")?.focus({ preventScroll: !0 });
303
- }, [M, U]);
308
+ let [E, ye] = P(!1), O = N(null), A = N(null), F = Se(), [z, B] = P(0), [V, H] = P(0), U = l();
309
+ j(() => {
310
+ z !== 0 && O.current?.querySelector("[data-testid=\"assistant-input\"]")?.focus({ preventScroll: !0 });
311
+ }, [z, U]);
304
312
  let W = !d;
305
- N(() => {
313
+ j(() => {
306
314
  if (W) return c();
307
- }, [W]), N(() => {
308
- V !== 0 && k.current?.querySelector("[data-testid=\"assistant-window-language\"]")?.focus({ preventScroll: !0 });
309
- }, [V, U]), a(k, w && x && !E && !A);
310
- let G = F(u?.onExpandedChange);
311
- N(() => {
315
+ }, [W]), j(() => {
316
+ V !== 0 && O.current?.querySelector("[data-testid=\"assistant-window-language\"]")?.focus({ preventScroll: !0 });
317
+ }, [V, U]), a(O, S && b && !w && !F);
318
+ let G = N(u?.onExpandedChange);
319
+ j(() => {
312
320
  G.current = u?.onExpandedChange;
313
321
  });
314
- let K = j((e) => {
315
- me(e), G.current?.(e);
316
- }, [me]), q = P(() => f ? b({
322
+ let Ce = k((e) => {
323
+ ve(e), G.current?.(e);
324
+ }, [ve]), we = M(() => f ? y({
317
325
  navigate: f,
318
326
  isShellLessTarget: p,
319
- isDesktop: J,
320
- collapseSheet: () => he(!1),
327
+ isDesktop: K,
328
+ collapseSheet: () => ye(!1),
321
329
  openInNewTab: (e) => window.open(e, "_blank", "noopener,noreferrer")
322
- }) : void 0, [f, p]), Y = w && T === "window" ? e.minimize : S;
323
- N(() => {
324
- if (!x || !ue || E) return;
330
+ }) : void 0, [f, p]), q = S && C === "window" ? e.minimize : pe;
331
+ j(() => {
332
+ if (!b || !de || w) return;
325
333
  let e = (e) => {
326
334
  se({
327
335
  key: e.key,
328
- isOpen: x,
336
+ isOpen: b,
329
337
  alreadyHandled: e.defaultPrevented,
330
338
  dialogOpen: document.querySelector("[role=\"dialog\"],[role=\"alertdialog\"],dialog[open]") !== null,
331
- pressedInsideDialog: le(e.target, "[role=\"dialog\"],[role=\"alertdialog\"],dialog[open]") !== null,
339
+ pressedInsideDialog: ue(e.target, "[role=\"dialog\"],[role=\"alertdialog\"],dialog[open]") !== null,
332
340
  panelOwnsEscape: o()
333
- }) === "close" && (e.preventDefault(), Y());
341
+ }) === "close" && (e.preventDefault(), q());
334
342
  };
335
343
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
336
344
  }, [
337
- x,
338
- E,
339
- Y,
340
- ue
345
+ b,
346
+ w,
347
+ q,
348
+ de
341
349
  ]);
342
- let ye = F(E);
343
- N(() => {
344
- if (w && E && !ye.current) {
350
+ let J = N(w);
351
+ j(() => {
352
+ if (S && w && !J.current) {
345
353
  let e = document.activeElement;
346
- (!e || e === document.body || k.current?.contains(e)) && ge.current?.focus({ preventScroll: !0 });
354
+ (!e || e === document.body || O.current?.contains(e)) && A.current?.focus({ preventScroll: !0 });
347
355
  }
348
- ye.current = E;
349
- }, [w, E]);
350
- let X = {
356
+ J.current = w;
357
+ }, [S, w]);
358
+ let Y = {
351
359
  panelId: s,
352
- visible: !E,
353
- onClose: S,
354
- docked: C,
355
- onToggleDock: fe,
356
- onNavigate: q,
360
+ visible: !w,
361
+ onClose: pe,
362
+ docked: x,
363
+ onToggleDock: he,
364
+ onNavigate: we,
357
365
  isShellLessTarget: p,
358
- ...w ? {
366
+ ...S ? {
359
367
  presentation: "compact",
360
- surface: T,
368
+ surface: C,
361
369
  onOpenFull: e.openFull,
362
370
  avatarSettingsRequest: e.avatarSettingsRequest,
363
371
  onMinimize: e.minimize,
364
- onExpandedChange: K,
372
+ onExpandedChange: Ce,
365
373
  windowView: e.windowView,
366
374
  onWindowViewChange: e.setWindowView
367
375
  } : {}
368
- }, Z = w ? D("overlay.launcherQuick", "Open quick assistant") : D("overlay.launcher", "AI Assistant"), Q = {
376
+ }, X = S ? T("overlay.launcherQuick", "Open quick assistant") : T("overlay.launcher", "AI Assistant"), Te = {
369
377
  [ee]: `${te}px`,
370
378
  [ne]: "var(--mobile-tabbar-height, 0px)"
371
- }, $ = {
372
- ...Q,
373
- [m]: ce(v)
374
- }, be = w ? re({
375
- isOpen: x,
376
- surface: T,
377
- minimized: E
378
- }) : x ? "desktop-only" : "always", xe = (t) => {
379
- !w || e.fullOpen ? de() : x && !E ? e.minimize() : (e.openWindow(), A || t.detail === 0 ? L((e) => e + 1) : H((e) => e + 1));
379
+ }, Ee = {
380
+ ...Te,
381
+ [m]: le(v)
382
+ }, Z = S ? re({
383
+ isOpen: b,
384
+ surface: C,
385
+ minimized: w
386
+ }) : b ? "desktop-only" : "always", Oe = (t) => {
387
+ !S || e.fullOpen ? me() : b && !w ? e.minimize() : (e.openWindow(), F || t.detail === 0 ? B((e) => e + 1) : H((e) => e + 1));
380
388
  };
381
- return /* @__PURE__ */ B(n, {
389
+ return /* @__PURE__ */ R(n, {
382
390
  preview: u?.preview,
383
391
  children: [
384
- x && /* @__PURE__ */ B("div", {
385
- ref: k,
386
- className: w ? ie({
387
- surface: T,
388
- minimized: E,
389
- docked: C,
392
+ b && /* @__PURE__ */ R("div", {
393
+ ref: O,
394
+ className: S ? ie({
395
+ surface: C,
396
+ minimized: w,
397
+ docked: x,
390
398
  expanded: e.expanded,
391
- sheetExpanded: O
399
+ sheetExpanded: E
392
400
  }) : _({
393
- expanded: O,
394
- docked: C
401
+ expanded: E,
402
+ docked: x
395
403
  }),
396
- style: w ? $ : Q,
404
+ style: S ? Ee : Te,
397
405
  "data-testid": "assistant-overlay",
398
- ...w ? {
406
+ ...S ? {
399
407
  id: s,
400
- "data-surface": T,
401
- ...E ? {
408
+ "data-surface": C,
409
+ ...w ? {
402
410
  hidden: !0,
403
411
  inert: !0,
404
412
  "data-minimized": ""
405
413
  } : {}
406
414
  } : {},
407
- children: [/* @__PURE__ */ z("button", {
415
+ children: [/* @__PURE__ */ L("button", {
408
416
  type: "button",
409
- onClick: () => he((e) => !e),
417
+ onClick: () => ye((e) => !e),
410
418
  className: "flex w-full shrink-0 justify-center pt-2 pb-1 sm:hidden",
411
- "aria-label": O ? D("sheet.collapse", "Shrink the assistant") : D("sheet.expand", "Expand the assistant"),
412
- "aria-expanded": O,
419
+ "aria-label": E ? T("sheet.collapse", "Shrink the assistant") : T("sheet.expand", "Expand the assistant"),
420
+ "aria-expanded": E,
413
421
  "data-testid": "assistant-sheet-handle",
414
- children: /* @__PURE__ */ z("span", { className: "h-1.5 w-10 rounded-full bg-border-strong" })
415
- }), /* @__PURE__ */ z("div", {
422
+ children: /* @__PURE__ */ L("span", { className: "h-1.5 w-10 rounded-full bg-border-strong" })
423
+ }), /* @__PURE__ */ L("div", {
416
424
  className: "flex min-h-0 flex-1 flex-col",
417
- children: /* @__PURE__ */ z(i.Provider, {
425
+ children: /* @__PURE__ */ L(i.Provider, {
418
426
  value: e.registerCloseGuard ?? null,
419
- children: d ? d(X) : Ce(u, X)
427
+ children: d ? d(Y) : De(u, Y)
420
428
  })
421
429
  })]
422
430
  }),
423
- y && /* @__PURE__ */ z("button", {
424
- ref: ge,
431
+ ce && /* @__PURE__ */ L("button", {
432
+ ref: A,
425
433
  type: "button",
426
- onClick: xe,
427
- title: w ? Z : D("overlay.launcherTitle", "AI Assistant ({{shortcut}})", { shortcut: "Ctrl+Shift+A" }),
428
- "aria-label": Z,
429
- "aria-haspopup": w ? void 0 : "dialog",
430
- "aria-expanded": w ? x && !E : x,
431
- ...w && x ? { "aria-controls": s } : {},
434
+ onClick: Oe,
435
+ title: S ? X : T("overlay.launcherTitle", "AI Assistant ({{shortcut}})", { shortcut: "Ctrl+Shift+A" }),
436
+ "aria-label": X,
437
+ "aria-haspopup": S ? void 0 : "dialog",
438
+ "aria-expanded": S ? b && !w : b,
439
+ ...S && b ? { "aria-controls": s } : {},
432
440
  "data-testid": "assistant-fab",
433
441
  style: {
434
- bottom: w ? h(v) : g(v),
435
- right: oe(pe)
442
+ bottom: S ? h(v) : g(v),
443
+ right: oe(ge)
436
444
  },
437
- className: "fixed z-30 size-14 items-center justify-center rounded-full border border-border-strong bg-[var(--color-accent-soft)] text-action-primary-bg shadow-float transition-colors duration-200 hover:border-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] cursor-pointer " + (be === "hidden" ? "hidden" : be === "desktop-only" ? "hidden sm:inline-flex" : "inline-flex") + (w ? " max-[480px]:[--assistant-consent-clearance:var(--bf-consent-banner-offset,0px)]" : ""),
438
- children: ae ?? /* @__PURE__ */ z(R, {
445
+ className: "fixed z-30 size-14 items-center justify-center rounded-full border border-border-strong bg-[var(--color-accent-soft)] text-action-primary-bg shadow-float transition-colors duration-200 hover:border-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] cursor-pointer " + (Z === "hidden" ? "hidden" : Z === "desktop-only" ? "hidden sm:inline-flex" : "inline-flex") + (S ? " max-[480px]:[--assistant-consent-clearance:var(--bf-consent-banner-offset,0px)]" : ""),
446
+ children: ae ?? /* @__PURE__ */ L(I, {
439
447
  className: "size-6",
440
448
  "aria-hidden": "true"
441
449
  })
442
450
  }),
443
- /* @__PURE__ */ z(_e, { onOpenAssistant: e.openFull })
451
+ /* @__PURE__ */ L(be, { onOpenAssistant: e.openFull })
444
452
  ]
445
453
  });
446
454
  }
447
- export { we as AssistantOverlay, xe as AssistantOverlayProvider, U as useAssistantDockWidth, H as useAssistantOverlayOrNull, W as useAssistantPanelInset, Y as useAssistantQuotaExhausted };
455
+ export { Oe as AssistantOverlay, Ee as AssistantOverlayProvider, V as useAssistantDockWidth, B as useAssistantOverlayOrNull, H as useAssistantPanelInset, Ce as useAssistantQuotaExhausted };