inline-chat-kit 0.59.2 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/README.md +5 -1
- package/dist/{ChatExperience-umh3nGe_.js → ChatExperience-BBd-p0wh.js} +711 -611
- package/dist/ChatExperience-BBd-p0wh.js.map +1 -0
- package/dist/ChatHeader/ChatHeader.d.ts +7 -0
- package/dist/ChatInput/ChatInput.d.ts +7 -0
- package/dist/ChatTurnRow/ChatTurnRow.d.ts +23 -1
- package/dist/demo.js +1 -1
- package/dist/inline-chat-kit.css +1 -1
- package/dist/inline-chat-kit.js +1 -1
- package/package.json +1 -1
- package/theming.md +69 -0
- package/dist/ChatExperience-umh3nGe_.js.map +0 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import e, { createContext as t, createElement as n, forwardRef as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useId as l, useImperativeHandle as u, useLayoutEffect as d, useMemo as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
|
|
3
3
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
4
4
|
import { AnimatePresence as y, LayoutGroup as b, MotionConfig as x, animate as S, motion as C, useAnimationControls as w, useMotionValue as T, useReducedMotion as E } from "motion/react";
|
|
5
|
-
import { ArrowDown as D, ArrowLeft as O, Bookmark as k, Brain as A, Check as j, ChevronDown as M, ChevronLeft as N, ChevronRight as ee, Copy as
|
|
6
|
-
var
|
|
5
|
+
import { ArrowDown as D, ArrowLeft as O, Bookmark as k, Brain as A, Check as j, ChevronDown as M, ChevronLeft as N, ChevronRight as ee, Copy as te, CornerDownLeft as P, File as F, FileText as I, Film as ne, Highlighter as L, Image as re, Link2 as ie, Maximize2 as R, MessageCircle as ae, Mic as oe, Minimize2 as se, Moon as ce, MoreHorizontal as le, Music as ue, Palette as de, Paperclip as z, Pencil as fe, Plus as pe, RotateCcw as me, Save as he, Share as ge, Square as _e, Sun as ve, TextCursor as ye, ThumbsDown as be, ThumbsUp as xe, Trash2 as Se, TriangleAlert as Ce, X as we } from "lucide-react";
|
|
6
|
+
var B = {
|
|
7
7
|
btn: "ick-btn-ZW5E",
|
|
8
8
|
xs: "ick-xs-rDs4",
|
|
9
9
|
s: "ick-s-DE-t",
|
|
@@ -21,25 +21,25 @@ var V = {
|
|
|
21
21
|
loading: "ick-loading-NCs-",
|
|
22
22
|
spinner: "ick-spinner-0n6Q",
|
|
23
23
|
spin: "ick-spin-QgE6"
|
|
24
|
-
}, we = {
|
|
25
|
-
primary: V.primary,
|
|
26
|
-
secondary: V.secondary,
|
|
27
|
-
outline: V.outline,
|
|
28
|
-
ghost: V.ghost,
|
|
29
|
-
glass: V.glass
|
|
30
24
|
}, Te = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
25
|
+
primary: B.primary,
|
|
26
|
+
secondary: B.secondary,
|
|
27
|
+
outline: B.outline,
|
|
28
|
+
ghost: B.ghost,
|
|
29
|
+
glass: B.glass
|
|
30
|
+
}, Ee = {
|
|
31
|
+
xs: B.xs,
|
|
32
|
+
s: B.s,
|
|
33
|
+
m: B.m,
|
|
34
|
+
l: B.l,
|
|
35
|
+
xl: B.xl
|
|
36
|
+
}, V = r(function({ variant: e = "primary", size: t = "s", icon: n, iconRight: r, loading: i = !1, children: a, className: o, disabled: s, ...c }, l) {
|
|
37
37
|
let u = [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
a ?
|
|
42
|
-
i ?
|
|
38
|
+
B.btn,
|
|
39
|
+
Te[e],
|
|
40
|
+
Ee[t],
|
|
41
|
+
a ? B.hasText : "",
|
|
42
|
+
i ? B.loading : "",
|
|
43
43
|
o ?? ""
|
|
44
44
|
].filter(Boolean).join(" ");
|
|
45
45
|
return /* @__PURE__ */ v("button", {
|
|
@@ -47,27 +47,28 @@ var V = {
|
|
|
47
47
|
className: u,
|
|
48
48
|
disabled: s || i,
|
|
49
49
|
"aria-busy": i,
|
|
50
|
+
"data-ick-variant": e,
|
|
50
51
|
...c,
|
|
51
52
|
children: [
|
|
52
53
|
n && /* @__PURE__ */ _("span", {
|
|
53
|
-
className:
|
|
54
|
+
className: B.icon,
|
|
54
55
|
children: n
|
|
55
56
|
}),
|
|
56
57
|
a && /* @__PURE__ */ _("span", {
|
|
57
|
-
className:
|
|
58
|
+
className: B.label,
|
|
58
59
|
children: a
|
|
59
60
|
}),
|
|
60
61
|
r && /* @__PURE__ */ _("span", {
|
|
61
|
-
className:
|
|
62
|
+
className: B.icon,
|
|
62
63
|
children: r
|
|
63
64
|
}),
|
|
64
65
|
i && /* @__PURE__ */ _("span", {
|
|
65
|
-
className:
|
|
66
|
+
className: B.spinner,
|
|
66
67
|
"aria-hidden": "true"
|
|
67
68
|
})
|
|
68
69
|
]
|
|
69
70
|
});
|
|
70
|
-
}),
|
|
71
|
+
}), De = {
|
|
71
72
|
list: "ick-list-4-Xw",
|
|
72
73
|
item: "ick-item-5jP3",
|
|
73
74
|
picture: "ick-picture-JacB",
|
|
@@ -76,7 +77,7 @@ var V = {
|
|
|
76
77
|
name: "ick-name-6t7S",
|
|
77
78
|
size: "ick-size-sR5p",
|
|
78
79
|
remove: "ick-remove-6I5y"
|
|
79
|
-
},
|
|
80
|
+
}, Oe = {
|
|
80
81
|
approval: {
|
|
81
82
|
once: "Allow once",
|
|
82
83
|
always: "Always allow",
|
|
@@ -226,9 +227,9 @@ var V = {
|
|
|
226
227
|
paragraph: "Paragraph {index}",
|
|
227
228
|
responding: "Generating response"
|
|
228
229
|
}
|
|
229
|
-
},
|
|
230
|
-
function
|
|
231
|
-
let n = s(
|
|
230
|
+
}, ke = t({});
|
|
231
|
+
function Ae({ labels: e, children: t }) {
|
|
232
|
+
let n = s(ke), r = e ? JSON.stringify(e) : "", i = f(() => {
|
|
232
233
|
if (!r) return n;
|
|
233
234
|
let e = JSON.parse(r), t = { ...n };
|
|
234
235
|
for (let r of Object.keys(e)) t[r] = {
|
|
@@ -237,25 +238,25 @@ function ke({ labels: e, children: t }) {
|
|
|
237
238
|
};
|
|
238
239
|
return t;
|
|
239
240
|
}, [n, r]);
|
|
240
|
-
return /* @__PURE__ */ _(
|
|
241
|
+
return /* @__PURE__ */ _(ke.Provider, {
|
|
241
242
|
value: i,
|
|
242
243
|
children: t
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
|
-
function
|
|
246
|
-
let n = s(
|
|
246
|
+
function H(e, t) {
|
|
247
|
+
let n = s(ke)[e];
|
|
247
248
|
return {
|
|
248
|
-
...
|
|
249
|
+
...Oe[e],
|
|
249
250
|
...n,
|
|
250
251
|
...t
|
|
251
252
|
};
|
|
252
253
|
}
|
|
253
|
-
function
|
|
254
|
+
function je(e, t) {
|
|
254
255
|
return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e);
|
|
255
256
|
}
|
|
256
257
|
//#endregion
|
|
257
258
|
//#region src/Attachments/Attachments.tsx
|
|
258
|
-
function
|
|
259
|
+
function Me(e) {
|
|
259
260
|
if (e === void 0 || !Number.isFinite(e) || e < 0) return "";
|
|
260
261
|
if (e < 1024) return `${e} B`;
|
|
261
262
|
let t = [
|
|
@@ -266,50 +267,51 @@ function je(e) {
|
|
|
266
267
|
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
267
268
|
return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${t[r]}`;
|
|
268
269
|
}
|
|
269
|
-
var
|
|
270
|
+
var U = (e) => !!e.url && (e.type ?? "").startsWith("image/"), Ne = (e) => e.replace(/["\\]/g, encodeURIComponent);
|
|
270
271
|
function Pe({ type: e }) {
|
|
271
272
|
let t = (e ?? "").split("/")[0];
|
|
272
|
-
return _(t === "image" ?
|
|
273
|
+
return _(t === "image" ? re : t === "video" ? ne : t === "audio" ? ue : e === "application/pdf" || t === "text" ? I : F, {
|
|
273
274
|
size: 16,
|
|
274
275
|
"aria-hidden": !0
|
|
275
276
|
});
|
|
276
277
|
}
|
|
277
278
|
function Fe({ attachments: e, onRemove: t, labels: n, className: r, ...i }) {
|
|
278
|
-
let a =
|
|
279
|
+
let a = H("attachments", n);
|
|
279
280
|
return e.length === 0 ? null : /* @__PURE__ */ _("ul", {
|
|
280
|
-
className: [
|
|
281
|
+
className: [De.list, r ?? ""].filter(Boolean).join(" "),
|
|
281
282
|
...i,
|
|
282
283
|
children: e.map((e) => {
|
|
283
|
-
let n =
|
|
284
|
+
let n = Me(e.size);
|
|
284
285
|
return /* @__PURE__ */ v("li", {
|
|
285
|
-
className:
|
|
286
|
-
"data-picture":
|
|
287
|
-
children: [
|
|
288
|
-
className:
|
|
286
|
+
className: De.item,
|
|
287
|
+
"data-picture": U(e) || void 0,
|
|
288
|
+
children: [U(e) ? /* @__PURE__ */ _("span", {
|
|
289
|
+
className: De.picture,
|
|
289
290
|
style: { backgroundImage: `url("${Ne(e.url)}")` },
|
|
290
291
|
role: "img",
|
|
291
292
|
"aria-label": e.name
|
|
292
293
|
}) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
293
|
-
className:
|
|
294
|
+
className: De.glyph,
|
|
294
295
|
children: /* @__PURE__ */ _(Pe, { type: e.type })
|
|
295
296
|
}), /* @__PURE__ */ v("span", {
|
|
296
|
-
className:
|
|
297
|
+
className: De.body,
|
|
297
298
|
children: [/* @__PURE__ */ _("span", {
|
|
298
|
-
className:
|
|
299
|
+
className: De.name,
|
|
299
300
|
children: e.name
|
|
300
301
|
}), n && /* @__PURE__ */ _("span", {
|
|
301
|
-
className:
|
|
302
|
+
className: De.size,
|
|
302
303
|
children: n
|
|
303
304
|
})]
|
|
304
305
|
})] }), t && /* @__PURE__ */ _("span", {
|
|
305
|
-
className:
|
|
306
|
-
children: /* @__PURE__ */ _(
|
|
306
|
+
className: De.remove,
|
|
307
|
+
children: /* @__PURE__ */ _(V, {
|
|
307
308
|
variant: "glass",
|
|
309
|
+
"data-ick-role": "remove-attachment",
|
|
308
310
|
size: "s",
|
|
309
311
|
onClick: () => t(e.id),
|
|
310
312
|
onPointerDown: (e) => e.stopPropagation(),
|
|
311
313
|
"aria-label": `${a.remove} ${e.name}`,
|
|
312
|
-
icon: /* @__PURE__ */ _(
|
|
314
|
+
icon: /* @__PURE__ */ _(we, {
|
|
313
315
|
size: 14,
|
|
314
316
|
"aria-hidden": !0
|
|
315
317
|
})
|
|
@@ -365,13 +367,13 @@ function Le({ mode: e, color: t = "currentColor", duration: n = .22, size: r = 1
|
|
|
365
367
|
alignItems: "center",
|
|
366
368
|
justifyContent: "center"
|
|
367
369
|
},
|
|
368
|
-
children: e === "send" ? /* @__PURE__ */ _(
|
|
370
|
+
children: e === "send" ? /* @__PURE__ */ _(P, {
|
|
369
371
|
size: r,
|
|
370
372
|
color: t,
|
|
371
373
|
strokeWidth: 1.8,
|
|
372
374
|
strokeLinecap: "round",
|
|
373
375
|
strokeLinejoin: "round"
|
|
374
|
-
}) : e === "mic" ? /* @__PURE__ */ _(
|
|
376
|
+
}) : e === "mic" ? /* @__PURE__ */ _(oe, {
|
|
375
377
|
size: r,
|
|
376
378
|
color: t,
|
|
377
379
|
strokeWidth: 1.8,
|
|
@@ -383,7 +385,7 @@ function Le({ mode: e, color: t = "currentColor", duration: n = .22, size: r = 1
|
|
|
383
385
|
strokeWidth: 2.2,
|
|
384
386
|
strokeLinecap: "round",
|
|
385
387
|
strokeLinejoin: "round"
|
|
386
|
-
}) : /* @__PURE__ */ _(
|
|
388
|
+
}) : /* @__PURE__ */ _(_e, {
|
|
387
389
|
size: r,
|
|
388
390
|
color: t,
|
|
389
391
|
fill: t,
|
|
@@ -421,7 +423,7 @@ var W = {
|
|
|
421
423
|
//#endregion
|
|
422
424
|
//#region src/ChatInput/HoverActionsRow.tsx
|
|
423
425
|
function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r, onCopy: i, onEdit: a, value: o, ac: s }) {
|
|
424
|
-
let c =
|
|
426
|
+
let c = H("input");
|
|
425
427
|
return /* @__PURE__ */ _(y, {
|
|
426
428
|
initial: !1,
|
|
427
429
|
children: e && /* @__PURE__ */ v(C.div, {
|
|
@@ -467,8 +469,9 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
|
|
|
467
469
|
},
|
|
468
470
|
exit: {}
|
|
469
471
|
},
|
|
470
|
-
children: /* @__PURE__ */ _(
|
|
472
|
+
children: /* @__PURE__ */ _(V, {
|
|
471
473
|
variant: "ghost",
|
|
474
|
+
"data-ick-role": "read-more",
|
|
472
475
|
icon: n ? c.readLess : c.readMore,
|
|
473
476
|
onClick: (e) => {
|
|
474
477
|
e.stopPropagation(), r((e) => !e);
|
|
@@ -483,7 +486,7 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
|
|
|
483
486
|
})
|
|
484
487
|
}, "read-more"), [{
|
|
485
488
|
id: "copy",
|
|
486
|
-
icon: /* @__PURE__ */ _(
|
|
489
|
+
icon: /* @__PURE__ */ _(te, {
|
|
487
490
|
size: 14,
|
|
488
491
|
"aria-hidden": !0
|
|
489
492
|
}),
|
|
@@ -491,7 +494,7 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
|
|
|
491
494
|
label: c.copy
|
|
492
495
|
}, {
|
|
493
496
|
id: "edit",
|
|
494
|
-
icon: /* @__PURE__ */ _(
|
|
497
|
+
icon: /* @__PURE__ */ _(fe, {
|
|
495
498
|
size: 14,
|
|
496
499
|
"aria-hidden": !0
|
|
497
500
|
}),
|
|
@@ -514,8 +517,10 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
|
|
|
514
517
|
},
|
|
515
518
|
exit: {}
|
|
516
519
|
},
|
|
517
|
-
children: /* @__PURE__ */ _(
|
|
520
|
+
children: /* @__PURE__ */ _(V, {
|
|
518
521
|
variant: "ghost",
|
|
522
|
+
"data-ick-role": "message-action",
|
|
523
|
+
"data-ick-action": e,
|
|
519
524
|
icon: t,
|
|
520
525
|
onClick: n,
|
|
521
526
|
"aria-label": r,
|
|
@@ -528,12 +533,12 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
|
|
|
528
533
|
//#endregion
|
|
529
534
|
//#region src/ChatInput/AddCardsOverlay.tsx
|
|
530
535
|
function ze() {
|
|
531
|
-
let e =
|
|
536
|
+
let e = H("input");
|
|
532
537
|
return [
|
|
533
538
|
{
|
|
534
539
|
id: "attach",
|
|
535
540
|
label: e.attach,
|
|
536
|
-
icon: /* @__PURE__ */ _(
|
|
541
|
+
icon: /* @__PURE__ */ _(z, {
|
|
537
542
|
size: 16,
|
|
538
543
|
"aria-hidden": !0
|
|
539
544
|
})
|
|
@@ -541,7 +546,7 @@ function ze() {
|
|
|
541
546
|
{
|
|
542
547
|
id: "design",
|
|
543
548
|
label: e.design,
|
|
544
|
-
icon: /* @__PURE__ */ _(
|
|
549
|
+
icon: /* @__PURE__ */ _(de, {
|
|
545
550
|
size: 16,
|
|
546
551
|
"aria-hidden": !0
|
|
547
552
|
})
|
|
@@ -549,7 +554,7 @@ function ze() {
|
|
|
549
554
|
{
|
|
550
555
|
id: "connectors",
|
|
551
556
|
label: e.connectors,
|
|
552
|
-
icon: /* @__PURE__ */ _(
|
|
557
|
+
icon: /* @__PURE__ */ _(ie, {
|
|
553
558
|
size: 16,
|
|
554
559
|
"aria-hidden": !0
|
|
555
560
|
})
|
|
@@ -557,7 +562,7 @@ function ze() {
|
|
|
557
562
|
];
|
|
558
563
|
}
|
|
559
564
|
function Be({ isAddOpen: e, setIsAddOpen: t, onAdd: n, items: r, showInlineGlyph: i, showButtons: a, ac: o }) {
|
|
560
|
-
let s = ze(), c = r ?? s, { closeMenu: l } =
|
|
565
|
+
let s = ze(), c = r ?? s, { closeMenu: l } = H("input");
|
|
561
566
|
return /* @__PURE__ */ _(y, { children: e && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(C.div, {
|
|
562
567
|
className: W.addBackdrop,
|
|
563
568
|
initial: { opacity: 0 },
|
|
@@ -661,9 +666,10 @@ function Be({ isAddOpen: e, setIsAddOpen: t, onAdd: n, items: r, showInlineGlyph
|
|
|
661
666
|
pointerEvents: "auto",
|
|
662
667
|
zIndex: 10
|
|
663
668
|
},
|
|
664
|
-
children: /* @__PURE__ */ _(
|
|
669
|
+
children: /* @__PURE__ */ _(V, {
|
|
665
670
|
variant: "ghost",
|
|
666
|
-
|
|
671
|
+
"data-ick-role": "add-close",
|
|
672
|
+
icon: /* @__PURE__ */ _(we, {
|
|
667
673
|
size: 14,
|
|
668
674
|
"aria-hidden": !0
|
|
669
675
|
}),
|
|
@@ -709,13 +715,13 @@ function Ke(e, t = "polite") {
|
|
|
709
715
|
}
|
|
710
716
|
//#endregion
|
|
711
717
|
//#region src/reducedMotion/reducedMotion.ts
|
|
712
|
-
var
|
|
713
|
-
function
|
|
714
|
-
return
|
|
718
|
+
var qe = "(prefers-reduced-motion: reduce)", Je;
|
|
719
|
+
function G() {
|
|
720
|
+
return Je === void 0 && (Je = typeof window < "u" && window.matchMedia ? window.matchMedia(qe) : null), Je?.matches ?? !1;
|
|
715
721
|
}
|
|
716
722
|
//#endregion
|
|
717
723
|
//#region src/voice/useVoiceInput.ts
|
|
718
|
-
var
|
|
724
|
+
var K = .6, q = .02, Ye = () => () => {}, Xe = () => typeof window < "u" && typeof navigator < "u" && !!navigator.mediaDevices?.getUserMedia && window.MediaRecorder !== void 0, Ze = () => {
|
|
719
725
|
let e = [
|
|
720
726
|
"audio/webm;codecs=opus",
|
|
721
727
|
"audio/webm",
|
|
@@ -730,7 +736,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
|
|
|
730
736
|
onTranscript: t,
|
|
731
737
|
onDone: n
|
|
732
738
|
}), w = p({
|
|
733
|
-
...
|
|
739
|
+
...Oe.voice,
|
|
734
740
|
...i
|
|
735
741
|
});
|
|
736
742
|
c(() => {
|
|
@@ -739,7 +745,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
|
|
|
739
745
|
onTranscript: t,
|
|
740
746
|
onDone: n
|
|
741
747
|
}, w.current = {
|
|
742
|
-
...
|
|
748
|
+
...Oe.voice,
|
|
743
749
|
...i
|
|
744
750
|
};
|
|
745
751
|
});
|
|
@@ -750,7 +756,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
|
|
|
750
756
|
S.current = !0, x.current?.abort(), T();
|
|
751
757
|
}, [T]);
|
|
752
758
|
let E = o((e) => {
|
|
753
|
-
if (
|
|
759
|
+
if (G()) return;
|
|
754
760
|
let t = new Uint8Array(e.fftSize), n = 0, i = () => {
|
|
755
761
|
e.getByteTimeDomainData(t);
|
|
756
762
|
let a = 0;
|
|
@@ -758,8 +764,8 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
|
|
|
758
764
|
let t = (e - 128) / 128;
|
|
759
765
|
a += t * t;
|
|
760
766
|
}
|
|
761
|
-
let o = Math.sqrt(a / t.length), s = o <
|
|
762
|
-
n = n *
|
|
767
|
+
let o = Math.sqrt(a / t.length), s = o < q ? 0 : Math.min(1, o * 3);
|
|
768
|
+
n = n * K + s * .4, r?.current?.style.setProperty("--ick-voice-level", n.toFixed(3)), y.current = requestAnimationFrame(i);
|
|
763
769
|
};
|
|
764
770
|
y.current = requestAnimationFrame(i);
|
|
765
771
|
}, [r]), D = o(async (e) => {
|
|
@@ -952,24 +958,24 @@ var at = {
|
|
|
952
958
|
n.deleteContents();
|
|
953
959
|
let r = document.createTextNode(e);
|
|
954
960
|
return n.insertNode(r), n.setStartAfter(r), n.collapse(!0), t.removeAllRanges(), t.addRange(n), !1;
|
|
955
|
-
}, st = r(function({ state: e, value: t, onChange: n, onSubmit: r, onStop: i, onAdd: a, attachments: s, onAttach: d, onRemoveAttachment: f, accept: h = "image/*", multiple: T = !1, onTranscribe: E, onCopy: D, onEdit: O, onCancelEdit: k, isEditing: A = !1, busy: j = !1, placeholder: M, menu: N, labels: ee, animationConfig: P, style: F }, I) {
|
|
956
|
-
let
|
|
961
|
+
}, st = r(function({ state: e, value: t, onChange: n, onSubmit: r, onStop: i, onAdd: a, attachments: s, onAttach: d, onRemoveAttachment: f, accept: h = "image/*", multiple: T = !1, onTranscribe: E, onCopy: D, onEdit: O, onCancelEdit: k, isEditing: A = !1, busy: j = !1, placeholder: M, menu: N, labels: ee, onLanded: te, animationConfig: P, style: F }, I) {
|
|
962
|
+
let ne = l(), L = H("input", ee), re = H("voice"), ie = M ?? L.placeholder, R = N !== !1, ae = p(null), oe = p(null), se = p(null), ce = p(null), [le, ue] = m(0), de = p(!1), z = p(null), [fe, me] = m(!1), [he, ge] = m(!1), [_e, ve] = m(!1), [ye, be] = m(!0), [xe, Se] = m(!1), [Ce, B] = m(!1), [Te, Ee] = m(!1), De = p(0), Oe = p(!1), ke = p(0), Ae = p(!1), je = p(null);
|
|
957
963
|
c(() => () => {
|
|
958
|
-
|
|
964
|
+
je.current && clearTimeout(je.current);
|
|
959
965
|
}, []);
|
|
960
|
-
let
|
|
961
|
-
|
|
962
|
-
let
|
|
963
|
-
|
|
964
|
-
let
|
|
966
|
+
let Me = w(), U = p(e), Ne = p(P);
|
|
967
|
+
Ne.current = P;
|
|
968
|
+
let Pe = p(null), [Ie, ze] = m([]), Ve = s ?? Ie, He = p(Ve);
|
|
969
|
+
He.current = Ve;
|
|
970
|
+
let Ue = p([]);
|
|
965
971
|
c(() => () => {
|
|
966
|
-
|
|
972
|
+
Ue.current.forEach((e) => URL.revokeObjectURL(e)), Ue.current = [];
|
|
967
973
|
}, []);
|
|
968
|
-
let
|
|
974
|
+
let We = o((e) => {
|
|
969
975
|
if (!e) return;
|
|
970
|
-
let t =
|
|
971
|
-
t !== -1 && (URL.revokeObjectURL(e),
|
|
972
|
-
}, []),
|
|
976
|
+
let t = Ue.current.indexOf(e);
|
|
977
|
+
t !== -1 && (URL.revokeObjectURL(e), Ue.current.splice(t, 1));
|
|
978
|
+
}, []), Ge = (e) => {
|
|
973
979
|
let t = Array.from(e.target.files ?? []);
|
|
974
980
|
if (e.target.value = "", t.length === 0) return;
|
|
975
981
|
if (d) {
|
|
@@ -978,7 +984,7 @@ var at = {
|
|
|
978
984
|
}
|
|
979
985
|
let n = t.map((e) => {
|
|
980
986
|
let t = URL.createObjectURL(e);
|
|
981
|
-
return
|
|
987
|
+
return Ue.current.push(t), {
|
|
982
988
|
id: `${e.name}-${e.size}-${e.lastModified}`,
|
|
983
989
|
name: e.name,
|
|
984
990
|
type: e.type,
|
|
@@ -986,57 +992,57 @@ var at = {
|
|
|
986
992
|
url: t
|
|
987
993
|
};
|
|
988
994
|
});
|
|
989
|
-
|
|
995
|
+
ze((e) => {
|
|
990
996
|
if (T) return [...e, ...n];
|
|
991
997
|
let t = n.slice(-1);
|
|
992
|
-
return e.forEach((e) =>
|
|
998
|
+
return e.forEach((e) => We(e.url)), n.slice(0, -1).forEach((e) => We(e.url)), t;
|
|
993
999
|
});
|
|
994
|
-
},
|
|
1000
|
+
}, Ke = o((e) => {
|
|
995
1001
|
if (f) {
|
|
996
1002
|
f(e);
|
|
997
1003
|
return;
|
|
998
1004
|
}
|
|
999
|
-
|
|
1000
|
-
}, [f,
|
|
1005
|
+
ze((t) => (We(t.find((t) => t.id === e)?.url), t.filter((t) => t.id !== e)));
|
|
1006
|
+
}, [f, We]);
|
|
1001
1007
|
u(I, () => ({
|
|
1002
|
-
focus: (e) =>
|
|
1008
|
+
focus: (e) => ae.current?.focus(e),
|
|
1003
1009
|
setValue: (e) => {
|
|
1004
|
-
let t =
|
|
1010
|
+
let t = ae.current;
|
|
1005
1011
|
t && (t.textContent = e, $e(t)), n(e);
|
|
1006
1012
|
},
|
|
1007
1013
|
getValue: () => t
|
|
1008
1014
|
}), [n, t]);
|
|
1009
|
-
let
|
|
1015
|
+
let qe = p(null), Je = p(null), G = p(null);
|
|
1010
1016
|
c(() => {
|
|
1011
1017
|
if (!E) return;
|
|
1012
|
-
let e =
|
|
1018
|
+
let e = ae.current;
|
|
1013
1019
|
if (!e) return;
|
|
1014
1020
|
let t = () => {
|
|
1015
1021
|
let t = window.getSelection();
|
|
1016
|
-
!t || t.rangeCount === 0 || e.contains(t.getRangeAt(0).endContainer) && (
|
|
1022
|
+
!t || t.rangeCount === 0 || e.contains(t.getRangeAt(0).endContainer) && (G.current = et(e));
|
|
1017
1023
|
};
|
|
1018
1024
|
return document.addEventListener("selectionchange", t), () => document.removeEventListener("selectionchange", t);
|
|
1019
1025
|
}, [E]);
|
|
1020
|
-
let
|
|
1026
|
+
let K = Qe({
|
|
1021
1027
|
onTranscribe: E,
|
|
1022
1028
|
onTranscript: o((e) => {
|
|
1023
|
-
let t =
|
|
1029
|
+
let t = Je.current, r = ae.current;
|
|
1024
1030
|
if (!t || !r) return;
|
|
1025
1031
|
let i = t.base.slice(0, t.at) + e + t.base.slice(t.at);
|
|
1026
1032
|
r.textContent = i, tt(r, t.at + e.length), n(i);
|
|
1027
1033
|
}, [n]),
|
|
1028
1034
|
onDone: () => {
|
|
1029
|
-
|
|
1035
|
+
Je.current = null, ae.current?.focus();
|
|
1030
1036
|
},
|
|
1031
|
-
meterRef:
|
|
1032
|
-
labels:
|
|
1033
|
-
}),
|
|
1037
|
+
meterRef: qe,
|
|
1038
|
+
labels: re
|
|
1039
|
+
}), q = e === "responding" || e === "resting", Ye = q, Xe = t.trim().length > 0 || Ve.length > 0, Ze = e === "typing" || e === "idle", rt = Ze && Xe && !j, st = !!i && (e === "responding" || j && Ze), ct = j && Ze && Xe && !i, lt = e === "resting" && fe, ut = lt, dt = e === "resting" && Ce, ft = K.state === "listening" || K.state === "requesting" || K.state === "transcribing", pt = !!E && K.supported && !A, mt = rt || st || ct, J = P, ht = J ? {
|
|
1034
1040
|
type: "spring",
|
|
1035
1041
|
stiffness: J.bubble.stiffness,
|
|
1036
1042
|
damping: J.bubble.damping,
|
|
1037
1043
|
mass: J.bubble.mass
|
|
1038
|
-
} : at,
|
|
1039
|
-
let e =
|
|
1044
|
+
} : at, gt = o(() => {
|
|
1045
|
+
let e = oe.current, t = se.current;
|
|
1040
1046
|
if (!e || !t) return;
|
|
1041
1047
|
if (!(e.scrollHeight > e.clientHeight)) {
|
|
1042
1048
|
t.removeAttribute("data-fade");
|
|
@@ -1046,32 +1052,43 @@ var at = {
|
|
|
1046
1052
|
!n && !r ? t.dataset.fade = "both" : n ? r ? t.removeAttribute("data-fade") : t.dataset.fade = "bottom" : t.dataset.fade = "top";
|
|
1047
1053
|
}, []);
|
|
1048
1054
|
c(() => {
|
|
1049
|
-
let e =
|
|
1050
|
-
if (e) return e.addEventListener("scroll",
|
|
1051
|
-
}, [
|
|
1055
|
+
let e = oe.current;
|
|
1056
|
+
if (e) return e.addEventListener("scroll", gt, { passive: !0 }), () => e.removeEventListener("scroll", gt);
|
|
1057
|
+
}, [gt]), c(() => {
|
|
1052
1058
|
let e = requestAnimationFrame(() => {
|
|
1053
|
-
let e =
|
|
1054
|
-
e && !
|
|
1059
|
+
let e = oe.current;
|
|
1060
|
+
e && !Ye && (e.scrollTop = e.scrollHeight), gt();
|
|
1055
1061
|
});
|
|
1056
1062
|
return () => cancelAnimationFrame(e);
|
|
1057
1063
|
}, [
|
|
1058
1064
|
t,
|
|
1059
|
-
|
|
1060
|
-
|
|
1065
|
+
Ye,
|
|
1066
|
+
gt
|
|
1061
1067
|
]), c(() => {
|
|
1062
|
-
(e === "idle" || e === "typing") &&
|
|
1068
|
+
(e === "idle" || e === "typing") && ae.current?.focus({ preventScroll: !0 });
|
|
1063
1069
|
}, [e]), c(() => {
|
|
1064
|
-
let e =
|
|
1065
|
-
e && (
|
|
1070
|
+
let e = ae.current;
|
|
1071
|
+
e && (De.current = e.scrollHeight || 17);
|
|
1066
1072
|
}, []), c(() => {
|
|
1067
|
-
let e =
|
|
1068
|
-
!e ||
|
|
1069
|
-
|
|
1070
|
-
|
|
1073
|
+
let e = ae.current;
|
|
1074
|
+
if (!e || q) return;
|
|
1075
|
+
let t = e.clientWidth, n = new ResizeObserver(() => {
|
|
1076
|
+
e.clientWidth !== t && (t = e.clientWidth, !e.textContent && e.scrollHeight && (De.current = e.scrollHeight));
|
|
1077
|
+
});
|
|
1078
|
+
return n.observe(e), () => n.disconnect();
|
|
1079
|
+
}, [q]), c(() => {
|
|
1080
|
+
let e = ae.current, n = z.current;
|
|
1081
|
+
!e || !De.current || requestAnimationFrame(() => {
|
|
1082
|
+
let r = n ? n.offsetWidth : 0, i = e.clientWidth - 16, a = (oe.current?.scrollHeight ?? 0) > De.current + 2, o = Ne.current, s = t.length === 0;
|
|
1083
|
+
if (!Oe.current) ke.current = i, !s && (a || r >= ke.current * (o?.wrap?.nearThreshold ?? .92)) && (Oe.current = !0, Ae.current = !0, be(!1));
|
|
1084
|
+
else {
|
|
1085
|
+
let e = a || r >= i - 2;
|
|
1086
|
+
(s || !e && r < ke.current * (o?.wrap?.exitThreshold ?? .75)) && (Oe.current = !1, Ae.current = !1, ve(!1), be(!0), je.current &&= (clearTimeout(je.current), null));
|
|
1087
|
+
}
|
|
1071
1088
|
});
|
|
1072
1089
|
}, [t]), c(() => {
|
|
1073
|
-
if (!
|
|
1074
|
-
let e =
|
|
1090
|
+
if (!q) return;
|
|
1091
|
+
let e = oe.current;
|
|
1075
1092
|
if (!e || e.scrollTop === 0) return;
|
|
1076
1093
|
let t = e.scrollTop;
|
|
1077
1094
|
S(t, 0, {
|
|
@@ -1083,25 +1100,44 @@ var at = {
|
|
|
1083
1100
|
e.scrollTop = t;
|
|
1084
1101
|
}
|
|
1085
1102
|
});
|
|
1086
|
-
}, [
|
|
1087
|
-
|
|
1088
|
-
}, [
|
|
1089
|
-
if (!
|
|
1090
|
-
let e =
|
|
1091
|
-
e && (
|
|
1103
|
+
}, [q]), c(() => {
|
|
1104
|
+
q ? Ee(!1) : (Se(!1), B(!1));
|
|
1105
|
+
}, [q]), c(() => {
|
|
1106
|
+
if (!q) return;
|
|
1107
|
+
let e = se.current;
|
|
1108
|
+
e && (Ce && !xe ? e.dataset.fade = "bottom" : e.removeAttribute("data-fade"));
|
|
1092
1109
|
}, [
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1110
|
+
q,
|
|
1111
|
+
Ce,
|
|
1112
|
+
xe
|
|
1096
1113
|
]), c(() => {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
}),
|
|
1103
|
-
|
|
1104
|
-
|
|
1114
|
+
if (e !== "resting") return;
|
|
1115
|
+
let t = oe.current, n = ae.current;
|
|
1116
|
+
if (!t || !n) return;
|
|
1117
|
+
let r = () => {
|
|
1118
|
+
ue(t.scrollHeight), B(t.scrollHeight > 241), gt();
|
|
1119
|
+
}, i = requestAnimationFrame(r), a = new ResizeObserver(r);
|
|
1120
|
+
return a.observe(n), () => {
|
|
1121
|
+
cancelAnimationFrame(i), a.disconnect();
|
|
1122
|
+
};
|
|
1123
|
+
}, [e, gt]), c(() => {
|
|
1124
|
+
let e = ce.current;
|
|
1125
|
+
if (!te || !e) return;
|
|
1126
|
+
let t = performance.now(), n = e.getBoundingClientRect().top, r = 0, i = 0, a = 0, o = () => {
|
|
1127
|
+
let s = e.getBoundingClientRect().top, c = Math.abs(s - n);
|
|
1128
|
+
if (n = s, r += c, i = c < .5 ? i + 1 : 0, r > 3 && i >= 2 || r <= 3 && performance.now() - t > 150) {
|
|
1129
|
+
te();
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
a = requestAnimationFrame(o);
|
|
1133
|
+
};
|
|
1134
|
+
return a = requestAnimationFrame(o), () => cancelAnimationFrame(a);
|
|
1135
|
+
}, [te]), c(() => {
|
|
1136
|
+
let t = U.current;
|
|
1137
|
+
if (U.current = e, t !== "responding" || e !== "resting") return;
|
|
1138
|
+
ge(!0);
|
|
1139
|
+
let n = Ne.current;
|
|
1140
|
+
Me.start({
|
|
1105
1141
|
scaleX: [
|
|
1106
1142
|
1,
|
|
1107
1143
|
n?.ripple?.scaleX ?? 1.018,
|
|
@@ -1122,35 +1158,35 @@ var at = {
|
|
|
1122
1158
|
]
|
|
1123
1159
|
}
|
|
1124
1160
|
});
|
|
1125
|
-
let r = window.setTimeout(() =>
|
|
1161
|
+
let r = window.setTimeout(() => ge(!1), n?.ripple?.pulseDuration ?? 260);
|
|
1126
1162
|
return () => clearTimeout(r);
|
|
1127
1163
|
}, [
|
|
1128
1164
|
e,
|
|
1129
|
-
|
|
1130
|
-
|
|
1165
|
+
Me,
|
|
1166
|
+
gt
|
|
1131
1167
|
]);
|
|
1132
|
-
let
|
|
1133
|
-
let e =
|
|
1134
|
-
e && (
|
|
1135
|
-
}, [n]),
|
|
1136
|
-
e.preventDefault(), ot(e.clipboardData.getData("text/plain")) ||
|
|
1137
|
-
}, [
|
|
1168
|
+
let Y = o(() => {
|
|
1169
|
+
let e = ae.current;
|
|
1170
|
+
e && (de.current = !0, n(e.textContent ?? ""));
|
|
1171
|
+
}, [n]), _t = o((e) => {
|
|
1172
|
+
e.preventDefault(), ot(e.clipboardData.getData("text/plain")) || Y();
|
|
1173
|
+
}, [Y]), vt = o((e) => {
|
|
1138
1174
|
if (e.key === "Enter") {
|
|
1139
|
-
if (e.preventDefault(), e.shiftKey) ot("\n") ||
|
|
1175
|
+
if (e.preventDefault(), e.shiftKey) ot("\n") || Y();
|
|
1140
1176
|
else if (j) return;
|
|
1141
|
-
else (t.trim().length > 0 ||
|
|
1177
|
+
else (t.trim().length > 0 || He.current.length > 0) && r(t, He.current);
|
|
1142
1178
|
}
|
|
1143
1179
|
}, [
|
|
1144
1180
|
t,
|
|
1145
1181
|
r,
|
|
1146
|
-
|
|
1182
|
+
Y,
|
|
1147
1183
|
j
|
|
1148
1184
|
]);
|
|
1149
1185
|
return c(() => {
|
|
1150
|
-
let e =
|
|
1186
|
+
let e = ae.current;
|
|
1151
1187
|
if (e) {
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1188
|
+
if (de.current) {
|
|
1189
|
+
de.current = !1;
|
|
1154
1190
|
return;
|
|
1155
1191
|
}
|
|
1156
1192
|
e.textContent !== t && (e.textContent = t, document.activeElement === e && $e(e));
|
|
@@ -1158,24 +1194,25 @@ var at = {
|
|
|
1158
1194
|
}, [t]), /* @__PURE__ */ _(x, {
|
|
1159
1195
|
reducedMotion: "user",
|
|
1160
1196
|
children: /* @__PURE__ */ _(b, {
|
|
1161
|
-
id:
|
|
1197
|
+
id: ne,
|
|
1162
1198
|
children: /* @__PURE__ */ v("div", {
|
|
1163
1199
|
className: W.wrap,
|
|
1164
|
-
onMouseEnter: () =>
|
|
1165
|
-
onMouseLeave: () =>
|
|
1200
|
+
onMouseEnter: () => me(!0),
|
|
1201
|
+
onMouseLeave: () => me(!1),
|
|
1166
1202
|
style: F,
|
|
1167
1203
|
children: [
|
|
1168
1204
|
/* @__PURE__ */ _(C.div, {
|
|
1169
|
-
className: `${W.root} ${
|
|
1205
|
+
className: `${W.root} ${q ? W.isGlassRoot : ""}`,
|
|
1206
|
+
ref: ce,
|
|
1170
1207
|
layout: !0,
|
|
1171
|
-
animate: { filter:
|
|
1208
|
+
animate: { filter: Te ? `blur(${J?.addCards?.inputBlur ?? 2}px)` : "blur(0px)" },
|
|
1172
1209
|
style: {
|
|
1173
|
-
pointerEvents:
|
|
1210
|
+
pointerEvents: Te ? "none" : "auto",
|
|
1174
1211
|
width: F?.width === "100%" ? "100%" : void 0,
|
|
1175
1212
|
maxWidth: F?.maxWidth
|
|
1176
1213
|
},
|
|
1177
1214
|
transition: {
|
|
1178
|
-
...
|
|
1215
|
+
...ht,
|
|
1179
1216
|
filter: {
|
|
1180
1217
|
type: "tween",
|
|
1181
1218
|
duration: .2,
|
|
@@ -1183,25 +1220,25 @@ var at = {
|
|
|
1183
1220
|
}
|
|
1184
1221
|
},
|
|
1185
1222
|
children: /* @__PURE__ */ v(C.div, {
|
|
1186
|
-
className: `${W.surface} ${
|
|
1223
|
+
className: `${W.surface} ${q ? W.glass : ""} ${lt ? W.hovered : ""} ${he ? W.pulsed : ""}`,
|
|
1187
1224
|
style: {
|
|
1188
1225
|
alignItems: "stretch",
|
|
1189
1226
|
flexDirection: "column",
|
|
1190
1227
|
justifyContent: "center"
|
|
1191
1228
|
},
|
|
1192
|
-
transition:
|
|
1193
|
-
animate:
|
|
1194
|
-
onClick: () =>
|
|
1229
|
+
transition: ht,
|
|
1230
|
+
animate: Me,
|
|
1231
|
+
onClick: () => ae.current?.focus(),
|
|
1195
1232
|
children: [
|
|
1196
1233
|
/* @__PURE__ */ _("input", {
|
|
1197
1234
|
type: "file",
|
|
1198
|
-
ref:
|
|
1235
|
+
ref: Pe,
|
|
1199
1236
|
accept: h,
|
|
1200
1237
|
multiple: T,
|
|
1201
1238
|
style: { display: "none" },
|
|
1202
|
-
onChange:
|
|
1239
|
+
onChange: Ge
|
|
1203
1240
|
}),
|
|
1204
|
-
/* @__PURE__ */ _(y, { children:
|
|
1241
|
+
/* @__PURE__ */ _(y, { children: Ve.length > 0 && /* @__PURE__ */ _(C.div, {
|
|
1205
1242
|
initial: {
|
|
1206
1243
|
opacity: 0,
|
|
1207
1244
|
height: 0
|
|
@@ -1226,10 +1263,10 @@ var at = {
|
|
|
1226
1263
|
},
|
|
1227
1264
|
children: /* @__PURE__ */ _("div", {
|
|
1228
1265
|
className: W.attachedTray,
|
|
1229
|
-
"data-glass":
|
|
1266
|
+
"data-glass": q || void 0,
|
|
1230
1267
|
children: /* @__PURE__ */ _(Fe, {
|
|
1231
|
-
attachments:
|
|
1232
|
-
onRemove:
|
|
1268
|
+
attachments: Ve,
|
|
1269
|
+
onRemove: q ? void 0 : Ke
|
|
1233
1270
|
})
|
|
1234
1271
|
})
|
|
1235
1272
|
}) }),
|
|
@@ -1238,15 +1275,15 @@ var at = {
|
|
|
1238
1275
|
display: "flex",
|
|
1239
1276
|
flexDirection: "row",
|
|
1240
1277
|
alignItems: "center",
|
|
1241
|
-
flexWrap:
|
|
1242
|
-
justifyContent:
|
|
1278
|
+
flexWrap: _e ? "wrap" : "nowrap",
|
|
1279
|
+
justifyContent: _e ? "flex-end" : "flex-start",
|
|
1243
1280
|
width: "100%",
|
|
1244
1281
|
minWidth: 0,
|
|
1245
1282
|
flex: 1
|
|
1246
1283
|
},
|
|
1247
1284
|
children: [
|
|
1248
1285
|
/* @__PURE__ */ _("span", {
|
|
1249
|
-
ref:
|
|
1286
|
+
ref: z,
|
|
1250
1287
|
"aria-hidden": "true",
|
|
1251
1288
|
style: {
|
|
1252
1289
|
position: "absolute",
|
|
@@ -1259,16 +1296,16 @@ var at = {
|
|
|
1259
1296
|
children: t
|
|
1260
1297
|
}),
|
|
1261
1298
|
/* @__PURE__ */ _("div", {
|
|
1262
|
-
ref:
|
|
1299
|
+
ref: se,
|
|
1263
1300
|
className: W.editorClip,
|
|
1264
|
-
style: { flexBasis:
|
|
1301
|
+
style: { flexBasis: _e ? "100%" : void 0 },
|
|
1265
1302
|
children: /* @__PURE__ */ _(C.div, {
|
|
1266
|
-
ref:
|
|
1267
|
-
className: `${W.editorWrap} ${
|
|
1303
|
+
ref: oe,
|
|
1304
|
+
className: `${W.editorWrap} ${q ? W.editorWrapGlass : ""}`,
|
|
1268
1305
|
layout: "position",
|
|
1269
|
-
animate:
|
|
1306
|
+
animate: q && Ce ? { maxHeight: xe ? le : 240 } : void 0,
|
|
1270
1307
|
transition: {
|
|
1271
|
-
...
|
|
1308
|
+
...ht,
|
|
1272
1309
|
maxHeight: {
|
|
1273
1310
|
type: "spring",
|
|
1274
1311
|
stiffness: 300,
|
|
@@ -1277,24 +1314,24 @@ var at = {
|
|
|
1277
1314
|
}
|
|
1278
1315
|
},
|
|
1279
1316
|
children: /* @__PURE__ */ _("div", {
|
|
1280
|
-
ref:
|
|
1317
|
+
ref: ae,
|
|
1281
1318
|
className: W.editor,
|
|
1282
|
-
contentEditable:
|
|
1319
|
+
contentEditable: Ye ? "false" : "plaintext-only",
|
|
1283
1320
|
suppressContentEditableWarning: !0,
|
|
1284
|
-
onInput:
|
|
1285
|
-
onKeyDown:
|
|
1286
|
-
onPaste:
|
|
1321
|
+
onInput: Y,
|
|
1322
|
+
onKeyDown: vt,
|
|
1323
|
+
onPaste: _t,
|
|
1287
1324
|
spellCheck: !1,
|
|
1288
1325
|
role: "textbox",
|
|
1289
1326
|
"aria-multiline": "true",
|
|
1290
|
-
"aria-label":
|
|
1291
|
-
"data-placeholder":
|
|
1327
|
+
"aria-label": ie,
|
|
1328
|
+
"data-placeholder": Ye ? "" : ie
|
|
1292
1329
|
})
|
|
1293
1330
|
})
|
|
1294
1331
|
}),
|
|
1295
1332
|
/* @__PURE__ */ v("div", {
|
|
1296
1333
|
className: W.buttonGroup,
|
|
1297
|
-
children: [!
|
|
1334
|
+
children: [!q && ye && pt && /* @__PURE__ */ _(C.div, {
|
|
1298
1335
|
initial: {
|
|
1299
1336
|
opacity: 0,
|
|
1300
1337
|
scale: nt,
|
|
@@ -1312,7 +1349,7 @@ var at = {
|
|
|
1312
1349
|
scale: nt,
|
|
1313
1350
|
width: 0,
|
|
1314
1351
|
marginLeft: 0,
|
|
1315
|
-
transition:
|
|
1352
|
+
transition: Ae.current ? {
|
|
1316
1353
|
type: "tween",
|
|
1317
1354
|
duration: J?.wrap?.exitDuration ?? .15,
|
|
1318
1355
|
ease: "easeOut",
|
|
@@ -1337,34 +1374,35 @@ var at = {
|
|
|
1337
1374
|
position: "relative",
|
|
1338
1375
|
height: 28
|
|
1339
1376
|
},
|
|
1340
|
-
children: /* @__PURE__ */ _(
|
|
1377
|
+
children: /* @__PURE__ */ _(V, {
|
|
1341
1378
|
variant: "ghost",
|
|
1342
|
-
"data-
|
|
1379
|
+
"data-ick-role": "dictate",
|
|
1380
|
+
"data-voice": K.state,
|
|
1343
1381
|
icon: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
1344
|
-
ref:
|
|
1382
|
+
ref: qe,
|
|
1345
1383
|
className: W.voiceMeter,
|
|
1346
|
-
"data-live":
|
|
1384
|
+
"data-live": K.state === "listening" || void 0,
|
|
1347
1385
|
"aria-hidden": !0
|
|
1348
1386
|
}), /* @__PURE__ */ _(Le, {
|
|
1349
|
-
mode:
|
|
1387
|
+
mode: K.state === "listening" || K.state === "transcribing" ? "stop" : "mic",
|
|
1350
1388
|
size: 14
|
|
1351
1389
|
})] }),
|
|
1352
1390
|
onClick: (e) => {
|
|
1353
|
-
if (e.stopPropagation(),
|
|
1354
|
-
if (!
|
|
1355
|
-
let e = Math.min(
|
|
1356
|
-
|
|
1391
|
+
if (e.stopPropagation(), K.state !== "denied") {
|
|
1392
|
+
if (!ft) {
|
|
1393
|
+
let e = Math.min(G.current ?? t.length, t.length);
|
|
1394
|
+
Je.current = {
|
|
1357
1395
|
base: t,
|
|
1358
1396
|
at: e
|
|
1359
1397
|
};
|
|
1360
1398
|
}
|
|
1361
|
-
|
|
1399
|
+
K.toggle();
|
|
1362
1400
|
}
|
|
1363
1401
|
},
|
|
1364
|
-
"aria-busy":
|
|
1365
|
-
"aria-pressed":
|
|
1366
|
-
disabled:
|
|
1367
|
-
"aria-label":
|
|
1402
|
+
"aria-busy": K.state === "requesting" || K.state === "transcribing",
|
|
1403
|
+
"aria-pressed": K.state === "listening",
|
|
1404
|
+
disabled: K.state === "denied",
|
|
1405
|
+
"aria-label": K.state === "listening" ? L.stopListening : K.state === "requesting" ? L.waitingForMicrophone : K.state === "transcribing" ? L.cancelTranscription : K.state === "denied" ? L.microphoneBlocked : L.dictate,
|
|
1368
1406
|
style: {
|
|
1369
1407
|
width: "100%",
|
|
1370
1408
|
height: "100%",
|
|
@@ -1374,11 +1412,11 @@ var at = {
|
|
|
1374
1412
|
}, "mic"), /* @__PURE__ */ v(y, {
|
|
1375
1413
|
initial: !1,
|
|
1376
1414
|
onExitComplete: () => {
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
},
|
|
1415
|
+
Ae.current && (Ae.current = !1, ve(!0), je.current && clearTimeout(je.current), je.current = window.setTimeout(() => {
|
|
1416
|
+
be(!0), je.current = null;
|
|
1417
|
+
}, Ne.current?.wrap?.slideInDelay ?? 120));
|
|
1380
1418
|
},
|
|
1381
|
-
children: [!
|
|
1419
|
+
children: [!q && ye && (R || A) && /* @__PURE__ */ _(C.div, {
|
|
1382
1420
|
initial: {
|
|
1383
1421
|
opacity: 0,
|
|
1384
1422
|
scale: nt,
|
|
@@ -1393,7 +1431,7 @@ var at = {
|
|
|
1393
1431
|
opacity: 0,
|
|
1394
1432
|
scale: nt,
|
|
1395
1433
|
width: 0,
|
|
1396
|
-
transition:
|
|
1434
|
+
transition: Ae.current ? {
|
|
1397
1435
|
type: "tween",
|
|
1398
1436
|
duration: J?.wrap?.exitDuration ?? .15,
|
|
1399
1437
|
ease: "easeOut",
|
|
@@ -1445,23 +1483,24 @@ var at = {
|
|
|
1445
1483
|
position: "absolute",
|
|
1446
1484
|
inset: 0
|
|
1447
1485
|
},
|
|
1448
|
-
children: /* @__PURE__ */ _(
|
|
1486
|
+
children: /* @__PURE__ */ _(V, {
|
|
1449
1487
|
variant: "ghost",
|
|
1450
|
-
|
|
1488
|
+
"data-ick-role": "cancel-edit",
|
|
1489
|
+
icon: /* @__PURE__ */ _(we, {
|
|
1451
1490
|
size: 14,
|
|
1452
1491
|
"aria-hidden": !0
|
|
1453
1492
|
}),
|
|
1454
1493
|
onClick: (e) => {
|
|
1455
1494
|
e.stopPropagation(), k?.();
|
|
1456
1495
|
},
|
|
1457
|
-
"aria-label":
|
|
1458
|
-
title:
|
|
1496
|
+
"aria-label": L.cancelEdit,
|
|
1497
|
+
title: L.cancelEdit,
|
|
1459
1498
|
style: {
|
|
1460
1499
|
width: "100%",
|
|
1461
1500
|
height: "100%"
|
|
1462
1501
|
}
|
|
1463
1502
|
})
|
|
1464
|
-
}, "cancel-btn") :
|
|
1503
|
+
}, "cancel-btn") : R && !Te ? /* @__PURE__ */ _(C.div, {
|
|
1465
1504
|
initial: {
|
|
1466
1505
|
opacity: 0,
|
|
1467
1506
|
scale: .5
|
|
@@ -1482,17 +1521,18 @@ var at = {
|
|
|
1482
1521
|
position: "absolute",
|
|
1483
1522
|
inset: 0
|
|
1484
1523
|
},
|
|
1485
|
-
children: /* @__PURE__ */ _(
|
|
1524
|
+
children: /* @__PURE__ */ _(V, {
|
|
1486
1525
|
variant: "ghost",
|
|
1487
|
-
|
|
1526
|
+
"data-ick-role": "add",
|
|
1527
|
+
icon: /* @__PURE__ */ _(pe, {
|
|
1488
1528
|
size: 14,
|
|
1489
1529
|
"aria-hidden": !0
|
|
1490
1530
|
}),
|
|
1491
1531
|
onClick: (e) => {
|
|
1492
|
-
e.stopPropagation(),
|
|
1532
|
+
e.stopPropagation(), Ee(!0);
|
|
1493
1533
|
},
|
|
1494
|
-
"aria-label":
|
|
1495
|
-
title:
|
|
1534
|
+
"aria-label": L.add,
|
|
1535
|
+
title: L.add,
|
|
1496
1536
|
style: {
|
|
1497
1537
|
width: "100%",
|
|
1498
1538
|
height: "100%"
|
|
@@ -1500,7 +1540,7 @@ var at = {
|
|
|
1500
1540
|
})
|
|
1501
1541
|
}, "plus-btn") : null
|
|
1502
1542
|
})
|
|
1503
|
-
}, "lead"),
|
|
1543
|
+
}, "lead"), mt && ye && /* @__PURE__ */ _(C.div, {
|
|
1504
1544
|
initial: {
|
|
1505
1545
|
opacity: 0,
|
|
1506
1546
|
scale: nt,
|
|
@@ -1518,7 +1558,7 @@ var at = {
|
|
|
1518
1558
|
scale: nt,
|
|
1519
1559
|
width: 0,
|
|
1520
1560
|
marginLeft: 0,
|
|
1521
|
-
transition:
|
|
1561
|
+
transition: Ae.current ? {
|
|
1522
1562
|
type: "tween",
|
|
1523
1563
|
duration: J?.wrap?.exitDuration ?? .15,
|
|
1524
1564
|
ease: "easeOut"
|
|
@@ -1530,8 +1570,8 @@ var at = {
|
|
|
1530
1570
|
type: "tween",
|
|
1531
1571
|
duration: .15
|
|
1532
1572
|
},
|
|
1533
|
-
width: it(
|
|
1534
|
-
marginLeft: it(
|
|
1573
|
+
width: it(ht),
|
|
1574
|
+
marginLeft: it(ht)
|
|
1535
1575
|
}
|
|
1536
1576
|
},
|
|
1537
1577
|
transition: {
|
|
@@ -1552,14 +1592,15 @@ var at = {
|
|
|
1552
1592
|
transformOrigin: "right",
|
|
1553
1593
|
height: 28
|
|
1554
1594
|
},
|
|
1555
|
-
children: /* @__PURE__ */ _(
|
|
1595
|
+
children: /* @__PURE__ */ _(V, {
|
|
1556
1596
|
variant: "primary",
|
|
1557
|
-
|
|
1597
|
+
"data-ick-role": st ? "stop" : A ? "save" : "send",
|
|
1598
|
+
icon: /* @__PURE__ */ _(Le, { mode: st ? "stop" : A ? "check" : "send" }),
|
|
1558
1599
|
onClick: (e) => {
|
|
1559
|
-
e.stopPropagation(),
|
|
1600
|
+
e.stopPropagation(), st ? i?.() : j || r(t, Ve);
|
|
1560
1601
|
},
|
|
1561
|
-
disabled:
|
|
1562
|
-
"aria-label":
|
|
1602
|
+
disabled: ct,
|
|
1603
|
+
"aria-label": st ? L.stop : A ? L.save : L.send,
|
|
1563
1604
|
style: {
|
|
1564
1605
|
flexShrink: 0,
|
|
1565
1606
|
width: 28
|
|
@@ -1574,31 +1615,31 @@ var at = {
|
|
|
1574
1615
|
})
|
|
1575
1616
|
}),
|
|
1576
1617
|
/* @__PURE__ */ _(Be, {
|
|
1577
|
-
isAddOpen:
|
|
1578
|
-
setIsAddOpen:
|
|
1618
|
+
isAddOpen: Te,
|
|
1619
|
+
setIsAddOpen: Ee,
|
|
1579
1620
|
items: N || void 0,
|
|
1580
1621
|
onAdd: (e, t) => {
|
|
1581
1622
|
let n = N ? N.find((e) => e.id === t) : void 0;
|
|
1582
|
-
t === "attach" && !n?.onSelect &&
|
|
1623
|
+
t === "attach" && !n?.onSelect && Pe.current?.click(), a?.();
|
|
1583
1624
|
},
|
|
1584
|
-
showInlineGlyph:
|
|
1585
|
-
showButtons:
|
|
1625
|
+
showInlineGlyph: mt,
|
|
1626
|
+
showButtons: ye,
|
|
1586
1627
|
ac: J
|
|
1587
1628
|
}),
|
|
1588
1629
|
/* @__PURE__ */ _(Re, {
|
|
1589
|
-
showActions:
|
|
1590
|
-
showReadMore:
|
|
1591
|
-
isExpanded:
|
|
1592
|
-
setIsExpanded:
|
|
1630
|
+
showActions: ut,
|
|
1631
|
+
showReadMore: dt,
|
|
1632
|
+
isExpanded: xe,
|
|
1633
|
+
setIsExpanded: Se,
|
|
1593
1634
|
onCopy: D,
|
|
1594
1635
|
onEdit: O,
|
|
1595
1636
|
value: t,
|
|
1596
1637
|
ac: J
|
|
1597
1638
|
}),
|
|
1598
|
-
|
|
1639
|
+
pt && (K.state === "denied" || K.state === "failed") && /* @__PURE__ */ _("p", {
|
|
1599
1640
|
className: W.voiceNote,
|
|
1600
|
-
"data-tone":
|
|
1601
|
-
children:
|
|
1641
|
+
"data-tone": K.state,
|
|
1642
|
+
children: K.state === "denied" ? L.microphoneBlockedHelp : K.error ?? re.couldNotOpen
|
|
1602
1643
|
})
|
|
1603
1644
|
]
|
|
1604
1645
|
})
|
|
@@ -1618,15 +1659,15 @@ function ct(e, t) {
|
|
|
1618
1659
|
}
|
|
1619
1660
|
//#endregion
|
|
1620
1661
|
//#region src/useChatTurns/useChatTurns.ts
|
|
1621
|
-
var lt = 260, ut = 220, dt = "Generating response",
|
|
1622
|
-
id:
|
|
1662
|
+
var lt = 260, ut = 220, dt = "Generating response", ft = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2, 11), pt = () => ({
|
|
1663
|
+
id: ft(),
|
|
1623
1664
|
user: "",
|
|
1624
1665
|
ai: "",
|
|
1625
1666
|
parts: [],
|
|
1626
1667
|
versions: [],
|
|
1627
1668
|
versionIndex: 0,
|
|
1628
1669
|
state: "idle"
|
|
1629
|
-
}),
|
|
1670
|
+
}), mt = (e) => {
|
|
1630
1671
|
let t = e.versions;
|
|
1631
1672
|
if (!t?.length) return e;
|
|
1632
1673
|
let n = e.versionIndex ?? 0, r = t[n];
|
|
@@ -1638,7 +1679,7 @@ var lt = 260, ut = 220, dt = "Generating response", J = () => typeof crypto < "u
|
|
|
1638
1679
|
parts: e.parts
|
|
1639
1680
|
} : t)
|
|
1640
1681
|
};
|
|
1641
|
-
},
|
|
1682
|
+
}, J = (e) => typeof e == "object" && !!e && Symbol.asyncIterator in e, ht = (e, t, n) => {
|
|
1642
1683
|
let r = 1e3 / t, i = Array(e.length), a = 0;
|
|
1643
1684
|
for (let t = 0; t < e.length; t++) {
|
|
1644
1685
|
a += r;
|
|
@@ -1648,7 +1689,7 @@ var lt = 260, ut = 220, dt = "Generating response", J = () => typeof crypto < "u
|
|
|
1648
1689
|
return i;
|
|
1649
1690
|
};
|
|
1650
1691
|
function gt({ onSend: e, revealSpeed: t = lt, sentencePause: n = ut, announcements: r, nextTurn: i = "after-answer" }) {
|
|
1651
|
-
let [a, s] = m(() => [
|
|
1692
|
+
let [a, s] = m(() => [pt()]), [l, u] = m(!1), d = p(null), f = p(null), h = p(/* @__PURE__ */ new Map()), g = p(/* @__PURE__ */ new Map()), _ = p(null), v = p(e), y = p(r), b = p(a);
|
|
1652
1693
|
c(() => {
|
|
1653
1694
|
v.current = e, b.current = a, y.current = r;
|
|
1654
1695
|
});
|
|
@@ -1661,7 +1702,7 @@ function gt({ onSend: e, revealSpeed: t = lt, sentencePause: n = ut, announcemen
|
|
|
1661
1702
|
...n,
|
|
1662
1703
|
...t
|
|
1663
1704
|
};
|
|
1664
|
-
return "versionIndex" in t || "versions" in t ? i :
|
|
1705
|
+
return "versionIndex" in t || "versions" in t ? i : mt(i);
|
|
1665
1706
|
});
|
|
1666
1707
|
return r ? (b.current = i, i) : n;
|
|
1667
1708
|
});
|
|
@@ -1673,7 +1714,7 @@ function gt({ onSend: e, revealSpeed: t = lt, sentencePause: n = ut, announcemen
|
|
|
1673
1714
|
e.clear(), t.clear(), s((e) => {
|
|
1674
1715
|
let t = e.map((e) => {
|
|
1675
1716
|
let t = n.find(([t]) => t === e.id)?.[1], i = r.find(([t]) => t === e.id)?.[1];
|
|
1676
|
-
return t === void 0 && !i ? e :
|
|
1717
|
+
return t === void 0 && !i ? e : mt({
|
|
1677
1718
|
...e,
|
|
1678
1719
|
...t === void 0 ? null : { ai: t },
|
|
1679
1720
|
...i ? { parts: i.reduce(ct, e.parts) } : null
|
|
@@ -1701,13 +1742,13 @@ function gt({ onSend: e, revealSpeed: t = lt, sentencePause: n = ut, announcemen
|
|
|
1701
1742
|
let D = o(() => {
|
|
1702
1743
|
s((e) => {
|
|
1703
1744
|
if (e.some((e) => (e.state === "idle" || e.state === "typing") && e.ai === "")) return e;
|
|
1704
|
-
let t = [...e,
|
|
1745
|
+
let t = [...e, pt()];
|
|
1705
1746
|
return b.current = t, t;
|
|
1706
1747
|
});
|
|
1707
1748
|
}, []), O = o((e, t) => {
|
|
1708
1749
|
u(!1), d.current = null, x(e, { state: "resting" }), t || D();
|
|
1709
1750
|
}, [x, D]), k = o((e, r, i) => new Promise((a) => {
|
|
1710
|
-
if (
|
|
1751
|
+
if (G()) {
|
|
1711
1752
|
w(e, r), a();
|
|
1712
1753
|
return;
|
|
1713
1754
|
}
|
|
@@ -1762,7 +1803,7 @@ function gt({ onSend: e, revealSpeed: t = lt, sentencePause: n = ut, announcemen
|
|
|
1762
1803
|
turnId: e,
|
|
1763
1804
|
attachments: r
|
|
1764
1805
|
});
|
|
1765
|
-
if (
|
|
1806
|
+
if (J(n)) for await (let t of n) {
|
|
1766
1807
|
if (a.signal.aborted) break;
|
|
1767
1808
|
if (typeof t == "string") c += t, w(e, c);
|
|
1768
1809
|
else {
|
|
@@ -1887,7 +1928,7 @@ var Y = {
|
|
|
1887
1928
|
}
|
|
1888
1929
|
return window;
|
|
1889
1930
|
}, wt = r(function({ title: e, subtitle: t, avatar: n, headingLevel: r = 2, truncate: i = !0, onBack: a, backHref: s, backLabel: l, actions: u = [], overflowLabel: d, variant: f = "plain", size: h = "m", align: g = "start", sticky: y = !1, elevateOnScroll: b = y, collapseActionsAt: x = 520, landmark: S = !0, children: C, className: w, ...T }, E) {
|
|
1890
|
-
let D =
|
|
1931
|
+
let D = H("header"), k = l ?? D.back, A = d ?? D.more, j = p(null), [M, N] = m(!1), [ee, te] = m(!1), P = o((e) => {
|
|
1891
1932
|
j.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
|
|
1892
1933
|
}, [E]);
|
|
1893
1934
|
c(() => {
|
|
@@ -1902,13 +1943,13 @@ var Y = {
|
|
|
1902
1943
|
if (!b) return;
|
|
1903
1944
|
let e = Ct(j.current), t = () => {
|
|
1904
1945
|
let t = e === window ? window.scrollY : e.scrollTop;
|
|
1905
|
-
|
|
1946
|
+
te(t > 0);
|
|
1906
1947
|
};
|
|
1907
1948
|
return t(), e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1908
1949
|
}, [b]);
|
|
1909
|
-
let
|
|
1950
|
+
let F = x !== !1 && M, I = F ? u.filter((e) => e.pinned) : u, ne = F ? u.filter((e) => !e.pinned) : [], L = r ? `h${r}` : "span";
|
|
1910
1951
|
return /* @__PURE__ */ v(S ? "header" : "div", {
|
|
1911
|
-
ref:
|
|
1952
|
+
ref: P,
|
|
1912
1953
|
className: [
|
|
1913
1954
|
Y.header,
|
|
1914
1955
|
bt[h],
|
|
@@ -1926,12 +1967,14 @@ var Y = {
|
|
|
1926
1967
|
href: s,
|
|
1927
1968
|
className: Y.back,
|
|
1928
1969
|
"aria-label": k,
|
|
1970
|
+
"data-ick-role": "back",
|
|
1929
1971
|
children: /* @__PURE__ */ _(O, {
|
|
1930
1972
|
size: yt[h],
|
|
1931
1973
|
"aria-hidden": !0
|
|
1932
1974
|
})
|
|
1933
|
-
}) : a ? /* @__PURE__ */ _(
|
|
1975
|
+
}) : a ? /* @__PURE__ */ _(V, {
|
|
1934
1976
|
variant: "secondary",
|
|
1977
|
+
"data-ick-role": "back",
|
|
1935
1978
|
size: _t[h],
|
|
1936
1979
|
icon: /* @__PURE__ */ _(O, {
|
|
1937
1980
|
size: yt[h],
|
|
@@ -1946,7 +1989,7 @@ var Y = {
|
|
|
1946
1989
|
}),
|
|
1947
1990
|
(e || t) && /* @__PURE__ */ v("div", {
|
|
1948
1991
|
className: Y.titles,
|
|
1949
|
-
children: [e && /* @__PURE__ */ _(
|
|
1992
|
+
children: [e && /* @__PURE__ */ _(L, {
|
|
1950
1993
|
className: [Y.title, i ? Y.truncate : ""].filter(Boolean).join(" "),
|
|
1951
1994
|
title: typeof e == "string" && i ? e : void 0,
|
|
1952
1995
|
children: e
|
|
@@ -1960,12 +2003,12 @@ var Y = {
|
|
|
1960
2003
|
className: Y.end,
|
|
1961
2004
|
children: [
|
|
1962
2005
|
C,
|
|
1963
|
-
|
|
2006
|
+
I.map((e) => /* @__PURE__ */ _(Tt, {
|
|
1964
2007
|
action: e,
|
|
1965
2008
|
size: h
|
|
1966
2009
|
}, e.id)),
|
|
1967
|
-
|
|
1968
|
-
actions:
|
|
2010
|
+
ne.length > 0 && /* @__PURE__ */ _(Et, {
|
|
2011
|
+
actions: ne,
|
|
1969
2012
|
size: h,
|
|
1970
2013
|
label: A
|
|
1971
2014
|
})
|
|
@@ -1984,11 +2027,15 @@ function Tt({ action: e, size: t }) {
|
|
|
1984
2027
|
className: Y.back,
|
|
1985
2028
|
"aria-label": n,
|
|
1986
2029
|
title: e.label,
|
|
2030
|
+
"data-ick-role": "header-action",
|
|
2031
|
+
"data-ick-action": e.id,
|
|
1987
2032
|
children: [e.icon, r]
|
|
1988
2033
|
}) : /* @__PURE__ */ v("span", {
|
|
1989
2034
|
className: Y.actionWrap,
|
|
1990
|
-
children: [/* @__PURE__ */ _(
|
|
1991
|
-
variant: "secondary",
|
|
2035
|
+
children: [/* @__PURE__ */ _(V, {
|
|
2036
|
+
variant: e.variant ?? "secondary",
|
|
2037
|
+
"data-ick-role": "header-action",
|
|
2038
|
+
"data-ick-action": e.id,
|
|
1992
2039
|
size: _t[t],
|
|
1993
2040
|
icon: e.icon,
|
|
1994
2041
|
"aria-label": n,
|
|
@@ -2000,38 +2047,54 @@ function Tt({ action: e, size: t }) {
|
|
|
2000
2047
|
});
|
|
2001
2048
|
}
|
|
2002
2049
|
function Et({ actions: e, size: t, label: n }) {
|
|
2003
|
-
let [r, i] = m(!1), [a, s] = m(0), [u, d] = m(!1), f = p(null), h = p(null), g =
|
|
2050
|
+
let [r, i] = m(!1), [a, s] = m(0), [u, d] = m(!1), f = p(null), h = p(null), g = p(!1), y = l(), b = o((e) => {
|
|
2004
2051
|
i(!1), e && f.current?.focus();
|
|
2005
|
-
}, []),
|
|
2052
|
+
}, []), x = Math.min(a, Math.max(e.length - 1, 0));
|
|
2006
2053
|
return c(() => {
|
|
2007
|
-
r && (h.current?.querySelectorAll("[role=\"menuitem\"], [role=\"menuitemcheckbox\"]"))?.[
|
|
2054
|
+
r && (h.current?.querySelectorAll("[role=\"menuitem\"], [role=\"menuitemcheckbox\"]"))?.[x]?.focus();
|
|
2055
|
+
}, [r, x]), c(() => {
|
|
2056
|
+
if (!r) return;
|
|
2057
|
+
let e = (e) => {
|
|
2058
|
+
let t = e.target;
|
|
2059
|
+
t && (h.current?.contains(t) || f.current?.contains(t) || b(!1));
|
|
2060
|
+
};
|
|
2061
|
+
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
2008
2062
|
}, [r, b]), /* @__PURE__ */ v("span", {
|
|
2009
2063
|
className: Y.overflow,
|
|
2010
|
-
children: [/* @__PURE__ */ _(
|
|
2064
|
+
children: [/* @__PURE__ */ _(V, {
|
|
2011
2065
|
ref: f,
|
|
2012
2066
|
variant: "secondary",
|
|
2067
|
+
"data-ick-role": "header-more",
|
|
2013
2068
|
size: _t[t],
|
|
2014
|
-
icon: /* @__PURE__ */ _(
|
|
2069
|
+
icon: /* @__PURE__ */ _(le, {
|
|
2015
2070
|
size: yt[t],
|
|
2016
2071
|
"aria-hidden": !0
|
|
2017
2072
|
}),
|
|
2018
2073
|
"aria-label": n,
|
|
2019
2074
|
"aria-haspopup": "menu",
|
|
2020
2075
|
"aria-expanded": r,
|
|
2021
|
-
"aria-controls": r ?
|
|
2076
|
+
"aria-controls": r ? y : void 0,
|
|
2077
|
+
onPointerDown: () => {
|
|
2078
|
+
g.current = r;
|
|
2079
|
+
},
|
|
2022
2080
|
onClick: (e) => {
|
|
2023
|
-
|
|
2081
|
+
let t = r || e.detail > 0 && g.current;
|
|
2082
|
+
if (g.current = !1, t) {
|
|
2083
|
+
b(!1);
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2086
|
+
d(e.detail === 0), s(0), i(!0);
|
|
2024
2087
|
}
|
|
2025
2088
|
}), r && /* @__PURE__ */ _("div", {
|
|
2026
2089
|
ref: h,
|
|
2027
|
-
id:
|
|
2090
|
+
id: y,
|
|
2028
2091
|
role: "menu",
|
|
2029
2092
|
"aria-label": n,
|
|
2030
2093
|
className: Y.menu,
|
|
2031
2094
|
"data-keyboard": u || void 0,
|
|
2032
2095
|
onKeyDown: (t) => {
|
|
2033
2096
|
if (t.key === "Escape") {
|
|
2034
|
-
t.stopPropagation(),
|
|
2097
|
+
t.stopPropagation(), b(!0);
|
|
2035
2098
|
return;
|
|
2036
2099
|
}
|
|
2037
2100
|
if ([
|
|
@@ -2054,17 +2117,19 @@ function Et({ actions: e, size: t, label: n }) {
|
|
|
2054
2117
|
t.key === "End" && (t.preventDefault(), s(e.length - 1));
|
|
2055
2118
|
},
|
|
2056
2119
|
onBlur: (e) => {
|
|
2057
|
-
e.currentTarget.contains(e.relatedTarget) ||
|
|
2120
|
+
e.currentTarget.contains(e.relatedTarget) || b(!1);
|
|
2058
2121
|
},
|
|
2059
2122
|
children: e.map((e, t) => /* @__PURE__ */ v("button", {
|
|
2060
2123
|
type: "button",
|
|
2061
2124
|
role: e.active === void 0 ? "menuitem" : "menuitemcheckbox",
|
|
2062
2125
|
"aria-checked": e.active,
|
|
2063
|
-
tabIndex:
|
|
2126
|
+
tabIndex: x === t ? 0 : -1,
|
|
2064
2127
|
className: Y.menuItem,
|
|
2128
|
+
"data-ick-role": "header-menu-item",
|
|
2129
|
+
"data-ick-action": e.id,
|
|
2065
2130
|
disabled: e.disabled,
|
|
2066
2131
|
onClick: () => {
|
|
2067
|
-
e.onClick?.(),
|
|
2132
|
+
e.onClick?.(), b(!0);
|
|
2068
2133
|
},
|
|
2069
2134
|
children: [
|
|
2070
2135
|
/* @__PURE__ */ _("span", {
|
|
@@ -2086,7 +2151,7 @@ var Dt = {
|
|
|
2086
2151
|
reveal: "ick-reveal-z3mw"
|
|
2087
2152
|
}, Ot = 1600;
|
|
2088
2153
|
function kt({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i = null, children: a, reveal: s = !1, busy: l = !1, labels: u, className: d, ...f }) {
|
|
2089
|
-
let [h, y] = m(!1), b = p(null), x =
|
|
2154
|
+
let [h, y] = m(!1), b = p(null), x = H("answerActions", u);
|
|
2090
2155
|
c(() => () => {
|
|
2091
2156
|
b.current && clearTimeout(b.current);
|
|
2092
2157
|
}, []);
|
|
@@ -2105,9 +2170,11 @@ function kt({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i =
|
|
|
2105
2170
|
].filter(Boolean).join(" "),
|
|
2106
2171
|
...f,
|
|
2107
2172
|
children: [
|
|
2108
|
-
e.trim() && /* @__PURE__ */ _(
|
|
2173
|
+
e.trim() && /* @__PURE__ */ _(V, {
|
|
2109
2174
|
variant: "ghost",
|
|
2110
|
-
|
|
2175
|
+
"data-ick-role": "answer-action",
|
|
2176
|
+
"data-ick-action": "copy",
|
|
2177
|
+
icon: _(h ? j : te, {
|
|
2111
2178
|
size: 14,
|
|
2112
2179
|
"aria-hidden": !0
|
|
2113
2180
|
}),
|
|
@@ -2115,9 +2182,11 @@ function kt({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i =
|
|
|
2115
2182
|
"aria-label": h ? x.copied : x.copy,
|
|
2116
2183
|
title: h ? x.copied : x.copy
|
|
2117
2184
|
}),
|
|
2118
|
-
n && /* @__PURE__ */ _(
|
|
2185
|
+
n && /* @__PURE__ */ _(V, {
|
|
2119
2186
|
variant: "ghost",
|
|
2120
|
-
|
|
2187
|
+
"data-ick-role": "answer-action",
|
|
2188
|
+
"data-ick-action": "regenerate",
|
|
2189
|
+
icon: /* @__PURE__ */ _(me, {
|
|
2121
2190
|
size: 14,
|
|
2122
2191
|
"aria-hidden": !0
|
|
2123
2192
|
}),
|
|
@@ -2127,9 +2196,11 @@ function kt({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i =
|
|
|
2127
2196
|
"aria-label": x.regenerate,
|
|
2128
2197
|
title: x.regenerate
|
|
2129
2198
|
}),
|
|
2130
|
-
r && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
2199
|
+
r && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(V, {
|
|
2131
2200
|
variant: "ghost",
|
|
2132
|
-
|
|
2201
|
+
"data-ick-role": "answer-action",
|
|
2202
|
+
"data-ick-action": "up",
|
|
2203
|
+
icon: /* @__PURE__ */ _(xe, {
|
|
2133
2204
|
size: 14,
|
|
2134
2205
|
"aria-hidden": !0
|
|
2135
2206
|
}),
|
|
@@ -2137,9 +2208,11 @@ function kt({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i =
|
|
|
2137
2208
|
"aria-pressed": i === "up",
|
|
2138
2209
|
"aria-label": x.up,
|
|
2139
2210
|
title: x.up
|
|
2140
|
-
}), /* @__PURE__ */ _(
|
|
2211
|
+
}), /* @__PURE__ */ _(V, {
|
|
2141
2212
|
variant: "ghost",
|
|
2142
|
-
|
|
2213
|
+
"data-ick-role": "answer-action",
|
|
2214
|
+
"data-ick-action": "down",
|
|
2215
|
+
icon: /* @__PURE__ */ _(be, {
|
|
2143
2216
|
size: 14,
|
|
2144
2217
|
"aria-hidden": !0
|
|
2145
2218
|
}),
|
|
@@ -2161,7 +2234,7 @@ var At = {
|
|
|
2161
2234
|
//#endregion
|
|
2162
2235
|
//#region src/Branch/Branch.tsx
|
|
2163
2236
|
function jt({ total: e, index: t, onSelect: n, labels: r, className: i, ...a }) {
|
|
2164
|
-
let o =
|
|
2237
|
+
let o = H("branch", r);
|
|
2165
2238
|
if (e < 2) return null;
|
|
2166
2239
|
let s = Math.min(Math.max(t, 0), e - 1), c = o.position.replace("{index}", String(s + 1)).replace("{total}", String(e));
|
|
2167
2240
|
return /* @__PURE__ */ v("div", {
|
|
@@ -2314,7 +2387,7 @@ var Rt = {
|
|
|
2314
2387
|
//#endregion
|
|
2315
2388
|
//#region src/disclosure/DisclosureBody.tsx
|
|
2316
2389
|
function zt({ id: e, open: t, className: n, children: r }) {
|
|
2317
|
-
let i =
|
|
2390
|
+
let i = G();
|
|
2318
2391
|
return /* @__PURE__ */ _("div", {
|
|
2319
2392
|
id: e,
|
|
2320
2393
|
className: Rt.outer,
|
|
@@ -2366,7 +2439,7 @@ var Vt = {
|
|
|
2366
2439
|
//#endregion
|
|
2367
2440
|
//#region src/Reasoning/Reasoning.tsx
|
|
2368
2441
|
function Ht({ children: e, state: t = "done", duration: n, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
|
|
2369
|
-
let u =
|
|
2442
|
+
let u = H("reasoning", o), d = l(), f = t === "thinking", { isOpen: p, toggle: h } = Pt({
|
|
2370
2443
|
open: r,
|
|
2371
2444
|
defaultOpen: i,
|
|
2372
2445
|
onOpenChange: a,
|
|
@@ -2494,7 +2567,7 @@ var en = {
|
|
|
2494
2567
|
pre: "ick-pre-qaBX"
|
|
2495
2568
|
}, tn = 1600;
|
|
2496
2569
|
function nn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor: a = tn, labels: s, className: l, ...u }) {
|
|
2497
|
-
let d =
|
|
2570
|
+
let d = H("codeBlock", s), [h, g] = m(!1), y = p(null), [b, x] = m(Qt);
|
|
2498
2571
|
c(() => {
|
|
2499
2572
|
if (b || !Jt(t)) return;
|
|
2500
2573
|
let e = !0;
|
|
@@ -2534,7 +2607,7 @@ function nn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor
|
|
|
2534
2607
|
onClick: C,
|
|
2535
2608
|
onPointerDown: (e) => e.stopPropagation(),
|
|
2536
2609
|
"aria-label": h ? d.copied : d.copyCode,
|
|
2537
|
-
children: [_(h ? j :
|
|
2610
|
+
children: [_(h ? j : te, {
|
|
2538
2611
|
size: 13,
|
|
2539
2612
|
"aria-hidden": !0
|
|
2540
2613
|
}), /* @__PURE__ */ _("span", {
|
|
@@ -2564,7 +2637,7 @@ function an({ state: e }) {
|
|
|
2564
2637
|
className: rn.glyph,
|
|
2565
2638
|
"data-state": e,
|
|
2566
2639
|
"aria-hidden": !0,
|
|
2567
|
-
children: e === "running" ? /* @__PURE__ */ _("span", { className: rn.spinner }) : e === "done" ? /* @__PURE__ */ _(j, { size: 13 }) : e === "error" ? /* @__PURE__ */ _(
|
|
2640
|
+
children: e === "running" ? /* @__PURE__ */ _("span", { className: rn.spinner }) : e === "done" ? /* @__PURE__ */ _(j, { size: 13 }) : e === "error" ? /* @__PURE__ */ _(Ce, { size: 13 }) : /* @__PURE__ */ _("span", { className: rn.queued })
|
|
2568
2641
|
});
|
|
2569
2642
|
}
|
|
2570
2643
|
var on = {
|
|
@@ -2627,7 +2700,7 @@ function cn({ label: e, value: t, tone: n }) {
|
|
|
2627
2700
|
});
|
|
2628
2701
|
}
|
|
2629
2702
|
function ln({ name: e, state: t = "done", summary: n, input: r, output: i, error: a, duration: o, open: s, defaultOpen: c, onOpenChange: u, labels: d, className: f, ...p }) {
|
|
2630
|
-
let m =
|
|
2703
|
+
let m = H("tool", d), h = l(), g = t === "error", { isOpen: y, toggle: b } = Pt({
|
|
2631
2704
|
open: s,
|
|
2632
2705
|
defaultOpen: c,
|
|
2633
2706
|
onOpenChange: u,
|
|
@@ -2703,7 +2776,7 @@ var un = {
|
|
|
2703
2776
|
denied: "wasDenied"
|
|
2704
2777
|
};
|
|
2705
2778
|
function pn({ title: e, description: t, children: n, decision: r = null, onDecide: i, readOnly: a = !1, choices: o = dn, labels: s, className: c, ...u }) {
|
|
2706
|
-
let d =
|
|
2779
|
+
let d = H("approval", s), f = (e) => o.includes(e), p = l(), m = r !== null;
|
|
2707
2780
|
return /* @__PURE__ */ v("section", {
|
|
2708
2781
|
className: [un.approval, c ?? ""].filter(Boolean).join(" "),
|
|
2709
2782
|
"data-decision": r ?? void 0,
|
|
@@ -2728,29 +2801,32 @@ function pn({ title: e, description: t, children: n, decision: r = null, onDecid
|
|
|
2728
2801
|
m ? /* @__PURE__ */ v("p", {
|
|
2729
2802
|
className: un.settled,
|
|
2730
2803
|
"data-decision": r,
|
|
2731
|
-
children: [_(r === "denied" ?
|
|
2804
|
+
children: [_(r === "denied" ? we : j, {
|
|
2732
2805
|
size: 13,
|
|
2733
2806
|
"aria-hidden": !0
|
|
2734
2807
|
}), d[fn[r]]]
|
|
2735
2808
|
}) : !a && /* @__PURE__ */ v("div", {
|
|
2736
2809
|
className: un.actions,
|
|
2737
2810
|
children: [
|
|
2738
|
-
f("deny") && /* @__PURE__ */ _(
|
|
2811
|
+
f("deny") && /* @__PURE__ */ _(V, {
|
|
2812
|
+
"data-ick-role": "approval-deny",
|
|
2739
2813
|
variant: "ghost",
|
|
2740
2814
|
size: "m",
|
|
2741
2815
|
className: un.deny,
|
|
2742
2816
|
onClick: () => i?.("denied"),
|
|
2743
2817
|
children: d.deny
|
|
2744
2818
|
}),
|
|
2745
|
-
f("always") && /* @__PURE__ */ _(
|
|
2819
|
+
f("always") && /* @__PURE__ */ _(V, {
|
|
2746
2820
|
variant: "outline",
|
|
2747
2821
|
size: "m",
|
|
2822
|
+
"data-ick-role": "approval-always",
|
|
2748
2823
|
onClick: () => i?.("always"),
|
|
2749
2824
|
children: d.always
|
|
2750
2825
|
}),
|
|
2751
|
-
f("once") && /* @__PURE__ */ _(
|
|
2826
|
+
f("once") && /* @__PURE__ */ _(V, {
|
|
2752
2827
|
variant: "primary",
|
|
2753
2828
|
size: "m",
|
|
2829
|
+
"data-ick-role": "approval-once",
|
|
2754
2830
|
onClick: () => i?.("once"),
|
|
2755
2831
|
children: d.once
|
|
2756
2832
|
})
|
|
@@ -2771,7 +2847,7 @@ var mn = {
|
|
|
2771
2847
|
//#endregion
|
|
2772
2848
|
//#region src/TaskList/TaskList.tsx
|
|
2773
2849
|
function hn({ tasks: e, title: t, collapsible: n = !1, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
|
|
2774
|
-
let u =
|
|
2850
|
+
let u = H("tasks", o), d = l(), f = G(), p = e.filter((e) => (e.state ?? "pending") === "done").length, m = Pt({
|
|
2775
2851
|
open: r,
|
|
2776
2852
|
defaultOpen: i,
|
|
2777
2853
|
onOpenChange: a,
|
|
@@ -2848,7 +2924,7 @@ var gn = {
|
|
|
2848
2924
|
//#endregion
|
|
2849
2925
|
//#region src/ChainOfThought/ChainOfThought.tsx
|
|
2850
2926
|
function _n({ steps: e, state: t = "done", duration: n, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
|
|
2851
|
-
let u =
|
|
2927
|
+
let u = H("chain", o), d = l(), f = G(), p = t === "thinking", { isOpen: m, toggle: h } = Pt({
|
|
2852
2928
|
open: r,
|
|
2853
2929
|
defaultOpen: i,
|
|
2854
2930
|
onOpenChange: a,
|
|
@@ -2928,7 +3004,7 @@ var vn = {
|
|
|
2928
3004
|
//#endregion
|
|
2929
3005
|
//#region src/Sources/Sources.tsx
|
|
2930
3006
|
function yn({ sources: e, title: t, collapsible: n = !1, activeId: r = null, onSelect: i, open: a, defaultOpen: o, onOpenChange: s, labels: c, className: u, ...d }) {
|
|
2931
|
-
let f =
|
|
3007
|
+
let f = H("sources", c), p = l(), m = Pt({
|
|
2932
3008
|
open: a,
|
|
2933
3009
|
defaultOpen: o,
|
|
2934
3010
|
onOpenChange: s,
|
|
@@ -2996,7 +3072,7 @@ var bn = { chip: "ick-chip-FJNL" };
|
|
|
2996
3072
|
//#endregion
|
|
2997
3073
|
//#region src/Chip/Chip.tsx
|
|
2998
3074
|
function xn({ children: e, className: t }) {
|
|
2999
|
-
let n =
|
|
3075
|
+
let n = G();
|
|
3000
3076
|
return /* @__PURE__ */ _(C.span, {
|
|
3001
3077
|
className: [bn.chip, t ?? ""].filter(Boolean).join(" "),
|
|
3002
3078
|
initial: n ? { opacity: 0 } : {
|
|
@@ -3054,7 +3130,7 @@ var X = {
|
|
|
3054
3130
|
children: e
|
|
3055
3131
|
});
|
|
3056
3132
|
}), Cn = r(function({ letter: e, title: t, description: n, selected: r = !1, className: i, ...a }, o) {
|
|
3057
|
-
let s =
|
|
3133
|
+
let s = G();
|
|
3058
3134
|
return /* @__PURE__ */ v(C.button, {
|
|
3059
3135
|
ref: o,
|
|
3060
3136
|
type: "button",
|
|
@@ -3214,7 +3290,7 @@ function Nn({ question: e, number: t, answer: n, onCommit: r, labels: i }) {
|
|
|
3214
3290
|
let [a, o] = m(() => n && "values" in n ? { ...n.values } : {}), [s, l] = m(() => n && "optionIds" in n ? [...n.optionIds ?? []] : []), [u, d] = m(() => n && "optionIds" in n ? n.other ?? "" : ""), [h, g] = m(n && "optionId" in n ? n.optionId : null), y = p(null), b = f(() => e.type === "inputs" ? e.fields.map(() => ({ current: null })) : [], [e]);
|
|
3215
3291
|
c(() => {
|
|
3216
3292
|
if (e.type !== "inputs") return;
|
|
3217
|
-
let t = setTimeout(() => y.current?.focus({ preventScroll: !0 }),
|
|
3293
|
+
let t = setTimeout(() => y.current?.focus({ preventScroll: !0 }), G() ? 0 : jn);
|
|
3218
3294
|
return () => clearTimeout(t);
|
|
3219
3295
|
}, [e.type]);
|
|
3220
3296
|
let x = f(() => e.type !== "inputs" || e.fields.every((e) => e.optional || (a[e.id] ?? "").trim()), [e, a]), S = {
|
|
@@ -3227,9 +3303,10 @@ function Nn({ question: e, number: t, answer: n, onCommit: r, labels: i }) {
|
|
|
3227
3303
|
let t = () => x && r?.({ values: a });
|
|
3228
3304
|
return /* @__PURE__ */ _(En, {
|
|
3229
3305
|
...S,
|
|
3230
|
-
footer: /* @__PURE__ */ _(
|
|
3306
|
+
footer: /* @__PURE__ */ _(V, {
|
|
3231
3307
|
variant: "secondary",
|
|
3232
3308
|
size: "m",
|
|
3309
|
+
"data-ick-role": "question-next",
|
|
3233
3310
|
disabled: !x,
|
|
3234
3311
|
onClick: t,
|
|
3235
3312
|
children: i.next
|
|
@@ -3271,7 +3348,8 @@ function Nn({ question: e, number: t, answer: n, onCommit: r, labels: i }) {
|
|
|
3271
3348
|
};
|
|
3272
3349
|
return /* @__PURE__ */ v(En, {
|
|
3273
3350
|
...S,
|
|
3274
|
-
footer: /* @__PURE__ */ _(
|
|
3351
|
+
footer: /* @__PURE__ */ _(V, {
|
|
3352
|
+
"data-ick-role": "question-next",
|
|
3275
3353
|
variant: "secondary",
|
|
3276
3354
|
size: "m",
|
|
3277
3355
|
disabled: !e.allowEmpty && w,
|
|
@@ -3294,7 +3372,7 @@ function Nn({ question: e, number: t, answer: n, onCommit: r, labels: i }) {
|
|
|
3294
3372
|
});
|
|
3295
3373
|
}
|
|
3296
3374
|
function Pn({ question: e, number: t, state: n, answer: r, onCommit: i, onEdit: a, readOnly: o = !1, labels: s }) {
|
|
3297
|
-
let c =
|
|
3375
|
+
let c = H("question", s), l = n !== "upcoming", u = G(), d = p(null), f = Dn(d), m;
|
|
3298
3376
|
if (n === "active") m = /* @__PURE__ */ _(Nn, {
|
|
3299
3377
|
question: e,
|
|
3300
3378
|
number: t,
|
|
@@ -3314,7 +3392,7 @@ function Pn({ question: e, number: t, state: n, answer: r, onCommit: i, onEdit:
|
|
|
3314
3392
|
})]
|
|
3315
3393
|
}), /* @__PURE__ */ v("span", {
|
|
3316
3394
|
className: X.collapsedAnswer,
|
|
3317
|
-
children: [n.map((e, t) => /* @__PURE__ */ _(xn, { children: e }, `${e}-${t}`)), !o && /* @__PURE__ */ _(
|
|
3395
|
+
children: [n.map((e, t) => /* @__PURE__ */ _(xn, { children: e }, `${e}-${t}`)), !o && /* @__PURE__ */ _(fe, {
|
|
3318
3396
|
className: X.pencil,
|
|
3319
3397
|
size: 14,
|
|
3320
3398
|
"aria-hidden": !0
|
|
@@ -3387,7 +3465,7 @@ var Fn = {
|
|
|
3387
3465
|
fadeInDelay: .08
|
|
3388
3466
|
};
|
|
3389
3467
|
function Rn({ id: e, title: t, questions: n, answers: r, activeIndex: i = null, collapsible: a = !1, onCommit: o, onEdit: s, readOnly: c = !1, labels: u, foldMotion: d, className: f }) {
|
|
3390
|
-
let [h, g] = m(!1), [x, S] = m(!1), w = l(), T = p(null), E = Dn(T), D =
|
|
3468
|
+
let [h, g] = m(!1), [x, S] = m(!1), w = l(), T = p(null), E = Dn(T), D = H("questionGroup", u), O = G(), k = a && !h, A = n.map((e) => e.shortTitle).join(" · "), j = {
|
|
3391
3469
|
...Ln,
|
|
3392
3470
|
...d
|
|
3393
3471
|
}, M = O ? { duration: 0 } : {
|
|
@@ -3406,7 +3484,7 @@ function Rn({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
|
|
|
3406
3484
|
duration: e,
|
|
3407
3485
|
delay: t
|
|
3408
3486
|
}
|
|
3409
|
-
},
|
|
3487
|
+
}, te = {
|
|
3410
3488
|
hidden: {
|
|
3411
3489
|
opacity: 0,
|
|
3412
3490
|
y: O ? 0 : j.rowOffset,
|
|
@@ -3417,7 +3495,7 @@ function Rn({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
|
|
|
3417
3495
|
y: 0,
|
|
3418
3496
|
transition: ee(j.fadeIn, O ? 0 : j.fadeInDelay)
|
|
3419
3497
|
}
|
|
3420
|
-
},
|
|
3498
|
+
}, P = {
|
|
3421
3499
|
variants: N,
|
|
3422
3500
|
initial: "hidden",
|
|
3423
3501
|
animate: "shown",
|
|
@@ -3455,9 +3533,9 @@ function Rn({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
|
|
|
3455
3533
|
initial: !1,
|
|
3456
3534
|
mode: "popLayout",
|
|
3457
3535
|
children: k ? /* @__PURE__ */ _(C.div, {
|
|
3458
|
-
...
|
|
3536
|
+
...P,
|
|
3459
3537
|
children: /* @__PURE__ */ v(C.div, {
|
|
3460
|
-
variants:
|
|
3538
|
+
variants: te,
|
|
3461
3539
|
className: Fn.summary,
|
|
3462
3540
|
children: [/* @__PURE__ */ v("span", {
|
|
3463
3541
|
className: Fn.count,
|
|
@@ -3473,9 +3551,9 @@ function Rn({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
|
|
|
3473
3551
|
})
|
|
3474
3552
|
}, "summary") : /* @__PURE__ */ _(C.div, {
|
|
3475
3553
|
className: Fn.list,
|
|
3476
|
-
...
|
|
3554
|
+
...P,
|
|
3477
3555
|
children: n.map((e, t) => /* @__PURE__ */ _(C.div, {
|
|
3478
|
-
variants:
|
|
3556
|
+
variants: te,
|
|
3479
3557
|
className: Fn.row,
|
|
3480
3558
|
children: /* @__PURE__ */ _(Pn, {
|
|
3481
3559
|
question: e,
|
|
@@ -3587,7 +3665,7 @@ function Kn({ children: e }) {
|
|
|
3587
3665
|
initial: !1,
|
|
3588
3666
|
animate: { height: n },
|
|
3589
3667
|
transition: {
|
|
3590
|
-
duration:
|
|
3668
|
+
duration: G() ? 0 : .22,
|
|
3591
3669
|
ease: [
|
|
3592
3670
|
.32,
|
|
3593
3671
|
.72,
|
|
@@ -4050,7 +4128,7 @@ var xr = {
|
|
|
4050
4128
|
//#endregion
|
|
4051
4129
|
//#region src/InlineCitation/InlineCitation.tsx
|
|
4052
4130
|
function Sr({ index: e, source: t, children: n, onSelect: r, labels: i, className: a, ...o }) {
|
|
4053
|
-
let { cite: s } =
|
|
4131
|
+
let { cite: s } = H("citation", i), c = t ? `${s} ${e}: ${t.title}` : `${s} ${e}`, l = r ? /* @__PURE__ */ _("button", {
|
|
4054
4132
|
type: "button",
|
|
4055
4133
|
className: xr.marker,
|
|
4056
4134
|
onClick: () => r(e, t),
|
|
@@ -4127,28 +4205,28 @@ var Cr = {
|
|
|
4127
4205
|
}), t.trim();
|
|
4128
4206
|
};
|
|
4129
4207
|
function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlightComplete: a, onReplyInThread: s, sources: u, onSelectSource: d }) {
|
|
4130
|
-
let h =
|
|
4131
|
-
e.viaKeyboard && (
|
|
4132
|
-
}, []),
|
|
4133
|
-
let t =
|
|
4134
|
-
|
|
4208
|
+
let h = H("highlighter"), g = p(null), [b, S] = m([]), [w, T] = m([]), [E, D] = m(null), [O, k] = m(!1), [A, j] = m(null), [M, N] = m(0), ee = p(null), te = p(null), [P, F] = m(null), [I, ne] = m(null), L = o((e) => {
|
|
4209
|
+
e.viaKeyboard && (te.current = document.activeElement), N(0), j(e);
|
|
4210
|
+
}, []), re = o((e = "none") => {
|
|
4211
|
+
let t = te.current;
|
|
4212
|
+
te.current = null, j(null), e !== "none" && (e === "restore" && t?.isConnected ? t.focus() : g.current?.focus());
|
|
4135
4213
|
}, []);
|
|
4136
4214
|
c(() => {
|
|
4137
4215
|
let e = (e) => {
|
|
4138
|
-
A && g.current && !g.current.contains(e.target) &&
|
|
4216
|
+
A && g.current && !g.current.contains(e.target) && re();
|
|
4139
4217
|
};
|
|
4140
4218
|
return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
|
|
4141
|
-
}, [A,
|
|
4142
|
-
let
|
|
4219
|
+
}, [A, re]);
|
|
4220
|
+
let ie = f(() => br(t), [t]), R = ie.tokens, oe = p(w), se = p(a), ce = p(A);
|
|
4143
4221
|
c(() => {
|
|
4144
|
-
|
|
4222
|
+
oe.current = w, se.current = a, ce.current = A;
|
|
4145
4223
|
});
|
|
4146
|
-
let
|
|
4224
|
+
let le = f(() => [...b.map((e) => ({
|
|
4147
4225
|
id: e.id,
|
|
4148
4226
|
d: Er(e.points),
|
|
4149
4227
|
kind: "path",
|
|
4150
4228
|
item: e,
|
|
4151
|
-
text: kr(e.highlightedIndices,
|
|
4229
|
+
text: kr(e.highlightedIndices, R)
|
|
4152
4230
|
})), ...w.map((e) => ({
|
|
4153
4231
|
id: e.id,
|
|
4154
4232
|
d: jr(e.rects),
|
|
@@ -4158,23 +4236,23 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4158
4236
|
}))], [
|
|
4159
4237
|
b,
|
|
4160
4238
|
w,
|
|
4161
|
-
|
|
4162
|
-
]),
|
|
4239
|
+
R
|
|
4240
|
+
]), ue = (e, t = !1) => {
|
|
4163
4241
|
let n = e.kind === "path" ? Dr(e.item.points) : Or(e.item.rects);
|
|
4164
|
-
|
|
4242
|
+
L({
|
|
4165
4243
|
x: n.x,
|
|
4166
4244
|
y: n.y,
|
|
4167
4245
|
pathId: e.id,
|
|
4168
4246
|
kind: e.kind,
|
|
4169
4247
|
viaKeyboard: t
|
|
4170
4248
|
});
|
|
4171
|
-
},
|
|
4249
|
+
}, de = o((e, t, n = !1) => {
|
|
4172
4250
|
let r = g.current, i = t.trim();
|
|
4173
4251
|
if (!r || !i) return;
|
|
4174
4252
|
let a = /* @__PURE__ */ new Set();
|
|
4175
4253
|
r.querySelectorAll("span[data-index]").forEach((t) => {
|
|
4176
4254
|
e.intersectsNode(t) && a.add(parseInt(t.getAttribute("data-index"), 10));
|
|
4177
|
-
}),
|
|
4255
|
+
}), se.current?.(i);
|
|
4178
4256
|
let o = r.getBoundingClientRect(), s = Array.from(e.getClientRects()).map((e) => ({
|
|
4179
4257
|
x: e.left - o.left,
|
|
4180
4258
|
y: e.top - o.top,
|
|
@@ -4203,23 +4281,23 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4203
4281
|
highlightedIndices: a
|
|
4204
4282
|
}]);
|
|
4205
4283
|
let d = Or(l);
|
|
4206
|
-
|
|
4284
|
+
L({
|
|
4207
4285
|
x: d.x,
|
|
4208
4286
|
y: d.y,
|
|
4209
4287
|
pathId: u,
|
|
4210
4288
|
kind: "selection",
|
|
4211
4289
|
viaKeyboard: n
|
|
4212
4290
|
});
|
|
4213
|
-
}, [
|
|
4291
|
+
}, [L]);
|
|
4214
4292
|
c(() => {
|
|
4215
4293
|
let e = (e) => {
|
|
4216
|
-
if (
|
|
4294
|
+
if (ce.current) return;
|
|
4217
4295
|
let t = g.current;
|
|
4218
4296
|
if (!t) return;
|
|
4219
4297
|
let n = window.getSelection();
|
|
4220
4298
|
if (!n || n.isCollapsed || n.rangeCount === 0 || !n.toString().trim()) return;
|
|
4221
4299
|
let r = n.getRangeAt(0);
|
|
4222
|
-
t.contains(r.commonAncestorContainer) && (
|
|
4300
|
+
t.contains(r.commonAncestorContainer) && (de(r, n.toString(), e), requestAnimationFrame(() => window.getSelection()?.removeAllRanges()));
|
|
4223
4301
|
}, t = () => e(!1), n = (t) => {
|
|
4224
4302
|
let n = (t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a";
|
|
4225
4303
|
!t.shiftKey && !n || e(!0);
|
|
@@ -4227,34 +4305,34 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4227
4305
|
return document.addEventListener("mouseup", t), document.addEventListener("keyup", n), () => {
|
|
4228
4306
|
document.removeEventListener("mouseup", t), document.removeEventListener("keyup", n);
|
|
4229
4307
|
};
|
|
4230
|
-
}, [
|
|
4231
|
-
let [
|
|
4232
|
-
|
|
4233
|
-
let
|
|
4234
|
-
from: Math.min(
|
|
4235
|
-
to: Math.max(
|
|
4236
|
-
}, [
|
|
4237
|
-
|
|
4238
|
-
},
|
|
4308
|
+
}, [de]);
|
|
4309
|
+
let [z, fe] = m(i);
|
|
4310
|
+
z !== i && (fe(i), j(null));
|
|
4311
|
+
let pe = f(() => R.map((e, t) => e.trim() ? t : -1).filter((e) => e >= 0), [R]), [me, he] = m(null), [ge, _e] = m(null), ve = l(), ye = f(() => me === null || ge === null ? null : {
|
|
4312
|
+
from: Math.min(ge, me),
|
|
4313
|
+
to: Math.max(ge, me)
|
|
4314
|
+
}, [me, ge]), be = () => {
|
|
4315
|
+
he(null), _e(null);
|
|
4316
|
+
}, xe = () => {
|
|
4239
4317
|
let e = g.current;
|
|
4240
|
-
if (!e || !
|
|
4241
|
-
let t = e.querySelector(`span[data-index="${
|
|
4318
|
+
if (!e || !ye) return;
|
|
4319
|
+
let t = e.querySelector(`span[data-index="${ye.from}"]`), n = e.querySelector(`span[data-index="${ye.to}"]`);
|
|
4242
4320
|
if (!t || !n) return;
|
|
4243
4321
|
let r = document.createRange();
|
|
4244
4322
|
r.setStartBefore(t), r.setEndAfter(n);
|
|
4245
4323
|
let i = "";
|
|
4246
|
-
for (let e =
|
|
4247
|
-
|
|
4248
|
-
},
|
|
4324
|
+
for (let e = ye.from; e <= ye.to; e++) i += R[e];
|
|
4325
|
+
de(r, i, !0), be();
|
|
4326
|
+
}, Ce = () => [...ee.current?.querySelectorAll("[role=\"menuitem\"]") ?? []];
|
|
4249
4327
|
c(() => {
|
|
4250
4328
|
if (!A) return;
|
|
4251
|
-
let e =
|
|
4329
|
+
let e = Ce();
|
|
4252
4330
|
if (e.length === 0) return;
|
|
4253
4331
|
let t = ee.current?.contains(document.activeElement);
|
|
4254
4332
|
(A.viaKeyboard || t) && e[Math.min(M, e.length - 1)]?.focus();
|
|
4255
4333
|
}, [A, M]);
|
|
4256
|
-
let
|
|
4257
|
-
let t =
|
|
4334
|
+
let we = (e) => {
|
|
4335
|
+
let t = Ce().length;
|
|
4258
4336
|
if (t === 0) return;
|
|
4259
4337
|
let n = (n) => {
|
|
4260
4338
|
e.preventDefault(), e.stopPropagation(), N((e) => (e + n + t) % t);
|
|
@@ -4268,34 +4346,34 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4268
4346
|
case "End": return e.preventDefault(), N(t - 1);
|
|
4269
4347
|
default: return;
|
|
4270
4348
|
}
|
|
4271
|
-
},
|
|
4272
|
-
if (e.target !== e.currentTarget && e.key !== "Escape" ||
|
|
4349
|
+
}, B = (e) => {
|
|
4350
|
+
if (e.target !== e.currentTarget && e.key !== "Escape" || pe.length === 0) return;
|
|
4273
4351
|
let t = (t, n) => {
|
|
4274
4352
|
e.preventDefault();
|
|
4275
|
-
let r =
|
|
4276
|
-
|
|
4353
|
+
let r = me === null ? -1 : pe.indexOf(me), i = r === -1 ? pe[t === 1 ? 0 : pe.length - 1] : pe[Math.min(pe.length - 1, Math.max(0, r + t))];
|
|
4354
|
+
he(i), (!n || ge === null) && _e(i);
|
|
4277
4355
|
}, n = (t) => {
|
|
4278
|
-
e.preventDefault(),
|
|
4356
|
+
e.preventDefault(), he(t), (!e.shiftKey || ge === null) && _e(t);
|
|
4279
4357
|
};
|
|
4280
4358
|
switch (e.key) {
|
|
4281
4359
|
case "ArrowRight": return t(1, e.shiftKey);
|
|
4282
4360
|
case "ArrowLeft": return t(-1, e.shiftKey);
|
|
4283
|
-
case "Home": return n(
|
|
4284
|
-
case "End": return n(
|
|
4361
|
+
case "Home": return n(pe[0]);
|
|
4362
|
+
case "End": return n(pe[pe.length - 1]);
|
|
4285
4363
|
case "Enter":
|
|
4286
|
-
case " ": return
|
|
4287
|
-
case "Escape": return !A &&
|
|
4364
|
+
case " ": return ye ? (e.preventDefault(), xe()) : void 0;
|
|
4365
|
+
case "Escape": return !A && me === null ? void 0 : (e.preventDefault(), re("restore"), be());
|
|
4288
4366
|
default: return;
|
|
4289
4367
|
}
|
|
4290
|
-
},
|
|
4368
|
+
}, Te = (e, t, n) => {
|
|
4291
4369
|
let r = document.elementFromPoint(e, t);
|
|
4292
4370
|
if (r && r.hasAttribute("data-index")) {
|
|
4293
4371
|
let e = parseInt(r.getAttribute("data-index"), 10);
|
|
4294
4372
|
n.add(e);
|
|
4295
4373
|
}
|
|
4296
|
-
},
|
|
4374
|
+
}, Ee = (e) => {
|
|
4297
4375
|
if (A) {
|
|
4298
|
-
|
|
4376
|
+
re();
|
|
4299
4377
|
return;
|
|
4300
4378
|
}
|
|
4301
4379
|
if (i === "precise" || e.button !== 0 && e.pointerType === "mouse") return;
|
|
@@ -4310,14 +4388,14 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4310
4388
|
}],
|
|
4311
4389
|
highlightedIndices: /* @__PURE__ */ new Set()
|
|
4312
4390
|
};
|
|
4313
|
-
D(s),
|
|
4314
|
-
},
|
|
4391
|
+
D(s), re(), Te(e.clientX, e.clientY, s.highlightedIndices);
|
|
4392
|
+
}, De = (e) => {
|
|
4315
4393
|
if (i === "precise" || !E) return;
|
|
4316
4394
|
let t = g.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, a = n - r * Tr;
|
|
4317
4395
|
D((t) => {
|
|
4318
4396
|
if (!t) return t;
|
|
4319
4397
|
let n = new Set(t.highlightedIndices);
|
|
4320
|
-
return
|
|
4398
|
+
return Te(e.clientX, e.clientY, n), {
|
|
4321
4399
|
...t,
|
|
4322
4400
|
points: [...t.points, {
|
|
4323
4401
|
x: a,
|
|
@@ -4326,28 +4404,28 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4326
4404
|
highlightedIndices: n
|
|
4327
4405
|
};
|
|
4328
4406
|
});
|
|
4329
|
-
},
|
|
4407
|
+
}, Oe = (e) => {
|
|
4330
4408
|
if (i !== "precise" && (k(!1), E)) {
|
|
4331
4409
|
if (e.currentTarget.releasePointerCapture(e.pointerId), S((e) => [...e, E]), E.highlightedIndices.size > 0) {
|
|
4332
4410
|
let e = Dr(E.points);
|
|
4333
|
-
|
|
4411
|
+
L({
|
|
4334
4412
|
x: e.x,
|
|
4335
4413
|
y: e.y,
|
|
4336
4414
|
pathId: E.id,
|
|
4337
4415
|
kind: "path"
|
|
4338
4416
|
});
|
|
4339
4417
|
}
|
|
4340
|
-
a && E.highlightedIndices.size > 0 && a(kr(E.highlightedIndices,
|
|
4418
|
+
a && E.highlightedIndices.size > 0 && a(kr(E.highlightedIndices, R)), D(null);
|
|
4341
4419
|
}
|
|
4342
|
-
}, Oe = (e) => {
|
|
4343
|
-
i !== "precise" && (k(!1), E && (e.currentTarget.releasePointerCapture(e.pointerId), D(null)));
|
|
4344
4420
|
}, ke = (e) => {
|
|
4421
|
+
i !== "precise" && (k(!1), E && (e.currentTarget.releasePointerCapture(e.pointerId), D(null)));
|
|
4422
|
+
}, Ae = (e) => {
|
|
4345
4423
|
let t = b.find((t) => t.id === e);
|
|
4346
|
-
return t ? kr(t.highlightedIndices,
|
|
4347
|
-
},
|
|
4424
|
+
return t ? kr(t.highlightedIndices, R) : "";
|
|
4425
|
+
}, Me = (e) => {
|
|
4348
4426
|
let t = A?.viaKeyboard;
|
|
4349
|
-
A?.kind === "selection" ? T((t) => t.filter((t) => t.id !== e)) : S((t) => t.filter((t) => t.id !== e)),
|
|
4350
|
-
},
|
|
4427
|
+
A?.kind === "selection" ? T((t) => t.filter((t) => t.id !== e)) : S((t) => t.filter((t) => t.id !== e)), re(t ? "container" : "none");
|
|
4428
|
+
}, U = () => {
|
|
4351
4429
|
let e = A?.viaKeyboard;
|
|
4352
4430
|
if (A && s) {
|
|
4353
4431
|
if (A.kind === "selection") {
|
|
@@ -4361,25 +4439,25 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4361
4439
|
s(e.text, c);
|
|
4362
4440
|
}
|
|
4363
4441
|
} else {
|
|
4364
|
-
let e =
|
|
4442
|
+
let e = Ae(A.pathId), t = document.getElementById(`highlight-path-${A.pathId}`);
|
|
4365
4443
|
t && s(e, t.getBoundingClientRect());
|
|
4366
4444
|
}
|
|
4367
4445
|
}
|
|
4368
|
-
|
|
4446
|
+
re(e ? "restore" : "none");
|
|
4369
4447
|
}, Ne = (e) => {
|
|
4370
|
-
let t =
|
|
4448
|
+
let t = R[e];
|
|
4371
4449
|
if (!r) return t;
|
|
4372
4450
|
let n = !1;
|
|
4373
4451
|
A && (n = (A.kind === "path" ? b.find((e) => e.id === A.pathId) : w.find((e) => e.id === A.pathId))?.highlightedIndices?.has(e) ?? !1);
|
|
4374
4452
|
let i = !1;
|
|
4375
|
-
return
|
|
4453
|
+
return P && (i = (b.find((e) => e.id === P) ?? w.find((e) => e.id === P))?.highlightedIndices?.has(e) ?? !1), /* @__PURE__ */ _("span", {
|
|
4376
4454
|
"data-index": e,
|
|
4377
4455
|
className: Cr.token,
|
|
4378
4456
|
"data-space": !t.trim() || void 0,
|
|
4379
4457
|
"data-active": n || void 0,
|
|
4380
4458
|
"data-pressed": i || void 0,
|
|
4381
|
-
"data-kbd-cursor":
|
|
4382
|
-
"data-kbd-selected":
|
|
4459
|
+
"data-kbd-cursor": me === e || void 0,
|
|
4460
|
+
"data-kbd-selected": ye && e >= ye.from && e <= ye.to || void 0,
|
|
4383
4461
|
children: t
|
|
4384
4462
|
}, e);
|
|
4385
4463
|
}, Pe = (e) => e.map((e, t) => {
|
|
@@ -4420,18 +4498,18 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4420
4498
|
"data-menu": !!A || void 0,
|
|
4421
4499
|
className: Cr.surface,
|
|
4422
4500
|
...r ? {
|
|
4423
|
-
onPointerDown:
|
|
4424
|
-
onPointerMove:
|
|
4425
|
-
onPointerUp:
|
|
4426
|
-
onPointerCancel:
|
|
4501
|
+
onPointerDown: Ee,
|
|
4502
|
+
onPointerMove: De,
|
|
4503
|
+
onPointerUp: Oe,
|
|
4504
|
+
onPointerCancel: ke,
|
|
4427
4505
|
tabIndex: 0,
|
|
4428
|
-
onKeyDown:
|
|
4429
|
-
onBlur:
|
|
4430
|
-
"aria-describedby":
|
|
4506
|
+
onKeyDown: B,
|
|
4507
|
+
onBlur: be,
|
|
4508
|
+
"aria-describedby": ve
|
|
4431
4509
|
} : null,
|
|
4432
4510
|
children: [
|
|
4433
4511
|
r && /* @__PURE__ */ _("span", {
|
|
4434
|
-
id:
|
|
4512
|
+
id: ve,
|
|
4435
4513
|
className: Cr.srOnly,
|
|
4436
4514
|
"aria-hidden": "true",
|
|
4437
4515
|
children: h.keyboardHint
|
|
@@ -4440,51 +4518,51 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4440
4518
|
/* @__PURE__ */ _("div", {
|
|
4441
4519
|
className: Cr.tokens,
|
|
4442
4520
|
"data-focus": !!A || void 0,
|
|
4443
|
-
children: Pe(
|
|
4521
|
+
children: Pe(ie.nodes)
|
|
4444
4522
|
}),
|
|
4445
4523
|
r && /* @__PURE__ */ _("svg", {
|
|
4446
4524
|
className: Cr.canvas,
|
|
4447
4525
|
children: /* @__PURE__ */ v("g", {
|
|
4448
4526
|
transform: `skewX(${wr})`,
|
|
4449
|
-
children: [
|
|
4527
|
+
children: [le.map((t) => /* @__PURE__ */ v(e.Fragment, { children: [/* @__PURE__ */ _("path", {
|
|
4450
4528
|
id: `highlight-${t.kind}-${t.id}`,
|
|
4451
4529
|
className: Cr.marker,
|
|
4452
4530
|
d: t.d,
|
|
4453
4531
|
"data-cursor": "pointer",
|
|
4454
|
-
"data-pressed":
|
|
4455
|
-
"data-active": A?.pathId === t.id ||
|
|
4532
|
+
"data-pressed": P === t.id || void 0,
|
|
4533
|
+
"data-active": A?.pathId === t.id || I === t.id || void 0,
|
|
4456
4534
|
"data-dimmed": A && A.pathId !== t.id || void 0,
|
|
4457
4535
|
style: { pointerEvents: O ? "none" : "stroke" },
|
|
4458
4536
|
onPointerDown: (e) => {
|
|
4459
|
-
O || (e.stopPropagation(),
|
|
4537
|
+
O || (e.stopPropagation(), F(t.id));
|
|
4460
4538
|
},
|
|
4461
4539
|
onPointerUp: (e) => {
|
|
4462
|
-
|
|
4540
|
+
P === t.id && (e.stopPropagation(), ue(t), F(null));
|
|
4463
4541
|
},
|
|
4464
|
-
onPointerLeave: () =>
|
|
4465
|
-
onPointerCancel: () =>
|
|
4542
|
+
onPointerLeave: () => F(null),
|
|
4543
|
+
onPointerCancel: () => F(null)
|
|
4466
4544
|
}), /* @__PURE__ */ _("path", {
|
|
4467
4545
|
className: Cr.shimmer,
|
|
4468
4546
|
d: t.d,
|
|
4469
4547
|
pathLength: 1,
|
|
4470
|
-
"data-active": A?.pathId === t.id ||
|
|
4548
|
+
"data-active": A?.pathId === t.id || I === t.id || void 0
|
|
4471
4549
|
})] }, t.id)), E && /* @__PURE__ */ _("path", {
|
|
4472
4550
|
className: Cr.marker,
|
|
4473
4551
|
d: Er(E.points)
|
|
4474
4552
|
})]
|
|
4475
4553
|
})
|
|
4476
4554
|
}),
|
|
4477
|
-
r &&
|
|
4555
|
+
r && le.length > 0 && /* @__PURE__ */ _("div", {
|
|
4478
4556
|
role: "group",
|
|
4479
|
-
"aria-label":
|
|
4480
|
-
children:
|
|
4557
|
+
"aria-label": je(le.length === 1 ? h.countOne : h.countMany, { count: le.length }),
|
|
4558
|
+
children: le.map((e) => /* @__PURE__ */ _("button", {
|
|
4481
4559
|
type: "button",
|
|
4482
4560
|
className: Cr.srOnly,
|
|
4483
4561
|
onPointerDown: (e) => e.stopPropagation(),
|
|
4484
|
-
onFocus: () =>
|
|
4485
|
-
onBlur: () =>
|
|
4562
|
+
onFocus: () => ne(e.id),
|
|
4563
|
+
onBlur: () => ne(null),
|
|
4486
4564
|
onClick: (t) => {
|
|
4487
|
-
t.stopPropagation(),
|
|
4565
|
+
t.stopPropagation(), ue(e, !0);
|
|
4488
4566
|
},
|
|
4489
4567
|
children: `${h.highlight} ${Ar(e.text)}`
|
|
4490
4568
|
}, e.id))
|
|
@@ -4493,9 +4571,9 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4493
4571
|
ref: ee,
|
|
4494
4572
|
role: "menu",
|
|
4495
4573
|
"aria-label": h.menu,
|
|
4496
|
-
onKeyDown:
|
|
4574
|
+
onKeyDown: we,
|
|
4497
4575
|
onBlur: (e) => {
|
|
4498
|
-
e.currentTarget.contains(e.relatedTarget) ||
|
|
4576
|
+
e.currentTarget.contains(e.relatedTarget) || re();
|
|
4499
4577
|
},
|
|
4500
4578
|
initial: { opacity: 0 },
|
|
4501
4579
|
animate: {
|
|
@@ -4536,13 +4614,15 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4536
4614
|
scale: .9,
|
|
4537
4615
|
transition: { duration: .1 }
|
|
4538
4616
|
},
|
|
4539
|
-
children: /* @__PURE__ */ _(
|
|
4617
|
+
children: /* @__PURE__ */ _(V, {
|
|
4540
4618
|
variant: "primary",
|
|
4541
4619
|
role: "menuitem",
|
|
4620
|
+
"data-ick-role": "highlight-action",
|
|
4621
|
+
"data-ick-action": "reply",
|
|
4542
4622
|
tabIndex: M === 0 ? 0 : -1,
|
|
4543
|
-
icon: /* @__PURE__ */ _(
|
|
4623
|
+
icon: /* @__PURE__ */ _(ae, { size: 14 }),
|
|
4544
4624
|
onClick: (e) => {
|
|
4545
|
-
e.stopPropagation(),
|
|
4625
|
+
e.stopPropagation(), U();
|
|
4546
4626
|
},
|
|
4547
4627
|
title: h.reply,
|
|
4548
4628
|
children: h.reply
|
|
@@ -4568,13 +4648,15 @@ function Mr({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
|
|
|
4568
4648
|
scale: .9,
|
|
4569
4649
|
transition: { duration: .1 }
|
|
4570
4650
|
},
|
|
4571
|
-
children: /* @__PURE__ */ _(
|
|
4651
|
+
children: /* @__PURE__ */ _(V, {
|
|
4572
4652
|
variant: "primary",
|
|
4573
4653
|
role: "menuitem",
|
|
4654
|
+
"data-ick-role": "highlight-action",
|
|
4655
|
+
"data-ick-action": "remove",
|
|
4574
4656
|
tabIndex: M === 1 ? 0 : -1,
|
|
4575
|
-
icon: /* @__PURE__ */ _(
|
|
4657
|
+
icon: /* @__PURE__ */ _(Se, { size: 14 }),
|
|
4576
4658
|
onClick: (e) => {
|
|
4577
|
-
e.stopPropagation(),
|
|
4659
|
+
e.stopPropagation(), Me(A.pathId);
|
|
4578
4660
|
},
|
|
4579
4661
|
title: h.remove,
|
|
4580
4662
|
"aria-label": h.remove
|
|
@@ -4612,23 +4694,31 @@ var Nr = {
|
|
|
4612
4694
|
part: e
|
|
4613
4695
|
});
|
|
4614
4696
|
return i < e.length && a(e.length), r;
|
|
4615
|
-
}, Ir = a(function({ turn: e, isActiveInput: t = !1, inputRef: n = null, placeholder: r, animationConfig: i, foldMotion: a, openArtifactId:
|
|
4616
|
-
let
|
|
4697
|
+
}, Ir = a(function({ turn: e, isActiveInput: t = !1, inputRef: n = null, placeholder: r, animationConfig: i, foldMotion: a, openArtifactId: s = null, onOpenArtifact: l, onArtifactChange: u, entranceDelay: d = 0, entrance: f = "rise", answerAfterTravel: p = !1, selectionMode: h = "marker", highlights: g = !0, questionAlign: y = "end", onDraft: b, onSubmit: x, onStop: S, busy: w, onEdit: T, onCancelEdit: E, onCopy: D = Pr, onHighlight: O, onReplyInThread: k, onRegenerate: A, onShowVersion: j, onFeedback: M, feedback: N = null, answerActions: ee = !0, onAnswerQuestion: te, onEditQuestion: P, onDecideApproval: F, renderPart: I, composerMenu: ne, labels: L, className: re, onTranscribe: ie }) {
|
|
4698
|
+
let R = G(), ae = R || f === "fade" ? 0 : -16, [oe, se] = m(!1), [ce, le] = m(e.state);
|
|
4699
|
+
ce !== e.state && (le(e.state), p && !R && e.state === "responding" && (ce === "typing" || ce === "idle") && se(!0));
|
|
4700
|
+
let ue = o(() => se(!1), []);
|
|
4701
|
+
c(() => {
|
|
4702
|
+
if (!oe) return;
|
|
4703
|
+
let e = window.setTimeout(() => se(!1), 1200);
|
|
4704
|
+
return () => window.clearTimeout(e);
|
|
4705
|
+
}, [oe]);
|
|
4706
|
+
let de = e.parts ?? [], z = de.find((e) => e.kind === "sources")?.sources, fe = Fr(e.ai, de), pe = ee && (e.state === "resting" || e.state === "responding") && fe.length > 0, me = pe && e.state === "resting", he = pe ? fe[fe.length - 1].kind === "prose" ? fe.length - 1 : fe.length : -1, ge = pe ? /* @__PURE__ */ v("div", {
|
|
4617
4707
|
className: Nr.actions,
|
|
4618
|
-
"data-pending":
|
|
4619
|
-
style:
|
|
4708
|
+
"data-pending": me ? void 0 : "",
|
|
4709
|
+
style: me ? void 0 : { visibility: "hidden" },
|
|
4620
4710
|
children: [/* @__PURE__ */ _(jt, {
|
|
4621
4711
|
total: e.versions?.length ?? 0,
|
|
4622
4712
|
index: e.versionIndex ?? 0,
|
|
4623
|
-
onSelect: (t) =>
|
|
4713
|
+
onSelect: (t) => j?.(e.id, t)
|
|
4624
4714
|
}), /* @__PURE__ */ _(kt, {
|
|
4625
4715
|
text: e.ai,
|
|
4626
|
-
onCopy:
|
|
4627
|
-
onRegenerate:
|
|
4628
|
-
onFeedback:
|
|
4629
|
-
feedback:
|
|
4716
|
+
onCopy: D,
|
|
4717
|
+
onRegenerate: A ? () => A(e.id) : void 0,
|
|
4718
|
+
onFeedback: M ? (t) => M(e.id, t) : void 0,
|
|
4719
|
+
feedback: N
|
|
4630
4720
|
})]
|
|
4631
|
-
}) : null,
|
|
4721
|
+
}) : null, _e = (t) => {
|
|
4632
4722
|
switch (t.kind) {
|
|
4633
4723
|
case "reasoning": return /* @__PURE__ */ _(Ht, {
|
|
4634
4724
|
state: t.state,
|
|
@@ -4664,7 +4754,7 @@ var Nr = {
|
|
|
4664
4754
|
description: t.description,
|
|
4665
4755
|
decision: t.decision ?? null,
|
|
4666
4756
|
choices: t.choices,
|
|
4667
|
-
onDecide: (n) =>
|
|
4757
|
+
onDecide: (n) => F?.(e.id, t.id, n),
|
|
4668
4758
|
children: t.tool && /* @__PURE__ */ _(ln, {
|
|
4669
4759
|
name: t.tool.name,
|
|
4670
4760
|
state: "pending",
|
|
@@ -4680,8 +4770,8 @@ var Nr = {
|
|
|
4680
4770
|
lang: t.lang,
|
|
4681
4771
|
content: t.content,
|
|
4682
4772
|
state: t.state,
|
|
4683
|
-
open:
|
|
4684
|
-
onOpen:
|
|
4773
|
+
open: s === t.id,
|
|
4774
|
+
onOpen: l ? (t) => l(e.id, t) : void 0
|
|
4685
4775
|
}, t.id);
|
|
4686
4776
|
case "notice": return /* @__PURE__ */ _(Bn, {
|
|
4687
4777
|
tone: t.tone,
|
|
@@ -4696,14 +4786,14 @@ var Nr = {
|
|
|
4696
4786
|
collapsible: t.collapsible,
|
|
4697
4787
|
readOnly: t.readOnly,
|
|
4698
4788
|
foldMotion: a,
|
|
4699
|
-
onCommit: (n, r) =>
|
|
4700
|
-
onEdit: (n) =>
|
|
4789
|
+
onCommit: (n, r) => te?.(e.id, t.id, n, r),
|
|
4790
|
+
onEdit: (n) => P?.(e.id, t.id, n)
|
|
4701
4791
|
}, t.id);
|
|
4702
4792
|
case "custom": {
|
|
4703
|
-
let n =
|
|
4793
|
+
let n = I?.(t, {
|
|
4704
4794
|
turnId: e.id,
|
|
4705
|
-
openArtifact: (t) =>
|
|
4706
|
-
closeArtifact: () =>
|
|
4795
|
+
openArtifact: (t) => u ? u(t) : l?.(e.id, t),
|
|
4796
|
+
closeArtifact: () => u?.(null)
|
|
4707
4797
|
});
|
|
4708
4798
|
return n == null || n === !1 ? null : /* @__PURE__ */ _("div", {
|
|
4709
4799
|
className: Nr.custom,
|
|
@@ -4713,14 +4803,14 @@ var Nr = {
|
|
|
4713
4803
|
}, t.id);
|
|
4714
4804
|
}
|
|
4715
4805
|
}
|
|
4716
|
-
},
|
|
4806
|
+
}, ve = /* @__PURE__ */ v(C.article, {
|
|
4717
4807
|
id: `turn-${e.id}`,
|
|
4718
|
-
className: [Nr.turn,
|
|
4808
|
+
className: [Nr.turn, re ?? ""].filter(Boolean).join(" "),
|
|
4719
4809
|
"data-active-input": t || void 0,
|
|
4720
4810
|
"aria-busy": e.state === "responding" || void 0,
|
|
4721
4811
|
initial: {
|
|
4722
4812
|
opacity: 0,
|
|
4723
|
-
y:
|
|
4813
|
+
y: ae
|
|
4724
4814
|
},
|
|
4725
4815
|
animate: {
|
|
4726
4816
|
opacity: 1,
|
|
@@ -4728,70 +4818,73 @@ var Nr = {
|
|
|
4728
4818
|
},
|
|
4729
4819
|
exit: {
|
|
4730
4820
|
opacity: 0,
|
|
4731
|
-
y:
|
|
4821
|
+
y: ae
|
|
4732
4822
|
},
|
|
4733
4823
|
transition: {
|
|
4734
|
-
duration:
|
|
4824
|
+
duration: R ? .15 : .4,
|
|
4735
4825
|
ease: [
|
|
4736
4826
|
.22,
|
|
4737
4827
|
1,
|
|
4738
4828
|
.36,
|
|
4739
4829
|
1
|
|
4740
4830
|
],
|
|
4741
|
-
delay:
|
|
4831
|
+
delay: d
|
|
4742
4832
|
},
|
|
4743
4833
|
children: [/* @__PURE__ */ _("div", {
|
|
4744
4834
|
className: Nr.question,
|
|
4745
|
-
"data-align":
|
|
4835
|
+
"data-align": y,
|
|
4746
4836
|
children: /* @__PURE__ */ _(st, {
|
|
4747
4837
|
ref: n,
|
|
4748
|
-
style:
|
|
4838
|
+
style: y === "stretch" ? { width: "100%" } : void 0,
|
|
4749
4839
|
state: e.state,
|
|
4750
4840
|
value: e.user,
|
|
4751
|
-
onChange: (t) =>
|
|
4752
|
-
onSubmit: (t, n) =>
|
|
4841
|
+
onChange: (t) => b?.(e.id, t),
|
|
4842
|
+
onSubmit: (t, n) => x?.(e.id, t, n),
|
|
4753
4843
|
attachments: e.attachments,
|
|
4754
|
-
onStop:
|
|
4755
|
-
busy:
|
|
4756
|
-
onTranscribe:
|
|
4757
|
-
onCopy:
|
|
4758
|
-
onEdit: () =>
|
|
4759
|
-
onCancelEdit: () =>
|
|
4844
|
+
onStop: S,
|
|
4845
|
+
busy: w,
|
|
4846
|
+
onTranscribe: ie,
|
|
4847
|
+
onCopy: D,
|
|
4848
|
+
onEdit: () => T?.(e.id),
|
|
4849
|
+
onCancelEdit: () => E?.(e.id),
|
|
4760
4850
|
isEditing: e.ai.length > 0 && e.state === "typing",
|
|
4851
|
+
onLanded: oe ? ue : void 0,
|
|
4761
4852
|
animationConfig: i,
|
|
4762
4853
|
placeholder: r,
|
|
4763
|
-
menu:
|
|
4854
|
+
menu: ne
|
|
4764
4855
|
})
|
|
4765
4856
|
}), /* @__PURE__ */ v("div", {
|
|
4766
4857
|
className: Nr.body,
|
|
4858
|
+
"data-held": oe || void 0,
|
|
4859
|
+
"aria-hidden": oe || void 0,
|
|
4767
4860
|
children: [
|
|
4768
|
-
|
|
4861
|
+
fe.map((t, n) => t.kind === "part" ? _e(t.part) : /* @__PURE__ */ v("div", {
|
|
4769
4862
|
className: Nr.answer,
|
|
4770
4863
|
children: [/* @__PURE__ */ _(Mr, {
|
|
4771
4864
|
text: t.text,
|
|
4772
|
-
marking:
|
|
4773
|
-
selectionMode:
|
|
4774
|
-
sources:
|
|
4775
|
-
onHighlightComplete:
|
|
4776
|
-
onReplyInThread:
|
|
4777
|
-
}),
|
|
4865
|
+
marking: g,
|
|
4866
|
+
selectionMode: h,
|
|
4867
|
+
sources: z,
|
|
4868
|
+
onHighlightComplete: g ? (t) => O?.(e.id, t) : void 0,
|
|
4869
|
+
onReplyInThread: g ? k : void 0
|
|
4870
|
+
}), he === n && ge]
|
|
4778
4871
|
}, `prose-${t.from}`)),
|
|
4779
|
-
e.state === "responding" && !e.ai &&
|
|
4872
|
+
e.state === "responding" && !e.ai && de.length === 0 && /* @__PURE__ */ _("div", {
|
|
4780
4873
|
className: Nr.answer,
|
|
4781
4874
|
children: /* @__PURE__ */ _(Nt, {})
|
|
4782
4875
|
}),
|
|
4783
|
-
|
|
4876
|
+
he === fe.length && /* @__PURE__ */ _("div", {
|
|
4784
4877
|
className: Nr.answer,
|
|
4785
4878
|
"data-actions-only": "",
|
|
4786
|
-
children:
|
|
4879
|
+
children: ge
|
|
4787
4880
|
})
|
|
4788
4881
|
]
|
|
4789
4882
|
})]
|
|
4790
4883
|
});
|
|
4791
|
-
return
|
|
4792
|
-
labels:
|
|
4793
|
-
children:
|
|
4794
|
-
}) :
|
|
4884
|
+
return L ? /* @__PURE__ */ _(Ae, {
|
|
4885
|
+
labels: L,
|
|
4886
|
+
children: ve
|
|
4887
|
+
}) : ve;
|
|
4795
4888
|
}, (e, t) => {
|
|
4796
4889
|
let n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
|
|
4797
4890
|
for (let r of n) {
|
|
@@ -4826,7 +4919,7 @@ function Rr(e) {
|
|
|
4826
4919
|
}
|
|
4827
4920
|
var zr = 6, Br = 2 * Math.PI * zr;
|
|
4828
4921
|
function Vr({ used: e, total: t, warnAt: n = .8, label: r, labels: i, className: a, ...o }) {
|
|
4829
|
-
let s =
|
|
4922
|
+
let s = H("context", i), c = t > 0 ? Math.min(1, Math.max(0, e / t)) : 0, l = Math.round(c * 100), u = c >= n, d = r === !1 ? null : r ?? `${l}%`, f = `${s.name}: ${l}%, ${Rr(e)} ${s.of} ${Rr(t)} ${s.tokens}${u ? `. ${s.nearlyFull}` : ""}`;
|
|
4830
4923
|
return /* @__PURE__ */ v("div", {
|
|
4831
4924
|
className: [Lr.context, a ?? ""].filter(Boolean).join(" "),
|
|
4832
4925
|
"data-warn": u || void 0,
|
|
@@ -4877,7 +4970,7 @@ var Hr = {
|
|
|
4877
4970
|
//#endregion
|
|
4878
4971
|
//#region src/Artifact/ArtifactPane.tsx
|
|
4879
4972
|
function Ur({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expanded: a = !1, onToggleExpanded: o, closeLabel: s, expandLabel: u, collapseLabel: d, className: f, ...m }) {
|
|
4880
|
-
let h =
|
|
4973
|
+
let h = H("pane"), g = s ?? h.close, y = u ?? h.expand, b = d ?? h.collapse, x = l(), S = p(null), C = p(null);
|
|
4881
4974
|
return c(() => {
|
|
4882
4975
|
C.current?.focus({ preventScroll: !0 });
|
|
4883
4976
|
}, []), c(() => {
|
|
@@ -4921,10 +5014,11 @@ function Ur({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expande
|
|
|
4921
5014
|
children: t
|
|
4922
5015
|
})]
|
|
4923
5016
|
}),
|
|
4924
|
-
o && !i && /* @__PURE__ */ _(
|
|
5017
|
+
o && !i && /* @__PURE__ */ _(V, {
|
|
4925
5018
|
variant: "ghost",
|
|
5019
|
+
"data-ick-role": "pane-expand",
|
|
4926
5020
|
size: "s",
|
|
4927
|
-
icon: _(a ?
|
|
5021
|
+
icon: _(a ? se : R, {
|
|
4928
5022
|
size: 15,
|
|
4929
5023
|
"aria-hidden": !0
|
|
4930
5024
|
}),
|
|
@@ -4932,10 +5026,11 @@ function Ur({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expande
|
|
|
4932
5026
|
"aria-pressed": a,
|
|
4933
5027
|
onClick: o
|
|
4934
5028
|
}),
|
|
4935
|
-
r && /* @__PURE__ */ _(
|
|
5029
|
+
r && /* @__PURE__ */ _(V, {
|
|
4936
5030
|
variant: "ghost",
|
|
5031
|
+
"data-ick-role": "pane-close",
|
|
4937
5032
|
size: "s",
|
|
4938
|
-
icon: /* @__PURE__ */ _(
|
|
5033
|
+
icon: /* @__PURE__ */ _(we, {
|
|
4939
5034
|
size: 15,
|
|
4940
5035
|
"aria-hidden": !0
|
|
4941
5036
|
}),
|
|
@@ -5143,7 +5238,7 @@ var ti = {
|
|
|
5143
5238
|
}, ni = 64, ri = 500, ii = .2, ai = 120, oi = 50, si = 4, ci = (e, t) => e.offsetTop - t.offsetTop, li = (e, t) => t ? e.querySelector(`[id="${CSS.escape(t)}"]`) : null, ui = (e) => (e.lastElementChild?.offsetHeight ?? 0) + (parseFloat(getComputedStyle(e).rowGap) || 0), di = (e, t, n) => {
|
|
5144
5239
|
n !== t.current && (t.current = n, e.style.setProperty("--ick-conversation-tail", `${Math.round(n)}px`));
|
|
5145
5240
|
}, fi = r(function({ children: e, anchorId: t, anchorOffset: n = 0, endOffset: r = 0, tail: i = "auto", threshold: a = ni, scrollButton: s = !0, scrollButtonLabel: l, follow: f = !0, dock: h = !1, className: g, viewportClassName: y, onScroll: b, ...x }, S) {
|
|
5146
|
-
let C =
|
|
5241
|
+
let C = H("conversation").jump, w = l ?? C, T = p(null);
|
|
5147
5242
|
u(S, () => T.current, []);
|
|
5148
5243
|
let E = p(null), O = p(null), [k, A] = m(!0);
|
|
5149
5244
|
c(() => {
|
|
@@ -5158,7 +5253,7 @@ var ti = {
|
|
|
5158
5253
|
r.disconnect(), t.style.removeProperty("--ick-dock-height");
|
|
5159
5254
|
};
|
|
5160
5255
|
}, [h]);
|
|
5161
|
-
let j = p(-1), M = p(-1), N = p(null), ee = p(!1),
|
|
5256
|
+
let j = p(-1), M = p(-1), N = p(null), ee = p(!1), te = o(() => {
|
|
5162
5257
|
let e = T.current, t = E.current;
|
|
5163
5258
|
if (!e || !t) return 0;
|
|
5164
5259
|
if (i === "auto" && ee.current) return Math.max(0, e.scrollHeight - e.clientHeight);
|
|
@@ -5168,7 +5263,7 @@ var ti = {
|
|
|
5168
5263
|
h,
|
|
5169
5264
|
r,
|
|
5170
5265
|
i
|
|
5171
|
-
]),
|
|
5266
|
+
]), P = o(() => {
|
|
5172
5267
|
let e = T.current, a = E.current;
|
|
5173
5268
|
if (!e || !a) return;
|
|
5174
5269
|
if (i !== "auto") return di(a, j, Math.max(0, i));
|
|
@@ -5186,7 +5281,7 @@ var ti = {
|
|
|
5186
5281
|
r,
|
|
5187
5282
|
t,
|
|
5188
5283
|
h
|
|
5189
|
-
]),
|
|
5284
|
+
]), F = o(() => {
|
|
5190
5285
|
let e = T.current;
|
|
5191
5286
|
if (!e) return 0;
|
|
5192
5287
|
if (t) {
|
|
@@ -5196,36 +5291,36 @@ var ti = {
|
|
|
5196
5291
|
return Math.max(0, Math.min(Math.max(a, s), t));
|
|
5197
5292
|
}
|
|
5198
5293
|
}
|
|
5199
|
-
return
|
|
5294
|
+
return te();
|
|
5200
5295
|
}, [
|
|
5201
5296
|
t,
|
|
5202
5297
|
n,
|
|
5203
|
-
|
|
5298
|
+
te,
|
|
5204
5299
|
h
|
|
5205
|
-
]),
|
|
5300
|
+
]), I = p(0), ne = p(null), L = o((e) => {
|
|
5206
5301
|
let t = T.current;
|
|
5207
5302
|
if (!t) return;
|
|
5208
|
-
let n = e && !
|
|
5209
|
-
|
|
5210
|
-
top:
|
|
5303
|
+
let n = e && !G();
|
|
5304
|
+
I.current = n ? performance.now() + ri : 0, t.scrollTo({
|
|
5305
|
+
top: F(),
|
|
5211
5306
|
behavior: n ? "smooth" : "auto"
|
|
5212
5307
|
}), A(!0);
|
|
5213
|
-
}, [
|
|
5308
|
+
}, [F]);
|
|
5214
5309
|
d(() => {
|
|
5215
5310
|
t && (N.current = t);
|
|
5216
5311
|
let e = T.current, n = E.current;
|
|
5217
|
-
if (
|
|
5218
|
-
let r = new ResizeObserver(
|
|
5312
|
+
if (P(), !e || !n || typeof ResizeObserver > "u") return;
|
|
5313
|
+
let r = new ResizeObserver(P);
|
|
5219
5314
|
return r.observe(n), r.observe(e), () => r.disconnect();
|
|
5220
|
-
}, [t,
|
|
5315
|
+
}, [t, P]), d(() => {
|
|
5221
5316
|
if (!f || !k && !t) return;
|
|
5222
5317
|
let e = T.current, n = E.current;
|
|
5223
5318
|
if (!e || !n || typeof ResizeObserver > "u") return;
|
|
5224
5319
|
let r = 0, i = () => {
|
|
5225
|
-
|
|
5226
|
-
let t =
|
|
5227
|
-
if (Math.abs(t - e.scrollTop) > a && !
|
|
5228
|
-
|
|
5320
|
+
I.current = 0;
|
|
5321
|
+
let t = F();
|
|
5322
|
+
if (Math.abs(t - e.scrollTop) > a && !G()) {
|
|
5323
|
+
I.current = performance.now() + ri, e.scrollTo({
|
|
5229
5324
|
top: t,
|
|
5230
5325
|
behavior: "smooth"
|
|
5231
5326
|
}), r = window.setTimeout(i, 550);
|
|
@@ -5233,22 +5328,22 @@ var ti = {
|
|
|
5233
5328
|
}
|
|
5234
5329
|
e.scrollTop = t;
|
|
5235
5330
|
}, o = () => {
|
|
5236
|
-
let n =
|
|
5237
|
-
if (
|
|
5238
|
-
let t =
|
|
5331
|
+
let n = F();
|
|
5332
|
+
if (I.current) {
|
|
5333
|
+
let t = I.current - performance.now();
|
|
5239
5334
|
if (t > 0 && Math.abs(e.scrollTop - n) > 1) {
|
|
5240
5335
|
window.clearTimeout(r), r = window.setTimeout(i, t + oi);
|
|
5241
5336
|
return;
|
|
5242
5337
|
}
|
|
5243
|
-
|
|
5338
|
+
I.current = 0;
|
|
5244
5339
|
}
|
|
5245
5340
|
let o = n - e.scrollTop;
|
|
5246
|
-
if (N.current && !t && !
|
|
5341
|
+
if (N.current && !t && !G() && h) {
|
|
5247
5342
|
!s && Math.abs(o) > si && (window.clearTimeout(c), c = window.setTimeout(l, ai));
|
|
5248
5343
|
return;
|
|
5249
5344
|
}
|
|
5250
|
-
if (N.current && !t && Math.abs(o) > a && !
|
|
5251
|
-
|
|
5345
|
+
if (N.current && !t && Math.abs(o) > a && !G()) {
|
|
5346
|
+
I.current = performance.now() + ri, e.scrollTo({
|
|
5252
5347
|
top: n,
|
|
5253
5348
|
behavior: "smooth"
|
|
5254
5349
|
});
|
|
@@ -5258,11 +5353,11 @@ var ti = {
|
|
|
5258
5353
|
}, s = 0, c = 0, l = () => {
|
|
5259
5354
|
if (s) return;
|
|
5260
5355
|
if (typeof requestAnimationFrame > "u") {
|
|
5261
|
-
e.scrollTop =
|
|
5356
|
+
e.scrollTop = F();
|
|
5262
5357
|
return;
|
|
5263
5358
|
}
|
|
5264
5359
|
let t = () => {
|
|
5265
|
-
let n =
|
|
5360
|
+
let n = F(), r = n - e.scrollTop;
|
|
5266
5361
|
if (Math.abs(r) <= 1) {
|
|
5267
5362
|
e.scrollTop = n, s = 0;
|
|
5268
5363
|
return;
|
|
@@ -5270,9 +5365,9 @@ var ti = {
|
|
|
5270
5365
|
e.scrollTop += Math.sign(r) * Math.max(1, Math.abs(r) * ii), s = requestAnimationFrame(t);
|
|
5271
5366
|
};
|
|
5272
5367
|
s = requestAnimationFrame(t);
|
|
5273
|
-
}, u = t != null && t !==
|
|
5274
|
-
t && (
|
|
5275
|
-
top:
|
|
5368
|
+
}, u = t != null && t !== ne.current;
|
|
5369
|
+
t && (ne.current = t), u && !G() && Math.abs(e.scrollTop - F()) > a ? (I.current = performance.now() + ri, e.scrollTo({
|
|
5370
|
+
top: F(),
|
|
5276
5371
|
behavior: "smooth"
|
|
5277
5372
|
})) : o();
|
|
5278
5373
|
let d = new ResizeObserver(o);
|
|
@@ -5282,7 +5377,7 @@ var ti = {
|
|
|
5282
5377
|
}, [
|
|
5283
5378
|
f,
|
|
5284
5379
|
k,
|
|
5285
|
-
|
|
5380
|
+
F,
|
|
5286
5381
|
t,
|
|
5287
5382
|
a,
|
|
5288
5383
|
h
|
|
@@ -5291,7 +5386,7 @@ var ti = {
|
|
|
5291
5386
|
let e = T.current;
|
|
5292
5387
|
if (!e) return;
|
|
5293
5388
|
let n = () => {
|
|
5294
|
-
|
|
5389
|
+
I.current = 0, Math.abs(e.scrollTop - F()) > a && A(!1);
|
|
5295
5390
|
}, r = (e) => {
|
|
5296
5391
|
t ? n() : e.deltaY < 0 && A(!1);
|
|
5297
5392
|
}, i = (e) => {
|
|
@@ -5317,18 +5412,18 @@ var ti = {
|
|
|
5317
5412
|
}, [
|
|
5318
5413
|
f,
|
|
5319
5414
|
a,
|
|
5320
|
-
|
|
5415
|
+
F,
|
|
5321
5416
|
t
|
|
5322
5417
|
]);
|
|
5323
|
-
let
|
|
5418
|
+
let re = o((e) => {
|
|
5324
5419
|
if (b?.(e), !f) return;
|
|
5325
5420
|
let t = T.current;
|
|
5326
|
-
t && Math.abs(t.scrollTop -
|
|
5421
|
+
t && Math.abs(t.scrollTop - F()) <= si && (I.current = 0, A(!0));
|
|
5327
5422
|
}, [
|
|
5328
5423
|
f,
|
|
5329
5424
|
b,
|
|
5330
|
-
|
|
5331
|
-
]),
|
|
5425
|
+
F
|
|
5426
|
+
]), ie = f && !k;
|
|
5332
5427
|
return /* @__PURE__ */ v("div", {
|
|
5333
5428
|
ref: O,
|
|
5334
5429
|
className: [ti.root, g ?? ""].filter(Boolean).join(" "),
|
|
@@ -5336,7 +5431,7 @@ var ti = {
|
|
|
5336
5431
|
children: [/* @__PURE__ */ _("div", {
|
|
5337
5432
|
ref: T,
|
|
5338
5433
|
className: [ti.viewport, y ?? ""].filter(Boolean).join(" "),
|
|
5339
|
-
onScroll:
|
|
5434
|
+
onScroll: re,
|
|
5340
5435
|
...x,
|
|
5341
5436
|
children: /* @__PURE__ */ _("div", {
|
|
5342
5437
|
ref: E,
|
|
@@ -5347,10 +5442,10 @@ var ti = {
|
|
|
5347
5442
|
}), s && /* @__PURE__ */ _("button", {
|
|
5348
5443
|
type: "button",
|
|
5349
5444
|
className: ti.jump,
|
|
5350
|
-
"data-shown":
|
|
5351
|
-
tabIndex:
|
|
5352
|
-
"aria-hidden": !
|
|
5353
|
-
onClick: () =>
|
|
5445
|
+
"data-shown": ie || void 0,
|
|
5446
|
+
tabIndex: ie ? 0 : -1,
|
|
5447
|
+
"aria-hidden": !ie || void 0,
|
|
5448
|
+
onClick: () => L(!0),
|
|
5354
5449
|
"aria-label": w,
|
|
5355
5450
|
children: /* @__PURE__ */ _(D, {
|
|
5356
5451
|
size: 15,
|
|
@@ -5368,7 +5463,7 @@ var ti = {
|
|
|
5368
5463
|
//#endregion
|
|
5369
5464
|
//#region src/EmptyState/EmptyState.tsx
|
|
5370
5465
|
function mi({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i, suggestionsLabel: a, children: o, className: s, ...c }) {
|
|
5371
|
-
let l =
|
|
5466
|
+
let l = H("emptyState").suggestions, u = a ?? l, d = i ? r ?? [] : [];
|
|
5372
5467
|
return /* @__PURE__ */ v("div", {
|
|
5373
5468
|
className: [pi.empty, s ?? ""].filter(Boolean).join(" "),
|
|
5374
5469
|
...c,
|
|
@@ -5389,9 +5484,10 @@ function mi({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i
|
|
|
5389
5484
|
className: pi.suggestions,
|
|
5390
5485
|
role: "group",
|
|
5391
5486
|
"aria-label": u,
|
|
5392
|
-
children: d.map((e) => /* @__PURE__ */ _(
|
|
5487
|
+
children: d.map((e) => /* @__PURE__ */ _(V, {
|
|
5393
5488
|
variant: "primary",
|
|
5394
5489
|
size: "m",
|
|
5490
|
+
"data-ick-role": "suggestion",
|
|
5395
5491
|
onClick: () => i?.(e),
|
|
5396
5492
|
children: e
|
|
5397
5493
|
}, e))
|
|
@@ -5454,7 +5550,7 @@ var Q = {
|
|
|
5454
5550
|
}
|
|
5455
5551
|
}, Si = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])";
|
|
5456
5552
|
function Ci({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
|
|
5457
|
-
let i =
|
|
5553
|
+
let i = H("thread"), { responding: a } = H("experience"), [o, s] = m("none"), u = p(null), d = p(null), f = p(null), [h] = m(() => typeof document > "u" ? null : document.activeElement), g = l(), y = l(), b = rt, [S, w] = m(() => typeof window > "u" ? !1 : window.matchMedia?.(`(max-width: ${bi}px)`)?.matches ?? !1);
|
|
5458
5554
|
c(() => {
|
|
5459
5555
|
let e = window.matchMedia?.(`(max-width: ${bi}px)`);
|
|
5460
5556
|
if (!e?.addEventListener) return;
|
|
@@ -5507,7 +5603,7 @@ function Ci({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
|
|
|
5507
5603
|
behavior: "smooth"
|
|
5508
5604
|
});
|
|
5509
5605
|
}, [E]);
|
|
5510
|
-
let { x: N, y: ee, width:
|
|
5606
|
+
let { x: N, y: ee, width: te, maxHeight: P } = typeof window > "u" ? {
|
|
5511
5607
|
x: 0,
|
|
5512
5608
|
y: 0,
|
|
5513
5609
|
width: 480,
|
|
@@ -5537,7 +5633,7 @@ function Ci({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
|
|
|
5537
5633
|
animate: S ? "open" : {
|
|
5538
5634
|
left: N,
|
|
5539
5635
|
top: ee,
|
|
5540
|
-
width:
|
|
5636
|
+
width: te,
|
|
5541
5637
|
borderRadius: 28,
|
|
5542
5638
|
opacity: 1
|
|
5543
5639
|
},
|
|
@@ -5567,7 +5663,7 @@ function Ci({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
|
|
|
5567
5663
|
(n.offset.y > 120 || n.velocity.y > 600) && t();
|
|
5568
5664
|
}
|
|
5569
5665
|
} : {},
|
|
5570
|
-
style: !S && Number.isFinite(
|
|
5666
|
+
style: !S && Number.isFinite(P) ? { maxHeight: P } : void 0,
|
|
5571
5667
|
className: Q.panel,
|
|
5572
5668
|
children: /* @__PURE__ */ v("div", {
|
|
5573
5669
|
className: Q.column,
|
|
@@ -5594,14 +5690,16 @@ function Ci({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
|
|
|
5594
5690
|
})]
|
|
5595
5691
|
}), /* @__PURE__ */ v("div", {
|
|
5596
5692
|
className: Q.headerActions,
|
|
5597
|
-
children: [/* @__PURE__ */ _(
|
|
5693
|
+
children: [/* @__PURE__ */ _(V, {
|
|
5598
5694
|
variant: "primary",
|
|
5599
|
-
|
|
5695
|
+
"data-ick-role": "thread-save",
|
|
5696
|
+
icon: /* @__PURE__ */ _(he, { size: 16 }),
|
|
5600
5697
|
onClick: n,
|
|
5601
5698
|
children: i.save
|
|
5602
|
-
}), /* @__PURE__ */ _(
|
|
5699
|
+
}), /* @__PURE__ */ _(V, {
|
|
5603
5700
|
variant: "secondary",
|
|
5604
|
-
|
|
5701
|
+
"data-ick-role": "thread-close",
|
|
5702
|
+
icon: /* @__PURE__ */ _(we, { size: 16 }),
|
|
5605
5703
|
onClick: t,
|
|
5606
5704
|
"aria-label": i.close
|
|
5607
5705
|
})]
|
|
@@ -5880,34 +5978,34 @@ var $ = {
|
|
|
5880
5978
|
damping: 24,
|
|
5881
5979
|
mass: 1
|
|
5882
5980
|
};
|
|
5883
|
-
function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !0, composerMenu: a, onTranscribe: s, onThreadReply: l, title: u, backHref: d, backLabel: h, actions: b, placeholder: x, empty: S, contextTotal: w, contextBase: T = 0, artifact: E, openArtifactId: D, onOpenArtifactChange: O, pane: A = "inline", surface: j = "flush", composer: M = "inline", fill: N = "window", theme: ee, onThemeChange:
|
|
5884
|
-
let
|
|
5981
|
+
function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !0, composerMenu: a, onTranscribe: s, onThreadReply: l, title: u, backHref: d, backLabel: h, actions: b, placeholder: x, empty: S, contextTotal: w, contextBase: T = 0, artifact: E, openArtifactId: D, onOpenArtifactChange: O, pane: A = "inline", surface: j = "flush", composer: M = "inline", fill: N = "window", theme: ee, onThemeChange: te, cursor: P = !1, selectionToggle: F = !1, highlights: I = !0, bookmarks: ne = !0, anchorOffset: re = 100, endOffset: ie = 120, animationConfig: R, foldMotion: ae, feedDelay: oe = 0, onAnswerQuestion: se, onEditQuestion: le, onDecideApproval: ue, className: de }) {
|
|
5982
|
+
let z = H("experience", r?.experience), fe = u ?? z.title, [pe, me] = m([]), [he, _e] = m(!1), [be, xe] = m(null), [Se, Ce] = m("marker"), we = p(null), B = ee !== void 0, [Te, Ee] = m(null), V = B ? ee : Te, [De, Oe] = m(() => typeof window < "u" && !!window.matchMedia?.("(prefers-color-scheme: dark)").matches);
|
|
5885
5983
|
c(() => {
|
|
5886
|
-
let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () =>
|
|
5984
|
+
let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => Oe(e.matches);
|
|
5887
5985
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
5888
5986
|
}, []);
|
|
5889
|
-
let
|
|
5890
|
-
Ti(
|
|
5891
|
-
let
|
|
5892
|
-
|
|
5893
|
-
}, [
|
|
5987
|
+
let ke = V ?? (De ? "dark" : "light");
|
|
5988
|
+
Ti(V);
|
|
5989
|
+
let Me = o((e) => {
|
|
5990
|
+
B || Ee(e), te?.(e);
|
|
5991
|
+
}, [B, te]), U = M === "docked", Ne = f(() => U ? {
|
|
5894
5992
|
...rt,
|
|
5895
|
-
...
|
|
5896
|
-
bubble:
|
|
5897
|
-
} :
|
|
5993
|
+
...R,
|
|
5994
|
+
bubble: R?.bubble ?? Di
|
|
5995
|
+
} : R, [U, R]), Pe = gt({
|
|
5898
5996
|
onSend: e ?? Ei,
|
|
5899
|
-
announcements: { responding:
|
|
5900
|
-
nextTurn:
|
|
5997
|
+
announcements: { responding: z.responding },
|
|
5998
|
+
nextTurn: U ? "at-send" : "after-answer"
|
|
5901
5999
|
}), { turns: Fe, setDraft: Ie, submit: Le, showVersion: W, stop: Re, beginEdit: ze, cancelEdit: Be, updatePart: Ve, isStreaming: He } = t ?? Pe, [Ue, We] = m(null), Ge = o((e, t, n) => {
|
|
5902
6000
|
We(e), Le(e, t, n);
|
|
5903
|
-
}, [Le]),
|
|
6001
|
+
}, [Le]), qe = Ue ? Fe.find((e) => e.id === Ue) ?? null : null, Je = (qe?.versions?.length ?? 0) > 0, G = qe && Je && qe.state !== "resting" ? Ue : null, [K, q] = m(0), Ye = N === "window";
|
|
5904
6002
|
c(() => {
|
|
5905
|
-
if (!
|
|
6003
|
+
if (!U || !Ye) return;
|
|
5906
6004
|
let e = window.visualViewport;
|
|
5907
6005
|
if (!e) return;
|
|
5908
|
-
let t = () =>
|
|
6006
|
+
let t = () => q(Math.max(0, Math.round(window.innerHeight - e.height)));
|
|
5909
6007
|
return t(), e.addEventListener("resize", t), () => e.removeEventListener("resize", t);
|
|
5910
|
-
}, [
|
|
6008
|
+
}, [U, Ye]);
|
|
5911
6009
|
let Xe = o((e) => {
|
|
5912
6010
|
We(e), Le(e);
|
|
5913
6011
|
}, [Le]), Ze = Fe.length === 1 && !Fe[0].user && !Fe[0].ai, Qe = T + Math.round(Fe.reduce((e, t) => e + t.user.length + t.ai.length + JSON.stringify(t.parts ?? []).length, 0) / 4), $e = w !== void 0 && Qe >= w, et = p(!1);
|
|
@@ -5916,8 +6014,8 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
5916
6014
|
et.current = !1;
|
|
5917
6015
|
return;
|
|
5918
6016
|
}
|
|
5919
|
-
et.current || (et.current = !0, Ke(
|
|
5920
|
-
}, [$e,
|
|
6017
|
+
et.current || (et.current = !0, Ke(z.windowFull));
|
|
6018
|
+
}, [$e, z.windowFull]);
|
|
5921
6019
|
let tt = ei(), nt = D !== void 0, it = nt ? D : tt.openId, at = p({
|
|
5922
6020
|
openArtifactId: it,
|
|
5923
6021
|
artifactHeld: nt,
|
|
@@ -5933,58 +6031,58 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
5933
6031
|
let ot = tt.open, st = tt.close, ct = o((e) => {
|
|
5934
6032
|
let { artifactHeld: t, onOpenArtifactChange: n } = at.current;
|
|
5935
6033
|
t || (e === null ? st() : ot(e)), n?.(e);
|
|
5936
|
-
}, [ot, st]), lt = o(() => ct(null), [ct]), [ut, dt] = m({}),
|
|
6034
|
+
}, [ot, st]), lt = o(() => ct(null), [ct]), [ut, dt] = m({}), ft = o((e, t) => {
|
|
5937
6035
|
dt((n) => ({
|
|
5938
6036
|
...n,
|
|
5939
6037
|
[e]: t
|
|
5940
6038
|
}));
|
|
5941
|
-
}, []),
|
|
5942
|
-
|
|
6039
|
+
}, []), pt = Fe.find((e) => e.state !== "idle" && e.state !== "typing" && e.user.trim())?.user.trim() ?? fe, mt = o((e, t) => {
|
|
6040
|
+
ne && t.trim().length > 0 && me((n) => [...n, {
|
|
5943
6041
|
turnId: e,
|
|
5944
6042
|
text: t.trim()
|
|
5945
6043
|
}]);
|
|
5946
|
-
}, [
|
|
5947
|
-
|
|
6044
|
+
}, [ne]), J = o((e, t) => ct(at.current.openArtifactId === t ? null : t), [ct]), ht = o((e, t) => {
|
|
6045
|
+
xe({
|
|
5948
6046
|
text: e,
|
|
5949
6047
|
rect: t
|
|
5950
6048
|
});
|
|
5951
|
-
}, []), Y = f(() =>
|
|
6049
|
+
}, []), Y = f(() => se ? (e, t, n, r) => se(Ve, e, t, n, r) : void 0, [se, Ve]), _t = f(() => le ? (e, t, n) => le(Ve, e, t, n) : void 0, [le, Ve]), vt = f(() => ue ? (e, t, n) => ue(Ve, e, t, n) : void 0, [ue, Ve]), [yt, bt] = m(() => typeof window > "u" || !window.matchMedia || window.matchMedia("(pointer: fine)").matches);
|
|
5952
6050
|
c(() => {
|
|
5953
|
-
if (!
|
|
6051
|
+
if (!P) return;
|
|
5954
6052
|
let e = window.matchMedia("(pointer: fine)"), t = () => bt(e.matches);
|
|
5955
6053
|
return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
5956
|
-
}, [
|
|
6054
|
+
}, [P]);
|
|
5957
6055
|
let xt = (e) => i === !0 || Array.isArray(i) && i.includes(e), St = [
|
|
5958
|
-
...
|
|
6056
|
+
...I && ne && pe.length > 0 ? [{
|
|
5959
6057
|
id: "bookmarks",
|
|
5960
|
-
label:
|
|
6058
|
+
label: z.savedHighlights,
|
|
5961
6059
|
icon: /* @__PURE__ */ _(k, {
|
|
5962
6060
|
size: 16,
|
|
5963
6061
|
"aria-hidden": !0
|
|
5964
6062
|
}),
|
|
5965
|
-
count:
|
|
6063
|
+
count: pe.length,
|
|
5966
6064
|
pinned: !0,
|
|
5967
|
-
onClick: () =>
|
|
6065
|
+
onClick: () => _e(!0)
|
|
5968
6066
|
}] : [],
|
|
5969
6067
|
...xt("theme") ? [{
|
|
5970
6068
|
id: "theme",
|
|
5971
|
-
label:
|
|
5972
|
-
icon: _(
|
|
6069
|
+
label: ke === "dark" ? z.themeToLight : z.themeToDark,
|
|
6070
|
+
icon: _(ke === "dark" ? ve : ce, {
|
|
5973
6071
|
size: 16,
|
|
5974
6072
|
"aria-hidden": !0
|
|
5975
6073
|
}),
|
|
5976
|
-
active:
|
|
5977
|
-
onClick: () =>
|
|
6074
|
+
active: ke === "dark",
|
|
6075
|
+
onClick: () => Me(ke === "dark" ? "light" : "dark")
|
|
5978
6076
|
}] : [],
|
|
5979
6077
|
...xt("share") ? [{
|
|
5980
6078
|
id: "share",
|
|
5981
|
-
label:
|
|
5982
|
-
icon: /* @__PURE__ */ _(
|
|
6079
|
+
label: z.share,
|
|
6080
|
+
icon: /* @__PURE__ */ _(ge, {
|
|
5983
6081
|
size: 16,
|
|
5984
6082
|
"aria-hidden": !0
|
|
5985
6083
|
}),
|
|
5986
6084
|
onClick: () => navigator.share?.({
|
|
5987
|
-
title:
|
|
6085
|
+
title: pt,
|
|
5988
6086
|
url: window.location.href
|
|
5989
6087
|
})
|
|
5990
6088
|
}] : [],
|
|
@@ -5994,15 +6092,15 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
5994
6092
|
$.page,
|
|
5995
6093
|
j === "panes" || !Ye ? $.fitted : "",
|
|
5996
6094
|
"ick-chat-page",
|
|
5997
|
-
|
|
6095
|
+
de
|
|
5998
6096
|
].filter(Boolean).join(" "),
|
|
5999
|
-
style: { "--ick-experience-anchor": `${
|
|
6000
|
-
"data-composer":
|
|
6097
|
+
style: { "--ick-experience-anchor": `${re}px` },
|
|
6098
|
+
"data-composer": U ? "docked" : void 0,
|
|
6001
6099
|
initial: { opacity: 0 },
|
|
6002
6100
|
animate: {
|
|
6003
|
-
opacity:
|
|
6004
|
-
filter:
|
|
6005
|
-
scale:
|
|
6101
|
+
opacity: be || he ? .4 : 1,
|
|
6102
|
+
filter: be || he ? "blur(3px)" : "blur(0px)",
|
|
6103
|
+
scale: be || he ? .9 : 1
|
|
6006
6104
|
},
|
|
6007
6105
|
transition: {
|
|
6008
6106
|
type: "spring",
|
|
@@ -6011,13 +6109,13 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
6011
6109
|
mass: .9
|
|
6012
6110
|
},
|
|
6013
6111
|
onAnimationComplete: () => {
|
|
6014
|
-
document.activeElement && document.activeElement !== document.body ||
|
|
6112
|
+
document.activeElement && document.activeElement !== document.body || we.current?.focus();
|
|
6015
6113
|
},
|
|
6016
6114
|
children: [
|
|
6017
6115
|
/* @__PURE__ */ _("div", { className: $.topBlur }),
|
|
6018
6116
|
/* @__PURE__ */ v(wt, {
|
|
6019
6117
|
className: `${$.header} ick-chat-header`,
|
|
6020
|
-
title:
|
|
6118
|
+
title: pt,
|
|
6021
6119
|
backHref: d,
|
|
6022
6120
|
backLabel: h,
|
|
6023
6121
|
elevateOnScroll: !1,
|
|
@@ -6027,36 +6125,36 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
6027
6125
|
className: $.context,
|
|
6028
6126
|
used: Qe,
|
|
6029
6127
|
total: w
|
|
6030
|
-
}),
|
|
6128
|
+
}), F && I && /* @__PURE__ */ v("div", {
|
|
6031
6129
|
className: $.selectMode,
|
|
6032
6130
|
role: "group",
|
|
6033
|
-
"aria-label":
|
|
6131
|
+
"aria-label": z.selectionMode,
|
|
6034
6132
|
children: [/* @__PURE__ */ _("button", {
|
|
6035
6133
|
type: "button",
|
|
6036
|
-
"data-active":
|
|
6037
|
-
onClick: () =>
|
|
6038
|
-
"aria-label":
|
|
6039
|
-
title:
|
|
6040
|
-
children: /* @__PURE__ */ _(
|
|
6134
|
+
"data-active": Se === "marker",
|
|
6135
|
+
onClick: () => Ce("marker"),
|
|
6136
|
+
"aria-label": z.marker,
|
|
6137
|
+
title: z.marker,
|
|
6138
|
+
children: /* @__PURE__ */ _(L, { size: 16 })
|
|
6041
6139
|
}), /* @__PURE__ */ _("button", {
|
|
6042
6140
|
type: "button",
|
|
6043
|
-
"data-active":
|
|
6044
|
-
onClick: () =>
|
|
6045
|
-
"aria-label":
|
|
6046
|
-
title:
|
|
6047
|
-
children: /* @__PURE__ */ _(
|
|
6141
|
+
"data-active": Se === "precise",
|
|
6142
|
+
onClick: () => Ce("precise"),
|
|
6143
|
+
"aria-label": z.precise,
|
|
6144
|
+
title: z.precise,
|
|
6145
|
+
children: /* @__PURE__ */ _(ye, { size: 16 })
|
|
6048
6146
|
})]
|
|
6049
6147
|
})]
|
|
6050
6148
|
}),
|
|
6051
6149
|
/* @__PURE__ */ v(fi, {
|
|
6052
6150
|
viewportClassName: `${$.feed} ick-chat-feed`,
|
|
6053
|
-
anchorId:
|
|
6054
|
-
dock:
|
|
6055
|
-
anchorOffset:
|
|
6056
|
-
endOffset:
|
|
6151
|
+
anchorId: G ? `turn-${G}` : void 0,
|
|
6152
|
+
dock: U,
|
|
6153
|
+
anchorOffset: re,
|
|
6154
|
+
endOffset: U ? 0 : ie,
|
|
6057
6155
|
children: [
|
|
6058
6156
|
Ze && S && /* @__PURE__ */ _(mi, {
|
|
6059
|
-
className:
|
|
6157
|
+
className: U ? `${$.opening} ${$.centred}` : $.opening,
|
|
6060
6158
|
title: S.title,
|
|
6061
6159
|
description: S.description,
|
|
6062
6160
|
suggestions: S.suggestions,
|
|
@@ -6066,31 +6164,33 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
6066
6164
|
let r = t === Fe.length - 1 && (e.state === "idle" || e.state === "typing");
|
|
6067
6165
|
return /* @__PURE__ */ _(Ir, {
|
|
6068
6166
|
turn: e,
|
|
6069
|
-
questionAlign:
|
|
6070
|
-
className:
|
|
6167
|
+
questionAlign: U && r || Ze && t === 0 ? "stretch" : "end",
|
|
6168
|
+
className: U && r ? $.dock : Ze && t === 0 ? $.opening : void 0,
|
|
6071
6169
|
onTranscribe: s,
|
|
6072
6170
|
isActiveInput: r,
|
|
6073
|
-
inputRef: r ?
|
|
6074
|
-
entranceDelay: t === 0 ?
|
|
6075
|
-
|
|
6076
|
-
|
|
6171
|
+
inputRef: r ? we : null,
|
|
6172
|
+
entranceDelay: t === 0 ? oe : 0,
|
|
6173
|
+
entrance: U && r ? "fade" : "rise",
|
|
6174
|
+
answerAfterTravel: U,
|
|
6175
|
+
selectionMode: Se,
|
|
6176
|
+
highlights: I,
|
|
6077
6177
|
animationConfig: Ne,
|
|
6078
|
-
foldMotion:
|
|
6178
|
+
foldMotion: ae,
|
|
6079
6179
|
openArtifactId: it,
|
|
6080
|
-
onOpenArtifact:
|
|
6180
|
+
onOpenArtifact: J,
|
|
6081
6181
|
onArtifactChange: ct,
|
|
6082
6182
|
placeholder: x,
|
|
6083
6183
|
onDraft: Ie,
|
|
6084
6184
|
onSubmit: Ge,
|
|
6085
6185
|
onRegenerate: Xe,
|
|
6086
6186
|
onShowVersion: W,
|
|
6087
|
-
onFeedback:
|
|
6187
|
+
onFeedback: ft,
|
|
6088
6188
|
feedback: ut[e.id] ?? null,
|
|
6089
|
-
onStop: !
|
|
6090
|
-
busy:
|
|
6189
|
+
onStop: !U || r ? Re : void 0,
|
|
6190
|
+
busy: U && r ? He : void 0,
|
|
6091
6191
|
onEdit: ze,
|
|
6092
6192
|
onCancelEdit: Be,
|
|
6093
|
-
onHighlight:
|
|
6193
|
+
onHighlight: mt,
|
|
6094
6194
|
onReplyInThread: l ? ht : void 0,
|
|
6095
6195
|
onAnswerQuestion: Y,
|
|
6096
6196
|
onEditQuestion: _t,
|
|
@@ -6099,21 +6199,21 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
6099
6199
|
composerMenu: a
|
|
6100
6200
|
}, e.id);
|
|
6101
6201
|
}) }),
|
|
6102
|
-
$e && /* @__PURE__ */ _(Bn, { children:
|
|
6202
|
+
$e && /* @__PURE__ */ _(Bn, { children: z.windowFull })
|
|
6103
6203
|
]
|
|
6104
6204
|
}),
|
|
6105
6205
|
/* @__PURE__ */ _("div", { className: $.bottomBlur })
|
|
6106
6206
|
]
|
|
6107
6207
|
});
|
|
6108
|
-
return /* @__PURE__ */ v(
|
|
6208
|
+
return /* @__PURE__ */ v(Ae, {
|
|
6109
6209
|
labels: r,
|
|
6110
6210
|
children: [
|
|
6111
|
-
|
|
6211
|
+
P && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("style", { dangerouslySetInnerHTML: { __html: "@media (pointer: fine) { * { cursor: none !important; } }" } }), yt && /* @__PURE__ */ _(wi, {})] }),
|
|
6112
6212
|
/* @__PURE__ */ _($r, {
|
|
6113
6213
|
className: $.workspace,
|
|
6114
6214
|
surface: j,
|
|
6115
6215
|
"data-fill": Ye ? void 0 : "container",
|
|
6116
|
-
style: Ye &&
|
|
6216
|
+
style: Ye && K > 0 ? { "--ick-keyboard": `${K}px` } : void 0,
|
|
6117
6217
|
onDismiss: lt,
|
|
6118
6218
|
pane: ({ narrow: e, expanded: t, toggleExpanded: n }) => Ct ? /* @__PURE__ */ _(Ur, {
|
|
6119
6219
|
title: Ct.title,
|
|
@@ -6126,16 +6226,16 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
6126
6226
|
}) : null,
|
|
6127
6227
|
children: Tt
|
|
6128
6228
|
}),
|
|
6129
|
-
/* @__PURE__ */ _(y, { children:
|
|
6229
|
+
/* @__PURE__ */ _(y, { children: he && /* @__PURE__ */ _(C.div, {
|
|
6130
6230
|
className: $.scrim,
|
|
6131
6231
|
initial: { opacity: 0 },
|
|
6132
6232
|
animate: { opacity: 1 },
|
|
6133
6233
|
exit: { opacity: 0 },
|
|
6134
|
-
onClick: () =>
|
|
6234
|
+
onClick: () => _e(!1),
|
|
6135
6235
|
children: /* @__PURE__ */ v(C.div, {
|
|
6136
6236
|
className: $.sheet,
|
|
6137
6237
|
role: "dialog",
|
|
6138
|
-
"aria-label":
|
|
6238
|
+
"aria-label": z.savedHighlights,
|
|
6139
6239
|
initial: {
|
|
6140
6240
|
y: 20,
|
|
6141
6241
|
scale: .95
|
|
@@ -6153,24 +6253,24 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
6153
6253
|
className: $.sheetHead,
|
|
6154
6254
|
children: [/* @__PURE__ */ _("h2", {
|
|
6155
6255
|
className: $.sheetTitle,
|
|
6156
|
-
children:
|
|
6256
|
+
children: z.highlights
|
|
6157
6257
|
}), /* @__PURE__ */ _("button", {
|
|
6158
6258
|
className: $.close,
|
|
6159
|
-
onClick: () =>
|
|
6160
|
-
children:
|
|
6259
|
+
onClick: () => _e(!1),
|
|
6260
|
+
children: z.close
|
|
6161
6261
|
})]
|
|
6162
|
-
}), Array.from(new Set(
|
|
6262
|
+
}), Array.from(new Set(pe.map((e) => e.turnId))).map((e, t) => /* @__PURE__ */ v("div", {
|
|
6163
6263
|
className: $.group,
|
|
6164
6264
|
children: [/* @__PURE__ */ _("h3", {
|
|
6165
6265
|
className: $.groupTitle,
|
|
6166
|
-
children:
|
|
6266
|
+
children: je(z.paragraph, { index: t + 1 })
|
|
6167
6267
|
}), /* @__PURE__ */ _("div", {
|
|
6168
6268
|
className: $.marks,
|
|
6169
|
-
children:
|
|
6269
|
+
children: pe.filter((t) => t.turnId === e).map((t, n) => /* @__PURE__ */ _("button", {
|
|
6170
6270
|
type: "button",
|
|
6171
6271
|
className: $.mark,
|
|
6172
6272
|
onClick: () => {
|
|
6173
|
-
|
|
6273
|
+
_e(!1), setTimeout(() => {
|
|
6174
6274
|
let t = document.getElementById(`turn-${e}`), n = document.querySelector(".ick-chat-feed"), r = document.querySelector(".ick-chat-header");
|
|
6175
6275
|
if (t && n) {
|
|
6176
6276
|
let e = r ? r.offsetHeight : 80;
|
|
@@ -6190,15 +6290,15 @@ function Oi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
|
|
|
6190
6290
|
}, e))]
|
|
6191
6291
|
})
|
|
6192
6292
|
}) }),
|
|
6193
|
-
/* @__PURE__ */ _(y, { children:
|
|
6194
|
-
activeReply:
|
|
6195
|
-
onClose: () =>
|
|
6293
|
+
/* @__PURE__ */ _(y, { children: be && l && /* @__PURE__ */ _(Ci, {
|
|
6294
|
+
activeReply: be,
|
|
6295
|
+
onClose: () => xe(null),
|
|
6196
6296
|
onSendMessage: l
|
|
6197
6297
|
}, "thread-popup") })
|
|
6198
6298
|
]
|
|
6199
6299
|
});
|
|
6200
6300
|
}
|
|
6201
6301
|
//#endregion
|
|
6202
|
-
export {
|
|
6302
|
+
export { Oe as $, pn as A, vt as B, Cn as C, yn as D, xn as E, Ht as F, Qe as G, ct as H, Nt as I, Re as J, Ke as K, jt as L, nn as M, Jt as N, _n as O, $t as P, Ae as Q, kt as R, wn as S, En as T, st as U, gt as V, rt as W, Fe as X, Le as Y, Me as Z, Rn as _, mi as a, Mn as b, $r as c, Ir as d, V as et, Mr as f, In as g, Bn as h, Ci as i, ln as j, hn as k, Ur as l, Wn as m, Ti as n, fi as o, Sr as p, Be as q, wi as r, ei as s, Oi as t, Vr as u, Ln as v, Tn as w, Sn as x, Pn as y, wt as z };
|
|
6203
6303
|
|
|
6204
|
-
//# sourceMappingURL=ChatExperience-
|
|
6304
|
+
//# sourceMappingURL=ChatExperience-BBd-p0wh.js.map
|