@almadar/shell-web 1.1.0 → 1.2.1

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.
Files changed (91) hide show
  1. package/LICENSE +72 -0
  2. package/dist/AvlGlyph-KZMJDBEB.js +5 -0
  3. package/dist/AvlStateMachine-KVZMFHFU.js +8 -0
  4. package/dist/AvlTransitionDetail-7DVGV27I.js +10 -0
  5. package/dist/AvlTransitionExplainer-RMJ5LQLK.js +11 -0
  6. package/dist/BehaviorView-EYRPME67.js +10 -0
  7. package/dist/FlowCanvas-J54627TC.js +23 -0
  8. package/dist/{FlowCanvas-VWUPMBKB.css → FlowCanvas-R4LL3KRI.css} +1 -1
  9. package/dist/{GameAudioProvider-D7wo5ryN.d.ts → GameAudioProvider-BgWOOYT3.d.ts} +15 -20
  10. package/dist/{KernelEngineContext-CPeWQMAz.d.ts → KernelEngineContext-BPx-q0iw.d.ts} +1 -1
  11. package/dist/{LayersPanel-M2LHWUFF.js → LayersPanel-PSXI4EHG.js} +4 -4
  12. package/dist/ModuleCard-TNRLL45H.js +6 -0
  13. package/dist/{OrbInspector-VMTMZHNQ.css → OrbInspector-2EGVZLOJ.css} +1 -1
  14. package/dist/OrbInspector-UBEQWWZ2.js +23 -0
  15. package/dist/{parseLessonSegments-GpCeMrb2.d.ts → SegmentRenderer-BAQ6Jwf6.d.ts} +4 -20
  16. package/dist/{Select-C2Uq6t86.d.ts → Select-BJ8Fgc8A.d.ts} +1 -1
  17. package/dist/{UISlotContext-Dl_ewwCI.d.ts → UISlotContext-7r0SQdTL.d.ts} +1 -1
  18. package/dist/UISlotRenderer-5OURMAP2.js +23 -0
  19. package/dist/{UISlotRenderer-BIS6KT7T.css → UISlotRenderer-SJBSQGBQ.css} +1 -1
  20. package/dist/auth/react/index.js +7 -6
  21. package/dist/avl/index.css +1 -1
  22. package/dist/avl/index.js +31 -31
  23. package/dist/{chunk-AE7VCQB6.js → chunk-2LNXLMK3.js} +2 -2
  24. package/dist/{chunk-REXYVBUO.js → chunk-3DA36FOA.js} +1 -1
  25. package/dist/{chunk-FAKU5F62.js → chunk-3UQNFRYV.js} +2 -5
  26. package/dist/{chunk-AGXD77SL.js → chunk-3YUMGEEW.js} +1 -1
  27. package/dist/{chunk-OWNG4JZI.js → chunk-6RXP5ZXE.js} +7 -7
  28. package/dist/{chunk-VUIACGDU.js → chunk-7UCL26QB.js} +4 -4
  29. package/dist/{chunk-57DC34LY.js → chunk-AL2XXMYR.js} +2 -2
  30. package/dist/{chunk-YHMRX6YA.js → chunk-ANTJUQRD.js} +53 -13
  31. package/dist/{chunk-P4ZFUQFF.js → chunk-AZ74UPG6.js} +4 -1
  32. package/dist/{chunk-YYIHRIDH.js → chunk-B23EZH2P.js} +3 -3
  33. package/dist/{chunk-AGVSO4WY.js → chunk-CCO2ZH7F.js} +3 -3
  34. package/dist/{chunk-4YXBKHHM.js → chunk-D5FJU4XC.js} +87 -16
  35. package/dist/{chunk-7N6ZPHQ5.js → chunk-DPDKBY6Z.js} +1 -1
  36. package/dist/{chunk-A2LR6VQQ.js → chunk-ECC3WQIB.js} +9 -93
  37. package/dist/{chunk-VO2TTLS5.js → chunk-GHAF7QUD.js} +1 -1
  38. package/dist/{chunk-M74BCDBQ.js → chunk-HA2BYO5E.js} +1 -1
  39. package/dist/{chunk-ILQXJ2AR.js → chunk-JEN4EIUF.js} +1 -1
  40. package/dist/{chunk-UTDC2NEA.js → chunk-KTYOYEVA.js} +1 -1
  41. package/dist/{chunk-VHC2M26B.js → chunk-LINJRTNB.js} +2 -2
  42. package/dist/{chunk-2WGR4TDJ.js → chunk-LKL5RULQ.js} +5 -108
  43. package/dist/{chunk-UU57VNS2.js → chunk-PWXZN5G5.js} +2 -2
  44. package/dist/{chunk-4YJ53G7S.js → chunk-RDPELAFQ.js} +4 -4
  45. package/dist/{chunk-PRXQGGCO.js → chunk-S3LS3B7N.js} +1 -1
  46. package/dist/{chunk-MS4K3K2R.js → chunk-TAEOMNDK.js} +996 -456
  47. package/dist/{chunk-3S54FWRC.js → chunk-UFQLHCFJ.js} +1 -1
  48. package/dist/{chunk-PRLHKBXG.js → chunk-V5SVGUYN.js} +2 -2
  49. package/dist/components/index.css +1 -1
  50. package/dist/components/index.d.ts +155 -21
  51. package/dist/components/index.js +25 -25
  52. package/dist/context/index.d.ts +2 -2
  53. package/dist/context/index.js +5 -5
  54. package/dist/core.d.ts +21 -4
  55. package/dist/core.js +1 -1
  56. package/dist/{fx-Br8zjvu9.d.ts → fx-Bx5RqplG.d.ts} +4 -1
  57. package/dist/hooks/index.d.ts +8 -8
  58. package/dist/hooks/index.js +6 -6
  59. package/dist/{katexPlugin-FA7NX4PE.css → katexPlugin-BUHVNRBJ.css} +1 -1
  60. package/dist/{kernel-client-JW6OH5FX.js → kernel-client-NMZ56JVU.js} +36 -3
  61. package/dist/{kernel-wire-DGAySGhX.d.ts → kernel-wire-CRsHtLsf.d.ts} +1 -1
  62. package/dist/lib/index.d.ts +3 -3
  63. package/dist/lib/index.js +434 -2
  64. package/dist/providers/index.css +1 -1
  65. package/dist/providers/index.d.ts +5 -5
  66. package/dist/providers/index.js +19 -19
  67. package/dist/renderer/index.d.ts +3 -79
  68. package/dist/renderer/index.js +2 -2
  69. package/dist/runtime/index.css +1 -1
  70. package/dist/runtime/index.d.ts +3 -1
  71. package/dist/runtime/index.js +18 -18
  72. package/dist/ssr/index.cjs +105 -28
  73. package/dist/ssr/index.js +106 -29
  74. package/dist/test-support.js +1 -1
  75. package/dist/{useUISlots-CiobNFGb.d.ts → useUISlots-BLcGd__D.d.ts} +2 -0
  76. package/dist/{verificationRegistry-oopV1J1n.d.ts → verificationRegistry-BLuQU1JV.d.ts} +1 -1
  77. package/package.json +9 -9
  78. package/src/core/locales/ar.json +10 -1
  79. package/src/core/locales/en.json +10 -1
  80. package/src/core/locales/sl.json +10 -1
  81. package/tailwind-preset.cjs +8 -4
  82. package/dist/AvlGlyph-PIXU6QH5.js +0 -5
  83. package/dist/AvlStateMachine-CKGMECMG.js +0 -8
  84. package/dist/AvlTransitionDetail-QZX6G5KJ.js +0 -10
  85. package/dist/AvlTransitionExplainer-26WLEIC6.js +0 -11
  86. package/dist/BehaviorView-JLZ4PKWY.js +0 -10
  87. package/dist/FlowCanvas-RPII4V24.js +0 -23
  88. package/dist/ModuleCard-NJD6JQGD.js +0 -6
  89. package/dist/OrbInspector-OWWKPOBF.js +0 -23
  90. package/dist/UISlotRenderer-PY7FIJXN.js +0 -23
  91. /package/dist/{katexPlugin-NCDKOOQY.js → katexPlugin-WGJ4JFZU.js} +0 -0
@@ -1,23 +1,23 @@
1
- import { FileTree } from './chunk-57DC34LY.js';
2
- import { AvlStateMachine, metricsFor, BODY_CHAR, MARGIN, PILL_H, MAX_SCALE, MIN_SCALE } from './chunk-4YJ53G7S.js';
3
- import { AvlGlyph, AvlEvent, AvlGuard } from './chunk-AGVSO4WY.js';
4
- import { AvlState, AvlFieldType } from './chunk-7N6ZPHQ5.js';
5
- import { stateMachinePlayback, Accordion, tracePlayback, describedTransitionLines } from './chunk-REXYVBUO.js';
6
- import { EmptyState } from './chunk-AGXD77SL.js';
7
- import { useContainerWidth, computeOrbitalLayout, edgePath, roundedEdgePath, loopKey, LOOP_LINE } from './chunk-M74BCDBQ.js';
1
+ import { FileTree } from './chunk-AL2XXMYR.js';
2
+ import { AvlStateMachine, metricsFor, BODY_CHAR, MARGIN, PILL_H, MAX_SCALE, MIN_SCALE } from './chunk-RDPELAFQ.js';
3
+ import { AvlGlyph, AvlEvent, AvlGuard } from './chunk-CCO2ZH7F.js';
4
+ import { AvlState, AvlFieldType } from './chunk-DPDKBY6Z.js';
5
+ import { stateMachinePlayback, Accordion, tracePlayback, describedTransitionLines } from './chunk-3DA36FOA.js';
6
+ import { EmptyState } from './chunk-3YUMGEEW.js';
7
+ import { useContainerWidth, loopKey, computeOrbitalLayout, edgePath, roundedEdgePath, LOOP_LINE } from './chunk-HA2BYO5E.js';
8
8
  import { parseTraitLevel, traitLevelFromDescription, programTraits, traitLevelFromTrait, traitEventWires } from './chunk-PCR37T3U.js';
9
- import { Tooltip, Popover, getOrCreatePortalRoot, ThemedPortal } from './chunk-PRLHKBXG.js';
10
- import { CONNECTION_COLORS, avlTint, STATE_COLORS, avlSeries, parseComputedColor, resolveThemeColor, THEME_SERIES, AVL_INK, AVL_FONT, AVL_STROKE, getStateRole, effectCategoryOf, EFFECT_CATEGORY_COLORS, AvlEffect } from './chunk-FAKU5F62.js';
11
- import { computeLineDiff, isEditorMotion, applyMotion, isEditorOperator, motionRange, applyOperator, isEditableTarget, verifierAttached, registerCheck, bindEventBus, bindTraitStateGetter, recordTransition, registerTrait, registerTraitSnapshot, unregisterTrait, recordingTransport, recordServerResponse, serverEffectTraces, asEnterAnimation, slotPlaysDefaultEnter, useSlotEnterRestart, ENTER_SLOT_CLASS, enterClassName, getNestedValue, parseLessonSegments, isDebugEnabled2, onDebugToggle, debugGroup, debug, debugGroupEnd, resolveImageUrl, isDebugEnabled, parseContentSegments, bindCanvasCapture, bindLastDrawables, parseMarkdownWithCodeBlocks, subscribeToTraitChanges, subscribeToTickChanges, subscribeToGuardChanges, subscribeToDebugEvents, subscribeToVerification, getEntitySnapshot, profilerOnRender, updateAssetStatus, getSummary, getBridgeHealth, getTransitions, getAllChecks, getDebugEvents, getGuardHistory, getAllTicks, getAllTraits, keyMapCode, resolveKeyMapEvent } from './chunk-2WGR4TDJ.js';
9
+ import { Tooltip, Popover, getOrCreatePortalRoot, ThemedPortal } from './chunk-V5SVGUYN.js';
10
+ import { CONNECTION_COLORS, avlTint, STATE_COLORS, avlSeries, parseComputedColor, resolveThemeColor, THEME_SERIES, AVL_INK, AVL_FONT, AVL_STROKE, getStateRole, effectCategoryOf, EFFECT_CATEGORY_COLORS, AvlEffect } from './chunk-3UQNFRYV.js';
11
+ import { computeLineDiff, isEditorMotion, applyMotion, isEditorOperator, motionRange, applyOperator, isEditableTarget, verifierAttached, registerCheck, bindEventBus, bindTraitStateGetter, recordTransition, registerTrait, registerTraitSnapshot, unregisterTrait, recordingTransport, recordServerResponse, serverEffectTraces, asEnterAnimation, slotPlaysDefaultEnter, useSlotEnterRestart, ENTER_SLOT_CLASS, enterClassName, getNestedValue, isDebugEnabled2, onDebugToggle, debugGroup, debug, debugGroupEnd, resolveImageUrl, isDebugEnabled, parseContentSegments, bindCanvasCapture, bindLastDrawables, subscribeToTraitChanges, subscribeToTickChanges, subscribeToGuardChanges, subscribeToDebugEvents, subscribeToVerification, getEntitySnapshot, profilerOnRender, updateAssetStatus, getSummary, getBridgeHealth, getTransitions, getAllChecks, getDebugEvents, getGuardHistory, getAllTicks, getAllTraits, keyMapCode, resolveKeyMapEvent } from './chunk-LKL5RULQ.js';
12
12
  import { registerHostSignOut, registerHostSignIn, registerHostConsent, local_store_transport_exports, collectEmbeddedTraits, openBrowserStore, browserStoreName, persistedMemory, openLocalKernel, nativeMemoryPersistence, createResidenceTransport, answerHostAsk, wrapCallbackForEvent, perfStart, perfEnd, registerHostAudio } from './chunk-ZDRDJKYB.js';
13
- import { useEditorFocus, keyChord, usePageHead, EditorFocusProvider, claimDispatch, useDragReorder, useQuerySingleton, usePullToRefresh, useCanvasGestures, useAuthContext, useSwipeGesture, useLongPress } from './chunk-PRXQGGCO.js';
14
- import { useArbitraryClassStyles, CurrentPagePathProvider, UISlotProvider, OrbitalThemeProvider, spacingTokenOf, positionOf, withPosition, snapToSpacingStep, defaultSpacingStepPx, spacingOf, withSizing, withSpacing, layoutOf, withLayout, useUISlots, sizingOf, useCurrentPagePath, useUser, DESIGN_COLOR_TOKENS, DESIGN_RADIUS_TOKENS, DESIGN_SPACING_SCALE, sizeLimitOf, withSizeLimit, isArbitraryClass, tokenOfDesignClass } from './chunk-AE7VCQB6.js';
15
- import { ALL_SLOTS } from './chunk-YHMRX6YA.js';
16
- import { useTranslate, Box, useEventBus, useScopedMode, useMediaQuery, HStack, Typography, cn, Card, Icon, Badge, Button, domPassthrough, Textarea, TextHighlight, Radio, Label, useEventListener, VStack, Spinner, useTheme, useThemeScope, useContentSurface, Select, getAllPages, matchPathAmong, NavStackProvider, usePrefersReducedMotion, useNavStack, ThemeProvider, INLINE_TEXT_ATTR, Input, EventBusProvider, registryKeyMode, ThemeScopeContext, usePendingScopeValue, PendingScopeContext, isMotionEnabled, useRenderI18n, useScopeHasPending, TraitScopeProvider, beginPending, endPending, useDialogBehavior, usePresence, Overlay, SurfaceBoundary, Dialog, useTraitScope, VideoEmbed, TypewriterText, TrendIndicator, TimeSlotCell, ThemeToggle, Switch, SvgStack, SvgShield, SvgRing, SvgPulse, SvgNode, SvgMorph, SvgMesh, SvgLobe, SvgGrid, SvgFlow, SvgConnection, SvgBranch, StatusDot, Stack, Sparkline, SectionHeader, RangeSlider, ProgressBar, Presence, PatternTile, LawReferenceTooltip, InfiniteScrollSentinel, Image as Image$1, GameIcon, FlipContainer, FilterPill, DayCell, ConfettiEffect, ConditionalWrapper, Checkbox, Center, Avatar, AtlasPanel, AtlasImage, Aside, AnimatedReveal, AnimatedGraphic, evaluateBindings, pressableProps, useFormatContext, formatValue, Divider, resolveIcon, Spacer, CONFETTI_BURST_KEYFRAMES, usePendingAction, guardsHold, toDateTimeInputValue, toDateInputValue, sortRows, STRETCHED_CONTROL, rowOpenControlProps, formatDate, STRETCHED_ABOVE, isAtlasAsset, getAtlas, resolveAssetSource, blit, followHref, usePendingRows, useTraitScopeChain, motionTiming, layoutScale, getTraitPresence, useTapReveal, getTileDimensions, fxHash01, createConfettiParticles, evaluateBinding, atlasUrlOf, atlasFailed, isSpriteSheetAtlas, subRectFor, boxesOf } from './chunk-4YXBKHHM.js';
17
- import { isNotificationSlot, isPortalSlot } from './chunk-P4ZFUQFF.js';
18
- import * as React51 from 'react';
19
- import React51__default, { createContext, useMemo, useState, useCallback, useRef, useEffect, useLayoutEffect, lazy, useId, useContext, useSyncExternalStore, Suspense, useReducer, Profiler } from 'react';
20
- import { DIAGRAM_TONES, FieldTagSchema, EFFECT_OPERATORS, LOADING_STATE_MARKER, notFoundPage, isHostSignInRoute, localeAlternates, hasKernelEvaluator, DIAGRAM_TONE_COLOR_KEYS, DIAGRAM_TEXT_SIZES, orbitalInlineEntities, storesRowsInBrowser, isInlineTrait, isPageReference, navigatePatternPath, isAriaRole, toPayloadValue, installKernelEvaluator, mintUlid, TRAIT_MOUNT_ERROR_TESTID, inlineTraitRefs, AwaitRenderSchema, isRowSetMarker, isRenderBindingMarker, actionTestId, PATTERN_PROP_TYPE_ERROR_TESTID, kernelEvaluator, toWireValue, KernelEvalError, isSExpr, containsEntityBinding, RENDER_BINDING_MARKER, isEventPayloadValue, FORM_PATTERN, ACTION_OVERFLOW_TESTID, quoteExpr, isJsonObject, ANONYMOUS_USER, answerToMutations, isFileValue, isTypeVariable } from '@almadar/core';
13
+ import { useEditorFocus, keyChord, usePageHead, EditorFocusProvider, claimDispatch, useDragReorder, useQuerySingleton, usePullToRefresh, useCanvasGestures, useAuthContext, useSwipeGesture, useLongPress } from './chunk-S3LS3B7N.js';
14
+ import { useArbitraryClassStyles, CurrentPagePathProvider, UISlotProvider, OrbitalThemeProvider, spacingTokenOf, positionOf, withPosition, snapToSpacingStep, defaultSpacingStepPx, spacingOf, withSizing, withSpacing, layoutOf, withLayout, useUISlots, sizingOf, useCurrentPagePath, useUser, DESIGN_COLOR_TOKENS, DESIGN_RADIUS_TOKENS, DESIGN_SPACING_SCALE, sizeLimitOf, withSizeLimit, isArbitraryClass, tokenOfDesignClass } from './chunk-2LNXLMK3.js';
15
+ import { ALL_SLOTS } from './chunk-ANTJUQRD.js';
16
+ import { useTranslate, Box, useEventBus, useScopedMode, useMediaQuery, HStack, Typography, cn, Card, Icon, Badge, Button, domPassthrough, Textarea, TextHighlight, Radio, Label, useEventListener, VStack, Spinner, useTheme, useThemeScope, useContentSurface, Select, getAllPages, matchPathAmong, NavStackProvider, usePrefersReducedMotion, useNavStack, ThemeProvider, INLINE_TEXT_ATTR, Input, EventBusProvider, registryKeyMode, ThemeScopeContext, usePendingScopeValue, PendingScopeContext, isMotionEnabled, useRenderI18n, useScopeHasPending, beginPending, endPending, TraitScopeProvider, useDialogBehavior, usePresence, Overlay, SurfaceBoundary, Dialog, useTraitScope, evaluateBindings, VideoEmbed, TypewriterText, TrendIndicator, TimeSlotCell, ThemeToggle, Switch, SvgStack, SvgShield, SvgRing, SvgPulse, SvgNode, SvgMorph, SvgMesh, SvgLobe, SvgGrid, SvgFlow, SvgConnection, SvgBranch, StatusDot, Stack, Sparkline, SectionHeader, RangeSlider, ProgressBar, Presence, PatternTile, LawReferenceTooltip, InfiniteScrollSentinel, Image as Image$1, GameIcon, FlipContainer, FilterPill, DayCell, ConfettiEffect, ConditionalWrapper, Checkbox, Center, Avatar, AtlasPanel, AtlasImage, Aside, AnimatedReveal, AnimatedGraphic, pressableProps, useFormatContext, formatValue, Divider, resolveIcon, Spacer, resolveColorToken, CONFETTI_BURST_KEYFRAMES, usePendingAction, guardsHold, toDateTimeInputValue, toDateInputValue, sortRows, STRETCHED_CONTROL, rowOpenControlProps, formatDate, STRETCHED_ABOVE, isAtlasAsset, getAtlas, resolveAssetSource, blit, followHref, usePendingRows, useTraitScopeChain, motionTiming, layoutScale, getTraitPresence, useTapReveal, getTileDimensions, fxHash01, createConfettiParticles, evaluateBinding, atlasUrlOf, atlasFailed, isSpriteSheetAtlas, subRectFor, boxesOf } from './chunk-D5FJU4XC.js';
17
+ import { paintsInTraitFrame, isPortalSlot, isNotificationSlot } from './chunk-AZ74UPG6.js';
18
+ import * as React52 from 'react';
19
+ import React52__default, { createContext, useMemo, useState, useCallback, useRef, useEffect, useLayoutEffect, lazy, useId, useContext, useSyncExternalStore, Suspense, useReducer, Profiler } from 'react';
20
+ import { DIAGRAM_TONES, TRACE_ACTIVITY_TYPES, FieldTagSchema, EFFECT_OPERATORS, LOADING_STATE_MARKER, notFoundPage, isHostSignInRoute, localeAlternates, hasKernelEvaluator, DIAGRAM_TONE_COLOR_KEYS, DIAGRAM_TEXT_SIZES, orbitalInlineEntities, storesRowsInBrowser, isInlineTrait, isPageReference, navigatePatternPath, isAriaRole, toPayloadValue, installKernelEvaluator, mintUlid, TRAIT_MOUNT_ERROR_TESTID, inlineTraitRefs, AwaitRenderSchema, isRenderBindingMarker, isRowSetMarker, actionTestId, PATTERN_PROP_TYPE_ERROR_TESTID, isSExpr, kernelEvaluator, toWireValue, KernelEvalError, containsEntityBinding, RENDER_BINDING_MARKER, isEventPayloadValue, quoteExpr, FORM_PATTERN, ACTION_OVERFLOW_TESTID, isJsonObject, ANONYMOUS_USER, answerToMutations, isFileValue, isTypeVariable } from '@almadar/core';
21
21
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
22
22
  import { Code, FileText, WrapText, Check, Copy, ChevronLeft, ChevronRight, AlertCircle, Circle, Clock, CheckCircle2, TrendingUp, TrendingDown, Minus, Eraser, X, Search, Bold, Italic, Underline, Strikethrough, Heading1, Heading2, Heading3, List, ListOrdered, Quote, Link, Image as Image$2, PauseCircle, HelpCircle, Upload, ZoomIn, Menu as Menu$1, ZoomOut, RotateCcw, DollarSign, Download, Printer, ArrowLeft, Link2, AlertTriangle, Trash2, Play, Terminal, CheckCircle, XCircle, ChevronUp, ChevronDown, GitBranch, Pencil, Eye, Plus, Lightbulb, ArrowRight, Trash } from 'lucide-react';
23
23
  import { translateLolo, translateOrb, ORB_COLORS, installNativeLanguages } from '@almadar/syntax';
