@kition/kit-editor 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { KitRpcError as he, isHello as co, KIT_UI_PROTOCOL as Bt, isHandshake as uo, KitPeer as ho, parseCommentAnchor as zn, HOST_SERVICE_CAPABILITY_PREFIX as Bn, parseKitView as _n, parseWatermark as fo, parseDocumentPermissions as mo, matchesShortcut as Hr, INVALID_PARAMS_REASON as At, LEASE_HELD_REASON as fn, ORIGIN_LABEL as po, HOST_ORIGIN_LABEL as go, parsePeers as bo, parsePresence as wo } from "@kition/kit-ui-protocol";
1
+ import { KitRpcError as he, isHello as co, KIT_UI_PROTOCOL as Bt, isHandshake as uo, KitPeer as ho, parseCommentAnchor as zn, HOST_SERVICE_CAPABILITY_PREFIX as Bn, parseKitView as _n, parseWatermark as fo, parseDocumentPermissions as mo, matchesShortcut as Hr, INVALID_PARAMS_REASON as At, LEASE_HELD_REASON as fn, ORIGIN_LABEL as po, HOST_ORIGIN_LABEL as go, parsePeers as wo, parsePresence as bo } from "@kition/kit-ui-protocol";
2
2
  import { fileErrorReason as th, isOpenableUrl as nh, openErrorReason as rh } from "@kition/kit-ui-protocol";
3
- import { brandTokens as yo, validBrand as vo, Dialog as st, Button as me, ElementsProvider as ko, MenuItem as le, RibbonButton as be, ICON_STROKE as $e, RibbonGroup as Me, StringsProvider as So, RibbonPresentationContext as vt, RibbonFitContext as Yt, lineSize as Co, MenuButton as lt, FULL_RIBBON_FIT as mn, menuKeyDown as xo, toast as pt, IconButton as De, OverflowStrip as Et, StatusBar as $o, StatusSpacer as Io, ZoomControl as Mo, Toaster as To, RibbonStack as Fe, ColorGrid as Vt, MenuSeparator as Ae, Choice as gt, Checkbox as Xt, LineMoreLabelContext as Ao, DropPanel as Eo } from "@kition/tessera-ui";
4
- import { Badge as oh, BarChart as ah, BarSeparator as sh, Button as lh, Card as ch, CardContent as dh, CardHeader as uh, Checkbox as hh, Choice as fh, ColorGrid as mh, ColorPicker as ph, ColorWheel as gh, Command as bh, CommandEmpty as wh, CommandGroup as yh, CommandInput as vh, CommandList as kh, CommandItem as Sh, CommandSeparator as Ch, CommandShortcut as xh, ConfirmProvider as $h, ContextMenu as Ih, CurveEditor as Mh, Dialog as Th, Disclosure as Ah, DockArea as Eh, EyeButton as Oh, Field as Rh, FloatingPanels as Dh, GradientSlider as Lh, Hint as Nh, Histogram as Ph, ICON_STROKE as Fh, IconButton as Wh, KeyframeLane as zh, LevelMeter as Bh, LineChart as _h, LineMoreLabelContext as Kh, MenuButton as Hh, MenuItem as qh, MenuSeparator as Uh, Modal as jh, ModalBody as Gh, ModalClose as Yh, ModalCloseButton as Vh, ModalContent as Xh, ModalDescription as Jh, ModalFooter as Zh, ModalHeader as Qh, ModalTitle as ef, ModalTrigger as tf, NumberField as nf, OverflowStrip as rf, PALETTE_COLORS as of, Panel as af, PanelFooter as sf, PasswordInput as lf, PieChart as cf, Popover as df, PopoverAnchor as uf, PopoverClose as hf, PopoverContent as ff, PopoverTrigger as mf, PreviewDialog as pf, RGB_IDENTITY as gf, RenameField as bf, RibbonButton as wf, RibbonGroup as yf, RibbonItem as vf, RibbonPresentationContext as kf, RibbonRow as Sf, RibbonStack as Cf, SLIDER_GRADIENTS as xf, STANDARD_COLORS as $f, Segmented as If, Select as Mf, Sheet as Tf, Spinner as Af, StatusBar as Ef, StatusSpacer as Of, Switch as Rf, TableSizePicker as Df, TextInput as Lf, Textarea as Nf, Thumbnail as Pf, TimecodeField as Ff, Toaster as Wf, Tooltip as zf, TooltipContent as Bf, TooltipProvider as _f, TooltipTrigger as Kf, TransportBar as Hf, WORKSPACE_ACTIONS as qf, WorkspaceLayout as Uf, ZoomControl as jf, addCurvePoint as Gf, automaticFloatingPosition as Yf, brandTokens as Vf, clampFloatingRect as Xf, contrast as Jf, deviceScale as Zf, dockHeights as Qf, formatTimecode as em, hitCurvePoint as tm, kitStoreKey as nm, lightnessAt as rm, lineSize as im, menuKeyDown as om, meterFraction as am, meterLayout as sm, moveCurvePoint as lm, overflowOf as cm, parseHex as dm, parseTimecode as um, rankScale as hm, readKitStore as fm, removeCurvePoint as mm, removeKitStore as pm, resizeFloatingRect as gm, rgbToHex as bm, sampleCurve as wm, sliderFraction as ym, sliderValueAt as vm, smoothHistogram as km, sortCurve as Sm, storedBytes as Cm, toast as xm, useAutoSize as $m, useConfirm as Im, useDialogFocus as Mm, useDismissableLayer as Tm, useKitStore as Am, useMediaQuery as Em, useWorkspaces as Om, wheelRadius as Rm, wheelValueAt as Dm, workspaceSlug as Lm, writeKitStore as Nm } from "@kition/tessera-ui";
5
- import { useRef as R, useState as B, useCallback as H, useEffect as J, useMemo as pe, useImperativeHandle as Oo, createContext as Ot, useContext as Le, useSyncExternalStore as He, useLayoutEffect as Te, Fragment as Ro } from "react";
6
- import { jsx as u, jsxs as M, Fragment as Ce } from "react/jsx-runtime";
7
- import { CommandGenericIcon as Do, HeadingIcon as qr, ListTreeIcon as Lo, CodeIcon as No, ArrowRightLeftIcon as Po, WaypointsIcon as Ur, GaugeIcon as Fo, SlidersHorizontalIcon as _t, ClipboardIcon as Wo, DatabaseIcon as Kn, HashIcon as pn, ArrowDownToLineIcon as zo, ZapIcon as Bo, PaintbrushIcon as _o, TextCursorInputIcon as Ko, ListOrderedIcon as Hn, NetworkIcon as Ho, MousePointerClickIcon as jr, PenToolIcon as Gr, PencilIcon as tt, HighlighterIcon as Yr, WholeWordIcon as qo, TextCursorIcon as Uo, RulerIcon as Ve, ClapperboardIcon as Vr, BrushIcon as Xr, BlendIcon as Qe, PaletteIcon as Rt, TypeIcon as Ue, PilcrowIcon as jo, SwatchBookIcon as Go, LayersIcon as kt, SplineIcon as gn, CameraIcon as Yo, Rows3Icon as Jr, FilmIcon as qn, BookmarkIcon as Zr, DiamondIcon as Qr, BoxIcon as ei, Grid3x3Icon as St, FrameIcon as Jt, FolderIcon as Un, ClockIcon as Vo, Volume2Icon as Xo, VideoIcon as ti, SettingsIcon as bn, ShapesIcon as _e, LightbulbIcon as Jo, SquareIcon as ct, CrosshairIcon as Zo, Grid2x2Icon as Qo, MoveUpRightIcon as ea, MessageSquareIcon as Dt, FileIcon as wn, TableIcon as yn, SquareFunctionIcon as ni, ComponentIcon as ta, WandSparklesIcon as vn, MousePointer2Icon as nt, BoldIcon as na, ItalicIcon as ri, UnderlineIcon as ra, StrikethroughIcon as ia, SubscriptIcon as oa, SuperscriptIcon as aa, SquareDashedIcon as jn, ContrastIcon as sa, HandIcon as ii, ChevronsDownUpIcon as la, ChevronsUpDownIcon as ca, LinkIcon as Ct, ShieldCheckIcon as da, LifeBuoyIcon as ua, TrashIcon as rt, BookOpenIcon as ha, ArrowLeftIcon as fa, ArrowRightIcon as Gn, ArrowUpIcon as Yn, ArrowDownIcon as Vn, ArrowLeftToLineIcon as ma, ArrowRightToLineIcon as pa, ClipLiftIcon as ga, ClipExtractIcon as ba, FastForwardIcon as wa, StepForwardIcon as Xn, EyeOffIcon as Jn, Undo2Icon as kn, Redo2Icon as oi, SaveIcon as ai, FileOutputIcon as ya, FileInputIcon as va, FolderOpenIcon as ka, XIcon as Zt, PrinterIcon as Sn, CopyIcon as Cn, ScissorsIcon as xn, ClipboardPasteIcon as si, PencilLineIcon as Sa, SearchIcon as li, ReplaceIcon as ci, AlignCenterHorizontalIcon as Ca, RotateCwIcon as $n, FlipHorizontalIcon as xa, MoveIcon as di, ScalingIcon as ui, MergeIcon as $a, SplitIcon as Ia, GroupIcon as In, UngroupIcon as Mn, LockIcon as Tn, LockOpenIcon as Ma, EyeIcon as An, ZoomInIcon as hi, PlayIcon as Ta, PauseIcon as Aa, DiscIcon as Ea, RotateCcwIcon as fi, CheckIcon as En, ToggleLeftIcon as Oa, ChevronRightIcon as On, ChevronLeftIcon as Ra, CropIcon as mi, PlusIcon as pi, ListIcon as Da, RepeatIcon as La, ArrowUpDownIcon as gi, FunnelIcon as bi, UnlinkIcon as Na, RefreshCwIcon as wi, BringToFrontIcon as Qt, MagnetIcon as Pa, PenLineIcon as it, PaintBucketIcon as xt, TablePropertiesIcon as Fa, ActivityIcon as Wa, ChartColumnIcon as je, ImageIcon as za, StickerIcon as Ba, PanelTopIcon as yi, PanelBottomIcon as _a, SigmaIcon as Ka, OmegaIcon as Ha, SquareCheckBigIcon as qa, SignatureIcon as Ua, CalendarIcon as ja, MusicIcon as Ga, QrCodeIcon as Ya, LayoutTemplateIcon as Va, FilePlusIcon as Xa, Columns2Icon as vi, SpellCheckIcon as Ja, LanguagesIcon as Za, TagIcon as ki, RulerDimensionLineIcon as Qa, RadiusIcon as es, DiameterIcon as ts, PackageIcon as ns, StickyNoteIcon as rs, MousePointerIcon as is, LassoIcon as os, MinusIcon as Si, RainbowIcon as as, ShellIcon as ss, CircleIcon as Ci, EraserIcon as xi, VectorPolygonIcon as ls, VectorSquareIcon as cs, WavesHorizontalIcon as ds, Move3dIcon as us, PipetteIcon as hs, CopyPlusIcon as fs, MoveHorizontalIcon as ms, CornerDownRightIcon as ps, UploadIcon as gs, StarIcon as $i, Share2Icon as bs, SendIcon as ws, MailIcon as ys, InfoIcon as vs, CircleQuestionMarkIcon as ks, FlagIcon as Ss, DownloadIcon as Cs, BellIcon as xs, ChevronDownIcon as Ii, ChevronsLeftIcon as $s, ChevronsRightIcon as Is, SparklesIcon as Lt, EllipsisIcon as Ms, RectangleHorizontalIcon as Mi, TriangleIcon as Ts, MoveRightIcon as As, SendToBackIcon as Es, CableIcon as Os, PenIcon as Ti, ChartColumnStackedIcon as Rs, ChartLineIcon as Zn, ChartAreaIcon as Ds, ChartPieIcon as Qn, ChartScatterIcon as Ls, RadarIcon as Ns, LayoutGridIcon as Ps, TrendingUpIcon as Fs, Table2Icon as Ws, Minimize2Icon as zs, FocusIcon as Ai, MenuIcon as Bs } from "@kition/tessera-icons/react";
3
+ import { brandTokens as yo, validBrand as vo, Dialog as st, Button as me, ElementsProvider as ko, MenuItem as le, RibbonButton as we, ICON_STROKE as $e, RibbonGroup as Me, StringsProvider as So, RibbonPresentationContext as vt, RibbonFitContext as Yt, lineSize as Co, MenuButton as lt, FULL_RIBBON_FIT as mn, menuKeyDown as xo, toast as pt, IconButton as De, OverflowStrip as Et, StatusBar as $o, StatusSpacer as Io, ZoomControl as Mo, Toaster as To, RibbonStack as Fe, ColorGrid as Vt, MenuSeparator as Ae, Choice as gt, Checkbox as Xt, LineMoreLabelContext as Ao, DropPanel as Eo } from "@kition/tessera-ui";
4
+ import { Badge as oh, BarChart as ah, BarSeparator as sh, Button as lh, Card as ch, CardContent as dh, CardHeader as uh, Checkbox as hh, Choice as fh, ColorGrid as mh, ColorPicker as ph, ColorWheel as gh, Command as wh, CommandEmpty as bh, CommandGroup as yh, CommandInput as vh, CommandList as kh, CommandItem as Sh, CommandSeparator as Ch, CommandShortcut as xh, ConfirmProvider as $h, ContextMenu as Ih, CurveEditor as Mh, Dialog as Th, Disclosure as Ah, DockArea as Eh, EyeButton as Oh, Field as Rh, FloatingPanels as Dh, GradientSlider as Lh, Hint as Ph, Histogram as Nh, ICON_STROKE as Fh, IconButton as Wh, KeyframeLane as zh, LevelMeter as Bh, LineChart as _h, LineMoreLabelContext as Kh, MenuButton as Hh, MenuItem as qh, MenuSeparator as Uh, Modal as jh, ModalBody as Gh, ModalClose as Yh, ModalCloseButton as Vh, ModalContent as Xh, ModalDescription as Jh, ModalFooter as Zh, ModalHeader as Qh, ModalTitle as ef, ModalTrigger as tf, NumberField as nf, OverflowStrip as rf, PALETTE_COLORS as of, Panel as af, PanelFooter as sf, PasswordInput as lf, PieChart as cf, Popover as df, PopoverAnchor as uf, PopoverClose as hf, PopoverContent as ff, PopoverTrigger as mf, PreviewDialog as pf, RGB_IDENTITY as gf, RenameField as wf, RibbonButton as bf, RibbonGroup as yf, RibbonItem as vf, RibbonPresentationContext as kf, RibbonRow as Sf, RibbonStack as Cf, SLIDER_GRADIENTS as xf, STANDARD_COLORS as $f, Segmented as If, Select as Mf, Sheet as Tf, Spinner as Af, StatusBar as Ef, StatusSpacer as Of, Switch as Rf, TableSizePicker as Df, TextInput as Lf, Textarea as Pf, Thumbnail as Nf, TimecodeField as Ff, Toaster as Wf, Tooltip as zf, TooltipContent as Bf, TooltipProvider as _f, TooltipTrigger as Kf, TransportBar as Hf, WORKSPACE_ACTIONS as qf, WorkspaceLayout as Uf, ZoomControl as jf, addCurvePoint as Gf, automaticFloatingPosition as Yf, brandTokens as Vf, clampFloatingRect as Xf, contrast as Jf, deviceScale as Zf, dockHeights as Qf, formatTimecode as em, hitCurvePoint as tm, kitStoreKey as nm, lightnessAt as rm, lineSize as im, menuKeyDown as om, meterFraction as am, meterLayout as sm, moveCurvePoint as lm, overflowOf as cm, parseHex as dm, parseTimecode as um, rankScale as hm, readKitStore as fm, removeCurvePoint as mm, removeKitStore as pm, resizeFloatingRect as gm, rgbToHex as wm, sampleCurve as bm, sliderFraction as ym, sliderValueAt as vm, smoothHistogram as km, sortCurve as Sm, storedBytes as Cm, toast as xm, useAutoSize as $m, useConfirm as Im, useDialogFocus as Mm, useDismissableLayer as Tm, useKitStore as Am, useMediaQuery as Em, useWorkspaces as Om, wheelRadius as Rm, wheelValueAt as Dm, workspaceSlug as Lm, writeKitStore as Pm } from "@kition/tessera-ui";
5
+ import { useRef as R, useState as B, useCallback as K, useEffect as J, useMemo as pe, useImperativeHandle as Oo, createContext as Ot, useContext as Le, useSyncExternalStore as He, useLayoutEffect as Te, Fragment as Ro } from "react";
6
+ import { jsx as u, jsxs as T, Fragment as Ce } from "react/jsx-runtime";
7
+ import { CommandGenericIcon as Do, HeadingIcon as qr, ListTreeIcon as Lo, CodeIcon as Po, ArrowRightLeftIcon as No, WaypointsIcon as Ur, GaugeIcon as Fo, SlidersHorizontalIcon as _t, ClipboardIcon as Wo, DatabaseIcon as Kn, HashIcon as pn, ArrowDownToLineIcon as zo, ZapIcon as Bo, PaintbrushIcon as _o, TextCursorInputIcon as Ko, ListOrderedIcon as Hn, NetworkIcon as Ho, MousePointerClickIcon as jr, PenToolIcon as Gr, PencilIcon as tt, HighlighterIcon as Yr, WholeWordIcon as qo, TextCursorIcon as Uo, RulerIcon as Ve, ClapperboardIcon as Vr, BrushIcon as Xr, BlendIcon as Qe, PaletteIcon as Rt, TypeIcon as Ue, PilcrowIcon as jo, SwatchBookIcon as Go, LayersIcon as kt, SplineIcon as gn, CameraIcon as Yo, Rows3Icon as Jr, FilmIcon as qn, BookmarkIcon as Zr, DiamondIcon as Qr, BoxIcon as ei, Grid3x3Icon as St, FrameIcon as Jt, FolderIcon as Un, ClockIcon as Vo, Volume2Icon as Xo, VideoIcon as ti, SettingsIcon as wn, ShapesIcon as _e, LightbulbIcon as Jo, SquareIcon as ct, CrosshairIcon as Zo, Grid2x2Icon as Qo, MoveUpRightIcon as ea, MessageSquareIcon as Dt, FileIcon as bn, TableIcon as yn, SquareFunctionIcon as ni, ComponentIcon as ta, WandSparklesIcon as vn, MousePointer2Icon as nt, BoldIcon as na, ItalicIcon as ri, UnderlineIcon as ra, StrikethroughIcon as ia, SubscriptIcon as oa, SuperscriptIcon as aa, SquareDashedIcon as jn, ContrastIcon as sa, HandIcon as ii, ChevronsDownUpIcon as la, ChevronsUpDownIcon as ca, LinkIcon as Ct, ShieldCheckIcon as da, LifeBuoyIcon as ua, TrashIcon as rt, BookOpenIcon as ha, ArrowLeftIcon as fa, ArrowRightIcon as Gn, ArrowUpIcon as Yn, ArrowDownIcon as Vn, ArrowLeftToLineIcon as ma, ArrowRightToLineIcon as pa, ClipLiftIcon as ga, ClipExtractIcon as wa, FastForwardIcon as ba, StepForwardIcon as Xn, EyeOffIcon as Jn, Undo2Icon as kn, Redo2Icon as oi, SaveIcon as ai, FileOutputIcon as ya, FileInputIcon as va, FolderOpenIcon as ka, XIcon as Zt, PrinterIcon as Sn, CopyIcon as Cn, ScissorsIcon as xn, ClipboardPasteIcon as si, PencilLineIcon as Sa, SearchIcon as li, ReplaceIcon as ci, AlignCenterHorizontalIcon as Ca, RotateCwIcon as $n, FlipHorizontalIcon as xa, MoveIcon as di, ScalingIcon as ui, MergeIcon as $a, SplitIcon as Ia, GroupIcon as In, UngroupIcon as Mn, LockIcon as Tn, LockOpenIcon as Ma, EyeIcon as An, ZoomInIcon as hi, PlayIcon as Ta, PauseIcon as Aa, DiscIcon as Ea, RotateCcwIcon as fi, CheckIcon as En, ToggleLeftIcon as Oa, ChevronRightIcon as On, ChevronLeftIcon as Ra, CropIcon as mi, PlusIcon as pi, ListIcon as Da, RepeatIcon as La, ArrowUpDownIcon as gi, FunnelIcon as wi, UnlinkIcon as Pa, RefreshCwIcon as bi, BringToFrontIcon as Qt, MagnetIcon as Na, PenLineIcon as it, PaintBucketIcon as xt, TablePropertiesIcon as Fa, ActivityIcon as Wa, ChartColumnIcon as je, ImageIcon as za, StickerIcon as Ba, PanelTopIcon as yi, PanelBottomIcon as _a, SigmaIcon as Ka, OmegaIcon as Ha, SquareCheckBigIcon as qa, SignatureIcon as Ua, CalendarIcon as ja, MusicIcon as Ga, QrCodeIcon as Ya, LayoutTemplateIcon as Va, FilePlusIcon as Xa, Columns2Icon as vi, SpellCheckIcon as Ja, LanguagesIcon as Za, TagIcon as ki, RulerDimensionLineIcon as Qa, RadiusIcon as es, DiameterIcon as ts, PackageIcon as ns, StickyNoteIcon as rs, MousePointerIcon as is, LassoIcon as os, MinusIcon as Si, RainbowIcon as as, ShellIcon as ss, CircleIcon as Ci, EraserIcon as xi, VectorPolygonIcon as ls, VectorSquareIcon as cs, WavesHorizontalIcon as ds, Move3dIcon as us, PipetteIcon as hs, CopyPlusIcon as fs, MoveHorizontalIcon as ms, CornerDownRightIcon as ps, UploadIcon as gs, StarIcon as $i, Share2Icon as ws, SendIcon as bs, MailIcon as ys, InfoIcon as vs, CircleQuestionMarkIcon as ks, FlagIcon as Ss, DownloadIcon as Cs, BellIcon as xs, ChevronDownIcon as Ii, ChevronsLeftIcon as $s, ChevronsRightIcon as Is, SparklesIcon as Lt, EllipsisIcon as Ms, RectangleHorizontalIcon as Mi, TriangleIcon as Ts, MoveRightIcon as As, SendToBackIcon as Es, CableIcon as Os, PenIcon as Ti, ChartColumnStackedIcon as Rs, ChartLineIcon as Zn, ChartAreaIcon as Ds, ChartPieIcon as Qn, ChartScatterIcon as Ls, RadarIcon as Ps, LayoutGridIcon as Ns, TrendingUpIcon as Fs, Table2Icon as Ws, Minimize2Icon as zs, FocusIcon as Ai, MenuIcon as Bs } from "@kition/tessera-icons/react";
8
8
  import * as lu from "@kition/tessera-icons/react";
9
9
  import { w as Fm } from "./chunks/workspaceTree-CpJ2i9hy.js";
10
10
  const en = ["menus", "line", "classic", "focus"], _s = ["menus", "line", "classic"], Ks = 720;
@@ -192,7 +192,7 @@ function al(e, t) {
192
192
  return r.hostHidden ? [] : [r.hostDisabled ? { ...n, enabled: !1 } : n];
193
193
  });
194
194
  }
