@duskmoon-dev/components 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,24 +2,24 @@
2
2
 
3
3
  // src/components/chat/Chat.tsx
4
4
  import {
5
- forwardRef as forwardRef6,
5
+ forwardRef as forwardRef5,
6
6
  useId as useId3,
7
- useLayoutEffect as useLayoutEffect3,
7
+ useLayoutEffect as useLayoutEffect4,
8
8
  useRef as useRef5,
9
9
  useState as useState3
10
10
  } from "react";
11
11
 
12
12
  // src/components/chat/ChatComposer.tsx
13
13
  import {
14
- forwardRef as forwardRef4,
14
+ forwardRef as forwardRef3,
15
15
  useId,
16
- useLayoutEffect as useLayoutEffect2,
16
+ useLayoutEffect as useLayoutEffect3,
17
17
  useRef as useRef4,
18
18
  useState as useState2
19
19
  } from "react";
20
20
 
21
21
  // src/components/chat/composer/ComposerShell.tsx
22
- import { forwardRef, useEffect, useRef } from "react";
22
+ import { forwardRef, useEffect, useRef as useRef2, useState } from "react";
23
23
 
24
24
  // src/components/button/Button.tsx
25
25
  import React from "react";
@@ -374,8 +374,8 @@ function Button({
374
374
  });
375
375
  }
376
376
  // src/components/chat/composer/CompletionList.tsx
377
- import React2 from "react";
378
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
377
+ import React2, { useLayoutEffect, useRef } from "react";
378
+ import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
379
379
  function completionOptionId(composerId, candidateId) {
380
380
  return `${composerId}-option-${encodeURIComponent(candidateId)}`;
381
381
  }