@@ -37,8 +37,8 @@ import { forceSimulation, forceLink, forceManyBody, forceCollide, forceX, forceY
37
37
  import { isKnownStdOperator } from '@almadar/std/registry';
38
38
  import { createPortal } from 'react-dom';
39
39
  import { TraitMountError } from '@almadar/shell-runtime/client/trait-mount-error';
40
+ import { createHttpTransport, TransportStatusError } from '@almadar/shell-runtime/client/EventTransport';
40
41
  import { createMemoryCircuitStore } from '@almadar/shell-runtime/client/circuit-store';
41
- import { createHttpTransport } from '@almadar/shell-runtime/client/EventTransport';
42
42
  import { loadLazyPage } from '@almadar/shell-runtime';
43
43
 
44
44
  var Tabs = ({
@@ -1005,6 +1005,348 @@ var SelectionAnnotator = ({
1005
1005
  );
1006
1006
  };
1007
1007
  SelectionAnnotator.displayName = "SelectionAnnotator";
1008
+ var FONT = 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace';
1009
+ var LINE_PX = 19.5;
1010
+ var PROBE = "0000000000";
1011
+ var SYNTAX_TONES = {
1012
+ keyword: "var(--color-primary)",
1013
+ string: "var(--color-success)",
1014
+ comment: "var(--color-muted-foreground)",
1015
+ number: "var(--color-warning)",
1016
+ type: "var(--color-accent)",
1017
+ function: "var(--color-info)",
1018
+ operator: "var(--color-foreground)",
1019
+ punctuation: "var(--color-muted-foreground)",
1020
+ variable: "var(--color-foreground)"
1021
+ };
1022
+ var tint = (token, percent) => `color-mix(in srgb, var(${token}) ${percent}%, transparent)`;
1023
+ var ANNOTATION_TONES = {
1024
+ search: tint("--color-warning", 40),
1025
+ review: tint("--color-primary", 22),
1026
+ "review-recent": tint("--color-accent", 35),
1027
+ error: tint("--color-error", 25),
1028
+ warning: tint("--color-warning", 25),
1029
+ info: tint("--color-info", 22)
1030
+ };
1031
+ var SELECTION_BG = tint("--color-primary", 35);
1032
+ var caretStyle = (caret) => {
1033
+ if (caret === "bar") return { boxShadow: "inset 2px 0 0 var(--color-foreground)" };
1034
+ if (caret === "underline") return { boxShadow: "inset 0 -2px 0 var(--color-foreground)" };
1035
+ return { backgroundColor: "var(--color-foreground)", color: "var(--color-background)" };
1036
+ };
1037
+ var before = (aRow, aCol, bRow, bCol) => aRow < bRow || aRow === bRow && aCol <= bCol;
1038
+ function runsOf(row, chars, decorations, selection, cursor, caret) {
1039
+ const len = chars.length;
1040
+ const cells = chars.map((ch) => ({ ch, tones: [], selected: false }));
1041
+ const eol = { ch: " ", tones: [], selected: false };
1042
+ const cellAt = (i) => cells[i] ?? eol;
1043
+ for (const d of decorations) {
1044
+ const start = row === d.fromRow ? d.fromCol : 0;
1045
+ const end = row === d.toRow ? d.toCol : len;
1046
+ for (let i = Math.max(0, start); i < Math.min(len, end); i++) {
1047
+ const cell = cells[i];
1048
+ cell.tones.push(d.tone);
1049
+ const fg = SYNTAX_TONES[d.tone];
1050
+ const bg = ANNOTATION_TONES[d.tone];
1051
+ if (fg !== void 0) cell.fg = fg;
1052
+ if (bg !== void 0) cell.bg = bg;
1053
+ if (d.label !== void 0) cell.label = d.label;
1054
+ }
1055
+ }
1056
+ let lineSelected = false;
1057
+ if (selection !== null) {
1058
+ const fromFirst = before(selection.fromRow, selection.fromCol, selection.toRow, selection.toCol);
1059
+ const minRow = fromFirst ? selection.fromRow : selection.toRow;
1060
+ const minCol = fromFirst ? selection.fromCol : selection.toCol;
1061
+ const maxRow = fromFirst ? selection.toRow : selection.fromRow;
1062
+ const maxCol = fromFirst ? selection.toCol : selection.fromCol;
1063
+ if (row >= minRow && row <= maxRow) {
1064
+ if (selection.linewise) {
1065
+ lineSelected = true;
1066
+ for (const cell of cells) cell.selected = true;
1067
+ if (len === 0) eol.selected = true;
1068
+ } else {
1069
+ const start = row === minRow ? minCol : 0;
1070
+ const end = row === maxRow ? maxCol : len;
1071
+ for (let i = Math.max(0, start); i <= end && i <= len; i++) cellAt(i).selected = true;
1072
+ }
1073
+ }
1074
+ }
1075
+ if (row === cursor.row) cellAt(Math.min(cursor.col, len)).caret = caret;
1076
+ const shown = [...cells];
1077
+ if (eol.selected || eol.caret !== void 0) shown.push(eol);
1078
+ const runs = [];
1079
+ const keyOf = (c) => `${c.fg ?? ""}|${c.bg ?? ""}|${c.tones.join(" ")}|${c.label ?? ""}|${c.selected}`;
1080
+ for (const cell of shown) {
1081
+ const last = runs[runs.length - 1];
1082
+ if (last !== void 0 && cell.caret === void 0 && last.cell.caret === void 0 && keyOf(last.cell) === keyOf(cell)) {
1083
+ last.text += cell.ch;
1084
+ } else {
1085
+ runs.push({ text: cell.ch, cell });
1086
+ }
1087
+ }
1088
+ return { runs, lineSelected };
1089
+ }
1090
+ function BufferCodeBlock({
1091
+ code: rawCode,
1092
+ maxHeight = "60vh",
1093
+ className,
1094
+ editorId,
1095
+ onEditorFocus = "EDITOR_FOCUS",
1096
+ onEditorBlur = "EDITOR_BLUR",
1097
+ onKey,
1098
+ onPointerDown,
1099
+ onHover,
1100
+ cursor,
1101
+ caret = "block",
1102
+ selection = null,
1103
+ decorations,
1104
+ popover = null,
1105
+ lineNumbers,
1106
+ relativeLineNumbers = false
1107
+ }) {
1108
+ const eventBus = useEventBus();
1109
+ const editorFocus = useEditorFocus();
1110
+ const surfaceRef = useRef(null);
1111
+ const scrollRef = useRef(null);
1112
+ const linesRef = useRef(null);
1113
+ const probeRef = useRef(null);
1114
+ const popoverRef = useRef(null);
1115
+ const hoverCell = useRef("");
1116
+ const [flipped, setFlipped] = useState(false);
1117
+ const text = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
1118
+ const lines = useMemo(() => text.split("\n").map((line2) => Array.from(line2)), [text]);
1119
+ const byRow = useMemo(() => {
1120
+ const map = /* @__PURE__ */ new Map();
1121
+ for (const d of decorations ?? []) {
1122
+ for (let r = d.fromRow; r <= d.toRow; r++) {
1123
+ const held = map.get(r);
1124
+ if (held) held.push(d);
1125
+ else map.set(r, [d]);
1126
+ }
1127
+ }
1128
+ return map;
1129
+ }, [decorations]);
1130
+ const showGutter = lineNumbers !== false;
1131
+ const gutterChars = String(lines.length).length;
1132
+ const noDecorations = [];
1133
+ const charWidth = useCallback(() => {
1134
+ const probe = probeRef.current;
1135
+ return probe ? probe.getBoundingClientRect().width / PROBE.length : 0;
1136
+ }, []);
1137
+ useLayoutEffect(() => {
1138
+ const scroller = scrollRef.current;
1139
+ if (!scroller) return;
1140
+ const top = cursor.row * LINE_PX;
1141
+ const height = scroller.clientHeight;
1142
+ if (top < scroller.scrollTop) scroller.scrollTop = top;
1143
+ else if (height > 0 && top + LINE_PX > scroller.scrollTop + height) scroller.scrollTop = top + LINE_PX - height;
1144
+ const cw = charWidth();
1145
+ const width = scroller.clientWidth;
1146
+ if (cw > 0 && width > 0) {
1147
+ const left = cursor.col * cw;
1148
+ if (left < scroller.scrollLeft) scroller.scrollLeft = left;
1149
+ else if (left + cw > scroller.scrollLeft + width) scroller.scrollLeft = left + cw - width;
1150
+ }
1151
+ }, [cursor.row, cursor.col, charWidth]);
1152
+ useLayoutEffect(() => {
1153
+ const scroller = scrollRef.current;
1154
+ const note = popoverRef.current;
1155
+ if (!popover || !scroller || !note) {
1156
+ setFlipped(false);
1157
+ return;
1158
+ }
1159
+ const height = note.offsetHeight;
1160
+ const below = (popover.fromRow + 1) * LINE_PX;
1161
+ const noRoomBelow = scroller.clientHeight > 0 && below + height > scroller.scrollTop + scroller.clientHeight;
1162
+ const roomAbove = popover.fromRow * LINE_PX - height >= scroller.scrollTop;
1163
+ setFlipped(noRoomBelow && roomAbove);
1164
+ }, [popover]);
1165
+ const cellOf = (e) => {
1166
+ const surface = linesRef.current;
1167
+ const rect = surface ? surface.getBoundingClientRect() : { left: 0, top: 0 };
1168
+ const last = lines.length - 1;
1169
+ const hit = e.target instanceof Element ? e.target.closest("[data-row]") : null;
1170
+ const hitRow = hit ? Number(hit.getAttribute("data-row")) : NaN;
1171
+ const row = Number.isNaN(hitRow) ? Math.min(last, Math.max(0, Math.floor((e.clientY - rect.top) / LINE_PX))) : hitRow;
1172
+ const cw = charWidth();
1173
+ const len = lines[row]?.length ?? 0;
1174
+ const col = cw > 0 ? Math.min(len, Math.max(0, Math.floor((e.clientX - rect.left) / cw))) : 0;
1175
+ return { row, col };
1176
+ };
1177
+ const handleKeyDown = (e) => {
1178
+ if (e.nativeEvent.isComposing || e.key === "Process") return;
1179
+ e.preventDefault();
1180
+ if (onKey && editorId) {
1181
+ eventBus.emit(`UI:${onKey}`, {
1182
+ editorId,
1183
+ key: e.key,
1184
+ code: e.code,
1185
+ ctrl: e.ctrlKey,
1186
+ alt: e.altKey,
1187
+ shift: e.shiftKey,
1188
+ meta: e.metaKey,
1189
+ repeat: e.repeat
1190
+ });
1191
+ }
1192
+ };
1193
+ const handlePointerDown = (e) => {
1194
+ e.preventDefault();
1195
+ surfaceRef.current?.focus();
1196
+ if (onPointerDown && editorId) eventBus.emit(`UI:${onPointerDown}`, { editorId, ...cellOf(e) });
1197
+ };
1198
+ const handlePointerMove = (e) => {
1199
+ const cell = cellOf(e);
1200
+ const key = `${cell.row}:${cell.col}`;
1201
+ if (key === hoverCell.current) return;
1202
+ hoverCell.current = key;
1203
+ if (onHover && editorId) eventBus.emit(`UI:${onHover}`, { editorId, ...cell });
1204
+ };
1205
+ const gutterNumber = (row) => relativeLineNumbers && row !== cursor.row ? Math.abs(row - cursor.row) : row + 1;
1206
+ return /* @__PURE__ */ jsx(
1207
+ Box,
1208
+ {
1209
+ ref: surfaceRef,
1210
+ "data-buffer": "",
1211
+ role: "textbox",
1212
+ "aria-multiline": "true",
1213
+ "aria-readonly": "true",
1214
+ tabIndex: 0,
1215
+ className,
1216
+ onKeyDown: handleKeyDown,
1217
+ onPointerDown: handlePointerDown,
1218
+ onPointerMove: handlePointerMove,
1219
+ onPointerLeave: () => {
1220
+ hoverCell.current = "";
1221
+ },
1222
+ onFocus: () => {
1223
+ if (!editorId) return;
1224
+ editorFocus.focus(editorId);
1225
+ eventBus.emit(`UI:${onEditorFocus}`, { editorId });
1226
+ },
1227
+ onBlur: () => {
1228
+ if (!editorId) return;
1229
+ editorFocus.blur(editorId);
1230
+ eventBus.emit(`UI:${onEditorBlur}`, { editorId });
1231
+ },
1232
+ style: {
1233
+ outline: "none",
1234
+ backgroundColor: "var(--color-surface-subtle)",
1235
+ color: "var(--color-foreground)",
1236
+ fontFamily: FONT,
1237
+ fontSize: "13px",
1238
+ lineHeight: `${LINE_PX}px`,
1239
+ cursor: "text",
1240
+ userSelect: "none"
1241
+ },
1242
+ children: /* @__PURE__ */ jsxs(Box, { ref: scrollRef, "data-buffer-scroll": "", style: { display: "flex", overflow: "auto", maxHeight, position: "relative" }, children: [
1243
+ showGutter && /* @__PURE__ */ jsx(
1244
+ Box,
1245
+ {
1246
+ "aria-hidden": "true",
1247
+ style: {
1248
+ position: "sticky",
1249
+ left: 0,
1250
+ flexShrink: 0,
1251
+ zIndex: 1,
1252
+ boxSizing: "content-box",
1253
+ width: `${gutterChars}ch`,
1254
+ padding: "0 1ch",
1255
+ textAlign: "right",
1256
+ backgroundColor: "var(--color-surface-subtle)",
1257
+ color: "var(--color-muted-foreground)",
1258
+ fontVariantNumeric: "tabular-nums"
1259
+ },
1260
+ children: lines.map((_, row) => /* @__PURE__ */ jsx(
1261
+ Box,
1262
+ {
1263
+ "data-gutter": "",
1264
+ style: { height: LINE_PX, color: row === cursor.row ? "var(--color-foreground)" : void 0 },
1265
+ children: gutterNumber(row)
1266
+ },
1267
+ row
1268
+ ))
1269
+ }
1270
+ ),
1271
+ /* @__PURE__ */ jsxs(Box, { ref: linesRef, style: { position: "relative", flexGrow: 1, minWidth: 0 }, children: [
1272
+ /* @__PURE__ */ jsx(
1273
+ Box,
1274
+ {
1275
+ as: "span",
1276
+ ref: probeRef,
1277
+ "aria-hidden": "true",
1278
+ "data-probe": "",
1279
+ style: { position: "absolute", visibility: "hidden", whiteSpace: "pre", pointerEvents: "none" },
1280
+ children: PROBE
1281
+ }
1282
+ ),
1283
+ lines.map((chars, row) => {
1284
+ const { runs, lineSelected } = runsOf(row, chars, byRow.get(row) ?? noDecorations, selection, cursor, caret);
1285
+ return /* @__PURE__ */ jsx(
1286
+ Box,
1287
+ {
1288
+ "data-row": row,
1289
+ ...lineSelected ? { "data-selected-line": "" } : {},
1290
+ style: { height: LINE_PX, whiteSpace: "pre", minWidth: "max-content" },
1291
+ children: runs.map((run, i) => /* @__PURE__ */ jsx(
1292
+ Box,
1293
+ {
1294
+ as: "span",
1295
+ ...run.cell.caret !== void 0 ? { "data-caret": run.cell.caret } : {},
1296
+ ...run.cell.selected ? { "data-selected": "" } : {},
1297
+ ...run.cell.tones.length > 0 ? { "data-tone": run.cell.tones.join(" ") } : {},
1298
+ ...run.cell.label !== void 0 ? { role: "group", "aria-label": run.cell.label } : {},
1299
+ style: {
1300
+ ...run.cell.fg !== void 0 ? { color: run.cell.fg } : {},
1301
+ ...run.cell.bg !== void 0 ? { backgroundColor: run.cell.bg } : {},
1302
+ ...run.cell.selected ? { backgroundColor: SELECTION_BG } : {},
1303
+ ...run.cell.caret !== void 0 ? caretStyle(run.cell.caret) : {}
1304
+ },
1305
+ children: run.text
1306
+ },
1307
+ i
1308
+ ))
1309
+ },
1310
+ row
1311
+ );
1312
+ }),
1313
+ popover && /* @__PURE__ */ jsxs(
1314
+ Box,
1315
+ {
1316
+ ref: popoverRef,
1317
+ "data-popover": "",
1318
+ role: "note",
1319
+ style: {
1320
+ position: "absolute",
1321
+ left: `${popover.fromCol}ch`,
1322
+ top: flipped ? popover.fromRow * LINE_PX : (popover.fromRow + 1) * LINE_PX,
1323
+ transform: flipped ? "translateY(-100%)" : void 0,
1324
+ zIndex: 2,
1325
+ maxWidth: "60ch",
1326
+ padding: "0.5rem 0.75rem",
1327
+ whiteSpace: "normal",
1328
+ pointerEvents: "none",
1329
+ backgroundColor: "var(--color-card)",
1330
+ color: "var(--color-foreground)",
1331
+ border: "1px solid var(--color-border)",
1332
+ borderRadius: "0.375rem",
1333
+ boxShadow: "var(--shadow-lg)"
1334
+ },
1335
+ children: [
1336
+ /* @__PURE__ */ jsx(Typography, { variant: "label", children: popover.title }),
1337
+ popover.sections.map((section, i) => /* @__PURE__ */ jsxs(Box, { style: { marginTop: "0.375rem" }, children: [
1338
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: section.heading }),
1339
+ section.lines.map((line2, j) => /* @__PURE__ */ jsx(Typography, { variant: "body2", children: line2 }, j))
1340
+ ] }, i)),
1341
+ popover.busy && /* @__PURE__ */ jsx(Box, { as: "span", "data-busy": "", role: "progressbar", "aria-busy": "true", className: "animate-pulse", style: { color: "var(--color-muted-foreground)" }, children: "\u2026" })
1342
+ ]
1343
+ }
1344
+ )
1345
+ ] })
1346
+ ] })
1347
+ }
1348
+ );
1349
+ }
1008
1350
  var loadedPrism;
1009
1351
  var prismLoad;
1010
1352
  var programLanguagesRegistered = false;
@@ -1447,7 +1789,7 @@ function translateProgram(source, language, lang) {
1447
1789
  }
1448
1790
  return source;
1449
1791
  }
