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