@@ -384,13 +384,37 @@ function CompletionList({
384
384
  label,
385
385
  candidates,
386
386
  activeId,
387
- onSelect
387
+ onSelect,
388
+ compact = false,
389
+ anchorName,
390
+ header,
391
+ status,
392
+ onDismiss
388
393
  }) {
389
- return /* @__PURE__ */ jsx2("ul", {
394
+ const surface = useRef(null);
395
+ useLayoutEffect(() => {
396
+ if (compact)
397
+ surface.current?.showPopover?.();
398
+ }, [compact]);
399
+ useLayoutEffect(() => {
400
+ const tray = surface.current;
401
+ const option = tray?.querySelector('[aria-selected="true"]');
402
+ if (!compact || !tray || !option)
403
+ return;
404
+ const bounds = tray.getBoundingClientRect();
405
+ const selected = option.getBoundingClientRect();
406
+ const top = bounds.top + tray.clientTop;
407
+ const bottom = top + tray.clientHeight;
408
+ if (selected.top < top)
409
+ tray.scrollTop += selected.top - top;
410
+ else if (selected.bottom > bottom)
411
+ tray.scrollTop += selected.bottom - bottom;
412
+ }, [compact, activeId, candidates]);
413
+ const list = candidates.length ? /* @__PURE__ */ jsx2("ul", {
390
414
  id: `${composerId}-completions`,
391
415
  role: "listbox",
392
416
  "aria-label": label,
393
- className: "chat-composer-completions",
417
+ className: compact ? "chat-composer-completion-list" : "chat-composer-completions",
394
418
  children: candidates.map((item, index) => /* @__PURE__ */ jsxs2(React2.Fragment, {
395
419
  children: [
396
420
  item.group && candidates[index - 1]?.group !== item.group ? /* @__PURE__ */ jsx2("li", {
@@ -401,7 +425,7 @@ function CompletionList({
401
425
  }) : null,
402
426
  /* @__PURE__ */ jsxs2("li", {
403
427
  id: completionOptionId(composerId, item.id),
404
- className: "chat-composer-option",
428
+ className: compact ? "chat-composer-option chat-composer-option-compact" : "chat-composer-option",
405
429
  role: "option",
406
430
  "aria-label": item.group ? `${item.group}: ${item.label}` : undefined,
407
431
  "aria-selected": item.id === activeId,
@@ -418,24 +442,57 @@ function CompletionList({
418
442
  }
419
443
  },
420
444
  children: [
445
+ compact && item.icon ? /* @__PURE__ */ jsx2("span", {
446
+ className: "chat-composer-option-icon",
447
+ "aria-hidden": "true",
448
+ children: item.icon
449
+ }) : null,
421
450
  /* @__PURE__ */ jsx2("span", {
451
+ className: compact ? "chat-composer-label" : undefined,
452
+ title: item.label,
422
453
  children: item.label
423
454
  }),
424
455
  item.description ? /* @__PURE__ */ jsx2("span", {
425
- className: "chat-composer-description",
456
+ className: compact ? "chat-composer-description chat-composer-option-description" : "chat-composer-description",
457
+ title: typeof item.description === "string" ? item.description : undefined,
426
458
  children: item.description
459
+ }) : null,
460
+ compact && item.sourceLabel ? /* @__PURE__ */ jsx2("span", {
461
+ className: "chat-composer-description chat-composer-option-source",
462
+ children: item.sourceLabel
427
463
  }) : null
428
464
  ]
429
465
  })
430
466
  ]
431
467
  }, item.id))
468
+ }) : null;
469
+ return compact ? /* @__PURE__ */ jsxs2("div", {
470
+ ref: surface,
471
+ popover: "auto",
472
+ className: "chat-composer-completions chat-composer-completions-compact",
473
+ style: { positionAnchor: anchorName },
474
+ onToggle: (event) => {
475
+ if (event.newState === "closed")
476
+ onDismiss?.();
477
+ },
478
+ children: [
479
+ header,
480
+ list,
481
+ status
482
+ ]
483
+ }) : /* @__PURE__ */ jsxs2(Fragment2, {
484
+ children: [
485
+ header,
486
+ status,
487
+ list
488
+ ]
432
489
  });
433
490
  }
434
491
 
435
492
  // src/components/chat/composer/ComposerShell.tsx
436
- import { jsx as jsx3, jsxs as jsxs3, Fragment as Fragment2 } from "react/jsx-runtime";
493
+ import { jsx as jsx3, jsxs as jsxs3, Fragment as Fragment3 } from "react/jsx-runtime";
437
494
  function AttachmentPreview({ file }) {
438
- const imageRef = useRef(null);
495
+ const imageRef = useRef2(null);
439
496
  useEffect(() => {
440
497
  const image = imageRef.current;
441
498
  if (!image || !file.type.startsWith("image/") || !URL.createObjectURL)
@@ -451,10 +508,44 @@ function AttachmentPreview({ file }) {
451
508
  }, [file]);
452
509
  return file.type.startsWith("image/") ? /* @__PURE__ */ jsx3("img", {
453
510
  ref: imageRef,
511
+ className: "chat-composer-preview",
454
512
  alt: file.name,
455
513
  hidden: true
456
514
  }) : null;
457
515
  }
516
+ function ComposerIcon({
517
+ action
518
+ }) {
519
+ return /* @__PURE__ */ jsx3("svg", {
520
+ width: "18",
521
+ height: "18",
522
+ viewBox: "0 0 24 24",
523
+ fill: "none",
524
+ stroke: "currentColor",
525
+ strokeWidth: "2",
526
+ strokeLinecap: "round",
527
+ strokeLinejoin: "round",
528
+ "aria-hidden": "true",
529
+ focusable: "false",
530
+ children: action === "attach" ? /* @__PURE__ */ jsx3("path", {
531
+ d: "M12 5v14M5 12h14"
532
+ }) : action === "send" ? /* @__PURE__ */ jsx3("path", {
533
+ d: "m5 12 7-7 7 7M12 5v14"
534
+ }) : action === "stop" ? /* @__PURE__ */ jsx3("rect", {
535
+ x: "6",
536
+ y: "6",
537
+ width: "12",
538
+ height: "12",
539
+ rx: "1",
540
+ fill: "currentColor",
541
+ stroke: "none"
542
+ }) : action === "retry" ? /* @__PURE__ */ jsx3("path", {
543
+ d: "M3 11a9 9 0 1 1 2.6 7.4M3 4v7h7"
544
+ }) : /* @__PURE__ */ jsx3("path", {
545
+ d: "m6 6 12 12M6 18 18 6"
546
+ })
547
+ });
548
+ }
458
549
  function AttachmentContent({
459
550
  file,
460
551
  renderAttachment,
@@ -471,6 +562,8 @@ function ExtraActions({
471
562
  var ComposerShell = forwardRef(({
472
563
  editor,
473
564
  composerId,
565
+ compact = false,
566
+ addMenu,
474
567
  entries,
475
568
  renderAttachment,
476
569
  removeAttachment,
@@ -489,12 +582,14 @@ var ComposerShell = forwardRef(({
489
582
  active,
490
583
  showCompletion,
491
584
  selectCompletion,
585
+ dismissCompletion,
492
586
  visibleError,
493
587
  hasError,
494
588
  intakeEvents = true,
495
589
  completionHeader,
496
590
  completionStatus,
497
591
  statusContent,
592
+ renderFooter,
498
593
  attachLabel,
499
594
  sendLabel,
500
595
  stopLabel,
@@ -504,215 +599,346 @@ var ComposerShell = forwardRef(({
504
599
  children,
505
600
  className,
506
601
  ...props
507
- }, ref) => /* @__PURE__ */ jsxs3("div", {
508
- ...props,
509
- ref,
510
- className: cn("chat-composer", className),
511
- onPaste: (event) => {
512
- props.onPaste?.(event);
513
- if (!intakeEvents || event.defaultPrevented || disabled || !onAttachmentsChange)
514
- return;
515
- const files = Array.from(event.clipboardData.files ?? []);
516
- if (files.length)
517
- addAttachments(files, "paste");
518
- },
519
- onDragOver: (event) => {
520
- props.onDragOver?.(event);
521
- if (intakeEvents && !event.defaultPrevented && !disabled && onAttachmentsChange && Array.from(event.dataTransfer.types).includes("Files"))
522
- event.preventDefault();
523
- },
524
- onDrop: (event) => {
525
- props.onDrop?.(event);
526
- if (!intakeEvents || event.defaultPrevented || disabled || !onAttachmentsChange)
527
- return;
528
- const files = Array.from(event.dataTransfer.files ?? []);
529
- if (files.length) {
530
- event.preventDefault();
531
- addAttachments(files, "drop");
532
- }
533
- },
534
- children: [
535
- entries.length > 0 ? /* @__PURE__ */ jsx3("ul", {
536
- role: "list",
537
- className: "chat-composer-attachments",
538
- "aria-label": "Attachments",
539
- children: entries.map(({
540
- file,
541
- id,
542
- name: entryName,
543
- previewUrl,
544
- state,
545
- status,
546
- progress,
547
- retry,
548
- cancel
549
- }) => {
550
- const name = file?.name ?? entryName ?? "Attachment";
551
- return /* @__PURE__ */ jsx3("li", {
552
- className: "chat-composer-attachment",
553
- "data-state": state,
554
- children: renderAttachment && file ? /* @__PURE__ */ jsx3(AttachmentContent, {
555
- file,
556
- renderAttachment,
557
- context: {
558
- remove: () => removeAttachment(id),
559
- disabled: disabled || !onAttachmentsChange
560
- }
561
- }) : /* @__PURE__ */ jsxs3(Fragment2, {
562
- children: [
563
- previewUrl ? /* @__PURE__ */ jsx3("img", {
564
- src: previewUrl,
565
- alt: name
566
- }) : file ? /* @__PURE__ */ jsx3(AttachmentPreview, {
567
- file
568
- }) : null,
569
- /* @__PURE__ */ jsxs3("div", {
570
- className: "chat-composer-attachment-info",
571
- children: [
572
- /* @__PURE__ */ jsx3("span", {
573
- className: "chat-composer-filename",
574
- title: name,
575
- children: name
576
- }),
577
- status ? /* @__PURE__ */ jsx3("span", {
578
- className: "chat-composer-description",
579
- children: status
580
- }) : null,
581
- progress !== undefined ? /* @__PURE__ */ jsx3("progress", {
582
- value: progress,
583
- max: 1,
584
- "aria-label": `Preparing ${name}`
585
- }) : null
586
- ]
587
- }),
588
- retry ? /* @__PURE__ */ jsx3(Button, {
589
- type: "button",
590
- size: "sm",
591
- disabled,
592
- onClick: retry,
593
- "aria-label": `Retry ${name}`,
594
- children: "Retry"
595
- }) : null,
596
- cancel ? /* @__PURE__ */ jsx3(Button, {
597
- type: "button",
598
- size: "sm",
599
- disabled,
600
- onClick: cancel,
601
- "aria-label": `Cancel ${name}`,
602
- children: "Cancel"
603
- }) : null,
604
- onAttachmentsChange ? /* @__PURE__ */ jsx3(Button, {
605
- type: "button",
606
- size: "sm",
607
- color: "base",
608
- appearance: "ghost",
609
- disabled,
610
- "aria-label": `Remove ${name}`,
611
- onClick: () => removeAttachment(id),
612
- children: "Remove"
613
- }) : null
614
- ]
615
- })
616
- }, id);
602
+ }, ref) => {
603
+ const [addOpen, setAddOpen] = useState(false);
604
+ const addId = `${composerId}-add`;
605
+ const addAnchor = `--composer-add-${composerId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
606
+ const completionAnchor = `--composer-completions-${composerId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
607
+ const thumbnails = compact && entries.length > 0 && !renderAttachment && entries.every(({ file, previewUrl, state, status, progress, retry, cancel }) => (previewUrl || file?.type.startsWith("image/") && typeof URL.createObjectURL === "function") && (!state || state === "ready") && !status && progress === undefined && !retry && !cancel);
608
+ const attachmentAction = onAttachmentsChange ? /* @__PURE__ */ jsxs3(Fragment3, {
609
+ children: [
610
+ /* @__PURE__ */ jsx3("input", {
611
+ ref: pickerRef,
612
+ type: "file",
613
+ accept,
614
+ multiple,
615
+ disabled,
616
+ hidden: true,
617
+ "aria-label": attachLabel,
618
+ onChange: (event) => {
619
+ const files = Array.from(event.currentTarget.files ?? []);
620
+ event.currentTarget.value = "";
621
+ if (files.length > 0)
622
+ addAttachments(files, "picker");
623
+ }
624
+ }),
625
+ /* @__PURE__ */ jsx3(Button, {
626
+ type: "button",
627
+ color: "base",
628
+ appearance: "ghost",
629
+ size: "sm",
630
+ shape: "circle",
631
+ "aria-label": attachLabel,
632
+ title: attachLabel,
633
+ disabled,
634
+ onClick: openAttachments,
635
+ children: /* @__PURE__ */ jsx3(ComposerIcon, {
636
+ action: "attach"
637
+ })
617
638
  })
618
- }) : null,
619
- editor,
620
- completionHeader,
621
- completionStatus,
622
- showCompletion ? /* @__PURE__ */ jsx3(CompletionList, {
623
- composerId,
624
- label: completion?.label ?? "Suggestions",
625
- candidates,
626
- activeId: active?.id,
627
- onSelect: selectCompletion
628
- }) : null,
629
- statusContent,
630
- hasError ? /* @__PURE__ */ jsx3("div", {
631
- id: `${composerId}-error`,
632
- role: "alert",
633
- className: "chat-composer-error chat-composer-status",
634
- "data-state": "error",
635
- children: visibleError
636
- }) : null,
637
- /* @__PURE__ */ jsxs3("div", {
638
- className: "chat-composer-actions",
639
+ ]
640
+ }) : null;
641
+ const actionContent = /* @__PURE__ */ jsxs3(Fragment3, {
642
+ children: [
643
+ /* @__PURE__ */ jsx3(ExtraActions, {
644
+ context: {
645
+ submit: () => {
646
+ submit();
647
+ },
648
+ submitting,
649
+ canSubmit: eligible,
650
+ disabled,
651
+ generating,
652
+ openAttachments
653
+ },
654
+ children
655
+ }),
656
+ generating && onStop && (!compact || !eligible) ? /* @__PURE__ */ jsx3(Button, {
657
+ type: "button",
658
+ color: compact ? "primary" : undefined,
659
+ size: "sm",
660
+ shape: "circle",
661
+ "aria-label": stopLabel,
662
+ title: stopLabel,
663
+ disabled,
664
+ onClick: onStop,
665
+ children: /* @__PURE__ */ jsx3(ComposerIcon, {
666
+ action: "stop"
667
+ })
668
+ }) : null,
669
+ !compact || !generating || !onStop || eligible ? /* @__PURE__ */ jsx3(Button, {
670
+ type: "button",
671
+ color: "primary",
672
+ size: "sm",
673
+ shape: "circle",
674
+ "aria-label": sendLabel,
675
+ title: sendLabel,
676
+ disabled: !eligible,
677
+ "aria-busy": busy || submitting || undefined,
678
+ onClick: () => {
679
+ submit();
680
+ },
681
+ children: /* @__PURE__ */ jsx3(ComposerIcon, {
682
+ action: "send"
683
+ })
684
+ }) : null
685
+ ]
686
+ });
687
+ function renderToolbar(menuContent) {
688
+ return compact ? /* @__PURE__ */ jsxs3("div", {
689
+ className: "chat-composer-toolbar chat-composer-toolbar-compact",
639
690
  children: [
640
- onAttachmentsChange ? /* @__PURE__ */ jsxs3(Fragment2, {
691
+ onAttachmentsChange || addMenu || menuContent ? /* @__PURE__ */ jsxs3(Fragment3, {
641
692
  children: [
642
- /* @__PURE__ */ jsx3("input", {
643
- ref: pickerRef,
644
- type: "file",
645
- accept,
646
- multiple,
647
- disabled,
648
- hidden: true,
649
- "aria-label": attachLabel,
650
- onChange: (event) => {
651
- const files = Array.from(event.currentTarget.files ?? []);
652
- event.currentTarget.value = "";
653
- if (files.length > 0)
654
- addAttachments(files, "picker");
655
- }
656
- }),
657
693
  /* @__PURE__ */ jsx3(Button, {
658
694
  type: "button",
659
695
  color: "base",
660
696
  appearance: "ghost",
697
+ size: "sm",
698
+ shape: "circle",
699
+ "aria-label": attachLabel,
700
+ title: attachLabel,
661
701
  disabled,
662
- onClick: openAttachments,
663
- children: attachLabel
702
+ popoverTarget: addId,
703
+ "aria-controls": addId,
704
+ "aria-expanded": addOpen,
705
+ style: { anchorName: addAnchor },
706
+ children: /* @__PURE__ */ jsx3(ComposerIcon, {
707
+ action: "attach"
708
+ })
709
+ }),
710
+ /* @__PURE__ */ jsxs3("div", {
711
+ id: addId,
712
+ popover: "auto",
713
+ role: "group",
714
+ "aria-label": "Add files and more",
715
+ className: "popover popover-menu chat-composer-menu",
716
+ style: { positionAnchor: addAnchor },
717
+ onToggle: (event) => setAddOpen(event.currentTarget.matches(":popover-open")),
718
+ children: [
719
+ /* @__PURE__ */ jsx3("div", {
720
+ className: "chat-composer-group",
721
+ children: "Add"
722
+ }),
723
+ onAttachmentsChange ? /* @__PURE__ */ jsxs3(Fragment3, {
724
+ children: [
725
+ /* @__PURE__ */ jsx3("input", {
726
+ ref: pickerRef,
727
+ type: "file",
728
+ accept,
729
+ multiple,
730
+ disabled,
731
+ hidden: true,
732
+ "aria-label": attachLabel,
733
+ onChange: (event) => {
734
+ const files = Array.from(event.currentTarget.files ?? []);
735
+ event.currentTarget.value = "";
736
+ if (files.length)
737
+ addAttachments(files, "picker");
738
+ }
739
+ }),
740
+ /* @__PURE__ */ jsxs3("button", {
741
+ type: "button",
742
+ className: "popover-menu-item",
743
+ disabled,
744
+ onClick: (event) => {
745
+ event.currentTarget.closest("[popover]")?.hidePopover?.();
746
+ openAttachments();
747
+ },
748
+ children: [
749
+ /* @__PURE__ */ jsx3(ComposerIcon, {
750
+ action: "attach"
751
+ }),
752
+ /* @__PURE__ */ jsx3("span", {
753
+ children: "Files"
754
+ })
755
+ ]
756
+ })
757
+ ]
758
+ }) : null,
759
+ menuContent,
760
+ addMenu
761
+ ]
664
762
  })
665
763
  ]
666
764
  }) : null,
667
- /* @__PURE__ */ jsx3(ExtraActions, {
668
- context: {
669
- submit: () => {
670
- submit();
671
- },
672
- submitting,
673
- canSubmit: eligible,
674
- disabled,
675
- generating,
676
- openAttachments
677
- },
678
- children
679
- }),
680
- generating && onStop ? /* @__PURE__ */ jsx3(Button, {
681
- type: "button",
682
- disabled,
683
- onClick: onStop,
684
- children: stopLabel
685
- }) : null,
686
- /* @__PURE__ */ jsx3(Button, {
687
- type: "button",
688
- color: "primary",
689
- disabled: !eligible,
690
- "aria-busy": busy || submitting || undefined,
691
- onClick: () => {
692
- submit();
693
- },
694
- children: sendLabel
765
+ /* @__PURE__ */ jsx3("div", {
766
+ className: "chat-composer-actions",
767
+ children: actionContent
695
768
  })
696
769
  ]
697
- })
698
- ]
699
- }));
770
+ }) : /* @__PURE__ */ jsxs3("div", {
771
+ className: "chat-composer-actions",
772
+ children: [
773
+ attachmentAction,
774
+ actionContent
775
+ ]
776
+ });
777
+ }
778
+ return /* @__PURE__ */ jsxs3("div", {
779
+ ...props,
780
+ ref,
781
+ className: cn("chat-composer", className),
782
+ style: compact ? {
783
+ ...props.style,
784
+ anchorName: props.style?.anchorName && props.style.anchorName !== "none" ? `${props.style.anchorName}, ${completionAnchor}` : completionAnchor
785
+ } : props.style,
786
+ onPaste: (event) => {
787
+ props.onPaste?.(event);
788
+ if (!intakeEvents || event.defaultPrevented || disabled || !onAttachmentsChange)
789
+ return;
790
+ const files = Array.from(event.clipboardData.files ?? []);
791
+ if (files.length)
792
+ addAttachments(files, "paste");
793
+ },
794
+ onDragOver: (event) => {
795
+ props.onDragOver?.(event);
796
+ if (intakeEvents && !event.defaultPrevented && !disabled && onAttachmentsChange && Array.from(event.dataTransfer.types).includes("Files"))
797
+ event.preventDefault();
798
+ },
799
+ onDrop: (event) => {
800
+ props.onDrop?.(event);
801
+ if (!intakeEvents || event.defaultPrevented || disabled || !onAttachmentsChange)
802
+ return;
803
+ const files = Array.from(event.dataTransfer.files ?? []);
804
+ if (files.length) {
805
+ event.preventDefault();
806
+ addAttachments(files, "drop");
807
+ }
808
+ },
809
+ children: [
810
+ entries.length > 0 ? /* @__PURE__ */ jsx3("ul", {
811
+ role: "list",
812
+ className: cn("chat-composer-attachments", thumbnails && "chat-composer-thumbnails"),
813
+ "aria-label": "Attachments",
814
+ children: entries.map(({
815
+ file,
816
+ id,
817
+ name: entryName,
818
+ previewUrl,
819
+ state,
820
+ status,
821
+ progress,
822
+ retry,
823
+ cancel
824
+ }) => {
825
+ const name = file?.name ?? entryName ?? "Attachment";
826
+ return /* @__PURE__ */ jsx3("li", {
827
+ className: cn("chat-composer-attachment", thumbnails && "chat-composer-attachment-tile"),
828
+ "data-state": state,
829
+ children: renderAttachment && file ? /* @__PURE__ */ jsx3(AttachmentContent, {
830
+ file,
831
+ renderAttachment,
832
+ context: {
833
+ remove: () => removeAttachment(id),
834
+ disabled: disabled || !onAttachmentsChange
835
+ }
836
+ }) : /* @__PURE__ */ jsxs3(Fragment3, {
837
+ children: [
838
+ previewUrl ? /* @__PURE__ */ jsx3("img", {
839
+ className: "chat-composer-preview",
840
+ src: previewUrl,
841
+ alt: name
842
+ }) : file ? /* @__PURE__ */ jsx3(AttachmentPreview, {
843
+ file
844
+ }) : null,
845
+ !thumbnails ? /* @__PURE__ */ jsxs3("div", {
846
+ className: "chat-composer-attachment-info",
847
+ children: [
848
+ /* @__PURE__ */ jsx3("span", {
849
+ className: "chat-composer-filename",
850
+ title: name,
851
+ children: name
852
+ }),
853
+ status ? /* @__PURE__ */ jsx3("span", {
854
+ className: "chat-composer-description",
855
+ children: status
856
+ }) : null,
857
+ progress !== undefined ? /* @__PURE__ */ jsx3("progress", {
858
+ className: "progress",
859
+ value: progress,
860
+ max: 1,
861
+ "aria-label": `Preparing ${name}`
862
+ }) : null
863
+ ]
864
+ }) : null,
865
+ retry ? /* @__PURE__ */ jsx3(Button, {
866
+ type: "button",
867
+ size: "sm",
868
+ shape: "circle",
869
+ disabled,
870
+ onClick: retry,
871
+ "aria-label": `Retry ${name}`,
872
+ title: `Retry ${name}`,
873
+ children: /* @__PURE__ */ jsx3(ComposerIcon, {
874
+ action: "retry"
875
+ })
876
+ }) : null,
877
+ cancel ? /* @__PURE__ */ jsx3(Button, {
878
+ type: "button",
879
+ size: "sm",
880
+ shape: "circle",
881
+ disabled,
882
+ onClick: cancel,
883
+ "aria-label": `Cancel ${name}`,
884
+ title: `Cancel ${name}`,
885
+ children: /* @__PURE__ */ jsx3(ComposerIcon, {
886
+ action: "remove"
887
+ })
888
+ }) : null,
889
+ onAttachmentsChange ? /* @__PURE__ */ jsx3(Button, {
890
+ type: "button",
891
+ size: thumbnails ? "xs" : "sm",
892
+ shape: "circle",
893
+ className: thumbnails ? "chat-composer-attachment-remove" : undefined,
894
+ color: "base",
895
+ appearance: "ghost",
896
+ disabled,
897
+ "aria-label": `Remove ${name}`,
898
+ title: `Remove ${name}`,
899
+ onClick: () => removeAttachment(id),
900
+ children: /* @__PURE__ */ jsx3(ComposerIcon, {
901
+ action: "remove"
902
+ })
903
+ }) : null
904
+ ]
905
+ })
906
+ }, id);
907
+ })
908
+ }) : null,
909
+ editor,
910
+ showCompletion || completionHeader || completionStatus ? /* @__PURE__ */ jsx3(CompletionList, {
911
+ composerId,
912
+ label: completion?.label ?? "Suggestions",
913
+ candidates: showCompletion ? candidates : [],
914
+ activeId: active?.id,
915
+ onSelect: selectCompletion,
916
+ compact,
917
+ anchorName: completionAnchor,
918
+ header: completionHeader,
919
+ status: completionStatus,
920
+ onDismiss: dismissCompletion
921
+ }) : null,
922
+ statusContent,
923
+ hasError ? /* @__PURE__ */ jsx3("div", {
924
+ id: `${composerId}-error`,
925
+ role: "alert",
926
+ className: "chat-composer-error chat-composer-status",
927
+ "data-state": "error",
928
+ children: visibleError
929
+ }) : null,
930
+ renderFooter ? renderFooter(renderToolbar) : renderToolbar()
931
+ ]
932
+ });
933
+ });
700
934
  ComposerShell.displayName = "ComposerShell";
701
935
 
702
936
  // src/components/chat/composer/PlainEditor.tsx
703
- import {
704
- forwardRef as forwardRef3,
705
- useImperativeHandle as useImperativeHandle2,
706
- useLayoutEffect,
707
- useRef as useRef3
708
- } from "react";
709
-
710
- // src/components/input/Input.tsx
711
937
  import {
712
938
  forwardRef as forwardRef2,
713
939
  useImperativeHandle,
714
- useRef as useRef2,
715
- useState
940
+ useLayoutEffect as useLayoutEffect2,
941
+ useRef as useRef3
716
942
  } from "react";
717
943
 
718
944
  // src/classes/input.ts
@@ -800,234 +1026,9 @@ function getTextAreaCountClasses({ exceeded }) {
800
1026
  return cn(textAreaCountClass, exceeded && textAreaCountExceededClass);
801
1027
  }
802
1028
 
803
- // src/components/input/Input.tsx
804
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
805
- function toTextValue(value) {
806
- if (Array.isArray(value)) {
807
- return value.join(",");
808
- }
809
- return value == null ? "" : String(value);
810
- }
811
- var InputRoot = forwardRef2(({
812
- allowClear,
813
- className,
814
- defaultValue,
815
- disabled,
816
- onChange,
817
- prefix,
818
- size = "md",
819
- status,
820
- suffix,
821
- type = "text",
822
- value,
823
- variant = "outlined",
824
- ...props
825
- }, ref) => {
826
- const inputRef = useRef2(null);
827
- const [internalValue, setInternalValue] = useState(() => toTextValue(defaultValue));
828
- const isControlled = value !== undefined;
829
- const currentValue = isControlled ? toTextValue(value) : internalValue;
830
- const hasAffix = prefix != null || suffix != null || allowClear;
831
- useImperativeHandle(ref, () => inputRef.current);
832
- function handleChange(event) {
833
- if (!isControlled) {
834
- setInternalValue(event.currentTarget.value);
835
- }
836
- onChange?.(event);
837
- }
838
- function handleClear() {
839
- const input = inputRef.current;
840
- if (!input || disabled) {
841
- return;
842
- }
843
- input.value = "";
844
- if (!isControlled) {
845
- setInternalValue("");
846
- }
847
- onChange?.({
848
- currentTarget: input,
849
- target: input,
850
- type: "change"
851
- });
852
- input.focus();
853
- }
854
- const control = /* @__PURE__ */ jsx4("input", {
855
- ...props,
856
- ref: inputRef,
857
- type,
858
- className: getInputClasses({ size, status, variant, className }),
859
- disabled,
860
- value: currentValue,
861
- onChange: handleChange
862
- });
863
- if (!hasAffix) {
864
- return control;
865
- }
866
- const showClear = allowClear && !disabled && currentValue.length > 0;
867
- return /* @__PURE__ */ jsxs4("span", {
868
- className: getInputWrapperClasses({ affixed: hasAffix }),
869
- children: [
870
- prefix != null ? /* @__PURE__ */ jsx4("span", {
871
- className: inputPrefixClass,
872
- children: prefix
873
- }) : null,
874
- control,
875
- showClear ? /* @__PURE__ */ jsx4("button", {
876
- type: "button",
877
- className: inputClearClass,
878
- "aria-label": "Clear input",
879
- onClick: handleClear,
880
- children: "x"
881
- }) : null,
882
- suffix != null ? /* @__PURE__ */ jsx4("span", {
883
- className: inputSuffixClass,
884
- children: suffix
885
- }) : null
886
- ]
887
- });
888
- });
889
- InputRoot.displayName = "Input";
890
- var Search = forwardRef2(({
891
- className,
892
- disabled,
893
- enterButton,
894
- loading,
895
- onKeyDown,
896
- onSearch,
897
- ...props
898
- }, ref) => {
899
- const inputRef = useRef2(null);
900
- useImperativeHandle(ref, () => inputRef.current);
901
- function emitSearch(event) {
902
- onSearch?.(inputRef.current?.value ?? "", event);
903
- }
904
- function handleKeyDown(event) {
905
- onKeyDown?.(event);
906
- if (!event.defaultPrevented && event.key === "Enter") {
907
- emitSearch(event);
908
- }
909
- }
910
- const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
911
- return /* @__PURE__ */ jsxs4("span", {
912
- className: getSearchWrapperClasses({ className }),
913
- children: [
914
- /* @__PURE__ */ jsx4(InputRoot, {
915
- ...props,
916
- ref: inputRef,
917
- disabled,
918
- onKeyDown: handleKeyDown
919
- }),
920
- enterButton || loading ? /* @__PURE__ */ jsx4("button", {
921
- type: "button",
922
- className: inputSearchButtonClass,
923
- disabled: disabled || loading,
924
- "aria-busy": loading || undefined,
925
- onClick: emitSearch,
926
- children: loading ? "Loading" : buttonContent
927
- }) : null
928
- ]
929
- });
930
- });
931
- Search.displayName = "Input.Search";
932
- var Password = forwardRef2(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
933
- const [visible, setVisible] = useState(false);
934
- const type = visible ? "text" : "password";
935
- const toggle = visibilityToggle ? /* @__PURE__ */ jsx4("button", {
936
- type: "button",
937
- className: inputPasswordToggleClass,
938
- disabled,
939
- "aria-label": visible ? "Hide password" : "Show password",
940
- onClick: () => {
941
- setVisible((current) => !current);
942
- },
943
- children: visible ? "Hide" : "Show"
944
- }) : undefined;
945
- return /* @__PURE__ */ jsx4("span", {
946
- className: getPasswordWrapperClasses({ className }),
947
- children: /* @__PURE__ */ jsx4(InputRoot, {
948
- ...props,
949
- ref,
950
- disabled,
951
- type,
952
- suffix: toggle
953
- })
954
- });
955
- });
956
- Password.displayName = "Input.Password";
957
- var TextArea = forwardRef2(({
958
- autoSize,
959
- className,
960
- defaultValue,
961
- maxLength,
962
- onChange,
963
- resize = "vertical",
964
- showCount,
965
- size = "md",
966
- status,
967
- value,
968
- variant = "outlined",
969
- ...props
970
- }, ref) => {
971
- const [internalValue, setInternalValue] = useState(() => toTextValue(defaultValue));
972
- const isControlled = value !== undefined;
973
- const currentValue = isControlled ? toTextValue(value) : internalValue;
974
- const count = currentValue.length;
975
- const exceeded = maxLength !== undefined && count > maxLength;
976
- function handleChange(event) {
977
- if (!isControlled) {
978
- setInternalValue(event.currentTarget.value);
979
- }
980
- onChange?.(event);
981
- }
982
- const control = /* @__PURE__ */ jsx4("textarea", {
983
- ...props,
984
- ref,
985
- className: getTextAreaClasses({
986
- size,
987
- status,
988
- variant,
989
- resize,
990
- autoSize: Boolean(autoSize),
991
- className
992
- }),
993
- maxLength,
994
- value: currentValue,
995
- onChange: handleChange
996
- });
997
- if (!showCount) {
998
- return control;
999
- }
1000
- return /* @__PURE__ */ jsxs4("span", {
1001
- className: textAreaWrapperClass,
1002
- children: [
1003
- control,
1004
- /* @__PURE__ */ jsxs4("span", {
1005
- className: getTextAreaCountClasses({ exceeded }),
1006
- children: [
1007
- count,
1008
- maxLength !== undefined ? ` / ${maxLength}` : null
1009
- ]
1010
- })
1011
- ]
1012
- });
1013
- });
1014
- TextArea.displayName = "Input.TextArea";
1015
- var Group = forwardRef2(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
1016
- ...props,
1017
- ref,
1018
- className: cn(inputGroupClass, className),
1019
- children
1020
- }));
1021
- Group.displayName = "Input.Group";
1022
- var Input = Object.assign(InputRoot, {
1023
- Search,
1024
- Password,
1025
- TextArea,
1026
- Group
1027
- });
1028
1029
  // src/components/chat/composer/PlainEditor.tsx
1029
- import { jsx as jsx5 } from "react/jsx-runtime";
1030
- var PlainEditor = forwardRef3(({
1030
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1031
+ var PlainEditor = forwardRef2(({
1031
1032
  value,
1032
1033
  disabled,
1033
1034
  minRows,
@@ -1047,7 +1048,12 @@ var PlainEditor = forwardRef3(({
1047
1048
  const composingRef = useRef3(false);
1048
1049
  const minimumRows = Math.max(1, Math.floor(minRows));
1049
1050
  const maximumRows = Math.max(minimumRows, Math.floor(maxRows));
1050
- useImperativeHandle2(ref, () => ({
1051
+ const { showCount, ...nativeProps } = textareaProps ?? {};
1052
+ delete nativeProps.size;
1053
+ delete nativeProps.status;
1054
+ delete nativeProps.variant;
1055
+ delete nativeProps.resize;
1056
+ useImperativeHandle(ref, () => ({
1051
1057
  focus: () => editorRef.current?.focus(),
1052
1058
  select: (start, end) => editorRef.current?.setSelectionRange(start, end),
1053
1059
  selection: (currentValue) => ({
@@ -1056,10 +1062,10 @@ var PlainEditor = forwardRef3(({
1056
1062
  selectionEnd: editorRef.current?.selectionEnd ?? currentValue.length
1057
1063
  })
1058
1064
  }), []);
1059
- useLayoutEffect(() => {
1065
+ useLayoutEffect2(() => {
1060
1066
  composingRef.current = false;
1061
1067
  }, [generation]);
1062
- useLayoutEffect(() => {
1068
+ useLayoutEffect2(() => {
1063
1069
  const editor = editorRef.current;
1064
1070
  if (!editor)
1065
1071
  return;
@@ -1087,17 +1093,16 @@ var PlainEditor = forwardRef3(({
1087
1093
  window.removeEventListener("resize", measure);
1088
1094
  };
1089
1095
  }, [value, minimumRows, maximumRows, textareaProps?.style]);
1090
- return /* @__PURE__ */ jsx5(Input.TextArea, {
1091
- ...textareaProps,
1096
+ const control = /* @__PURE__ */ jsx4("textarea", {
1097
+ ...nativeProps,
1092
1098
  ref: editorRef,
1093
1099
  className: cn("chat-composer-editor", textareaProps?.className),
1094
1100
  value,
1095
1101
  disabled,
1096
1102
  rows: minimumRows,
1097
- resize: "none",
1098
1103
  "aria-label": textareaProps?.["aria-label"] ?? (textareaProps?.["aria-labelledby"] ? undefined : "Message"),
1099
1104
  "aria-describedby": cn(textareaProps?.["aria-describedby"], hasError && `${composerId}-error`) || undefined,
1100
- "aria-invalid": hasError ? true : textareaProps?.["aria-invalid"],
1105
+ "aria-invalid": hasError || textareaProps?.status === "error" ? true : textareaProps?.["aria-invalid"],
1101
1106
  "aria-controls": showCompletion ? `${composerId}-completions` : undefined,
1102
1107
  "aria-autocomplete": hasCompletion ? "list" : undefined,
1103
1108
  "aria-haspopup": hasCompletion ? "listbox" : undefined,
@@ -1118,6 +1123,21 @@ var PlainEditor = forwardRef3(({
1118
1123
  onKeyDown(event);
1119
1124
  }
1120
1125
  });
1126
+ return showCount ? /* @__PURE__ */ jsxs4("span", {
1127
+ className: textAreaWrapperClass,
1128
+ children: [
1129
+ control,
1130
+ /* @__PURE__ */ jsxs4("span", {
1131
+ className: getTextAreaCountClasses({
1132
+ exceeded: textareaProps?.maxLength !== undefined && value.length > textareaProps.maxLength
1133
+ }),
1134
+ children: [
1135
+ value.length,
1136
+ textareaProps?.maxLength !== undefined ? ` / ${textareaProps.maxLength}` : null
1137
+ ]
1138
+ })
1139
+ ]
1140
+ }) : control;
1121
1141
  });
1122
1142
  PlainEditor.displayName = "PlainEditor";
1123
1143
 
@@ -1757,8 +1777,8 @@ function createComposerAttachmentController(options) {
1757
1777
  }
1758
1778
 
1759
1779
  // src/components/chat/ChatComposer.tsx
1760
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1761
- var ChatComposer = forwardRef4(({
1780
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1781
+ var ChatComposer = forwardRef3(({
1762
1782
  value,
1763
1783
  onValueChange,
1764
1784
  onSubmit,
@@ -1770,6 +1790,8 @@ var ChatComposer = forwardRef4(({
1770
1790
  onAttachmentRejected,
1771
1791
  multiple = true,
1772
1792
  allowAttachmentOnly = false,
1793
+ compact = false,
1794
+ addMenu,
1773
1795
  disabled = false,
1774
1796
  busy = false,
1775
1797
  generating = false,
@@ -1820,13 +1842,13 @@ var ChatComposer = forwardRef4(({
1820
1842
  const scopeChanged = scopeRef.current.contextKey !== scope?.contextKey || scopeRef.current.conversationId !== scope?.conversationId;
1821
1843
  const generation = generationRef.current + (scopeChanged ? 1 : 0);
1822
1844
  const occurrences = reconcileAttachments(scopeChanged ? [] : entriesRef.current, attachments, nextEntryRef.current);
1823
- useLayoutEffect2(() => {
1845
+ useLayoutEffect3(() => {
1824
1846
  mountedRef.current = true;
1825
1847
  return () => {
1826
1848
  mountedRef.current = false;
1827
1849
  };
1828
1850
  }, []);
1829
- useLayoutEffect2(() => {
1851
+ useLayoutEffect3(() => {
1830
1852
  if (scopeChanged) {
1831
1853
  scopeRef.current = {
1832
1854
  contextKey: scope?.contextKey,
@@ -1842,7 +1864,7 @@ var ChatComposer = forwardRef4(({
1842
1864
  revisionRef.current++;
1843
1865
  }
1844
1866
  }, [scopeChanged, scope?.contextKey, scope?.conversationId, generation]);
1845
- useLayoutEffect2(() => {
1867
+ useLayoutEffect3(() => {
1846
1868
  if (observedValueRef.current !== value) {
1847
1869
  revisionRef.current++;
1848
1870
  observedValueRef.current = value;
@@ -1870,7 +1892,7 @@ var ChatComposer = forwardRef4(({
1870
1892
  const candidates = completion?.items ?? [];
1871
1893
  const { enabled, active } = legacyCompletion(candidates, activeId);
1872
1894
  const showCompletion = !disabled && !dismissed && candidates.length > 0;
1873
- const visibleError = error ?? submitError ?? (attachmentRejections.length ? /* @__PURE__ */ jsx6("ul", {
1895
+ const visibleError = error ?? submitError ?? (attachmentRejections.length ? /* @__PURE__ */ jsx5("ul", {
1874
1896
  children: attachmentRejections.map((item, index) => /* @__PURE__ */ jsxs5("li", {
1875
1897
  children: [
1876
1898
  item.metadata.name,
@@ -1961,11 +1983,13 @@ var ChatComposer = forwardRef4(({
1961
1983
  }
1962
1984
  }
1963
1985
  }
1964
- return /* @__PURE__ */ jsx6(ComposerShell, {
1986
+ return /* @__PURE__ */ jsx5(ComposerShell, {
1965
1987
  ...props,
1966
1988
  ref,
1967
1989
  className,
1968
1990
  composerId: id,
1991
+ compact,
1992
+ addMenu,
1969
1993
  entries: occurrences.entries,
1970
1994
  renderAttachment,
1971
1995
  removeAttachment: (entryId) => {
@@ -1987,6 +2011,7 @@ var ChatComposer = forwardRef4(({
1987
2011
  active,
1988
2012
  showCompletion,
1989
2013
  selectCompletion,
2014
+ dismissCompletion: () => setDismissed(true),
1990
2015
  visibleError,
1991
2016
  hasError,
1992
2017
  attachLabel,
@@ -1995,7 +2020,7 @@ var ChatComposer = forwardRef4(({
1995
2020
  openAttachments,
1996
2021
  submit,
1997
2022
  onStop,
1998
- editor: /* @__PURE__ */ jsx6(PlainEditor, {
2023
+ editor: /* @__PURE__ */ jsx5(PlainEditor, {
1999
2024
  ref: editorRef,
2000
2025
  value,
2001
2026
  disabled,
@@ -2047,7 +2072,7 @@ var ChatComposer = forwardRef4(({
2047
2072
  ChatComposer.displayName = "Chat.Composer";
2048
2073
 
2049
2074
  // src/components/chat/ChatPrimitives.tsx
2050
- import { forwardRef as forwardRef5, useId as useId2 } from "react";
2075
+ import { forwardRef as forwardRef4, useId as useId2 } from "react";
2051
2076
 
2052
2077
  // src/classes/chat.ts
2053
2078
  var chatBaseClass = "chat";
@@ -2124,69 +2149,69 @@ function getChatToolClasses({
2124
2149
  }
2125
2150
 
2126
2151
  // src/components/chat/ChatPrimitives.tsx
2127
- import { jsx as jsx7, jsxs as jsxs6, Fragment as Fragment3 } from "react/jsx-runtime";
2128
- var ChatAgent = forwardRef5(({ timeline, className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2152
+ import { jsx as jsx6, jsxs as jsxs6, Fragment as Fragment4 } from "react/jsx-runtime";
2153
+ var ChatAgent = forwardRef4(({ timeline, className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
2129
2154
  ...props,
2130
2155
  ref,
2131
2156
  "data-chat-tl": timeline ?? props["data-chat-tl"],
2132
2157
  className: getChatClasses({ className: cn("chat-agent", className) })
2133
2158
  }));
2134
2159
  ChatAgent.displayName = "Chat.Agent";
2135
- var ChatContent = forwardRef5(({ streaming, className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2160
+ var ChatContent = forwardRef4(({ streaming, className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
2136
2161
  ...props,
2137
2162
  ref,
2138
2163
  className: cn("chat-content", streaming && "chat-streaming", className)
2139
2164
  }));
2140
2165
  ChatContent.displayName = "Chat.Content";
2141
- var ChatWork = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("details", {
2166
+ var ChatWork = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("details", {
2142
2167
  ...props,
2143
2168
  ref,
2144
2169
  className: cn("chat-work", className)
2145
2170
  }));
2146
2171
  ChatWork.displayName = "Chat.Work";
2147
- var ChatWorkSummary = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("summary", {
2172
+ var ChatWorkSummary = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("summary", {
2148
2173
  ...props,
2149
2174
  ref,
2150
2175
  className: cn("chat-work-summary", className)
2151
2176
  }));
2152
2177
  ChatWorkSummary.displayName = "Chat.WorkSummary";
2153
- var ChatWorkBody = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2178
+ var ChatWorkBody = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
2154
2179
  ...props,
2155
2180
  ref,
2156
2181
  className: cn("chat-work-body", className)
2157
2182
  }));
2158
2183
  ChatWorkBody.displayName = "Chat.WorkBody";
2159
- var ChatInputArea = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2184
+ var ChatInputArea = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
2160
2185
  ...props,
2161
2186
  ref,
2162
2187
  className: cn("chat-input-area", className)
2163
2188
  }));
2164
2189
  ChatInputArea.displayName = "Chat.InputArea";
2165
- var ChatComposerForm = forwardRef5(({ color, ghost, className, ...props }, ref) => /* @__PURE__ */ jsx7("form", {
2190
+ var ChatComposerForm = forwardRef4(({ color, ghost, className, ...props }, ref) => /* @__PURE__ */ jsx6("form", {
2166
2191
  ...props,
2167
2192
  ref,
2168
2193
  className: cn("chat-composer", color && `chat-composer-${color}`, ghost && "chat-composer-ghost", className)
2169
2194
  }));
2170
2195
  ChatComposerForm.displayName = "Chat.ComposerForm";
2171
- var ChatComposerInput = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("textarea", {
2196
+ var ChatComposerInput = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("textarea", {
2172
2197
  ...props,
2173
2198
  ref,
2174
2199
  className: cn("chat-composer-input", className)
2175
2200
  }));
2176
2201
  ChatComposerInput.displayName = "Chat.ComposerInput";
2177
- var ChatComposerActions = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2202
+ var ChatComposerActions = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
2178
2203
  ...props,
2179
2204
  ref,
2180
2205
  className: cn("chat-composer-actions", className)
2181
2206
  }));
2182
2207
  ChatComposerActions.displayName = "Chat.ComposerActions";
2183
- var ChatComposerHint = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("kbd", {
2208
+ var ChatComposerHint = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("kbd", {
2184
2209
  ...props,
2185
2210
  ref,
2186
2211
  className: cn("chat-composer-hint", className)
2187
2212
  }));
2188
2213
  ChatComposerHint.displayName = "Chat.ComposerHint";
2189
- var ChatQueue = forwardRef5(({
2214
+ var ChatQueue = forwardRef4(({
2190
2215
  items,
2191
2216
  activeId = items[0]?.id,
2192
2217
  pendingIds = [],
@@ -2211,7 +2236,7 @@ var ChatQueue = forwardRef5(({
2211
2236
  /* @__PURE__ */ jsxs6("div", {
2212
2237
  className: "chat-queue-header sr-only",
2213
2238
  children: [
2214
- /* @__PURE__ */ jsx7("h3", {
2239
+ /* @__PURE__ */ jsx6("h3", {
2215
2240
  className: "chat-queue-title",
2216
2241
  id: titleId,
2217
2242
  children: label
@@ -2225,7 +2250,7 @@ var ChatQueue = forwardRef5(({
2225
2250
  })
2226
2251
  ]
2227
2252
  }),
2228
- /* @__PURE__ */ jsx7("ol", {
2253
+ /* @__PURE__ */ jsx6("ol", {
2229
2254
  className: "chat-queue-list",
2230
2255
  role: "list",
2231
2256
  tabIndex: 0,
@@ -2236,14 +2261,14 @@ var ChatQueue = forwardRef5(({
2236
2261
  className: cn("chat-queue-item", item.id === activeId && "chat-queue-item-active"),
2237
2262
  "aria-busy": pending || undefined,
2238
2263
  children: [
2239
- /* @__PURE__ */ jsx7("svg", {
2264
+ /* @__PURE__ */ jsx6("svg", {
2240
2265
  className: "chat-queue-icon",
2241
2266
  viewBox: "0 0 24 24",
2242
2267
  fill: "none",
2243
2268
  stroke: "currentColor",
2244
2269
  "aria-hidden": "true",
2245
2270
  focusable: "false",
2246
- children: /* @__PURE__ */ jsx7("path", {
2271
+ children: /* @__PURE__ */ jsx6("path", {
2247
2272
  d: "m8 6 4 4-4 4M12 10H5m10-4h4m-4 6h4m-4 6h4"
2248
2273
  })
2249
2274
  }),
@@ -2254,57 +2279,58 @@ var ChatQueue = forwardRef5(({
2254
2279
  index + 1
2255
2280
  ]
2256
2281
  }),
2257
- item.attachment ? /* @__PURE__ */ jsx7("img", {
2282
+ item.attachment ? /* @__PURE__ */ jsx6("img", {
2258
2283
  className: "chat-queue-attachment",
2259
2284
  src: item.attachment.src,
2260
2285
  alt: item.attachment.alt
2261
2286
  }) : null,
2262
- /* @__PURE__ */ jsx7("div", {
2287
+ /* @__PURE__ */ jsx6("div", {
2263
2288
  className: "chat-queue-content",
2264
2289
  title: item.text,
2265
2290
  children: renderItemContent ? renderItemContent(item, index) : item.text
2266
2291
  }),
2267
- /* @__PURE__ */ jsx7("div", {
2292
+ /* @__PURE__ */ jsx6("div", {
2268
2293
  className: "chat-actions chat-queue-actions",
2269
- children: renderItemActions ? renderItemActions(item, index, pending) : /* @__PURE__ */ jsxs6(Fragment3, {
2294
+ children: renderItemActions ? renderItemActions(item, index, pending) : /* @__PURE__ */ jsxs6(Fragment4, {
2270
2295
  children: [
2271
- /* @__PURE__ */ jsxs6("button", {
2272
- className: "btn btn-ghost btn-sm chat-queue-steer",
2296
+ /* @__PURE__ */ jsx6("button", {
2297
+ className: "btn btn-ghost btn-sm btn-circle btn-icon btn-icon-sm chat-queue-steer",
2273
2298
  type: "button",
2274
2299
  disabled: pending || steerDisabled,
2275
2300
  "aria-label": `Steer waiting message ${index + 1}`,
2301
+ title: `Steer waiting message ${index + 1}`,
2276
2302
  onClick: () => onSteer(item.id),
2277
- children: [
2278
- /* @__PURE__ */ jsx7("svg", {
2279
- width: "16",
2280
- height: "16",
2281
- viewBox: "0 0 24 24",
2282
- fill: "none",
2283
- stroke: "currentColor",
2284
- "aria-hidden": "true",
2285
- focusable: "false",
2286
- children: /* @__PURE__ */ jsx7("path", {
2287
- d: "m15 4 5 5-5 5M20 9h-9a6 6 0 0 0-6 6v4"
2288
- })
2289
- }),
2290
- "Steer"
2291
- ]
2303
+ children: /* @__PURE__ */ jsx6("svg", {
2304
+ width: "16",
2305
+ height: "16",
2306
+ style: { flexShrink: 0 },
2307
+ viewBox: "0 0 24 24",
2308
+ fill: "none",
2309
+ stroke: "currentColor",
2310
+ "aria-hidden": "true",
2311
+ focusable: "false",
2312
+ children: /* @__PURE__ */ jsx6("path", {
2313
+ d: "m15 4 5 5-5 5M20 9h-9a6 6 0 0 0-6 6v4"
2314
+ })
2315
+ })
2292
2316
  }),
2293
- /* @__PURE__ */ jsx7("button", {
2294
- className: "btn btn-ghost btn-sm btn-square chat-queue-remove",
2317
+ /* @__PURE__ */ jsx6("button", {
2318
+ className: "btn btn-ghost btn-sm btn-circle btn-icon btn-icon-sm chat-queue-remove",
2295
2319
  type: "button",
2296
2320
  disabled: pending,
2297
2321
  "aria-label": `Remove waiting message ${index + 1}`,
2322
+ title: `Remove waiting message ${index + 1}`,
2298
2323
  onClick: () => onRemove(item.id),
2299
- children: /* @__PURE__ */ jsx7("svg", {
2324
+ children: /* @__PURE__ */ jsx6("svg", {
2300
2325
  width: "16",
2301
2326
  height: "16",
2327
+ style: { flexShrink: 0 },
2302
2328
  viewBox: "0 0 24 24",
2303
2329
  fill: "none",
2304
2330
  stroke: "currentColor",
2305
2331
  "aria-hidden": "true",
2306
2332
  focusable: "false",
2307
- children: /* @__PURE__ */ jsx7("path", {
2333
+ children: /* @__PURE__ */ jsx6("path", {
2308
2334
  d: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7m4-7v7"
2309
2335
  })
2310
2336
  })
@@ -2322,20 +2348,20 @@ var ChatQueue = forwardRef5(({
2322
2348
  ChatQueue.displayName = "Chat.Queue";
2323
2349
 
2324
2350
  // src/components/chat/Chat.tsx
2325
- import { jsx as jsx8, jsxs as jsxs7, Fragment as Fragment4 } from "react/jsx-runtime";
2326
- var ChatAvatar = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2351
+ import { jsx as jsx7, jsxs as jsxs7, Fragment as Fragment5 } from "react/jsx-runtime";
2352
+ var ChatAvatar = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2327
2353
  ...props,
2328
2354
  ref,
2329
2355
  className: cn(chatAvatarClass, className)
2330
2356
  }));
2331
2357
  ChatAvatar.displayName = "Chat.Avatar";
2332
- var ChatHeader = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2358
+ var ChatHeader = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2333
2359
  ...props,
2334
2360
  ref,
2335
2361
  className: cn(chatHeaderClass, className)
2336
2362
  }));
2337
2363
  ChatHeader.displayName = "Chat.Header";
2338
- var ChatBubble = forwardRef6(({
2364
+ var ChatBubble = forwardRef5(({
2339
2365
  color,
2340
2366
  size = "md",
2341
2367
  filled,
@@ -2356,7 +2382,7 @@ var ChatBubble = forwardRef6(({
2356
2382
  const [internalExpanded, setInternalExpanded] = useState3(defaultExpanded);
2357
2383
  const requestedExpanded = expanded ?? internalExpanded;
2358
2384
  const isExpanded = overflows && requestedExpanded;
2359
- useLayoutEffect3(() => {
2385
+ useLayoutEffect4(() => {
2360
2386
  const content = contentRef.current;
2361
2387
  if (!collapsible || !content) {
2362
2388
  collapseRequestedRef.current = false;
@@ -2398,16 +2424,16 @@ var ChatBubble = forwardRef6(({
2398
2424
  mutation?.disconnect();
2399
2425
  };
2400
2426
  }, [collapsible, children, requestedExpanded, expanded, onExpandedChange]);
2401
- const body = /* @__PURE__ */ jsxs7(Fragment4, {
2427
+ const body = /* @__PURE__ */ jsxs7(Fragment5, {
2402
2428
  children: [
2403
2429
  children,
2404
- streaming ? /* @__PURE__ */ jsx8("span", {
2430
+ streaming ? /* @__PURE__ */ jsx7("span", {
2405
2431
  className: "chat-bubble-content chat-bubble-streaming",
2406
2432
  "aria-hidden": "true"
2407
2433
  }) : null
2408
2434
  ]
2409
2435
  });
2410
- return /* @__PURE__ */ jsx8("div", {
2436
+ return /* @__PURE__ */ jsx7("div", {
2411
2437
  ...props,
2412
2438
  ref,
2413
2439
  className: getChatBubbleClasses({
@@ -2417,16 +2443,16 @@ var ChatBubble = forwardRef6(({
2417
2443
  streaming,
2418
2444
  className: cn(collapsible && "chat-bubble-collapsible", className)
2419
2445
  }),
2420
- children: collapsible ? /* @__PURE__ */ jsxs7(Fragment4, {
2446
+ children: collapsible ? /* @__PURE__ */ jsxs7(Fragment5, {
2421
2447
  children: [
2422
- /* @__PURE__ */ jsx8("div", {
2448
+ /* @__PURE__ */ jsx7("div", {
2423
2449
  ref: contentRef,
2424
2450
  className: "chat-bubble-content",
2425
2451
  id: contentId,
2426
2452
  tabIndex: -1,
2427
2453
  children: body
2428
2454
  }),
2429
- /* @__PURE__ */ jsx8("button", {
2455
+ /* @__PURE__ */ jsx7("button", {
2430
2456
  ref: toggleRef,
2431
2457
  type: "button",
2432
2458
  className: "btn btn-ghost btn-xs chat-bubble-toggle",
@@ -2445,55 +2471,55 @@ var ChatBubble = forwardRef6(({
2445
2471
  });
2446
2472
  });
2447
2473
  ChatBubble.displayName = "Chat.Bubble";
2448
- var ChatFooter = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2474
+ var ChatFooter = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2449
2475
  ...props,
2450
2476
  ref,
2451
2477
  className: cn(chatFooterClass, className)
2452
2478
  }));
2453
2479
  ChatFooter.displayName = "Chat.Footer";
2454
- var ChatStatus = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2480
+ var ChatStatus = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2455
2481
  ...props,
2456
2482
  ref,
2457
2483
  className: cn(chatStatusClass, className)
2458
2484
  }));
2459
2485
  ChatStatus.displayName = "Chat.Status";
2460
- var ChatStatusItem = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("span", {
2486
+ var ChatStatusItem = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("span", {
2461
2487
  ...props,
2462
2488
  ref,
2463
2489
  className: cn(chatStatusItemClass, className)
2464
2490
  }));
2465
2491
  ChatStatusItem.displayName = "Chat.StatusItem";
2466
- var ChatStatusValue = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("span", {
2492
+ var ChatStatusValue = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("span", {
2467
2493
  ...props,
2468
2494
  ref,
2469
2495
  className: cn(chatStatusValueClass, className)
2470
2496
  }));
2471
2497
  ChatStatusValue.displayName = "Chat.StatusValue";
2472
- var ChatActions = forwardRef6(({ hover, className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2498
+ var ChatActions = forwardRef5(({ hover, className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2473
2499
  ...props,
2474
2500
  ref,
2475
2501
  className: cn(chatActionsClass, hover && chatActionsHoverClass, className)
2476
2502
  }));
2477
2503
  ChatActions.displayName = "Chat.Actions";
2478
- var ChatScroll = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2504
+ var ChatScroll = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2479
2505
  ...props,
2480
2506
  ref,
2481
2507
  className: cn(chatScrollClass, className)
2482
2508
  }));
2483
2509
  ChatScroll.displayName = "Chat.Scroll";
2484
- var ChatScrollBody = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2510
+ var ChatScrollBody = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2485
2511
  ...props,
2486
2512
  ref,
2487
2513
  className: cn(chatScrollBodyClass, className)
2488
2514
  }));
2489
2515
  ChatScrollBody.displayName = "Chat.ScrollBody";
2490
- var ChatScrollTrack = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2516
+ var ChatScrollTrack = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2491
2517
  ...props,
2492
2518
  ref,
2493
2519
  className: cn(chatScrollTrackClass, className)
2494
2520
  }));
2495
2521
  ChatScrollTrack.displayName = "Chat.ScrollTrack";
2496
- var ChatScrollIndicator = forwardRef6(({ targetId, timeline, type = "button", className, onClick, ...props }, ref) => /* @__PURE__ */ jsx8("button", {
2522
+ var ChatScrollIndicator = forwardRef5(({ targetId, timeline, type = "button", className, onClick, ...props }, ref) => /* @__PURE__ */ jsx7("button", {
2497
2523
  ...props,
2498
2524
  ref,
2499
2525
  type,
@@ -2515,59 +2541,59 @@ var ChatScrollIndicator = forwardRef6(({ targetId, timeline, type = "button", cl
2515
2541
  }
2516
2542
  }));
2517
2543
  ChatScrollIndicator.displayName = "Chat.ScrollIndicator";
2518
- var ChatReasoning = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("details", {
2544
+ var ChatReasoning = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("details", {
2519
2545
  ...props,
2520
2546
  ref,
2521
2547
  className: cn(chatReasoningClass, className)
2522
2548
  }));
2523
2549
  ChatReasoning.displayName = "Chat.Reasoning";
2524
- var ChatTool = forwardRef6(({ status, className, ...props }, ref) => /* @__PURE__ */ jsx8("details", {
2550
+ var ChatTool = forwardRef5(({ status, className, ...props }, ref) => /* @__PURE__ */ jsx7("details", {
2525
2551
  ...props,
2526
2552
  ref,
2527
2553
  className: getChatToolClasses({ status, className })
2528
2554
  }));
2529
2555
  ChatTool.displayName = "Chat.Tool";
2530
- var ChatToolHeader = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("summary", {
2556
+ var ChatToolHeader = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("summary", {
2531
2557
  ...props,
2532
2558
  ref,
2533
2559
  className: cn(chatToolHeaderClass, className)
2534
2560
  }));
2535
2561
  ChatToolHeader.displayName = "Chat.ToolHeader";
2536
- var ChatToolStatus = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("span", {
2562
+ var ChatToolStatus = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("span", {
2537
2563
  ...props,
2538
2564
  ref,
2539
2565
  className: cn(chatToolStatusClass, className)
2540
2566
  }));
2541
2567
  ChatToolStatus.displayName = "Chat.ToolStatus";
2542
- var ChatToolCall = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2568
+ var ChatToolCall = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2543
2569
  ...props,
2544
2570
  ref,
2545
2571
  className: cn(chatToolCallClass, className)
2546
2572
  }));
2547
2573
  ChatToolCall.displayName = "Chat.ToolCall";
2548
- var ChatToolResult = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2574
+ var ChatToolResult = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2549
2575
  ...props,
2550
2576
  ref,
2551
2577
  className: cn(chatToolResultClass, className)
2552
2578
  }));
2553
2579
  ChatToolResult.displayName = "Chat.ToolResult";
2554
- var ChatTyping = forwardRef6(({
2580
+ var ChatTyping = forwardRef5(({
2555
2581
  className,
2556
2582
  role = "status",
2557
2583
  "aria-label": ariaLabel = "Assistant is typing",
2558
2584
  ...props
2559
- }, ref) => /* @__PURE__ */ jsx8("span", {
2585
+ }, ref) => /* @__PURE__ */ jsx7("span", {
2560
2586
  ...props,
2561
2587
  ref,
2562
2588
  role,
2563
2589
  "aria-label": ariaLabel,
2564
2590
  className: cn(chatTypingClass, className),
2565
- children: /* @__PURE__ */ jsx8("span", {
2591
+ children: /* @__PURE__ */ jsx7("span", {
2566
2592
  "aria-hidden": "true"
2567
2593
  })
2568
2594
  }));
2569
2595
  ChatTyping.displayName = "Chat.Typing";
2570
- var ChatRoot = forwardRef6(({ placement = "start", timeline, className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
2596
+ var ChatRoot = forwardRef5(({ placement = "start", timeline, className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2571
2597
  ...props,
2572
2598
  ref,
2573
2599
  "data-chat-tl": timeline ?? props["data-chat-tl"],
@@ -2608,15 +2634,15 @@ var Chat = Object.assign(ChatRoot, {
2608
2634
  Typing: ChatTyping
2609
2635
  });
2610
2636
  // src/components/chat/ChatSessionComposer.tsx
2611
- import { forwardRef as forwardRef9 } from "react";
2637
+ import { forwardRef as forwardRef8 } from "react";
2612
2638
 
2613
2639
  // src/components/chat/composer/SemanticComposer.tsx
2614
2640
  import {
2615
- forwardRef as forwardRef8,
2641
+ forwardRef as forwardRef7,
2616
2642
  useId as useId7,
2617
2643
  useCallback as useCallback2,
2618
- useImperativeHandle as useImperativeHandle4,
2619
- useLayoutEffect as useLayoutEffect9,
2644
+ useImperativeHandle as useImperativeHandle3,
2645
+ useLayoutEffect as useLayoutEffect10,
2620
2646
  useRef as useRef7,
2621
2647
  useState as useState8,
2622
2648
  useSyncExternalStore as useSyncExternalStore5
@@ -2625,14 +2651,14 @@ import {
2625
2651
  // src/components/chat/composer/useComposerAttachments.ts
2626
2652
  import {
2627
2653
  useEffect as useEffect2,
2628
- useLayoutEffect as useLayoutEffect4,
2654
+ useLayoutEffect as useLayoutEffect5,
2629
2655
  useState as useState4,
2630
2656
  useSyncExternalStore
2631
2657
  } from "react";
2632
2658
  function useComposerAttachments(options) {
2633
2659
  const [controller] = useState4(() => createComposerAttachmentController(options));
2634
2660
  const snapshot = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
2635
- useLayoutEffect4(() => {
2661
+ useLayoutEffect5(() => {
2636
2662
  controller.configure(options);
2637
2663
  });
2638
2664
  useEffect2(() => () => {
@@ -2642,7 +2668,7 @@ function useComposerAttachments(options) {
2642
2668
  }
2643
2669
 
2644
2670
  // src/components/chat/composer/useComposerProviders.ts
2645
- import { useLayoutEffect as useLayoutEffect5, useState as useState5, useSyncExternalStore as useSyncExternalStore2 } from "react";
2671
+ import { useLayoutEffect as useLayoutEffect6, useState as useState5, useSyncExternalStore as useSyncExternalStore2 } from "react";
2646
2672
 
2647
2673
  // src/components/chat/composer/providers.ts
2648
2674
  var nextController = 0;
@@ -3016,18 +3042,18 @@ class ComposerProviderController {
3016
3042
  function useComposerProviders(context) {
3017
3043
  const [controller] = useState5(() => new ComposerProviderController);
3018
3044
  const snapshot = useSyncExternalStore2(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
3019
- useLayoutEffect5(() => {
3045
+ useLayoutEffect6(() => {
3020
3046
  controller.activate();
3021
3047
  return () => controller.dispose();
3022
3048
  }, [controller]);
3023
- useLayoutEffect5(() => {
3049
+ useLayoutEffect6(() => {
3024
3050
  controller.update(context);
3025
3051
  });
3026
3052
  return { controller, snapshot };
3027
3053
  }
3028
3054
 
3029
3055
  // src/components/chat/composer/useComposerSession.ts
3030
- import { useId as useId4, useLayoutEffect as useLayoutEffect6, useState as useState6, useSyncExternalStore as useSyncExternalStore3 } from "react";
3056
+ import { useId as useId4, useLayoutEffect as useLayoutEffect7, useState as useState6, useSyncExternalStore as useSyncExternalStore3 } from "react";
3031
3057
 
3032
3058
  // src/components/chat/composer/session.ts
3033
3059
  function sameComposerScope(a, b) {
@@ -3220,6 +3246,16 @@ function snapshotComposerReceipt(input, submission) {
3220
3246
  throw new TypeError("Unsupported receipt fields");
3221
3247
  return value;
3222
3248
  }
3249
+ function createSubmissionId() {
3250
+ const webCrypto = globalThis.crypto;
3251
+ if (typeof webCrypto.randomUUID === "function")
3252
+ return webCrypto.randomUUID();
3253
+ const bytes = webCrypto.getRandomValues(new Uint8Array(16));
3254
+ bytes[6] = bytes[6] & 15 | 64;
3255
+ bytes[8] = bytes[8] & 63 | 128;
3256
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
3257
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
3258
+ }
3223
3259
  function createComposerSessionController(initial, identity) {
3224
3260
  let context = initial;
3225
3261
  let disposed = false;
@@ -3342,7 +3378,7 @@ function createComposerSessionController(initial, identity) {
3342
3378
  const action = composerActionEligibility(context, intent);
3343
3379
  if (disposed || state.submitting || !action.allowed)
3344
3380
  return;
3345
- const clientSubmissionId = identity.nextSubmissionId?.() ?? crypto.randomUUID();
3381
+ const clientSubmissionId = identity.nextSubmissionId?.() ?? createSubmissionId();
3346
3382
  const common = {
3347
3383
  protocolVersion: 1,
3348
3384
  clientSubmissionId,
@@ -3436,11 +3472,11 @@ function useComposerSession(context) {
3436
3472
  const instanceId = useId4();
3437
3473
  const [controller] = useState6(() => createComposerSessionController(context, { instanceId }));
3438
3474
  const snapshot = useSyncExternalStore3(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
3439
- useLayoutEffect6(() => {
3475
+ useLayoutEffect7(() => {
3440
3476
  controller.activate();
3441
3477
  return () => controller.dispose();
3442
3478
  }, [controller]);
3443
- useLayoutEffect6(() => {
3479
+ useLayoutEffect7(() => {
3444
3480
  controller.update(context);
3445
3481
  });
3446
3482
  return { controller, snapshot };
@@ -3448,25 +3484,25 @@ function useComposerSession(context) {
3448
3484
 
3449
3485
  // src/components/chat/composer/PlainSemanticEditor.tsx
3450
3486
  import {
3451
- forwardRef as forwardRef7,
3487
+ forwardRef as forwardRef6,
3452
3488
  useId as useId5,
3453
- useImperativeHandle as useImperativeHandle3,
3489
+ useImperativeHandle as useImperativeHandle2,
3454
3490
  useCallback,
3455
- useLayoutEffect as useLayoutEffect7,
3491
+ useLayoutEffect as useLayoutEffect8,
3456
3492
  useRef as useRef6
3457
3493
  } from "react";
3458
- import { jsx as jsx9 } from "react/jsx-runtime";
3494
+ import { jsx as jsx8 } from "react/jsx-runtime";
3459
3495
  function isPlainComposerDocument(document2) {
3460
3496
  return !document2.command && document2.content.every((node) => node.type === "text");
3461
3497
  }
3462
- var PlainSemanticEditor = forwardRef7((props, ref) => {
3498
+ var PlainSemanticEditor = forwardRef6((props, ref) => {
3463
3499
  const editor = useRef6(null);
3464
3500
  const originId = useId5();
3465
3501
  const latest = useRef6(props);
3466
3502
  const revision = useRef6(props.value.revision);
3467
3503
  const pendingCaret = useRef6(undefined);
3468
3504
  const text = props.value.document.content.map((node) => node.type === "text" ? node.text : "").join("");
3469
- useLayoutEffect7(() => {
3505
+ useLayoutEffect8(() => {
3470
3506
  latest.current = props;
3471
3507
  revision.current = Math.max(revision.current, props.value.revision);
3472
3508
  const caret = pendingCaret.current;
@@ -3477,7 +3513,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
3477
3513
  pendingCaret.current = undefined;
3478
3514
  }
3479
3515
  });
3480
- useLayoutEffect7(() => {
3516
+ useLayoutEffect8(() => {
3481
3517
  latest.current.onReady?.(true);
3482
3518
  return () => latest.current.onReady?.(false);
3483
3519
  }, []);
@@ -3517,7 +3553,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
3517
3553
  }
3518
3554
  return latest.current.value.document.content.length ? null : { nodeIndex: 0, start: 0, end: 0 };
3519
3555
  }
3520
- useImperativeHandle3(ref, () => ({
3556
+ useImperativeHandle2(ref, () => ({
3521
3557
  focus: () => editor.current?.focus(),
3522
3558
  selection,
3523
3559
  insertText: (value) => {
@@ -3557,7 +3593,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
3557
3593
  return true;
3558
3594
  }
3559
3595
  }), [change]);
3560
- return /* @__PURE__ */ jsx9(PlainEditor, {
3596
+ return /* @__PURE__ */ jsx8(PlainEditor, {
3561
3597
  ref: editor,
3562
3598
  value: text,
3563
3599
  disabled: !!props.disabled,
@@ -3595,7 +3631,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
3595
3631
  PlainSemanticEditor.displayName = "PlainSemanticEditor";
3596
3632
 
3597
3633
  // src/components/chat/composer/PreservedDraft.tsx
3598
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3634
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3599
3635
  function PreservedDraft({
3600
3636
  input,
3601
3637
  reason,
@@ -3621,10 +3657,10 @@ function PreservedDraft({
3621
3657
  " Your draft is preserved."
3622
3658
  ]
3623
3659
  }),
3624
- /* @__PURE__ */ jsx10("pre", {
3660
+ /* @__PURE__ */ jsx9("pre", {
3625
3661
  children: document2.status === "compatible" ? exportComposerText(document2.value) : json ?? "The application retains the original incompatible input."
3626
3662
  }),
3627
- json ? /* @__PURE__ */ jsx10("a", {
3663
+ json ? /* @__PURE__ */ jsx9("a", {
3628
3664
  download: "composer-draft.json",
3629
3665
  href: `data:application/json;charset=utf-8,${encodeURIComponent(json)}`,
3630
3666
  children: "Export preserved draft"
@@ -3644,7 +3680,7 @@ function PreservedDraft({
3644
3680
  import { useId as useId6 } from "react";
3645
3681
 
3646
3682
  // src/components/chat/composer/useComposerDraft.ts
3647
- import { useLayoutEffect as useLayoutEffect8, useState as useState7, useSyncExternalStore as useSyncExternalStore4 } from "react";
3683
+ import { useLayoutEffect as useLayoutEffect9, useState as useState7, useSyncExternalStore as useSyncExternalStore4 } from "react";
3648
3684
 
3649
3685
  // src/components/chat/composer/drafts.ts
3650
3686
  function error2(cause, code) {
@@ -4010,18 +4046,18 @@ function createComposerDraftController(context) {
4010
4046
  function useComposerDraft(context) {
4011
4047
  const [controller] = useState7(() => createComposerDraftController(context));
4012
4048
  const snapshot = useSyncExternalStore4(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
4013
- useLayoutEffect8(() => {
4049
+ useLayoutEffect9(() => {
4014
4050
  controller.activate();
4015
4051
  return () => controller.dispose();
4016
4052
  }, [controller]);
4017
- useLayoutEffect8(() => {
4053
+ useLayoutEffect9(() => {
4018
4054
  controller.update(context);
4019
4055
  });
4020
4056
  return { controller, snapshot };
4021
4057
  }
4022
4058
 
4023
4059
  // src/components/chat/composer/DraftLifecycle.tsx
4024
- import { jsx as jsx11, jsxs as jsxs9, Fragment as Fragment5 } from "react/jsx-runtime";
4060
+ import { jsx as jsx10, jsxs as jsxs9, Fragment as Fragment6 } from "react/jsx-runtime";
4025
4061
  function DraftLifecycle({
4026
4062
  adapter,
4027
4063
  scope,
@@ -4030,7 +4066,9 @@ function DraftLifecycle({
4030
4066
  value,
4031
4067
  attachments,
4032
4068
  onDocumentChange,
4033
- disabled
4069
+ disabled,
4070
+ compact = false,
4071
+ children
4034
4072
  }) {
4035
4073
  const originId = `${useId6()}-draft`;
4036
4074
  function restore(draft) {
@@ -4054,25 +4092,25 @@ function DraftLifecycle({
4054
4092
  onRestore: restore
4055
4093
  });
4056
4094
  const blocked = disabled || snapshot.saving || snapshot.status === "idle" || snapshot.status === "loading" || snapshot.restorePending || snapshot.status === "incompatible" && !snapshot.overwriteAllowed || snapshot.status === "error" && snapshot.errorOperation !== "save";
4057
- return /* @__PURE__ */ jsxs9("div", {
4058
- className: "chat-composer-status",
4059
- "aria-label": "Draft storage",
4095
+ const status = snapshot.status === "loading" ? "Loading stored draft…" : snapshot.saving ? "Saving draft…" : snapshot.lastSavedRevision === value.revision ? "Draft saved by host storage." : snapshot.loaded?.applied ? "Stored draft restored." : "Draft storage is provided by the host.";
4096
+ const feedback = /* @__PURE__ */ jsxs9(Fragment6, {
4060
4097
  children: [
4061
- /* @__PURE__ */ jsx11("div", {
4098
+ /* @__PURE__ */ jsx10("div", {
4062
4099
  role: "status",
4063
- children: snapshot.status === "loading" ? "Loading stored draft…" : snapshot.saving ? "Saving draft…" : snapshot.lastSavedRevision === value.revision ? "Draft saved by host storage." : snapshot.loaded?.applied ? "Stored draft restored." : "Draft storage is provided by the host."
4100
+ className: compact ? "sr-only" : undefined,
4101
+ children: status
4064
4102
  }),
4065
- snapshot.error ? /* @__PURE__ */ jsx11("p", {
4103
+ snapshot.error ? /* @__PURE__ */ jsx10("p", {
4066
4104
  role: "alert",
4067
4105
  children: snapshot.error.message
4068
4106
  }) : null,
4069
- snapshot.incompatible ? /* @__PURE__ */ jsxs9(Fragment5, {
4107
+ snapshot.incompatible ? /* @__PURE__ */ jsxs9(Fragment6, {
4070
4108
  children: [
4071
- /* @__PURE__ */ jsx11(PreservedDraft, {
4109
+ /* @__PURE__ */ jsx10(PreservedDraft, {
4072
4110
  input: snapshot.incompatible.input,
4073
4111
  reason: snapshot.incompatible.reason
4074
4112
  }),
4075
- !snapshot.overwriteAllowed ? /* @__PURE__ */ jsx11("button", {
4113
+ !snapshot.overwriteAllowed ? /* @__PURE__ */ jsx10("button", {
4076
4114
  type: "button",
4077
4115
  disabled,
4078
4116
  onClick: () => {
@@ -4083,14 +4121,14 @@ function DraftLifecycle({
4083
4121
  }) : null
4084
4122
  ]
4085
4123
  }) : null,
4086
- snapshot.loaded && !snapshot.loaded.applied ? /* @__PURE__ */ jsxs9(Fragment5, {
4124
+ snapshot.loaded && !snapshot.loaded.applied ? /* @__PURE__ */ jsxs9(Fragment6, {
4087
4125
  children: [
4088
- /* @__PURE__ */ jsx11(PreservedDraft, {
4126
+ /* @__PURE__ */ jsx10(PreservedDraft, {
4089
4127
  input: snapshot.loaded.draft,
4090
4128
  reason: "A stored draft arrived after editing. Your current draft is preserved.",
4091
4129
  state: "pending"
4092
4130
  }),
4093
- /* @__PURE__ */ jsx11("button", {
4131
+ /* @__PURE__ */ jsx10("button", {
4094
4132
  type: "button",
4095
4133
  disabled,
4096
4134
  onClick: () => {
@@ -4100,14 +4138,81 @@ function DraftLifecycle({
4100
4138
  children: "Restore stored draft"
4101
4139
  })
4102
4140
  ]
4103
- }) : null,
4104
- /* @__PURE__ */ jsx11("button", {
4141
+ }) : null
4142
+ ]
4143
+ });
4144
+ const actions = compact ? /* @__PURE__ */ jsxs9(Fragment6, {
4145
+ children: [
4146
+ /* @__PURE__ */ jsxs9("button", {
4147
+ type: "button",
4148
+ className: "popover-menu-item",
4149
+ title: status,
4150
+ disabled: blocked,
4151
+ onClick: (event) => {
4152
+ controller.save();
4153
+ event.currentTarget.closest("[popover]")?.hidePopover?.();
4154
+ },
4155
+ children: [
4156
+ /* @__PURE__ */ jsx10("svg", {
4157
+ width: "18",
4158
+ height: "18",
4159
+ viewBox: "0 0 24 24",
4160
+ fill: "none",
4161
+ stroke: "currentColor",
4162
+ strokeWidth: "2",
4163
+ strokeLinecap: "round",
4164
+ strokeLinejoin: "round",
4165
+ "aria-hidden": "true",
4166
+ focusable: "false",
4167
+ children: /* @__PURE__ */ jsx10("path", {
4168
+ d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12l4 4v12a2 2 0 0 1-2 2ZM7 3v6h10V3M7 21v-8h10v8"
4169
+ })
4170
+ }),
4171
+ /* @__PURE__ */ jsx10("span", {
4172
+ children: "Save draft"
4173
+ })
4174
+ ]
4175
+ }),
4176
+ /* @__PURE__ */ jsxs9("button", {
4177
+ type: "button",
4178
+ className: "popover-menu-item",
4179
+ title: "Reload stored draft",
4180
+ disabled: disabled || snapshot.status === "loading" || snapshot.saving,
4181
+ onClick: (event) => {
4182
+ controller.reload();
4183
+ event.currentTarget.closest("[popover]")?.hidePopover?.();
4184
+ },
4185
+ children: [
4186
+ /* @__PURE__ */ jsx10("svg", {
4187
+ width: "18",
4188
+ height: "18",
4189
+ viewBox: "0 0 24 24",
4190
+ fill: "none",
4191
+ stroke: "currentColor",
4192
+ strokeWidth: "2",
4193
+ strokeLinecap: "round",
4194
+ strokeLinejoin: "round",
4195
+ "aria-hidden": "true",
4196
+ focusable: "false",
4197
+ children: /* @__PURE__ */ jsx10("path", {
4198
+ d: "M3 11a9 9 0 1 1 2.6 7.4M3 4v7h7"
4199
+ })
4200
+ }),
4201
+ /* @__PURE__ */ jsx10("span", {
4202
+ children: "Reload stored draft"
4203
+ })
4204
+ ]
4205
+ })
4206
+ ]
4207
+ }) : /* @__PURE__ */ jsxs9(Fragment6, {
4208
+ children: [
4209
+ /* @__PURE__ */ jsx10("button", {
4105
4210
  type: "button",
4106
4211
  disabled: blocked,
4107
4212
  onClick: () => void controller.save(),
4108
4213
  children: "Save draft"
4109
4214
  }),
4110
- /* @__PURE__ */ jsx11("button", {
4215
+ /* @__PURE__ */ jsx10("button", {
4111
4216
  type: "button",
4112
4217
  disabled: disabled || snapshot.status === "loading" || snapshot.saving,
4113
4218
  onClick: () => void controller.reload(),
@@ -4115,11 +4220,19 @@ function DraftLifecycle({
4115
4220
  })
4116
4221
  ]
4117
4222
  });
4223
+ return compact ? children(feedback, actions) : children(/* @__PURE__ */ jsxs9("div", {
4224
+ className: "chat-composer-status",
4225
+ "aria-label": "Draft storage",
4226
+ children: [
4227
+ feedback,
4228
+ actions
4229
+ ]
4230
+ }));
4118
4231
  }
4119
4232
 
4120
4233
  // src/components/chat/composer/SemanticComposer.tsx
4121
- import { jsx as jsx12, jsxs as jsxs10, Fragment as Fragment6 } from "react/jsx-runtime";
4122
- var SemanticComposer = forwardRef8(({
4234
+ import { jsx as jsx11, jsxs as jsxs10, Fragment as Fragment7 } from "react/jsx-runtime";
4235
+ var SemanticComposer = forwardRef7(({
4123
4236
  Editor,
4124
4237
  structured,
4125
4238
  value,
@@ -4138,6 +4251,8 @@ var SemanticComposer = forwardRef8(({
4138
4251
  busy = false,
4139
4252
  canSubmit = true,
4140
4253
  allowAttachmentOnly = false,
4254
+ compact = false,
4255
+ addMenu,
4141
4256
  onStop,
4142
4257
  label = "Message",
4143
4258
  attachLabel = "Attach files",
@@ -4166,13 +4281,13 @@ var SemanticComposer = forwardRef8(({
4166
4281
  const changedScope = !sameComposerScope(observed.current.scope, scope) || observed.current.draftKey !== draftKey;
4167
4282
  const generation = observed.current.generation + (changedScope ? 1 : 0);
4168
4283
  const alive = useRef7(false);
4169
- useLayoutEffect9(() => {
4284
+ useLayoutEffect10(() => {
4170
4285
  alive.current = true;
4171
4286
  return () => {
4172
4287
  alive.current = false;
4173
4288
  };
4174
4289
  }, []);
4175
- useLayoutEffect9(() => {
4290
+ useLayoutEffect10(() => {
4176
4291
  if (changedScope)
4177
4292
  observed.current = { scope: { ...scope }, draftKey, generation };
4178
4293
  }, [
@@ -4257,10 +4372,13 @@ var SemanticComposer = forwardRef8(({
4257
4372
  const completion = useComposerProviders(providerContext);
4258
4373
  const popup = completion.snapshot.status !== "idle";
4259
4374
  const candidates = completion.snapshot.items.map((item) => {
4375
+ const provider = providers.find((entry) => entry.providerId === item.providerId);
4260
4376
  const reason = item.candidate.disabledReason ?? candidateDisabledReason(item.candidate);
4261
4377
  return {
4262
4378
  id: item.id,
4263
4379
  label: item.candidate.label,
4380
+ icon: provider?.icon,
4381
+ sourceLabel: provider?.sourceLabel,
4264
4382
  description: reason ?? item.candidate.description,
4265
4383
  disabled: reason !== undefined,
4266
4384
  group: item.candidate.group ?? completion.snapshot.groups.find((group) => group.providerId === item.providerId)?.label
@@ -4270,7 +4388,7 @@ var SemanticComposer = forwardRef8(({
4270
4388
  const showCompletion = popup && candidates.length > 0;
4271
4389
  const visibleError = error ?? localError ?? session.snapshot.error?.message;
4272
4390
  const hasError = visibleError !== undefined && visibleError !== null && visibleError !== false;
4273
- useImperativeHandle4(forwardedRef, () => ({
4391
+ useImperativeHandle3(forwardedRef, () => ({
4274
4392
  focus: () => editor.current?.focus(),
4275
4393
  selection: () => editor.current?.selection() ?? null,
4276
4394
  insertReference: (node) => {
@@ -4326,16 +4444,19 @@ var SemanticComposer = forwardRef8(({
4326
4444
  }
4327
4445
  editor.current?.focus();
4328
4446
  }
4329
- return /* @__PURE__ */ jsx12(ComposerShell, {
4447
+ const compactImages = compact && attachmentsCurrent && attachments.entries.length > 0 && attachments.entries.every((entry) => entry.state.status === "ready" && entry.metadata.mediaType.startsWith("image/") && !!attachments.controller.previewUrl(entry.entryId));
4448
+ return /* @__PURE__ */ jsx11(ComposerShell, {
4330
4449
  ...rootProps,
4331
4450
  className,
4332
4451
  composerId: id,
4452
+ compact,
4453
+ addMenu,
4333
4454
  entries: (attachmentsCurrent ? attachments.entries : []).map((entry) => ({
4334
4455
  id: entry.entryId,
4335
4456
  name: entry.metadata.name,
4336
4457
  previewUrl: attachments.controller.previewUrl(entry.entryId),
4337
4458
  state: entry.state.status === "preparing" ? "validating" : entry.state.status,
4338
- status: entry.state.status === "error" ? entry.state.error.message : entry.state.status === "reattach" ? "Select this file again to restore it" : entry.state.status === "ready" ? "Ready" : entry.state.status,
4459
+ status: entry.state.status === "error" ? entry.state.error.message : entry.state.status === "reattach" ? "Select this file again to restore it" : entry.state.status === "ready" ? compactImages ? undefined : "Ready" : entry.state.status,
4339
4460
  ...entry.state.status === "preparing" || entry.state.status === "uploading" ? {
4340
4461
  progress: entry.state.progress,
4341
4462
  cancel: () => attachments.controller.cancel(entry.entryId)
@@ -4385,23 +4506,24 @@ var SemanticComposer = forwardRef8(({
4385
4506
  active,
4386
4507
  showCompletion,
4387
4508
  selectCompletion: selectCandidate,
4509
+ dismissCompletion: () => completion.controller.dismiss(),
4388
4510
  completionHeader: completion.snapshot.breadcrumbs.length ? /* @__PURE__ */ jsxs10("nav", {
4389
4511
  "aria-label": "Suggestion folders",
4390
4512
  className: "chat-composer-breadcrumb",
4391
4513
  children: [
4392
- /* @__PURE__ */ jsx12("button", {
4514
+ /* @__PURE__ */ jsx11("button", {
4393
4515
  type: "button",
4394
4516
  onMouseDown: (event) => event.preventDefault(),
4395
4517
  onClick: () => completion.controller.back(0),
4396
4518
  children: "All results"
4397
4519
  }),
4398
- completion.snapshot.breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsx12("button", {
4520
+ completion.snapshot.breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsx11("button", {
4399
4521
  type: "button",
4400
4522
  onMouseDown: (event) => event.preventDefault(),
4401
4523
  onClick: () => completion.controller.back(index + 1),
4402
4524
  children: crumb.label
4403
4525
  }, crumb.refId)),
4404
- /* @__PURE__ */ jsx12("span", {
4526
+ /* @__PURE__ */ jsx11("span", {
4405
4527
  className: "chat-composer-hint",
4406
4528
  children: "Alt+Left returns to the parent folder."
4407
4529
  })
@@ -4412,7 +4534,7 @@ var SemanticComposer = forwardRef8(({
4412
4534
  className: "chat-composer-status",
4413
4535
  children: [
4414
4536
  completion.snapshot.status === "loading" ? "Loading suggestions…" : completion.snapshot.status === "empty" ? "No suggestions" : completion.snapshot.error?.message ?? "Some suggestions could not be loaded",
4415
- completion.snapshot.status === "error" ? /* @__PURE__ */ jsx12("button", {
4537
+ completion.snapshot.status === "error" ? /* @__PURE__ */ jsx11("button", {
4416
4538
  type: "button",
4417
4539
  onClick: () => completion.controller.retry(),
4418
4540
  children: "Retry suggestions"
@@ -4421,18 +4543,8 @@ var SemanticComposer = forwardRef8(({
4421
4543
  }) : null,
4422
4544
  visibleError,
4423
4545
  hasError,
4424
- statusContent: /* @__PURE__ */ jsxs10(Fragment6, {
4546
+ statusContent: /* @__PURE__ */ jsxs10(Fragment7, {
4425
4547
  children: [
4426
- draftAdapter && attachmentsCurrent && read.status === "compatible" ? /* @__PURE__ */ jsx12(DraftLifecycle, {
4427
- adapter: draftAdapter,
4428
- scope,
4429
- draftKey,
4430
- generation,
4431
- value,
4432
- attachments: attachments.controller,
4433
- onDocumentChange,
4434
- disabled: disabled || runtime.status === "read_only"
4435
- }, generation) : null,
4436
4548
  attachmentsCurrent && attachments.rejections.length ? /* @__PURE__ */ jsxs10("div", {
4437
4549
  role: "alert",
4438
4550
  className: "chat-composer-status",
@@ -4445,58 +4557,80 @@ var SemanticComposer = forwardRef8(({
4445
4557
  item.error.message
4446
4558
  ]
4447
4559
  }, `${index}-${item.metadata.name}`)),
4448
- /* @__PURE__ */ jsx12("button", {
4560
+ /* @__PURE__ */ jsx11("button", {
4449
4561
  type: "button",
4450
4562
  onClick: () => attachments.controller.clearRejections(),
4451
4563
  children: "Dismiss attachment errors"
4452
4564
  })
4453
4565
  ]
4454
4566
  }) : null,
4455
- recovery.filter((attempt) => sameComposerScope(attempt.snapshot.scope, scope) && (attempt.status === "unknown" || attempt.status === "pending")).map((attempt) => /* @__PURE__ */ jsxs10("details", {
4567
+ recovery.filter((attempt) => sameComposerScope(attempt.snapshot.scope, scope) && (attempt.status === "unknown" || attempt.status === "pending")).map((attempt) => compact && attempt.status === "pending" ? /* @__PURE__ */ jsx11("p", {
4568
+ role: "status",
4569
+ className: "sr-only",
4570
+ "data-state": "pending",
4571
+ children: "Awaiting admission"
4572
+ }, attempt.snapshot.clientSubmissionId) : /* @__PURE__ */ jsxs10("details", {
4456
4573
  className: "chat-composer-status",
4457
4574
  "data-state": attempt.status,
4458
4575
  children: [
4459
- /* @__PURE__ */ jsx12("summary", {
4576
+ /* @__PURE__ */ jsx11("summary", {
4460
4577
  children: attempt.status === "unknown" ? "Submission outcome unknown — draft retained" : "Awaiting admission"
4461
4578
  }),
4462
- /* @__PURE__ */ jsx12("p", {
4579
+ /* @__PURE__ */ jsx11("p", {
4463
4580
  children: attempt.snapshot.clientSubmissionId
4464
4581
  }),
4465
- attempt.receipt?.outcome === "unknown" ? /* @__PURE__ */ jsx12("p", {
4582
+ attempt.receipt?.outcome === "unknown" ? /* @__PURE__ */ jsx11("p", {
4466
4583
  children: attempt.receipt.error.message
4467
4584
  }) : null,
4468
- host.reconcile ? /* @__PURE__ */ jsx12("button", {
4585
+ host.reconcile ? /* @__PURE__ */ jsx11("button", {
4469
4586
  type: "button",
4470
4587
  onClick: () => {
4471
4588
  session.controller.reconcile(attempt.snapshot.clientSubmissionId).catch((cause) => setLocalError(String(cause), generation));
4472
4589
  },
4473
4590
  children: "Check submission status"
4474
4591
  }) : null,
4475
- attempt.status === "unknown" && host.authorizeRetry ? /* @__PURE__ */ jsx12("button", {
4592
+ attempt.status === "unknown" && host.authorizeRetry ? /* @__PURE__ */ jsx11("button", {
4476
4593
  type: "button",
4477
4594
  onClick: () => {
4478
4595
  session.controller.retry(attempt.snapshot.clientSubmissionId).catch((cause) => setLocalError(String(cause), generation));
4479
4596
  },
4480
4597
  children: "Request authorized retry"
4481
4598
  }) : null,
4482
- /* @__PURE__ */ jsx12(PreservedDraft, {
4599
+ /* @__PURE__ */ jsx11(PreservedDraft, {
4483
4600
  input: attempt.snapshot.document,
4484
4601
  reason: "Submitted snapshot",
4485
4602
  state: attempt.status === "unknown" ? "unknown" : "pending"
4486
4603
  })
4487
4604
  ]
4488
4605
  }, attempt.snapshot.clientSubmissionId)),
4489
- session.snapshot.recoveryFailures?.map((attempt) => /* @__PURE__ */ jsx12(PreservedDraft, {
4606
+ session.snapshot.recoveryFailures?.map((attempt) => /* @__PURE__ */ jsx11(PreservedDraft, {
4490
4607
  input: attempt,
4491
4608
  reason: "The host could not retain this submission. Export its recovery record before leaving."
4492
4609
  }, attempt.snapshot.clientSubmissionId)),
4493
- session.snapshot.lastReceipt?.outcome === "accepted" ? /* @__PURE__ */ jsx12("div", {
4610
+ session.snapshot.lastReceipt?.outcome === "accepted" ? /* @__PURE__ */ jsx11("div", {
4494
4611
  role: "status",
4495
- className: "chat-composer-status",
4612
+ className: compact ? "sr-only" : "chat-composer-status",
4496
4613
  children: session.snapshot.lastReceipt.operation === "command" ? "Command completed" : `Admitted: ${session.snapshot.lastReceipt.delivery} (${session.snapshot.lastReceipt.persistence})`
4497
4614
  }) : null
4498
4615
  ]
4499
4616
  }),
4617
+ renderFooter: (renderToolbar) => draftAdapter && attachmentsCurrent && read.status === "compatible" ? /* @__PURE__ */ jsx11(DraftLifecycle, {
4618
+ compact,
4619
+ adapter: draftAdapter,
4620
+ scope,
4621
+ draftKey,
4622
+ generation,
4623
+ value,
4624
+ attachments: attachments.controller,
4625
+ onDocumentChange,
4626
+ disabled: disabled || runtime.status === "read_only",
4627
+ children: (feedback, actions) => /* @__PURE__ */ jsxs10(Fragment7, {
4628
+ children: [
4629
+ feedback,
4630
+ renderToolbar(actions)
4631
+ ]
4632
+ })
4633
+ }, `draft-${generation}`) : renderToolbar(),
4500
4634
  attachLabel,
4501
4635
  sendLabel: action.label,
4502
4636
  stopLabel,
@@ -4506,7 +4640,7 @@ var SemanticComposer = forwardRef8(({
4506
4640
  },
4507
4641
  submit,
4508
4642
  onStop,
4509
- editor: editAvailable ? /* @__PURE__ */ jsx12(Editor, {
4643
+ editor: editAvailable ? /* @__PURE__ */ jsx11(Editor, {
4510
4644
  ref: editor,
4511
4645
  value,
4512
4646
  instanceGeneration: generation,
@@ -4559,7 +4693,7 @@ var SemanticComposer = forwardRef8(({
4559
4693
  submit();
4560
4694
  }
4561
4695
  }
4562
- }, generation) : /* @__PURE__ */ jsx12(PreservedDraft, {
4696
+ }, generation) : /* @__PURE__ */ jsx11(PreservedDraft, {
4563
4697
  input: value.document,
4564
4698
  reason: editorError?.message ?? (read.status === "incompatible" ? read.reason : "This draft requires the optional rich editor.")
4565
4699
  }),
@@ -4569,8 +4703,8 @@ var SemanticComposer = forwardRef8(({
4569
4703
  SemanticComposer.displayName = "SemanticComposer";
4570
4704
 
4571
4705
  // src/components/chat/ChatSessionComposer.tsx
4572
- import { jsx as jsx13 } from "react/jsx-runtime";
4573
- var ChatSessionComposer = forwardRef9((props, ref) => /* @__PURE__ */ jsx13(SemanticComposer, {
4706
+ import { jsx as jsx12 } from "react/jsx-runtime";
4707
+ var ChatSessionComposer = forwardRef8((props, ref) => /* @__PURE__ */ jsx12(SemanticComposer, {
4574
4708
  ...props,
4575
4709
  ref,
4576
4710
  Editor: PlainSemanticEditor,
@@ -4578,14 +4712,40 @@ var ChatSessionComposer = forwardRef9((props, ref) => /* @__PURE__ */ jsx13(Sema
4578
4712
  }));
4579
4713
  ChatSessionComposer.displayName = "ChatSessionComposer";
4580
4714
  // src/components/chat/ChatAuthoritativeQueue.tsx
4581
- import { useId as useId8, useLayoutEffect as useLayoutEffect10, useRef as useRef8, useState as useState9 } from "react";
4582
- import { jsx as jsx14, jsxs as jsxs11, Fragment as Fragment7 } from "react/jsx-runtime";
4715
+ import { useId as useId8, useLayoutEffect as useLayoutEffect11, useRef as useRef8, useState as useState9 } from "react";
4716
+ import { jsx as jsx13, jsxs as jsxs11, Fragment as Fragment8 } from "react/jsx-runtime";
4583
4717
  function scopeKey(projection) {
4584
4718
  return JSON.stringify([
4585
4719
  projection.scope.contextKey,
4586
4720
  projection.scope.conversationId
4587
4721
  ]);
4588
4722
  }
4723
+ function QueueActionIcon({
4724
+ action
4725
+ }) {
4726
+ const paths = {
4727
+ edit: "m15 4 5 5-11 11H4v-5ZM13 6l5 5",
4728
+ steer: "m15 4 5 5-5 5M20 9h-9a6 6 0 0 0-6 6v4",
4729
+ remove: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7m4-7v7",
4730
+ save: "m5 12 4 4L19 6",
4731
+ cancel: "m6 6 12 12M6 18 18 6"
4732
+ };
4733
+ return /* @__PURE__ */ jsx13("svg", {
4734
+ width: "16",
4735
+ height: "16",
4736
+ viewBox: "0 0 24 24",
4737
+ fill: "none",
4738
+ stroke: "currentColor",
4739
+ strokeWidth: "2",
4740
+ strokeLinecap: "round",
4741
+ strokeLinejoin: "round",
4742
+ "aria-hidden": "true",
4743
+ focusable: "false",
4744
+ children: /* @__PURE__ */ jsx13("path", {
4745
+ d: paths[action]
4746
+ })
4747
+ });
4748
+ }
4589
4749
  function safeText(item) {
4590
4750
  return !item.document.command && !item.attachments.length && item.document.content.every((node) => node.type === "text");
4591
4751
  }
@@ -4596,19 +4756,19 @@ function DocumentEditorSlot({
4596
4756
  renderEditor,
4597
4757
  ...editor
4598
4758
  }) {
4599
- return /* @__PURE__ */ jsx14(Fragment7, {
4759
+ return /* @__PURE__ */ jsx13(Fragment8, {
4600
4760
  children: renderEditor(editor)
4601
4761
  });
4602
4762
  }
4603
4763
  function ChatAuthoritativeQueue(props) {
4604
- return /* @__PURE__ */ jsx14(QueueSession, {
4764
+ return /* @__PURE__ */ jsx13(QueueSession, {
4605
4765
  ...props
4606
4766
  }, scopeKey(props.projection));
4607
4767
  }
4608
4768
  function QueueSession(props) {
4609
4769
  const latest = useRef8(props);
4610
4770
  const watermark = useRef8(props.projection.revision);
4611
- useLayoutEffect10(() => {
4771
+ useLayoutEffect11(() => {
4612
4772
  latest.current = props;
4613
4773
  watermark.current = Math.max(watermark.current, props.projection.revision);
4614
4774
  });
@@ -4618,7 +4778,7 @@ function QueueSession(props) {
4618
4778
  const [pending, setPending] = useState9([]);
4619
4779
  const [message, setMessage] = useState9();
4620
4780
  const [edit, setEdit] = useState9();
4621
- useLayoutEffect10(() => {
4781
+ useLayoutEffect11(() => {
4622
4782
  const active = requests.current;
4623
4783
  return () => {
4624
4784
  for (const controller of active.values())
@@ -4690,7 +4850,7 @@ function QueueSession(props) {
4690
4850
  return /* @__PURE__ */ jsxs11("div", {
4691
4851
  className: props.className,
4692
4852
  children: [
4693
- /* @__PURE__ */ jsx14(ChatQueue, {
4853
+ /* @__PURE__ */ jsx13(ChatQueue, {
4694
4854
  label: props.label,
4695
4855
  items: props.projection.items.map((item) => ({
4696
4856
  id: item.id,
@@ -4702,26 +4862,30 @@ function QueueSession(props) {
4702
4862
  renderItemActions: (row, index, busy) => {
4703
4863
  const item = props.projection.items[index];
4704
4864
  const editable = canEdit(item, props);
4705
- return /* @__PURE__ */ jsxs11(Fragment7, {
4865
+ return /* @__PURE__ */ jsxs11(Fragment8, {
4706
4866
  children: [
4707
- editable ? /* @__PURE__ */ jsx14("button", {
4867
+ editable ? /* @__PURE__ */ jsx13("button", {
4708
4868
  type: "button",
4709
- className: "btn btn-ghost btn-sm",
4869
+ className: "btn btn-ghost btn-sm btn-square",
4710
4870
  disabled: busy,
4711
4871
  "aria-label": `Edit waiting message ${index + 1}`,
4872
+ title: `Edit waiting message ${index + 1}`,
4712
4873
  onClick: () => setEdit({
4713
4874
  item,
4714
4875
  revision: props.projection.revision,
4715
4876
  document: snapshotComposerDocument(item.document),
4716
4877
  text: safeText(item)
4717
4878
  }),
4718
- children: "Edit"
4879
+ children: /* @__PURE__ */ jsx13(QueueActionIcon, {
4880
+ action: "edit"
4881
+ })
4719
4882
  }) : null,
4720
- props.capabilities.promote && item.capabilities.promote ? /* @__PURE__ */ jsx14("button", {
4883
+ props.capabilities.promote && item.capabilities.promote ? /* @__PURE__ */ jsx13("button", {
4721
4884
  type: "button",
4722
- className: "btn btn-ghost btn-sm chat-queue-steer",
4885
+ className: "btn btn-ghost btn-sm btn-square chat-queue-steer",
4723
4886
  disabled: busy || !props.targetTurnId,
4724
4887
  "aria-label": `Steer waiting message ${index + 1}`,
4888
+ title: `Steer waiting message ${index + 1}`,
4725
4889
  onClick: () => {
4726
4890
  if (props.targetTurnId)
4727
4891
  mutate({
@@ -4729,27 +4893,32 @@ function QueueSession(props) {
4729
4893
  targetTurnId: props.targetTurnId
4730
4894
  }, row.id);
4731
4895
  },
4732
- children: "Steer"
4896
+ children: /* @__PURE__ */ jsx13(QueueActionIcon, {
4897
+ action: "steer"
4898
+ })
4733
4899
  }) : null,
4734
- props.capabilities.remove && item.capabilities.remove ? /* @__PURE__ */ jsx14("button", {
4900
+ props.capabilities.remove && item.capabilities.remove ? /* @__PURE__ */ jsx13("button", {
4735
4901
  type: "button",
4736
- className: "btn btn-ghost btn-sm chat-queue-remove",
4902
+ className: "btn btn-ghost btn-sm btn-square chat-queue-remove",
4737
4903
  disabled: busy,
4738
4904
  "aria-label": `Remove waiting message ${index + 1}`,
4905
+ title: `Remove waiting message ${index + 1}`,
4739
4906
  onClick: () => void mutate({ operation: "remove" }, row.id),
4740
- children: "Remove"
4907
+ children: /* @__PURE__ */ jsx13(QueueActionIcon, {
4908
+ action: "remove"
4909
+ })
4741
4910
  }) : null
4742
4911
  ]
4743
4912
  });
4744
4913
  }
4745
4914
  }),
4746
- edit ? /* @__PURE__ */ jsx14("div", {
4915
+ edit ? /* @__PURE__ */ jsx13("div", {
4747
4916
  className: "chat-composer",
4748
4917
  role: "group",
4749
4918
  "aria-label": "Edit queued message",
4750
- children: edit.text ? /* @__PURE__ */ jsxs11(Fragment7, {
4919
+ children: edit.text ? /* @__PURE__ */ jsxs11(Fragment8, {
4751
4920
  children: [
4752
- /* @__PURE__ */ jsx14("textarea", {
4921
+ /* @__PURE__ */ jsx13("textarea", {
4753
4922
  className: "chat-composer-input",
4754
4923
  "aria-label": "Queued message",
4755
4924
  value: exportComposerText(edit.document),
@@ -4767,24 +4936,32 @@ function QueueSession(props) {
4767
4936
  /* @__PURE__ */ jsxs11("div", {
4768
4937
  className: "chat-composer-actions",
4769
4938
  children: [
4770
- /* @__PURE__ */ jsx14("button", {
4771
- className: "btn btn-sm",
4939
+ /* @__PURE__ */ jsx13("button", {
4940
+ className: "btn btn-sm btn-square",
4772
4941
  type: "button",
4942
+ "aria-label": "Save queued message",
4943
+ title: "Save queued message",
4773
4944
  disabled: pending.includes(edit.item.id) || !editAllowed,
4774
4945
  onClick: () => void mutate({ operation: "edit", document: edit.document }, edit.item.id, edit.revision),
4775
- children: "Save queued message"
4946
+ children: /* @__PURE__ */ jsx13(QueueActionIcon, {
4947
+ action: "save"
4948
+ })
4776
4949
  }),
4777
- /* @__PURE__ */ jsx14("button", {
4778
- className: "btn btn-ghost btn-sm",
4950
+ /* @__PURE__ */ jsx13("button", {
4951
+ className: "btn btn-ghost btn-sm btn-square",
4779
4952
  type: "button",
4953
+ "aria-label": "Cancel",
4954
+ title: "Cancel",
4780
4955
  disabled: pending.includes(edit.item.id),
4781
4956
  onClick: () => setEdit(undefined),
4782
- children: "Cancel"
4957
+ children: /* @__PURE__ */ jsx13(QueueActionIcon, {
4958
+ action: "cancel"
4959
+ })
4783
4960
  })
4784
4961
  ]
4785
4962
  })
4786
4963
  ]
4787
- }) : props.renderDocumentEditor && editAllowed ? /* @__PURE__ */ jsx14(DocumentEditorSlot, {
4964
+ }) : props.renderDocumentEditor && editAllowed ? /* @__PURE__ */ jsx13(DocumentEditorSlot, {
4788
4965
  renderEditor: props.renderDocumentEditor,
4789
4966
  item: edit.item,
4790
4967
  value: edit.document,
@@ -4795,14 +4972,14 @@ function QueueSession(props) {
4795
4972
  onSave: () => void mutate({ operation: "edit", document: edit.document }, edit.item.id, edit.revision),
4796
4973
  onCancel: () => setEdit(undefined),
4797
4974
  pending: pending.includes(edit.item.id)
4798
- }) : /* @__PURE__ */ jsxs11(Fragment7, {
4975
+ }) : /* @__PURE__ */ jsxs11(Fragment8, {
4799
4976
  children: [
4800
- /* @__PURE__ */ jsx14(PreservedDraft, {
4977
+ /* @__PURE__ */ jsx13(PreservedDraft, {
4801
4978
  input: edit.document,
4802
4979
  reason: "This queued message is no longer editable. Your replacement draft is preserved.",
4803
4980
  state: "pending"
4804
4981
  }),
4805
- /* @__PURE__ */ jsx14("button", {
4982
+ /* @__PURE__ */ jsx13("button", {
4806
4983
  type: "button",
4807
4984
  onClick: () => setEdit(undefined),
4808
4985
  children: "Discard queued edit"
@@ -4810,7 +4987,7 @@ function QueueSession(props) {
4810
4987
  ]
4811
4988
  })
4812
4989
  }) : null,
4813
- message ? /* @__PURE__ */ jsx14("p", {
4990
+ message ? /* @__PURE__ */ jsx13("p", {
4814
4991
  className: message.error ? "chat-composer-error" : "chat-composer-status",
4815
4992
  role: message.error ? "alert" : "status",
4816
4993
  children: message.text
@@ -4819,11 +4996,11 @@ function QueueSession(props) {
4819
4996
  });
4820
4997
  }
4821
4998
  // src/components/chat/ComposerSettings.tsx
4822
- import { useId as useId10, useLayoutEffect as useLayoutEffect11, useRef as useRef10, useState as useState11 } from "react";
4999
+ import { useId as useId10, useLayoutEffect as useLayoutEffect12, useRef as useRef10, useState as useState11 } from "react";
4823
5000
 
4824
5001
  // src/components/select/Select.tsx
4825
- import React14, {
4826
- forwardRef as forwardRef10,
5002
+ import React13, {
5003
+ forwardRef as forwardRef9,
4827
5004
  useCallback as useCallback3,
4828
5005
  useEffect as useEffect3,
4829
5006
  useId as useId9,
@@ -4886,7 +5063,7 @@ function getSelectOptionClasses({
4886
5063
  }
4887
5064
 
4888
5065
  // src/components/select/Select.tsx
4889
- import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
5066
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
4890
5067
  function isGroup(option) {
4891
5068
  return "options" in option;
4892
5069
  }
@@ -4911,8 +5088,8 @@ function normalizeMultiValue(value) {
4911
5088
  }
4912
5089
  function optionsFromChildren(children) {
4913
5090
  const result = [];
4914
- React14.Children.forEach(children, (child) => {
4915
- if (!React14.isValidElement(child)) {
5091
+ React13.Children.forEach(children, (child) => {
5092
+ if (!React13.isValidElement(child)) {
4916
5093
  return;
4917
5094
  }
4918
5095
  if (child.type === Option) {
@@ -4962,19 +5139,19 @@ function filterOptions(options, searchValue, filterOption) {
4962
5139
  function renderValue(option) {
4963
5140
  return option ? optionLabel(option) : null;
4964
5141
  }
4965
- var Option = forwardRef10(({ children, ...props }, ref) => /* @__PURE__ */ jsx15("div", {
5142
+ var Option = forwardRef9(({ children, ...props }, ref) => /* @__PURE__ */ jsx14("div", {
4966
5143
  ...props,
4967
5144
  ref,
4968
5145
  children
4969
5146
  }));
4970
5147
  Option.displayName = "Select.Option";
4971
- var OptGroup = forwardRef10(({ children, ...props }, ref) => /* @__PURE__ */ jsx15("div", {
5148
+ var OptGroup = forwardRef9(({ children, ...props }, ref) => /* @__PURE__ */ jsx14("div", {
4972
5149
  ...props,
4973
5150
  ref,
4974
5151
  children
4975
5152
  }));
4976
5153
  OptGroup.displayName = "Select.OptGroup";
4977
- var SelectRoot = forwardRef10(({
5154
+ var SelectRoot = forwardRef9(({
4978
5155
  allowClear,
4979
5156
  "aria-describedby": ariaDescribedBy,
4980
5157
  "aria-errormessage": ariaErrorMessage,
@@ -5115,7 +5292,7 @@ var SelectRoot = forwardRef10(({
5115
5292
  }
5116
5293
  function renderOption(option) {
5117
5294
  const selected = selectedKeys.has(valueKey(option.value));
5118
- return /* @__PURE__ */ jsx15("button", {
5295
+ return /* @__PURE__ */ jsx14("button", {
5119
5296
  type: "button",
5120
5297
  role: "option",
5121
5298
  "aria-selected": selected,
@@ -5138,7 +5315,7 @@ var SelectRoot = forwardRef10(({
5138
5315
  className: cn(selectGroupClass, option.className),
5139
5316
  role: "group",
5140
5317
  children: [
5141
- /* @__PURE__ */ jsx15("div", {
5318
+ /* @__PURE__ */ jsx14("div", {
5142
5319
  className: selectGroupLabelClass,
5143
5320
  children: option.label
5144
5321
  }),
@@ -5155,7 +5332,7 @@ var SelectRoot = forwardRef10(({
5155
5332
  ref.current = node;
5156
5333
  }
5157
5334
  };
5158
- const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx15("span", {
5335
+ const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx14("span", {
5159
5336
  className: selectTagClass,
5160
5337
  children: renderValue(option)
5161
5338
  }, valueKey(option.value))) : renderValue(selectedOptions[0]);
@@ -5191,17 +5368,17 @@ var SelectRoot = forwardRef10(({
5191
5368
  setOpenState(!isOpen);
5192
5369
  },
5193
5370
  children: [
5194
- /* @__PURE__ */ jsx15("span", {
5371
+ /* @__PURE__ */ jsx14("span", {
5195
5372
  className: selectSelectionClass,
5196
- children: hasValue ? selection : /* @__PURE__ */ jsx15("span", {
5373
+ children: hasValue ? selection : /* @__PURE__ */ jsx14("span", {
5197
5374
  className: selectPlaceholderClass,
5198
5375
  children: placeholder
5199
5376
  })
5200
5377
  }),
5201
- /* @__PURE__ */ jsx15("span", {
5378
+ /* @__PURE__ */ jsx14("span", {
5202
5379
  className: selectIconClass,
5203
5380
  "aria-hidden": "true",
5204
- children: /* @__PURE__ */ jsx15("svg", {
5381
+ children: /* @__PURE__ */ jsx14("svg", {
5205
5382
  width: "16",
5206
5383
  height: "16",
5207
5384
  viewBox: "0 0 24 24",
@@ -5211,19 +5388,19 @@ var SelectRoot = forwardRef10(({
5211
5388
  strokeLinecap: "round",
5212
5389
  strokeLinejoin: "round",
5213
5390
  "aria-hidden": "true",
5214
- children: /* @__PURE__ */ jsx15("path", {
5391
+ children: /* @__PURE__ */ jsx14("path", {
5215
5392
  d: "m6 9 6 6 6-6"
5216
5393
  })
5217
5394
  })
5218
5395
  })
5219
5396
  ]
5220
5397
  }),
5221
- allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx15("button", {
5398
+ allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx14("button", {
5222
5399
  type: "button",
5223
5400
  className: selectClearClass,
5224
5401
  "aria-label": "Clear selection",
5225
5402
  onClick: clearValue,
5226
- children: /* @__PURE__ */ jsx15("svg", {
5403
+ children: /* @__PURE__ */ jsx14("svg", {
5227
5404
  width: "14",
5228
5405
  height: "14",
5229
5406
  viewBox: "0 0 24 24",
@@ -5232,7 +5409,7 @@ var SelectRoot = forwardRef10(({
5232
5409
  strokeWidth: "2",
5233
5410
  strokeLinecap: "round",
5234
5411
  "aria-hidden": "true",
5235
- children: /* @__PURE__ */ jsx15("path", {
5412
+ children: /* @__PURE__ */ jsx14("path", {
5236
5413
  d: "m6 6 12 12M6 18 18 6"
5237
5414
  })
5238
5415
  })
@@ -5254,7 +5431,7 @@ var SelectRoot = forwardRef10(({
5254
5431
  }
5255
5432
  },
5256
5433
  children: [
5257
- searchable ? /* @__PURE__ */ jsx15("input", {
5434
+ searchable ? /* @__PURE__ */ jsx14("input", {
5258
5435
  className: selectSearchClass,
5259
5436
  value: searchValue,
5260
5437
  placeholder: typeof placeholder === "string" ? placeholder : undefined,
@@ -5266,7 +5443,7 @@ var SelectRoot = forwardRef10(({
5266
5443
  }
5267
5444
  }
5268
5445
  }) : null,
5269
- visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx15("div", {
5446
+ visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx14("div", {
5270
5447
  className: selectEmptyClass,
5271
5448
  children: "No data"
5272
5449
  })
@@ -5281,16 +5458,16 @@ Select.Option = Option;
5281
5458
  Select.OptGroup = OptGroup;
5282
5459
 
5283
5460
  // src/components/chat/ComposerSettings.tsx
5284
- import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
5461
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
5285
5462
  function ComposerSettings(props) {
5286
- return /* @__PURE__ */ jsx16(SettingsSession, {
5463
+ return /* @__PURE__ */ jsx15(SettingsSession, {
5287
5464
  ...props
5288
5465
  }, props.scopeKey);
5289
5466
  }
5290
5467
  function SettingsSession(props) {
5291
5468
  const latest = useRef10(props);
5292
5469
  const watermark = useRef10(props.revision);
5293
- useLayoutEffect11(() => {
5470
+ useLayoutEffect12(() => {
5294
5471
  latest.current = props;
5295
5472
  watermark.current = Math.max(watermark.current, props.revision);
5296
5473
  });
@@ -5299,7 +5476,7 @@ function SettingsSession(props) {
5299
5476
  const instanceId = useId10();
5300
5477
  const [pending, setPending] = useState11([]);
5301
5478
  const [feedback, setFeedback] = useState11({});
5302
- useLayoutEffect11(() => {
5479
+ useLayoutEffect12(() => {
5303
5480
  const active = requests.current;
5304
5481
  return () => {
5305
5482
  for (const controller of active.values())
@@ -5359,7 +5536,7 @@ function SettingsSession(props) {
5359
5536
  }
5360
5537
  }
5361
5538
  }
5362
- return /* @__PURE__ */ jsx16("div", {
5539
+ return /* @__PURE__ */ jsx15("div", {
5363
5540
  className: cn("chat-composer-toolbar", props.className),
5364
5541
  role: "group",
5365
5542
  "aria-label": props.label ?? "Composer settings",
@@ -5369,7 +5546,7 @@ function SettingsSession(props) {
5369
5546
  const description = busy ? "Change pending" : feedback[setting.id] || setting.unavailableReason;
5370
5547
  return /* @__PURE__ */ jsxs13("div", {
5371
5548
  children: [
5372
- /* @__PURE__ */ jsx16(Select, {
5549
+ /* @__PURE__ */ jsx15(Select, {
5373
5550
  "aria-label": setting.label,
5374
5551
  "aria-describedby": description ? descriptionId : undefined,
5375
5552
  value: setting.value,
@@ -5385,7 +5562,7 @@ function SettingsSession(props) {
5385
5562
  request(setting.id, value);
5386
5563
  }
5387
5564
  }),
5388
- description ? /* @__PURE__ */ jsx16("p", {
5565
+ description ? /* @__PURE__ */ jsx15("p", {
5389
5566
  id: descriptionId,
5390
5567
  className: "chat-composer-status",
5391
5568
  role: "status",