@vivix-labs/studio-workbench 1.0.0-beta.10 → 1.0.0-beta.12

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.
@@ -450,21 +450,30 @@ function IconButton({ icon, variant = "icon-ghost-sm", ...props }) {
450
450
  }
451
451
 
452
452
  // packages/ui-system/dist/asset-selection-toolbar.js
453
- import { jsxs as _jsxs2, jsx as _jsx4 } from "react/jsx-runtime";
454
- function AssetSelectionToolbar({ count, allSelected, onSelectAll, onFavorite, onDownload, onDelete, deleteHint, onCancel, cancelRef, busy }) {
453
+ import { jsxs as _jsxs2, jsx as _jsx4, Fragment as _Fragment } from "react/jsx-runtime";
454
+ function AssetSelectionToolbar({ count, allSelected, label = "Selected asset actions", showAssetActions = true, onSelectAll, onFavorite, onDownload, onDelete, deleteHint, onCancel, cancelRef, busy }) {
455
455
  const common = { variant: "text-tonal-sm", width: "hug" };
456
- return _jsxs2("div", { className: "vx-asset-selection", role: "group", "aria-label": "Selected asset actions", children: [_jsxs2("span", { role: "status", children: [count, " ", count === 1 ? "item" : "items", " selected"] }), _jsx4(Button, { ...common, label: "Select all", leadingIcon: "select-items", "aria-pressed": allSelected, disabled: busy || !onSelectAll, onClick: onSelectAll }), _jsx4("i", { "aria-hidden": "true" }), _jsx4(Button, { ...common, label: "Favorite", leadingIcon: "favorite", disabled: busy || !onFavorite, onClick: onFavorite }), _jsx4(Button, { ...common, label: "Download", leadingIcon: "download", disabled: busy || !onDownload, onClick: onDownload }), _jsx4(Button, { ...common, label: "Delete", leadingIcon: "delete", title: deleteHint, disabled: busy || !onDelete, onClick: onDelete }), _jsx4("i", { "aria-hidden": "true" }), _jsx4(Button, { ...common, ref: cancelRef, label: "Cancel", leadingIcon: "close", disabled: busy, onClick: onCancel })] });
456
+ return _jsxs2("div", { className: "vx-asset-selection", role: "group", "aria-label": label, children: [_jsxs2("span", { role: "status", children: [count, " ", count === 1 ? "item" : "items", " selected"] }), _jsx4(Button, { ...common, label: "Select all", leadingIcon: "select-items", "aria-pressed": allSelected, disabled: busy || !onSelectAll, onClick: onSelectAll }), showAssetActions && _jsxs2(_Fragment, { children: [_jsx4("i", { "aria-hidden": "true" }), _jsx4(Button, { ...common, label: "Favorite", leadingIcon: "favorite", disabled: busy || !onFavorite, onClick: onFavorite }), _jsx4(Button, { ...common, label: "Download", leadingIcon: "download", disabled: busy || !onDownload, onClick: onDownload }), _jsx4(Button, { ...common, label: "Delete", leadingIcon: "delete", title: deleteHint, disabled: busy || !onDelete, onClick: onDelete })] }), _jsx4("i", { "aria-hidden": "true" }), _jsx4(Button, { ...common, ref: cancelRef, label: "Cancel", leadingIcon: "close", disabled: busy, onClick: onCancel })] });
457
+ }
458
+
459
+ // packages/ui-system/dist/asset-reference-row.js
460
+ import { Fragment as _Fragment2, jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
461
+ function AssetReferenceRow({ references, renderThumbnail, className = "" }) {
462
+ if (!references.length)
463
+ return _jsx5(_Fragment2, { children: "--" });
464
+ const remaining = references.length - 2;
465
+ return _jsxs3("span", { className: `vx-asset-reference-row ${className}`.trimEnd(), children: [references.slice(0, 2).map(renderThumbnail), remaining > 0 && _jsxs3("span", { className: "vx-asset-reference-count", title: `${remaining} more ${remaining === 1 ? "reference" : "references"}`, children: ["+", remaining] })] });
457
466
  }
458
467
 
459
468
  // packages/ui-system/dist/asset-tile-caption.js
460
- import { jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
469
+ import { jsx as _jsx6, jsxs as _jsxs4 } from "react/jsx-runtime";
461
470
  function AssetTileCaption({ title, facts, status, actions, onOpen, disabled }) {
462
471
  const details = facts.filter((fact) => typeof fact === "string" && Boolean(fact.trim()));
463
- return _jsxs3("div", { className: "vx-tile-caption", children: [onOpen ? _jsx5("button", { type: "button", className: "vx-tile-title", title, onClick: onOpen, disabled, children: title }) : _jsx5("strong", { className: "vx-tile-title", title, children: title }), actions, _jsxs3("div", { className: "vx-tile-facts", title: details.join(" \xB7 "), children: [status, details.map((detail, i) => _jsx5("span", { children: detail }, i))] })] });
472
+ return _jsxs4("div", { className: "vx-tile-caption", children: [onOpen ? _jsx6("button", { type: "button", className: "vx-tile-title", title, onClick: onOpen, disabled, children: title }) : _jsx6("strong", { className: "vx-tile-title", title, children: title }), actions, _jsxs4("div", { className: "vx-tile-facts", title: details.join(" \xB7 "), children: [status, details.map((detail, i) => _jsx6("span", { children: detail }, i))] })] });
464
473
  }
465
474
 
466
475
  // packages/ui-system/dist/script-cover.js
467
- import { jsx as _jsx6, jsxs as _jsxs4 } from "react/jsx-runtime";
476
+ import { jsx as _jsx7, jsxs as _jsxs5 } from "react/jsx-runtime";
468
477
  import { useEffect, useState } from "react";
469
478
  async function readTextExcerpt(response, signal, maxBytes = 1024) {
470
479
  if (!response.ok || !response.body)
@@ -514,14 +523,14 @@ function ScriptCover({ title, synopsis, src }) {
514
523
  return () => controller.abort();
515
524
  }, [src, synopsis]);
516
525
  const text = synopsis || (src && excerpt?.src === src ? excerpt.text : "");
517
- return _jsx6("span", { className: "vx-script-cover", "aria-label": title, children: _jsxs4("span", { className: "vx-script-sheet", children: [_jsx6("strong", { children: title }), _jsx6("span", { children: text })] }) });
526
+ return _jsx7("span", { className: "vx-script-cover", "aria-label": title, children: _jsxs5("span", { className: "vx-script-sheet", children: [_jsx7("strong", { children: title }), _jsx7("span", { children: text })] }) });
518
527
  }
519
528
 
520
529
  // packages/ui-system/dist/cover-preview.js
521
- import { jsx as _jsx7 } from "react/jsx-runtime";
530
+ import { jsx as _jsx8 } from "react/jsx-runtime";
522
531
  import { useState as useState2 } from "react";
523
532
  function CoverPreview(props) {
524
- return _jsx7(Preview, { ...props }, JSON.stringify([props.kind, props.src]));
533
+ return _jsx8(Preview, { ...props }, JSON.stringify([props.kind, props.src]));
525
534
  }
526
535
  function Preview({ className, ref, kind: kind2 = "image", src, pending, iconSize = 20, children }) {
527
536
  const [mediaState, setMediaState] = useState2("loading");
@@ -530,23 +539,27 @@ function Preview({ className, ref, kind: kind2 = "image", src, pending, iconSize
530
539
  const iconKind = kind2 === "video" || kind2 === "audio" ? kind2 : kind2 === "text" ? "script" : "image";
531
540
  const ready = () => setMediaState("ready");
532
541
  const failed = () => setMediaState("empty");
533
- return _jsx7("span", { ref, className: `vx-cover-preview ${className}`, "data-cover-state": state, "aria-hidden": "true", children: state === "empty" ? _jsx7(Icon, { name: `placeholder-${iconKind}`, size: iconSize }) : !pending && media ? kind2 === "video" ? _jsx7("video", { src, muted: true, playsInline: true, preload: "auto", onLoadedData: ready, onError: failed }) : _jsx7("img", { src, alt: "", loading: "lazy", onLoad: ready, onError: failed }) : state === "ready" ? children : null });
542
+ return _jsx8("span", { ref, className: `vx-cover-preview ${className}`, "data-cover-state": state, "aria-hidden": "true", children: state === "empty" ? _jsx8(Icon, { name: `placeholder-${iconKind}`, size: iconSize }) : !pending && media ? kind2 === "video" ? _jsx8("video", { src, muted: true, playsInline: true, preload: "auto", onLoadedData: ready, onError: failed }) : _jsx8("img", { src, alt: "", loading: "lazy", onLoad: ready, onError: failed }) : state === "ready" ? children : null });
534
543
  }
535
544
 
536
545
  // packages/ui-system/dist/checkbox.js
537
- import { jsx as _jsx8, jsxs as _jsxs5 } from "react/jsx-runtime";
546
+ import { jsx as _jsx9, jsxs as _jsxs6 } from "react/jsx-runtime";
538
547
  function Checkbox({ label, checked, onCheckedChange, hideLabel = false, appearance = "default", ...props }) {
539
- return _jsxs5("label", { className: "vx-checkbox", "data-appearance": appearance, "data-label-hidden": hideLabel || void 0, children: [_jsx8("input", { ...props, className: "vx-checkbox-input", type: "checkbox", "aria-label": hideLabel ? label : void 0, checked, onChange: (event2) => onCheckedChange(event2.currentTarget.checked) }), _jsx8("span", { className: "vx-checkbox-mark", "aria-hidden": "true", children: _jsx8(Icon, { name: appearance === "on-content" ? "check-on-content" : "check" }) }), !hideLabel && label] });
548
+ return _jsxs6("label", { className: "vx-checkbox", "data-appearance": appearance, "data-label-hidden": hideLabel || void 0, children: [_jsx9("input", { ...props, className: "vx-checkbox-input", type: "checkbox", "aria-label": hideLabel ? label : void 0, checked, onChange: (event2) => onCheckedChange(event2.currentTarget.checked) }), _jsx9("span", { className: "vx-checkbox-mark", "aria-hidden": "true", children: _jsx9(Icon, { name: appearance === "on-content" ? "check-on-content" : "check" }) }), !hideLabel && label] });
540
549
  }
541
550
 
542
551
  // packages/ui-system/dist/dropdown.js
543
- import { jsx as _jsx9, jsxs as _jsxs6 } from "react/jsx-runtime";
552
+ import { jsx as _jsx10, jsxs as _jsxs7 } from "react/jsx-runtime";
544
553
  import { useEffect as useEffect2, useId, useLayoutEffect, useRef, useState as useState3 } from "react";
545
- function Dropdown({ label, options, value, onValueChange, placeholder = "Select an option", size = "medium", width = "fixed", appearance = "default", textSize = 14, disabled = false }) {
554
+ function optionIcon(icon) {
555
+ return typeof icon === "string" ? _jsx10(Icon, { name: icon }) : icon;
556
+ }
557
+ function Dropdown({ label, options, value, onValueChange, placeholder = "Select an option", size = "medium", width = "fixed", appearance = "default", textSize = 14, floating = false, disabled = false }) {
546
558
  const id = useId();
547
559
  const trigger = useRef(null);
548
560
  const list = useRef(null);
549
561
  const heading = appearance === "heading";
562
+ const popover = heading || floating;
550
563
  const activeOption = useRef(null);
551
564
  const search = useRef({ query: "", time: 0 });
552
565
  const [open, setOpen] = useState3(false);
@@ -560,7 +573,7 @@ function Dropdown({ label, options, value, onValueChange, placeholder = "Select
560
573
  useLayoutEffect(() => {
561
574
  const anchor2 = trigger.current;
562
575
  const popup = list.current;
563
- if (!expanded || !heading || !popup || !anchor2)
576
+ if (!expanded || !popover || !popup || !anchor2)
564
577
  return;
565
578
  const win = anchor2.ownerDocument.defaultView;
566
579
  popup.showPopover?.();
@@ -575,6 +588,8 @@ function Dropdown({ label, options, value, onValueChange, placeholder = "Select
575
588
  const above = box.top - gap - margin;
576
589
  const up = below < Math.min(popup.scrollHeight, 240) && above > below;
577
590
  popup.style.maxHeight = Math.max(0, Math.min(240, up ? above : below)) + "px";
591
+ if (floating)
592
+ popup.style.width = box.width + "px";
578
593
  const size2 = popup.getBoundingClientRect();
579
594
  popup.style.left = Math.max(margin, Math.min(box.left, width2 - size2.width - margin)) + "px";
580
595
  popup.style.top = (up ? box.top - gap - size2.height : box.bottom + gap) + "px";
@@ -587,7 +602,7 @@ function Dropdown({ label, options, value, onValueChange, placeholder = "Select
587
602
  win.removeEventListener("resize", place);
588
603
  win.removeEventListener("scroll", place, true);
589
604
  };
590
- }, [expanded, heading]);
605
+ }, [expanded, floating, popover]);
591
606
  useEffect2(() => {
592
607
  if (expanded)
593
608
  activeOption.current?.scrollIntoView({ block: "nearest" });
@@ -667,14 +682,14 @@ function Dropdown({ label, options, value, onValueChange, placeholder = "Select
667
682
  if (match)
668
683
  setHighlighted(match.value);
669
684
  }
670
- return _jsxs6("div", { className: "vx-dropdown", "data-size": size, "data-width": width, "data-appearance": appearance, "data-text-size": textSize, children: [_jsxs6("button", { type: "button", ref: trigger, role: "combobox", className: "vx-dropdown-trigger", "aria-label": label, "aria-expanded": expanded, "aria-controls": `${id}-listbox`, "aria-activedescendant": expanded && active ? `${id}-option-${options.indexOf(active)}` : void 0, disabled: !canOpen, onClick: () => expanded ? close() : setOpen(true), onBlur: close, onKeyDown: handleKey, children: [_jsxs6("span", { className: "vx-dropdown-value", children: [selected?.icon && _jsx9(Icon, { name: selected.icon }), _jsx9("span", { children: selected?.triggerLabel ?? selected?.label ?? placeholder })] }), _jsx9(Icon, { name: expanded ? "chevron-up" : "chevron-down" })] }), _jsx9("ul", { ref: list, popover: heading ? "manual" : void 0, id: `${id}-listbox`, role: "listbox", "aria-label": label, hidden: !expanded, children: options.map((option, index) => _jsxs6("li", { id: `${id}-option-${index}`, ref: active === option ? activeOption : void 0, role: "option", "aria-selected": option.value === value, "aria-disabled": option.disabled || void 0, "data-active": active === option, onMouseDown: (event2) => event2.preventDefault(), onClick: () => {
685
+ return _jsxs7("div", { className: "vx-dropdown", "data-size": size, "data-width": width, "data-appearance": appearance, "data-text-size": textSize, "data-floating": floating || void 0, children: [_jsxs7("button", { type: "button", ref: trigger, role: "combobox", className: "vx-dropdown-trigger", "aria-label": label, "aria-expanded": expanded, "aria-controls": `${id}-listbox`, "aria-activedescendant": expanded && active ? `${id}-option-${options.indexOf(active)}` : void 0, disabled: !canOpen, onClick: () => expanded ? close() : setOpen(true), onBlur: close, onKeyDown: handleKey, children: [_jsxs7("span", { className: "vx-dropdown-value", children: [optionIcon(selected?.icon), _jsx10("span", { children: selected?.triggerLabel ?? selected?.label ?? placeholder })] }), _jsx10(Icon, { name: expanded ? "chevron-up" : "chevron-down" })] }), _jsx10("ul", { ref: list, popover: popover ? "manual" : void 0, id: `${id}-listbox`, role: "listbox", "aria-label": label, hidden: !expanded, children: options.map((option, index) => _jsxs7("li", { id: `${id}-option-${index}`, ref: active === option ? activeOption : void 0, role: "option", "aria-selected": option.value === value, "aria-disabled": option.disabled || void 0, "data-active": active === option, onMouseDown: (event2) => event2.preventDefault(), onClick: () => {
671
686
  if (!option.disabled)
672
687
  choose(option);
673
- }, children: [option.icon && _jsx9(Icon, { name: option.icon }), option.label, width === "hug" && option.value === value && _jsx9(Icon, { name: "check" })] }, option.value)) })] });
688
+ }, children: [optionIcon(option.icon), option.label, width === "hug" && option.value === value && _jsx10(Icon, { name: "check" })] }, option.value)) })] });
674
689
  }
675
690
 
676
691
  // packages/ui-system/dist/tabs.js
677
- import { jsx as _jsx10, jsxs as _jsxs7 } from "react/jsx-runtime";
692
+ import { jsx as _jsx11, jsxs as _jsxs8 } from "react/jsx-runtime";
678
693
  import { useId as useId2 } from "react";
679
694
  function Tabs({ label, items, value, onValueChange, variant = "primary", actions }) {
680
695
  const id = useId2();
@@ -695,51 +710,60 @@ function Tabs({ label, items, value, onValueChange, variant = "primary", actions
695
710
  if (next.value !== value)
696
711
  onValueChange(next.value);
697
712
  }
698
- return _jsxs7("div", { children: [_jsxs7("div", { className: "vx-tabs", "data-variant": variant, children: [_jsx10("div", { role: "tablist", "aria-label": label, className: "vx-tab-list", children: items.map((item, index) => _jsx10("button", { type: "button", role: "tab", id: `${id}-tab-${index}`, "aria-controls": `${id}-panel-${index}`, "aria-selected": item === selected, disabled: item.disabled, tabIndex: item === selected ? 0 : -1, onClick: () => {
713
+ return _jsxs8("div", { children: [_jsxs8("div", { className: "vx-tabs", "data-variant": variant, children: [_jsx11("div", { role: "tablist", "aria-label": label, className: "vx-tab-list", children: items.map((item, index) => _jsx11("button", { type: "button", role: "tab", id: `${id}-tab-${index}`, "aria-controls": `${id}-panel-${index}`, "aria-selected": item === selected, disabled: item.disabled, tabIndex: item === selected ? 0 : -1, onClick: () => {
699
714
  if (item.value !== value)
700
715
  onValueChange(item.value);
701
- }, onKeyDown: (event2) => moveFocus(event2, item), children: item.label }, item.value)) }), actions && _jsx10("div", { className: "vx-tabs-actions", children: actions })] }), items.map((item, index) => _jsx10("div", { role: "tabpanel", id: `${id}-panel-${index}`, "aria-labelledby": `${id}-tab-${index}`, hidden: item !== selected, tabIndex: 0, children: item.panel }, item.value))] });
716
+ }, onKeyDown: (event2) => moveFocus(event2, item), children: item.label }, item.value)) }), actions && _jsx11("div", { className: "vx-tabs-actions", children: actions })] }), items.map((item, index) => _jsx11("div", { role: "tabpanel", id: `${id}-panel-${index}`, "aria-labelledby": `${id}-tab-${index}`, hidden: item !== selected, tabIndex: 0, children: item.panel }, item.value))] });
702
717
  }
703
718
 
704
719
  // packages/ui-system/dist/segmented-control.js
705
- import { jsx as _jsx11, jsxs as _jsxs8 } from "react/jsx-runtime";
720
+ import { jsx as _jsx12, jsxs as _jsxs9 } from "react/jsx-runtime";
706
721
  import { useId as useId3 } from "react";
707
722
  function SegmentedControl({ label, items, value, onValueChange, size = "medium", width = "fixed", iconOnly = false }) {
708
723
  const id = useId3();
709
- return _jsx11("div", { role: "radiogroup", "aria-label": label, className: "vx-segment", "data-size": size, "data-width": width, "data-icon-only": iconOnly, children: items.map((item) => _jsxs8("label", { children: [_jsx11("input", { type: "radio", name: id, value: item.value, disabled: item.disabled, checked: item.value === value, "aria-label": item.label, onChange: () => onValueChange(item.value) }), _jsxs8("span", { className: "vx-segment-item", children: [item.icon && _jsx11(Icon, { name: item.icon }), (!iconOnly || !item.icon) && item.label] })] }, item.value)) });
724
+ return _jsx12("div", { role: "radiogroup", "aria-label": label, className: "vx-segment", "data-size": size, "data-width": width, "data-icon-only": iconOnly, children: items.map((item) => _jsxs9("label", { children: [_jsx12("input", { type: "radio", name: id, value: item.value, disabled: item.disabled, checked: item.value === value, "aria-label": item.label, onChange: () => onValueChange(item.value) }), _jsxs9("span", { className: "vx-segment-item", children: [item.icon && _jsx12(Icon, { name: item.icon }), (!iconOnly || !item.icon) && item.label] })] }, item.value)) });
710
725
  }
711
726
 
712
727
  // packages/ui-system/dist/input.js
713
- import { jsx as _jsx12, jsxs as _jsxs9 } from "react/jsx-runtime";
714
- function TextInput({ label, value, onValueChange, size = "medium", appearance = "default", ...props }) {
715
- return _jsxs9("label", { className: "vx-field", "data-size": size, "data-appearance": appearance, children: [_jsx12("span", { children: label }), _jsx12("input", { ...props, type: "text", value, onChange: (event2) => onValueChange(event2.currentTarget.value) })] });
728
+ import { jsx as _jsx13, jsxs as _jsxs10 } from "react/jsx-runtime";
729
+ function TextInput({ label, value, onValueChange, size = "medium", appearance = "default", placeholder, ...props }) {
730
+ return _jsxs10("label", { className: "vx-field", "data-size": size, "data-appearance": appearance, children: [_jsx13("span", { children: label }), _jsx13("input", { ...props, type: "text", placeholder: placeholder ?? (props.readOnly ? void 0 : "Enter text"), value, onChange: (event2) => onValueChange(event2.currentTarget.value) })] });
716
731
  }
717
732
 
718
733
  // packages/ui-system/dist/tag.js
719
- import { jsx as _jsx13 } from "react/jsx-runtime";
734
+ import { jsx as _jsx14 } from "react/jsx-runtime";
720
735
  function Tag({ children, variant = "overlay", className }) {
721
- return _jsx13("span", { className: className ? `vx-tag ${className}` : "vx-tag", "data-variant": variant, children });
736
+ return _jsx14("span", { className: className ? `vx-tag ${className}` : "vx-tag", "data-variant": variant, children });
722
737
  }
723
738
 
724
739
  // packages/ui-system/dist/dialog.js
725
- import { jsx as _jsx14, jsxs as _jsxs10, Fragment as _Fragment } from "react/jsx-runtime";
740
+ import { jsx as _jsx15, jsxs as _jsxs11, Fragment as _Fragment3 } from "react/jsx-runtime";
726
741
  import { useId as useId4, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState4 } from "react";
727
742
  import { createPortal } from "react-dom";
728
743
 
729
744
  // packages/ui-system/dist/dialog-surface.js
730
- function createDialogSurface(anchor2) {
745
+ var overlayOpeningEvent = "vx-overlay-opening";
746
+ function outerDialogDocument(anchor2) {
731
747
  const source = anchor2.ownerDocument;
732
- let target;
733
748
  try {
734
- target = source.defaultView?.top?.document ?? source;
749
+ const target = source.defaultView?.top?.document;
750
+ return target && target !== source ? target : void 0;
735
751
  } catch {
736
752
  return void 0;
737
753
  }
738
- if (target === source)
754
+ }
755
+ function createDialogSurface(anchor2) {
756
+ const source = anchor2.ownerDocument;
757
+ const target = outerDialogDocument(anchor2);
758
+ if (!target)
739
759
  return void 0;
740
760
  const host = target.createElement("div");
741
761
  host.dataset.studioDialogSurface = "";
742
762
  const shadow = host.attachShadow({ mode: "open" });
763
+ shadow.addEventListener("beforetoggle", (event2) => {
764
+ if (event2.newState === "open" && !event2.target.classList.contains("vx-toast"))
765
+ target.dispatchEvent(new Event(overlayOpeningEvent));
766
+ }, true);
743
767
  for (const original of source.querySelectorAll('link[rel="stylesheet"], style')) {
744
768
  const clone = original.cloneNode(true);
745
769
  if (original.tagName === "LINK")
@@ -775,13 +799,21 @@ function createDialogSurface(anchor2) {
775
799
  }
776
800
 
777
801
  // packages/ui-system/dist/dialog.js
778
- function Dialog({ title, open, onOpenChange, children, actions, className, variant = "default", focusTitleOnOpen = variant === "welcome" }) {
802
+ function useInlineDialog(anchor2) {
803
+ const [inline, setInline] = useState4(false);
804
+ useLayoutEffect2(() => {
805
+ if (anchor2.current)
806
+ setInline(!outerDialogDocument(anchor2.current));
807
+ }, [anchor2]);
808
+ return inline;
809
+ }
810
+ function Dialog({ title, open, onOpenChange, children, actions, className, inlineWhenClosed = false, variant = "default", closeOnEscape = true, focusTitleOnOpen = variant === "welcome" }) {
779
811
  const ref = useRef2(null);
780
812
  const anchor2 = useRef2(null);
781
813
  const [surface, setSurface] = useState4();
782
814
  const heading = useId4();
783
815
  useLayoutEffect2(() => {
784
- if (!open || !anchor2.current)
816
+ if (inlineWhenClosed || !open || !anchor2.current)
785
817
  return;
786
818
  const mounted = createDialogSurface(anchor2.current);
787
819
  const active = anchor2.current.getRootNode().activeElement;
@@ -794,9 +826,20 @@ function Dialog({ title, open, onOpenChange, children, actions, className, varia
794
826
  active.focus();
795
827
  });
796
828
  };
797
- }, [open]);
829
+ }, [open, inlineWhenClosed]);
798
830
  useLayoutEffect2(() => {
799
831
  const dialog2 = ref.current;
832
+ if (inlineWhenClosed && dialog2) {
833
+ if (open) {
834
+ dialog2.close();
835
+ dialog2.showModal();
836
+ } else {
837
+ if (dialog2.matches(":modal"))
838
+ dialog2.close();
839
+ dialog2.open = true;
840
+ }
841
+ return;
842
+ }
800
843
  if (!open || surface === void 0 || !dialog2)
801
844
  return;
802
845
  dialog2.showModal();
@@ -804,28 +847,94 @@ function Dialog({ title, open, onOpenChange, children, actions, className, varia
804
847
  if (dialog2.open)
805
848
  dialog2.close();
806
849
  };
807
- }, [open, surface]);
850
+ }, [open, surface, inlineWhenClosed]);
808
851
  const welcome = variant === "welcome";
809
- const closeButton = _jsx14(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) });
810
- const dialog = _jsxs10("dialog", { ref, className: className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, "aria-labelledby": heading, onCancel: (event2) => {
852
+ const closeButton = _jsx15(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) });
853
+ const dialog = _jsxs11("dialog", { ref, open: inlineWhenClosed || void 0, className: inlineWhenClosed && !open ? "vx-dialog vx-dialog-inline" : className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, role: inlineWhenClosed && !open ? "presentation" : void 0, "aria-labelledby": inlineWhenClosed && !open ? void 0 : heading, onCancel: (event2) => {
811
854
  event2.preventDefault();
812
855
  event2.stopPropagation();
813
- onOpenChange(false);
856
+ if (closeOnEscape)
857
+ onOpenChange(false);
814
858
  }, onClose: (event2) => {
815
859
  if (open && event2.currentTarget.isConnected && !event2.currentTarget.open)
816
860
  onOpenChange(false);
817
- }, children: [_jsxs10("header", { children: [_jsx14("h2", { id: heading, tabIndex: focusTitleOnOpen ? -1 : void 0, autoFocus: focusTitleOnOpen, children: title }), !welcome && closeButton] }), _jsx14("div", { className: "vx-dialog-body", children }), (actions || welcome) && _jsxs10("footer", { children: [actions, welcome && closeButton] })] });
818
- return _jsxs10(_Fragment, { children: [_jsx14("span", { ref: anchor2, hidden: true }), open && (surface ? createPortal(dialog, surface) : dialog)] });
861
+ }, children: [_jsxs11("header", { hidden: inlineWhenClosed && !open, children: [_jsx15("h2", { id: heading, tabIndex: focusTitleOnOpen ? -1 : void 0, autoFocus: focusTitleOnOpen, children: title }), !welcome && closeButton] }), _jsx15("div", { className: "vx-dialog-body", children }), (actions || welcome) && _jsxs11("footer", { hidden: inlineWhenClosed && !open, children: [actions, welcome && closeButton] })] });
862
+ return _jsxs11(_Fragment3, { children: [_jsx15("span", { ref: anchor2, hidden: true }), (open || inlineWhenClosed) && (surface ? createPortal(dialog, surface) : dialog)] });
819
863
  }
820
864
 
821
- // packages/ui-system/dist/menu.js
822
- import { jsx as _jsx15, jsxs as _jsxs11 } from "react/jsx-runtime";
823
- import { useEffect as useEffect3, useId as useId5, useLayoutEffect as useLayoutEffect3, useRef as useRef3, useState as useState5 } from "react";
865
+ // packages/ui-system/dist/toast.js
866
+ import { jsx as _jsx16, jsxs as _jsxs12, Fragment as _Fragment4 } from "react/jsx-runtime";
867
+ import { useCallback, useEffect as useEffect3, useLayoutEffect as useLayoutEffect3, useRef as useRef3, useState as useState5 } from "react";
824
868
  import { createPortal as createPortal2 } from "react-dom";
825
- function MenuPreview({ children }) {
869
+ function useToastMessage() {
870
+ const [message2, setMessage] = useState5("");
871
+ const timeout = useRef3(void 0);
872
+ useEffect3(() => () => clearTimeout(timeout.current), []);
873
+ const show = useCallback((text) => {
874
+ clearTimeout(timeout.current);
875
+ setMessage(text);
876
+ if (text)
877
+ timeout.current = setTimeout(() => setMessage(""), 2e3);
878
+ }, []);
879
+ return [message2, show];
880
+ }
881
+ function Toast({ message: message2, leading, className }) {
882
+ const anchor2 = useRef3(null);
826
883
  const ref = useRef3(null);
827
- const [visible, setVisible] = useState5(false);
828
- useEffect3(() => {
884
+ const [surface, setSurface] = useState5();
885
+ const visible = Boolean(message2);
886
+ useLayoutEffect3(() => {
887
+ if (!visible || !anchor2.current)
888
+ return;
889
+ const mounted = createDialogSurface(anchor2.current);
890
+ setSurface(mounted?.root ?? null);
891
+ return () => {
892
+ mounted?.dispose();
893
+ setSurface(void 0);
894
+ };
895
+ }, [visible]);
896
+ useLayoutEffect3(() => {
897
+ const toast = ref.current;
898
+ if (!toast || !visible)
899
+ return;
900
+ const doc = toast.ownerDocument;
901
+ const win = doc.defaultView;
902
+ let frame = 0;
903
+ const bringToFront = () => {
904
+ win.cancelAnimationFrame(frame);
905
+ frame = win.requestAnimationFrame(() => {
906
+ toast.hidePopover();
907
+ toast.showPopover();
908
+ });
909
+ };
910
+ function onOpening(event2) {
911
+ const target = event2.target;
912
+ if (event2.newState === "open" && !target.classList.contains("vx-toast"))
913
+ bringToFront();
914
+ }
915
+ toast.showPopover();
916
+ doc.addEventListener("beforetoggle", onOpening, true);
917
+ doc.addEventListener(overlayOpeningEvent, bringToFront);
918
+ doc.addEventListener("fullscreenchange", bringToFront);
919
+ return () => {
920
+ win.cancelAnimationFrame(frame);
921
+ doc.removeEventListener("beforetoggle", onOpening, true);
922
+ doc.removeEventListener(overlayOpeningEvent, bringToFront);
923
+ doc.removeEventListener("fullscreenchange", bringToFront);
924
+ };
925
+ }, [visible, surface]);
926
+ const notice = visible && surface !== void 0 && _jsxs12("div", { ref, popover: "manual", role: "status", "aria-atomic": "true", className: className ? `vx-toast ${className}` : "vx-toast", children: [leading, _jsx16("span", { children: message2 })] });
927
+ return _jsxs12(_Fragment4, { children: [_jsx16("span", { hidden: true, ref: anchor2 }), surface ? createPortal2(notice, surface) : notice] });
928
+ }
929
+
930
+ // packages/ui-system/dist/menu.js
931
+ import { jsx as _jsx17, jsxs as _jsxs13 } from "react/jsx-runtime";
932
+ import { useEffect as useEffect4, useId as useId5, useLayoutEffect as useLayoutEffect4, useRef as useRef4, useState as useState6 } from "react";
933
+ import { createPortal as createPortal3 } from "react-dom";
934
+ function MenuPreview({ children }) {
935
+ const ref = useRef4(null);
936
+ const [visible, setVisible] = useState6(false);
937
+ useEffect4(() => {
829
938
  const node = ref.current;
830
939
  if (!node)
831
940
  return;
@@ -838,23 +947,23 @@ function MenuPreview({ children }) {
838
947
  observer.observe(node);
839
948
  return () => observer.disconnect();
840
949
  }, []);
841
- return _jsx15("span", { ref, className: "vx-menu-preview", "aria-hidden": "true", children: visible && children });
950
+ return _jsx17("span", { ref, className: "vx-menu-preview", "aria-hidden": "true", children: visible && children });
842
951
  }
843
952
  function isEnabled(item) {
844
953
  return !item.disabled && item.items?.length !== 0;
845
954
  }
846
955
  function Menu({ label, items, triggerIcon, textTrigger = "dropdown", floating = false, cascading = false }) {
847
956
  const id = useId5();
848
- const trigger = useRef3(null);
849
- const popup = useRef3(null);
850
- const children = useRef3(/* @__PURE__ */ new Map());
851
- const focusOnOpen = useRef3(true);
957
+ const trigger = useRef4(null);
958
+ const popup = useRef4(null);
959
+ const children = useRef4(/* @__PURE__ */ new Map());
960
+ const focusOnOpen = useRef4(true);
852
961
  const cascade = floating && cascading;
853
- const focusIndex = useRef3(0);
854
- const [path, setPath] = useState5(null);
855
- const [placement, setPlacement] = useState5({ visibility: "hidden" });
962
+ const focusIndex = useRef4(0);
963
+ const [path, setPath] = useState6(null);
964
+ const [placement, setPlacement] = useState6({ visibility: "hidden" });
856
965
  const portalRoot = floating ? trigger.current?.closest("dialog, [data-vx-theme]") : null;
857
- useLayoutEffect3(() => {
966
+ useLayoutEffect4(() => {
858
967
  if (!floating || !path || !portalRoot)
859
968
  return;
860
969
  const position = () => {
@@ -931,7 +1040,7 @@ function Menu({ label, items, triggerIcon, textTrigger = "dropdown", floating =
931
1040
  function buttons(panel = cascade && path?.length ? children.current.get(path.length) : popup.current) {
932
1041
  return [...panel?.querySelectorAll("button:not(:disabled)") ?? []];
933
1042
  }
934
- useEffect3(() => {
1043
+ useEffect4(() => {
935
1044
  if (focusOnOpen.current && path && (!floating || !portalRoot || placement.visibility === "visible"))
936
1045
  buttons().at(focusIndex.current)?.focus();
937
1046
  }, [path, floating && placement.visibility, portalRoot]);
@@ -1025,7 +1134,7 @@ function Menu({ label, items, triggerIcon, textTrigger = "dropdown", floating =
1025
1134
  focusOnOpen.current = false;
1026
1135
  setPath(next);
1027
1136
  }
1028
- const menu = levels.map(({ entries: entries2, menuLabel: menuLabel2 }, depth) => !cascade && depth !== levels.length - 1 ? null : _jsx15("div", { ref: !cascade || depth === 0 ? popup : (el) => {
1137
+ const menu = levels.map(({ entries: entries2, menuLabel: menuLabel2 }, depth) => !cascade && depth !== levels.length - 1 ? null : _jsx17("div", { ref: !cascade || depth === 0 ? popup : (el) => {
1029
1138
  if (el)
1030
1139
  children.current.set(depth, el);
1031
1140
  else
@@ -1036,26 +1145,26 @@ function Menu({ label, items, triggerIcon, textTrigger = "dropdown", floating =
1036
1145
  visibility: "hidden",
1037
1146
  maxHeight: "min(480px, calc(100dvh - 16px))",
1038
1147
  zIndex: 100 + depth
1039
- } : placement : void 0, children: entries2.map((item) => _jsxs11("button", { type: "button", role: item.checked === void 0 ? "menuitem" : "menuitemcheckbox", "aria-checked": item.checked, "aria-haspopup": item.items?.length ? "menu" : void 0, "data-key": item.id, "aria-expanded": cascade && item.items ? path?.[depth] === item.id : void 0, onPointerEnter: cascade ? (e) => {
1148
+ } : placement : void 0, children: entries2.map((item) => _jsxs13("button", { type: "button", role: item.checked === void 0 ? "menuitem" : "menuitemcheckbox", "aria-checked": item.checked, "aria-haspopup": item.items?.length ? "menu" : void 0, "data-key": item.id, "aria-expanded": cascade && item.items ? path?.[depth] === item.id : void 0, onPointerEnter: cascade ? (e) => {
1040
1149
  if (e.pointerType !== "touch")
1041
1150
  hover(item, depth);
1042
- } : void 0, "data-size": item.size ?? "medium", "data-tone": item.tone, disabled: !isEnabled(item), tabIndex: -1, onClick: () => choose(item, depth), children: [item.icon && _jsx15(Icon, { name: item.icon }), path && item.preview && _jsx15(MenuPreview, { children: item.preview }), _jsx15("span", { className: "vx-menu-label", children: item.label }), item.checked && _jsx15(Icon, { name: "check" }), item.items?.length ? _jsx15(Icon, { name: "chevron-right" }) : null] }, item.id)) }, depth));
1043
- return _jsxs11("div", { className: "vx-action-menu", onBlur: (event2) => {
1151
+ } : void 0, "data-size": item.size ?? "medium", "data-tone": item.tone, disabled: !isEnabled(item), tabIndex: -1, onClick: () => choose(item, depth), children: [item.icon && _jsx17(Icon, { name: item.icon }), path && item.preview && _jsx17(MenuPreview, { children: item.preview }), _jsx17("span", { className: "vx-menu-label", children: item.label }), item.checked && _jsx17(Icon, { name: "check" }), item.items?.length ? _jsx17(Icon, { name: "chevron-right" }) : null] }, item.id)) }, depth));
1152
+ return _jsxs13("div", { className: "vx-action-menu", onBlur: (event2) => {
1044
1153
  if (!event2.currentTarget.contains(event2.relatedTarget) && !(floating && popup.current?.contains(event2.relatedTarget)) && ![...children.current.values()].some((panel) => panel.contains(event2.relatedTarget)))
1045
1154
  setPath(null);
1046
- }, children: [triggerIcon ? _jsx15(IconButton, { ref: trigger, label, icon: triggerIcon, variant: "icon-ghost-sm", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }) : _jsx15(Button, { ref: trigger, label, variant: textTrigger === "plain" ? "text-plain-sm" : "text-tonal-sm", trailingIcon: textTrigger === "dropdown" ? "chevron-down" : void 0, "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }), portalRoot ? createPortal2(menu, portalRoot) : menu] });
1155
+ }, children: [triggerIcon ? _jsx17(IconButton, { ref: trigger, label, icon: triggerIcon, variant: "icon-ghost-sm", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }) : _jsx17(Button, { ref: trigger, label, variant: textTrigger === "plain" ? "text-plain-sm" : "text-tonal-sm", trailingIcon: textTrigger === "dropdown" ? "chevron-down" : void 0, "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }), portalRoot ? createPortal3(menu, portalRoot) : menu] });
1047
1156
  }
1048
1157
 
1049
1158
  // packages/ui-system/dist/filter-menu.js
1050
- import { jsx as _jsx16, jsxs as _jsxs12, Fragment as _Fragment2 } from "react/jsx-runtime";
1051
- import { useId as useId6, useRef as useRef4, useState as useState6, useLayoutEffect as useLayoutEffect4 } from "react";
1159
+ import { jsx as _jsx18, jsxs as _jsxs14, Fragment as _Fragment5 } from "react/jsx-runtime";
1160
+ import { useId as useId6, useRef as useRef5, useState as useState7, useLayoutEffect as useLayoutEffect5 } from "react";
1052
1161
  function FilterMenu({ label, groups, value, onValueChange, leadingIcon = "filter" }) {
1053
1162
  const id = useId6();
1054
- const popup = useRef4(null);
1055
- const [expanded, setExpanded] = useState6(false);
1056
- const list = useRef4(null);
1057
- const [moreBelow, setMoreBelow] = useState6(false);
1058
- useLayoutEffect4(() => {
1163
+ const popup = useRef5(null);
1164
+ const [expanded, setExpanded] = useState7(false);
1165
+ const list = useRef5(null);
1166
+ const [moreBelow, setMoreBelow] = useState7(false);
1167
+ useLayoutEffect5(() => {
1059
1168
  const el = list.current;
1060
1169
  if (!el || !expanded)
1061
1170
  return;
@@ -1083,31 +1192,42 @@ function FilterMenu({ label, groups, value, onValueChange, leadingIcon = "filter
1083
1192
  function focusFirstGroup() {
1084
1193
  popup.current?.querySelector("summary")?.focus({ preventScroll: true });
1085
1194
  }
1086
- return _jsxs12(_Fragment2, { children: [_jsx16(Button, { label, badge: count, className: "vx-filter-trigger", width: "hug", variant: "text-tonal-sm", leadingIcon, trailingIcon: leadingIcon ? void 0 : "chevron-down", popoverTarget: id, "aria-controls": id, "aria-expanded": expanded, "aria-haspopup": "dialog", disabled: !sections.length }), _jsxs12("div", { ref: popup, id, className: "vx-filter-menu", popover: "auto", role: "dialog", "aria-label": label, onToggle: (event2) => {
1195
+ return _jsxs14(_Fragment5, { children: [_jsx18(Button, { label, badge: count, className: "vx-filter-trigger", width: "hug", variant: "text-tonal-sm", leadingIcon, trailingIcon: leadingIcon ? void 0 : "chevron-down", popoverTarget: id, "aria-controls": id, "aria-expanded": expanded, "aria-haspopup": "dialog", disabled: !sections.length }), _jsxs14("div", { ref: popup, id, className: "vx-filter-menu", popover: "auto", role: "dialog", "aria-label": label, onToggle: (event2) => {
1087
1196
  const open = event2.currentTarget.matches(":popover-open");
1088
1197
  setExpanded(open);
1089
1198
  if (open)
1090
1199
  focusFirstGroup();
1091
- }, children: [_jsx16("div", { className: "vx-filter-scroll", "data-more-below": moreBelow || void 0, children: _jsx16("div", { className: "vx-filter-groups", ref: list, children: sections.map(({ id: groupId, label: label2, options, optionLabels, selected, initiallyCollapsed }) => _jsxs12("details", { open: !initiallyCollapsed, children: [_jsxs12("summary", { children: [label2, _jsx16(Icon, { name: "chevron-down", size: 16 })] }), _jsx16("div", { className: "vx-filter-options", role: "group", "aria-label": label2, children: options.map(([option, optionLabel]) => _jsx16(Checkbox, { label: optionLabels?.[option] ?? optionLabel, checked: selected.includes(option), onCheckedChange: (checked) => onValueChange({
1200
+ }, children: [_jsx18("div", { className: "vx-filter-scroll", "data-more-below": moreBelow || void 0, children: _jsx18("div", { className: "vx-filter-groups", ref: list, children: sections.map(({ id: groupId, label: label2, options, optionLabels, selected, initiallyCollapsed }) => _jsxs14("details", { open: !initiallyCollapsed, children: [_jsxs14("summary", { children: [label2, _jsx18(Icon, { name: "chevron-down", size: 16 })] }), _jsx18("div", { className: "vx-filter-options", role: "group", "aria-label": label2, children: options.map(([option, optionLabel]) => _jsx18(Checkbox, { label: optionLabels?.[option] ?? optionLabel, checked: selected.includes(option), onCheckedChange: (checked) => onValueChange({
1092
1201
  ...value,
1093
1202
  [groupId]: checked ? [...selected, option] : selected.filter((item) => item !== option)
1094
- }) }, option)) })] }, groupId)) }) }), _jsx16("footer", { children: _jsx16(Button, { label: "Clear Filters", variant: "text-tonal-sm", disabled: !count, onClick: () => {
1203
+ }) }, option)) })] }, groupId)) }) }), _jsx18("footer", { children: _jsx18(Button, { label: "Clear Filters", variant: "text-tonal-sm", disabled: !count, onClick: () => {
1095
1204
  onValueChange({});
1096
1205
  focusFirstGroup();
1097
1206
  } }) })] })] });
1098
1207
  }
1099
1208
 
1100
1209
  // packages/ui-system/dist/media.js
1101
- import { jsx as _jsx17, Fragment as _Fragment3, jsxs as _jsxs13 } from "react/jsx-runtime";
1102
- import { useRef as useRef5, useState as useState7 } from "react";
1210
+ import { jsx as _jsx19, Fragment as _Fragment6, jsxs as _jsxs15 } from "react/jsx-runtime";
1211
+ import { useRef as useRef6, useState as useState8 } from "react";
1212
+ function AspectRatioIcon({ ratio: ratio2 }) {
1213
+ const dimensions = ratio2?.trim().match(/^(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)$/);
1214
+ if (!dimensions)
1215
+ return null;
1216
+ const width = Number(dimensions[1]);
1217
+ const height = Number(dimensions[2]);
1218
+ const scale = 12 / Math.max(width, height);
1219
+ if (!(width > 0 && height > 0 && scale > 0))
1220
+ return null;
1221
+ return _jsx19("span", { className: "vx-aspect-ratio-icon", "aria-hidden": "true", children: _jsx19("span", { style: { width: width * scale, height: height * scale } }) });
1222
+ }
1103
1223
  function MediaBadges({ label, duration, labelVariant }) {
1104
- return _jsxs13(_Fragment3, { children: [" ", label && _jsx17("span", { className: labelVariant === "selected" ? "vx-media-selected" : "vx-media-label", children: _jsx17(Tag, { variant: labelVariant, children: label }) }), duration && _jsx17("span", { className: "vx-media-duration", children: _jsx17(Tag, { children: duration }) })] });
1224
+ return _jsxs15(_Fragment6, { children: [" ", label && _jsx19("span", { className: labelVariant === "selected" ? "vx-media-selected" : "vx-media-label", children: _jsx19(Tag, { variant: labelVariant, children: label }) }), duration && _jsx19("span", { className: "vx-media-duration", children: _jsx19(Tag, { children: duration }) })] });
1105
1225
  }
1106
- function Media({ src, videoSrc, emptyLabel, script, alt, ratio: ratio2 = "16:9", state = "default", fit = "cover", emptyAppearance = "black", crop, label, labelVariant, duration, selectedLabel, selectionStyle = "outline", onSelect, onOpen }) {
1107
- const [failedImage, setFailedImage] = useState7();
1108
- const [failedVideo, setFailedVideo] = useState7();
1109
- const image = src !== failedImage ? src : void 0;
1226
+ function Media({ src, videoSrc, preferVideo = false, emptyLabel, script, alt, ratio: ratio2 = "16:9", state = "default", fit = "cover", emptyAppearance = "black", crop, label, labelVariant, duration, selectedLabel, selectionStyle = "outline", onSelect, onOpen }) {
1227
+ const [failedImage, setFailedImage] = useState8();
1228
+ const [failedVideo, setFailedVideo] = useState8();
1110
1229
  const video = videoSrc !== failedVideo ? videoSrc : void 0;
1230
+ const image = src !== failedImage && !(preferVideo && video) ? src : void 0;
1111
1231
  const selected = state === "selected";
1112
1232
  const busy = state === "loading" || state === "generating";
1113
1233
  const imageStyle = crop ? {
@@ -1119,7 +1239,7 @@ function Media({ src, videoSrc, emptyLabel, script, alt, ratio: ratio2 = "16:9",
1119
1239
  transform: `rotate(${crop.rotation ?? 0}deg)`,
1120
1240
  objectFit: "fill"
1121
1241
  } : { objectFit: fit };
1122
- const content = _jsxs13(_Fragment3, { children: [script ? _jsx17(ScriptCover, { ...script }) : image ? _jsx17("img", { src: image, alt, style: imageStyle, onError: () => setFailedImage(image) }, image) : video ? _jsx17("video", { src: video, preload: "metadata", muted: true, playsInline: true, "aria-hidden": "true", style: { objectFit: fit }, onError: () => setFailedVideo(video) }, video) : emptyAppearance !== "black" && emptyAppearance !== "surface" ? _jsx17(Icon, { name: `placeholder-${emptyAppearance}`, size: 20 }) : emptyLabel && !busy ? _jsx17("span", { className: "vx-media-empty-label", children: emptyLabel }) : null, _jsx17(MediaBadges, { label, labelVariant, duration }), selected && selectedLabel && _jsx17("span", { className: "vx-media-selected", children: _jsx17(Tag, { variant: "selected", children: "Selected" }) }), selectionStyle === "checkbox" && _jsx17("span", { className: "vx-media-marker", "aria-hidden": "true", children: selected && _jsx17(Icon, { name: "check", size: 12 }) }), busy && _jsx17("span", { className: "vx-media-progress", role: "status", children: state === "loading" ? "Loading" : "Generating" })] });
1242
+ const content = _jsxs15(_Fragment6, { children: [script ? _jsx19(ScriptCover, { ...script }) : image ? _jsx19("img", { src: image, alt, style: imageStyle, onError: () => setFailedImage(image) }, image) : video ? _jsx19("video", { src: video, preload: "metadata", muted: true, playsInline: true, "aria-hidden": "true", style: { objectFit: fit }, onError: () => setFailedVideo(video) }, video) : emptyAppearance !== "black" && emptyAppearance !== "surface" ? _jsx19(Icon, { name: `placeholder-${emptyAppearance}`, size: 20 }) : emptyLabel && !busy ? _jsx19("span", { className: "vx-media-empty-label", children: emptyLabel }) : null, _jsx19(MediaBadges, { label, labelVariant, duration }), selected && selectedLabel && _jsx19("span", { className: "vx-media-selected", children: _jsx19(Tag, { variant: "selected", children: "Selected" }) }), selectionStyle === "checkbox" && _jsx19("span", { className: "vx-media-marker", "aria-hidden": "true", children: selected && _jsx19(Icon, { name: "check", size: 12 }) }), busy && _jsx19("span", { className: "vx-media-progress", role: "status", children: state === "loading" ? "Loading" : "Generating" })] });
1123
1243
  const props = {
1124
1244
  className: "vx-media",
1125
1245
  "data-state": state,
@@ -1128,48 +1248,53 @@ function Media({ src, videoSrc, emptyLabel, script, alt, ratio: ratio2 = "16:9",
1128
1248
  "aria-busy": busy || void 0,
1129
1249
  style: { aspectRatio: ratio2.replace(":", " / ") }
1130
1250
  };
1131
- return onSelect || onOpen ? _jsx17("button", { ...props, type: "button", "aria-label": alt, "aria-pressed": onSelect ? selected : void 0, disabled: busy, onClick: () => onSelect ? onSelect(!selected) : onOpen?.(), children: content }) : _jsx17("div", { ...props, "aria-label": image ? void 0 : alt, children: content });
1251
+ return onSelect || onOpen ? _jsx19("button", { ...props, type: "button", "aria-label": alt, "aria-pressed": onSelect ? selected : void 0, disabled: busy, onClick: () => onSelect ? onSelect(!selected) : onOpen?.(), children: content }) : _jsx19("div", { ...props, "aria-label": image ? void 0 : alt, children: content });
1132
1252
  }
1133
1253
 
1134
1254
  // packages/ui-system/dist/video-player.js
1135
- import { jsx as _jsx18, jsxs as _jsxs14, Fragment as _Fragment4 } from "react/jsx-runtime";
1136
- import { useEffect as useEffect4, useRef as useRef6, useState as useState8 } from "react";
1255
+ import { jsx as _jsx20, jsxs as _jsxs16, Fragment as _Fragment7 } from "react/jsx-runtime";
1256
+ import { useEffect as useEffect5, useRef as useRef7, useState as useState9 } from "react";
1137
1257
  function timeLabel(seconds, padMinutes = false) {
1138
1258
  const whole = Math.floor(seconds);
1139
1259
  const minutes = String(Math.floor(whole / 60));
1140
1260
  return `${padMinutes ? minutes.padStart(2, "0") : minutes}:${String(whole % 60).padStart(2, "0")}`;
1141
1261
  }
1142
- function PlaybackControls({ playing, muted, time, duration, size = "medium", disabled, onTogglePlay, onToggleMute, onSeek, onFullscreen, fullscreenLabel = "Toggle fullscreen", actions, appearance = "on-content", timeDisplay = "combined" }) {
1143
- return _jsxs14("div", { className: "vx-playback-controls", role: "group", "aria-label": "Playback controls", "data-size": size, "data-appearance": appearance, style: {
1144
- "--vx-playback-progress": `${duration > 0 ? Math.min(100, Math.max(0, time / duration * 100)) : 0}%`
1145
- }, children: [_jsx18(IconButton, { icon: playing ? size === "large" ? "pause-large" : "pause" : size === "large" ? "playback-play-large" : "playback-play", label: playing ? "Pause" : "Play", disabled, onClick: onTogglePlay }), timeDisplay === "split" && _jsx18("span", { "aria-hidden": "true", "data-time": "elapsed", children: timeLabel(time, true) }), _jsx18("input", { "aria-label": "Playback position", "aria-valuetext": `${timeLabel(time)} of ${timeLabel(duration)}`, type: "range", min: 0, max: duration, value: time, step: "any", disabled: disabled || !duration, onChange: (event2) => onSeek(event2.currentTarget.valueAsNumber) }), _jsx18("span", { "aria-hidden": "true", "data-time": timeDisplay === "split" ? "duration" : void 0, children: timeDisplay === "split" ? timeLabel(duration, true) : `${timeLabel(time)} / ${timeLabel(duration)}` }), _jsx18(IconButton, { icon: muted ? size === "large" ? "mute-large" : "mute" : size === "large" ? "volume-large" : "volume", label: muted ? "Unmute" : "Mute", disabled, onClick: onToggleMute }), actions, onFullscreen && _jsx18(IconButton, { icon: size === "large" ? "fullscreen-large" : "fullscreen", label: fullscreenLabel, onClick: onFullscreen })] });
1262
+ function PlaybackControls({ playing, muted, time, duration, size = "medium", disabled, onTogglePlay, onToggleMute, onSeek, onFullscreen, fullscreenLabel = "Toggle fullscreen", actions, appearance = "on-content", timeDisplay = "combined", renderTimeline }) {
1263
+ const slider = _jsx20("input", { className: "vx-playback-range", "aria-label": "Playback position", "aria-valuetext": `${timeLabel(time)} of ${timeLabel(duration)}`, type: "range", min: 0, max: duration, value: time, step: "any", disabled: disabled || !duration, onChange: (event2) => onSeek(event2.currentTarget.valueAsNumber) });
1264
+ return _jsxs16("div", { className: "vx-playback-controls", role: "group", "aria-label": "Playback controls", "data-size": size, "data-appearance": appearance, style: {
1265
+ "--vx-playback-fraction": duration > 0 ? Math.min(1, Math.max(0, time / duration)) : 0
1266
+ }, children: [_jsx20(IconButton, { icon: playing ? size === "large" ? "pause-large" : "pause" : size === "large" ? "playback-play-large" : "playback-play", label: playing ? "Pause" : "Play", disabled, onClick: onTogglePlay }), timeDisplay === "split" && _jsx20("span", { "aria-hidden": "true", "data-time": "elapsed", children: timeLabel(time, true) }), renderTimeline ? renderTimeline(slider) : slider, _jsx20("span", { "aria-hidden": "true", "data-time": timeDisplay === "split" ? "duration" : void 0, children: timeDisplay === "split" ? timeLabel(duration, true) : `${timeLabel(time)} / ${timeLabel(duration)}` }), _jsx20(IconButton, { icon: muted ? size === "large" ? "mute-large" : "mute" : size === "large" ? "volume-large" : "volume", label: muted ? "Unmute" : "Mute", disabled, onClick: onToggleMute }), actions, onFullscreen && _jsx20(IconButton, { icon: size === "large" ? "fullscreen-large" : "fullscreen", label: fullscreenLabel, onClick: onFullscreen })] });
1146
1267
  }
1147
1268
  function VideoPlayer(props) {
1148
- return _jsx18(Playback, { ...props }, JSON.stringify([props.src, props.poster, props.posterDuration]));
1269
+ return _jsx20(Playback, { ...props }, JSON.stringify([props.src, props.poster, props.posterDuration]));
1149
1270
  }
1150
1271
  function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version, durationLabel, sceneLabel, defaultMuted = false, controlsPlacement = "overlay", fitContent = false, showCoverInfo = true, showCoverPlay = true, fitExpandedContent = false, controlsSize, controlsAppearance, timeDisplay, controlsActions, showFullscreen = true, fullscreenMode = "native", overlay, onBeforePlay, onStateChange, onTimeChange, onEnded, onError }) {
1151
- const root = useRef6(null);
1152
- const video = useRef6(null);
1153
- const position = useRef6(0);
1154
- const callbacks = useRef6({ onTimeChange, onStateChange, onEnded });
1155
- const [time, setTime] = useState8(0);
1156
- const [ratio2, setRatio] = useState8(16 / 9);
1157
- const [metadataDuration, setMetadataDuration] = useState8(0);
1158
- const [state, setState] = useState8("cover");
1159
- const [muted, setMuted] = useState8(defaultMuted);
1160
- const [expanded, setExpanded] = useState8(false);
1161
- const [inlineHeight, setInlineHeight] = useState8();
1162
- const restoreFocus = useRef6(false);
1163
- useEffect4(() => {
1272
+ const root = useRef7(null);
1273
+ const video = useRef7(null);
1274
+ const playbackEpoch = useRef7(0);
1275
+ const localDialog = useInlineDialog(root);
1276
+ const inlineDialog = fullscreenMode === "dialog" && localDialog;
1277
+ const position = useRef7(0);
1278
+ const callbacks = useRef7({ onTimeChange, onStateChange, onEnded });
1279
+ const [time, setTime] = useState9(0);
1280
+ const [ratio2, setRatio] = useState9();
1281
+ const [metadataDuration, setMetadataDuration] = useState9(0);
1282
+ const [state, setState] = useState9("cover");
1283
+ const [muted, setMuted] = useState9(defaultMuted);
1284
+ const [expanded, setExpanded] = useState9(false);
1285
+ const [inlineHeight, setInlineHeight] = useState9();
1286
+ const restoreFocus = useRef7(false);
1287
+ useEffect5(() => {
1164
1288
  if (!expanded && restoreFocus.current) {
1165
1289
  restoreFocus.current = false;
1166
1290
  root.current?.querySelector('button[aria-label="Expand video"]')?.focus();
1167
1291
  }
1168
1292
  }, [expanded]);
1169
- const restore = useRef6(void 0);
1293
+ const restore = useRef7(void 0);
1170
1294
  const stillDuration = poster && Number.isFinite(posterDuration) ? Math.max(0, posterDuration) : 0;
1171
1295
  const duration = src ? metadataDuration : stillDuration;
1172
- useEffect4(() => {
1296
+ const displayRatio = ratio2 ?? aspectRatio ?? 16 / 9;
1297
+ useEffect5(() => {
1173
1298
  const element = video.current;
1174
1299
  return () => {
1175
1300
  if (!element)
@@ -1178,7 +1303,7 @@ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version
1178
1303
  element.removeAttribute("src");
1179
1304
  element.load();
1180
1305
  };
1181
- }, [expanded, src]);
1306
+ }, [inlineDialog ? false : expanded, src, inlineDialog]);
1182
1307
  function updateTime(next) {
1183
1308
  position.current = next;
1184
1309
  setTime(next);
@@ -1188,10 +1313,10 @@ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version
1188
1313
  setState(next);
1189
1314
  onStateChange?.(next);
1190
1315
  }
1191
- useEffect4(() => {
1316
+ useEffect5(() => {
1192
1317
  callbacks.current = { onTimeChange, onStateChange, onEnded };
1193
1318
  }, [onTimeChange, onStateChange, onEnded]);
1194
- useEffect4(() => {
1319
+ useEffect5(() => {
1195
1320
  if (src || state !== "playing" || !duration)
1196
1321
  return;
1197
1322
  let previous = performance.now();
@@ -1212,7 +1337,15 @@ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version
1212
1337
  }
1213
1338
  return () => cancelAnimationFrame(frame);
1214
1339
  }, [src, state, duration]);
1340
+ function requestPlay(element, onRejected) {
1341
+ const epoch = playbackEpoch.current;
1342
+ void element.play().catch((error) => {
1343
+ if (epoch === playbackEpoch.current && video.current === element && element.isConnected)
1344
+ onRejected(error);
1345
+ });
1346
+ }
1215
1347
  function togglePlay() {
1348
+ playbackEpoch.current++;
1216
1349
  if (state === "playing") {
1217
1350
  if (video.current)
1218
1351
  video.current.pause();
@@ -1223,7 +1356,7 @@ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version
1223
1356
  if (onBeforePlay?.() === false)
1224
1357
  return;
1225
1358
  if (video.current)
1226
- void video.current.play().catch((error) => onError?.(error));
1359
+ requestPlay(video.current, (error) => onError?.(error));
1227
1360
  else if (duration) {
1228
1361
  if (position.current >= duration)
1229
1362
  updateTime(0);
@@ -1254,21 +1387,26 @@ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version
1254
1387
  }
1255
1388
  }
1256
1389
  function changeExpanded(next) {
1390
+ if (next)
1391
+ setInlineHeight(root.current?.getBoundingClientRect().height);
1392
+ else
1393
+ restoreFocus.current = true;
1394
+ if (inlineDialog) {
1395
+ setExpanded(next);
1396
+ return;
1397
+ }
1398
+ playbackEpoch.current++;
1257
1399
  const element = video.current;
1258
1400
  restore.current = {
1259
1401
  time: element?.currentTime ?? position.current,
1260
1402
  playing: element ? !element.paused : state === "playing",
1261
1403
  state
1262
1404
  };
1263
- if (next)
1264
- setInlineHeight(root.current?.getBoundingClientRect().height);
1265
- else
1266
- restoreFocus.current = true;
1267
1405
  element?.pause();
1268
1406
  setExpanded(next);
1269
1407
  }
1270
1408
  const fitted = fitContent || expanded && fitExpandedContent;
1271
- const player = _jsxs14("section", { ref: root, className: "vx-video-player", "aria-label": title, "data-fit": fitted ? "content" : void 0, style: fitted ? { "--vx-video-ratio": aspectRatio ?? ratio2 } : void 0, "data-placement": controlsPlacement, "data-controls-size": controlsSize, "data-state": state, children: [_jsxs14("div", { className: "vx-video-stage", style: aspectRatio ? { aspectRatio } : void 0, children: [src ? _jsx18("video", { ref: video, src, poster, muted, playsInline: true, preload: "metadata", onResize: (event2) => {
1409
+ const player = _jsxs16("section", { ref: root, className: "vx-video-player", "aria-label": title, "data-fit": fitted ? "content" : void 0, style: { "--vx-video-ratio": displayRatio }, "data-placement": controlsPlacement, "data-controls-size": controlsSize, "data-state": state, children: [_jsxs16("div", { className: "vx-video-stage", children: [src ? _jsx20("video", { ref: video, src, poster, muted, playsInline: true, preload: "metadata", onResize: (event2) => {
1272
1410
  const { videoWidth, videoHeight } = event2.currentTarget;
1273
1411
  if (videoWidth && videoHeight)
1274
1412
  setRatio(videoWidth / videoHeight);
@@ -1284,7 +1422,7 @@ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version
1284
1422
  updateTime(element.currentTime);
1285
1423
  restore.current = void 0;
1286
1424
  if (previous.playing)
1287
- void element.play().catch(() => changeState("paused"));
1425
+ requestPlay(element, () => changeState("paused"));
1288
1426
  else
1289
1427
  changeState(previous.state);
1290
1428
  }, onDurationChange: (event2) => {
@@ -1301,13 +1439,13 @@ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version
1301
1439
  }, onEnded, onError: (event2) => {
1302
1440
  if (event2.currentTarget.error)
1303
1441
  onError?.(event2.currentTarget.error);
1304
- } }) : poster && _jsx18("img", { src: poster, alt: "" }), overlay, state === "cover" && !fitted && _jsxs14("div", { className: "vx-video-cover", "data-plain": !showCoverInfo || void 0, children: [showCoverInfo && _jsxs14("div", { className: "vx-video-info", children: [_jsxs14("div", { className: "vx-video-title", children: [_jsx18("strong", { title, children: title }), version && _jsx18(Tag, { children: version })] }), (durationLabel || sceneLabel) && _jsxs14("div", { className: "vx-video-meta", children: [durationLabel && _jsx18("span", { children: durationLabel }), durationLabel && sceneLabel && _jsx18("span", { "aria-hidden": "true", children: "\xB7" }), sceneLabel && _jsx18("span", { children: sceneLabel })] })] }), showCoverPlay && (src || duration > 0) && _jsx18(IconButton, { icon: "play-cover", className: "vx-video-start", label: `Play ${title}`, variant: "icon-circle-lg", onClick: togglePlay })] })] }), _jsx18(PlaybackControls, { playing: state === "playing", muted, time: Math.min(time, duration), duration, disabled: !src && !duration, size: controlsSize, appearance: controlsAppearance, timeDisplay, actions: controlsActions, onTogglePlay: togglePlay, onToggleMute: () => setMuted(!muted), onSeek: seek, onFullscreen: showFullscreen && !(expanded && fitExpandedContent) ? () => void toggleFullscreen() : void 0, fullscreenLabel: fullscreenMode === "dialog" ? expanded ? "Close expanded video" : "Expand video" : void 0 })] });
1305
- return _jsxs14(_Fragment4, { children: [expanded ? _jsx18("div", { "aria-hidden": "true", style: { height: inlineHeight } }) : player, _jsx18(Dialog, { title, open: expanded, onOpenChange: changeExpanded, className: fitExpandedContent ? "vx-video-dialog vx-video-dialog-fit" : "vx-video-dialog", children: expanded && player })] });
1442
+ } }) : poster && _jsx20("img", { src: poster, alt: "" }), overlay, state === "cover" && !fitted && _jsxs16("div", { className: "vx-video-cover", "data-plain": !showCoverInfo || void 0, children: [showCoverInfo && _jsxs16("div", { className: "vx-video-info", children: [_jsxs16("div", { className: "vx-video-title", children: [_jsx20("strong", { title, children: title }), version && _jsx20(Tag, { children: version })] }), (durationLabel || sceneLabel) && _jsxs16("div", { className: "vx-video-meta", children: [durationLabel && _jsx20("span", { children: durationLabel }), durationLabel && sceneLabel && _jsx20("span", { "aria-hidden": "true", children: "\xB7" }), sceneLabel && _jsx20("span", { children: sceneLabel })] })] }), showCoverPlay && (src || duration > 0) && _jsx20(IconButton, { icon: "play-cover", className: "vx-video-start", label: `Play ${title}`, variant: "icon-circle-lg", onClick: togglePlay })] })] }), _jsx20(PlaybackControls, { playing: state === "playing", muted, time: Math.min(time, duration), duration, disabled: !src && !duration, size: controlsSize, appearance: controlsAppearance, timeDisplay, actions: controlsActions, onTogglePlay: togglePlay, onToggleMute: () => setMuted(!muted), onSeek: seek, onFullscreen: showFullscreen && !(expanded && fitExpandedContent) ? () => void toggleFullscreen() : void 0, fullscreenLabel: fullscreenMode === "dialog" ? expanded ? "Close expanded video" : "Expand video" : void 0 })] });
1443
+ return _jsxs16(_Fragment7, { children: [expanded ? _jsx20("div", { "aria-hidden": "true", style: { height: inlineHeight } }) : !inlineDialog && player, _jsx20(Dialog, { title, open: expanded, onOpenChange: changeExpanded, className: fitExpandedContent ? "vx-video-dialog vx-video-dialog-fit" : "vx-video-dialog", inlineWhenClosed: inlineDialog, children: (expanded || inlineDialog) && player })] });
1306
1444
  }
1307
1445
 
1308
1446
  // packages/ui-system/dist/workspace-theme.js
1309
- import { jsx as _jsx19, jsxs as _jsxs15 } from "react/jsx-runtime";
1310
- import { useEffect as useEffect5, useState as useState9 } from "react";
1447
+ import { jsx as _jsx21, jsxs as _jsxs17 } from "react/jsx-runtime";
1448
+ import { useEffect as useEffect6, useState as useState10 } from "react";
1311
1449
  var key = "vivix.studio.theme";
1312
1450
  var event = "vivix-studio-theme";
1313
1451
  function readPreference() {
@@ -1320,9 +1458,9 @@ function readPreference() {
1320
1458
  return "light";
1321
1459
  }
1322
1460
  function useWorkspaceTheme() {
1323
- const [preference, setPreference] = useState9(readPreference);
1324
- const [system, setSystem] = useState9(() => globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light");
1325
- useEffect5(() => {
1461
+ const [preference, setPreference] = useState10(readPreference);
1462
+ const [system, setSystem] = useState10(() => globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light");
1463
+ useEffect6(() => {
1326
1464
  const query = globalThis.matchMedia?.("(prefers-color-scheme: dark)");
1327
1465
  const synchronize = () => setPreference(readPreference());
1328
1466
  const systemChanged = () => setSystem(query?.matches ? "dark" : "light");
@@ -1346,24 +1484,23 @@ function useWorkspaceTheme() {
1346
1484
  return { theme: preference === "system" ? system : preference, preference, update };
1347
1485
  }
1348
1486
 
1487
+ // packages/ui-system/dist/duration.js
1488
+ function formatDurationSeconds(durationMs) {
1489
+ return (Math.round(durationMs / 100) / 10).toFixed(1);
1490
+ }
1491
+
1492
+ // packages/ui-system/dist/view-skeleton.js
1493
+ import { jsx as _jsx22, Fragment as _Fragment8, jsxs as _jsxs18 } from "react/jsx-runtime";
1494
+ function ViewSkeleton({ layout = "list", label = "Loading project", heading = true }) {
1495
+ const count = { list: 5, grid: 8, document: 1, preview: 1, compare: 2 }[layout];
1496
+ return _jsxs18("section", { className: "vx-view-skeleton", "data-layout": layout, role: "status", "aria-label": label, "aria-busy": "true", children: [heading && _jsx22("div", { className: "vx-skeleton-heading", "aria-hidden": "true" }), _jsx22("div", { className: "vx-skeleton-content", "aria-hidden": "true", children: Array.from({ length: count }, (_, index) => _jsxs18("div", { className: "vx-skeleton-item", children: [layout !== "document" && _jsx22("div", { className: "vx-skeleton-media" }), _jsxs18("div", { className: "vx-skeleton-copy", children: [_jsx22("span", {}), _jsx22("span", {}), layout === "document" && _jsxs18(_Fragment8, { children: [_jsx22("span", {}), _jsx22("span", {}), _jsx22("span", {})] })] })] }, index)) })] });
1497
+ }
1498
+
1349
1499
  // packages/studio-workbench/src/project-frame.tsx
1350
1500
  import * as React from "react";
1351
1501
  function ProjectSkeleton({ view }) {
1352
1502
  const layout = view === "compare" ? "compare" : !view || ["preview", "episode", "overview"].includes(view) ? "preview" : "list";
1353
- return /* @__PURE__ */ React.createElement(
1354
- "section",
1355
- {
1356
- className: "studio-project-skeleton",
1357
- role: "status",
1358
- "aria-label": "Loading project",
1359
- "data-layout": layout
1360
- },
1361
- /* @__PURE__ */ React.createElement("div", { className: "studio-skeleton-title", "aria-hidden": "true" }),
1362
- /* @__PURE__ */ React.createElement("div", { className: "studio-skeleton-panels", "aria-hidden": "true" }, Array.from(
1363
- { length: layout === "compare" ? 4 : layout === "preview" ? 3 : 1 },
1364
- (_, column2) => /* @__PURE__ */ React.createElement("div", { key: column2, className: "studio-skeleton-panel" }, layout !== "list" && /* @__PURE__ */ React.createElement("div", { className: "studio-skeleton-cover" }), Array.from({ length: layout === "list" ? 7 : 4 }, (_2, row) => /* @__PURE__ */ React.createElement("div", { className: "studio-skeleton-line", key: row })))
1365
- ))
1366
- );
1503
+ return /* @__PURE__ */ React.createElement(ViewSkeleton, { layout });
1367
1504
  }
1368
1505
  function ProjectFrame({
1369
1506
  frame,
@@ -1417,9 +1554,15 @@ function ProjectFrame({
1417
1554
  import { z as z5 } from "vivix-studio/sdk/shared";
1418
1555
 
1419
1556
  // packages/project-studio/src/cost.ts
1557
+ var creditsFormat = new Intl.NumberFormat("en-US", {
1558
+ minimumFractionDigits: 1,
1559
+ maximumFractionDigits: 1,
1560
+ useGrouping: false
1561
+ });
1420
1562
  function taskCostLabel(task) {
1421
1563
  const cost = task.cost;
1422
- if (cost?.status === "settled" && cost.credits != null) return `${cost.credits} credits`;
1564
+ if (cost?.status === "settled" && cost.credits != null)
1565
+ return `${creditsFormat.format(Number(cost.credits))} credits`;
1423
1566
  if (cost?.status === "pending") return "Pending settlement";
1424
1567
  return "-";
1425
1568
  }
@@ -1699,14 +1842,14 @@ function defaultView(source) {
1699
1842
  ] : source === "assets" ? [
1700
1843
  column("previewUrl", "Preview", 136, { role: "preview" }),
1701
1844
  column("name", "Title", 112, { role: "name" }),
1702
- column("subjectType", "Type", 94),
1703
- column("kind", "Format", 112),
1704
- column("refs", "Reference", 112),
1845
+ column("subjectType", "Type", 128),
1846
+ column("kind", "Format", 120),
1847
+ column("refs", "Reference", 128),
1705
1848
  column("prompt", "Prompt", 128),
1706
- column("scene", "Shot", 80),
1707
- column("aspectRatio", "Aspect Ratio", 112),
1708
- column("modelId", "Model", 112),
1709
- column("createdAt", "Created Time", 116, { format: "date" }),
1849
+ column("scene", "Shot", 128),
1850
+ column("aspectRatio", "Aspect Ratio", 128),
1851
+ column("modelId", "Model", 128),
1852
+ column("createdAt", "Created Time", 128, { format: "date" }),
1710
1853
  column("projectName", "Project", 180, { role: "project", visible: false }),
1711
1854
  column("purpose", "Purpose", 140, { visible: false })
1712
1855
  ] : [
@@ -1942,9 +2085,11 @@ function libraryQuery(source, viewId, filters, legacy = false) {
1942
2085
  conditions.push(expressions[category[1]] + " = :category");
1943
2086
  params.category = category[2];
1944
2087
  }
2088
+ let hasFilter = Boolean(filters.favorite?.length);
1945
2089
  for (const field of ["project", "format", "subject", "aspect", "model", "state"]) {
1946
2090
  const values = filters[field] ?? [];
1947
- if (!values.length) continue;
2091
+ if (!values.length || field === "state" && source !== "tasks") continue;
2092
+ hasFilter = true;
1948
2093
  const bindings = values.map((value, index) => {
1949
2094
  const key3 = field + index;
1950
2095
  params[key3] = field === "subject" ? value.toLowerCase() : value;
@@ -1957,7 +2102,7 @@ function libraryQuery(source, viewId, filters, legacy = false) {
1957
2102
  source === "assets" && (viewId === "default:favorites" || !!filters.favorite?.length),
1958
2103
  conditions
1959
2104
  );
1960
- const orderByProject = !legacy && source === "assets" && !sql.includes("studio_asset_versions") && Object.values(filters).some((values) => values?.length);
2105
+ const orderByProject = !legacy && source === "assets" && !sql.includes("studio_asset_versions") && hasFilter;
1961
2106
  return {
1962
2107
  sql: orderByProject ? sql.replace(
1963
2108
  "ORDER BY a.createdAt",
@@ -2146,15 +2291,41 @@ function QueryResults({
2146
2291
  renderCell,
2147
2292
  rowActions
2148
2293
  }) {
2294
+ const showActionColumn = route.page !== "assets" || !selecting;
2149
2295
  const libraryGrid = active.id?.startsWith("default:");
2296
+ const actionWidth = route.page === "assets" ? 80 : 100;
2297
+ const defaultAssets = route.page === "assets" && libraryGrid;
2298
+ const minTableWidth = defaultAssets ? visibleColumns.reduce(
2299
+ (width, column2) => width + column2.width,
2300
+ (selecting ? 48 : 0) + (showActionColumn ? actionWidth : 0)
2301
+ ) : void 0;
2302
+ if (queryLoading && rows.length === 0 && !failure) {
2303
+ return /* @__PURE__ */ React2.createElement(
2304
+ ViewSkeleton,
2305
+ {
2306
+ heading: false,
2307
+ layout: route.layout === "grid" ? "grid" : "list",
2308
+ label: `Loading ${route.page}`
2309
+ }
2310
+ );
2311
+ }
2150
2312
  return /* @__PURE__ */ React2.createElement("div", { className: "studio-results", "aria-busy": queryLoading }, route.layout === "list" ? /* @__PURE__ */ React2.createElement("div", { className: "studio-table-scroll" }, /* @__PURE__ */ React2.createElement(
2151
2313
  "table",
2152
2314
  {
2153
2315
  className: `studio-table studio-table-${route.page}`,
2154
- "aria-label": pageTitles[route.page]
2316
+ "aria-label": pageTitles[route.page],
2317
+ style: { minWidth: minTableWidth }
2155
2318
  },
2156
- /* @__PURE__ */ React2.createElement("colgroup", null, selecting && /* @__PURE__ */ React2.createElement("col", { style: { width: 48 } }), visibleColumns.map((column2) => /* @__PURE__ */ React2.createElement("col", { key: column2.path, style: { width: column2.width } })), /* @__PURE__ */ React2.createElement("col", { style: { width: 100 } })),
2157
- /* @__PURE__ */ React2.createElement("thead", null, /* @__PURE__ */ React2.createElement("tr", null, selecting && /* @__PURE__ */ React2.createElement("th", { scope: "col" }, "Select"), visibleColumns.map((column2) => /* @__PURE__ */ React2.createElement("th", { key: column2.path, scope: "col" }, column2.label ?? column2.path)), active.id !== "default:assets" && /* @__PURE__ */ React2.createElement("th", { scope: "col" }, "Action"))),
2319
+ /* @__PURE__ */ React2.createElement("colgroup", null, selecting && /* @__PURE__ */ React2.createElement("col", { style: { width: 48 } }), visibleColumns.map((column2) => /* @__PURE__ */ React2.createElement(
2320
+ "col",
2321
+ {
2322
+ key: column2.path,
2323
+ style: {
2324
+ width: defaultAssets && column2.role === "name" ? void 0 : column2.width
2325
+ }
2326
+ }
2327
+ )), showActionColumn && /* @__PURE__ */ React2.createElement("col", { style: { width: actionWidth } })),
2328
+ /* @__PURE__ */ React2.createElement("thead", null, /* @__PURE__ */ React2.createElement("tr", null, selecting && /* @__PURE__ */ React2.createElement("th", { scope: "col" }, "Select"), visibleColumns.map((column2) => /* @__PURE__ */ React2.createElement("th", { key: column2.path, scope: "col" }, column2.label ?? column2.path)), showActionColumn && /* @__PURE__ */ React2.createElement("th", { className: "studio-actions-cell", scope: "col" }, "Action"))),
2158
2329
  /* @__PURE__ */ React2.createElement("tbody", null, presentationRows(rows, active.view).map(({ row, renderKey }) => /* @__PURE__ */ React2.createElement(
2159
2330
  "tr",
2160
2331
  {
@@ -2176,15 +2347,16 @@ function QueryResults({
2176
2347
  Button,
2177
2348
  {
2178
2349
  className: "studio-row-name",
2350
+ title: rowTitle(row, active.view),
2179
2351
  label: rowTitle(row, active.view),
2180
2352
  variant: "text-tonal-sm",
2181
2353
  disabled: selecting ? !selectionKey(row) : !canOpen(row),
2182
2354
  onClick: () => selecting ? toggle(row) : openRow(row)
2183
2355
  }
2184
2356
  ) : renderCell(row, column2))),
2185
- active.id !== "default:assets" && /* @__PURE__ */ React2.createElement("td", null, !selecting && rowActions(row))
2357
+ showActionColumn && /* @__PURE__ */ React2.createElement("td", { className: "studio-actions-cell" }, !selecting && rowActions(row))
2186
2358
  )))
2187
- ), !rows.length && /* @__PURE__ */ React2.createElement("div", { className: "studio-empty", role: "status" }, queryLoading ? "Loading\u2026" : failure ? "The query could not be loaded." : route.page === "projects" ? "No matching projects." : route.page === "tasks" ? "No matching tasks." : "No assets.")) : /* @__PURE__ */ React2.createElement("div", { className: libraryGrid ? "studio-grid vx-asset-grid" : "studio-grid" }, presentationRows(rows, active.view).map(({ row, renderKey }) => /* @__PURE__ */ React2.createElement(
2359
+ ), !rows.length && /* @__PURE__ */ React2.createElement("div", { className: "studio-empty", role: "status" }, failure ? "The query could not be loaded." : route.page === "projects" ? "No matching projects." : route.page === "tasks" ? "No matching tasks." : "No assets.")) : /* @__PURE__ */ React2.createElement("div", { className: libraryGrid ? "studio-grid vx-asset-grid" : "studio-grid" }, presentationRows(rows, active.view).map(({ row, renderKey }) => /* @__PURE__ */ React2.createElement(
2188
2360
  "article",
2189
2361
  {
2190
2362
  key: renderKey,
@@ -2224,7 +2396,7 @@ function QueryResults({
2224
2396
  ), !selecting && rowActions(row)), route.page === "assets" && rowRef(row, active.view) ? /* @__PURE__ */ React2.createElement("div", { className: "studio-card-subtitle" }, visibleColumns.some((column2) => column2.format === "categories") ? visibleColumns.filter((column2) => column2.format === "categories").map((column2) => /* @__PURE__ */ React2.createElement(React2.Fragment, { key: column2.path }, renderCell(row, column2))) : columnText(row.kind)) : /* @__PURE__ */ React2.createElement("dl", null, visibleColumns.filter(
2225
2397
  (column2) => !column2.role || column2.role === "state" || column2.role === "project"
2226
2398
  ).map((column2) => /* @__PURE__ */ React2.createElement("div", { key: column2.path }, /* @__PURE__ */ React2.createElement("dt", null, column2.label ?? column2.path), /* @__PURE__ */ React2.createElement("dd", null, renderCell(row, column2))))))
2227
- )), !rows.length && /* @__PURE__ */ React2.createElement("div", { className: "studio-empty", role: "status" }, queryLoading ? "Loading\u2026" : failure ? "The query could not be loaded." : route.page === "projects" ? "No matching projects." : route.page === "tasks" ? "No matching tasks." : "No assets.")));
2399
+ )), !rows.length && /* @__PURE__ */ React2.createElement("div", { className: "studio-empty", role: "status" }, failure ? "The query could not be loaded." : route.page === "projects" ? "No matching projects." : route.page === "tasks" ? "No matching tasks." : "No assets.")));
2228
2400
  }
2229
2401
 
2230
2402
  // packages/studio-workbench/src/home.tsx
@@ -2573,7 +2745,7 @@ var CardBoundary = class extends React4.Component {
2573
2745
  };
2574
2746
  function PromptDialog({ prompt, close }) {
2575
2747
  const [value, setValue] = React4.useState(prompt.value);
2576
- const [status, setStatus] = React4.useState("");
2748
+ const [status, setStatus] = useToastMessage();
2577
2749
  const fieldId = React4.useId();
2578
2750
  const text = React4.useRef(null);
2579
2751
  async function copy2() {
@@ -2623,23 +2795,19 @@ function PromptDialog({ prompt, close }) {
2623
2795
  "aria-label": prompt.editable ? void 0 : "Prompt",
2624
2796
  rows: prompt.editable ? 10 : 7,
2625
2797
  value,
2798
+ placeholder: prompt.editable ? "Describe the dashboard changes you want" : void 0,
2626
2799
  readOnly: !prompt.editable,
2627
2800
  onChange: (event2) => setValue(event2.target.value)
2628
2801
  }
2629
2802
  ),
2630
- /* @__PURE__ */ React4.createElement("span", { role: "status" }, status)
2803
+ /* @__PURE__ */ React4.createElement(Toast, { message: status })
2631
2804
  );
2632
2805
  }
2633
2806
  function SavedViewsEmpty({
2634
2807
  instance,
2635
2808
  showPrompt
2636
2809
  }) {
2637
- const [copied, setCopied] = React4.useState(false);
2638
- React4.useEffect(() => {
2639
- if (!copied) return;
2640
- const timer = window.setTimeout(() => setCopied(false), 2e3);
2641
- return () => window.clearTimeout(timer);
2642
- }, [copied]);
2810
+ const [notice, setNotice] = useToastMessage();
2643
2811
  async function copyPrompt() {
2644
2812
  const value = [
2645
2813
  "Help me create a custom view in Vivix Studio and save it to Home.",
@@ -2649,16 +2817,15 @@ function SavedViewsEmpty({
2649
2817
  ].join("\n\n");
2650
2818
  try {
2651
2819
  await navigator.clipboard.writeText(value);
2652
- setCopied(true);
2820
+ setNotice("Prompt copied. Paste it into your Agent chat.");
2653
2821
  } catch {
2654
2822
  showPrompt({ title: "Create a saved view", value });
2655
2823
  }
2656
2824
  }
2657
- return /* @__PURE__ */ React4.createElement("div", { className: "studio-saved-empty" }, /* @__PURE__ */ React4.createElement("p", null, "No saved view yet. Ask your agent to create any views."), /* @__PURE__ */ React4.createElement(
2825
+ return /* @__PURE__ */ React4.createElement("div", { className: "studio-saved-empty" }, /* @__PURE__ */ React4.createElement("p", null, "No saved view yet. Ask your agent to create any views."), /* @__PURE__ */ React4.createElement(Toast, { message: notice }), /* @__PURE__ */ React4.createElement(
2658
2826
  Button,
2659
2827
  {
2660
- label: copied ? "Copied" : "Copy prompt",
2661
- "aria-live": "polite",
2828
+ label: "Copy prompt",
2662
2829
  variant: "text-tonal-sm",
2663
2830
  width: "hug",
2664
2831
  onClick: () => void copyPrompt()
@@ -2778,26 +2945,15 @@ ${"plugin" in ref ? "Use this enabled user-scope component in the Home instance
2778
2945
  value: "preset",
2779
2946
  label: "Preset",
2780
2947
  panel: /* @__PURE__ */ React4.createElement("div", { className: "studio-home-grid studio-home-gallery", role: "list" }, viewTemplates.map((template) => {
2781
- const { title, project: projectName, route: view } = template;
2782
- const project = projectName ? props.projects.find(
2783
- (item) => item.available && (item.name === projectName || item.name === projectName.toLowerCase().replaceAll(" ", "-"))
2784
- ) : void 0;
2948
+ const { title, preview } = template;
2949
+ const openPrompt = () => setPrompt({ title, preview, value: viewTemplatePrompt(template) });
2785
2950
  return /* @__PURE__ */ React4.createElement("article", { className: "studio-home-template", key: title, role: "listitem" }, /* @__PURE__ */ React4.createElement(
2786
2951
  "button",
2787
2952
  {
2788
2953
  type: "button",
2789
2954
  className: "studio-home-tile",
2790
2955
  "aria-label": title,
2791
- onClick: () => {
2792
- if (project) props.openProject(project.id, view);
2793
- else if (!projectName) props.openAssets();
2794
- else
2795
- setPrompt({
2796
- title,
2797
- preview: template.preview,
2798
- value: viewTemplatePrompt(template)
2799
- });
2800
- }
2956
+ onClick: openPrompt
2801
2957
  },
2802
2958
  /* @__PURE__ */ React4.createElement("span", { className: "studio-home-preview", "data-preview": template.preview }),
2803
2959
  /* @__PURE__ */ React4.createElement("span", { className: "studio-template-caption" }, /* @__PURE__ */ React4.createElement("strong", null, title), /* @__PURE__ */ React4.createElement("span", { className: "studio-home-template-summary" }, template.description))
@@ -2807,11 +2963,7 @@ ${"plugin" in ref ? "Use this enabled user-scope component in the Home instance
2807
2963
  label: "View Prompt",
2808
2964
  variant: "text-filled-sm",
2809
2965
  width: "hug",
2810
- onClick: () => setPrompt({
2811
- title,
2812
- preview: template.preview,
2813
- value: viewTemplatePrompt(template)
2814
- })
2966
+ onClick: openPrompt
2815
2967
  }
2816
2968
  ));
2817
2969
  }))
@@ -2913,7 +3065,6 @@ function WelcomeDialog({
2913
3065
  { requestKey: crypto.randomUUID() }
2914
3066
  );
2915
3067
  }
2916
- dismiss();
2917
3068
  onProject(project);
2918
3069
  } catch (error2) {
2919
3070
  setError(error2 instanceof Error ? error2.message : String(error2));
@@ -2926,6 +3077,7 @@ function WelcomeDialog({
2926
3077
  {
2927
3078
  title: "Welcome to Vivix Studio",
2928
3079
  variant: "welcome",
3080
+ closeOnEscape: false,
2929
3081
  className: "studio-welcome",
2930
3082
  open: true,
2931
3083
  onOpenChange: (next) => !next && !pending && dismiss()
@@ -2937,10 +3089,7 @@ function WelcomeDialog({
2937
3089
  className: "studio-welcome-choice",
2938
3090
  type: "button",
2939
3091
  disabled: !onCreate || !!pending,
2940
- onClick: () => {
2941
- dismiss();
2942
- onCreate?.();
2943
- }
3092
+ onClick: onCreate
2944
3093
  },
2945
3094
  /* @__PURE__ */ React5.createElement("span", { className: "studio-welcome-cover" }, /* @__PURE__ */ React5.createElement("span", { className: "studio-welcome-plus" }, /* @__PURE__ */ React5.createElement(Icon, { name: "add", size: 18 }))),
2946
3095
  /* @__PURE__ */ React5.createElement("span", null, "Create a Blank Project")
@@ -3389,6 +3538,7 @@ function CustomViewEditor({
3389
3538
  /* @__PURE__ */ React8.createElement(
3390
3539
  TextInput,
3391
3540
  {
3541
+ placeholder: "Enter a view name",
3392
3542
  label: "View name",
3393
3543
  value: name,
3394
3544
  onValueChange: setName,
@@ -3453,8 +3603,7 @@ function Detail({
3453
3603
  onDownload,
3454
3604
  onProject,
3455
3605
  project,
3456
- error,
3457
- notice
3606
+ error
3458
3607
  }) {
3459
3608
  const item = detail?.item;
3460
3609
  const [information, setInformation] = React8.useState(false);
@@ -3468,7 +3617,7 @@ function Detail({
3468
3617
  const facts = [
3469
3618
  ratio2,
3470
3619
  dimensions ? item?.kind === "video" ? `${Math.min(width, height)}P` : `${width} \xD7 ${height}` : void 0,
3471
- duration > 0 ? `${Number((duration / 1e3).toFixed(2))}s` : void 0
3620
+ duration > 0 ? `${formatDurationSeconds(duration)}s` : void 0
3472
3621
  ].filter(Boolean);
3473
3622
  const prompt = typeof item?.prompt === "string" ? item.prompt.trim() : "";
3474
3623
  const savedVersions = parseArray(item?.favoriteRefs).map(decodeRef).filter((ref) => ref !== null);
@@ -3579,7 +3728,7 @@ function Detail({
3579
3728
  /* @__PURE__ */ React8.createElement(DetailPrompt, { key: refKey(refValue), value: prompt })
3580
3729
  ), parseArray(item?.refs).some(referenceValue) && section("Reference", references(item?.refs)), item?.modelId && section("Model", /* @__PURE__ */ React8.createElement("p", null, String(item.modelId))), section(
3581
3730
  "Details",
3582
- /* @__PURE__ */ React8.createElement("p", { className: "studio-media-facts" }, ratio2 && /* @__PURE__ */ React8.createElement("span", { "aria-hidden": "true", className: "studio-ratio-icon" }), facts.length ? facts.join(" \xB7 ") : String(item?.mimeType ?? item?.kind ?? "--"))
3731
+ /* @__PURE__ */ React8.createElement("p", { className: "studio-media-facts" }, /* @__PURE__ */ React8.createElement(AspectRatioIcon, { ratio: ratio2 }), facts.length ? facts.join(" \xB7 ") : String(item?.mimeType ?? item?.kind ?? "--"))
3583
3732
  ), (information || detail.versions.length > 1) && section(
3584
3733
  "Version",
3585
3734
  /* @__PURE__ */ React8.createElement(
@@ -3605,7 +3754,7 @@ function Detail({
3605
3754
  onClick: () => onVersion(ref)
3606
3755
  }
3607
3756
  )))
3608
- )), error && /* @__PURE__ */ React8.createElement("p", { className: "studio-error", role: "alert" }, error), notice && /* @__PURE__ */ React8.createElement("p", { role: "status" }, notice)))
3757
+ )), error && /* @__PURE__ */ React8.createElement("p", { className: "studio-error", role: "alert" }, error)))
3609
3758
  );
3610
3759
  }
3611
3760
  function GlobalWorkbench({ client }) {
@@ -3621,6 +3770,14 @@ function GlobalWorkbench({ client }) {
3621
3770
  const [projectSummaries, setProjectSummaries] = React8.useState(
3622
3771
  /* @__PURE__ */ new Map()
3623
3772
  );
3773
+ const [liveCovers, setLiveCovers] = React8.useState(
3774
+ /* @__PURE__ */ new Map()
3775
+ );
3776
+ const displayCover = (id) => {
3777
+ const summary = projectSummaries.get(id);
3778
+ const live = liveCovers.get(id);
3779
+ return summary?.cover ?? (live ? live.ref : summary?.storyboard) ?? null;
3780
+ };
3624
3781
  const [catalogRevision, refreshCatalog] = React8.useReducer((revision) => revision + 1, 0);
3625
3782
  const catalog = catalogSnapshot ?? [];
3626
3783
  const [legacyWorkbench, setLegacyWorkbench] = React8.useState(false);
@@ -3637,7 +3794,7 @@ function GlobalWorkbench({ client }) {
3637
3794
  const [busy, setBusy] = React8.useState(false);
3638
3795
  const [error, setError] = React8.useState("");
3639
3796
  const [loadFailure, setLoadFailure] = React8.useState(null);
3640
- const [notice, setNotice] = React8.useState("");
3797
+ const [notice, setNotice] = useToastMessage();
3641
3798
  const [listRevision, setListRevision] = React8.useState(0);
3642
3799
  const [queryOwner, setQueryOwner] = React8.useState(null);
3643
3800
  const canQuery = queryOwner?.client === client && queryOwner.scope === scopeIdentity;
@@ -3647,6 +3804,7 @@ function GlobalWorkbench({ client }) {
3647
3804
  const querySequence = React8.useRef(0);
3648
3805
  const [editor, setEditor] = React8.useState(null);
3649
3806
  const [createViewOpen, setCreateViewOpen] = React8.useState(false);
3807
+ const renameFormId = React8.useId();
3650
3808
  const [projectAction, setProjectAction] = React8.useState(null);
3651
3809
  const [projectActionError, setProjectActionError] = React8.useState("");
3652
3810
  const [projectActionBusy, setProjectActionBusy] = React8.useState(false);
@@ -3790,8 +3948,21 @@ function GlobalWorkbench({ client }) {
3790
3948
  }
3791
3949
  React8.useEffect(() => {
3792
3950
  const onAsset = (event2) => {
3793
- if (event2.origin !== location.origin || !frame.current || event2.source !== frame.current.contentWindow || event2.data?.type !== "studio:open-asset")
3951
+ if (event2.origin !== location.origin || !frame.current || event2.source !== frame.current.contentWindow)
3794
3952
  return;
3953
+ if (event2.data?.type === "studio:storyboard-cover") {
3954
+ const id = readRoute(new URL(location.href)).project?.id;
3955
+ const { ref: value, revision } = event2.data;
3956
+ const ref2 = decodeRef(value);
3957
+ if (!id || id !== event2.data.projectId || !Number.isInteger(revision) || !ref2 && value !== null)
3958
+ return;
3959
+ setLiveCovers((previous) => {
3960
+ if ((previous.get(id)?.revision ?? -1) >= revision) return previous;
3961
+ return new Map(previous).set(id, { ref: ref2, revision });
3962
+ });
3963
+ return;
3964
+ }
3965
+ if (event2.data?.type !== "studio:open-asset") return;
3795
3966
  const ref = decodeRef(event2.data.ref);
3796
3967
  if (ref) navigate({ ...readRoute(new URL(location.href)), ref });
3797
3968
  };
@@ -3849,6 +4020,7 @@ function GlobalWorkbench({ client }) {
3849
4020
  id: z7.string(),
3850
4021
  name: z7.string(),
3851
4022
  coverRef: z7.unknown().optional(),
4023
+ storyboardCoverRef: z7.unknown().optional(),
3852
4024
  tags: z7.array(z7.string()).default([]),
3853
4025
  revision: z7.number().optional()
3854
4026
  })
@@ -3856,9 +4028,15 @@ function GlobalWorkbench({ client }) {
3856
4028
  setSummariesPending(false);
3857
4029
  setProjectSummaries(
3858
4030
  new Map(
3859
- parsed.success ? parsed.data.map(({ id, name, coverRef, tags: tags2, revision }) => [
4031
+ parsed.success ? parsed.data.map(({ id, name, coverRef, storyboardCoverRef, tags: tags2, revision }) => [
3860
4032
  id,
3861
- { name, cover: decodeRef(coverRef), tags: tags2, revision }
4033
+ {
4034
+ name,
4035
+ cover: decodeRef(coverRef),
4036
+ storyboard: decodeRef(storyboardCoverRef),
4037
+ tags: tags2,
4038
+ revision
4039
+ }
3862
4040
  ]) : []
3863
4041
  )
3864
4042
  );
@@ -4112,7 +4290,11 @@ function GlobalWorkbench({ client }) {
4112
4290
  identity: detailIdentity,
4113
4291
  value: keepSource ? {
4114
4292
  ...value,
4115
- item: { ...value.item, previewUrl: current.value.item.previewUrl }
4293
+ item: {
4294
+ ...value.item,
4295
+ previewUrl: current.value.item.previewUrl,
4296
+ posterUrl: current.value.item.posterUrl ?? value.item.posterUrl
4297
+ }
4116
4298
  } : value
4117
4299
  };
4118
4300
  });
@@ -4393,7 +4575,7 @@ function GlobalWorkbench({ client }) {
4393
4575
  }
4394
4576
  const cover = (row) => {
4395
4577
  const projectId2 = annotationProject(row);
4396
- const output = active.view.source === "projects" && projectId2 ? projectSummaries.has(projectId2) ? projectSummaries.get(projectId2).cover : decodeRef(row.coverRef) : taskCoverRef(row, active.view);
4578
+ const output = active.view.source === "projects" && projectId2 ? displayCover(projectId2) ?? (!projectSummaries.has(projectId2) ? decodeRef(row.coverRef) : null) : taskCoverRef(row, active.view);
4397
4579
  return /* @__PURE__ */ React8.createElement(
4398
4580
  QueryCover,
4399
4581
  {
@@ -4439,10 +4621,10 @@ function GlobalWorkbench({ client }) {
4439
4621
  }
4440
4622
  return request;
4441
4623
  }
4442
- function renderReferences(value, disabled = false) {
4624
+ function renderReferences(value, disabled = false, compact = false) {
4443
4625
  const refs = parseArray(value).map(referenceValue).filter((ref) => ref !== null);
4444
4626
  if (!refs.length) return "--";
4445
- return /* @__PURE__ */ React8.createElement("span", { className: "studio-asset-references" }, refs.map((ref, index) => {
4627
+ const renderThumbnail = (ref, index) => {
4446
4628
  const key3 = refKey(ref);
4447
4629
  const item = referenceRows.get(key3);
4448
4630
  return /* @__PURE__ */ React8.createElement(
@@ -4464,11 +4646,21 @@ function GlobalWorkbench({ client }) {
4464
4646
  }
4465
4647
  )
4466
4648
  );
4467
- }));
4649
+ };
4650
+ return compact ? /* @__PURE__ */ React8.createElement(
4651
+ AssetReferenceRow,
4652
+ {
4653
+ className: "studio-asset-references",
4654
+ references: refs,
4655
+ renderThumbnail
4656
+ }
4657
+ ) : /* @__PURE__ */ React8.createElement("span", { className: "studio-asset-references" }, refs.map(renderThumbnail));
4468
4658
  }
4469
4659
  const renderCell = (row, column2) => {
4660
+ if (route.page === "tasks" && column2.path === "costLabel" && row.costStatus === "settled" && row.chargedCredits != null)
4661
+ return taskCostLabel({ cost: { status: row.costStatus, credits: row.chargedCredits } });
4470
4662
  if (builtIn && route.page !== "projects" && column2.path === "refs")
4471
- return renderReferences(row.refs, selecting);
4663
+ return renderReferences(row.refs, selecting, route.page === "assets");
4472
4664
  if (builtIn && (column2.path === "aspectRatio" || column2.path === "scene")) {
4473
4665
  const meta = assetMetadata(row.metadata);
4474
4666
  const source = assetMetadata(meta.adSource);
@@ -4627,6 +4819,7 @@ function GlobalWorkbench({ client }) {
4627
4819
  theme: theme.preference === "system" ? menu?.theme ?? theme.theme : theme.theme,
4628
4820
  className: "studio-global"
4629
4821
  },
4822
+ /* @__PURE__ */ React8.createElement(Toast, { message: notice }),
4630
4823
  /* @__PURE__ */ React8.createElement(
4631
4824
  "div",
4632
4825
  {
@@ -4671,6 +4864,7 @@ function GlobalWorkbench({ client }) {
4671
4864
  )), /* @__PURE__ */ React8.createElement("h2", null, "Projects"), visibleProjects.map((project) => {
4672
4865
  const active2 = sidebarProject === project.id;
4673
4866
  const summary = projectSummaries.get(project.id);
4867
+ const projectCover = project.available ? displayCover(project.id) : null;
4674
4868
  const title = summary?.name ?? project.name;
4675
4869
  const tabs = active2 && !collapsed && route.project ? menu?.tabs : void 0;
4676
4870
  return /* @__PURE__ */ React8.createElement("div", { className: "studio-project-group", key: project.id }, /* @__PURE__ */ React8.createElement("div", { className: "studio-project-row", "data-active": active2 || void 0 }, /* @__PURE__ */ React8.createElement(
@@ -4688,9 +4882,9 @@ function GlobalWorkbench({ client }) {
4688
4882
  AssetThumbnail,
4689
4883
  {
4690
4884
  className: "studio-project-thumbnail",
4691
- key: project.available && summary?.cover ? refKey(summary.cover) : "",
4885
+ key: projectCover ? refKey(projectCover) : "",
4692
4886
  pending: project.available && Boolean(client.config.studioInstance) && !summary && summariesPending,
4693
- cover: project.available ? summary?.cover ?? null : null,
4887
+ cover: projectCover,
4694
4888
  resolvePreview: resolveProjectPreview
4695
4889
  }
4696
4890
  ),
@@ -4744,7 +4938,7 @@ function GlobalWorkbench({ client }) {
4744
4938
  /* @__PURE__ */ React8.createElement("span", null, tab.label)
4745
4939
  ))
4746
4940
  ));
4747
- })), /* @__PURE__ */ React8.createElement("div", { className: "studio-account" }, /* @__PURE__ */ React8.createElement("span", { className: "studio-user-mark", "aria-hidden": "true" }), /* @__PURE__ */ React8.createElement("span", null, "Local User"))),
4941
+ })), /* @__PURE__ */ React8.createElement("div", { className: "studio-account" }, /* @__PURE__ */ React8.createElement("span", { className: "studio-user-mark vx-local-user-avatar", "aria-hidden": "true" }), /* @__PURE__ */ React8.createElement("span", null, "Local User"))),
4748
4942
  /* @__PURE__ */ React8.createElement("main", { className: "studio-content" }, /* @__PURE__ */ React8.createElement("div", { className: "studio-mobile-nav" }, /* @__PURE__ */ React8.createElement(
4749
4943
  Dropdown,
4750
4944
  {
@@ -4782,7 +4976,7 @@ function GlobalWorkbench({ client }) {
4782
4976
  variant: "text-tonal-sm",
4783
4977
  onClick: () => setCreateViewOpen(true)
4784
4978
  }
4785
- )), (error || failure) && /* @__PURE__ */ React8.createElement("div", { className: "studio-feedback studio-error", role: "alert" }, error || failure?.message, failure && " Reload the workspace to try again.", error && /* @__PURE__ */ React8.createElement(IconButton, { icon: "close", label: "Dismiss error", onClick: () => setError("") })), notice && /* @__PURE__ */ React8.createElement("div", { className: "studio-feedback", role: "status" }, notice, /* @__PURE__ */ React8.createElement(IconButton, { icon: "close", label: "Dismiss notice", onClick: () => setNotice("") })), route.project ? projectEntry ? /* @__PURE__ */ React8.createElement(
4979
+ )), (error || failure) && /* @__PURE__ */ React8.createElement("div", { className: "studio-feedback studio-error", role: "alert" }, error || failure?.message, failure && " Reload the workspace to try again.", error && /* @__PURE__ */ React8.createElement(IconButton, { icon: "close", label: "Dismiss error", onClick: () => setError("") })), route.project ? projectEntry ? /* @__PURE__ */ React8.createElement(
4786
4980
  ProjectFrame,
4787
4981
  {
4788
4982
  key: projectEntry,
@@ -4796,6 +4990,7 @@ function GlobalWorkbench({ client }) {
4796
4990
  client,
4797
4991
  onProjectCreated,
4798
4992
  hiddenProjectIds: hiddenProjects,
4993
+ projectCovers: new Map(visibleProjects.map(({ id }) => [id, displayCover(id)])),
4799
4994
  projects: visibleProjects.map(({ id, name, available }) => ({
4800
4995
  id,
4801
4996
  name: projectSummaries.get(id)?.name ?? name,
@@ -4834,7 +5029,7 @@ function GlobalWorkbench({ client }) {
4834
5029
  /* @__PURE__ */ React8.createElement(
4835
5030
  "div",
4836
5031
  {
4837
- className: route.page === "assets" ? "studio-toolbar vx-asset-library-toolbar" : "studio-toolbar",
5032
+ className: route.page === "assets" || selecting ? "studio-toolbar vx-asset-library-toolbar" : "studio-toolbar",
4838
5033
  "data-selection": selecting
4839
5034
  },
4840
5035
  /* @__PURE__ */ React8.createElement("div", { className: "studio-view-tabs", role: "group", "aria-label": "Custom Views" }, visibleViews.map((view2) => /* @__PURE__ */ React8.createElement(
@@ -4851,9 +5046,11 @@ function GlobalWorkbench({ client }) {
4851
5046
  }
4852
5047
  }
4853
5048
  ))),
4854
- selecting && route.page === "assets" ? /* @__PURE__ */ React8.createElement(
5049
+ selecting ? /* @__PURE__ */ React8.createElement(
4855
5050
  AssetSelectionToolbar,
4856
5051
  {
5052
+ label: route.page === "projects" ? "Selected project actions" : route.page === "tasks" ? "Selected task actions" : void 0,
5053
+ showAssetActions: route.page !== "projects",
4857
5054
  count: selected.size,
4858
5055
  allSelected,
4859
5056
  busy,
@@ -4863,51 +5060,7 @@ function GlobalWorkbench({ client }) {
4863
5060
  deleteHint: "Delete assets in their project.",
4864
5061
  onCancel: stopSelecting
4865
5062
  }
4866
- ) : selecting ? /* @__PURE__ */ React8.createElement("div", { className: "studio-bulk", role: "group", "aria-label": "Selected item actions" }, /* @__PURE__ */ React8.createElement("span", { role: "status" }, selected.size, " selected"), /* @__PURE__ */ React8.createElement(
4867
- Button,
4868
- {
4869
- label: allSelected ? "Deselect page" : "Select page",
4870
- variant: "text-tonal-sm",
4871
- disabled: !rows.length,
4872
- onClick: toggleSelectedPage
4873
- }
4874
- ), route.page === "projects" ? /* @__PURE__ */ React8.createElement(
4875
- Button,
4876
- {
4877
- label: "Copy names",
4878
- variant: "text-tonal-sm",
4879
- disabled: !selected.size,
4880
- onClick: () => {
4881
- void navigator.clipboard.writeText([...selected.values()].map((item) => item.title).join("\n")).then(
4882
- () => setNotice("Project names copied."),
4883
- (error2) => setError(message(error2))
4884
- );
4885
- }
4886
- }
4887
- ) : /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
4888
- Button,
4889
- {
4890
- label: "Favorite",
4891
- variant: "text-tonal-sm",
4892
- disabled: !selectedRefs.length || busy,
4893
- onClick: () => void favorite(selectedRefs, true)
4894
- }
4895
- ), /* @__PURE__ */ React8.createElement(
4896
- Button,
4897
- {
4898
- label: "Download",
4899
- variant: "text-tonal-sm",
4900
- disabled: !selectedRefs.length || busy,
4901
- onClick: () => void download(selectedRefs)
4902
- }
4903
- )), /* @__PURE__ */ React8.createElement(
4904
- Button,
4905
- {
4906
- label: "Cancel selection",
4907
- variant: "text-tonal-sm",
4908
- onClick: stopSelecting
4909
- }
4910
- )) : /* @__PURE__ */ React8.createElement(
5063
+ ) : /* @__PURE__ */ React8.createElement(
4911
5064
  "div",
4912
5065
  {
4913
5066
  className: route.page === "assets" ? "studio-toolbar-controls vx-asset-library-controls" : "studio-toolbar-controls"
@@ -5097,7 +5250,6 @@ function GlobalWorkbench({ client }) {
5097
5250
  {
5098
5251
  key: detailIdentity,
5099
5252
  error: error || failure?.message || "",
5100
- notice,
5101
5253
  detail,
5102
5254
  refValue: route.ref,
5103
5255
  busy,
@@ -5205,23 +5357,37 @@ function GlobalWorkbench({ client }) {
5205
5357
  Dialog,
5206
5358
  {
5207
5359
  title: "Rename project",
5360
+ className: "studio-rename-dialog",
5208
5361
  open: true,
5209
5362
  onOpenChange: (open) => {
5210
5363
  if (!open && !projectActionBusy) setProjectAction(null);
5211
5364
  },
5212
- actions: /* @__PURE__ */ React8.createElement(
5365
+ actions: /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
5366
+ Button,
5367
+ {
5368
+ label: "Cancel",
5369
+ variant: "text-tonal-md",
5370
+ width: "hug",
5371
+ disabled: projectActionBusy,
5372
+ onClick: () => setProjectAction(null)
5373
+ }
5374
+ ), /* @__PURE__ */ React8.createElement(
5213
5375
  Button,
5214
5376
  {
5215
5377
  label: "Rename",
5378
+ variant: "text-filled-md",
5379
+ width: "hug",
5380
+ type: "submit",
5381
+ form: renameFormId,
5216
5382
  loading: projectActionBusy,
5217
- disabled: !projectAction.name.trim(),
5218
- onClick: () => void saveProjectAction()
5383
+ disabled: !projectAction.name.trim()
5219
5384
  }
5220
- )
5385
+ ))
5221
5386
  },
5222
5387
  /* @__PURE__ */ React8.createElement(
5223
5388
  "form",
5224
5389
  {
5390
+ id: renameFormId,
5225
5391
  onSubmit: (event2) => {
5226
5392
  event2.preventDefault();
5227
5393
  void saveProjectAction();
@@ -5231,7 +5397,14 @@ function GlobalWorkbench({ client }) {
5231
5397
  TextInput,
5232
5398
  {
5233
5399
  label: "Project name",
5400
+ placeholder: "Enter project name",
5234
5401
  value: projectAction.name,
5402
+ size: "large",
5403
+ ref: (input) => {
5404
+ if (input) input.autofocus = true;
5405
+ },
5406
+ onFocus: (event2) => event2.currentTarget.select(),
5407
+ disabled: projectActionBusy,
5235
5408
  maxLength: 120,
5236
5409
  required: true,
5237
5410
  onValueChange: (name) => setProjectAction({ ...projectAction, name })
@@ -5417,7 +5590,7 @@ function FileBrowser({
5417
5590
  MediaActions
5418
5591
  }) {
5419
5592
  const [mediaOpen, setMediaOpen] = React9.useState(false);
5420
- const [versionId, setVersionId] = React9.useState(""), [menu, setMenu] = React9.useState(false), [edit, setEdit] = React9.useState(""), [name, setName] = React9.useState(""), [tags2, setTags] = React9.useState(""), [text, setText] = React9.useState(""), [working, setWorking] = React9.useState(false), [download, setDownload] = React9.useState(""), [notice, setNotice] = React9.useState(""), [targetProject, setTargetProject] = React9.useState("");
5593
+ const [versionId, setVersionId] = React9.useState(""), [menu, setMenu] = React9.useState(false), [edit, setEdit] = React9.useState(""), [name, setName] = React9.useState(""), [tags2, setTags] = React9.useState(""), [text, setText] = React9.useState(""), [working, setWorking] = React9.useState(false), [download, setDownload] = React9.useState(""), [notice, setNotice] = useToastMessage(), [targetProject, setTargetProject] = React9.useState("");
5421
5594
  const upload = React9.useRef(null);
5422
5595
  const library = !projectId;
5423
5596
  const version = selected?.versions?.find((v) => v.versionId === versionId) || selected?.versions?.at(-1);
@@ -5461,7 +5634,7 @@ function FileBrowser({
5461
5634
  setMenu(false);
5462
5635
  setEdit("rename");
5463
5636
  };
5464
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, notice && !selected && /* @__PURE__ */ React9.createElement("p", { className: "file-notice", role: "status" }, notice), /* @__PURE__ */ React9.createElement("div", { className: "file-grid", "aria-label": "\u6587\u4EF6\u5217\u8868" }, rows.map((row) => /* @__PURE__ */ React9.createElement(
5637
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(Toast, { message: notice }), /* @__PURE__ */ React9.createElement("div", { className: "file-grid", "aria-label": "\u6587\u4EF6\u5217\u8868" }, rows.map((row) => /* @__PURE__ */ React9.createElement(
5465
5638
  "button",
5466
5639
  {
5467
5640
  className: "file-tile",
@@ -5561,7 +5734,6 @@ function FileBrowser({
5561
5734
  },
5562
5735
  "\u79FB\u9664\u6587\u4EF6"
5563
5736
  ))), /* @__PURE__ */ React9.createElement("button", { "aria-label": "\u5173\u95ED\u6587\u4EF6\u9884\u89C8", className: "file-close", onClick: onClose }, "\xD7"))),
5564
- notice && /* @__PURE__ */ React9.createElement("p", { className: "file-viewer-notice", role: "status" }, notice),
5565
5737
  /* @__PURE__ */ React9.createElement("div", { className: "file-viewer-body" }, /* @__PURE__ */ React9.createElement("div", { className: "file-stage" }, mediaOpen ? /* @__PURE__ */ React9.createElement("p", null, "Playback is paused while video tools are open.") : /* @__PURE__ */ React9.createElement(
5566
5738
  FilePreview,
5567
5739
  {
@@ -5692,6 +5864,7 @@ function FileBrowser({
5692
5864
  edit === "rename" && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("label", null, "\u6587\u4EF6\u540D", /* @__PURE__ */ React9.createElement(
5693
5865
  "input",
5694
5866
  {
5867
+ placeholder: "Enter a file name",
5695
5868
  "aria-label": "\u6587\u4EF6\u540D",
5696
5869
  required: true,
5697
5870
  maxLength: 200,
@@ -5710,6 +5883,7 @@ function FileBrowser({
5710
5883
  edit === "text" && /* @__PURE__ */ React9.createElement("label", null, "\u5185\u5BB9", /* @__PURE__ */ React9.createElement(
5711
5884
  "textarea",
5712
5885
  {
5886
+ placeholder: "Enter text for this file",
5713
5887
  "aria-label": "\u6587\u672C\u5185\u5BB9",
5714
5888
  value: text,
5715
5889
  onChange: (e) => setText(e.target.value)
@@ -5792,7 +5966,7 @@ import * as React11 from "react";
5792
5966
  function Settings({ bridge, projectId, onError, project, studio, onSaved }) {
5793
5967
  const [form, setForm] = React11.useState({ name: "", description: "", aspectRatio: "", tags: "" });
5794
5968
  const [saving, setSaving] = React11.useState(false);
5795
- const [saved, setSaved] = React11.useState("");
5969
+ const [saved, setSaved] = useToastMessage();
5796
5970
  const reset = () => setForm({
5797
5971
  name: project?.data.name || "",
5798
5972
  description: project?.data.description || "",
@@ -5825,6 +5999,7 @@ function Settings({ bridge, projectId, onError, project, studio, onSaved }) {
5825
5999
  return /* @__PURE__ */ React11.createElement("section", { className: "project-settings", "aria-label": "\u9879\u76EE\u8BBE\u7F6E" }, /* @__PURE__ */ React11.createElement("div", { className: "settings-section" }, /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("h2", null, "\u9879\u76EE\u4FE1\u606F"), /* @__PURE__ */ React11.createElement("p", { className: "sub" }, "\u8BBE\u7F6E\u9879\u76EE\u540D\u79F0\u4E0E\u8BF4\u660E\u3002")), /* @__PURE__ */ React11.createElement("div", { className: "settings-fields" }, /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement("span", null, "\u9879\u76EE\u540D\u79F0"), /* @__PURE__ */ React11.createElement(
5826
6000
  "input",
5827
6001
  {
6002
+ placeholder: "Enter a project name",
5828
6003
  "aria-label": "\u9879\u76EE\u540D\u79F0",
5829
6004
  value: form.name,
5830
6005
  onChange: (e) => setForm({ ...form, name: e.target.value }),
@@ -5833,6 +6008,7 @@ function Settings({ bridge, projectId, onError, project, studio, onSaved }) {
5833
6008
  )), /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement("span", null, "\u8BF4\u660E"), /* @__PURE__ */ React11.createElement(
5834
6009
  "textarea",
5835
6010
  {
6011
+ placeholder: "Describe the project and its goals",
5836
6012
  "aria-label": "\u9879\u76EE\u8BF4\u660E",
5837
6013
  value: form.description,
5838
6014
  onChange: (e) => setForm({ ...form, description: e.target.value }),
@@ -5863,7 +6039,7 @@ function Settings({ bridge, projectId, onError, project, studio, onSaved }) {
5863
6039
  ...form.aspectRatio ? [form.aspectRatio] : []
5864
6040
  ])
5865
6041
  ].map((value) => /* @__PURE__ */ React11.createElement("option", { key: value }, value))
5866
- )))), /* @__PURE__ */ React11.createElement("div", { className: "settings-save-row" }, /* @__PURE__ */ React11.createElement("span", { className: "sub", role: "status" }, saved || "\u4FEE\u6539\u4EC5\u7528\u4E8E\u5F53\u524D\u9879\u76EE\u3002"), /* @__PURE__ */ React11.createElement("div", { className: "actions" }, /* @__PURE__ */ React11.createElement("button", { disabled: saving, onClick: reset }, "\u53D6\u6D88\u4FEE\u6539"), /* @__PURE__ */ React11.createElement(
6042
+ )))), /* @__PURE__ */ React11.createElement("div", { className: "settings-save-row" }, /* @__PURE__ */ React11.createElement(Toast, { message: saved }), /* @__PURE__ */ React11.createElement("span", { className: "sub" }, "\u4FEE\u6539\u4EC5\u7528\u4E8E\u5F53\u524D\u9879\u76EE\u3002"), /* @__PURE__ */ React11.createElement("div", { className: "actions" }, /* @__PURE__ */ React11.createElement("button", { disabled: saving, onClick: reset }, "\u53D6\u6D88\u4FEE\u6539"), /* @__PURE__ */ React11.createElement(
5867
6043
  "button",
5868
6044
  {
5869
6045
  className: "primary",
@@ -5944,7 +6120,7 @@ function FileMediaTools({
5944
6120
  const [chosen, setChosen] = React12.useState(0);
5945
6121
  const [outputName, setOutputName] = React12.useState(`${row.data.name} edited`);
5946
6122
  const [error, setError] = React12.useState("");
5947
- const [notice, setNotice] = React12.useState("");
6123
+ const [notice, setNotice] = useToastMessage();
5948
6124
  const [submitting, setSubmitting] = React12.useState(false);
5949
6125
  const [refresh, setRefresh] = React12.useState(0);
5950
6126
  const live = React12.useRef(true);
@@ -6126,6 +6302,7 @@ function FileMediaTools({
6126
6302
  /* @__PURE__ */ React12.createElement("label", null, "Output name", /* @__PURE__ */ React12.createElement(
6127
6303
  "input",
6128
6304
  {
6305
+ placeholder: "Enter an output file name",
6129
6306
  value: outputName,
6130
6307
  maxLength: 200,
6131
6308
  onChange: (event2) => setOutputName(event2.target.value)
@@ -6150,7 +6327,7 @@ function FileMediaTools({
6150
6327
  disabled: open
6151
6328
  }
6152
6329
  )),
6153
- notice && /* @__PURE__ */ React12.createElement("p", { role: "status" }, notice),
6330
+ /* @__PURE__ */ React12.createElement(Toast, { message: notice }),
6154
6331
  error && /* @__PURE__ */ React12.createElement("p", { role: "alert", className: "error" }, error),
6155
6332
  mode && Editor && /* @__PURE__ */ React12.createElement(Editor, { input, mode, onApply: apply, onClose: () => setMode(null) }),
6156
6333
  compare && Compare && /* @__PURE__ */ React12.createElement("div", { className: "file-media-comparison" }, /* @__PURE__ */ React12.createElement(
@@ -6162,7 +6339,7 @@ function FileMediaTools({
6162
6339
  if (!value) closeComparison();
6163
6340
  }
6164
6341
  },
6165
- details || detailLoading || detailError ? /* @__PURE__ */ React12.createElement("section", { "aria-label": "Video details" }, detailLoading && /* @__PURE__ */ React12.createElement("p", { role: "status" }, "Loading fixed details\u2026"), detailError && /* @__PURE__ */ React12.createElement("p", { role: "alert" }, detailError), details && /* @__PURE__ */ React12.createElement("dl", null, /* @__PURE__ */ React12.createElement("dt", null, "Name"), /* @__PURE__ */ React12.createElement("dd", null, details.name), /* @__PURE__ */ React12.createElement("dt", null, "Version"), /* @__PURE__ */ React12.createElement("dd", null, "v", details.versionNumber), /* @__PURE__ */ React12.createElement("dt", null, "Editing"), /* @__PURE__ */ React12.createElement("dd", null, details.edited ? "Fixed editing recipe" : "Original"), /* @__PURE__ */ React12.createElement("dt", null, "Effective duration"), /* @__PURE__ */ React12.createElement("dd", null, (details.effectiveDurationMs / 1e3).toFixed(3), " s"), /* @__PURE__ */ React12.createElement("dt", null, "Frame"), /* @__PURE__ */ React12.createElement("dd", null, details.geometry.pixelRect.width, " \xD7 ", details.geometry.pixelRect.height)), /* @__PURE__ */ React12.createElement(
6342
+ details || detailLoading || detailError ? /* @__PURE__ */ React12.createElement("section", { "aria-label": "Video details" }, detailLoading && /* @__PURE__ */ React12.createElement("p", { role: "status" }, "Loading fixed details\u2026"), detailError && /* @__PURE__ */ React12.createElement("p", { role: "alert" }, detailError), details && /* @__PURE__ */ React12.createElement("dl", null, /* @__PURE__ */ React12.createElement("dt", null, "Name"), /* @__PURE__ */ React12.createElement("dd", null, details.name), /* @__PURE__ */ React12.createElement("dt", null, "Version"), /* @__PURE__ */ React12.createElement("dd", null, "v", details.versionNumber), /* @__PURE__ */ React12.createElement("dt", null, "Editing"), /* @__PURE__ */ React12.createElement("dd", null, details.edited ? "Fixed editing recipe" : "Original"), /* @__PURE__ */ React12.createElement("dt", null, "Effective duration"), /* @__PURE__ */ React12.createElement("dd", null, formatDurationSeconds(details.effectiveDurationMs), " s"), /* @__PURE__ */ React12.createElement("dt", null, "Frame"), /* @__PURE__ */ React12.createElement("dd", null, details.geometry.pixelRect.width, " \xD7 ", details.geometry.pixelRect.height)), /* @__PURE__ */ React12.createElement(
6166
6343
  Button,
6167
6344
  {
6168
6345
  label: "Back to comparison",
@@ -6328,7 +6505,7 @@ function ProjectWorkbench({ client, navigation }) {
6328
6505
  const [nextOffset, setNextOffset] = React13.useState(null);
6329
6506
  const [busy, setBusy] = React13.useState(false);
6330
6507
  const [error, setError] = React13.useState("");
6331
- const [notice, setNotice] = React13.useState("");
6508
+ const [notice, setNotice] = useToastMessage();
6332
6509
  const [draft, setDraft] = React13.useState({});
6333
6510
  const [models, setModels] = React13.useState([]);
6334
6511
  const [capability, setCapability] = React13.useState(null);
@@ -6804,7 +6981,7 @@ function ProjectWorkbench({ client, navigation }) {
6804
6981
  hidden: true,
6805
6982
  onChange: (e) => void importFiles(e.target.files)
6806
6983
  }
6807
- )), projectId && page === "assets" && /* @__PURE__ */ React13.createElement("button", { onClick: () => setForm({ name: "\u672A\u547D\u540D\u6587\u672C", text: "" }) }, "\u65B0\u5EFA\u6587\u672C")))), error && /* @__PURE__ */ React13.createElement("div", { role: "alert", className: "error" }, error, /* @__PURE__ */ React13.createElement("button", { onClick: () => setError("") }, "\u5173\u95ED")), notice && /* @__PURE__ */ React13.createElement("p", { role: "status", className: "file-notice" }, notice), ["projects", "assets", "library"].includes(page) && /* @__PURE__ */ React13.createElement("div", { className: "file-toolbar" }, /* @__PURE__ */ React13.createElement(
6984
+ )), projectId && page === "assets" && /* @__PURE__ */ React13.createElement("button", { onClick: () => setForm({ name: "\u672A\u547D\u540D\u6587\u672C", text: "" }) }, "\u65B0\u5EFA\u6587\u672C")))), error && /* @__PURE__ */ React13.createElement("div", { role: "alert", className: "error" }, error, /* @__PURE__ */ React13.createElement("button", { onClick: () => setError("") }, "\u5173\u95ED")), /* @__PURE__ */ React13.createElement(Toast, { message: notice }), ["projects", "assets", "library"].includes(page) && /* @__PURE__ */ React13.createElement("div", { className: "file-toolbar" }, /* @__PURE__ */ React13.createElement(
6808
6985
  "input",
6809
6986
  {
6810
6987
  "aria-label": page === "projects" ? "\u641C\u7D22\u9879\u76EE" : "\u641C\u7D22\u6587\u4EF6",
@@ -6947,6 +7124,7 @@ function ProjectWorkbench({ client, navigation }) {
6947
7124
  "input",
6948
7125
  {
6949
7126
  required: true,
7127
+ placeholder: "Enter a file name",
6950
7128
  value: form.name,
6951
7129
  onChange: (e) => setForm({ ...form, name: e.target.value })
6952
7130
  }
@@ -6954,6 +7132,7 @@ function ProjectWorkbench({ client, navigation }) {
6954
7132
  /* @__PURE__ */ React13.createElement("label", null, "\u5185\u5BB9", /* @__PURE__ */ React13.createElement(
6955
7133
  "textarea",
6956
7134
  {
7135
+ placeholder: "Enter text for this file",
6957
7136
  value: form.text,
6958
7137
  onChange: (e) => setForm({ ...form, text: e.target.value })
6959
7138
  }