1450
- var CodeBlock = React51__default.memo(
1792
+ var ClassicCodeBlock = React52__default.memo(
1451
1793
  ({
1452
1794
  code: rawCode,
1453
1795
  language = "text",
@@ -2430,7 +2772,7 @@ var CodeBlock = React51__default.memo(
2430
2772
  },
2431
2773
  children: diagnosticUnderlines.map((seg, i) => {
2432
2774
  const mark = seg.range ?? seg.marker;
2433
- if (!mark) return /* @__PURE__ */ jsx(React51__default.Fragment, { children: seg.text }, i);
2775
+ if (!mark) return /* @__PURE__ */ jsx(React52__default.Fragment, { children: seg.text }, i);
2434
2776
  return /* @__PURE__ */ jsx(
2435
2777
  Box,
2436
2778
  {
@@ -2725,6 +3067,10 @@ var CodeBlock = React51__default.memo(
2725
3067
  },
2726
3068
  (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.completions === next.completions && prev.assist === next.assist && prev.problems === next.problems && prev.diagnostics === next.diagnostics && prev.definitionAt === next.definitionAt && prev.onGoToDefinition === next.onGoToDefinition && prev.diagnosticsCode === next.diagnosticsCode && prev.lineNumbers === next.lineNumbers && prev.errorLines === next.errorLines && prev.highlightLines?.start === next.highlightLines?.start && prev.highlightLines?.end === next.highlightLines?.end && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.naturalLanguages === next.naturalLanguages && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.onKey === next.onKey && prev.motions === next.motions && prev.operators === next.operators && prev.askEvent === next.askEvent && prev.noteEvent === next.noteEvent && prev.askLabel === next.askLabel && prev.noteLabel === next.noteLabel
2727
3069
  );
3070
+ ClassicCodeBlock.displayName = "ClassicCodeBlock";
3071
+ var CodeBlock = React52__default.memo(
3072
+ (props) => props.cursor !== void 0 ? /* @__PURE__ */ jsx(BufferCodeBlock, { ...props, cursor: props.cursor }) : /* @__PURE__ */ jsx(ClassicCodeBlock, { ...props })
3073
+ );
2728
3074
  CodeBlock.displayName = "CodeBlock";
2729
3075
 
2730
3076
  // src/lib/canvas-tools.ts
@@ -2753,7 +3099,7 @@ var CANVAS_TOOLS = [
2753
3099
  function hasCanvasTool(tools, tool) {
2754
3100
  return tools.includes(tool);
2755
3101
  }
2756
- var IconButton = React51__default.forwardRef(
3102
+ var IconButton = React52__default.forwardRef(
2757
3103
  ({ icon, label, tooltipPosition = "right", variant = "ghost", size = "sm", className, ...rest }, ref) => {
2758
3104
  const touch = useMediaQuery("(hover: none)");
2759
3105
  const button = /* @__PURE__ */ jsx(
@@ -3615,14 +3961,14 @@ function insertionLineRect(container, children, index, axis) {
3615
3961
  return axis === "vertical" ? { top: container.top, left: container.left, width: container.width, height: INSERTION_LINE_PX } : { top: container.top, left: container.left, width: INSERTION_LINE_PX, height: container.height };
3616
3962
  }
3617
3963
  const clamped = Math.max(0, Math.min(index, children.length));
3618
- const before = children[clamped];
3964
+ const before2 = children[clamped];
3619
3965
  const after = children[clamped - 1];
3620
- const ref = before ?? after ?? container;
3966
+ const ref = before2 ?? after ?? container;
3621
3967
  if (axis === "vertical") {
3622
- const edge2 = before && after ? (after.top + after.height + before.top) / 2 : before ? before.top : after ? after.top + after.height : container.top;
3968
+ const edge2 = before2 && after ? (after.top + after.height + before2.top) / 2 : before2 ? before2.top : after ? after.top + after.height : container.top;
3623
3969
  return { top: edge2 - half, left: ref.left, width: ref.width, height: INSERTION_LINE_PX };
3624
3970
  }
3625
- const edge = before && after ? (after.left + after.width + before.left) / 2 : before ? before.left : after ? after.left + after.width : container.left;
3971
+ const edge = before2 && after ? (after.left + after.width + before2.left) / 2 : before2 ? before2.left : after ? after.left + after.width : container.left;
3626
3972
  return { top: ref.top, left: edge - half, width: INSERTION_LINE_PX, height: ref.height };
3627
3973
  }
3628
3974
  var GRID_POSITION = {
@@ -4243,7 +4589,7 @@ function EntitySchemaProvider({
4243
4589
  orbitalsByTrait,
4244
4590
  children
4245
4591
  }) {
4246
- const contextValue = React51__default.useMemo(() => ({ orbitalsByTrait }), [orbitalsByTrait]);
4592
+ const contextValue = React52__default.useMemo(() => ({ orbitalsByTrait }), [orbitalsByTrait]);
4247
4593
  return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value: contextValue, children });
4248
4594
  }
4249
4595
  function useEntitySchema() {
@@ -4286,7 +4632,7 @@ function resolveMarkerExpression(expression, entity, config, state, i18n) {
4286
4632
  function isPlainObject(value) {
4287
4633
  if (value === null || value === void 0 || typeof value !== "object") return false;
4288
4634
  if (Array.isArray(value)) return false;
4289
- if (React51__default.isValidElement(value)) return false;
4635
+ if (React52__default.isValidElement(value)) return false;
4290
4636
  if (value instanceof Date) return false;
4291
4637
  if (typeof value === "function") return false;
4292
4638
  return true;
@@ -4301,7 +4647,7 @@ function cachedContainer(value, scopeTrait, entity, config, state, i18n, rowSets
4301
4647
  var resolvedMarkerFree = /* @__PURE__ */ new WeakSet();
4302
4648
  var evaluatorResolvedData = /* @__PURE__ */ new WeakSet();
4303
4649
  function isPatternNode(value) {
4304
- if (value === null || typeof value !== "object" || Array.isArray(value) || React51__default.isValidElement(value) || value instanceof Date) return false;
4650
+ if (value === null || typeof value !== "object" || Array.isArray(value) || React52__default.isValidElement(value) || value instanceof Date) return false;
4305
4651
  const type = value.type;
4306
4652
  return typeof type === "string" && getComponentForPattern(type) !== null;
4307
4653
  }
@@ -4312,7 +4658,7 @@ function isEvaluatorResolvedData(value) {
4312
4658
  return evaluatorResolvedData.has(value);
4313
4659
  }
4314
4660
  function brandResolved(value) {
4315
- if (value !== null && typeof value === "object" && !React51__default.isValidElement(value) && !(value instanceof Date)) {
4661
+ if (value !== null && typeof value === "object" && !React52__default.isValidElement(value) && !(value instanceof Date)) {
4316
4662
  resolvedMarkerFree.add(value);
4317
4663
  }
4318
4664
  }
@@ -4355,7 +4701,7 @@ function walkValue(value, scopeTrait, entity, config, state, i18n, rowSets) {
4355
4701
  }
4356
4702
  const resolved = resolveMarkerExpression(value.expression, entity, config, state, i18n);
4357
4703
  markerResolutionCache.set(value, { entity, config, state, i18n, resolved });
4358
- if (resolved !== null && typeof resolved === "object" && !React51__default.isValidElement(resolved) && !(resolved instanceof Date)) {
4704
+ if (resolved !== null && typeof resolved === "object" && !React52__default.isValidElement(resolved) && !(resolved instanceof Date)) {
4359
4705
  resolvedMarkerFree.add(resolved);
4360
4706
  if (!holdsRenderNode(resolved)) evaluatorResolvedData.add(resolved);
4361
4707
  }
@@ -4718,7 +5064,7 @@ var Drawer = ({
4718
5064
  const positionClasses2 = position === "right" ? "right-0 border-l" : "left-0 border-r";
4719
5065
  const drawerSign = position === "right" ? 1 : -1;
4720
5066
  const slideTransform = position === "right" ? "translateX(100%)" : "translateX(-100%)";
4721
- return /* @__PURE__ */ jsxs(Fragment, { children: [
5067
+ const layer = /* @__PURE__ */ jsxs(Fragment, { children: [
4722
5068
  modal && /* @__PURE__ */ jsx(
4723
5069
  Overlay,
4724
5070
  {
@@ -4793,6 +5139,7 @@ var Drawer = ({
4793
5139
  }
4794
5140
  )
4795
5141
  ] });
5142
+ return contained ? layer : /* @__PURE__ */ jsx(ThemedPortal, { children: layer });
4796
5143
  };
4797
5144
  Drawer.displayName = "Drawer";
4798
5145
  var SplitPane = ({
@@ -5412,7 +5759,7 @@ var DefaultFallback = ({ error, onRetry }) => {
5412
5759
  }
5413
5760
  );
5414
5761
  };
5415
- var ErrorBoundary = class extends React51__default.Component {
5762
+ var ErrorBoundary = class extends React52__default.Component {
5416
5763
  static displayName = "ErrorBoundary";
5417
5764
  constructor(props) {
5418
5765
  super(props);
@@ -5692,7 +6039,7 @@ function renderNode(node, key) {
5692
6039
  return /* @__PURE__ */ jsx(VStack, { gap: "lg", children: node.stack.map((child, i) => renderNode(child, i)) }, key);
5693
6040
  }
5694
6041
  const { variant, rows, columns, fields } = node.shape;
5695
- return /* @__PURE__ */ jsx(React51__default.Fragment, { children: renderVariant(variant, rows, columns, fields, void 0) }, key);
6042
+ return /* @__PURE__ */ jsx(React52__default.Fragment, { children: renderVariant(variant, rows, columns, fields, void 0) }, key);
5696
6043
  }
5697
6044
  function SkeletonTree({ node, className }) {
5698
6045
  const { t } = useTranslate();
@@ -5742,7 +6089,7 @@ function useAwaitingSkeleton(target) {
5742
6089
  return "slot" in target ? source.forSlot(target.slot) : source.forTrait(target.trait);
5743
6090
  }
5744
6091
  var LazySlotContentRenderer = lazy(
5745
- () => import('./UISlotRenderer-PY7FIJXN.js').then((m) => ({
6092
+ () => import('./UISlotRenderer-5OURMAP2.js').then((m) => ({
5746
6093
  default: m.SlotContentRenderer
5747
6094
  }))
5748
6095
  );
@@ -5995,10 +6342,10 @@ function splitFirstMatch(node, annotation) {
5995
6342
  if (child.type === "text" && typeof child.value === "string") {
5996
6343
  const at = child.value.indexOf(annotation.text);
5997
6344
  if (at < 0) continue;
5998
- const before = child.value.slice(0, at);
6345
+ const before2 = child.value.slice(0, at);
5999
6346
  const after = child.value.slice(at + annotation.text.length);
6000
6347
  const replacement = [];
6001
- if (before) replacement.push({ type: "text", value: before });
6348
+ if (before2) replacement.push({ type: "text", value: before2 });
6002
6349
  replacement.push({
6003
6350
  type: "element",
6004
6351
  tagName: "mark",
@@ -6229,9 +6576,14 @@ function resolveCanvasTheme(scope) {
6229
6576
  const r = new ScopeReader(scope);
6230
6577
  try {
6231
6578
  const tones = {};
6579
+ const unresolvedTones = [];
6232
6580
  for (const tone of DIAGRAM_TONES) {
6233
6581
  const c = r.color(toneVar(tone));
6234
- tones[tone] = c ? colorCss(c) : "currentColor";
6582
+ if (c) tones[tone] = colorCss(c);
6583
+ else {
6584
+ tones[tone] = "transparent";
6585
+ unresolvedTones.push(tone);
6586
+ }
6235
6587
  }
6236
6588
  const surface = (name) => {
6237
6589
  const c = r.color(name);
@@ -6250,6 +6602,7 @@ function resolveCanvasTheme(scope) {
6250
6602
  onPrimary: surface("--color-primary-foreground")
6251
6603
  },
6252
6604
  tones,
6605
+ unresolvedTones,
6253
6606
  series: SERIES_TONES.map((t) => tones[t]),
6254
6607
  strokes: {
6255
6608
  thin: r.length("--diagram-stroke-thin", 1),
@@ -6364,11 +6717,22 @@ function useCanvasTheme(scopeRef, scopePresent = true) {
6364
6717
  }, [appliedTheme, scopeKey, scopeRef, scopePresent]);
6365
6718
  return state;
6366
6719
  }
6367
-
6368
- // src/lib/mermaidTheme.ts
6369
6720
  var PIE_SLOTS = 12;
6721
+ var READ_TONES = ["ink", "label", "axis", "grid", "guide", "fill", "highlight"];
6722
+ var SERIES_TONE_IDS = ["series-1", "series-2", "series-3", "series-4", "series-5", "series-6", "series-7", "series-8"];
6723
+ var UnresolvedThemeToneError = class extends Error {
6724
+ constructor(tones) {
6725
+ super(`diagram tones unresolved on the scope: declare ${tones.map((t) => `--color-${DIAGRAM_TONE_COLOR_KEYS[t]}`).join(", ")}`);
6726
+ this.tones = tones;
6727
+ this.name = "UnresolvedThemeToneError";
6728
+ }
6729
+ tones;
6730
+ };
6370
6731
  function mermaidThemeVariables(theme, mode) {
6371
6732
  const { tones, series } = theme;
6733
+ const drawnSeries = SERIES_TONE_IDS.filter((_, i) => i < series.length && i < PIE_SLOTS);
6734
+ const missing = [...READ_TONES, ...drawnSeries].filter((t) => theme.unresolvedTones.includes(t));
6735
+ if (missing.length > 0) throw new UnresolvedThemeToneError(missing);
6372
6736
  const seriesAt = (i) => series[i % series.length] ?? tones.highlight;
6373
6737
  const vars = {
6374
6738
  darkMode: mode === "dark",
@@ -6420,7 +6784,7 @@ function loadMermaid() {
6420
6784
  mermaidModule ??= import('mermaid').then((m) => m.default);
6421
6785
  return mermaidModule;
6422
6786
  }
6423
- var MermaidDiagram = React51__default.memo(
6787
+ var MermaidDiagram = React52__default.memo(
6424
6788
  ({ code, className }) => {
6425
6789
  const resolvedMode = useScopedMode();
6426
6790
  const { t } = useTranslate();
@@ -6498,7 +6862,7 @@ var urlTransform = (url, key, node) => key === "src" && node.tagName === "img" &
6498
6862
  var loadedKatex;
6499
6863
  function loadKatex() {
6500
6864
  if (loadedKatex !== void 0) return Promise.resolve(loadedKatex);
6501
- return import('./katexPlugin-NCDKOOQY.js').then((m) => {
6865
+ return import('./katexPlugin-WGJ4JFZU.js').then((m) => {
6502
6866
  loadedKatex = m.rehypeKatex;
6503
6867
  return m.rehypeKatex;
6504
6868
  });
@@ -6629,7 +6993,7 @@ var STATIC_COMPONENTS = {
6629
6993
  );
6630
6994
  }
6631
6995
  };
6632
- var MarkdownContent = React51__default.memo(
6996
+ var MarkdownContent = React52__default.memo(
6633
6997
  ({ content, direction = "ltr", askEvent, noteEvent, askLabel, noteLabel, annotations, annotationEvent, className, ...rest }) => {
6634
6998
  const { t: _t } = useTranslate();
6635
6999
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -6732,6 +7096,7 @@ var CHANGE_KIND_ICON = {
6732
7096
  "theme-changed": "palette",
6733
7097
  "behavior-composed": "layers"
6734
7098
  };
7099
+ var KNOWN_ACTIVITY_TYPES = new Set(TRACE_ACTIVITY_TYPES);
6735
7100
  function jumpTargetOf(activity) {
6736
7101
  switch (activity.type) {
6737
7102
  case "orbital_started":
@@ -6769,7 +7134,7 @@ function activityRowFacts(items, activityOf) {
6769
7134
  });
6770
7135
  return facts;
6771
7136
  }
6772
- function describe(activity, t, facts) {
7137
+ function describe(activity, t, facts, toolLabel) {
6773
7138
  switch (activity.type) {
6774
7139
  case "message":
6775
7140
  return { icon: "info", color: "muted", text: activity.content, details: [] };
@@ -6777,7 +7142,7 @@ function describe(activity, t, facts) {
6777
7142
  return {
6778
7143
  icon: "wrench",
6779
7144
  color: "muted",
6780
- text: t("agentActivity.toolCall", { tool: activity.tool }),
7145
+ text: toolLabel ?? t("agentActivity.toolCall", { tool: activity.tool }),
6781
7146
  details: [],
6782
7147
  ...activity.argsText !== "" && activity.argsText !== "{}" ? { raw: activity.argsText } : {}
6783
7148
  };
@@ -6785,7 +7150,7 @@ function describe(activity, t, facts) {
6785
7150
  return {
6786
7151
  icon: activity.success ? "corner-down-right" : "alert-circle",
6787
7152
  color: activity.success ? "muted" : "error",
6788
- text: t("agentActivity.toolResult", { tool: activity.tool }),
7153
+ text: toolLabel !== void 0 ? t(activity.success ? "agentActivity.toolDone" : "agentActivity.toolFailed", { tool: toolLabel }) : t("agentActivity.toolResult", { tool: activity.tool }),
6789
7154
  details: [
6790
7155
  ...activity.detail !== void 0 ? [activity.detail] : [],
6791
7156
  ...activity.rows !== void 0 ? [t("agentActivity.toolRows", { count: activity.rows })] : []
@@ -6845,6 +7210,10 @@ function describe(activity, t, facts) {
6845
7210
  return { icon: "circle-x", color: "muted", text: activity.message || t("agentActivity.cancelled"), details: [] };
6846
7211
  case "llm_response":
6847
7212
  return { icon: "cpu", color: "muted", text: t("agentActivity.llmResponse"), details: [activity.content] };
7213
+ default: {
7214
+ const unhandled = activity;
7215
+ throw new Error(`describe: unhandled activity ${JSON.stringify(unhandled)}`);
7216
+ }
6848
7217
  }
6849
7218
  }
6850
7219
  function llmSummary(activity, t) {
@@ -6886,8 +7255,14 @@ function LlmResponseRow({ activity }) {
6886
7255
  }
6887
7256
  ) });
6888
7257
  }
6889
- function AgentActivityRow({ activity, onJump, facts }) {
7258
+ function AgentActivityRow({ activity, onJump, facts, toolLabel }) {
6890
7259
  const { t } = useTranslate();
7260
+ if (!KNOWN_ACTIVITY_TYPES.has(activity.type)) {
7261
+ return /* @__PURE__ */ jsxs(Box, { className: "flex items-start gap-2 w-full", "data-testid": "agent-activity-unknown", children: [
7262
+ /* @__PURE__ */ jsx(Icon, { name: "help-circle", size: "sm", color: "muted", className: "mt-0.5 shrink-0" }),
7263
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "muted", className: "break-words", children: t("agentActivity.unknown", { kind: activity.type }) })
7264
+ ] });
7265
+ }
6891
7266
  if (activity.type === "llm_response") return /* @__PURE__ */ jsx(LlmResponseRow, { activity });
6892
7267
  if (activity.type === "message" && activity.role !== "system") {
6893
7268
  const mine = activity.role === "user";
@@ -6900,7 +7275,7 @@ function AgentActivityRow({ activity, onJump, facts }) {
6900
7275
  }
6901
7276
  );
6902
7277
  }
6903
- const spec = describe(activity, t, facts);
7278
+ const spec = describe(activity, t, facts, toolLabel);
6904
7279
  const target = jumpTargetOf(activity);
6905
7280
  return /* @__PURE__ */ jsxs(Box, { className: "flex items-start gap-2 w-full", "data-testid": `agent-activity-${activity.type}`, children: [
6906
7281
  /* @__PURE__ */ jsx(Icon, { name: spec.icon, size: "sm", color: spec.color, animation: spec.animation, className: "mt-0.5 shrink-0" }),
@@ -7077,11 +7452,12 @@ function CopyReply({ text }) {
7077
7452
  }
7078
7453
  );
7079
7454
  }
7080
- function StepRows({ steps }) {
7081
- const facts = activityRowFacts(steps, (a) => a);
7082
- return /* @__PURE__ */ jsx(VStack, { gap: "xs", className: "w-full", children: steps.map((step, i) => /* @__PURE__ */ jsx(AgentActivityRow, { activity: step, facts: facts[i] }, `${step.type}-${step.timestamp}-${i}`)) });
7455
+ function StepRows({ steps, labelOf }) {
7456
+ const shown = steps.filter((step) => !(step.type === "tool_result" && step.success && labelOf(step) !== void 0));
7457
+ const facts = activityRowFacts(shown, (a) => a);
7458
+ return /* @__PURE__ */ jsx(VStack, { gap: "xs", className: "w-full", children: shown.map((step, i) => /* @__PURE__ */ jsx(AgentActivityRow, { activity: step, facts: facts[i], toolLabel: labelOf(step) }, `${step.type}-${step.timestamp}-${i}`)) });
7083
7459
  }
7084
- function TurnSteps({ steps, showRawLlm, onToggleRaw, idPrefix, index }) {
7460
+ function TurnSteps({ steps, showRawLlm, onToggleRaw, idPrefix, index, labelOf }) {
7085
7461
  const { t } = useTranslate();
7086
7462
  const [open, setOpen] = useState(false);
7087
7463
  const visible = showRawLlm ? steps : steps.filter((s) => s.type !== "llm_response");
@@ -7106,12 +7482,16 @@ function TurnSteps({ steps, showRawLlm, onToggleRaw, idPrefix, index }) {
7106
7482
  ),
7107
7483
  open ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "w-full border-s-[length:var(--border-width)] border-[var(--color-border)] ps-3", children: [
7108
7484
  hasRaw ? /* @__PURE__ */ jsx(Switch, { checked: showRawLlm, onChange: onToggleRaw, label: t("agentActivity.showRawLlm"), id: `${idPrefix}-show-raw-llm-${index}` }) : null,
7109
- /* @__PURE__ */ jsx(StepRows, { steps: visible })
7485
+ /* @__PURE__ */ jsx(StepRows, { steps: visible, labelOf })
7110
7486
  ] }) : null
7111
7487
  ] });
7112
7488
  }
7113
- function AgentChatFeed({ activities, emptyTitle, rawLlmPreferenceKey, idPrefix, working = false, className }) {
7489
+ function AgentChatFeed({ activities, emptyTitle, rawLlmPreferenceKey, idPrefix, working = false, toolLabels, className }) {
7114
7490
  const { t } = useTranslate();
7491
+ const labelOf = useMemo(() => {
7492
+ const labels = new Map((toolLabels ?? []).map((entry) => [entry.tool, entry.label]));
7493
+ return (activity) => activity.type === "tool_call" || activity.type === "tool_result" ? labels.get(activity.tool) : void 0;
7494
+ }, [toolLabels]);
7115
7495
  const [showRawLlm, setShowRawLlm] = useState(() => readFlag(rawLlmPreferenceKey));
7116
7496
  const scrollerRef = useRef(null);
7117
7497
  const endRef = useRef(null);
@@ -7165,7 +7545,7 @@ function AgentChatFeed({ activities, emptyTitle, rawLlmPreferenceKey, idPrefix,
7165
7545
  /* @__PURE__ */ jsx(AgentActivityRow, { activity: turn.request, facts: activityRowFacts([turn.request], (a) => a)[0] }),
7166
7546
  /* @__PURE__ */ jsx(Time, { ts: turn.request.timestamp, align: "end" })
7167
7547
  ] }) : null,
7168
- live ? /* @__PURE__ */ jsx(StepRows, { steps: showRawLlm ? turn.steps : turn.steps.filter((s) => s.type !== "llm_response") }) : /* @__PURE__ */ jsx(TurnSteps, { steps: turn.steps, showRawLlm, onToggleRaw: handleToggle, idPrefix, index: i }),
7548
+ live ? /* @__PURE__ */ jsx(StepRows, { steps: showRawLlm ? turn.steps : turn.steps.filter((s) => s.type !== "llm_response"), labelOf }) : /* @__PURE__ */ jsx(TurnSteps, { steps: turn.steps, showRawLlm, onToggleRaw: handleToggle, idPrefix, index: i, labelOf }),
7169
7549
  turn.replies.map((reply, r) => /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "w-full", children: [
7170
7550
  /* @__PURE__ */ jsx(AgentActivityRow, { activity: reply, facts: activityRowFacts([reply], (a) => a)[0] }),
7171
7551
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1 self-start", children: [
@@ -8535,6 +8915,32 @@ var BiologyCanvas = ({
8535
8915
  /* @__PURE__ */ jsx(OrbitalSceneCanvas, { pattern: "biology-canvas", config, width: width ?? 600, height: height ?? 400, callbacks, keyMap, keyUpMap })
8536
8916
  ] }) });
8537
8917
  };
8918
+
8919
+ // src/lib/lessonSegmentUtils.ts
8920
+ function parseMarkdownWithCodeBlocks(content) {
8921
+ const segments = [];
8922
+ const codeBlockRegex = /```([^\n\r]*)\r?\n([\s\S]*?)```/g;
8923
+ let lastIndex = 0;
8924
+ let match;
8925
+ while ((match = codeBlockRegex.exec(content)) !== null) {
8926
+ const before2 = content.slice(lastIndex, match.index);
8927
+ if (before2.trim()) {
8928
+ segments.push({ type: "markdown", content: before2 });
8929
+ }
8930
+ const tokens = match[1].trim().split(/\s+/).filter(Boolean);
8931
+ let rawLanguage = tokens[0] ?? "text";
8932
+ const suffixRunnable = rawLanguage.endsWith("-runnable");
8933
+ const runnable = suffixRunnable || tokens.includes("run");
8934
+ const baseLanguage = suffixRunnable ? rawLanguage.slice(0, -"-runnable".length) || "text" : rawLanguage;
8935
+ segments.push({ type: "code", language: baseLanguage, content: match[2].trim(), runnable });
8936
+ lastIndex = codeBlockRegex.lastIndex;
8937
+ }
8938
+ const remaining = content.slice(lastIndex);
8939
+ if (remaining.trim()) {
8940
+ segments.push({ type: "markdown", content: remaining });
8941
+ }
8942
+ return segments;
8943
+ }
8538
8944
  var BLOOM_CONFIG = {
8539
8945
  remember: { color: "bg-secondary text-secondary-foreground", bgColor: "bg-muted", labelKey: "bloomQuiz.level.remember" },
8540
8946
  understand: { color: "bg-info text-info-foreground", bgColor: "bg-info/10", labelKey: "bloomQuiz.level.understand" },
@@ -9708,8 +10114,8 @@ function MiniMap({
9708
10114
  ...rest
9709
10115
  }) {
9710
10116
  const { t } = useTranslate();
9711
- const canvasRef = React51.useRef(null);
9712
- const imgCacheRef = React51.useRef(/* @__PURE__ */ new Map());
10117
+ const canvasRef = React52.useRef(null);
10118
+ const imgCacheRef = React52.useRef(/* @__PURE__ */ new Map());
9713
10119
  function loadImg(url) {
9714
10120
  const cached = imgCacheRef.current.get(url);
9715
10121
  if (cached) return cached.complete ? cached : null;
@@ -9725,7 +10131,7 @@ function MiniMap({
9725
10131
  imgCacheRef.current.set(url, img);
9726
10132
  return null;
9727
10133
  }
9728
- React51.useEffect(() => {
10134
+ React52.useEffect(() => {
9729
10135
  const canvas = canvasRef.current;
9730
10136
  if (!canvas) return;
9731
10137
  const ctx = canvas.getContext("2d");
@@ -11333,14 +11739,14 @@ function Canvas2D({
11333
11739
  description,
11334
11740
  ...rest
11335
11741
  }) {
11336
- const descId = React51.useId();
11742
+ const descId = React52.useId();
11337
11743
  const instanceId = useMemo(() => Math.random().toString(36).slice(2, 8), []);
11338
11744
  const childDrawablesRef = useRef([]);
11339
11745
  childDrawablesRef.current = [];
11340
11746
  const registerChildDrawable = useCallback((node) => {
11341
11747
  childDrawablesRef.current.push(node);
11342
11748
  }, []);
11343
- const hasJsxChildren = React51.Children.count(children) > 0;
11749
+ const hasJsxChildren = React52.Children.count(children) > 0;
11344
11750
  function isDrawableLayer(node) {
11345
11751
  return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
11346
11752
  }
@@ -11934,6 +12340,7 @@ function Canvas({
11934
12340
  selectEvent,
11935
12341
  moveEvent,
11936
12342
  children,
12343
+ description,
11937
12344
  ...rest
11938
12345
  }) {
11939
12346
  canvasLog.debug("Canvas render", { mode, drawablesCount: drawables?.length, projection, camera: camera ? JSON.stringify(camera) : void 0 });
@@ -11948,12 +12355,13 @@ function Canvas({
11948
12355
  if (mode !== "3d") return;
11949
12356
  const next = childDrawablesRef.current;
11950
12357
  canvasLog.debug("children:adopt", { registered: next.length, adopted: childDrawables.length });
11951
- if (next.length === 0 && React51.Children.count(children) > 0) return;
12358
+ if (next.length === 0 && React52.Children.count(children) > 0) return;
11952
12359
  setChildDrawables(
11953
12360
  (prev) => prev.length === next.length && JSON.stringify(prev) === JSON.stringify(next) ? prev : [...next]
11954
12361
  );
11955
12362
  });
11956
12363
  const { t } = useTranslate();
12364
+ const descId = React52.useId();
11957
12365
  const config3d = useMemo(
11958
12366
  () => ({
11959
12367
  type: "canvas",
@@ -11992,7 +12400,8 @@ function Canvas({
11992
12400
  );
11993
12401
  const allDrawables = useMemo(() => [...drawables ?? [], ...childDrawables], [drawables, childDrawables]);
11994
12402
  if (mode === "3d") {
11995
- return /* @__PURE__ */ jsxs(Fragment, { children: [
12403
+ return /* @__PURE__ */ jsxs("div", { role: "img", "aria-label": t("aria.canvasScene"), ...description ? { "aria-describedby": descId } : {}, ...domPassthrough(rest), className: "contents", children: [
12404
+ description && /* @__PURE__ */ jsx(Box, { id: descId, className: "sr-only", children: description }),
11996
12405
  isLoading ? /* @__PURE__ */ jsx("div", { className: cn("game-canvas-3d game-canvas-3d--loading", className), children: /* @__PURE__ */ jsx("div", { className: "game-canvas-3d__loading", children: t("canvas3d.loadingScene") }) }) : /* @__PURE__ */ jsx(
11997
12406
  OrbitalCanvas3D,
11998
12407
  {
@@ -12010,13 +12419,14 @@ function Canvas({
12010
12419
  ...moveEvent !== void 0 ? { moveEvent } : {}
12011
12420
  }
12012
12421
  ),
12013
- React51.Children.count(children) > 0 && /* @__PURE__ */ jsx(DrawableRegistryContext.Provider, { value: registerChildDrawable, children: /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: { position: "absolute", width: 0, height: 0, overflow: "hidden" }, children }) })
12422
+ React52.Children.count(children) > 0 && /* @__PURE__ */ jsx(DrawableRegistryContext.Provider, { value: registerChildDrawable, children: /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: { position: "absolute", width: 0, height: 0, overflow: "hidden" }, children }) })
12014
12423
  ] });
12015
12424
  }
12016
12425
  return /* @__PURE__ */ jsx(
12017
12426
  Canvas2D,
12018
12427
  {
12019
12428
  ...domPassthrough(rest),
12429
+ ...description !== void 0 ? { description } : {},
12020
12430
  className,
12021
12431
  drawables,
12022
12432
  isLoading,
@@ -13377,11 +13787,13 @@ function ChatBar({
13377
13787
  const focus = editFocus ?? null;
13378
13788
  const requestId = focusRequest?.id;
13379
13789
  const requestPlaceholder = focusRequest?.placeholder;
13790
+ const requestText = focusRequest?.text;
13380
13791
  useEffect(() => {
13381
13792
  if (requestId === void 0) return;
13382
13793
  if (requestPlaceholder !== void 0 && requestPlaceholder.length > 0) setRequestedPlaceholder(requestPlaceholder);
13794
+ if (requestText !== void 0) setInputValue(requestText);
13383
13795
  inputRef.current?.focus();
13384
- }, [requestId, requestPlaceholder]);
13796
+ }, [requestId, requestPlaceholder, requestText]);
13385
13797
  useLayoutEffect(() => {
13386
13798
  const el = inputRef.current;
13387
13799
  if (!el) return;
@@ -14228,7 +14640,7 @@ var Container = ({
14228
14640
  ...rest
14229
14641
  }) => {
14230
14642
  const resolvedSize = maxWidth ?? size ?? "lg";
14231
- return React51__default.createElement(
14643
+ return React52__default.createElement(
14232
14644
  Component,
14233
14645
  {
14234
14646
  ...domPassthrough(rest),
@@ -14514,9 +14926,9 @@ function ControlButton({
14514
14926
  ...rest
14515
14927
  }) {
14516
14928
  const eventBus = useEventBus();
14517
- const [isPressed, setIsPressed] = React51.useState(false);
14929
+ const [isPressed, setIsPressed] = React52.useState(false);
14518
14930
  const actualPressed = pressed ?? isPressed;
14519
- const handlePointerDown = React51.useCallback(
14931
+ const handlePointerDown = React52.useCallback(
14520
14932
  (e) => {
14521
14933
  e.preventDefault();
14522
14934
  if (disabled) return;
@@ -14526,7 +14938,7 @@ function ControlButton({
14526
14938
  },
14527
14939
  [disabled, pressEvent, eventBus, onPress]
14528
14940
  );
14529
- const handlePointerUp = React51.useCallback(
14941
+ const handlePointerUp = React52.useCallback(
14530
14942
  (e) => {
14531
14943
  e.preventDefault();
14532
14944
  if (disabled) return;
@@ -14536,7 +14948,7 @@ function ControlButton({
14536
14948
  },
14537
14949
  [disabled, releaseEvent, eventBus, onRelease]
14538
14950
  );
14539
- const handlePointerLeave = React51.useCallback(
14951
+ const handlePointerLeave = React52.useCallback(
14540
14952
  (e) => {
14541
14953
  if (isPressed) {
14542
14954
  setIsPressed(false);
@@ -14626,18 +15038,18 @@ function ControlGrid({
14626
15038
  const eventBus = useEventBus();
14627
15039
  const { t } = useTranslate();
14628
15040
  const buttons = buttonsProp ?? DEFAULT_BUTTON_KEYS.map(({ labelKey, ...rest2 }) => ({ ...rest2, label: t(labelKey) }));
14629
- const [active, setActive] = React51.useState(/* @__PURE__ */ new Set());
14630
- const [coarse, setCoarse] = React51.useState(
15041
+ const [active, setActive] = React52.useState(/* @__PURE__ */ new Set());
15042
+ const [coarse, setCoarse] = React52.useState(
14631
15043
  () => typeof window !== "undefined" && window.matchMedia("(pointer: coarse)").matches
14632
15044
  );
14633
- React51.useEffect(() => {
15045
+ React52.useEffect(() => {
14634
15046
  if (visibility !== "auto" || typeof window === "undefined") return;
14635
15047
  const mq = window.matchMedia("(pointer: coarse)");
14636
15048
  const onChange = (e) => setCoarse(e.matches);
14637
15049
  mq.addEventListener("change", onChange);
14638
15050
  return () => mq.removeEventListener("change", onChange);
14639
15051
  }, [visibility]);
14640
- const handlePress = React51.useCallback(
15052
+ const handlePress = React52.useCallback(
14641
15053
  (id) => {
14642
15054
  setActive((prev) => new Set(prev).add(id));
14643
15055
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -14651,7 +15063,7 @@ function ControlGrid({
14651
15063
  },
14652
15064
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
14653
15065
  );
14654
- const handleRelease = React51.useCallback(
15066
+ const handleRelease = React52.useCallback(
14655
15067
  (id) => {
14656
15068
  setActive((prev) => {
14657
15069
  const next = new Set(prev);
@@ -15277,7 +15689,7 @@ function SubMenu({
15277
15689
  ),
15278
15690
  children: [
15279
15691
  item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm", className: cn("flex-shrink-0", isDanger && "text-error") }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm", className: cn("flex-shrink-0", isDanger && "text-error") })),
15280
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "flex-1", children: item.label }),
15692
+ /* @__PURE__ */ jsx(MenuItemText, { item }),
15281
15693
  item.badge !== void 0 && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs font-medium", children: item.badge })
15282
15694
  ]
15283
15695
  },
@@ -15288,6 +15700,15 @@ function SubMenu({
15288
15700
  );
15289
15701
  return typeof document !== "undefined" ? /* @__PURE__ */ jsx(ThemedPortal, { children: panel }) : panel;
15290
15702
  }
15703
+ function MenuItemText({ item }) {
15704
+ if (item.description === void 0 || item.description === "") {
15705
+ return /* @__PURE__ */ jsx(Typography, { variant: "small", className: "flex-1", children: item.label });
15706
+ }
15707
+ return /* @__PURE__ */ jsxs(Box, { className: "flex flex-1 min-w-0 flex-col", children: [
15708
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "semibold", children: item.label }),
15709
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: item.description })
15710
+ ] });
15711
+ }
15291
15712
  function MenuItemRow({
15292
15713
  item,
15293
15714
  itemId,
@@ -15346,14 +15767,7 @@ function MenuItemRow({
15346
15767
  ),
15347
15768
  children: /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-3 flex-1 min-w-0", children: [
15348
15769
  item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm", className: cn("flex-shrink-0", isDanger && "text-error") }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm", className: cn("flex-shrink-0", isDanger && "text-error") })),
15349
- /* @__PURE__ */ jsx(
15350
- Typography,
15351
- {
15352
- variant: "small",
15353
- className: "flex-1",
15354
- children: item.label
15355
- }
15356
- ),
15770
+ /* @__PURE__ */ jsx(MenuItemText, { item }),
15357
15771
  item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge }),
15358
15772
  hasSubMenu && /* @__PURE__ */ jsx(
15359
15773
  Icon,
@@ -15401,7 +15815,8 @@ var Menu = ({
15401
15815
  const [subMenuAutoFocus, setSubMenuAutoFocus] = useState(false);
15402
15816
  const [triggerRect, setTriggerRect] = useState(null);
15403
15817
  const triggerRef = useRef(null);
15404
- const [innerControl, setInnerControl] = useState(null);
15818
+ const innerControlRef = useRef(null);
15819
+ const [hasInnerControl, setHasInnerControl] = useState(false);
15405
15820
  const focusReturnRef = useRef(null);
15406
15821
  const menuRef = useRef(null);
15407
15822
  const menuId = useId();
@@ -15447,7 +15862,7 @@ var Menu = ({
15447
15862
  updatePosition();
15448
15863
  setIsOpen(true);
15449
15864
  };
15450
- focusReturnRef.current = innerControl ?? triggerRef.current;
15865
+ focusReturnRef.current = innerControlRef.current ?? triggerRef.current;
15451
15866
  useDialogBehavior({ open: isOpen, containerRef: menuRef, onEscape: closeMenu, modal: false, returnFocusRef: focusReturnRef });
15452
15867
  const panelMounted = isOpen && triggerRect !== null;
15453
15868
  useEffect(() => {
@@ -15464,17 +15879,18 @@ var Menu = ({
15464
15879
  "aria-expanded": isOpen,
15465
15880
  ...isOpen ? { "aria-controls": menuId } : void 0
15466
15881
  };
15467
- const wrapsTrigger = !React51__default.isValidElement(trigger);
15468
- useLayoutEffect(() => {
15469
- setInnerControl(wrapsTrigger ? triggerRef.current?.querySelector(TRIGGER_CONTROL_SELECTOR) ?? null : null);
15470
- }, [wrapsTrigger, trigger]);
15882
+ const wrapsTrigger = !React52__default.isValidElement(trigger);
15471
15883
  useLayoutEffect(() => {
15472
- if (!innerControl) return;
15473
- innerControl.setAttribute("aria-haspopup", "menu");
15474
- innerControl.setAttribute("aria-expanded", String(isOpen));
15475
- if (isOpen) innerControl.setAttribute("aria-controls", menuId);
15476
- else innerControl.removeAttribute("aria-controls");
15477
- }, [innerControl, isOpen, menuId]);
15884
+ const control = wrapsTrigger ? triggerRef.current?.querySelector(TRIGGER_CONTROL_SELECTOR) ?? null : null;
15885
+ innerControlRef.current = control;
15886
+ focusReturnRef.current = control ?? triggerRef.current;
15887
+ if (control !== null !== hasInnerControl) setHasInnerControl(control !== null);
15888
+ if (!control) return;
15889
+ control.setAttribute("aria-haspopup", "menu");
15890
+ control.setAttribute("aria-expanded", String(isOpen));
15891
+ if (isOpen) control.setAttribute("aria-controls", menuId);
15892
+ else control.removeAttribute("aria-controls");
15893
+ });
15478
15894
  useEffect(() => {
15479
15895
  if (isOpen) {
15480
15896
  updatePosition();
@@ -15502,7 +15918,7 @@ var Menu = ({
15502
15918
  "bottom-end": "bottom-start"
15503
15919
  };
15504
15920
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
15505
- const triggerElement = React51__default.isValidElement(trigger) ? React51__default.cloneElement(trigger, {
15921
+ const triggerElement = React52__default.isValidElement(trigger) ? React52__default.cloneElement(trigger, {
15506
15922
  ref: triggerRef,
15507
15923
  onClick: handleToggle,
15508
15924
  onKeyDown: onTriggerKeyDown,
@@ -15515,9 +15931,9 @@ var Menu = ({
15515
15931
  triggerRef.current = el;
15516
15932
  },
15517
15933
  onClick: handleToggle,
15518
- ...innerControl ? void 0 : { role: "button", tabIndex: 0, ...triggerA11y },
15934
+ ...hasInnerControl ? void 0 : { role: "button", tabIndex: 0, ...triggerA11y },
15519
15935
  onKeyDown: (e) => {
15520
- if (!innerControl && (e.key === "Enter" || e.key === " ")) {
15936
+ if (!hasInnerControl && (e.key === "Enter" || e.key === " ")) {
15521
15937
  e.preventDefault();
15522
15938
  handleToggle();
15523
15939
  } else {
@@ -15692,6 +16108,12 @@ var DashboardLayout = ({
15692
16108
  onSignOutProp?.();
15693
16109
  };
15694
16110
  const showSidebar = layoutMode === "sidebar" || isDrawer;
16111
+ const sidebarRef = useRef(null);
16112
+ useDialogBehavior({
16113
+ open: showSidebar && offCanvas && sidebarOpen,
16114
+ containerRef: sidebarRef,
16115
+ onEscape: () => setSidebarOpen(false)
16116
+ });
15695
16117
  const showHeader = layoutMode !== "minimal";
15696
16118
  const showBottomNav = layoutMode === "bottomnav";
15697
16119
  const isTopNav = layoutMode === "topnav";
@@ -15726,6 +16148,7 @@ var DashboardLayout = ({
15726
16148
  Box,
15727
16149
  {
15728
16150
  as: "aside",
16151
+ ref: sidebarRef,
15729
16152
  inert: offCanvas && !sidebarOpen ? true : void 0,
15730
16153
  className: cn(
15731
16154
  "z-30 flex-shrink-0 bg-card surface-material border-e-[length:var(--border-width)] border-border",
@@ -16490,7 +16913,7 @@ var almadarDndCollisionDetection = (args) => {
16490
16913
  return closestCorners(args);
16491
16914
  };
16492
16915
  var dndLog = createLogger("almadar:ui:dnd");
16493
- var RootCtx = React51__default.createContext(null);
16916
+ var RootCtx = React52__default.createContext(null);
16494
16917
  function useDataDnd(args) {
16495
16918
  const {
16496
16919
  dragGroup,
@@ -16507,14 +16930,14 @@ function useDataDnd(args) {
16507
16930
  const isZone = Boolean(dragGroup || accepts2 || sortable);
16508
16931
  const enabled = isZone || Boolean(dndRoot);
16509
16932
  const eventBus = useEventBus();
16510
- const parentRoot = React51__default.useContext(RootCtx);
16933
+ const parentRoot = React52__default.useContext(RootCtx);
16511
16934
  const isRoot = enabled && parentRoot === null;
16512
- const zoneId = React51__default.useId();
16935
+ const zoneId = React52__default.useId();
16513
16936
  const ownGroup = dragGroup ?? accepts2 ?? zoneId;
16514
- const [optimisticOrders, setOptimisticOrders] = React51__default.useState(() => /* @__PURE__ */ new Map());
16515
- const optimisticOrdersRef = React51__default.useRef(optimisticOrders);
16937
+ const [optimisticOrders, setOptimisticOrders] = React52__default.useState(() => /* @__PURE__ */ new Map());
16938
+ const optimisticOrdersRef = React52__default.useRef(optimisticOrders);
16516
16939
  optimisticOrdersRef.current = optimisticOrders;
16517
- const clearOptimisticOrder = React51__default.useCallback((group) => {
16940
+ const clearOptimisticOrder = React52__default.useCallback((group) => {
16518
16941
  setOptimisticOrders((prev) => {
16519
16942
  if (!prev.has(group)) return prev;
16520
16943
  const next = new Map(prev);
@@ -16539,7 +16962,7 @@ function useDataDnd(args) {
16539
16962
  const raw = it[dndItemIdField];
16540
16963
  return raw != null ? String(raw) : `__idx_${idx}`;
16541
16964
  }).join("|");
16542
- const itemIds = React51__default.useMemo(
16965
+ const itemIds = React52__default.useMemo(
16543
16966
  () => orderedItems.map((it, idx) => {
16544
16967
  const raw = it[dndItemIdField];
16545
16968
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -16550,7 +16973,7 @@ function useDataDnd(args) {
16550
16973
  const raw = it[dndItemIdField];
16551
16974
  return raw != null ? String(raw) : `__${idx}`;
16552
16975
  }).join("|");
16553
- React51__default.useEffect(() => {
16976
+ React52__default.useEffect(() => {
16554
16977
  const root = isRoot ? null : parentRoot;
16555
16978
  if (root) {
16556
16979
  root.clearOptimisticOrder(ownGroup);
@@ -16558,20 +16981,20 @@ function useDataDnd(args) {
16558
16981
  clearOptimisticOrder(ownGroup);
16559
16982
  }
16560
16983
  }, [itemsContentSig, ownGroup]);
16561
- const zonesRef = React51__default.useRef(/* @__PURE__ */ new Map());
16562
- const registerZone = React51__default.useCallback((zoneId2, meta2) => {
16984
+ const zonesRef = React52__default.useRef(/* @__PURE__ */ new Map());
16985
+ const registerZone = React52__default.useCallback((zoneId2, meta2) => {
16563
16986
  zonesRef.current.set(zoneId2, meta2);
16564
16987
  }, []);
16565
- const unregisterZone = React51__default.useCallback((zoneId2) => {
16988
+ const unregisterZone = React52__default.useCallback((zoneId2) => {
16566
16989
  zonesRef.current.delete(zoneId2);
16567
16990
  }, []);
16568
- const [activeDrag, setActiveDrag] = React51__default.useState(null);
16569
- const [overZoneGroup, setOverZoneGroup] = React51__default.useState(null);
16570
- const meta = React51__default.useMemo(
16991
+ const [activeDrag, setActiveDrag] = React52__default.useState(null);
16992
+ const [overZoneGroup, setOverZoneGroup] = React52__default.useState(null);
16993
+ const meta = React52__default.useMemo(
16571
16994
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
16572
16995
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
16573
16996
  );
16574
- React51__default.useEffect(() => {
16997
+ React52__default.useEffect(() => {
16575
16998
  const target = isRoot ? null : parentRoot;
16576
16999
  if (!target) {
16577
17000
  zonesRef.current.set(zoneId, meta);
@@ -16590,7 +17013,7 @@ function useDataDnd(args) {
16590
17013
  }, [parentRoot, isRoot, zoneId, meta]);
16591
17014
  const sensors = useAlmadarDndSensors(true);
16592
17015
  const collisionDetection = almadarDndCollisionDetection;
16593
- const findZoneByItem = React51__default.useCallback(
17016
+ const findZoneByItem = React52__default.useCallback(
16594
17017
  (id) => {
16595
17018
  for (const z of zonesRef.current.values()) {
16596
17019
  if (z.itemIds.includes(id)) return z;
@@ -16599,7 +17022,7 @@ function useDataDnd(args) {
16599
17022
  },
16600
17023
  []
16601
17024
  );
16602
- React51__default.useCallback(
17025
+ React52__default.useCallback(
16603
17026
  (group) => {
16604
17027
  for (const z of zonesRef.current.values()) {
16605
17028
  if (z.group === group) return z;
@@ -16608,7 +17031,7 @@ function useDataDnd(args) {
16608
17031
  },
16609
17032
  []
16610
17033
  );
16611
- const handleDragEnd = React51__default.useCallback(
17034
+ const handleDragEnd = React52__default.useCallback(
16612
17035
  (event) => {
16613
17036
  const { active, over } = event;
16614
17037
  const activeIdStr = String(active.id);
@@ -16699,8 +17122,8 @@ function useDataDnd(args) {
16699
17122
  },
16700
17123
  [eventBus]
16701
17124
  );
16702
- const sortableData = React51__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
16703
- const SortableItem = React51__default.useCallback(
17125
+ const sortableData = React52__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
17126
+ const SortableItem = React52__default.useCallback(
16704
17127
  ({ id, children }) => {
16705
17128
  const {
16706
17129
  attributes,
@@ -16742,7 +17165,7 @@ function useDataDnd(args) {
16742
17165
  id: droppableId,
16743
17166
  data: sortableData
16744
17167
  });
16745
- const ctx = React51__default.useContext(RootCtx);
17168
+ const ctx = React52__default.useContext(RootCtx);
16746
17169
  const activeDrag2 = ctx?.activeDrag ?? null;
16747
17170
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
16748
17171
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -16757,7 +17180,7 @@ function useDataDnd(args) {
16757
17180
  showForeignPlaceholder,
16758
17181
  ctxAvailable: ctx != null
16759
17182
  });
16760
- React51__default.useEffect(() => {
17183
+ React52__default.useEffect(() => {
16761
17184
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
16762
17185
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
16763
17186
  return /* @__PURE__ */ jsx(
@@ -16771,11 +17194,11 @@ function useDataDnd(args) {
16771
17194
  }
16772
17195
  );
16773
17196
  };
16774
- const rootContextValue = React51__default.useMemo(
17197
+ const rootContextValue = React52__default.useMemo(
16775
17198
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
16776
17199
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
16777
17200
  );
16778
- const handleDragStart = React51__default.useCallback((event) => {
17201
+ const handleDragStart = React52__default.useCallback((event) => {
16779
17202
  const sourceZone = findZoneByItem(event.active.id);
16780
17203
  const rect = event.active.rect.current.initial;
16781
17204
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -16794,7 +17217,7 @@ function useDataDnd(args) {
16794
17217
  isRoot
16795
17218
  });
16796
17219
  }, [findZoneByItem, isRoot, zoneId]);
16797
- const handleDragOver = React51__default.useCallback((event) => {
17220
+ const handleDragOver = React52__default.useCallback((event) => {
16798
17221
  const { active, over } = event;
16799
17222
  const overData = over?.data?.current;
16800
17223
  const overGroup = overData?.dndGroup ?? null;
@@ -16864,7 +17287,7 @@ function useDataDnd(args) {
16864
17287
  return next;
16865
17288
  });
16866
17289
  }, []);
16867
- const handleDragCancel = React51__default.useCallback((event) => {
17290
+ const handleDragCancel = React52__default.useCallback((event) => {
16868
17291
  setActiveDrag(null);
16869
17292
  setOverZoneGroup(null);
16870
17293
  dndLog.warn("dragCancel", {
@@ -16872,12 +17295,12 @@ function useDataDnd(args) {
16872
17295
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
16873
17296
  });
16874
17297
  }, []);
16875
- const handleDragEndWithCleanup = React51__default.useCallback((event) => {
17298
+ const handleDragEndWithCleanup = React52__default.useCallback((event) => {
16876
17299
  handleDragEnd(event);
16877
17300
  setActiveDrag(null);
16878
17301
  setOverZoneGroup(null);
16879
17302
  }, [handleDragEnd]);
16880
- const wrapContainer = React51__default.useCallback(
17303
+ const wrapContainer = React52__default.useCallback(
16881
17304
  (children) => {
16882
17305
  if (!enabled) return children;
16883
17306
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -17156,6 +17579,7 @@ function DataGrid({
17156
17579
  {
17157
17580
  "data-grid-layout": asRows ? "rows" : "cards",
17158
17581
  "data-item-move-root": nestedMoves.id,
17582
+ ...scrollX ? { role: "region", tabIndex: 0, "aria-label": t("aria.scrollableBoard") } : {},
17159
17583
  className: cn(
17160
17584
  asRows ? cn("flex flex-col divide-y divide-border", contentSurface.className && cn(contentSurface.className, "overflow-hidden")) : cn("grid", gapStyles3[gap], scrollX ? "grid-flow-col overflow-x-auto snap-x snap-mandatory [&>*]:snap-start pb-2" : colsClass, lookStyles3[look]),
17161
17585
  className
@@ -17512,7 +17936,7 @@ function DataList({
17512
17936
  const { t } = useTranslate();
17513
17937
  const fmt = useFormatContext();
17514
17938
  const contentSurface = useContentSurface(look === "card-rows" ? "none" : surface);
17515
- const [visibleCount, setVisibleCount] = React51__default.useState(pageSize || Infinity);
17939
+ const [visibleCount, setVisibleCount] = React52__default.useState(pageSize || Infinity);
17516
17940
  const fieldDefs = fields ?? columns ?? [];
17517
17941
  const allDataRaw = entityRows(entity);
17518
17942
  const dnd = useDataDnd({
@@ -17528,7 +17952,7 @@ function DataList({
17528
17952
  dndRoot
17529
17953
  });
17530
17954
  const orderedData = dnd.orderedItems;
17531
- const allData = React51__default.useMemo(
17955
+ const allData = React52__default.useMemo(
17532
17956
  () => sortRows(orderedData, sortBy, sortDirection),
17533
17957
  [orderedData, sortBy, sortDirection]
17534
17958
  );
@@ -17537,7 +17961,7 @@ function DataList({
17537
17961
  const renderItemFn = typeof schemaRenderItem === "function" ? schemaRenderItem : void 0;
17538
17962
  const itemRenderer = typeof children === "function" ? children : renderItemFn;
17539
17963
  const hasRenderProp = typeof itemRenderer === "function";
17540
- React51__default.useEffect(() => {
17964
+ React52__default.useEffect(() => {
17541
17965
  const renderItemTypeOf = typeof schemaRenderItem;
17542
17966
  const childrenTypeOf = typeof children;
17543
17967
  if (data.length > 0 && !hasRenderProp) {
@@ -17670,7 +18094,7 @@ function DataList({
17670
18094
  return v === void 0 || v === null || v === "" ? raw : String(v);
17671
18095
  };
17672
18096
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), "data-item-move-root": moves.root, children: [
17673
- groups2.map((group, gi) => /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
18097
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
17674
18098
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
17675
18099
  group.items.map((itemData, index) => {
17676
18100
  const id = itemData.id || `${gi}-${index}`;
@@ -17956,7 +18380,7 @@ function DataList({
17956
18380
  className
17957
18381
  ),
17958
18382
  children: [
17959
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
18383
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
17960
18384
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
17961
18385
  group.items.map(
17962
18386
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -18339,12 +18763,12 @@ var MapViewImpl = lazy(async () => {
18339
18763
  shadowSize: [41, 41]
18340
18764
  });
18341
18765
  L.Marker.prototype.options.icon = defaultIcon;
18342
- const { useEffect: useEffect73, useRef: useRef62, useCallback: useCallback85, useState: useState98 } = React51__default;
18766
+ const { useEffect: useEffect73, useRef: useRef63, useCallback: useCallback86, useState: useState99 } = React52__default;
18343
18767
  const { Typography: Typography2 } = await import('./core.js');
18344
18768
  const { useEventBus: useEventBus2 } = await import('./core.js');
18345
18769
  function MapUpdater({ centerLat, centerLng, zoom }) {
18346
18770
  const map = useMap();
18347
- const prevRef = useRef62({ centerLat, centerLng, zoom });
18771
+ const prevRef = useRef63({ centerLat, centerLng, zoom });
18348
18772
  useEffect73(() => {
18349
18773
  const prev = prevRef.current;
18350
18774
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
@@ -18389,8 +18813,8 @@ var MapViewImpl = lazy(async () => {
18389
18813
  const centerLng = centerLngProp ?? DEFAULT_CENTER_LNG;
18390
18814
  const contentSurface = useContentSurface(surface);
18391
18815
  const eventBus = useEventBus2();
18392
- const [clickedPosition, setClickedPosition] = useState98(null);
18393
- const handleMapClick = useCallback85((lat, lng) => {
18816
+ const [clickedPosition, setClickedPosition] = useState99(null);
18817
+ const handleMapClick = useCallback86((lat, lng) => {
18394
18818
  if (showClickedPin) {
18395
18819
  setClickedPosition({ lat, lng });
18396
18820
  }
@@ -18399,7 +18823,7 @@ var MapViewImpl = lazy(async () => {
18399
18823
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
18400
18824
  }
18401
18825
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
18402
- const handleMarkerClick = useCallback85((marker) => {
18826
+ const handleMarkerClick = useCallback86((marker) => {
18403
18827
  onMarkerClick?.(marker);
18404
18828
  if (markerClickEvent) {
18405
18829
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -18526,7 +18950,7 @@ var WizardProgress = ({
18526
18950
  const isActive = index === currentStep;
18527
18951
  const isCompleted = index < currentStep;
18528
18952
  const canNavigate = isCompleted && allowNavigation;
18529
- return /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
18953
+ return /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
18530
18954
  /* @__PURE__ */ jsx(
18531
18955
  Button,
18532
18956
  {
@@ -19050,8 +19474,8 @@ function TableView({
19050
19474
  const rowActions = useRowActions();
19051
19475
  const { t } = useTranslate();
19052
19476
  const fmt = useFormatContext();
19053
- const [visibleCount, setVisibleCount] = React51__default.useState(pageSize > 0 ? pageSize : Infinity);
19054
- const [localSelected, setLocalSelected] = React51__default.useState(/* @__PURE__ */ new Set());
19477
+ const [visibleCount, setVisibleCount] = React52__default.useState(pageSize > 0 ? pageSize : Infinity);
19478
+ const [localSelected, setLocalSelected] = React52__default.useState(/* @__PURE__ */ new Set());
19055
19479
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
19056
19480
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
19057
19481
  const { fire: fireRowAction, isRowPending } = useRowActionFire();
@@ -19073,7 +19497,7 @@ function TableView({
19073
19497
  const hasMore = pageSize > 0 && visibleCount < ordered.length;
19074
19498
  const hasRenderProp = typeof children === "function";
19075
19499
  const idField = dndItemIdField ?? "id";
19076
- React51__default.useEffect(() => {
19500
+ React52__default.useEffect(() => {
19077
19501
  tableViewLog.debug("render", {
19078
19502
  rowCount: data.length,
19079
19503
  colCount: colDefs.length,
@@ -19122,7 +19546,7 @@ function TableView({
19122
19546
  };
19123
19547
  eventBus.emit(`UI:${itemClickEvent}`, payload);
19124
19548
  };
19125
- const colFloors = React51__default.useMemo(
19549
+ const colFloors = React52__default.useMemo(
19126
19550
  () => colDefs.map((col) => {
19127
19551
  const longest = data.reduce((widest, row) => {
19128
19552
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format, relationsData?.[col.field ?? col.key], fmt);
@@ -19270,7 +19694,7 @@ function TableView({
19270
19694
  const label = relationDisplay ?? col.labels?.[String(raw)] ?? (typeof raw === "boolean" ? formatValue(raw, "boolean", fmt) : valueLabelFor(String(raw), col.labels));
19271
19695
  return /* @__PURE__ */ jsxs(Box, { role: "cell", className: cellBase, children: [
19272
19696
  stackedLabel,
19273
- asControl(/* @__PURE__ */ jsx(Badge, { variant: badgeVariantFor(String(raw), col.colorMap), size: "sm", className: "whitespace-nowrap", children: label }))
19697
+ asControl(/* @__PURE__ */ jsx(Badge, { variant: badgeVariantFor(String(raw), col.colorMap), size: "sm", icon: col.iconMap?.[String(raw)], className: "whitespace-nowrap", children: label }))
19274
19698
  ] }, col.key);
19275
19699
  }
19276
19700
  return /* @__PURE__ */ jsxs(Box, { role: "cell", className: cellBase, children: [
@@ -19314,12 +19738,12 @@ function TableView({
19314
19738
  ]
19315
19739
  }
19316
19740
  );
19317
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React51__default.Fragment, { children: rowInner }, id);
19741
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React52__default.Fragment, { children: rowInner }, id);
19318
19742
  };
19319
19743
  const items = Array.from(data);
19320
19744
  const groups = groupBy ? groupRows(items, groupBy) : [{ label: "", items }];
19321
19745
  let runningIndex = 0;
19322
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
19746
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
19323
19747
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
19324
19748
  group.items.map((row) => renderRow(row, runningIndex++))
19325
19749
  ] }, gi)) });
@@ -19396,7 +19820,7 @@ var Timeline = ({
19396
19820
  const { t } = useTranslate();
19397
19821
  const fmt = useFormatContext();
19398
19822
  const entityData = entityRows(entity);
19399
- const items = React51__default.useMemo(() => {
19823
+ const items = React52__default.useMemo(() => {
19400
19824
  if (propItems && propItems.length > 0) return propItems;
19401
19825
  if (entityData.length === 0) return [];
19402
19826
  return entityData.map((record, idx) => {
@@ -20076,7 +20500,7 @@ var DetailPanel = ({
20076
20500
  const fmt = useFormatContext();
20077
20501
  const ctx = { locale, t, fmt };
20078
20502
  const contained = useContext(SlotContainedContext);
20079
- const [titleDraft, setTitleDraft] = React51__default.useState(null);
20503
+ const [titleDraft, setTitleDraft] = React52__default.useState(null);
20080
20504
  const isFieldDefArray = (arr) => {
20081
20505
  if (!arr || arr.length === 0) return false;
20082
20506
  const first = arr[0];
@@ -20491,7 +20915,7 @@ var DocBreadcrumb = ({
20491
20915
  "aria-label": rest["aria-label"] ?? t("aria.breadcrumb"),
20492
20916
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
20493
20917
  const isLast = idx === items.length - 1;
20494
- return /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
20918
+ return /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
20495
20919
  idx > 0 && /* @__PURE__ */ jsx(
20496
20920
  Icon,
20497
20921
  {
@@ -21920,7 +22344,7 @@ var DocumentViewer = ({
21920
22344
  };
21921
22345
  DocumentViewer.displayName = "DocumentViewer";
21922
22346
  function extractTitle(children) {
21923
- if (!React51__default.isValidElement(children)) return void 0;
22347
+ if (!React52__default.isValidElement(children)) return void 0;
21924
22348
  const props = children.props;
21925
22349
  if (typeof props.title === "string") {
21926
22350
  return props.title;
@@ -21960,14 +22384,6 @@ var DrawerSlot = ({
21960
22384
  );
21961
22385
  };
21962
22386
  DrawerSlot.displayName = "DrawerSlot";
21963
- var colorTokenVars = {
21964
- primary: "var(--color-primary)",
21965
- secondary: "var(--color-secondary)",
21966
- success: "var(--color-success)",
21967
- warning: "var(--color-warning)",
21968
- error: "var(--color-error)",
21969
- muted: "var(--color-muted)"
21970
- };
21971
22387
  function ArchSVG({
21972
22388
  facing,
21973
22389
  w,
@@ -22105,7 +22521,7 @@ var EdgeDecoration = ({
22105
22521
  }) => {
22106
22522
  const id = useId();
22107
22523
  const Variant = VARIANT_MAP[variant];
22108
- const resolvedColor = color in colorTokenVars ? colorTokenVars[color] : color;
22524
+ const resolvedColor = resolveColorToken(color);
22109
22525
  const sides = side === "both" ? ["left", "right"] : [side];
22110
22526
  return /* @__PURE__ */ jsx(Fragment, { children: sides.map((s) => /* @__PURE__ */ jsx(
22111
22527
  "svg",
@@ -23099,7 +23515,7 @@ var Flex = ({
23099
23515
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
23100
23516
  }
23101
23517
  }
23102
- return React51__default.createElement(Component, {
23518
+ return React52__default.createElement(Component, {
23103
23519
  ...domPassthrough(rest),
23104
23520
  className: cn(
23105
23521
  inline ? "inline-flex" : "flex",
@@ -23559,8 +23975,8 @@ var FormField = ({
23559
23975
  children,
23560
23976
  ...rest
23561
23977
  }) => {
23562
- const generatedId = React51__default.useId();
23563
- const field = React51__default.Children.count(children) === 1 && React51__default.isValidElement(children) ? children : null;
23978
+ const generatedId = React52__default.useId();
23979
+ const field = React52__default.Children.count(children) === 1 && React52__default.isValidElement(children) ? children : null;
23564
23980
  const fieldId = field ? field.props.id ?? generatedId : void 0;
23565
23981
  const baseId = fieldId ?? generatedId;
23566
23982
  const hintId = `${baseId}-hint`;
@@ -23568,7 +23984,7 @@ var FormField = ({
23568
23984
  const describedBy = [field?.props["aria-describedby"], error ? errorId : hint ? hintId : void 0].filter(Boolean).join(" ") || void 0;
23569
23985
  return /* @__PURE__ */ jsxs(VStack, { ...domPassthrough(rest), gap: "xs", className, children: [
23570
23986
  /* @__PURE__ */ jsx(Label, { required, htmlFor: fieldId, children: label }),
23571
- field ? React51__default.cloneElement(field, {
23987
+ field ? React52__default.cloneElement(field, {
23572
23988
  id: fieldId,
23573
23989
  "aria-describedby": describedBy,
23574
23990
  "aria-invalid": error ? true : field.props["aria-invalid"]
@@ -23724,7 +24140,7 @@ var Form = ({
23724
24140
  const isSchemaEntity = isOrbitalEntitySchema(entity);
23725
24141
  const resolvedEntity = isSchemaEntity ? entity : void 0;
23726
24142
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
23727
- const normalizedInitialData = React51__default.useMemo(() => {
24143
+ const normalizedInitialData = React52__default.useMemo(() => {
23728
24144
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
23729
24145
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
23730
24146
  const merged = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
@@ -23744,7 +24160,7 @@ var Form = ({
23744
24160
  }
23745
24161
  return normalized;
23746
24162
  }, [entity, initialData]);
23747
- const entityDerivedFields = React51__default.useMemo(() => {
24163
+ const entityDerivedFields = React52__default.useMemo(() => {
23748
24164
  if (fields && fields.length > 0) return void 0;
23749
24165
  if (!resolvedEntity) return void 0;
23750
24166
  return resolvedEntity.fields.map(
@@ -23765,18 +24181,18 @@ var Form = ({
23765
24181
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
23766
24182
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
23767
24183
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
23768
- const [formData, setFormData] = React51__default.useState(
24184
+ const [formData, setFormData] = React52__default.useState(
23769
24185
  normalizedInitialData
23770
24186
  );
23771
- const [collapsedSections, setCollapsedSections] = React51__default.useState(
24187
+ const [collapsedSections, setCollapsedSections] = React52__default.useState(
23772
24188
  /* @__PURE__ */ new Set()
23773
24189
  );
23774
- const [submitError, setSubmitError] = React51__default.useState(null);
23775
- const formRef = React51__default.useRef(null);
23776
- const formUid = React51__default.useId();
24190
+ const [submitError, setSubmitError] = React52__default.useState(null);
24191
+ const formRef = React52__default.useRef(null);
24192
+ const formUid = React52__default.useId();
23777
24193
  const fieldDomId = (name) => `${formUid}-${name}`;
23778
- const [fieldErrors, setFieldErrors] = React51__default.useState({});
23779
- const [invalidFields, setInvalidFields] = React51__default.useState([]);
24194
+ const [fieldErrors, setFieldErrors] = React52__default.useState({});
24195
+ const [invalidFields, setInvalidFields] = React52__default.useState([]);
23780
24196
  const fieldElement = (name) => formRef.current?.querySelector(
23781
24197
  `[data-field-name=${JSON.stringify(name)}]`
23782
24198
  ) ?? null;
@@ -23796,7 +24212,7 @@ var Form = ({
23796
24212
  if (message === null) setInvalidFields((prev) => prev.includes(name) ? prev.filter((n) => n !== name) : prev);
23797
24213
  };
23798
24214
  const formMode = props.mode;
23799
- const mountedRef = React51__default.useRef(false);
24215
+ const mountedRef = React52__default.useRef(false);
23800
24216
  if (!mountedRef.current) {
23801
24217
  mountedRef.current = true;
23802
24218
  debug("forms", "mount", {
@@ -23809,7 +24225,7 @@ var Form = ({
23809
24225
  });
23810
24226
  }
23811
24227
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
23812
- const evalContext = React51__default.useMemo(
24228
+ const evalContext = React52__default.useMemo(
23813
24229
  () => ({
23814
24230
  formValues: formData,
23815
24231
  globalVariables: externalContext?.globalVariables ?? {},
@@ -23818,7 +24234,7 @@ var Form = ({
23818
24234
  }),
23819
24235
  [formData, externalContext]
23820
24236
  );
23821
- React51__default.useEffect(() => {
24237
+ React52__default.useEffect(() => {
23822
24238
  debug("forms", "initialData-sync", {
23823
24239
  mode: formMode,
23824
24240
  normalizedInitialData,
@@ -23829,7 +24245,7 @@ var Form = ({
23829
24245
  setFormData(normalizedInitialData);
23830
24246
  }
23831
24247
  }, [normalizedInitialData]);
23832
- const processCalculations = React51__default.useCallback(
24248
+ const processCalculations = React52__default.useCallback(
23833
24249
  (changedFieldId, newFormData) => {
23834
24250
  if (!hiddenCalculations.length) return;
23835
24251
  const context = {
@@ -23859,7 +24275,7 @@ var Form = ({
23859
24275
  },
23860
24276
  [hiddenCalculations, externalContext, eventBus]
23861
24277
  );
23862
- const checkViolations = React51__default.useCallback(
24278
+ const checkViolations = React52__default.useCallback(
23863
24279
  (changedFieldId, newFormData) => {
23864
24280
  if (!violationTriggers.length) return;
23865
24281
  const context = {
@@ -23903,7 +24319,7 @@ var Form = ({
23903
24319
  processCalculations(name, newFormData);
23904
24320
  checkViolations(name, newFormData);
23905
24321
  };
23906
- const conditionVerdicts = React51__default.useMemo(() => {
24322
+ const conditionVerdicts = React52__default.useMemo(() => {
23907
24323
  const keyed = [];
23908
24324
  for (const [name, condition] of Object.entries(conditionalFields)) {
23909
24325
  keyed.push({ key: `field:${name}`, condition });
@@ -23914,14 +24330,14 @@ var Form = ({
23914
24330
  const holds = guardsHold(toEvalContext(evalContext), keyed.map((k) => k.condition));
23915
24331
  return new Map(keyed.map((k, i) => [k.key, holds[i]]));
23916
24332
  }, [conditionalFields, sections, evalContext]);
23917
- const isFieldVisible = React51__default.useCallback(
24333
+ const isFieldVisible = React52__default.useCallback(
23918
24334
  (fieldName2) => {
23919
24335
  if (!conditionalFields[fieldName2]) return true;
23920
24336
  return conditionVerdicts.get(`field:${fieldName2}`) ?? true;
23921
24337
  },
23922
24338
  [conditionalFields, conditionVerdicts]
23923
24339
  );
23924
- const isSectionVisible = React51__default.useCallback(
24340
+ const isSectionVisible = React52__default.useCallback(
23925
24341
  (section) => {
23926
24342
  if (!section.condition) return true;
23927
24343
  return conditionVerdicts.get(`section:${section.id}`) ?? true;
@@ -23962,7 +24378,7 @@ var Form = ({
23962
24378
  }
23963
24379
  });
23964
24380
  };
23965
- const invalidScheduled = React51__default.useRef(false);
24381
+ const invalidScheduled = React52__default.useRef(false);
23966
24382
  const handleInvalid = (e) => {
23967
24383
  const target = e.target;
23968
24384
  if (!(target instanceof HTMLElement)) return;
@@ -23996,9 +24412,9 @@ var Form = ({
23996
24412
  });
23997
24413
  });
23998
24414
  };
23999
- const handleInvalidRef = React51__default.useRef(handleInvalid);
24415
+ const handleInvalidRef = React52__default.useRef(handleInvalid);
24000
24416
  handleInvalidRef.current = handleInvalid;
24001
- React51__default.useEffect(() => {
24417
+ React52__default.useEffect(() => {
24002
24418
  const form = formRef.current;
24003
24419
  if (!form) return;
24004
24420
  const listener = (e) => handleInvalidRef.current(e);
@@ -24013,7 +24429,7 @@ var Form = ({
24013
24429
  eventBus.emit(`UI:${onCancel}`);
24014
24430
  }
24015
24431
  };
24016
- const renderField = React51__default.useCallback(
24432
+ const renderField = React52__default.useCallback(
24017
24433
  (field) => {
24018
24434
  const fieldName2 = field.name || field.field;
24019
24435
  if (!fieldName2) return null;
@@ -24037,7 +24453,7 @@ var Form = ({
24037
24453
  [formData, fieldErrors, isFieldVisible, relationsData, relationsLoading, isLoading]
24038
24454
  );
24039
24455
  const effectiveFields = entityDerivedFields ?? fields;
24040
- const normalizedFields = React51__default.useMemo(() => {
24456
+ const normalizedFields = React52__default.useMemo(() => {
24041
24457
  if (!effectiveFields || effectiveFields.length === 0) return [];
24042
24458
  return effectiveFields.map((field) => {
24043
24459
  if (typeof field === "string") {
@@ -24072,7 +24488,7 @@ var Form = ({
24072
24488
  };
24073
24489
  });
24074
24490
  }, [effectiveFields, resolvedEntity, fieldOverrides]);
24075
- const schemaFields = React51__default.useMemo(() => {
24491
+ const schemaFields = React52__default.useMemo(() => {
24076
24492
  if (normalizedFields.length === 0) return null;
24077
24493
  if (isDebugEnabled()) {
24078
24494
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -24082,7 +24498,7 @@ var Form = ({
24082
24498
  }
24083
24499
  return normalizedFields.map(renderField).filter(Boolean);
24084
24500
  }, [normalizedFields, renderField, entityName, conditionalFields]);
24085
- const sectionElements = React51__default.useMemo(() => {
24501
+ const sectionElements = React52__default.useMemo(() => {
24086
24502
  if (!sections || sections.length === 0) return null;
24087
24503
  return sections.map((section) => {
24088
24504
  if (!isSectionVisible(section)) {
@@ -24458,7 +24874,7 @@ var FormSection = ({
24458
24874
  className,
24459
24875
  ...rest
24460
24876
  }) => {
24461
- const [collapsed, setCollapsed] = React51__default.useState(defaultCollapsed);
24877
+ const [collapsed, setCollapsed] = React52__default.useState(defaultCollapsed);
24462
24878
  const { t } = useTranslate();
24463
24879
  const eventBus = useEventBus();
24464
24880
  const gridClass = {
@@ -24466,7 +24882,7 @@ var FormSection = ({
24466
24882
  2: "grid-cols-1 md:grid-cols-2",
24467
24883
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
24468
24884
  }[columns];
24469
- React51__default.useCallback(() => {
24885
+ React52__default.useCallback(() => {
24470
24886
  if (collapsible) {
24471
24887
  setCollapsed((prev) => !prev);
24472
24888
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -24814,49 +25230,40 @@ var FxOverlay = ({ items, tickMs = DEFAULT_TICK_MS2, children, className, ...res
24814
25230
  return overlay;
24815
25231
  };
24816
25232
  FxOverlay.displayName = "FxOverlay";
24817
- function pickPath(entry) {
24818
- if (Array.isArray(entry.path)) {
24819
- return entry.path[Math.floor(Math.random() * entry.path.length)];
24820
- }
24821
- return entry.path;
24822
- }
24823
25233
  function useGameAudio({
24824
- manifest,
24825
- baseUrl = "",
24826
25234
  initialMuted = false,
24827
- initialVolume = 1
25235
+ initialVolume = 1,
25236
+ autostart
24828
25237
  }) {
24829
25238
  const [muted, setMutedState] = useState(initialMuted);
24830
25239
  const [masterVolume, setMasterVolumeState] = useState(initialVolume);
24831
25240
  const mutedRef = useRef(muted);
24832
25241
  const volumeRef = useRef(masterVolume);
24833
- const manifestRef = useRef(manifest);
24834
25242
  mutedRef.current = muted;
24835
25243
  volumeRef.current = masterVolume;
24836
- manifestRef.current = manifest;
24837
25244
  const poolsRef = useRef(/* @__PURE__ */ new Map());
24838
- const getOrCreateElement = useCallback((key) => {
24839
- const entry = manifestRef.current[key];
24840
- if (!entry) return null;
25245
+ const poolPlansRef = useRef(/* @__PURE__ */ new Map());
25246
+ const getOrCreateElement = useCallback((plan) => {
25247
+ const key = plan.key;
25248
+ poolPlansRef.current.set(key, plan);
24841
25249
  let pool = poolsRef.current.get(key);
24842
25250
  if (!pool) {
24843
25251
  pool = [];
24844
25252
  poolsRef.current.set(key, pool);
24845
25253
  }
24846
- const maxSize = entry.poolSize ?? 1;
25254
+ const maxSize = Math.max(1, plan.poolSize);
24847
25255
  for (const audio of pool) {
24848
25256
  if (audio.paused && (audio.ended || audio.currentTime === 0)) {
24849
25257
  return audio;
24850
25258
  }
24851
25259
  }
24852
25260
  if (pool.length < maxSize) {
24853
- const src = baseUrl + pickPath(entry);
24854
- const audio = new Audio(src);
24855
- audio.loop = entry.loop ?? false;
25261
+ const audio = new Audio(plan.source);
25262
+ audio.loop = plan.loop;
24856
25263
  pool.push(audio);
24857
25264
  return audio;
24858
25265
  }
24859
- if (!entry.loop) {
25266
+ if (!plan.loop) {
24860
25267
  let oldest = pool[0];
24861
25268
  for (const audio of pool) {
24862
25269
  if (audio.currentTime > oldest.currentTime) {
@@ -24865,18 +25272,17 @@ function useGameAudio({
24865
25272
  }
24866
25273
  oldest.pause();
24867
25274
  oldest.currentTime = 0;
25275
+ oldest.src = plan.source;
24868
25276
  return oldest;
24869
25277
  }
24870
25278
  return null;
24871
- }, [baseUrl]);
24872
- const play = useCallback((key) => {
24873
- if (mutedRef.current) return;
24874
- const entry = manifestRef.current[key];
24875
- if (!entry) return;
24876
- const audio = getOrCreateElement(key);
25279
+ }, []);
25280
+ const playPlan = useCallback((plan) => {
25281
+ if (mutedRef.current || !plan.key) return;
25282
+ const audio = getOrCreateElement(plan);
24877
25283
  if (!audio) return;
24878
- audio.volume = Math.min(1, (entry.volume ?? 1) * volumeRef.current);
24879
- if (!entry.loop) {
25284
+ audio.volume = Math.min(1, plan.volume * volumeRef.current);
25285
+ if (!plan.loop) {
24880
25286
  audio.currentTime = 0;
24881
25287
  }
24882
25288
  const promise = audio.play();
@@ -24894,36 +25300,37 @@ function useGameAudio({
24894
25300
  }
24895
25301
  }, []);
24896
25302
  const currentMusicKeyRef = useRef(null);
25303
+ const currentMusicPlanRef = useRef(null);
24897
25304
  const currentMusicElRef = useRef(null);
24898
25305
  const musicFadeRef = useRef(null);
24899
- const pendingMusicKeyRef = useRef(null);
25306
+ const pendingMusicRef = useRef(null);
24900
25307
  const clearMusicFade = useCallback(() => {
24901
25308
  if (musicFadeRef.current) {
24902
25309
  clearInterval(musicFadeRef.current);
24903
25310
  musicFadeRef.current = null;
24904
25311
  }
24905
25312
  }, []);
24906
- const playMusic = useCallback((key) => {
24907
- if (key === currentMusicKeyRef.current) return;
24908
- pendingMusicKeyRef.current = key;
24909
- const entry = manifestRef.current[key];
24910
- if (!entry) return;
24911
- const fadeDurationMs = entry.crossfadeDurationMs ?? 1500;
25313
+ const startMusicPlan = useCallback((plan) => {
25314
+ if (plan.key === currentMusicKeyRef.current) return;
25315
+ pendingMusicRef.current = plan;
24912
25316
  const stepMs = 50;
24913
- const totalSteps = Math.max(1, fadeDurationMs / stepMs);
24914
- const targetVolume = Math.min(1, (entry.volume ?? 1) * volumeRef.current);
25317
+ const totalSteps = Math.max(1, plan.fadeMs / stepMs);
25318
+ const targetVolume = Math.min(1, plan.volume * volumeRef.current);
24915
25319
  clearMusicFade();
24916
- const src = baseUrl + (Array.isArray(entry.path) ? entry.path[0] : entry.path);
24917
- const incoming = new Audio(src);
25320
+ const incoming = new Audio(plan.source);
24918
25321
  incoming.loop = true;
24919
25322
  incoming.volume = 0;
24920
25323
  const outgoing = currentMusicElRef.current;
24921
25324
  const outgoingStartVol = outgoing?.volume ?? 0;
24922
- currentMusicKeyRef.current = key;
25325
+ const outgoingKey = currentMusicKeyRef.current;
25326
+ const outgoingPlan = currentMusicPlanRef.current;
25327
+ currentMusicKeyRef.current = plan.key;
25328
+ currentMusicPlanRef.current = plan;
24923
25329
  currentMusicElRef.current = incoming;
24924
25330
  if (!mutedRef.current) {
24925
25331
  incoming.play().catch(() => {
24926
- currentMusicKeyRef.current = null;
25332
+ currentMusicKeyRef.current = outgoingKey;
25333
+ currentMusicPlanRef.current = outgoingPlan;
24927
25334
  currentMusicElRef.current = outgoing;
24928
25335
  });
24929
25336
  }
@@ -24943,13 +25350,14 @@ function useGameAudio({
24943
25350
  }
24944
25351
  }
24945
25352
  }, stepMs);
24946
- }, [baseUrl, clearMusicFade]);
24947
- const stopMusic = useCallback((fadeDurationMs = 1e3) => {
25353
+ }, [clearMusicFade]);
25354
+ const stopMusic = useCallback((fadeDurationMs) => {
25355
+ pendingMusicRef.current = null;
24948
25356
  const outgoing = currentMusicElRef.current;
24949
25357
  if (!outgoing) return;
24950
25358
  currentMusicKeyRef.current = null;
25359
+ currentMusicPlanRef.current = null;
24951
25360
  currentMusicElRef.current = null;
24952
- pendingMusicKeyRef.current = null;
24953
25361
  clearMusicFade();
24954
25362
  const startVolume = outgoing.volume;
24955
25363
  const stepMs = 50;
@@ -24966,6 +25374,10 @@ function useGameAudio({
24966
25374
  }
24967
25375
  }, stepMs);
24968
25376
  }, [clearMusicFade]);
25377
+ const playMusicPlan = useCallback((plan) => {
25378
+ if (plan.key) startMusicPlan(plan);
25379
+ else stopMusic(plan.fadeMs);
25380
+ }, [startMusicPlan, stopMusic]);
24969
25381
  const stopAll = useCallback(() => {
24970
25382
  for (const pool of poolsRef.current.values()) {
24971
25383
  for (const audio of pool) {
@@ -24979,7 +25391,7 @@ function useGameAudio({
24979
25391
  setMutedState(value);
24980
25392
  if (value) {
24981
25393
  for (const [key, pool] of poolsRef.current.entries()) {
24982
- if (manifestRef.current[key]?.loop) {
25394
+ if (poolPlansRef.current.get(key)?.loop) {
24983
25395
  for (const audio of pool) {
24984
25396
  if (!audio.paused) audio.pause();
24985
25397
  }
@@ -24988,8 +25400,7 @@ function useGameAudio({
24988
25400
  currentMusicElRef.current?.pause();
24989
25401
  } else {
24990
25402
  for (const [key, pool] of poolsRef.current.entries()) {
24991
- const entry = manifestRef.current[key];
24992
- if (entry?.loop && entry?.autostart) {
25403
+ if (poolPlansRef.current.get(key)?.loop && autostartKeysRef.current.has(key)) {
24993
25404
  for (const audio of pool) {
24994
25405
  if (audio.paused) audio.play().catch(() => {
24995
25406
  });
@@ -25007,33 +25418,37 @@ function useGameAudio({
25007
25418
  const clamped = Math.max(0, Math.min(1, volume));
25008
25419
  setMasterVolumeState(clamped);
25009
25420
  for (const [key, pool] of poolsRef.current.entries()) {
25010
- const entryVol = manifestRef.current[key]?.volume ?? 1;
25421
+ const entryVol = poolPlansRef.current.get(key)?.volume ?? 1;
25011
25422
  for (const audio of pool) {
25012
25423
  audio.volume = Math.min(1, entryVol * clamped);
25013
25424
  }
25014
25425
  }
25015
25426
  if (!musicFadeRef.current && currentMusicElRef.current) {
25016
- const key = currentMusicKeyRef.current;
25017
- const entryVol = key ? manifestRef.current[key]?.volume ?? 1 : 1;
25427
+ const entryVol = currentMusicPlanRef.current?.volume ?? 1;
25018
25428
  currentMusicElRef.current.volume = Math.min(1, entryVol * clamped);
25019
25429
  }
25020
25430
  }, []);
25021
25431
  const unlockedRef = useRef(false);
25432
+ const autostartPlans = autostart ?? [];
25433
+ const autostartKeysRef = useRef(/* @__PURE__ */ new Set());
25434
+ autostartKeysRef.current = new Set(autostartPlans.map((p) => p.key));
25435
+ const autostartRef = useRef(autostartPlans);
25436
+ autostartRef.current = autostartPlans;
25437
+ const autostartSignature = autostartPlans.map((p) => p.key + "\0" + p.source).join("");
25022
25438
  useEffect(() => {
25023
- const autoKeys = Object.keys(manifest).filter((k) => manifest[k].autostart);
25024
- const hasPendingMusic = () => pendingMusicKeyRef.current !== null;
25025
- const hasAutoStart = autoKeys.length > 0;
25439
+ const hasPendingMusic = () => pendingMusicRef.current !== null;
25440
+ const hasAutoStart = autostartRef.current.length > 0;
25026
25441
  if (!hasAutoStart && !hasPendingMusic()) return;
25027
25442
  const unlock = () => {
25028
25443
  if (unlockedRef.current) return;
25029
25444
  unlockedRef.current = true;
25030
25445
  if (!mutedRef.current) {
25031
- for (const key of autoKeys) {
25032
- play(key);
25446
+ for (const plan of autostartRef.current) {
25447
+ playPlan(plan);
25033
25448
  }
25034
- const pending = pendingMusicKeyRef.current;
25035
- if (pending && pending !== currentMusicKeyRef.current) {
25036
- playMusic(pending);
25449
+ const pending = pendingMusicRef.current;
25450
+ if (pending && pending.key !== currentMusicKeyRef.current) {
25451
+ startMusicPlan(pending);
25037
25452
  }
25038
25453
  }
25039
25454
  };
@@ -25045,7 +25460,7 @@ function useGameAudio({
25045
25460
  document.removeEventListener("keydown", unlock);
25046
25461
  document.removeEventListener("touchstart", unlock);
25047
25462
  };
25048
- }, [manifest, play, playMusic]);
25463
+ }, [autostartSignature, playPlan, startMusicPlan]);
25049
25464
  useEffect(() => {
25050
25465
  return () => {
25051
25466
  clearMusicFade();
@@ -25064,10 +25479,10 @@ function useGameAudio({
25064
25479
  };
25065
25480
  }, [clearMusicFade]);
25066
25481
  return {
25067
- play,
25068
25482
  stop,
25069
25483
  stopAll,
25070
- playMusic,
25484
+ playPlan,
25485
+ playMusicPlan,
25071
25486
  stopMusic,
25072
25487
  muted,
25073
25488
  setMuted,
@@ -25079,31 +25494,32 @@ useGameAudio.displayName = "useGameAudio";
25079
25494
 
25080
25495
  // src/components/game/atoms/GameAudioCue.tsx
25081
25496
  function GameAudioCue({
25082
- cue,
25083
25497
  cueSeq,
25084
- music,
25498
+ cuePlay,
25499
+ musicPlay,
25500
+ autostart,
25085
25501
  muted,
25086
- volume,
25087
- manifest,
25088
- baseUrl
25502
+ volume
25089
25503
  }) {
25090
- const { play, playMusic, stopMusic, setMuted, setMasterVolume } = useGameAudio({
25091
- manifest,
25092
- baseUrl,
25504
+ const { playPlan, playMusicPlan, setMuted, setMasterVolume } = useGameAudio({
25093
25505
  initialMuted: muted,
25094
- initialVolume: volume
25506
+ initialVolume: volume,
25507
+ autostart: autostart ?? []
25095
25508
  });
25096
25509
  const prevCueSeqRef = useRef(cueSeq);
25097
25510
  useEffect(() => {
25098
- if (cue && cueSeq !== void 0 && cueSeq !== prevCueSeqRef.current) {
25099
- play(cue);
25511
+ if (cuePlay && cueSeq !== void 0 && cueSeq !== prevCueSeqRef.current) {
25512
+ playPlan(cuePlay);
25100
25513
  }
25101
25514
  prevCueSeqRef.current = cueSeq;
25102
- }, [cue, cueSeq, play]);
25515
+ }, [cuePlay, cueSeq, playPlan]);
25516
+ const musicKey = musicPlay?.key ?? "";
25517
+ const musicSource = musicPlay?.source ?? "";
25518
+ const musicRef = useRef(musicPlay);
25519
+ musicRef.current = musicPlay;
25103
25520
  useEffect(() => {
25104
- if (music) playMusic(music);
25105
- else stopMusic();
25106
- }, [music, playMusic, stopMusic]);
25521
+ if (musicRef.current) playMusicPlan(musicRef.current);
25522
+ }, [musicKey, musicSource, playMusicPlan]);
25107
25523
  useEffect(() => {
25108
25524
  if (muted !== void 0) setMuted(muted);
25109
25525
  }, [muted, setMuted]);
@@ -25126,23 +25542,19 @@ function useGameAudioContextOptional() {
25126
25542
  return useContext(GameAudioContext);
25127
25543
  }
25128
25544
  function GameAudioProvider({
25129
- manifest,
25130
- baseUrl = "",
25131
25545
  children,
25132
25546
  initialMuted = false
25133
25547
  }) {
25134
- const { play, stop, stopAll, playMusic, stopMusic, muted, setMuted, masterVolume, setMasterVolume } = useGameAudio({ manifest, baseUrl, initialMuted });
25548
+ const { playPlan, playMusicPlan, stop, stopAll, stopMusic, muted, setMuted, masterVolume, setMasterVolume } = useGameAudio({ initialMuted });
25135
25549
  useEffect(() => registerHostAudio((ask) => {
25136
- if (ask.op === "audio/play-sound") play(ask.key);
25550
+ if (ask.op === "audio/play-sound") playPlan(ask.play);
25137
25551
  else if (ask.op === "audio/stop-sound") {
25138
25552
  if (ask.key !== void 0) stop(ask.key);
25139
25553
  else stopAll();
25140
- } else if (ask.op === "audio/change-music") {
25141
- if (ask.key !== void 0) playMusic(ask.key);
25142
- else stopMusic();
25143
- } else stopMusic();
25144
- }), [play, stop, stopAll, playMusic, stopMusic]);
25145
- const value = { muted, setMuted, masterVolume, setMasterVolume, play, playMusic, stopMusic };
25554
+ } else if (ask.op === "audio/change-music") playMusicPlan(ask.play);
25555
+ else stopMusic(ask.fadeMs);
25556
+ }), [playPlan, playMusicPlan, stop, stopAll, stopMusic]);
25557
+ const value = { muted, setMuted, masterVolume, setMasterVolume, playPlan, playMusicPlan, stopMusic };
25146
25558
  return /* @__PURE__ */ jsx(GameAudioContext.Provider, { value, children });
25147
25559
  }
25148
25560
  GameAudioProvider.displayName = "GameAudioProvider";
@@ -25539,7 +25951,7 @@ function GameHud({
25539
25951
  );
25540
25952
  }
25541
25953
  GameHud.displayName = "GameHud";
25542
- var GameOverlayContext = React51.createContext(false);
25954
+ var GameOverlayContext = React52.createContext(false);
25543
25955
  var DEFAULT_MENU_OPTION_KEYS = [
25544
25956
  { labelKey: "gameMenu.newGame", event: "NEW_GAME", variant: "primary" },
25545
25957
  { labelKey: "gameMenu.continue", event: "CONTINUE", variant: "secondary" },
@@ -25566,8 +25978,8 @@ function GameMenu({
25566
25978
  const resolvedOptions = options ?? menuItems ?? defaultOptions;
25567
25979
  const eventBus = useEventBus();
25568
25980
  const navStack = useNavStack();
25569
- const inOverlay = React51.useContext(GameOverlayContext);
25570
- const handleOptionClick = React51.useCallback(
25981
+ const inOverlay = React52.useContext(GameOverlayContext);
25982
+ const handleOptionClick = React52.useCallback(
25571
25983
  (option) => {
25572
25984
  if (option.event) {
25573
25985
  eventBus.emit(`UI:${option.event}`, { option });
@@ -26458,20 +26870,12 @@ var GeometricPattern = ({
26458
26870
  );
26459
26871
  };
26460
26872
  GeometricPattern.displayName = "GeometricPattern";
26461
- var colorTokenVars2 = {
26462
- primary: "var(--color-primary)",
26463
- secondary: "var(--color-secondary)",
26464
- success: "var(--color-success)",
26465
- warning: "var(--color-warning)",
26466
- error: "var(--color-error)",
26467
- muted: "var(--color-muted)"
26468
- };
26469
26873
  var GradientDivider = ({
26470
26874
  color,
26471
26875
  className,
26472
26876
  ...rest
26473
26877
  }) => {
26474
- const centerColor = color ? color in colorTokenVars2 ? colorTokenVars2[color] : color : "var(--color-primary)";
26878
+ const centerColor = color ? resolveColorToken(color) : "var(--color-primary)";
26475
26879
  return /* @__PURE__ */ jsx(
26476
26880
  Box,
26477
26881
  {
@@ -26560,7 +26964,7 @@ var GraphCanvas = ({
26560
26964
  description,
26561
26965
  ...rest
26562
26966
  }) => {
26563
- const descId = React51__default.useId();
26967
+ const descId = React52__default.useId();
26564
26968
  const selectedNode = selectedNodeId === void 0 ? void 0 : propNodes.find((n) => n.id === selectedNodeId);
26565
26969
  const eventBus = useEventBus();
26566
26970
  const { t } = useTranslate();
@@ -27414,10 +27818,10 @@ function layoutRadial(nodeIds, adjacency, roots, width, height, margin) {
27414
27818
  const cy = height / 2;
27415
27819
  const maxRadius = Math.min(width, height) / 2 - margin;
27416
27820
  if (roots.length === 0) {
27417
- const order = edgeWalkOrder(nodeIds, adjacency);
27418
- const k = order.length;
27821
+ const order2 = edgeWalkOrder(nodeIds, adjacency);
27822
+ const k = order2.length;
27419
27823
  const positions2 = /* @__PURE__ */ new Map();
27420
- order.forEach((id, i) => {
27824
+ order2.forEach((id, i) => {
27421
27825
  const angle = i / k * 2 * Math.PI;
27422
27826
  positions2.set(id, { id, x: cx + maxRadius * Math.cos(angle), y: cy + maxRadius * Math.sin(angle) });
27423
27827
  });
@@ -27425,19 +27829,39 @@ function layoutRadial(nodeIds, adjacency, roots, width, height, margin) {
27425
27829
  }
27426
27830
  const { depth, visitOrder } = bfsDepthAndOrder(nodeIds, adjacency, roots);
27427
27831
  const maxDepth = Math.max(...Array.from(depth.values()));
27428
- const ringGroups = groupByTier(nodeIds, depth, maxDepth);
27832
+ const order = (a, b) => (visitOrder.get(a) ?? 0) - (visitOrder.get(b) ?? 0);
27833
+ const children = new Map(nodeIds.map((id) => [id, []]));
27834
+ const tops = [];
27835
+ for (const id of [...nodeIds].sort(order)) {
27836
+ const d = depth.get(id) ?? 0;
27837
+ const parent = (adjacency.in.get(id) ?? []).filter((p) => (depth.get(p) ?? 0) === d - 1).sort(order)[0];
27838
+ if (d > 0 && parent !== void 0) children.get(parent)?.push(id);
27839
+ else tops.push(id);
27840
+ }
27841
+ const weight = /* @__PURE__ */ new Map();
27842
+ const weigh = (id) => {
27843
+ const own = (children.get(id) ?? []).reduce((sum, child) => sum + weigh(child), 0);
27844
+ const w = Math.max(1, own);
27845
+ weight.set(id, w);
27846
+ return w;
27847
+ };
27848
+ tops.forEach(weigh);
27849
+ const centred = tops.length === 1;
27850
+ const radiusAt = (d) => centred ? d * maxRadius / Math.max(1, maxDepth) : (d + 1) * maxRadius / (maxDepth + 1);
27429
27851
  const positions = /* @__PURE__ */ new Map();
27430
- for (let d = 0; d <= maxDepth; d++) {
27431
- const ordered = [...ringGroups[d]].sort(
27432
- (a, b) => (visitOrder.get(a) ?? 0) - (visitOrder.get(b) ?? 0)
27433
- );
27434
- const radius = d * maxRadius / Math.max(1, maxDepth);
27435
- const k = ordered.length;
27436
- ordered.forEach((id, i) => {
27437
- const angle = i / k * 2 * Math.PI;
27852
+ const place = (ids, from, to) => {
27853
+ const total = ids.reduce((sum, id) => sum + (weight.get(id) ?? 1), 0);
27854
+ let at = from;
27855
+ for (const id of ids) {
27856
+ const span = (to - from) * (weight.get(id) ?? 1) / total;
27857
+ const angle = at + span / 2;
27858
+ const radius = radiusAt(depth.get(id) ?? 0);
27438
27859
  positions.set(id, { id, x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) });
27439
- });
27440
- }
27860
+ place(children.get(id) ?? [], at, at + span);
27861
+ at += span;
27862
+ }
27863
+ };
27864
+ place(tops, -Math.PI / 2, 3 * Math.PI / 2);
27441
27865
  return nodeIds.map((id) => positions.get(id));
27442
27866
  }
27443
27867
  function computeStaticLayout(mode, input) {
@@ -27472,6 +27896,21 @@ function edgeEndpoints(source, target) {
27472
27896
  y2: target.y - uy * (target.size + EDGE_ARROW_GAP)
27473
27897
  };
27474
27898
  }
27899
+ function radialEdgePath(center, source, target) {
27900
+ const rs = Math.hypot(source.x - center.x, source.y - center.y);
27901
+ const rt = Math.hypot(target.x - center.x, target.y - center.y);
27902
+ if (rs < 1 || rt < 1) return `M${source.x},${source.y} L${target.x},${target.y}`;
27903
+ const mid = (rs + rt) / 2;
27904
+ const toward = (p, r) => {
27905
+ const a = Math.atan2(p.y - center.y, p.x - center.x);
27906
+ return `${center.x + r * Math.cos(a)},${center.y + r * Math.sin(a)}`;
27907
+ };
27908
+ return `M${source.x},${source.y} C${toward(source, mid)} ${toward(target, mid)} ${target.x},${target.y}`;
27909
+ }
27910
+ function radialRings(center, points) {
27911
+ const radii = points.map((p) => Math.round(Math.hypot(p.x - center.x, p.y - center.y))).filter((r) => r > 1);
27912
+ return [...new Set(radii)].sort((a, b) => a - b);
27913
+ }
27475
27914
  function resolveNodeColor(node, groups) {
27476
27915
  if (node.color) return node.color;
27477
27916
  if (node.group) {
@@ -27640,6 +28079,7 @@ var GraphView = ({
27640
28079
  cancelAnimationFrame(animRef.current);
27641
28080
  };
27642
28081
  }, [nodes, edges, w, h, groups, layout]);
28082
+ const center = useMemo(() => ({ x: w / 2, y: h / 2 }), [w, h]);
27643
28083
  const viewBox = useMemo(() => {
27644
28084
  if (!zoomToFit || !settled || simNodes.length === 0) {
27645
28085
  return `0 0 ${w} ${h}`;
@@ -27655,10 +28095,17 @@ var GraphView = ({
27655
28095
  maxX = Math.max(maxX, node.x + node.size);
27656
28096
  maxY = Math.max(maxY, node.y + node.size);
27657
28097
  }
28098
+ if (layout === "radial") {
28099
+ const outer = radialRings(center, simNodes).at(-1) ?? 0;
28100
+ minX = Math.min(minX, center.x - outer);
28101
+ minY = Math.min(minY, center.y - outer);
28102
+ maxX = Math.max(maxX, center.x + outer);
28103
+ maxY = Math.max(maxY, center.y + outer);
28104
+ }
27658
28105
  const fitW = maxX - minX + pad * 2;
27659
28106
  const fitH = maxY - minY + pad * 2;
27660
28107
  return `${minX - pad} ${minY - pad} ${fitW} ${fitH}`;
27661
- }, [zoomToFit, settled, simNodes, w, h]);
28108
+ }, [zoomToFit, settled, simNodes, w, h, layout, center]);
27662
28109
  const nodeMap = useMemo(() => {
27663
28110
  const map = /* @__PURE__ */ new Map();
27664
28111
  for (const n of simNodes) {
@@ -27718,7 +28165,7 @@ var GraphView = ({
27718
28165
  viewBox,
27719
28166
  preserveAspectRatio: "xMidYMid meet",
27720
28167
  children: [
27721
- layout !== "force" && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
28168
+ (layout === "flow" || layout === "tree") && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
27722
28169
  "marker",
27723
28170
  {
27724
28171
  id: arrowMarkerId,
@@ -27731,25 +28178,53 @@ var GraphView = ({
27731
28178
  children: /* @__PURE__ */ jsx("path", { d: "M0,0 L10,5 L0,10 z", fill: "currentColor" })
27732
28179
  }
27733
28180
  ) }),
28181
+ layout === "radial" && radialRings(center, simNodes).map((r) => /* @__PURE__ */ jsx(
28182
+ "circle",
28183
+ {
28184
+ cx: center.x,
28185
+ cy: center.y,
28186
+ r,
28187
+ fill: "none",
28188
+ stroke: "var(--color-border)",
28189
+ strokeWidth: 1,
28190
+ strokeDasharray: "2 5",
28191
+ opacity: 0.7
28192
+ },
28193
+ `ring-${r}`
28194
+ )),
27734
28195
  edges.map((edge, idx) => {
27735
28196
  const source = nodeMap.get(edge.source);
27736
28197
  const target = nodeMap.get(edge.target);
27737
28198
  if (!source || !target) return null;
27738
28199
  const isHighlighted = hoveredId ? connectedIds.has(edge.source) && connectedIds.has(edge.target) : true;
27739
- const ends = layout !== "force" ? edgeEndpoints(source, target) : { x1: source.x, y1: source.y, x2: target.x, y2: target.y };
28200
+ const directed = layout === "flow" || layout === "tree";
28201
+ const ends = directed ? edgeEndpoints(source, target) : { x1: source.x, y1: source.y, x2: target.x, y2: target.y };
28202
+ const stroke = edge.color ?? (layout === "radial" ? target.color : DEFAULT_EDGE_COLOR);
28203
+ const lit = Boolean(hoveredId) && isHighlighted;
27740
28204
  return /* @__PURE__ */ jsxs("g", { children: [
27741
- /* @__PURE__ */ jsx(
28205
+ layout === "radial" ? /* @__PURE__ */ jsx(
28206
+ "path",
28207
+ {
28208
+ d: radialEdgePath(center, source, target),
28209
+ fill: "none",
28210
+ stroke,
28211
+ strokeWidth: lit ? 2 : 1.25,
28212
+ strokeLinecap: "round",
28213
+ opacity: hoveredId ? isHighlighted ? 0.9 : 0.08 : 0.45
28214
+ }
28215
+ ) : /* @__PURE__ */ jsx(
27742
28216
  "line",
27743
28217
  {
27744
28218
  x1: ends.x1,
27745
28219
  y1: ends.y1,
27746
28220
  x2: ends.x2,
27747
28221
  y2: ends.y2,
27748
- stroke: edge.color ?? DEFAULT_EDGE_COLOR,
27749
- color: edge.color ?? DEFAULT_EDGE_COLOR,
27750
- strokeWidth: 1.5,
27751
- opacity: isHighlighted ? 0.8 : 0.15,
27752
- markerEnd: layout !== "force" ? `url(#${arrowMarkerId})` : void 0
28222
+ stroke,
28223
+ color: stroke,
28224
+ strokeWidth: lit ? 2 : 1.25,
28225
+ strokeLinecap: "round",
28226
+ opacity: hoveredId ? isHighlighted ? 0.9 : 0.1 : 0.6,
28227
+ markerEnd: directed ? `url(#${arrowMarkerId})` : void 0
27753
28228
  }
27754
28229
  ),
27755
28230
  showLabels && edge.label && /* @__PURE__ */ jsx(
@@ -27759,7 +28234,10 @@ var GraphView = ({
27759
28234
  y: (source.y + target.y) / 2 - 6,
27760
28235
  textAnchor: "middle",
27761
28236
  fill: "var(--color-muted-foreground)",
27762
- fontSize: 9,
28237
+ fontSize: 10,
28238
+ stroke: "var(--color-card)",
28239
+ strokeWidth: 3,
28240
+ paintOrder: "stroke",
27763
28241
  opacity: isHighlighted ? 0.9 : 0.2,
27764
28242
  children: edge.label
27765
28243
  }
@@ -27769,10 +28247,12 @@ var GraphView = ({
27769
28247
  simNodes.map((node) => {
27770
28248
  const isHighlighted = hoveredId ? connectedIds.has(node.id) : true;
27771
28249
  const isHovered = hoveredId === node.id;
28250
+ const r = isHovered ? node.size * 1.25 : node.size;
27772
28251
  return /* @__PURE__ */ jsxs(
27773
28252
  "g",
27774
28253
  {
27775
28254
  style: { cursor: onNodeClick ? "pointer" : "default" },
28255
+ opacity: isHighlighted ? 1 : 0.3,
27776
28256
  onMouseEnter: () => handleNodeMouseEnter(node),
27777
28257
  onMouseLeave: handleNodeMouseLeave,
27778
28258
  ...pressableProps(onNodeClick ? () => handleNodeClickInternal(node) : void 0),
@@ -27788,23 +28268,37 @@ var GraphView = ({
27788
28268
  {
27789
28269
  cx: node.x,
27790
28270
  cy: node.y,
27791
- r: isHovered ? node.size * 1.4 : node.size,
28271
+ r: r + Math.max(4, node.size * 0.45),
27792
28272
  fill: node.color,
27793
- opacity: isHighlighted ? 1 : 0.3,
27794
- stroke: isHovered ? "var(--color-background)" : "none",
27795
- strokeWidth: isHovered ? 2 : 0
28273
+ opacity: isHovered ? 0.28 : 0.14,
28274
+ style: { transition: "r 160ms ease, opacity 160ms ease" }
27796
28275
  }
27797
28276
  ),
27798
- showLabels && /* @__PURE__ */ jsx(
28277
+ /* @__PURE__ */ jsx(
28278
+ "circle",
28279
+ {
28280
+ cx: node.x,
28281
+ cy: node.y,
28282
+ r,
28283
+ fill: node.color,
28284
+ stroke: "var(--color-card)",
28285
+ strokeWidth: 2,
28286
+ style: { transition: "r 160ms ease" }
28287
+ }
28288
+ ),
28289
+ showLabels && (node.label ?? node.id) !== "" && /* @__PURE__ */ jsx(
27799
28290
  "text",
27800
28291
  {
27801
28292
  x: node.x,
27802
- y: node.y + node.size + 12,
28293
+ y: node.y + r + Math.max(4, node.size * 0.45) + 12,
27803
28294
  textAnchor: "middle",
27804
28295
  fill: "var(--color-foreground)",
27805
- fontSize: 11,
27806
- fontWeight: isHovered ? "bold" : "normal",
27807
- opacity: isHighlighted ? 0.9 : 0.2,
28296
+ fontSize: 11.5,
28297
+ fontWeight: isHovered ? 600 : 500,
28298
+ stroke: "var(--color-card)",
28299
+ strokeWidth: 3.5,
28300
+ strokeLinejoin: "round",
28301
+ paintOrder: "stroke",
27808
28302
  children: node.label ?? node.id
27809
28303
  }
27810
28304
  )
@@ -27980,7 +28474,7 @@ var Grid = ({
27980
28474
  ...rest
27981
28475
  }) => {
27982
28476
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
27983
- return React51__default.createElement(
28477
+ return React52__default.createElement(
27984
28478
  Component,
27985
28479
  {
27986
28480
  ...domPassthrough(rest),
@@ -28008,7 +28502,7 @@ function readsI18n(value) {
28008
28502
  const arr = value;
28009
28503
  return arr[0] === "i18n/t" || arr.some((v) => readsI18n(v));
28010
28504
  }
28011
- if (value !== null && typeof value === "object" && !React51__default.isValidElement(value) && !(value instanceof Date) && typeof value !== "function") {
28505
+ if (value !== null && typeof value === "object" && !React52__default.isValidElement(value) && !(value instanceof Date) && typeof value !== "function") {
28012
28506
  return Object.values(value).some((v) => readsI18n(v));
28013
28507
  }
28014
28508
  return false;
@@ -28076,7 +28570,7 @@ function substituteLambdaBindings(body, params, item, index) {
28076
28570
  const arr = body;
28077
28571
  return arr.map((b) => recur(b));
28078
28572
  }
28079
- if (body !== null && typeof body === "object" && !React51__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
28573
+ if (body !== null && typeof body === "object" && !React52__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
28080
28574
  const out = {};
28081
28575
  for (const [k, v] of Object.entries(body)) {
28082
28576
  out[k] = recur(v);
@@ -28089,7 +28583,7 @@ function evaluableCall(node) {
28089
28583
  return isOperatorCall(node) && isSExpr(node) && !needsRenderContext(node);
28090
28584
  }
28091
28585
  function isPlainContainer(body) {
28092
- return body !== null && typeof body === "object" && !Array.isArray(body) && !React51__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function";
28586
+ return body !== null && typeof body === "object" && !Array.isArray(body) && !React52__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function";
28093
28587
  }
28094
28588
  function gatherCalls(body, sink) {
28095
28589
  if (Array.isArray(body)) {
@@ -28125,8 +28619,8 @@ function evaluateStandaloneCalls(body) {
28125
28619
  const values = evaluateBindings({}, calls).map((evaluated) => isEventPayloadValue(evaluated) ? evaluated : String(evaluated));
28126
28620
  return replaceCalls(body, values[Symbol.iterator]());
28127
28621
  }
28128
- var LazySlotContentRenderer2 = React51__default.lazy(
28129
- () => import('./UISlotRenderer-PY7FIJXN.js').then((m) => ({ default: m.SlotContentRenderer }))
28622
+ var LazySlotContentRenderer2 = React52__default.lazy(
28623
+ () => import('./UISlotRenderer-5OURMAP2.js').then((m) => ({ default: m.SlotContentRenderer }))
28130
28624
  );
28131
28625
  function deferLambdaEntityExprs(value) {
28132
28626
  if (typeof value === "string") {
@@ -28145,7 +28639,7 @@ function deferLambdaEntityExprs(value) {
28145
28639
  }
28146
28640
  return arr.map((v) => deferLambdaEntityExprs(v));
28147
28641
  }
28148
- if (value !== null && typeof value === "object" && !React51__default.isValidElement(value) && !(value instanceof Date) && typeof value !== "function" && !isRenderBindingMarker(value)) {
28642
+ if (value !== null && typeof value === "object" && !React52__default.isValidElement(value) && !(value instanceof Date) && typeof value !== "function" && !isRenderBindingMarker(value)) {
28149
28643
  const out = {};
28150
28644
  for (const [k, v] of Object.entries(value)) {
28151
28645
  out[k] = deferLambdaEntityExprs(v);
@@ -28159,7 +28653,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
28159
28653
  const resolvedBody = deferLambdaEntityExprs(
28160
28654
  resolveLambdaBindings(lambdaBody, params, item, index)
28161
28655
  );
28162
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React51__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
28656
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React52__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
28163
28657
  return null;
28164
28658
  }
28165
28659
  const record = resolvedBody;
@@ -28177,10 +28671,10 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
28177
28671
  props: childProps,
28178
28672
  priority: 0
28179
28673
  };
28180
- return React51__default.createElement(
28181
- React51__default.Suspense,
28674
+ return React52__default.createElement(
28675
+ React52__default.Suspense,
28182
28676
  { fallback: null },
28183
- React51__default.createElement(LazySlotContentRenderer2, { content: childContent, onDismiss: () => void 0 })
28677
+ React52__default.createElement(LazySlotContentRenderer2, { content: childContent, onDismiss: () => void 0 })
28184
28678
  );
28185
28679
  };
28186
28680
  }
@@ -28201,7 +28695,7 @@ function convertNode(node, callerKey, def) {
28201
28695
  });
28202
28696
  return anyChanged ? mapped : node;
28203
28697
  }
28204
- if (typeof node === "object" && !React51__default.isValidElement(node) && !(node instanceof Date)) {
28698
+ if (typeof node === "object" && !React52__default.isValidElement(node) && !(node instanceof Date)) {
28205
28699
  return convertObjectProps(node, def?.properties);
28206
28700
  }
28207
28701
  return node;
@@ -28292,7 +28786,7 @@ function useSlotFlush(uiSlots, embeddedTraits, returnHostAsk, traceSource) {
28292
28786
  const { bareTraitRef, patternType, props: unwrapped } = unwrapPattern(last.pattern);
28293
28787
  const rawProps = bareTraitRef !== void 0 ? bareTraitRef : { ...unwrapped ?? {}, ...last.props };
28294
28788
  const props = convertFnFormLambdasInProps(rawProps, typeof patternType === "string" ? patternType : void 0);
28295
- const isEmbedded = (embedded?.has(traitName) ?? false) && !isNotificationSlot(slot);
28789
+ const isEmbedded = paintsInTraitFrame(embedded?.has(traitName) ?? false, slot);
28296
28790
  if (isEmbedded) {
28297
28791
  const content = {
28298
28792
  pattern: patternType,
@@ -28332,7 +28826,7 @@ function useSlotFlush(uiSlots, embeddedTraits, returnHostAsk, traceSource) {
28332
28826
  const [, slot, pattern] = effect;
28333
28827
  const sourceTrait = traitName ?? "kernel";
28334
28828
  const { bareTraitRef, patternType, props: unwrapped } = unwrapPattern(pattern);
28335
- const isEmbedded = (embedded?.has(sourceTrait) ?? false) && !isNotificationSlot(slot);
28829
+ const isEmbedded = paintsInTraitFrame(embedded?.has(sourceTrait) ?? false, slot);
28336
28830
  flushLog.debug("apply:render", { trait: sourceTrait, slot, pattern: patternType ?? bareTraitRef ?? null, embedded: isEmbedded, event, fromState });
28337
28831
  const propsValue = bareTraitRef !== void 0 ? bareTraitRef : { ...unwrapped ?? {} };
28338
28832
  const props = convertFnFormLambdasInProps(propsValue, typeof patternType === "string" ? patternType : void 0);
@@ -28390,7 +28884,7 @@ function SeedGuestPaints({ paints }) {
28390
28884
  useLayoutEffect(() => {
28391
28885
  const held = new Set(paints.map((paint) => `${paint.slot}\0${paint.trait}`));
28392
28886
  for (const [key, gone] of seeded.current) {
28393
- if (!held.has(key)) slotsRef.current.clearBySource(gone.slot, gone.trait);
28887
+ if (!held.has(key) && !isNotificationSlot(gone.slot)) slotsRef.current.clearBySource(gone.slot, gone.trait);
28394
28888
  }
28395
28889
  seeded.current = new Map(paints.map((paint) => [`${paint.slot}\0${paint.trait}`, paint]));
28396
28890
  for (const paint of paints) {
@@ -28402,7 +28896,7 @@ function SeedGuestPaints({ paints }) {
28402
28896
  const propsValue = bareTraitRef !== void 0 ? bareTraitRef : { ...props ?? {} };
28403
28897
  const pattern = patternType;
28404
28898
  const converted = convertFnFormLambdasInProps(propsValue, typeof patternType === "string" ? patternType : void 0);
28405
- if (paint.embedded) {
28899
+ if (paintsInTraitFrame(paint.embedded, paint.slot)) {
28406
28900
  slotsRef.current.updateTraitContent(paint.trait, { pattern, props: converted, slot: paint.slot, priority: 0 });
28407
28901
  } else {
28408
28902
  slotsRef.current.render({ target: paint.slot, pattern, props: converted, sourceTrait: paint.trait });
@@ -28425,13 +28919,13 @@ var GuestView = ({ guest, source, navigate, route, paints, children }) => {
28425
28919
  [paints]
28426
28920
  );
28427
28921
  const sourceOrbital = orbitalsByTrait.get(source);
28428
- const roots = React51__default.Children.count(children);
28922
+ const roots = React52__default.Children.count(children);
28429
28923
  if (roots > 1) log8.warn("roots:unscoped", { guest, source, roots });
28430
28924
  const main = roots === 1 && sourceOrbital !== void 0 ? /* @__PURE__ */ jsx(TraitScopeProvider, { orbital: sourceOrbital, trait: source, children }) : children;
28431
28925
  return /* @__PURE__ */ jsx(EntitySchemaProvider, { orbitalsByTrait, children: /* @__PURE__ */ jsxs(UISlotProvider, { children: [
28432
28926
  paints !== void 0 && /* @__PURE__ */ jsx(SeedGuestPaints, { paints }),
28433
28927
  inHostRouter ? /* @__PURE__ */ jsx(HostHrefBaseProbe, { onBase: setHostHrefBase }) : null,
28434
- /* @__PURE__ */ jsx(Box, { ref: frameRef, fullWidth: true, fullHeight: true, className: "relative overflow-auto", children: route === void 0 ? /* @__PURE__ */ jsx(UISlotRenderer, { hudMode: "inline", includeHud: true, main }) : /* @__PURE__ */ jsx(CurrentPagePathProvider, { value: route, children: /* @__PURE__ */ jsx(UISlotRenderer, { hudMode: "inline", includeHud: true, main }) }) })
28928
+ /* @__PURE__ */ jsx(Box, { "data-guest-frame": "", fullWidth: true, fullHeight: true, className: "relative", style: { contain: "layout" }, children: /* @__PURE__ */ jsx(Box, { ref: frameRef, fullWidth: true, fullHeight: true, className: "relative overflow-auto", children: route === void 0 ? /* @__PURE__ */ jsx(UISlotRenderer, { hudMode: "inline", includeHud: true, main }) : /* @__PURE__ */ jsx(CurrentPagePathProvider, { value: route, children: /* @__PURE__ */ jsx(UISlotRenderer, { hudMode: "inline", includeHud: true, main }) }) }) })
28435
28929
  ] }) });
28436
28930
  };
28437
28931
  GuestView.displayName = "GuestView";
@@ -28694,7 +29188,7 @@ var ImportPreviewTree = ({
28694
29188
  const renderUnit = (unit, childrenByParent, depth) => {
28695
29189
  const summary = fieldSummary(unit);
28696
29190
  const children = childrenByParent.get(unit.ref) ?? [];
28697
- return /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
29191
+ return /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
28698
29192
  /* @__PURE__ */ jsxs(
28699
29193
  Box,
28700
29194
  {
@@ -28784,7 +29278,7 @@ var ImportProgress = ({
28784
29278
  PIPELINE.map((key, index) => {
28785
29279
  const isComplete = index < currentIndex;
28786
29280
  const isActive = index === currentIndex;
28787
- return /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
29281
+ return /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
28788
29282
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
28789
29283
  /* @__PURE__ */ jsxs(
28790
29284
  Box,
@@ -29007,7 +29501,7 @@ var questionSizes = {
29007
29501
  md: "text-base",
29008
29502
  lg: "text-lg"
29009
29503
  };
29010
- var LikertScale = React51__default.forwardRef(
29504
+ var LikertScale = React52__default.forwardRef(
29011
29505
  ({
29012
29506
  question,
29013
29507
  options: optionsProp,
@@ -29020,7 +29514,7 @@ var LikertScale = React51__default.forwardRef(
29020
29514
  className,
29021
29515
  ...rest
29022
29516
  }, ref) => {
29023
- const groupId = React51__default.useId();
29517
+ const groupId = React52__default.useId();
29024
29518
  const eventBus = useEventBus();
29025
29519
  const { t } = useTranslate();
29026
29520
  const options = optionsProp ?? DEFAULT_LIKERT_OPTION_KEYS.map((o) => ({ value: o.value, label: t(o.labelKey) }));
@@ -29509,6 +30003,7 @@ var AvlOrbitalMachine = ({
29509
30003
  selectedTrait = "",
29510
30004
  selectEvent,
29511
30005
  pickEvent,
30006
+ focusTarget = null,
29512
30007
  maxHeight = "calc(100vh - 9rem)",
29513
30008
  direction = "ltr",
29514
30009
  className,
@@ -29541,24 +30036,38 @@ var AvlOrbitalMachine = ({
29541
30036
  }, [eventBus, selectEvent]);
29542
30037
  const hosts = useTraitScopeChain();
29543
30038
  const pickable = useMemo(() => orbital.traits.map((tr) => tr.trait).filter((name) => !hosts.some((h2) => h2.trait === name)), [orbital, hosts]);
29544
- const pick = useCallback((trait) => {
29545
- setInspecting(false);
30039
+ const reveal = useCallback((trait, at) => {
29546
30040
  const chain = [];
29547
30041
  for (let name = trait; name !== null && !chain.includes(name); name = orbital.traits.find((tr) => tr.trait === name)?.parent ?? null) chain.push(name);
29548
30042
  setOpen((s) => /* @__PURE__ */ new Set([...s, ...chain]));
29549
30043
  setClosed((s) => new Set([...s].filter((name) => !chain.includes(name))));
29550
- setFocus({ trait, after: layoutRef.current });
30044
+ if (at !== null && at.from === at.to) setOpenLoops((s) => toggled(s, loopKey(trait, at.from), true));
30045
+ setFocus({ trait, at, after: layoutRef.current });
30046
+ }, [orbital]);
30047
+ const pick = useCallback((trait) => {
30048
+ setInspecting(false);
30049
+ reveal(trait, null);
29551
30050
  if (pickEvent) eventBus.emit(`UI:${pickEvent}`, { trait });
29552
- }, [eventBus, pickEvent, orbital]);
30051
+ }, [eventBus, pickEvent, reveal]);
29553
30052
  const stopInspecting = useCallback(() => setInspecting(false), []);
29554
30053
  const inspected = useTraitInspector({ active: inspecting, pickable, exclude: rootRef, onPick: pick, onCancel: stopInspecting });
29555
30054
  useEffect(() => {
29556
30055
  layoutRef.current = layout;
29557
30056
  if (focus === null || layout === null || layout === focus.after) return;
29558
30057
  setFocus(null);
29559
- const box = hostRef.current?.querySelector(`[data-testid="avl-om-box"][data-trait="${CSS.escape(focus.trait)}"]`);
29560
- box?.scrollIntoView({ block: "center", inline: "center", behavior: reduceMotion ? "auto" : "smooth" });
30058
+ const host = hostRef.current;
30059
+ if (host === null) return;
30060
+ const trait = CSS.escape(focus.trait);
30061
+ const at = focus.at !== null && focus.at.event !== "" ? focus.at : null;
30062
+ const found = at === null ? null : host.querySelector(`[data-testid="avl-om-label"][data-trait="${trait}"][data-event="${CSS.escape(at.event)}"][data-from="${CSS.escape(at.from)}"][data-to="${CSS.escape(at.to)}"]`) ?? host.querySelector(`[data-testid="avl-om-loop-event"][data-trait="${trait}"][data-state="${CSS.escape(at.from)}"][data-event="${CSS.escape(at.event)}"]`);
30063
+ const target = found ?? host.querySelector(`[data-testid="avl-om-box"][data-trait="${trait}"]`);
30064
+ target?.scrollIntoView({ block: "center", inline: "center", behavior: reduceMotion ? "auto" : "smooth" });
29561
30065
  }, [focus, layout, reduceMotion]);
30066
+ const focusKey = focusTarget === null ? "" : JSON.stringify(focusTarget);
30067
+ useEffect(() => {
30068
+ if (focusTarget === null) return;
30069
+ reveal(focusTarget.trait, { event: focusTarget.event, from: focusTarget.from, to: focusTarget.to });
30070
+ }, [focusKey]);
29562
30071
  const setExpanded = useCallback((trait, expanded) => {
29563
30072
  setOpen((s) => toggled(s, trait, expanded));
29564
30073
  setClosed((s) => toggled(s, trait, !expanded));
@@ -29868,6 +30377,8 @@ var AvlOrbitalMachine = ({
29868
30377
  "data-testid": "avl-om-label",
29869
30378
  "data-trait": e.trait,
29870
30379
  "data-event": e.event,
30380
+ "data-from": e.from,
30381
+ "data-to": e.to,
29871
30382
  "data-next": next ? "true" : "false",
29872
30383
  className: "absolute flex items-center justify-center rounded-md px-2",
29873
30384
  style: {
@@ -29987,6 +30498,10 @@ var AvlOrbitalMachine = ({
29987
30498
  Box,
29988
30499
  {
29989
30500
  as: "span",
30501
+ "data-testid": "avl-om-loop-event",
30502
+ "data-trait": s.trait,
30503
+ "data-state": s.name,
30504
+ "data-event": ev.event,
29990
30505
  "data-fired": onRoute(s.trait, ev.index) ? "true" : "false",
29991
30506
  className: "whitespace-nowrap",
29992
30507
  style: { lineHeight: `${LOOP_LINE}px`, color: onRoute(s.trait, ev.index) ? AVL_INK.focus : active ? AVL_INK.text : AVL_INK.quiet, fontWeight: onRoute(s.trait, ev.index) ? 600 : 400 },
@@ -30004,13 +30519,13 @@ var AvlOrbitalMachine = ({
30004
30519
  ] });
30005
30520
  };
30006
30521
  AvlOrbitalMachine.displayName = "AvlOrbitalMachine";
30007
- var StateMachineView = ({ trait, description, orbital = null, activeStates, firedTransition, route, expandDepth, selectedTrait, selectEvent, pickEvent, maxHeight, isLoading = false, error = null, className, ...rest }) => {
30522
+ var StateMachineView = ({ trait, description, orbital = null, activeStates, firedTransition, route, expandDepth, selectedTrait, selectEvent, pickEvent, focusTarget, maxHeight, isLoading = false, error = null, className, ...rest }) => {
30008
30523
  const { t } = useTranslate();
30009
30524
  const drawn = trait ?? (description ? traitLevelFromDescription(description) : null);
30010
30525
  if (isLoading) return /* @__PURE__ */ jsx(LoadingState, { message: t("stateMachine.loading") });
30011
30526
  if (error) return /* @__PURE__ */ jsx(ErrorState, { message: error instanceof Error ? error.message : String(error) });
30012
30527
  if (orbital !== null && orbital.traits.length > 0) {
30013
- return /* @__PURE__ */ jsx(AvlOrbitalMachine, { orbital, activeStates, firedTransition, route, expandDepth, selectedTrait, selectEvent, pickEvent, maxHeight, direction: rest.direction, className });
30528
+ return /* @__PURE__ */ jsx(AvlOrbitalMachine, { orbital, activeStates, firedTransition, route, expandDepth, selectedTrait, selectEvent, pickEvent, focusTarget, maxHeight, direction: rest.direction, className });
30014
30529
  }
30015
30530
  if (!drawn) {
30016
30531
  return /* @__PURE__ */ jsx(Box, { "data-testid": "state-machine-view-empty", padding: "lg", className: "text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "muted", children: t("stateMachine.noStateMachine") }) });
@@ -30100,7 +30615,7 @@ var TraitCardNodeInner = (props) => {
30100
30615
  }
30101
30616
  );
30102
30617
  };
30103
- var TraitCardNode = React51__default.memo(TraitCardNodeInner);
30618
+ var TraitCardNode = React52__default.memo(TraitCardNodeInner);
30104
30619
  TraitCardNode.displayName = "TraitCardNode";
30105
30620
  var SystemMapContext = createContext({});
30106
30621
  function useOpenTraits(map) {
@@ -30175,14 +30690,14 @@ var SystemNodeInner = ({ data }) => {
30175
30690
  }
30176
30691
  );
30177
30692
  };
30178
- var SystemNode = React51__default.memo(SystemNodeInner);
30693
+ var SystemNode = React52__default.memo(SystemNodeInner);
30179
30694
  SystemNode.displayName = "SystemNode";
30180
30695
  var SystemBandNodeInner = ({ data }) => {
30181
30696
  const d = data;
30182
30697
  const { t } = useTranslate();
30183
30698
  return /* @__PURE__ */ jsx(Box, { "data-testid": `avl-system-band-${d.bandKind}`, className: "pointer-events-none whitespace-nowrap", children: /* @__PURE__ */ jsx(Typography, { variant: "overline", color: "muted", children: t(d.bandKind === "connected" ? "avl.system.connected" : "avl.system.standalone", { count: d.bandCount ?? 0 }) }) });
30184
30699
  };
30185
- var SystemBandNode = React51__default.memo(SystemBandNodeInner);
30700
+ var SystemBandNode = React52__default.memo(SystemBandNodeInner);
30186
30701
  SystemBandNode.displayName = "SystemBandNode";
30187
30702
  var DEPENDENCY_ROLE_CLASS = {
30188
30703
  selected: "border-primary bg-primary/25 text-foreground ring-2 ring-primary/40",
@@ -30240,14 +30755,14 @@ var DependencyNodeInner = ({ id, data }) => {
30240
30755
  }
30241
30756
  );
30242
30757
  };
30243
- var DependencyNode = React51__default.memo(DependencyNodeInner);
30758
+ var DependencyNode = React52__default.memo(DependencyNodeInner);
30244
30759
  DependencyNode.displayName = "DependencyNode";
30245
30760
  var DependencyColumnNodeInner = ({ data }) => {
30246
30761
  const d = data;
30247
30762
  const { t } = useTranslate();
30248
30763
  return /* @__PURE__ */ jsx(Box, { "data-testid": `avl-dependency-column-${d.dependencyColumn}`, className: "pointer-events-none whitespace-nowrap", children: /* @__PURE__ */ jsx(Typography, { variant: "overline", color: "muted", children: t(`avl.deps.column.${d.dependencyColumn ?? "unknown"}`) }) });
30249
30764
  };
30250
- var DependencyColumnNode = React51__default.memo(DependencyColumnNodeInner);
30765
+ var DependencyColumnNode = React52__default.memo(DependencyColumnNodeInner);
30251
30766
  DependencyColumnNode.displayName = "DependencyColumnNode";
30252
30767
 
30253
30768
  // src/lib/avl-dependency-graph.ts
@@ -30396,7 +30911,7 @@ var EventFlowEdgeInner = (props) => {
30396
30911
  ) })
30397
30912
  ] });
30398
30913
  };
30399
- var EventFlowEdge = React51__default.memo(EventFlowEdgeInner);
30914
+ var EventFlowEdge = React52__default.memo(EventFlowEdgeInner);
30400
30915
  EventFlowEdge.displayName = "EventFlowEdge";
30401
30916
  var AVL_GRAPH_NODE_TYPES = {
30402
30917
  dependency: DependencyNode,
@@ -30574,19 +31089,19 @@ function FlowCanvasInner({
30574
31089
  const fitPadding = systemLevel || flowLens ? 0.08 : 0.25;
30575
31090
  const compact = useCompactLayout();
30576
31091
  const [scope, setScope] = useState("local");
30577
- const scopeRef = React51__default.useRef(scope);
31092
+ const scopeRef = React52__default.useRef(scope);
30578
31093
  scopeRef.current = scope;
30579
31094
  const [focusRequest, setFocusRequest] = useState(focusedOrbitalProp ?? initialOrbital);
30580
31095
  const [stateByOrbital, setStateByOrbital] = useState({});
30581
- const fitFocusedRef = React51__default.useRef(false);
30582
- const pendingFitRef = React51__default.useRef(null);
30583
- const fittedViewRef = React51__default.useRef(null);
31096
+ const fitFocusedRef = React52__default.useRef(false);
31097
+ const pendingFitRef = React52__default.useRef(null);
31098
+ const fittedViewRef = React52__default.useRef(null);
30584
31099
  useEffect(() => {
30585
31100
  if (focusedOrbitalProp === void 0) return;
30586
31101
  fitFocusedRef.current = true;
30587
31102
  setFocusRequest(focusedOrbitalProp);
30588
31103
  }, [focusedOrbitalProp]);
30589
- const screenSizeUserOverrideRef = React51__default.useRef(false);
31104
+ const screenSizeUserOverrideRef = React52__default.useRef(false);
30590
31105
  const [screenSize, setScreenSize] = useState(
30591
31106
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
30592
31107
  );
@@ -30743,9 +31258,9 @@ function FlowCanvasInner({
30743
31258
  const [edges, setEdges, onEdgesChange] = useEdgesState(activeEdges);
30744
31259
  const reactFlow = useReactFlow();
30745
31260
  const cameraMs = usePrefersReducedMotion() ? 0 : 300;
30746
- const savedPositionsRef = React51__default.useRef(nodePositions);
31261
+ const savedPositionsRef = React52__default.useRef(nodePositions);
30747
31262
  savedPositionsRef.current = nodePositions;
30748
- const nodesRef = React51__default.useRef(nodes);
31263
+ const nodesRef = React52__default.useRef(nodes);
30749
31264
  nodesRef.current = nodes;
30750
31265
  useEffect(() => {
30751
31266
  setEdges([]);
@@ -30765,7 +31280,7 @@ function FlowCanvasInner({
30765
31280
  }
30766
31281
  fitFocusedRef.current = false;
30767
31282
  }, [activeNodes, activeEdges, setNodes, setEdges, scope, focusedOrbital, screenSize, systemLevel, wiresOnly, dependencyLens, traitLevel, flowLens, traitFilter]);
30768
- const frameRef = React51__default.useRef(null);
31283
+ const frameRef = React52__default.useRef(null);
30769
31284
  useEffect(() => {
30770
31285
  const frame = frameRef.current;
30771
31286
  if (!fitOnResize || !frame) return;
@@ -30905,7 +31420,7 @@ function FlowCanvasInner({
30905
31420
  targetTraitName: tgtData.traitName
30906
31421
  });
30907
31422
  }, [nodes, onEventWire, eventBus]);
30908
- const worldPositionsRef = React51__default.useRef(canvas.worldPositions);
31423
+ const worldPositionsRef = React52__default.useRef(canvas.worldPositions);
30909
31424
  worldPositionsRef.current = canvas.worldPositions;
30910
31425
  const placementsOf = useCallback((list) => {
30911
31426
  const positions = { ...savedPositionsRef.current };
@@ -31254,23 +31769,23 @@ var FLOW_COLUMN = "min-w-0 min-h-0 w-auto basis-0 grow-[1.6] transition-[flex-gr
31254
31769
  var FLOW_ONLY = { lens: "flow", filter: null };
31255
31770
  function MachinePanel({ schema, transitions, describe: describe2, descriptions, behavior, replayStepMs = 800, dependencies }) {
31256
31771
  const { t } = useTranslate();
31257
- const entries = React51.useMemo(() => programTraits(schema), [schema]);
31258
- const ran = React51.useMemo(() => {
31772
+ const entries = React52.useMemo(() => programTraits(schema), [schema]);
31773
+ const ran = React52.useMemo(() => {
31259
31774
  const names = new Set(entries.map((e) => e.level.name));
31260
31775
  return transitions.filter((h) => names.has(h.traitName));
31261
31776
  }, [entries, transitions]);
31262
- const [pinned, setPinned] = React51.useState(null);
31263
- const [replay, setReplay] = React51.useState(null);
31264
- const [described, setDescribed] = React51.useState(/* @__PURE__ */ new Map());
31777
+ const [pinned, setPinned] = React52.useState(null);
31778
+ const [replay, setReplay] = React52.useState(null);
31779
+ const [described, setDescribed] = React52.useState(/* @__PURE__ */ new Map());
31265
31780
  const latest = ran[ran.length - 1]?.traitName;
31266
31781
  const name = pinned ?? latest ?? entries[0]?.level.name;
31267
31782
  const entry = entries.find((e) => e.level.name === name);
31268
- const selectedUnit = React51.useMemo(() => entry ? traitFlowGraph(schema, entry.orbital).units.find((unit) => [...unit.traits, ...unit.renderPieces].includes(entry.level.name)) : void 0, [schema, entry]);
31269
- const hops = React51.useMemo(() => ran.filter((h) => h.traitName === name), [ran, name]);
31783
+ const selectedUnit = React52.useMemo(() => entry ? traitFlowGraph(schema, entry.orbital).units.find((unit) => [...unit.traits, ...unit.renderPieces].includes(entry.level.name)) : void 0, [schema, entry]);
31784
+ const hops = React52.useMemo(() => ran.filter((h) => h.traitName === name), [ran, name]);
31270
31785
  const value = entry ? describedValue(entry, behavior) : null;
31271
31786
  const key = value ? `${value.behavior}.traits.${value.trait}` : null;
31272
31787
  const source = key && descriptions?.[key] ? { status: "ready", description: descriptions[key] } : key ? described.get(key) : void 0;
31273
- React51.useEffect(() => {
31788
+ React52.useEffect(() => {
31274
31789
  if (!describe2 || !value || !key || descriptions?.[key] || described.has(key)) return;
31275
31790
  setDescribed((prev) => new Map(prev).set(key, { status: "loading" }));
31276
31791
  describe2(value).then(
@@ -31278,7 +31793,7 @@ function MachinePanel({ schema, transitions, describe: describe2, descriptions,
31278
31793
  (error) => setDescribed((prev) => new Map(prev).set(key, { status: "failed", error: error.message }))
31279
31794
  );
31280
31795
  }, [describe2, descriptions, value, key, described]);
31281
- React51.useEffect(() => {
31796
+ React52.useEffect(() => {
31282
31797
  if (!replay?.playing) return;
31283
31798
  const timer = setTimeout(() => {
31284
31799
  setReplay((r) => r ? r.step + 1 < hops.length ? { step: r.step + 1, playing: r.step + 2 < hops.length } : { ...r, playing: false } : r);
@@ -31723,7 +32238,7 @@ var MediaGallery = ({
31723
32238
  [selectable, selectedItems, selectionEvent, eventBus]
31724
32239
  );
31725
32240
  const entityData = Array.isArray(entity) ? entity : [];
31726
- const items = React51__default.useMemo(() => {
32241
+ const items = React52__default.useMemo(() => {
31727
32242
  if (propItems && propItems.length > 0) return propItems;
31728
32243
  if (entityData.length === 0) return [];
31729
32244
  return entityData.map((record, idx) => {
@@ -32087,7 +32602,7 @@ var Meter = ({
32087
32602
  };
32088
32603
  Meter.displayName = "Meter";
32089
32604
  function extractTitle2(children) {
32090
- if (!React51__default.isValidElement(children)) return void 0;
32605
+ if (!React52__default.isValidElement(children)) return void 0;
32091
32606
  const props = children.props;
32092
32607
  if (typeof props.title === "string") {
32093
32608
  return props.title;
@@ -34130,7 +34645,7 @@ var RepeatableFormSection = ({
34130
34645
  };
34131
34646
  RepeatableFormSection.displayName = "RepeatableFormSection";
34132
34647
  function useDebugData() {
34133
- const [data, setData] = React51.useState(() => ({
34648
+ const [data, setData] = React52.useState(() => ({
34134
34649
  traits: [],
34135
34650
  ticks: [],
34136
34651
  guards: [],
@@ -34144,7 +34659,7 @@ function useDebugData() {
34144
34659
  },
34145
34660
  lastUpdate: Date.now()
34146
34661
  }));
34147
- React51.useEffect(() => {
34662
+ React52.useEffect(() => {
34148
34663
  const updateData = () => {
34149
34664
  setData({
34150
34665
  traits: getAllTraits(),
@@ -34374,15 +34889,15 @@ var TYPE_BADGES = {
34374
34889
  };
34375
34890
  function EventFlowTab({ events }) {
34376
34891
  const { t, locale } = useTranslate();
34377
- const [filter, setFilter] = React51.useState("all");
34378
- const containerRef = React51.useRef(null);
34379
- const [autoScroll, setAutoScroll] = React51.useState(true);
34380
- React51.useEffect(() => {
34892
+ const [filter, setFilter] = React52.useState("all");
34893
+ const containerRef = React52.useRef(null);
34894
+ const [autoScroll, setAutoScroll] = React52.useState(true);
34895
+ React52.useEffect(() => {
34381
34896
  if (autoScroll && containerRef.current) {
34382
34897
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
34383
34898
  }
34384
34899
  }, [events.length, autoScroll]);
34385
- const filteredEvents = React51.useMemo(() => {
34900
+ const filteredEvents = React52.useMemo(() => {
34386
34901
  if (filter === "all") return events;
34387
34902
  return events.filter((e) => e.type === filter);
34388
34903
  }, [events, filter]);
@@ -34478,7 +34993,7 @@ function EventFlowTab({ events }) {
34478
34993
  EventFlowTab.displayName = "EventFlowTab";
34479
34994
  function GuardsPanel({ guards }) {
34480
34995
  const { t, locale } = useTranslate();
34481
- const [filter, setFilter] = React51.useState("all");
34996
+ const [filter, setFilter] = React52.useState("all");
34482
34997
  if (guards.length === 0) {
34483
34998
  return /* @__PURE__ */ jsx(
34484
34999
  EmptyState,
@@ -34491,7 +35006,7 @@ function GuardsPanel({ guards }) {
34491
35006
  }
34492
35007
  const passedCount = guards.filter((g) => g.result).length;
34493
35008
  const failedCount = guards.length - passedCount;
34494
- const filteredGuards = React51.useMemo(() => {
35009
+ const filteredGuards = React52.useMemo(() => {
34495
35010
  if (filter === "all") return guards;
34496
35011
  if (filter === "passed") return guards.filter((g) => g.result);
34497
35012
  return guards.filter((g) => !g.result);
@@ -34618,10 +35133,10 @@ function EffectBadge({ effect }) {
34618
35133
  }
34619
35134
  function TransitionTimeline({ transitions }) {
34620
35135
  const { t, locale } = useTranslate();
34621
- const containerRef = React51.useRef(null);
34622
- const [autoScroll, setAutoScroll] = React51.useState(true);
34623
- const [expandedId, setExpandedId] = React51.useState(null);
34624
- React51.useEffect(() => {
35136
+ const containerRef = React52.useRef(null);
35137
+ const [autoScroll, setAutoScroll] = React52.useState(true);
35138
+ const [expandedId, setExpandedId] = React52.useState(null);
35139
+ React52.useEffect(() => {
34625
35140
  if (autoScroll && containerRef.current) {
34626
35141
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
34627
35142
  }
@@ -34877,9 +35392,9 @@ function getAllEvents(traits) {
34877
35392
  function EventDispatcherTab({ traits, schema }) {
34878
35393
  const eventBus = useEventBus();
34879
35394
  const { t } = useTranslate();
34880
- const [log16, setLog] = React51.useState([]);
34881
- const prevStatesRef = React51.useRef(/* @__PURE__ */ new Map());
34882
- React51.useEffect(() => {
35395
+ const [log16, setLog] = React52.useState([]);
35396
+ const prevStatesRef = React52.useRef(/* @__PURE__ */ new Map());
35397
+ React52.useEffect(() => {
34883
35398
  for (const trait of traits) {
34884
35399
  const prev = prevStatesRef.current.get(trait.id);
34885
35400
  if (prev && prev !== trait.currentState) {
@@ -34968,7 +35483,7 @@ function VerifyModePanel({
34968
35483
  dependencies
34969
35484
  }) {
34970
35485
  const { t } = useTranslate();
34971
- const [expanded, setExpanded] = React51.useState(true);
35486
+ const [expanded, setExpanded] = React52.useState(true);
34972
35487
  const hudBottom = typeof document !== "undefined" ? document.getElementById("runtime-debugger-portal") : null;
34973
35488
  const panel = /* @__PURE__ */ jsxs(
34974
35489
  "div",
@@ -35023,10 +35538,10 @@ function RuntimeDebugger({
35023
35538
  }) {
35024
35539
  const a11y = domPassthrough(rest);
35025
35540
  const { t } = useTranslate();
35026
- const [isCollapsed, setIsCollapsed] = React51.useState(mode === "verify" ? true : defaultCollapsed);
35027
- const [isVisible, setIsVisible] = React51.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
35541
+ const [isCollapsed, setIsCollapsed] = React52.useState(mode === "verify" ? true : defaultCollapsed);
35542
+ const [isVisible, setIsVisible] = React52.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
35028
35543
  const debugData = useDebugData();
35029
- React51.useEffect(() => {
35544
+ React52.useEffect(() => {
35030
35545
  if (mode === "inline") return;
35031
35546
  return onDebugToggle((enabled) => {
35032
35547
  setIsVisible(enabled);
@@ -35035,7 +35550,7 @@ function RuntimeDebugger({
35035
35550
  }
35036
35551
  });
35037
35552
  }, [mode]);
35038
- React51.useEffect(() => {
35553
+ React52.useEffect(() => {
35039
35554
  if (mode === "inline") return;
35040
35555
  const handleKeyDown = (e) => {
35041
35556
  if (e.key === "`" && isVisible) {
@@ -35369,7 +35884,7 @@ var Section = ({
35369
35884
  }) => {
35370
35885
  const hasHeader = title || description || action;
35371
35886
  const wrap = (node) => variant === "card" ? /* @__PURE__ */ jsx(SurfaceBoundary, { children: node }) : node;
35372
- return React51__default.createElement(
35887
+ return React52__default.createElement(
35373
35888
  Component,
35374
35889
  {
35375
35890
  ...domPassthrough(rest),
@@ -35420,7 +35935,6 @@ var Section = ({
35420
35935
  Section.displayName = "Section";
35421
35936
  var SegmentRenderer = ({
35422
35937
  segments: segmentsProp,
35423
- lesson,
35424
35938
  activationSaveEvent,
35425
35939
  reflectionSaveEvent,
35426
35940
  bloomAnswerEvent,
@@ -35440,10 +35954,7 @@ var SegmentRenderer = ({
35440
35954
  onRenderVisualization,
35441
35955
  ...rest
35442
35956
  }) => {
35443
- const segments = useMemo(
35444
- () => lesson !== void 0 ? parseLessonSegments(lesson) : segmentsProp ?? [],
35445
- [lesson, segmentsProp]
35446
- );
35957
+ const segments = useMemo(() => segmentsProp ?? [], [segmentsProp]);
35447
35958
  const annotationOwner = useMemo(() => {
35448
35959
  const owner = /* @__PURE__ */ new Map();
35449
35960
  for (const annotation of annotations ?? []) {
@@ -35638,7 +36149,7 @@ function LinearView({
35638
36149
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
35639
36150
  const isDone = i < currentIdx;
35640
36151
  const isCurrent = i === currentIdx;
35641
- return /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
36152
+ return /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
35642
36153
  i > 0 && /* @__PURE__ */ jsx(
35643
36154
  Typography,
35644
36155
  {
@@ -36075,7 +36586,7 @@ function SequenceBar({
36075
36586
  onSlotRemove?.(index);
36076
36587
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
36077
36588
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
36078
- return /* @__PURE__ */ jsx(HStack, { ...domPassthrough(rest), className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React51__default.Fragment, { children: [
36589
+ return /* @__PURE__ */ jsx(HStack, { ...domPassthrough(rest), className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React52__default.Fragment, { children: [
36079
36590
  i > 0 && /* @__PURE__ */ jsx(
36080
36591
  Typography,
36081
36592
  {
@@ -36913,7 +37424,7 @@ var StatCard = ({
36913
37424
  const eventBus = useEventBus();
36914
37425
  const { t, locale } = useTranslate();
36915
37426
  const fmt = useFormatContext();
36916
- const handleActionClick = React51__default.useCallback(() => {
37427
+ const handleActionClick = React52__default.useCallback(() => {
36917
37428
  if (action?.event) {
36918
37429
  eventBus.emit(`UI:${action.event}`, {});
36919
37430
  }
@@ -36924,7 +37435,7 @@ var StatCard = ({
36924
37435
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
36925
37436
  const isLoading = externalLoading ?? false;
36926
37437
  const error = externalError;
36927
- const computeMetricValue = React51__default.useCallback(
37438
+ const computeMetricValue = React52__default.useCallback(
36928
37439
  (metric, items) => {
36929
37440
  if (metric.value !== void 0) return metric.value;
36930
37441
  const rows = metric.filter ? items.filter((item) => item[metric.filter.field] === metric.filter.equals) : items;
@@ -36938,7 +37449,7 @@ var StatCard = ({
36938
37449
  },
36939
37450
  []
36940
37451
  );
36941
- const schemaStats = React51__default.useMemo(() => {
37452
+ const schemaStats = React52__default.useMemo(() => {
36942
37453
  if (!metrics || metrics.length === 0) return null;
36943
37454
  return metrics.map((metric) => ({
36944
37455
  label: metric.label,
@@ -36946,7 +37457,7 @@ var StatCard = ({
36946
37457
  format: metric.format
36947
37458
  }));
36948
37459
  }, [metrics, data, computeMetricValue]);
36949
- const calculatedTrend = React51__default.useMemo(() => {
37460
+ const calculatedTrend = React52__default.useMemo(() => {
36950
37461
  if (manualTrend !== void 0) return manualTrend;
36951
37462
  if (previousValue === void 0 || currentValue === void 0)
36952
37463
  return void 0;
@@ -37185,7 +37696,7 @@ function StateGraph({
37185
37696
  className,
37186
37697
  ...rest
37187
37698
  }) {
37188
- const trait = React51.useMemo(() => ({
37699
+ const trait = React52.useMemo(() => ({
37189
37700
  name: "StateGraph",
37190
37701
  linkedEntity: "",
37191
37702
  states: (states ?? []).map((name) => ({ name, isInitial: name === initialState, isTerminal: false })),
@@ -37446,8 +37957,8 @@ var InlineActivityRow = ({ activity }) => {
37446
37957
  ] });
37447
37958
  };
37448
37959
  var InlineActivityStream = ({ activities, autoScroll = true, className }) => {
37449
- const endRef = React51__default.useRef(null);
37450
- React51__default.useEffect(() => {
37960
+ const endRef = React52__default.useRef(null);
37961
+ React52__default.useEffect(() => {
37451
37962
  if (!autoScroll) return;
37452
37963
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
37453
37964
  }, [activities.length, autoScroll]);
@@ -37559,7 +38070,7 @@ var OrbitalGroup = ({ orbitalName, subagents }) => {
37559
38070
  };
37560
38071
  var SubagentRichCard = ({ subagent }) => {
37561
38072
  const { t } = useTranslate();
37562
- const activities = React51__default.useMemo(
38073
+ const activities = React52__default.useMemo(
37563
38074
  () => subagentMessagesToActivities(subagent.messages),
37564
38075
  [subagent.messages]
37565
38076
  );
@@ -37636,8 +38147,8 @@ var ChatMessageRow = ({ message, index }) => {
37636
38147
  ] });
37637
38148
  };
37638
38149
  var CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
37639
- const endRef = React51__default.useRef(null);
37640
- React51__default.useEffect(() => {
38150
+ const endRef = React52__default.useRef(null);
38151
+ React52__default.useEffect(() => {
37641
38152
  if (!autoScroll) return;
37642
38153
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
37643
38154
  }, [messages.length, autoScroll]);
@@ -38319,7 +38830,7 @@ function TimerDisplay({
38319
38830
  }
38320
38831
  TimerDisplay.displayName = "TimerDisplay";
38321
38832
  function extractToastProps(children) {
38322
- if (!React51__default.isValidElement(children)) {
38833
+ if (!React52__default.isValidElement(children)) {
38323
38834
  if (typeof children === "string") {
38324
38835
  return { message: children };
38325
38836
  }
@@ -38357,7 +38868,7 @@ var ToastSlot = ({
38357
38868
  eventBus.emit(`${prefix}CLOSE`);
38358
38869
  };
38359
38870
  if (!isVisible) return null;
38360
- const isCustomContent = React51__default.isValidElement(children) && !message;
38871
+ const isCustomContent = React52__default.isValidElement(children) && !message;
38361
38872
  const toast = /* @__PURE__ */ jsx(Box, { ...domPassthrough(rest), className: contained ? "absolute bottom-4 right-4 z-50" : "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
38362
38873
  Toast,
38363
38874
  {
@@ -38679,7 +39190,7 @@ var VersionDiffInner = ({
38679
39190
  }) }) })
38680
39191
  ] }) });
38681
39192
  };
38682
- var VersionDiff = React51__default.memo(VersionDiffInner);
39193
+ var VersionDiff = React52__default.memo(VersionDiffInner);
38683
39194
  VersionDiff.displayName = "VersionDiff";
38684
39195
  var actionTypeLabelKeys = {
38685
39196
  measure: "violationAlert.actionType.measure",
@@ -38971,7 +39482,7 @@ function isComponentType(value) {
38971
39482
  return typeof value === "function";
38972
39483
  }
38973
39484
  function lazyChunk(name, loader) {
38974
- const Lazy = React51__default.lazy(
39485
+ const Lazy = React52__default.lazy(
38975
39486
  () => loader().then((m) => {
38976
39487
  const raw = m[name];
38977
39488
  if (!isComponentType(raw)) {
@@ -38981,20 +39492,20 @@ function lazyChunk(name, loader) {
38981
39492
  })
38982
39493
  );
38983
39494
  function ChunkWrapper(props) {
38984
- return React51__default.createElement(React51__default.Suspense, { fallback: null }, React51__default.createElement(Lazy, props));
39495
+ return React52__default.createElement(React52__default.Suspense, { fallback: null }, React52__default.createElement(Lazy, props));
38985
39496
  }
38986
39497
  ChunkWrapper.displayName = `Lazy(${name})`;
38987
39498
  return ChunkWrapper;
38988
39499
  }
38989
- var AvlGlyph2 = lazyChunk("AvlGlyph", () => import('./AvlGlyph-PIXU6QH5.js'));
38990
- var AvlStateMachine2 = lazyChunk("AvlStateMachine", () => import('./AvlStateMachine-CKGMECMG.js'));
38991
- var AvlTransitionDetail = lazyChunk("AvlTransitionDetail", () => import('./AvlTransitionDetail-QZX6G5KJ.js'));
38992
- var AvlTransitionExplainer = lazyChunk("AvlTransitionExplainer", () => import('./AvlTransitionExplainer-26WLEIC6.js'));
38993
- var BehaviorView = lazyChunk("BehaviorView", () => import('./BehaviorView-JLZ4PKWY.js'));
38994
- var FlowCanvas2 = lazyChunk("FlowCanvas", () => import('./FlowCanvas-RPII4V24.js'));
38995
- var LayersPanel = lazyChunk("LayersPanel", () => import('./LayersPanel-M2LHWUFF.js'));
38996
- var ModuleCard = lazyChunk("ModuleCard", () => import('./ModuleCard-NJD6JQGD.js'));
38997
- var OrbInspector2 = lazyChunk("OrbInspector", () => import('./OrbInspector-OWWKPOBF.js'));
39500
+ var AvlGlyph2 = lazyChunk("AvlGlyph", () => import('./AvlGlyph-KZMJDBEB.js'));
39501
+ var AvlStateMachine2 = lazyChunk("AvlStateMachine", () => import('./AvlStateMachine-KVZMFHFU.js'));
39502
+ var AvlTransitionDetail = lazyChunk("AvlTransitionDetail", () => import('./AvlTransitionDetail-7DVGV27I.js'));
39503
+ var AvlTransitionExplainer = lazyChunk("AvlTransitionExplainer", () => import('./AvlTransitionExplainer-RMJ5LQLK.js'));
39504
+ var BehaviorView = lazyChunk("BehaviorView", () => import('./BehaviorView-EYRPME67.js'));
39505
+ var FlowCanvas2 = lazyChunk("FlowCanvas", () => import('./FlowCanvas-J54627TC.js'));
39506
+ var LayersPanel = lazyChunk("LayersPanel", () => import('./LayersPanel-PSXI4EHG.js'));
39507
+ var ModuleCard = lazyChunk("ModuleCard", () => import('./ModuleCard-TNRLL45H.js'));
39508
+ var OrbInspector2 = lazyChunk("OrbInspector", () => import('./OrbInspector-UBEQWWZ2.js'));
38998
39509
  var COMPONENT_REGISTRY = {
38999
39510
  get "Accordion"() {
39000
39511
  return Accordion;
@@ -39809,7 +40320,7 @@ function SuspenseConfigProvider({
39809
40320
  config,
39810
40321
  children
39811
40322
  }) {
39812
- return React51__default.createElement(
40323
+ return React52__default.createElement(
39813
40324
  SuspenseConfigContext.Provider,
39814
40325
  { value: config },
39815
40326
  children
@@ -39999,7 +40510,10 @@ function UISlotComponent(props) {
39999
40510
  const inner = /* @__PURE__ */ jsx(RenderSlotProvider, { slot: props.slot, children: /* @__PURE__ */ jsx(PendingScopeContext.Provider, { value: pendingScope, children: /* @__PURE__ */ jsx(UISlotComponentInner, { ...props }) }) });
40000
40511
  return props.slot === "system" ? /* @__PURE__ */ jsx(Box, { className: "sr-only", children: inner }) : inner;
40001
40512
  }
40002
- function UISlotComponentInner({
40513
+ function UISlotComponentInner(props) {
40514
+ return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(ResolvedSlotContent, { ...props }) });
40515
+ }
40516
+ function ResolvedSlotContent({
40003
40517
  slot,
40004
40518
  portal = false,
40005
40519
  position,
@@ -40506,10 +41020,10 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
40506
41020
  const key = `${parentId}-${index}-trait:${traitName}`;
40507
41021
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
40508
41022
  }
40509
- return /* @__PURE__ */ jsx(React51__default.Fragment, { children: child }, `${parentId}-${index}`);
41023
+ return /* @__PURE__ */ jsx(React52__default.Fragment, { children: child }, `${parentId}-${index}`);
40510
41024
  }
40511
41025
  if (!child || typeof child !== "object") return null;
40512
- if (React51__default.isValidElement(child)) return /* @__PURE__ */ jsx(React51__default.Fragment, { children: child }, `${parentId}-${index}`);
41026
+ if (React52__default.isValidElement(child)) return /* @__PURE__ */ jsx(React52__default.Fragment, { children: child }, `${parentId}-${index}`);
40513
41027
  const childId = `${parentId}-${index}`;
40514
41028
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
40515
41029
  const childAsRecord = child;
@@ -40569,7 +41083,7 @@ function isPatternConfig(value) {
40569
41083
  if (value === null || value === void 0) return false;
40570
41084
  if (typeof value !== "object") return false;
40571
41085
  if (Array.isArray(value)) return false;
40572
- if (React51__default.isValidElement(value)) return false;
41086
+ if (React52__default.isValidElement(value)) return false;
40573
41087
  if (value instanceof Date) return false;
40574
41088
  if (typeof value === "function") return false;
40575
41089
  const record = value;
@@ -40586,9 +41100,9 @@ function renderPatternValue(value) {
40586
41100
  if (typeof value === "string") return renderPatternChildren(value, () => {
40587
41101
  });
40588
41102
  if (value instanceof Date) return /* @__PURE__ */ jsx(PatternDate, { value });
40589
- if (React51__default.isValidElement(value)) return value;
41103
+ if (React52__default.isValidElement(value)) return value;
40590
41104
  if (Array.isArray(value)) {
40591
- return value.map((item, index) => /* @__PURE__ */ jsx(React51__default.Fragment, { children: renderPatternValue(item) }, index));
41105
+ return value.map((item, index) => /* @__PURE__ */ jsx(React52__default.Fragment, { children: renderPatternValue(item) }, index));
40592
41106
  }
40593
41107
  if (isPatternConfig(value)) {
40594
41108
  const { type, ...props } = value;
@@ -40598,7 +41112,7 @@ function renderPatternValue(value) {
40598
41112
  return null;
40599
41113
  }
40600
41114
  function isPlainConfigObject(value) {
40601
- if (React51__default.isValidElement(value)) return false;
41115
+ if (React52__default.isValidElement(value)) return false;
40602
41116
  if (value instanceof Date) return false;
40603
41117
  const proto = Object.getPrototypeOf(value);
40604
41118
  return proto === Object.prototype || proto === null;
@@ -40795,7 +41309,7 @@ function SlotContentRenderer({
40795
41309
  for (const slotKey of CONTENT_NODE_SLOTS) {
40796
41310
  const slotVal = restProps[slotKey];
40797
41311
  if (slotVal === void 0 || slotVal === null) continue;
40798
- if (React51__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
41312
+ if (React52__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
40799
41313
  const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
40800
41314
  if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
40801
41315
  nodeSlotOverrides[slotKey] = renderPatternChildren(
@@ -40849,7 +41363,7 @@ function SlotContentRenderer({
40849
41363
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
40850
41364
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
40851
41365
  const sample = resolvedItems[0];
40852
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React51__default.isValidElement(sample) && !(sample instanceof Date)) {
41366
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React52__default.isValidElement(sample) && !(sample instanceof Date)) {
40853
41367
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
40854
41368
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
40855
41369
  }
@@ -41314,7 +41828,7 @@ function memoryTraitDefinitions(surface) {
41314
41828
  // src/lib/kernel-client-lazy.ts
41315
41829
  function createLazyKernelClient(opts) {
41316
41830
  let loaded;
41317
- const client = import('./kernel-client-JW6OH5FX.js').then((m) => loaded = m.createKernelClient(opts));
41831
+ const client = import('./kernel-client-NMZ56JVU.js').then((m) => loaded = m.createKernelClient(opts));
41318
41832
  client.catch(() => void 0);
41319
41833
  return {
41320
41834
  store: opts.store,
@@ -41881,11 +42395,17 @@ function useTraitStateMachine(uiSlots, options) {
41881
42395
  const { traitIndex: shown, kernel: running, settleOutcome: settle } = pushRef.current;
41882
42396
  const traitName = request.targetTrait;
41883
42397
  const ownsFrame = (frame) => [...shown.byName.values()].some((entry) => entry.frameKey === frame);
41884
- if (traitName === void 0 || !hostDispatchInView(request, response, (t2) => shown.byName.has(t2), ownsFrame)) return;
42398
+ if (traitName === void 0 || !hostDispatchInView(request, response, (t2) => shown.byName.has(t2), ownsFrame)) {
42399
+ for (const emitted of response.success ? response.emittedEvents : []) void running.deliverToListeners(emitted);
42400
+ return;
42401
+ }
41885
42402
  void running.foldHostDispatch(request, response).then((outcome) => settle(traitName, request.event, request.payload, outcome));
41886
42403
  }, { clientId: getTabClientId() });
41887
42404
  }, [transport]);
42405
+ const crumbRef = useRef(options.crumb);
42406
+ crumbRef.current = options.crumb;
41888
42407
  const mountAndSettle = useCallback(async (seeds, payload, route) => {
42408
+ const crumb = crumbRef.current;
41889
42409
  let beforeLocalPaint;
41890
42410
  let outcome;
41891
42411
  try {
@@ -41894,7 +42414,7 @@ function useTraitStateMachine(uiSlots, options) {
41894
42414
  if (beforeLocalPaint === void 0) beforeLocalPaint = slotFlush.checkpoint();
41895
42415
  slotFlush.applyClientEffects(local.clientEffectsByTrait, options.navigate, options.navigateBack, activeTraitNamesRef.current);
41896
42416
  }
41897
- }, { payload, ...route !== void 0 ? { route } : {} });
42417
+ }, { payload, ...route !== void 0 ? { route } : {}, ...crumb !== void 0 ? { crumb } : {} });
41898
42418
  } catch (err) {
41899
42419
  if (beforeLocalPaint !== void 0) slotFlush.rollback(beforeLocalPaint);
41900
42420
  for (const seed of seeds) {
@@ -41931,6 +42451,10 @@ function useTraitStateMachine(uiSlots, options) {
41931
42451
  aliveRef.current = false;
41932
42452
  };
41933
42453
  }, []);
42454
+ const pageTraits = circuit.status === "ready" ? circuit.page.traits : void 0;
42455
+ useEffect(() => {
42456
+ if (pageTraits !== void 0) uiSlots.setDeclaredTraitOrder(pageTraits);
42457
+ }, [pageTraits, uiSlots]);
41934
42458
  const kernelClientRef = useRef(kernelClient);
41935
42459
  kernelClientRef.current = kernelClient;
41936
42460
  useEffect(() => () => {
@@ -41958,10 +42482,15 @@ function useTraitStateMachine(uiSlots, options) {
41958
42482
  const cause = err instanceof TraitMountError ? err.original : err;
41959
42483
  stateLog.warn("mount:failed", { traits, failed, error: message, stack: cause instanceof Error ? cause.stack : void 0 });
41960
42484
  if (!aliveRef.current) return;
42485
+ const refused = err instanceof TransportStatusError ? err : void 0;
41961
42486
  uiSlots.render({
41962
42487
  target: "main",
41963
42488
  pattern: "error-state",
41964
- props: { title: t("error.traitMountFailed", { trait: failed }), message, "data-testid": TRAIT_MOUNT_ERROR_TESTID },
42489
+ props: {
42490
+ title: refused !== void 0 ? t("error.serverRefused") : t("error.traitMountFailed", { trait: failed }),
42491
+ message: refused?.refusal?.error ?? message,
42492
+ "data-testid": TRAIT_MOUNT_ERROR_TESTID
42493
+ },
41965
42494
  sourceTrait: MOUNT_ERROR_SOURCE
41966
42495
  });
41967
42496
  });
@@ -42064,7 +42593,7 @@ function PageAccessHost({
42064
42593
  if (access === "public") return /* @__PURE__ */ jsx(Fragment, { children });
42065
42594
  if (!gated) return authority === "pending" ? null : /* @__PURE__ */ jsx(Fragment, { children });
42066
42595
  if (authority !== "authenticated") return null;
42067
- return /* @__PURE__ */ jsx(React51__default.Fragment, { children }, viewerId);
42596
+ return /* @__PURE__ */ jsx(React52__default.Fragment, { children }, viewerId);
42068
42597
  }
42069
42598
  PageAccessHost.displayName = "PageAccessHost";
42070
42599
  function useBrowserStore(appName, orbitals, locale) {
@@ -42239,7 +42768,7 @@ function NavStackRefBridge({ apiRef }) {
42239
42768
  }, [api, apiRef]);
42240
42769
  return null;
42241
42770
  }
42242
- function TraitInitializer({ pageName, routeParams, mountKey, orbitals, metadata, stamp, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, browserStore, hasBridge, children }) {
42771
+ function TraitInitializer({ pageName, routePath, crumb, routeParams, mountKey, orbitals, metadata, stamp, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, browserStore, hasBridge, children }) {
42243
42772
  const bridge = useServerBridge();
42244
42773
  const uiSlots = useUISlots();
42245
42774
  useEffect(() => {
@@ -42252,6 +42781,8 @@ function TraitInitializer({ pageName, routeParams, mountKey, orbitals, metadata,
42252
42781
  const { entityBindingSource, awaitingSkeletonSource, circuit, sessionTheme } = useTraitStateMachine(uiSlots, {
42253
42782
  orbitals,
42254
42783
  ...pageName !== void 0 ? { page: pageName } : {},
42784
+ ...routePath !== void 0 ? { routePath } : {},
42785
+ ...crumb !== void 0 ? { crumb } : {},
42255
42786
  ...metadata !== void 0 ? { metadata } : {},
42256
42787
  ...stamp !== void 0 ? { stamp } : {},
42257
42788
  ...onNavigate !== void 0 ? { navigate: onNavigate } : {},
@@ -42344,7 +42875,7 @@ function FitToBox({ children, mode = "box" }) {
42344
42875
  }
42345
42876
  ) });
42346
42877
  }
42347
- function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, themeOverride, frame }) {
42878
+ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routePath, crumb, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, themeOverride, frame }) {
42348
42879
  const stamp = useMemo(() => programStamp(schema), [schema]);
42349
42880
  const activeOrbitalTheme = useMemo(() => resolvePreviewTheme(schema, pageName), [schema, pageName]);
42350
42881
  const { locale } = useTranslate();
@@ -42369,6 +42900,8 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
42369
42900
  TraitInitializer,
42370
42901
  {
42371
42902
  pageName,
42903
+ ...routePath !== void 0 ? { routePath } : {},
42904
+ ...crumb !== void 0 ? { crumb } : {},
42372
42905
  routeParams,
42373
42906
  mountKey: pageName,
42374
42907
  orbitals: schema.orbitals,
@@ -42546,6 +43079,8 @@ function OrbPreview({
42546
43079
  return pattern.replace(/:([A-Za-z0-9_]+)/g, (whole, key) => routeParams[key] ?? whole);
42547
43080
  }, [currentPagePath, routeParams]);
42548
43081
  const navStackRef = useRef(null);
43082
+ const [crumbedNavigate, setCrumbedNavigate] = useState(null);
43083
+ const openedCrumb = crumbedNavigate !== null && crumbedNavigate.path === concreteCurrentPath ? crumbedNavigate.crumb : void 0;
42549
43084
  const announcePage = useCallback((path) => {
42550
43085
  if (onPageChange) {
42551
43086
  onPageChange(path);
@@ -42624,6 +43159,7 @@ function OrbPreview({
42624
43159
  const handleNavigateEffect = useCallback(
42625
43160
  (path, params, crumb) => {
42626
43161
  navStackRef.current?.beginNavigate(path, crumb);
43162
+ setCrumbedNavigate(crumb !== void 0 && crumb !== "" ? { path, crumb } : null);
42627
43163
  handleNavigate(path, params);
42628
43164
  },
42629
43165
  [handleNavigate]
@@ -42714,6 +43250,8 @@ function OrbPreview({
42714
43250
  getAccessToken,
42715
43251
  mockData: effectiveMockData,
42716
43252
  pageName: currentPage,
43253
+ routePath: concreteCurrentPath,
43254
+ ...openedCrumb !== void 0 ? { crumb: openedCrumb } : {},
42717
43255
  routeParams,
42718
43256
  onNavigate: handleNavigateEffect,
42719
43257
  onNavigateBack: handleNavigateBack,
@@ -42731,6 +43269,8 @@ function OrbPreview({
42731
43269
  getAccessToken,
42732
43270
  mockData: effectiveMockData,
42733
43271
  pageName: currentPage,
43272
+ routePath: concreteCurrentPath,
43273
+ ...openedCrumb !== void 0 ? { crumb: openedCrumb } : {},
42734
43274
  routeParams,
42735
43275
  onNavigate: handleNavigateEffect,
42736
43276
  onNavigateBack: handleNavigateBack,
@@ -42752,9 +43292,9 @@ function OrbPreview({
42752
43292
  }
42753
43293
  OrbPreview.displayName = "OrbPreview";
42754
43294
  var log15 = createLogger("almadar:ui:canvas-dnd");
42755
- var CanvasDragKindContext = React51__default.createContext(null);
43295
+ var CanvasDragKindContext = React52__default.createContext(null);
42756
43296
  function useCanvasDragKind() {
42757
- return React51__default.useContext(CanvasDragKindContext);
43297
+ return React52__default.useContext(CanvasDragKindContext);
42758
43298
  }
42759
43299
  function useCanvasDraggable({
42760
43300
  id,
@@ -42843,12 +43383,12 @@ function CanvasDndProvider({
42843
43383
  }) {
42844
43384
  const eventBus = useEventBus();
42845
43385
  const sensors = useAlmadarDndSensors(false);
42846
- const [activePayload, setActivePayload] = React51__default.useState(null);
42847
- const lastPointerRef = React51__default.useRef(null);
42848
- const trackPointer = React51__default.useCallback((ev) => {
43386
+ const [activePayload, setActivePayload] = React52__default.useState(null);
43387
+ const lastPointerRef = React52__default.useRef(null);
43388
+ const trackPointer = React52__default.useCallback((ev) => {
42849
43389
  lastPointerRef.current = { x: ev.clientX, y: ev.clientY };
42850
43390
  }, []);
42851
- const handleDragStart = React51__default.useCallback((e) => {
43391
+ const handleDragStart = React52__default.useCallback((e) => {
42852
43392
  const data = e.active.data.current;
42853
43393
  const payload = data?.payload;
42854
43394
  const activator = e.activatorEvent;
@@ -42861,7 +43401,7 @@ function CanvasDndProvider({
42861
43401
  log15.warn("dragStart:missing-payload", { id: e.active.id });
42862
43402
  }
42863
43403
  }, [trackPointer]);
42864
- const handleDragEnd = React51__default.useCallback((e) => {
43404
+ const handleDragEnd = React52__default.useCallback((e) => {
42865
43405
  setActivePayload(null);
42866
43406
  document.removeEventListener("pointermove", trackPointer);
42867
43407
  const activeData = e.active.data.current;
@@ -42894,7 +43434,7 @@ function CanvasDndProvider({
42894
43434
  const suppressed = onDrop ? onDrop(drop) === true : false;
42895
43435
  if (!suppressed) defaultEmit(eventBus, drop);
42896
43436
  }, [eventBus, onDrop, trackPointer]);
42897
- const handleDragCancel = React51__default.useCallback(() => {
43437
+ const handleDragCancel = React52__default.useCallback(() => {
42898
43438
  setActivePayload(null);
42899
43439
  document.removeEventListener("pointermove", trackPointer);
42900
43440
  log15.info("dragCancel");
@@ -43950,7 +44490,7 @@ var OrbPreviewNodeInner = (props) => {
43950
44490
  const targets = [...siblings, parent.box];
43951
44491
  const moved = layoutBoxOf(el);
43952
44492
  const painted = moved instanceof HTMLElement ? moved : null;
43953
- const before = painted?.style.translate ?? "";
44493
+ const before2 = painted?.style.translate ?? "";
43954
44494
  let current = start;
43955
44495
  let dragging = false;
43956
44496
  const move = (ev) => {
@@ -43970,7 +44510,7 @@ var OrbPreviewNodeInner = (props) => {
43970
44510
  window.removeEventListener("pointerup", up);
43971
44511
  setGuides([]);
43972
44512
  if (!dragging) return;
43973
- if (painted) painted.style.translate = before;
44513
+ if (painted) painted.style.translate = before2;
43974
44514
  suppressClickRef.current = true;
43975
44515
  const position = positionOf(classes);
43976
44516
  const offset = offsetWithin(current, parent.box);
@@ -44382,7 +44922,7 @@ var OrbPreviewNodeInner = (props) => {
44382
44922
  }
44383
44923
  );
44384
44924
  };
44385
- var OrbPreviewNode = React51__default.memo(OrbPreviewNodeInner);
44925
+ var OrbPreviewNode = React52__default.memo(OrbPreviewNodeInner);
44386
44926
  OrbPreviewNode.displayName = "OrbPreviewNode";
44387
44927
  orbPreviewLog.debug("export-resolved", () => ({
44388
44928
  type: typeof OrbPreviewNode,
@@ -45918,4 +46458,4 @@ function AppearanceSection({ patternConfig, themeManifest, onPropChange, onToken
45918
46458
  ] });
45919
46459
  }
45920
46460
 
45921
- export { AVL_GRAPH_NODE_TYPES, ActionPalette, ActionTile, ActivationBlock, ActivityRail, AgentActivityFeed, AgentActivityRow, AgentChatFeed, AgentThinkingRow, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AuthLayout, AvlGraphCanvas, AwaitingSkeletonContext, BiologyCanvas, BloomQuizBlock, BranchingLogicBuilder, Breadcrumb, ButtonGroup, CANVAS_TOOLS, COMPACT_MEDIA_QUERY, CalendarGrid, Canvas, Canvas2D, CanvasDndProvider, CanvasVerifyContext, Card2 as Card, Carousel, ChangeList, Chart, ChartLegend, ChatBar, ChemistryCanvas, ChoiceButton, CodeBlock, CodeRunnerPanel, CommandPalette, CommitRow, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTION_KEYS, DEFAULT_MATRIX_COLUMN_KEYS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DateRangePicker, DateRangeSelector, DependencyColumnNode, DependencyNode, DetailPanel, DialogueBubble, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, DrawFxLayer, DrawGroup, DrawMesh, DrawShape, DrawShapeLayer, DrawSkinnedMesh, DrawSprite, DrawSpriteLayer, DrawText, DrawTextLayer, Drawer, DrawerSlot, EDITABLE, ELEMENT_SELECTED_EVENT, EdgeDecoration, ElementEditAccessContext, EmojiPicker, EntityBindingContext, EntitySchemaProvider, ErrorBoundary, ErrorState, EventFlowEdge, FEATURE_COLORS, FLOOR_HEIGHT, FeatureCard, FeatureGrid, FilterGroup, Flex, FlipCard, FloatingActionButton, FloatingToolbar, FlowCanvas, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioContext, GameAudioCue, GameAudioProvider, GameAudioToggle, GameHud, GameMenu, GameShell, Gantt, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, GuestView, Header, HealthBar, IconButton, ImportPreviewTree, ImportProgress, ImportSourcePicker, InputGroup, JazariStateMachine, KernelEngineContext, KernelEngineProvider, KernelLoaderMissingError, KnobField, KnobSettingRow, LIVE_STATE, LearningCanvas, Lightbox, LikertScale, LineChart2 as LineChart, LoadingState, MachinePanel, MapView, MarkdownContent, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, Navigation, NumberStepper, OptionConstraintGroup, OrbInspector, OrbPreview, OrbPreviewNode, OrbitalProvider, OrbitalVisualization, PageAccessHost, PageHeader, PageTransition, Pagination, PhysicsCanvas, PositionedCanvas, ProgressDots, PullToRefresh, QrScanner, QuizBlock, ReflectionBlock, RelationSelect, RenderSlotProvider, RepeatableFormSection, ReplyTree, RichTextEditor, RowSetResolverProvider, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SegmentRenderer, SelectionContext, SelectionProvider, SequenceBar, ServerBridgeProvider, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SkeletonTree, SlotContainedContext, SlotContentRenderer, SocialProof, SortableList, Split, SplitPane, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, SubagentTracePanel, SuspenseConfigProvider, SwipeableRow, SystemBandNode, SystemMapContext, SystemNode, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagInput, Timeline, TimerDisplay, Toast, ToastSlot, TopNavItem, TraitFrame, TraitSlot, TraitStateViewer, UISlotComponent, UISlotRenderer, UploadDropZone, VerificationProvider, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, activityRowFacts, applyCompletion, applySuggestions, canvasViewGraph, createUnitAnimationState, dependencyReach, deriveEditFocusFromElement, dispatchCommandPaletteCommand, dropBusEvent, flowNeighbors, frameRect, getCurrentFrame, groupIntoConversations, hasCanvasTool, inferDirection, initialStateOf, isoToScreen, layeredGraph, mapServerEffectResults, optionForPlayedStep, parseEditFocus, preloadCodeHighlighter, propAccessAt, registerCodeLanguageLoader, renderPatternProps, renderPatternValue, resolveFrame, resolveSheetDirection, sanitizeRichHtml, schemaToDependencyGraph, schemaToOverviewGraph, screenToIso, stateOptionsOf, tickAnimationState, toCodeLanguage, traitFlowGraph, transitionAnimation, useAwaitingSkeleton, useCamera, useCanvasDraggable, useCanvasDroppable, useCompactLayout, useDockLayout, useEntityBindingSnapshot, useEntitySchema, useEntitySchemaOptional, useGameAudio, useGameAudioContext, useGameAudioContextOptional, useImageCache, useInlineTextEdit, useKernelEngine, useRenderSlot, useRowSetResolver, useRowSetResolverHandle, useSelection, useSelectionOptional, useServerBridge, useTraitStateMachine };
46461
+ export { AVL_GRAPH_NODE_TYPES, ActionPalette, ActionTile, ActivationBlock, ActivityRail, AgentActivityFeed, AgentActivityRow, AgentChatFeed, AgentThinkingRow, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AuthLayout, AvlGraphCanvas, AwaitingSkeletonContext, BiologyCanvas, BloomQuizBlock, BranchingLogicBuilder, Breadcrumb, ButtonGroup, CANVAS_TOOLS, COMPACT_MEDIA_QUERY, CalendarGrid, Canvas, Canvas2D, CanvasDndProvider, CanvasVerifyContext, Card2 as Card, Carousel, ChangeList, Chart, ChartLegend, ChatBar, ChemistryCanvas, ChoiceButton, CodeBlock, CodeRunnerPanel, CommandPalette, CommitRow, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTION_KEYS, DEFAULT_MATRIX_COLUMN_KEYS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DateRangePicker, DateRangeSelector, DependencyColumnNode, DependencyNode, DetailPanel, DialogueBubble, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, DrawFxLayer, DrawGroup, DrawMesh, DrawShape, DrawShapeLayer, DrawSkinnedMesh, DrawSprite, DrawSpriteLayer, DrawText, DrawTextLayer, Drawer, DrawerSlot, EDITABLE, ELEMENT_SELECTED_EVENT, EdgeDecoration, ElementEditAccessContext, EmojiPicker, EntityBindingContext, EntitySchemaProvider, ErrorBoundary, ErrorState, EventFlowEdge, FEATURE_COLORS, FLOOR_HEIGHT, FeatureCard, FeatureGrid, FilterGroup, Flex, FlipCard, FloatingActionButton, FloatingToolbar, FlowCanvas, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioContext, GameAudioCue, GameAudioProvider, GameAudioToggle, GameHud, GameMenu, GameShell, Gantt, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, GuestView, Header, HealthBar, IconButton, ImportPreviewTree, ImportProgress, ImportSourcePicker, InputGroup, JazariStateMachine, KernelEngineContext, KernelEngineProvider, KernelLoaderMissingError, KnobField, KnobSettingRow, LIVE_STATE, LearningCanvas, Lightbox, LikertScale, LineChart2 as LineChart, LoadingState, MachinePanel, MapView, MarkdownContent, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, Navigation, NumberStepper, OptionConstraintGroup, OrbInspector, OrbPreview, OrbPreviewNode, OrbitalProvider, OrbitalVisualization, PageAccessHost, PageHeader, PageTransition, Pagination, PhysicsCanvas, PositionedCanvas, ProgressDots, PullToRefresh, QrScanner, QuizBlock, ReflectionBlock, RelationSelect, RenderSlotProvider, RepeatableFormSection, ReplyTree, RichTextEditor, RowSetResolverProvider, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SegmentRenderer, SelectionContext, SelectionProvider, SequenceBar, ServerBridgeProvider, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SkeletonTree, SlotContainedContext, SlotContentRenderer, SocialProof, SortableList, Split, SplitPane, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, SubagentTracePanel, SuspenseConfigProvider, SwipeableRow, SystemBandNode, SystemMapContext, SystemNode, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagInput, Timeline, TimerDisplay, Toast, ToastSlot, TopNavItem, TraitFrame, TraitSlot, TraitStateViewer, UISlotComponent, UISlotRenderer, UploadDropZone, VerificationProvider, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, activityRowFacts, applyCompletion, applySuggestions, canvasViewGraph, createUnitAnimationState, dependencyReach, deriveEditFocusFromElement, dispatchCommandPaletteCommand, dropBusEvent, flowNeighbors, frameRect, getCurrentFrame, groupIntoConversations, hasCanvasTool, inferDirection, initialStateOf, isoToScreen, layeredGraph, mapServerEffectResults, optionForPlayedStep, parseEditFocus, parseMarkdownWithCodeBlocks, preloadCodeHighlighter, propAccessAt, registerCodeLanguageLoader, renderPatternProps, renderPatternValue, resolveFrame, resolveSheetDirection, sanitizeRichHtml, schemaToDependencyGraph, schemaToOverviewGraph, screenToIso, stateOptionsOf, tickAnimationState, toCodeLanguage, traitFlowGraph, transitionAnimation, useAwaitingSkeleton, useCamera, useCanvasDraggable, useCanvasDroppable, useCompactLayout, useDockLayout, useEntityBindingSnapshot, useEntitySchema, useEntitySchemaOptional, useGameAudio, useGameAudioContext, useGameAudioContextOptional, useImageCache, useInlineTextEdit, useKernelEngine, useRenderSlot, useRowSetResolver, useRowSetResolverHandle, useSelection, useSelectionOptional, useServerBridge, useTraitStateMachine };