@itechchoice/prime-chatkit 0.1.0-alpha.8 → 0.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1271 -1271
- package/dist/types/ui/blocks/useFollowLatest.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! PrimeChatKit – proprietary, see LICENSE. Contains affectUI Pro components – licensed under https://www.affectui.com/license, not under this package's terms. Don't copy them out of this package. */
|
|
2
2
|
import { jsxs as d, jsx as i, Fragment as Me } from "react/jsx-runtime";
|
|
3
|
-
import { useContext as Ht, createContext as ht, useSyncExternalStore as Ya, useMemo as je, useCallback as Ne, useRef as
|
|
3
|
+
import { useContext as Ht, createContext as ht, useSyncExternalStore as Ya, useMemo as je, useCallback as Ne, useRef as U, useState as A, useEffect as se, useLayoutEffect as ke, useId as qe, isValidElement as Va, Fragment as Ga, memo as Nt, useImperativeHandle as Qa, createElement as Za } from "react";
|
|
4
4
|
import { Clock01Icon as Ka, Alert02Icon as Wt, Mic01Icon as Ja, Video01Icon as Xa, Refresh01Icon as en, Tick02Icon as la, ArrowRight01Icon as tn, Briefcase01Icon as an, StarIcon as nn, SparklesIcon as on, Idea01Icon as rn, Compass01Icon as sn, HelpCircleIcon as cn, ChartLineData01Icon as ln, Analytics01Icon as dn, ArrowLeft01Icon as un, PencilEdit02Icon as pn, HistoryIcon as hn, PictureInPictureOnIcon as mn, Layout2ColumnIcon as fn, Cancel01Icon as gn } from "@hugeicons/core-free-icons";
|
|
5
5
|
import { HugeiconsIcon as it } from "@hugeicons/react";
|
|
6
6
|
import da, { defaultUrlTransform as ua } from "react-markdown";
|
|
@@ -112,50 +112,50 @@ const wn = 1440, yi = 1280, _n = 768, bn = 620, _t = 480, ki = 720, Qt = 64, kt
|
|
|
112
112
|
} catch {
|
|
113
113
|
}
|
|
114
114
|
}, Nn = (e, t, o) => {
|
|
115
|
-
const n =
|
|
115
|
+
const n = U(null), [a, r] = A(
|
|
116
116
|
typeof window < "u" ? window.innerWidth : 0
|
|
117
|
-
), [c, u] =
|
|
117
|
+
), [c, u] = A(
|
|
118
118
|
typeof window < "u" ? window.innerHeight : 0
|
|
119
|
-
), [s, l] =
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
}, []),
|
|
123
|
-
const
|
|
124
|
-
[oi]:
|
|
125
|
-
[xi[oi]]:
|
|
119
|
+
), [s, l] = A(Qt), [x, _] = A(null), [b, w] = A(null), [m, k] = A(null), [v, f] = A(!1), [y, L] = A(!1), [z, H] = A(!1), [C, P] = A(!1), F = U(null), D = U(null), T = U(null), B = U(null), ee = U(null), M = U(null), W = U(null), Z = U(null), K = U(null), te = U(!1), X = U(null), oe = t || "auto", E = (oe === "auto" && a >= wn || oe === "split" && a >= yi ? "split" : "dock") === "split", V = e && E, p = !E && a >= _n, S = Ne(() => {
|
|
120
|
+
const $ = X.current;
|
|
121
|
+
$ && (window.removeEventListener("pointermove", $.handlePointerMove), window.removeEventListener("pointerup", $.handlePointerUp), $.pointerTarget?.hasPointerCapture?.($.pointerId) && $.pointerTarget.releasePointerCapture($.pointerId), document.body.classList.remove("chatkit-dragging"), document.body.classList.remove("chatkit-dock-resizing"), Z.current && typeof window < "u" && (window.cancelAnimationFrame(Z.current), Z.current = null), X.current = null, H(!1), P(!1));
|
|
122
|
+
}, []), N = je(() => {
|
|
123
|
+
const $ = `${Math.max(0, s)}px`, ae = {
|
|
124
|
+
[oi]: $,
|
|
125
|
+
[xi[oi]]: $
|
|
126
126
|
};
|
|
127
|
-
return p && m &&
|
|
128
|
-
}, [m, s, p,
|
|
127
|
+
return p && m && !E && (ae.top = `${m.y}px`, ae.left = `${m.x}px`, ae.width = `${m.width}px`, ae.height = `${m.height}px`, ae.right = "auto", ae.bottom = "auto"), ae;
|
|
128
|
+
}, [m, s, p, E]), h = Ne(() => {
|
|
129
129
|
if (typeof window > "u") return;
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
130
|
+
const $ = document.querySelector('[data-role="app-header"]');
|
|
131
|
+
if (!$) {
|
|
132
132
|
l(Qt);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
const ae =
|
|
135
|
+
const ae = $.getBoundingClientRect();
|
|
136
136
|
l(ae?.height || Qt);
|
|
137
137
|
}, []);
|
|
138
138
|
se(() => {
|
|
139
139
|
if (typeof window > "u") return;
|
|
140
|
-
const
|
|
140
|
+
const $ = () => {
|
|
141
141
|
r(window.innerWidth || 0), u(window.innerHeight || 0), h();
|
|
142
142
|
};
|
|
143
|
-
return
|
|
143
|
+
return $(), window.addEventListener("resize", $), () => window.removeEventListener("resize", $);
|
|
144
144
|
}, [h]), se(() => {
|
|
145
|
-
if (
|
|
145
|
+
if (!E || a <= 0)
|
|
146
146
|
return;
|
|
147
|
-
const
|
|
148
|
-
Math.max(Math.round(a * Ci),
|
|
147
|
+
const $ = _t, ae = Math.min(
|
|
148
|
+
Math.max(Math.round(a * Ci), $),
|
|
149
149
|
ki
|
|
150
150
|
), fe = _t;
|
|
151
|
-
|
|
152
|
-
}, [
|
|
151
|
+
F.current = $, D.current = ae, T.current = fe, w(fe), _((ue) => ue ? Math.min(ae, Math.max(fe, ue)) : $);
|
|
152
|
+
}, [E, a]), se(() => {
|
|
153
153
|
if (!p) {
|
|
154
|
-
|
|
154
|
+
S(), k(null);
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
k((
|
|
158
|
-
const ae =
|
|
157
|
+
k(($) => {
|
|
158
|
+
const ae = $ || Cn() || Mn({
|
|
159
159
|
viewportWidth: a,
|
|
160
160
|
viewportHeight: c,
|
|
161
161
|
headerHeight: s
|
|
@@ -166,74 +166,74 @@ const wn = 1440, yi = 1280, _n = 768, bn = 620, _t = 480, ki = 720, Qt = 64, kt
|
|
|
166
166
|
headerHeight: s
|
|
167
167
|
});
|
|
168
168
|
});
|
|
169
|
-
}, [s, p,
|
|
169
|
+
}, [s, p, S, c, a]), se(() => {
|
|
170
170
|
K.current = m, p && m && vt(n.current, m);
|
|
171
171
|
}, [m, p]), se(() => {
|
|
172
172
|
if (typeof document > "u") return;
|
|
173
|
-
const
|
|
174
|
-
return
|
|
175
|
-
St(
|
|
173
|
+
const $ = document.documentElement;
|
|
174
|
+
return V && x && b ? (bt($, st, `${x}px`), bt($, zt, `${b}px`)) : (St($, st), St($, zt)), () => {
|
|
175
|
+
St($, st), St($, zt);
|
|
176
176
|
};
|
|
177
|
-
}, [
|
|
178
|
-
|
|
179
|
-
}, [
|
|
177
|
+
}, [V, b, x]), se(() => {
|
|
178
|
+
V || (f(!1), L(!1));
|
|
179
|
+
}, [V]), se(() => {
|
|
180
180
|
if (typeof document > "u") return;
|
|
181
|
-
const
|
|
182
|
-
return
|
|
183
|
-
}, [
|
|
181
|
+
const $ = "ai-split-active";
|
|
182
|
+
return V ? document.body.classList.add($) : document.body.classList.remove($), () => document.body.classList.remove($);
|
|
183
|
+
}, [V]), se(() => {
|
|
184
184
|
if (typeof document > "u" || typeof window > "u")
|
|
185
185
|
return;
|
|
186
|
-
if (!
|
|
186
|
+
if (!V) {
|
|
187
187
|
te.current = !1;
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
|
-
const
|
|
190
|
+
const $ = document.documentElement, ae = window.getComputedStyle($), fe = Mi(ae.getPropertyValue("--app-sidebar-width"), 0), ue = Mi(ae.getPropertyValue("--app-shell-gutter"), 0), ge = x || F.current || _t;
|
|
191
191
|
a - ge - fe - ue < bn && !te.current && (te.current = !0, o("dock"));
|
|
192
|
-
}, [
|
|
193
|
-
const
|
|
194
|
-
e && (
|
|
195
|
-
}, [e,
|
|
196
|
-
if (!
|
|
197
|
-
|
|
198
|
-
const ae =
|
|
192
|
+
}, [V, x, a, o]);
|
|
193
|
+
const I = Ne(() => {
|
|
194
|
+
e && (E ? o("dock") : a >= yi ? o("split") : o("dock"));
|
|
195
|
+
}, [e, E, a, o]), Q = Ne(($) => {
|
|
196
|
+
if (!V || $.button !== 0) return;
|
|
197
|
+
$.preventDefault(), $.stopPropagation();
|
|
198
|
+
const ae = $.clientX, fe = D.current || Math.min(
|
|
199
199
|
Math.max(Math.round(a * Ci), _t),
|
|
200
200
|
ki
|
|
201
|
-
), ue = T.current || _t, ge = x ||
|
|
202
|
-
_e?.setPointerCapture?.(
|
|
201
|
+
), ue = T.current || _t, ge = x || F.current || fe, _e = $.currentTarget;
|
|
202
|
+
_e?.setPointerCapture?.($.pointerId), B.current = {
|
|
203
203
|
startX: ae,
|
|
204
204
|
startWidth: ge,
|
|
205
205
|
maxWidth: fe,
|
|
206
206
|
minWidth: ue,
|
|
207
|
-
pointerId:
|
|
207
|
+
pointerId: $.pointerId,
|
|
208
208
|
pointerTarget: _e
|
|
209
|
-
},
|
|
209
|
+
}, M.current = ge, f(!0), L(!0), document.body.classList.add("chatkit-resizing");
|
|
210
210
|
const we = document.documentElement;
|
|
211
211
|
bt(we, zt, `${ue}px`);
|
|
212
212
|
const he = (ce) => {
|
|
213
213
|
if (!B.current) return;
|
|
214
214
|
const { startX: xe, startWidth: pe, maxWidth: ve, minWidth: Ce } = B.current, J = xe - ce.clientX, ze = Math.min(ve, Math.max(Ce, pe + J));
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
M.current = ze, !W.current && (W.current = window.requestAnimationFrame(() => {
|
|
216
|
+
W.current = null, bt(we, st, `${M.current}px`);
|
|
217
217
|
}));
|
|
218
|
-
},
|
|
218
|
+
}, G = (ce) => {
|
|
219
219
|
const xe = B.current;
|
|
220
|
-
B.current = null,
|
|
220
|
+
B.current = null, L(!1), document.body.classList.remove("chatkit-resizing"), W.current && (window.cancelAnimationFrame(W.current), W.current = null), M.current && (bt(we, st, `${M.current}px`), _(M.current)), xe?.pointerTarget?.hasPointerCapture?.(xe.pointerId) && xe.pointerTarget.releasePointerCapture(xe.pointerId);
|
|
221
221
|
const pe = xe?.pointerTarget?.getBoundingClientRect?.(), ve = pe && ce.clientX >= pe.left && ce.clientX <= pe.right && ce.clientY >= pe.top && ce.clientY <= pe.bottom;
|
|
222
|
-
f(!!ve), window.removeEventListener("pointermove", he), window.removeEventListener("pointerup",
|
|
222
|
+
f(!!ve), window.removeEventListener("pointermove", he), window.removeEventListener("pointerup", G), ee.current = null;
|
|
223
223
|
};
|
|
224
224
|
ee.current = {
|
|
225
|
-
pointerId:
|
|
225
|
+
pointerId: $.pointerId,
|
|
226
226
|
pointerTarget: _e,
|
|
227
227
|
handlePointerMove: he,
|
|
228
|
-
handlePointerUp:
|
|
229
|
-
}, window.addEventListener("pointermove", he), window.addEventListener("pointerup",
|
|
230
|
-
}, [
|
|
231
|
-
if (!p || !m ||
|
|
228
|
+
handlePointerUp: G
|
|
229
|
+
}, window.addEventListener("pointermove", he), window.addEventListener("pointerup", G);
|
|
230
|
+
}, [V, x, a]), g = Ne(($) => {
|
|
231
|
+
if (!p || !m || $.button !== 0 || $.target instanceof Element && $.target.closest('button, a, input, textarea, select, [role="button"]'))
|
|
232
232
|
return;
|
|
233
|
-
|
|
234
|
-
const ae =
|
|
235
|
-
ae?.setPointerCapture?.(
|
|
236
|
-
const fe =
|
|
233
|
+
$.preventDefault(), $.stopPropagation(), S();
|
|
234
|
+
const ae = $.currentTarget;
|
|
235
|
+
ae?.setPointerCapture?.($.pointerId);
|
|
236
|
+
const fe = $.clientX - m.x, ue = $.clientY - m.y, ge = (we) => {
|
|
237
237
|
const he = Ot(
|
|
238
238
|
{
|
|
239
239
|
...m,
|
|
@@ -247,27 +247,27 @@ const wn = 1440, yi = 1280, _n = 768, bn = 620, _t = 480, ki = 720, Qt = 64, kt
|
|
|
247
247
|
}));
|
|
248
248
|
}, _e = () => {
|
|
249
249
|
const we = K.current;
|
|
250
|
-
Z.current && (window.cancelAnimationFrame(Z.current), Z.current = null), vt(n.current, we), we && (Ni(we), k(we)),
|
|
250
|
+
Z.current && (window.cancelAnimationFrame(Z.current), Z.current = null), vt(n.current, we), we && (Ni(we), k(we)), S();
|
|
251
251
|
};
|
|
252
252
|
X.current = {
|
|
253
253
|
mode: "drag",
|
|
254
|
-
pointerId:
|
|
254
|
+
pointerId: $.pointerId,
|
|
255
255
|
pointerTarget: ae,
|
|
256
256
|
handlePointerMove: ge,
|
|
257
257
|
handlePointerUp: _e
|
|
258
|
-
},
|
|
259
|
-
}, [m, s, p,
|
|
260
|
-
if (!p || !m ||
|
|
258
|
+
}, H(!0), document.body.classList.add("chatkit-dragging"), window.addEventListener("pointermove", ge), window.addEventListener("pointerup", _e);
|
|
259
|
+
}, [m, s, p, S, c, a]), O = Ne(($) => {
|
|
260
|
+
if (!p || !m || $.button !== 0)
|
|
261
261
|
return;
|
|
262
|
-
|
|
263
|
-
const ae =
|
|
264
|
-
ae?.setPointerCapture?.(
|
|
265
|
-
const fe =
|
|
262
|
+
$.preventDefault(), $.stopPropagation(), S();
|
|
263
|
+
const ae = $.currentTarget;
|
|
264
|
+
ae?.setPointerCapture?.($.pointerId);
|
|
265
|
+
const fe = $.clientX, ue = $.clientY, ge = m.width, _e = m.height, we = (G) => {
|
|
266
266
|
const ce = Ot(
|
|
267
267
|
{
|
|
268
268
|
...m,
|
|
269
|
-
width: ge + (
|
|
270
|
-
height: _e + (
|
|
269
|
+
width: ge + (G.clientX - fe),
|
|
270
|
+
height: _e + (G.clientY - ue)
|
|
271
271
|
},
|
|
272
272
|
{ viewportWidth: a, viewportHeight: c, headerHeight: s }
|
|
273
273
|
);
|
|
@@ -275,42 +275,42 @@ const wn = 1440, yi = 1280, _n = 768, bn = 620, _t = 480, ki = 720, Qt = 64, kt
|
|
|
275
275
|
Z.current = null, vt(n.current, K.current);
|
|
276
276
|
}));
|
|
277
277
|
}, he = () => {
|
|
278
|
-
const
|
|
279
|
-
Z.current && (window.cancelAnimationFrame(Z.current), Z.current = null), vt(n.current,
|
|
278
|
+
const G = K.current;
|
|
279
|
+
Z.current && (window.cancelAnimationFrame(Z.current), Z.current = null), vt(n.current, G), G && (Ni(G), k(G)), S();
|
|
280
280
|
};
|
|
281
281
|
X.current = {
|
|
282
282
|
mode: "resize",
|
|
283
|
-
pointerId:
|
|
283
|
+
pointerId: $.pointerId,
|
|
284
284
|
pointerTarget: ae,
|
|
285
285
|
handlePointerMove: we,
|
|
286
286
|
handlePointerUp: he
|
|
287
|
-
},
|
|
288
|
-
}, [m, s, p,
|
|
287
|
+
}, P(!0), document.body.classList.add("chatkit-dock-resizing"), window.addEventListener("pointermove", we), window.addEventListener("pointerup", he);
|
|
288
|
+
}, [m, s, p, S, c, a]);
|
|
289
289
|
se(() => () => {
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
}, [
|
|
290
|
+
const $ = ee.current;
|
|
291
|
+
$ && (window.removeEventListener("pointermove", $.handlePointerMove), window.removeEventListener("pointerup", $.handlePointerUp), $.pointerTarget.hasPointerCapture?.($.pointerId) && $.pointerTarget.releasePointerCapture($.pointerId), ee.current = null), B.current = null, M.current = null, W.current && typeof window < "u" && (window.cancelAnimationFrame(W.current), W.current = null), Z.current && typeof window < "u" && window.cancelAnimationFrame(Z.current), document.body.classList.remove("chatkit-resizing"), document.body.classList.remove("chatkit-dragging"), document.body.classList.remove("chatkit-dock-resizing"), S();
|
|
292
|
+
}, [S]);
|
|
293
293
|
const R = Ne(() => {
|
|
294
|
-
|
|
295
|
-
}, [
|
|
294
|
+
V && f(!0);
|
|
295
|
+
}, [V]), q = Ne(() => {
|
|
296
296
|
B.current || f(!1);
|
|
297
297
|
}, []);
|
|
298
298
|
return {
|
|
299
|
-
isSplitLayout:
|
|
300
|
-
isSplitActive:
|
|
301
|
-
isResizeReady:
|
|
302
|
-
isResizing:
|
|
299
|
+
isSplitLayout: E,
|
|
300
|
+
isSplitActive: V,
|
|
301
|
+
isResizeReady: v,
|
|
302
|
+
isResizing: y,
|
|
303
303
|
isDockInteractive: p,
|
|
304
|
-
isDockDragging:
|
|
305
|
-
isDockResizing:
|
|
304
|
+
isDockDragging: z,
|
|
305
|
+
isDockResizing: C,
|
|
306
306
|
shellRef: n,
|
|
307
|
-
shellStyle:
|
|
308
|
-
toggleLayout:
|
|
309
|
-
handleResizeStart:
|
|
307
|
+
shellStyle: N,
|
|
308
|
+
toggleLayout: I,
|
|
309
|
+
handleResizeStart: Q,
|
|
310
310
|
handleResizeEnter: R,
|
|
311
|
-
handleResizeLeave:
|
|
311
|
+
handleResizeLeave: q,
|
|
312
312
|
handleDockDragStart: g,
|
|
313
|
-
handleDockResizeStart:
|
|
313
|
+
handleDockResizeStart: O
|
|
314
314
|
};
|
|
315
315
|
};
|
|
316
316
|
function In({
|
|
@@ -325,25 +325,25 @@ function In({
|
|
|
325
325
|
}) {
|
|
326
326
|
const s = e && t, l = e && !t, x = Nn(s, o, n), {
|
|
327
327
|
isSplitLayout: _,
|
|
328
|
-
isSplitActive:
|
|
328
|
+
isSplitActive: b,
|
|
329
329
|
isDockInteractive: w,
|
|
330
330
|
isDockDragging: m,
|
|
331
331
|
isDockResizing: k,
|
|
332
|
-
shellRef:
|
|
332
|
+
shellRef: v,
|
|
333
333
|
shellStyle: f,
|
|
334
|
-
handleResizeStart:
|
|
335
|
-
handleResizeEnter:
|
|
336
|
-
handleResizeLeave:
|
|
337
|
-
handleDockResizeStart:
|
|
334
|
+
handleResizeStart: y,
|
|
335
|
+
handleResizeEnter: L,
|
|
336
|
+
handleResizeLeave: z,
|
|
337
|
+
handleDockResizeStart: H
|
|
338
338
|
} = x;
|
|
339
339
|
return /* @__PURE__ */ d(
|
|
340
340
|
"div",
|
|
341
341
|
{
|
|
342
|
-
ref:
|
|
342
|
+
ref: v,
|
|
343
343
|
className: [
|
|
344
344
|
"abc-prime-dock",
|
|
345
345
|
s && "abc-prime-dock--open",
|
|
346
|
-
|
|
346
|
+
b && "abc-prime-dock--split",
|
|
347
347
|
l && "abc-prime-dock--minimized",
|
|
348
348
|
w && "abc-prime-dock--dock-interactive",
|
|
349
349
|
m && "abc-prime-dock--dragging",
|
|
@@ -352,16 +352,16 @@ function In({
|
|
|
352
352
|
].filter(Boolean).join(" "),
|
|
353
353
|
style: f,
|
|
354
354
|
children: [
|
|
355
|
-
|
|
355
|
+
b && /* @__PURE__ */ i(
|
|
356
356
|
"div",
|
|
357
357
|
{
|
|
358
358
|
className: "abc-prime-dock__resize-handle",
|
|
359
359
|
role: "separator",
|
|
360
360
|
"aria-orientation": "vertical",
|
|
361
361
|
"aria-label": r.resizeHandle,
|
|
362
|
-
onPointerDown:
|
|
363
|
-
onPointerEnter:
|
|
364
|
-
onPointerLeave:
|
|
362
|
+
onPointerDown: y,
|
|
363
|
+
onPointerEnter: L,
|
|
364
|
+
onPointerLeave: z
|
|
365
365
|
}
|
|
366
366
|
),
|
|
367
367
|
/* @__PURE__ */ d("div", { className: "abc-prime-dock__panel", children: [
|
|
@@ -371,7 +371,7 @@ function In({
|
|
|
371
371
|
{
|
|
372
372
|
type: "button",
|
|
373
373
|
className: "abc-prime-dock__resize-corner",
|
|
374
|
-
onPointerDown:
|
|
374
|
+
onPointerDown: H,
|
|
375
375
|
"aria-label": r.resizeCorner
|
|
376
376
|
}
|
|
377
377
|
)
|
|
@@ -499,75 +499,75 @@ function En({
|
|
|
499
499
|
onAttach: x,
|
|
500
500
|
// PrimeChatKit LOCAL ⑨ start
|
|
501
501
|
onAdd: _,
|
|
502
|
-
addItems:
|
|
502
|
+
addItems: b,
|
|
503
503
|
voice: w = !0,
|
|
504
504
|
// PrimeChatKit LOCAL ⑨ end
|
|
505
505
|
approval: m = "ask",
|
|
506
506
|
onApprovalChange: k,
|
|
507
|
-
onLearnMore:
|
|
507
|
+
onLearnMore: v,
|
|
508
508
|
folders: f = Ln,
|
|
509
|
-
folder:
|
|
510
|
-
onFolderChange:
|
|
511
|
-
apps:
|
|
512
|
-
connectedApps:
|
|
513
|
-
onAppsChange:
|
|
514
|
-
foot:
|
|
515
|
-
tray:
|
|
509
|
+
folder: y,
|
|
510
|
+
onFolderChange: L,
|
|
511
|
+
apps: z = Tn,
|
|
512
|
+
connectedApps: H = ["gmail"],
|
|
513
|
+
onAppsChange: C,
|
|
514
|
+
foot: P,
|
|
515
|
+
tray: F = !0
|
|
516
516
|
}) {
|
|
517
|
-
const
|
|
518
|
-
a &&
|
|
519
|
-
},
|
|
520
|
-
a &&
|
|
521
|
-
}, [g,
|
|
517
|
+
const D = { ...ya, ...r }, T = Sn(D), B = Dn(D), [ee, M] = A(m === !1 ? "ask" : m), [W, Z] = A(!1), [K, te] = A(!1), [X, oe] = A(""), [re, Y] = A(y ?? null), [E, V] = A(H), [p, S] = A(c[0]), [N, h] = A(null), I = (j) => {
|
|
518
|
+
a && j === "add" || h((le) => le === j ? null : j);
|
|
519
|
+
}, Q = (j) => (le) => {
|
|
520
|
+
a && j === "add" || le.key !== "ArrowDown" && le.key !== "ArrowUp" || (le.preventDefault(), h(j));
|
|
521
|
+
}, [g, O] = A(!1), [R, q] = A(""), [$, ae] = A(Dt), [fe, ue] = A("");
|
|
522
522
|
se(() => {
|
|
523
|
-
a && (h(null),
|
|
523
|
+
a && (h(null), O(!1), q(""), ae(Dt()), ue(""));
|
|
524
524
|
}, [a]);
|
|
525
|
-
const ge =
|
|
525
|
+
const ge = U(null), _e = U(null), we = U(null), [he, G] = A(Ii);
|
|
526
526
|
ke(() => {
|
|
527
|
-
const
|
|
528
|
-
if (!
|
|
529
|
-
const le =
|
|
530
|
-
|
|
531
|
-
const Oe = Math.max(
|
|
532
|
-
|
|
533
|
-
const We = parseFloat(getComputedStyle(
|
|
534
|
-
|
|
527
|
+
const j = _e.current;
|
|
528
|
+
if (!j) return;
|
|
529
|
+
const le = j.style.height;
|
|
530
|
+
j.style.height = "0px";
|
|
531
|
+
const Oe = Math.max(j.scrollHeight, R ? we.current?.scrollHeight ?? 0 : 0);
|
|
532
|
+
j.style.height = le;
|
|
533
|
+
const We = parseFloat(getComputedStyle(j).lineHeight) || 1;
|
|
534
|
+
G(Math.min(On, Math.max(Ii, Math.round(Oe / We))));
|
|
535
535
|
}, [X, R]);
|
|
536
|
-
const ce =
|
|
537
|
-
const le = re ===
|
|
538
|
-
|
|
539
|
-
}, Lt = (
|
|
540
|
-
const le =
|
|
541
|
-
|
|
542
|
-
}, Tt = (
|
|
543
|
-
|
|
544
|
-
}, At = (
|
|
536
|
+
const ce = U(null), xe = U(null), pe = U(null), ve = U(null), Ce = U(null), J = U(0), [ze, Yt] = A(!1), It = (j) => {
|
|
537
|
+
const le = re === j ? null : j;
|
|
538
|
+
Y(le), h(null), ue(le ? D.workingIn(le) : D.noFolder), L?.(le), ve.current?.focus();
|
|
539
|
+
}, Lt = (j) => {
|
|
540
|
+
const le = !E.includes(j), Oe = le ? [...E, j] : E.filter((We) => We !== j);
|
|
541
|
+
V(Oe), h(null), ue(D.appConnection(z.find((We) => We.id === j)?.name, le)), C?.(Oe), (F ? Ce : pe).current?.focus();
|
|
542
|
+
}, Tt = (j) => {
|
|
543
|
+
j !== ee && Z(!0), M(j), h(null), ue(D.selected(T.find((le) => le.id === j)?.label)), k?.(j), xe.current?.focus();
|
|
544
|
+
}, At = (j) => {
|
|
545
545
|
if (!a) {
|
|
546
|
-
if (
|
|
547
|
-
if (h(null),
|
|
546
|
+
if (j === "apps") return h("apps");
|
|
547
|
+
if (h(null), j === "plan" && (ue(K ? D.planOff : D.planOn), te(!K)), x?.(j), j === "folder" && f.length > 0 && !P) return h("folder");
|
|
548
548
|
pe.current?.focus();
|
|
549
549
|
}
|
|
550
|
-
}, ft = (
|
|
551
|
-
|
|
550
|
+
}, ft = (j) => {
|
|
551
|
+
j.id !== p?.id && Yt(!0), S(j), h(null), ue(D.selected(j.name)), l?.(j), ce.current?.focus();
|
|
552
552
|
};
|
|
553
553
|
ke(() => {
|
|
554
|
-
const
|
|
555
|
-
if (!
|
|
556
|
-
const le =
|
|
557
|
-
J.current = le, !(!ze || !Oe || Math.abs(Oe - le) < 0.5) && (window.matchMedia("(prefers-reduced-motion: reduce)").matches ||
|
|
554
|
+
const j = ce.current;
|
|
555
|
+
if (!j) return;
|
|
556
|
+
const le = j.offsetWidth, Oe = J.current;
|
|
557
|
+
J.current = le, !(!ze || !Oe || Math.abs(Oe - le) < 0.5) && (window.matchMedia("(prefers-reduced-motion: reduce)").matches || j.animate([{ width: `${Oe}px` }, { width: `${le}px` }], {
|
|
558
558
|
duration: 460,
|
|
559
559
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)"
|
|
560
560
|
}));
|
|
561
561
|
}, [p?.id]), se(() => {
|
|
562
|
-
w === !1 && (
|
|
562
|
+
w === !1 && (O(!1), q(""), ae(Dt()), ue(""));
|
|
563
563
|
}, [w]), se(() => {
|
|
564
564
|
if (!g || w === !1) return;
|
|
565
|
-
const
|
|
565
|
+
const j = u.split(/\s+/).filter(Boolean);
|
|
566
566
|
let le = 0;
|
|
567
567
|
const Oe = window.setInterval(() => {
|
|
568
|
-
le = Math.min(
|
|
568
|
+
le = Math.min(j.length, le + 1), q(j.slice(0, le).join(" "));
|
|
569
569
|
}, 320), We = window.setInterval(() => {
|
|
570
|
-
const Ha = le <
|
|
570
|
+
const Ha = le < j.length && Math.random() > 0.3 ? 0.3 + Math.random() * 0.7 : 0;
|
|
571
571
|
ae((Wa) => [...Wa.slice(1), Ha]);
|
|
572
572
|
}, 120);
|
|
573
573
|
return () => {
|
|
@@ -575,41 +575,41 @@ function En({
|
|
|
575
575
|
};
|
|
576
576
|
}, [g, u, w]);
|
|
577
577
|
const Vt = () => {
|
|
578
|
-
a || w !== !1 && (h(null),
|
|
579
|
-
}, gt = (
|
|
580
|
-
|
|
578
|
+
a || w !== !1 && (h(null), q(""), ae(Dt()), O(!0), ue(D.recording));
|
|
579
|
+
}, gt = (j) => {
|
|
580
|
+
O(!1), j && R ? (oe((le) => le.trim() ? `${le.trimEnd()} ${R}` : R), ue(D.recordingAdded)) : ue(D.recordingDiscarded), q(""), _e.current?.focus();
|
|
581
581
|
}, He = e && !!t, xt = !He && !a && !o && X.trim().length > 0, ie = () => {
|
|
582
|
-
xt && (s?.(X.trim(), { model: p?.id ?? "" }), oe(""), ue(
|
|
583
|
-
}, Le = (
|
|
584
|
-
|
|
585
|
-
}, Xe = (
|
|
586
|
-
|
|
587
|
-
}, tt = (
|
|
588
|
-
|
|
589
|
-
}, nt = T.find((
|
|
590
|
-
h(null), le &&
|
|
591
|
-
}, Gt = B.map((
|
|
592
|
-
title:
|
|
582
|
+
xt && (s?.(X.trim(), { model: p?.id ?? "" }), oe(""), ue(D.messageSent), _e.current?.focus());
|
|
583
|
+
}, Le = (j) => {
|
|
584
|
+
j.key === "Enter" && !j.shiftKey && !j.nativeEvent.isComposing && (j.preventDefault(), ie());
|
|
585
|
+
}, Xe = (j) => {
|
|
586
|
+
j.key === "Escape" && g && (j.preventDefault(), gt(!1));
|
|
587
|
+
}, tt = (j) => {
|
|
588
|
+
j.target.closest("button, textarea, input") || (j.preventDefault(), _e.current?.focus());
|
|
589
|
+
}, nt = T.find((j) => j.id === ee) ?? T.find((j) => j.id === "ask"), wt = (j) => (le) => {
|
|
590
|
+
h(null), le && j.current?.focus();
|
|
591
|
+
}, Gt = B.map((j) => ({
|
|
592
|
+
title: j.title,
|
|
593
593
|
// Without the tray, filter the replacement's ID (apps), not the original folder ID.
|
|
594
|
-
rows:
|
|
595
|
-
if (!
|
|
596
|
-
const Oe =
|
|
594
|
+
rows: j.rows.flatMap((le) => {
|
|
595
|
+
if (!F && le.id === "folder") {
|
|
596
|
+
const Oe = z.find(() => !0);
|
|
597
597
|
if (!Oe) return [];
|
|
598
598
|
const We = Oe.Logo;
|
|
599
|
-
return [{ id: "apps", label:
|
|
599
|
+
return [{ id: "apps", label: D.connectApps, description: E.length ? D.connectedCount(E.length) : void 0, icon: /* @__PURE__ */ i(We, {}) }];
|
|
600
600
|
}
|
|
601
601
|
return [{
|
|
602
602
|
id: le.id,
|
|
603
603
|
label: le.label,
|
|
604
|
-
description: le.id === "plan" && K ?
|
|
604
|
+
description: le.id === "plan" && K ? D.planOffDescription : le.description,
|
|
605
605
|
icon: /* @__PURE__ */ i(le.Icon, {}),
|
|
606
606
|
checked: le.id === "plan" ? K : void 0
|
|
607
607
|
}];
|
|
608
|
-
}).filter((le) =>
|
|
609
|
-
})).filter((
|
|
608
|
+
}).filter((le) => b === void 0 || b.includes(le.id))
|
|
609
|
+
})).filter((j) => j.rows.length > 0);
|
|
610
610
|
return (
|
|
611
611
|
// PrimeChatKit LOCAL ⑫ start
|
|
612
|
-
/* @__PURE__ */ d("div", { className: "ui-ccc", "data-tray":
|
|
612
|
+
/* @__PURE__ */ d("div", { className: "ui-ccc", "data-tray": F ? void 0 : "off", "data-disabled": a || void 0, children: [
|
|
613
613
|
/* @__PURE__ */ i("style", { href: "ui-chat-composer-clean", precedence: "default", children: ao }),
|
|
614
614
|
/* @__PURE__ */ d(
|
|
615
615
|
"section",
|
|
@@ -618,7 +618,7 @@ function En({
|
|
|
618
618
|
className: "ui-ccc__body",
|
|
619
619
|
"data-recording": g,
|
|
620
620
|
style: { "--ui-ccc-lines": he },
|
|
621
|
-
"aria-label":
|
|
621
|
+
"aria-label": D.composer,
|
|
622
622
|
onKeyDown: Xe,
|
|
623
623
|
children: [
|
|
624
624
|
/* @__PURE__ */ d("div", { className: "ui-ccc__write", onPointerDown: tt, children: [
|
|
@@ -629,10 +629,10 @@ function En({
|
|
|
629
629
|
ref: _e,
|
|
630
630
|
className: "ui-ccc__message",
|
|
631
631
|
value: X,
|
|
632
|
-
onChange: (
|
|
632
|
+
onChange: (j) => oe(j.target.value),
|
|
633
633
|
onKeyDown: Le,
|
|
634
|
-
placeholder: n ??
|
|
635
|
-
"aria-label":
|
|
634
|
+
placeholder: n ?? D.placeholder,
|
|
635
|
+
"aria-label": D.message,
|
|
636
636
|
spellCheck: !1,
|
|
637
637
|
readOnly: g,
|
|
638
638
|
disabled: a,
|
|
@@ -653,12 +653,12 @@ function En({
|
|
|
653
653
|
ref: pe,
|
|
654
654
|
type: "button",
|
|
655
655
|
className: "ui-ccc__icon-btn",
|
|
656
|
-
"aria-label":
|
|
656
|
+
"aria-label": D.add,
|
|
657
657
|
"aria-haspopup": _ ? void 0 : "menu",
|
|
658
|
-
"aria-expanded": _ ? void 0 :
|
|
658
|
+
"aria-expanded": _ ? void 0 : N === "add",
|
|
659
659
|
disabled: a || !_ && Gt.length === 0,
|
|
660
|
-
onClick: _ ?? (() =>
|
|
661
|
-
onKeyDown: _ ? void 0 :
|
|
660
|
+
onClick: _ ?? (() => I("add")),
|
|
661
|
+
onKeyDown: _ ? void 0 : Q("add"),
|
|
662
662
|
children: /* @__PURE__ */ i(Rn, {})
|
|
663
663
|
}
|
|
664
664
|
),
|
|
@@ -670,10 +670,10 @@ function En({
|
|
|
670
670
|
className: "ui-ccc__approval",
|
|
671
671
|
"data-tone": nt.tone,
|
|
672
672
|
"aria-haspopup": "listbox",
|
|
673
|
-
"aria-expanded":
|
|
674
|
-
onClick: () =>
|
|
675
|
-
onKeyDown:
|
|
676
|
-
children: /* @__PURE__ */ d("span", { className: "ui-ccc__approval-face", "data-morph":
|
|
673
|
+
"aria-expanded": N === "approval",
|
|
674
|
+
onClick: () => I("approval"),
|
|
675
|
+
onKeyDown: Q("approval"),
|
|
676
|
+
children: /* @__PURE__ */ d("span", { className: "ui-ccc__approval-face", "data-morph": W || void 0, children: [
|
|
677
677
|
/* @__PURE__ */ i("span", { className: "ui-ccc__approval-icon", "aria-hidden": "true", children: /* @__PURE__ */ i(nt.Icon, {}) }),
|
|
678
678
|
/* @__PURE__ */ i("span", { className: "ui-ccc__approval-text", children: nt.label })
|
|
679
679
|
] }, nt.id)
|
|
@@ -689,9 +689,9 @@ function En({
|
|
|
689
689
|
type: "button",
|
|
690
690
|
className: "ui-ccc__model",
|
|
691
691
|
"aria-haspopup": "listbox",
|
|
692
|
-
"aria-expanded":
|
|
693
|
-
onClick: () =>
|
|
694
|
-
onKeyDown:
|
|
692
|
+
"aria-expanded": N === "model",
|
|
693
|
+
onClick: () => I("model"),
|
|
694
|
+
onKeyDown: Q("model"),
|
|
695
695
|
children: [
|
|
696
696
|
/* @__PURE__ */ d("span", { className: "ui-ccc__model-face", "data-morph": ze || void 0, children: [
|
|
697
697
|
p.Logo && p.id !== "auto" && /* @__PURE__ */ i("span", { className: "ui-ccc__model-logo", "aria-hidden": "true", children: /* @__PURE__ */ i(p.Logo, {}) }),
|
|
@@ -701,18 +701,18 @@ function En({
|
|
|
701
701
|
]
|
|
702
702
|
}
|
|
703
703
|
),
|
|
704
|
-
w !== !1 && /* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__icon-btn", "aria-label":
|
|
705
|
-
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__send", "data-stop": He || void 0, "aria-label": He ?
|
|
704
|
+
w !== !1 && /* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__icon-btn", "aria-label": D.voiceInput, onClick: Vt, disabled: a, children: /* @__PURE__ */ i(Vn, {}) }),
|
|
705
|
+
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__send", "data-stop": He || void 0, "aria-label": He ? D.stop : D.sendMessage, disabled: !He && !xt, onClick: He ? t : ie, children: He ? /* @__PURE__ */ i(Qn, {}) : /* @__PURE__ */ i(Zn, {}) })
|
|
706
706
|
] }),
|
|
707
707
|
w !== !1 && /* @__PURE__ */ d("div", { className: "ui-ccc__group ui-ccc__group--end ui-ccc__group--voice", inert: !g, children: [
|
|
708
|
-
/* @__PURE__ */ i("span", { className: "ui-ccc__trace", "aria-hidden": "true", children:
|
|
709
|
-
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__button", "aria-label":
|
|
710
|
-
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__send", "aria-label":
|
|
708
|
+
/* @__PURE__ */ i("span", { className: "ui-ccc__trace", "aria-hidden": "true", children: $.map((j, le) => /* @__PURE__ */ i("span", { style: { height: Math.max(2, j * 16) } }, le)) }),
|
|
709
|
+
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__button", "aria-label": D.discardRecording, onClick: () => gt(!1), children: /* @__PURE__ */ i(io, {}) }),
|
|
710
|
+
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__send", "aria-label": D.useRecording, onClick: () => gt(!0), children: /* @__PURE__ */ i(Ma, {}) })
|
|
711
711
|
] })
|
|
712
712
|
] })
|
|
713
713
|
] })
|
|
714
714
|
] }),
|
|
715
|
-
|
|
715
|
+
F ? P ? /* @__PURE__ */ i("div", { className: "ui-ccc__foot", "data-custom": "", children: P }) : /* @__PURE__ */ d("div", { className: "ui-ccc__foot", children: [
|
|
716
716
|
f.length > 0 && /* @__PURE__ */ d(
|
|
717
717
|
"button",
|
|
718
718
|
{
|
|
@@ -720,28 +720,28 @@ function En({
|
|
|
720
720
|
type: "button",
|
|
721
721
|
className: "ui-ccc__row ui-ccc__row--folder",
|
|
722
722
|
"aria-haspopup": "listbox",
|
|
723
|
-
"aria-expanded":
|
|
724
|
-
onClick: () =>
|
|
725
|
-
onKeyDown:
|
|
723
|
+
"aria-expanded": N === "folder",
|
|
724
|
+
onClick: () => I("folder"),
|
|
725
|
+
onKeyDown: Q("folder"),
|
|
726
726
|
children: [
|
|
727
727
|
/* @__PURE__ */ i("span", { className: "ui-ccc__folder", "aria-hidden": "true", children: /* @__PURE__ */ i(Kn, {}) }),
|
|
728
|
-
/* @__PURE__ */ i("span", { className: "ui-ccc__row-label", title: re ?? void 0, dir: "auto", children: re ??
|
|
728
|
+
/* @__PURE__ */ i("span", { className: "ui-ccc__row-label", title: re ?? void 0, dir: "auto", children: re ?? D.workInFolder })
|
|
729
729
|
]
|
|
730
730
|
}
|
|
731
731
|
),
|
|
732
|
-
|
|
732
|
+
z.length > 0 && /* @__PURE__ */ d(
|
|
733
733
|
"button",
|
|
734
734
|
{
|
|
735
735
|
ref: Ce,
|
|
736
736
|
type: "button",
|
|
737
737
|
className: "ui-ccc__row ui-ccc__row--apps",
|
|
738
738
|
"aria-haspopup": "menu",
|
|
739
|
-
"aria-expanded":
|
|
740
|
-
onClick: () =>
|
|
741
|
-
onKeyDown:
|
|
739
|
+
"aria-expanded": N === "apps",
|
|
740
|
+
onClick: () => I("apps"),
|
|
741
|
+
onKeyDown: Q("apps"),
|
|
742
742
|
children: [
|
|
743
|
-
|
|
744
|
-
/* @__PURE__ */ i("span", { className: "ui-ccc__logos", "aria-hidden": "true", children:
|
|
743
|
+
D.connectApps,
|
|
744
|
+
/* @__PURE__ */ i("span", { className: "ui-ccc__logos", "aria-hidden": "true", children: z.slice(0, 3).map((j) => /* @__PURE__ */ i("span", { className: "ui-ccc__logo", children: /* @__PURE__ */ i(j.Logo, {}) }, j.id)) })
|
|
745
745
|
]
|
|
746
746
|
}
|
|
747
747
|
)
|
|
@@ -749,9 +749,9 @@ function En({
|
|
|
749
749
|
!_ && !a && Gt.length > 0 && /* @__PURE__ */ i(
|
|
750
750
|
yt,
|
|
751
751
|
{
|
|
752
|
-
open:
|
|
752
|
+
open: N === "add",
|
|
753
753
|
role: "menu",
|
|
754
|
-
label:
|
|
754
|
+
label: D.addToChat,
|
|
755
755
|
inline: !0,
|
|
756
756
|
wide: !0,
|
|
757
757
|
sections: Gt,
|
|
@@ -764,58 +764,58 @@ function En({
|
|
|
764
764
|
m !== !1 && /* @__PURE__ */ i(
|
|
765
765
|
yt,
|
|
766
766
|
{
|
|
767
|
-
open:
|
|
768
|
-
label:
|
|
767
|
+
open: N === "approval",
|
|
768
|
+
label: D.approvalQuestion,
|
|
769
769
|
head: /* @__PURE__ */ d(Me, { children: [
|
|
770
|
-
/* @__PURE__ */ i("span", { children:
|
|
771
|
-
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__menu-link", onClick:
|
|
770
|
+
/* @__PURE__ */ i("span", { children: D.approvalQuestion }),
|
|
771
|
+
/* @__PURE__ */ i("button", { type: "button", className: "ui-ccc__menu-link", onClick: v, children: D.learnMore })
|
|
772
772
|
] }),
|
|
773
773
|
width: 468,
|
|
774
774
|
align: "start",
|
|
775
|
-
sections: [{ rows: T.map((
|
|
775
|
+
sections: [{ rows: T.map((j) => ({ id: j.id, label: j.label, description: j.description, icon: /* @__PURE__ */ i(j.Icon, {}), tone: j.tone, checked: j.id === ee })) }],
|
|
776
776
|
anchor: xe,
|
|
777
777
|
container: ge,
|
|
778
|
-
onPick: (
|
|
778
|
+
onPick: (j) => Tt(j),
|
|
779
779
|
onClose: wt(xe)
|
|
780
780
|
}
|
|
781
781
|
),
|
|
782
782
|
p && /* @__PURE__ */ i(
|
|
783
783
|
yt,
|
|
784
784
|
{
|
|
785
|
-
open:
|
|
786
|
-
label:
|
|
787
|
-
sections: [{ rows: c.map((
|
|
785
|
+
open: N === "model",
|
|
786
|
+
label: D.selectModel,
|
|
787
|
+
sections: [{ rows: c.map((j) => ({ id: j.id, label: j.name, description: j.description, icon: j.Logo && /* @__PURE__ */ i(j.Logo, {}), checked: j.id === p.id })) }],
|
|
788
788
|
anchor: ce,
|
|
789
789
|
container: ge,
|
|
790
|
-
onPick: (
|
|
790
|
+
onPick: (j) => ft(c.find((le) => le.id === j) ?? p),
|
|
791
791
|
onClose: wt(ce)
|
|
792
792
|
}
|
|
793
793
|
),
|
|
794
|
-
|
|
794
|
+
F && !P && f.length > 0 && /* @__PURE__ */ i(
|
|
795
795
|
yt,
|
|
796
796
|
{
|
|
797
|
-
open:
|
|
798
|
-
label:
|
|
797
|
+
open: N === "folder",
|
|
798
|
+
label: D.workInFolder,
|
|
799
799
|
align: "start",
|
|
800
|
-
sections: [{ title:
|
|
800
|
+
sections: [{ title: D.workInFolder, rows: f.map((j) => ({ id: j, label: j, icon: /* @__PURE__ */ i(ka, {}), checked: j === re })) }],
|
|
801
801
|
anchor: ve,
|
|
802
802
|
container: ge,
|
|
803
803
|
onPick: It,
|
|
804
804
|
onClose: wt(ve)
|
|
805
805
|
}
|
|
806
806
|
),
|
|
807
|
-
(!
|
|
807
|
+
(!F || !P) && z.length > 0 && /* @__PURE__ */ i(
|
|
808
808
|
yt,
|
|
809
809
|
{
|
|
810
|
-
open:
|
|
810
|
+
open: N === "apps",
|
|
811
811
|
role: "menu",
|
|
812
|
-
label:
|
|
813
|
-
align:
|
|
814
|
-
sections: [{ title:
|
|
815
|
-
anchor:
|
|
812
|
+
label: D.apps,
|
|
813
|
+
align: F ? void 0 : "start",
|
|
814
|
+
sections: [{ title: D.apps, rows: z.map((j) => ({ id: j.id, label: j.name, icon: /* @__PURE__ */ i(j.Logo, {}), checked: E.includes(j.id) })) }],
|
|
815
|
+
anchor: F ? Ce : pe,
|
|
816
816
|
container: ge,
|
|
817
817
|
onPick: Lt,
|
|
818
|
-
onClose: wt(
|
|
818
|
+
onClose: wt(F ? Ce : pe)
|
|
819
819
|
}
|
|
820
820
|
)
|
|
821
821
|
]
|
|
@@ -848,12 +848,12 @@ function yt({
|
|
|
848
848
|
wide: l = !1,
|
|
849
849
|
inline: x = !1,
|
|
850
850
|
onPick: _,
|
|
851
|
-
onClose:
|
|
851
|
+
onClose: b
|
|
852
852
|
}) {
|
|
853
|
-
const w = qe(), m =
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
}, [te, X] =
|
|
853
|
+
const w = qe(), m = U(null), k = U([]), v = a.flatMap((Y) => Y.rows), [f, y] = A(0), [L, z] = A({ top: 0, left: 0, width: s, up: !0, fromTop: 0, fromLeft: 0, fromRadius: 0 }), [H, C] = A({ y: 0, h: 0, glide: !1 }), [P, F] = A(!1), D = U(!1), [T, B] = A(!1), [ee, M] = A(!1), [W, Z] = A(!1), K = () => {
|
|
854
|
+
const Y = m.current;
|
|
855
|
+
Y && Z(Y.scrollTop + Y.clientHeight < Y.scrollHeight - 2);
|
|
856
|
+
}, [te, X] = A(!0);
|
|
857
857
|
ke(() => {
|
|
858
858
|
if (!e) {
|
|
859
859
|
B(!1);
|
|
@@ -865,41 +865,41 @@ function yt({
|
|
|
865
865
|
return;
|
|
866
866
|
}
|
|
867
867
|
if (!r.current || !c.current || !m.current) return;
|
|
868
|
-
const
|
|
869
|
-
m.current.style.width = `${
|
|
870
|
-
const
|
|
871
|
-
m.current.style.maxHeight = `${ae / p}px`,
|
|
868
|
+
const Y = r.current.getBoundingClientRect(), E = c.current.getBoundingClientRect(), V = jn(c.current), p = E.width / (c.current.offsetWidth || E.width) || 1, S = Math.min(l ? c.current.offsetWidth : s, (V.right - V.left) / p - 16);
|
|
869
|
+
m.current.style.width = `${S}px`, m.current.style.maxHeight = "";
|
|
870
|
+
const N = S * p, h = m.current.offsetHeight * p, I = 8 * p, Q = l ? -6 * p : 0, g = 8 * p, O = l ? E : Y, R = O.top + Q - (V.top + g), q = V.bottom - g - (O.bottom + I), $ = l ? R >= Math.min(h, 160 * p) || R >= q : R >= h || R >= q, ae = Math.min(h, Math.max(0, $ ? R : q)), fe = (he, G, ce) => Math.max(G, Math.min(he, ce)), ue = fe($ ? O.top + Q - ae : O.bottom + I, V.top + g, V.bottom - g - ae), ge = fe(l ? E.left : u === "start" ? Y.left : Y.right - N, V.left + g, V.right - g - N), _e = fe(Y.left - ge, 0, N - 1) / p, we = ($ ? fe(ae - Y.height, 0, ae - 1) : 0) / p;
|
|
871
|
+
m.current.style.maxHeight = `${ae / p}px`, z({ top: (ue - E.top) / p, left: (ge - E.left) / p, width: S, up: $, fromTop: we, fromLeft: _e, fromRadius: 6 }), y(Math.max(0, v.findIndex((he) => he.checked))), F(!1), M(!0);
|
|
872
872
|
}, [e, te]), ke(() => {
|
|
873
|
-
!e || T || !m.current || (getComputedStyle(m.current).clipPath,
|
|
874
|
-
}, [
|
|
875
|
-
T && (m.current?.focus({ preventScroll: !0 }), m.current?.matches(":focus-visible") &&
|
|
873
|
+
!e || T || !m.current || (getComputedStyle(m.current).clipPath, M(!1), B(!0));
|
|
874
|
+
}, [L]), se(() => {
|
|
875
|
+
T && (m.current?.focus({ preventScroll: !0 }), m.current?.matches(":focus-visible") && F(!0)), K();
|
|
876
876
|
}, [T]), ke(() => {
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
const
|
|
880
|
-
|
|
881
|
-
}, [f, e,
|
|
877
|
+
const Y = k.current[f];
|
|
878
|
+
Y && C({ y: Y.offsetTop, h: Y.offsetHeight, glide: D.current && P });
|
|
879
|
+
const E = m.current;
|
|
880
|
+
Y && E && e && (Y.offsetTop < E.scrollTop ? E.scrollTop = Y.offsetTop - 4 : Y.offsetTop + Y.offsetHeight > E.scrollTop + E.clientHeight && (E.scrollTop = Y.offsetTop + Y.offsetHeight - E.clientHeight + 4)), D.current = P;
|
|
881
|
+
}, [f, e, P]), se(() => {
|
|
882
882
|
if (!e) return;
|
|
883
|
-
const
|
|
884
|
-
const
|
|
885
|
-
m.current?.contains(
|
|
883
|
+
const Y = (E) => {
|
|
884
|
+
const V = E.target;
|
|
885
|
+
m.current?.contains(V) || r.current?.contains(V) || b(!1);
|
|
886
886
|
};
|
|
887
|
-
return document.addEventListener("pointerdown",
|
|
888
|
-
}, [e,
|
|
889
|
-
const oe = (
|
|
890
|
-
const
|
|
891
|
-
if (
|
|
892
|
-
|
|
887
|
+
return document.addEventListener("pointerdown", Y), () => document.removeEventListener("pointerdown", Y);
|
|
888
|
+
}, [e, b, r]);
|
|
889
|
+
const oe = (Y) => {
|
|
890
|
+
const E = Y.target === m.current, V = m.current?.querySelector(".ui-ccc__menu-head :is(a, button)");
|
|
891
|
+
if (Y.key === "Tab" && V && E !== Y.shiftKey) {
|
|
892
|
+
Y.preventDefault(), (E ? V : m.current)?.focus({ preventScroll: !0 });
|
|
893
893
|
return;
|
|
894
894
|
}
|
|
895
|
-
if (
|
|
896
|
-
const p =
|
|
895
|
+
if (!E && Y.key !== "Tab" && Y.key !== "Escape") return;
|
|
896
|
+
const p = v.length - 1, S = {
|
|
897
897
|
ArrowDown: Math.min(p, f + 1),
|
|
898
898
|
ArrowUp: Math.max(0, f - 1),
|
|
899
899
|
Home: 0,
|
|
900
900
|
End: p
|
|
901
901
|
};
|
|
902
|
-
|
|
902
|
+
Y.key in S ? (Y.preventDefault(), y(S[Y.key]), F(!0)) : Y.key === "Enter" || Y.key === " " ? (Y.preventDefault(), _(v[f].id)) : Y.key === "Escape" ? (Y.preventDefault(), Y.stopPropagation(), b(!0)) : Y.key === "Tab" && (r.current?.focus({ preventScroll: !0 }), b(!1));
|
|
903
903
|
};
|
|
904
904
|
let re = -1;
|
|
905
905
|
return /* @__PURE__ */ i(
|
|
@@ -908,18 +908,18 @@ function yt({
|
|
|
908
908
|
className: "ui-ccc__menu",
|
|
909
909
|
"data-open": T,
|
|
910
910
|
"data-placing": ee,
|
|
911
|
-
"data-up":
|
|
911
|
+
"data-up": L.up,
|
|
912
912
|
"data-inline": x || void 0,
|
|
913
|
-
"data-above": l &&
|
|
913
|
+
"data-above": l && L.up || void 0,
|
|
914
914
|
style: {
|
|
915
915
|
display: te ? "none" : void 0,
|
|
916
|
-
top:
|
|
917
|
-
left:
|
|
918
|
-
width:
|
|
919
|
-
"--from-top": `${
|
|
920
|
-
"--from-left": `${
|
|
921
|
-
"--from-bottom":
|
|
922
|
-
"--from-radius": `${
|
|
916
|
+
top: L.top,
|
|
917
|
+
left: L.left,
|
|
918
|
+
width: L.width,
|
|
919
|
+
"--from-top": `${L.fromTop}px`,
|
|
920
|
+
"--from-left": `${L.fromLeft}px`,
|
|
921
|
+
"--from-bottom": L.up ? "0px" : `calc(100% - ${L.fromRadius * 2}px)`,
|
|
922
|
+
"--from-radius": `${L.fromRadius}px`
|
|
923
923
|
},
|
|
924
924
|
inert: !T,
|
|
925
925
|
children: /* @__PURE__ */ d(
|
|
@@ -932,54 +932,54 @@ function yt({
|
|
|
932
932
|
"aria-label": o,
|
|
933
933
|
"aria-activedescendant": `${w}-${f}`,
|
|
934
934
|
onKeyDown: oe,
|
|
935
|
-
onPointerLeave: () =>
|
|
935
|
+
onPointerLeave: () => F(!1),
|
|
936
936
|
onScroll: K,
|
|
937
|
-
"data-more":
|
|
937
|
+
"data-more": W || void 0,
|
|
938
938
|
children: [
|
|
939
939
|
/* @__PURE__ */ i(
|
|
940
940
|
"span",
|
|
941
941
|
{
|
|
942
942
|
className: "ui-ccc__menu-fill",
|
|
943
943
|
"aria-hidden": "true",
|
|
944
|
-
"data-glide":
|
|
945
|
-
style: { transform: `translateY(${
|
|
944
|
+
"data-glide": H.glide,
|
|
945
|
+
style: { transform: `translateY(${H.y}px)`, height: H.h, opacity: P ? 1 : 0 }
|
|
946
946
|
}
|
|
947
947
|
),
|
|
948
948
|
n && /* @__PURE__ */ i("div", { className: "ui-ccc__menu-head", children: n }),
|
|
949
|
-
a.map((
|
|
950
|
-
|
|
951
|
-
|
|
949
|
+
a.map((Y, E) => /* @__PURE__ */ d("div", { className: "ui-ccc__menu-section", role: "group", "aria-label": Y.title, children: [
|
|
950
|
+
Y.title && /* @__PURE__ */ i("div", { className: "ui-ccc__menu-title", "aria-hidden": "true", children: Y.title }),
|
|
951
|
+
Y.rows.map((V) => {
|
|
952
952
|
const p = ++re;
|
|
953
953
|
return /* @__PURE__ */ d(
|
|
954
954
|
"div",
|
|
955
955
|
{
|
|
956
|
-
ref: (
|
|
957
|
-
k.current[p] =
|
|
956
|
+
ref: (S) => {
|
|
957
|
+
k.current[p] = S;
|
|
958
958
|
},
|
|
959
959
|
id: `${w}-${p}`,
|
|
960
|
-
role: t === "listbox" ? "option" :
|
|
961
|
-
"aria-selected": t === "listbox" ? !!
|
|
962
|
-
"aria-checked": t === "menu" &&
|
|
963
|
-
"data-checked":
|
|
964
|
-
"data-tone":
|
|
960
|
+
role: t === "listbox" ? "option" : V.checked === void 0 ? "menuitem" : "menuitemcheckbox",
|
|
961
|
+
"aria-selected": t === "listbox" ? !!V.checked : void 0,
|
|
962
|
+
"aria-checked": t === "menu" && V.checked !== void 0 ? V.checked : void 0,
|
|
963
|
+
"data-checked": V.checked || void 0,
|
|
964
|
+
"data-tone": V.tone,
|
|
965
965
|
className: "ui-ccc__option",
|
|
966
966
|
onPointerEnter: () => {
|
|
967
|
-
|
|
967
|
+
y(p), F(!0);
|
|
968
968
|
},
|
|
969
|
-
onClick: () => _(
|
|
969
|
+
onClick: () => _(V.id),
|
|
970
970
|
children: [
|
|
971
|
-
/* @__PURE__ */ i("span", { className: "ui-ccc__option-logo", "aria-hidden": "true", children:
|
|
971
|
+
/* @__PURE__ */ i("span", { className: "ui-ccc__option-logo", "aria-hidden": "true", children: V.icon }),
|
|
972
972
|
/* @__PURE__ */ d("span", { className: "ui-ccc__option-text", children: [
|
|
973
|
-
/* @__PURE__ */ i("span", { className: "ui-ccc__option-name", title:
|
|
974
|
-
|
|
973
|
+
/* @__PURE__ */ i("span", { className: "ui-ccc__option-name", title: V.label, dir: "auto", children: V.label }),
|
|
974
|
+
V.description && /* @__PURE__ */ i("span", { className: "ui-ccc__option-desc", dir: "auto", children: V.description })
|
|
975
975
|
] }),
|
|
976
976
|
/* @__PURE__ */ i("span", { className: "ui-ccc__option-check", "aria-hidden": "true", children: /* @__PURE__ */ i(Ma, {}) })
|
|
977
977
|
]
|
|
978
978
|
},
|
|
979
|
-
|
|
979
|
+
V.id
|
|
980
980
|
);
|
|
981
981
|
})
|
|
982
|
-
] },
|
|
982
|
+
] }, E))
|
|
983
983
|
]
|
|
984
984
|
}
|
|
985
985
|
)
|
|
@@ -1752,27 +1752,27 @@ function oo({
|
|
|
1752
1752
|
onApprove: l,
|
|
1753
1753
|
onDeny: x,
|
|
1754
1754
|
onEdit: _,
|
|
1755
|
-
expiresIn:
|
|
1755
|
+
expiresIn: b,
|
|
1756
1756
|
onExpire: w,
|
|
1757
1757
|
allowAlways: m = !0,
|
|
1758
1758
|
alwaysLabel: k = "Always allow this action",
|
|
1759
|
-
approveLabel:
|
|
1759
|
+
approveLabel: v = "Approve",
|
|
1760
1760
|
denyLabel: f = "Deny",
|
|
1761
|
-
editLabel:
|
|
1762
|
-
shortcuts:
|
|
1763
|
-
label:
|
|
1764
|
-
actions:
|
|
1765
|
-
className:
|
|
1761
|
+
editLabel: y = "Edit",
|
|
1762
|
+
shortcuts: L = !0,
|
|
1763
|
+
label: z,
|
|
1764
|
+
actions: H = "card",
|
|
1765
|
+
className: C
|
|
1766
1766
|
}) {
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1769
|
-
const
|
|
1767
|
+
const P = qe(), [F, D] = A(s), T = u ?? F, B = T !== "pending", [ee, M] = A(!1), [W, Z] = A(!1), [K, te] = A("user"), [X, oe] = A(() => B ? Date.now() : null), [re, Y] = A(""), [E, V] = A(!1), [p, S] = A(!1), [N, h] = A("⌘"), [I, Q] = A(T), [g, O] = A(!1), [R, q] = A(!1);
|
|
1768
|
+
I !== T && (Q(T), T === "pending" ? (O(!1), q(!0), M(!1), Z(!1), te("user"), oe(null), Y("")) : (O(I === "pending"), q(!1), oe(Date.now()), Y(`${T === "approved" ? "Approved" : K === "timeout" ? "Expired" : "Denied"}: ${e}`)));
|
|
1769
|
+
const $ = U(null), ae = U(null), fe = U(null), ue = U(!1);
|
|
1770
1770
|
se(() => {
|
|
1771
1771
|
const ie = navigator.userAgentData?.platform ?? navigator.platform ?? "";
|
|
1772
1772
|
/mac|iphone|ipad|ipod/i.test(ie || navigator.userAgent) || h("Ctrl");
|
|
1773
1773
|
}, []);
|
|
1774
1774
|
const ge = async () => {
|
|
1775
|
-
if (B ||
|
|
1775
|
+
if (B || W) return;
|
|
1776
1776
|
const ie = l?.({ always: ee });
|
|
1777
1777
|
if (ie && typeof ie.then == "function") {
|
|
1778
1778
|
Z(!0);
|
|
@@ -1784,24 +1784,24 @@ function oo({
|
|
|
1784
1784
|
}
|
|
1785
1785
|
Z(!1);
|
|
1786
1786
|
}
|
|
1787
|
-
u === void 0 &&
|
|
1787
|
+
u === void 0 && D("approved");
|
|
1788
1788
|
}, _e = (ie = "user") => {
|
|
1789
|
-
B ||
|
|
1789
|
+
B || W && ie === "user" || (te(ie), ie === "timeout" && w?.(), x?.({ reason: ie }), u === void 0 && D("denied"));
|
|
1790
1790
|
}, we = (ie) => {
|
|
1791
|
-
B ||
|
|
1792
|
-
}, he = typeof
|
|
1791
|
+
B || W || ie.defaultPrevented || (ie.key === "Enter" && (ie.metaKey || ie.ctrlKey) ? (ie.preventDefault(), ge()) : ie.key === "Escape" && (ie.preventDefault(), _e("user")));
|
|
1792
|
+
}, he = typeof b == "number" && Number.isFinite(b) && b > 0 ? b * 1e3 : 0, G = U(he), [ce, xe] = A(Math.ceil(he / 1e3)), pe = U(() => {
|
|
1793
1793
|
});
|
|
1794
1794
|
ke(() => {
|
|
1795
1795
|
pe.current = () => _e("timeout");
|
|
1796
1796
|
}), se(() => {
|
|
1797
|
-
T === "pending" && (
|
|
1797
|
+
T === "pending" && (G.current = he, xe(Math.ceil(he / 1e3)));
|
|
1798
1798
|
}, [T, he]);
|
|
1799
|
-
const ve =
|
|
1799
|
+
const ve = E || p || W;
|
|
1800
1800
|
se(() => {
|
|
1801
1801
|
if (!he || B || ve) return;
|
|
1802
1802
|
let ie = performance.now(), Le = 0;
|
|
1803
1803
|
const Xe = (tt) => {
|
|
1804
|
-
if (
|
|
1804
|
+
if (G.current -= tt - ie, ie = tt, xe(Math.max(0, Math.ceil(G.current / 1e3))), G.current <= 0) {
|
|
1805
1805
|
pe.current();
|
|
1806
1806
|
return;
|
|
1807
1807
|
}
|
|
@@ -1809,16 +1809,16 @@ function oo({
|
|
|
1809
1809
|
};
|
|
1810
1810
|
return Le = requestAnimationFrame(Xe), () => cancelAnimationFrame(Le);
|
|
1811
1811
|
}, [he, B, ve]);
|
|
1812
|
-
const Ce =
|
|
1812
|
+
const Ce = U(0), J = U(!1), ze = U(!1);
|
|
1813
1813
|
se(() => {
|
|
1814
|
-
const ie =
|
|
1814
|
+
const ie = $.current;
|
|
1815
1815
|
if (!ie || typeof ResizeObserver > "u") return;
|
|
1816
1816
|
const Le = new ResizeObserver(() => {
|
|
1817
1817
|
J.current || (Ce.current = ie.offsetHeight);
|
|
1818
1818
|
});
|
|
1819
1819
|
return Le.observe(ie), () => Le.disconnect();
|
|
1820
1820
|
}, []), ke(() => {
|
|
1821
|
-
const ie =
|
|
1821
|
+
const ie = $.current;
|
|
1822
1822
|
if (!ie) return;
|
|
1823
1823
|
if (!ze.current) {
|
|
1824
1824
|
ze.current = !0, Ce.current = ie.offsetHeight;
|
|
@@ -1838,20 +1838,20 @@ function oo({
|
|
|
1838
1838
|
window.clearTimeout(nt), ie.style.height = "", J.current = !1;
|
|
1839
1839
|
};
|
|
1840
1840
|
}, [B]);
|
|
1841
|
-
const [, Yt] =
|
|
1841
|
+
const [, Yt] = A(0);
|
|
1842
1842
|
se(() => {
|
|
1843
1843
|
if (!B) return;
|
|
1844
1844
|
const ie = window.setInterval(() => Yt((Le) => Le + 1), 3e4);
|
|
1845
1845
|
return () => window.clearInterval(ie);
|
|
1846
1846
|
}, [B]);
|
|
1847
|
-
const It = `${
|
|
1847
|
+
const It = `${P}-title`, Lt = `${P}-row`, Tt = `${P}-desc`, At = `${P}-timer`, ft = r ?? c, Vt = T === "approved" ? "Approved" : K === "timeout" ? "Expired" : "Denied", gt = [t ? Tt : null, he && !B ? At : null].filter(Boolean).join(" "), He = m && /* @__PURE__ */ d("label", { className: "ui-apc__always", children: [
|
|
1848
1848
|
/* @__PURE__ */ d("span", { className: "ui-apc__box", children: [
|
|
1849
|
-
/* @__PURE__ */ i("input", { type: "checkbox", checked: ee, disabled:
|
|
1849
|
+
/* @__PURE__ */ i("input", { type: "checkbox", checked: ee, disabled: W, onChange: (ie) => M(ie.target.checked) }),
|
|
1850
1850
|
/* @__PURE__ */ i("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ i("path", { d: "M4 8.3 6.8 11 12 5.2" }) })
|
|
1851
1851
|
] }),
|
|
1852
1852
|
/* @__PURE__ */ i("span", { className: "ui-apc__always-label", children: k })
|
|
1853
1853
|
] }), xt = /* @__PURE__ */ d("div", { className: "ui-apc__foot", children: [
|
|
1854
|
-
|
|
1854
|
+
H === "card" && He,
|
|
1855
1855
|
he > 0 && /* @__PURE__ */ d("span", { className: "ui-apc__expires", "data-paused": ve || void 0, "data-low": ce <= 10 || void 0, "aria-hidden": "true", children: [
|
|
1856
1856
|
/* @__PURE__ */ d("svg", { viewBox: "0 0 16 16", children: [
|
|
1857
1857
|
/* @__PURE__ */ i("circle", { cx: "8", cy: "8", r: "6" }),
|
|
@@ -1866,9 +1866,9 @@ function oo({
|
|
|
1866
1866
|
{
|
|
1867
1867
|
type: "button",
|
|
1868
1868
|
className: "ui-apc__btn ui-apc__btn--ghost",
|
|
1869
|
-
"aria-disabled":
|
|
1870
|
-
onClick: () => !
|
|
1871
|
-
children:
|
|
1869
|
+
"aria-disabled": W || void 0,
|
|
1870
|
+
onClick: () => !W && _(),
|
|
1871
|
+
children: y
|
|
1872
1872
|
}
|
|
1873
1873
|
),
|
|
1874
1874
|
/* @__PURE__ */ d(
|
|
@@ -1877,11 +1877,11 @@ function oo({
|
|
|
1877
1877
|
type: "button",
|
|
1878
1878
|
className: "ui-apc__btn ui-apc__btn--quiet ui-apc__deny",
|
|
1879
1879
|
"aria-keyshortcuts": "Escape",
|
|
1880
|
-
"aria-disabled":
|
|
1880
|
+
"aria-disabled": W || void 0,
|
|
1881
1881
|
onClick: () => _e("user"),
|
|
1882
1882
|
children: [
|
|
1883
1883
|
f,
|
|
1884
|
-
|
|
1884
|
+
L && /* @__PURE__ */ i("kbd", { className: "ui-apc__kbd", "aria-hidden": "true", children: "Esc" })
|
|
1885
1885
|
]
|
|
1886
1886
|
}
|
|
1887
1887
|
),
|
|
@@ -1892,13 +1892,13 @@ function oo({
|
|
|
1892
1892
|
type: "button",
|
|
1893
1893
|
className: "ui-apc__btn ui-apc__btn--primary ui-apc__approve",
|
|
1894
1894
|
"aria-keyshortcuts": "Meta+Enter Control+Enter",
|
|
1895
|
-
"aria-disabled":
|
|
1895
|
+
"aria-disabled": W || void 0,
|
|
1896
1896
|
onClick: () => {
|
|
1897
1897
|
ge();
|
|
1898
1898
|
},
|
|
1899
1899
|
children: [
|
|
1900
|
-
|
|
1901
|
-
|
|
1900
|
+
v,
|
|
1901
|
+
W ? /* @__PURE__ */ i("svg", { className: "ui-apc__spinner", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ i("circle", { cx: "8", cy: "8", r: "6" }) }) : L && /* @__PURE__ */ i("kbd", { className: "ui-apc__kbd", "aria-hidden": "true", children: N === "⌘" ? "⌘↵" : "Ctrl ↵" })
|
|
1902
1902
|
]
|
|
1903
1903
|
}
|
|
1904
1904
|
)
|
|
@@ -1907,26 +1907,26 @@ function oo({
|
|
|
1907
1907
|
return /* @__PURE__ */ d(
|
|
1908
1908
|
"div",
|
|
1909
1909
|
{
|
|
1910
|
-
ref:
|
|
1911
|
-
className: ["ui-apc",
|
|
1910
|
+
ref: $,
|
|
1911
|
+
className: ["ui-apc", C].filter(Boolean).join(" "),
|
|
1912
1912
|
role: "group",
|
|
1913
1913
|
"aria-labelledby": B ? Lt : It,
|
|
1914
1914
|
"aria-describedby": gt || void 0,
|
|
1915
|
-
"aria-busy":
|
|
1915
|
+
"aria-busy": W || void 0,
|
|
1916
1916
|
"data-status": T,
|
|
1917
|
-
"data-busy":
|
|
1918
|
-
"data-label":
|
|
1919
|
-
"data-actions":
|
|
1917
|
+
"data-busy": W || void 0,
|
|
1918
|
+
"data-label": z ? "" : void 0,
|
|
1919
|
+
"data-actions": H,
|
|
1920
1920
|
onKeyDown: we,
|
|
1921
|
-
onPointerEnter: () =>
|
|
1922
|
-
onPointerLeave: () =>
|
|
1923
|
-
onFocus: () =>
|
|
1921
|
+
onPointerEnter: () => V(!0),
|
|
1922
|
+
onPointerLeave: () => V(!1),
|
|
1923
|
+
onFocus: () => S(!0),
|
|
1924
1924
|
onBlur: (ie) => {
|
|
1925
|
-
ie.currentTarget.contains(ie.relatedTarget) ||
|
|
1925
|
+
ie.currentTarget.contains(ie.relatedTarget) || S(!1);
|
|
1926
1926
|
},
|
|
1927
1927
|
children: [
|
|
1928
1928
|
/* @__PURE__ */ i("style", { href: "ui-approval-card-clean", precedence: "default", children: lo }),
|
|
1929
|
-
|
|
1929
|
+
z && /* @__PURE__ */ i("div", { className: "ui-apc__label", title: typeof z == "string" ? z : void 0, children: z }),
|
|
1930
1930
|
(!B || g) && /* @__PURE__ */ d(
|
|
1931
1931
|
"div",
|
|
1932
1932
|
{
|
|
@@ -1936,7 +1936,7 @@ function oo({
|
|
|
1936
1936
|
inert: g,
|
|
1937
1937
|
"aria-hidden": g || void 0,
|
|
1938
1938
|
onAnimationEnd: (ie) => {
|
|
1939
|
-
ie.target === ie.currentTarget && (g &&
|
|
1939
|
+
ie.target === ie.currentTarget && (g && O(!1), R && q(!1));
|
|
1940
1940
|
},
|
|
1941
1941
|
children: [
|
|
1942
1942
|
/* @__PURE__ */ d("div", { className: "ui-apc__card", children: [
|
|
@@ -1962,10 +1962,10 @@ function oo({
|
|
|
1962
1962
|
/* @__PURE__ */ i("dd", { dir: "auto", children: ie.value })
|
|
1963
1963
|
] }, ie.label + Le)) }) : null
|
|
1964
1964
|
] }),
|
|
1965
|
-
|
|
1966
|
-
|
|
1965
|
+
H === "tray" && He,
|
|
1966
|
+
H === "card" && xt
|
|
1967
1967
|
] }),
|
|
1968
|
-
|
|
1968
|
+
H === "tray" && xt,
|
|
1969
1969
|
he > 0 && /* @__PURE__ */ i("span", { className: "ui-apc__sr", id: g ? void 0 : At, children: `Expires in ${so(ce)} unless approved. The timer pauses while the card is hovered or focused.` })
|
|
1970
1970
|
]
|
|
1971
1971
|
}
|
|
@@ -2650,35 +2650,35 @@ function uo({
|
|
|
2650
2650
|
defaultOpen: l = !1,
|
|
2651
2651
|
open: x,
|
|
2652
2652
|
onOpenChange: _,
|
|
2653
|
-
openOnError:
|
|
2653
|
+
openOnError: b = !0,
|
|
2654
2654
|
onRetry: w,
|
|
2655
2655
|
maxCodeHeight: m = 220,
|
|
2656
2656
|
className: k,
|
|
2657
|
-
labels:
|
|
2657
|
+
labels: v
|
|
2658
2658
|
}) {
|
|
2659
|
-
const f = { ...Ca, ...
|
|
2660
|
-
x === void 0 &&
|
|
2661
|
-
}, [
|
|
2662
|
-
n !==
|
|
2663
|
-
const B = go(n === "running", u, !1), ee = n === "running" ? B ?? 0 : s ?? B,
|
|
2659
|
+
const f = { ...Ca, ...v }, y = qe(), [L, z] = A(l), H = x ?? L, C = (W) => {
|
|
2660
|
+
x === void 0 && z(W), _?.(W);
|
|
2661
|
+
}, [P, F] = A(n), [D, T] = A(!1);
|
|
2662
|
+
n !== P && (F(n), x === void 0 && b && (n === "error" && !L ? (z(!0), T(!0)) : P === "error" && D && (z(!1), T(!1))));
|
|
2663
|
+
const B = go(n === "running", u, !1), ee = n === "running" ? B ?? 0 : s ?? B, M = n === "running" ? f.running(e) : n === "success" ? f.finished(e) : f.failedAnnouncement(e, c);
|
|
2664
2664
|
return /* @__PURE__ */ d(
|
|
2665
2665
|
"div",
|
|
2666
2666
|
{
|
|
2667
2667
|
className: ["ui-tclc", k].filter(Boolean).join(" "),
|
|
2668
2668
|
"data-status": n,
|
|
2669
|
-
"data-open":
|
|
2669
|
+
"data-open": H || void 0,
|
|
2670
2670
|
children: [
|
|
2671
2671
|
/* @__PURE__ */ i("style", { href: "ui-tool-call-clean", precedence: "default", children: yo }),
|
|
2672
|
-
/* @__PURE__ */ i("span", { className: "ui-tclc-sr", role: "status", "aria-live": "polite", children:
|
|
2672
|
+
/* @__PURE__ */ i("span", { className: "ui-tclc-sr", role: "status", "aria-live": "polite", children: M }),
|
|
2673
2673
|
/* @__PURE__ */ d(
|
|
2674
2674
|
"button",
|
|
2675
2675
|
{
|
|
2676
2676
|
type: "button",
|
|
2677
2677
|
className: "ui-tclc__head",
|
|
2678
|
-
"aria-expanded":
|
|
2679
|
-
"aria-controls": `${
|
|
2678
|
+
"aria-expanded": H,
|
|
2679
|
+
"aria-controls": `${y}-body`,
|
|
2680
2680
|
onClick: () => {
|
|
2681
|
-
T(!1),
|
|
2681
|
+
T(!1), C(!H);
|
|
2682
2682
|
},
|
|
2683
2683
|
children: [
|
|
2684
2684
|
/* @__PURE__ */ i("span", { className: "ui-tclc__icon", "aria-hidden": "true", children: o ?? /* @__PURE__ */ i(fo, {}) }),
|
|
@@ -2699,7 +2699,7 @@ function uo({
|
|
|
2699
2699
|
]
|
|
2700
2700
|
}
|
|
2701
2701
|
),
|
|
2702
|
-
/* @__PURE__ */ i("div", { className: "ui-tclc__body", id: `${
|
|
2702
|
+
/* @__PURE__ */ i("div", { className: "ui-tclc__body", id: `${y}-body`, inert: !H, children: /* @__PURE__ */ i("div", { className: "ui-tclc__clip", children: /* @__PURE__ */ d("div", { className: "ui-tclc__sections", children: [
|
|
2703
2703
|
n === "error" && /* @__PURE__ */ d("div", { className: "ui-tclc__error", children: [
|
|
2704
2704
|
/* @__PURE__ */ i(Di, {}),
|
|
2705
2705
|
/* @__PURE__ */ i("p", { className: "ui-tclc__error-text", dir: "auto", children: c ?? f.error }),
|
|
@@ -2724,16 +2724,16 @@ function uo({
|
|
|
2724
2724
|
}
|
|
2725
2725
|
const Ai = 640;
|
|
2726
2726
|
function Si({ label: e, copyLabel: t, labels: o, value: n, cap: a }) {
|
|
2727
|
-
const { text: r, json: c } = wo(n), u =
|
|
2727
|
+
const { text: r, json: c } = wo(n), u = U(null), [s, l] = A(!1), [x, _] = A(0);
|
|
2728
2728
|
ke(() => {
|
|
2729
2729
|
const w = u.current, m = w?.firstElementChild;
|
|
2730
2730
|
if (!w || !m) return;
|
|
2731
2731
|
const k = () => _(w.scrollHeight);
|
|
2732
2732
|
k();
|
|
2733
|
-
const
|
|
2734
|
-
return
|
|
2733
|
+
const v = new ResizeObserver(k);
|
|
2734
|
+
return v.observe(m), () => v.disconnect();
|
|
2735
2735
|
}, [r]);
|
|
2736
|
-
const
|
|
2736
|
+
const b = x > a + 24;
|
|
2737
2737
|
return /* @__PURE__ */ d("div", { className: "ui-tclc__section", children: [
|
|
2738
2738
|
/* @__PURE__ */ d("div", { className: "ui-tclc__section-head", children: [
|
|
2739
2739
|
/* @__PURE__ */ i("span", { className: "ui-tclc__label", children: e }),
|
|
@@ -2744,17 +2744,17 @@ function Si({ label: e, copyLabel: t, labels: o, value: n, cap: a }) {
|
|
|
2744
2744
|
{
|
|
2745
2745
|
ref: u,
|
|
2746
2746
|
className: "ui-tclc__code",
|
|
2747
|
-
"data-capped":
|
|
2748
|
-
"data-scroll":
|
|
2749
|
-
style:
|
|
2747
|
+
"data-capped": b && !s || void 0,
|
|
2748
|
+
"data-scroll": b && s && x > Ai || void 0,
|
|
2749
|
+
style: b ? { maxHeight: s ? Math.min(x, Ai) : a } : void 0,
|
|
2750
2750
|
children: /* @__PURE__ */ i("code", { children: c ? bo(r) : r })
|
|
2751
2751
|
}
|
|
2752
2752
|
),
|
|
2753
|
-
|
|
2753
|
+
b && /* @__PURE__ */ i("button", { type: "button", className: "ui-tclc__more", "aria-expanded": s, onClick: () => l(!s), children: s ? o.showLess : o.showAll })
|
|
2754
2754
|
] });
|
|
2755
2755
|
}
|
|
2756
2756
|
function po({ text: e, label: t, labels: o }) {
|
|
2757
|
-
const [n, a] =
|
|
2757
|
+
const [n, a] = A(!1);
|
|
2758
2758
|
return se(() => {
|
|
2759
2759
|
if (!n) return;
|
|
2760
2760
|
const r = window.setTimeout(() => a(!1), 1400);
|
|
@@ -2797,7 +2797,7 @@ function fo() {
|
|
|
2797
2797
|
return /* @__PURE__ */ i("svg", { viewBox: "0 0 16 16", children: /* @__PURE__ */ i("path", { d: "M10.2 2.4a3.5 3.5 0 0 0-4.3 4.6L2.6 10.3a1.4 1.4 0 0 0 2 2L7.9 9a3.5 3.5 0 0 0 4.6-4.3l-2 2-1.6-.4-.4-1.6 1.7-2.3Z" }) });
|
|
2798
2798
|
}
|
|
2799
2799
|
function go(e, t, o) {
|
|
2800
|
-
const n =
|
|
2800
|
+
const n = U(null), a = U(0), [r, c] = A(null);
|
|
2801
2801
|
return se(() => {
|
|
2802
2802
|
if (!e) {
|
|
2803
2803
|
n.current !== null && (a.current += Date.now() - n.current, n.current = null, c(a.current));
|
|
@@ -3353,16 +3353,16 @@ function Ae({
|
|
|
3353
3353
|
onPointerEnter: l,
|
|
3354
3354
|
type: x = "button",
|
|
3355
3355
|
ref: _,
|
|
3356
|
-
...
|
|
3356
|
+
...b
|
|
3357
3357
|
}) {
|
|
3358
|
-
const w = typeof r == "string" ? r : void 0, m = r != null && r !== !1 && r !== "", k = !m && !!(n || a),
|
|
3359
|
-
se(() =>
|
|
3360
|
-
const
|
|
3358
|
+
const w = typeof r == "string" ? r : void 0, m = r != null && r !== !1 && r !== "", k = !m && !!(n || a), v = ko.includes(e) ? e : "primary", f = zo.includes(t) ? t : "md", y = U(null), L = U(0), [z, H] = A(!1);
|
|
3359
|
+
se(() => H(!0), []);
|
|
3360
|
+
const C = w ?? "label", P = o && n ? "spinner" : Oi(n), F = Oi(a), D = `${C}|${P}|${F}`, T = U(D);
|
|
3361
3361
|
return ke(() => {
|
|
3362
|
-
const B =
|
|
3362
|
+
const B = y.current;
|
|
3363
3363
|
if (!B) return;
|
|
3364
|
-
const ee = B.getBoundingClientRect().width,
|
|
3365
|
-
|
|
3364
|
+
const ee = B.getBoundingClientRect().width, M = L.current, W = T.current !== D;
|
|
3365
|
+
L.current = ee, T.current = D, !(!W || !M || Math.abs(M - ee) < 0.5) && (window.matchMedia("(prefers-reduced-motion: reduce)").matches || B.animate([{ width: `${M}px` }, { width: `${ee}px` }], {
|
|
3366
3366
|
duration: 480,
|
|
3367
3367
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)"
|
|
3368
3368
|
}));
|
|
@@ -3373,15 +3373,15 @@ function Ae({
|
|
|
3373
3373
|
{
|
|
3374
3374
|
type: x,
|
|
3375
3375
|
className: ["ui-buttonc", c].filter(Boolean).join(" "),
|
|
3376
|
-
"data-variant":
|
|
3376
|
+
"data-variant": v,
|
|
3377
3377
|
"data-size": f,
|
|
3378
3378
|
"data-loading": o || void 0,
|
|
3379
3379
|
"data-icon-only": k || void 0,
|
|
3380
3380
|
"data-icon-left": !k && !!n || void 0,
|
|
3381
3381
|
"data-icon-right": !k && !!a || void 0,
|
|
3382
|
-
"data-ready":
|
|
3382
|
+
"data-ready": z || void 0,
|
|
3383
3383
|
ref: (B) => {
|
|
3384
|
-
|
|
3384
|
+
y.current = B, typeof _ == "function" ? _(B) : _ && (_.current = B);
|
|
3385
3385
|
},
|
|
3386
3386
|
disabled: u,
|
|
3387
3387
|
"aria-busy": o || void 0,
|
|
@@ -3395,13 +3395,13 @@ function Ae({
|
|
|
3395
3395
|
},
|
|
3396
3396
|
onPointerEnter: (B) => {
|
|
3397
3397
|
const ee = B.currentTarget.querySelector(".ui-buttonc__label");
|
|
3398
|
-
ee && w && !
|
|
3398
|
+
ee && w && !b.title && (ee.title = ee.scrollWidth > ee.clientWidth + 1 ? w : ""), l?.(B);
|
|
3399
3399
|
},
|
|
3400
|
-
...
|
|
3400
|
+
...b,
|
|
3401
3401
|
children: [
|
|
3402
|
-
n && /* @__PURE__ */ i("span", { className: "ui-buttonc__icon", "aria-hidden": "true", onErrorCapture: $i, children: o ? /* @__PURE__ */ i(Mo, {}) : n }, `icon-${
|
|
3403
|
-
m && /* @__PURE__ */ i("span", { className: "ui-buttonc__label", "data-text": w, dir: "auto", children: r }, `label-${
|
|
3404
|
-
a && /* @__PURE__ */ i("span", { className: "ui-buttonc__icon", "aria-hidden": "true", onErrorCapture: $i, children: a }, `icon-right-${
|
|
3402
|
+
n && /* @__PURE__ */ i("span", { className: "ui-buttonc__icon", "aria-hidden": "true", onErrorCapture: $i, children: o ? /* @__PURE__ */ i(Mo, {}) : n }, `icon-${P}`),
|
|
3403
|
+
m && /* @__PURE__ */ i("span", { className: "ui-buttonc__label", "data-text": w, dir: "auto", children: r }, `label-${C}`),
|
|
3404
|
+
a && /* @__PURE__ */ i("span", { className: "ui-buttonc__icon", "aria-hidden": "true", onErrorCapture: $i, children: a }, `icon-right-${F}`)
|
|
3405
3405
|
]
|
|
3406
3406
|
}
|
|
3407
3407
|
)
|
|
@@ -3766,7 +3766,7 @@ const No = (
|
|
|
3766
3766
|
other: "Other"
|
|
3767
3767
|
}, Io = () => typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
3768
3768
|
function $t({ id: e, children: t, className: o }) {
|
|
3769
|
-
const n =
|
|
3769
|
+
const n = U({ id: e, node: t }), [a, r] = A(e), [c, u] = A(null);
|
|
3770
3770
|
return a !== e && (r(e), u(n.current)), n.current = { id: e, node: t }, se(() => {
|
|
3771
3771
|
if (!c) return;
|
|
3772
3772
|
const s = window.setTimeout(() => u(null), 300);
|
|
@@ -3801,67 +3801,67 @@ function Ao({
|
|
|
3801
3801
|
onFeedback: l,
|
|
3802
3802
|
reasons: x,
|
|
3803
3803
|
onSpeak: _,
|
|
3804
|
-
speaking:
|
|
3804
|
+
speaking: b,
|
|
3805
3805
|
speakDuration: w,
|
|
3806
3806
|
quiet: m = !0,
|
|
3807
3807
|
label: k,
|
|
3808
|
-
labels:
|
|
3808
|
+
labels: v,
|
|
3809
3809
|
className: f
|
|
3810
3810
|
}) {
|
|
3811
|
-
const
|
|
3812
|
-
T !==
|
|
3813
|
-
const
|
|
3814
|
-
const ze = Math.min(
|
|
3815
|
-
ze !==
|
|
3816
|
-
}, [p,
|
|
3811
|
+
const y = { ...ri, ...v }, L = x ?? [y.notAccurate, y.tooLong, y.didNotFollow, y.other], z = (J) => J === y.other || J === ri.other, H = qe(), C = To(t), P = Math.max(1, Kt(typeof o == "number" ? o : Array.isArray(o) ? o.length : 1, 1)), [F, D] = A(() => Math.min(P - 1, Math.max(0, Kt(a, P - 1)))), [T, B] = A(P), [ee, M] = A(null), [W, Z] = A(!1), [K, te] = A(null), [X, oe] = A(""), [re, Y] = A(!1);
|
|
3812
|
+
T !== P && (P > T && (D(P - 1), M(null), Z(!1)), B(P));
|
|
3813
|
+
const E = Math.min(P - 1, Math.max(0, Kt(n, F))), V = (J) => {
|
|
3814
|
+
const ze = Math.min(P - 1, Math.max(0, J));
|
|
3815
|
+
ze !== E && (n === void 0 && D(ze), r?.(ze), N(y.version(ze + 1, P)));
|
|
3816
|
+
}, [p, S] = A(""), N = (J) => S((ze) => ze === J ? `${J} ` : J), [h, I] = A(0);
|
|
3817
3817
|
se(() => {
|
|
3818
3818
|
if (!h) return;
|
|
3819
|
-
const J = window.setTimeout(() =>
|
|
3819
|
+
const J = window.setTimeout(() => I(0), 1600);
|
|
3820
3820
|
return () => window.clearTimeout(J);
|
|
3821
3821
|
}, [h]);
|
|
3822
|
-
const
|
|
3822
|
+
const Q = () => {
|
|
3823
3823
|
try {
|
|
3824
3824
|
e !== void 0 && navigator.clipboard?.writeText(e).catch(() => {
|
|
3825
3825
|
});
|
|
3826
3826
|
} catch {
|
|
3827
3827
|
}
|
|
3828
|
-
c?.(e),
|
|
3829
|
-
}, [g,
|
|
3830
|
-
|
|
3831
|
-
},
|
|
3828
|
+
c?.(e), I(Date.now()), N(y.copied);
|
|
3829
|
+
}, [g, O] = A(0), R = () => {
|
|
3830
|
+
O((J) => J + 1), u?.(), N(y.regenerating);
|
|
3831
|
+
}, q = () => {
|
|
3832
3832
|
if (ee === "up") {
|
|
3833
|
-
|
|
3833
|
+
M(null), l?.(null);
|
|
3834
3834
|
return;
|
|
3835
3835
|
}
|
|
3836
|
-
|
|
3837
|
-
},
|
|
3836
|
+
M("up"), Z(!1), l?.("up"), N(y.markedGood);
|
|
3837
|
+
}, $ = () => {
|
|
3838
3838
|
if (ee === "down") {
|
|
3839
|
-
|
|
3839
|
+
M(null), Z(!1), l?.(null);
|
|
3840
3840
|
return;
|
|
3841
3841
|
}
|
|
3842
|
-
|
|
3842
|
+
M("down"), Z(!0), Y(!1), te(null), oe(""), l?.("down"), N(y.markedBad);
|
|
3843
3843
|
}, ae = () => {
|
|
3844
|
-
!K || re || (l?.("down",
|
|
3844
|
+
!K || re || (l?.("down", z(K) && X.trim() || K), Y(!0), N(y.thanksFeedback));
|
|
3845
3845
|
};
|
|
3846
3846
|
se(() => {
|
|
3847
3847
|
if (!re) return;
|
|
3848
3848
|
const J = window.setTimeout(() => Z(!1), Io() ? 1200 : 1500);
|
|
3849
3849
|
return () => window.clearTimeout(J);
|
|
3850
3850
|
}, [re]);
|
|
3851
|
-
const fe =
|
|
3851
|
+
const fe = U(null), ue = () => {
|
|
3852
3852
|
Z(!1), fe.current?.focus();
|
|
3853
|
-
}, [ge, _e] =
|
|
3853
|
+
}, [ge, _e] = A(!1), we = b ?? ge, he = e ? e.trim().split(/\s+/).length : 0, G = typeof w == "number" && w > 0 ? w : Math.max(2600, he * 380);
|
|
3854
3854
|
se(() => {
|
|
3855
|
-
if (
|
|
3855
|
+
if (b !== void 0 || !ge) return;
|
|
3856
3856
|
const J = window.setTimeout(() => {
|
|
3857
|
-
_e(!1), _?.(!1),
|
|
3858
|
-
},
|
|
3857
|
+
_e(!1), _?.(!1), N(y.finishedReading);
|
|
3858
|
+
}, G);
|
|
3859
3859
|
return () => window.clearTimeout(J);
|
|
3860
|
-
}, [ge,
|
|
3860
|
+
}, [ge, b, G]);
|
|
3861
3861
|
const ce = () => {
|
|
3862
3862
|
const J = !we;
|
|
3863
|
-
|
|
3864
|
-
}, xe = !!h ||
|
|
3863
|
+
b === void 0 && _e(J), _?.(J), N(J ? y.readingAloud : y.stoppedReading);
|
|
3864
|
+
}, xe = !!h || W || we || s, pe = (J) => /* @__PURE__ */ d("span", { className: "ui-mac__item", "data-flash": J.flash ? "" : void 0, children: [
|
|
3865
3865
|
/* @__PURE__ */ i(
|
|
3866
3866
|
"button",
|
|
3867
3867
|
{
|
|
@@ -3878,11 +3878,11 @@ function Ao({
|
|
|
3878
3878
|
}
|
|
3879
3879
|
),
|
|
3880
3880
|
/* @__PURE__ */ i("span", { className: "ui-mac__tip", "aria-hidden": "true", children: /* @__PURE__ */ i($t, { id: J.tip, children: J.tip }) })
|
|
3881
|
-
] }, J.key), ve =
|
|
3881
|
+
] }, J.key), ve = C.map((J) => J === "copy" ? pe({
|
|
3882
3882
|
key: "copy",
|
|
3883
|
-
tip: h ?
|
|
3884
|
-
labelText: h ?
|
|
3885
|
-
onClick:
|
|
3883
|
+
tip: h ? y.copied : y.copy,
|
|
3884
|
+
labelText: h ? y.copied : y.copyMessage,
|
|
3885
|
+
onClick: Q,
|
|
3886
3886
|
flash: !!h,
|
|
3887
3887
|
extra: { "data-done": h ? "" : void 0 },
|
|
3888
3888
|
children: /* @__PURE__ */ d("span", { className: "ui-mac__icon ui-mac__morph", children: [
|
|
@@ -3892,29 +3892,29 @@ function Ao({
|
|
|
3892
3892
|
}) : J === "regenerate" ? /* @__PURE__ */ d("span", { className: "ui-mac__regen", children: [
|
|
3893
3893
|
pe({
|
|
3894
3894
|
key: "regenerate",
|
|
3895
|
-
tip: s ?
|
|
3896
|
-
labelText:
|
|
3895
|
+
tip: s ? y.writing : y.regenerate,
|
|
3896
|
+
labelText: y.regenerateResponse,
|
|
3897
3897
|
onClick: R,
|
|
3898
3898
|
extra: { "data-busy": s ? "" : void 0 },
|
|
3899
3899
|
children: /* @__PURE__ */ i("span", { className: "ui-mac__icon", children: /* @__PURE__ */ i("span", { className: "ui-mac__spin", "data-spin": g ? "" : void 0, children: /* @__PURE__ */ i(Ye, { d: Ve.redo }) }, g) })
|
|
3900
3900
|
}),
|
|
3901
|
-
/* @__PURE__ */ i("span", { className: "ui-mac__versions", "data-open":
|
|
3901
|
+
/* @__PURE__ */ i("span", { className: "ui-mac__versions", "data-open": P > 1 ? "" : void 0, inert: P < 2, children: /* @__PURE__ */ d("span", { className: "ui-mac__versions-clip", role: "group", "aria-label": y.versions, children: [
|
|
3902
3902
|
/* @__PURE__ */ i(
|
|
3903
3903
|
"button",
|
|
3904
3904
|
{
|
|
3905
3905
|
type: "button",
|
|
3906
3906
|
className: "ui-mac__step",
|
|
3907
3907
|
"data-dir": "prev",
|
|
3908
|
-
"aria-label":
|
|
3909
|
-
disabled:
|
|
3910
|
-
onClick: () =>
|
|
3908
|
+
"aria-label": y.previousVersion,
|
|
3909
|
+
disabled: E === 0,
|
|
3910
|
+
onClick: () => V(E - 1),
|
|
3911
3911
|
children: /* @__PURE__ */ i(Ye, { d: Ve.next, solid: !0 })
|
|
3912
3912
|
}
|
|
3913
3913
|
),
|
|
3914
|
-
/* @__PURE__ */ d("span", { className: "ui-mac__count", "aria-label":
|
|
3915
|
-
/* @__PURE__ */ i($t, { id: String(
|
|
3914
|
+
/* @__PURE__ */ d("span", { className: "ui-mac__count", "aria-label": y.version(E + 1, P), children: [
|
|
3915
|
+
/* @__PURE__ */ i($t, { id: String(E), className: "ui-mac__count-now", children: Ft(E + 1) }),
|
|
3916
3916
|
/* @__PURE__ */ i("span", { "aria-hidden": "true", children: "/" }),
|
|
3917
|
-
/* @__PURE__ */ i($t, { id: String(
|
|
3917
|
+
/* @__PURE__ */ i($t, { id: String(P), children: Ft(P) })
|
|
3918
3918
|
] }),
|
|
3919
3919
|
/* @__PURE__ */ i(
|
|
3920
3920
|
"button",
|
|
@@ -3922,9 +3922,9 @@ function Ao({
|
|
|
3922
3922
|
type: "button",
|
|
3923
3923
|
className: "ui-mac__step",
|
|
3924
3924
|
"data-dir": "next",
|
|
3925
|
-
"aria-label":
|
|
3926
|
-
disabled:
|
|
3927
|
-
onClick: () =>
|
|
3925
|
+
"aria-label": y.nextVersion,
|
|
3926
|
+
disabled: E >= P - 1,
|
|
3927
|
+
onClick: () => V(E + 1),
|
|
3928
3928
|
children: /* @__PURE__ */ i(Ye, { d: Ve.next, solid: !0 })
|
|
3929
3929
|
}
|
|
3930
3930
|
)
|
|
@@ -3932,27 +3932,27 @@ function Ao({
|
|
|
3932
3932
|
] }, "regenerate") : J === "feedback" ? /* @__PURE__ */ d(Ga, { children: [
|
|
3933
3933
|
pe({
|
|
3934
3934
|
key: "up",
|
|
3935
|
-
tip: ee === "up" ?
|
|
3936
|
-
labelText:
|
|
3935
|
+
tip: ee === "up" ? y.thanks : y.goodResponse,
|
|
3936
|
+
labelText: y.goodResponse,
|
|
3937
3937
|
pressed: ee === "up",
|
|
3938
|
-
onClick:
|
|
3938
|
+
onClick: q,
|
|
3939
3939
|
children: /* @__PURE__ */ i("span", { className: "ui-mac__icon ui-mac__thumb", children: /* @__PURE__ */ i(Ye, { d: Ve.thumb, solid: !0 }) })
|
|
3940
3940
|
}),
|
|
3941
3941
|
pe({
|
|
3942
3942
|
key: "down",
|
|
3943
|
-
tip:
|
|
3944
|
-
labelText:
|
|
3943
|
+
tip: y.badResponse,
|
|
3944
|
+
labelText: y.badResponse,
|
|
3945
3945
|
pressed: ee === "down",
|
|
3946
|
-
expanded:
|
|
3947
|
-
controls: `${
|
|
3948
|
-
onClick:
|
|
3946
|
+
expanded: W,
|
|
3947
|
+
controls: `${H}-feedback`,
|
|
3948
|
+
onClick: $,
|
|
3949
3949
|
refEl: fe,
|
|
3950
3950
|
children: /* @__PURE__ */ i("span", { className: "ui-mac__icon ui-mac__thumb", children: /* @__PURE__ */ i(Ye, { d: Ve.thumb, solid: !0 }) })
|
|
3951
3951
|
})
|
|
3952
3952
|
] }, "feedback") : pe({
|
|
3953
3953
|
key: "speak",
|
|
3954
|
-
tip: we ?
|
|
3955
|
-
labelText: we ?
|
|
3954
|
+
tip: we ? y.stop : y.readAloud,
|
|
3955
|
+
labelText: we ? y.stopReading : y.readAloud,
|
|
3956
3956
|
pressed: we,
|
|
3957
3957
|
onClick: ce,
|
|
3958
3958
|
children: /* @__PURE__ */ d("span", { className: "ui-mac__icon ui-mac__morph", children: [
|
|
@@ -3975,14 +3975,14 @@ function Ao({
|
|
|
3975
3975
|
"data-active": xe ? "" : void 0,
|
|
3976
3976
|
children: [
|
|
3977
3977
|
/* @__PURE__ */ i("style", { href: "ui-message-actions-clean", precedence: "default", children: So }),
|
|
3978
|
-
/* @__PURE__ */ i("div", { className: "ui-mac__bar", role: "group", "aria-label": k ??
|
|
3979
|
-
|
|
3978
|
+
/* @__PURE__ */ i("div", { className: "ui-mac__bar", role: "group", "aria-label": k ?? y.label, children: ve }),
|
|
3979
|
+
C.includes("feedback") && /* @__PURE__ */ i("div", { id: `${H}-feedback`, className: "ui-mac__fold", "data-open": W ? "" : void 0, inert: !W, children: /* @__PURE__ */ i("div", { className: "ui-mac__clip", children: /* @__PURE__ */ d("div", { className: "ui-mac__panel", role: "group", "aria-labelledby": `${H}-ask`, onKeyDown: Ce, children: [
|
|
3980
3980
|
/* @__PURE__ */ d("div", { className: "ui-mac__panel-head", children: [
|
|
3981
|
-
/* @__PURE__ */ i("span", { id: `${
|
|
3982
|
-
/* @__PURE__ */ i("button", { type: "button", className: "ui-mac__close", "aria-label":
|
|
3981
|
+
/* @__PURE__ */ i("span", { id: `${H}-ask`, className: "ui-mac__ask", children: y.whatWentWrong }),
|
|
3982
|
+
/* @__PURE__ */ i("button", { type: "button", className: "ui-mac__close", "aria-label": y.closeFeedback, onClick: ue, children: /* @__PURE__ */ i(Ye, { d: Ve.close }) })
|
|
3983
3983
|
] }),
|
|
3984
3984
|
/* @__PURE__ */ d("div", { className: "ui-mac__chips", children: [
|
|
3985
|
-
(Array.isArray(
|
|
3985
|
+
(Array.isArray(L) ? L : []).map((J, ze) => /* @__PURE__ */ i(
|
|
3986
3986
|
"button",
|
|
3987
3987
|
{
|
|
3988
3988
|
type: "button",
|
|
@@ -4007,19 +4007,19 @@ function Ao({
|
|
|
4007
4007
|
onClick: ae,
|
|
4008
4008
|
children: /* @__PURE__ */ i($t, { id: re ? "sent" : "send", children: re ? /* @__PURE__ */ d(Me, { children: [
|
|
4009
4009
|
/* @__PURE__ */ i(Ye, { d: Ve.tick }),
|
|
4010
|
-
|
|
4011
|
-
] }) :
|
|
4010
|
+
y.thanks
|
|
4011
|
+
] }) : y.send })
|
|
4012
4012
|
}
|
|
4013
4013
|
)
|
|
4014
4014
|
] }),
|
|
4015
|
-
Array.isArray(
|
|
4015
|
+
Array.isArray(L) && L.some(z) && /* @__PURE__ */ i("div", { className: "ui-mac__fold", "data-open": z(K) && !re ? "" : void 0, inert: !z(K) || re, children: /* @__PURE__ */ i("div", { className: "ui-mac__clip", children: /* @__PURE__ */ i(
|
|
4016
4016
|
"input",
|
|
4017
4017
|
{
|
|
4018
4018
|
className: "ui-mac__input",
|
|
4019
4019
|
value: X,
|
|
4020
|
-
placeholder:
|
|
4020
|
+
placeholder: y.morePlaceholder,
|
|
4021
4021
|
dir: "auto",
|
|
4022
|
-
"aria-label":
|
|
4022
|
+
"aria-label": y.moreLabel,
|
|
4023
4023
|
onChange: (J) => oe(J.target.value),
|
|
4024
4024
|
onKeyDown: (J) => {
|
|
4025
4025
|
J.key === "Enter" && ae();
|
|
@@ -4487,7 +4487,7 @@ function ji({ text: e, query: t }) {
|
|
|
4487
4487
|
const Ri = (e) => {
|
|
4488
4488
|
e.currentTarget.dataset.broken = "";
|
|
4489
4489
|
}, Bo = Nt(function({ cmd: t, domId: o, selected: n, ran: a, mod: r, q: c, on: u }) {
|
|
4490
|
-
const s = t.n ? [r, String(t.n)] : t.keys, l =
|
|
4490
|
+
const s = t.n ? [r, String(t.n)] : t.keys, l = U(null);
|
|
4491
4491
|
ke(() => {
|
|
4492
4492
|
t.editing && (l.current?.focus(), l.current?.select());
|
|
4493
4493
|
}, [t.editing]);
|
|
@@ -4507,8 +4507,8 @@ const Ri = (e) => {
|
|
|
4507
4507
|
tabIndex: -1,
|
|
4508
4508
|
onMouseMove: () => u.current.move(t),
|
|
4509
4509
|
onClick: () => u.current.run(t),
|
|
4510
|
-
onKeyDown: x ? (
|
|
4511
|
-
(
|
|
4510
|
+
onKeyDown: x ? (b) => {
|
|
4511
|
+
(b.key === "ArrowLeft" || b.key === "Escape") && (b.preventDefault(), b.stopPropagation(), u.current.focusRow(t));
|
|
4512
4512
|
} : void 0,
|
|
4513
4513
|
children: [
|
|
4514
4514
|
t.logo ? /* @__PURE__ */ i("span", { className: "ui-cmc__logo", "data-letter": Ei(t.label), onErrorCapture: Ri, children: t.logo }) : /* @__PURE__ */ i("span", { className: "ui-cmc__icon", "data-letter": Ei(t.label), onErrorCapture: Ri, children: t.icon }),
|
|
@@ -4521,31 +4521,31 @@ const Ri = (e) => {
|
|
|
4521
4521
|
dir: "auto",
|
|
4522
4522
|
"aria-label": t.label,
|
|
4523
4523
|
defaultValue: t.label,
|
|
4524
|
-
onClick: (
|
|
4525
|
-
onKeyDown: (
|
|
4526
|
-
|
|
4524
|
+
onClick: (b) => b.stopPropagation(),
|
|
4525
|
+
onKeyDown: (b) => {
|
|
4526
|
+
b.stopPropagation(), !b.nativeEvent.isComposing && (b.key === "Enter" ? (b.preventDefault(), u.current.editSubmit(t, b.currentTarget.value)) : b.key === "Escape" && (b.preventDefault(), u.current.editCancel(t)));
|
|
4527
4527
|
}
|
|
4528
4528
|
}
|
|
4529
4529
|
) : /* @__PURE__ */ i("span", { className: "ui-cmc__name", dir: "auto", title: t.label, children: /* @__PURE__ */ i(ji, { text: t.label, query: c }) }),
|
|
4530
4530
|
t.hint && /* @__PURE__ */ i("span", { className: "ui-cmc__hint", dir: "auto", title: t.hint, children: /* @__PURE__ */ i(ji, { text: t.hint, query: c }) })
|
|
4531
4531
|
] }),
|
|
4532
|
-
!t.editing && t.actions?.length ? /* @__PURE__ */ i("span", { className: "ui-cmc__actions", children: t.actions.map((
|
|
4532
|
+
!t.editing && t.actions?.length ? /* @__PURE__ */ i("span", { className: "ui-cmc__actions", children: t.actions.map((b) => /* @__PURE__ */ i(
|
|
4533
4533
|
"button",
|
|
4534
4534
|
{
|
|
4535
4535
|
type: "button",
|
|
4536
|
-
"data-action":
|
|
4537
|
-
"aria-label":
|
|
4538
|
-
title:
|
|
4536
|
+
"data-action": b.id,
|
|
4537
|
+
"aria-label": b.label,
|
|
4538
|
+
title: b.label,
|
|
4539
4539
|
tabIndex: n ? 0 : -1,
|
|
4540
4540
|
onFocus: () => u.current.move(t),
|
|
4541
4541
|
onClick: (w) => {
|
|
4542
|
-
w.stopPropagation(), u.current.action(t,
|
|
4542
|
+
w.stopPropagation(), u.current.action(t, b.id);
|
|
4543
4543
|
},
|
|
4544
|
-
children:
|
|
4544
|
+
children: b.icon ?? b.label
|
|
4545
4545
|
},
|
|
4546
|
-
|
|
4546
|
+
b.id
|
|
4547
4547
|
)) }) : null,
|
|
4548
|
-
s && /* @__PURE__ */ i("span", { className: "ui-cmc__keys", "aria-hidden": "true", children: s.map((
|
|
4548
|
+
s && /* @__PURE__ */ i("span", { className: "ui-cmc__keys", "aria-hidden": "true", children: s.map((b, w) => /* @__PURE__ */ i("kbd", { children: b }, w)) })
|
|
4549
4549
|
]
|
|
4550
4550
|
}
|
|
4551
4551
|
)
|
|
@@ -4566,61 +4566,61 @@ function qo({
|
|
|
4566
4566
|
onRun: l,
|
|
4567
4567
|
onClose: x,
|
|
4568
4568
|
autoFocus: _,
|
|
4569
|
-
className:
|
|
4569
|
+
className: b
|
|
4570
4570
|
}) {
|
|
4571
|
-
const w = je(() => ({ ...Do, ...u }), [u]), m = "ui-cmc" + qe().replace(/[^a-zA-Z0-9_-]/g, ""), k =
|
|
4572
|
-
() => (e ?? []).filter(Boolean).map((h,
|
|
4573
|
-
key: `g${
|
|
4571
|
+
const w = je(() => ({ ...Do, ...u }), [u]), m = "ui-cmc" + qe().replace(/[^a-zA-Z0-9_-]/g, ""), k = U(null), v = U(null), f = U(null), [y, L] = A(0), [z, H] = A(""), [C, P] = A(null), [F, D] = A(null), [T, B] = A(null), [ee, M] = A(!0), W = Uo() ? "⌘" : "Ctrl", Z = je(
|
|
4572
|
+
() => (e ?? []).filter(Boolean).map((h, I) => ({
|
|
4573
|
+
key: `g${I}`,
|
|
4574
4574
|
id: h.id,
|
|
4575
4575
|
label: String(h.label ?? ""),
|
|
4576
|
-
commands: (Array.isArray(h.commands) ? h.commands : []).filter(Boolean).map((
|
|
4577
|
-
const
|
|
4578
|
-
return { row: { ...
|
|
4576
|
+
commands: (Array.isArray(h.commands) ? h.commands : []).filter(Boolean).map((Q, g) => {
|
|
4577
|
+
const O = String(Q.label ?? ""), R = Q.hint == null || Q.hint === "" ? void 0 : String(Q.hint);
|
|
4578
|
+
return { row: { ...Q, label: O, hint: R, key: `${I}-${g}`, n: 0 }, text: Pt(`${O} ${R ?? ""} ${Q.keywords ?? ""}`) };
|
|
4579
4579
|
})
|
|
4580
4580
|
})),
|
|
4581
4581
|
[e]
|
|
4582
|
-
), K =
|
|
4583
|
-
const h = Pt(K),
|
|
4584
|
-
...
|
|
4585
|
-
commands:
|
|
4586
|
-
})).filter((
|
|
4587
|
-
return r && h &&
|
|
4588
|
-
}, [Z, K, r, w]), X = je(() => te.flatMap((h) => h.commands), [te]), oe = X.filter((h) => h.n), re = X.find((h) => h.key ===
|
|
4582
|
+
), K = z.trim(), te = je(() => {
|
|
4583
|
+
const h = Pt(K), I = Z.map((Q) => ({
|
|
4584
|
+
...Q,
|
|
4585
|
+
commands: Q.commands.filter((g) => !h || g.text.includes(h)).map((g, O) => Q.id === "suggestions" && O < 5 ? { ...g.row, n: O + 1 } : g.row)
|
|
4586
|
+
})).filter((Q) => Q.commands.length);
|
|
4587
|
+
return r && h && I.unshift({ key: "ask", id: "ask-about", label: w.assistant, commands: [{ key: "ask", n: 0, id: "ask-about", label: w.ask(K), logo: /* @__PURE__ */ i(Na, {}) }] }), I;
|
|
4588
|
+
}, [Z, K, r, w]), X = je(() => te.flatMap((h) => h.commands), [te]), oe = X.filter((h) => h.n), re = X.find((h) => h.key === C) ?? X[0], Y = U(!1);
|
|
4589
4589
|
ke(() => {
|
|
4590
|
-
const h =
|
|
4591
|
-
if (!h || !
|
|
4592
|
-
if (B({ y:
|
|
4593
|
-
|
|
4594
|
-
const
|
|
4595
|
-
|
|
4590
|
+
const h = v.current, I = h?.querySelector(`[data-key="${re?.key}"]`);
|
|
4591
|
+
if (!h || !I) return B(null);
|
|
4592
|
+
if (B({ y: I.offsetTop, h: I.offsetHeight }), !Y.current) return;
|
|
4593
|
+
Y.current = !1;
|
|
4594
|
+
const Q = 8, g = I.previousElementSibling?.classList.contains("ui-cmc__label") ? I.previousElementSibling.offsetHeight : 0, O = I.offsetTop - Q - g, R = I.offsetTop + I.offsetHeight + Q;
|
|
4595
|
+
O < h.scrollTop ? h.scrollTop = O : R > h.scrollTop + h.clientHeight && (h.scrollTop = R - h.clientHeight);
|
|
4596
4596
|
}, [re?.key, X.length]), ke(() => {
|
|
4597
|
-
const h =
|
|
4598
|
-
if (!h || !
|
|
4599
|
-
const
|
|
4600
|
-
const
|
|
4601
|
-
|
|
4597
|
+
const h = v.current, I = f.current;
|
|
4598
|
+
if (!h || !I) return;
|
|
4599
|
+
const Q = () => {
|
|
4600
|
+
const O = getComputedStyle(h), R = parseFloat(O.paddingTop) + parseFloat(O.paddingBottom), q = parseFloat(O.maxHeight) || 1 / 0;
|
|
4601
|
+
L(Math.min(I.offsetHeight + R, q));
|
|
4602
4602
|
};
|
|
4603
|
-
|
|
4604
|
-
const g = new ResizeObserver(
|
|
4605
|
-
return g.observe(
|
|
4603
|
+
Q();
|
|
4604
|
+
const g = new ResizeObserver(Q);
|
|
4605
|
+
return g.observe(I), () => g.disconnect();
|
|
4606
4606
|
}, []), se(() => {
|
|
4607
4607
|
if (!c) return;
|
|
4608
|
-
const h = (
|
|
4609
|
-
(
|
|
4608
|
+
const h = (I) => {
|
|
4609
|
+
(I.metaKey || I.ctrlKey) && I.key.toLowerCase() === "k" && (I.preventDefault(), k.current?.focus(), k.current?.select());
|
|
4610
4610
|
};
|
|
4611
4611
|
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
4612
4612
|
}, [c]), se(() => {
|
|
4613
|
-
_ && !
|
|
4613
|
+
_ && !v.current?.querySelector(".ui-cmc__edit") && k.current?.focus();
|
|
4614
4614
|
}, [_]), se(() => {
|
|
4615
|
-
if (!
|
|
4616
|
-
const h = window.setTimeout(() =>
|
|
4615
|
+
if (!F) return;
|
|
4616
|
+
const h = window.setTimeout(() => D(null), 1800);
|
|
4617
4617
|
return () => window.clearTimeout(h);
|
|
4618
|
-
}, [
|
|
4619
|
-
const
|
|
4620
|
-
h.editing || (
|
|
4621
|
-
},
|
|
4622
|
-
|
|
4623
|
-
}, p =
|
|
4618
|
+
}, [F]);
|
|
4619
|
+
const E = (h) => {
|
|
4620
|
+
h.editing || (P(h.key), D({ id: h.key, label: h.key === "ask" ? w.asked(K) : w.ran(h.label) }), h.key === "ask" ? l?.("ask", K) : l?.(h.id));
|
|
4621
|
+
}, V = (h) => {
|
|
4622
|
+
P(h.key), M(!0), k.current?.focus({ preventScroll: !0 });
|
|
4623
|
+
}, p = U({ move: () => {
|
|
4624
4624
|
}, run: () => {
|
|
4625
4625
|
}, action: () => {
|
|
4626
4626
|
}, editSubmit: () => {
|
|
@@ -4629,53 +4629,53 @@ function qo({
|
|
|
4629
4629
|
} });
|
|
4630
4630
|
p.current = {
|
|
4631
4631
|
move: (h) => {
|
|
4632
|
-
|
|
4632
|
+
M(!0), h.key !== re?.key && P(h.key);
|
|
4633
4633
|
},
|
|
4634
4634
|
run: (h) => {
|
|
4635
|
-
|
|
4635
|
+
E(h), k.current?.focus({ preventScroll: !0 });
|
|
4636
4636
|
},
|
|
4637
4637
|
// PrimeChatKit LOCAL ⑭ start
|
|
4638
|
-
action: (h,
|
|
4639
|
-
|
|
4638
|
+
action: (h, I) => {
|
|
4639
|
+
V(h), o?.(h.id, I);
|
|
4640
4640
|
},
|
|
4641
|
-
editSubmit: (h,
|
|
4642
|
-
n?.(h.id,
|
|
4641
|
+
editSubmit: (h, I) => {
|
|
4642
|
+
n?.(h.id, I), V(h);
|
|
4643
4643
|
},
|
|
4644
4644
|
editCancel: (h) => {
|
|
4645
|
-
a?.(h.id),
|
|
4645
|
+
a?.(h.id), V(h);
|
|
4646
4646
|
},
|
|
4647
|
-
focusRow:
|
|
4647
|
+
focusRow: V
|
|
4648
4648
|
// PrimeChatKit LOCAL ⑭ end
|
|
4649
4649
|
};
|
|
4650
|
-
const
|
|
4650
|
+
const S = (h) => {
|
|
4651
4651
|
if (!X.length || !re) return;
|
|
4652
|
-
|
|
4653
|
-
const
|
|
4654
|
-
|
|
4655
|
-
},
|
|
4652
|
+
Y.current = !0, M(!0);
|
|
4653
|
+
const I = X.findIndex((Q) => Q.key === re.key);
|
|
4654
|
+
P(X[(I + h + X.length) % X.length].key);
|
|
4655
|
+
}, N = (h) => {
|
|
4656
4656
|
if (h.key === "ArrowRight" && re?.actions?.length && !re.editing) {
|
|
4657
|
-
const
|
|
4658
|
-
|
|
4657
|
+
const I = v.current?.querySelector(`[data-key="${re.key}"] [data-action]`);
|
|
4658
|
+
I && (h.preventDefault(), M(!0), I.focus());
|
|
4659
4659
|
return;
|
|
4660
4660
|
}
|
|
4661
4661
|
if (h.key === "ArrowDown" || h.key === "ArrowUp")
|
|
4662
|
-
h.preventDefault(),
|
|
4662
|
+
h.preventDefault(), S(h.key === "ArrowDown" ? 1 : -1);
|
|
4663
4663
|
else if (h.key === "Enter" && re)
|
|
4664
|
-
h.preventDefault(),
|
|
4664
|
+
h.preventDefault(), E(re);
|
|
4665
4665
|
else if (h.key === "Tab" && te.length > 1) {
|
|
4666
4666
|
h.preventDefault();
|
|
4667
|
-
const
|
|
4668
|
-
|
|
4667
|
+
const I = te.findIndex((g) => g.commands.some((O) => O.key === re?.key)), Q = h.shiftKey ? I <= 0 ? te.length - 1 : I - 1 : (I + 1) % te.length;
|
|
4668
|
+
Y.current = !0, M(!0), P(te[Q].commands[0].key);
|
|
4669
4669
|
} else if (h.key === "Escape")
|
|
4670
|
-
|
|
4670
|
+
z ? H("") : x?.();
|
|
4671
4671
|
else if ((h.metaKey || h.ctrlKey) && /^[1-5]$/.test(h.key)) {
|
|
4672
|
-
const
|
|
4673
|
-
|
|
4672
|
+
const I = oe[Number(h.key) - 1];
|
|
4673
|
+
I && (h.preventDefault(), E(I));
|
|
4674
4674
|
}
|
|
4675
4675
|
};
|
|
4676
4676
|
return (
|
|
4677
4677
|
// PrimeChatKit LOCAL ⑭ start
|
|
4678
|
-
/* @__PURE__ */ d("div", { className: ["ui-cmc",
|
|
4678
|
+
/* @__PURE__ */ d("div", { className: ["ui-cmc", b].filter(Boolean).join(" "), "data-fill": s || void 0, children: [
|
|
4679
4679
|
/* @__PURE__ */ i("style", { href: "ui-command-menu-clean", precedence: "default", children: Ho }),
|
|
4680
4680
|
/* @__PURE__ */ d("div", { className: "ui-cmc__card", children: [
|
|
4681
4681
|
/* @__PURE__ */ d("label", { className: "ui-cmc__search", children: [
|
|
@@ -4687,7 +4687,7 @@ function qo({
|
|
|
4687
4687
|
"input",
|
|
4688
4688
|
{
|
|
4689
4689
|
ref: k,
|
|
4690
|
-
value:
|
|
4690
|
+
value: z,
|
|
4691
4691
|
dir: "auto",
|
|
4692
4692
|
placeholder: t ?? w.placeholder,
|
|
4693
4693
|
"aria-label": w.command,
|
|
@@ -4696,9 +4696,9 @@ function qo({
|
|
|
4696
4696
|
"aria-controls": `${m}-list`,
|
|
4697
4697
|
"aria-activedescendant": re ? `${m}-${re.key}` : void 0,
|
|
4698
4698
|
onChange: (h) => {
|
|
4699
|
-
|
|
4699
|
+
H(h.target.value), P(null);
|
|
4700
4700
|
},
|
|
4701
|
-
onKeyDown:
|
|
4701
|
+
onKeyDown: N
|
|
4702
4702
|
}
|
|
4703
4703
|
),
|
|
4704
4704
|
/* @__PURE__ */ i("kbd", { className: "ui-cmc__enter", "aria-hidden": "true", children: /* @__PURE__ */ i("svg", { viewBox: "0 0 16 16", children: /* @__PURE__ */ i("path", { d: "M12.5 4v3a2 2 0 0 1-2 2h-7M6 6.5 3.5 9 6 11.5" }) }) })
|
|
@@ -4706,46 +4706,46 @@ function qo({
|
|
|
4706
4706
|
/* @__PURE__ */ d(
|
|
4707
4707
|
"div",
|
|
4708
4708
|
{
|
|
4709
|
-
ref:
|
|
4709
|
+
ref: v,
|
|
4710
4710
|
id: `${m}-list`,
|
|
4711
4711
|
className: "ui-cmc__list",
|
|
4712
4712
|
role: "listbox",
|
|
4713
4713
|
"aria-label": w.commands,
|
|
4714
|
-
style: !s &&
|
|
4715
|
-
onMouseLeave: () =>
|
|
4714
|
+
style: !s && y ? { height: y } : void 0,
|
|
4715
|
+
onMouseLeave: () => M(!1),
|
|
4716
4716
|
children: [
|
|
4717
4717
|
T && /* @__PURE__ */ i("span", { className: "ui-cmc__pill", "data-lit": ee || void 0, style: { transform: `translateY(${T.y}px)`, height: T.h }, "aria-hidden": "true" }),
|
|
4718
4718
|
/* @__PURE__ */ i("div", { ref: f, className: "ui-cmc__inner", children: te.map((h) => /* @__PURE__ */ d("div", { role: "group", "aria-label": h.label, className: "ui-cmc__group", children: [
|
|
4719
4719
|
h.key !== "ask" && h.label && /* @__PURE__ */ i("span", { className: "ui-cmc__label", dir: "auto", children: h.label }),
|
|
4720
|
-
h.commands.map((
|
|
4720
|
+
h.commands.map((I) => /* @__PURE__ */ i(
|
|
4721
4721
|
Bo,
|
|
4722
4722
|
{
|
|
4723
|
-
cmd:
|
|
4724
|
-
domId: `${m}-${
|
|
4725
|
-
selected:
|
|
4726
|
-
ran:
|
|
4727
|
-
mod:
|
|
4723
|
+
cmd: I,
|
|
4724
|
+
domId: `${m}-${I.key}`,
|
|
4725
|
+
selected: I.key === re?.key,
|
|
4726
|
+
ran: F?.id === I.key,
|
|
4727
|
+
mod: W,
|
|
4728
4728
|
q: K,
|
|
4729
4729
|
on: p
|
|
4730
4730
|
},
|
|
4731
|
-
|
|
4731
|
+
I.key
|
|
4732
4732
|
))
|
|
4733
4733
|
] }, h.key)) })
|
|
4734
4734
|
]
|
|
4735
4735
|
}
|
|
4736
4736
|
),
|
|
4737
4737
|
/* @__PURE__ */ d("footer", { className: "ui-cmc__foot", "aria-live": "polite", children: [
|
|
4738
|
-
|
|
4738
|
+
F ? /* @__PURE__ */ d("span", { className: "ui-cmc__done", children: [
|
|
4739
4739
|
/* @__PURE__ */ i("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ i("path", { d: "m3.5 8.5 3 3 6-7" }) }),
|
|
4740
|
-
/* @__PURE__ */ i("span", { className: "ui-cmc__done-text", children:
|
|
4741
|
-
] },
|
|
4740
|
+
/* @__PURE__ */ i("span", { className: "ui-cmc__done-text", children: F.label })
|
|
4741
|
+
] }, F.label) : /* @__PURE__ */ d("span", { className: "ui-cmc__tip", children: [
|
|
4742
4742
|
/* @__PURE__ */ i("kbd", { children: "Tab" }),
|
|
4743
4743
|
" ",
|
|
4744
4744
|
w.jumpSections
|
|
4745
4745
|
] }),
|
|
4746
4746
|
c && /* @__PURE__ */ d("span", { className: "ui-cmc__foot-right", children: [
|
|
4747
4747
|
/* @__PURE__ */ d("span", { className: "ui-cmc__keys", children: [
|
|
4748
|
-
/* @__PURE__ */ i("kbd", { children:
|
|
4748
|
+
/* @__PURE__ */ i("kbd", { children: W }),
|
|
4749
4749
|
/* @__PURE__ */ i("kbd", { children: "K" })
|
|
4750
4750
|
] }),
|
|
4751
4751
|
w.open
|
|
@@ -5482,21 +5482,21 @@ function nr({
|
|
|
5482
5482
|
askState: l,
|
|
5483
5483
|
onTask: x,
|
|
5484
5484
|
onAsk: _,
|
|
5485
|
-
onRetry:
|
|
5485
|
+
onRetry: b,
|
|
5486
5486
|
// PrimeChatKit LOCAL ③ start
|
|
5487
5487
|
onCopy: w,
|
|
5488
5488
|
onRegenerate: m,
|
|
5489
5489
|
onFeedback: k,
|
|
5490
|
-
feedbackReasons:
|
|
5490
|
+
feedbackReasons: v
|
|
5491
5491
|
// PrimeChatKit LOCAL ③ end
|
|
5492
5492
|
}) {
|
|
5493
|
-
const f = Yo(),
|
|
5493
|
+
const f = Yo(), y = e.parts.length - 1, L = e.parts.filter((C) => C.kind === "text"), z = L.map((C) => C.text).join(`
|
|
5494
5494
|
|
|
5495
|
-
`),
|
|
5496
|
-
return m &&
|
|
5495
|
+
`), H = ["copy"];
|
|
5496
|
+
return m && H.push("regenerate"), k && H.push("feedback"), // PrimeChatKit LOCAL ③ start
|
|
5497
5497
|
/* @__PURE__ */ d("div", { className: "ui-th-agent", "data-ui-message": e.id, "data-streaming": e.streaming || void 0, children: [
|
|
5498
5498
|
c ? /* @__PURE__ */ d("span", { className: "ui-th-who", children: [
|
|
5499
|
-
r ? /* @__PURE__ */ i("span", { className: "ui-th-avatar", "data-image": "", "aria-hidden": "true", children: /* @__PURE__ */ i("img", { src: r, alt: "" }) }) : /* @__PURE__ */ i("span", { className: "ui-th-avatar", "data-busy": e.streaming || void 0, "aria-hidden": "true", children: ur.map((
|
|
5499
|
+
r ? /* @__PURE__ */ i("span", { className: "ui-th-avatar", "data-image": "", "aria-hidden": "true", children: /* @__PURE__ */ i("img", { src: r, alt: "" }) }) : /* @__PURE__ */ i("span", { className: "ui-th-avatar", "data-busy": e.streaming || void 0, "aria-hidden": "true", children: ur.map((C, P) => /* @__PURE__ */ i("i", { "data-on": C || void 0, style: { animationDelay: `${pr[P]}ms` } }, P)) }),
|
|
5500
5500
|
s.orchestrator,
|
|
5501
5501
|
/* @__PURE__ */ i("time", { className: "ui-th-who__time ui-th-num", dateTime: new Date(e.at).toISOString(), children: a.format(e.at) })
|
|
5502
5502
|
] }) : /* @__PURE__ */ d("span", { className: "ui-th-sr", children: [
|
|
@@ -5504,48 +5504,48 @@ function nr({
|
|
|
5504
5504
|
":"
|
|
5505
5505
|
] }),
|
|
5506
5506
|
t,
|
|
5507
|
-
e.parts.map((
|
|
5508
|
-
const
|
|
5509
|
-
switch (
|
|
5507
|
+
e.parts.map((C, P) => {
|
|
5508
|
+
const F = `${C.kind}-${P}`;
|
|
5509
|
+
switch (C.kind) {
|
|
5510
5510
|
// PrimeChatKit LOCAL ② start
|
|
5511
5511
|
case "text":
|
|
5512
5512
|
return /* @__PURE__ */ d("div", { className: "ui-th-text", dir: "auto", children: [
|
|
5513
|
-
/* @__PURE__ */ i(ut, { text:
|
|
5514
|
-
e.streaming &&
|
|
5515
|
-
] },
|
|
5513
|
+
/* @__PURE__ */ i(ut, { text: C.text }),
|
|
5514
|
+
e.streaming && P === y && /* @__PURE__ */ i("span", { className: "ui-th-caret", "aria-hidden": "true" })
|
|
5515
|
+
] }, F);
|
|
5516
5516
|
// PrimeChatKit LOCAL ② end
|
|
5517
5517
|
// PrimeChatKit LOCAL ㉘ start
|
|
5518
5518
|
case "note":
|
|
5519
|
-
return /* @__PURE__ */ i("div", { className: "ui-th-note", dir: "auto", children: /* @__PURE__ */ i(ut, { text:
|
|
5519
|
+
return /* @__PURE__ */ i("div", { className: "ui-th-note", dir: "auto", children: /* @__PURE__ */ i(ut, { text: C.text }) }, F);
|
|
5520
5520
|
// PrimeChatKit LOCAL ㉘ end
|
|
5521
5521
|
case "tools":
|
|
5522
|
-
return /* @__PURE__ */ i(or, { tools:
|
|
5522
|
+
return /* @__PURE__ */ i(or, { tools: C.tools, now: u, labels: s, phase: o, liveOpen: n }, C.id);
|
|
5523
5523
|
// PrimeChatKit LOCAL ㉕ end
|
|
5524
5524
|
case "task":
|
|
5525
|
-
return /* @__PURE__ */ i(cr, { task:
|
|
5525
|
+
return /* @__PURE__ */ i(cr, { task: C.task, labels: s, onOpen: () => x(C.task.id) }, F);
|
|
5526
5526
|
case "decision":
|
|
5527
|
-
return /* @__PURE__ */ i(lr, { ask:
|
|
5527
|
+
return /* @__PURE__ */ i(lr, { ask: C.ask, state: l(C.ask.id), labels: s, onClick: () => _(C.ask.id) }, F);
|
|
5528
5528
|
case "artifacts":
|
|
5529
|
-
return /* @__PURE__ */ i("div", { className: "ui-th-files", children: /* @__PURE__ */ i(Vo, { names:
|
|
5529
|
+
return /* @__PURE__ */ i("div", { className: "ui-th-files", children: /* @__PURE__ */ i(Vo, { names: C.names, onOpen: (D) => tr(f, D, s.title) }) }, F);
|
|
5530
5530
|
case "error":
|
|
5531
|
-
return /* @__PURE__ */ i(dr, { text:
|
|
5531
|
+
return /* @__PURE__ */ i(dr, { text: C.text, labels: s, onRetry: C.retry ? b : void 0 }, F);
|
|
5532
5532
|
}
|
|
5533
5533
|
}),
|
|
5534
|
-
e.streaming && e.parts[
|
|
5534
|
+
e.streaming && e.parts[y]?.kind !== "text" && e.parts[y]?.kind !== "tools" && /* @__PURE__ */ i("span", { className: "ui-th-caret ui-th-caret--alone", "aria-hidden": "true" }),
|
|
5535
5535
|
e.stopped && /* @__PURE__ */ d("span", { className: "ui-th-stopped", children: [
|
|
5536
5536
|
/* @__PURE__ */ i("span", { className: "ui-th-stopped__mark", "aria-hidden": "true" }),
|
|
5537
5537
|
s.stopped
|
|
5538
5538
|
] }),
|
|
5539
|
-
!e.streaming &&
|
|
5539
|
+
!e.streaming && L.length > 0 && /* @__PURE__ */ i(
|
|
5540
5540
|
Ao,
|
|
5541
5541
|
{
|
|
5542
5542
|
labels: s.messageActions,
|
|
5543
|
-
text:
|
|
5544
|
-
actions:
|
|
5545
|
-
onCopy: w ? () => w(e.id,
|
|
5543
|
+
text: z,
|
|
5544
|
+
actions: H,
|
|
5545
|
+
onCopy: w ? () => w(e.id, z) : void 0,
|
|
5546
5546
|
onRegenerate: m ? () => m(e.id) : void 0,
|
|
5547
|
-
onFeedback: k ? (...
|
|
5548
|
-
reasons:
|
|
5547
|
+
onFeedback: k ? (...C) => k(e.id, ...C) : void 0,
|
|
5548
|
+
reasons: v
|
|
5549
5549
|
}
|
|
5550
5550
|
)
|
|
5551
5551
|
] });
|
|
@@ -5557,9 +5557,9 @@ function _i({ size: e = 14 }) {
|
|
|
5557
5557
|
] });
|
|
5558
5558
|
}
|
|
5559
5559
|
function or({ tools: e, now: t, labels: o, phase: n, liveOpen: a = !0 }) {
|
|
5560
|
-
const r = e.filter((
|
|
5561
|
-
_ !== n && (
|
|
5562
|
-
const [w, m] =
|
|
5560
|
+
const r = e.filter((H) => H.status === "running").length, c = e.filter((H) => H.status === "failed").length, u = e.some((H) => H.status === "stopped"), s = n === "working" ? !1 : n === "writing" ? !0 : r === 0, [l, x] = A(null), [_, b] = A(n);
|
|
5561
|
+
_ !== n && (b(n), a && (n === "working" || n === "writing") && x(null));
|
|
5562
|
+
const [w, m] = A(!1), k = U(!s);
|
|
5563
5563
|
se(() => {
|
|
5564
5564
|
if (n === "writing") {
|
|
5565
5565
|
k.current = !1, m(!1);
|
|
@@ -5571,21 +5571,21 @@ function or({ tools: e, now: t, labels: o, phase: n, liveOpen: a = !0 }) {
|
|
|
5571
5571
|
}
|
|
5572
5572
|
if (!k.current) return;
|
|
5573
5573
|
k.current = !1, m(!0);
|
|
5574
|
-
const
|
|
5575
|
-
return () => window.clearTimeout(
|
|
5574
|
+
const H = window.setTimeout(() => m(!1), 650);
|
|
5575
|
+
return () => window.clearTimeout(H);
|
|
5576
5576
|
}, [s, n]);
|
|
5577
|
-
const
|
|
5578
|
-
return /* @__PURE__ */ d("div", { className: "ui-th-tools", "data-open":
|
|
5579
|
-
/* @__PURE__ */ d("button", { type: "button", className: "ui-th-tools__head", "aria-expanded":
|
|
5577
|
+
const v = a ? n === "working" || (l ?? (n === "writing" ? !1 : !s || w || c > 0)) : l ?? c > 0, f = Math.max(0, ...e.map((H) => H.ms ?? 0)), y = e.length, L = s ? u ? o.toolsStopped(e.filter((H) => H.status === "done").length, y) : c ? o.toolsFailed(y, c) : o.toolsRan(y, o.duration(f)) : o.toolsRunning(y), z = `ui-th-tools-${qe().replace(/:/g, "")}`;
|
|
5578
|
+
return /* @__PURE__ */ d("div", { className: "ui-th-tools", "data-open": v, "data-state": s ? c ? "failed" : "done" : "running", children: [
|
|
5579
|
+
/* @__PURE__ */ d("button", { type: "button", className: "ui-th-tools__head", "aria-expanded": v, "aria-controls": z, onClick: () => x(!v), children: [
|
|
5580
5580
|
/* @__PURE__ */ i("span", { className: "ui-th-tools__glyph", "aria-hidden": "true", children: s ? c ? /* @__PURE__ */ i(Be, { icon: Wt, size: 14 }) : /* @__PURE__ */ i(Be, { icon: la, size: 14, stroke: 2.2 }) : /* @__PURE__ */ i(_i, {}) }),
|
|
5581
|
-
/* @__PURE__ */ i("span", { className: "ui-th-tools__title", "data-shimmer": !s || void 0, "data-text":
|
|
5581
|
+
/* @__PURE__ */ i("span", { className: "ui-th-tools__title", "data-shimmer": !s || void 0, "data-text": L, children: L }, s ? "done" : "run"),
|
|
5582
5582
|
/* @__PURE__ */ i("span", { className: "ui-th-tools__chev", "aria-hidden": "true", children: /* @__PURE__ */ i(Be, { icon: tn, size: 12 }) })
|
|
5583
5583
|
] }),
|
|
5584
|
-
/* @__PURE__ */ i("div", { className: "ui-th-tools__wrap", id:
|
|
5584
|
+
/* @__PURE__ */ i("div", { className: "ui-th-tools__wrap", id: z, inert: !v, children: /* @__PURE__ */ i("ul", { className: "ui-th-tools__list", children: e.map((H) => /* @__PURE__ */ i(rr, { tool: H, now: t, labels: o }, H.id)) }) })
|
|
5585
5585
|
] });
|
|
5586
5586
|
}
|
|
5587
5587
|
function rr({ tool: e, now: t, labels: o }) {
|
|
5588
|
-
const [n, a] =
|
|
5588
|
+
const [n, a] = A(!1), r = `ui-th-tool-${qe().replace(/:/g, "")}`, c = e.args !== void 0 || e.result !== void 0 || e.error !== void 0, u = /* @__PURE__ */ d(Me, { children: [
|
|
5589
5589
|
/* @__PURE__ */ i("span", { className: "ui-th-tool__mark", "aria-hidden": "true", children: e.status === "running" ? /* @__PURE__ */ i(_i, { size: 12 }) : e.status === "failed" ? /* @__PURE__ */ i(Be, { icon: Wt, size: 12 }) : e.status === "stopped" ? /* @__PURE__ */ i("span", { className: "ui-th-tool__stop" }) : /* @__PURE__ */ i(Be, { icon: la, size: 12, stroke: 2.4 }) }),
|
|
5590
5590
|
e.icon && /* @__PURE__ */ i("span", { className: "ui-th-tool__icon", "aria-hidden": "true", children: /* @__PURE__ */ i(Be, { icon: e.icon, size: 13 }) }),
|
|
5591
5591
|
/* @__PURE__ */ d("span", { className: "ui-th-tool__label", dir: "auto", title: e.label, children: [
|
|
@@ -6339,49 +6339,49 @@ const gr = (
|
|
|
6339
6339
|
e.map((t, o) => /* @__PURE__ */ i("rect", { "data-tone": t.tone ?? "soft", x: t.x, y: t.y, width: t.w, height: t.h, rx: t.r ?? 2 }, o))
|
|
6340
6340
|
] });
|
|
6341
6341
|
function Ta({ decisions: e, onDecide: t, onLater: o, defaultFolded: n = !1, reveal: a, labels: r, className: c }) {
|
|
6342
|
-
const u = { ...xr, ...r }, [s, l] =
|
|
6342
|
+
const u = { ...xr, ...r }, [s, l] = A(() => /* @__PURE__ */ new Set());
|
|
6343
6343
|
se(() => {
|
|
6344
|
-
l((
|
|
6345
|
-
if (
|
|
6346
|
-
const
|
|
6347
|
-
return p.size ===
|
|
6344
|
+
l((E) => {
|
|
6345
|
+
if (!E.size) return E;
|
|
6346
|
+
const V = new Set(e.map((S) => S.id)), p = new Set([...E].filter((S) => V.has(S)));
|
|
6347
|
+
return p.size === E.size ? E : p;
|
|
6348
6348
|
});
|
|
6349
6349
|
}, [e]);
|
|
6350
|
-
const x = e.filter((
|
|
6351
|
-
|
|
6352
|
-
const B =
|
|
6353
|
-
Z.current = typeof document < "u" && !!
|
|
6354
|
-
const K = (
|
|
6350
|
+
const x = e.filter((E) => !s.has(E.id)), _ = x.filter((E) => !E.readOnly), [b, w] = A({}), [m, k] = A(null), [v, f] = A(n), [y, L] = A({}), [z, H] = A(!1), [C, P] = A(""), F = Math.max(0, x.findIndex((E) => E.id === m)), D = x[F] ?? null, T = U(D);
|
|
6351
|
+
D && (T.current = D);
|
|
6352
|
+
const B = D ?? T.current, ee = D ? v && !D.readOnly ? "min" : "full" : "none", M = U(null), W = U(null), Z = U(!1);
|
|
6353
|
+
Z.current = typeof document < "u" && !!M.current?.contains(document.activeElement);
|
|
6354
|
+
const K = (E) => P((V) => V === E ? `${E} ` : E);
|
|
6355
6355
|
ke(() => {
|
|
6356
|
-
const
|
|
6357
|
-
if (
|
|
6358
|
-
const p =
|
|
6359
|
-
(
|
|
6356
|
+
const E = Z.current && ee !== "none" && (!document.activeElement || document.activeElement === document.body), V = W.current ?? (E ? ee === "min" ? "show" : "row" : null);
|
|
6357
|
+
if (W.current = null, !V) return;
|
|
6358
|
+
const p = M.current;
|
|
6359
|
+
(V === "show" && p?.querySelector(".ui-dcc__show") || (V === "prev" || V === "next") && p?.querySelector(`.ui-dcc__page[data-step="${V}"]`) || // No options: the field for your own words takes the focus
|
|
6360
6360
|
p?.querySelector('[role="option"][tabindex="0"], .ui-dcc__input'))?.focus({ preventScroll: !0 });
|
|
6361
6361
|
});
|
|
6362
|
-
const te =
|
|
6362
|
+
const te = U(a);
|
|
6363
6363
|
se(() => {
|
|
6364
6364
|
if (a === te.current) return;
|
|
6365
|
-
te.current = a, f(!1),
|
|
6366
|
-
const
|
|
6367
|
-
return () => window.clearTimeout(
|
|
6365
|
+
te.current = a, f(!1), W.current = "row", H(!0);
|
|
6366
|
+
const E = window.setTimeout(() => H(!1), 700);
|
|
6367
|
+
return () => window.clearTimeout(E);
|
|
6368
6368
|
}, [a]);
|
|
6369
|
-
const X = (
|
|
6370
|
-
if (
|
|
6369
|
+
const X = (E, V) => {
|
|
6370
|
+
if (E.readOnly || s.has(E.id)) return;
|
|
6371
6371
|
const p = _.length - 1;
|
|
6372
|
-
w(({ [
|
|
6373
|
-
const
|
|
6374
|
-
l((
|
|
6372
|
+
w(({ [E.id]: N, ...h }) => h);
|
|
6373
|
+
const S = x[F + 1] ?? x[F - 1] ?? null;
|
|
6374
|
+
l((N) => new Set(N).add(E.id)), k(S?.id ?? null), L(({ [E.id]: N, ...h }) => h), K(`${u.answered}: ${_r(E, V, u)}. ${p ? u.waiting(p) : u.allDone}`), t?.(E.id, V);
|
|
6375
6375
|
}, oe = () => {
|
|
6376
|
-
!
|
|
6376
|
+
!D || D.readOnly || (f(!0), W.current = "show", K(`${u.later} – ${u.waiting(_.length)}`), o?.(D.id));
|
|
6377
6377
|
}, re = () => {
|
|
6378
|
-
f(!1),
|
|
6379
|
-
},
|
|
6380
|
-
x.length < 2 || (
|
|
6378
|
+
f(!1), W.current = "row";
|
|
6379
|
+
}, Y = (E) => {
|
|
6380
|
+
x.length < 2 || (M.current?.contains(document.activeElement) && (W.current = E < 0 ? "prev" : "next"), k(x[(F + E + x.length) % x.length].id));
|
|
6381
6381
|
};
|
|
6382
|
-
return /* @__PURE__ */ d("div", { ref:
|
|
6382
|
+
return /* @__PURE__ */ d("div", { ref: M, className: ["ui-dcc", c].filter(Boolean).join(" "), "data-mode": ee, children: [
|
|
6383
6383
|
/* @__PURE__ */ i("style", { href: "ui-decision-card-clean", precedence: "default", children: Mr }),
|
|
6384
|
-
/* @__PURE__ */ i("span", { className: "ui-dcc__sr", role: "status", "aria-live": "polite", children:
|
|
6384
|
+
/* @__PURE__ */ i("span", { className: "ui-dcc__sr", role: "status", "aria-live": "polite", children: C }),
|
|
6385
6385
|
/* @__PURE__ */ i("div", { className: "ui-dcc__wrap", inert: ee === "none", children: /* @__PURE__ */ i("div", { className: "ui-dcc__inner", children: ee === "min" ? /* @__PURE__ */ i("div", { className: "ui-dcc__box ui-dcc__box--min", children: /* @__PURE__ */ d("div", { className: "ui-dcc__head", children: [
|
|
6386
6386
|
/* @__PURE__ */ i("span", { className: "ui-dcc__badge", children: u.needsYou }),
|
|
6387
6387
|
/* @__PURE__ */ i("span", { className: "ui-dcc__task ui-dcc__num", children: u.waiting(_.length) }),
|
|
@@ -6394,16 +6394,16 @@ function Ta({ decisions: e, onDecide: t, onLater: o, defaultFolded: n = !1, reve
|
|
|
6394
6394
|
d: B,
|
|
6395
6395
|
L: u,
|
|
6396
6396
|
count: _.length,
|
|
6397
|
-
index: _.findIndex((
|
|
6397
|
+
index: _.findIndex((E) => E.id === B.id),
|
|
6398
6398
|
pageCount: x.length,
|
|
6399
|
-
selected:
|
|
6400
|
-
onSelect: (
|
|
6401
|
-
pulse:
|
|
6402
|
-
draft:
|
|
6403
|
-
onDraft: (
|
|
6404
|
-
onAnswer: (
|
|
6399
|
+
selected: b[B.id] ?? [],
|
|
6400
|
+
onSelect: (E) => w((V) => ({ ...V, [B.id]: E })),
|
|
6401
|
+
pulse: z,
|
|
6402
|
+
draft: y[B.id] ?? "",
|
|
6403
|
+
onDraft: (E) => L((V) => ({ ...V, [B.id]: E })),
|
|
6404
|
+
onAnswer: (E) => X(B, E),
|
|
6405
6405
|
onLater: oe,
|
|
6406
|
-
onPage:
|
|
6406
|
+
onPage: Y
|
|
6407
6407
|
},
|
|
6408
6408
|
B.id
|
|
6409
6409
|
)
|
|
@@ -6425,54 +6425,54 @@ function zr({
|
|
|
6425
6425
|
onDraft: l,
|
|
6426
6426
|
onAnswer: x,
|
|
6427
6427
|
onLater: _,
|
|
6428
|
-
onPage:
|
|
6428
|
+
onPage: b
|
|
6429
6429
|
}) {
|
|
6430
|
-
const w = `ui-dcc-q-${qe().replace(/:/g, "")}`, m = wr(n, a), k = n.kind === "pick", [
|
|
6430
|
+
const w = `ui-dcc-q-${qe().replace(/:/g, "")}`, m = wr(n, a), k = n.kind === "pick", [v, f] = A(() => Math.max(0, m.findIndex((M) => M.recommended))), y = U(null), L = U(null), [z, H] = A(null), C = n.own !== !1 && !n.readOnly, P = t.length >= (n.multiple?.max ?? 1 / 0), F = t.length >= (n.multiple?.min ?? 0) && t.length <= (n.multiple?.max ?? 1 / 0), D = (M) => {
|
|
6431
6431
|
if (!n.readOnly) {
|
|
6432
|
-
if (!n.multiple) return x(
|
|
6433
|
-
t.includes(
|
|
6432
|
+
if (!n.multiple) return x(M.answer);
|
|
6433
|
+
t.includes(M.id) ? o(t.filter((W) => W !== M.id)) : P || o([...t, M.id]);
|
|
6434
6434
|
}
|
|
6435
|
-
}, T = (
|
|
6436
|
-
f(
|
|
6435
|
+
}, T = (M) => {
|
|
6436
|
+
f(M), y.current?.querySelector(`[data-row="${M}"]`)?.focus();
|
|
6437
6437
|
}, B = () => {
|
|
6438
|
-
if (!
|
|
6439
|
-
const
|
|
6440
|
-
if (
|
|
6441
|
-
const
|
|
6442
|
-
if (!
|
|
6443
|
-
x({ text:
|
|
6438
|
+
if (!C) return;
|
|
6439
|
+
const M = n.validate?.(s.trim()) ?? null;
|
|
6440
|
+
if (H(M), M) return L.current?.focus();
|
|
6441
|
+
const W = s.trim();
|
|
6442
|
+
if (!W) return L.current?.focus();
|
|
6443
|
+
x({ text: W });
|
|
6444
6444
|
};
|
|
6445
|
-
return /* @__PURE__ */ d("div", { ref:
|
|
6446
|
-
if (n.readOnly ||
|
|
6447
|
-
if (
|
|
6448
|
-
return
|
|
6449
|
-
if (
|
|
6450
|
-
const
|
|
6451
|
-
if (
|
|
6452
|
-
return
|
|
6453
|
-
if (
|
|
6454
|
-
return
|
|
6445
|
+
return /* @__PURE__ */ d("div", { ref: y, className: "ui-dcc__box", role: "group", "aria-labelledby": w, "data-pulse": u || void 0, onKeyDown: (M) => {
|
|
6446
|
+
if (n.readOnly || M.metaKey || M.ctrlKey || M.altKey || M.nativeEvent.isComposing) return;
|
|
6447
|
+
if (M.key === "Escape")
|
|
6448
|
+
return M.preventDefault(), _();
|
|
6449
|
+
if (M.target.getAttribute("role") !== "option") return;
|
|
6450
|
+
const W = /^[1-9]$/.test(M.key) ? Number(M.key) : 0;
|
|
6451
|
+
if (W >= 1 && W <= m.length)
|
|
6452
|
+
return M.preventDefault(), D(m[W - 1]);
|
|
6453
|
+
if (C && M.key === "ArrowDown" && v === m.length - 1)
|
|
6454
|
+
return M.preventDefault(), L.current?.focus();
|
|
6455
6455
|
const Z = k ? ["ArrowRight", "ArrowDown"] : ["ArrowDown"], K = k ? ["ArrowLeft", "ArrowUp"] : ["ArrowUp"];
|
|
6456
|
-
Z.includes(
|
|
6456
|
+
Z.includes(M.key) ? (M.preventDefault(), T(Math.min(m.length - 1, v + 1))) : K.includes(M.key) ? (M.preventDefault(), T(Math.max(0, v - 1))) : M.key === "Home" ? (M.preventDefault(), T(0)) : M.key === "End" ? (M.preventDefault(), T(m.length - 1)) : (M.key === "Enter" || M.key === " ") && (M.preventDefault(), D(m[v]));
|
|
6457
6457
|
}, children: [
|
|
6458
6458
|
/* @__PURE__ */ d("div", { className: "ui-dcc__head", children: [
|
|
6459
6459
|
/* @__PURE__ */ i("span", { className: "ui-dcc__badge", children: a.needsYou }),
|
|
6460
6460
|
/* @__PURE__ */ i("span", { className: "ui-dcc__task", dir: "auto", children: n.task }),
|
|
6461
6461
|
/* @__PURE__ */ d("span", { className: "ui-dcc__tools", children: [
|
|
6462
6462
|
e > 1 && /* @__PURE__ */ d("span", { className: "ui-dcc__pager", children: [
|
|
6463
|
-
/* @__PURE__ */ i("button", { type: "button", className: "ui-dcc__page", "data-step": "prev", "aria-label": a.previous, onClick: () =>
|
|
6463
|
+
/* @__PURE__ */ i("button", { type: "button", className: "ui-dcc__page", "data-step": "prev", "aria-label": a.previous, onClick: () => b(-1), children: /* @__PURE__ */ i(br, {}) }),
|
|
6464
6464
|
!n.readOnly && r > 1 && /* @__PURE__ */ i("span", { className: "ui-dcc__num ui-dcc__count", style: { minWidth: `${a.of(r, r).length}ch` }, children: a.of(c + 1, r) }),
|
|
6465
|
-
/* @__PURE__ */ i("button", { type: "button", className: "ui-dcc__page", "data-step": "next", "aria-label": a.next, onClick: () =>
|
|
6465
|
+
/* @__PURE__ */ i("button", { type: "button", className: "ui-dcc__page", "data-step": "next", "aria-label": a.next, onClick: () => b(1), children: /* @__PURE__ */ i(vr, {}) })
|
|
6466
6466
|
] }),
|
|
6467
6467
|
!n.readOnly && /* @__PURE__ */ i("button", { type: "button", className: "ui-dcc__link", "aria-keyshortcuts": "Escape", onClick: _, children: a.later })
|
|
6468
6468
|
] })
|
|
6469
6469
|
] }),
|
|
6470
6470
|
/* @__PURE__ */ d("div", { className: "ui-dcc__body", children: [
|
|
6471
6471
|
n.body !== void 0 ? /* @__PURE__ */ i("div", { id: w, className: "ui-dcc__q", "data-rich": "", dir: "auto", children: n.body }) : /* @__PURE__ */ i("p", { id: w, className: "ui-dcc__q", dir: "auto", children: n.question }),
|
|
6472
|
-
!n.readOnly && n.facts && n.facts.length > 0 && /* @__PURE__ */ i("dl", { className: "ui-dcc__facts", children: n.facts.slice(0, 3).map((
|
|
6473
|
-
/* @__PURE__ */ i("dt", { title:
|
|
6474
|
-
/* @__PURE__ */ i("dd", { dir: "auto", children:
|
|
6475
|
-
] },
|
|
6472
|
+
!n.readOnly && n.facts && n.facts.length > 0 && /* @__PURE__ */ i("dl", { className: "ui-dcc__facts", children: n.facts.slice(0, 3).map((M, W) => /* @__PURE__ */ d("div", { children: [
|
|
6473
|
+
/* @__PURE__ */ i("dt", { title: M.label, children: M.label }),
|
|
6474
|
+
/* @__PURE__ */ i("dd", { dir: "auto", children: M.value })
|
|
6475
|
+
] }, W)) }),
|
|
6476
6476
|
!n.readOnly && /* @__PURE__ */ i(
|
|
6477
6477
|
"div",
|
|
6478
6478
|
{
|
|
@@ -6483,70 +6483,70 @@ function zr({
|
|
|
6483
6483
|
"aria-orientation": k ? "horizontal" : "vertical",
|
|
6484
6484
|
"data-many": k && m.length > 3 ? "" : void 0,
|
|
6485
6485
|
style: k ? { "--ui-dcc-cols": Math.max(3, m.length) } : void 0,
|
|
6486
|
-
children: m.map((
|
|
6486
|
+
children: m.map((M, W) => /* @__PURE__ */ d(
|
|
6487
6487
|
"button",
|
|
6488
6488
|
{
|
|
6489
6489
|
type: "button",
|
|
6490
6490
|
role: "option",
|
|
6491
6491
|
className: k ? "ui-dcc__tile" : "ui-dcc__opt",
|
|
6492
|
-
"data-row":
|
|
6493
|
-
"aria-selected": n.multiple ? t.includes(
|
|
6494
|
-
"aria-disabled": n.multiple &&
|
|
6495
|
-
"aria-keyshortcuts":
|
|
6496
|
-
tabIndex:
|
|
6497
|
-
onFocus: () => f(
|
|
6498
|
-
onClick: () =>
|
|
6492
|
+
"data-row": W,
|
|
6493
|
+
"aria-selected": n.multiple ? t.includes(M.id) : W === v,
|
|
6494
|
+
"aria-disabled": n.multiple && P && !t.includes(M.id) || void 0,
|
|
6495
|
+
"aria-keyshortcuts": W < 9 ? String(W + 1) : void 0,
|
|
6496
|
+
tabIndex: W === v ? 0 : -1,
|
|
6497
|
+
onFocus: () => f(W),
|
|
6498
|
+
onClick: () => D(M),
|
|
6499
6499
|
children: [
|
|
6500
|
-
k && /* @__PURE__ */ i("span", { className: "ui-dcc__frame", "aria-hidden": "true", children:
|
|
6501
|
-
k &&
|
|
6500
|
+
k && /* @__PURE__ */ i("span", { className: "ui-dcc__frame", "aria-hidden": "true", children: M.preview ?? (M.blocks ? /* @__PURE__ */ i(kr, { blocks: M.blocks }) : null) }),
|
|
6501
|
+
k && M.recommended && /* @__PURE__ */ i("span", { className: "ui-dcc__tag ui-dcc__tag--tile", children: a.recommended }),
|
|
6502
6502
|
/* @__PURE__ */ d("span", { className: "ui-dcc__row", children: [
|
|
6503
|
-
/* @__PURE__ */ i("span", { className: "ui-dcc__key ui-dcc__num", "aria-hidden": "true", children:
|
|
6503
|
+
/* @__PURE__ */ i("span", { className: "ui-dcc__key ui-dcc__num", "aria-hidden": "true", children: W + 1 }),
|
|
6504
6504
|
/* @__PURE__ */ d("span", { className: "ui-dcc__text", children: [
|
|
6505
|
-
/* @__PURE__ */ i("span", { className: "ui-dcc__title", dir: "auto", children:
|
|
6506
|
-
!k &&
|
|
6505
|
+
/* @__PURE__ */ i("span", { className: "ui-dcc__title", dir: "auto", children: M.title }),
|
|
6506
|
+
!k && M.summary && /* @__PURE__ */ i("span", { className: "ui-dcc__summary", dir: "auto", children: M.summary })
|
|
6507
6507
|
] }),
|
|
6508
|
-
|
|
6508
|
+
M.recommended && /* @__PURE__ */ i("span", { className: "ui-dcc__tag ui-dcc__tag--row", children: a.recommended })
|
|
6509
6509
|
] })
|
|
6510
6510
|
]
|
|
6511
6511
|
},
|
|
6512
|
-
|
|
6512
|
+
M.id
|
|
6513
6513
|
))
|
|
6514
6514
|
}
|
|
6515
6515
|
),
|
|
6516
|
-
|
|
6516
|
+
C && /* @__PURE__ */ d("div", { className: "ui-dcc__own", onClick: (M) => M.target === M.currentTarget && L.current?.focus(), children: [
|
|
6517
6517
|
n.body !== void 0 && /* @__PURE__ */ i("span", { id: `${w}-own`, className: "ui-dcc__sr", children: a.own.replace(/…$/, "") }),
|
|
6518
6518
|
/* @__PURE__ */ i("span", { className: "ui-dcc__key ui-dcc__num", "aria-hidden": "true", children: m.length + 1 }),
|
|
6519
6519
|
/* @__PURE__ */ i(
|
|
6520
6520
|
"input",
|
|
6521
6521
|
{
|
|
6522
|
-
ref:
|
|
6522
|
+
ref: L,
|
|
6523
6523
|
className: "ui-dcc__input",
|
|
6524
6524
|
value: s,
|
|
6525
6525
|
placeholder: n.placeholder ?? a.own,
|
|
6526
6526
|
inputMode: n.inputMode,
|
|
6527
|
-
"aria-invalid": !!
|
|
6528
|
-
"aria-describedby":
|
|
6527
|
+
"aria-invalid": !!z || void 0,
|
|
6528
|
+
"aria-describedby": z ? `${w}-error` : void 0,
|
|
6529
6529
|
"aria-label": n.body !== void 0 ? void 0 : `${a.own.replace(/…$/, "")}: ${n.question}`,
|
|
6530
6530
|
"aria-labelledby": n.body !== void 0 ? `${w}-own ${w}` : void 0,
|
|
6531
6531
|
dir: "auto",
|
|
6532
|
-
onChange: (
|
|
6533
|
-
|
|
6532
|
+
onChange: (M) => {
|
|
6533
|
+
H(null), l(M.target.value);
|
|
6534
6534
|
},
|
|
6535
|
-
onKeyDown: (
|
|
6536
|
-
|
|
6535
|
+
onKeyDown: (M) => {
|
|
6536
|
+
M.nativeEvent.isComposing || (M.key === "Enter" ? (M.preventDefault(), B()) : M.key === "ArrowUp" && !s && (M.preventDefault(), T(m.length - 1)));
|
|
6537
6537
|
}
|
|
6538
6538
|
}
|
|
6539
6539
|
),
|
|
6540
6540
|
/* @__PURE__ */ i("button", { type: "button", className: "ui-dcc__send", "aria-label": a.send, title: a.send, "aria-disabled": !s.trim() || void 0, "data-shown": s.trim() ? "" : void 0, tabIndex: s.trim() ? 0 : -1, onClick: B, children: /* @__PURE__ */ i(yr, {}) })
|
|
6541
6541
|
] }),
|
|
6542
|
-
|
|
6542
|
+
C && z && /* @__PURE__ */ i("p", { id: `${w}-error`, className: "ui-dcc__q", role: "alert", children: z }),
|
|
6543
6543
|
!n.readOnly && n.multiple && /* @__PURE__ */ i(
|
|
6544
6544
|
"button",
|
|
6545
6545
|
{
|
|
6546
6546
|
type: "button",
|
|
6547
6547
|
className: "ui-dcc__link",
|
|
6548
|
-
disabled: !
|
|
6549
|
-
onClick: () =>
|
|
6548
|
+
disabled: !F,
|
|
6549
|
+
onClick: () => F && x({ options: m.filter((M) => t.includes(M.id)).map((M) => M.id) }),
|
|
6550
6550
|
children: a.confirm
|
|
6551
6551
|
}
|
|
6552
6552
|
)
|
|
@@ -6851,27 +6851,27 @@ function $r({
|
|
|
6851
6851
|
autoplay: u = !1,
|
|
6852
6852
|
className: s
|
|
6853
6853
|
}) {
|
|
6854
|
-
const [l, x] =
|
|
6855
|
-
|
|
6856
|
-
const
|
|
6857
|
-
Qa(e, () => ({ pick: () =>
|
|
6858
|
-
const
|
|
6854
|
+
const [l, x] = A([]), [_, b] = A(0), [w, m] = A(""), [, k] = A(0), v = U(null), f = U(null), y = U(null), L = U(0), z = U(l);
|
|
6855
|
+
z.current = l;
|
|
6856
|
+
const H = qe();
|
|
6857
|
+
Qa(e, () => ({ pick: () => v.current?.click() }), []);
|
|
6858
|
+
const C = { ...Aa, ...t }, P = o?.map((g) => g.replace(/^\./, "").toLowerCase()), F = P?.length ? C.acceptedTypes(P) : C.anyFile, D = Number.isFinite(n) && n > 0 ? n : 1 / 0, T = c ?? (D < 1 / 0 ? C.hint(F, Et(D, C)) : F);
|
|
6859
6859
|
se(() => {
|
|
6860
|
-
r?.(l.filter((g) => !g.removing).map(({ id: g, name:
|
|
6860
|
+
r?.(l.filter((g) => !g.removing).map(({ id: g, name: O, size: R, status: q, progress: $, error: ae, file: fe }) => ({ id: g, name: O, size: R, status: q, progress: $, error: ae, file: fe })));
|
|
6861
6861
|
}, [l]), ke(() => {
|
|
6862
|
-
const g = f.current,
|
|
6863
|
-
if (!g || !
|
|
6864
|
-
const R = () => g.style.height = `${
|
|
6862
|
+
const g = f.current, O = y.current;
|
|
6863
|
+
if (!g || !O) return;
|
|
6864
|
+
const R = () => g.style.height = `${O.offsetHeight}px`;
|
|
6865
6865
|
R();
|
|
6866
|
-
const
|
|
6867
|
-
return
|
|
6866
|
+
const q = new ResizeObserver(R);
|
|
6867
|
+
return q.observe(O), () => q.disconnect();
|
|
6868
6868
|
}, []);
|
|
6869
|
-
const B = (g,
|
|
6870
|
-
const
|
|
6869
|
+
const B = (g, O) => x((R) => R.map((q) => q.id === g ? { ...q, ...O } : q)), ee = (g) => {
|
|
6870
|
+
const O = Ar();
|
|
6871
6871
|
let R;
|
|
6872
|
-
|
|
6873
|
-
const
|
|
6874
|
-
id:
|
|
6872
|
+
P?.length && !P.includes(Bt(g.name)) ? R = C.unsupportedType(Bt(g.name)) : g.size > D && (R = C.tooLarge(Et(D, C)));
|
|
6873
|
+
const q = {
|
|
6874
|
+
id: O,
|
|
6875
6875
|
name: g.name,
|
|
6876
6876
|
size: Ct(g.size),
|
|
6877
6877
|
file: g.file,
|
|
@@ -6882,88 +6882,88 @@ function $r({
|
|
|
6882
6882
|
startedAt: performance.now(),
|
|
6883
6883
|
duration: Lr(Ct(g.size))
|
|
6884
6884
|
};
|
|
6885
|
-
x((
|
|
6886
|
-
},
|
|
6885
|
+
x(($) => [...$, q]), R ? m(C.errorAnnouncement(g.name, R)) : a && g.file && M(q);
|
|
6886
|
+
}, M = (g) => {
|
|
6887
6887
|
a(
|
|
6888
6888
|
g.file,
|
|
6889
|
-
(
|
|
6889
|
+
(O) => x((R) => R.map((q) => q.id === g.id && q.status === "uploading" ? { ...q, progress: Math.max(q.progress, Nr(O)) } : q))
|
|
6890
6890
|
).then(() => {
|
|
6891
|
-
B(g.id, { status: "done", progress: 1 }), m(
|
|
6892
|
-
}).catch((
|
|
6893
|
-
const R =
|
|
6894
|
-
B(g.id, { status: "error", error: R, retryable: !0 }), m(
|
|
6891
|
+
B(g.id, { status: "done", progress: 1 }), m(C.uploadedAnnouncement(g.name));
|
|
6892
|
+
}).catch((O) => {
|
|
6893
|
+
const R = O instanceof Error && O.message ? O.message : C.uploadFailed;
|
|
6894
|
+
B(g.id, { status: "error", error: R, retryable: !0 }), m(C.errorAnnouncement(g.name, R));
|
|
6895
6895
|
});
|
|
6896
|
-
},
|
|
6896
|
+
}, W = (g) => Array.from(g).forEach((O) => ee({ name: O.name, size: O.size, file: O })), Z = l.some((g) => g.status === "uploading" && (!a || !g.file));
|
|
6897
6897
|
se(() => {
|
|
6898
6898
|
if (!Z) return;
|
|
6899
6899
|
const g = window.setInterval(() => {
|
|
6900
|
-
const
|
|
6900
|
+
const O = performance.now();
|
|
6901
6901
|
x(
|
|
6902
|
-
(R) => R.map((
|
|
6903
|
-
if (
|
|
6904
|
-
const
|
|
6905
|
-
return
|
|
6902
|
+
(R) => R.map((q) => {
|
|
6903
|
+
if (q.status !== "uploading" || a && q.file) return q;
|
|
6904
|
+
const $ = Math.min(1, (O - q.startedAt) / q.duration), ae = Math.max(q.progress, $ < 1 ? $ * (0.92 + Math.random() * 0.08) : 1);
|
|
6905
|
+
return q.failAt !== void 0 && ae >= q.failAt ? (m(C.failedAnnouncement(q.name)), { ...q, progress: q.failAt, status: "error", error: C.connectionLost, retryable: !0 }) : ae >= 1 ? (m(C.uploadedAnnouncement(q.name)), { ...q, progress: 1, status: "done" }) : { ...q, progress: ae };
|
|
6906
6906
|
})
|
|
6907
6907
|
);
|
|
6908
6908
|
}, 90);
|
|
6909
6909
|
return () => clearInterval(g);
|
|
6910
6910
|
}, [Z, a]), se(() => {
|
|
6911
|
-
if (!l.some((
|
|
6912
|
-
const g = window.setInterval(() => k((
|
|
6911
|
+
if (!l.some((O) => O.status === "uploading")) return;
|
|
6912
|
+
const g = window.setInterval(() => k((O) => O + 1), 500);
|
|
6913
6913
|
return () => clearInterval(g);
|
|
6914
6914
|
}, [l]), se(() => {
|
|
6915
6915
|
if (!u) return;
|
|
6916
6916
|
const g = [
|
|
6917
|
-
window.setTimeout(() =>
|
|
6917
|
+
window.setTimeout(() => b(Ui.length), 700),
|
|
6918
6918
|
window.setTimeout(() => {
|
|
6919
|
-
|
|
6919
|
+
b(0), Ui.forEach((O, R) => window.setTimeout(() => ee(O), R * 140));
|
|
6920
6920
|
}, 1900)
|
|
6921
6921
|
];
|
|
6922
6922
|
return () => g.forEach(clearTimeout);
|
|
6923
6923
|
}, [u]);
|
|
6924
6924
|
const K = (g) => {
|
|
6925
|
-
B(g.id, { status: "uploading", progress: 0, error: void 0, retryable: !1, failAt: void 0, startedAt: performance.now() }), a && g.file &&
|
|
6925
|
+
B(g.id, { status: "uploading", progress: 0, error: void 0, retryable: !1, failAt: void 0, startedAt: performance.now() }), a && g.file && M({ ...g });
|
|
6926
6926
|
}, te = (g) => {
|
|
6927
|
-
B(g, { removing: !0 }), window.setTimeout(() => x((
|
|
6928
|
-
}, X = () =>
|
|
6929
|
-
oe(g) && (g.preventDefault(),
|
|
6930
|
-
}, W = (g) => {
|
|
6931
|
-
oe(g) && (g.preventDefault(), g.dataTransfer.dropEffect = "copy");
|
|
6932
|
-
}, $ = () => {
|
|
6933
|
-
M.current = Math.max(0, M.current - 1), M.current || v(0);
|
|
6927
|
+
B(g, { removing: !0 }), window.setTimeout(() => x((O) => O.filter((R) => R.id !== g)), 480);
|
|
6928
|
+
}, X = () => z.current.filter((g) => g.status !== "uploading").forEach((g) => te(g.id)), oe = (g) => Array.from(g.dataTransfer.types).includes("Files"), re = (g) => {
|
|
6929
|
+
oe(g) && (g.preventDefault(), L.current += 1, b(Math.max(1, g.dataTransfer.items.length)));
|
|
6934
6930
|
}, Y = (g) => {
|
|
6935
|
-
oe(g) && (g.preventDefault(),
|
|
6936
|
-
},
|
|
6937
|
-
|
|
6931
|
+
oe(g) && (g.preventDefault(), g.dataTransfer.dropEffect = "copy");
|
|
6932
|
+
}, E = () => {
|
|
6933
|
+
L.current = Math.max(0, L.current - 1), L.current || b(0);
|
|
6934
|
+
}, V = (g) => {
|
|
6935
|
+
oe(g) && (g.preventDefault(), L.current = 0, b(0), W(g.dataTransfer.files));
|
|
6936
|
+
}, p = l.filter((g) => !g.removing), S = p.filter((g) => g.status === "uploading"), N = p.filter((g) => g.status === "done"), h = p.filter((g) => g.status === "error"), I = performance.now();
|
|
6937
|
+
let Q = null;
|
|
6938
6938
|
if (p.length)
|
|
6939
|
-
if (
|
|
6940
|
-
const g =
|
|
6941
|
-
|
|
6939
|
+
if (S.length) {
|
|
6940
|
+
const g = S.reduce((q, $) => q + $.size, 0), O = S.reduce((q, $) => q + $.size * $.progress, 0), R = C.uploading(S.length, p.length);
|
|
6941
|
+
Q = /* @__PURE__ */ d("span", { className: "ui-dzc__summary", children: [
|
|
6942
6942
|
/* @__PURE__ */ i("span", { className: "ui-dzc__shimmer", "data-text": R, children: R }),
|
|
6943
6943
|
/* @__PURE__ */ i("span", { className: "ui-dzc__dot", children: "·" }),
|
|
6944
|
-
Pi(
|
|
6944
|
+
Pi(O, g, C)
|
|
6945
6945
|
] });
|
|
6946
6946
|
} else
|
|
6947
|
-
|
|
6947
|
+
Q = /* @__PURE__ */ d("span", { className: "ui-dzc__summary ui-dzc__summary-done", children: [
|
|
6948
6948
|
h.length ? /* @__PURE__ */ i(ct, { d: lt.alertCircle, solid: !0, className: "ui-dzc__warn" }) : /* @__PURE__ */ i(ct, { d: lt.checkCircle, solid: !0, className: "ui-dzc__ok" }),
|
|
6949
|
-
h.length ?
|
|
6949
|
+
h.length ? C.partiallyUploaded(N.length, p.length) : C.allUploaded(N.length)
|
|
6950
6950
|
] });
|
|
6951
6951
|
return /* @__PURE__ */ d("div", { className: ["ui-dzc", s].filter(Boolean).join(" "), children: [
|
|
6952
6952
|
/* @__PURE__ */ i("style", { href: "ui-dropzone-clean", precedence: "default", children: Or }),
|
|
6953
6953
|
/* @__PURE__ */ d("div", { className: "ui-dzc__card", children: [
|
|
6954
|
-
/* @__PURE__ */ i("div", { ref: f, className: "ui-dzc__body", children: /* @__PURE__ */ d("div", { ref:
|
|
6954
|
+
/* @__PURE__ */ i("div", { ref: f, className: "ui-dzc__body", children: /* @__PURE__ */ d("div", { ref: y, className: "ui-dzc__inner", children: [
|
|
6955
6955
|
/* @__PURE__ */ i(
|
|
6956
6956
|
"input",
|
|
6957
6957
|
{
|
|
6958
|
-
ref:
|
|
6959
|
-
id:
|
|
6958
|
+
ref: v,
|
|
6959
|
+
id: H,
|
|
6960
6960
|
type: "file",
|
|
6961
6961
|
multiple: !0,
|
|
6962
6962
|
accept: o?.join(","),
|
|
6963
6963
|
className: "ui-dzc__input",
|
|
6964
6964
|
tabIndex: -1,
|
|
6965
6965
|
onChange: (g) => {
|
|
6966
|
-
g.target.files &&
|
|
6966
|
+
g.target.files && W(g.target.files), g.target.value = "";
|
|
6967
6967
|
}
|
|
6968
6968
|
}
|
|
6969
6969
|
),
|
|
@@ -6973,25 +6973,25 @@ function $r({
|
|
|
6973
6973
|
type: "button",
|
|
6974
6974
|
className: "ui-dzc__area",
|
|
6975
6975
|
"data-dragging": _ > 0 || void 0,
|
|
6976
|
-
"aria-describedby": `${
|
|
6977
|
-
onClick: () =>
|
|
6976
|
+
"aria-describedby": `${H}-hint`,
|
|
6977
|
+
onClick: () => v.current?.click(),
|
|
6978
6978
|
onDragEnter: re,
|
|
6979
|
-
onDragOver:
|
|
6980
|
-
onDragLeave:
|
|
6981
|
-
onDrop:
|
|
6979
|
+
onDragOver: Y,
|
|
6980
|
+
onDragLeave: E,
|
|
6981
|
+
onDrop: V,
|
|
6982
6982
|
children: [
|
|
6983
|
-
/* @__PURE__ */ i(Dr, { labels:
|
|
6984
|
-
/* @__PURE__ */ i("span", { className: "ui-dzc__title", children: _ ?
|
|
6983
|
+
/* @__PURE__ */ i(Dr, { labels: C }),
|
|
6984
|
+
/* @__PURE__ */ i("span", { className: "ui-dzc__title", children: _ ? C.release(_) : /* @__PURE__ */ d(Me, { children: [
|
|
6985
6985
|
/* @__PURE__ */ d("span", { className: "ui-dzc__for-mouse", children: [
|
|
6986
|
-
|
|
6987
|
-
/* @__PURE__ */ i("span", { className: "ui-dzc__browse", children:
|
|
6986
|
+
C.dropFiles,
|
|
6987
|
+
/* @__PURE__ */ i("span", { className: "ui-dzc__browse", children: C.browse })
|
|
6988
6988
|
] }),
|
|
6989
6989
|
/* @__PURE__ */ d("span", { className: "ui-dzc__for-touch", children: [
|
|
6990
|
-
|
|
6991
|
-
/* @__PURE__ */ i("span", { className: "ui-dzc__browse", children:
|
|
6990
|
+
C.tapTo,
|
|
6991
|
+
/* @__PURE__ */ i("span", { className: "ui-dzc__browse", children: C.chooseFiles })
|
|
6992
6992
|
] })
|
|
6993
6993
|
] }) }, _ ? "drop" : "idle"),
|
|
6994
|
-
/* @__PURE__ */ i("span", { className: "ui-dzc__hint", id: `${
|
|
6994
|
+
/* @__PURE__ */ i("span", { className: "ui-dzc__hint", id: `${H}-hint`, children: T })
|
|
6995
6995
|
]
|
|
6996
6996
|
}
|
|
6997
6997
|
),
|
|
@@ -6999,9 +6999,9 @@ function $r({
|
|
|
6999
6999
|
"ul",
|
|
7000
7000
|
{
|
|
7001
7001
|
className: "ui-dzc__list",
|
|
7002
|
-
"aria-label":
|
|
7002
|
+
"aria-label": C.uploads,
|
|
7003
7003
|
children: l.map((g) => {
|
|
7004
|
-
const
|
|
7004
|
+
const O = g.status === "uploading" ? (1 - g.progress) * (I - g.startedAt) / Math.max(0.05, g.progress) / 1e3 : 0;
|
|
7005
7005
|
return /* @__PURE__ */ i("li", { className: "ui-dzc__row", "data-status": g.status, "data-removing": g.removing || void 0, children: /* @__PURE__ */ d("div", { className: "ui-dzc__row-inner", children: [
|
|
7006
7006
|
/* @__PURE__ */ i(Sr, { name: g.name }),
|
|
7007
7007
|
/* @__PURE__ */ d("div", { className: "ui-dzc__info", children: [
|
|
@@ -7014,18 +7014,18 @@ function $r({
|
|
|
7014
7014
|
"span",
|
|
7015
7015
|
{
|
|
7016
7016
|
className: "ui-dzc__done",
|
|
7017
|
-
"aria-label":
|
|
7017
|
+
"aria-label": C.uploaded,
|
|
7018
7018
|
children: /* @__PURE__ */ i(ct, { d: lt.checkCircle, solid: !0 })
|
|
7019
7019
|
}
|
|
7020
7020
|
)
|
|
7021
7021
|
] }),
|
|
7022
7022
|
/* @__PURE__ */ d("div", { className: "ui-dzc__meta", children: [
|
|
7023
7023
|
g.status === "uploading" && /* @__PURE__ */ d(Me, { children: [
|
|
7024
|
-
Pi(g.size * g.progress, g.size,
|
|
7024
|
+
Pi(g.size * g.progress, g.size, C),
|
|
7025
7025
|
/* @__PURE__ */ i("span", { className: "ui-dzc__dot", children: "·" }),
|
|
7026
|
-
g.progress < 0.04 ?
|
|
7026
|
+
g.progress < 0.04 ? C.starting : Cr(O, C)
|
|
7027
7027
|
] }),
|
|
7028
|
-
g.status === "done" && Et(g.size,
|
|
7028
|
+
g.status === "done" && Et(g.size, C),
|
|
7029
7029
|
g.status === "error" && /* @__PURE__ */ i("span", { className: "ui-dzc__error", dir: "auto", children: g.error })
|
|
7030
7030
|
] }, g.status),
|
|
7031
7031
|
(g.status !== "error" || g.retryable) && /* @__PURE__ */ i(
|
|
@@ -7034,7 +7034,7 @@ function $r({
|
|
|
7034
7034
|
className: "ui-dzc__bar",
|
|
7035
7035
|
"data-hidden": g.status === "done" || void 0,
|
|
7036
7036
|
role: "progressbar",
|
|
7037
|
-
"aria-label":
|
|
7037
|
+
"aria-label": C.uploadProgress(g.name),
|
|
7038
7038
|
"aria-valuemin": 0,
|
|
7039
7039
|
"aria-valuemax": 100,
|
|
7040
7040
|
"aria-valuenow": Math.round(g.progress * 100),
|
|
@@ -7048,7 +7048,7 @@ function $r({
|
|
|
7048
7048
|
{
|
|
7049
7049
|
type: "button",
|
|
7050
7050
|
className: "ui-dzc__icon-btn ui-dzc__retry",
|
|
7051
|
-
"aria-label":
|
|
7051
|
+
"aria-label": C.retry(g.name),
|
|
7052
7052
|
onClick: () => K(g),
|
|
7053
7053
|
children: /* @__PURE__ */ i(ct, { d: lt.retry })
|
|
7054
7054
|
}
|
|
@@ -7058,7 +7058,7 @@ function $r({
|
|
|
7058
7058
|
{
|
|
7059
7059
|
type: "button",
|
|
7060
7060
|
className: "ui-dzc__icon-btn",
|
|
7061
|
-
"aria-label":
|
|
7061
|
+
"aria-label": C.remove(g.name),
|
|
7062
7062
|
onClick: () => te(g.id),
|
|
7063
7063
|
children: /* @__PURE__ */ i(ct, { d: lt.close })
|
|
7064
7064
|
}
|
|
@@ -7070,8 +7070,8 @@ function $r({
|
|
|
7070
7070
|
)
|
|
7071
7071
|
] }) }),
|
|
7072
7072
|
/* @__PURE__ */ d("div", { className: "ui-dzc__foot", children: [
|
|
7073
|
-
|
|
7074
|
-
(
|
|
7073
|
+
Q ?? /* @__PURE__ */ i("span", { className: "ui-dzc__foot-idle", children: C.noFiles }),
|
|
7074
|
+
(N.length > 0 || h.length > 0) && !S.length && /* @__PURE__ */ i("button", { type: "button", className: "ui-dzc__clear", onClick: X, children: C.clear })
|
|
7075
7075
|
] })
|
|
7076
7076
|
] }),
|
|
7077
7077
|
/* @__PURE__ */ i("span", { className: "ui-dzc__live", "aria-live": "polite", children: w })
|
|
@@ -7376,34 +7376,34 @@ function Sa({
|
|
|
7376
7376
|
variant: u = "pill",
|
|
7377
7377
|
className: s
|
|
7378
7378
|
}) {
|
|
7379
|
-
const l = Array.isArray(e) ? e.map((Z) => String(Z ?? "")) : [], x = l.length ? l : qi.slice(0, 1), _ = Number.isFinite(t) && t > 0 ? Math.max(t, 200) : 2200, [
|
|
7380
|
-
a &&
|
|
7379
|
+
const l = Array.isArray(e) ? e.map((Z) => String(Z ?? "")) : [], x = l.length ? l : qi.slice(0, 1), _ = Number.isFinite(t) && t > 0 ? Math.max(t, 200) : 2200, [b, w] = A(0), [m, k] = A(() => Date.now()), [v, f] = A(null), y = v ?? Math.max(1, Math.round((Date.now() - m) / 1e3));
|
|
7380
|
+
a && v === null && f(y), !a && v !== null && (f(null), k(Date.now()), w(0)), se(() => {
|
|
7381
7381
|
if (a || o !== void 0 && Number.isFinite(o) || x.length < 2) return;
|
|
7382
7382
|
const Z = window.setInterval(() => {
|
|
7383
7383
|
w((K) => K + 1 < x.length ? K + 1 : n ? 0 : K);
|
|
7384
7384
|
}, _);
|
|
7385
7385
|
return () => window.clearInterval(Z);
|
|
7386
7386
|
}, [a, o, x.length, _, n]);
|
|
7387
|
-
const
|
|
7388
|
-
|
|
7389
|
-
const T =
|
|
7387
|
+
const L = o !== void 0 && Number.isFinite(o) ? Math.floor(o) : b, z = Math.min(Math.max(L, 0), Math.max(x.length - 1, 0)), H = String((a ? typeof r == "function" ? r(y) : r : x[z]) ?? ""), [C, P] = A({ key: 0, text: H }), [F, D] = A(null);
|
|
7388
|
+
H !== C.text && (D(C), P({ key: C.key + 1, text: H }));
|
|
7389
|
+
const T = U(null), B = U(null), ee = U(null), M = U(!1), W = U(() => {
|
|
7390
7390
|
});
|
|
7391
|
-
return
|
|
7391
|
+
return W.current = () => {
|
|
7392
7392
|
const Z = T.current, K = B.current, te = ee.current;
|
|
7393
7393
|
if (!Z || !K || !te) return;
|
|
7394
7394
|
const X = te.scrollWidth + 1, oe = Z.parentElement, re = { width: K.style.width, transition: K.style.transition };
|
|
7395
7395
|
K.style.transition = "none", K.style.width = `${X}px`;
|
|
7396
|
-
const
|
|
7396
|
+
const Y = oe ? getComputedStyle(oe) : null, E = oe && Y ? oe.clientWidth - parseFloat(Y.paddingLeft) - parseFloat(Y.paddingRight) : 0, V = oe ? Math.floor(E - (Z.offsetWidth - K.offsetWidth)) : X;
|
|
7397
7397
|
K.style.width = re.width, K.getBoundingClientRect(), K.style.transition = re.transition;
|
|
7398
|
-
const p =
|
|
7399
|
-
Z.toggleAttribute("data-cut", p), K.style.width = `${p ?
|
|
7398
|
+
const p = V > 0 && X > V;
|
|
7399
|
+
Z.toggleAttribute("data-cut", p), K.style.width = `${p ? V : X}px`;
|
|
7400
7400
|
}, ke(() => {
|
|
7401
7401
|
const Z = B.current;
|
|
7402
|
-
Z && (
|
|
7403
|
-
}, [
|
|
7402
|
+
Z && (M.current || (Z.style.transition = "none"), W.current(), M.current || (Z.getBoundingClientRect(), Z.style.transition = "", M.current = !0));
|
|
7403
|
+
}, [C.key]), se(() => {
|
|
7404
7404
|
const Z = T.current?.parentElement;
|
|
7405
7405
|
if (!Z || typeof ResizeObserver > "u") return;
|
|
7406
|
-
const K = new ResizeObserver(() =>
|
|
7406
|
+
const K = new ResizeObserver(() => W.current());
|
|
7407
7407
|
return K.observe(Z), () => K.disconnect();
|
|
7408
7408
|
}, []), /* @__PURE__ */ d(
|
|
7409
7409
|
"span",
|
|
@@ -7433,28 +7433,28 @@ function Sa({
|
|
|
7433
7433
|
/* @__PURE__ */ i("svg", { className: "ui-tlc__check", viewBox: "0 0 16 16", children: /* @__PURE__ */ i("path", { d: "M3.5 8.4 6.6 11.3 12.5 4.9", pathLength: 1 }) })
|
|
7434
7434
|
] }),
|
|
7435
7435
|
/* @__PURE__ */ d("span", { ref: B, className: "ui-tlc__text", children: [
|
|
7436
|
-
|
|
7436
|
+
F && /* @__PURE__ */ i(
|
|
7437
7437
|
"span",
|
|
7438
7438
|
{
|
|
7439
7439
|
className: "ui-tlc__label ui-tlc__label--out",
|
|
7440
7440
|
"aria-hidden": "true",
|
|
7441
7441
|
dir: "auto",
|
|
7442
|
-
onAnimationEnd: () =>
|
|
7443
|
-
children:
|
|
7442
|
+
onAnimationEnd: () => D(null),
|
|
7443
|
+
children: F.text
|
|
7444
7444
|
},
|
|
7445
|
-
|
|
7445
|
+
F.key
|
|
7446
7446
|
),
|
|
7447
7447
|
/* @__PURE__ */ i(
|
|
7448
7448
|
"span",
|
|
7449
7449
|
{
|
|
7450
7450
|
ref: ee,
|
|
7451
|
-
className: ["ui-tlc__label",
|
|
7452
|
-
"data-text":
|
|
7453
|
-
title:
|
|
7451
|
+
className: ["ui-tlc__label", C.key > 0 && "ui-tlc__label--in", !a && "ui-tlc__shine"].filter(Boolean).join(" "),
|
|
7452
|
+
"data-text": C.text,
|
|
7453
|
+
title: C.text,
|
|
7454
7454
|
dir: "auto",
|
|
7455
|
-
children:
|
|
7455
|
+
children: C.text
|
|
7456
7456
|
},
|
|
7457
|
-
|
|
7457
|
+
C.key
|
|
7458
7458
|
)
|
|
7459
7459
|
] })
|
|
7460
7460
|
]
|
|
@@ -7735,7 +7735,7 @@ Nt(function({
|
|
|
7735
7735
|
sources: s,
|
|
7736
7736
|
chip: l
|
|
7737
7737
|
}) {
|
|
7738
|
-
const x = new Set(r ? r.split(",").map(Number) : []), _ = (
|
|
7738
|
+
const x = new Set(r ? r.split(",").map(Number) : []), _ = (b) => b.map((w) => {
|
|
7739
7739
|
if (w.i >= n) return null;
|
|
7740
7740
|
const m = a && w.i === n - 1 ? /* @__PURE__ */ i("span", { className: "ui-ansc__caret", "aria-hidden": "true" }) : null;
|
|
7741
7741
|
if (w.kind === "word")
|
|
@@ -7743,16 +7743,16 @@ Nt(function({
|
|
|
7743
7743
|
w.text,
|
|
7744
7744
|
m
|
|
7745
7745
|
] }, w.i);
|
|
7746
|
-
const k = s[w.ids[0]],
|
|
7746
|
+
const k = s[w.ids[0]], v = w.ids.map((f) => s[f].title).join(", ");
|
|
7747
7747
|
return /* @__PURE__ */ d("span", { className: "ui-ansc__w", children: [
|
|
7748
7748
|
/* @__PURE__ */ d(
|
|
7749
7749
|
"button",
|
|
7750
7750
|
{
|
|
7751
7751
|
type: "button",
|
|
7752
7752
|
className: "ui-ansc__cite",
|
|
7753
|
-
title:
|
|
7753
|
+
title: v,
|
|
7754
7754
|
"data-lit": w.ids.some((f) => x.has(f)) || void 0,
|
|
7755
|
-
"aria-label": t.source(
|
|
7755
|
+
"aria-label": t.source(v),
|
|
7756
7756
|
"aria-describedby": c === w.ids ? u : void 0,
|
|
7757
7757
|
onMouseEnter: (f) => l.open(w.ids, f.currentTarget),
|
|
7758
7758
|
onMouseLeave: l.close,
|
|
@@ -7770,7 +7770,7 @@ Nt(function({
|
|
|
7770
7770
|
] }, w.i);
|
|
7771
7771
|
});
|
|
7772
7772
|
return o.kind === "p" ? /* @__PURE__ */ i("p", { dir: "auto", children: _(o.tokens) }) : /* @__PURE__ */ i("ul", { children: o.items.map(
|
|
7773
|
-
(
|
|
7773
|
+
(b, w) => b[0] && b[0].i < n ? /* @__PURE__ */ i("li", { dir: "auto", children: _(b) }, w) : null
|
|
7774
7774
|
) });
|
|
7775
7775
|
});
|
|
7776
7776
|
const Ie = {
|
|
@@ -8440,11 +8440,11 @@ function ja(e = "zh-CN") {
|
|
|
8440
8440
|
return e.toLowerCase().startsWith("zh") ? us : ps;
|
|
8441
8441
|
}
|
|
8442
8442
|
function hs({ sessions: e, currentId: t, locale: o, onOpen: n, onRename: a, onDelete: r, onClose: c }) {
|
|
8443
|
-
const [u, s] =
|
|
8443
|
+
const [u, s] = A(), [l, x] = A();
|
|
8444
8444
|
se(() => {
|
|
8445
8445
|
s(void 0), x(void 0);
|
|
8446
8446
|
}, [t]);
|
|
8447
|
-
const _ = cs(o),
|
|
8447
|
+
const _ = cs(o), b = e?.items ?? [], w = Fr(b, { now: Date.now(), copy: _, editingId: u, confirmingId: l });
|
|
8448
8448
|
return e?.error && w.unshift({ id: "history-error", label: "", commands: [{ id: "history-error", label: _.errorText(e.error.code) }] }), /* @__PURE__ */ i(
|
|
8449
8449
|
qo,
|
|
8450
8450
|
{
|
|
@@ -8454,10 +8454,10 @@ function hs({ sessions: e, currentId: t, locale: o, onOpen: n, onRename: a, onDe
|
|
|
8454
8454
|
hotkey: !1,
|
|
8455
8455
|
autoFocus: !0,
|
|
8456
8456
|
labels: ds(o),
|
|
8457
|
-
placeholder:
|
|
8457
|
+
placeholder: b.length ? _.search : e?.loading ? _.loading : _.empty,
|
|
8458
8458
|
onClose: c,
|
|
8459
8459
|
onRun: (m) => {
|
|
8460
|
-
|
|
8460
|
+
b.some((k) => k.id === m) && n(m);
|
|
8461
8461
|
},
|
|
8462
8462
|
onAction: (m, k) => {
|
|
8463
8463
|
k === "rename" ? (x(void 0), s(m)) : k === "delete" ? (s(void 0), x(m)) : k === "confirm-delete" ? (x(void 0), r(m)) : k === "cancel" && x(void 0);
|
|
@@ -8720,7 +8720,7 @@ function ys(e, t, o = Date.now()) {
|
|
|
8720
8720
|
const s = de(a.capabilityName) ?? de(a.toolName) ?? "tool";
|
|
8721
8721
|
if (s === "runtime-capability-discovery") break;
|
|
8722
8722
|
const l = de(a.occurrenceId) ?? de(a.callId) ?? `${s}-${r.turns.length}-${o}`;
|
|
8723
|
-
if (r.turns.some((
|
|
8723
|
+
if (r.turns.some((b) => b.tools.some((w) => w.id === l))) break;
|
|
8724
8724
|
const x = a.input ?? Ue(a.arguments) ?? void 0, _ = {
|
|
8725
8725
|
id: l,
|
|
8726
8726
|
callId: de(a.callId),
|
|
@@ -8731,25 +8731,25 @@ function ys(e, t, o = Date.now()) {
|
|
|
8731
8731
|
startedAt: o,
|
|
8732
8732
|
args: x
|
|
8733
8733
|
};
|
|
8734
|
-
r = ot(r, rt(a, r), (
|
|
8734
|
+
r = ot(r, rt(a, r), (b) => ({ ...b, tools: [...b.tools, _] }));
|
|
8735
8735
|
break;
|
|
8736
8736
|
}
|
|
8737
8737
|
case "TOOL_EXECUTION_COMPLETED":
|
|
8738
8738
|
case "CAPABILITY_RESULT": {
|
|
8739
|
-
const s = de(a.capabilityName) ?? de(a.toolName) ?? "tool", l = de(a.occurrenceId) ?? de(a.callId), x = String(a.status ?? "").toUpperCase() !== "SUCCESS", _ = Pa(a.result),
|
|
8740
|
-
...
|
|
8739
|
+
const s = de(a.capabilityName) ?? de(a.toolName) ?? "tool", l = de(a.occurrenceId) ?? de(a.callId), x = String(a.status ?? "").toUpperCase() !== "SUCCESS", _ = Pa(a.result), b = x ? de(a.errorMessage) ?? _.error ?? "Failed" : void 0, w = (v) => ({
|
|
8740
|
+
...v,
|
|
8741
8741
|
status: x || _.ok === !1 ? "error" : "success",
|
|
8742
|
-
durationMs: me(a.durationMs) ?? o -
|
|
8742
|
+
durationMs: me(a.durationMs) ?? o - v.startedAt,
|
|
8743
8743
|
result: _.value,
|
|
8744
|
-
error:
|
|
8745
|
-
}), m = (
|
|
8746
|
-
r = ot(r, k, (
|
|
8747
|
-
const f =
|
|
8744
|
+
error: b ?? (_.ok === !1 ? _.error ?? "Failed" : void 0)
|
|
8745
|
+
}), m = (v) => v.id === l || v.callId && v.callId === de(a.callId), k = r.turns.find((v) => v.tools.some(m))?.iteration ?? rt(a, r);
|
|
8746
|
+
r = ot(r, k, (v) => {
|
|
8747
|
+
const f = v.tools.findIndex(m);
|
|
8748
8748
|
if (f !== -1) {
|
|
8749
|
-
const
|
|
8750
|
-
return
|
|
8749
|
+
const L = v.tools.slice();
|
|
8750
|
+
return L[f] = w(L[f]), { ...v, tools: L };
|
|
8751
8751
|
}
|
|
8752
|
-
const
|
|
8752
|
+
const y = {
|
|
8753
8753
|
id: l ?? `${s}-${o}`,
|
|
8754
8754
|
callId: de(a.callId),
|
|
8755
8755
|
capability: s,
|
|
@@ -8757,7 +8757,7 @@ function ys(e, t, o = Date.now()) {
|
|
|
8757
8757
|
status: "running",
|
|
8758
8758
|
startedAt: o
|
|
8759
8759
|
};
|
|
8760
|
-
return { ...
|
|
8760
|
+
return { ...v, tools: [...v.tools, w(y)] };
|
|
8761
8761
|
});
|
|
8762
8762
|
break;
|
|
8763
8763
|
}
|
|
@@ -8851,40 +8851,40 @@ function ks(e, t, o = {}) {
|
|
|
8851
8851
|
});
|
|
8852
8852
|
const s = [...r.turns].sort((w, m) => w.iteration - m.iteration);
|
|
8853
8853
|
for (const w of s) {
|
|
8854
|
-
const m = Gi(r, w) ? w.text.split(/\r?\n/).map((
|
|
8854
|
+
const m = Gi(r, w) ? w.text.split(/\r?\n/).map((v) => v.trim()).find((v) => v.length > 0) : void 0, k = Array.from(m ?? "");
|
|
8855
8855
|
c.push({
|
|
8856
8856
|
id: `${a}:turn:${w.iteration}`,
|
|
8857
8857
|
label: m ? k.length > 80 ? `${k.slice(0, 80).join("")}…` : m : t.thinking(w.iteration),
|
|
8858
8858
|
status: w.model?.status === "running" ? "running" : "done",
|
|
8859
8859
|
ms: w.model?.durationMs
|
|
8860
8860
|
});
|
|
8861
|
-
for (const
|
|
8861
|
+
for (const v of o.processView === "replies" ? [] : w.tools)
|
|
8862
8862
|
c.push({
|
|
8863
|
-
id:
|
|
8864
|
-
label:
|
|
8865
|
-
name:
|
|
8866
|
-
args:
|
|
8867
|
-
result:
|
|
8868
|
-
error:
|
|
8869
|
-
startedAt:
|
|
8870
|
-
ms:
|
|
8871
|
-
status:
|
|
8863
|
+
id: v.id,
|
|
8864
|
+
label: v.summary || t.toolFallback(v.name),
|
|
8865
|
+
name: v.name,
|
|
8866
|
+
args: v.args,
|
|
8867
|
+
result: v.result,
|
|
8868
|
+
error: v.error,
|
|
8869
|
+
startedAt: v.startedAt,
|
|
8870
|
+
ms: v.durationMs,
|
|
8871
|
+
status: v.status === "success" ? "done" : v.status === "error" ? "failed" : r.status === "running" ? "running" : r.status === "cancelled" ? "stopped" : "done"
|
|
8872
8872
|
});
|
|
8873
8873
|
}
|
|
8874
8874
|
const l = [];
|
|
8875
8875
|
if (c.length && l.push({ kind: "tools", id: `${a}:process`, tools: c }), o.processView === "replies" && (r.status === "running" || r.status === "waiting")) {
|
|
8876
8876
|
let w = "";
|
|
8877
8877
|
for (const m of s) {
|
|
8878
|
-
const k = ws(m.thinking).trim(),
|
|
8879
|
-
k && (w = k),
|
|
8878
|
+
const k = ws(m.thinking).trim(), v = Gi(r, m) ? m.text.trim() : "";
|
|
8879
|
+
k && (w = k), v && (w = v);
|
|
8880
8880
|
}
|
|
8881
8881
|
w && l.push({ kind: "note", text: w });
|
|
8882
8882
|
}
|
|
8883
|
-
const { body: x, sources: _ } = bs(vi(r)),
|
|
8884
|
-
|
|
8883
|
+
const { body: x, sources: _ } = bs(vi(r)), b = x.trim();
|
|
8884
|
+
b && l.push({ kind: "text", text: b }), _.length && l.push({ kind: "artifacts", names: _.map((w) => w.label) });
|
|
8885
8885
|
for (const w of r.asks)
|
|
8886
8886
|
l.push({ kind: "decision", ask: { id: w.id, question: w.question, task: w.header ?? "", kind: "decision" } });
|
|
8887
|
-
return r.status === "failed" ? l.push({ kind: "error", text: t.failedAnswer, retry: !0 }) : r.status === "completed" && !
|
|
8887
|
+
return r.status === "failed" ? l.push({ kind: "error", text: t.failedAnswer, retry: !0 }) : r.status === "completed" && !b && vs(r) === 0 && l.push({ kind: "error", text: t.emptyAnswer }), { id: a, role: "agent", at: n.createdAt, parts: l, streaming: r.status === "running", stopped: r.status === "cancelled" };
|
|
8888
8888
|
});
|
|
8889
8889
|
}
|
|
8890
8890
|
function zs(e) {
|
|
@@ -8899,21 +8899,21 @@ function zs(e) {
|
|
|
8899
8899
|
}
|
|
8900
8900
|
const Ms = ht(null);
|
|
8901
8901
|
function Cs({ title: e, meta: t, icon: o, onClose: n, children: a, placement: r = "inside", size: c = "default", labels: u }) {
|
|
8902
|
-
const s = Ht(Ms), l =
|
|
8902
|
+
const s = Ht(Ms), l = U(null), x = s?.previewRef ?? l, _ = U(null), b = U(null), [w, m] = A(!1);
|
|
8903
8903
|
ke(() => {
|
|
8904
8904
|
if (r !== "viewport") return;
|
|
8905
8905
|
const f = [];
|
|
8906
|
-
for (let
|
|
8907
|
-
const
|
|
8908
|
-
|
|
8909
|
-
const
|
|
8910
|
-
return f.forEach((
|
|
8906
|
+
for (let z = b.current?.parentElement; z; z = z.parentElement) f.push(z);
|
|
8907
|
+
const y = () => m(f.some((z) => z.matches('.dark, [data-theme="dark"]')));
|
|
8908
|
+
y();
|
|
8909
|
+
const L = new MutationObserver(y);
|
|
8910
|
+
return f.forEach((z) => L.observe(z, { attributes: !0, attributeFilter: ["class", "data-theme"] })), () => L.disconnect();
|
|
8911
8911
|
}, [r]), se(() => (_.current = s?.opener.current ?? (document.activeElement instanceof HTMLElement ? document.activeElement : null), x.current?.querySelector(".ui-crsc__preview-close")?.focus({ preventScroll: !0 }), () => {
|
|
8912
8912
|
_.current?.focus({ preventScroll: !0 });
|
|
8913
8913
|
}), []);
|
|
8914
8914
|
const k = () => {
|
|
8915
8915
|
n(), _.current?.focus({ preventScroll: !0 });
|
|
8916
|
-
},
|
|
8916
|
+
}, v = /* @__PURE__ */ d(Me, { children: [
|
|
8917
8917
|
/* @__PURE__ */ i("style", { href: "ui-collaboration-stream-clean", precedence: "default", children: Is }),
|
|
8918
8918
|
/* @__PURE__ */ i(
|
|
8919
8919
|
"div",
|
|
@@ -8937,8 +8937,8 @@ function Cs({ title: e, meta: t, icon: o, onClose: n, children: a, placement: r
|
|
|
8937
8937
|
if (f.key === "Escape")
|
|
8938
8938
|
f.preventDefault(), f.stopPropagation(), k();
|
|
8939
8939
|
else if (f.key === "Tab") {
|
|
8940
|
-
const
|
|
8941
|
-
(f.shiftKey ?
|
|
8940
|
+
const y = [...x.current?.querySelectorAll("button, [tabindex='0']") ?? []], L = y.indexOf(document.activeElement);
|
|
8941
|
+
(f.shiftKey ? L <= 0 : L === y.length - 1) && (f.preventDefault(), y[f.shiftKey ? y.length - 1 : 0]?.focus());
|
|
8942
8942
|
}
|
|
8943
8943
|
},
|
|
8944
8944
|
children: [
|
|
@@ -8958,9 +8958,9 @@ function Cs({ title: e, meta: t, icon: o, onClose: n, children: a, placement: r
|
|
|
8958
8958
|
)
|
|
8959
8959
|
] });
|
|
8960
8960
|
return r === "viewport" ? /* @__PURE__ */ d(Me, { children: [
|
|
8961
|
-
/* @__PURE__ */ i("span", { ref:
|
|
8962
|
-
typeof document < "u" && xn(
|
|
8963
|
-
] }) :
|
|
8961
|
+
/* @__PURE__ */ i("span", { ref: b, hidden: !0 }),
|
|
8962
|
+
typeof document < "u" && xn(v, document.body)
|
|
8963
|
+
] }) : v;
|
|
8964
8964
|
}
|
|
8965
8965
|
const Ns = (
|
|
8966
8966
|
/* css */
|
|
@@ -9309,7 +9309,7 @@ function As({ files: e, getAttachmentUrls: t, onDownload: o, copy: n }) {
|
|
|
9309
9309
|
)) });
|
|
9310
9310
|
}
|
|
9311
9311
|
function Ss({ file: e, getUrls: t, onDownload: o, closeLabel: n }) {
|
|
9312
|
-
const [a, r] =
|
|
9312
|
+
const [a, r] = A(), [c, u] = A(!1), [s, l] = A(), x = U(null), _ = U(0), b = U(0), w = hi(t).urls.get(e.id), m = !w || Date.now() - w.fetchedAt >= jt;
|
|
9313
9313
|
se(() => {
|
|
9314
9314
|
const f = ++_.current;
|
|
9315
9315
|
return l(void 0), u(!1), () => {
|
|
@@ -9317,8 +9317,8 @@ function Ss({ file: e, getUrls: t, onDownload: o, closeLabel: n }) {
|
|
|
9317
9317
|
};
|
|
9318
9318
|
}, [t, e.id]), se(() => {
|
|
9319
9319
|
let f = !0;
|
|
9320
|
-
return Ls(t, e.id).then((
|
|
9321
|
-
f && r({ getUrls: t, id: e.id, url:
|
|
9320
|
+
return Ls(t, e.id).then((y) => {
|
|
9321
|
+
f && r({ getUrls: t, id: e.id, url: y });
|
|
9322
9322
|
}).catch(() => {
|
|
9323
9323
|
f && r(void 0);
|
|
9324
9324
|
}), () => {
|
|
@@ -9326,15 +9326,15 @@ function Ss({ file: e, getUrls: t, onDownload: o, closeLabel: n }) {
|
|
|
9326
9326
|
};
|
|
9327
9327
|
}, [t, e.id, m]);
|
|
9328
9328
|
const k = async () => {
|
|
9329
|
-
const f = _.current,
|
|
9329
|
+
const f = _.current, y = ++b.current;
|
|
9330
9330
|
try {
|
|
9331
|
-
const
|
|
9332
|
-
if (_.current !== f ||
|
|
9333
|
-
(!
|
|
9331
|
+
const L = hi(t), z = L.urls.get(e.id), H = z && Date.now() - z.fetchedAt < jt ? z.url : await Ba(t, e.id);
|
|
9332
|
+
if (_.current !== f || b.current !== y) return;
|
|
9333
|
+
(!z || Date.now() - z.fetchedAt >= jt) && (L.urls.set(e.id, { url: H, fetchedAt: Date.now() }), r({ getUrls: t, id: e.id, url: H })), x.current?.focus({ preventScroll: !0 }), l(H);
|
|
9334
9334
|
} catch {
|
|
9335
|
-
_.current === f &&
|
|
9335
|
+
_.current === f && b.current === y && u(!0);
|
|
9336
9336
|
}
|
|
9337
|
-
},
|
|
9337
|
+
}, v = a?.getUrls === t && a.id === e.id && !c ? a.url : void 0;
|
|
9338
9338
|
return /* @__PURE__ */ d(Me, { children: [
|
|
9339
9339
|
/* @__PURE__ */ i(
|
|
9340
9340
|
Ae,
|
|
@@ -9342,16 +9342,16 @@ function Ss({ file: e, getUrls: t, onDownload: o, closeLabel: n }) {
|
|
|
9342
9342
|
ref: x,
|
|
9343
9343
|
variant: "ghost",
|
|
9344
9344
|
size: "sm",
|
|
9345
|
-
"aria-label":
|
|
9346
|
-
"aria-haspopup":
|
|
9347
|
-
style:
|
|
9345
|
+
"aria-label": v ? e.name : void 0,
|
|
9346
|
+
"aria-haspopup": v ? "dialog" : void 0,
|
|
9347
|
+
style: v ? { height: "auto", padding: 0 } : void 0,
|
|
9348
9348
|
onClick: () => {
|
|
9349
|
-
|
|
9349
|
+
v ? k() : o(e.id);
|
|
9350
9350
|
},
|
|
9351
|
-
children:
|
|
9351
|
+
children: v ? /* @__PURE__ */ i(
|
|
9352
9352
|
"img",
|
|
9353
9353
|
{
|
|
9354
|
-
src:
|
|
9354
|
+
src: v,
|
|
9355
9355
|
alt: e.name,
|
|
9356
9356
|
width: 64,
|
|
9357
9357
|
height: 64,
|
|
@@ -9391,7 +9391,7 @@ function Ds(e, t, o, n = {}) {
|
|
|
9391
9391
|
return vi(e) ? t.writing : t.thinking;
|
|
9392
9392
|
}
|
|
9393
9393
|
function $s({ run: e, live: t, copy: o, hideTools: n }) {
|
|
9394
|
-
const a = e.status === "running", [r, c] =
|
|
9394
|
+
const a = e.status === "running", [r, c] = A(Date.now);
|
|
9395
9395
|
if (se(() => {
|
|
9396
9396
|
if (!a) return;
|
|
9397
9397
|
c(Date.now());
|
|
@@ -9445,12 +9445,12 @@ function js(e) {
|
|
|
9445
9445
|
return /* @__PURE__ */ i(Rs, { ...e }, `${e.suspension.taskId}:${e.suspension.id}`);
|
|
9446
9446
|
}
|
|
9447
9447
|
function Rs({ suspension: e, locale: t, onAnswer: o, error: n, onCancel: a, onNavigate: r }) {
|
|
9448
|
-
const [c, u] =
|
|
9448
|
+
const [c, u] = A(Zi), [s, l] = A(0), x = ja(t), _ = li(t), b = n?.code === "resume-failed", w = e.kind === "approval" ? e.toolName?.split(":").at(-1) : void 0;
|
|
9449
9449
|
if (e.kind === "approval" && !e.readOnly) return /* @__PURE__ */ i(
|
|
9450
9450
|
oo,
|
|
9451
9451
|
{
|
|
9452
9452
|
title: w ? _.approvalQuestion(w) : _.approvalQuestionGeneric,
|
|
9453
|
-
description:
|
|
9453
|
+
description: b ? _.errorText(n.code, n.status) : _.approvalTask,
|
|
9454
9454
|
details: [
|
|
9455
9455
|
...w ? [{ label: _.factTool, value: w }] : [],
|
|
9456
9456
|
...e.capability ? [{ label: _.factCapability, value: e.capability }] : []
|
|
@@ -9487,35 +9487,35 @@ function Rs({ suspension: e, locale: t, onAnswer: o, error: n, onCancel: a, onNa
|
|
|
9487
9487
|
}];
|
|
9488
9488
|
} else
|
|
9489
9489
|
m = e.steps.filter((f) => !Rt(c, f.id)).map((f) => {
|
|
9490
|
-
const
|
|
9490
|
+
const y = { id: `${e.id}:${f.id}`, question: f.question, body: /* @__PURE__ */ i(ut, { text: f.question }), task: f.header ?? e.title ?? _.questionsTask };
|
|
9491
9491
|
switch (f.type) {
|
|
9492
9492
|
case "single":
|
|
9493
9493
|
case "multi":
|
|
9494
9494
|
return {
|
|
9495
|
-
...
|
|
9496
|
-
options: f.options?.map((
|
|
9495
|
+
...y,
|
|
9496
|
+
options: f.options?.map((L) => ({ id: L.id, title: L.label, summary: L.description })),
|
|
9497
9497
|
own: f.type === "single" && !!f.customField,
|
|
9498
9498
|
...f.type === "multi" ? { multiple: { min: f.minItems, max: f.maxItems } } : {}
|
|
9499
9499
|
};
|
|
9500
9500
|
case "boolean":
|
|
9501
|
-
return { ...
|
|
9501
|
+
return { ...y, options: [{ id: "true", title: x.questions.yes }, { id: "false", title: x.questions.no }], own: !1 };
|
|
9502
9502
|
case "number":
|
|
9503
9503
|
return {
|
|
9504
|
-
...
|
|
9504
|
+
...y,
|
|
9505
9505
|
inputMode: f.integer ? "numeric" : "decimal",
|
|
9506
9506
|
placeholder: x.questions.numberPlaceholder,
|
|
9507
|
-
validate: (
|
|
9508
|
-
const
|
|
9509
|
-
return !
|
|
9507
|
+
validate: (L) => {
|
|
9508
|
+
const z = Number(L);
|
|
9509
|
+
return !L.trim() || !Number.isFinite(z) ? x.questions.invalidNumber : f.integer && !Number.isInteger(z) ? x.questions.invalidInteger : null;
|
|
9510
9510
|
}
|
|
9511
9511
|
};
|
|
9512
9512
|
case "text":
|
|
9513
|
-
return { ...
|
|
9513
|
+
return { ...y, options: f.required ? [] : [{ id: "__skip", title: _.skip }] };
|
|
9514
9514
|
}
|
|
9515
9515
|
});
|
|
9516
|
-
const k = e.kind === "questions" && e.steps.every((f) => Rt(c, f.id)),
|
|
9516
|
+
const k = e.kind === "questions" && e.steps.every((f) => Rt(c, f.id)), v = e.kind === "wait" || e.kind === "approval";
|
|
9517
9517
|
return /* @__PURE__ */ d(Me, { children: [
|
|
9518
|
-
k &&
|
|
9518
|
+
k && b ? /* @__PURE__ */ d(Me, { children: [
|
|
9519
9519
|
/* @__PURE__ */ i(Ae, { size: "sm", onClick: () => o?.({ kind: "questions", ...c }), children: x.questions.resubmit }),
|
|
9520
9520
|
/* @__PURE__ */ i(Ae, { variant: "secondary", size: "sm", onClick: () => {
|
|
9521
9521
|
u(Zi()), l((f) => f + 1);
|
|
@@ -9524,15 +9524,15 @@ function Rs({ suspension: e, locale: t, onAnswer: o, error: n, onCancel: a, onNa
|
|
|
9524
9524
|
Ta,
|
|
9525
9525
|
{
|
|
9526
9526
|
decisions: m,
|
|
9527
|
-
labels:
|
|
9528
|
-
onDecide: (f,
|
|
9527
|
+
labels: v ? { ...x.decision, needsYou: x.questions.waiting } : x.decision,
|
|
9528
|
+
onDecide: (f, y) => {
|
|
9529
9529
|
if (e.kind === "link") {
|
|
9530
|
-
/^\/(?!\/)/.test(e.url) && r ? r(e.url) : window.open(e.url, "_blank", "noopener,noreferrer"), l((
|
|
9530
|
+
/^\/(?!\/)/.test(e.url) && r ? r(e.url) : window.open(e.url, "_blank", "noopener,noreferrer"), l((z) => z + 1);
|
|
9531
9531
|
return;
|
|
9532
9532
|
}
|
|
9533
9533
|
if (e.kind !== "questions") return;
|
|
9534
|
-
const
|
|
9535
|
-
|
|
9534
|
+
const L = Es(e, c, f, y);
|
|
9535
|
+
L && (u(L), e.steps.every((z) => Rt(L, z.id)) && o?.({ kind: "questions", ...L }));
|
|
9536
9536
|
}
|
|
9537
9537
|
},
|
|
9538
9538
|
s
|
|
@@ -9541,36 +9541,36 @@ function Rs({ suspension: e, locale: t, onAnswer: o, error: n, onCancel: a, onNa
|
|
|
9541
9541
|
] });
|
|
9542
9542
|
}
|
|
9543
9543
|
function Fs({ messages: e, older: t, active: o = !0 }) {
|
|
9544
|
-
const n =
|
|
9545
|
-
const
|
|
9546
|
-
|
|
9547
|
-
}, [o]),
|
|
9548
|
-
r.current = !0,
|
|
9549
|
-
}, [
|
|
9550
|
-
const
|
|
9551
|
-
!o || !
|
|
9552
|
-
}, [o, l, t]),
|
|
9553
|
-
const
|
|
9554
|
-
if (!o || !
|
|
9555
|
-
const
|
|
9556
|
-
c.current =
|
|
9544
|
+
const n = U(null), a = U(null), r = U(!0), c = U(0), u = U(o), s = U(null), l = e.find(() => !0)?.id, x = U(l), _ = [...e].reverse().find((z) => z.role === "user")?.id, b = U(_), w = U(!1), [m, k] = A(!1), v = Ne(() => {
|
|
9545
|
+
const z = n.current;
|
|
9546
|
+
z && o && r.current && !s.current && (z.scrollTop = Math.max(0, z.scrollHeight - z.clientHeight), c.current = z.scrollTop);
|
|
9547
|
+
}, [o]), f = Ne(() => {
|
|
9548
|
+
r.current = !0, k(!1), v();
|
|
9549
|
+
}, [v]), y = Ne(() => {
|
|
9550
|
+
const z = n.current;
|
|
9551
|
+
!o || !z || !t?.hasMore || t.loading || s.current || (r.current = !1, s.current = { firstId: l, height: z.scrollHeight, sawLoading: !1 }, k(!0), t.onLoad());
|
|
9552
|
+
}, [o, l, t]), L = Ne(() => {
|
|
9553
|
+
const z = n.current;
|
|
9554
|
+
if (!o || !z) return;
|
|
9555
|
+
const H = z.scrollTop !== c.current, C = z.scrollTop < c.current;
|
|
9556
|
+
c.current = z.scrollTop, H && z.scrollHeight - z.clientHeight - z.scrollTop <= 24 ? r.current = !0 : C && (r.current = !1), k(!r.current), C && z.scrollTop <= 48 && y();
|
|
9557
9557
|
}, [o, y]);
|
|
9558
9558
|
return ke(() => {
|
|
9559
|
-
const
|
|
9559
|
+
const z = n.current, H = o && !u.current;
|
|
9560
9560
|
u.current = o, t || (s.current = null);
|
|
9561
|
-
const
|
|
9562
|
-
if (
|
|
9563
|
-
const
|
|
9564
|
-
|
|
9565
|
-
const
|
|
9566
|
-
|
|
9561
|
+
const C = x.current;
|
|
9562
|
+
if (C !== void 0 && (l === void 0 || C !== l && !s.current) && (r.current = !0, k(!1), c.current = 0, w.current = !0, e.length || (s.current = null)), x.current = l, b.current !== void 0 && _ !== void 0 && b.current !== _ && (r.current = !0, k(!1)), b.current = _, !o || !z) return;
|
|
9563
|
+
const F = w.current;
|
|
9564
|
+
w.current = !1, H && !F && (z.scrollTop = c.current);
|
|
9565
|
+
const D = s.current;
|
|
9566
|
+
D && (D.firstId !== l ? ((D.firstId === void 0 || e.some((T) => T.id === D.firstId)) && (z.scrollTop += z.scrollHeight - D.height, c.current = z.scrollTop, r.current = !1, k(!0)), s.current = null) : t?.loading ? D.sawLoading = !0 : D.sawLoading && (s.current = null)), (!H || F) && v();
|
|
9567
9567
|
}), ke(() => {
|
|
9568
|
-
const
|
|
9569
|
-
return a.current &&
|
|
9570
|
-
}, [
|
|
9568
|
+
const z = new ResizeObserver(v);
|
|
9569
|
+
return a.current && z.observe(a.current), n.current && z.observe(n.current), () => z.disconnect();
|
|
9570
|
+
}, [v]), { viewport: n, content: a, away: m, onScroll: L, jump: f, loadOlder: y };
|
|
9571
9571
|
}
|
|
9572
9572
|
function Ps(e, t) {
|
|
9573
|
-
const o =
|
|
9573
|
+
const o = U(/* @__PURE__ */ new Set()), n = U([]), [a, r] = A([]), [c, u] = A(!1), [s, l] = A(0);
|
|
9574
9574
|
return se(() => {
|
|
9575
9575
|
const m = o.current;
|
|
9576
9576
|
return () => {
|
|
@@ -9581,36 +9581,36 @@ function Ps(e, t) {
|
|
|
9581
9581
|
setOpen: u,
|
|
9582
9582
|
generation: s,
|
|
9583
9583
|
onUpload: async (m, k) => {
|
|
9584
|
-
const
|
|
9585
|
-
|
|
9586
|
-
const f = { file: m, controller: new AbortController(), itemId:
|
|
9584
|
+
const v = [...o.current].find((y) => y.file === m && n.current.some((L) => L.id === y.itemId && L.status === "error"));
|
|
9585
|
+
v && (v.controller.abort(), o.current.delete(v));
|
|
9586
|
+
const f = { file: m, controller: new AbortController(), itemId: v?.itemId };
|
|
9587
9587
|
o.current.add(f);
|
|
9588
9588
|
try {
|
|
9589
9589
|
if (!e) throw new Error(t);
|
|
9590
|
-
const
|
|
9591
|
-
f.controller.signal.aborted || k(
|
|
9590
|
+
const y = await e(m, (L) => {
|
|
9591
|
+
f.controller.signal.aborted || k(L);
|
|
9592
9592
|
}, f.controller.signal);
|
|
9593
|
-
f.controller.signal.throwIfAborted(), f.result =
|
|
9593
|
+
f.controller.signal.throwIfAborted(), f.result = y;
|
|
9594
9594
|
} catch {
|
|
9595
9595
|
throw new Error(t);
|
|
9596
9596
|
}
|
|
9597
9597
|
},
|
|
9598
9598
|
onChange: (m) => {
|
|
9599
|
-
m.some((k) => !n.current.some((
|
|
9599
|
+
m.some((k) => !n.current.some((v) => v.id === k.id)) && u(!0);
|
|
9600
9600
|
for (const k of m) {
|
|
9601
9601
|
if (!k.file || [...o.current].some((f) => f.itemId === k.id)) continue;
|
|
9602
|
-
const
|
|
9603
|
-
|
|
9602
|
+
const v = [...o.current].find((f) => f.itemId === void 0 && f.file === k.file);
|
|
9603
|
+
v && (v.itemId = k.id);
|
|
9604
9604
|
}
|
|
9605
9605
|
for (const k of o.current)
|
|
9606
|
-
k.itemId !== void 0 && !m.some((
|
|
9606
|
+
k.itemId !== void 0 && !m.some((v) => v.id === k.itemId) && (k.controller.abort(), o.current.delete(k));
|
|
9607
9607
|
n.current = m, r(m);
|
|
9608
9608
|
},
|
|
9609
9609
|
reset: () => {
|
|
9610
9610
|
o.current.forEach((m) => m.controller.abort()), o.current.clear(), n.current = [], r([]), l((m) => m + 1), u(!1);
|
|
9611
9611
|
},
|
|
9612
9612
|
completed: () => n.current.flatMap((m) => {
|
|
9613
|
-
const k = [...o.current].find((
|
|
9613
|
+
const k = [...o.current].find((v) => v.itemId === m.id);
|
|
9614
9614
|
return m.status === "done" && k?.result && !k.controller.signal.aborted ? [k.result] : [];
|
|
9615
9615
|
}),
|
|
9616
9616
|
uploading: a.some((m) => m.status === "uploading"),
|
|
@@ -9618,7 +9618,7 @@ function Ps(e, t) {
|
|
|
9618
9618
|
};
|
|
9619
9619
|
}
|
|
9620
9620
|
function Bs(e) {
|
|
9621
|
-
const t =
|
|
9621
|
+
const t = U(/* @__PURE__ */ new Map()), o = U(!1), [n, a] = A(!1);
|
|
9622
9622
|
return se(() => {
|
|
9623
9623
|
o.current = !0;
|
|
9624
9624
|
const c = t.current;
|
|
@@ -9659,64 +9659,64 @@ function qs({
|
|
|
9659
9659
|
onAnswerSuspension: l,
|
|
9660
9660
|
onCancelSuspension: x,
|
|
9661
9661
|
error: _,
|
|
9662
|
-
locale:
|
|
9662
|
+
locale: b = "zh-CN",
|
|
9663
9663
|
credits: w,
|
|
9664
9664
|
branding: m,
|
|
9665
9665
|
onSend: k,
|
|
9666
|
-
onStop:
|
|
9666
|
+
onStop: v,
|
|
9667
9667
|
onNewChat: f,
|
|
9668
|
-
layout:
|
|
9669
|
-
onToggleLayout:
|
|
9670
|
-
onClose:
|
|
9671
|
-
onCreditsClick:
|
|
9672
|
-
onHeaderPointerDown:
|
|
9673
|
-
processView:
|
|
9674
|
-
onRegenerate:
|
|
9675
|
-
onFeedback:
|
|
9668
|
+
layout: y = "split",
|
|
9669
|
+
onToggleLayout: L,
|
|
9670
|
+
onClose: z,
|
|
9671
|
+
onCreditsClick: H,
|
|
9672
|
+
onHeaderPointerDown: C,
|
|
9673
|
+
processView: P,
|
|
9674
|
+
onRegenerate: F,
|
|
9675
|
+
onFeedback: D,
|
|
9676
9676
|
onNavigate: T,
|
|
9677
9677
|
upload: B,
|
|
9678
9678
|
attachmentLimits: ee,
|
|
9679
|
-
getAttachmentUrls:
|
|
9680
|
-
className:
|
|
9679
|
+
getAttachmentUrls: M,
|
|
9680
|
+
className: W
|
|
9681
9681
|
}) {
|
|
9682
|
-
const [Z, K] =
|
|
9683
|
-
const
|
|
9682
|
+
const [Z, K] = A("chat"), te = ja(b), X = Jr(b), oe = Qr(b), re = li(b), Y = m?.title ?? "VIA", E = je(() => {
|
|
9683
|
+
const G = Jo(oe.locale);
|
|
9684
9684
|
return {
|
|
9685
|
-
...
|
|
9685
|
+
...G,
|
|
9686
9686
|
...oe.labels,
|
|
9687
|
-
orchestrator:
|
|
9688
|
-
composer: { ...
|
|
9689
|
-
messageActions: { ...
|
|
9690
|
-
toolCall: { ...
|
|
9687
|
+
orchestrator: Y,
|
|
9688
|
+
composer: { ...G.composer, ...oe.labels.composer },
|
|
9689
|
+
messageActions: { ...G.messageActions, ...oe.labels.messageActions },
|
|
9690
|
+
toolCall: { ...G.toolCall, ...oe.labels.toolCall }
|
|
9691
9691
|
};
|
|
9692
|
-
}, [oe.locale, oe.labels,
|
|
9692
|
+
}, [oe.locale, oe.labels, Y]), V = je(() => new Intl.DateTimeFormat(oe.locale, { hour: "2-digit", minute: "2-digit" }), [oe.locale]), p = c !== void 0 && !c.ready;
|
|
9693
9693
|
Z === "history" && (p || !n) && K("chat");
|
|
9694
|
-
const
|
|
9695
|
-
if (
|
|
9696
|
-
const ce = s ?
|
|
9694
|
+
const S = r?.available === !1, N = p || S || !!s, h = Ps(B, te.attachments.dropzone.uploadFailed), I = U(null), Q = Bs(M), g = h.uploading || h.failed, O = N ? void 0 : F, R = [...e].reverse().find((G) => G.role === "assistant"), q = !p && !!n && Z === "history", $ = je(() => ks(e, oe.copy, { processView: P }).map((G) => {
|
|
9695
|
+
if (G.role !== "agent") return G;
|
|
9696
|
+
const ce = s ? G.parts.filter((pe) => pe.kind !== "decision") : G.parts, xe = _ && G.id === R?.id && Ki.has(_.code) ? ce.map((pe) => pe.kind === "error" ? { ...pe, retry: !1 } : pe) : ce;
|
|
9697
9697
|
return {
|
|
9698
|
-
...
|
|
9699
|
-
parts: _ &&
|
|
9698
|
+
...G,
|
|
9699
|
+
parts: _ && G.id === R?.id ? [...xe, { kind: "error", text: re.errorText(_.code, _.status), retry: Ki.has(_.code) }] : xe
|
|
9700
9700
|
};
|
|
9701
|
-
}), [e, oe.copy,
|
|
9701
|
+
}), [e, oe.copy, P, s, _, R?.id, re]), ae = $.some((G) => G.role === "agent" && G.parts.some((ce) => ce.kind === "tools" && ce.tools.some((xe) => xe.status === "running"))), [fe, ue] = A(Date.now);
|
|
9702
9702
|
se(() => {
|
|
9703
9703
|
if (!ae || p) return;
|
|
9704
9704
|
ue(Date.now());
|
|
9705
|
-
const
|
|
9706
|
-
return () => window.clearInterval(
|
|
9705
|
+
const G = window.setInterval(() => ue(Date.now()), 1e3);
|
|
9706
|
+
return () => window.clearInterval(G);
|
|
9707
9707
|
}, [ae, p]);
|
|
9708
|
-
const ge = je(() => zs(e), [e]), _e = R?.run.status === "running", we = R?.run.status === "waiting" ? te.live.waiting : _e ? te.live.working : o ?
|
|
9709
|
-
return /* @__PURE__ */ d(fr, { className: ["prime-blocks",
|
|
9708
|
+
const ge = je(() => zs(e), [e]), _e = R?.run.status === "running", we = R?.run.status === "waiting" ? te.live.waiting : _e ? te.live.working : o ? Y : void 0, he = Fs({ messages: e, older: p || t ? void 0 : u, active: !q && !p && !t });
|
|
9709
|
+
return /* @__PURE__ */ d(fr, { className: ["prime-blocks", W].filter(Boolean).join(" "), children: [
|
|
9710
9710
|
/* @__PURE__ */ i("style", { href: "prime-blocks-layout", precedence: "default", children: Hs }),
|
|
9711
9711
|
/* @__PURE__ */ d(
|
|
9712
9712
|
"header",
|
|
9713
9713
|
{
|
|
9714
|
-
className: ["prime-blocks__header",
|
|
9715
|
-
onPointerDown:
|
|
9716
|
-
|
|
9714
|
+
className: ["prime-blocks__header", C && "abc-prime-dock__header"].filter(Boolean).join(" "),
|
|
9715
|
+
onPointerDown: C ? (G) => {
|
|
9716
|
+
G.target instanceof Element && G.target.closest('button, a, input, textarea, select, [role="button"]') || C(G);
|
|
9717
9717
|
} : void 0,
|
|
9718
9718
|
children: [
|
|
9719
|
-
|
|
9719
|
+
q ? /* @__PURE__ */ d("div", { className: "prime-blocks__history-heading", children: [
|
|
9720
9720
|
/* @__PURE__ */ i(
|
|
9721
9721
|
Ae,
|
|
9722
9722
|
{
|
|
@@ -9730,38 +9730,38 @@ function qs({
|
|
|
9730
9730
|
),
|
|
9731
9731
|
/* @__PURE__ */ i("span", { className: "prime-blocks__title", title: X.historyTitle, children: X.historyTitle })
|
|
9732
9732
|
] }) : /* @__PURE__ */ d("div", { className: "prime-blocks__titles", children: [
|
|
9733
|
-
/* @__PURE__ */ i("span", { className: "prime-blocks__title", title: o ||
|
|
9733
|
+
/* @__PURE__ */ i("span", { className: "prime-blocks__title", title: o || Y, children: o || Y }),
|
|
9734
9734
|
we && /* @__PURE__ */ i("span", { className: "prime-blocks__subtitle ui-th-who__time", children: we })
|
|
9735
9735
|
] }),
|
|
9736
9736
|
/* @__PURE__ */ d("div", { className: "prime-blocks__actions", children: [
|
|
9737
|
-
w !== void 0 && /* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", onClick:
|
|
9737
|
+
w !== void 0 && /* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", onClick: H, children: X.credits(w, oe.locale) }),
|
|
9738
9738
|
f && /* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", "aria-label": X.newChat, title: X.newChat, icon: /* @__PURE__ */ i(it, { icon: pn, size: 16 }), onClick: () => {
|
|
9739
9739
|
f(), K("chat");
|
|
9740
9740
|
} }),
|
|
9741
|
-
n && !p && /* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", "aria-label": X.history, title: X.history, "aria-pressed":
|
|
9742
|
-
|
|
9741
|
+
n && !p && /* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", "aria-label": X.history, title: X.history, "aria-pressed": q, icon: /* @__PURE__ */ i(it, { icon: hn, size: 16 }), onClick: () => {
|
|
9742
|
+
q ? K("chat") : (K("history"), n.onLoad());
|
|
9743
9743
|
} }),
|
|
9744
|
-
|
|
9745
|
-
|
|
9744
|
+
L && /* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", "aria-label": X.switchLayout, title: y === "split" ? X.layoutFloat : X.layoutSplit, icon: /* @__PURE__ */ i(it, { icon: y === "split" ? mn : fn, size: 16 }), onClick: L }),
|
|
9745
|
+
z && /* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", "aria-label": X.close, title: X.close, icon: /* @__PURE__ */ i(it, { icon: gn, size: 16 }), onClick: z })
|
|
9746
9746
|
] })
|
|
9747
9747
|
]
|
|
9748
9748
|
}
|
|
9749
9749
|
),
|
|
9750
|
-
|
|
9750
|
+
q && /* @__PURE__ */ i("div", { className: "prime-blocks__history", children: /* @__PURE__ */ i(
|
|
9751
9751
|
hs,
|
|
9752
9752
|
{
|
|
9753
9753
|
sessions: n.sessions,
|
|
9754
9754
|
currentId: n.currentId,
|
|
9755
|
-
locale:
|
|
9756
|
-
onOpen: (
|
|
9757
|
-
n.onOpen(
|
|
9755
|
+
locale: b,
|
|
9756
|
+
onOpen: (G) => {
|
|
9757
|
+
n.onOpen(G), K("chat");
|
|
9758
9758
|
},
|
|
9759
9759
|
onRename: n.onRename,
|
|
9760
9760
|
onDelete: n.onDelete,
|
|
9761
9761
|
onClose: () => K("chat")
|
|
9762
9762
|
}
|
|
9763
9763
|
) }),
|
|
9764
|
-
/* @__PURE__ */ d("div", { className: "prime-blocks__conversation", hidden:
|
|
9764
|
+
/* @__PURE__ */ d("div", { className: "prime-blocks__conversation", hidden: q, children: [
|
|
9765
9765
|
/* @__PURE__ */ i("div", { ref: he.viewport, className: "prime-blocks__messages", role: "region", "aria-label": te.conversation, onScroll: he.onScroll, children: /* @__PURE__ */ i("div", { ref: he.content, className: "prime-blocks__column", "data-loading": t || void 0, "data-start": !t && (p || !e.length && a) ? "" : void 0, children: t ? /* @__PURE__ */ i("div", { className: "prime-blocks__loading", children: /* @__PURE__ */ i(Sa, { variant: "plain", phases: [X.loadingSession], phase: 0 }) }) : p ? /* @__PURE__ */ i("div", { className: "prime-blocks__start", children: /* @__PURE__ */ i(Fi, { start: {
|
|
9766
9766
|
greeting: X.provisionTitle,
|
|
9767
9767
|
body: c.lastFailedReason ?? void 0,
|
|
@@ -9773,103 +9773,103 @@ function qs({
|
|
|
9773
9773
|
greeting: a.greeting || X.startGreeting,
|
|
9774
9774
|
body: X.startBody,
|
|
9775
9775
|
avatar: m?.avatar ?? ei,
|
|
9776
|
-
prompts: a.prompts?.map((
|
|
9777
|
-
disabled:
|
|
9778
|
-
}, onStartPrompt: (
|
|
9779
|
-
const ce = a.prompts?.find((xe, pe) => String(pe) ===
|
|
9780
|
-
!
|
|
9776
|
+
prompts: a.prompts?.map((G, ce) => ({ id: String(ce), label: G.label, icon: Vi(G.icon) ?? Vi("sparkle") })),
|
|
9777
|
+
disabled: N
|
|
9778
|
+
}, onStartPrompt: (G) => {
|
|
9779
|
+
const ce = a.prompts?.find((xe, pe) => String(pe) === G);
|
|
9780
|
+
!N && ce && k(ce.prompt, []);
|
|
9781
9781
|
} }) }),
|
|
9782
|
-
/* @__PURE__ */ i(La.Provider, { value: (
|
|
9783
|
-
if (
|
|
9782
|
+
/* @__PURE__ */ i(La.Provider, { value: (G, ce) => {
|
|
9783
|
+
if (G.startsWith("attachment://")) {
|
|
9784
9784
|
ce.preventDefault();
|
|
9785
|
-
const xe =
|
|
9786
|
-
xe &&
|
|
9785
|
+
const xe = G.slice(13);
|
|
9786
|
+
xe && Q.download(xe);
|
|
9787
9787
|
return;
|
|
9788
9788
|
}
|
|
9789
|
-
!T || !/^\/(?!\/)/.test(
|
|
9790
|
-
}, children:
|
|
9791
|
-
if (
|
|
9792
|
-
const { attachments: ve, ...Ce } =
|
|
9793
|
-
return /* @__PURE__ */ d("div", { "data-ui-message":
|
|
9794
|
-
/* @__PURE__ */ i(ir, { message: Ce, labels:
|
|
9789
|
+
!T || !/^\/(?!\/)/.test(G) || (ce.preventDefault(), T(G));
|
|
9790
|
+
}, children: $.map((G) => {
|
|
9791
|
+
if (G.role === "user") {
|
|
9792
|
+
const { attachments: ve, ...Ce } = G, J = e.find((ze) => ze.id === G.id && ze.role === "user");
|
|
9793
|
+
return /* @__PURE__ */ d("div", { "data-ui-message": G.id, className: "prime-blocks__user", children: [
|
|
9794
|
+
/* @__PURE__ */ i(ir, { message: Ce, labels: E, onRetry: ii }),
|
|
9795
9795
|
J?.role === "user" && !!J.attachments?.length && /* @__PURE__ */ i(
|
|
9796
9796
|
As,
|
|
9797
9797
|
{
|
|
9798
9798
|
files: J.attachments,
|
|
9799
|
-
getAttachmentUrls:
|
|
9800
|
-
onDownload:
|
|
9799
|
+
getAttachmentUrls: M,
|
|
9800
|
+
onDownload: Q.download,
|
|
9801
9801
|
copy: te.attachments
|
|
9802
9802
|
}
|
|
9803
9803
|
)
|
|
9804
|
-
] },
|
|
9804
|
+
] }, G.id);
|
|
9805
9805
|
}
|
|
9806
|
-
const ce = e.find((ve) => ve.id ===
|
|
9806
|
+
const ce = e.find((ve) => ve.id === G.id && ve.role === "assistant"), xe = ce?.role === "assistant" ? ce.run : void 0, pe = xe?.status === "running" ? G.parts.some((ve) => ve.kind === "text") ? "writing" : "working" : "done";
|
|
9807
9807
|
return /* @__PURE__ */ i(
|
|
9808
9808
|
nr,
|
|
9809
9809
|
{
|
|
9810
|
-
message:
|
|
9811
|
-
labels:
|
|
9810
|
+
message: G,
|
|
9811
|
+
labels: E,
|
|
9812
9812
|
phase: pe,
|
|
9813
|
-
liveOpen:
|
|
9814
|
-
status: xe && /* @__PURE__ */ i($s, { run: xe, live: te.live, copy: oe.copy, hideTools:
|
|
9813
|
+
liveOpen: P !== "replies",
|
|
9814
|
+
status: xe && /* @__PURE__ */ i($s, { run: xe, live: te.live, copy: oe.copy, hideTools: P === "replies" }),
|
|
9815
9815
|
orchestratorAvatar: m?.avatar ?? ei,
|
|
9816
9816
|
first: !0,
|
|
9817
9817
|
now: fe,
|
|
9818
|
-
clock:
|
|
9819
|
-
onRetry:
|
|
9820
|
-
onRegenerate:
|
|
9821
|
-
onFeedback:
|
|
9818
|
+
clock: V,
|
|
9819
|
+
onRetry: O ? () => O(G.id) : void 0,
|
|
9820
|
+
onRegenerate: O,
|
|
9821
|
+
onFeedback: D ? (ve, Ce, J) => D(ve, Ce, J) : void 0,
|
|
9822
9822
|
feedbackReasons: te.feedbackReasons,
|
|
9823
9823
|
askState: Us,
|
|
9824
9824
|
onTask: ii,
|
|
9825
9825
|
onAsk: ii
|
|
9826
9826
|
},
|
|
9827
|
-
|
|
9827
|
+
G.id
|
|
9828
9828
|
);
|
|
9829
9829
|
}) })
|
|
9830
9830
|
] }) }) }),
|
|
9831
9831
|
/* @__PURE__ */ d("div", { className: "prime-blocks__footer", children: [
|
|
9832
9832
|
!p && !t && /* @__PURE__ */ d(Me, { children: [
|
|
9833
9833
|
he.away && /* @__PURE__ */ i("div", { className: "prime-blocks__latest", children: /* @__PURE__ */ i(Ae, { variant: "secondary", size: "sm", onClick: he.jump, children: te.latest }) }),
|
|
9834
|
-
_ && !R && !(s && _.code === "resume-failed") && /* @__PURE__ */ i("div", { className: "prime-blocks__status", children: /* @__PURE__ */ i("div", { role: "alert", children: li(
|
|
9835
|
-
s ? /* @__PURE__ */ i(js, { suspension: s, locale:
|
|
9836
|
-
if (!(
|
|
9834
|
+
_ && !R && !(s && _.code === "resume-failed") && /* @__PURE__ */ i("div", { className: "prime-blocks__status", children: /* @__PURE__ */ i("div", { role: "alert", children: li(b).errorText(_.code, _.status) }) }),
|
|
9835
|
+
s ? /* @__PURE__ */ i(js, { suspension: s, locale: b, onAnswer: (G) => (he.jump(), l?.(G)), error: _, onCancel: x, onNavigate: T }, `${s.taskId}:${s.id}`) : ge.length > 0 && /* @__PURE__ */ i(Ta, { decisions: Os(ge), labels: te.decision, onDecide: (G, ce) => {
|
|
9836
|
+
if (!(N || typeof ce == "string"))
|
|
9837
9837
|
if (ce.option !== void 0) {
|
|
9838
|
-
const xe = ge.find((pe) => pe.id ===
|
|
9838
|
+
const xe = ge.find((pe) => pe.id === G)?.options?.find((pe) => pe.id === ce.option);
|
|
9839
9839
|
xe && k(xe.title, []);
|
|
9840
9840
|
} else ce.text !== void 0 && k(ce.text, []);
|
|
9841
9841
|
} }),
|
|
9842
|
-
(
|
|
9842
|
+
(S || s) && /* @__PURE__ */ i("div", { role: "status", children: S ? r.message || X.unavailable : te.pendingQuestion })
|
|
9843
9843
|
] }),
|
|
9844
|
-
|
|
9845
|
-
B && /* @__PURE__ */ d("div", { hidden: !h.open ||
|
|
9844
|
+
Q.failed && /* @__PURE__ */ i("div", { className: "prime-blocks__status", role: "alert", children: te.attachments.downloadFailed }),
|
|
9845
|
+
B && /* @__PURE__ */ d("div", { hidden: !h.open || N, inert: N, children: [
|
|
9846
9846
|
/* @__PURE__ */ i(
|
|
9847
9847
|
$r,
|
|
9848
9848
|
{
|
|
9849
9849
|
labels: te.attachments.dropzone,
|
|
9850
|
-
picker:
|
|
9851
|
-
accept: ee?.allowedExtensions.map((
|
|
9850
|
+
picker: I,
|
|
9851
|
+
accept: ee?.allowedExtensions.map((G) => `.${G.replace(/^\.+/, "")}`),
|
|
9852
9852
|
maxSize: ee?.maxSizeBytes,
|
|
9853
9853
|
onUpload: h.onUpload,
|
|
9854
9854
|
onChange: h.onChange
|
|
9855
9855
|
},
|
|
9856
9856
|
h.generation
|
|
9857
9857
|
),
|
|
9858
|
-
/* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", disabled:
|
|
9858
|
+
/* @__PURE__ */ i(Ae, { variant: "ghost", size: "sm", disabled: N, onClick: () => h.setOpen(!1), children: te.attachments.collapse })
|
|
9859
9859
|
] }),
|
|
9860
|
-
!
|
|
9860
|
+
!N && g && /* @__PURE__ */ i("div", { role: "status", children: h.uploading ? te.attachments.waitUploads : te.attachments.fixUploads }),
|
|
9861
9861
|
/* @__PURE__ */ i(
|
|
9862
9862
|
En,
|
|
9863
9863
|
{
|
|
9864
9864
|
addItems: [],
|
|
9865
9865
|
approval: !1,
|
|
9866
9866
|
voice: !1,
|
|
9867
|
-
disabled:
|
|
9867
|
+
disabled: N,
|
|
9868
9868
|
sendDisabled: g,
|
|
9869
9869
|
running: _e,
|
|
9870
|
-
onStop:
|
|
9870
|
+
onStop: v,
|
|
9871
9871
|
onAdd: B ? () => {
|
|
9872
|
-
|
|
9872
|
+
N || I.current?.pick();
|
|
9873
9873
|
} : void 0,
|
|
9874
9874
|
models: [],
|
|
9875
9875
|
folders: [],
|
|
@@ -9877,8 +9877,8 @@ function qs({
|
|
|
9877
9877
|
tray: !1,
|
|
9878
9878
|
placeholder: X.placeholder,
|
|
9879
9879
|
labels: { ...oe.labels.composer, stop: te.stop },
|
|
9880
|
-
onSend: (
|
|
9881
|
-
|
|
9880
|
+
onSend: (G) => {
|
|
9881
|
+
N || g || (k(G, h.completed()), h.reset());
|
|
9882
9882
|
}
|
|
9883
9883
|
}
|
|
9884
9884
|
)
|
|
@@ -9914,14 +9914,14 @@ const Hs = `
|
|
|
9914
9914
|
.prime-blocks__status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
9915
9915
|
`, Ji = /* @__PURE__ */ new WeakMap();
|
|
9916
9916
|
function Ws({ enabled: e, panelMode: t, panelVisible: o }) {
|
|
9917
|
-
const n = mt(), { controller: a, client: r } = gi(), { state: c } = xa(), { showPanel: u, hidePanel: s, setPanelMode: l } = wa(), [x, _] =
|
|
9917
|
+
const n = mt(), { controller: a, client: r } = gi(), { state: c } = xa(), { showPanel: u, hidePanel: s, setPanelMode: l } = wa(), [x, _] = A();
|
|
9918
9918
|
return se(() => {
|
|
9919
|
-
let
|
|
9919
|
+
let b = !0, w = Ji.get(r);
|
|
9920
9920
|
return w || (w = r.getAttachmentLimits().catch(() => {
|
|
9921
9921
|
}), Ji.set(r, w)), w.then((m) => {
|
|
9922
|
-
|
|
9922
|
+
b && m && _({ client: r, limits: m });
|
|
9923
9923
|
}), () => {
|
|
9924
|
-
|
|
9924
|
+
b = !1;
|
|
9925
9925
|
};
|
|
9926
9926
|
}, [r]), /* @__PURE__ */ i(
|
|
9927
9927
|
In,
|
|
@@ -9932,7 +9932,7 @@ function Ws({ enabled: e, panelMode: t, panelVisible: o }) {
|
|
|
9932
9932
|
labels: os(n.locale),
|
|
9933
9933
|
onRestore: u,
|
|
9934
9934
|
onPanelModeChange: l,
|
|
9935
|
-
children: (
|
|
9935
|
+
children: (b) => /* @__PURE__ */ i(
|
|
9936
9936
|
qs,
|
|
9937
9937
|
{
|
|
9938
9938
|
messages: c.messages,
|
|
@@ -9940,7 +9940,7 @@ function Ws({ enabled: e, panelMode: t, panelVisible: o }) {
|
|
|
9940
9940
|
error: c.error,
|
|
9941
9941
|
title: c.title,
|
|
9942
9942
|
loading: c.phase === "loading",
|
|
9943
|
-
layout:
|
|
9943
|
+
layout: b.isSplitLayout ? "split" : "float",
|
|
9944
9944
|
history: {
|
|
9945
9945
|
sessions: c.sessions,
|
|
9946
9946
|
currentId: c.sessionId,
|
|
@@ -9972,24 +9972,24 @@ function Ws({ enabled: e, panelMode: t, panelVisible: o }) {
|
|
|
9972
9972
|
onCancelSuspension: a.cancelSuspension,
|
|
9973
9973
|
onStop: a.stop,
|
|
9974
9974
|
onNewChat: a.newChat,
|
|
9975
|
-
onToggleLayout:
|
|
9975
|
+
onToggleLayout: b.toggleLayout,
|
|
9976
9976
|
onClose: s,
|
|
9977
|
-
onHeaderPointerDown:
|
|
9977
|
+
onHeaderPointerDown: b.isDockInteractive && !b.isSplitLayout ? b.handleDockDragStart : void 0,
|
|
9978
9978
|
onRegenerate: (w) => {
|
|
9979
|
-
const m = c.messages.findIndex((
|
|
9979
|
+
const m = c.messages.findIndex((v) => v.id === w && v.role === "assistant");
|
|
9980
9980
|
if (m < 0) return;
|
|
9981
|
-
const k = c.messages.slice(0, m).reverse().find((
|
|
9981
|
+
const k = c.messages.slice(0, m).reverse().find((v) => v.role === "user");
|
|
9982
9982
|
k && a.send(k.text).catch(() => {
|
|
9983
9983
|
});
|
|
9984
9984
|
},
|
|
9985
9985
|
onFeedback: (w, m, k) => {
|
|
9986
9986
|
if (m === null) return;
|
|
9987
|
-
const
|
|
9988
|
-
if (!
|
|
9989
|
-
const f =
|
|
9987
|
+
const v = c.messages.find((y) => y.id === w && y.role === "assistant");
|
|
9988
|
+
if (!v || v.role !== "assistant") return;
|
|
9989
|
+
const f = v.run.taskId;
|
|
9990
9990
|
r.submitFeedback({
|
|
9991
9991
|
taskId: f,
|
|
9992
|
-
messageId: /^\d+$/.test(
|
|
9992
|
+
messageId: /^\d+$/.test(v.id) ? v.id : f,
|
|
9993
9993
|
rating: m === "up" ? 1 : -1,
|
|
9994
9994
|
...k ? { comment: k } : {}
|
|
9995
9995
|
}).catch(() => {
|
|
@@ -10095,8 +10095,8 @@ function Gs(e) {
|
|
|
10095
10095
|
...Object.keys(l).length > 0 ? { params: l } : {}
|
|
10096
10096
|
}));
|
|
10097
10097
|
return {
|
|
10098
|
-
items: (Array.isArray(x.items) ? x.items : []).flatMap((
|
|
10099
|
-
const w = Te(
|
|
10098
|
+
items: (Array.isArray(x.items) ? x.items : []).flatMap((b) => {
|
|
10099
|
+
const w = Te(b), m = Ze(w.id);
|
|
10100
10100
|
return m === void 0 ? [] : [{
|
|
10101
10101
|
id: m,
|
|
10102
10102
|
title: be(w.title),
|
|
@@ -10113,16 +10113,16 @@ function Gs(e) {
|
|
|
10113
10113
|
const _ = {
|
|
10114
10114
|
...l.limit !== void 0 ? { limit: l.limit } : {},
|
|
10115
10115
|
...l.before !== void 0 ? { before: l.before } : {}
|
|
10116
|
-
},
|
|
10116
|
+
}, b = Te(await t({
|
|
10117
10117
|
method: "get",
|
|
10118
10118
|
url: x,
|
|
10119
10119
|
showLoading: !1,
|
|
10120
10120
|
...Object.keys(_).length > 0 ? { params: _ } : {}
|
|
10121
|
-
})), w = Array.isArray(
|
|
10121
|
+
})), w = Array.isArray(b.messages) ? b.messages : [];
|
|
10122
10122
|
return {
|
|
10123
|
-
id: Ze(
|
|
10124
|
-
title: be(
|
|
10125
|
-
hasMore: w.length > 0 &&
|
|
10123
|
+
id: Ze(b.id) ?? s,
|
|
10124
|
+
title: be(b.title),
|
|
10125
|
+
hasMore: w.length > 0 && b.hasMore === !0,
|
|
10126
10126
|
records: w
|
|
10127
10127
|
};
|
|
10128
10128
|
},
|
|
@@ -10174,7 +10174,7 @@ function Gs(e) {
|
|
|
10174
10174
|
if (Ze(s.sessionId) === void 0) throw new $e("invalid-session-id");
|
|
10175
10175
|
const { file: l, onProgress: x } = s, _ = new FormData();
|
|
10176
10176
|
l.name !== void 0 ? _.append("file", l, l.name) : _.append("file", l);
|
|
10177
|
-
const
|
|
10177
|
+
const b = Te(await t({
|
|
10178
10178
|
method: "post",
|
|
10179
10179
|
url: `${a}/threads/${encodeURIComponent(s.sessionId)}/attachments`,
|
|
10180
10180
|
data: _,
|
|
@@ -10182,19 +10182,19 @@ function Gs(e) {
|
|
|
10182
10182
|
showLoading: !1,
|
|
10183
10183
|
...s.signal !== void 0 ? { signal: s.signal } : {},
|
|
10184
10184
|
...x !== void 0 ? {
|
|
10185
|
-
onUploadProgress: ({ loaded: k, total:
|
|
10186
|
-
|
|
10185
|
+
onUploadProgress: ({ loaded: k, total: v }) => {
|
|
10186
|
+
v !== void 0 && v > 0 && Number.isFinite(v) && Number.isFinite(k) && x(Math.max(0, Math.min(1, k / v)));
|
|
10187
10187
|
}
|
|
10188
10188
|
} : {}
|
|
10189
|
-
})), w = De(
|
|
10189
|
+
})), w = De(b.id) ?? De(b.attachmentId);
|
|
10190
10190
|
if (w === void 0) throw new $e("missing-attachment-id");
|
|
10191
10191
|
const m = {
|
|
10192
10192
|
id: w,
|
|
10193
|
-
name: De(
|
|
10194
|
-
mimeType: De(
|
|
10195
|
-
size: be(
|
|
10196
|
-
status: be(
|
|
10197
|
-
ready:
|
|
10193
|
+
name: De(b.filename) ?? De(b.fileName) ?? De(b.name) ?? l.name ?? "",
|
|
10194
|
+
mimeType: De(b.contentType) ?? De(b.mimeType) ?? De(l.type),
|
|
10195
|
+
size: be(b.size),
|
|
10196
|
+
status: be(b.status),
|
|
10197
|
+
ready: b.markdownAvailable === !0 || b.ingestionStatus === "indexed" || b.ingestionStatus === "parsed"
|
|
10198
10198
|
};
|
|
10199
10199
|
return x?.(1), m;
|
|
10200
10200
|
},
|
|
@@ -10267,7 +10267,7 @@ function Gs(e) {
|
|
|
10267
10267
|
}
|
|
10268
10268
|
},
|
|
10269
10269
|
async resumeTask(s, l) {
|
|
10270
|
-
const x = Object.fromEntries(Object.entries(l.identity ?? {}).filter(([,
|
|
10270
|
+
const x = Object.fromEntries(Object.entries(l.identity ?? {}).filter(([, b]) => De(b) !== void 0)), _ = Te(await t({
|
|
10271
10271
|
method: "post",
|
|
10272
10272
|
url: `${c(s)}/resume`,
|
|
10273
10273
|
showLoading: !1,
|
|
@@ -10288,38 +10288,38 @@ function Gs(e) {
|
|
|
10288
10288
|
};
|
|
10289
10289
|
},
|
|
10290
10290
|
async subscribeTaskEvents(s) {
|
|
10291
|
-
const { cursor: l, onEvent: x, signal: _, delays:
|
|
10291
|
+
const { cursor: l, onEvent: x, signal: _, delays: b = [1e3, 2e3, 4e3] } = s;
|
|
10292
10292
|
if (_?.aborted) return { kind: "aborted" };
|
|
10293
10293
|
const w = `${c(s.taskId)}/events`;
|
|
10294
|
-
let m, k = 0,
|
|
10294
|
+
let m, k = 0, v = !1;
|
|
10295
10295
|
const f = () => {
|
|
10296
10296
|
m?.cancel().catch(() => {
|
|
10297
10297
|
});
|
|
10298
|
-
},
|
|
10299
|
-
const
|
|
10300
|
-
_.addEventListener("abort",
|
|
10301
|
-
(
|
|
10302
|
-
_.removeEventListener("abort",
|
|
10298
|
+
}, y = (L) => _ ? new Promise((z, H) => {
|
|
10299
|
+
const C = () => H(_.reason);
|
|
10300
|
+
_.addEventListener("abort", C, { once: !0 }), L.then(
|
|
10301
|
+
(P) => {
|
|
10302
|
+
_.removeEventListener("abort", C), z(P);
|
|
10303
10303
|
},
|
|
10304
|
-
(
|
|
10305
|
-
_.removeEventListener("abort",
|
|
10304
|
+
(P) => {
|
|
10305
|
+
_.removeEventListener("abort", C), H(P);
|
|
10306
10306
|
}
|
|
10307
|
-
), _.aborted && (_.removeEventListener("abort",
|
|
10308
|
-
}) :
|
|
10307
|
+
), _.aborted && (_.removeEventListener("abort", C), C());
|
|
10308
|
+
}) : L;
|
|
10309
10309
|
_?.addEventListener("abort", f, { once: !0 });
|
|
10310
10310
|
try {
|
|
10311
10311
|
for (; !_?.aborted; ) {
|
|
10312
|
-
const
|
|
10313
|
-
let
|
|
10312
|
+
const L = at(l());
|
|
10313
|
+
let z = { kind: "lost" };
|
|
10314
10314
|
try {
|
|
10315
|
-
const
|
|
10315
|
+
const P = await y(Promise.resolve(o?.(w) ?? {}));
|
|
10316
10316
|
if (_?.aborted) return { kind: "aborted" };
|
|
10317
|
-
const
|
|
10318
|
-
|
|
10319
|
-
const
|
|
10320
|
-
|
|
10321
|
-
const T = await
|
|
10322
|
-
headers:
|
|
10317
|
+
const F = new Headers({ Accept: "text/event-stream", ...P });
|
|
10318
|
+
F.delete("Last-Event-ID");
|
|
10319
|
+
const D = at(l());
|
|
10320
|
+
D !== void 0 && F.set("Last-Event-ID", D);
|
|
10321
|
+
const T = await y((n ?? globalThis.fetch)(`${r}${w}`, {
|
|
10322
|
+
headers: F,
|
|
10323
10323
|
credentials: "include",
|
|
10324
10324
|
signal: _
|
|
10325
10325
|
}));
|
|
@@ -10329,10 +10329,10 @@ function Gs(e) {
|
|
|
10329
10329
|
m = T.body.getReader();
|
|
10330
10330
|
const B = new TextDecoder(), ee = Ys();
|
|
10331
10331
|
for (; !_?.aborted; ) {
|
|
10332
|
-
const { value:
|
|
10332
|
+
const { value: M, done: W } = await y(m.read());
|
|
10333
10333
|
if (_?.aborted) return { kind: "aborted" };
|
|
10334
|
-
const Z = ee.push(
|
|
10335
|
-
|
|
10334
|
+
const Z = ee.push(W ? B.decode() : B.decode(M, { stream: !0 }));
|
|
10335
|
+
W && Z.push(...ee.flush());
|
|
10336
10336
|
for (const K of Z) {
|
|
10337
10337
|
if (_?.aborted) return { kind: "aborted" };
|
|
10338
10338
|
x(K);
|
|
@@ -10340,37 +10340,37 @@ function Gs(e) {
|
|
|
10340
10340
|
if (te === "RUN_FINISHED")
|
|
10341
10341
|
return m.cancel().catch(() => {
|
|
10342
10342
|
}), { kind: "finished" };
|
|
10343
|
-
te === "TASK_SUSPENDED" && (
|
|
10343
|
+
te === "TASK_SUSPENDED" && (v = !0), te === "TASK_RESUMED" && (v = !1);
|
|
10344
10344
|
}
|
|
10345
|
-
if (
|
|
10346
|
-
if (
|
|
10345
|
+
if (W) {
|
|
10346
|
+
if (v) return { kind: "suspended" };
|
|
10347
10347
|
break;
|
|
10348
10348
|
}
|
|
10349
10349
|
}
|
|
10350
10350
|
}
|
|
10351
10351
|
} else {
|
|
10352
|
-
if (
|
|
10353
|
-
if (T.status < 500 || T.status >= 600) return
|
|
10352
|
+
if (z.status = T.status, z.message = await y(T.text()), _?.aborted) return { kind: "aborted" };
|
|
10353
|
+
if (T.status < 500 || T.status >= 600) return z;
|
|
10354
10354
|
}
|
|
10355
|
-
} catch (
|
|
10355
|
+
} catch (P) {
|
|
10356
10356
|
if (_?.aborted) return { kind: "aborted" };
|
|
10357
|
-
const
|
|
10358
|
-
if (
|
|
10357
|
+
const F = typeof P == "string" ? P : be(Te(P).message);
|
|
10358
|
+
if (F !== void 0 && (z.message = F), z.status !== void 0 && (z.status < 500 || z.status >= 600)) return z;
|
|
10359
10359
|
} finally {
|
|
10360
10360
|
m?.releaseLock(), m = void 0;
|
|
10361
10361
|
}
|
|
10362
10362
|
if (_?.aborted) return { kind: "aborted" };
|
|
10363
|
-
const
|
|
10364
|
-
if (
|
|
10365
|
-
let
|
|
10363
|
+
const H = at(l());
|
|
10364
|
+
if (H !== void 0 && (L === void 0 || bi(H, L)) && (k = 0), k >= b.length) return z;
|
|
10365
|
+
let C;
|
|
10366
10366
|
try {
|
|
10367
|
-
await
|
|
10368
|
-
|
|
10367
|
+
await y(new Promise((P) => {
|
|
10368
|
+
C = setTimeout(P, b[k]);
|
|
10369
10369
|
}));
|
|
10370
10370
|
} catch {
|
|
10371
10371
|
return { kind: "aborted" };
|
|
10372
10372
|
} finally {
|
|
10373
|
-
clearTimeout(
|
|
10373
|
+
clearTimeout(C);
|
|
10374
10374
|
}
|
|
10375
10375
|
k++;
|
|
10376
10376
|
}
|
|
@@ -10557,8 +10557,8 @@ function oa(e) {
|
|
|
10557
10557
|
if (!n || !t) return;
|
|
10558
10558
|
const a = o.interaction == null ? void 0 : Se(o.interaction), r = Se(o.promptPayload), c = {};
|
|
10559
10559
|
for (const f of ["requestId", "sessionId", "checkpointId", "checkpointDigest"]) {
|
|
10560
|
-
const
|
|
10561
|
-
|
|
10560
|
+
const y = Ee(o[f]);
|
|
10561
|
+
y !== void 0 && (c[f] = y);
|
|
10562
10562
|
}
|
|
10563
10563
|
const u = {
|
|
10564
10564
|
id: n,
|
|
@@ -10594,27 +10594,27 @@ function oa(e) {
|
|
|
10594
10594
|
...typeof a?.waitingOn == "string" ? { waitingOn: a.waitingOn } : {}
|
|
10595
10595
|
};
|
|
10596
10596
|
if (x !== "FORM" || !a && !Object.keys(r).length) return;
|
|
10597
|
-
const _ = Se(a ? a.requestedSchema : o.resumeSchema),
|
|
10597
|
+
const _ = Se(a ? a.requestedSchema : o.resumeSchema), b = Se(_.properties);
|
|
10598
10598
|
let w = s.steps;
|
|
10599
10599
|
if (w === void 0 && Array.isArray(s.options)) {
|
|
10600
|
-
const f = Object.entries(
|
|
10600
|
+
const f = Object.entries(b).find(([L, z]) => !L.endsWith("_custom") && Array.isArray(Se(z).oneOf));
|
|
10601
10601
|
if (!f) return;
|
|
10602
|
-
const [
|
|
10603
|
-
w = [{ ...s, id:
|
|
10602
|
+
const [y] = f;
|
|
10603
|
+
w = [{ ...s, id: y }];
|
|
10604
10604
|
}
|
|
10605
10605
|
const m = /* @__PURE__ */ new Map();
|
|
10606
10606
|
if (Array.isArray(w)) for (const f of w) {
|
|
10607
|
-
const
|
|
10608
|
-
|
|
10607
|
+
const y = Se(f), L = Ee(y.id);
|
|
10608
|
+
L && Object.hasOwn(b, L) && m.set(L, y);
|
|
10609
10609
|
}
|
|
10610
|
-
const k = /* @__PURE__ */ new Set([...m.keys(), ...Object.keys(
|
|
10610
|
+
const k = /* @__PURE__ */ new Set([...m.keys(), ...Object.keys(b)]), v = [];
|
|
10611
10611
|
for (const f of k) {
|
|
10612
10612
|
if (f.endsWith("_custom")) continue;
|
|
10613
|
-
const
|
|
10614
|
-
if (!
|
|
10615
|
-
|
|
10613
|
+
const y = tc(f, m.get(f) ?? {}, _);
|
|
10614
|
+
if (!y) return;
|
|
10615
|
+
v.push(y);
|
|
10616
10616
|
}
|
|
10617
|
-
return
|
|
10617
|
+
return v.length ? { ...l, kind: "questions", steps: v } : void 0;
|
|
10618
10618
|
}
|
|
10619
10619
|
function ic(e, t) {
|
|
10620
10620
|
if (t === void 0) return;
|
|
@@ -10704,28 +10704,28 @@ function oc(e) {
|
|
|
10704
10704
|
lastFailedReason: null,
|
|
10705
10705
|
expiresAt: null
|
|
10706
10706
|
});
|
|
10707
|
-
let u = !1, s = 0, l = 0, x = null, _ = null,
|
|
10708
|
-
const
|
|
10707
|
+
let u = !1, s = 0, l = 0, x = null, _ = null, b, w, m = 0, k = 0, v = new AbortController(), f, y, L;
|
|
10708
|
+
const z = /* @__PURE__ */ new Set(), H = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new WeakSet(), F = (p) => !u && p === v && !p.signal.aborted, D = () => r && c.provisioning?.ready !== !0;
|
|
10709
10709
|
function T(p) {
|
|
10710
10710
|
if (!u) {
|
|
10711
10711
|
c = { ...c, ...p };
|
|
10712
|
-
for (const
|
|
10712
|
+
for (const S of [...z]) {
|
|
10713
10713
|
if (u) break;
|
|
10714
|
-
|
|
10714
|
+
S();
|
|
10715
10715
|
}
|
|
10716
10716
|
}
|
|
10717
10717
|
}
|
|
10718
10718
|
function B(p) {
|
|
10719
|
-
return c.messages.find((
|
|
10719
|
+
return c.messages.find((S) => S.id === p.messageId && S.role === "assistant");
|
|
10720
10720
|
}
|
|
10721
|
-
function ee(p,
|
|
10722
|
-
return c.messages.map((
|
|
10721
|
+
function ee(p, S) {
|
|
10722
|
+
return c.messages.map((N) => N.id === p && N.role === "assistant" ? { ...N, run: S } : N);
|
|
10723
10723
|
}
|
|
10724
|
-
function
|
|
10725
|
-
return
|
|
10724
|
+
function M() {
|
|
10725
|
+
return v.abort(), f?.stream.abort(), f = void 0, y = void 0, L = void 0, v = new AbortController(), v;
|
|
10726
10726
|
}
|
|
10727
|
-
function
|
|
10728
|
-
u || (l++,
|
|
10727
|
+
function W() {
|
|
10728
|
+
u || (l++, M(), c = {
|
|
10729
10729
|
...ra(),
|
|
10730
10730
|
...c.provisioning ? { provisioning: c.provisioning } : {},
|
|
10731
10731
|
...c.sessions ? { sessions: c.sessions } : {}
|
|
@@ -10734,37 +10734,37 @@ function oc(e) {
|
|
|
10734
10734
|
async function Z(p) {
|
|
10735
10735
|
if (u) return;
|
|
10736
10736
|
if (x = p, p === null) {
|
|
10737
|
-
|
|
10737
|
+
b = void 0, _ = null, W();
|
|
10738
10738
|
return;
|
|
10739
10739
|
}
|
|
10740
|
-
if (
|
|
10741
|
-
|
|
10740
|
+
if (D()) {
|
|
10741
|
+
b = p;
|
|
10742
10742
|
return;
|
|
10743
10743
|
}
|
|
10744
|
-
|
|
10745
|
-
const
|
|
10746
|
-
if (
|
|
10747
|
-
_ =
|
|
10748
|
-
const
|
|
10744
|
+
b = void 0;
|
|
10745
|
+
const S = Js(p);
|
|
10746
|
+
if (S === null || S === _) return;
|
|
10747
|
+
_ = S;
|
|
10748
|
+
const N = w;
|
|
10749
10749
|
w = void 0;
|
|
10750
10750
|
const h = ++l;
|
|
10751
|
-
if (!(
|
|
10751
|
+
if (!(N !== void 0 && N > Date.now()))
|
|
10752
10752
|
try {
|
|
10753
|
-
const
|
|
10753
|
+
const I = await t.getScopeSession(p);
|
|
10754
10754
|
if (u || h !== l) return;
|
|
10755
|
-
|
|
10756
|
-
} catch (
|
|
10757
|
-
!u && h === l && (_ = null, T({ error: { code: "scope-failed", status: Fe(
|
|
10755
|
+
I === null ? W() : await Y(I);
|
|
10756
|
+
} catch (I) {
|
|
10757
|
+
!u && h === l && (_ = null, T({ error: { code: "scope-failed", status: Fe(I) } }));
|
|
10758
10758
|
}
|
|
10759
10759
|
}
|
|
10760
10760
|
async function K(p) {
|
|
10761
|
-
const
|
|
10761
|
+
const S = ++m;
|
|
10762
10762
|
if (p && T({ provisioning: { ...c.provisioning, triggering: !0, error: void 0 } }), u) return;
|
|
10763
|
-
let
|
|
10763
|
+
let N;
|
|
10764
10764
|
try {
|
|
10765
|
-
|
|
10765
|
+
N = await (p ? t.triggerProvisioning() : t.getProvisioning());
|
|
10766
10766
|
} catch (h) {
|
|
10767
|
-
!u &&
|
|
10767
|
+
!u && S === m && T({ provisioning: {
|
|
10768
10768
|
...c.provisioning,
|
|
10769
10769
|
triggering: !1,
|
|
10770
10770
|
...p ? {} : { checked: !0, ready: !1 },
|
|
@@ -10772,193 +10772,193 @@ function oc(e) {
|
|
|
10772
10772
|
} });
|
|
10773
10773
|
return;
|
|
10774
10774
|
}
|
|
10775
|
-
if (!(u ||
|
|
10776
|
-
const h =
|
|
10777
|
-
|
|
10775
|
+
if (!(u || S !== m) && (T({ provisioning: { ...N, checked: !0, triggering: !1 } }), !u && c.provisioning?.ready && b)) {
|
|
10776
|
+
const h = b;
|
|
10777
|
+
b = void 0, await Z(h);
|
|
10778
10778
|
}
|
|
10779
10779
|
}
|
|
10780
|
-
function te(p,
|
|
10780
|
+
function te(p, S, N) {
|
|
10781
10781
|
const h = {
|
|
10782
10782
|
messageId: p,
|
|
10783
|
-
taskId:
|
|
10784
|
-
view:
|
|
10783
|
+
taskId: N,
|
|
10784
|
+
view: S,
|
|
10785
10785
|
stream: new AbortController(),
|
|
10786
10786
|
ready: sa(),
|
|
10787
10787
|
finished: sa(),
|
|
10788
10788
|
finalReceived: !1
|
|
10789
10789
|
};
|
|
10790
|
-
return
|
|
10790
|
+
return N && h.ready.resolve(), f = h, h;
|
|
10791
10791
|
}
|
|
10792
|
-
async function X(p,
|
|
10793
|
-
!
|
|
10792
|
+
async function X(p, S) {
|
|
10793
|
+
!F(S) || !c.sessionId || H.has(p) || (H.add(p), await Y(c.sessionId, !0));
|
|
10794
10794
|
}
|
|
10795
10795
|
async function oe(p) {
|
|
10796
|
-
if (!
|
|
10797
|
-
let
|
|
10796
|
+
if (!F(p.view) || f !== p || !p.taskId) return;
|
|
10797
|
+
let S;
|
|
10798
10798
|
try {
|
|
10799
|
-
|
|
10799
|
+
S = await t.subscribeTaskEvents({
|
|
10800
10800
|
taskId: p.taskId,
|
|
10801
10801
|
cursor: () => B(p)?.run.lastEventId,
|
|
10802
10802
|
signal: p.stream.signal,
|
|
10803
|
-
onEvent: (
|
|
10804
|
-
if (!
|
|
10803
|
+
onEvent: (N) => {
|
|
10804
|
+
if (!F(p.view) || f !== p || p.stream.signal.aborted) return;
|
|
10805
10805
|
const h = B(p);
|
|
10806
10806
|
if (!h) return;
|
|
10807
|
-
const
|
|
10808
|
-
|
|
10809
|
-
messages:
|
|
10810
|
-
...
|
|
10807
|
+
const I = ys(h.run, N);
|
|
10808
|
+
N.event.toUpperCase() === "FINAL_MESSAGE_COMPLETED" && I.run !== h.run && (p.finalReceived = !0), (I.run !== h.run || I.title !== void 0) && T({
|
|
10809
|
+
messages: I.run === h.run ? c.messages : ee(h.id, I.run),
|
|
10810
|
+
...I.title !== void 0 ? { title: I.title } : {}
|
|
10811
10811
|
});
|
|
10812
10812
|
}
|
|
10813
10813
|
});
|
|
10814
|
-
} catch (
|
|
10815
|
-
|
|
10814
|
+
} catch (N) {
|
|
10815
|
+
S = p.stream.signal.aborted ? { kind: "aborted" } : { kind: "lost", status: Fe(N) };
|
|
10816
10816
|
}
|
|
10817
|
-
p.end =
|
|
10817
|
+
p.end = S, S.kind === "finished" && p.finished.resolve(), await re(p);
|
|
10818
10818
|
}
|
|
10819
10819
|
async function re(p) {
|
|
10820
|
-
const
|
|
10821
|
-
if (!(!
|
|
10822
|
-
if (
|
|
10823
|
-
T({ phase: "idle", connection: "lost", error: { code: "stream-lost", status:
|
|
10824
|
-
else if (
|
|
10825
|
-
const
|
|
10820
|
+
const S = p.end;
|
|
10821
|
+
if (!(!F(p.view) || f !== p || !p.taskId || !S || S.kind === "aborted") && c.phase !== "stopping")
|
|
10822
|
+
if (S.kind === "lost")
|
|
10823
|
+
T({ phase: "idle", connection: "lost", error: { code: "stream-lost", status: S.status } }), f === p && await X(p.taskId, p.view);
|
|
10824
|
+
else if (S.kind === "suspended") {
|
|
10825
|
+
const N = () => F(p.view) && f === p && c.phase !== "stopping";
|
|
10826
10826
|
try {
|
|
10827
10827
|
const h = await Re(t.getTask(p.taskId), p.view.signal);
|
|
10828
|
-
if (!h || !
|
|
10829
|
-
const
|
|
10830
|
-
if (
|
|
10831
|
-
const
|
|
10832
|
-
if (!
|
|
10833
|
-
const g =
|
|
10834
|
-
|
|
10828
|
+
if (!h || !N()) return;
|
|
10829
|
+
const I = at(h.eventWatermark);
|
|
10830
|
+
if (C.set(p.taskId, I), (h.status === "RUNNING" || h.status === "CREATED") && !P.has(p)) {
|
|
10831
|
+
const Q = B(p);
|
|
10832
|
+
if (!Q) return;
|
|
10833
|
+
const g = Q.run.lastEventId, O = I && (!g || bi(I, g)) ? I : g;
|
|
10834
|
+
P.add(p), p.end = void 0, T({
|
|
10835
10835
|
phase: "running",
|
|
10836
10836
|
suspension: void 0,
|
|
10837
|
-
messages: ee(
|
|
10838
|
-
}),
|
|
10837
|
+
messages: ee(Q.id, { ...Q.run, status: "running", suspension: void 0, lastEventId: O })
|
|
10838
|
+
}), N() && await oe(p);
|
|
10839
10839
|
return;
|
|
10840
10840
|
}
|
|
10841
10841
|
T({ phase: "idle", suspension: oa(h) });
|
|
10842
10842
|
} catch {
|
|
10843
|
-
|
|
10843
|
+
N() && T({ phase: "idle", error: { code: "suspension-failed" } });
|
|
10844
10844
|
}
|
|
10845
10845
|
} else
|
|
10846
|
-
T({ phase: "idle" }), f === p &&
|
|
10846
|
+
T({ phase: "idle" }), f === p && S.kind === "finished" && (!p.finalReceived || B(p)?.run.answer.final !== !0) && await X(p.taskId, p.view);
|
|
10847
10847
|
}
|
|
10848
|
-
async function
|
|
10848
|
+
async function Y(p, S = !1, N = !0) {
|
|
10849
10849
|
if (u) return;
|
|
10850
|
-
const h =
|
|
10851
|
-
if (T({ phase: "loading", loadingOlder: !1, suspension: void 0, ...
|
|
10850
|
+
const h = M(), I = () => F(h);
|
|
10851
|
+
if (T({ phase: "loading", loadingOlder: !1, suspension: void 0, ...S ? {} : { error: void 0, connection: "online" } }), !!I())
|
|
10852
10852
|
try {
|
|
10853
|
-
const
|
|
10854
|
-
if (!
|
|
10855
|
-
const g = aa(
|
|
10856
|
-
if (T({ sessionId:
|
|
10857
|
-
const
|
|
10858
|
-
if (!
|
|
10853
|
+
const Q = await Re(t.getSessionPage(p, { limit: o }), h.signal);
|
|
10854
|
+
if (!Q || !I()) return;
|
|
10855
|
+
const g = aa(Q.records);
|
|
10856
|
+
if (T({ sessionId: Q.id, title: Q.title, messages: g, hasMore: Q.hasMore }), !I()) return;
|
|
10857
|
+
const O = N ? [...g].reverse().find((q) => q.role === "assistant" && (q.run.status === "running" || q.run.status === "waiting")) : void 0;
|
|
10858
|
+
if (!O) {
|
|
10859
10859
|
T({ phase: "idle" });
|
|
10860
10860
|
return;
|
|
10861
10861
|
}
|
|
10862
10862
|
let R;
|
|
10863
10863
|
try {
|
|
10864
|
-
R = await Re(t.getTask(
|
|
10864
|
+
R = await Re(t.getTask(O.run.taskId), h.signal);
|
|
10865
10865
|
} catch {
|
|
10866
|
-
|
|
10866
|
+
I() && T({ phase: "idle", error: { code: "suspension-failed" } });
|
|
10867
10867
|
return;
|
|
10868
10868
|
}
|
|
10869
|
-
if (!R || !
|
|
10870
|
-
if (
|
|
10871
|
-
const
|
|
10872
|
-
T({ messages: ee(
|
|
10869
|
+
if (!R || !I()) return;
|
|
10870
|
+
if (C.set(O.run.taskId, at(R.eventWatermark)), R.status === "RUNNING" || R.status === "CREATED") {
|
|
10871
|
+
const q = te(O.id, h, O.run.taskId);
|
|
10872
|
+
T({ messages: ee(O.id, pi(O.run.taskId)), phase: "running" }), oe(q);
|
|
10873
10873
|
} else R.status === "SUSPENDED" || R.status === "WAITING_APPROVAL" ? T({
|
|
10874
|
-
messages: ee(
|
|
10875
|
-
...
|
|
10874
|
+
messages: ee(O.id, {
|
|
10875
|
+
...O.run,
|
|
10876
10876
|
status: "waiting",
|
|
10877
|
-
lastEventId:
|
|
10877
|
+
lastEventId: O.run.lastEventId ?? at(R.eventWatermark)
|
|
10878
10878
|
}),
|
|
10879
10879
|
phase: "idle",
|
|
10880
10880
|
suspension: oa(R)
|
|
10881
|
-
}) : (T({ phase: "idle" }), !f && ni(R.status) && await X(
|
|
10882
|
-
} catch (
|
|
10883
|
-
if (!
|
|
10884
|
-
Fe(
|
|
10881
|
+
}) : (T({ phase: "idle" }), !f && ni(R.status) && await X(O.run.taskId, h));
|
|
10882
|
+
} catch (Q) {
|
|
10883
|
+
if (!I()) return;
|
|
10884
|
+
Fe(Q) === 404 ? (W(), T({ error: { code: "session-gone" } })) : T({ phase: "idle", error: { code: "session-failed", status: Fe(Q) } });
|
|
10885
10885
|
}
|
|
10886
10886
|
}
|
|
10887
|
-
async function
|
|
10888
|
-
if (u ||
|
|
10889
|
-
const
|
|
10890
|
-
if (!
|
|
10891
|
-
const h =
|
|
10892
|
-
|
|
10893
|
-
const
|
|
10894
|
-
if (T({ error: void 0 }), !
|
|
10895
|
-
let
|
|
10887
|
+
async function E(p, S) {
|
|
10888
|
+
if (u || y || c.phase !== "idle" || c.suspension !== p) return;
|
|
10889
|
+
const N = [...c.messages].reverse().find((O) => O.role === "assistant" && O.run.taskId === p.taskId);
|
|
10890
|
+
if (!N) return;
|
|
10891
|
+
const h = v;
|
|
10892
|
+
y = p;
|
|
10893
|
+
const I = () => F(h) && y === p && c.suspension === p;
|
|
10894
|
+
if (T({ error: void 0 }), !I()) return;
|
|
10895
|
+
let Q;
|
|
10896
10896
|
try {
|
|
10897
|
-
|
|
10897
|
+
Q = await Re(t.resumeTask(p.taskId, {
|
|
10898
10898
|
suspensionId: p.id,
|
|
10899
|
-
...
|
|
10899
|
+
...S,
|
|
10900
10900
|
identity: p.identity,
|
|
10901
10901
|
signal: h.signal
|
|
10902
10902
|
}), h.signal);
|
|
10903
|
-
} catch (
|
|
10904
|
-
|
|
10903
|
+
} catch (O) {
|
|
10904
|
+
I() && T({ error: { code: "resume-failed", status: Fe(O) } }), y === p && (y = void 0);
|
|
10905
10905
|
return;
|
|
10906
10906
|
}
|
|
10907
|
-
if (!
|
|
10908
|
-
if (
|
|
10909
|
-
T({ suspension: void 0, phase: "idle" }),
|
|
10907
|
+
if (!I()) return;
|
|
10908
|
+
if (y = void 0, Q?.status && ni(Q.status)) {
|
|
10909
|
+
T({ suspension: void 0, phase: "idle" }), F(h) && c.sessionId && await Y(c.sessionId, !0);
|
|
10910
10910
|
return;
|
|
10911
10911
|
}
|
|
10912
|
-
const g = te(
|
|
10912
|
+
const g = te(N.id, h, p.taskId);
|
|
10913
10913
|
T({
|
|
10914
10914
|
suspension: void 0,
|
|
10915
10915
|
phase: "running",
|
|
10916
10916
|
connection: "online",
|
|
10917
10917
|
error: void 0,
|
|
10918
|
-
messages: ee(
|
|
10919
|
-
...
|
|
10918
|
+
messages: ee(N.id, {
|
|
10919
|
+
...N.run,
|
|
10920
10920
|
status: "running",
|
|
10921
10921
|
suspension: void 0,
|
|
10922
|
-
lastEventId:
|
|
10922
|
+
lastEventId: N.run.lastEventId || C.get(p.taskId)
|
|
10923
10923
|
})
|
|
10924
10924
|
}), await oe(g);
|
|
10925
10925
|
}
|
|
10926
|
-
function
|
|
10927
|
-
return new Promise((
|
|
10928
|
-
let
|
|
10929
|
-
const
|
|
10930
|
-
|
|
10931
|
-
},
|
|
10932
|
-
if (!(
|
|
10926
|
+
function V(p) {
|
|
10927
|
+
return new Promise((S) => {
|
|
10928
|
+
let N = !1, h, I;
|
|
10929
|
+
const Q = p.view.signal, g = (q) => {
|
|
10930
|
+
N || (N = !0, clearTimeout(h), clearTimeout(I), Q.removeEventListener("abort", O), S(q));
|
|
10931
|
+
}, O = () => g("aborted"), R = async () => {
|
|
10932
|
+
if (!(N || !F(p.view) || !p.taskId)) {
|
|
10933
10933
|
try {
|
|
10934
|
-
const
|
|
10935
|
-
if (ni(
|
|
10934
|
+
const q = await t.getTask(p.taskId);
|
|
10935
|
+
if (ni(q.status)) {
|
|
10936
10936
|
g("finished");
|
|
10937
10937
|
return;
|
|
10938
10938
|
}
|
|
10939
10939
|
} catch {
|
|
10940
10940
|
}
|
|
10941
|
-
|
|
10941
|
+
N || (h = setTimeout(() => {
|
|
10942
10942
|
R();
|
|
10943
10943
|
}, n.intervalMs));
|
|
10944
10944
|
}
|
|
10945
10945
|
};
|
|
10946
|
-
if (
|
|
10947
|
-
|
|
10946
|
+
if (Q.addEventListener("abort", O, { once: !0 }), Q.aborted) {
|
|
10947
|
+
O();
|
|
10948
10948
|
return;
|
|
10949
10949
|
}
|
|
10950
10950
|
if (p.end?.kind === "finished") {
|
|
10951
10951
|
g("finished");
|
|
10952
10952
|
return;
|
|
10953
10953
|
}
|
|
10954
|
-
p.finished.promise.then(() => g("finished")),
|
|
10954
|
+
p.finished.promise.then(() => g("finished")), I = setTimeout(() => g("timeout"), n.timeoutMs), R();
|
|
10955
10955
|
});
|
|
10956
10956
|
}
|
|
10957
10957
|
return r && K(!1), {
|
|
10958
10958
|
getState: () => c,
|
|
10959
10959
|
subscribe(p) {
|
|
10960
|
-
return u ||
|
|
10961
|
-
|
|
10960
|
+
return u || z.add(p), () => {
|
|
10961
|
+
z.delete(p);
|
|
10962
10962
|
};
|
|
10963
10963
|
},
|
|
10964
10964
|
setScope: Z,
|
|
@@ -10969,130 +10969,130 @@ function oc(e) {
|
|
|
10969
10969
|
!r || u || c.provisioning?.ready || c.provisioning?.triggering || await K(!0);
|
|
10970
10970
|
},
|
|
10971
10971
|
async openSession(p) {
|
|
10972
|
-
u ||
|
|
10972
|
+
u || D() || (l++, await Y(p));
|
|
10973
10973
|
},
|
|
10974
10974
|
async loadSessions() {
|
|
10975
|
-
if (u ||
|
|
10976
|
-
const p = ++k,
|
|
10977
|
-
if (T({ sessions: { items: c.sessions?.items ?? [], loading: !0 } }), !!
|
|
10975
|
+
if (u || D()) return;
|
|
10976
|
+
const p = ++k, S = () => !u && !D() && p === k;
|
|
10977
|
+
if (T({ sessions: { items: c.sessions?.items ?? [], loading: !0 } }), !!S())
|
|
10978
10978
|
try {
|
|
10979
|
-
const
|
|
10980
|
-
|
|
10981
|
-
} catch (
|
|
10982
|
-
|
|
10979
|
+
const N = await t.listSessions({ page: 1, size: 50 });
|
|
10980
|
+
S() && T({ sessions: { items: N.items, loading: !1 } });
|
|
10981
|
+
} catch (N) {
|
|
10982
|
+
S() && T({ sessions: {
|
|
10983
10983
|
items: c.sessions?.items ?? [],
|
|
10984
10984
|
loading: !1,
|
|
10985
|
-
error: { code: "sessions-failed", status: Fe(
|
|
10985
|
+
error: { code: "sessions-failed", status: Fe(N) }
|
|
10986
10986
|
} });
|
|
10987
10987
|
}
|
|
10988
10988
|
},
|
|
10989
|
-
async renameSession(p,
|
|
10990
|
-
if (u ||
|
|
10991
|
-
const
|
|
10992
|
-
if (!h || !
|
|
10993
|
-
const
|
|
10989
|
+
async renameSession(p, S) {
|
|
10990
|
+
if (u || D()) return;
|
|
10991
|
+
const N = S.trim(), h = c.sessions?.items.find((R) => R.id === p);
|
|
10992
|
+
if (!h || !N || N === h.title) return;
|
|
10993
|
+
const I = v, Q = c.title, g = c.sessionId === p, O = { ...h, title: N };
|
|
10994
10994
|
if (T({
|
|
10995
|
-
sessions: { ...c.sessions, error: void 0, items: c.sessions.items.map((R) => R.id === p ?
|
|
10996
|
-
...g ? { title:
|
|
10997
|
-
}), !(u ||
|
|
10995
|
+
sessions: { ...c.sessions, error: void 0, items: c.sessions.items.map((R) => R.id === p ? O : R) },
|
|
10996
|
+
...g ? { title: N } : {}
|
|
10997
|
+
}), !(u || D()))
|
|
10998
10998
|
try {
|
|
10999
|
-
await t.renameSession(p,
|
|
10999
|
+
await t.renameSession(p, N);
|
|
11000
11000
|
} catch (R) {
|
|
11001
|
-
if (u ||
|
|
11001
|
+
if (u || D() || !c.sessions) return;
|
|
11002
11002
|
T({
|
|
11003
11003
|
sessions: {
|
|
11004
11004
|
...c.sessions,
|
|
11005
11005
|
// Roll back only this optimistic row, preserving unrelated changes and newer list reads.
|
|
11006
|
-
items: c.sessions.items.map((
|
|
11006
|
+
items: c.sessions.items.map((q) => q === O ? h : q),
|
|
11007
11007
|
error: { code: "rename-failed", status: Fe(R) }
|
|
11008
11008
|
},
|
|
11009
|
-
...g &&
|
|
11009
|
+
...g && F(I) && c.sessionId === p && c.title === N ? { title: Q } : {}
|
|
11010
11010
|
});
|
|
11011
11011
|
}
|
|
11012
11012
|
},
|
|
11013
11013
|
async deleteSession(p) {
|
|
11014
|
-
if (u ||
|
|
11015
|
-
let
|
|
11014
|
+
if (u || D()) return;
|
|
11015
|
+
let S, N;
|
|
11016
11016
|
try {
|
|
11017
|
-
|
|
11017
|
+
S = await t.deleteSession(p);
|
|
11018
11018
|
} catch (h) {
|
|
11019
|
-
|
|
11019
|
+
S = !1, N = Fe(h);
|
|
11020
11020
|
}
|
|
11021
|
-
if (!(u ||
|
|
11022
|
-
if (!
|
|
11023
|
-
c.sessions && T({ sessions: { ...c.sessions, error: { code: "delete-failed", status:
|
|
11021
|
+
if (!(u || D())) {
|
|
11022
|
+
if (!S) {
|
|
11023
|
+
c.sessions && T({ sessions: { ...c.sessions, error: { code: "delete-failed", status: N } } });
|
|
11024
11024
|
return;
|
|
11025
11025
|
}
|
|
11026
|
-
c.sessions && T({ sessions: { ...c.sessions, error: void 0, items: c.sessions.items.filter((h) => h.id !== p) } }), c.sessionId === p &&
|
|
11026
|
+
c.sessions && T({ sessions: { ...c.sessions, error: void 0, items: c.sessions.items.filter((h) => h.id !== p) } }), c.sessionId === p && W();
|
|
11027
11027
|
}
|
|
11028
11028
|
},
|
|
11029
|
-
newChat:
|
|
11029
|
+
newChat: W,
|
|
11030
11030
|
async loadOlder() {
|
|
11031
|
-
if (u ||
|
|
11031
|
+
if (u || D() || !c.sessionId || !c.hasMore || c.loadingOlder || c.phase === "loading") return;
|
|
11032
11032
|
const p = c.messages.find((h) => /^\d+$/.test(h.id))?.id;
|
|
11033
11033
|
if (!p) return;
|
|
11034
|
-
const
|
|
11035
|
-
if (T({ loadingOlder: !0 }), !!
|
|
11034
|
+
const S = v, N = c.sessionId;
|
|
11035
|
+
if (T({ loadingOlder: !0 }), !!F(S))
|
|
11036
11036
|
try {
|
|
11037
|
-
const h = await Re(t.getSessionPage(
|
|
11038
|
-
if (!h || !
|
|
11037
|
+
const h = await Re(t.getSessionPage(N, { limit: o, before: p }), S.signal);
|
|
11038
|
+
if (!h || !F(S)) return;
|
|
11039
11039
|
T({ messages: qa([...aa(h.records), ...c.messages]), hasMore: h.hasMore, loadingOlder: !1 });
|
|
11040
11040
|
} catch (h) {
|
|
11041
|
-
|
|
11041
|
+
F(S) && T({ loadingOlder: !1, error: { code: "history-failed", status: Fe(h) } });
|
|
11042
11042
|
}
|
|
11043
11043
|
},
|
|
11044
|
-
async send(p,
|
|
11045
|
-
if (u ||
|
|
11046
|
-
if (c.phase !== "idle" ||
|
|
11047
|
-
const
|
|
11044
|
+
async send(p, S) {
|
|
11045
|
+
if (u || D()) return;
|
|
11046
|
+
if (c.phase !== "idle" || y) throw new $e("busy");
|
|
11047
|
+
const N = Xs(x);
|
|
11048
11048
|
let h;
|
|
11049
11049
|
try {
|
|
11050
11050
|
const R = a?.();
|
|
11051
11051
|
typeof R == "string" && R && (h = R);
|
|
11052
11052
|
} catch {
|
|
11053
11053
|
}
|
|
11054
|
-
const
|
|
11054
|
+
const I = v, Q = String(++s), g = te(`local:a:${Q}`, I), O = Date.now();
|
|
11055
11055
|
if (T({
|
|
11056
11056
|
messages: [
|
|
11057
11057
|
...c.messages,
|
|
11058
11058
|
{
|
|
11059
|
-
id: `local:u:${
|
|
11059
|
+
id: `local:u:${Q}`,
|
|
11060
11060
|
role: "user",
|
|
11061
11061
|
text: p,
|
|
11062
|
-
createdAt:
|
|
11063
|
-
attachments:
|
|
11062
|
+
createdAt: O,
|
|
11063
|
+
attachments: S?.attachments?.map(({ id: R, name: q, mimeType: $, size: ae }) => ({ id: R, name: q, mimeType: $, size: me(ae) }))
|
|
11064
11064
|
},
|
|
11065
|
-
{ id: g.messageId, role: "assistant", createdAt:
|
|
11065
|
+
{ id: g.messageId, role: "assistant", createdAt: O, run: pi("") }
|
|
11066
11066
|
],
|
|
11067
11067
|
phase: "running",
|
|
11068
11068
|
connection: "online",
|
|
11069
11069
|
error: void 0,
|
|
11070
11070
|
suspension: void 0
|
|
11071
|
-
}), !!
|
|
11071
|
+
}), !!F(I)) {
|
|
11072
11072
|
try {
|
|
11073
|
-
if (
|
|
11073
|
+
if (L && await Re(L, I.signal), !F(I)) return;
|
|
11074
11074
|
const R = Object.fromEntries(Object.entries({
|
|
11075
|
-
...
|
|
11075
|
+
...N,
|
|
11076
11076
|
...h !== void 0 ? { pageTraceId: h } : {},
|
|
11077
|
-
...
|
|
11078
|
-
...
|
|
11077
|
+
...S?.requestMetadata,
|
|
11078
|
+
...S?.attachments ? { attachments: S.attachments.map(({ id: fe, name: ue, mimeType: ge, size: _e }) => ({
|
|
11079
11079
|
attachmentId: fe,
|
|
11080
11080
|
fileName: ue,
|
|
11081
11081
|
status: "READY",
|
|
11082
11082
|
...ge !== void 0 ? { contentType: ge } : {},
|
|
11083
11083
|
..._e !== void 0 ? { size: _e } : {}
|
|
11084
11084
|
})) } : {}
|
|
11085
|
-
}).filter(([, fe]) => fe !== void 0)),
|
|
11086
|
-
if (
|
|
11087
|
-
g.taskId =
|
|
11085
|
+
}).filter(([, fe]) => fe !== void 0)), q = Object.keys(R).length > 0 ? R : void 0, $ = await Re(t.createTask({ sessionId: c.sessionId, message: p, requestMetadata: q, signal: I.signal }), I.signal);
|
|
11086
|
+
if (!$ || !F(I)) return;
|
|
11087
|
+
g.taskId = $.taskId;
|
|
11088
11088
|
const ae = B(g);
|
|
11089
11089
|
if (!ae) return;
|
|
11090
|
-
T({ messages: ee(ae.id, { ...ae.run, taskId:
|
|
11090
|
+
T({ messages: ee(ae.id, { ...ae.run, taskId: $.taskId }), sessionId: $.sessionId ?? c.sessionId });
|
|
11091
11091
|
} catch (R) {
|
|
11092
|
-
if (!
|
|
11093
|
-
const
|
|
11092
|
+
if (!F(I)) return;
|
|
11093
|
+
const q = B(g);
|
|
11094
11094
|
T({
|
|
11095
|
-
...
|
|
11095
|
+
...q ? { messages: ee(q.id, { ...q.run, status: "failed", error: "create-task-failed" }) } : {},
|
|
11096
11096
|
phase: "idle",
|
|
11097
11097
|
error: { code: "create-task-failed", status: Fe(R) }
|
|
11098
11098
|
});
|
|
@@ -11104,72 +11104,72 @@ function oc(e) {
|
|
|
11104
11104
|
}
|
|
11105
11105
|
},
|
|
11106
11106
|
async answer(p) {
|
|
11107
|
-
const
|
|
11108
|
-
if (u ||
|
|
11109
|
-
let
|
|
11107
|
+
const S = c.suspension;
|
|
11108
|
+
if (u || D() || !S || y || c.phase !== "idle") return;
|
|
11109
|
+
let N;
|
|
11110
11110
|
try {
|
|
11111
|
-
|
|
11111
|
+
N = ac(S, p);
|
|
11112
11112
|
} catch (h) {
|
|
11113
11113
|
T({ error: { code: h instanceof Error ? h.message : "invalid-answer" } });
|
|
11114
11114
|
return;
|
|
11115
11115
|
}
|
|
11116
|
-
await
|
|
11116
|
+
await E(S, N);
|
|
11117
11117
|
},
|
|
11118
11118
|
async cancelSuspension() {
|
|
11119
|
-
u ||
|
|
11119
|
+
u || D() || c.suspension && await E(c.suspension, { action: "CANCEL", payload: {} });
|
|
11120
11120
|
},
|
|
11121
11121
|
async stop() {
|
|
11122
11122
|
if (u || c.phase !== "running" || !f) return;
|
|
11123
11123
|
const p = f;
|
|
11124
|
-
if (T({ phase: "stopping", error: void 0 }), await Re(p.ready.promise, p.view.signal), !
|
|
11125
|
-
let
|
|
11124
|
+
if (T({ phase: "stopping", error: void 0 }), await Re(p.ready.promise, p.view.signal), !F(p.view) || !p.taskId) return;
|
|
11125
|
+
let S;
|
|
11126
11126
|
try {
|
|
11127
|
-
|
|
11127
|
+
S = await Re(t.cancelTask(p.taskId), p.view.signal);
|
|
11128
11128
|
} catch {
|
|
11129
|
-
|
|
11129
|
+
S = !1;
|
|
11130
11130
|
}
|
|
11131
|
-
if (!
|
|
11132
|
-
if (
|
|
11131
|
+
if (!F(p.view)) return;
|
|
11132
|
+
if (S === !1) {
|
|
11133
11133
|
T({ phase: "running", error: { code: "cancel-rejected" } }), await re(p);
|
|
11134
11134
|
return;
|
|
11135
11135
|
}
|
|
11136
|
-
const
|
|
11137
|
-
!
|
|
11136
|
+
const N = await V(p);
|
|
11137
|
+
!F(p.view) || N === "aborted" || (p.stream.abort(), N === "timeout" && T({ error: { code: "stop-timeout" } }), F(p.view) && (c.sessionId ? await Y(c.sessionId, !0, !1) : T({ phase: "idle" })));
|
|
11138
11138
|
},
|
|
11139
|
-
async upload(p,
|
|
11139
|
+
async upload(p, S, N) {
|
|
11140
11140
|
if (u) return new Promise(() => {
|
|
11141
11141
|
});
|
|
11142
|
-
if (
|
|
11143
|
-
const h =
|
|
11144
|
-
if (
|
|
11145
|
-
let
|
|
11146
|
-
if (!
|
|
11147
|
-
if (!
|
|
11148
|
-
const
|
|
11149
|
-
if (!(!R || !
|
|
11142
|
+
if (D()) throw new $e("not-provisioned");
|
|
11143
|
+
const h = v;
|
|
11144
|
+
if (N?.aborted) throw new $e("aborted");
|
|
11145
|
+
let I = c.sessionId;
|
|
11146
|
+
if (!I) {
|
|
11147
|
+
if (!L) {
|
|
11148
|
+
const O = Re(t.createSession({ signal: h.signal }), h.signal).then((R) => {
|
|
11149
|
+
if (!(!R || !F(h)))
|
|
11150
11150
|
return T({ sessionId: R.sessionId }), R.sessionId;
|
|
11151
11151
|
});
|
|
11152
|
-
|
|
11153
|
-
|
|
11152
|
+
L = O, O.finally(() => {
|
|
11153
|
+
L === O && (L = void 0);
|
|
11154
11154
|
}).catch(() => {
|
|
11155
11155
|
});
|
|
11156
11156
|
}
|
|
11157
|
-
|
|
11157
|
+
I = await Re(L, N ?? h.signal);
|
|
11158
11158
|
}
|
|
11159
|
-
if (!
|
|
11160
|
-
const
|
|
11161
|
-
sessionId:
|
|
11159
|
+
if (!I || !F(h) || N?.aborted) throw new $e("aborted");
|
|
11160
|
+
const Q = N ? AbortSignal.any([h.signal, N]) : h.signal, g = await Re(t.uploadAttachment({
|
|
11161
|
+
sessionId: I,
|
|
11162
11162
|
file: p,
|
|
11163
|
-
signal:
|
|
11164
|
-
onProgress:
|
|
11165
|
-
|
|
11163
|
+
signal: Q,
|
|
11164
|
+
onProgress: S ? (O) => {
|
|
11165
|
+
F(h) && !Q.aborted && S(O);
|
|
11166
11166
|
} : void 0
|
|
11167
|
-
}),
|
|
11168
|
-
if (!g || !
|
|
11167
|
+
}), Q);
|
|
11168
|
+
if (!g || !F(h) || Q.aborted) throw new $e("aborted");
|
|
11169
11169
|
return g;
|
|
11170
11170
|
},
|
|
11171
11171
|
dispose() {
|
|
11172
|
-
u || (u = !0, l++,
|
|
11172
|
+
u || (u = !0, l++, z.clear(), M());
|
|
11173
11173
|
}
|
|
11174
11174
|
};
|
|
11175
11175
|
}
|
|
@@ -11194,7 +11194,7 @@ function cc(e = {}) {
|
|
|
11194
11194
|
};
|
|
11195
11195
|
}
|
|
11196
11196
|
function zc(e) {
|
|
11197
|
-
const t = cc(e), o = JSON.stringify(t.startScreen.prompts.map(({ icon:
|
|
11197
|
+
const t = cc(e), o = JSON.stringify(t.startScreen.prompts.map(({ icon: v, label: f, prompt: y }) => [v, f, y])), n = je(() => t, [
|
|
11198
11198
|
t.locale,
|
|
11199
11199
|
t.getTraceId,
|
|
11200
11200
|
t.onNavigate,
|
|
@@ -11219,26 +11219,26 @@ function zc(e) {
|
|
|
11219
11219
|
t.panel?.visible,
|
|
11220
11220
|
t.panel?.mode,
|
|
11221
11221
|
t.processView
|
|
11222
|
-
]), a =
|
|
11222
|
+
]), a = U(n.getTraceId);
|
|
11223
11223
|
ke(() => {
|
|
11224
11224
|
a.current = n.getTraceId;
|
|
11225
11225
|
}, [n.getTraceId]);
|
|
11226
|
-
const [r, c] =
|
|
11226
|
+
const [r, c] = A(null), { http: u } = e;
|
|
11227
11227
|
se(() => {
|
|
11228
|
-
let
|
|
11228
|
+
let v = !1, f;
|
|
11229
11229
|
return queueMicrotask(() => {
|
|
11230
|
-
if (
|
|
11231
|
-
const
|
|
11232
|
-
f = oc({ client:
|
|
11230
|
+
if (v) return;
|
|
11231
|
+
const y = Gs(u);
|
|
11232
|
+
f = oc({ client: y, getTraceId: () => a.current(), provisioning: !0 }), c({ http: u, client: y, controller: f });
|
|
11233
11233
|
}), () => {
|
|
11234
|
-
|
|
11234
|
+
v = !0, f?.dispose();
|
|
11235
11235
|
};
|
|
11236
11236
|
}, [u]);
|
|
11237
11237
|
const s = r?.http === u ? r : null, { scopeType: l, scopeId: x, pending: _ } = n.scope;
|
|
11238
11238
|
ke(() => {
|
|
11239
11239
|
s && s.controller.setScope({ scopeType: l, scopeId: x || void 0, pending: _ });
|
|
11240
11240
|
}, [s, l, x, _]);
|
|
11241
|
-
const [
|
|
11241
|
+
const [b, w] = A({ enabled: !0, visible: !0, mode: "auto" }), m = Ne((v) => w((f) => ({ ...f, ...v })), []), k = je(() => ({ panel: b, patch: m }), [b, m]);
|
|
11242
11242
|
return /* @__PURE__ */ i(ma.Provider, { value: n, children: /* @__PURE__ */ i(ga.Provider, { value: k, children: s && /* @__PURE__ */ i(fa.Provider, { value: s, children: e.children }) }) });
|
|
11243
11243
|
}
|
|
11244
11244
|
export {
|