195
- function Ni(e, t, n) {
195
+ function Pi(e, t, n) {
196
196
  let r = e, i = null;
197
197
  const o = /* @__PURE__ */ new Set(), a = (s) => {
198
198
  r = i ? { ...s, personal: i } : s;
@@ -224,7 +224,7 @@ function nr(e, t = null, n = document.documentElement) {
224
224
  if (r) for (const [i, o] of Object.entries(yo(t, e.colorScheme))) n.style.setProperty(i, o);
225
225
  n.dataset.brand = r ? "kit" : "host", n.style.colorScheme = e.colorScheme, n.dataset.colorScheme = e.colorScheme;
226
226
  }
227
- const Nt = () => typeof navigator < "u" && /Mac|iPhone|iPad/i.test(navigator.platform);
227
+ const Pt = () => typeof navigator < "u" && /Mac|iPhone|iPad/i.test(navigator.platform);
228
228
  function cu(e) {
229
229
  return new Promise((t) => {
230
230
  const n = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, r = () => window.parent.postMessage({ kitionKitUi: 1, ready: Bt, id: n }, "*"), i = (o) => {
@@ -243,16 +243,16 @@ function cu(e) {
243
243
  const p = s.capabilities.includes("replica") && (e.capabilities ?? []).includes("replica"), h = {
244
244
  read: async (m) => {
245
245
  if (l && m === s.document.path) {
246
- const I = l;
247
- return l = null, { bytes: I, stamp: s.document.version ?? null };
246
+ const M = l;
247
+ return l = null, { bytes: M, stamp: s.document.version ?? null };
248
248
  }
249
249
  const y = await a.request("host/read", { path: m });
250
250
  return { bytes: y.bytes, stamp: y.version };
251
251
  },
252
252
  stamp: async (m) => (await a.request("host/stamp", { path: m })).version,
253
- write: async (m, y, I) => {
254
- const N = y.buffer.slice(y.byteOffset, y.byteOffset + y.byteLength);
255
- return (await a.request("host/write", { path: m, bytes: N, mode: "save", ...I === void 0 ? {} : { expected: I } }, { transfer: !0 })).version || null;
253
+ write: async (m, y, M) => {
254
+ const P = y.buffer.slice(y.byteOffset, y.byteOffset + y.byteLength);
255
+ return (await a.request("host/write", { path: m, bytes: P, mode: "save", ...M === void 0 ? {} : { expected: M } }, { transfer: !0 })).version || null;
256
256
  },
257
257
  lend: () => s.document.lend ?? null
258
258
  };
@@ -264,16 +264,16 @@ function cu(e) {
264
264
  });
265
265
  const f = vo(e.brand);
266
266
  nr(s.theme, f);
267
- const g = Ni(
267
+ const g = Pi(
268
268
  tr(s.ui),
269
269
  s.capabilities.includes("customize") ? async (m) => void await a.request("host/customize", { personal: { hide: m } }) : null,
270
270
  (m) => a.notify("ui/action", m)
271
271
  );
272
272
  a.on("ui/configure", (m) => g.replace(tr(m?.ui))), document.documentElement.lang = s.locale;
273
- const b = s.shortcuts, w = (m) => {
274
- b.some((y) => Hr(y, m, Nt())) && (m.preventDefault(), m.stopPropagation(), a.notify("host/shortcut", { key: m.key, code: m.code, meta: m.metaKey, ctrl: m.ctrlKey, shift: m.shiftKey, alt: m.altKey }));
273
+ const w = s.shortcuts, b = (m) => {
274
+ w.some((y) => Hr(y, m, Pt())) && (m.preventDefault(), m.stopPropagation(), a.notify("host/shortcut", { key: m.key, code: m.code, meta: m.metaKey, ctrl: m.ctrlKey, shift: m.shiftKey, alt: m.altKey }));
275
275
  };
276
- window.addEventListener("keydown", w, !0), a.on("ui/theme", ({ theme: m }) => nr(m, f)), a.on("ui/locale", ({ locale: m }) => {
276
+ window.addEventListener("keydown", b, !0), a.on("ui/theme", ({ theme: m }) => nr(m, f)), a.on("ui/locale", ({ locale: m }) => {
277
277
  document.documentElement.lang = m;
278
278
  }), t({
279
279
  peer: a,
@@ -286,8 +286,8 @@ function cu(e) {
286
286
  permissions: mo(s.document.permissions),
287
287
  watermark: fo(s.document.watermark),
288
288
  onReveal: (m) => a.on("document/reveal", (y) => {
289
- const I = _n(y?.view);
290
- I && m(I);
289
+ const M = _n(y?.view);
290
+ M && m(M);
291
291
  }),
292
292
  ui: g,
293
293
  brand: f,
@@ -296,14 +296,14 @@ function cu(e) {
296
296
  declaration: e.ui ?? null,
297
297
  opened: (m = []) => {
298
298
  const y = [...e.capabilities ?? ["ai"], ...e.ui ? ["ui-config"] : []];
299
- d({ kit: { id: e.id, version: e.version }, capabilities: [...y, ...m.filter((I) => !y.includes(I))] });
299
+ d({ kit: { id: e.id, version: e.version }, capabilities: [...y, ...m.filter((M) => !y.includes(M))] });
300
300
  },
301
301
  failed: (m) => c(m),
302
302
  changed: (m) => a.notify("document/changed", m),
303
303
  notify: (m) => a.notify("host/notify", m),
304
304
  exportFile: async (m, y) => {
305
- const I = y.buffer.slice(y.byteOffset, y.byteOffset + y.byteLength);
306
- return (await a.request("host/write", { path: m, bytes: I, mode: "export" }, { transfer: !0 })).path;
305
+ const M = y.buffer.slice(y.byteOffset, y.byteOffset + y.byteLength);
306
+ return (await a.request("host/write", { path: m, bytes: M, mode: "export" }, { transfer: !0 })).path;
307
307
  },
308
308
  openAgent: async (m) => {
309
309
  await a.request("host/openAgent", m ? { prompt: m } : {});
@@ -313,27 +313,27 @@ function cu(e) {
313
313
  hasService: (m) => s.capabilities.includes(`${Bn}${m}`),
314
314
  service: async (m, y) => {
315
315
  if (!s.capabilities.includes(`${Bn}${m}`)) throw new he(-32e3, `the host does not serve ${m}`, { reason: "not-allowed" });
316
- const I = m === "file.saveAs";
317
- return await a.request("host/service", { service: m, params: y }, I ? { transfer: !0 } : void 0);
316
+ const M = m === "file.saveAs";
317
+ return await a.request("host/service", { service: m, params: y }, M ? { transfer: !0 } : void 0);
318
318
  },
319
319
  commentAnchors: s.capabilities.includes("comment-anchors"),
320
320
  onComments: (m) => a.on("comments/show", (y) => {
321
- const I = Array.isArray(y?.threads) ? y.threads : [];
321
+ const M = Array.isArray(y?.threads) ? y.threads : [];
322
322
  m(
323
- I.flatMap((N) => {
324
- const E = zn(N?.anchor);
325
- return E && typeof N?.id == "string" ? [{ id: N.id, anchor: E, resolved: N.resolved === !0, count: Number.isSafeInteger(N.count) ? N.count : 0 }] : [];
323
+ M.flatMap((P) => {
324
+ const E = zn(P?.anchor);
325
+ return E && typeof P?.id == "string" ? [{ id: P.id, anchor: E, resolved: P.resolved === !0, count: Number.isSafeInteger(P.count) ? P.count : 0 }] : [];
326
326
  })
327
327
  );
328
328
  }),
329
329
  activateComment: (m) => a.notify("comments/activated", { id: m }),
330
330
  locateComments: (m) => a.handle("comments/locate", async (y) => {
331
- const N = (Array.isArray(y?.anchors) ? y.anchors : []).map((q) => zn(q)), E = await m(N.filter((q) => q !== null));
332
- let Y = 0;
333
- return { found: N.map((q) => q ? E[Y++] === !0 : !1) };
331
+ const P = (Array.isArray(y?.anchors) ? y.anchors : []).map((q) => zn(q)), E = await m(P.filter((q) => q !== null));
332
+ let G = 0;
333
+ return { found: P.map((q) => q ? E[G++] === !0 : !1) };
334
334
  }),
335
335
  close: () => {
336
- window.removeEventListener("keydown", w, !0), a.close();
336
+ window.removeEventListener("keydown", b, !0), a.close();
337
337
  }
338
338
  });
339
339
  })
@@ -347,7 +347,7 @@ class Je extends Error {
347
347
  super(t.message), this.data = t, this.name = "KitModelError";
348
348
  }
349
349
  }
350
- const ll = /* @__PURE__ */ new Set(["edit.undo", "undo"]), cl = /* @__PURE__ */ new Set(["edit.redo", "redo"]), Oe = "read-only", Pe = Object.freeze({
350
+ const ll = /* @__PURE__ */ new Set(["edit.undo", "undo"]), cl = /* @__PURE__ */ new Set(["edit.redo", "redo"]), Oe = "read-only", Ne = Object.freeze({
351
351
  /**
352
352
  * Families whose commands only change what the person sees (zoom, selection, the playhead,
353
353
  * playback): they run even when their kit flags them `mutates`.
@@ -431,16 +431,16 @@ const ll = /* @__PURE__ */ new Set(["edit.undo", "undo"]), cl = /* @__PURE__ */
431
431
  });
432
432
  function dl(e) {
433
433
  const { id: t } = e, n = t.split(".")[0] ?? "";
434
- return Pe.editingCommands.includes(t) || Pe.documentSettings.includes(t) ? !0 : Pe.editingGroups.includes(n) ? !Pe.fileOutputs.test(t) : Pe.viewingCommands.includes(t) || Pe.viewingGroups.includes(n) ? !1 : e.mutates === !0;
434
+ return Ne.editingCommands.includes(t) || Ne.documentSettings.includes(t) ? !0 : Ne.editingGroups.includes(n) ? !Ne.fileOutputs.test(t) : Ne.viewingCommands.includes(t) || Ne.viewingGroups.includes(n) ? !1 : e.mutates === !0;
435
435
  }
436
436
  function ul(e, t) {
437
- return !t || !e ? /* @__PURE__ */ new Set() : new Set(e.filter((n) => typeof n == "string" && !Pe.editingCommands.includes(n) && !Pe.editingGroups.includes(n.split(".")[0] ?? "")));
437
+ return !t || !e ? /* @__PURE__ */ new Set() : new Set(e.filter((n) => typeof n == "string" && !Ne.editingCommands.includes(n) && !Ne.editingGroups.includes(n.split(".")[0] ?? "")));
438
438
  }
439
- function Pi(e, t) {
439
+ function Ni(e, t) {
440
440
  return t.size === 0 ? null : ll.has(e) ? "undo" : cl.has(e) ? "redo" : null;
441
441
  }
442
442
  function It(e, t) {
443
- return dl(e) && !t.has(e.id) && Pi(e.id, t) === null;
443
+ return dl(e) && !t.has(e.id) && Ni(e.id, t) === null;
444
444
  }
445
445
  function hl(e, t) {
446
446
  return t.size > 0 && It(e, t);
@@ -476,6 +476,9 @@ class ot {
476
476
  pending = /* @__PURE__ */ new Map();
477
477
  nextId = 1;
478
478
  failure = null;
479
+ fontListeners = /* @__PURE__ */ new Set();
480
+ /** How many of the manifest's `lazyFonts` the engine has not been given yet. */
481
+ fontsPending = 0;
479
482
  /**
480
483
  * Starts a worker and opens the file's bytes in it with the kit's SDK; the bytes move to the
481
484
  * worker. `lent` is where the document's other files (media) are read from, if anywhere;
@@ -487,7 +490,7 @@ class ot {
487
490
  static async open(t, n, r, i = null, o = null, a = !1, s = !1) {
488
491
  const d = new Worker(new URL(
489
492
  /* @vite-ignore */
490
- "" + new URL("assets/kitEngine.worker-Bb4qhbsX.js", import.meta.url).href,
493
+ "" + new URL("assets/kitEngine.worker-BfM9MCRl.js", import.meta.url).href,
491
494
  import.meta.url
492
495
  ), { type: "module" }), c = new ot(d, qt);
493
496
  d.onmessage = (l) => c.settle(l.data), d.onerror = (l) => c.fail(new Error(l.message || "the kit engine stopped"));
@@ -505,7 +508,7 @@ class ot {
505
508
  static async create(t, n, r, i, o = null, a = !1) {
506
509
  const s = new Worker(new URL(
507
510
  /* @vite-ignore */
508
- "" + new URL("assets/kitEngine.worker-Bb4qhbsX.js", import.meta.url).href,
511
+ "" + new URL("assets/kitEngine.worker-BfM9MCRl.js", import.meta.url).href,
509
512
  import.meta.url
510
513
  ), { type: "module" }), d = new ot(s, qt);
511
514
  s.onmessage = (c) => d.settle(c.data), s.onerror = (c) => d.fail(new Error(c.message || "the kit engine stopped"));
@@ -525,6 +528,11 @@ class ot {
525
528
  return this.info.pinned;
526
529
  }
527
530
  settle(t) {
531
+ if (!("id" in t)) {
532
+ const r = t.fonts < this.fontsPending;
533
+ if (this.fontsPending = t.fonts, r) for (const i of this.fontListeners) i();
534
+ return;
535
+ }
528
536
  const n = this.pending.get(t.id);
529
537
  n && (this.pending.delete(t.id), t.ok === !0 ? n.resolve(t.value) : t.data ? n.reject(new Je(t.data)) : t.reason === Oe ? n.reject(new Mt("", t.error)) : t.reason === At ? n.reject(new Rn(t.error, t.errors ?? [])) : t.reason === rn ? n.reject(new Wi(rn, t.error)) : n.reject(new Error(t.error)));
530
538
  }
@@ -673,6 +681,18 @@ class ot {
673
681
  async markSaved(t) {
674
682
  this.info = await this.call({ method: "markSaved", revision: t });
675
683
  }
684
+ /**
685
+ * Calls `listener` each time the engine was given one of the manifest's `lazyFonts`: what it
686
+ * draws may have changed (text it drew as missing glyphs), so the page draws again. Answers how
687
+ * to stop.
688
+ */
689
+ onFonts(t) {
690
+ return this.fontListeners.add(t), () => this.fontListeners.delete(t);
691
+ }
692
+ /** Gives the engine every one of the manifest's `lazyFonts` now; resolves once each is in (or skipped). */
693
+ async loadFonts() {
694
+ await this.call({ method: "fonts" });
695
+ }
676
696
  /** Brings `info` up to date after changes it does not follow (an `invoke` that edits, such as a merge of the file). */
677
697
  async refreshInfo() {
678
698
  return this.info = await this.call({ method: "info" }), this.info;
@@ -741,14 +761,14 @@ function gl() {
741
761
  };
742
762
  }
743
763
  const on = /* @__PURE__ */ new WeakMap();
744
- function bl(e, t) {
764
+ function wl(e, t) {
745
765
  const n = on.get(e);
746
766
  return n ? (n.current = t, () => {
747
767
  n.current === t && (n.current = null);
748
768
  }) : () => {
749
769
  };
750
770
  }
751
- class wl extends Error {
771
+ class bl extends Error {
752
772
  constructor(t) {
753
773
  super(`${t} changed on disk since it was opened; merge the change or keep yours before saving`), this.name = "FileChangedError";
754
774
  }
@@ -765,12 +785,12 @@ function kl(e, t, n, r, i, o = {}) {
765
785
  c.current = o.followFile;
766
786
  const l = R(null), p = R(i);
767
787
  p.current = i;
768
- const h = R(null), f = R(!1), [g, b] = B(null), [w, m] = B(null), [y, I] = B(null), [N, E] = B({ revision: 0, damage: null }), [Y, q] = B(!1), [V, j] = B(null), [D, Z] = B(null), [Q, fe] = B(!1), [ce, k] = B(!1), [O, U] = B(0), x = R(null);
788
+ const h = R(null), f = R(!1), [g, w] = B(null), [b, m] = B(null), [y, M] = B(null), [P, E] = B({ revision: 0, damage: null }), [G, q] = B(!1), [Y, U] = B(null), [D, Z] = B(null), [Q, fe] = B(!1), [ce, k] = B(!1), [O, H] = B(0), x = R(null);
769
789
  x.current ??= gl();
770
- const C = x.current, W = H((S = null) => {
790
+ const C = x.current, W = K((S = null) => {
771
791
  const $ = l.current;
772
- $ && (m($.info), I(p.current($.info)), q($.info.dirty), E((F) => ({ revision: F.revision + 1, damage: S })));
773
- }, []), _ = H(async (S) => {
792
+ $ && (m($.info), M(p.current($.info)), q($.info.dirty), E((F) => ({ revision: F.revision + 1, damage: S })));
793
+ }, []), V = K(async (S) => {
774
794
  f.current = !0;
775
795
  try {
776
796
  const { bytes: $, stamp: F } = await e.read(n);
@@ -783,28 +803,28 @@ function kl(e, t, n, r, i, o = {}) {
783
803
  return;
784
804
  }
785
805
  const ke = l.current;
786
- l.current = oe, h.current = F, b(oe), k(!1), j(null), W(), ke?.dispose();
806
+ l.current = oe, h.current = F, w(oe), k(!1), U(null), W(), ke?.dispose();
787
807
  } finally {
788
808
  f.current = !1;
789
809
  }
790
810
  }, [s, e, t, d, n, a, W]);
791
811
  J(() => {
792
812
  let S = !0;
793
- return _(() => S).catch(($) => {
794
- S && j(vl($));
813
+ return V(() => S).catch(($) => {
814
+ S && U(vl($));
795
815
  }), () => {
796
816
  S = !1;
797
817
  };
798
- }, [O, _]), J(() => () => {
818
+ }, [O, V]), J(() => () => {
799
819
  l.current?.dispose(), l.current = null;
800
820
  }, [n]);
801
- const T = R(/* @__PURE__ */ new Set()), K = H((S) => {
802
- T.current.add(S);
803
- const $ = () => T.current.delete(S);
821
+ const I = R(/* @__PURE__ */ new Set()), _ = K((S) => {
822
+ I.current.add(S);
823
+ const $ = () => I.current.delete(S);
804
824
  return S.then($, $), S;
805
- }, []), ne = H(async () => {
806
- for (; T.current.size; ) await Promise.allSettled([...T.current]);
807
- }, []), P = H(
825
+ }, []), ne = K(async () => {
826
+ for (; I.current.size; ) await Promise.allSettled([...I.current]);
827
+ }, []), N = K(
808
828
  async (S = () => !0) => {
809
829
  const $ = l.current;
810
830
  if (!(!$ || f.current || !h.current))
@@ -832,44 +852,44 @@ function kl(e, t, n, r, i, o = {}) {
832
852
  return;
833
853
  }
834
854
  }
835
- S() && await _(S);
855
+ S() && await V(S);
836
856
  } catch {
837
857
  }
838
858
  },
839
- [e, _, n, W, ne]
859
+ [e, V, n, W, ne]
840
860
  );
841
861
  J(() => {
842
862
  let S = !0;
843
- const $ = window.setInterval(() => void P(() => S), yl);
863
+ const $ = window.setInterval(() => void N(() => S), yl);
844
864
  return () => {
845
865
  S = !1, window.clearInterval($);
846
866
  };
847
- }, [r, P]);
848
- const G = R(null), ue = H((S) => G.current ? G.current(S) : S(), []), ye = H(
867
+ }, [r, N]);
868
+ const j = R(null), ue = K((S) => j.current ? j.current(S) : S(), []), ye = K(
849
869
  async (S, $, F, X) => {
850
870
  const ee = l.current;
851
871
  if (!ee) return null;
852
872
  const de = X.skipUnchangedPaint ? { revision: ee.info.revision, inspected: JSON.stringify(ee.info.inspected) } : null, oe = await ee.execute(S, $, X.origin, X.agent);
853
873
  if (l.current === ee) {
854
874
  if (ee.closed)
855
- return ee.dispose(), l.current = null, b(null), m(null), I(null), q(!1), k(!1), oe;
875
+ return ee.dispose(), l.current = null, w(null), m(null), M(null), q(!1), k(!1), oe;
856
876
  const ke = X.refresh ?? "all", dt = de != null && ee.info.revision === de.revision && JSON.stringify(ee.info.inspected) === de.inspected;
857
877
  ke === "all" ? W(dt ? rr : F) : ke === "repaint" && C.bump(F);
858
878
  }
859
879
  return oe;
860
880
  },
861
881
  [W, C]
862
- ), Ie = H(
863
- async (S, $ = {}, F = null, X = {}) => l.current ? K(ue(() => ye(S, $, F, X))) : null,
864
- [ue, ye, K]
865
- ), Ne = H(async (S, $ = [], F = !1) => {
882
+ ), Ie = K(
883
+ async (S, $ = {}, F = null, X = {}) => l.current ? _(ue(() => ye(S, $, F, X))) : null,
884
+ [ue, ye, _]
885
+ ), Pe = K(async (S, $ = [], F = !1) => {
866
886
  const X = l.current;
867
887
  if (!X) return null;
868
- const ee = X.info.revision, { value: de, changed: oe } = await K(X.tool(S, $, F));
888
+ const ee = X.info.revision, { value: de, changed: oe } = await _(X.tool(S, $, F));
869
889
  return l.current === X && oe && W(X.info.revision === ee ? rr : pl(de)), de;
870
- }, [W, K]);
871
- on.has(Ne) || on.set(Ne, G);
872
- const We = H(async () => l.current ? l.current.commands() : [], []), A = H(async () => ue(async () => l.current ? l.current.disabledCommands() : []), [ue]), L = H(async () => {
890
+ }, [W, _]);
891
+ on.has(Pe) || on.set(Pe, j);
892
+ const We = K(async () => l.current ? l.current.commands() : [], []), A = K(async () => ue(async () => l.current ? l.current.disabledCommands() : []), [ue]), L = K(async () => {
873
893
  const S = l.current;
874
894
  if (S) {
875
895
  if (a) throw new Mt("Save");
@@ -877,7 +897,7 @@ function kl(e, t, n, r, i, o = {}) {
877
897
  try {
878
898
  const $ = h.current, F = $ ? await e.stamp(n).catch(() => null) : null;
879
899
  if ($ && F && F !== $)
880
- throw k(!0), new wl(n);
900
+ throw k(!0), new bl(n);
881
901
  const { bytes: X, replica: ee, revision: de } = await ue(async () => e.replicaWrite ? S.saveWithReplica() : { ...await S.serialize(), replica: null });
882
902
  h.current = await ml(e, n, X, ee, $), l.current === S && await S.markSaved(de), k(!1), W();
883
903
  } finally {
@@ -942,18 +962,18 @@ function kl(e, t, n, r, i, o = {}) {
942
962
  }),
943
963
  compare: ($, F) => S().replicaCompare($, F)
944
964
  };
945
- }, [e, t, ue, n, a, W]), se = H(() => U((S) => S + 1), []), ge = H(
965
+ }, [e, t, ue, n, a, W]), se = K(() => H((S) => S + 1), []), ge = K(
946
966
  async (S) => {
947
967
  if (!S) return;
948
968
  h.current = S, await e.stamp(n).catch(() => null) === S && k(!1);
949
969
  },
950
970
  [e, n]
951
- ), v = H(async () => {
971
+ ), v = K(async () => {
952
972
  k(!1);
953
973
  const S = await e.stamp(n).catch(() => null);
954
974
  S && (h.current = S);
955
975
  }, [e, n]), z = pe(() => ({ get: C.get, subscribe: C.subscribe }), [C]);
956
- return { path: n, manifest: t, doc: g, info: w, state: y, change: N, repaints: z, dirty: Y, failure: V, openMs: D, saving: Q, conflict: ce, run: Ie, tool: Ne, commands: We, disabledCommands: A, save: L, replica: re, model: ie, draft: ae, reopen: se, keepMine: v, checkFile: P, holdFile: ge };
976
+ return { path: n, manifest: t, doc: g, info: b, state: y, change: P, repaints: z, dirty: G, failure: Y, openMs: D, saving: Q, conflict: ce, run: Ie, tool: Pe, commands: We, disabledCommands: A, save: L, replica: re, model: ie, draft: ae, reopen: se, keepMine: v, checkFile: N, holdFile: ge };
957
977
  }
958
978
  async function an(e, t) {
959
979
  const n = Math.min(1, t / Math.max(1, e.width, e.height)), r = Math.max(1, Math.round(e.width * n)), i = Math.max(1, Math.round(e.height * n)), o = await e.render(0, 0, n, r, i), a = document.createElement("canvas");
@@ -1063,7 +1083,7 @@ class Cl {
1063
1083
  }
1064
1084
  const xl = [
1065
1085
  [/^tool-selection$/, nt],
1066
- [/^tool-page$/, wn],
1086
+ [/^tool-page$/, bn],
1067
1087
  [/^tool-gap$/, vi],
1068
1088
  [/^tool-(collector|placer)/, ns],
1069
1089
  [/^tool-(rect-frame|ellipse-frame|polygon-frame)/, Jt],
@@ -1148,7 +1168,7 @@ const Il = [
1148
1168
  [/page|section|break|sheet|slide/, Xa],
1149
1169
  [/rows?\b/, Jr],
1150
1170
  [/columns?\b/, vi],
1151
- [/filter/, bi],
1171
+ [/filter/, wi],
1152
1172
  [/sort/, gi],
1153
1173
  [/ungroup/, Mn],
1154
1174
  [/group/, In],
@@ -1161,12 +1181,12 @@ const Il = [
1161
1181
  [/copy|duplicate/, Cn],
1162
1182
  [/cut\b/, xn],
1163
1183
  [/delete|remove|clear/, rt],
1164
- [/refresh|recalc/, wi],
1184
+ [/refresh|recalc/, bi],
1165
1185
  [/protect|lock/, Tn],
1166
1186
  [/name|label|tag/, ki],
1167
1187
  [/show|hide|view/, An],
1168
- [/option|setting|propert/, bn],
1169
- [/\bfile\b|document/, wn]
1188
+ [/option|setting|propert/, wn],
1189
+ [/\bfile\b|document/, bn]
1170
1190
  ], Ml = [
1171
1191
  [/^(?:bold)$/, na],
1172
1192
  [/^(?:italic)$/, ri],
@@ -1193,8 +1213,8 @@ const Il = [
1193
1213
  [/^(?:home|start)$/, ma],
1194
1214
  [/^(?:end)$/, pa],
1195
1215
  [/^(?:lift)$/, ga],
1196
- [/^(?:extract)$/, ba],
1197
- [/^(?:shuttle)$/, wa],
1216
+ [/^(?:extract)$/, wa],
1217
+ [/^(?:shuttle)$/, ba],
1198
1218
  [/^(?:tick|advance)$/, Xn],
1199
1219
  [/^(?:batch)$/, kt],
1200
1220
  [/^(?:redact)$/, Jn],
@@ -1248,15 +1268,15 @@ const Il = [
1248
1268
  [/^(?:list|inspect|info|get|query|state)$/, Da],
1249
1269
  [/^(?:convert|change)$/, La],
1250
1270
  [/^(?:sort)$/, gi],
1251
- [/^(?:filter)$/, bi],
1271
+ [/^(?:filter)$/, wi],
1252
1272
  [/^(?:link)$/, Ct],
1253
- [/^(?:unlink)$/, Na],
1273
+ [/^(?:unlink)$/, Pa],
1254
1274
  [/^(?:increase|grow|raise)$/, Yn],
1255
1275
  [/^(?:decrease|shrink|lower)$/, Vn],
1256
- [/^(?:refresh|reload|update|sync)$/, wi],
1276
+ [/^(?:refresh|reload|update|sync)$/, bi],
1257
1277
  [/^(?:define|edit|modify|configure)$/, tt],
1258
1278
  [/^(?:arrange|order|bring|send)$/, Qt],
1259
- [/^(?:snap)$/, Pa],
1279
+ [/^(?:snap)$/, Na],
1260
1280
  [/^(?:smooth|simplify)$/, gn],
1261
1281
  [/^(?:stroke|outline)$/, it],
1262
1282
  [/^(?:fill)$/, xt],
@@ -1264,8 +1284,8 @@ const Il = [
1264
1284
  ], or = [
1265
1285
  [/\b(?:heading|title)\b/, qr],
1266
1286
  [/\b(?:level|outline|tree)\b/, Lo],
1267
- [/\b(?:code)\b/, No],
1268
- [/\b(?:direction)\b/, Po],
1287
+ [/\b(?:code)\b/, Po],
1288
+ [/\b(?:direction)\b/, No],
1269
1289
  [/\b(?:waypoints?|bends?)\b/, Ur],
1270
1290
  [/\b(?:stats|statistics|performance)\b/, Fo],
1271
1291
  [/\b(?:mixer)\b/, _t],
@@ -1277,7 +1297,7 @@ const Il = [
1277
1297
  [/\b(?:painter)\b/, _o],
1278
1298
  [/\b(?:field|form)\b/, Ko],
1279
1299
  [/\b(?:tab order)\b/, Hn],
1280
- [/\b(?:smart ?art|diagram)\b/, Ho],
1300
+ [/\b(?:smart ?graphics?|diagram)\b/, Ho],
1281
1301
  [/\b(?:action button|button)\b/, jr],
1282
1302
  [/\b(?:pen)\b/, Gr],
1283
1303
  [/\b(?:pencil)\b/, tt],
@@ -1311,7 +1331,7 @@ const Il = [
1311
1331
  [/\b(?:playhead|time|duration)\b/, Vo],
1312
1332
  [/\b(?:audio|sound|volume)\b/, Xo],
1313
1333
  [/\b(?:video)\b/, ti],
1314
- [/\b(?:preferences|settings|options)\b/, bn],
1334
+ [/\b(?:preferences|settings|options)\b/, wn],
1315
1335
  [/\b(?:shape|rectangle|ellipse|polygon)\b/, _e],
1316
1336
  [/\b(?:light|lamp)\b/, Jo],
1317
1337
  [/\b(?:solid)\b/, ct],
@@ -1323,7 +1343,7 @@ const Il = [
1323
1343
  [/\b(?:gradient mesh|mesh)\b/, St],
1324
1344
  [/\b(?:line|arrow)\b/, ea],
1325
1345
  [/\b(?:comment|note)\b/, Dt],
1326
- [/\b(?:page)\b/, wn],
1346
+ [/\b(?:page)\b/, bn],
1327
1347
  [/\b(?:cell|row|column)\b/, yn],
1328
1348
  [/\b(?:formula|function)\b/, ni],
1329
1349
  [/\b(?:symbol)\b/, ta],
@@ -1344,7 +1364,7 @@ function Ge(e) {
1344
1364
  const a = Ml.find(([s]) => s.test(r) || s.test(i))?.[1];
1345
1365
  return a || (or.find(([s]) => s.test(o))?.[1] ?? Il.find(([s]) => s.test(o))?.[1] ?? at);
1346
1366
  }
1347
- function Pt(e) {
1367
+ function Nt(e) {
1348
1368
  return Object.values(e.schema ?? {}).some((t) => t.required);
1349
1369
  }
1350
1370
  const Tl = 6, sr = (e) => typeof e == "string" ? e : JSON.stringify(e);
@@ -1378,33 +1398,33 @@ function Ol({
1378
1398
  title: o
1379
1399
  }) {
1380
1400
  const a = e.schema ?? {}, [s, d] = B(() => Object.fromEntries(Object.entries(a).map(([m, y]) => [m, Al(y, i[m])]))), c = Object.entries(a), l = c.length > Tl, p = ([m, y]) => !l || y.required || i[m] !== void 0, h = c.filter(p), f = c.filter((m) => !p(m)), g = ([m, y]) => {
1381
- const I = (E) => d((Y) => ({ ...Y, [m]: E })), N = `param-${m}`;
1401
+ const M = (E) => d((G) => ({ ...G, [m]: E })), P = `param-${m}`;
1382
1402
  return [
1383
- /* @__PURE__ */ M("label", { htmlFor: N, title: y.description, children: [
1403
+ /* @__PURE__ */ T("label", { htmlFor: P, title: y.description, children: [
1384
1404
  m,
1385
1405
  y.required ? /* @__PURE__ */ u("span", { title: r.required, children: " *" }) : null
1386
1406
  ] }, `${m}-label`),
1387
- y.enum?.length ? /* @__PURE__ */ M("select", { id: N, className: "kui-field", value: s[m], onChange: (E) => I(E.target.value), children: [
1407
+ y.enum?.length ? /* @__PURE__ */ T("select", { id: P, className: "kui-field", value: s[m], onChange: (E) => M(E.target.value), children: [
1388
1408
  y.required ? null : /* @__PURE__ */ u("option", { value: "" }),
1389
1409
  y.enum.map((E) => /* @__PURE__ */ u("option", { value: String(E), children: String(E) }, String(E)))
1390
- ] }, m) : y.type === "boolean" ? /* @__PURE__ */ u("input", { id: N, type: "checkbox", checked: s[m] === "true", onChange: (E) => I(String(E.target.checked)) }, m) : /* @__PURE__ */ u(
1410
+ ] }, m) : y.type === "boolean" ? /* @__PURE__ */ u("input", { id: P, type: "checkbox", checked: s[m] === "true", onChange: (E) => M(String(E.target.checked)) }, m) : /* @__PURE__ */ u(
1391
1411
  "input",
1392
1412
  {
1393
- id: N,
1413
+ id: P,
1394
1414
  className: "kui-field",
1395
1415
  type: y.type === "number" || y.type === "integer" ? "number" : "text",
1396
1416
  value: s[m],
1397
1417
  placeholder: y.description,
1398
- onChange: (E) => I(E.target.value)
1418
+ onChange: (E) => M(E.target.value)
1399
1419
  },
1400
1420
  m
1401
1421
  )
1402
1422
  ];
1403
- }, b = Object.entries(a).some(([m, y]) => y.required && (s[m] ?? "").trim() === ""), w = () => {
1423
+ }, w = Object.entries(a).some(([m, y]) => y.required && (s[m] ?? "").trim() === ""), b = () => {
1404
1424
  const m = {};
1405
- for (const [y, I] of Object.entries(a)) {
1406
- const N = El(I, s[y] ?? "");
1407
- N !== void 0 && (m[y] = N);
1425
+ for (const [y, M] of Object.entries(a)) {
1426
+ const P = El(M, s[y] ?? "");
1427
+ P !== void 0 && (m[y] = P);
1408
1428
  }
1409
1429
  t(m);
1410
1430
  };
@@ -1413,19 +1433,19 @@ function Ol({
1413
1433
  {
1414
1434
  title: o ?? e.title,
1415
1435
  onClose: n,
1416
- actions: /* @__PURE__ */ M(Ce, { children: [
1436
+ actions: /* @__PURE__ */ T(Ce, { children: [
1417
1437
  /* @__PURE__ */ u(me, { onClick: n, children: r.cancel }),
1418
- /* @__PURE__ */ u(me, { variant: "primary", disabled: b, onClick: w, "data-testid": "command-dialog-run", children: r.run })
1438
+ /* @__PURE__ */ u(me, { variant: "primary", disabled: w, onClick: b, "data-testid": "command-dialog-run", children: r.run })
1419
1439
  ] }),
1420
- children: /* @__PURE__ */ M(
1440
+ children: /* @__PURE__ */ T(
1421
1441
  "form",
1422
1442
  {
1423
1443
  onSubmit: (m) => {
1424
- m.preventDefault(), b || w();
1444
+ m.preventDefault(), w || b();
1425
1445
  },
1426
1446
  children: [
1427
1447
  /* @__PURE__ */ u("div", { className: "kui-param-grid", children: h.map(g) }),
1428
- f.length ? /* @__PURE__ */ M("details", { children: [
1448
+ f.length ? /* @__PURE__ */ T("details", { children: [
1429
1449
  /* @__PURE__ */ u("summary", { children: r.more ?? "More options" }),
1430
1450
  /* @__PURE__ */ u("div", { className: "kui-param-grid", children: f.map(g) })
1431
1451
  ] }) : null,
@@ -1500,7 +1520,7 @@ function _i(e, t) {
1500
1520
  return i ? o.replace(/\{(\w+)\}/g, (a, s) => s in i ? String(i[s]) : a) : o;
1501
1521
  };
1502
1522
  }
1503
- const Ll = /* @__PURE__ */ new Set(["Cmd+N", "Cmd+W", "Cmd+O", "Cmd+P", "Cmd+Q", "Cmd+,", "Cmd+S", "Cmd+Shift+S", "Cmd+T", "Cmd+."]), Nl = Ll, lr = {
1523
+ const Ll = /* @__PURE__ */ new Set(["Cmd+N", "Cmd+W", "Cmd+O", "Cmd+P", "Cmd+Q", "Cmd+,", "Cmd+S", "Cmd+Shift+S", "Cmd+T", "Cmd+."]), Pl = Ll, lr = {
1504
1524
  "[": "BracketLeft",
1505
1525
  "]": "BracketRight",
1506
1526
  ",": "Comma",
@@ -1520,11 +1540,11 @@ function cr(e, t, n = Ki(), r = !1) {
1520
1540
  const i = e.split("+"), o = i.length > 1 && i[i.length - 1] === "" ? "+" : i.pop() ?? "", a = new Set(i.filter(Boolean)), s = a.has("Cmd"), d = n ? t.metaKey : t.ctrlKey, c = n ? t.ctrlKey : !1;
1521
1541
  return s !== d || a.has("Ctrl") !== c || a.has("Shift") !== t.shiftKey || a.has("Alt") !== t.altKey ? !1 : /^[A-Za-z]$/.test(o) ? t.code === `Key${o.toUpperCase()}` : /^[0-9]$/.test(o) ? t.code === `Digit${o}` : lr[o] ? t.code === lr[o] : o === "Delete" ? t.key === "Delete" || !r && t.key === "Backspace" : t.key === o;
1522
1542
  }
1523
- function Pl(e) {
1524
- return !e || Nl.has(e) ? !1 : e.includes("+") || /^(Delete|Backspace|PageUp|PageDown|F[0-9]{1,2})$/.test(e);
1543
+ function Nl(e) {
1544
+ return !e || Pl.has(e) ? !1 : e.includes("+") || /^(Delete|Backspace|PageUp|PageDown|F[0-9]{1,2})$/.test(e);
1525
1545
  }
1526
1546
  function Fl(e, t, n = Ki()) {
1527
- const r = e.filter((i) => Pl(i.shortcut));
1547
+ const r = e.filter((i) => Nl(i.shortcut));
1528
1548
  return r.find((i) => cr(i.shortcut, t, n, !0)) ?? r.find((i) => cr(i.shortcut, t, n));
1529
1549
  }
1530
1550
  const Wl = 4, Re = {
@@ -1805,25 +1825,25 @@ class ql {
1805
1825
  }
1806
1826
  /** Renders the document area a pane shows, at the zoom; null when it shows none of it. */
1807
1827
  async renderPane(t, n) {
1808
- const r = this.view.zoom * n, i = (b) => {
1809
- const w = t.pinX ? 0 : (t.area.x1 - t.area.x0) * b, m = t.pinY ? 0 : (t.area.y1 - t.area.y0) * b;
1828
+ const r = this.view.zoom * n, i = (w) => {
1829
+ const b = t.pinX ? 0 : (t.area.x1 - t.area.x0) * w, m = t.pinY ? 0 : (t.area.y1 - t.area.y0) * w;
1810
1830
  return {
1811
- x0: Math.max(0, Math.floor(t.area.x0 - w)),
1831
+ x0: Math.max(0, Math.floor(t.area.x0 - b)),
1812
1832
  y0: Math.max(0, Math.floor(t.area.y0 - m)),
1813
- x1: Math.min(this.doc.width, Math.ceil(t.area.x1 + w)),
1833
+ x1: Math.min(this.doc.width, Math.ceil(t.area.x1 + b)),
1814
1834
  y1: Math.min(this.doc.height, Math.ceil(t.area.y1 + m))
1815
1835
  };
1816
- }, o = (b) => (b.x1 - b.x0) * (b.y1 - b.y0) * Math.min(1, r) ** 2 * Math.max(1, r) ** 2 <= Ut, { x0: a, y0: s, x1: d, y1: c } = Bl.map(i).find((b) => o(b)) ?? i(0);
1836
+ }, o = (w) => (w.x1 - w.x0) * (w.y1 - w.y0) * Math.min(1, r) ** 2 * Math.max(1, r) ** 2 <= Ut, { x0: a, y0: s, x1: d, y1: c } = Bl.map(i).find((w) => o(w)) ?? i(0);
1817
1837
  if (d <= a || c <= s) return null;
1818
1838
  let l, p, h, f;
1819
1839
  if (r < 1) {
1820
- let b = Math.max(1, Math.floor(1 / r));
1821
- for (; (d - a) / b * ((c - s) / b) > Ut; ) b += 1;
1822
- h = Math.ceil((d - a) / b), f = Math.ceil((c - s) / b), p = await this.doc.renderArea(a, s, a + h * b, s + f * b, h, f), l = { x: a, y: s, width: h * b, height: f * b, scale: 1 / b };
1840
+ let w = Math.max(1, Math.floor(1 / r));
1841
+ for (; (d - a) / w * ((c - s) / w) > Ut; ) w += 1;
1842
+ h = Math.ceil((d - a) / w), f = Math.ceil((c - s) / w), p = await this.doc.renderArea(a, s, a + h * w, s + f * w, h, f), l = { x: a, y: s, width: h * w, height: f * w, scale: 1 / w };
1823
1843
  } else {
1824
- let b = r;
1825
- const w = (d - a) * (c - s) * b * b, m = i(0), y = Math.max(Ut, Math.min(zl, (m.x1 - m.x0) * (m.y1 - m.y0) * r * r));
1826
- w > y && (b = Math.max(1, b * Math.sqrt(y / w))), b = Math.max(1, Math.min(b, dr / (d - a), dr / (c - s))), h = Math.max(1, Math.ceil((d - a) * b)), f = Math.max(1, Math.ceil((c - s) * b)), p = await this.doc.render(a, s, b, h, f), l = { x: a, y: s, width: h / b, height: f / b, scale: b };
1844
+ let w = r;
1845
+ const b = (d - a) * (c - s) * w * w, m = i(0), y = Math.max(Ut, Math.min(zl, (m.x1 - m.x0) * (m.y1 - m.y0) * r * r));
1846
+ b > y && (w = Math.max(1, w * Math.sqrt(y / b))), w = Math.max(1, Math.min(w, dr / (d - a), dr / (c - s))), h = Math.max(1, Math.ceil((d - a) * w)), f = Math.max(1, Math.ceil((c - s) * w)), p = await this.doc.render(a, s, w, h, f), l = { x: a, y: s, width: h / w, height: f / w, scale: w };
1827
1847
  }
1828
1848
  const g = document.createElement("canvas");
1829
1849
  return g.width = h, g.height = f, g.getContext("2d")?.putImageData(fr(p, h, f), 0, 0), { bitmap: g, ...l, pinX: t.pinX, pinY: t.pinY };
@@ -1838,15 +1858,15 @@ class ql {
1838
1858
  if (!n.length || this.rendering || this.failed)
1839
1859
  return this.render();
1840
1860
  const r = n.flatMap((c) => {
1841
- const l = c.bitmap.width / c.width, p = c.bitmap.height / c.height, h = ft(Math.floor((t.x0 - c.x) * l), 0, c.bitmap.width), f = ft(Math.floor((t.y0 - c.y) * p), 0, c.bitmap.height), g = ft(Math.ceil((t.x1 - c.x) * l), 0, c.bitmap.width), b = ft(Math.ceil((t.y1 - c.y) * p), 0, c.bitmap.height);
1842
- return g > h && b > f ? [{ frame: c, sx: l, sy: p, px0: h, py0: f, width: g - h, height: b - f }] : [];
1861
+ const l = c.bitmap.width / c.width, p = c.bitmap.height / c.height, h = ft(Math.floor((t.x0 - c.x) * l), 0, c.bitmap.width), f = ft(Math.floor((t.y0 - c.y) * p), 0, c.bitmap.height), g = ft(Math.ceil((t.x1 - c.x) * l), 0, c.bitmap.width), w = ft(Math.ceil((t.y1 - c.y) * p), 0, c.bitmap.height);
1862
+ return g > h && w > f ? [{ frame: c, sx: l, sy: p, px0: h, py0: f, width: g - h, height: w - f }] : [];
1843
1863
  });
1844
1864
  if (!r.length) return !1;
1845
1865
  const i = performance.now(), o = this.generation, a = [];
1846
1866
  try {
1847
- for (const { frame: c, sx: l, sy: p, px0: h, py0: f, width: g, height: b } of r) {
1848
- const w = Math.round(1 / c.scale);
1849
- a.push(c.scale < 1 ? await this.doc.renderArea(c.x + h * w, c.y + f * w, c.x + (h + g) * w, c.y + (f + b) * w, g, b) : await this.doc.render(c.x + h / l, c.y + f / p, c.scale, g, b));
1867
+ for (const { frame: c, sx: l, sy: p, px0: h, py0: f, width: g, height: w } of r) {
1868
+ const b = Math.round(1 / c.scale);
1869
+ a.push(c.scale < 1 ? await this.doc.renderArea(c.x + h * b, c.y + f * b, c.x + (h + g) * b, c.y + (f + w) * b, g, w) : await this.doc.render(c.x + h / l, c.y + f / p, c.scale, g, w));
1850
1870
  }
1851
1871
  } catch (c) {
1852
1872
  return !this.disposed && o === this.generation && this.frames === n && (this.failed = !0, this.onRender(c)), !1;
@@ -1875,7 +1895,7 @@ class ql {
1875
1895
  const c = jt(s, this.pins, t, n);
1876
1896
  for (const l of c) {
1877
1897
  a.save(), c.length > 1 && (a.beginPath(), a.rect(l.clip.x0, l.clip.y0, l.clip.x1 - l.clip.x0, l.clip.y1 - l.clip.y0), a.clip());
1878
- const p = (g, b) => ({ x: (g - l.offX) * d, y: (b - l.offY) * d }), h = p(0, 0);
1898
+ const p = (g, w) => ({ x: (g - l.offX) * d, y: (w - l.offY) * d }), h = p(0, 0);
1879
1899
  this.framed && (a.shadowColor = "rgba(15, 15, 30, 0.12)", a.shadowBlur = 12, this.pattern ??= Hl(a), a.fillStyle = this.pattern ?? "#ffffff", a.fillRect(h.x, h.y, this.doc.width * d, this.doc.height * d), a.shadowBlur = 0);
1880
1900
  const f = this.frames.find((g) => g.pinX === l.pinX && g.pinY === l.pinY);
1881
1901
  if (f) {
@@ -1936,40 +1956,44 @@ function Vl(e, t) {
1936
1956
  };
1937
1957
  }
1938
1958
  function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, viewMemory: a, initialArea: s = null, panBounds: d = null, decorate: c = null, animated: l = !1, spacePans: p = !0, framed: h = !0, children: f, ref: g }) {
1939
- const b = R(null), w = R(null), m = R(null), y = R(null), [I, N] = B(!1), E = R({ doc: e, onView: i, onRender: o, initialArea: s, panBounds: d });
1959
+ const w = R(null), b = R(null), m = R(null), y = R(null), [M, P] = B(!1), E = R({ doc: e, onView: i, onRender: o, initialArea: s, panBounds: d });
1940
1960
  E.current = { doc: e, onView: i, onRender: o, initialArea: s, panBounds: d };
1941
- const Y = Vl(w, m);
1961
+ const G = Vl(b, m);
1942
1962
  J(() => {
1943
- const k = b.current;
1963
+ const k = w.current;
1944
1964
  if (!k) return;
1945
1965
  let O = a.current != null;
1946
- const U = new ql(k, e, pr(), (_, T) => {
1947
- O && (a.current = _), E.current.onView({ ..._, width: k.clientWidth, height: k.clientHeight }, T);
1948
- }, h, (_) => {
1949
- E.current.doc === e && E.current.onRender?.(_);
1966
+ const H = new ql(k, e, pr(), (I, _) => {
1967
+ O && (a.current = I), E.current.onView({ ...I, width: k.clientWidth, height: k.clientHeight }, _);
1968
+ }, h, (I) => {
1969
+ E.current.doc === e && E.current.onRender?.(I);
1950
1970
  });
1951
- m.current = U, a.current && (U.view = { ...a.current }), U.setPanBounds(E.current.panBounds);
1971
+ m.current = H, a.current && (H.view = { ...a.current }), H.setPanBounds(E.current.panBounds);
1952
1972
  const x = new ResizeObserver(() => {
1953
1973
  if (!O && k.clientWidth > 0 && k.clientHeight > 0) {
1954
1974
  O = !0;
1955
- const _ = E.current.initialArea;
1956
- _ ? U.fitArea(_) : U.fit();
1975
+ const I = E.current.initialArea;
1976
+ I ? H.fitArea(I) : H.fit();
1957
1977
  }
1958
- O && U.resized(), U.render();
1978
+ O && H.resized(), H.render();
1959
1979
  });
1960
1980
  x.observe(k);
1961
- const C = (_) => {
1962
- _.preventDefault(), _.ctrlKey || _.metaKey ? U.zoomTo(U.view.zoom * Math.exp(-_.deltaY * jl), _.clientX, _.clientY) : U.panBy(-_.deltaX, -_.deltaY);
1981
+ const C = (I) => {
1982
+ I.preventDefault(), I.ctrlKey || I.metaKey ? H.zoomTo(H.view.zoom * Math.exp(-I.deltaY * jl), I.clientX, I.clientY) : H.panBy(-I.deltaX, -I.deltaY);
1963
1983
  };
1964
1984
  k.addEventListener("wheel", C, { passive: !1 });
1965
- const W = typeof MutationObserver > "u" ? null : new MutationObserver(() => U.setBackdrop(pr()));
1966
- return W?.observe(document.documentElement, { attributes: !0, attributeFilter: ["style", "data-color-scheme", "data-brand", "class"] }), () => {
1967
- W?.disconnect(), x.disconnect(), k.removeEventListener("wheel", C), U.dispose(), m.current = null;
1985
+ const W = typeof MutationObserver > "u" ? null : new MutationObserver(() => H.setBackdrop(pr()));
1986
+ W?.observe(document.documentElement, { attributes: !0, attributeFilter: ["style", "data-color-scheme", "data-brand", "class"] });
1987
+ const V = e.onFonts(() => {
1988
+ H.invalidate(), H.render();
1989
+ });
1990
+ return () => {
1991
+ V(), W?.disconnect(), x.disconnect(), k.removeEventListener("wheel", C), H.dispose(), m.current = null;
1968
1992
  };
1969
1993
  }, [e, h, a]), J(() => m.current?.setPanBounds(d), [e, d]), J(() => {
1970
1994
  const k = m.current;
1971
1995
  k && (t.damage || k.invalidate(), (t.damage ? k.patch(t.damage) : k.render()).then((O) => {
1972
- O && Y.clear();
1996
+ O && G.clear();
1973
1997
  }));
1974
1998
  }, [t]);
1975
1999
  const q = R(n?.tick ?? 0);
@@ -1984,16 +2008,16 @@ function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, vi
1984
2008
  }, [l, c, e]), J(() => {
1985
2009
  if (!p) return;
1986
2010
  const k = (x) => x instanceof HTMLInputElement || x instanceof HTMLTextAreaElement, O = (x) => {
1987
- x.code === "Space" && !k(x.target) && N(!0);
1988
- }, U = (x) => {
1989
- x.code === "Space" && N(!1);
2011
+ x.code === "Space" && !k(x.target) && P(!0);
2012
+ }, H = (x) => {
2013
+ x.code === "Space" && P(!1);
1990
2014
  };
1991
- return window.addEventListener("keydown", O), window.addEventListener("keyup", U), () => {
1992
- window.removeEventListener("keydown", O), window.removeEventListener("keyup", U);
2015
+ return window.addEventListener("keydown", O), window.addEventListener("keyup", H), () => {
2016
+ window.removeEventListener("keydown", O), window.removeEventListener("keyup", H);
1993
2017
  };
1994
2018
  }, [p]), Oo(g, () => ({
1995
2019
  view: () => {
1996
- const k = m.current, O = b.current;
2020
+ const k = m.current, O = w.current;
1997
2021
  return k && O ? { ...k.view, width: O.clientWidth, height: O.clientHeight } : null;
1998
2022
  },
1999
2023
  fit: () => m.current?.fit(),
@@ -2006,75 +2030,75 @@ function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, vi
2006
2030
  panTo: (k, O) => m.current?.panTo(k, O),
2007
2031
  retryRender: async () => {
2008
2032
  const k = await m.current?.render() ?? !1;
2009
- return k && Y.clear(), k;
2033
+ return k && G.clear(), k;
2010
2034
  }
2011
2035
  }), []);
2012
- const V = () => m.current ? { viewport: m.current, overlay: Y } : null, j = R(1), D = (k) => {
2013
- const O = V();
2036
+ const Y = () => m.current ? { viewport: m.current, overlay: G } : null, U = R(1), D = (k) => {
2037
+ const O = Y();
2014
2038
  if (!O || k.button === 2) return;
2015
2039
  k.preventDefault();
2016
- const U = k.currentTarget.closest("[tabindex]");
2017
- U && document.activeElement !== U && U.focus({ preventScroll: !0 }), k.currentTarget.setPointerCapture(k.pointerId);
2018
- const x = I || k.button === 1 ? Re : r, C = qe(k, O.viewport);
2019
- j.current = C.pressure, y.current = x.begin(C, O) || null;
2040
+ const H = k.currentTarget.closest("[tabindex]");
2041
+ H && document.activeElement !== H && H.focus({ preventScroll: !0 }), k.currentTarget.setPointerCapture(k.pointerId);
2042
+ const x = M || k.button === 1 ? Re : r, C = qe(k, O.viewport);
2043
+ U.current = C.pressure, y.current = x.begin(C, O) || null;
2020
2044
  }, Z = (k) => {
2021
- const O = V(), U = y.current;
2022
- if (O && r.track?.(qe(k, O.viewport), O), O && !U && !I && k.buttons === 0 && r.hover?.(qe(k, O.viewport), O), !(!O || !U?.move))
2045
+ const O = Y(), H = y.current;
2046
+ if (O && r.track?.(qe(k, O.viewport), O), O && !H && !M && k.buttons === 0 && r.hover?.(qe(k, O.viewport), O), !(!O || !H?.move))
2023
2047
  for (const x of k.nativeEvent.getCoalescedEvents?.() ?? [k.nativeEvent]) {
2024
- const C = qe(x, O.viewport, j.current);
2025
- j.current = C.pressure, U.move(C, O);
2048
+ const C = qe(x, O.viewport, U.current);
2049
+ U.current = C.pressure, H.move(C, O);
2026
2050
  }
2027
2051
  }, Q = (k) => {
2028
- const O = V(), U = y.current;
2029
- y.current = null, O && U && U.end?.(qe(k, O.viewport, j.current), O);
2052
+ const O = Y(), H = y.current;
2053
+ y.current = null, O && H && H.end?.(qe(k, O.viewport, U.current), O);
2030
2054
  }, fe = R(() => {
2031
2055
  });
2032
2056
  fe.current = (k) => {
2033
2057
  const O = y.current;
2034
2058
  if (!O || k.key !== "Escape" || k.isComposing || k.metaKey || k.ctrlKey || k.altKey || k.shiftKey) return;
2035
2059
  y.current = null;
2036
- const U = V();
2037
- U && O.cancel?.(U), Y.clear(), k.preventDefault(), k.stopPropagation();
2060
+ const H = Y();
2061
+ H && O.cancel?.(H), G.clear(), k.preventDefault(), k.stopPropagation();
2038
2062
  }, J(() => {
2039
2063
  const k = (O) => fe.current(O);
2040
2064
  return window.addEventListener("keydown", k, !0), () => window.removeEventListener("keydown", k, !0);
2041
2065
  }, []);
2042
2066
  const ce = () => {
2043
- const k = V(), O = y.current;
2044
- O && (y.current = null, k && O.cancel?.(k), Y.clear());
2067
+ const k = Y(), O = y.current;
2068
+ O && (y.current = null, k && O.cancel?.(k), G.clear());
2045
2069
  };
2046
- return /* @__PURE__ */ M("div", { className: "kui-canvas", "data-testid": "kit-canvas", children: [
2070
+ return /* @__PURE__ */ T("div", { className: "kui-canvas", "data-testid": "kit-canvas", children: [
2047
2071
  /* @__PURE__ */ u(
2048
2072
  "canvas",
2049
2073
  {
2050
- ref: b,
2074
+ ref: w,
2051
2075
  className: "kui-canvas-surface",
2052
- style: { cursor: I ? Re.cursor : r.cursor },
2076
+ style: { cursor: M ? Re.cursor : r.cursor },
2053
2077
  onPointerDown: D,
2054
2078
  onPointerMove: Z,
2055
2079
  onPointerUp: Q,
2056
2080
  onPointerCancel: ce,
2057
2081
  onLostPointerCapture: ce,
2058
2082
  onPointerLeave: () => {
2059
- const k = V();
2083
+ const k = Y();
2060
2084
  k && !y.current && r.leave?.(k);
2061
2085
  },
2062
2086
  onDoubleClick: (k) => {
2063
- const O = V();
2087
+ const O = Y();
2064
2088
  O && r.doubleClick?.(qe({ ...k, clientX: k.clientX, clientY: k.clientY, pressure: 1 }, O.viewport), O);
2065
2089
  },
2066
2090
  onContextMenu: (k) => k.preventDefault(),
2067
2091
  "data-testid": "kit-canvas-surface"
2068
2092
  }
2069
2093
  ),
2070
- /* @__PURE__ */ u("canvas", { ref: w, className: "kui-canvas-overlay", "aria-hidden": "true" }),
2094
+ /* @__PURE__ */ u("canvas", { ref: b, className: "kui-canvas-overlay", "aria-hidden": "true" }),
2071
2095
  f
2072
2096
  ] });
2073
2097
  }
2074
- const bt = /* @__PURE__ */ new Set();
2098
+ const wt = /* @__PURE__ */ new Set();
2075
2099
  function Jl(e) {
2076
2100
  const t = (n, r, i) => {
2077
- bt.has(t) || e(n, r, i);
2101
+ wt.has(t) || e(n, r, i);
2078
2102
  };
2079
2103
  return t;
2080
2104
  }
@@ -2091,14 +2115,14 @@ function gr(e, t) {
2091
2115
  } finally {
2092
2116
  r.restore();
2093
2117
  }
2094
- const a = qi(e).filter((s) => !bt.has(s));
2095
- for (const s of a) bt.add(s);
2118
+ const a = qi(e).filter((s) => !wt.has(s));
2119
+ for (const s of a) wt.add(s);
2096
2120
  r.save();
2097
2121
  try {
2098
2122
  t(r, i, o);
2099
2123
  } finally {
2100
2124
  r.restore();
2101
- for (const s of a) bt.delete(s);
2125
+ for (const s of a) wt.delete(s);
2102
2126
  }
2103
2127
  };
2104
2128
  return Hi.set(n, [e, t]), n;
@@ -2140,8 +2164,8 @@ function Gi({ commands: e, declaration: t, engineTools: n, agent: r, t: i, phras
2140
2164
  const s = [], d = /* @__PURE__ */ new Set(), c = (l, p, h, f, g = []) => {
2141
2165
  if (d.has(l)) return;
2142
2166
  d.add(l);
2143
- const b = Se(a, l, g);
2144
- s.push({ id: l, kind: p, label: h, parent: f, hidden: b.hidden, disabled: b.disabled });
2167
+ const w = Se(a, l, g);
2168
+ s.push({ id: l, kind: p, label: h, parent: f, hidden: w.hidden, disabled: w.disabled });
2145
2169
  };
2146
2170
  for (const l of Ui(t?.menus ?? [])) c(l.id, l.kind, o(l.label), l.parent, l.menu);
2147
2171
  for (const l of e) {
@@ -2157,9 +2181,9 @@ function Gi({ commands: e, declaration: t, engineTools: n, agent: r, t: i, phras
2157
2181
  for (const l of ji) (r || l.id !== "action:agent") && c(l.id, "action", i(l.label), null);
2158
2182
  return s;
2159
2183
  }
2160
- const Ql = () => !1, Wt = Ot(null), ec = Ni(nn, null, () => {
2184
+ const Ql = () => !1, Wt = Ot(null), ec = Pi(nn, null, () => {
2161
2185
  });
2162
- function we() {
2186
+ function be() {
2163
2187
  const e = Le(Wt), t = e?.store ?? ec, n = He(t.subscribe, t.get);
2164
2188
  return {
2165
2189
  config: n,
@@ -2184,7 +2208,7 @@ function Yi({ value: e, children: t }) {
2184
2208
  return /* @__PURE__ */ u(Wt.Provider, { value: e, children: /* @__PURE__ */ u(tc, { children: t }) });
2185
2209
  }
2186
2210
  function tc({ children: e }) {
2187
- const t = Le(Wt), n = we(), { config: r } = n, i = pe(
2211
+ const t = Le(Wt), n = be(), { config: r } = n, i = pe(
2188
2212
  () => ({
2189
2213
  state: (o) => n.state(o),
2190
2214
  renderExtras: (o, a) => n.renderButtons(o, a),
@@ -2198,12 +2222,12 @@ function tc({ children: e }) {
2198
2222
  return /* @__PURE__ */ u(ko, { elements: i, children: e });
2199
2223
  }
2200
2224
  function pu({ id: e, children: t }) {
2201
- const n = we();
2225
+ const n = be();
2202
2226
  n.declared;
2203
2227
  const r = n.state(e);
2204
2228
  return r.hidden ? null : /* @__PURE__ */ u("fieldset", { className: "kui-element", "data-kit-ui-id": e, disabled: r.disabled, role: "presentation", children: t });
2205
2229
  }
2206
- const br = {
2230
+ const wr = {
2207
2231
  bell: xs,
2208
2232
  check: En,
2209
2233
  download: Cs,
@@ -2217,16 +2241,16 @@ const br = {
2217
2241
  message: Dt,
2218
2242
  plus: pi,
2219
2243
  printer: Sn,
2220
- send: ws,
2221
- settings: bn,
2222
- share: bs,
2244
+ send: bs,
2245
+ settings: wn,
2246
+ share: ws,
2223
2247
  star: $i,
2224
2248
  upload: gs,
2225
2249
  x: Zt
2226
2250
  }, ze = /* @__PURE__ */ new Map(), nc = 32;
2227
2251
  function rc(e) {
2228
2252
  if (!e) return;
2229
- if (!e.startsWith("data:image/")) return Object.hasOwn(br, e) ? br[e] : ct;
2253
+ if (!e.startsWith("data:image/")) return Object.hasOwn(wr, e) ? wr[e] : ct;
2230
2254
  const t = ze.get(e);
2231
2255
  if (t)
2232
2256
  return ze.delete(e), ze.set(e, t), t;
@@ -2238,25 +2262,25 @@ function rc(e) {
2238
2262
  return ze.set(e, n), n;
2239
2263
  }
2240
2264
  function zt({ place: e, as: t }) {
2241
- const n = we();
2265
+ const n = be();
2242
2266
  return /* @__PURE__ */ u(Ce, { children: n.buttons(e).map((r) => {
2243
2267
  const i = il(r, n.locale), o = rc(r.icon), a = `host:${r.id}`;
2244
- return t === "menu" ? /* @__PURE__ */ u(le, { icon: o, label: i, shortcut: r.shortcut, disabled: r.disabled, onSelect: () => n.press(r.id), uiId: a }, r.id) : t === "ribbon" ? /* @__PURE__ */ u(be, { icon: o, label: i, pressed: r.pressed, disabled: r.disabled, onClick: () => n.press(r.id), "data-kit-ui-id": a }, r.id) : /* @__PURE__ */ M(me, { variant: "ghost", "aria-pressed": r.pressed, disabled: r.disabled, onClick: () => n.press(r.id), "data-kit-ui-id": a, children: [
2268
+ return t === "menu" ? /* @__PURE__ */ u(le, { icon: o, label: i, shortcut: r.shortcut, disabled: r.disabled, onSelect: () => n.press(r.id), uiId: a }, r.id) : t === "ribbon" ? /* @__PURE__ */ u(we, { icon: o, label: i, pressed: r.pressed, disabled: r.disabled, onClick: () => n.press(r.id), "data-kit-ui-id": a }, r.id) : /* @__PURE__ */ T(me, { variant: "ghost", "aria-pressed": r.pressed, disabled: r.disabled, onClick: () => n.press(r.id), "data-kit-ui-id": a, children: [
2245
2269
  o ? /* @__PURE__ */ u(o, { size: 15, strokeWidth: $e, "aria-hidden": "true" }) : null,
2246
2270
  i
2247
2271
  ] }, r.id);
2248
2272
  }) });
2249
2273
  }
2250
- const wr = /* @__PURE__ */ new Set();
2274
+ const br = /* @__PURE__ */ new Set();
2251
2275
  function ic(e, t) {
2252
2276
  const n = new Map(e.map((h) => [h.id, h])), r = (h) => {
2253
2277
  const f = /* @__PURE__ */ new Set();
2254
2278
  for (let g = h.parent; g !== null && !f.has(g); ) {
2255
2279
  f.add(g);
2256
- const b = n.get(g);
2257
- if (!b) return !1;
2258
- if (b.hidden) return !0;
2259
- g = b.parent;
2280
+ const w = n.get(g);
2281
+ if (!w) return !1;
2282
+ if (w.hidden) return !0;
2283
+ g = w.parent;
2260
2284
  }
2261
2285
  return !1;
2262
2286
  }, i = e.filter((h) => !h.hidden && h.id !== Di && !(h.kind === "command" && h.parent === null) && !r(h)), o = new Map(i.map((h) => [h.id, h])), a = /* @__PURE__ */ new Map();
@@ -2268,29 +2292,29 @@ function ic(e, t) {
2268
2292
  const s = (h, f) => {
2269
2293
  const g = new Set(f);
2270
2294
  g.add(h.id);
2271
- const b = (a.get(h.id) ?? []).filter((w) => g.has(w.id) ? (wr.has(w.id) || (wr.add(w.id), console.warn(`[kit-editor] ${w.id} is its own ancestor in the declared elements`)), !1) : !0).map((w) => s(w, g));
2272
- return { element: h, children: b };
2295
+ const w = (a.get(h.id) ?? []).filter((b) => g.has(b.id) ? (br.has(b.id) || (br.add(b.id), console.warn(`[kit-editor] ${b.id} is its own ancestor in the declared elements`)), !1) : !0).map((b) => s(b, g));
2296
+ return { element: h, children: w };
2273
2297
  }, d = [], c = /* @__PURE__ */ new Set();
2274
2298
  for (const h of i) {
2275
2299
  if (c.has(h.id)) continue;
2276
2300
  const f = [];
2277
2301
  let g = h;
2278
2302
  for (; g !== void 0; ) {
2279
- const b = g;
2280
- if (c.has(b.id)) {
2303
+ const w = g;
2304
+ if (c.has(w.id)) {
2281
2305
  for (const y of f) c.add(y);
2282
2306
  break;
2283
2307
  }
2284
- const w = f.indexOf(b.id);
2285
- if (w !== -1) {
2286
- d.push(o.get(f[w]));
2308
+ const b = f.indexOf(w.id);
2309
+ if (b !== -1) {
2310
+ d.push(o.get(f[b]));
2287
2311
  for (const y of f) c.add(y);
2288
2312
  break;
2289
2313
  }
2290
- f.push(b.id);
2291
- const m = b.parent !== null ? o.get(b.parent) : void 0;
2314
+ f.push(w.id);
2315
+ const m = w.parent !== null ? o.get(w.parent) : void 0;
2292
2316
  if (m === void 0) {
2293
- d.push(b);
2317
+ d.push(w);
2294
2318
  for (const y of f) c.add(y);
2295
2319
  break;
2296
2320
  }
@@ -2306,20 +2330,20 @@ function ic(e, t) {
2306
2330
  function oc({ catalog: e, personal: t, labels: n, onSave: r, onClose: i }) {
2307
2331
  const [o, a] = B([...t]), [s, d] = B(""), c = pe(() => ic(e, s), [e, s]), l = (h) => a((f) => f.includes(h) ? f.filter((g) => g !== h) : [...f, h]), p = (h, f) => {
2308
2332
  const g = o.includes(h.element.id);
2309
- return /* @__PURE__ */ M("li", { children: [
2310
- /* @__PURE__ */ M("label", { className: "kui-customize-row", children: [
2333
+ return /* @__PURE__ */ T("li", { children: [
2334
+ /* @__PURE__ */ T("label", { className: "kui-customize-row", children: [
2311
2335
  /* @__PURE__ */ u("input", { type: "checkbox", checked: !g, disabled: f, onChange: () => l(h.element.id), "data-element": h.element.id }),
2312
2336
  /* @__PURE__ */ u("span", { children: h.element.label })
2313
2337
  ] }),
2314
- h.children.length ? /* @__PURE__ */ u("ul", { children: h.children.map((b) => p(b, f || g)) }) : null
2338
+ h.children.length ? /* @__PURE__ */ u("ul", { children: h.children.map((w) => p(w, f || g)) }) : null
2315
2339
  ] }, h.element.id);
2316
2340
  };
2317
- return /* @__PURE__ */ M(
2341
+ return /* @__PURE__ */ T(
2318
2342
  st,
2319
2343
  {
2320
2344
  title: n.title,
2321
2345
  onClose: i,
2322
- actions: /* @__PURE__ */ M(Ce, { children: [
2346
+ actions: /* @__PURE__ */ T(Ce, { children: [
2323
2347
  /* @__PURE__ */ u(me, { variant: "ghost", onClick: () => a([]), "data-action": "restore", children: n.restore }),
2324
2348
  /* @__PURE__ */ u("span", { style: { flex: 1 } }),
2325
2349
  /* @__PURE__ */ u(me, { variant: "ghost", onClick: i, children: n.cancel }),
@@ -2333,8 +2357,8 @@ function oc({ catalog: e, personal: t, labels: n, onSave: r, onClose: i }) {
2333
2357
  );
2334
2358
  }
2335
2359
  function ac({ message: e, title: t, retryLabel: n, onRetry: r }) {
2336
- return /* @__PURE__ */ M("div", { className: "kui-render-failure", role: "alert", "data-testid": "kit-render-failure", children: [
2337
- /* @__PURE__ */ M("div", { children: [
2360
+ return /* @__PURE__ */ T("div", { className: "kui-render-failure", role: "alert", "data-testid": "kit-render-failure", children: [
2361
+ /* @__PURE__ */ T("div", { children: [
2338
2362
  /* @__PURE__ */ u("strong", { children: t }),
2339
2363
  /* @__PURE__ */ u("div", { className: "kui-muted", children: e })
2340
2364
  ] }),
@@ -2843,102 +2867,102 @@ function ln(e, t, n) {
2843
2867
  e.report ? e.report(t, n) : pt("error", t, Dn(n));
2844
2868
  }
2845
2869
  const yr = { "edit.undo": "undo", "edit.redo": "redo" };
2846
- function bu(e, t, n, r, i = (s) => s, o, a = {}) {
2870
+ function wu(e, t, n, r, i = (s) => s, o, a = {}) {
2847
2871
  const s = R(a.report);
2848
2872
  s.current = a.report;
2849
- const d = H((T, K) => s.current ? s.current(T, K) : pt("error", T, Dn(K)), []), { doc: c, change: l } = e, [p, h] = B([]), [f, g] = B(/* @__PURE__ */ new Set()), [b, w] = B(null), m = R(o);
2873
+ const d = K((I, _) => s.current ? s.current(I, _) : pt("error", I, Dn(_)), []), { doc: c, change: l } = e, [p, h] = B([]), [f, g] = B(/* @__PURE__ */ new Set()), [w, b] = B(null), m = R(o);
2850
2874
  m.current = o;
2851
- const y = H(
2852
- (T, K = {}) => w(T ? { command: T, values: { ...m.current?.(T), ...K } } : null),
2875
+ const y = K(
2876
+ (I, _ = {}) => b(I ? { command: I, values: { ...m.current?.(I), ..._ } } : null),
2853
2877
  []
2854
- ), I = R(e);
2855
- I.current = e;
2856
- const N = He(t.ui.subscribe, t.ui.get), E = a.history ?? null, [, Y] = B(0);
2857
- J(() => E?.subscribe(() => Y((T) => T + 1)), [E]);
2878
+ ), M = R(e);
2879
+ M.current = e;
2880
+ const P = He(t.ui.subscribe, t.ui.get), E = a.history ?? null, [, G] = B(0);
2881
+ J(() => E?.subscribe(() => G((I) => I + 1)), [E]);
2858
2882
  const q = R(E);
2859
2883
  q.current = E;
2860
- const V = t.readOnly === !0, j = e.comments ?? Xi, D = H((T) => V && It(T, j), [j, V]);
2884
+ const Y = t.readOnly === !0, U = e.comments ?? Xi, D = K((I) => Y && It(I, U), [U, Y]);
2861
2885
  J(() => {
2862
2886
  c && c.commands().then(h);
2863
2887
  }, [c]), J(() => {
2864
2888
  if (!c) return;
2865
- let T = !1;
2866
- return c.disabledCommands().catch(() => []).then((K) => {
2867
- T || g(new Set(K));
2889
+ let I = !1;
2890
+ return c.disabledCommands().catch(() => []).then((_) => {
2891
+ I || g(new Set(_));
2868
2892
  }), () => {
2869
- T = !0;
2893
+ I = !0;
2870
2894
  };
2871
2895
  }, [l.revision, c]);
2872
- const Z = H(async (T, K = {}) => {
2873
- const ne = I.current.doc;
2896
+ const Z = K(async (I, _ = {}) => {
2897
+ const ne = M.current.doc;
2874
2898
  if (!ne) return null;
2875
- const P = fe.current.get(T);
2876
- if (P?.mutates && Se(t.ui.get(), `command:${T}`, P.menu).denied || P && D(P)) return null;
2899
+ const N = fe.current.get(I);
2900
+ if (N?.mutates && Se(t.ui.get(), `command:${I}`, N.menu).denied || N && D(N)) return null;
2877
2901
  try {
2878
- return JSON.parse(await ne.execute(T, K));
2902
+ return JSON.parse(await ne.execute(I, _));
2879
2903
  } catch {
2880
2904
  return null;
2881
2905
  }
2882
- }, [t, D]), Q = pe(() => new Map(p.map((T) => [T.id, T])), [p]), fe = R(Q);
2906
+ }, [t, D]), Q = pe(() => new Map(p.map((I) => [I.id, I])), [p]), fe = R(Q);
2883
2907
  fe.current = Q;
2884
- const ce = H(
2885
- async (T, K) => {
2886
- const ne = Q.get(T), P = q.current, G = P ? yr[T] : void 0;
2887
- if (P && G) {
2888
- if (Se(t.ui.get(), `command:${T}`, ne?.menu).denied || Se(t.ui.get(), `action:${G}`).denied) return null;
2908
+ const ce = K(
2909
+ async (I, _) => {
2910
+ const ne = Q.get(I), N = q.current, j = N ? yr[I] : void 0;
2911
+ if (N && j) {
2912
+ if (Se(t.ui.get(), `command:${I}`, ne?.menu).denied || Se(t.ui.get(), `action:${j}`).denied) return null;
2889
2913
  try {
2890
- return JSON.stringify({ done: await P[G]() !== !1 });
2914
+ return JSON.stringify({ done: await N[j]() !== !1 });
2891
2915
  } catch (ue) {
2892
2916
  return d(n("commandFailed"), ue), null;
2893
2917
  }
2894
2918
  }
2895
- if (!K && ne && Pt(ne) && !Se(t.ui.get(), `command:${T}`, ne.menu).denied && !D(ne))
2919
+ if (!_ && ne && Nt(ne) && !Se(t.ui.get(), `command:${I}`, ne.menu).denied && !D(ne))
2896
2920
  return y(ne), null;
2897
2921
  try {
2898
- return await I.current.run(T, K ?? {});
2922
+ return await M.current.run(I, _ ?? {});
2899
2923
  } catch (ue) {
2900
- return V && sc(ue) ? pt("info", n(j.size ? "commentOnlyRefused" : "viewOnlyRefused")) : d(n("commandFailed"), ue), null;
2924
+ return Y && sc(ue) ? pt("info", n(U.size ? "commentOnlyRefused" : "viewOnlyRefused")) : d(n("commandFailed"), ue), null;
2901
2925
  }
2902
2926
  },
2903
- [Q, j, t, V, D, d, y, n]
2904
- ), k = E ? E.canUndo() : c?.info?.canUndo ?? !1, O = E ? E.canRedo() : c?.info?.canRedo ?? !1, U = H(
2905
- (T, K) => {
2906
- const ne = Q.get(T);
2907
- if (!ne || Se(N, `command:${T}`, ne.menu).denied) return !1;
2908
- const P = E ? yr[T] : void 0;
2909
- if (P) return P === "undo" ? k : O;
2910
- if (K.has(T) || D(ne)) return !1;
2911
- const G = V ? Pi(T, j) : null;
2912
- return G === null || (G === "undo" ? k : O);
2927
+ [Q, U, t, Y, D, d, y, n]
2928
+ ), k = E ? E.canUndo() : c?.info?.canUndo ?? !1, O = E ? E.canRedo() : c?.info?.canRedo ?? !1, H = K(
2929
+ (I, _) => {
2930
+ const ne = Q.get(I);
2931
+ if (!ne || Se(P, `command:${I}`, ne.menu).denied) return !1;
2932
+ const N = E ? yr[I] : void 0;
2933
+ if (N) return N === "undo" ? k : O;
2934
+ if (_.has(I) || D(ne)) return !1;
2935
+ const j = Y ? Ni(I, U) : null;
2936
+ return j === null || (j === "undo" ? k : O);
2913
2937
  },
2914
- [Q, O, k, j, E, V, D, N]
2915
- ), x = H((T) => U(T, f), [f, U]), C = H(
2916
- async (T) => {
2917
- const K = I.current.doc;
2918
- if (!K) return !1;
2919
- const ne = await I.current.disabledCommands().catch(() => null);
2920
- return ne != null && I.current.doc === K && U(T, new Set(ne));
2938
+ [Q, O, k, U, E, Y, D, P]
2939
+ ), x = K((I) => H(I, f), [f, H]), C = K(
2940
+ async (I) => {
2941
+ const _ = M.current.doc;
2942
+ if (!_) return !1;
2943
+ const ne = await M.current.disabledCommands().catch(() => null);
2944
+ return ne != null && M.current.doc === _ && H(I, new Set(ne));
2921
2945
  },
2922
- [U]
2923
- ), W = H(async () => {
2946
+ [H]
2947
+ ), W = K(async () => {
2924
2948
  try {
2925
- await I.current.save(), pt("success", n("saved"));
2926
- } catch (T) {
2927
- d(n("saveFailed"), T);
2949
+ await M.current.save(), pt("success", n("saved"));
2950
+ } catch (I) {
2951
+ d(n("saveFailed"), I);
2928
2952
  }
2929
- }, [d, n]), _ = H(
2930
- (T, K) => {
2931
- Se(t.ui.get(), `command:${T}`, Q.get(T)?.menu).denied ? ce(T, K ?? {}) : y(Q.get(T) ?? null, K);
2953
+ }, [d, n]), V = K(
2954
+ (I, _) => {
2955
+ Se(t.ui.get(), `command:${I}`, Q.get(I)?.menu).denied ? ce(I, _ ?? {}) : y(Q.get(I) ?? null, _);
2932
2956
  },
2933
2957
  [Q, t, ce, y]
2934
2958
  );
2935
- return { session: e, host: t, t: n, phrase: i, testId: r, commands: p, byId: Q, enabled: x, enabledNow: C, run: ce, ask: _, query: Z, save: W, report: d, dialog: b, setDialog: y, comments: j, canUndo: k, canRedo: O };
2959
+ return { session: e, host: t, t: n, phrase: i, testId: r, commands: p, byId: Q, enabled: x, enabledNow: C, run: ce, ask: V, query: Z, save: W, report: d, dialog: w, setDialog: y, comments: U, canUndo: k, canRedo: O };
2936
2960
  }
2937
2961
  const Ln = Ot(null);
2938
- function wu({ editor: e, tools: t = null, children: n }) {
2962
+ function bu({ editor: e, tools: t = null, children: n }) {
2939
2963
  const r = pe(() => ({ editor: e, tools: t }), [e, t]), { host: i, byId: o, session: a } = e, s = He(i.ui.subscribe, i.ui.get), d = t?.setDenied, c = i.readOnly === !0;
2940
2964
  Te(() => {
2941
- d?.((b) => c || Se(s, `tool:${b}`).denied);
2965
+ d?.((w) => c || Se(s, `tool:${w}`).denied);
2942
2966
  }, [s, c, d]);
2943
2967
  const l = pe(() => Zl(i.declaration), [i]), p = R(a.doc);
2944
2968
  p.current = a.doc;
@@ -2947,21 +2971,21 @@ function wu({ editor: e, tools: t = null, children: n }) {
2947
2971
  store: i.ui,
2948
2972
  locale: i.init.locale,
2949
2973
  // O(1): `useUi().state` calls it for every command on every render.
2950
- menuOf: (b) => o.get(b)?.menu ?? [],
2974
+ menuOf: (w) => o.get(w)?.menu ?? [],
2951
2975
  declared: l,
2952
- press: (b) => i.ui.action({ id: b, document: { path: i.init.document.path, dirty: p.current?.info.dirty ?? !1, revision: p.current?.info.revision ?? 0 } }),
2976
+ press: (w) => i.ui.action({ id: w, document: { path: i.init.document.path, dirty: p.current?.info.dirty ?? !1, revision: p.current?.info.revision ?? 0 } }),
2953
2977
  offerHide: null,
2954
2978
  openCustomize: null,
2955
2979
  hide: null,
2956
- renderButtons: (b, w) => /* @__PURE__ */ u(zt, { place: b, as: w }),
2980
+ renderButtons: (w, b) => /* @__PURE__ */ u(zt, { place: w, as: b }),
2957
2981
  // A commenter sees what they can run, not a document of disabled edits.
2958
- sessionHidden: h.size ? (b) => hl(o.get(b) ?? { id: b }, h) : void 0
2982
+ sessionHidden: h.size ? (w) => hl(o.get(w) ?? { id: w }, h) : void 0
2959
2983
  }),
2960
2984
  [o, h, l, i]
2961
2985
  ), g = R(async () => []);
2962
2986
  return g.current = async () => {
2963
- const b = await a.commands(), w = t && !t.tools.length ? await a.tool("tools") ?? [] : t?.tools ?? [];
2964
- return Gi({ commands: b, declaration: i.declaration, engineTools: w, agent: i.init.capabilities.includes("agent"), t: e.t, phrase: e.phrase, config: i.ui.get() });
2987
+ const w = await a.commands(), b = t && !t.tools.length ? await a.tool("tools") ?? [] : t?.tools ?? [];
2988
+ return Gi({ commands: w, declaration: i.declaration, engineTools: b, agent: i.init.capabilities.includes("agent"), t: e.t, phrase: e.phrase, config: i.ui.get() });
2965
2989
  }, J(() => {
2966
2990
  i.declaration && i.peer.handle("ui/elements", () => g.current());
2967
2991
  }, [i]), /* @__PURE__ */ u(Ln.Provider, { value: r, children: /* @__PURE__ */ u(So, { strings: e.t, children: /* @__PURE__ */ u(Yi, { value: f, children: n }) }) });
@@ -2978,23 +3002,23 @@ function Xe() {
2978
3002
  return Le(Ln)?.tools ?? null;
2979
3003
  }
2980
3004
  function Ji(e) {
2981
- const { offerHide: t } = we();
3005
+ const { offerHide: t } = be();
2982
3006
  return t ? (n) => {
2983
3007
  n.preventDefault(), t(e, n.clientX, n.clientY);
2984
3008
  } : void 0;
2985
3009
  }
2986
3010
  function lc({ command: e, params: t, ask: n, onRun: r, ...i }) {
2987
- const o = te(), { enabled: a, byId: s, testId: d, phrase: c } = o, l = we(), p = Ji(`command:${e}`);
3011
+ const o = te(), { enabled: a, byId: s, testId: d, phrase: c } = o, l = be(), p = Ji(`command:${e}`);
2988
3012
  if (l.state(`command:${e}`).hidden) return null;
2989
3013
  const h = s.get(e);
2990
3014
  return /* @__PURE__ */ u(
2991
- be,
3015
+ we,
2992
3016
  {
2993
3017
  ...i,
2994
3018
  label: i.label ?? c(h?.title ?? e),
2995
3019
  disabled: i.disabled || !a(e),
2996
3020
  onClick: () => {
2997
- n ? o.ask(e) : r && t === void 0 && !(h && Pt(h)) ? r(e) : o.run(e, t);
3021
+ n ? o.ask(e) : r && t === void 0 && !(h && Nt(h)) ? r(e) : o.run(e, t);
2998
3022
  },
2999
3023
  onContextMenu: p ?? i.onContextMenu,
3000
3024
  "data-testid": `${d}-cmd-${e}`,
@@ -3003,9 +3027,9 @@ function lc({ command: e, params: t, ask: n, onRun: r, ...i }) {
3003
3027
  );
3004
3028
  }
3005
3029
  function vu({ tool: e, testId: t, ...n }) {
3006
- const r = Xe(), { testId: i } = te(), a = we().state(`tool:${e}`);
3030
+ const r = Xe(), { testId: i } = te(), a = be().state(`tool:${e}`);
3007
3031
  return a.hidden ? null : /* @__PURE__ */ u(
3008
- be,
3032
+ we,
3009
3033
  {
3010
3034
  ...n,
3011
3035
  pressed: r?.active === e,
@@ -3025,8 +3049,8 @@ function xe({ icon: e, label: t, size: n = "small", children: r, disabled: i, sw
3025
3049
  return /* @__PURE__ */ u(
3026
3050
  lt,
3027
3051
  {
3028
- trigger: ({ toggle: h, open: f }) => /* @__PURE__ */ M("span", { style: { display: "inline-flex", alignItems: "center" }, "data-primary": s || void 0, children: [
3029
- /* @__PURE__ */ u(be, { icon: e, label: t, size: p, disabled: i, pressed: f, swatch: o, onClick: h, "data-testid": a, primary: s, lineLabel: d }),
3052
+ trigger: ({ toggle: h, open: f }) => /* @__PURE__ */ T("span", { style: { display: "inline-flex", alignItems: "center" }, "data-primary": s || void 0, children: [
3053
+ /* @__PURE__ */ u(we, { icon: e, label: t, size: p, disabled: i, pressed: f, swatch: o, onClick: h, "data-testid": a, primary: s, lineLabel: d }),
3030
3054
  p !== "large" ? /* @__PURE__ */ u(Ii, { size: 11, strokeWidth: $e, "aria-hidden": "true", style: { marginLeft: -4, opacity: 0.6 }, onClick: h }) : null
3031
3055
  ] }),
3032
3056
  children: /* @__PURE__ */ u(vt.Provider, { value: "full", children: /* @__PURE__ */ u(Yt.Provider, { value: mn, children: r }) })
@@ -3044,19 +3068,19 @@ function cc({
3044
3068
  path: s,
3045
3069
  onRun: d
3046
3070
  }) {
3047
- const c = te(), { enabled: l, byId: p, testId: h, phrase: f } = c, g = we(), b = Ji(`command:${e}`), w = s ? g.state(`command:${e}`, s) : null;
3048
- if (g.state(`command:${e}`).hidden || w?.hidden) return null;
3071
+ const c = te(), { enabled: l, byId: p, testId: h, phrase: f } = c, g = be(), w = Ji(`command:${e}`), b = s ? g.state(`command:${e}`, s) : null;
3072
+ if (g.state(`command:${e}`).hidden || b?.hidden) return null;
3049
3073
  const m = p.get(e);
3050
- return /* @__PURE__ */ u("div", { onContextMenu: b, style: { display: "contents" }, children: /* @__PURE__ */ u(
3074
+ return /* @__PURE__ */ u("div", { onContextMenu: w, style: { display: "contents" }, children: /* @__PURE__ */ u(
3051
3075
  le,
3052
3076
  {
3053
3077
  icon: r,
3054
3078
  label: n ?? f(m?.title ?? e),
3055
3079
  shortcut: o === void 0 ? m?.shortcut : o,
3056
- disabled: !l(e) || !!w?.disabled,
3080
+ disabled: !l(e) || !!b?.disabled,
3057
3081
  checked: a,
3058
3082
  onSelect: () => {
3059
- i ? c.ask(e) : d && t === void 0 && !(m && Pt(m)) ? d(e) : c.run(e, t);
3083
+ i ? c.ask(e) : d && t === void 0 && !(m && Nt(m)) ? d(e) : c.run(e, t);
3060
3084
  },
3061
3085
  testId: `${h}-cmd-${e}`,
3062
3086
  uiId: `command:${e}`
@@ -3120,70 +3144,70 @@ function Cu({
3120
3144
  decorateUnder: l,
3121
3145
  children: p
3122
3146
  }) {
3123
- const h = te(), f = Xe(), g = R(null), { doc: b, change: w, failure: m, repaints: y } = h.session, [I, N] = B(null), E = He(y.subscribe, y.get), { t: Y } = h, q = f?.decorate ?? null, V = pe(() => gr(gr(l, q), c), [c, l, q]);
3124
- return /* @__PURE__ */ M("div", { className: "kui-canvas-region", "data-testid": s ?? `${h.testId}-canvas-region`, children: [
3125
- m ? /* @__PURE__ */ M("div", { className: "kui-message", role: "alert", children: [
3126
- /* @__PURE__ */ u("strong", { children: Y("openFailed") }),
3147
+ const h = te(), f = Xe(), g = R(null), { doc: w, change: b, failure: m, repaints: y } = h.session, [M, P] = B(null), E = He(y.subscribe, y.get), { t: G } = h, q = f?.decorate ?? null, Y = pe(() => gr(gr(l, q), c), [c, l, q]);
3148
+ return /* @__PURE__ */ T("div", { className: "kui-canvas-region", "data-testid": s ?? `${h.testId}-canvas-region`, children: [
3149
+ m ? /* @__PURE__ */ T("div", { className: "kui-message", role: "alert", children: [
3150
+ /* @__PURE__ */ u("strong", { children: G("openFailed") }),
3127
3151
  /* @__PURE__ */ u("span", { className: "kui-muted", children: m })
3128
- ] }) : b ? /* @__PURE__ */ M(
3152
+ ] }) : w ? /* @__PURE__ */ T(
3129
3153
  Xl,
3130
3154
  {
3131
3155
  ref: e,
3132
3156
  viewMemory: t ?? g,
3133
- doc: b,
3134
- change: w,
3157
+ doc: w,
3158
+ change: b,
3135
3159
  repaint: E,
3136
3160
  tool: d ?? f?.canvasTool ?? Re,
3137
- decorate: V,
3161
+ decorate: Y,
3138
3162
  spacePans: !f?.wantsText,
3139
3163
  initialArea: n,
3140
3164
  panBounds: r,
3141
3165
  framed: i,
3142
3166
  animated: o,
3143
- onView: (j, D) => {
3144
- f?.viewZoom?.(j.zoom), a?.(j, D);
3167
+ onView: (U, D) => {
3168
+ f?.viewZoom?.(U.zoom), a?.(U, D);
3145
3169
  },
3146
- onRender: (j) => N(j === null ? null : { doc: b, message: Dn(j) }),
3170
+ onRender: (U) => P(U === null ? null : { doc: w, message: Dn(U) }),
3147
3171
  children: [
3148
3172
  p,
3149
- I?.doc === b ? /* @__PURE__ */ u(ac, { message: I.message, title: Y("renderFailed"), retryLabel: Y("retryRender"), onRetry: () => {
3173
+ M?.doc === w ? /* @__PURE__ */ u(ac, { message: M.message, title: G("renderFailed"), retryLabel: G("retryRender"), onRetry: () => {
3150
3174
  e.current?.retryRender();
3151
3175
  } }) : null
3152
3176
  ]
3153
3177
  }
3154
- ) : /* @__PURE__ */ u("div", { className: "kui-message kui-muted", children: Y("opening") }),
3155
- f ? /* @__PURE__ */ u(Dl, { active: f.wantsText, onText: f.typeText, onKey: (j) => f.keyDown(j) }) : null
3178
+ ) : /* @__PURE__ */ u("div", { className: "kui-message kui-muted", children: G("opening") }),
3179
+ f ? /* @__PURE__ */ u(Dl, { active: f.wantsText, onText: f.typeText, onKey: (U) => f.keyDown(U) }) : null
3156
3180
  ] });
3157
3181
  }
3158
3182
  const vr = 1.25, hc = /* @__PURE__ */ new Set(["checkbox", "radio", "button", "submit", "reset", "range", "color", "file", "image"]);
3159
3183
  function kr(e) {
3160
3184
  return e instanceof HTMLInputElement ? !hc.has(e.type) : e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement && !e.classList.contains("kui-text-sink");
3161
3185
  }
3162
- function Nn() {
3163
- const e = te(), t = we(), n = e.host.readOnly === !0, r = n && (e.comments?.size ?? 0) > 0, i = (o, a, s) => {
3186
+ function Pn() {
3187
+ const e = te(), t = be(), n = e.host.readOnly === !0, r = n && (e.comments?.size ?? 0) > 0, i = (o, a, s) => {
3164
3188
  const d = t.state(`action:${o}`), c = t.state(`command:${a}`);
3165
3189
  return { hidden: d.hidden || c.hostHidden || n && !r, disabled: !s || d.disabled || c.denied };
3166
3190
  };
3167
3191
  return { undo: i("undo", "edit.undo", e.canUndo), redo: i("redo", "edit.redo", e.canRedo), readOnly: n, commenting: r };
3168
3192
  }
3169
3193
  function fc({ before: e, mode: t }) {
3170
- const n = te(), r = we(), { session: i, host: o, t: a, testId: s } = n, { dirty: d } = i, c = (g) => r.state(`action:${g}`), { undo: l, redo: p, readOnly: h, commenting: f } = Nn();
3171
- return /* @__PURE__ */ M(Ce, { children: [
3194
+ const n = te(), r = be(), { session: i, host: o, t: a, testId: s } = n, { dirty: d } = i, c = (g) => r.state(`action:${g}`), { undo: l, redo: p, readOnly: h, commenting: f } = Pn();
3195
+ return /* @__PURE__ */ T(Ce, { children: [
3172
3196
  e,
3173
3197
  /* @__PURE__ */ u(zt, { place: "action", as: "action" }),
3174
3198
  h ? /* @__PURE__ */ u("span", { className: "kui-view-only", "data-testid": `${s}-view-only`, "data-comment-only": f ? "true" : void 0, children: a(f ? "commentOnly" : "viewOnly") }) : null,
3175
3199
  l.hidden ? null : /* @__PURE__ */ u(De, { icon: kn, label: a("undo"), disabled: l.disabled, onClick: () => void n.run("edit.undo", {}), "data-testid": `${s}-undo`, "data-kit-ui-id": "action:undo" }),
3176
3200
  p.hidden ? null : /* @__PURE__ */ u(De, { icon: oi, label: a("redo"), disabled: p.disabled, onClick: () => void n.run("edit.redo", {}), "data-testid": `${s}-redo`, "data-kit-ui-id": "action:redo" }),
3177
- o.init.capabilities.includes("agent") && !c("agent").hidden ? /* @__PURE__ */ M(me, { variant: "ghost", disabled: c("agent").disabled, onClick: () => void o.openAgent(), "data-testid": `${s}-ask-agent`, "data-kit-ui-id": "action:agent", children: [
3201
+ o.init.capabilities.includes("agent") && !c("agent").hidden ? /* @__PURE__ */ T(me, { variant: "ghost", disabled: c("agent").disabled, onClick: () => void o.openAgent(), "data-testid": `${s}-ask-agent`, "data-kit-ui-id": "action:agent", children: [
3178
3202
  /* @__PURE__ */ u(Lt, { size: 15, strokeWidth: $e, "aria-hidden": "true" }),
3179
3203
  a("askAgent")
3180
3204
  ] }) : null,
3181
3205
  t,
3182
- c("save").hidden || h ? null : /* @__PURE__ */ M(me, { variant: "primary", disabled: !d || i.saving || c("save").disabled, onClick: () => void n.save(), "data-testid": `${s}-save`, "data-kit-ui-id": "action:save", children: [
3206
+ c("save").hidden || h ? null : /* @__PURE__ */ T(me, { variant: "primary", disabled: !d || i.saving || c("save").disabled, onClick: () => void n.save(), "data-testid": `${s}-save`, "data-kit-ui-id": "action:save", children: [
3183
3207
  /* @__PURE__ */ u(ai, { size: 15, strokeWidth: $e, "aria-hidden": "true" }),
3184
3208
  a("save")
3185
3209
  ] }),
3186
- r.openCustomize && !c("more").hidden ? /* @__PURE__ */ u(lt, { align: "end", trigger: ({ toggle: g, open: b }) => /* @__PURE__ */ u(De, { icon: Ms, label: a("more"), pressed: b, disabled: c("more").disabled, onClick: g, "data-testid": `${s}-more`, "data-kit-ui-id": "action:more" }), children: /* @__PURE__ */ u(le, { label: a("customize"), onSelect: () => r.openCustomize?.(), testId: `${s}-customize`, uiId: "action:more" }) }) : null
3210
+ r.openCustomize && !c("more").hidden ? /* @__PURE__ */ u(lt, { align: "end", trigger: ({ toggle: g, open: w }) => /* @__PURE__ */ u(De, { icon: Ms, label: a("more"), pressed: w, disabled: c("more").disabled, onClick: g, "data-testid": `${s}-more`, "data-kit-ui-id": "action:more" }), children: /* @__PURE__ */ u(le, { label: a("customize"), onSelect: () => r.openCustomize?.(), testId: `${s}-customize`, uiId: "action:more" }) }) : null
3187
3211
  ] });
3188
3212
  }
3189
3213
  function mc({ x: e, y: t, label: n, testId: r, onHide: i, onClose: o }) {
@@ -3199,38 +3223,38 @@ function mc({ x: e, y: t, label: n, testId: r, onHide: i, onClose: o }) {
3199
3223
  }, [o]), /* @__PURE__ */ u("div", { className: "kui-dialog-backdrop kui-hide-menu-backdrop", onPointerDown: o, children: /* @__PURE__ */ u("div", { ref: a, className: "kui-popover kui-hide-menu", role: "menu", style: s ?? { left: e, top: t, visibility: "hidden" }, onPointerDown: (c) => c.stopPropagation(), children: /* @__PURE__ */ u(le, { label: n, onSelect: i, testId: r }) }) });
3200
3224
  }
3201
3225
  function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom: o, onKeyDown: a, statusBar: s = !0, hiddenCommands: d, fileChangedBar: c = !0, frame: l, children: p }) {
3202
- const h = te(), f = Xe(), { session: g, t: b, testId: w } = h, { dirty: m } = g, y = Le(Wt), I = we(), [N, E] = B(null), [Y, q] = B(null), V = H(() => q(null), []), j = R(async () => {
3226
+ const h = te(), f = Xe(), { session: g, t: w, testId: b } = h, { dirty: m } = g, y = Le(Wt), M = be(), [P, E] = B(null), [G, q] = B(null), Y = K(() => q(null), []), U = R(async () => {
3203
3227
  });
3204
- j.current = async (x) => {
3228
+ U.current = async (x) => {
3205
3229
  try {
3206
- await I.store.setPersonal(x);
3230
+ await M.store.setPersonal(x);
3207
3231
  } catch (C) {
3208
- ln(h, b("customizeFailed"), C);
3232
+ ln(h, w("customizeFailed"), C);
3209
3233
  }
3210
3234
  };
3211
3235
  const D = R(() => []);
3212
- D.current = () => Gi({ commands: h.commands, declaration: h.host.declaration, engineTools: f?.tools ?? [], agent: h.host.init.capabilities.includes("agent"), t: b, phrase: h.phrase, config: { ...I.store.get(), personal: [] } });
3213
- const { store: Z } = I, Q = Z.customizable && h.host.declaration !== null, fe = pe(
3236
+ D.current = () => Gi({ commands: h.commands, declaration: h.host.declaration, engineTools: f?.tools ?? [], agent: h.host.init.capabilities.includes("agent"), t: w, phrase: h.phrase, config: { ...M.store.get(), personal: [] } });
3237
+ const { store: Z } = M, Q = Z.customizable && h.host.declaration !== null, fe = pe(
3214
3238
  () => y && Q ? {
3215
3239
  ...y,
3216
3240
  offerHide: (x, C, W) => q({ id: x, x: C, y: W }),
3217
3241
  openCustomize: () => E(D.current()),
3218
- hide: (x) => void j.current([...Z.get().personal, x])
3242
+ hide: (x) => void U.current([...Z.get().personal, x])
3219
3243
  } : y,
3220
3244
  [Q, y, Z]
3221
3245
  ), ce = (x) => x.currentTarget.ownerDocument.querySelector(".kui-dialog-backdrop") != null || x.target instanceof Element && x.target.closest(".kui-dialog") != null, k = (x) => {
3222
3246
  !l || x.nativeEvent.isComposing || ce(x) || l.keyDown(x) && (x.preventDefault(), x.stopPropagation());
3223
3247
  }, O = (x) => {
3224
- U(x);
3248
+ H(x);
3225
3249
  const C = !x.metaKey && !x.ctrlKey && !x.altKey && !x.shiftKey;
3226
3250
  l && C && x.key === "Escape" && !x.defaultPrevented && !x.nativeEvent.isComposing && !ce(x) && !kr(x.target) && l.escape() && x.preventDefault();
3227
- }, U = (x) => {
3251
+ }, H = (x) => {
3228
3252
  if (ce(x)) return;
3229
3253
  const C = x.target, W = kr(C);
3230
3254
  if (W && !((x.metaKey || x.ctrlKey) && !x.altKey && x.key.toLowerCase() === "s")) return;
3231
- const _ = C instanceof HTMLTextAreaElement;
3232
- if (_ && x.defaultPrevented || !x.metaKey && !x.ctrlKey && !x.altKey && !x.shiftKey && (x.key === " " || x.key === "Enter") && C instanceof Element && C.matches('button, [role="menuitem"], input[type="checkbox"], input[type="radio"]')) return;
3233
- if (!W && !_ && f?.keyDown(x)) {
3255
+ const V = C instanceof HTMLTextAreaElement;
3256
+ if (V && x.defaultPrevented || !x.metaKey && !x.ctrlKey && !x.altKey && !x.shiftKey && (x.key === " " || x.key === "Enter") && C instanceof Element && C.matches('button, [role="menuitem"], input[type="checkbox"], input[type="radio"]')) return;
3257
+ if (!W && !V && f?.keyDown(x)) {
3234
3258
  x.preventDefault();
3235
3259
  return;
3236
3260
  }
@@ -3238,35 +3262,35 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
3238
3262
  x.preventDefault();
3239
3263
  return;
3240
3264
  }
3241
- const K = I.config.add.find((ye) => ye.shortcut && !ye.disabled && Hr(ye.shortcut, x, Nt()));
3242
- if (K) {
3243
- x.preventDefault(), I.press(K.id);
3265
+ const _ = M.config.add.find((ye) => ye.shortcut && !ye.disabled && Hr(ye.shortcut, x, Pt()));
3266
+ if (_) {
3267
+ x.preventDefault(), M.press(_.id);
3244
3268
  return;
3245
3269
  }
3246
- const ne = x.metaKey || x.ctrlKey, P = x.key.toLowerCase();
3247
- if (ne && P === "s") {
3248
- x.preventDefault(), !I.state("action:save").denied && !h.host.readOnly && h.save();
3270
+ const ne = x.metaKey || x.ctrlKey, N = x.key.toLowerCase();
3271
+ if (ne && N === "s") {
3272
+ x.preventDefault(), !M.state("action:save").denied && !h.host.readOnly && h.save();
3249
3273
  return;
3250
3274
  }
3251
- if (i?.current && ne && (P === "0" || P === "=" || P === "+" || P === "-")) {
3252
- x.preventDefault(), P === "0" ? i.current.fit() : i.current.zoomBy(P === "-" ? 1 / vr : vr);
3275
+ if (i?.current && ne && (N === "0" || N === "=" || N === "+" || N === "-")) {
3276
+ x.preventDefault(), N === "0" ? i.current.fit() : i.current.zoomBy(N === "-" ? 1 / vr : vr);
3253
3277
  return;
3254
3278
  }
3255
- const G = Fl(d ? h.commands.filter((ye) => !d(ye.id)) : h.commands, x);
3256
- if (G && h.enabled(G.id)) {
3257
- x.preventDefault(), h.run(G.id, {});
3279
+ const j = Fl(d ? h.commands.filter((ye) => !d(ye.id)) : h.commands, x);
3280
+ if (j && h.enabled(j.id)) {
3281
+ x.preventDefault(), h.run(j.id, {});
3258
3282
  return;
3259
3283
  }
3260
- if (G && !ne && !(x.key.length === 1 && f?.toolForKey(x.key, x.shiftKey))) {
3284
+ if (j && !ne && !(x.key.length === 1 && f?.toolForKey(x.key, x.shiftKey))) {
3261
3285
  x.preventDefault();
3262
- const ye = G.id;
3286
+ const ye = j.id;
3263
3287
  h.enabledNow(ye).then((Ie) => Ie ? h.run(ye, {}) : void 0);
3264
3288
  return;
3265
3289
  }
3266
- const ue = !ne && !x.altKey && x.key.length === 1 && !_ ? f?.toolForKey(x.key, x.shiftKey) : null;
3267
- ue && !I.state(`tool:${ue}`).denied && (x.preventDefault(), f?.select(ue));
3290
+ const ue = !ne && !x.altKey && x.key.length === 1 && !V ? f?.toolForKey(x.key, x.shiftKey) : null;
3291
+ ue && !M.state(`tool:${ue}`).denied && (x.preventDefault(), f?.select(ue));
3268
3292
  };
3269
- return /* @__PURE__ */ u(Yi, { value: fe, children: /* @__PURE__ */ M(
3293
+ return /* @__PURE__ */ u(Yi, { value: fe, children: /* @__PURE__ */ T(
3270
3294
  "div",
3271
3295
  {
3272
3296
  ref: l?.ref,
@@ -3280,25 +3304,25 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
3280
3304
  tabIndex: -1,
3281
3305
  children: [
3282
3306
  e,
3283
- c && g.conflict && g.doc ? /* @__PURE__ */ M("div", { className: "kui-file-changed", role: "alert", "data-testid": `${w}-file-changed`, children: [
3284
- /* @__PURE__ */ u("span", { children: b("fileChanged") }),
3285
- /* @__PURE__ */ u(me, { variant: "ghost", size: "sm", onClick: () => void g.keepMine().catch((x) => ln(h, b("saveFailed"), x)), "data-testid": `${w}-keep-mine`, children: b("keepMine") }),
3286
- /* @__PURE__ */ u(me, { variant: "primary", size: "sm", onClick: () => g.reopen(), "data-testid": `${w}-reload`, children: b("reloadFile") })
3307
+ c && g.conflict && g.doc ? /* @__PURE__ */ T("div", { className: "kui-file-changed", role: "alert", "data-testid": `${b}-file-changed`, children: [
3308
+ /* @__PURE__ */ u("span", { children: w("fileChanged") }),
3309
+ /* @__PURE__ */ u(me, { variant: "ghost", size: "sm", onClick: () => void g.keepMine().catch((x) => ln(h, w("saveFailed"), x)), "data-testid": `${b}-keep-mine`, children: w("keepMine") }),
3310
+ /* @__PURE__ */ u(me, { variant: "primary", size: "sm", onClick: () => g.reopen(), "data-testid": `${b}-reload`, children: w("reloadFile") })
3287
3311
  ] }) : null,
3288
3312
  p,
3289
- s ? /* @__PURE__ */ M($o, { onClick: r ? (x) => !(x.target instanceof Element && x.target.closest('button, input, select, [role="menuitem"]')) && r() : void 0, children: [
3313
+ s ? /* @__PURE__ */ T($o, { onClick: r ? (x) => !(x.target instanceof Element && x.target.closest('button, input, select, [role="menuitem"]')) && r() : void 0, children: [
3290
3314
  t,
3291
- m ? /* @__PURE__ */ u("span", { "data-testid": `${w}-unsaved`, children: b("unsaved") }) : null,
3292
- g.editedBy?.by === "agent" ? /* @__PURE__ */ M("span", { className: "kui-agent-edited", "data-testid": `${w}-agent-edited`, children: [
3315
+ m ? /* @__PURE__ */ u("span", { "data-testid": `${b}-unsaved`, children: w("unsaved") }) : null,
3316
+ g.editedBy?.by === "agent" ? /* @__PURE__ */ T("span", { className: "kui-agent-edited", "data-testid": `${b}-agent-edited`, children: [
3293
3317
  /* @__PURE__ */ u(Lt, { size: 12, strokeWidth: $e, "aria-hidden": "true" }),
3294
- b("agentEdited")
3318
+ w("agentEdited")
3295
3319
  ] }) : g.editedBy?.by === "system" ? (
3296
3320
  // The host's own change (Kit UI protocol 2.7): the app, named by its feature on hover.
3297
- /* @__PURE__ */ u("span", { className: "kui-host-edited", "data-testid": `${w}-host-edited`, title: g.editedBy.originLabel, children: b("hostEdited") })
3321
+ /* @__PURE__ */ u("span", { className: "kui-host-edited", "data-testid": `${b}-host-edited`, title: g.editedBy.originLabel, children: w("hostEdited") })
3298
3322
  ) : null,
3299
3323
  /* @__PURE__ */ u(Io, {}),
3300
3324
  n,
3301
- i && o != null ? /* @__PURE__ */ u(Mo, { zoom: o, onZoom: (x) => i.current?.zoomTo(x), onFit: () => i.current?.fit(), labels: { out: b("zoomOut"), in: b("zoomIn"), fit: b("fit") } }) : null
3325
+ i && o != null ? /* @__PURE__ */ u(Mo, { zoom: o, onZoom: (x) => i.current?.zoomTo(x), onFit: () => i.current?.fit(), labels: { out: w("zoomOut"), in: w("zoomIn"), fit: w("fit") } }) : null
3302
3326
  ] }) : null,
3303
3327
  h.dialog ? /* @__PURE__ */ u(
3304
3328
  Ol,
@@ -3306,7 +3330,7 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
3306
3330
  command: h.dialog.command,
3307
3331
  values: h.dialog.values,
3308
3332
  title: h.phrase(h.dialog.command.title),
3309
- labels: { run: b("run"), cancel: b("cancel"), required: b("required"), more: b("moreOptions") },
3333
+ labels: { run: w("run"), cancel: w("cancel"), required: w("required"), more: w("moreOptions") },
3310
3334
  onClose: () => h.setDialog(null),
3311
3335
  onRun: (x) => {
3312
3336
  const C = h.dialog.command.id;
@@ -3315,29 +3339,29 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
3315
3339
  },
3316
3340
  h.dialog.command.id
3317
3341
  ) : null,
3318
- N ? /* @__PURE__ */ u(
3342
+ P ? /* @__PURE__ */ u(
3319
3343
  oc,
3320
3344
  {
3321
- catalog: N,
3322
- personal: I.config.personal,
3323
- labels: { title: b("customizeTitle"), search: b("customizeSearch"), restore: b("customizeRestore"), cancel: b("cancel"), save: b("customizeSave") },
3345
+ catalog: P,
3346
+ personal: M.config.personal,
3347
+ labels: { title: w("customizeTitle"), search: w("customizeSearch"), restore: w("customizeRestore"), cancel: w("cancel"), save: w("customizeSave") },
3324
3348
  onSave: (x) => {
3325
- E(null), j.current(x);
3349
+ E(null), U.current(x);
3326
3350
  },
3327
3351
  onClose: () => E(null)
3328
3352
  }
3329
3353
  ) : null,
3330
- Y ? /* @__PURE__ */ u(
3354
+ G ? /* @__PURE__ */ u(
3331
3355
  mc,
3332
3356
  {
3333
- x: Y.x,
3334
- y: Y.y,
3335
- label: b("hideElement"),
3336
- testId: `${w}-hide-element`,
3357
+ x: G.x,
3358
+ y: G.y,
3359
+ label: w("hideElement"),
3360
+ testId: `${b}-hide-element`,
3337
3361
  onHide: () => {
3338
- q(null), j.current([...I.store.get().personal, Y.id]);
3362
+ q(null), U.current([...M.store.get().personal, G.id]);
3339
3363
  },
3340
- onClose: V
3364
+ onClose: Y
3341
3365
  }
3342
3366
  ) : null,
3343
3367
  /* @__PURE__ */ u(To, {})
@@ -3356,31 +3380,31 @@ function gc(e, t, n, r = () => !0) {
3356
3380
  const o = (a) => t.includes(a) ? t.indexOf(a) : t.length;
3357
3381
  return [...i.values()].sort((a, s) => o(a.label) - o(s.label));
3358
3382
  }
3359
- function bc({ label: e, path: t, children: n, uiId: r, testId: i }) {
3383
+ function wc({ label: e, path: t, children: n, uiId: r, testId: i }) {
3360
3384
  const o = r ?? `menu:${t}`, { phrase: a } = te(), s = R(null), d = R(null), c = R(null), [l, p] = B(null), h = R(!1), f = () => {
3361
3385
  const m = s.current?.getBoundingClientRect();
3362
3386
  m && p({ left: m.right - 2, top: m.top - 4, maxHeight: Math.max(0, window.innerHeight - 16) });
3363
3387
  }, g = () => {
3364
3388
  c.current?.contains(document.activeElement) && d.current?.focus(), p(null);
3365
- }, b = H(() => {
3389
+ }, w = K(() => {
3366
3390
  const m = s.current?.getBoundingClientRect(), y = c.current;
3367
3391
  if (!m || !y) return;
3368
- const I = Math.max(0, window.innerHeight - 16), N = Math.min(y.scrollHeight, I), E = y.offsetWidth, Y = m.right - 2, q = Y + E <= window.innerWidth - 4 ? Y : m.left + 2 - E >= 4 ? m.left + 2 - E : Y, V = Math.max(4, Math.min(q, window.innerWidth - E - 4)), j = Math.max(8, Math.min(m.top - 4, window.innerHeight - 8 - N));
3369
- p((D) => !D || D.left === V && D.top === j && D.maxHeight === I ? D : { left: V, top: j, maxHeight: I });
3370
- }, []), w = l != null;
3392
+ const M = Math.max(0, window.innerHeight - 16), P = Math.min(y.scrollHeight, M), E = y.offsetWidth, G = m.right - 2, q = G + E <= window.innerWidth - 4 ? G : m.left + 2 - E >= 4 ? m.left + 2 - E : G, Y = Math.max(4, Math.min(q, window.innerWidth - E - 4)), U = Math.max(8, Math.min(m.top - 4, window.innerHeight - 8 - P));
3393
+ p((D) => !D || D.left === Y && D.top === U && D.maxHeight === M ? D : { left: Y, top: U, maxHeight: M });
3394
+ }, []), b = l != null;
3371
3395
  return Te(() => {
3372
- if (!w) return;
3373
- b();
3396
+ if (!b) return;
3397
+ w();
3374
3398
  const m = c.current;
3375
3399
  if (!m || typeof ResizeObserver > "u") return;
3376
- const y = new ResizeObserver(() => b());
3400
+ const y = new ResizeObserver(() => w());
3377
3401
  y.observe(m);
3378
- for (const I of m.children) y.observe(I);
3402
+ for (const M of m.children) y.observe(M);
3379
3403
  return () => y.disconnect();
3380
- }, [w, b]), Te(() => {
3404
+ }, [b, w]), Te(() => {
3381
3405
  !l || !h.current || !c.current || (h.current = !1, c.current.querySelector('[role^="menuitem"]:not(:disabled)')?.focus());
3382
- }, [l]), /* @__PURE__ */ M("div", { ref: s, className: "kui-submenu", onPointerEnter: f, onPointerLeave: g, children: [
3383
- /* @__PURE__ */ M(
3406
+ }, [l]), /* @__PURE__ */ T("div", { ref: s, className: "kui-submenu", onPointerEnter: f, onPointerLeave: g, children: [
3407
+ /* @__PURE__ */ T(
3384
3408
  "div",
3385
3409
  {
3386
3410
  ref: d,
@@ -3401,7 +3425,7 @@ function bc({ label: e, path: t, children: n, uiId: r, testId: i }) {
3401
3425
  ]
3402
3426
  }
3403
3427
  ),
3404
- l ? /* @__PURE__ */ M(
3428
+ l ? /* @__PURE__ */ T(
3405
3429
  "div",
3406
3430
  {
3407
3431
  ref: c,
@@ -3419,42 +3443,42 @@ function bc({ label: e, path: t, children: n, uiId: r, testId: i }) {
3419
3443
  ) : null
3420
3444
  ] });
3421
3445
  }
3422
- function wc({ children: e }) {
3446
+ function bc({ children: e }) {
3423
3447
  const { t } = te();
3424
3448
  return /* @__PURE__ */ u(Et, { className: "kui-options-strip", panelClassName: "kui-options-bar", labels: { start: t("optionsScrollStart"), end: t("optionsScrollEnd") }, testId: "options-scroll", children: e });
3425
3449
  }
3426
3450
  const yc = 400;
3427
3451
  function vc({ tools: e, shown: t, active: n, onSelect: r, rail: i, pressMs: o }) {
3428
- const { testId: a, t: s } = te(), d = we(), [c, l] = B(null), p = R(null), h = R(null), f = R(!1);
3452
+ const { testId: a, t: s } = te(), d = be(), [c, l] = B(null), p = R(null), h = R(null), f = R(!1);
3429
3453
  J(() => {
3430
- const w = () => {
3454
+ const b = () => {
3431
3455
  f.current = !1;
3432
3456
  };
3433
- return window.addEventListener("pointerdown", w, !0), () => window.removeEventListener("pointerdown", w, !0);
3457
+ return window.addEventListener("pointerdown", b, !0), () => window.removeEventListener("pointerdown", b, !0);
3434
3458
  }, []);
3435
3459
  const g = () => {
3436
- const w = p.current?.getBoundingClientRect(), m = i.current?.getBoundingClientRect().right ?? w?.right;
3437
- w && m != null && e.length > 1 && l({ left: m + 4, top: Math.min(w.top, window.innerHeight - e.length * 30 - 16) });
3460
+ const b = p.current?.getBoundingClientRect(), m = i.current?.getBoundingClientRect().right ?? b?.right;
3461
+ b && m != null && e.length > 1 && l({ left: m + 4, top: Math.min(b.top, window.innerHeight - e.length * 30 - 16) });
3438
3462
  };
3439
3463
  J(() => {
3440
3464
  if (!c) return;
3441
- const w = (m) => {
3465
+ const b = (m) => {
3442
3466
  (!(m.target instanceof Node) || !document.querySelector(".kui-tool-flyout")?.contains(m.target)) && l(null);
3443
3467
  };
3444
- return window.addEventListener("pointerdown", w, !0), () => window.removeEventListener("pointerdown", w, !0);
3468
+ return window.addEventListener("pointerdown", b, !0), () => window.removeEventListener("pointerdown", b, !0);
3445
3469
  }, [c]);
3446
- const b = t.shortcut ? `${t.label} (${t.shortcut})` : t.label;
3447
- return /* @__PURE__ */ M(
3470
+ const w = t.shortcut ? `${t.label} (${t.shortcut})` : t.label;
3471
+ return /* @__PURE__ */ T(
3448
3472
  "span",
3449
3473
  {
3450
3474
  ref: p,
3451
3475
  className: "kui-tool-slot",
3452
3476
  "data-grouped": e.length > 1,
3453
- onContextMenu: (w) => {
3454
- w.preventDefault(), e.length > 1 ? g() : d.offerHide?.(`tool:${t.id}`, w.clientX, w.clientY);
3477
+ onContextMenu: (b) => {
3478
+ b.preventDefault(), e.length > 1 ? g() : d.offerHide?.(`tool:${t.id}`, b.clientX, b.clientY);
3455
3479
  },
3456
- onPointerDown: (w) => {
3457
- f.current = !1, w.button === 0 && (h.current = window.setTimeout(() => {
3480
+ onPointerDown: (b) => {
3481
+ f.current = !1, b.button === 0 && (h.current = window.setTimeout(() => {
3458
3482
  f.current = e.length > 1, g();
3459
3483
  }, o));
3460
3484
  },
@@ -3467,8 +3491,8 @@ function vc({ tools: e, shown: t, active: n, onSelect: r, rail: i, pressMs: o })
3467
3491
  De,
3468
3492
  {
3469
3493
  icon: t.icon,
3470
- label: b,
3471
- pressed: e.some((w) => w.id === n),
3494
+ label: w,
3495
+ pressed: e.some((b) => b.id === n),
3472
3496
  disabled: d.state(`tool:${t.id}`).disabled,
3473
3497
  onClick: () => {
3474
3498
  f.current ? f.current = !1 : r(t.id);
@@ -3477,29 +3501,29 @@ function vc({ tools: e, shown: t, active: n, onSelect: r, rail: i, pressMs: o })
3477
3501
  "data-kit-ui-id": `tool:${t.id}`
3478
3502
  }
3479
3503
  ),
3480
- c ? /* @__PURE__ */ M("div", { className: "kui-popover kui-tool-flyout", role: "menu", style: { left: c.left, top: c.top }, children: [
3481
- e.map((w) => /* @__PURE__ */ M(
3504
+ c ? /* @__PURE__ */ T("div", { className: "kui-popover kui-tool-flyout", role: "menu", style: { left: c.left, top: c.top }, children: [
3505
+ e.map((b) => /* @__PURE__ */ T(
3482
3506
  "button",
3483
3507
  {
3484
3508
  type: "button",
3485
3509
  role: "menuitemradio",
3486
- "aria-checked": w.id === n,
3510
+ "aria-checked": b.id === n,
3487
3511
  className: "kui-menu-item",
3488
- disabled: d.state(`tool:${w.id}`).disabled,
3512
+ disabled: d.state(`tool:${b.id}`).disabled,
3489
3513
  onClick: () => {
3490
- l(null), r(w.id);
3514
+ l(null), r(b.id);
3491
3515
  },
3492
- "data-testid": `${a}-tool-${w.id}`,
3493
- "data-kit-ui-id": `tool:${w.id}`,
3516
+ "data-testid": `${a}-tool-${b.id}`,
3517
+ "data-kit-ui-id": `tool:${b.id}`,
3494
3518
  children: [
3495
- /* @__PURE__ */ u(w.icon, { size: 15, strokeWidth: $e, "aria-hidden": "true" }),
3496
- /* @__PURE__ */ u("span", { children: w.label }),
3497
- w.shortcut ? /* @__PURE__ */ u("kbd", { children: w.shortcut }) : null
3519
+ /* @__PURE__ */ u(b.icon, { size: 15, strokeWidth: $e, "aria-hidden": "true" }),
3520
+ /* @__PURE__ */ u("span", { children: b.label }),
3521
+ b.shortcut ? /* @__PURE__ */ u("kbd", { children: b.shortcut }) : null
3498
3522
  ]
3499
3523
  },
3500
- w.id
3524
+ b.id
3501
3525
  )),
3502
- d.hide ? /* @__PURE__ */ M(
3526
+ d.hide ? /* @__PURE__ */ T(
3503
3527
  "button",
3504
3528
  {
3505
3529
  type: "button",
@@ -3535,34 +3559,34 @@ function Ic({ tools: e, active: t, onSelect: n, columns: r = 1, onColumns: i, co
3535
3559
  J(() => {
3536
3560
  h != null && p((D) => D.get(h) === t ? D : new Map(D).set(h, t));
3537
3561
  }, [t, h]);
3538
- const [f, g] = B(!1), b = R(null), w = we(), m = e.filter((D) => !w.state(`tool:${D.id}`).hidden), y = w.state(`tool:${t}`).denied ? m.find((D) => !w.state(`tool:${D.id}`).denied)?.id : void 0, I = R(n);
3539
- I.current = n, Te(() => {
3540
- y && I.current(y);
3562
+ const [f, g] = B(!1), w = R(null), b = be(), m = e.filter((D) => !b.state(`tool:${D.id}`).hidden), y = b.state(`tool:${t}`).denied ? m.find((D) => !b.state(`tool:${D.id}`).denied)?.id : void 0, M = R(n);
3563
+ M.current = n, Te(() => {
3564
+ y && M.current(y);
3541
3565
  }, [y]);
3542
- const N = [];
3566
+ const P = [];
3543
3567
  for (const D of m) {
3544
- const Z = N.at(-1);
3545
- Z && D.group != null && Z[0].group === D.group ? Z.push(D) : N.push([D]);
3568
+ const Z = P.at(-1);
3569
+ Z && D.group != null && Z[0].group === D.group ? Z.push(D) : P.push([D]);
3546
3570
  }
3547
3571
  const E = [];
3548
- for (const D of N) {
3572
+ for (const D of P) {
3549
3573
  const Z = E.at(-1);
3550
3574
  Z && Z[0][0].section === D[0].section ? Z.push(D) : E.push([D]);
3551
3575
  }
3552
3576
  J(() => {
3553
3577
  if (r !== "auto" || typeof ResizeObserver > "u") return;
3554
- const D = b.current, Z = D?.parentElement;
3578
+ const D = w.current, Z = D?.parentElement;
3555
3579
  if (!D || !Z) return;
3556
- const Q = () => g(xc(N.length, E.length, Z.getBoundingClientRect().bottom - D.getBoundingClientRect().top)), fe = new ResizeObserver(Q);
3580
+ const Q = () => g(xc(P.length, E.length, Z.getBoundingClientRect().bottom - D.getBoundingClientRect().top)), fe = new ResizeObserver(Q);
3557
3581
  return fe.observe(Z), () => fe.disconnect();
3558
- }, [r, N.length, E.length]);
3559
- const Y = r === 2 || r === "auto" && f ? 2 : 1, q = o ? w.state(o) : { hidden: !1, disabled: !1 }, V = (D) => {
3560
- w.state(`tool:${D}`).denied || n(D);
3561
- }, j = (D) => {
3562
- const Z = (ce) => !w.state(`tool:${ce.id}`).denied, Q = D[0].group == null || !a ? void 0 : l.get(D[0].group), fe = D.find((ce) => ce.id === t) ?? D.find((ce) => ce.id === Q && Z(ce)) ?? D.find(Z) ?? D[0];
3563
- return /* @__PURE__ */ u(vc, { tools: D, shown: fe, active: t, onSelect: V, rail: b, pressMs: s }, D[0].id);
3582
+ }, [r, P.length, E.length]);
3583
+ const G = r === 2 || r === "auto" && f ? 2 : 1, q = o ? b.state(o) : { hidden: !1, disabled: !1 }, Y = (D) => {
3584
+ b.state(`tool:${D}`).denied || n(D);
3585
+ }, U = (D) => {
3586
+ const Z = (ce) => !b.state(`tool:${ce.id}`).denied, Q = D[0].group == null || !a ? void 0 : l.get(D[0].group), fe = D.find((ce) => ce.id === t) ?? D.find((ce) => ce.id === Q && Z(ce)) ?? D.find(Z) ?? D[0];
3587
+ return /* @__PURE__ */ u(vc, { tools: D, shown: fe, active: t, onSelect: Y, rail: w, pressMs: s }, D[0].id);
3564
3588
  };
3565
- return /* @__PURE__ */ M("div", { className: "kui-tool-rail", role: "toolbar", "aria-orientation": "vertical", "data-testid": `${d}-tool-rail`, "data-columns": Y, ref: b, children: [
3589
+ return /* @__PURE__ */ T("div", { className: "kui-tool-rail", role: "toolbar", "aria-orientation": "vertical", "data-testid": `${d}-tool-rail`, "data-columns": G, ref: w, children: [
3566
3590
  i && r !== "auto" && !q.hidden ? /* @__PURE__ */ u(
3567
3591
  "button",
3568
3592
  {
@@ -3577,9 +3601,9 @@ function Ic({ tools: e, active: t, onSelect: n, columns: r = 1, onColumns: i, co
3577
3601
  children: r === 2 ? /* @__PURE__ */ u($s, { size: 12, strokeWidth: $e, "aria-hidden": "true" }) : /* @__PURE__ */ u(Is, { size: 12, strokeWidth: $e, "aria-hidden": "true" })
3578
3602
  }
3579
3603
  ) : null,
3580
- E.map((D, Z) => /* @__PURE__ */ M(Ro, { children: [
3604
+ E.map((D, Z) => /* @__PURE__ */ T(Ro, { children: [
3581
3605
  Z > 0 ? /* @__PURE__ */ u("div", { className: "kui-tool-rail-divider", "aria-hidden": "true" }) : null,
3582
- Y === 2 ? $c(D, 2).map((Q) => /* @__PURE__ */ u("div", { className: "kui-tool-rail-row", children: Q.map(j) }, Q[0][0].id)) : D.map(j)
3606
+ G === 2 ? $c(D, 2).map((Q) => /* @__PURE__ */ u("div", { className: "kui-tool-rail-row", children: Q.map(U) }, Q[0][0].id)) : D.map(U)
3583
3607
  ] }, D[0][0].id))
3584
3608
  ] });
3585
3609
  }
@@ -3590,12 +3614,12 @@ function xu({ hidden: e = [] }) {
3590
3614
  return /* @__PURE__ */ u(Ic, { tools: i, active: t.active, onSelect: t.select });
3591
3615
  }
3592
3616
  function $u({ id: e, title: t, children: n, defaultOpen: r = !0, actions: i, testId: o }) {
3593
- const [a, s] = B(r), d = we();
3617
+ const [a, s] = B(r), d = be();
3594
3618
  e && (d.declared, void 0);
3595
3619
  const c = e ? d.state(e) : null;
3596
- return c?.hidden ? null : /* @__PURE__ */ M("section", { className: "kui-panel-section", "data-open": a, "data-testid": o, "data-kit-ui-id": e, children: [
3597
- /* @__PURE__ */ M("div", { className: "kui-panel-section-header", children: [
3598
- /* @__PURE__ */ M("button", { type: "button", className: "kui-panel-section-toggle", "aria-expanded": a, onClick: () => s((l) => !l), children: [
3620
+ return c?.hidden ? null : /* @__PURE__ */ T("section", { className: "kui-panel-section", "data-open": a, "data-testid": o, "data-kit-ui-id": e, children: [
3621
+ /* @__PURE__ */ T("div", { className: "kui-panel-section-header", children: [
3622
+ /* @__PURE__ */ T("button", { type: "button", className: "kui-panel-section-toggle", "aria-expanded": a, onClick: () => s((l) => !l), children: [
3599
3623
  /* @__PURE__ */ u(On, { size: 13, strokeWidth: $e, "aria-hidden": "true", className: "kui-panel-section-chevron" }),
3600
3624
  t
3601
3625
  ] }),
@@ -3612,7 +3636,7 @@ function Iu(e) {
3612
3636
  }
3613
3637
  const Mu = ["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp"];
3614
3638
  function Tu() {
3615
- const e = te(), { host: t, t: n } = e, r = t.init.capabilities.includes("pick-file"), i = H(
3639
+ const e = te(), { host: t, t: n } = e, r = t.init.capabilities.includes("pick-file"), i = K(
3616
3640
  async (o, a) => {
3617
3641
  try {
3618
3642
  const s = await t.pick(o, a);
@@ -3699,7 +3723,7 @@ function Ac() {
3699
3723
  return pe(() => ({ ...e, leases: t }), [e, t]);
3700
3724
  }
3701
3725
  function Eu(e) {
3702
- const { leases: t, acquire: n, release: r } = Ac(), i = e ? eo(t, e)?.holder ?? null : null, o = e ? t.some((d) => d.holder.self && d.scope === e) : !1, a = H((d) => e ? n(e, d) : Promise.resolve({ granted: !0, lease: null }), [n, e]), s = H(() => e ? r(e) : Promise.resolve(), [r, e]);
3726
+ const { leases: t, acquire: n, release: r } = Ac(), i = e ? eo(t, e)?.holder ?? null : null, o = e ? t.some((d) => d.holder.self && d.scope === e) : !1, a = K((d) => e ? n(e, d) : Promise.resolve({ granted: !0, lease: null }), [n, e]), s = K(() => e ? r(e) : Promise.resolve(), [r, e]);
3703
3727
  return { heldBy: i, mine: o, acquire: a, release: s };
3704
3728
  }
3705
3729
  function mt(e, t) {
@@ -3750,11 +3774,11 @@ function Lc(e, t) {
3750
3774
  schema: r.schema ?? null
3751
3775
  }));
3752
3776
  }
3753
- function Nc(e, t, n, r) {
3777
+ function Pc(e, t, n, r) {
3754
3778
  const i = r?.name || "another session";
3755
3779
  return new he(-32e3, `step ${t} (\`${e}\`) is not allowed: ${i} holds the lease on \`${n}\``, { reason: fn, command: e, step: t, scope: n, ...r ? { holder: r } : {} });
3756
3780
  }
3757
- async function Pc(e, t, n, r, i, o) {
3781
+ async function Nc(e, t, n, r, i, o) {
3758
3782
  if (!t) {
3759
3783
  const s = n ? e.list().find((d) => !d.holder.self && d.scope === "*") : void 0;
3760
3784
  if (s) throw o("*", s.holder);
@@ -3775,53 +3799,53 @@ async function Pc(e, t, n, r, i, o) {
3775
3799
  function Ou(e, t, n, r = {}) {
3776
3800
  const i = e.init.document.path, o = e.readOnly === !0, a = o && e.init.document.comments?.canComment === !0, s = t.commentCommands, d = pe(() => ul(s, a), [a, s]), c = kl(e.files, t, i, !0, n, { readOnly: o, canComment: a, replicaMergesFile: r.replicaMergesFile, followFile: r.followFile }), { doc: l, failure: p } = c, h = l?.info.revision ?? null, f = l?.info.dirty ?? !1, g = R(c);
3777
3801
  g.current = c;
3778
- const b = R({ doc: null, map: null, commands: null, loading: null }), w = H((C) => {
3779
- const W = b.current;
3802
+ const w = R({ doc: null, map: null, commands: null, loading: null }), b = K((C) => {
3803
+ const W = w.current;
3780
3804
  if (W.doc === C && W.loading) return W.loading;
3781
- const _ = C.commands().then((T) => {
3782
- const K = new Map(T.map((ne) => [ne.id, ne.menu]));
3783
- return b.current.loading === _ && (b.current = { doc: C, map: K, commands: new Map(T.map((ne) => [ne.id, ne])), loading: _ }), K;
3805
+ const V = C.commands().then((I) => {
3806
+ const _ = new Map(I.map((ne) => [ne.id, ne.menu]));
3807
+ return w.current.loading === V && (w.current = { doc: C, map: _, commands: new Map(I.map((ne) => [ne.id, ne])), loading: V }), _;
3784
3808
  });
3785
- return _.catch(() => {
3786
- b.current.loading === _ && (b.current = { doc: null, map: null, commands: null, loading: null });
3787
- }), b.current = { doc: C, map: null, commands: null, loading: _ }, _;
3809
+ return V.catch(() => {
3810
+ w.current.loading === V && (w.current = { doc: null, map: null, commands: null, loading: null });
3811
+ }), w.current = { doc: C, map: null, commands: null, loading: V }, V;
3788
3812
  }, []);
3789
3813
  J(() => {
3790
- l && w(l).catch(() => {
3814
+ l && b(l).catch(() => {
3791
3815
  });
3792
- }, [l, w]);
3793
- const m = H(
3816
+ }, [l, b]);
3817
+ const m = K(
3794
3818
  (C) => {
3795
- const W = b.current.commands?.get(C);
3819
+ const W = w.current.commands?.get(C);
3796
3820
  return It(W ?? { id: C }, d);
3797
3821
  },
3798
3822
  [d]
3799
- ), y = H(
3800
- async (C, W = {}, _ = null, T = {}) => {
3801
- const K = g.current.doc;
3802
- if (!K) return null;
3803
- const ne = b.current, P = ne.doc === K && ne.map ? ne.map : await w(K);
3804
- if (Se(e.ui.get(), `command:${C}`, P.get(C) ?? []).denied) throw ht(C);
3823
+ ), y = K(
3824
+ async (C, W = {}, V = null, I = {}) => {
3825
+ const _ = g.current.doc;
3826
+ if (!_) return null;
3827
+ const ne = w.current, N = ne.doc === _ && ne.map ? ne.map : await b(_);
3828
+ if (Se(e.ui.get(), `command:${C}`, N.get(C) ?? []).denied) throw ht(C);
3805
3829
  if (o && m(C)) throw mt(C);
3806
3830
  try {
3807
- return await c.run(C, W, _, T);
3808
- } catch (G) {
3809
- throw Fi(G) ? mt(C) : G;
3831
+ return await c.run(C, W, V, I);
3832
+ } catch (j) {
3833
+ throw Fi(j) ? mt(C) : j;
3810
3834
  }
3811
3835
  },
3812
- [m, e, w, o, c.run]
3813
- ), I = r.agentSkipsUnchangedPaint === !0, N = R(r);
3814
- N.current = r;
3815
- const E = pe(() => _i(Vi, e.init.locale), [e]), Y = r.agentLeaseScope != null;
3836
+ [m, e, b, o, c.run]
3837
+ ), M = r.agentSkipsUnchangedPaint === !0, P = R(r);
3838
+ P.current = r;
3839
+ const E = pe(() => _i(Vi, e.init.locale), [e]), G = r.agentLeaseScope != null;
3816
3840
  J(() => {
3817
- Y && dn(e);
3818
- }, [e, Y]);
3819
- const q = R(Promise.resolve()), V = R(null), j = R(null), [D, Z] = B(null), Q = H((C, W) => {
3820
- j.current = { edit: C, revision: W }, Z(C);
3841
+ G && dn(e);
3842
+ }, [e, G]);
3843
+ const q = R(Promise.resolve()), Y = R(null), U = R(null), [D, Z] = B(null), Q = K((C, W) => {
3844
+ U.current = { edit: C, revision: W }, Z(C);
3821
3845
  }, []), fe = R(!1), ce = R({ doc: null, version: null }), k = R(null);
3822
3846
  k.current ??= new Cl({
3823
3847
  open: () => g.current.draft.open(),
3824
- merge: (C, W, _, T) => g.current.draft.merge(C, W, _, T),
3848
+ merge: (C, W, V, I) => g.current.draft.merge(C, W, V, I),
3825
3849
  compare: (C, W) => g.current.draft.compare(C, W),
3826
3850
  preview: async (C) => {
3827
3851
  const W = g.current.doc;
@@ -3835,18 +3859,18 @@ function Ou(e, t, n, r = {}) {
3835
3859
  fe.current || (l ? (fe.current = !0, e.opened([...l.info.model ? ["model", "draft", "draft-model", "check"] : ["check"], ...l.info.context ? ["context"] : [], ...l.info.changes ? ["changes"] : [], ...l.info.premises ? ["premises"] : []])) : p && (fe.current = !0, e.failed(new Error(p))));
3836
3860
  }, [l, p, e]), J(() => {
3837
3861
  if (!l) return;
3838
- const C = V.current ?? (j.current?.revision === l.info.revision ? j.current.edit : { by: "person" });
3839
- C.by === "person" && j.current && (j.current = null, Z(null)), e.changed({ dirty: l.info.dirty, revision: l.info.revision, title: e.init.document.name, ...C });
3862
+ const C = Y.current ?? (U.current?.revision === l.info.revision ? U.current.edit : { by: "person" });
3863
+ C.by === "person" && U.current && (U.current = null, Z(null)), e.changed({ dirty: l.info.dirty, revision: l.info.revision, title: e.init.document.name, ...C });
3840
3864
  }, [l, e, h, f]);
3841
- const O = l?.info.schema?.reads ?? null, U = l?.info.schema?.newestAuthor ?? null, x = R(null);
3865
+ const O = l?.info.schema?.reads ?? null, H = l?.info.schema?.newestAuthor ?? null, x = R(null);
3842
3866
  return J(() => {
3843
- if (O === null || U === null || U <= O) return;
3844
- const C = `${O}:${U}`;
3845
- x.current !== C && (x.current = C, e.peer.notify("document/schema", { reads: O, newestAuthor: U }));
3846
- }, [e, U, O]), J(() => {
3867
+ if (O === null || H === null || H <= O) return;
3868
+ const C = `${O}:${H}`;
3869
+ x.current !== C && (x.current = C, e.peer.notify("document/schema", { reads: O, newestAuthor: H }));
3870
+ }, [e, H, O]), J(() => {
3847
3871
  if (!e.replica || !l) return;
3848
- const C = l.info.replica ?? null, W = C ? C.join(",") : null, _ = ce.current;
3849
- ce.current = { doc: l, version: W }, !(_.doc !== l || !C || W === _.version) && e.peer.notify("replica/changed", { version: C.slice().buffer });
3872
+ const C = l.info.replica ?? null, W = C ? C.join(",") : null, V = ce.current;
3873
+ ce.current = { doc: l, version: W }, !(V.doc !== l || !C || W === V.version) && e.peer.notify("replica/changed", { version: C.slice().buffer });
3850
3874
  }, [l, e, h]), J(() => {
3851
3875
  const { peer: C } = e;
3852
3876
  C.handle("document/state", () => {
@@ -3860,38 +3884,38 @@ function Ou(e, t, n, r = {}) {
3860
3884
  const A = g.current.doc;
3861
3885
  if (!A) throw new Error("the document is still opening");
3862
3886
  return A;
3863
- }, _ = k.current, T = (A) => {
3887
+ }, V = k.current, I = (A) => {
3864
3888
  if (o) throw new he(-32e3, "a draft is not allowed: the document is read-only", { reason: Oe });
3865
- return _.engine(A);
3889
+ return V.engine(A);
3866
3890
  };
3867
3891
  C.handle("ai/inspect", async (A) => {
3868
- const L = A?.draft === !0, re = L ? await T(!1) : W(), { width: ie, height: ae, dirty: se, canUndo: ge, canRedo: v, inspected: z } = re.info, S = `${ie} × ${ae}${L ? ", draft" : se ? ", unsaved" : ""}`, $ = A.context ? await re.inspectAt(A.context, A.part) : { details: z };
3869
- return re.agentReply({ path: i, kit: t.kitId, revision: re.info.revision, summary: S, dirty: L ? !1 : se, canUndo: ge, canRedo: v, ...$, ...L ? { draft: _.info() } : {} });
3892
+ const L = A?.draft === !0, re = L ? await I(!1) : W(), { width: ie, height: ae, dirty: se, canUndo: ge, canRedo: v, inspected: z } = re.info, S = `${ie} × ${ae}${L ? ", draft" : se ? ", unsaved" : ""}`, $ = A.context ? await re.inspectAt(A.context, A.part) : { details: z };
3893
+ return re.agentReply({ path: i, kit: t.kitId, revision: re.info.revision, summary: S, dirty: L ? !1 : se, canUndo: ge, canRedo: v, ...$, ...L ? { draft: V.info() } : {} });
3870
3894
  }), C.handle("document/check", async (A) => {
3871
- const L = A?.draft === !0 ? await T(!1) : W();
3895
+ const L = A?.draft === !0 ? await I(!1) : W();
3872
3896
  return L.agentReply({ diagnostics: await L.check() });
3873
3897
  }), C.handle("ai/commands", async ({ query: A }) => {
3874
3898
  const L = al(e.ui.get(), await W().commands());
3875
3899
  return Lc(o ? L.map((re) => It(re, d) ? { ...re, enabled: !1 } : re) : L, A);
3876
3900
  }), C.handle("ai/run", async (A) => {
3877
- const { steps: L, save: re, draft: ie } = A, ae = Ec(A), se = W(), ge = await w(se), v = ol(e.ui.get(), L, ($) => ge.get($) ?? []);
3901
+ const { steps: L, save: re, draft: ie } = A, ae = Ec(A), se = W(), ge = await b(se), v = ol(e.ui.get(), L, ($) => ge.get($) ?? []);
3878
3902
  if (v >= 0) throw ht(L[v].command, v);
3879
3903
  const z = o ? L.findIndex(($) => m($.command)) : -1;
3880
3904
  if (z >= 0) throw mt(L[z].command, z);
3881
- if (ie === !0) return ue(await T(!0), L);
3905
+ if (ie === !0) return ue(await I(!0), L);
3882
3906
  const S = se.info.context === !0 ? -1 : L.findIndex(($) => $.context != null);
3883
3907
  if (S >= 0) throw Dc(L[S].command, S);
3884
- return P(() => K(se, L, re, ae));
3908
+ return N(() => _(se, L, re, ae));
3885
3909
  });
3886
- const K = async (A, L, re, ie) => {
3887
- const ae = [], se = ie.by === "system" ? { kind: "system", principal: "kdm", label: ie.originLabel } : { kind: "agent", principal: e.init.document.comments?.me ?? "agent", label: "ai/run" }, ge = { last: null, meanwhile: !1 }, v = A.info.context === !0 ? { state: null } : null, z = ($) => ({ ...I ? { skipUnchangedPaint: !0 } : {}, origin: se, ...v ? { agent: { state: v, set: $ } } : {} });
3888
- V.current = ie;
3910
+ const _ = async (A, L, re, ie) => {
3911
+ const ae = [], se = ie.by === "system" ? { kind: "system", principal: "kdm", label: ie.originLabel } : { kind: "agent", principal: e.init.document.comments?.me ?? "agent", label: "ai/run" }, ge = { last: null, meanwhile: !1 }, v = A.info.context === !0 ? { state: null } : null, z = ($) => ({ ...M ? { skipUnchangedPaint: !0 } : {}, origin: se, ...v ? { agent: { state: v, set: $ } } : {} });
3912
+ Y.current = ie;
3889
3913
  try {
3890
3914
  for (const [$, F] of L.entries()) {
3891
3915
  let X = A.info.revision, ee;
3892
3916
  try {
3893
3917
  const oe = () => (X = A.info.revision, ge.last !== null && X !== ge.last && (ge.meanwhile = !0), y(F.command, F.params ?? {}, null, z(F.context ?? null)));
3894
- ee = await G(A, F.command, F.params ?? {}, $, oe, ie);
3918
+ ee = await j(A, F.command, F.params ?? {}, $, oe, ie);
3895
3919
  } catch (oe) {
3896
3920
  if (oe instanceof he && oe.data?.reason === fn) throw oe;
3897
3921
  const ke = oe instanceof he && oe.data?.reason === "not-allowed" ? ht(F.command, $) : oe instanceof he && oe.data?.reason === Oe ? mt(F.command, $) : Oc(oe, F.command, $);
@@ -3906,7 +3930,7 @@ function Ou(e, t, n, r = {}) {
3906
3930
  return { completed: ae, closed: !0, saved: !1, notRun: L.length - ae.length };
3907
3931
  }
3908
3932
  } finally {
3909
- V.current = null;
3933
+ Y.current = null;
3910
3934
  }
3911
3935
  ae.some(($) => $.changed) && Q(ie, A.info.revision);
3912
3936
  const S = !o && !Se(e.ui.get(), "action:save").denied;
@@ -3924,7 +3948,7 @@ function Ou(e, t, n, r = {}) {
3924
3948
  const oe = A.info.revision;
3925
3949
  se.last !== null && oe !== se.last && (se.meanwhile = !0);
3926
3950
  try {
3927
- await G(A, "edit.undo", $r, ae, () => y("edit.undo", $r, null, ge), v);
3951
+ await j(A, "edit.undo", $r, ae, () => y("edit.undo", $r, null, ge), v);
3928
3952
  } catch (ke) {
3929
3953
  de = un(ke);
3930
3954
  break;
@@ -3946,7 +3970,7 @@ function Ou(e, t, n, r = {}) {
3946
3970
  [],
3947
3971
  L
3948
3972
  ) : $(` The ${L.length} step(s) before it were rolled back: the document is as it was before the run.`, [], L);
3949
- }, P = (A) => {
3973
+ }, N = (A) => {
3950
3974
  const L = q.current.then(A, A);
3951
3975
  return q.current = L.then(
3952
3976
  () => {
@@ -3954,8 +3978,8 @@ function Ou(e, t, n, r = {}) {
3954
3978
  () => {
3955
3979
  }
3956
3980
  ), L;
3957
- }, G = async (A, L, re, ie, ae, se) => {
3958
- const ge = N.current.agentLeaseScope, v = ge ? dn(e) : null;
3981
+ }, j = async (A, L, re, ie, ae, se) => {
3982
+ const ge = P.current.agentLeaseScope, v = ge ? dn(e) : null;
3959
3983
  if (!ge || !v?.available) return ae();
3960
3984
  let z = "";
3961
3985
  try {
@@ -3963,10 +3987,10 @@ function Ou(e, t, n, r = {}) {
3963
3987
  } catch {
3964
3988
  z = "";
3965
3989
  }
3966
- const S = b.current.commands?.get(L)?.mutates ?? !0;
3967
- return Pc(v, z, S, N.current.agentLeaseTtl, ae, ($, F) => (se.by === "agent" && e.notify({ level: "warning", title: E("agentLeaseHeld", { name: F?.name || E("someone") }) }), Nc(L, ie, $, F)));
3990
+ const S = w.current.commands?.get(L)?.mutates ?? !0;
3991
+ return Nc(v, z, S, P.current.agentLeaseTtl, ae, ($, F) => (se.by === "agent" && e.notify({ level: "warning", title: E("agentLeaseHeld", { name: F?.name || E("someone") }) }), Pc(L, ie, $, F)));
3968
3992
  };
3969
- C.handle("ai/preview", async ({ maxSize: A, draft: L }) => ({ png: await an(L === !0 ? await T(!1) : W(), A) }));
3993
+ C.handle("ai/preview", async ({ maxSize: A, draft: L }) => ({ png: await an(L === !0 ? await I(!1) : W(), A) }));
3970
3994
  const ue = async (A, L) => {
3971
3995
  const re = [];
3972
3996
  let ie = !1;
@@ -3988,23 +4012,23 @@ function Ou(e, t, n, r = {}) {
3988
4012
  return ie = !0, { completed: re, closed: !0, saved: !1, notRun: L.length - re.length };
3989
4013
  }
3990
4014
  } finally {
3991
- !ie && re.some((ae) => ae.changed) && _.edited();
4015
+ !ie && re.some((ae) => ae.changed) && V.edited();
3992
4016
  }
3993
4017
  return { completed: re, saved: !1 };
3994
4018
  };
3995
- C.handle("draft/state", () => _.info()), C.handle("draft/ready", () => _.ready()), C.handle("draft/reopen", () => _.reopen()), C.handle("draft/compare", (A) => _.compare(Math.max(1, Number(A?.maxSize) || 1024), A?.schema ?? null)), C.handle("draft/merge", async ({ origin: A, schema: L = null }) => {
4019
+ C.handle("draft/state", () => V.info()), C.handle("draft/ready", () => V.ready()), C.handle("draft/reopen", () => V.reopen()), C.handle("draft/compare", (A) => V.compare(Math.max(1, Number(A?.maxSize) || 1024), A?.schema ?? null)), C.handle("draft/merge", async ({ origin: A, schema: L = null }) => {
3996
4020
  if (o) throw new he(-32e3, "the document is read-only", { reason: Oe });
3997
4021
  const re = { kind: "agent", principal: String(A?.principal ?? ""), ...A?.label ? { label: String(A.label) } : {} };
3998
- V.current = { by: "agent" };
4022
+ Y.current = { by: "agent" };
3999
4023
  try {
4000
- const ie = await _.merge(re, L), ae = g.current.doc;
4001
- return ae && Q({ by: "agent" }, ae.info.revision), ie.merged && N.current.draftMerged?.({ summary: ie.summary }), ie;
4024
+ const ie = await V.merge(re, L), ae = g.current.doc;
4025
+ return ae && Q({ by: "agent" }, ae.info.revision), ie.merged && P.current.draftMerged?.({ summary: ie.summary }), ie;
4002
4026
  } catch (ie) {
4003
4027
  throw ie instanceof Je ? xr(ie.data) : ie;
4004
4028
  } finally {
4005
- V.current = null;
4029
+ Y.current = null;
4006
4030
  }
4007
- }), C.handle("draft/discard", () => _.discard());
4031
+ }), C.handle("draft/discard", () => V.discard());
4008
4032
  const ye = async (A) => {
4009
4033
  if (!W().info.model) throw new he(-32601, "the kit's engine does not answer the object model");
4010
4034
  try {
@@ -4023,22 +4047,22 @@ function Ou(e, t, n, r = {}) {
4023
4047
  (A) => ye(async () => {
4024
4048
  const { schema: L = null, draft: re, ...ie } = A ?? {}, ae = Array.isArray(ie.ops) ? ie.ops : [];
4025
4049
  if (o && ae.length) throw new Je({ code: Oe, index: null, message: "the document is read-only" });
4026
- const se = await w(W());
4050
+ const se = await b(W());
4027
4051
  if (ae.forEach((z, S) => {
4028
4052
  if (z?.op === "command" && typeof z.id == "string" && Se(e.ui.get(), `command:${z.id}`, se.get(z.id) ?? []).denied)
4029
4053
  throw new Je({ code: "command-failed", index: S, message: ht(z.id).message });
4030
4054
  }), re !== !0) return g.current.model.batch(ie, L);
4031
- const v = await (await T(ae.length > 0)).modelBatch(ie, L);
4032
- return ae.length && _.edited(), v;
4055
+ const v = await (await I(ae.length > 0)).modelBatch(ie, L);
4056
+ return ae.length && V.edited(), v;
4033
4057
  })
4034
4058
  );
4035
- const Ne = C.on("document/fileChanged", () => void g.current.checkFile()), We = C.on("document/held", (A) => {
4059
+ const Pe = C.on("document/fileChanged", () => void g.current.checkFile()), We = C.on("document/held", (A) => {
4036
4060
  typeof A?.version == "string" && g.current.holdFile(A.version);
4037
4061
  });
4038
4062
  return e.replica && (C.handle("replica/version", async () => ({ version: await g.current.replica.version() })), C.handle("replica/export", ({ since: A }) => g.current.replica.exportChanges(A)), C.handle("replica/import", async ({ changes: A, blobs: L }) => ({ damage: await g.current.replica.importChanges(A, L) })), C.handle("replica/info", async () => ({ docId: await g.current.replica.docId() }))), () => {
4039
- Ne(), We();
4063
+ Pe(), We();
4040
4064
  };
4041
- }, [d, Q, m, e, t.kitId, w, i, o, y, I, E]), { ...c, run: y, editedBy: D, comments: d };
4065
+ }, [d, Q, m, e, t.kitId, b, i, o, y, M, E]), { ...c, run: y, editedBy: D, comments: d };
4042
4066
  }
4043
4067
  const to = [
4044
4068
  { preset: "rect", icon: ct, label: "drawingRect" },
@@ -4052,9 +4076,9 @@ const to = [
4052
4076
  ], Fc = ["Shape", "Shapes", "Text Box", "Textbox"], Wc = [0.5, 0.75, 1, 1.5, 2.25, 3, 4.5, 6];
4053
4077
  function Ru({ testId: e = "drawing", label: t, merge: n, exclude: r, primary: i }) {
4054
4078
  const o = te(), { t: a } = o, s = !o.enabled("drawing.insert"), d = (p) => void o.run("drawing.insert", p), c = o.byId.has("draw.shape"), l = (p) => c ? void o.run("draw.shape", { preset: p }) : d({ geometry: { preset: p } });
4055
- return /* @__PURE__ */ M(Me, { label: t ?? a("drawingIllustrations"), icon: _e, children: [
4079
+ return /* @__PURE__ */ T(Me, { label: t ?? a("drawingIllustrations"), icon: _e, children: [
4056
4080
  /* @__PURE__ */ u(xe, { icon: _e, label: a("drawingShapes"), size: "large", disabled: s, testId: `${e}-shapes`, primary: !0, children: to.map((p) => /* @__PURE__ */ u(le, { icon: p.icon, label: a(p.label), testId: `${e}-shape-${p.preset}`, onSelect: () => l(p.preset) }, p.preset)) }),
4057
- /* @__PURE__ */ u(be, { icon: Ue, label: a("drawingTextBox"), size: "large", disabled: s, onClick: () => d({ kind: "textBox", text: "" }), "data-testid": `${e}-text-box`, primary: !0 }),
4081
+ /* @__PURE__ */ u(we, { icon: Ue, label: a("drawingTextBox"), size: "large", disabled: s, onClick: () => d({ kind: "textBox", text: "" }), "data-testid": `${e}-text-box`, primary: !0 }),
4058
4082
  n ? /* @__PURE__ */ u(uc, { path: n, titles: Fc, exclude: r, primary: i?.length ? i : void 0 }) : null
4059
4083
  ] });
4060
4084
  }
@@ -4124,7 +4148,7 @@ const qc = [
4124
4148
  ];
4125
4149
  function jc({ disabled: e, testId: t = "drawing", onPick: n }) {
4126
4150
  const { t: r } = te();
4127
- return /* @__PURE__ */ M(xe, { icon: vn, label: r("drawingTransform"), disabled: e, testId: `${t}-transform`, children: [
4151
+ return /* @__PURE__ */ T(xe, { icon: vn, label: r("drawingTransform"), disabled: e, testId: `${t}-transform`, children: [
4128
4152
  Uc.map((i) => /* @__PURE__ */ u(le, { label: r(i.label), testId: `${t}-warp-${i.preset}`, onSelect: () => n(i.preset) }, i.preset)),
4129
4153
  /* @__PURE__ */ u(Ae, {}),
4130
4154
  /* @__PURE__ */ u(le, { label: r("drawingNoTransform"), testId: `${t}-no-warp`, onSelect: () => n(null) })
@@ -4134,16 +4158,16 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
4134
4158
  const r = te(), { t: i } = r, o = e.length === 0 || !r.enabled("drawing.format"), a = (f) => void r.run("drawing.format", { ids: e, ...f }), s = e.length === 0 || !r.enabled("drawing.arrange"), d = (f) => void r.run("drawing.arrange", { ids: e, order: f }), c = Hc(e), l = e.length === 0 || !r.enabled("drawing.text"), p = (f) => {
4135
4159
  for (const g of e) r.run("drawing.text", { id: g, warp: f });
4136
4160
  }, h = Kc(e) ?? "#5645D4";
4137
- return /* @__PURE__ */ M(Ce, { children: [
4138
- /* @__PURE__ */ u(Me, { label: i("drawingShapeStyles"), icon: xt, children: /* @__PURE__ */ M(Fe, { children: [
4139
- /* @__PURE__ */ M(xe, { icon: xt, label: i("drawingFill"), disabled: o, testId: `${t}-fill`, primary: !0, children: [
4161
+ return /* @__PURE__ */ T(Ce, { children: [
4162
+ /* @__PURE__ */ u(Me, { label: i("drawingShapeStyles"), icon: xt, children: /* @__PURE__ */ T(Fe, { children: [
4163
+ /* @__PURE__ */ T(xe, { icon: xt, label: i("drawingFill"), disabled: o, testId: `${t}-fill`, primary: !0, children: [
4140
4164
  /* @__PURE__ */ u(Vt, { onPick: (f) => a({ fill: { color: f } }), testId: `${t}-fill-colors` }),
4141
4165
  /* @__PURE__ */ u(Ae, {}),
4142
4166
  Bc.map((f) => /* @__PURE__ */ u(le, { label: i(f.label), testId: `${t}-gradient-${f.id}`, onSelect: () => a({ fill: _c(h, f) }) }, f.id)),
4143
4167
  /* @__PURE__ */ u(Ae, {}),
4144
4168
  /* @__PURE__ */ u(le, { label: i("drawingNoFill"), testId: `${t}-no-fill`, onSelect: () => a({ fill: { none: !0 } }) })
4145
4169
  ] }),
4146
- n ? /* @__PURE__ */ M(xe, { icon: Lt, label: i("drawingEffects"), disabled: o, testId: `${t}-effects`, children: [
4170
+ n ? /* @__PURE__ */ T(xe, { icon: Lt, label: i("drawingEffects"), disabled: o, testId: `${t}-effects`, children: [
4147
4171
  qc.map((f) => /* @__PURE__ */ u(le, { label: i(f.label), testId: `${t}-shadow-${f.id}`, onSelect: () => a({ effects: { shadow: { color: { rgb: "#000000", alpha: 0.4 }, ...f.shadow } } }) }, f.id)),
4148
4172
  /* @__PURE__ */ u(le, { label: i("drawingNoShadow"), testId: `${t}-no-shadow`, onSelect: () => a({ effects: { shadow: null } }) }),
4149
4173
  /* @__PURE__ */ u(Ae, {}),
@@ -4151,7 +4175,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
4151
4175
  /* @__PURE__ */ u(le, { label: i("drawingNoGlow"), testId: `${t}-no-glow`, onSelect: () => a({ effects: { glow: null } }) })
4152
4176
  ] }) : null,
4153
4177
  /* @__PURE__ */ u(jc, { disabled: l, testId: t, onPick: p }),
4154
- /* @__PURE__ */ M(xe, { icon: it, label: i("drawingOutline"), disabled: o, testId: `${t}-outline`, primary: !0, children: [
4178
+ /* @__PURE__ */ T(xe, { icon: it, label: i("drawingOutline"), disabled: o, testId: `${t}-outline`, primary: !0, children: [
4155
4179
  /* @__PURE__ */ u(Vt, { onPick: (f) => a({ stroke: { color: f } }), testId: `${t}-outline-colors` }),
4156
4180
  /* @__PURE__ */ u(Ae, {}),
4157
4181
  Wc.map((f) => /* @__PURE__ */ u(le, { label: i("drawingWeight", { value: f }), testId: `${t}-weight-${f}`, onSelect: () => a({ stroke: { width: f } }) }, f)),
@@ -4159,21 +4183,21 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
4159
4183
  /* @__PURE__ */ u(le, { label: i("drawingNoOutline"), testId: `${t}-no-outline`, onSelect: () => a({ stroke: { none: !0 } }) })
4160
4184
  ] })
4161
4185
  ] }) }),
4162
- /* @__PURE__ */ M(Me, { label: i("drawingArrange"), icon: Qt, children: [
4186
+ /* @__PURE__ */ T(Me, { label: i("drawingArrange"), icon: Qt, children: [
4163
4187
  /* @__PURE__ */ u(Fe, { children: /* @__PURE__ */ u(xe, { icon: _e, label: i("drawingChangeShape"), disabled: o, testId: `${t}-change-shape`, children: to.map((f) => /* @__PURE__ */ u(le, { icon: f.icon, label: i(f.label), onSelect: () => a({ geometry: { preset: f.preset } }) }, f.preset)) }) }),
4164
- /* @__PURE__ */ M(Fe, { children: [
4165
- /* @__PURE__ */ M(xe, { icon: Qt, label: i("drawingBringForward"), disabled: s, testId: `${t}-bring`, primary: !0, children: [
4188
+ /* @__PURE__ */ T(Fe, { children: [
4189
+ /* @__PURE__ */ T(xe, { icon: Qt, label: i("drawingBringForward"), disabled: s, testId: `${t}-bring`, primary: !0, children: [
4166
4190
  /* @__PURE__ */ u(le, { label: i("drawingBringForward"), testId: `${t}-bring-forward`, onSelect: () => d("forward") }),
4167
4191
  /* @__PURE__ */ u(le, { label: i("drawingBringToFront"), testId: `${t}-bring-front`, onSelect: () => d("front") })
4168
4192
  ] }),
4169
- /* @__PURE__ */ M(xe, { icon: Es, label: i("drawingSendBackward"), disabled: s, testId: `${t}-send`, primary: !0, children: [
4193
+ /* @__PURE__ */ T(xe, { icon: Es, label: i("drawingSendBackward"), disabled: s, testId: `${t}-send`, primary: !0, children: [
4170
4194
  /* @__PURE__ */ u(le, { label: i("drawingSendBackward"), testId: `${t}-send-backward`, onSelect: () => d("backward") }),
4171
4195
  /* @__PURE__ */ u(le, { label: i("drawingSendToBack"), testId: `${t}-send-back`, onSelect: () => d("back") })
4172
4196
  ] })
4173
4197
  ] }),
4174
- /* @__PURE__ */ M(Fe, { children: [
4198
+ /* @__PURE__ */ T(Fe, { children: [
4175
4199
  /* @__PURE__ */ u(
4176
- be,
4200
+ we,
4177
4201
  {
4178
4202
  icon: In,
4179
4203
  label: i("drawingGroup"),
@@ -4184,7 +4208,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
4184
4208
  }
4185
4209
  ),
4186
4210
  /* @__PURE__ */ u(
4187
- be,
4211
+ we,
4188
4212
  {
4189
4213
  icon: Os,
4190
4214
  label: i("drawingConnect"),
@@ -4194,7 +4218,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
4194
4218
  }
4195
4219
  ),
4196
4220
  /* @__PURE__ */ u(
4197
- be,
4221
+ we,
4198
4222
  {
4199
4223
  icon: Mn,
4200
4224
  label: i("drawingUngroup"),
@@ -4204,7 +4228,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
4204
4228
  }
4205
4229
  ),
4206
4230
  /* @__PURE__ */ u(
4207
- be,
4231
+ we,
4208
4232
  {
4209
4233
  icon: $n,
4210
4234
  label: i("drawingRotateRight"),
@@ -4214,7 +4238,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
4214
4238
  }
4215
4239
  ),
4216
4240
  /* @__PURE__ */ u(
4217
- be,
4241
+ we,
4218
4242
  {
4219
4243
  icon: rt,
4220
4244
  label: i("drawingDelete"),
@@ -4235,7 +4259,7 @@ const Gc = [
4235
4259
  { tool: "eraser", icon: xi, label: "inkEraser" }
4236
4260
  ], Yc = [0.5, 1, 1.5, 2, 3, 4.5, 6, 12], Vc = ["pen", "pencil", "highlighter"];
4237
4261
  function Lu({ testId: e = "ink" }) {
4238
- const t = te(), n = Xe(), { t: r } = t, i = t.session.change?.revision, [o, a] = B(null), s = H(() => {
4262
+ const t = te(), n = Xe(), { t: r } = t, i = t.session.change?.revision, [o, a] = B(null), s = K(() => {
4239
4263
  t.query("draw.state").then((g) => {
4240
4264
  g && a(g);
4241
4265
  });
@@ -4245,14 +4269,14 @@ function Lu({ testId: e = "ink" }) {
4245
4269
  const g = setTimeout(s, 60);
4246
4270
  return () => clearTimeout(g);
4247
4271
  }, [s, i, n?.active]);
4248
- const d = (g) => n?.tools.some((b) => b.id === g) ?? !1, c = async (g) => {
4272
+ const d = (g) => n?.tools.some((w) => w.id === g) ?? !1, c = async (g) => {
4249
4273
  d(g) ? n?.select(g) : await t.run(`draw.${g}`, {}), s();
4250
4274
  }, l = n && d(o?.tool ?? "select") && n.tools.some((g) => g.id === n.active) ? n.active : o?.tool, p = o && Vc.includes(o.tool) ? o.tool : null, h = async (g) => {
4251
4275
  p && (await t.run(`draw.${p}`, g), s());
4252
4276
  }, f = !t.enabled("draw.pen");
4253
- return /* @__PURE__ */ M(Ce, { children: [
4277
+ return /* @__PURE__ */ T(Ce, { children: [
4254
4278
  /* @__PURE__ */ u(Me, { label: r("inkTools"), icon: Ti, children: Gc.map((g) => /* @__PURE__ */ u(
4255
- be,
4279
+ we,
4256
4280
  {
4257
4281
  icon: g.icon,
4258
4282
  label: r(g.label),
@@ -4265,7 +4289,7 @@ function Lu({ testId: e = "ink" }) {
4265
4289
  },
4266
4290
  g.tool
4267
4291
  )) }),
4268
- /* @__PURE__ */ u(Me, { label: r("inkPens"), icon: it, children: /* @__PURE__ */ M(Fe, { children: [
4292
+ /* @__PURE__ */ u(Me, { label: r("inkPens"), icon: it, children: /* @__PURE__ */ T(Fe, { children: [
4269
4293
  /* @__PURE__ */ u(
4270
4294
  xe,
4271
4295
  {
@@ -4363,7 +4387,7 @@ function ed(e) {
4363
4387
  function ro(e) {
4364
4388
  return e === "line" || e === "lineMarkers" || e === "stackedLine" || e === "scatter" || e === "radar";
4365
4389
  }
4366
- const Pn = [
4390
+ const Nn = [
4367
4391
  { kind: "column", icon: je, label: "chartColumn" },
4368
4392
  {
4369
4393
  kind: "stackedColumn",
@@ -4377,9 +4401,9 @@ const Pn = [
4377
4401
  { kind: "pie", icon: Qn, label: "chartPie" },
4378
4402
  { kind: "doughnut", icon: Qn, label: "chartDoughnut" },
4379
4403
  { kind: "scatter", icon: Ls, label: "chartScatter" },
4380
- { kind: "radar", icon: Ns, label: "chartRadar" }
4404
+ { kind: "radar", icon: Ps, label: "chartRadar" }
4381
4405
  ], td = ["top", "bottom", "left", "right"];
4382
- function Nu({
4406
+ function Pu({
4383
4407
  testId: e = "chart",
4384
4408
  size: t = "large",
4385
4409
  primary: n
@@ -4394,7 +4418,7 @@ function Nu({
4394
4418
  disabled: !r.enabled("drawing.insert"),
4395
4419
  testId: `${e}-insert`,
4396
4420
  primary: n,
4397
- children: Pn.map((o) => /* @__PURE__ */ u(
4421
+ children: Nn.map((o) => /* @__PURE__ */ u(
4398
4422
  le,
4399
4423
  {
4400
4424
  icon: o.icon,
@@ -4427,14 +4451,14 @@ function nd(e) {
4427
4451
  };
4428
4452
  }, [t, e, n]), r;
4429
4453
  }
4430
- function Pu({
4454
+ function Nu({
4431
4455
  id: e,
4432
4456
  testId: t = "chart",
4433
4457
  dataEditable: n = !0,
4434
4458
  formats: r = no
4435
4459
  }) {
4436
- const i = te(), { t: o } = i, a = nd(e), [s, d] = B(!1), [c, l] = B(null), p = !a || !i.enabled("drawing.chart"), h = (m) => void i.run("drawing.chart", { id: e, ...m }), f = typeof a?.kind == "object", g = a?.kind === "pie" || a?.kind === "doughnut", b = g || a?.kind === "radar" || f, w = (m) => h({ seriesFormat: (a?.series ?? []).map((y, I) => ({ index: I, ...m })) });
4437
- return /* @__PURE__ */ M(Ce, { children: [
4460
+ const i = te(), { t: o } = i, a = nd(e), [s, d] = B(!1), [c, l] = B(null), p = !a || !i.enabled("drawing.chart"), h = (m) => void i.run("drawing.chart", { id: e, ...m }), f = typeof a?.kind == "object", g = a?.kind === "pie" || a?.kind === "doughnut", w = g || a?.kind === "radar" || f, b = (m) => h({ seriesFormat: (a?.series ?? []).map((y, M) => ({ index: M, ...m })) });
4461
+ return /* @__PURE__ */ T(Ce, { children: [
4438
4462
  /* @__PURE__ */ u(Me, { label: o("chartType"), icon: je, children: /* @__PURE__ */ u(
4439
4463
  xe,
4440
4464
  {
@@ -4444,7 +4468,7 @@ function Pu({
4444
4468
  disabled: p || f,
4445
4469
  testId: `${t}-type`,
4446
4470
  primary: !0,
4447
- children: Pn.map((m) => /* @__PURE__ */ u(
4471
+ children: Nn.map((m) => /* @__PURE__ */ u(
4448
4472
  le,
4449
4473
  {
4450
4474
  icon: m.icon,
@@ -4459,10 +4483,10 @@ function Pu({
4459
4483
  ))
4460
4484
  }
4461
4485
  ) }),
4462
- /* @__PURE__ */ M(Me, { label: o("chartElements"), icon: Ps, children: [
4463
- /* @__PURE__ */ M(Fe, { children: [
4486
+ /* @__PURE__ */ T(Me, { label: o("chartElements"), icon: Ns, children: [
4487
+ /* @__PURE__ */ T(Fe, { children: [
4464
4488
  /* @__PURE__ */ u(
4465
- be,
4489
+ we,
4466
4490
  {
4467
4491
  icon: qr,
4468
4492
  label: o("chartTitle"),
@@ -4475,7 +4499,7 @@ function Pu({
4475
4499
  primary: !0
4476
4500
  }
4477
4501
  ),
4478
- /* @__PURE__ */ M(
4502
+ /* @__PURE__ */ T(
4479
4503
  xe,
4480
4504
  {
4481
4505
  icon: Ue,
@@ -4508,7 +4532,7 @@ function Pu({
4508
4532
  }
4509
4533
  ),
4510
4534
  /* @__PURE__ */ u(
4511
- be,
4535
+ we,
4512
4536
  {
4513
4537
  icon: pn,
4514
4538
  label: o("chartDataLabels"),
@@ -4520,9 +4544,9 @@ function Pu({
4520
4544
  }
4521
4545
  )
4522
4546
  ] }),
4523
- /* @__PURE__ */ M(Fe, { children: [
4547
+ /* @__PURE__ */ T(Fe, { children: [
4524
4548
  /* @__PURE__ */ u(
4525
- be,
4549
+ we,
4526
4550
  {
4527
4551
  icon: St,
4528
4552
  label: o("chartGridlines"),
@@ -4532,20 +4556,20 @@ function Pu({
4532
4556
  "data-testid": `${t}-gridlines`
4533
4557
  }
4534
4558
  ),
4535
- r.includes("trends") ? /* @__PURE__ */ M(Ce, { children: [
4536
- /* @__PURE__ */ M(xe, { icon: Fs, label: o("chartTrendline"), disabled: p || b, testId: `${t}-trendline`, children: [
4537
- Jc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-trendline-${m.id}`, onSelect: () => w({ trendline: m.trendline }) }, m.id)),
4559
+ r.includes("trends") ? /* @__PURE__ */ T(Ce, { children: [
4560
+ /* @__PURE__ */ T(xe, { icon: Fs, label: o("chartTrendline"), disabled: p || w, testId: `${t}-trendline`, children: [
4561
+ Jc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-trendline-${m.id}`, onSelect: () => b({ trendline: m.trendline }) }, m.id)),
4538
4562
  /* @__PURE__ */ u(Ae, {}),
4539
- /* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-trendline-none`, onSelect: () => w({ trendline: null }) })
4563
+ /* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-trendline-none`, onSelect: () => b({ trendline: null }) })
4540
4564
  ] }),
4541
- /* @__PURE__ */ M(xe, { icon: Ve, label: o("chartErrorBars"), disabled: p || b, testId: `${t}-error-bars`, children: [
4542
- Zc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-error-bars-${m.id}`, onSelect: () => w({ errorBars: m.errorBars }) }, m.id)),
4565
+ /* @__PURE__ */ T(xe, { icon: Ve, label: o("chartErrorBars"), disabled: p || w, testId: `${t}-error-bars`, children: [
4566
+ Zc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-error-bars-${m.id}`, onSelect: () => b({ errorBars: m.errorBars }) }, m.id)),
4543
4567
  /* @__PURE__ */ u(Ae, {}),
4544
- /* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-error-bars-none`, onSelect: () => w({ errorBars: null }) })
4568
+ /* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-error-bars-none`, onSelect: () => b({ errorBars: null }) })
4545
4569
  ] })
4546
4570
  ] }) : null,
4547
4571
  /* @__PURE__ */ u(
4548
- be,
4572
+ we,
4549
4573
  {
4550
4574
  icon: Ue,
4551
4575
  label: o("chartAxisTitles"),
@@ -4572,7 +4596,7 @@ function Pu({
4572
4596
  }
4573
4597
  ),
4574
4598
  n ? /* @__PURE__ */ u(Me, { label: o("chartData"), icon: yn, children: /* @__PURE__ */ u(
4575
- be,
4599
+ we,
4576
4600
  {
4577
4601
  icon: Ws,
4578
4602
  label: o("chartEditData"),
@@ -4624,9 +4648,9 @@ function rd({
4624
4648
  const { t: a } = te(), s = e?.kind === "pie" || e?.kind === "doughnut", d = typeof e?.kind == "object", c = ed(e?.kind), l = n.filter(
4625
4649
  (h) => h === "lineWidth" || h === "marker" || h === "smooth" || h === "combo"
4626
4650
  ), p = l.includes("lineWidth") || ro(e?.kind) && l.length > 0 || l.includes("combo") && typeof e?.kind == "string" && !["pie", "doughnut", "radar", "scatter"].includes(e.kind);
4627
- return !n.includes("axes") && !n.includes("labelPosition") && l.length === 0 ? null : /* @__PURE__ */ u(Me, { label: a("chartFormat"), icon: Rt, children: /* @__PURE__ */ M(Fe, { children: [
4651
+ return !n.includes("axes") && !n.includes("labelPosition") && l.length === 0 ? null : /* @__PURE__ */ u(Me, { label: a("chartFormat"), icon: Rt, children: /* @__PURE__ */ T(Fe, { children: [
4628
4652
  n.includes("axes") ? /* @__PURE__ */ u(
4629
- be,
4653
+ we,
4630
4654
  {
4631
4655
  icon: Ve,
4632
4656
  label: a("chartFormatAxis"),
@@ -4655,7 +4679,7 @@ function rd({
4655
4679
  }
4656
4680
  ) : null,
4657
4681
  l.length > 0 ? /* @__PURE__ */ u(
4658
- be,
4682
+ we,
4659
4683
  {
4660
4684
  icon: it,
4661
4685
  label: a("chartFormatSeries"),
@@ -4666,7 +4690,7 @@ function rd({
4666
4690
  ) : null
4667
4691
  ] }) });
4668
4692
  }
4669
- function wt(e) {
4693
+ function bt(e) {
4670
4694
  if (e.trim() === "") return null;
4671
4695
  const t = Number(e);
4672
4696
  return Number.isFinite(t) ? t : void 0;
@@ -4678,28 +4702,28 @@ function id({
4678
4702
  onClose: n,
4679
4703
  testId: r = "chart"
4680
4704
  }) {
4681
- const { t: i } = te(), [o, a] = B("yAxis"), s = (y) => e[y] ?? {}, [d, c] = B(() => Ir(s("yAxis"))), l = o === "yAxis" || e.kind === "scatter", p = wt(d.min), h = wt(d.max), f = wt(d.major), g = l && (p === void 0 || h === void 0 || f === void 0 || f != null && f <= 0 || p != null && h != null && p >= h) || d.numberFormat.length > 255, b = (y) => {
4705
+ const { t: i } = te(), [o, a] = B("yAxis"), s = (y) => e[y] ?? {}, [d, c] = B(() => Ir(s("yAxis"))), l = o === "yAxis" || e.kind === "scatter", p = bt(d.min), h = bt(d.max), f = bt(d.major), g = l && (p === void 0 || h === void 0 || f === void 0 || f != null && f <= 0 || p != null && h != null && p >= h) || d.numberFormat.length > 255, w = (y) => {
4682
4706
  a(y), c(Ir(s(y)));
4683
- }, w = () => {
4707
+ }, b = () => {
4684
4708
  const y = {
4685
4709
  numberFormat: d.numberFormat.trim() || null,
4686
4710
  hidden: !d.shown
4687
4711
  };
4688
4712
  l && Object.assign(y, { min: p, max: h, major: f }), t({ [o]: y }), n();
4689
- }, m = (y, I, N) => {
4690
- const E = d[y], Y = N && E.trim() !== "" && !Number.isFinite(Number(E));
4713
+ }, m = (y, M, P) => {
4714
+ const E = d[y], G = P && E.trim() !== "" && !Number.isFinite(Number(E));
4691
4715
  return [
4692
- /* @__PURE__ */ u("label", { htmlFor: `chart-axis-${y}`, children: I }, `${y}-label`),
4716
+ /* @__PURE__ */ u("label", { htmlFor: `chart-axis-${y}`, children: M }, `${y}-label`),
4693
4717
  /* @__PURE__ */ u(
4694
4718
  "input",
4695
4719
  {
4696
4720
  id: `chart-axis-${y}`,
4697
4721
  className: "kui-field",
4698
- inputMode: N ? "decimal" : void 0,
4722
+ inputMode: P ? "decimal" : void 0,
4699
4723
  placeholder: i("chartAxisAuto"),
4700
- "aria-invalid": Y,
4724
+ "aria-invalid": G,
4701
4725
  value: E,
4702
- onChange: (q) => c((V) => ({ ...V, [y]: q.target.value })),
4726
+ onChange: (q) => c((Y) => ({ ...Y, [y]: q.target.value })),
4703
4727
  "data-testid": `${r}-axis-${y}`
4704
4728
  },
4705
4729
  y
@@ -4712,20 +4736,20 @@ function id({
4712
4736
  title: i("chartFormatAxis"),
4713
4737
  onClose: n,
4714
4738
  testId: `${r}-axis`,
4715
- actions: /* @__PURE__ */ M(Ce, { children: [
4739
+ actions: /* @__PURE__ */ T(Ce, { children: [
4716
4740
  /* @__PURE__ */ u(me, { onClick: n, children: i("cancel") }),
4717
4741
  /* @__PURE__ */ u(
4718
4742
  me,
4719
4743
  {
4720
4744
  variant: "primary",
4721
4745
  disabled: g,
4722
- onClick: w,
4746
+ onClick: b,
4723
4747
  "data-testid": `${r}-axis-ok`,
4724
4748
  children: i("chartOk")
4725
4749
  }
4726
4750
  )
4727
4751
  ] }),
4728
- children: /* @__PURE__ */ M("div", { className: "kui-param-grid", children: [
4752
+ children: /* @__PURE__ */ T("div", { className: "kui-param-grid", children: [
4729
4753
  /* @__PURE__ */ u("span", { children: i("chartAxis") }),
4730
4754
  /* @__PURE__ */ u(
4731
4755
  gt,
@@ -4737,7 +4761,7 @@ function id({
4737
4761
  ["yAxis", i("chartAxisValue")],
4738
4762
  ["xAxis", i("chartAxisCategory")]
4739
4763
  ],
4740
- onChange: b,
4764
+ onChange: w,
4741
4765
  testId: `${r}-axis-which`
4742
4766
  }
4743
4767
  ),
@@ -4753,7 +4777,7 @@ function id({
4753
4777
  {
4754
4778
  label: i("chartAxisShow"),
4755
4779
  checked: d.shown,
4756
- onChange: (y) => c((I) => ({ ...I, shown: y })),
4780
+ onChange: (y) => c((M) => ({ ...M, shown: y })),
4757
4781
  testId: `${r}-axis-shown`
4758
4782
  }
4759
4783
  )
@@ -4777,8 +4801,8 @@ function od({
4777
4801
  onClose: r,
4778
4802
  testId: i = "chart"
4779
4803
  }) {
4780
- const { t: o } = te(), a = ro(e.kind), s = t.includes("combo") && typeof e.kind == "string" && !["pie", "doughnut", "radar", "scatter"].includes(e.kind), [d, c] = B(0), l = (w) => {
4781
- const m = e.series[w];
4804
+ const { t: o } = te(), a = ro(e.kind), s = t.includes("combo") && typeof e.kind == "string" && !["pie", "doughnut", "radar", "scatter"].includes(e.kind), [d, c] = B(0), l = (b) => {
4805
+ const m = e.series[b];
4782
4806
  return {
4783
4807
  lineWidth: yt(m?.lineWidth),
4784
4808
  marker: m?.marker ?? "",
@@ -4786,9 +4810,9 @@ function od({
4786
4810
  kind: typeof m?.kind == "string" ? m.kind : "",
4787
4811
  secondary: m?.secondary ?? !1
4788
4812
  };
4789
- }, [p, h] = B(() => l(0)), f = wt(p.lineWidth), g = f === void 0 || f != null && (f < 0 || f > 100), b = () => {
4790
- const w = { index: d };
4791
- t.includes("lineWidth") && (w.lineWidth = f), a && t.includes("marker") && (w.marker = p.marker === "" ? null : p.marker), a && t.includes("smooth") && (w.smooth = p.smooth), s && (w.kind = p.kind === "" ? null : p.kind, w.secondary = p.secondary), n({ seriesFormat: [w] }), r();
4813
+ }, [p, h] = B(() => l(0)), f = bt(p.lineWidth), g = f === void 0 || f != null && (f < 0 || f > 100), w = () => {
4814
+ const b = { index: d };
4815
+ t.includes("lineWidth") && (b.lineWidth = f), a && t.includes("marker") && (b.marker = p.marker === "" ? null : p.marker), a && t.includes("smooth") && (b.smooth = p.smooth), s && (b.kind = p.kind === "" ? null : p.kind, b.secondary = p.secondary), n({ seriesFormat: [b] }), r();
4792
4816
  };
4793
4817
  return /* @__PURE__ */ u(
4794
4818
  st,
@@ -4796,20 +4820,20 @@ function od({
4796
4820
  title: o("chartFormatSeries"),
4797
4821
  onClose: r,
4798
4822
  testId: `${i}-series`,
4799
- actions: /* @__PURE__ */ M(Ce, { children: [
4823
+ actions: /* @__PURE__ */ T(Ce, { children: [
4800
4824
  /* @__PURE__ */ u(me, { onClick: r, children: o("cancel") }),
4801
4825
  /* @__PURE__ */ u(
4802
4826
  me,
4803
4827
  {
4804
4828
  variant: "primary",
4805
4829
  disabled: g,
4806
- onClick: b,
4830
+ onClick: w,
4807
4831
  "data-testid": `${i}-series-ok`,
4808
4832
  children: o("chartOk")
4809
4833
  }
4810
4834
  )
4811
4835
  ] }),
4812
- children: /* @__PURE__ */ M("div", { className: "kui-param-grid", children: [
4836
+ children: /* @__PURE__ */ T("div", { className: "kui-param-grid", children: [
4813
4837
  /* @__PURE__ */ u("span", { children: o("chartSeries") }),
4814
4838
  /* @__PURE__ */ u(
4815
4839
  gt,
@@ -4817,9 +4841,9 @@ function od({
4817
4841
  label: o("chartSeries"),
4818
4842
  quiet: !0,
4819
4843
  value: String(d),
4820
- choices: e.series.map((w, m) => [String(m), w.name]),
4821
- onChange: (w) => {
4822
- c(Number(w)), h(l(Number(w)));
4844
+ choices: e.series.map((b, m) => [String(m), b.name]),
4845
+ onChange: (b) => {
4846
+ c(Number(b)), h(l(Number(b)));
4823
4847
  },
4824
4848
  testId: `${i}-series-which`
4825
4849
  }
@@ -4835,7 +4859,7 @@ function od({
4835
4859
  placeholder: o("chartAxisAuto"),
4836
4860
  "aria-invalid": g,
4837
4861
  value: p.lineWidth,
4838
- onChange: (w) => h((m) => ({ ...m, lineWidth: w.target.value })),
4862
+ onChange: (b) => h((m) => ({ ...m, lineWidth: b.target.value })),
4839
4863
  "data-testid": `${i}-series-width`
4840
4864
  },
4841
4865
  "w"
@@ -4851,11 +4875,11 @@ function od({
4851
4875
  value: p.marker,
4852
4876
  choices: [
4853
4877
  ["", o("chartMarker_auto")],
4854
- ...Qc.filter((w) => w !== "auto").map(
4855
- (w) => [w, o(`chartMarker_${w}`)]
4878
+ ...Qc.filter((b) => b !== "auto").map(
4879
+ (b) => [b, o(`chartMarker_${b}`)]
4856
4880
  )
4857
4881
  ],
4858
- onChange: (w) => h((m) => ({ ...m, marker: w })),
4882
+ onChange: (b) => h((m) => ({ ...m, marker: b })),
4859
4883
  testId: `${i}-series-marker`
4860
4884
  },
4861
4885
  "m"
@@ -4871,9 +4895,9 @@ function od({
4871
4895
  value: p.kind,
4872
4896
  choices: [
4873
4897
  ["", o("chartSeriesTypeChart")],
4874
- ...Xc.map((w) => [w, o(Pn.find((m) => m.kind === w)?.label ?? w)])
4898
+ ...Xc.map((b) => [b, o(Nn.find((m) => m.kind === b)?.label ?? b)])
4875
4899
  ],
4876
- onChange: (w) => h((m) => ({ ...m, kind: w })),
4900
+ onChange: (b) => h((m) => ({ ...m, kind: b })),
4877
4901
  testId: `${i}-series-kind`
4878
4902
  },
4879
4903
  "k"
@@ -4884,7 +4908,7 @@ function od({
4884
4908
  {
4885
4909
  label: o("chartSecondaryAxis"),
4886
4910
  checked: p.secondary,
4887
- onChange: (w) => h((m) => ({ ...m, secondary: w })),
4911
+ onChange: (b) => h((m) => ({ ...m, secondary: b })),
4888
4912
  testId: `${i}-series-secondary`
4889
4913
  },
4890
4914
  "x"
@@ -4897,7 +4921,7 @@ function od({
4897
4921
  {
4898
4922
  label: o("chartSmooth"),
4899
4923
  checked: p.smooth,
4900
- onChange: (w) => h((m) => ({ ...m, smooth: w })),
4924
+ onChange: (b) => h((m) => ({ ...m, smooth: b })),
4901
4925
  testId: `${i}-series-smooth`
4902
4926
  },
4903
4927
  "s"
@@ -4919,34 +4943,34 @@ function sd({
4919
4943
  onClose: n,
4920
4944
  testId: r = "chart"
4921
4945
  }) {
4922
- const { t: i } = te(), [o, a] = B(e.categories), [s, d] = B(e.series.map((b) => b.name)), [c, l] = B(
4946
+ const { t: i } = te(), [o, a] = B(e.categories), [s, d] = B(e.series.map((w) => w.name)), [c, l] = B(
4923
4947
  () => e.series.map(
4924
- (b) => e.categories.map(
4925
- (w, m) => b.values[m] == null ? "" : String(b.values[m])
4948
+ (w) => e.categories.map(
4949
+ (b, m) => w.values[m] == null ? "" : String(w.values[m])
4926
4950
  )
4927
4951
  )
4928
4952
  ), p = e.kind === "pie" || e.kind === "doughnut", h = c.some(
4929
- (b) => b.some((w) => w.trim() !== "" && !Number.isFinite(Number(w)))
4953
+ (w) => w.some((b) => b.trim() !== "" && !Number.isFinite(Number(b)))
4930
4954
  ), f = () => {
4931
4955
  t({
4932
4956
  categories: o,
4933
- series: s.map((b, w) => ({
4934
- name: b,
4935
- values: c[w].map((m) => m.trim() === "" ? null : Number(m))
4957
+ series: s.map((w, b) => ({
4958
+ name: w,
4959
+ values: c[b].map((m) => m.trim() === "" ? null : Number(m))
4936
4960
  }))
4937
4961
  }), n();
4938
- }, g = (b, w, m) => l(
4962
+ }, g = (w, b, m) => l(
4939
4963
  (y) => y.map(
4940
- (I, N) => N === b ? I.map((E, Y) => Y === w ? m : E) : I
4964
+ (M, P) => P === w ? M.map((E, G) => G === b ? m : E) : M
4941
4965
  )
4942
4966
  );
4943
- return /* @__PURE__ */ M(
4967
+ return /* @__PURE__ */ T(
4944
4968
  st,
4945
4969
  {
4946
4970
  title: i("chartEditData"),
4947
4971
  onClose: n,
4948
4972
  testId: `${r}-data`,
4949
- actions: /* @__PURE__ */ M(Ce, { children: [
4973
+ actions: /* @__PURE__ */ T(Ce, { children: [
4950
4974
  /* @__PURE__ */ u(me, { onClick: n, children: i("cancel") }),
4951
4975
  /* @__PURE__ */ u(
4952
4976
  me,
@@ -4960,31 +4984,31 @@ function sd({
4960
4984
  )
4961
4985
  ] }),
4962
4986
  children: [
4963
- /* @__PURE__ */ u("div", { style: { maxHeight: 360, overflow: "auto" }, children: /* @__PURE__ */ M("table", { className: "kui-chart-data", children: [
4964
- /* @__PURE__ */ u("thead", { children: /* @__PURE__ */ M("tr", { children: [
4987
+ /* @__PURE__ */ u("div", { style: { maxHeight: 360, overflow: "auto" }, children: /* @__PURE__ */ T("table", { className: "kui-chart-data", children: [
4988
+ /* @__PURE__ */ u("thead", { children: /* @__PURE__ */ T("tr", { children: [
4965
4989
  /* @__PURE__ */ u("th", {}),
4966
- s.map((b, w) => /* @__PURE__ */ u("th", { children: /* @__PURE__ */ u(
4990
+ s.map((w, b) => /* @__PURE__ */ u("th", { children: /* @__PURE__ */ u(
4967
4991
  "input",
4968
4992
  {
4969
- "aria-label": i("chartSeriesName", { n: w + 1 }),
4970
- value: b,
4993
+ "aria-label": i("chartSeriesName", { n: b + 1 }),
4994
+ value: w,
4971
4995
  onChange: (m) => d(
4972
- (y) => y.map((I, N) => N === w ? m.target.value : I)
4996
+ (y) => y.map((M, P) => P === b ? m.target.value : M)
4973
4997
  ),
4974
- "data-testid": `${r}-data-series-${w}`
4998
+ "data-testid": `${r}-data-series-${b}`
4975
4999
  }
4976
- ) }, w))
5000
+ ) }, b))
4977
5001
  ] }) }),
4978
- /* @__PURE__ */ u("tbody", { children: o.map((b, w) => /* @__PURE__ */ M("tr", { children: [
5002
+ /* @__PURE__ */ u("tbody", { children: o.map((w, b) => /* @__PURE__ */ T("tr", { children: [
4979
5003
  /* @__PURE__ */ u("th", { children: /* @__PURE__ */ u(
4980
5004
  "input",
4981
5005
  {
4982
- "aria-label": i("chartCategoryName", { n: w + 1 }),
4983
- value: b,
5006
+ "aria-label": i("chartCategoryName", { n: b + 1 }),
5007
+ value: w,
4984
5008
  onChange: (m) => a(
4985
- (y) => y.map((I, N) => N === w ? m.target.value : I)
5009
+ (y) => y.map((M, P) => P === b ? m.target.value : M)
4986
5010
  ),
4987
- "data-testid": `${r}-data-category-${w}`
5011
+ "data-testid": `${r}-data-category-${b}`
4988
5012
  }
4989
5013
  ) }),
4990
5014
  s.map((m, y) => /* @__PURE__ */ u("td", { children: /* @__PURE__ */ u(
@@ -4993,25 +5017,25 @@ function sd({
4993
5017
  inputMode: "decimal",
4994
5018
  "aria-label": i("chartValue", {
4995
5019
  series: s[y],
4996
- category: b
5020
+ category: w
4997
5021
  }),
4998
- "aria-invalid": c[y][w].trim() !== "" && !Number.isFinite(Number(c[y][w])),
4999
- value: c[y][w],
5000
- onChange: (I) => g(y, w, I.target.value),
5001
- "data-testid": `${r}-data-cell-${y}-${w}`
5022
+ "aria-invalid": c[y][b].trim() !== "" && !Number.isFinite(Number(c[y][b])),
5023
+ value: c[y][b],
5024
+ onChange: (M) => g(y, b, M.target.value),
5025
+ "data-testid": `${r}-data-cell-${y}-${b}`
5002
5026
  }
5003
5027
  ) }, y))
5004
- ] }, w)) })
5028
+ ] }, b)) })
5005
5029
  ] }) }),
5006
- /* @__PURE__ */ M("div", { style: { display: "flex", gap: 8, marginTop: 8 }, children: [
5030
+ /* @__PURE__ */ T("div", { style: { display: "flex", gap: 8, marginTop: 8 }, children: [
5007
5031
  /* @__PURE__ */ u(
5008
5032
  me,
5009
5033
  {
5010
5034
  onClick: () => {
5011
- a((b) => [
5012
- ...b,
5013
- i("chartCategoryText", { n: b.length + 1 })
5014
- ]), l((b) => b.map((w) => [...w, ""]));
5035
+ a((w) => [
5036
+ ...w,
5037
+ i("chartCategoryText", { n: w.length + 1 })
5038
+ ]), l((w) => w.map((b) => [...b, ""]));
5015
5039
  },
5016
5040
  "data-testid": `${r}-data-add-category`,
5017
5041
  children: i("chartAddCategory")
@@ -5022,10 +5046,10 @@ function sd({
5022
5046
  {
5023
5047
  disabled: p,
5024
5048
  onClick: () => {
5025
- d((b) => [
5026
- ...b,
5027
- i("chartSeriesText", { n: b.length + 1 })
5028
- ]), l((b) => [...b, o.map(() => "")]);
5049
+ d((w) => [
5050
+ ...w,
5051
+ i("chartSeriesText", { n: w.length + 1 })
5052
+ ]), l((w) => [...w, o.map(() => "")]);
5029
5053
  },
5030
5054
  "data-testid": `${r}-data-add-series`,
5031
5055
  children: i("chartAddSeries")
@@ -5036,7 +5060,7 @@ function sd({
5036
5060
  {
5037
5061
  disabled: o.length <= 1,
5038
5062
  onClick: () => {
5039
- a((b) => b.slice(0, -1)), l((b) => b.map((w) => w.slice(0, -1)));
5063
+ a((w) => w.slice(0, -1)), l((w) => w.map((b) => b.slice(0, -1)));
5040
5064
  },
5041
5065
  "data-testid": `${r}-data-remove-category`,
5042
5066
  children: i("chartRemoveCategory")
@@ -5047,7 +5071,7 @@ function sd({
5047
5071
  {
5048
5072
  disabled: s.length <= 1,
5049
5073
  onClick: () => {
5050
- d((b) => b.slice(0, -1)), l((b) => b.slice(0, -1));
5074
+ d((w) => w.slice(0, -1)), l((w) => w.slice(0, -1));
5051
5075
  },
5052
5076
  "data-testid": `${r}-data-remove-series`,
5053
5077
  children: i("chartRemoveSeries")
@@ -5060,19 +5084,19 @@ function sd({
5060
5084
  }
5061
5085
  const ld = 4e3;
5062
5086
  function cd({ tool: e, onExit: t }) {
5063
- const n = te(), r = Xe(), i = we(), { undo: o } = Nn(), { host: a, t: s, testId: d, phrase: c } = n, l = r?.tools.find((w) => w.id === r.active), p = e ?? (l ? { label: c(l.label), icon: zi(l.icon, l.id) } : null), h = i.state("action:agent"), f = p?.icon, [g, b] = B(!0);
5087
+ const n = te(), r = Xe(), i = be(), { undo: o } = Pn(), { host: a, t: s, testId: d, phrase: c } = n, l = r?.tools.find((b) => b.id === r.active), p = e ?? (l ? { label: c(l.label), icon: zi(l.icon, l.id) } : null), h = i.state("action:agent"), f = p?.icon, [g, w] = B(!0);
5064
5088
  return J(() => {
5065
- const w = setTimeout(() => b(!1), ld);
5066
- return () => clearTimeout(w);
5067
- }, []), /* @__PURE__ */ M("div", { className: "kui-focus-bar", role: "toolbar", "aria-label": s("focusBar"), "data-fresh": g || void 0, "data-testid": `${d}-focus-bar`, children: [
5068
- /* @__PURE__ */ M(me, { variant: "ghost", className: "kui-focus-exit", title: `${s("exitFocus")} (Esc)`, onClick: t, "data-testid": `${d}-focus-exit`, "data-kit-ui-id": "action:mode", children: [
5089
+ const b = setTimeout(() => w(!1), ld);
5090
+ return () => clearTimeout(b);
5091
+ }, []), /* @__PURE__ */ T("div", { className: "kui-focus-bar", role: "toolbar", "aria-label": s("focusBar"), "data-fresh": g || void 0, "data-testid": `${d}-focus-bar`, children: [
5092
+ /* @__PURE__ */ T(me, { variant: "ghost", className: "kui-focus-exit", title: `${s("exitFocus")} (Esc)`, onClick: t, "data-testid": `${d}-focus-exit`, "data-kit-ui-id": "action:mode", children: [
5069
5093
  /* @__PURE__ */ u(zs, { size: 16, strokeWidth: $e, "aria-hidden": "true" }),
5070
5094
  s("exitFocus"),
5071
5095
  /* @__PURE__ */ u("kbd", { children: "Esc" })
5072
5096
  ] }),
5073
5097
  o.hidden ? null : /* @__PURE__ */ u(De, { icon: kn, label: s("undo"), disabled: o.disabled, onClick: () => void n.run("edit.undo", {}), "data-testid": `${d}-focus-undo`, "data-kit-ui-id": "action:undo" }),
5074
5098
  a.init.capabilities.includes("agent") && !h.hidden ? /* @__PURE__ */ u(De, { icon: Lt, label: s("askAgent"), disabled: h.disabled, onClick: () => void a.openAgent(), "data-testid": `${d}-focus-ask`, "data-kit-ui-id": "action:agent" }) : null,
5075
- p && f ? /* @__PURE__ */ M("span", { className: "kui-focus-tool", "data-testid": `${d}-focus-tool`, children: [
5099
+ p && f ? /* @__PURE__ */ T("span", { className: "kui-focus-tool", "data-testid": `${d}-focus-tool`, children: [
5076
5100
  /* @__PURE__ */ u(f, { size: 16, strokeWidth: $e, "aria-hidden": "true" }),
5077
5101
  p.label
5078
5102
  ] }) : null
@@ -5114,7 +5138,7 @@ function hd(e, t, n = () => !1) {
5114
5138
  return r.map((i) => ({ label: i, children: io(e.filter((o) => o.path[0] === i), 1, t, n) })).filter((i) => i.children.length > 0 || n(i.label));
5115
5139
  }
5116
5140
  function fd({ row: e, checked: t, onKitCommand: n }) {
5117
- const { phrase: r, testId: i } = te(), o = we(), a = Ft(e.command);
5141
+ const { phrase: r, testId: i } = te(), o = be(), a = Ft(e.command);
5118
5142
  o.declared;
5119
5143
  const s = o.state(a, e.path);
5120
5144
  return /* @__PURE__ */ u(le, { label: r(e.label), shortcut: e.shortcut, disabled: s.disabled, checked: t, onSelect: () => !s.denied && n?.(e.command), testId: `${i}-${a.replace(":", "-")}`, uiId: a });
@@ -5124,20 +5148,20 @@ function oo({ nodes: e, checked: t, onKitCommand: n, onCommand: r }) {
5124
5148
  return /* @__PURE__ */ u(Ce, { children: e.map((o, a) => {
5125
5149
  if (o.kind === "separator") return /* @__PURE__ */ u(Ae, {}, `---${a}`);
5126
5150
  if (o.kind === "submenu")
5127
- return /* @__PURE__ */ u(bc, { label: o.label, path: o.path, children: /* @__PURE__ */ u(oo, { nodes: o.children, checked: t, onKitCommand: n, onCommand: r }) }, `menu:${o.path}`);
5151
+ return /* @__PURE__ */ u(wc, { label: o.label, path: o.path, children: /* @__PURE__ */ u(oo, { nodes: o.children, checked: t, onKitCommand: n, onCommand: r }) }, `menu:${o.path}`);
5128
5152
  const { row: s } = o, d = `${s.command}@${a}`;
5129
5153
  return s.command.startsWith(Ke) ? /* @__PURE__ */ u(fd, { row: s, checked: t?.(s.command), onKitCommand: n }, d) : /* @__PURE__ */ u(cc, { command: s.command, path: s.path, label: i(s.label), shortcut: s.shortcut ?? void 0, checked: t?.(s.command), onRun: r }, d);
5130
5154
  }) });
5131
5155
  }
5132
5156
  function md({ tree: e, nodes: t }) {
5133
- return /* @__PURE__ */ M(Ce, { children: [
5157
+ return /* @__PURE__ */ T(Ce, { children: [
5134
5158
  e.before?.map((n) => /* @__PURE__ */ u(le, { icon: n.icon, label: n.label, onSelect: n.onSelect, testId: n.testId }, n.label)),
5135
5159
  e.before?.length && t.length ? /* @__PURE__ */ u(Ae, {}) : null,
5136
5160
  /* @__PURE__ */ u(oo, { nodes: t, checked: e.checked, onKitCommand: e.onKitCommand, onCommand: e.onCommand })
5137
5161
  ] });
5138
5162
  }
5139
5163
  function pd(e) {
5140
- const { byId: t } = te(), { config: n, sessionHidden: r } = we(), i = R(/* @__PURE__ */ new WeakMap());
5164
+ const { byId: t } = te(), { config: n, sessionHidden: r } = be(), i = R(/* @__PURE__ */ new WeakMap());
5141
5165
  return pe(() => {
5142
5166
  const o = /* @__PURE__ */ new Map(), a = (s) => Li(n, `menu:${s}`).length > 0 && !Se(n, `menu:${s}`).hidden;
5143
5167
  for (const s of e) {
@@ -5159,11 +5183,11 @@ function pd(e) {
5159
5183
  }
5160
5184
  const Ze = (e) => e.flatMap((t) => t.kind === "row" ? [t.row] : t.kind === "submenu" ? Ze(t.children) : []), gd = 5;
5161
5185
  function Mr({ row: e, tree: t, primary: n }) {
5162
- const r = te(), i = we(), { byId: o, phrase: a, testId: s } = r, d = a(e.label);
5186
+ const r = te(), i = be(), { byId: o, phrase: a, testId: s } = r, d = a(e.label);
5163
5187
  if (e.command.startsWith(Ke)) {
5164
5188
  const h = Ft(e.command), f = i.state(h, e.path), g = Ge({ id: e.command.slice(Ke.length), title: e.label });
5165
5189
  return /* @__PURE__ */ u(
5166
- be,
5190
+ we,
5167
5191
  {
5168
5192
  icon: g,
5169
5193
  lineLabel: g === at,
@@ -5179,7 +5203,7 @@ function Mr({ row: e, tree: t, primary: n }) {
5179
5203
  }
5180
5204
  const c = o.get(e.command), l = i.state(`command:${e.command}`, e.path), p = Ge(c ?? { id: e.command, title: e.label });
5181
5205
  return /* @__PURE__ */ u(
5182
- be,
5206
+ we,
5183
5207
  {
5184
5208
  icon: p,
5185
5209
  lineLabel: p === at,
@@ -5188,34 +5212,34 @@ function Mr({ row: e, tree: t, primary: n }) {
5188
5212
  pressed: t.checked?.(e.command),
5189
5213
  disabled: !r.enabled(e.command) || l.disabled,
5190
5214
  onClick: () => {
5191
- t.onCommand && !(c && Pt(c)) ? t.onCommand(e.command) : r.run(e.command);
5215
+ t.onCommand && !(c && Nt(c)) ? t.onCommand(e.command) : r.run(e.command);
5192
5216
  },
5193
5217
  "data-testid": `${s}-cmd-${e.command}`,
5194
5218
  "data-kit-ui-id": `command:${e.command}`
5195
5219
  }
5196
5220
  );
5197
5221
  }
5198
- function bd({ tab: e, nodes: t }) {
5199
- const { byId: n, phrase: r } = te(), i = Nn(), o = /* @__PURE__ */ new Set([...i.undo.hidden ? [] : ["edit.undo"], ...i.redo.hidden ? [] : ["edit.redo"]]), a = (f) => f.filter((g) => !o.has(g.command)), s = (f) => {
5200
- const g = f.find((b) => b.command !== "---");
5222
+ function wd({ tab: e, nodes: t }) {
5223
+ const { byId: n, phrase: r } = te(), i = Pn(), o = /* @__PURE__ */ new Set([...i.undo.hidden ? [] : ["edit.undo"], ...i.redo.hidden ? [] : ["edit.redo"]]), a = (f) => f.filter((g) => !o.has(g.command)), s = (f) => {
5224
+ const g = f.find((w) => w.command !== "---");
5201
5225
  return g ? Ge(n.get(g.command) ?? { id: g.command.replace(Ke, ""), title: g.label }) : void 0;
5202
5226
  }, d = e.menu;
5203
5227
  if (!d) return null;
5204
5228
  const c = a(t.flatMap((f) => f.kind === "row" ? [f.row] : [])), l = t.flatMap((f) => f.kind === "submenu" && a(Ze(f.children)).length ? [f] : []), p = d.primary ? null : new Set([...c, ...l.flatMap((f) => a(Ze(f.children)))].filter((f) => f.command !== "---").slice(0, gd).map((f) => f.command)), h = (f) => p ? p.has(f.command) : d.primary?.includes(f.command);
5205
- return /* @__PURE__ */ M(Ce, { children: [
5206
- c.length || d.before?.length ? /* @__PURE__ */ u(Me, { id: `menu:${e.id}`, label: e.label, icon: s(c), children: /* @__PURE__ */ M("div", { className: "kui-command-grid", children: [
5229
+ return /* @__PURE__ */ T(Ce, { children: [
5230
+ c.length || d.before?.length ? /* @__PURE__ */ u(Me, { id: `menu:${e.id}`, label: e.label, icon: s(c), children: /* @__PURE__ */ T("div", { className: "kui-command-grid", children: [
5207
5231
  d.before?.map((f) => {
5208
5232
  const g = f.icon ?? Ge({ id: f.testId ?? f.label, title: f.label });
5209
- return /* @__PURE__ */ u(be, { icon: g, lineLabel: !f.icon && g === at, primary: f.primary, label: f.label, onClick: f.onSelect, "data-testid": f.testId }, f.label);
5233
+ return /* @__PURE__ */ u(we, { icon: g, lineLabel: !f.icon && g === at, primary: f.primary, label: f.label, onClick: f.onSelect, "data-testid": f.testId }, f.label);
5210
5234
  }),
5211
5235
  c.map((f, g) => /* @__PURE__ */ u(Mr, { row: f, tree: d, primary: h(f) }, `${f.command}@${g}`))
5212
5236
  ] }) }) : null,
5213
- l.map((f) => /* @__PURE__ */ u(Me, { id: `menu:${f.path}`, label: r(f.label), icon: s(a(Ze(f.children))), children: /* @__PURE__ */ u("div", { className: "kui-command-grid", children: a(Ze(f.children)).map((g, b) => /* @__PURE__ */ u(Mr, { row: g, tree: d, primary: h(g) }, `${g.command}@${b}`)) }) }, f.path))
5237
+ l.map((f) => /* @__PURE__ */ u(Me, { id: `menu:${f.path}`, label: r(f.label), icon: s(a(Ze(f.children))), children: /* @__PURE__ */ u("div", { className: "kui-command-grid", children: a(Ze(f.children)).map((g, w) => /* @__PURE__ */ u(Mr, { row: g, tree: d, primary: h(g) }, `${g.command}@${w}`)) }) }, f.path))
5214
5238
  ] });
5215
5239
  }
5216
- const Tr = { menus: Bs, line: Mi, classic: yi, focus: Ai }, Ar = () => Nt() ? "Cmd+\\" : "Ctrl+\\";
5217
- function wd({ display: e, shown: t, areas: n = !0 }) {
5218
- const { t: r, testId: i } = te(), a = we().state("action:mode");
5240
+ const Tr = { menus: Bs, line: Mi, classic: yi, focus: Ai }, Ar = () => Pt() ? "Cmd+\\" : "Ctrl+\\";
5241
+ function bd({ display: e, shown: t, areas: n = !0 }) {
5242
+ const { t: r, testId: i } = te(), a = be().state("action:mode");
5219
5243
  if (a.hidden || e.allowed.length < 2) return null;
5220
5244
  if (!n) {
5221
5245
  const l = `${r("mode_focus")} (${Ar()})`;
@@ -5273,7 +5297,7 @@ function Fu(e, { order: t, exclude: n = [], ...r }) {
5273
5297
  return vd(kd(e, t, n), r);
5274
5298
  }
5275
5299
  function Sd(e, t = !0) {
5276
- const { modes: n } = He(e.ui.subscribe, e.ui.get), r = e.kit.id, [i, o] = B(() => Hs(r)), [a, s] = B(() => n.default === "focus"), d = Ri(n), c = t ? d : d.filter((g) => g === "menus" || g === "focus"), l = t ? Us({ stored: i, rules: n, kit: e.display, readOnly: e.readOnly === !0 }) : "menus", p = H(
5300
+ const { modes: n } = He(e.ui.subscribe, e.ui.get), r = e.kit.id, [i, o] = B(() => Hs(r)), [a, s] = B(() => n.default === "focus"), d = Ri(n), c = t ? d : d.filter((g) => g === "menus" || g === "focus"), l = t ? Us({ stored: i, rules: n, kit: e.display, readOnly: e.readOnly === !0 }) : "menus", p = K(
5277
5301
  (g) => {
5278
5302
  if (g === "focus") {
5279
5303
  s(!0);
@@ -5282,7 +5306,7 @@ function Sd(e, t = !0) {
5282
5306
  qs(r, g), o(g), s(!1);
5283
5307
  },
5284
5308
  [r]
5285
- ), h = H(() => s((g) => !g), []), f = H(() => s(!1), []);
5309
+ ), h = K(() => s((g) => !g), []), f = K(() => s(!1), []);
5286
5310
  return { chosen: l, focus: a && c.includes("focus"), allowed: c, choose: p, toggleFocus: h, exitFocus: f };
5287
5311
  }
5288
5312
  function Cd(e, t, n, r) {
@@ -5296,18 +5320,18 @@ function Cd(e, t, n, r) {
5296
5320
  });
5297
5321
  return p.observe(l), () => p.disconnect();
5298
5322
  }, [e]);
5299
- const d = js(t, i, { classic: a.get(`classic:${n}`), line: a.get(`line:${n}`) }, r), c = H(
5323
+ const d = js(t, i, { classic: a.get(`classic:${n}`), line: a.get(`line:${n}`) }, r), c = K(
5300
5324
  (l, p) => {
5301
5325
  const h = e.current;
5302
5326
  if (!p || !h || typeof ResizeObserver > "u") return;
5303
- const f = h.getBoundingClientRect().width, g = p.scrollWidth - p.clientWidth, b = `${l}:${n}`;
5304
- s((w) => {
5305
- const m = w.get(b);
5327
+ const f = h.getBoundingClientRect().width, g = p.scrollWidth - p.clientWidth, w = `${l}:${n}`;
5328
+ s((b) => {
5329
+ const m = b.get(w);
5306
5330
  if (g > 1) {
5307
5331
  const y = Math.ceil(f + g);
5308
- return m !== void 0 && Math.abs(m - y) <= 1 ? w : new Map(w).set(b, y);
5332
+ return m !== void 0 && Math.abs(m - y) <= 1 ? b : new Map(b).set(w, y);
5309
5333
  }
5310
- return m === void 0 || m <= f ? w : new Map(w).set(b, Math.floor(f));
5334
+ return m === void 0 || m <= f ? b : new Map(b).set(w, Math.floor(f));
5311
5335
  });
5312
5336
  },
5313
5337
  [e, n]
@@ -5356,7 +5380,7 @@ function Td({ tabs: e, active: t, onTab: n }) {
5356
5380
  const p = (f) => `${f.id}
5357
5381
  ${f.label}`;
5358
5382
  for (const f of l.querySelectorAll(".kui-ribbon-tab")) {
5359
- const g = e.find((b) => b.id === f.dataset.tab);
5383
+ const g = e.find((w) => w.id === f.dataset.tab);
5360
5384
  g && !f.hidden && o.current.set(p(g), f.offsetWidth);
5361
5385
  }
5362
5386
  const h = e.every((f) => o.current.has(p(f))) ? Md(
@@ -5373,7 +5397,7 @@ ${f.label}`;
5373
5397
  return p.observe(l), () => p.disconnect();
5374
5398
  }, []);
5375
5399
  const c = a === null ? [] : e.filter((l) => !a.has(l.id));
5376
- return /* @__PURE__ */ M("div", { ref: i, className: "kui-frame-tabs", children: [
5400
+ return /* @__PURE__ */ T("div", { ref: i, className: "kui-frame-tabs", children: [
5377
5401
  /* @__PURE__ */ u("div", { className: "kui-ribbon-tabs", role: "tablist", children: e.map((l) => /* @__PURE__ */ u("button", { type: "button", role: "tab", className: "kui-ribbon-tab", "aria-selected": l.id === t, hidden: a !== null && !a.has(l.id), onClick: () => n(l.id), "data-tab": l.id, "data-testid": `ribbon-tab-${l.id}`, "data-kit-ui-id": Ye(l), children: l.label }, l.id)) }),
5378
5402
  c.length > 0 ? /* @__PURE__ */ u(
5379
5403
  lt,
@@ -5389,8 +5413,8 @@ function Ad(e, t) {
5389
5413
  return e === null || t === null ? e === t : e.size === t.size && [...e].every((n) => t.has(n));
5390
5414
  }
5391
5415
  function Ed({ tab: e }) {
5392
- const [t, n] = B(!1), r = R(null), i = we(), { t: o } = te(), a = i.state(Ye(e));
5393
- return /* @__PURE__ */ M("span", { ref: r, style: { display: "inline-flex" }, children: [
5416
+ const [t, n] = B(!1), r = R(null), i = be(), { t: o } = te(), a = i.state(Ye(e));
5417
+ return /* @__PURE__ */ T("span", { ref: r, style: { display: "inline-flex" }, children: [
5394
5418
  /* @__PURE__ */ u("button", { type: "button", className: "kui-menu-bar-item", "aria-expanded": t, "aria-haspopup": "dialog", onClick: () => n((s) => !s), "data-testid": `ribbon-tab-${e.id}`, "data-kit-ui-id": Ye(e), children: e.label }),
5395
5419
  /* @__PURE__ */ u(Eo, { open: t, anchor: r, onClose: () => n(!1), label: e.label, className: "kui-drop-ribbon", testId: `ribbon-drop-${e.id}`, children: /* @__PURE__ */ u(Et, { className: "kui-drop-ribbon-strip", panelClassName: "kui-ribbon-panel", resetKey: e.id, labels: { start: o("ribbonScrollStart"), end: o("ribbonScrollEnd") }, testId: `ribbon-drop-${e.id}-scroll`, children: /* @__PURE__ */ u("fieldset", { className: "kui-element", disabled: a.disabled, children: /* @__PURE__ */ u(vt.Provider, { value: "full", children: e.ribbon }) }) }) })
5396
5420
  ] });
@@ -5398,7 +5422,7 @@ function Ed({ tab: e }) {
5398
5422
  function Od({ tabs: e, menus: t }) {
5399
5423
  const { t: n, testId: r } = te();
5400
5424
  return /* @__PURE__ */ u("nav", { className: "kui-menu-nav", "aria-label": n("menuBar"), "data-testid": `${r}-menu-bar`, children: /* @__PURE__ */ u(Et, { className: "kui-menu-strip", panelClassName: "kui-menu-bar", labels: { start: n("menusScrollStart"), end: n("menusScrollEnd") }, testId: `${r}-menu-bar-scroll`, children: e.map(
5401
- (i) => i.menu ? /* @__PURE__ */ M(
5425
+ (i) => i.menu ? /* @__PURE__ */ T(
5402
5426
  lt,
5403
5427
  {
5404
5428
  trigger: ({ toggle: o, open: a }) => /* @__PURE__ */ u("button", { type: "button", className: "kui-menu-bar-item", "aria-expanded": a, onClick: o, "data-testid": `${r}-menu-${i.id}`, "data-kit-ui-id": `menu:${i.id}`, children: i.label }),
@@ -5428,76 +5452,76 @@ function Ld(e) {
5428
5452
  function Lr(e) {
5429
5453
  return Fn(e).reduce((t, n) => t + n.offsetWidth, 0);
5430
5454
  }
5431
- function Nd({ mode: e, tab: t, nodes: n, panel: r, measure: i }) {
5432
- const { t: o } = te(), a = we(), s = t.ribbon ?? (t.menu ? /* @__PURE__ */ u(bd, { tab: t, nodes: n }) : null), d = H((y) => o("lineMore", { group: y }), [o]), c = e === "line", l = `${e}:${t.id}`, [p, h] = B({ key: l, level: 0, groups: [], fresh: 0 }), f = p.key === l ? p.level : 0, g = p.key === l ? p.groups : [], b = pe(() => c ? mn : Rd(f, g), [g, f, c]), w = R({ width: 0, content: 0 }), m = R(null);
5455
+ function Pd({ mode: e, tab: t, nodes: n, panel: r, measure: i }) {
5456
+ const { t: o } = te(), a = be(), s = t.ribbon ?? (t.menu ? /* @__PURE__ */ u(wd, { tab: t, nodes: n }) : null), d = K((y) => o("lineMore", { group: y }), [o]), c = e === "line", l = `${e}:${t.id}`, [p, h] = B({ key: l, level: 0, groups: [], fresh: 0 }), f = p.key === l ? p.level : 0, g = p.key === l ? p.groups : [], w = pe(() => c ? mn : Rd(f, g), [g, f, c]), b = R({ width: 0, content: 0 }), m = R(null);
5433
5457
  return Te(() => {
5434
5458
  const y = r.current;
5435
5459
  if (!c && y) {
5436
- const I = Ld(y);
5437
- if (y.scrollWidth - y.clientWidth > 1 && f < Dd(I.length)) {
5438
- h((Y) => ({ key: l, level: f + 1, groups: I, fresh: Y.fresh }));
5460
+ const M = Ld(y);
5461
+ if (y.scrollWidth - y.clientWidth > 1 && f < Dd(M.length)) {
5462
+ h((G) => ({ key: l, level: f + 1, groups: M, fresh: G.fresh }));
5439
5463
  return;
5440
5464
  }
5441
- w.current = { width: y.clientWidth, content: Lr(y) };
5465
+ b.current = { width: y.clientWidth, content: Lr(y) };
5442
5466
  const E = m.current;
5443
5467
  if (E) {
5444
5468
  E.disconnect(), E.observe(y);
5445
- for (const Y of Fn(y)) E.observe(Y);
5469
+ for (const G of Fn(y)) E.observe(G);
5446
5470
  }
5447
5471
  }
5448
5472
  i(e, y);
5449
5473
  }), Te(() => {
5450
5474
  const y = r.current;
5451
5475
  if (c || !y || typeof ResizeObserver > "u") return;
5452
- const I = new ResizeObserver(() => {
5453
- const N = w.current;
5454
- (y.clientWidth > N.width + 1 || Math.abs(Lr(y) - N.content) > 1) && h((E) => ({ key: l, level: 0, groups: E.groups, fresh: E.fresh + 1 }));
5476
+ const M = new ResizeObserver(() => {
5477
+ const P = b.current;
5478
+ (y.clientWidth > P.width + 1 || Math.abs(Lr(y) - P.content) > 1) && h((E) => ({ key: l, level: 0, groups: E.groups, fresh: E.fresh + 1 }));
5455
5479
  });
5456
- return m.current = I, I.observe(y), () => {
5457
- I.disconnect(), m.current = null;
5480
+ return m.current = M, M.observe(y), () => {
5481
+ M.disconnect(), m.current = null;
5458
5482
  };
5459
- }, [l, c, r]), s ? /* @__PURE__ */ u(Et, { className: c ? "kui-line" : "kui-ribbon-body", panelClassName: c ? "kui-line-panel" : "kui-ribbon-panel", role: "tabpanel", resetKey: t.id, labels: { start: o("ribbonScrollStart"), end: o("ribbonScrollEnd") }, testId: "ribbon-scroll", panelRef: r, children: /* @__PURE__ */ u("fieldset", { className: "kui-element", disabled: a.state(Ye(t)).disabled, children: /* @__PURE__ */ u(Ao.Provider, { value: d, children: /* @__PURE__ */ u(vt.Provider, { value: c ? "line" : "full", children: /* @__PURE__ */ u(Yt.Provider, { value: b, children: s }) }) }) }) }) : null;
5483
+ }, [l, c, r]), s ? /* @__PURE__ */ u(Et, { className: c ? "kui-line" : "kui-ribbon-body", panelClassName: c ? "kui-line-panel" : "kui-ribbon-panel", role: "tabpanel", resetKey: t.id, labels: { start: o("ribbonScrollStart"), end: o("ribbonScrollEnd") }, testId: "ribbon-scroll", panelRef: r, children: /* @__PURE__ */ u("fieldset", { className: "kui-element", disabled: a.state(Ye(t)).disabled, children: /* @__PURE__ */ u(Ao.Provider, { value: d, children: /* @__PURE__ */ u(vt.Provider, { value: c ? "line" : "full", children: /* @__PURE__ */ u(Yt.Provider, { value: w, children: s }) }) }) }) }) : null;
5460
5484
  }
5461
5485
  function Bu({ tabs: e, tab: t, onTab: n, defaultTab: r, title: i, actions: o, options: a, rail: s, sidebar: d, panels: c, focusTool: l, statusBar: p = !0, children: h, ...f }) {
5462
- const g = te(), { host: b, phrase: w, testId: m } = g, y = we(), I = R(null), N = R(null), E = b.readOnly === !0, Y = xd(), q = y.config.add, V = pe(() => {
5463
- if (!e.some((G) => G.menu)) return e;
5464
- const P = q.map((G) => G.place).filter((G) => G.startsWith("menu:") && !G.includes("/")).map((G) => G.slice(5)).filter((G, ue, ye) => ye.indexOf(G) === ue && !e.some((Ie) => Ie.id === G));
5465
- return P.length ? [...e, ...P.map((G) => ({ id: G, label: w(G), menu: { rows: [] } }))] : e;
5466
- }, [q, w, e]), j = pd(V), D = V.filter((P) => y.state(Ye(P)).hidden || E && !P.view ? !1 : !P.menu || P.ribbon ? !0 : (j.get(P.id)?.length ?? 0) > 0 || (P.menu.before?.length ?? 0) > 0 || y.buttons(`menu:${P.id}`).length > 0), Z = Sd(b, D.length > 0), [Q, fe] = B(r ?? null), ce = t ?? Q, k = D.find((P) => P.id === ce) ?? D.find((P) => P.id === r) ?? D.find((P) => P.id.toLowerCase() !== "file") ?? D[0] ?? null, O = k?.id ?? null, U = H(
5467
- (P) => {
5468
- fe(P), n?.(P);
5486
+ const g = te(), { host: w, phrase: b, testId: m } = g, y = be(), M = R(null), P = R(null), E = w.readOnly === !0, G = xd(), q = y.config.add, Y = pe(() => {
5487
+ if (!e.some((j) => j.menu)) return e;
5488
+ const N = q.map((j) => j.place).filter((j) => j.startsWith("menu:") && !j.includes("/")).map((j) => j.slice(5)).filter((j, ue, ye) => ye.indexOf(j) === ue && !e.some((Ie) => Ie.id === j));
5489
+ return N.length ? [...e, ...N.map((j) => ({ id: j, label: b(j), menu: { rows: [] } }))] : e;
5490
+ }, [q, b, e]), U = pd(Y), D = Y.filter((N) => y.state(Ye(N)).hidden || E && !N.view ? !1 : !N.menu || N.ribbon ? !0 : (U.get(N.id)?.length ?? 0) > 0 || (N.menu.before?.length ?? 0) > 0 || y.buttons(`menu:${N.id}`).length > 0), Z = Sd(w, D.length > 0), [Q, fe] = B(r ?? null), ce = t ?? Q, k = D.find((N) => N.id === ce) ?? D.find((N) => N.id === r) ?? D.find((N) => N.id.toLowerCase() !== "file") ?? D[0] ?? null, O = k?.id ?? null, H = K(
5491
+ (N) => {
5492
+ fe(N), n?.(N);
5469
5493
  },
5470
5494
  [n]
5471
5495
  );
5472
5496
  Te(() => {
5473
5497
  t !== void 0 && O !== null && O !== t && n?.(O);
5474
5498
  }, [O, n, t]);
5475
- const x = Cd(I, Z.chosen, O ?? "", Z.allowed), C = Z.focus ? "focus" : x.effective, W = (P) => (Nt() ? P.metaKey : P.ctrlKey) && !P.shiftKey && !P.altKey && P.code === "Backslash" ? !Z.allowed.includes("focus") || y.state("action:mode").denied ? !1 : (Z.toggleFocus(), !0) : !1, _ = () => Z.focus ? (Z.exitFocus(), !0) : !1, T = C === "focus", K = R(T);
5499
+ const x = Cd(M, Z.chosen, O ?? "", Z.allowed), C = Z.focus ? "focus" : x.effective, W = (N) => (Pt() ? N.metaKey : N.ctrlKey) && !N.shiftKey && !N.altKey && N.code === "Backslash" ? !Z.allowed.includes("focus") || y.state("action:mode").denied ? !1 : (Z.toggleFocus(), !0) : !1, V = () => Z.focus ? (Z.exitFocus(), !0) : !1, I = C === "focus", _ = R(I);
5476
5500
  Te(() => {
5477
- if (K.current === T) return;
5478
- K.current = T;
5479
- const P = document.activeElement;
5480
- if (P && P !== document.body && P.isConnected) return;
5481
- ((T ? null : I.current?.querySelector(".kui-mode-button")) ?? I.current)?.focus({ preventScroll: !0 });
5482
- }, [T]);
5483
- const ne = T ? /* @__PURE__ */ u(cd, { tool: l, onExit: Z.exitFocus }) : /* @__PURE__ */ M(Ce, { children: [
5484
- /* @__PURE__ */ M("div", { className: "kui-frame-top", "data-testid": `${m}-top-bar`, children: [
5501
+ if (_.current === I) return;
5502
+ _.current = I;
5503
+ const N = document.activeElement;
5504
+ if (N && N !== document.body && N.isConnected) return;
5505
+ ((I ? null : M.current?.querySelector(".kui-mode-button")) ?? M.current)?.focus({ preventScroll: !0 });
5506
+ }, [I]);
5507
+ const ne = I ? /* @__PURE__ */ u(cd, { tool: l, onExit: Z.exitFocus }) : /* @__PURE__ */ T(Ce, { children: [
5508
+ /* @__PURE__ */ T("div", { className: "kui-frame-top", "data-testid": `${m}-top-bar`, children: [
5485
5509
  i ? /* @__PURE__ */ u("div", { className: "kui-frame-title", children: i }) : null,
5486
- C === "menus" ? /* @__PURE__ */ u(Od, { tabs: D, menus: j }) : /* @__PURE__ */ u(Td, { tabs: D, active: O, onTab: U }),
5487
- /* @__PURE__ */ u("div", { className: "kui-ribbon-end", children: /* @__PURE__ */ u(fc, { before: o, mode: /* @__PURE__ */ u(wd, { display: Z, shown: C, areas: D.length > 0 }) }) })
5510
+ C === "menus" ? /* @__PURE__ */ u(Od, { tabs: D, menus: U }) : /* @__PURE__ */ u(Td, { tabs: D, active: O, onTab: H }),
5511
+ /* @__PURE__ */ u("div", { className: "kui-ribbon-end", children: /* @__PURE__ */ u(fc, { before: o, mode: /* @__PURE__ */ u(bd, { display: Z, shown: C, areas: D.length > 0 }) }) })
5488
5512
  ] }),
5489
- (C === "line" || C === "classic") && k ? /* @__PURE__ */ u(Nd, { mode: C, tab: k, nodes: j.get(k.id) ?? [], panel: N, measure: x.measure }) : null,
5490
- a ? /* @__PURE__ */ u(wc, { children: a }) : null
5513
+ (C === "line" || C === "classic") && k ? /* @__PURE__ */ u(Pd, { mode: C, tab: k, nodes: U.get(k.id) ?? [], panel: P, measure: x.measure }) : null,
5514
+ a ? /* @__PURE__ */ u(bc, { children: a }) : null
5491
5515
  ] });
5492
- return /* @__PURE__ */ u(ao.Provider, { value: C, children: /* @__PURE__ */ u(so.Provider, { value: Z, children: /* @__PURE__ */ u(pc, { ...f, statusBar: p && !T, top: ne, frame: { ref: I, mode: C, chosen: Z.chosen, touch: Y, viewOnly: E, keyDown: W, escape: _ }, children: /* @__PURE__ */ M("div", { className: "kui-frame-body", children: [
5493
- s && !E && !T ? s : null,
5494
- d && !T ? d : null,
5516
+ return /* @__PURE__ */ u(ao.Provider, { value: C, children: /* @__PURE__ */ u(so.Provider, { value: Z, children: /* @__PURE__ */ u(pc, { ...f, statusBar: p && !I, top: ne, frame: { ref: M, mode: C, chosen: Z.chosen, touch: G, viewOnly: E, keyDown: W, escape: V }, children: /* @__PURE__ */ T("div", { className: "kui-frame-body", children: [
5517
+ s && !E && !I ? s : null,
5518
+ d && !I ? d : null,
5495
5519
  /* @__PURE__ */ u("div", { className: "kui-frame-main", children: h }),
5496
- c && !T ? c : null
5520
+ c && !I ? c : null
5497
5521
  ] }) }) }) });
5498
5522
  }
5499
- const Pd = new ArrayBuffer(0);
5500
- function Nr(e) {
5523
+ const Nd = new ArrayBuffer(0);
5524
+ function Pr(e) {
5501
5525
  return e.slice().buffer;
5502
5526
  }
5503
5527
  function Fd(e) {
@@ -5519,13 +5543,13 @@ class _u {
5519
5543
  push() {
5520
5544
  this.enqueue(async () => {
5521
5545
  const t = this.page.replica(), n = t.version();
5522
- this.pushed.includes(n) || (await this.engine.importChanges(Nr(t.exportChanges(this.pushed)), Pd), this.pushed = n);
5546
+ this.pushed.includes(n) || (await this.engine.importChanges(Pr(t.exportChanges(this.pushed)), Nd), this.pushed = n);
5523
5547
  });
5524
5548
  }
5525
5549
  /** Takes the worker's changes the page does not have yet. */
5526
5550
  pull() {
5527
5551
  this.enqueue(async () => {
5528
- const t = this.page.replica(), { changes: n } = await this.engine.exportChanges(Nr(t.version().encode()));
5552
+ const t = this.page.replica(), { changes: n } = await this.engine.exportChanges(Pr(t.version().encode()));
5529
5553
  if (this.closed || this.page.replica() !== t) return;
5530
5554
  const r = t.version(), i = this.pushed.includes(r), o = new Uint8Array(n);
5531
5555
  this.page.importChanges ? this.page.importChanges(o) : t.importChanges(o), i && (this.pushed = t.version()), t.version().equals(r) || this.pulled();
@@ -5587,7 +5611,7 @@ function Bd(e, t, n, r, i) {
5587
5611
  const d = e.measureText(r).width + o.padX * 2, c = o.height ?? Math.round(zd(a) * 1.2) + o.padY * 2, l = o.align === "center" ? t - d / 2 : t;
5588
5612
  e.fillStyle = s, e.beginPath(), e.roundRect(l, n, d, c, o.radius), e.fill(), e.fillStyle = o.color ?? (s === i.surface ? i.ink : i.surface), e.textBaseline = "middle", e.fillText(r, l + o.padX, n + c / 2);
5589
5613
  }
5590
- function Pr(e, t, n, r, i) {
5614
+ function Nr(e, t, n, r, i) {
5591
5615
  switch (r.kind) {
5592
5616
  case "marquee": {
5593
5617
  const o = i.marquee, a = t(r.x0, r.y0), s = t(r.x1, r.y1);
@@ -5663,11 +5687,11 @@ function _d(e, t = hn, n) {
5663
5687
  n && (l = n(s, { context: r, toScreen: i, view: o, style: t, overlays: e, index: d, frame: a, drawDefault: (h = s) => {
5664
5688
  r.save();
5665
5689
  try {
5666
- c(), Pr(r, i, o, h, t);
5690
+ c(), Nr(r, i, o, h, t);
5667
5691
  } finally {
5668
5692
  r.restore();
5669
5693
  }
5670
- } }) === !0), l || (r.restore(), r.save(), c(), Pr(r, i, o, s, t));
5694
+ } }) === !0), l || (r.restore(), r.save(), c(), Nr(r, i, o, s, t));
5671
5695
  } finally {
5672
5696
  r.restore();
5673
5697
  }
@@ -5682,27 +5706,27 @@ const Hd = /* @__PURE__ */ new Set(["Delete", "Backspace"]), Fr = /* @__PURE__ *
5682
5706
  function Ku(e, t, n, r) {
5683
5707
  const [i, o] = B([]), [a, s] = B(r.initial), [d, c] = B(() => Kd), [l, p] = B(null), [h, f] = B(null), g = R(r);
5684
5708
  g.current = r;
5685
- const b = R(d);
5686
- b.current = d;
5687
- const w = R(0), m = R(null), [y, I] = B(0), N = R(r.initial), E = R(null), Y = Object.keys(r.hostTools ?? {}).find((v) => r.hostTools?.[v] === Re) ?? Re.id;
5709
+ const w = R(d);
5710
+ w.current = d;
5711
+ const b = R(0), m = R(null), [y, M] = B(0), P = R(r.initial), E = R(null), G = Object.keys(r.hostTools ?? {}).find((v) => r.hostTools?.[v] === Re) ?? Re.id;
5688
5712
  let q = a;
5689
- d(a) && (q = i.find((v) => !r.hidden?.has(v.id) && !d(v.id))?.id ?? Y, i.length && q !== a && s(q));
5690
- const V = r.hostTools?.[q] ?? (q === Re.id && !i.some((v) => v.id === q) ? Re : void 0);
5691
- N.current = q;
5692
- const j = R(/* @__PURE__ */ new Set());
5693
- j.current = new Set(Object.keys(r.hostTools ?? {})), i.some((v) => v.id === Re.id) || j.current.add(Re.id);
5694
- const D = H((v) => {
5695
- if (b.current(v)) return;
5696
- const z = ++w.current;
5697
- m.current = z, N.current = v, I(z), s(v);
5698
- }, []), Z = H((v) => c(() => v), []), Q = R(1), fe = R(null), ce = R(!1), k = R([]), O = R(null), U = H((v, z) => {
5713
+ d(a) && (q = i.find((v) => !r.hidden?.has(v.id) && !d(v.id))?.id ?? G, i.length && q !== a && s(q));
5714
+ const Y = r.hostTools?.[q] ?? (q === Re.id && !i.some((v) => v.id === q) ? Re : void 0);
5715
+ P.current = q;
5716
+ const U = R(/* @__PURE__ */ new Set());
5717
+ U.current = new Set(Object.keys(r.hostTools ?? {})), i.some((v) => v.id === Re.id) || U.current.add(Re.id);
5718
+ const D = K((v) => {
5719
+ if (w.current(v)) return;
5720
+ const z = ++b.current;
5721
+ m.current = z, P.current = v, M(z), s(v);
5722
+ }, []), Z = K((v) => c(() => v), []), Q = R(1), fe = R(null), ce = R(!1), k = R([]), O = R(null), H = K((v, z) => {
5699
5723
  if (!v) return;
5700
5724
  O.current = v, p(v);
5701
5725
  let S = null;
5702
5726
  for (const $ of v.requests)
5703
- $.kind === "switchTool" ? (m.current === null || z === m.current) && !b.current($.id) && (S = $.id) : $.kind === "status" ? f($.text) : g.current.onDialog?.($.name, $.params);
5704
- S !== null && S !== N.current && (N.current = S, E.current = { id: S, serial: w.current }, j.current.has(S) || k.current.unshift({ name: "selectTool", args: [S, Q.current], settled: !0, coalesce: !1, selection: z }), s(S));
5705
- }, []), x = R(!1), C = R(null), W = H((v, z) => {
5727
+ $.kind === "switchTool" ? (m.current === null || z === m.current) && !w.current($.id) && (S = $.id) : $.kind === "status" ? f($.text) : g.current.onDialog?.($.name, $.params);
5728
+ S !== null && S !== P.current && (P.current = S, E.current = { id: S, serial: b.current }, U.current.has(S) || k.current.unshift({ name: "selectTool", args: [S, Q.current], settled: !0, coalesce: !1, selection: z }), s(S));
5729
+ }, []), x = R(!1), C = R(null), W = K((v, z) => {
5706
5730
  const S = document.activeElement ?? document.body;
5707
5731
  x.current = !0, C.current = 0;
5708
5732
  try {
@@ -5710,9 +5734,9 @@ function Ku(e, t, n, r) {
5710
5734
  } finally {
5711
5735
  x.current = !1, C.current = null;
5712
5736
  }
5713
- }, []), _ = H((v) => {
5737
+ }, []), V = K((v) => {
5714
5738
  C.current === null ? k.current.push(v) : k.current.splice(C.current++, 0, v);
5715
- }, []), T = H(async () => {
5739
+ }, []), I = K(async () => {
5716
5740
  if (!ce.current) {
5717
5741
  ce.current = !0;
5718
5742
  try {
@@ -5722,88 +5746,88 @@ function Ku(e, t, n, r) {
5722
5746
  continue;
5723
5747
  }
5724
5748
  if ("key" in v) {
5725
- v.key.length > 1 ? W(v.key, v.shift) : O.current?.wantsText ? U(await e("toolText", [v.key, Q.current], !0).catch(() => null)) : g.current.onDeferredKey ? g.current.onDeferredKey(v.key, v.shift) : W(v.key, v.shift);
5749
+ v.key.length > 1 ? W(v.key, v.shift) : O.current?.wantsText ? H(await e("toolText", [v.key, Q.current], !0).catch(() => null)) : g.current.onDeferredKey ? g.current.onDeferredKey(v.key, v.shift) : W(v.key, v.shift);
5726
5750
  continue;
5727
5751
  }
5728
- U(await e(v.name, v.args, v.settled).catch(() => null), v.selection), v.selection === m.current && (m.current = null);
5752
+ H(await e(v.name, v.args, v.settled).catch(() => null), v.selection), v.selection === m.current && (m.current = null);
5729
5753
  }
5730
5754
  } finally {
5731
5755
  ce.current = !1;
5732
5756
  }
5733
5757
  }
5734
- }, [U, W, e]), K = H((v, z, S, $ = !1, F) => {
5758
+ }, [H, W, e]), _ = K((v, z, S, $ = !1, F) => {
5735
5759
  const X = k.current[k.current.length - 1];
5736
- $ && C.current === null && X && "name" in X && X.coalesce && X.name === v ? k.current[k.current.length - 1] = { name: v, args: z, settled: S, coalesce: $, selection: F } : _({ name: v, args: z, settled: S, coalesce: $, selection: F }), T();
5737
- }, [_, T]), ne = H((v) => !ce.current && !k.current.length ? v() : new Promise((z, S) => {
5738
- _({ work: () => v().then(z, S) }), T();
5739
- }), [_, T]);
5740
- J(() => bl(e, ne), [ne, e]), J(() => {
5760
+ $ && C.current === null && X && "name" in X && X.coalesce && X.name === v ? k.current[k.current.length - 1] = { name: v, args: z, settled: S, coalesce: $, selection: F } : V({ name: v, args: z, settled: S, coalesce: $, selection: F }), I();
5761
+ }, [V, I]), ne = K((v) => !ce.current && !k.current.length ? v() : new Promise((z, S) => {
5762
+ V({ work: () => v().then(z, S) }), I();
5763
+ }), [V, I]);
5764
+ J(() => wl(e, ne), [ne, e]), J(() => {
5741
5765
  t && e("tools").then((v) => o(v ?? []));
5742
5766
  }, [t, e]);
5743
- const P = !!V;
5767
+ const N = !!Y;
5744
5768
  J(() => {
5745
5769
  if (!t) {
5746
5770
  E.current = null;
5747
5771
  return;
5748
5772
  }
5749
- if (P) return;
5773
+ if (N) return;
5750
5774
  const v = E.current;
5751
- E.current = null, !(v?.id === q && v.serial === y) && K("selectTool", [q, Q.current], !0, !1, y);
5752
- }, [q, P, t, y, K]), J(() => {
5753
- if (!t || P) return;
5775
+ E.current = null, !(v?.id === q && v.serial === y) && _("selectTool", [q, Q.current], !0, !1, y);
5776
+ }, [q, N, t, y, _]), J(() => {
5777
+ if (!t || N) return;
5754
5778
  const v = fe.current ?? { x: 0, y: 0 };
5755
- K("toolState", [v.x, v.y, "{}", Q.current], !1, !0);
5779
+ _("toolState", [v.x, v.y, "{}", Q.current], !1, !0);
5756
5780
  }, [n.revision, t]);
5757
- const G = H((v, z, S, $, F = !1) => {
5758
- Q.current = S, fe.current = { x: z.x, y: z.y }, K("pointer", [JSON.stringify({ action: v, x: z.x, y: z.y, mods: Gt(z), pressure: z.pressure, zoom: S })], $, F);
5759
- }, [K]), ue = pe(() => V ?? {
5781
+ const j = K((v, z, S, $, F = !1) => {
5782
+ Q.current = S, fe.current = { x: z.x, y: z.y }, _("pointer", [JSON.stringify({ action: v, x: z.x, y: z.y, mods: Gt(z), pressure: z.pressure, zoom: S })], $, F);
5783
+ }, [_]), ue = pe(() => Y ?? {
5760
5784
  id: q,
5761
5785
  cursor: l?.cursor || "default",
5762
- begin: (v, { viewport: z }) => (G("down", v, z.view.zoom, !1), {
5763
- move: (S, $) => G("drag", S, $.viewport.view.zoom, !1, !0),
5764
- end: (S, $) => G("up", S, $.viewport.view.zoom, !0),
5786
+ begin: (v, { viewport: z }) => (j("down", v, z.view.zoom, !1), {
5787
+ move: (S, $) => j("drag", S, $.viewport.view.zoom, !1, !0),
5788
+ end: (S, $) => j("up", S, $.viewport.view.zoom, !0),
5765
5789
  // An interrupted pointer must not commit the press as a click. Keep cancellation
5766
5790
  // in the same queue as its pending press/moves and the person's next gesture.
5767
- cancel: (S) => K("toolKey", ["Escape", "{}", S.viewport.view.zoom], !0)
5791
+ cancel: (S) => _("toolKey", ["Escape", "{}", S.viewport.view.zoom], !0)
5768
5792
  }),
5769
- hover: (v, { viewport: z }) => G("move", v, z.view.zoom, !1, !0),
5770
- doubleClick: (v, { viewport: z }) => G("doubleClick", v, z.view.zoom, !0)
5771
- }, [q, V, G, l?.cursor, K]), ye = l?.overlays, { overlayStyle: Ie, drawOverlay: Ne } = r, We = Ud(), A = pe(() => {
5793
+ hover: (v, { viewport: z }) => j("move", v, z.view.zoom, !1, !0),
5794
+ doubleClick: (v, { viewport: z }) => j("doubleClick", v, z.view.zoom, !0)
5795
+ }, [q, Y, j, l?.cursor, _]), ye = l?.overlays, { overlayStyle: Ie, drawOverlay: Pe } = r, We = Ud(), A = pe(() => {
5772
5796
  const v = Wd(Ie);
5773
5797
  return We && !Ie?.accent ? { ...v, accent: We } : v;
5774
5798
  }, [We, Ie]), L = pe(
5775
- () => ye?.length && !V ? Jl(_d(ye, A, Ne)) : null,
5776
- [Ne, V, ye, A]
5777
- ), re = H((v) => {
5778
- if (V || !v.shiftKey && !v.altKey && !v.metaKey && !v.ctrlKey && v.key === "Escape" && g.current.escapable && !g.current.escapable()) return !1;
5799
+ () => ye?.length && !Y ? Jl(_d(ye, A, Pe)) : null,
5800
+ [Pe, Y, ye, A]
5801
+ ), re = K((v) => {
5802
+ if (Y || !v.shiftKey && !v.altKey && !v.metaKey && !v.ctrlKey && v.key === "Escape" && g.current.escapable && !g.current.escapable()) return !1;
5779
5803
  const S = v.metaKey || v.ctrlKey, $ = v.key.length === 1 || Hd.has(v.key);
5780
5804
  if (!S && !v.altKey && $ && !x.current && (ce.current || k.current.length))
5781
- return k.current.push({ key: v.key, shift: v.shiftKey }), T(), !0;
5805
+ return k.current.push({ key: v.key, shift: v.shiftKey }), I(), !0;
5782
5806
  const F = O.current;
5783
5807
  if (!F) return !1;
5784
5808
  if (F.wantsText && !S) {
5785
- if (v.key.length === 1) K("toolText", [v.key, Q.current], !0);
5786
- else if (Fr.has(v.key)) K("toolKey", [v.key, JSON.stringify(Gt({ shift: v.shiftKey, alt: v.altKey, meta: !1 })), Q.current], !0);
5809
+ if (v.key.length === 1) _("toolText", [v.key, Q.current], !0);
5810
+ else if (Fr.has(v.key)) _("toolKey", [v.key, JSON.stringify(Gt({ shift: v.shiftKey, alt: v.altKey, meta: !1 })), Q.current], !0);
5787
5811
  else return !1;
5788
5812
  return !0;
5789
5813
  }
5790
- return F.busy && Fr.has(v.key) ? (K("toolKey", [v.key, JSON.stringify(Gt({ shift: v.shiftKey, alt: v.altKey, meta: S })), Q.current], !0), !0) : !1;
5791
- }, [V, T, K]), ie = H((v, z) => {
5814
+ return F.busy && Fr.has(v.key) ? (_("toolKey", [v.key, JSON.stringify(Gt({ shift: v.shiftKey, alt: v.altKey, meta: S })), Q.current], !0), !0) : !1;
5815
+ }, [Y, I, _]), ie = K((v, z) => {
5792
5816
  const S = (z ? `Shift+${v}` : v).toLowerCase(), F = i.filter((ee) => !g.current.hidden?.has(ee.id)).filter((ee) => ee.shortcut?.toLowerCase() === S);
5793
5817
  if (!F.length) return null;
5794
5818
  const X = F.findIndex((ee) => ee.id === q);
5795
5819
  return F[(X + 1) % F.length].id;
5796
- }, [q, i]), ae = H(() => {
5797
- if (P) return;
5820
+ }, [q, i]), ae = K(() => {
5821
+ if (N) return;
5798
5822
  const v = fe.current ?? { x: 0, y: 0 };
5799
- K("toolState", [v.x, v.y, "{}", Q.current], !1, !0);
5800
- }, [P, K]), se = H((v) => {
5801
- if (!Number.isFinite(v) || v <= 0 || Math.abs(v - Q.current) < 1e-9 || (Q.current = v, !t || P || !O.current)) return;
5823
+ _("toolState", [v.x, v.y, "{}", Q.current], !1, !0);
5824
+ }, [N, _]), se = K((v) => {
5825
+ if (!Number.isFinite(v) || v <= 0 || Math.abs(v - Q.current) < 1e-9 || (Q.current = v, !t || N || !O.current)) return;
5802
5826
  const z = fe.current ?? { x: 0, y: 0 };
5803
- K("toolState", [z.x, z.y, "{}", v], !1, !0);
5804
- }, [P, t, K]), ge = H((v) => {
5805
- v && K("toolText", [v, Q.current], !0);
5806
- }, [K]);
5827
+ _("toolState", [z.x, z.y, "{}", v], !1, !0);
5828
+ }, [N, t, _]), ge = K((v) => {
5829
+ v && _("toolText", [v, Q.current], !0);
5830
+ }, [_]);
5807
5831
  return {
5808
5832
  tools: i,
5809
5833
  active: q,
@@ -5815,7 +5839,7 @@ function Ku(e, t, n, r) {
5815
5839
  canvasTool: ue,
5816
5840
  decorate: L,
5817
5841
  status: h,
5818
- wantsText: !!l?.wantsText && !V,
5842
+ wantsText: !!l?.wantsText && !Y,
5819
5843
  keyDown: re,
5820
5844
  toolForKey: ie
5821
5845
  };
@@ -5887,7 +5911,7 @@ function Vd(e) {
5887
5911
  let n = zr;
5888
5912
  const r = /* @__PURE__ */ new Set();
5889
5913
  t && e.peer.on("presence/peers", (c) => {
5890
- const l = bo(c?.peers);
5914
+ const l = wo(c?.peers);
5891
5915
  n = l.length ? l : zr;
5892
5916
  for (const p of [...r]) p();
5893
5917
  });
@@ -5902,7 +5926,7 @@ function Vd(e) {
5902
5926
  subscribe: (c) => (r.add(c), () => r.delete(c)),
5903
5927
  set: (c) => {
5904
5928
  if (!t) return;
5905
- const l = wo(c);
5929
+ const l = bo(c);
5906
5930
  if (!l) return;
5907
5931
  const p = o + Yd - Date.now();
5908
5932
  if (p <= 0 && !s) {
@@ -6022,7 +6046,7 @@ function Kr({ placeholder: e, submit: t, cancel: n, labels: r, autoFocus: i, tes
6022
6046
  const p = a.trim();
6023
6047
  p && (t(p), s(""));
6024
6048
  };
6025
- return /* @__PURE__ */ M("form", { onSubmit: c, style: { display: "flex", flexDirection: "column", gap: 6 }, "data-testid": o, children: [
6049
+ return /* @__PURE__ */ T("form", { onSubmit: c, style: { display: "flex", flexDirection: "column", gap: 6 }, "data-testid": o, children: [
6026
6050
  /* @__PURE__ */ u(
6027
6051
  "textarea",
6028
6052
  {
@@ -6038,7 +6062,7 @@ function Kr({ placeholder: e, submit: t, cancel: n, labels: r, autoFocus: i, tes
6038
6062
  }
6039
6063
  }
6040
6064
  ),
6041
- /* @__PURE__ */ M("div", { style: ve.actions, children: [
6065
+ /* @__PURE__ */ T("div", { style: ve.actions, children: [
6042
6066
  n ? /* @__PURE__ */ u(me, { onClick: n, children: r.cancel }) : null,
6043
6067
  /* @__PURE__ */ u(me, { type: "submit", variant: "primary", disabled: !a.trim(), "data-testid": `${o}-send`, children: e === r.replyPlaceholder ? r.reply : r.comment })
6044
6068
  ] })
@@ -6050,12 +6074,12 @@ function Vu(e) {
6050
6074
  e.activeThread && a.current?.querySelector(`[data-thread="${CSS.escape(e.activeThread)}"]`)?.scrollIntoView({ block: "nearest" });
6051
6075
  }, [e.activeThread]);
6052
6076
  const s = e.formatTime ?? ((c) => c.replace("T", " ").replace(/(:\d\d)(\.\d+)?Z$/, "$1")), d = (c, l) => r !== null && c === r ? t.you : l || c;
6053
- return /* @__PURE__ */ M("div", { style: ve.panel, "data-testid": n, ref: a, children: [
6054
- /* @__PURE__ */ M("div", { style: ve.header, children: [
6077
+ return /* @__PURE__ */ T("div", { style: ve.panel, "data-testid": n, ref: a, children: [
6078
+ /* @__PURE__ */ T("div", { style: ve.header, children: [
6055
6079
  /* @__PURE__ */ u(Dt, { size: 16, strokeWidth: $e, "aria-hidden": "true" }),
6056
6080
  /* @__PURE__ */ u("span", { children: t.title })
6057
6081
  ] }),
6058
- e.pendingAnchor && i ? /* @__PURE__ */ M("div", { style: ve.card, children: [
6082
+ e.pendingAnchor && i ? /* @__PURE__ */ T("div", { style: ve.card, children: [
6059
6083
  e.anchorLabel?.(e.pendingAnchor) ? /* @__PURE__ */ u("div", { style: ve.muted, children: e.anchorLabel(e.pendingAnchor) }) : null,
6060
6084
  /* @__PURE__ */ u(
6061
6085
  Kr,
@@ -6072,7 +6096,7 @@ function Vu(e) {
6072
6096
  e.threads.length === 0 && !e.pendingAnchor ? /* @__PURE__ */ u("div", { style: ve.muted, children: t.empty }) : null,
6073
6097
  e.threads.map((c) => {
6074
6098
  const l = c.comments[0]?.author, p = r !== null && l === r, h = i && (!o || p), f = c.anchor && e.anchorLabel ? e.anchorLabel(c.anchor) : null;
6075
- return /* @__PURE__ */ M(
6099
+ return /* @__PURE__ */ T(
6076
6100
  "div",
6077
6101
  {
6078
6102
  "data-thread": c.id,
@@ -6082,18 +6106,18 @@ function Vu(e) {
6082
6106
  onClick: () => e.onActivate?.(c.id),
6083
6107
  children: [
6084
6108
  f ? /* @__PURE__ */ u("div", { style: ve.muted, children: f }) : null,
6085
- c.comments.map((g) => /* @__PURE__ */ M("div", { style: ve.comment, "data-testid": `${n}-comment`, "data-author": g.author, children: [
6086
- /* @__PURE__ */ M("div", { style: ve.byline, children: [
6109
+ c.comments.map((g) => /* @__PURE__ */ T("div", { style: ve.comment, "data-testid": `${n}-comment`, "data-author": g.author, children: [
6110
+ /* @__PURE__ */ T("div", { style: ve.byline, children: [
6087
6111
  /* @__PURE__ */ u("span", { style: ve.author, children: d(g.author, g.name) }),
6088
6112
  /* @__PURE__ */ u("span", { style: ve.muted, children: s(g.created) }),
6089
6113
  /* @__PURE__ */ u("span", { style: { flex: 1 } }),
6090
- h && g.author === r ? /* @__PURE__ */ u(De, { icon: rt, label: t.delete, "data-testid": `${n}-delete`, onClick: (b) => {
6091
- b.stopPropagation(), e.onDelete(c.id, g.id);
6114
+ h && g.author === r ? /* @__PURE__ */ u(De, { icon: rt, label: t.delete, "data-testid": `${n}-delete`, onClick: (w) => {
6115
+ w.stopPropagation(), e.onDelete(c.id, g.id);
6092
6116
  } }) : null
6093
6117
  ] }),
6094
6118
  /* @__PURE__ */ u("div", { style: ve.body, children: g.body })
6095
6119
  ] }, g.id)),
6096
- /* @__PURE__ */ M("div", { style: ve.actions, children: [
6120
+ /* @__PURE__ */ T("div", { style: ve.actions, children: [
6097
6121
  c.resolved ? /* @__PURE__ */ u("span", { style: { ...ve.muted, marginRight: "auto" }, children: t.resolved }) : null,
6098
6122
  !h && o && !p ? /* @__PURE__ */ u("span", { style: { ...ve.muted, marginRight: "auto" }, "data-testid": `${n}-history`, children: t.readOnlyHistory }) : null,
6099
6123
  h ? /* @__PURE__ */ u(
@@ -6166,7 +6190,7 @@ export {
6166
6190
  sh as BarSeparator,
6167
6191
  lh as Button,
6168
6192
  no as CHART_FORMATS,
6169
- Pn as CHART_KINDS,
6193
+ Nn as CHART_KINDS,
6170
6194
  Qc as CHART_MARKERS,
6171
6195
  at as COMMAND_FALLBACK_ICON,
6172
6196
  Qd as COMMENTS_PANEL_LABELS,
@@ -6175,18 +6199,18 @@ export {
6175
6199
  uh as CardHeader,
6176
6200
  id as ChartAxisDialog,
6177
6201
  sd as ChartDataDialog,
6178
- Pu as ChartDesignGroups,
6179
- Nu as ChartInsertMenu,
6202
+ Nu as ChartDesignGroups,
6203
+ Pu as ChartInsertMenu,
6180
6204
  od as ChartSeriesDialog,
6181
6205
  hh as Checkbox,
6182
6206
  fh as Choice,
6183
6207
  mh as ColorGrid,
6184
6208
  ph as ColorPicker,
6185
6209
  gh as ColorWheel,
6186
- bh as Command,
6210
+ wh as Command,
6187
6211
  lc as CommandButton,
6188
6212
  Ol as CommandDialog,
6189
- wh as CommandEmpty,
6213
+ bh as CommandEmpty,
6190
6214
  yh as CommandGroup,
6191
6215
  uc as CommandGroupButtons,
6192
6216
  vh as CommandInput,
@@ -6216,14 +6240,14 @@ export {
6216
6240
  Oh as EyeButton,
6217
6241
  Gs as FILE_CHUNK_BYTES,
6218
6242
  Rh as Field,
6219
- wl as FileChangedError,
6243
+ bl as FileChangedError,
6220
6244
  Dh as FloatingPanels,
6221
6245
  zu as FrameChrome,
6222
6246
  Lh as GradientSlider,
6223
6247
  Re as HAND_TOOL,
6224
- br as HOST_ICONS,
6225
- Nh as Hint,
6226
- Ph as Histogram,
6248
+ wr as HOST_ICONS,
6249
+ Ph as Hint,
6250
+ Nh as Histogram,
6227
6251
  zt as HostButtons,
6228
6252
  Fh as ICON_STROKE,
6229
6253
  Gc as INK_TOOLS,
@@ -6234,7 +6258,7 @@ export {
6234
6258
  zh as KeyframeLane,
6235
6259
  Xl as KitCanvas,
6236
6260
  Cu as KitDocumentCanvas,
6237
- wu as KitEditorProvider,
6261
+ bu as KitEditorProvider,
6238
6262
  pu as KitElement,
6239
6263
  ot as KitEngine,
6240
6264
  Ks as LINE_MIN_WIDTH,
@@ -6271,12 +6295,12 @@ export {
6271
6295
  mf as PopoverTrigger,
6272
6296
  pf as PreviewDialog,
6273
6297
  Oe as READ_ONLY_REASON,
6274
- Pe as READ_ONLY_RULES,
6298
+ Ne as READ_ONLY_RULES,
6275
6299
  Ll as RESERVED_SHORTCUTS,
6276
6300
  gf as RGB_IDENTITY,
6277
6301
  Mt as ReadOnlyError,
6278
- bf as RenameField,
6279
- wf as RibbonButton,
6302
+ wf as RenameField,
6303
+ bf as RibbonButton,
6280
6304
  yf as RibbonGroup,
6281
6305
  vf as RibbonItem,
6282
6306
  xe as RibbonMenu,
@@ -6291,14 +6315,14 @@ export {
6291
6315
  Af as Spinner,
6292
6316
  Ef as StatusBar,
6293
6317
  Of as StatusSpacer,
6294
- bc as SubMenu,
6318
+ wc as SubMenu,
6295
6319
  Rf as Switch,
6296
6320
  Df as TableSizePicker,
6297
6321
  lu as TesseraIcons,
6298
6322
  Lf as TextInput,
6299
6323
  Dl as TextSink,
6300
- Nf as Textarea,
6301
- Pf as Thumbnail,
6324
+ Pf as Textarea,
6325
+ Nf as Thumbnail,
6302
6326
  Ff as TimecodeField,
6303
6327
  Wf as Toaster,
6304
6328
  vu as ToolButton,
@@ -6317,7 +6341,7 @@ export {
6317
6341
  nr as applyTheme,
6318
6342
  Yf as automaticFloatingPosition,
6319
6343
  Iu as base64,
6320
- Pl as bindableShortcut,
6344
+ Nl as bindableShortcut,
6321
6345
  Vf as brandTokens,
6322
6346
  hd as catalogMenuTree,
6323
6347
  lo as catalogNames,
@@ -6340,14 +6364,14 @@ export {
6340
6364
  Qf as dockHeights,
6341
6365
  fu as dragRect,
6342
6366
  _d as drawEngineOverlays,
6343
- Pr as drawOverlayInStyle,
6367
+ Nr as drawOverlayInStyle,
6344
6368
  Yu as drawPresence,
6345
6369
  dl as editsDocument,
6346
6370
  th as fileErrorReason,
6347
6371
  em as formatTimecode,
6348
6372
  tm as hitCurvePoint,
6349
6373
  du as isFileChangedError,
6350
- Nt as isMac,
6374
+ Pt as isMac,
6351
6375
  nh as isOpenableUrl,
6352
6376
  Fi as isReadOnlyError,
6353
6377
  dn as kitLeases,
@@ -6364,7 +6388,7 @@ export {
6364
6388
  sm as meterLayout,
6365
6389
  Oi as modeStorageKey,
6366
6390
  lm as moveCurvePoint,
6367
- Pt as needsParams,
6391
+ Nt as needsParams,
6368
6392
  Hu as oneInFlight,
6369
6393
  rh as openErrorReason,
6370
6394
  cm as overflowOf,
@@ -6385,8 +6409,8 @@ export {
6385
6409
  pm as removeKitStore,
6386
6410
  Gd as reportConflicts,
6387
6411
  gm as resizeFloatingRect,
6388
- bm as rgbToHex,
6389
- wm as sampleCurve,
6412
+ wm as rgbToHex,
6413
+ bm as sampleCurve,
6390
6414
  Mc as scopesCollide,
6391
6415
  cr as shortcutMatches,
6392
6416
  ym as sliderFraction,
@@ -6411,7 +6435,7 @@ export {
6411
6435
  $d as useFrameMode,
6412
6436
  Tu as useHostPick,
6413
6437
  te as useKitEditor,
6414
- bu as useKitEditorState,
6438
+ wu as useKitEditorState,
6415
6439
  Ou as useKitSession,
6416
6440
  Am as useKitStore,
6417
6441
  Xe as useKitTools,
@@ -6422,7 +6446,7 @@ export {
6422
6446
  yu as useReadOnly,
6423
6447
  Gu as useRemoteCarets,
6424
6448
  ju as useRemoteSelections,
6425
- we as useUi,
6449
+ be as useUi,
6426
6450
  Om as useWorkspaces,
6427
6451
  jt as viewPanes,
6428
6452
  Rm as wheelRadius,
@@ -6430,5 +6454,5 @@ export {
6430
6454
  Zu as withPhrases,
6431
6455
  Lm as workspaceSlug,
6432
6456
  Fm as workspaceTree,
6433
- Nm as writeKitStore
6457
+ Pm as writeKitStore
6434
6458
  };