@almadar/ui 6.3.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/avl/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React94 from 'react';
3
- import React94__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
2
+ import * as React95 from 'react';
3
+ import React95__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
4
4
  import { getAllPages, matchPathAmong, CurrentPagePathProvider, NavStackProvider, OrbitalProvider, EventBusContext, useTraitScopeChain, useNavStack, ServerBridgeProvider, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, useServerBridge, EntityBindingContext, useEntitySchema, RenderSlotProvider, useEntitySchemaOptional, useEntityBindingSnapshot, TraitScopeProvider, useTraitScope, useCurrentPagePath, useRenderSlot, useGameAudioContextOptional } from '@almadar/ui/providers';
5
5
  import { createLogger, setNamespaceLevel, isLogLevelEnabled } from '@almadar/logger';
6
6
  import ELK from 'elkjs/lib/elk.bundled.js';
@@ -68,7 +68,7 @@ import ReactMarkdown from 'react-markdown';
68
68
  import remarkGfm from 'remark-gfm';
69
69
  import remarkMath from 'remark-math';
70
70
  import rehypeKatex from 'rehype-katex';
71
- import { useDroppable, useDraggable, DndContext, DragOverlay, useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners } from '@dnd-kit/core';
71
+ import { useDroppable, useDraggable as useDraggable$1, DndContext, DragOverlay, useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners } from '@dnd-kit/core';
72
72
  import { sortableKeyboardCoordinates, useSortable, arrayMove, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
73
73
  import { CSS } from '@dnd-kit/utilities';
74
74
  import { ordered, lib } from 'emojilib';
@@ -3301,7 +3301,7 @@ var init_Typography = __esm({
3301
3301
  if (format !== void 0 && format !== "none" && (typeof body === "string" || typeof body === "number" || body instanceof Date)) {
3302
3302
  body = formatValue(body, format);
3303
3303
  }
3304
- return React94__default.createElement(
3304
+ return React95__default.createElement(
3305
3305
  Component,
3306
3306
  {
3307
3307
  id,
@@ -3647,7 +3647,7 @@ var init_Box = __esm({
3647
3647
  fixed: "fixed",
3648
3648
  sticky: "sticky"
3649
3649
  };
3650
- Box = React94__default.forwardRef(
3650
+ Box = React95__default.forwardRef(
3651
3651
  ({
3652
3652
  padding,
3653
3653
  paddingX,
@@ -3712,7 +3712,7 @@ var init_Box = __esm({
3712
3712
  onPointerDown?.(e);
3713
3713
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
3714
3714
  const isClickable = action || onClick;
3715
- return React94__default.createElement(
3715
+ return React95__default.createElement(
3716
3716
  Component,
3717
3717
  {
3718
3718
  ref,
@@ -3808,7 +3808,7 @@ var init_Stack = __esm({
3808
3808
  };
3809
3809
  const isHorizontal = direction === "horizontal";
3810
3810
  const directionClass = responsive && isHorizontal ? reverse ? "flex-col-reverse md:flex-row-reverse" : "flex-col md:flex-row" : isHorizontal ? reverse ? "flex-row-reverse" : "flex-row" : reverse ? "flex-col-reverse" : "flex-col";
3811
- return React94__default.createElement(
3811
+ return React95__default.createElement(
3812
3812
  Component,
3813
3813
  {
3814
3814
  className: cn(
@@ -4300,7 +4300,7 @@ var init_MiniStateMachine = __esm({
4300
4300
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
4301
4301
  const tc = transitionCounts[s.name] ?? 0;
4302
4302
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
4303
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
4303
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
4304
4304
  /* @__PURE__ */ jsx(
4305
4305
  AvlState,
4306
4306
  {
@@ -4583,7 +4583,7 @@ function resolveMarkerExpression(expression, entity, config, state) {
4583
4583
  function isPlainObject(value) {
4584
4584
  if (value === null || value === void 0 || typeof value !== "object") return false;
4585
4585
  if (Array.isArray(value)) return false;
4586
- if (React94__default.isValidElement(value)) return false;
4586
+ if (React95__default.isValidElement(value)) return false;
4587
4587
  if (value instanceof Date) return false;
4588
4588
  if (typeof value === "function") return false;
4589
4589
  return true;
@@ -4592,7 +4592,7 @@ function isEvaluatorResolvedData(value) {
4592
4592
  return evaluatorResolvedData.has(value);
4593
4593
  }
4594
4594
  function brandResolved(value) {
4595
- if (value !== null && typeof value === "object" && !React94__default.isValidElement(value) && !(value instanceof Date)) {
4595
+ if (value !== null && typeof value === "object" && !React95__default.isValidElement(value) && !(value instanceof Date)) {
4596
4596
  resolvedMarkerFree.add(value);
4597
4597
  }
4598
4598
  }
@@ -4625,7 +4625,7 @@ function walkValue(value, scopeTrait, entity, config, state) {
4625
4625
  }
4626
4626
  const resolved = resolveMarkerExpression(value.expression, entity, config, state);
4627
4627
  markerResolutionCache.set(value, { entity, config, state, resolved });
4628
- if (resolved !== null && typeof resolved === "object" && !React94__default.isValidElement(resolved) && !(resolved instanceof Date)) {
4628
+ if (resolved !== null && typeof resolved === "object" && !React95__default.isValidElement(resolved) && !(resolved instanceof Date)) {
4629
4629
  resolvedMarkerFree.add(resolved);
4630
4630
  evaluatorResolvedData.add(resolved);
4631
4631
  }
@@ -4876,7 +4876,7 @@ var init_Icon = __esm({
4876
4876
  const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
4877
4877
  const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
4878
4878
  const family = useIconFamily();
4879
- const RenderedComponent = React94__default.useMemo(() => {
4879
+ const RenderedComponent = React95__default.useMemo(() => {
4880
4880
  if (directIcon) return null;
4881
4881
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
4882
4882
  }, [directIcon, effectiveName, family]);
@@ -5005,7 +5005,7 @@ var init_atlasSlice = __esm({
5005
5005
  }
5006
5006
  });
5007
5007
  function useAtlasSliceDataUrl(asset) {
5008
- const [, bump] = React94.useReducer((x) => x + 1, 0);
5008
+ const [, bump] = React95.useReducer((x) => x + 1, 0);
5009
5009
  if (!isAtlasAsset(asset)) return void 0;
5010
5010
  const key = `${asset.atlas}#${asset.sprite}`;
5011
5011
  const cached = sliceDataUrlCache.get(key);
@@ -5068,13 +5068,13 @@ function AtlasImage({
5068
5068
  style,
5069
5069
  "aria-hidden": ariaHidden
5070
5070
  }) {
5071
- const [, bump] = React94.useReducer((x) => x + 1, 0);
5072
- const canvasRef = React94.useRef(null);
5071
+ const [, bump] = React95.useReducer((x) => x + 1, 0);
5072
+ const canvasRef = React95.useRef(null);
5073
5073
  const sliced = isAtlasAsset(asset);
5074
5074
  const atlas = sliced ? getAtlas(asset.atlas, bump) : void 0;
5075
5075
  const img = sliced && asset?.url ? getSheetImage(asset.url, bump) : null;
5076
5076
  const rect = sliced && atlas ? subRectFor(atlas, asset.sprite) : null;
5077
- React94.useEffect(() => {
5077
+ React95.useEffect(() => {
5078
5078
  const canvas = canvasRef.current;
5079
5079
  if (!canvas || !img || !rect) return;
5080
5080
  canvas.width = rect.sw;
@@ -5150,7 +5150,7 @@ function resolveIconProp(value, sizeClass) {
5150
5150
  const IconComp = value;
5151
5151
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
5152
5152
  }
5153
- if (React94__default.isValidElement(value)) {
5153
+ if (React95__default.isValidElement(value)) {
5154
5154
  return value;
5155
5155
  }
5156
5156
  if (typeof value === "object" && value !== null && isIconLike(value)) {
@@ -5227,7 +5227,7 @@ var init_Button = __esm({
5227
5227
  md: "h-icon-default w-icon-default",
5228
5228
  lg: "h-icon-default w-icon-default"
5229
5229
  };
5230
- Button = React94__default.forwardRef(
5230
+ Button = React95__default.forwardRef(
5231
5231
  ({
5232
5232
  className,
5233
5233
  variant = "primary",
@@ -5297,7 +5297,7 @@ var Dialog;
5297
5297
  var init_Dialog = __esm({
5298
5298
  "components/core/atoms/Dialog.tsx"() {
5299
5299
  init_cn();
5300
- Dialog = React94__default.forwardRef(
5300
+ Dialog = React95__default.forwardRef(
5301
5301
  ({
5302
5302
  role = "dialog",
5303
5303
  "aria-modal": ariaModal = true,
@@ -5507,7 +5507,6 @@ var init_Modal = __esm({
5507
5507
  ),
5508
5508
  style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
5509
5509
  onClick: handleOverlayClick,
5510
- "aria-hidden": "true",
5511
5510
  children: /* @__PURE__ */ jsxs(
5512
5511
  Dialog,
5513
5512
  {
@@ -5742,7 +5741,7 @@ var init_Drawer = __esm({
5742
5741
  };
5743
5742
  const widthClass = width in sizeWidths ? sizeWidths[width] : "";
5744
5743
  const widthStyle = width in sizeWidths ? void 0 : { width };
5745
- const positionClasses = position === "right" ? "right-0 border-l" : "left-0 border-r";
5744
+ const positionClasses2 = position === "right" ? "right-0 border-l" : "left-0 border-r";
5746
5745
  const drawerSign = position === "right" ? 1 : -1;
5747
5746
  const slideTransform = position === "right" ? "translateX(100%)" : "translateX(-100%)";
5748
5747
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -5764,7 +5763,7 @@ var init_Drawer = __esm({
5764
5763
  className: cn(
5765
5764
  "fixed top-0 bottom-0 z-50",
5766
5765
  "flex flex-col max-h-screen",
5767
- positionClasses,
5766
+ positionClasses2,
5768
5767
  widthClass,
5769
5768
  drawerAnim,
5770
5769
  className
@@ -5860,7 +5859,7 @@ var init_Badge = __esm({
5860
5859
  md: "px-2.5 py-1 text-sm",
5861
5860
  lg: "px-3 py-1.5 text-base"
5862
5861
  };
5863
- Badge = React94__default.forwardRef(
5862
+ Badge = React95__default.forwardRef(
5864
5863
  ({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
5865
5864
  const iconSizes3 = {
5866
5865
  sm: "h-icon-default w-icon-default",
@@ -6210,7 +6209,7 @@ var init_SvgFlow = __esm({
6210
6209
  width = 100,
6211
6210
  height = 100
6212
6211
  }) => {
6213
- const markerId = React94__default.useMemo(() => {
6212
+ const markerId = React95__default.useMemo(() => {
6214
6213
  flowIdCounter += 1;
6215
6214
  return `almadar-flow-arrow-${flowIdCounter}`;
6216
6215
  }, []);
@@ -6803,7 +6802,7 @@ var init_SvgRing = __esm({
6803
6802
  width = 100,
6804
6803
  height = 100
6805
6804
  }) => {
6806
- const gradientId = React94__default.useMemo(() => {
6805
+ const gradientId = React95__default.useMemo(() => {
6807
6806
  ringIdCounter += 1;
6808
6807
  return `almadar-ring-glow-${ringIdCounter}`;
6809
6808
  }, []);
@@ -6984,7 +6983,7 @@ var init_Input = __esm({
6984
6983
  init_cn();
6985
6984
  init_Icon();
6986
6985
  init_useEventBus();
6987
- Input = React94__default.forwardRef(
6986
+ Input = React95__default.forwardRef(
6988
6987
  ({
6989
6988
  className,
6990
6989
  inputType,
@@ -7008,9 +7007,9 @@ var init_Input = __esm({
7008
7007
  const eventBus = useEventBus();
7009
7008
  const type = inputType || htmlType || "text";
7010
7009
  const isDeclarative = typeof onChange === "string";
7011
- const [localValue, setLocalValue] = React94__default.useState(value);
7012
- const pendingEchoRef = React94__default.useRef(/* @__PURE__ */ new Set());
7013
- React94__default.useEffect(() => {
7010
+ const [localValue, setLocalValue] = React95__default.useState(value);
7011
+ const pendingEchoRef = React95__default.useRef(/* @__PURE__ */ new Set());
7012
+ React95__default.useEffect(() => {
7014
7013
  if (!isDeclarative) return;
7015
7014
  const incoming = value == null ? "" : String(value);
7016
7015
  if (pendingEchoRef.current.has(incoming)) {
@@ -7177,7 +7176,7 @@ var Label;
7177
7176
  var init_Label = __esm({
7178
7177
  "components/core/atoms/Label.tsx"() {
7179
7178
  init_cn();
7180
- Label = React94__default.forwardRef(
7179
+ Label = React95__default.forwardRef(
7181
7180
  ({ className, required, children, ...props }, ref) => {
7182
7181
  return /* @__PURE__ */ jsxs(
7183
7182
  "label",
@@ -7204,7 +7203,7 @@ var init_Textarea = __esm({
7204
7203
  "components/core/atoms/Textarea.tsx"() {
7205
7204
  init_cn();
7206
7205
  init_useEventBus();
7207
- Textarea = React94__default.forwardRef(
7206
+ Textarea = React95__default.forwardRef(
7208
7207
  ({ className, error, onChange, ...props }, ref) => {
7209
7208
  const eventBus = useEventBus();
7210
7209
  const handleChange = (e) => {
@@ -7454,7 +7453,7 @@ var init_Select = __esm({
7454
7453
  init_cn();
7455
7454
  init_Icon();
7456
7455
  init_useEventBus();
7457
- Select = React94__default.forwardRef(
7456
+ Select = React95__default.forwardRef(
7458
7457
  (props, _ref) => {
7459
7458
  const { multiple, searchable, clearable } = props;
7460
7459
  if (multiple || searchable || clearable) {
@@ -7471,7 +7470,7 @@ var init_Checkbox = __esm({
7471
7470
  "components/core/atoms/Checkbox.tsx"() {
7472
7471
  init_cn();
7473
7472
  init_useEventBus();
7474
- Checkbox = React94__default.forwardRef(
7473
+ Checkbox = React95__default.forwardRef(
7475
7474
  ({ className, label, id, onChange, ...props }, ref) => {
7476
7475
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
7477
7476
  const eventBus = useEventBus();
@@ -7525,7 +7524,7 @@ var init_Spinner = __esm({
7525
7524
  md: "h-6 w-6",
7526
7525
  lg: "h-8 w-8"
7527
7526
  };
7528
- Spinner = React94__default.forwardRef(
7527
+ Spinner = React95__default.forwardRef(
7529
7528
  ({ className, size = "md", overlay, ...props }, ref) => {
7530
7529
  if (overlay) {
7531
7530
  return /* @__PURE__ */ jsx(
@@ -7615,7 +7614,7 @@ var init_Card = __esm({
7615
7614
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
7616
7615
  "tile-image-first": "p-0 overflow-hidden"
7617
7616
  };
7618
- Card = React94__default.forwardRef(
7617
+ Card = React95__default.forwardRef(
7619
7618
  ({
7620
7619
  className,
7621
7620
  variant = "bordered",
@@ -7664,9 +7663,9 @@ var init_Card = __esm({
7664
7663
  }
7665
7664
  );
7666
7665
  Card.displayName = "Card";
7667
- CardHeader = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7666
+ CardHeader = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7668
7667
  CardHeader.displayName = "CardHeader";
7669
- CardTitle = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7668
+ CardTitle = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7670
7669
  "h3",
7671
7670
  {
7672
7671
  ref,
@@ -7679,11 +7678,11 @@ var init_Card = __esm({
7679
7678
  }
7680
7679
  ));
7681
7680
  CardTitle.displayName = "CardTitle";
7682
- CardContent = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7681
+ CardContent = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7683
7682
  CardContent.displayName = "CardContent";
7684
7683
  CardBody = CardContent;
7685
7684
  CardBody.displayName = "CardBody";
7686
- CardFooter = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7685
+ CardFooter = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7687
7686
  "div",
7688
7687
  {
7689
7688
  ref,
@@ -7770,7 +7769,7 @@ var init_FilterPill = __esm({
7770
7769
  md: "w-3.5 h-3.5",
7771
7770
  lg: "w-4 h-4"
7772
7771
  };
7773
- FilterPill = React94__default.forwardRef(
7772
+ FilterPill = React95__default.forwardRef(
7774
7773
  ({
7775
7774
  className,
7776
7775
  variant = "default",
@@ -7899,8 +7898,8 @@ var init_Avatar = __esm({
7899
7898
  actionPayload
7900
7899
  }) => {
7901
7900
  const eventBus = useEventBus();
7902
- const [imgFailed, setImgFailed] = React94__default.useState(false);
7903
- React94__default.useEffect(() => {
7901
+ const [imgFailed, setImgFailed] = React95__default.useState(false);
7902
+ React95__default.useEffect(() => {
7904
7903
  setImgFailed(false);
7905
7904
  }, [src]);
7906
7905
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -8013,7 +8012,7 @@ var init_Center = __esm({
8013
8012
  as: Component = "div"
8014
8013
  }) => {
8015
8014
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
8016
- return React94__default.createElement(Component, {
8015
+ return React95__default.createElement(Component, {
8017
8016
  className: cn(
8018
8017
  inline ? "inline-flex" : "flex",
8019
8018
  horizontal && "justify-center",
@@ -8281,7 +8280,7 @@ var init_Radio = __esm({
8281
8280
  md: "w-2.5 h-2.5",
8282
8281
  lg: "w-3 h-3"
8283
8282
  };
8284
- Radio = React94__default.forwardRef(
8283
+ Radio = React95__default.forwardRef(
8285
8284
  ({
8286
8285
  label,
8287
8286
  helperText,
@@ -8298,12 +8297,12 @@ var init_Radio = __esm({
8298
8297
  onChange,
8299
8298
  ...props
8300
8299
  }, ref) => {
8301
- const reactId = React94__default.useId();
8300
+ const reactId = React95__default.useId();
8302
8301
  const baseId = id || `radio-${reactId}`;
8303
8302
  const hasError = !!error;
8304
8303
  const eventBus = useEventBus();
8305
- const [selected, setSelected] = React94__default.useState(value);
8306
- React94__default.useEffect(() => {
8304
+ const [selected, setSelected] = React95__default.useState(value);
8305
+ React95__default.useEffect(() => {
8307
8306
  if (value !== void 0) setSelected(value);
8308
8307
  }, [value]);
8309
8308
  const pick = (next, e) => {
@@ -8485,7 +8484,7 @@ var init_Switch = __esm({
8485
8484
  "components/core/atoms/Switch.tsx"() {
8486
8485
  "use client";
8487
8486
  init_cn();
8488
- Switch = React94.forwardRef(
8487
+ Switch = React95.forwardRef(
8489
8488
  ({
8490
8489
  checked,
8491
8490
  defaultChecked = false,
@@ -8496,10 +8495,10 @@ var init_Switch = __esm({
8496
8495
  name,
8497
8496
  className
8498
8497
  }, ref) => {
8499
- const [isChecked, setIsChecked] = React94.useState(
8498
+ const [isChecked, setIsChecked] = React95.useState(
8500
8499
  checked !== void 0 ? checked : defaultChecked
8501
8500
  );
8502
- React94.useEffect(() => {
8501
+ React95.useEffect(() => {
8503
8502
  if (checked !== void 0) {
8504
8503
  setIsChecked(checked);
8505
8504
  }
@@ -8777,7 +8776,7 @@ var Aside;
8777
8776
  var init_Aside = __esm({
8778
8777
  "components/core/atoms/Aside.tsx"() {
8779
8778
  init_cn();
8780
- Aside = React94__default.forwardRef(
8779
+ Aside = React95__default.forwardRef(
8781
8780
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
8782
8781
  );
8783
8782
  Aside.displayName = "Aside";
@@ -8856,9 +8855,9 @@ var init_LawReferenceTooltip = __esm({
8856
8855
  className
8857
8856
  }) => {
8858
8857
  const { t } = useTranslate();
8859
- const [isVisible, setIsVisible] = React94__default.useState(false);
8860
- const timeoutRef = React94__default.useRef(null);
8861
- const triggerRef = React94__default.useRef(null);
8858
+ const [isVisible, setIsVisible] = React95__default.useState(false);
8859
+ const timeoutRef = React95__default.useRef(null);
8860
+ const triggerRef = React95__default.useRef(null);
8862
8861
  const handleMouseEnter = () => {
8863
8862
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8864
8863
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -8869,7 +8868,7 @@ var init_LawReferenceTooltip = __esm({
8869
8868
  };
8870
8869
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
8871
8870
  const open = isVisible || revealed;
8872
- React94__default.useEffect(() => {
8871
+ React95__default.useEffect(() => {
8873
8872
  return () => {
8874
8873
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8875
8874
  };
@@ -9079,7 +9078,7 @@ var init_StatusDot = __esm({
9079
9078
  md: "w-2.5 h-2.5",
9080
9079
  lg: "w-3 h-3"
9081
9080
  };
9082
- StatusDot = React94__default.forwardRef(
9081
+ StatusDot = React95__default.forwardRef(
9083
9082
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
9084
9083
  return /* @__PURE__ */ jsx(
9085
9084
  "span",
@@ -9133,7 +9132,7 @@ var init_TrendIndicator = __esm({
9133
9132
  down: "trending-down",
9134
9133
  flat: "arrow-right"
9135
9134
  };
9136
- TrendIndicator = React94__default.forwardRef(
9135
+ TrendIndicator = React95__default.forwardRef(
9137
9136
  ({
9138
9137
  className,
9139
9138
  value,
@@ -9202,7 +9201,7 @@ var init_RangeSlider = __esm({
9202
9201
  md: "w-4 h-4",
9203
9202
  lg: "w-5 h-5"
9204
9203
  };
9205
- RangeSlider = React94__default.forwardRef(
9204
+ RangeSlider = React95__default.forwardRef(
9206
9205
  ({
9207
9206
  className,
9208
9207
  min = 0,
@@ -9859,7 +9858,7 @@ var init_ContentSection = __esm({
9859
9858
  md: "py-16",
9860
9859
  lg: "py-24"
9861
9860
  };
9862
- ContentSection = React94__default.forwardRef(
9861
+ ContentSection = React95__default.forwardRef(
9863
9862
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
9864
9863
  return /* @__PURE__ */ jsx(
9865
9864
  Box,
@@ -10393,7 +10392,7 @@ var init_AnimatedReveal = __esm({
10393
10392
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
10394
10393
  "none": {}
10395
10394
  };
10396
- AnimatedReveal = React94__default.forwardRef(
10395
+ AnimatedReveal = React95__default.forwardRef(
10397
10396
  ({
10398
10397
  trigger = "scroll",
10399
10398
  animation = "fade-up",
@@ -10553,7 +10552,7 @@ var init_AnimatedGraphic = __esm({
10553
10552
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
10554
10553
  "use client";
10555
10554
  init_cn();
10556
- AnimatedGraphic = React94__default.forwardRef(
10555
+ AnimatedGraphic = React95__default.forwardRef(
10557
10556
  ({
10558
10557
  src,
10559
10558
  svgContent,
@@ -10576,7 +10575,7 @@ var init_AnimatedGraphic = __esm({
10576
10575
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
10577
10576
  const resolvedSvg = svgContent ?? fetchedSvg;
10578
10577
  const prevAnimateRef = useRef(animate);
10579
- const setRef = React94__default.useCallback(
10578
+ const setRef = React95__default.useCallback(
10580
10579
  (node) => {
10581
10580
  containerRef.current = node;
10582
10581
  if (typeof ref === "function") ref(node);
@@ -11328,9 +11327,9 @@ function ControlButton({
11328
11327
  className
11329
11328
  }) {
11330
11329
  const eventBus = useEventBus();
11331
- const [isPressed, setIsPressed] = React94.useState(false);
11330
+ const [isPressed, setIsPressed] = React95.useState(false);
11332
11331
  const actualPressed = pressed ?? isPressed;
11333
- const handlePointerDown = React94.useCallback(
11332
+ const handlePointerDown = React95.useCallback(
11334
11333
  (e) => {
11335
11334
  e.preventDefault();
11336
11335
  if (disabled) return;
@@ -11340,7 +11339,7 @@ function ControlButton({
11340
11339
  },
11341
11340
  [disabled, pressEvent, eventBus, onPress]
11342
11341
  );
11343
- const handlePointerUp = React94.useCallback(
11342
+ const handlePointerUp = React95.useCallback(
11344
11343
  (e) => {
11345
11344
  e.preventDefault();
11346
11345
  if (disabled) return;
@@ -11350,7 +11349,7 @@ function ControlButton({
11350
11349
  },
11351
11350
  [disabled, releaseEvent, eventBus, onRelease]
11352
11351
  );
11353
- const handlePointerLeave = React94.useCallback(
11352
+ const handlePointerLeave = React95.useCallback(
11354
11353
  (e) => {
11355
11354
  if (isPressed) {
11356
11355
  setIsPressed(false);
@@ -11609,18 +11608,18 @@ function ControlGrid({
11609
11608
  className
11610
11609
  }) {
11611
11610
  const eventBus = useEventBus();
11612
- const [active, setActive] = React94.useState(/* @__PURE__ */ new Set());
11613
- const [coarse, setCoarse] = React94.useState(
11611
+ const [active, setActive] = React95.useState(/* @__PURE__ */ new Set());
11612
+ const [coarse, setCoarse] = React95.useState(
11614
11613
  () => typeof window !== "undefined" && window.matchMedia("(pointer: coarse)").matches
11615
11614
  );
11616
- React94.useEffect(() => {
11615
+ React95.useEffect(() => {
11617
11616
  if (visibility !== "auto" || typeof window === "undefined") return;
11618
11617
  const mq = window.matchMedia("(pointer: coarse)");
11619
11618
  const onChange = (e) => setCoarse(e.matches);
11620
11619
  mq.addEventListener("change", onChange);
11621
11620
  return () => mq.removeEventListener("change", onChange);
11622
11621
  }, [visibility]);
11623
- const handlePress = React94.useCallback(
11622
+ const handlePress = React95.useCallback(
11624
11623
  (id) => {
11625
11624
  setActive((prev) => new Set(prev).add(id));
11626
11625
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -11634,7 +11633,7 @@ function ControlGrid({
11634
11633
  },
11635
11634
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
11636
11635
  );
11637
- const handleRelease = React94.useCallback(
11636
+ const handleRelease = React95.useCallback(
11638
11637
  (id) => {
11639
11638
  setActive((prev) => {
11640
11639
  const next = new Set(prev);
@@ -11997,7 +11996,7 @@ function GameMenu({
11997
11996
  }) {
11998
11997
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
11999
11998
  const eventBus = useEventBus();
12000
- const handleOptionClick = React94.useCallback(
11999
+ const handleOptionClick = React95.useCallback(
12001
12000
  (option) => {
12002
12001
  if (option.event) {
12003
12002
  eventBus.emit(`UI:${option.event}`, { option });
@@ -12233,7 +12232,7 @@ function StateGraph({
12233
12232
  }) {
12234
12233
  const eventBus = useEventBus();
12235
12234
  const nodes = states ?? [];
12236
- const positions = React94.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
12235
+ const positions = React95.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
12237
12236
  return /* @__PURE__ */ jsxs(
12238
12237
  Box,
12239
12238
  {
@@ -12304,8 +12303,8 @@ function MiniMap({
12304
12303
  tileAssets,
12305
12304
  unitAssets
12306
12305
  }) {
12307
- const canvasRef = React94.useRef(null);
12308
- const imgCacheRef = React94.useRef(/* @__PURE__ */ new Map());
12306
+ const canvasRef = React95.useRef(null);
12307
+ const imgCacheRef = React95.useRef(/* @__PURE__ */ new Map());
12309
12308
  function loadImg(url) {
12310
12309
  const cached = imgCacheRef.current.get(url);
12311
12310
  if (cached) return cached.complete ? cached : null;
@@ -12321,7 +12320,7 @@ function MiniMap({
12321
12320
  imgCacheRef.current.set(url, img);
12322
12321
  return null;
12323
12322
  }
12324
- React94.useEffect(() => {
12323
+ React95.useEffect(() => {
12325
12324
  const canvas = canvasRef.current;
12326
12325
  if (!canvas) return;
12327
12326
  const ctx = canvas.getContext("2d");
@@ -13555,7 +13554,7 @@ function proceduralShapes(view, pos, fade, progress) {
13555
13554
  }
13556
13555
  }
13557
13556
  }
13558
- function expandFxItem(view, node, epochNowMs, dim, projector) {
13557
+ function expandFxItem(view, node, epochNowMs, dim, projector, fontFamily) {
13559
13558
  if (view.space === "screen") return [];
13560
13559
  const tickMs = node.tickMs ?? DEFAULT_TICK_MS;
13561
13560
  const { ageMs, progress, fade } = fxLifecycle(view, epochNowMs, tickMs);
@@ -13592,6 +13591,7 @@ function expandFxItem(view, node, epochNowMs, dim, projector) {
13592
13591
  }
13593
13592
  if (view.message) {
13594
13593
  const pxSize = projector && view.size !== void 0 ? Math.max(10, Math.round(view.size * projector.tileWidth)) : void 0;
13594
+ const family = fontFamily ?? "system-ui, sans-serif";
13595
13595
  const text = {
13596
13596
  type: "draw-text",
13597
13597
  text: view.message,
@@ -13599,18 +13599,18 @@ function expandFxItem(view, node, epochNowMs, dim, projector) {
13599
13599
  offsetY: -(0.15 + 0.55 * progress),
13600
13600
  color: view.color ?? node.textColor ?? DEFAULT_TEXT_COLOR,
13601
13601
  opacity: fade,
13602
- ...pxSize ? { font: `bold ${pxSize}px system-ui, sans-serif` } : {}
13602
+ font: `bold ${pxSize ?? 14}px ${family}`
13603
13603
  };
13604
13604
  out.push(text);
13605
13605
  }
13606
13606
  return out;
13607
13607
  }
13608
- function expandFxLayer(node, epochNowMs, dim, projector) {
13608
+ function expandFxLayer(node, epochNowMs, dim, projector, fontFamily) {
13609
13609
  if (!Array.isArray(node.items)) return [];
13610
13610
  const out = [];
13611
13611
  for (const item of node.items) {
13612
13612
  if (!item || typeof item.id !== "string") continue;
13613
- out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim, projector));
13613
+ out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim, projector, fontFamily));
13614
13614
  }
13615
13615
  return out;
13616
13616
  }
@@ -13677,7 +13677,7 @@ function paintDrawable(painter, node, dctx) {
13677
13677
  break;
13678
13678
  case "draw-fx-layer": {
13679
13679
  const epochNow = dctx.time > 0 && typeof performance !== "undefined" ? performance.timeOrigin + dctx.time : 0;
13680
- for (const child of expandFxLayer(node, epochNow, "2d", dctx.projector)) paintDrawable(painter, child, dctx);
13680
+ for (const child of expandFxLayer(node, epochNow, "2d", dctx.projector, dctx.fontFamily)) paintDrawable(painter, child, dctx);
13681
13681
  break;
13682
13682
  }
13683
13683
  }
@@ -13787,7 +13787,7 @@ function Canvas2D({
13787
13787
  const registerChildDrawable = useCallback((node) => {
13788
13788
  childDrawablesRef.current.push(node);
13789
13789
  }, []);
13790
- const hasJsxChildren = React94.Children.count(children) > 0;
13790
+ const hasJsxChildren = React95.Children.count(children) > 0;
13791
13791
  function isDrawableLayer(node) {
13792
13792
  return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
13793
13793
  }
@@ -14345,7 +14345,7 @@ function Canvas({
14345
14345
  if (mode !== "3d") return;
14346
14346
  const next = childDrawablesRef.current;
14347
14347
  canvasLog.debug("children:adopt", { registered: next.length, adopted: childDrawables.length });
14348
- if (next.length === 0 && React94.Children.count(children) > 0) return;
14348
+ if (next.length === 0 && React95.Children.count(children) > 0) return;
14349
14349
  setChildDrawables(
14350
14350
  (prev) => prev.length === next.length && JSON.stringify(prev) === JSON.stringify(next) ? prev : [...next]
14351
14351
  );
@@ -14383,7 +14383,7 @@ function Canvas({
14383
14383
  };
14384
14384
  return /* @__PURE__ */ jsxs(Fragment, { children: [
14385
14385
  /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Canvas3DHost, { ...props3d }) }),
14386
- React94.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 }) })
14386
+ React95.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 }) })
14387
14387
  ] });
14388
14388
  }
14389
14389
  return /* @__PURE__ */ jsx(
@@ -14541,7 +14541,7 @@ function LinearView({
14541
14541
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
14542
14542
  const isDone = i < currentIdx;
14543
14543
  const isCurrent = i === currentIdx;
14544
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
14544
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
14545
14545
  i > 0 && /* @__PURE__ */ jsx(
14546
14546
  Typography,
14547
14547
  {
@@ -15076,7 +15076,7 @@ function SequenceBar({
15076
15076
  else onSlotRemove?.(index);
15077
15077
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
15078
15078
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
15079
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
15079
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
15080
15080
  i > 0 && /* @__PURE__ */ jsx(
15081
15081
  Typography,
15082
15082
  {
@@ -15774,7 +15774,7 @@ var init_LearningCanvas = __esm({
15774
15774
  if (drawables?.length && projector) {
15775
15775
  const painter = createWebPainter(ctx, invalidateRef.current);
15776
15776
  const timeMs = needsAnim && typeof performance !== "undefined" ? performance.now() : 0;
15777
- const dctx = { projector, time: timeMs, invalidate: invalidateRef.current };
15777
+ const dctx = { projector, time: timeMs, invalidate: invalidateRef.current, fontFamily: themeBodyFont(canvas) };
15778
15778
  for (const node of drawables) {
15779
15779
  paintDrawable(painter, node, dctx);
15780
15780
  }
@@ -15936,7 +15936,7 @@ var init_ErrorBoundary = __esm({
15936
15936
  }
15937
15937
  );
15938
15938
  };
15939
- ErrorBoundary = class extends React94__default.Component {
15939
+ ErrorBoundary = class extends React95__default.Component {
15940
15940
  constructor(props) {
15941
15941
  super(props);
15942
15942
  __publicField(this, "reset", () => {
@@ -16205,7 +16205,7 @@ var init_Container = __esm({
16205
16205
  as: Component = "div"
16206
16206
  }) => {
16207
16207
  const resolvedSize = maxWidth ?? size ?? "lg";
16208
- return React94__default.createElement(
16208
+ return React95__default.createElement(
16209
16209
  Component,
16210
16210
  {
16211
16211
  className: cn(
@@ -17142,7 +17142,7 @@ var init_FloatingActionButton = __esm({
17142
17142
  document.addEventListener("mousedown", handleClickOutside);
17143
17143
  return () => document.removeEventListener("mousedown", handleClickOutside);
17144
17144
  }, [isExpanded, actions]);
17145
- const positionClasses = {
17145
+ const positionClasses2 = {
17146
17146
  "bottom-right": "bottom-6 right-6",
17147
17147
  "bottom-left": "bottom-6 left-6",
17148
17148
  "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
@@ -17151,7 +17151,7 @@ var init_FloatingActionButton = __esm({
17151
17151
  "top-center": "top-6 left-1/2 -translate-x-1/2"
17152
17152
  };
17153
17153
  if (resolvedAction && (!actions || actions.length === 0)) {
17154
- return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses[position], className), children: /* @__PURE__ */ jsx(
17154
+ return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses2[position], className), children: /* @__PURE__ */ jsx(
17155
17155
  Button,
17156
17156
  {
17157
17157
  variant: resolvedAction.variant || "primary",
@@ -17179,7 +17179,7 @@ var init_FloatingActionButton = __esm({
17179
17179
  ref: fabRef,
17180
17180
  className: cn(
17181
17181
  "fixed z-50 flex flex-col items-end gap-3",
17182
- positionClasses[position],
17182
+ positionClasses2[position],
17183
17183
  position.includes("left") && "items-start",
17184
17184
  className
17185
17185
  ),
@@ -19288,9 +19288,11 @@ var init_Tabs = __esm({
19288
19288
  }
19289
19289
  };
19290
19290
  const handleKeyDown = (e, index) => {
19291
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
19291
+ const prevKey = orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
19292
+ const nextKey = orientation === "vertical" ? "ArrowDown" : "ArrowRight";
19293
+ if (e.key === prevKey || e.key === nextKey) {
19292
19294
  e.preventDefault();
19293
- const direction = e.key === "ArrowLeft" ? -1 : 1;
19295
+ const direction = e.key === prevKey ? -1 : 1;
19294
19296
  const nextIndex = (index + direction + safeItems.length) % safeItems.length;
19295
19297
  const nextTab = safeItems[nextIndex];
19296
19298
  if (nextTab && !nextTab.disabled) {
@@ -19862,7 +19864,7 @@ var init_CodeBlock = __esm({
19862
19864
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
19863
19865
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
19864
19866
  HIDDEN_LINE_NUMBERS = { display: "none" };
19865
- CodeBlock = React94__default.memo(
19867
+ CodeBlock = React95__default.memo(
19866
19868
  ({
19867
19869
  code: rawCode,
19868
19870
  language = "text",
@@ -20445,14 +20447,77 @@ var init_CodeBlock = __esm({
20445
20447
  CodeBlock.displayName = "CodeBlock";
20446
20448
  }
20447
20449
  });
20450
+ function loadMermaid() {
20451
+ mermaidModule ?? (mermaidModule = import('mermaid').then((m) => m.default));
20452
+ return mermaidModule;
20453
+ }
20454
+ var mermaidModule, MermaidDiagram;
20455
+ var init_MermaidDiagram = __esm({
20456
+ "components/core/molecules/markdown/MermaidDiagram.tsx"() {
20457
+ init_Box();
20458
+ init_Typography();
20459
+ init_CodeBlock();
20460
+ init_cn();
20461
+ mermaidModule = null;
20462
+ MermaidDiagram = React95__default.memo(
20463
+ ({ code, className }) => {
20464
+ const { resolvedMode } = useTheme();
20465
+ const containerRef = useRef(null);
20466
+ const [error, setError] = useState(null);
20467
+ const reactId = useId();
20468
+ useEffect(() => {
20469
+ let active = true;
20470
+ void (async () => {
20471
+ try {
20472
+ const mermaid = await loadMermaid();
20473
+ mermaid.initialize({
20474
+ startOnLoad: false,
20475
+ securityLevel: "strict",
20476
+ theme: resolvedMode === "dark" ? "dark" : "default"
20477
+ });
20478
+ const domId = `mermaid-${reactId.replace(/[^a-zA-Z0-9]/g, "")}`;
20479
+ const { svg } = await mermaid.render(domId, code);
20480
+ if (!active || !containerRef.current) return;
20481
+ containerRef.current.innerHTML = svg;
20482
+ setError(null);
20483
+ } catch (err) {
20484
+ if (active) setError(err instanceof Error ? err.message : String(err));
20485
+ }
20486
+ })();
20487
+ return () => {
20488
+ active = false;
20489
+ };
20490
+ }, [code, resolvedMode, reactId]);
20491
+ return /* @__PURE__ */ jsxs(Box, { className: cn("not-prose my-4", className), children: [
20492
+ error !== null && /* @__PURE__ */ jsxs(Box, { className: "space-y-2 mb-2", children: [
20493
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error whitespace-pre-wrap", children: error }),
20494
+ /* @__PURE__ */ jsx(CodeBlock, { code, language: "mermaid" })
20495
+ ] }),
20496
+ /* @__PURE__ */ jsx(
20497
+ Box,
20498
+ {
20499
+ ref: containerRef,
20500
+ "data-testid": "mermaid-diagram",
20501
+ className: "overflow-x-auto",
20502
+ style: error !== null ? { display: "none" } : void 0
20503
+ }
20504
+ )
20505
+ ] });
20506
+ },
20507
+ (prev, next) => prev.code === next.code && prev.className === next.className
20508
+ );
20509
+ MermaidDiagram.displayName = "MermaidDiagram";
20510
+ }
20511
+ });
20448
20512
  var MarkdownContent;
20449
20513
  var init_MarkdownContent = __esm({
20450
20514
  "components/core/molecules/markdown/MarkdownContent.tsx"() {
20451
20515
  init_katex_min();
20452
20516
  init_Box();
20453
20517
  init_CodeBlock();
20518
+ init_MermaidDiagram();
20454
20519
  init_cn();
20455
- MarkdownContent = React94__default.memo(
20520
+ MarkdownContent = React95__default.memo(
20456
20521
  ({ content, direction = "ltr", className }) => {
20457
20522
  const { t: _t } = useTranslate();
20458
20523
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -20497,6 +20562,9 @@ var init_MarkdownContent = __esm({
20497
20562
  if (!inline) {
20498
20563
  const match = /language-(\w+)/.exec(codeClassName ?? "");
20499
20564
  const code = String(children).replace(/\n$/, "");
20565
+ if (match?.[1] === "mermaid") {
20566
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code });
20567
+ }
20500
20568
  if (match) {
20501
20569
  return /* @__PURE__ */ jsx(
20502
20570
  CodeBlock,
@@ -21779,7 +21847,7 @@ var init_StateMachineView = __esm({
21779
21847
  style: { top: title ? 30 : 0 },
21780
21848
  children: [
21781
21849
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
21782
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React94__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
21850
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React95__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
21783
21851
  StateNode2,
21784
21852
  {
21785
21853
  state,
@@ -27968,7 +28036,7 @@ var init_Menu = __esm({
27968
28036
  "bottom-end": "bottom-start"
27969
28037
  };
27970
28038
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
27971
- const triggerElement = React94__default.isValidElement(trigger) ? React94__default.cloneElement(trigger, {
28039
+ const triggerElement = React95__default.isValidElement(trigger) ? React95__default.cloneElement(trigger, {
27972
28040
  ref: triggerRef,
27973
28041
  onClick: handleToggle
27974
28042
  }) : /* @__PURE__ */ jsx(
@@ -28071,14 +28139,14 @@ function useDataDnd(args) {
28071
28139
  const isZone = Boolean(dragGroup || accepts || sortable);
28072
28140
  const enabled = isZone || Boolean(dndRoot);
28073
28141
  const eventBus = useEventBus();
28074
- const parentRoot = React94__default.useContext(RootCtx);
28142
+ const parentRoot = React95__default.useContext(RootCtx);
28075
28143
  const isRoot = enabled && parentRoot === null;
28076
- const zoneId = React94__default.useId();
28144
+ const zoneId = React95__default.useId();
28077
28145
  const ownGroup = dragGroup ?? accepts ?? zoneId;
28078
- const [optimisticOrders, setOptimisticOrders] = React94__default.useState(() => /* @__PURE__ */ new Map());
28079
- const optimisticOrdersRef = React94__default.useRef(optimisticOrders);
28146
+ const [optimisticOrders, setOptimisticOrders] = React95__default.useState(() => /* @__PURE__ */ new Map());
28147
+ const optimisticOrdersRef = React95__default.useRef(optimisticOrders);
28080
28148
  optimisticOrdersRef.current = optimisticOrders;
28081
- const clearOptimisticOrder = React94__default.useCallback((group) => {
28149
+ const clearOptimisticOrder = React95__default.useCallback((group) => {
28082
28150
  setOptimisticOrders((prev) => {
28083
28151
  if (!prev.has(group)) return prev;
28084
28152
  const next = new Map(prev);
@@ -28103,7 +28171,7 @@ function useDataDnd(args) {
28103
28171
  const raw = it[dndItemIdField];
28104
28172
  return raw != null ? String(raw) : `__idx_${idx}`;
28105
28173
  }).join("|");
28106
- const itemIds = React94__default.useMemo(
28174
+ const itemIds = React95__default.useMemo(
28107
28175
  () => orderedItems.map((it, idx) => {
28108
28176
  const raw = it[dndItemIdField];
28109
28177
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -28114,7 +28182,7 @@ function useDataDnd(args) {
28114
28182
  const raw = it[dndItemIdField];
28115
28183
  return raw != null ? String(raw) : `__${idx}`;
28116
28184
  }).join("|");
28117
- React94__default.useEffect(() => {
28185
+ React95__default.useEffect(() => {
28118
28186
  const root = isRoot ? null : parentRoot;
28119
28187
  if (root) {
28120
28188
  root.clearOptimisticOrder(ownGroup);
@@ -28122,20 +28190,20 @@ function useDataDnd(args) {
28122
28190
  clearOptimisticOrder(ownGroup);
28123
28191
  }
28124
28192
  }, [itemsContentSig, ownGroup]);
28125
- const zonesRef = React94__default.useRef(/* @__PURE__ */ new Map());
28126
- const registerZone = React94__default.useCallback((zoneId2, meta2) => {
28193
+ const zonesRef = React95__default.useRef(/* @__PURE__ */ new Map());
28194
+ const registerZone = React95__default.useCallback((zoneId2, meta2) => {
28127
28195
  zonesRef.current.set(zoneId2, meta2);
28128
28196
  }, []);
28129
- const unregisterZone = React94__default.useCallback((zoneId2) => {
28197
+ const unregisterZone = React95__default.useCallback((zoneId2) => {
28130
28198
  zonesRef.current.delete(zoneId2);
28131
28199
  }, []);
28132
- const [activeDrag, setActiveDrag] = React94__default.useState(null);
28133
- const [overZoneGroup, setOverZoneGroup] = React94__default.useState(null);
28134
- const meta = React94__default.useMemo(
28200
+ const [activeDrag, setActiveDrag] = React95__default.useState(null);
28201
+ const [overZoneGroup, setOverZoneGroup] = React95__default.useState(null);
28202
+ const meta = React95__default.useMemo(
28135
28203
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
28136
28204
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
28137
28205
  );
28138
- React94__default.useEffect(() => {
28206
+ React95__default.useEffect(() => {
28139
28207
  const target = isRoot ? null : parentRoot;
28140
28208
  if (!target) {
28141
28209
  zonesRef.current.set(zoneId, meta);
@@ -28154,7 +28222,7 @@ function useDataDnd(args) {
28154
28222
  }, [parentRoot, isRoot, zoneId, meta]);
28155
28223
  const sensors = useAlmadarDndSensors(true);
28156
28224
  const collisionDetection = almadarDndCollisionDetection;
28157
- const findZoneByItem = React94__default.useCallback(
28225
+ const findZoneByItem = React95__default.useCallback(
28158
28226
  (id) => {
28159
28227
  for (const z of zonesRef.current.values()) {
28160
28228
  if (z.itemIds.includes(id)) return z;
@@ -28163,7 +28231,7 @@ function useDataDnd(args) {
28163
28231
  },
28164
28232
  []
28165
28233
  );
28166
- React94__default.useCallback(
28234
+ React95__default.useCallback(
28167
28235
  (group) => {
28168
28236
  for (const z of zonesRef.current.values()) {
28169
28237
  if (z.group === group) return z;
@@ -28172,7 +28240,7 @@ function useDataDnd(args) {
28172
28240
  },
28173
28241
  []
28174
28242
  );
28175
- const handleDragEnd = React94__default.useCallback(
28243
+ const handleDragEnd = React95__default.useCallback(
28176
28244
  (event) => {
28177
28245
  const { active, over } = event;
28178
28246
  const activeIdStr = String(active.id);
@@ -28263,8 +28331,8 @@ function useDataDnd(args) {
28263
28331
  },
28264
28332
  [eventBus]
28265
28333
  );
28266
- const sortableData = React94__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
28267
- const SortableItem = React94__default.useCallback(
28334
+ const sortableData = React95__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
28335
+ const SortableItem = React95__default.useCallback(
28268
28336
  ({ id, children }) => {
28269
28337
  const {
28270
28338
  attributes,
@@ -28304,7 +28372,7 @@ function useDataDnd(args) {
28304
28372
  id: droppableId,
28305
28373
  data: sortableData
28306
28374
  });
28307
- const ctx = React94__default.useContext(RootCtx);
28375
+ const ctx = React95__default.useContext(RootCtx);
28308
28376
  const activeDrag2 = ctx?.activeDrag ?? null;
28309
28377
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
28310
28378
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -28319,7 +28387,7 @@ function useDataDnd(args) {
28319
28387
  showForeignPlaceholder,
28320
28388
  ctxAvailable: ctx != null
28321
28389
  });
28322
- React94__default.useEffect(() => {
28390
+ React95__default.useEffect(() => {
28323
28391
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
28324
28392
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
28325
28393
  return /* @__PURE__ */ jsx(
@@ -28333,11 +28401,11 @@ function useDataDnd(args) {
28333
28401
  }
28334
28402
  );
28335
28403
  };
28336
- const rootContextValue = React94__default.useMemo(
28404
+ const rootContextValue = React95__default.useMemo(
28337
28405
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
28338
28406
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
28339
28407
  );
28340
- const handleDragStart = React94__default.useCallback((event) => {
28408
+ const handleDragStart = React95__default.useCallback((event) => {
28341
28409
  const sourceZone = findZoneByItem(event.active.id);
28342
28410
  const rect = event.active.rect.current.initial;
28343
28411
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -28356,7 +28424,7 @@ function useDataDnd(args) {
28356
28424
  isRoot
28357
28425
  });
28358
28426
  }, [findZoneByItem, isRoot, zoneId]);
28359
- const handleDragOver = React94__default.useCallback((event) => {
28427
+ const handleDragOver = React95__default.useCallback((event) => {
28360
28428
  const { active, over } = event;
28361
28429
  const overData = over?.data?.current;
28362
28430
  const overGroup = overData?.dndGroup ?? null;
@@ -28426,7 +28494,7 @@ function useDataDnd(args) {
28426
28494
  return next;
28427
28495
  });
28428
28496
  }, []);
28429
- const handleDragCancel = React94__default.useCallback((event) => {
28497
+ const handleDragCancel = React95__default.useCallback((event) => {
28430
28498
  setActiveDrag(null);
28431
28499
  setOverZoneGroup(null);
28432
28500
  dndLog.warn("dragCancel", {
@@ -28434,12 +28502,12 @@ function useDataDnd(args) {
28434
28502
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
28435
28503
  });
28436
28504
  }, []);
28437
- const handleDragEndWithCleanup = React94__default.useCallback((event) => {
28505
+ const handleDragEndWithCleanup = React95__default.useCallback((event) => {
28438
28506
  handleDragEnd(event);
28439
28507
  setActiveDrag(null);
28440
28508
  setOverZoneGroup(null);
28441
28509
  }, [handleDragEnd]);
28442
- const wrapContainer = React94__default.useCallback(
28510
+ const wrapContainer = React95__default.useCallback(
28443
28511
  (children) => {
28444
28512
  if (!enabled) return children;
28445
28513
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -28493,7 +28561,7 @@ var init_useDataDnd = __esm({
28493
28561
  init_useAlmadarDndCollision();
28494
28562
  init_Box();
28495
28563
  dndLog = createLogger("almadar:ui:dnd");
28496
- RootCtx = React94__default.createContext(null);
28564
+ RootCtx = React95__default.createContext(null);
28497
28565
  }
28498
28566
  });
28499
28567
  function renderIconInput(icon, props) {
@@ -29008,7 +29076,7 @@ function DataList({
29008
29076
  }) {
29009
29077
  const eventBus = useEventBus();
29010
29078
  const { t } = useTranslate();
29011
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize || Infinity);
29079
+ const [visibleCount, setVisibleCount] = React95__default.useState(pageSize || Infinity);
29012
29080
  const fieldDefs = fields ?? columns ?? [];
29013
29081
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
29014
29082
  const dnd = useDataDnd({
@@ -29024,14 +29092,14 @@ function DataList({
29024
29092
  dndRoot
29025
29093
  });
29026
29094
  const orderedData = dnd.orderedItems;
29027
- const allData = React94__default.useMemo(
29095
+ const allData = React95__default.useMemo(
29028
29096
  () => sortRows(orderedData, sortBy, sortDirection),
29029
29097
  [orderedData, sortBy, sortDirection]
29030
29098
  );
29031
29099
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
29032
29100
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
29033
29101
  const hasRenderProp = typeof children === "function";
29034
- React94__default.useEffect(() => {
29102
+ React95__default.useEffect(() => {
29035
29103
  const renderItemTypeOf = typeof schemaRenderItem;
29036
29104
  const childrenTypeOf = typeof children;
29037
29105
  if (data.length > 0 && !hasRenderProp) {
@@ -29151,7 +29219,7 @@ function DataList({
29151
29219
  return v === void 0 || v === null || v === "" ? raw : String(v);
29152
29220
  };
29153
29221
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
29154
- groups2.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
29222
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
29155
29223
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
29156
29224
  group.items.map((itemData, index) => {
29157
29225
  const id = itemData.id || `${gi}-${index}`;
@@ -29367,7 +29435,7 @@ function DataList({
29367
29435
  className
29368
29436
  ),
29369
29437
  children: [
29370
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
29438
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
29371
29439
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
29372
29440
  group.items.map(
29373
29441
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -29454,7 +29522,7 @@ var init_FormSection = __esm({
29454
29522
  columns = 1,
29455
29523
  className
29456
29524
  }) => {
29457
- const [collapsed, setCollapsed] = React94__default.useState(defaultCollapsed);
29525
+ const [collapsed, setCollapsed] = React95__default.useState(defaultCollapsed);
29458
29526
  const { t } = useTranslate();
29459
29527
  const eventBus = useEventBus();
29460
29528
  const gridClass = {
@@ -29462,7 +29530,7 @@ var init_FormSection = __esm({
29462
29530
  2: "grid-cols-1 md:grid-cols-2",
29463
29531
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
29464
29532
  }[columns];
29465
- React94__default.useCallback(() => {
29533
+ React95__default.useCallback(() => {
29466
29534
  if (collapsible) {
29467
29535
  setCollapsed((prev) => !prev);
29468
29536
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -29735,6 +29803,112 @@ var init_GridPicker = __esm({
29735
29803
  GridPicker.displayName = "GridPicker";
29736
29804
  }
29737
29805
  });
29806
+ function useDraggable({ payload, disabled = false }) {
29807
+ const [isDragging, setIsDragging] = useState(false);
29808
+ const eventBus = useEventBus();
29809
+ const handleDragStart = useCallback(
29810
+ (e) => {
29811
+ if (disabled) {
29812
+ e.preventDefault();
29813
+ return;
29814
+ }
29815
+ e.dataTransfer.setData(ALMADAR_DND_MIME, JSON.stringify(payload));
29816
+ e.dataTransfer.effectAllowed = "copy";
29817
+ setIsDragging(true);
29818
+ eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
29819
+ },
29820
+ [disabled, payload, eventBus]
29821
+ );
29822
+ const handleDragEnd = useCallback(
29823
+ (e) => {
29824
+ setIsDragging(false);
29825
+ eventBus.emit("UI:DRAG_END", { kind: payload.kind, data: payload.data });
29826
+ },
29827
+ [payload, eventBus]
29828
+ );
29829
+ const dragProps = useMemo(
29830
+ () => ({
29831
+ draggable: !disabled,
29832
+ onDragStart: handleDragStart,
29833
+ onDragEnd: handleDragEnd,
29834
+ "aria-grabbed": isDragging
29835
+ }),
29836
+ [disabled, handleDragStart, handleDragEnd, isDragging]
29837
+ );
29838
+ return { dragProps, isDragging };
29839
+ }
29840
+ var ALMADAR_DND_MIME;
29841
+ var init_useDraggable = __esm({
29842
+ "hooks/useDraggable.ts"() {
29843
+ "use client";
29844
+ init_useEventBus();
29845
+ ALMADAR_DND_MIME = "application/x-almadar-dnd";
29846
+ }
29847
+ });
29848
+ function parsePayload(e) {
29849
+ try {
29850
+ const raw = e.dataTransfer.getData(ALMADAR_DND_MIME);
29851
+ if (!raw) return null;
29852
+ const parsed = JSON.parse(raw);
29853
+ if (typeof parsed.kind !== "string" || !parsed.data) return null;
29854
+ return parsed;
29855
+ } catch {
29856
+ return null;
29857
+ }
29858
+ }
29859
+ function hasAlmadarPayload(e) {
29860
+ return e.dataTransfer.types.includes(ALMADAR_DND_MIME);
29861
+ }
29862
+ function useDropZone({ accepts, onDrop, disabled = false }) {
29863
+ const [isOver, setIsOver] = useState(false);
29864
+ const eventBus = useEventBus();
29865
+ const handleDragOver = useCallback(
29866
+ (e) => {
29867
+ if (disabled) return;
29868
+ if (!hasAlmadarPayload(e)) return;
29869
+ e.preventDefault();
29870
+ e.dataTransfer.dropEffect = "copy";
29871
+ setIsOver(true);
29872
+ },
29873
+ [disabled]
29874
+ );
29875
+ const handleDragLeave = useCallback(
29876
+ (e) => {
29877
+ setIsOver(false);
29878
+ },
29879
+ []
29880
+ );
29881
+ const handleDrop = useCallback(
29882
+ (e) => {
29883
+ e.preventDefault();
29884
+ setIsOver(false);
29885
+ if (disabled) return;
29886
+ const payload = parsePayload(e);
29887
+ if (!payload) return;
29888
+ if (!accepts.includes(payload.kind)) return;
29889
+ const position = { x: e.clientX, y: e.clientY };
29890
+ onDrop(payload, position);
29891
+ eventBus.emit("UI:DROP", { kind: payload.kind, data: payload.data, ...position });
29892
+ },
29893
+ [disabled, accepts, onDrop, eventBus]
29894
+ );
29895
+ const dropProps = useMemo(
29896
+ () => ({
29897
+ onDragOver: handleDragOver,
29898
+ onDragLeave: handleDragLeave,
29899
+ onDrop: handleDrop
29900
+ }),
29901
+ [handleDragOver, handleDragLeave, handleDrop]
29902
+ );
29903
+ return { dropProps, isOver };
29904
+ }
29905
+ var init_useDropZone = __esm({
29906
+ "hooks/useDropZone.ts"() {
29907
+ "use client";
29908
+ init_useEventBus();
29909
+ init_useDraggable();
29910
+ }
29911
+ });
29738
29912
  function fileIcon(name) {
29739
29913
  const ext = name.split(".").pop()?.toLowerCase() ?? "";
29740
29914
  switch (ext) {
@@ -29760,6 +29934,13 @@ function fileIcon(name) {
29760
29934
  return "file";
29761
29935
  }
29762
29936
  }
29937
+ function siblingsOf(target, roots, childrenByParent) {
29938
+ if (target.parentId) {
29939
+ const parentSiblings = childrenByParent.get(target.parentId);
29940
+ if (parentSiblings?.some((sibling) => sibling.id === target.id)) return parentSiblings;
29941
+ }
29942
+ return roots;
29943
+ }
29763
29944
  function ancestorsOf(id, byId) {
29764
29945
  const out = /* @__PURE__ */ new Set();
29765
29946
  if (!id) return out;
@@ -29777,6 +29958,8 @@ var init_FileTree = __esm({
29777
29958
  init_Box();
29778
29959
  init_Typography();
29779
29960
  init_Icon();
29961
+ init_useDraggable();
29962
+ init_useDropZone();
29780
29963
  TreeNodeItem = ({
29781
29964
  node,
29782
29965
  depth,
@@ -29860,10 +30043,12 @@ var init_FileTree = __esm({
29860
30043
  depth,
29861
30044
  indent,
29862
30045
  childrenByParent,
30046
+ roots,
29863
30047
  onNodeSelect,
29864
30048
  onNodeAction,
29865
30049
  nodeActionIcon,
29866
30050
  nodeActionLabel,
30051
+ onNodeReorder,
29867
30052
  selectedId,
29868
30053
  look,
29869
30054
  isExpanded,
@@ -29874,6 +30059,7 @@ var init_FileTree = __esm({
29874
30059
  const expanded = hasChildren && isExpanded(item.id, depth);
29875
30060
  const isSelected = selectedId !== void 0 && selectedId !== "" && item.id === selectedId;
29876
30061
  const nav = look === "nav";
30062
+ const rowRef = useRef(null);
29877
30063
  const handleClick = useCallback(() => {
29878
30064
  if (hasChildren && !onNodeSelect) onToggle(item.id, expanded);
29879
30065
  onNodeSelect?.(item.id);
@@ -29886,16 +30072,50 @@ var init_FileTree = __esm({
29886
30072
  e.stopPropagation();
29887
30073
  onNodeAction?.(item.id);
29888
30074
  }, [item.id, onNodeAction]);
30075
+ const { dragProps } = useDraggable({
30076
+ payload: { kind: "tree-node", data: { id: item.id } },
30077
+ disabled: !onNodeReorder
30078
+ });
30079
+ const handleRowDrop = useCallback(
30080
+ (payload, position) => {
30081
+ if (!onNodeReorder) return;
30082
+ const draggedId = typeof payload.data.id === "string" ? payload.data.id : void 0;
30083
+ if (!draggedId || draggedId === item.id) return;
30084
+ const rect = rowRef.current?.getBoundingClientRect();
30085
+ if (!rect || rect.height === 0) return;
30086
+ const relY = position.y - rect.top;
30087
+ const third = rect.height / 3;
30088
+ if (relY >= third && relY <= third * 2) {
30089
+ const existingChildren = childrenByParent.get(item.id);
30090
+ onNodeReorder(draggedId, item.id, existingChildren ? existingChildren.length : 0);
30091
+ return;
30092
+ }
30093
+ const siblings = siblingsOf(item, roots, childrenByParent);
30094
+ const newParentId = siblings === roots ? null : item.parentId ?? null;
30095
+ const targetIndex = siblings.findIndex((sibling) => sibling.id === item.id);
30096
+ const index = relY < third ? targetIndex < 0 ? 0 : targetIndex : targetIndex < 0 ? siblings.length : targetIndex + 1;
30097
+ onNodeReorder(draggedId, newParentId, index);
30098
+ },
30099
+ [onNodeReorder, item, roots, childrenByParent]
30100
+ );
30101
+ const { dropProps } = useDropZone({
30102
+ accepts: ["tree-node"],
30103
+ onDrop: handleRowDrop,
30104
+ disabled: !onNodeReorder
30105
+ });
29889
30106
  return /* @__PURE__ */ jsxs(Fragment, { children: [
29890
30107
  /* @__PURE__ */ jsxs(
29891
30108
  Box,
29892
30109
  {
30110
+ ref: rowRef,
29893
30111
  className: `group/treerow flex items-center gap-1.5 px-2 cursor-pointer rounded-sm transition-colors ${nav ? "py-1" : "py-0.5"} ${isSelected ? "bg-primary text-primary-foreground" : nav ? "text-foreground hover:bg-muted" : "hover:bg-muted"}`,
29894
30112
  style: { paddingLeft: depth * indent + 8 },
29895
30113
  onClick: handleClick,
29896
30114
  role: "treeitem",
29897
30115
  "aria-selected": isSelected,
29898
30116
  "aria-expanded": hasChildren ? expanded : void 0,
30117
+ ...dragProps,
30118
+ ...dropProps,
29899
30119
  children: [
29900
30120
  hasChildren ? /* @__PURE__ */ jsx(Box, { onClick: handleChevron, className: "flex items-center flex-shrink-0", role: "button", "aria-label": expanded ? "Collapse" : "Expand", children: /* @__PURE__ */ jsx(
29901
30121
  Icon,
@@ -29942,10 +30162,12 @@ var init_FileTree = __esm({
29942
30162
  depth: depth + 1,
29943
30163
  indent,
29944
30164
  childrenByParent,
30165
+ roots,
29945
30166
  onNodeSelect,
29946
30167
  onNodeAction,
29947
30168
  nodeActionIcon,
29948
30169
  nodeActionLabel,
30170
+ onNodeReorder,
29949
30171
  selectedId,
29950
30172
  look,
29951
30173
  isExpanded,
@@ -29963,14 +30185,15 @@ var init_FileTree = __esm({
29963
30185
  onNodeAction,
29964
30186
  nodeActionIcon,
29965
30187
  nodeActionLabel,
30188
+ onNodeReorder,
29966
30189
  className,
29967
30190
  indent = 16
29968
30191
  }) => {
29969
30192
  const [overrides, setOverrides] = useState(() => /* @__PURE__ */ new Map());
29970
- const byId = React94__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
29971
- const selectedAncestors = React94__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
29972
- const lastSelectedRef = React94__default.useRef(selectedId);
29973
- React94__default.useEffect(() => {
30193
+ const byId = React95__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
30194
+ const selectedAncestors = React95__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
30195
+ const lastSelectedRef = React95__default.useRef(selectedId);
30196
+ React95__default.useEffect(() => {
29974
30197
  if (selectedId === lastSelectedRef.current) return;
29975
30198
  lastSelectedRef.current = selectedId;
29976
30199
  setOverrides((prev) => {
@@ -30011,10 +30234,12 @@ var init_FileTree = __esm({
30011
30234
  depth: 0,
30012
30235
  indent,
30013
30236
  childrenByParent,
30237
+ roots,
30014
30238
  onNodeSelect,
30015
30239
  onNodeAction,
30016
30240
  nodeActionIcon,
30017
30241
  nodeActionLabel,
30242
+ onNodeReorder,
30018
30243
  selectedId,
30019
30244
  look,
30020
30245
  isExpanded,
@@ -30034,6 +30259,7 @@ var init_FileTree = __esm({
30034
30259
  onNodeAction,
30035
30260
  nodeActionIcon,
30036
30261
  nodeActionLabel,
30262
+ onNodeReorder,
30037
30263
  className,
30038
30264
  indent = 16
30039
30265
  }) => {
@@ -30048,6 +30274,7 @@ var init_FileTree = __esm({
30048
30274
  onNodeAction,
30049
30275
  nodeActionIcon,
30050
30276
  nodeActionLabel,
30277
+ onNodeReorder,
30051
30278
  className,
30052
30279
  indent
30053
30280
  }
@@ -30800,7 +31027,7 @@ var init_Flex = __esm({
30800
31027
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
30801
31028
  }
30802
31029
  }
30803
- return React94__default.createElement(Component, {
31030
+ return React95__default.createElement(Component, {
30804
31031
  className: cn(
30805
31032
  inline ? "inline-flex" : "flex",
30806
31033
  directionStyles[direction],
@@ -30919,7 +31146,7 @@ var init_Grid = __esm({
30919
31146
  as: Component = "div"
30920
31147
  }) => {
30921
31148
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
30922
- return React94__default.createElement(
31149
+ return React95__default.createElement(
30923
31150
  Component,
30924
31151
  {
30925
31152
  className: cn(
@@ -31341,9 +31568,9 @@ var init_Popover = __esm({
31341
31568
  onMouseLeave: handleClose,
31342
31569
  onPointerDown: tapTriggerProps.onPointerDown
31343
31570
  };
31344
- const childElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
31571
+ const childElement = React95__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
31345
31572
  const childPointerDown = childElement.props.onPointerDown;
31346
- const triggerElement = React94__default.cloneElement(
31573
+ const triggerElement = React95__default.cloneElement(
31347
31574
  childElement,
31348
31575
  {
31349
31576
  ref: triggerRef,
@@ -31957,9 +32184,9 @@ var init_Tooltip = __esm({
31957
32184
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
31958
32185
  };
31959
32186
  }, []);
31960
- const triggerElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
32187
+ const triggerElement = React95__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
31961
32188
  const childPointerDown = triggerElement.props.onPointerDown;
31962
- const trigger = React94__default.cloneElement(triggerElement, {
32189
+ const trigger = React95__default.cloneElement(triggerElement, {
31963
32190
  ref: triggerRef,
31964
32191
  onMouseEnter: handleMouseEnter,
31965
32192
  onMouseLeave: handleMouseLeave,
@@ -32049,7 +32276,7 @@ var init_WizardProgress = __esm({
32049
32276
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
32050
32277
  const isActive = index === currentStep;
32051
32278
  const isCompleted = index < currentStep;
32052
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
32279
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
32053
32280
  /* @__PURE__ */ jsx(
32054
32281
  "button",
32055
32282
  {
@@ -33111,6 +33338,8 @@ var init_MathCanvas = __esm({
33111
33338
  gridColor = "var(--color-border, #9ca3af)",
33112
33339
  axisColor = "var(--color-muted-foreground, #374151)",
33113
33340
  showTickLabels = false,
33341
+ tickLabelFontSize = 10,
33342
+ labelFontSize = 12,
33114
33343
  showCurveLabels = false,
33115
33344
  curves = [],
33116
33345
  points = [],
@@ -33182,18 +33411,18 @@ var init_MathCanvas = __esm({
33182
33411
  let kx = 0;
33183
33412
  for (let x = Math.ceil(xMin / gridStep) * gridStep; x <= xMax; x += gridStep, kx++) {
33184
33413
  if (kx % labelEveryX === 0 && x !== 0) {
33185
- out.push({ type: "text", x: mapX(x), y: xAxisY + 12, text: formatTick(x), color: "#6b7280", fontSize: 10, align: "center" });
33414
+ out.push({ type: "text", x: mapX(x), y: xAxisY + 12, text: formatTick(x), color: "#6b7280", fontSize: tickLabelFontSize, align: "center" });
33186
33415
  }
33187
33416
  }
33188
33417
  const labelEveryY = Math.max(1, Math.ceil((yMax - yMin) / gridStep / Math.floor(plotH / 28)));
33189
33418
  let ky = 0;
33190
33419
  for (let y = Math.ceil(yMin / gridStep) * gridStep; y <= yMax; y += gridStep, ky++) {
33191
33420
  if (ky % labelEveryY === 0 && y !== 0) {
33192
- out.push({ type: "text", x: yAxisX - 6, y: mapY(y), text: formatTick(y), color: "#6b7280", fontSize: 10, align: "right" });
33421
+ out.push({ type: "text", x: yAxisX - 6, y: mapY(y), text: formatTick(y), color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
33193
33422
  }
33194
33423
  }
33195
33424
  if (xMin <= 0 && xMax >= 0 && yMin <= 0 && yMax >= 0) {
33196
- out.push({ type: "text", x: yAxisX - 6, y: xAxisY + 12, text: "0", color: "#6b7280", fontSize: 10, align: "right" });
33425
+ out.push({ type: "text", x: yAxisX - 6, y: xAxisY + 12, text: "0", color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
33197
33426
  }
33198
33427
  }
33199
33428
  for (const region of regions) {
@@ -33224,7 +33453,7 @@ var init_MathCanvas = __esm({
33224
33453
  y: (mapY(region.samples[mid].y) + mapY(baseline)) / 2,
33225
33454
  text: region.label,
33226
33455
  color,
33227
- fontSize: 11
33456
+ fontSize: labelFontSize
33228
33457
  });
33229
33458
  }
33230
33459
  }
@@ -33263,7 +33492,7 @@ var init_MathCanvas = __esm({
33263
33492
  const py = mapY(guide.at);
33264
33493
  out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color, dash });
33265
33494
  if (guide.label) {
33266
- out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: 11, align: "right" });
33495
+ out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: labelFontSize, align: "right" });
33267
33496
  }
33268
33497
  }
33269
33498
  }
@@ -33306,7 +33535,7 @@ var init_MathCanvas = __esm({
33306
33535
  y: mapY(lastInRange.y) - 6,
33307
33536
  text: curve.label,
33308
33537
  color: curve.color ?? "#2563eb",
33309
- fontSize: 11
33538
+ fontSize: labelFontSize
33310
33539
  });
33311
33540
  }
33312
33541
  }
@@ -33343,7 +33572,7 @@ var init_MathCanvas = __esm({
33343
33572
  y: xAxisY - peak - 8,
33344
33573
  text: hop.label,
33345
33574
  color,
33346
- fontSize: 10,
33575
+ fontSize: labelFontSize,
33347
33576
  align: "center"
33348
33577
  });
33349
33578
  }
@@ -33370,7 +33599,7 @@ var init_MathCanvas = __esm({
33370
33599
  y: mapY(angle.y + 1.35 * radius * Math.sin(rad)),
33371
33600
  text: angle.label,
33372
33601
  color,
33373
- fontSize: 11,
33602
+ fontSize: labelFontSize,
33374
33603
  align: "center"
33375
33604
  });
33376
33605
  }
@@ -33387,7 +33616,7 @@ var init_MathCanvas = __esm({
33387
33616
  fill: isOpen ? "#ffffff" : p.color ?? "#dc2626"
33388
33617
  });
33389
33618
  if (p.label) {
33390
- out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: 12 });
33619
+ out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: labelFontSize });
33391
33620
  }
33392
33621
  }
33393
33622
  for (const v of vectors) {
@@ -33398,7 +33627,7 @@ var init_MathCanvas = __esm({
33398
33627
  const y2 = mapY(v.y + v.vy);
33399
33628
  out.push({ type: "arrow", x1, y1, x2, y2, color: v.color ?? "#7c3aed", lineWidth: 2 });
33400
33629
  if (v.label) {
33401
- out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: 12 });
33630
+ out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: labelFontSize });
33402
33631
  }
33403
33632
  }
33404
33633
  out.push(...shapes);
@@ -33417,6 +33646,8 @@ var init_MathCanvas = __esm({
33417
33646
  gridColor,
33418
33647
  axisColor,
33419
33648
  showTickLabels,
33649
+ tickLabelFontSize,
33650
+ labelFontSize,
33420
33651
  showCurveLabels,
33421
33652
  curves,
33422
33653
  points,
@@ -34704,13 +34935,13 @@ var init_MapView = __esm({
34704
34935
  shadowSize: [41, 41]
34705
34936
  });
34706
34937
  L.Marker.prototype.options.icon = defaultIcon;
34707
- const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback96, useState: useState103 } = React94__default;
34938
+ const { useEffect: useEffect68, useRef: useRef67, useCallback: useCallback98, useState: useState106 } = React95__default;
34708
34939
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
34709
34940
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
34710
34941
  function MapUpdater({ centerLat, centerLng, zoom }) {
34711
34942
  const map = useMap();
34712
- const prevRef = useRef65({ centerLat, centerLng, zoom });
34713
- useEffect67(() => {
34943
+ const prevRef = useRef67({ centerLat, centerLng, zoom });
34944
+ useEffect68(() => {
34714
34945
  const prev = prevRef.current;
34715
34946
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
34716
34947
  map.setView([centerLat, centerLng], zoom);
@@ -34721,7 +34952,7 @@ var init_MapView = __esm({
34721
34952
  }
34722
34953
  function MapClickHandler({ onMapClick }) {
34723
34954
  const map = useMap();
34724
- useEffect67(() => {
34955
+ useEffect68(() => {
34725
34956
  if (!onMapClick) return;
34726
34957
  const handler = (e) => {
34727
34958
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -34749,8 +34980,8 @@ var init_MapView = __esm({
34749
34980
  showAttribution = true
34750
34981
  }) {
34751
34982
  const eventBus = useEventBus2();
34752
- const [clickedPosition, setClickedPosition] = useState103(null);
34753
- const handleMapClick = useCallback96((lat, lng) => {
34983
+ const [clickedPosition, setClickedPosition] = useState106(null);
34984
+ const handleMapClick = useCallback98((lat, lng) => {
34754
34985
  if (showClickedPin) {
34755
34986
  setClickedPosition({ lat, lng });
34756
34987
  }
@@ -34759,7 +34990,7 @@ var init_MapView = __esm({
34759
34990
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
34760
34991
  }
34761
34992
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
34762
- const handleMarkerClick = useCallback96((marker) => {
34993
+ const handleMarkerClick = useCallback98((marker) => {
34763
34994
  onMarkerClick?.(marker);
34764
34995
  if (markerClickEvent) {
34765
34996
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -35649,8 +35880,8 @@ function TableView({
35649
35880
  }) {
35650
35881
  const eventBus = useEventBus();
35651
35882
  const { t } = useTranslate();
35652
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize > 0 ? pageSize : Infinity);
35653
- const [localSelected, setLocalSelected] = React94__default.useState(/* @__PURE__ */ new Set());
35883
+ const [visibleCount, setVisibleCount] = React95__default.useState(pageSize > 0 ? pageSize : Infinity);
35884
+ const [localSelected, setLocalSelected] = React95__default.useState(/* @__PURE__ */ new Set());
35654
35885
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
35655
35886
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
35656
35887
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
@@ -35671,7 +35902,7 @@ function TableView({
35671
35902
  const hasMore = pageSize > 0 && visibleCount < ordered2.length;
35672
35903
  const hasRenderProp = typeof children === "function";
35673
35904
  const idField = dndItemIdField ?? "id";
35674
- React94__default.useEffect(() => {
35905
+ React95__default.useEffect(() => {
35675
35906
  tableViewLog.debug("render", {
35676
35907
  rowCount: data.length,
35677
35908
  colCount: colDefs.length,
@@ -35721,7 +35952,7 @@ function TableView({
35721
35952
  };
35722
35953
  eventBus.emit(`UI:${rowClickEvent}`, payload);
35723
35954
  };
35724
- const colFloors = React94__default.useMemo(
35955
+ const colFloors = React95__default.useMemo(
35725
35956
  () => colDefs.map((col) => {
35726
35957
  const longest = data.reduce((widest, row) => {
35727
35958
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -35864,12 +36095,12 @@ function TableView({
35864
36095
  ]
35865
36096
  }
35866
36097
  );
35867
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React94__default.Fragment, { children: rowInner }, id);
36098
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React95__default.Fragment, { children: rowInner }, id);
35868
36099
  };
35869
36100
  const items = Array.from(data);
35870
36101
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
35871
36102
  let runningIndex = 0;
35872
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
36103
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
35873
36104
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
35874
36105
  group.items.map((row) => renderRow(row, runningIndex++))
35875
36106
  ] }, gi)) });
@@ -37238,7 +37469,7 @@ var init_StepFlow = __esm({
37238
37469
  className
37239
37470
  }) => {
37240
37471
  if (orientation === "vertical") {
37241
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
37472
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React95__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
37242
37473
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
37243
37474
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
37244
37475
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -37249,7 +37480,7 @@ var init_StepFlow = __esm({
37249
37480
  ] })
37250
37481
  ] }) }, index)) });
37251
37482
  }
37252
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
37483
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
37253
37484
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
37254
37485
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
37255
37486
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -38239,7 +38470,7 @@ var init_LikertScale = __esm({
38239
38470
  md: "text-base",
38240
38471
  lg: "text-lg"
38241
38472
  };
38242
- LikertScale = React94__default.forwardRef(
38473
+ LikertScale = React95__default.forwardRef(
38243
38474
  ({
38244
38475
  question,
38245
38476
  options = DEFAULT_LIKERT_OPTIONS,
@@ -38251,7 +38482,7 @@ var init_LikertScale = __esm({
38251
38482
  variant = "radios",
38252
38483
  className
38253
38484
  }, ref) => {
38254
- const groupId = React94__default.useId();
38485
+ const groupId = React95__default.useId();
38255
38486
  const eventBus = useEventBus();
38256
38487
  const handleSelect = useCallback(
38257
38488
  (next) => {
@@ -40674,7 +40905,7 @@ var init_DocBreadcrumb = __esm({
40674
40905
  "aria-label": t("aria.breadcrumb"),
40675
40906
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
40676
40907
  const isLast = idx === items.length - 1;
40677
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
40908
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
40678
40909
  idx > 0 && /* @__PURE__ */ jsx(
40679
40910
  Icon,
40680
40911
  {
@@ -41339,7 +41570,7 @@ var init_PageHeader = __esm({
41339
41570
  info: "bg-info/10 text-info"
41340
41571
  };
41341
41572
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
41342
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
41573
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
41343
41574
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
41344
41575
  crumb.href ? /* @__PURE__ */ jsx(
41345
41576
  "a",
@@ -41697,7 +41928,7 @@ var init_Section = __esm({
41697
41928
  as: Component = "section"
41698
41929
  }) => {
41699
41930
  const hasHeader = title || description || action;
41700
- return React94__default.createElement(
41931
+ return React95__default.createElement(
41701
41932
  Component,
41702
41933
  {
41703
41934
  className: cn(
@@ -42071,7 +42302,7 @@ var init_WizardContainer = __esm({
42071
42302
  const isCompleted = index < currentStep;
42072
42303
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42073
42304
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42074
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
42305
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
42075
42306
  /* @__PURE__ */ jsx(
42076
42307
  Button,
42077
42308
  {
@@ -43858,7 +44089,7 @@ var init_ImportPreviewTree = __esm({
43858
44089
  const renderUnit = (unit, childrenByParent, depth) => {
43859
44090
  const summary = fieldSummary(unit);
43860
44091
  const children = childrenByParent.get(unit.ref) ?? [];
43861
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
44092
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
43862
44093
  /* @__PURE__ */ jsxs(
43863
44094
  Box,
43864
44095
  {
@@ -43955,7 +44186,7 @@ var init_ImportProgress = __esm({
43955
44186
  PIPELINE.map((key, index) => {
43956
44187
  const isComplete = index < currentIndex;
43957
44188
  const isActive = index === currentIndex;
43958
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
44189
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
43959
44190
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
43960
44191
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
43961
44192
  /* @__PURE__ */ jsx(
@@ -44083,6 +44314,69 @@ var init_ReflectionBlock = __esm({
44083
44314
  ReflectionBlock.displayName = "ReflectionBlock";
44084
44315
  }
44085
44316
  });
44317
+ var positionClasses, FloatingToolbar;
44318
+ var init_FloatingToolbar = __esm({
44319
+ "components/core/molecules/FloatingToolbar.tsx"() {
44320
+ "use client";
44321
+ init_Button();
44322
+ init_Box();
44323
+ init_Divider();
44324
+ init_Typography();
44325
+ init_ButtonGroup();
44326
+ init_cn();
44327
+ init_useEventBus();
44328
+ positionClasses = {
44329
+ "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
44330
+ "bottom-left": "bottom-6 left-6",
44331
+ "bottom-right": "bottom-6 right-6"
44332
+ };
44333
+ FloatingToolbar = ({
44334
+ items,
44335
+ position = "bottom-center",
44336
+ children,
44337
+ className
44338
+ }) => {
44339
+ const eventBus = useEventBus();
44340
+ return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses[position]), children: /* @__PURE__ */ jsxs(
44341
+ ButtonGroup,
44342
+ {
44343
+ variant: "default",
44344
+ orientation: "horizontal",
44345
+ className: cn(
44346
+ "items-center gap-1 rounded-full border border-border",
44347
+ "bg-card/95 backdrop-blur-sm shadow-elevation-popover p-1",
44348
+ className
44349
+ ),
44350
+ children: [
44351
+ items.map((item) => /* @__PURE__ */ jsx(
44352
+ Button,
44353
+ {
44354
+ variant: item.active ? "primary" : "ghost",
44355
+ size: "sm",
44356
+ icon: item.icon,
44357
+ action: item.action,
44358
+ actionPayload: item.actionPayload,
44359
+ disabled: item.disabled,
44360
+ "aria-pressed": item.active,
44361
+ "aria-label": item.label,
44362
+ className: "rounded-full",
44363
+ "data-testid": item.testId ?? `floating-toolbar-item-${item.id}`,
44364
+ onClick: () => {
44365
+ if (item.event) eventBus.emit(`UI:${item.event}`, { actionId: item.id });
44366
+ },
44367
+ children: /* @__PURE__ */ jsx(Typography, { as: "span", className: "sr-only", children: item.label })
44368
+ },
44369
+ item.id
44370
+ )),
44371
+ children && items.length > 0 && /* @__PURE__ */ jsx(Divider, { orientation: "vertical", className: "h-6 mx-1" }),
44372
+ children
44373
+ ]
44374
+ }
44375
+ ) });
44376
+ };
44377
+ FloatingToolbar.displayName = "FloatingToolbar";
44378
+ }
44379
+ });
44086
44380
 
44087
44381
  // components/core/molecules/index.ts
44088
44382
  var init_molecules2 = __esm({
@@ -44833,7 +45127,7 @@ var init_DetailPanel = __esm({
44833
45127
  }) => {
44834
45128
  const eventBus = useEventBus();
44835
45129
  const { t } = useTranslate();
44836
- const [titleDraft, setTitleDraft] = React94__default.useState(null);
45130
+ const [titleDraft, setTitleDraft] = React95__default.useState(null);
44837
45131
  const isFieldDefArray = (arr) => {
44838
45132
  if (!arr || arr.length === 0) return false;
44839
45133
  const first = arr[0];
@@ -45226,8 +45520,224 @@ var init_DetailPanel = __esm({
45226
45520
  DetailPanel.displayName = "DetailPanel";
45227
45521
  }
45228
45522
  });
45523
+ var SplitPane;
45524
+ var init_SplitPane = __esm({
45525
+ "components/core/organisms/layout/SplitPane.tsx"() {
45526
+ "use client";
45527
+ init_cn();
45528
+ SplitPane = ({
45529
+ direction = "horizontal",
45530
+ ratio: ratioProp = 50,
45531
+ minSize = 100,
45532
+ resizable = true,
45533
+ left,
45534
+ right,
45535
+ className,
45536
+ leftClassName,
45537
+ rightClassName,
45538
+ onRatioChange
45539
+ }) => {
45540
+ const [uncontrolledRatio, setUncontrolledRatio] = useState(ratioProp);
45541
+ const ratio = onRatioChange ? ratioProp : uncontrolledRatio;
45542
+ const containerRef = useRef(null);
45543
+ const isDragging = useRef(false);
45544
+ const handlePointerDown = useCallback(
45545
+ (e) => {
45546
+ if (!resizable) return;
45547
+ e.preventDefault();
45548
+ isDragging.current = true;
45549
+ e.currentTarget.setPointerCapture(e.pointerId);
45550
+ const handlePointerMove = (ev) => {
45551
+ if (!isDragging.current || !containerRef.current) return;
45552
+ const rect = containerRef.current.getBoundingClientRect();
45553
+ let newRatio;
45554
+ if (direction === "horizontal") {
45555
+ const x = ev.clientX - rect.left;
45556
+ newRatio = x / rect.width * 100;
45557
+ } else {
45558
+ const y = ev.clientY - rect.top;
45559
+ newRatio = y / rect.height * 100;
45560
+ }
45561
+ const minRatio = minSize / (direction === "horizontal" ? rect.width : rect.height) * 100;
45562
+ const maxRatio = 100 - minRatio;
45563
+ newRatio = Math.max(minRatio, Math.min(maxRatio, newRatio));
45564
+ if (onRatioChange) {
45565
+ onRatioChange(newRatio);
45566
+ } else {
45567
+ setUncontrolledRatio(newRatio);
45568
+ }
45569
+ };
45570
+ const handlePointerUp = () => {
45571
+ isDragging.current = false;
45572
+ document.removeEventListener("pointermove", handlePointerMove);
45573
+ document.removeEventListener("pointerup", handlePointerUp);
45574
+ document.removeEventListener("pointercancel", handlePointerUp);
45575
+ };
45576
+ document.addEventListener("pointermove", handlePointerMove);
45577
+ document.addEventListener("pointerup", handlePointerUp);
45578
+ document.addEventListener("pointercancel", handlePointerUp);
45579
+ },
45580
+ [direction, minSize, resizable, onRatioChange]
45581
+ );
45582
+ const isHorizontal = direction === "horizontal";
45583
+ return /* @__PURE__ */ jsxs(
45584
+ "div",
45585
+ {
45586
+ ref: containerRef,
45587
+ className: cn(
45588
+ "flex w-full h-full",
45589
+ isHorizontal ? "flex-row" : "flex-col",
45590
+ className
45591
+ ),
45592
+ children: [
45593
+ /* @__PURE__ */ jsx(
45594
+ "div",
45595
+ {
45596
+ className: cn("overflow-auto", leftClassName),
45597
+ style: {
45598
+ [isHorizontal ? "width" : "height"]: `${ratio}%`,
45599
+ flexShrink: 0
45600
+ },
45601
+ children: left
45602
+ }
45603
+ ),
45604
+ resizable && /* @__PURE__ */ jsx(
45605
+ "div",
45606
+ {
45607
+ onPointerDown: handlePointerDown,
45608
+ className: cn(
45609
+ "flex-shrink-0 bg-border transition-colors touch-none",
45610
+ isHorizontal ? "w-1 cursor-col-resize hover:w-1.5 hover:bg-muted-foreground" : "h-1 cursor-row-resize hover:h-1.5 hover:bg-muted-foreground"
45611
+ )
45612
+ }
45613
+ ),
45614
+ /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto", rightClassName), children: right })
45615
+ ]
45616
+ }
45617
+ );
45618
+ };
45619
+ SplitPane.displayName = "SplitPane";
45620
+ }
45621
+ });
45622
+ var DockLayout;
45623
+ var init_DockLayout = __esm({
45624
+ "components/core/organisms/layout/DockLayout.tsx"() {
45625
+ "use client";
45626
+ init_Box();
45627
+ init_Stack();
45628
+ init_cn();
45629
+ init_SplitPane();
45630
+ DockLayout = ({
45631
+ rail,
45632
+ sidebar,
45633
+ main,
45634
+ bottomPanel,
45635
+ statusBar,
45636
+ secondarySidebar,
45637
+ railWidth = 56,
45638
+ secondarySidebarWidth = 280,
45639
+ sidebarCollapsed = false,
45640
+ sidebarWidth = 20,
45641
+ onSidebarWidthChange,
45642
+ sidebarMinSize = 160,
45643
+ bottomPanelCollapsed = false,
45644
+ bottomPanelHeight = 30,
45645
+ onBottomPanelHeightChange,
45646
+ bottomPanelMinSize = 120,
45647
+ secondarySidebarCollapsed = false,
45648
+ className,
45649
+ railClassName,
45650
+ sidebarClassName,
45651
+ mainClassName,
45652
+ bottomPanelClassName,
45653
+ statusBarClassName,
45654
+ secondarySidebarClassName
45655
+ }) => {
45656
+ const showSidebar = Boolean(sidebar) && !sidebarCollapsed;
45657
+ const showBottomPanel = Boolean(bottomPanel) && !bottomPanelCollapsed;
45658
+ const showSecondarySidebar = Boolean(secondarySidebar) && !secondarySidebarCollapsed;
45659
+ const centerRow = /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "flex-1 min-h-0 min-w-0", children: [
45660
+ /* @__PURE__ */ jsx(Box, { className: cn("flex-1 min-w-0 h-full overflow-auto", mainClassName), children: main }),
45661
+ showSecondarySidebar && /* @__PURE__ */ jsx(
45662
+ Box,
45663
+ {
45664
+ className: cn(
45665
+ "flex-shrink-0 h-full overflow-auto border-l border-border",
45666
+ secondarySidebarClassName
45667
+ ),
45668
+ style: { width: secondarySidebarWidth },
45669
+ children: secondarySidebar
45670
+ }
45671
+ )
45672
+ ] });
45673
+ const sidebarAndCenter = showSidebar ? /* @__PURE__ */ jsx(
45674
+ SplitPane,
45675
+ {
45676
+ direction: "horizontal",
45677
+ ratio: sidebarWidth,
45678
+ onRatioChange: onSidebarWidthChange,
45679
+ minSize: sidebarMinSize,
45680
+ resizable: true,
45681
+ left: /* @__PURE__ */ jsx(Box, { className: cn("h-full overflow-auto", sidebarClassName), children: sidebar }),
45682
+ right: centerRow,
45683
+ className: "flex-1 min-h-0 min-w-0"
45684
+ }
45685
+ ) : centerRow;
45686
+ const body = /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "flex-1 min-h-0 min-w-0", children: [
45687
+ rail && /* @__PURE__ */ jsx(
45688
+ Box,
45689
+ {
45690
+ className: cn(
45691
+ "flex-shrink-0 h-full overflow-auto border-r border-border",
45692
+ railClassName
45693
+ ),
45694
+ style: { width: railWidth },
45695
+ children: rail
45696
+ }
45697
+ ),
45698
+ sidebarAndCenter
45699
+ ] });
45700
+ const bodyPlusBottom = showBottomPanel ? /* @__PURE__ */ jsx(
45701
+ SplitPane,
45702
+ {
45703
+ direction: "vertical",
45704
+ ratio: 100 - bottomPanelHeight,
45705
+ onRatioChange: (topRatio) => onBottomPanelHeightChange?.(100 - topRatio),
45706
+ minSize: bottomPanelMinSize,
45707
+ resizable: true,
45708
+ left: body,
45709
+ right: /* @__PURE__ */ jsx(
45710
+ Box,
45711
+ {
45712
+ className: cn(
45713
+ "h-full overflow-auto border-t border-border",
45714
+ bottomPanelClassName
45715
+ ),
45716
+ children: bottomPanel
45717
+ }
45718
+ ),
45719
+ className: "flex-1 min-h-0"
45720
+ }
45721
+ ) : body;
45722
+ return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: cn("w-full h-full overflow-hidden", className), children: [
45723
+ bodyPlusBottom,
45724
+ statusBar && /* @__PURE__ */ jsx(
45725
+ Box,
45726
+ {
45727
+ className: cn(
45728
+ "flex-shrink-0 border-t border-border bg-background",
45729
+ statusBarClassName
45730
+ ),
45731
+ children: statusBar
45732
+ }
45733
+ )
45734
+ ] });
45735
+ };
45736
+ DockLayout.displayName = "DockLayout";
45737
+ }
45738
+ });
45229
45739
  function extractTitle(children) {
45230
- if (!React94__default.isValidElement(children)) return void 0;
45740
+ if (!React95__default.isValidElement(children)) return void 0;
45231
45741
  const props = children.props;
45232
45742
  if (typeof props.title === "string") {
45233
45743
  return props.title;
@@ -45589,7 +46099,7 @@ var init_Form = __esm({
45589
46099
  const isSchemaEntity = isOrbitalEntitySchema(entity);
45590
46100
  const resolvedEntity = isSchemaEntity ? entity : void 0;
45591
46101
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
45592
- const normalizedInitialData = React94__default.useMemo(() => {
46102
+ const normalizedInitialData = React95__default.useMemo(() => {
45593
46103
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
45594
46104
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
45595
46105
  const merged = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
@@ -45608,7 +46118,7 @@ var init_Form = __esm({
45608
46118
  }
45609
46119
  return normalized;
45610
46120
  }, [entity, initialData]);
45611
- const entityDerivedFields = React94__default.useMemo(() => {
46121
+ const entityDerivedFields = React95__default.useMemo(() => {
45612
46122
  if (fields && fields.length > 0) return void 0;
45613
46123
  if (!resolvedEntity) return void 0;
45614
46124
  return resolvedEntity.fields.map(
@@ -45629,16 +46139,16 @@ var init_Form = __esm({
45629
46139
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
45630
46140
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
45631
46141
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
45632
- const [formData, setFormData] = React94__default.useState(
46142
+ const [formData, setFormData] = React95__default.useState(
45633
46143
  normalizedInitialData
45634
46144
  );
45635
- const [collapsedSections, setCollapsedSections] = React94__default.useState(
46145
+ const [collapsedSections, setCollapsedSections] = React95__default.useState(
45636
46146
  /* @__PURE__ */ new Set()
45637
46147
  );
45638
- const [submitError, setSubmitError] = React94__default.useState(null);
45639
- const formRef = React94__default.useRef(null);
46148
+ const [submitError, setSubmitError] = React95__default.useState(null);
46149
+ const formRef = React95__default.useRef(null);
45640
46150
  const formMode = props.mode;
45641
- const mountedRef = React94__default.useRef(false);
46151
+ const mountedRef = React95__default.useRef(false);
45642
46152
  if (!mountedRef.current) {
45643
46153
  mountedRef.current = true;
45644
46154
  debug("forms", "mount", {
@@ -45651,7 +46161,7 @@ var init_Form = __esm({
45651
46161
  });
45652
46162
  }
45653
46163
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
45654
- const evalContext = React94__default.useMemo(
46164
+ const evalContext = React95__default.useMemo(
45655
46165
  () => ({
45656
46166
  formValues: formData,
45657
46167
  globalVariables: externalContext?.globalVariables ?? {},
@@ -45660,7 +46170,7 @@ var init_Form = __esm({
45660
46170
  }),
45661
46171
  [formData, externalContext]
45662
46172
  );
45663
- React94__default.useEffect(() => {
46173
+ React95__default.useEffect(() => {
45664
46174
  debug("forms", "initialData-sync", {
45665
46175
  mode: formMode,
45666
46176
  normalizedInitialData,
@@ -45671,7 +46181,7 @@ var init_Form = __esm({
45671
46181
  setFormData(normalizedInitialData);
45672
46182
  }
45673
46183
  }, [normalizedInitialData]);
45674
- const processCalculations = React94__default.useCallback(
46184
+ const processCalculations = React95__default.useCallback(
45675
46185
  (changedFieldId, newFormData) => {
45676
46186
  if (!hiddenCalculations.length) return;
45677
46187
  const context = {
@@ -45696,7 +46206,7 @@ var init_Form = __esm({
45696
46206
  },
45697
46207
  [hiddenCalculations, externalContext, eventBus]
45698
46208
  );
45699
- const checkViolations = React94__default.useCallback(
46209
+ const checkViolations = React95__default.useCallback(
45700
46210
  (changedFieldId, newFormData) => {
45701
46211
  if (!violationTriggers.length) return;
45702
46212
  const context = {
@@ -45734,7 +46244,7 @@ var init_Form = __esm({
45734
46244
  processCalculations(name, newFormData);
45735
46245
  checkViolations(name, newFormData);
45736
46246
  };
45737
- const isFieldVisible = React94__default.useCallback(
46247
+ const isFieldVisible = React95__default.useCallback(
45738
46248
  (fieldName2) => {
45739
46249
  const condition = conditionalFields[fieldName2];
45740
46250
  if (!condition) return true;
@@ -45742,7 +46252,7 @@ var init_Form = __esm({
45742
46252
  },
45743
46253
  [conditionalFields, evalContext]
45744
46254
  );
45745
- const isSectionVisible = React94__default.useCallback(
46255
+ const isSectionVisible = React95__default.useCallback(
45746
46256
  (section) => {
45747
46257
  if (!section.condition) return true;
45748
46258
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -45818,7 +46328,7 @@ var init_Form = __esm({
45818
46328
  eventBus.emit(`UI:${onCancel}`);
45819
46329
  }
45820
46330
  };
45821
- const renderField = React94__default.useCallback(
46331
+ const renderField = React95__default.useCallback(
45822
46332
  (field) => {
45823
46333
  const fieldName2 = field.name || field.field;
45824
46334
  if (!fieldName2) return null;
@@ -45840,7 +46350,7 @@ var init_Form = __esm({
45840
46350
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
45841
46351
  );
45842
46352
  const effectiveFields = entityDerivedFields ?? fields;
45843
- const normalizedFields = React94__default.useMemo(() => {
46353
+ const normalizedFields = React95__default.useMemo(() => {
45844
46354
  if (!effectiveFields || effectiveFields.length === 0) return [];
45845
46355
  return effectiveFields.map((field) => {
45846
46356
  if (typeof field === "string") {
@@ -45875,7 +46385,7 @@ var init_Form = __esm({
45875
46385
  };
45876
46386
  });
45877
46387
  }, [effectiveFields, resolvedEntity, fieldOverrides]);
45878
- const schemaFields = React94__default.useMemo(() => {
46388
+ const schemaFields = React95__default.useMemo(() => {
45879
46389
  if (normalizedFields.length === 0) return null;
45880
46390
  if (isDebugEnabled()) {
45881
46391
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -45885,7 +46395,7 @@ var init_Form = __esm({
45885
46395
  }
45886
46396
  return normalizedFields.map(renderField).filter(Boolean);
45887
46397
  }, [normalizedFields, renderField, entityName, conditionalFields]);
45888
- const sectionElements = React94__default.useMemo(() => {
46398
+ const sectionElements = React95__default.useMemo(() => {
45889
46399
  if (!sections || sections.length === 0) return null;
45890
46400
  return sections.map((section) => {
45891
46401
  if (!isSectionVisible(section)) {
@@ -46721,7 +47231,7 @@ var init_List = __esm({
46721
47231
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
46722
47232
  return [];
46723
47233
  }, [entity]);
46724
- const getItemActions = React94__default.useCallback(
47234
+ const getItemActions = React95__default.useCallback(
46725
47235
  (item) => {
46726
47236
  if (!itemActions) return [];
46727
47237
  if (typeof itemActions === "function") {
@@ -47203,7 +47713,7 @@ var init_MediaGallery = __esm({
47203
47713
  [selectable, selectedItems, selectionEvent, eventBus]
47204
47714
  );
47205
47715
  const entityData = Array.isArray(entity) ? entity : [];
47206
- const items = React94__default.useMemo(() => {
47716
+ const items = React95__default.useMemo(() => {
47207
47717
  if (propItems && propItems.length > 0) return propItems;
47208
47718
  if (entityData.length === 0) return [];
47209
47719
  return entityData.map((record, idx) => {
@@ -47368,7 +47878,7 @@ var init_MediaGallery = __esm({
47368
47878
  }
47369
47879
  });
47370
47880
  function extractTitle2(children) {
47371
- if (!React94__default.isValidElement(children)) return void 0;
47881
+ if (!React95__default.isValidElement(children)) return void 0;
47372
47882
  const props = children.props;
47373
47883
  if (typeof props.title === "string") {
47374
47884
  return props.title;
@@ -47642,7 +48152,7 @@ var init_debugRegistry = __esm({
47642
48152
  }
47643
48153
  });
47644
48154
  function useDebugData() {
47645
- const [data, setData] = React94.useState(() => ({
48155
+ const [data, setData] = React95.useState(() => ({
47646
48156
  traits: [],
47647
48157
  ticks: [],
47648
48158
  guards: [],
@@ -47656,7 +48166,7 @@ function useDebugData() {
47656
48166
  },
47657
48167
  lastUpdate: Date.now()
47658
48168
  }));
47659
- React94.useEffect(() => {
48169
+ React95.useEffect(() => {
47660
48170
  const updateData = () => {
47661
48171
  setData({
47662
48172
  traits: getAllTraits(),
@@ -47765,12 +48275,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
47765
48275
  return positions;
47766
48276
  }
47767
48277
  function WalkMinimap() {
47768
- const [walkStep, setWalkStep] = React94.useState(null);
47769
- const [traits2, setTraits] = React94.useState([]);
47770
- const [coveredEdges, setCoveredEdges] = React94.useState([]);
47771
- const [completedTraits, setCompletedTraits] = React94.useState(/* @__PURE__ */ new Set());
47772
- const prevTraitRef = React94.useRef(null);
47773
- React94.useEffect(() => {
48278
+ const [walkStep, setWalkStep] = React95.useState(null);
48279
+ const [traits2, setTraits] = React95.useState([]);
48280
+ const [coveredEdges, setCoveredEdges] = React95.useState([]);
48281
+ const [completedTraits, setCompletedTraits] = React95.useState(/* @__PURE__ */ new Set());
48282
+ const prevTraitRef = React95.useRef(null);
48283
+ React95.useEffect(() => {
47774
48284
  const interval = setInterval(() => {
47775
48285
  const w = window;
47776
48286
  const step = w.__orbitalWalkStep;
@@ -48206,15 +48716,15 @@ var init_EntitiesTab = __esm({
48206
48716
  });
48207
48717
  function EventFlowTab({ events: events2 }) {
48208
48718
  const { t } = useTranslate();
48209
- const [filter, setFilter] = React94.useState("all");
48210
- const containerRef = React94.useRef(null);
48211
- const [autoScroll, setAutoScroll] = React94.useState(true);
48212
- React94.useEffect(() => {
48719
+ const [filter, setFilter] = React95.useState("all");
48720
+ const containerRef = React95.useRef(null);
48721
+ const [autoScroll, setAutoScroll] = React95.useState(true);
48722
+ React95.useEffect(() => {
48213
48723
  if (autoScroll && containerRef.current) {
48214
48724
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
48215
48725
  }
48216
48726
  }, [events2.length, autoScroll]);
48217
- const filteredEvents = React94.useMemo(() => {
48727
+ const filteredEvents = React95.useMemo(() => {
48218
48728
  if (filter === "all") return events2;
48219
48729
  return events2.filter((e) => e.type === filter);
48220
48730
  }, [events2, filter]);
@@ -48330,7 +48840,7 @@ var init_EventFlowTab = __esm({
48330
48840
  });
48331
48841
  function GuardsPanel({ guards }) {
48332
48842
  const { t } = useTranslate();
48333
- const [filter, setFilter] = React94.useState("all");
48843
+ const [filter, setFilter] = React95.useState("all");
48334
48844
  if (guards.length === 0) {
48335
48845
  return /* @__PURE__ */ jsx(
48336
48846
  EmptyState,
@@ -48343,7 +48853,7 @@ function GuardsPanel({ guards }) {
48343
48853
  }
48344
48854
  const passedCount = guards.filter((g) => g.result).length;
48345
48855
  const failedCount = guards.length - passedCount;
48346
- const filteredGuards = React94.useMemo(() => {
48856
+ const filteredGuards = React95.useMemo(() => {
48347
48857
  if (filter === "all") return guards;
48348
48858
  if (filter === "passed") return guards.filter((g) => g.result);
48349
48859
  return guards.filter((g) => !g.result);
@@ -48506,10 +49016,10 @@ function EffectBadge({ effect }) {
48506
49016
  }
48507
49017
  function TransitionTimeline({ transitions }) {
48508
49018
  const { t } = useTranslate();
48509
- const containerRef = React94.useRef(null);
48510
- const [autoScroll, setAutoScroll] = React94.useState(true);
48511
- const [expandedId, setExpandedId] = React94.useState(null);
48512
- React94.useEffect(() => {
49019
+ const containerRef = React95.useRef(null);
49020
+ const [autoScroll, setAutoScroll] = React95.useState(true);
49021
+ const [expandedId, setExpandedId] = React95.useState(null);
49022
+ React95.useEffect(() => {
48513
49023
  if (autoScroll && containerRef.current) {
48514
49024
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
48515
49025
  }
@@ -48789,9 +49299,9 @@ function getAllEvents(traits2) {
48789
49299
  function EventDispatcherTab({ traits: traits2, schema }) {
48790
49300
  const eventBus = useEventBus();
48791
49301
  const { t } = useTranslate();
48792
- const [log11, setLog] = React94.useState([]);
48793
- const prevStatesRef = React94.useRef(/* @__PURE__ */ new Map());
48794
- React94.useEffect(() => {
49302
+ const [log11, setLog] = React95.useState([]);
49303
+ const prevStatesRef = React95.useRef(/* @__PURE__ */ new Map());
49304
+ React95.useEffect(() => {
48795
49305
  for (const trait of traits2) {
48796
49306
  const prev = prevStatesRef.current.get(trait.id);
48797
49307
  if (prev && prev !== trait.currentState) {
@@ -48960,10 +49470,10 @@ function VerifyModePanel({
48960
49470
  localCount
48961
49471
  }) {
48962
49472
  const { t } = useTranslate();
48963
- const [expanded, setExpanded] = React94.useState(true);
48964
- const scrollRef = React94.useRef(null);
48965
- const prevCountRef = React94.useRef(0);
48966
- React94.useEffect(() => {
49473
+ const [expanded, setExpanded] = React95.useState(true);
49474
+ const scrollRef = React95.useRef(null);
49475
+ const prevCountRef = React95.useRef(0);
49476
+ React95.useEffect(() => {
48967
49477
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
48968
49478
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
48969
49479
  }
@@ -49020,10 +49530,10 @@ function RuntimeDebugger({
49020
49530
  schema
49021
49531
  }) {
49022
49532
  const { t } = useTranslate();
49023
- const [isCollapsed, setIsCollapsed] = React94.useState(mode === "verify" ? true : defaultCollapsed);
49024
- const [isVisible, setIsVisible] = React94.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
49533
+ const [isCollapsed, setIsCollapsed] = React95.useState(mode === "verify" ? true : defaultCollapsed);
49534
+ const [isVisible, setIsVisible] = React95.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
49025
49535
  const debugData = useDebugData();
49026
- React94.useEffect(() => {
49536
+ React95.useEffect(() => {
49027
49537
  if (mode === "inline") return;
49028
49538
  return onDebugToggle((enabled) => {
49029
49539
  setIsVisible(enabled);
@@ -49032,7 +49542,7 @@ function RuntimeDebugger({
49032
49542
  }
49033
49543
  });
49034
49544
  }, [mode]);
49035
- React94.useEffect(() => {
49545
+ React95.useEffect(() => {
49036
49546
  if (mode === "inline") return;
49037
49547
  const handleKeyDown = (e) => {
49038
49548
  if (e.key === "`" && isVisible) {
@@ -49047,7 +49557,7 @@ function RuntimeDebugger({
49047
49557
  if (!isVisible) {
49048
49558
  return null;
49049
49559
  }
49050
- const positionClasses = {
49560
+ const positionClasses2 = {
49051
49561
  "bottom-right": "bottom-4 right-4",
49052
49562
  "bottom-left": "bottom-4 left-4",
49053
49563
  "top-right": "top-4 right-4",
@@ -49176,7 +49686,7 @@ function RuntimeDebugger({
49176
49686
  className: cn(
49177
49687
  "runtime-debugger",
49178
49688
  "fixed",
49179
- positionClasses[position],
49689
+ positionClasses2[position],
49180
49690
  isCollapsed ? "runtime-debugger--collapsed" : "runtime-debugger--expanded",
49181
49691
  className
49182
49692
  ),
@@ -49258,6 +49768,7 @@ var init_SegmentRenderer = __esm({
49258
49768
  "use client";
49259
49769
  init_MarkdownContent();
49260
49770
  init_CodeBlock();
49771
+ init_MermaidDiagram();
49261
49772
  init_QuizBlock();
49262
49773
  init_ActivationBlock();
49263
49774
  init_ConnectionBlock();
@@ -49289,6 +49800,9 @@ var init_SegmentRenderer = __esm({
49289
49800
  return /* @__PURE__ */ jsx(MarkdownContent, { content: segment.content }, `md-${index}`);
49290
49801
  }
49291
49802
  if (segment.type === "code") {
49803
+ if (segment.language === "mermaid") {
49804
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code: segment.content }, `code-${index}`);
49805
+ }
49292
49806
  if (segment.runnable && onRunCodeSimulation) {
49293
49807
  return /* @__PURE__ */ jsx(
49294
49808
  CodeRunnerPanel,
@@ -49421,99 +49935,6 @@ var init_ShowcaseOrganism = __esm({
49421
49935
  ShowcaseOrganism.displayName = "ShowcaseOrganism";
49422
49936
  }
49423
49937
  });
49424
- var SplitPane;
49425
- var init_SplitPane = __esm({
49426
- "components/core/organisms/layout/SplitPane.tsx"() {
49427
- "use client";
49428
- init_cn();
49429
- SplitPane = ({
49430
- direction = "horizontal",
49431
- ratio: initialRatio = 50,
49432
- minSize = 100,
49433
- resizable = true,
49434
- left,
49435
- right,
49436
- className,
49437
- leftClassName,
49438
- rightClassName
49439
- }) => {
49440
- const [ratio, setRatio] = useState(initialRatio);
49441
- const containerRef = useRef(null);
49442
- const isDragging = useRef(false);
49443
- const handlePointerDown = useCallback(
49444
- (e) => {
49445
- if (!resizable) return;
49446
- e.preventDefault();
49447
- isDragging.current = true;
49448
- e.currentTarget.setPointerCapture(e.pointerId);
49449
- const handlePointerMove = (ev) => {
49450
- if (!isDragging.current || !containerRef.current) return;
49451
- const rect = containerRef.current.getBoundingClientRect();
49452
- let newRatio;
49453
- if (direction === "horizontal") {
49454
- const x = ev.clientX - rect.left;
49455
- newRatio = x / rect.width * 100;
49456
- } else {
49457
- const y = ev.clientY - rect.top;
49458
- newRatio = y / rect.height * 100;
49459
- }
49460
- const minRatio = minSize / (direction === "horizontal" ? rect.width : rect.height) * 100;
49461
- const maxRatio = 100 - minRatio;
49462
- newRatio = Math.max(minRatio, Math.min(maxRatio, newRatio));
49463
- setRatio(newRatio);
49464
- };
49465
- const handlePointerUp = () => {
49466
- isDragging.current = false;
49467
- document.removeEventListener("pointermove", handlePointerMove);
49468
- document.removeEventListener("pointerup", handlePointerUp);
49469
- document.removeEventListener("pointercancel", handlePointerUp);
49470
- };
49471
- document.addEventListener("pointermove", handlePointerMove);
49472
- document.addEventListener("pointerup", handlePointerUp);
49473
- document.addEventListener("pointercancel", handlePointerUp);
49474
- },
49475
- [direction, minSize, resizable]
49476
- );
49477
- const isHorizontal = direction === "horizontal";
49478
- return /* @__PURE__ */ jsxs(
49479
- "div",
49480
- {
49481
- ref: containerRef,
49482
- className: cn(
49483
- "flex w-full h-full",
49484
- isHorizontal ? "flex-row" : "flex-col",
49485
- className
49486
- ),
49487
- children: [
49488
- /* @__PURE__ */ jsx(
49489
- "div",
49490
- {
49491
- className: cn("overflow-auto", leftClassName),
49492
- style: {
49493
- [isHorizontal ? "width" : "height"]: `${ratio}%`,
49494
- flexShrink: 0
49495
- },
49496
- children: left
49497
- }
49498
- ),
49499
- resizable && /* @__PURE__ */ jsx(
49500
- "div",
49501
- {
49502
- onPointerDown: handlePointerDown,
49503
- className: cn(
49504
- "flex-shrink-0 bg-border transition-colors touch-none",
49505
- isHorizontal ? "w-1 cursor-col-resize hover:w-1.5 hover:bg-muted-foreground" : "h-1 cursor-row-resize hover:h-1.5 hover:bg-muted-foreground"
49506
- )
49507
- }
49508
- ),
49509
- /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto", rightClassName), children: right })
49510
- ]
49511
- }
49512
- );
49513
- };
49514
- SplitPane.displayName = "SplitPane";
49515
- }
49516
- });
49517
49938
  var StatCard;
49518
49939
  var init_StatCard = __esm({
49519
49940
  "components/core/organisms/StatCard.tsx"() {
@@ -49552,7 +49973,7 @@ var init_StatCard = __esm({
49552
49973
  const labelToUse = propLabel ?? propTitle;
49553
49974
  const eventBus = useEventBus();
49554
49975
  const { t } = useTranslate();
49555
- const handleActionClick = React94__default.useCallback(() => {
49976
+ const handleActionClick = React95__default.useCallback(() => {
49556
49977
  if (action?.event) {
49557
49978
  eventBus.emit(`UI:${action.event}`, {});
49558
49979
  }
@@ -49563,7 +49984,7 @@ var init_StatCard = __esm({
49563
49984
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
49564
49985
  const isLoading = externalLoading ?? false;
49565
49986
  const error = externalError;
49566
- const computeMetricValue = React94__default.useCallback(
49987
+ const computeMetricValue = React95__default.useCallback(
49567
49988
  (metric, items) => {
49568
49989
  if (metric.value !== void 0) {
49569
49990
  return metric.value;
@@ -49602,7 +50023,7 @@ var init_StatCard = __esm({
49602
50023
  },
49603
50024
  []
49604
50025
  );
49605
- const schemaStats = React94__default.useMemo(() => {
50026
+ const schemaStats = React95__default.useMemo(() => {
49606
50027
  if (!metrics || metrics.length === 0) return null;
49607
50028
  return metrics.map((metric) => ({
49608
50029
  label: metric.label,
@@ -49610,7 +50031,7 @@ var init_StatCard = __esm({
49610
50031
  format: metric.format
49611
50032
  }));
49612
50033
  }, [metrics, data, computeMetricValue]);
49613
- const calculatedTrend = React94__default.useMemo(() => {
50034
+ const calculatedTrend = React95__default.useMemo(() => {
49614
50035
  if (manualTrend !== void 0) return manualTrend;
49615
50036
  if (previousValue === void 0 || currentValue === void 0)
49616
50037
  return void 0;
@@ -50250,8 +50671,8 @@ var init_SubagentTracePanel = __esm({
50250
50671
  ] });
50251
50672
  };
50252
50673
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
50253
- const endRef = React94__default.useRef(null);
50254
- React94__default.useEffect(() => {
50674
+ const endRef = React95__default.useRef(null);
50675
+ React95__default.useEffect(() => {
50255
50676
  if (!autoScroll) return;
50256
50677
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
50257
50678
  }, [activities.length, autoScroll]);
@@ -50345,7 +50766,7 @@ var init_SubagentTracePanel = __esm({
50345
50766
  };
50346
50767
  SubagentRichCard = ({ subagent }) => {
50347
50768
  const { t } = useTranslate();
50348
- const activities = React94__default.useMemo(
50769
+ const activities = React95__default.useMemo(
50349
50770
  () => subagentMessagesToActivities(subagent.messages),
50350
50771
  [subagent.messages]
50351
50772
  );
@@ -50422,8 +50843,8 @@ var init_SubagentTracePanel = __esm({
50422
50843
  ] });
50423
50844
  };
50424
50845
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
50425
- const endRef = React94__default.useRef(null);
50426
- React94__default.useEffect(() => {
50846
+ const endRef = React95__default.useRef(null);
50847
+ React95__default.useEffect(() => {
50427
50848
  if (!autoScroll) return;
50428
50849
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
50429
50850
  }, [messages.length, autoScroll]);
@@ -50858,7 +51279,7 @@ var init_Timeline = __esm({
50858
51279
  }) => {
50859
51280
  const { t } = useTranslate();
50860
51281
  const entityData = entity ?? [];
50861
- const items = React94__default.useMemo(() => {
51282
+ const items = React95__default.useMemo(() => {
50862
51283
  if (propItems) return propItems;
50863
51284
  if (entityData.length === 0) return [];
50864
51285
  return entityData.map((record, idx) => {
@@ -50960,7 +51381,7 @@ var init_Timeline = __esm({
50960
51381
  }
50961
51382
  });
50962
51383
  function extractToastProps(children) {
50963
- if (!React94__default.isValidElement(children)) {
51384
+ if (!React95__default.isValidElement(children)) {
50964
51385
  if (typeof children === "string") {
50965
51386
  return { message: children };
50966
51387
  }
@@ -51002,7 +51423,7 @@ var init_ToastSlot = __esm({
51002
51423
  eventBus.emit(`${prefix}CLOSE`);
51003
51424
  };
51004
51425
  if (!isVisible) return null;
51005
- const isCustomContent = React94__default.isValidElement(children) && !message;
51426
+ const isCustomContent = React95__default.isValidElement(children) && !message;
51006
51427
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
51007
51428
  Toast,
51008
51429
  {
@@ -51097,6 +51518,7 @@ var init_component_registry_generated = __esm({
51097
51518
  init_DocSearch();
51098
51519
  init_DocSidebar();
51099
51520
  init_DocTOC();
51521
+ init_DockLayout();
51100
51522
  init_DocumentDetails();
51101
51523
  init_DocumentPanel();
51102
51524
  init_DocumentViewer();
@@ -51127,6 +51549,7 @@ var init_component_registry_generated = __esm({
51127
51549
  init_FlipCard();
51128
51550
  init_FlipContainer();
51129
51551
  init_FloatingActionButton();
51552
+ init_FloatingToolbar();
51130
51553
  init_Form();
51131
51554
  init_FormField();
51132
51555
  init_FormSection();
@@ -51371,6 +51794,7 @@ var init_component_registry_generated = __esm({
51371
51794
  "DocSearch": DocSearch,
51372
51795
  "DocSidebar": DocSidebar,
51373
51796
  "DocTOC": DocTOC,
51797
+ "DockLayout": DockLayout,
51374
51798
  "DocumentDetails": DocumentDetails,
51375
51799
  "DocumentPanel": DocumentPanel,
51376
51800
  "DocumentViewer": DocumentViewer,
@@ -51401,6 +51825,7 @@ var init_component_registry_generated = __esm({
51401
51825
  "FlipCard": FlipCard,
51402
51826
  "FlipContainer": FlipContainer,
51403
51827
  "FloatingActionButton": FloatingActionButton,
51828
+ "FloatingToolbar": FloatingToolbar,
51404
51829
  "Form": Form,
51405
51830
  "FormField": FormField,
51406
51831
  "FormLayout": FormLayout,
@@ -51588,7 +52013,7 @@ function SuspenseConfigProvider({
51588
52013
  config,
51589
52014
  children
51590
52015
  }) {
51591
- return React94__default.createElement(
52016
+ return React95__default.createElement(
51592
52017
  SuspenseConfigContext.Provider,
51593
52018
  { value: config },
51594
52019
  children
@@ -51636,7 +52061,7 @@ function enrichFormFields(fields, entityDef) {
51636
52061
  }
51637
52062
  return { name: field, label: humanizeFieldName(field) };
51638
52063
  }
51639
- if (field && typeof field === "object" && !Array.isArray(field) && !React94__default.isValidElement(field) && !(field instanceof Date)) {
52064
+ if (field && typeof field === "object" && !Array.isArray(field) && !React95__default.isValidElement(field) && !(field instanceof Date)) {
51640
52065
  const obj = field;
51641
52066
  const fieldName2 = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
51642
52067
  if (!fieldName2) return field;
@@ -51689,7 +52114,7 @@ function enrichDetailFields(fields, entityDef) {
51689
52114
  const meta = metaFor(field);
51690
52115
  return meta ? { key: field, ...meta } : field;
51691
52116
  }
51692
- if (field && typeof field === "object" && !Array.isArray(field) && !React94__default.isValidElement(field) && !(field instanceof Date)) {
52117
+ if (field && typeof field === "object" && !Array.isArray(field) && !React95__default.isValidElement(field) && !(field instanceof Date)) {
51693
52118
  const obj = field;
51694
52119
  const fieldName2 = typeof obj.key === "string" ? obj.key : typeof obj.name === "string" ? obj.name : void 0;
51695
52120
  if (!fieldName2 || obj.type) return field;
@@ -52148,7 +52573,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
52148
52573
  const key = `${parentId}-${index}-trait:${traitName}`;
52149
52574
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
52150
52575
  }
52151
- return /* @__PURE__ */ jsx(React94__default.Fragment, { children: child }, `${parentId}-${index}`);
52576
+ return /* @__PURE__ */ jsx(React95__default.Fragment, { children: child }, `${parentId}-${index}`);
52152
52577
  }
52153
52578
  if (!child || typeof child !== "object") return null;
52154
52579
  const childId = `${parentId}-${index}`;
@@ -52205,7 +52630,7 @@ function isPatternConfig(value) {
52205
52630
  if (value === null || value === void 0) return false;
52206
52631
  if (typeof value !== "object") return false;
52207
52632
  if (Array.isArray(value)) return false;
52208
- if (React94__default.isValidElement(value)) return false;
52633
+ if (React95__default.isValidElement(value)) return false;
52209
52634
  if (value instanceof Date) return false;
52210
52635
  if (typeof value === "function") return false;
52211
52636
  const record = value;
@@ -52218,9 +52643,9 @@ function renderPatternValue(value) {
52218
52643
  if (typeof value === "string") return renderPatternChildren(value, () => {
52219
52644
  });
52220
52645
  if (value instanceof Date) return value.toLocaleString();
52221
- if (React94__default.isValidElement(value)) return value;
52646
+ if (React95__default.isValidElement(value)) return value;
52222
52647
  if (Array.isArray(value)) {
52223
- return value.map((item, index) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: renderPatternValue(item) }, index));
52648
+ return value.map((item, index) => /* @__PURE__ */ jsx(React95__default.Fragment, { children: renderPatternValue(item) }, index));
52224
52649
  }
52225
52650
  if (isPatternConfig(value)) {
52226
52651
  const { type, ...props } = value;
@@ -52230,7 +52655,7 @@ function renderPatternValue(value) {
52230
52655
  return null;
52231
52656
  }
52232
52657
  function isPlainConfigObject(value) {
52233
- if (React94__default.isValidElement(value)) return false;
52658
+ if (React95__default.isValidElement(value)) return false;
52234
52659
  if (value instanceof Date) return false;
52235
52660
  const proto = Object.getPrototypeOf(value);
52236
52661
  return proto === Object.prototype || proto === null;
@@ -52404,7 +52829,7 @@ function SlotContentRenderer({
52404
52829
  for (const slotKey of CONTENT_NODE_SLOTS) {
52405
52830
  const slotVal = restProps[slotKey];
52406
52831
  if (slotVal === void 0 || slotVal === null) continue;
52407
- if (React94__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
52832
+ if (React95__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
52408
52833
  const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
52409
52834
  if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
52410
52835
  nodeSlotOverrides[slotKey] = renderPatternChildren(
@@ -52458,7 +52883,7 @@ function SlotContentRenderer({
52458
52883
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
52459
52884
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
52460
52885
  const sample = resolvedItems[0];
52461
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React94__default.isValidElement(sample) && !(sample instanceof Date)) {
52886
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React95__default.isValidElement(sample) && !(sample instanceof Date)) {
52462
52887
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
52463
52888
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
52464
52889
  }
@@ -52822,7 +53247,7 @@ var AvlTransition = ({
52822
53247
  opacity = 1,
52823
53248
  className
52824
53249
  }) => {
52825
- const ids = React94__default.useMemo(() => {
53250
+ const ids = React95__default.useMemo(() => {
52826
53251
  avlTransitionId += 1;
52827
53252
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
52828
53253
  }, []);
@@ -53383,7 +53808,7 @@ var AvlStateMachine = ({
53383
53808
  color = "var(--color-primary)",
53384
53809
  animated = false
53385
53810
  }) => {
53386
- const ids = React94__default.useMemo(() => {
53811
+ const ids = React95__default.useMemo(() => {
53387
53812
  avlSmId += 1;
53388
53813
  const base = `avl-sm-${avlSmId}`;
53389
53814
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -53582,7 +54007,7 @@ var AvlOrbitalUnit = ({
53582
54007
  color = "var(--color-primary)",
53583
54008
  animated = false
53584
54009
  }) => {
53585
- const ids = React94__default.useMemo(() => {
54010
+ const ids = React95__default.useMemo(() => {
53586
54011
  avlOuId += 1;
53587
54012
  const base = `avl-ou-${avlOuId}`;
53588
54013
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -53678,7 +54103,7 @@ var AvlClosedCircuit = ({
53678
54103
  color = "var(--color-primary)",
53679
54104
  animated = false
53680
54105
  }) => {
53681
- const ids = React94__default.useMemo(() => {
54106
+ const ids = React95__default.useMemo(() => {
53682
54107
  avlCcId += 1;
53683
54108
  const base = `avl-cc-${avlCcId}`;
53684
54109
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -53833,7 +54258,7 @@ var AvlEmitListen = ({
53833
54258
  color = "var(--color-primary)",
53834
54259
  animated = false
53835
54260
  }) => {
53836
- const ids = React94__default.useMemo(() => {
54261
+ const ids = React95__default.useMemo(() => {
53837
54262
  avlElId += 1;
53838
54263
  const base = `avl-el-${avlElId}`;
53839
54264
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -54107,7 +54532,7 @@ function renderNode(node, color, glowId) {
54107
54532
  const baseR = node.type === "operator" ? 20 : 16;
54108
54533
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
54109
54534
  const nc = nodeColor(node.type, color);
54110
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
54535
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
54111
54536
  node.children.map((child, i) => {
54112
54537
  const childR = Math.max(
54113
54538
  child.type === "operator" ? 20 : 16,
@@ -54164,7 +54589,7 @@ var AvlExprTree = ({
54164
54589
  className,
54165
54590
  color = "var(--color-primary)"
54166
54591
  }) => {
54167
- const ids = React94__default.useMemo(() => {
54592
+ const ids = React95__default.useMemo(() => {
54168
54593
  avlEtId += 1;
54169
54594
  return { glow: `avl-et-${avlEtId}-glow` };
54170
54595
  }, []);
@@ -54999,7 +55424,7 @@ var SystemNode = ({ data }) => {
54999
55424
  stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
55000
55425
  const tc = transitionCounts[s.name] ?? 0;
55001
55426
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
55002
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
55427
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
55003
55428
  /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial ?? void 0, isTerminal: s.isTerminal ?? void 0 }),
55004
55429
  i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
55005
55430
  ] }, s.name);
@@ -56086,7 +56511,7 @@ function resolveLambdaBindings(body, params, item, index) {
56086
56511
  }
56087
56512
  return substituted;
56088
56513
  }
56089
- if (body !== null && typeof body === "object" && !React94__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
56514
+ if (body !== null && typeof body === "object" && !React95__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
56090
56515
  const out = {};
56091
56516
  for (const [k, v] of Object.entries(body)) {
56092
56517
  out[k] = recur(v);
@@ -56119,7 +56544,7 @@ function deferLambdaEntityExprs(value) {
56119
56544
  }
56120
56545
  return arr.map((v) => deferLambdaEntityExprs(v));
56121
56546
  }
56122
- if (value !== null && typeof value === "object" && !React94__default.isValidElement(value) && !(value instanceof Date) && typeof value !== "function" && !isRenderBindingMarker(value)) {
56547
+ if (value !== null && typeof value === "object" && !React95__default.isValidElement(value) && !(value instanceof Date) && typeof value !== "function" && !isRenderBindingMarker(value)) {
56123
56548
  const out = {};
56124
56549
  for (const [k, v] of Object.entries(value)) {
56125
56550
  out[k] = deferLambdaEntityExprs(v);
@@ -56133,7 +56558,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
56133
56558
  const resolvedBody = deferLambdaEntityExprs(
56134
56559
  resolveLambdaBindings(lambdaBody, params, item, index)
56135
56560
  );
56136
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React94__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
56561
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React95__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
56137
56562
  return null;
56138
56563
  }
56139
56564
  const record = resolvedBody;
@@ -56152,7 +56577,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
56152
56577
  props: childProps,
56153
56578
  priority: 0
56154
56579
  };
56155
- return React94__default.createElement(SlotContentRenderer2, { content: childContent });
56580
+ return React95__default.createElement(SlotContentRenderer2, { content: childContent });
56156
56581
  };
56157
56582
  }
56158
56583
  function convertNode(node, callerKey) {
@@ -56172,7 +56597,7 @@ function convertNode(node, callerKey) {
56172
56597
  });
56173
56598
  return anyChanged ? mapped : node;
56174
56599
  }
56175
- if (typeof node === "object" && !React94__default.isValidElement(node) && !(node instanceof Date)) {
56600
+ if (typeof node === "object" && !React95__default.isValidElement(node) && !(node instanceof Date)) {
56176
56601
  return convertObjectProps(node);
56177
56602
  }
56178
56603
  return node;
@@ -58129,13 +58554,12 @@ function useCanvasDraggable({
58129
58554
  payload,
58130
58555
  disabled
58131
58556
  }) {
58132
- const { setNodeRef, attributes, listeners: listeners7, isDragging, transform } = useDraggable({
58557
+ const { setNodeRef, attributes, listeners: listeners7, isDragging, transform } = useDraggable$1({
58133
58558
  id,
58134
58559
  data: { payload },
58135
58560
  disabled
58136
58561
  });
58137
58562
  const style = {
58138
- transform: CSS.Translate.toString(transform),
58139
58563
  cursor: disabled ? "not-allowed" : isDragging ? "grabbing" : "grab",
58140
58564
  opacity: isDragging ? 0.5 : 1,
58141
58565
  touchAction: "none"
@@ -58187,6 +58611,21 @@ function defaultEmit(eventBus, drop) {
58187
58611
  log9.info("default-emit:behavior", { behaviorName, level: target.level });
58188
58612
  return;
58189
58613
  }
58614
+ if (payload.kind === "pattern-instance") {
58615
+ const fromPath = payload.data["fromPath"];
58616
+ if (typeof fromPath !== "string") {
58617
+ log9.warn("default-emit:pattern-instance:missing-fromPath");
58618
+ return;
58619
+ }
58620
+ const out = { fromPath, loc: payload.data["loc"] };
58621
+ if (resolved) {
58622
+ out.toParentPath = resolved.parentPath;
58623
+ out.toIndex = resolved.index;
58624
+ }
58625
+ eventBus.emit("UI:PATTERN_MOVE", out);
58626
+ log9.info("default-emit:pattern-instance", { fromPath, level: target.level });
58627
+ return;
58628
+ }
58190
58629
  log9.debug("default-emit:unhandled-kind", { kind: payload.kind });
58191
58630
  }
58192
58631
  function CanvasDndProvider({
@@ -58196,10 +58635,17 @@ function CanvasDndProvider({
58196
58635
  }) {
58197
58636
  const eventBus = useEventBus();
58198
58637
  const sensors = useAlmadarDndSensors(false);
58199
- const [activePayload, setActivePayload] = React94__default.useState(null);
58200
- const handleDragStart = React94__default.useCallback((e) => {
58638
+ const [activePayload, setActivePayload] = React95__default.useState(null);
58639
+ const lastPointerRef = React95__default.useRef(null);
58640
+ const trackPointer = React95__default.useCallback((ev) => {
58641
+ lastPointerRef.current = { x: ev.clientX, y: ev.clientY };
58642
+ }, []);
58643
+ const handleDragStart = React95__default.useCallback((e) => {
58201
58644
  const data = e.active.data.current;
58202
58645
  const payload = data?.payload;
58646
+ const activator = e.activatorEvent;
58647
+ lastPointerRef.current = activator instanceof MouseEvent ? { x: activator.clientX, y: activator.clientY } : null;
58648
+ document.addEventListener("pointermove", trackPointer);
58203
58649
  if (payload) {
58204
58650
  setActivePayload(payload);
58205
58651
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
@@ -58207,9 +58653,10 @@ function CanvasDndProvider({
58207
58653
  } else {
58208
58654
  log9.warn("dragStart:missing-payload", { id: e.active.id });
58209
58655
  }
58210
- }, [eventBus]);
58211
- const handleDragEnd = React94__default.useCallback((e) => {
58656
+ }, [eventBus, trackPointer]);
58657
+ const handleDragEnd = React95__default.useCallback((e) => {
58212
58658
  setActivePayload(null);
58659
+ document.removeEventListener("pointermove", trackPointer);
58213
58660
  const activeData = e.active.data.current;
58214
58661
  const payload = activeData?.payload;
58215
58662
  const overData = e.over?.data.current;
@@ -58230,17 +58677,24 @@ function CanvasDndProvider({
58230
58677
  log9.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
58231
58678
  return;
58232
58679
  }
58233
- const activator = e.activatorEvent;
58234
- const cursor = activator && typeof activator.clientX === "number" && typeof activator.clientY === "number" ? { x: activator.clientX + e.delta.x, y: activator.clientY + e.delta.y } : null;
58680
+ const cursor = lastPointerRef.current;
58235
58681
  const resolved = target.resolvePath && cursor ? target.resolvePath(cursor) : null;
58682
+ log9.debug("dragEnd:resolve", {
58683
+ hasResolver: !!target.resolvePath,
58684
+ cursorX: cursor?.x,
58685
+ cursorY: cursor?.y,
58686
+ resolvedParent: resolved?.parentPath ?? null,
58687
+ resolvedIndex: resolved?.index ?? null
58688
+ });
58236
58689
  const drop = { payload, target, cursor, resolved };
58237
58690
  const suppressed = onDrop ? onDrop(drop) === true : false;
58238
58691
  if (!suppressed) defaultEmit(eventBus, drop);
58239
- }, [eventBus, onDrop]);
58240
- const handleDragCancel = React94__default.useCallback(() => {
58692
+ }, [eventBus, onDrop, trackPointer]);
58693
+ const handleDragCancel = React95__default.useCallback(() => {
58241
58694
  setActivePayload(null);
58695
+ document.removeEventListener("pointermove", trackPointer);
58242
58696
  log9.info("dragCancel");
58243
- }, []);
58697
+ }, [trackPointer]);
58244
58698
  return /* @__PURE__ */ jsxs(
58245
58699
  DndContext,
58246
58700
  {
@@ -58251,7 +58705,14 @@ function CanvasDndProvider({
58251
58705
  onDragCancel: handleDragCancel,
58252
58706
  children: [
58253
58707
  children,
58254
- renderOverlay ? /* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, children: activePayload ? renderOverlay(activePayload) : null }) : null
58708
+ renderOverlay ? (
58709
+ /* pointer-events none on the WRAPPER, not just the rendered content:
58710
+ dnd-kit doesn't default it, and the overlay rides exactly under the
58711
+ cursor — with hit-testing on, `resolvePath`'s elementFromPoint sees
58712
+ the overlay instead of the drop target and every drop degrades to
58713
+ the caller's fallback position. */
58714
+ /* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, style: { pointerEvents: "none" }, children: activePayload ? renderOverlay(activePayload) : null })
58715
+ ) : null
58255
58716
  ]
58256
58717
  }
58257
58718
  );
@@ -58320,6 +58781,34 @@ function deriveEditFocusFromElement(el) {
58320
58781
  if (entity !== null) focus.entity = entity;
58321
58782
  return focus;
58322
58783
  }
58784
+ function withNodeTransition(focus, nodeTransitionEvent) {
58785
+ const transition = nodeTransitionEvent ?? focus.transition;
58786
+ return transition ? { ...focus, transition } : { ...focus };
58787
+ }
58788
+
58789
+ // components/avl/lib/compute-insertion-index.ts
58790
+ function computeInsertionIndex(childRects, pointer, axis) {
58791
+ for (let i = 0; i < childRects.length; i++) {
58792
+ const rect = childRects[i];
58793
+ const mid = axis === "vertical" ? rect.top + rect.height / 2 : rect.left + rect.width / 2;
58794
+ const pos = axis === "vertical" ? pointer.y : pointer.x;
58795
+ if (pos < mid) return i;
58796
+ }
58797
+ return childRects.length;
58798
+ }
58799
+
58800
+ // components/avl/lib/resolve-direct-children.ts
58801
+ function resolveDirectChildren(containerPath, candidates) {
58802
+ const prefix = `${containerPath}.children.`;
58803
+ return candidates.reduce((acc, { path, ref }) => {
58804
+ if (!path.startsWith(prefix)) return acc;
58805
+ const rest = path.slice(prefix.length);
58806
+ if (!rest || rest.includes(".")) return acc;
58807
+ const index = Number(rest);
58808
+ if (Number.isFinite(index)) acc.push({ index, ref });
58809
+ return acc;
58810
+ }, []).sort((a, b) => a.index - b.index).map(({ ref }) => ref);
58811
+ }
58323
58812
  function entityNameOf(ref) {
58324
58813
  if (!ref) return void 0;
58325
58814
  if (typeof ref === "string") return ref;
@@ -58605,6 +59094,13 @@ function rectRelativeTo(el, container, zoom) {
58605
59094
  height: (u.bottom - u.top) / z
58606
59095
  };
58607
59096
  }
59097
+ function resolveLayoutAxis(el) {
59098
+ let cur = el;
59099
+ while (getComputedStyle(cur).display === "contents" && cur.firstElementChild) {
59100
+ cur = cur.firstElementChild;
59101
+ }
59102
+ return getComputedStyle(cur).flexDirection === "row" ? "horizontal" : "vertical";
59103
+ }
58608
59104
  var OrbPreviewNodeInner = (props) => {
58609
59105
  const data = props.data;
58610
59106
  const screenSize = useContext(ScreenSizeContext);
@@ -58674,7 +59170,11 @@ var OrbPreviewNodeInner = (props) => {
58674
59170
  rect: rect ?? void 0
58675
59171
  });
58676
59172
  const focus = deriveEditFocusFromElement(patternEl);
58677
- if (focus) eventBus.emit("UI:ELEMENT_SELECTED", { focus: { ...focus } });
59173
+ if (focus) {
59174
+ eventBus.emit("UI:ELEMENT_SELECTED", {
59175
+ focus: { ...withNodeTransition(focus, data.transitionEvent) }
59176
+ });
59177
+ }
58678
59178
  } else {
58679
59179
  setSelectedRect(null);
58680
59180
  select(null);
@@ -58710,6 +59210,17 @@ var OrbPreviewNodeInner = (props) => {
58710
59210
  unsub2();
58711
59211
  };
58712
59212
  }, [eventBus]);
59213
+ const [reorderDragActive, setReorderDragActive] = useState(false);
59214
+ useEffect(() => {
59215
+ const unsub1 = eventBus.on("UI:DRAG_START", (e) => {
59216
+ if (e.payload?.kind === "pattern-instance") setReorderDragActive(true);
59217
+ });
59218
+ const unsub2 = eventBus.on("UI:DRAG_END", () => setReorderDragActive(false));
59219
+ return () => {
59220
+ unsub1();
59221
+ unsub2();
59222
+ };
59223
+ }, [eventBus]);
58713
59224
  const resolveL2Path = useCallback(
58714
59225
  (cursor) => {
58715
59226
  const hit = document.elementFromPoint(cursor.x, cursor.y);
@@ -58720,21 +59231,34 @@ var OrbPreviewNodeInner = (props) => {
58720
59231
  el = el.parentElement;
58721
59232
  }
58722
59233
  if (!el) return null;
58723
- const containerPath = el.dataset?.patternPath;
58724
- if (!containerPath) return { parentPath: "root", index: 0 };
58725
- const pathChildren = el.querySelectorAll(":scope > [data-pattern-path]");
58726
- let insertIndex = pathChildren.length;
58727
- const style = el.firstElementChild ? getComputedStyle(el.firstElementChild) : null;
58728
- const isVertical = style?.flexDirection !== "row";
58729
- for (let i = 0; i < pathChildren.length; i++) {
58730
- const rect = pathChildren[i].getBoundingClientRect();
58731
- const mid = isVertical ? rect.top + rect.height / 2 : rect.left + rect.width / 2;
58732
- const pos = isVertical ? cursor.y : cursor.x;
58733
- if (pos < mid) {
58734
- insertIndex = i;
58735
- break;
58736
- }
58737
- }
59234
+ const containerPath = el.dataset?.patternPath ?? "root";
59235
+ if (!el.dataset?.patternPath) {
59236
+ const rootEl = el.querySelector('[data-pattern-path="root"]');
59237
+ if (rootEl instanceof HTMLElement) el = rootEl;
59238
+ }
59239
+ const directChildren = resolveDirectChildren(
59240
+ containerPath,
59241
+ Array.from(el.querySelectorAll("[data-pattern-path]")).map((child) => ({
59242
+ path: child.dataset.patternPath ?? "",
59243
+ ref: child
59244
+ }))
59245
+ );
59246
+ const childRects = directChildren.map((child) => {
59247
+ const u = absUnion(child);
59248
+ if (u) return { ...u, width: u.right - u.left, height: u.bottom - u.top };
59249
+ const raw = child.getBoundingClientRect();
59250
+ return { top: raw.top, left: raw.left, right: raw.right, bottom: raw.bottom, width: raw.width, height: raw.height };
59251
+ });
59252
+ const axis = resolveLayoutAxis(el);
59253
+ const insertIndex = computeInsertionIndex(childRects, cursor, axis);
59254
+ orbPreviewLog.debug("resolveL2Path", {
59255
+ containerPath,
59256
+ childCount: childRects.length,
59257
+ axis,
59258
+ cursorY: cursor.y,
59259
+ mids: childRects.map((r2) => axis === "vertical" ? r2.top + r2.height / 2 : r2.left + r2.width / 2),
59260
+ insertIndex
59261
+ });
58738
59262
  return { parentPath: containerPath, index: insertIndex };
58739
59263
  },
58740
59264
  []
@@ -58754,13 +59278,35 @@ var OrbPreviewNodeInner = (props) => {
58754
59278
  const { setNodeRef: l2SetNodeRef, isOver: l2IsOver } = useCanvasDroppable({
58755
59279
  id: `orb-l2-${data.orbitalName}-${data.traitName ?? ""}-${data.transitionEvent ?? ""}`,
58756
59280
  target: l2Target,
58757
- accepts: ["pattern"],
59281
+ accepts: ["pattern", "pattern-instance"],
58758
59282
  disabled: !isExpanded
58759
59283
  });
59284
+ const reorderDataRef = useRef({ fromPath: "", loc: {} });
59285
+ const {
59286
+ setNodeRef: reorderSetNodeRef,
59287
+ listeners: reorderListeners
59288
+ } = useCanvasDraggable({
59289
+ id: `orb-l2-reorder-${data.orbitalName}-${data.traitName ?? ""}-${data.transitionEvent ?? ""}`,
59290
+ payload: { kind: "pattern-instance", data: reorderDataRef.current },
59291
+ disabled: !isExpanded
59292
+ });
59293
+ const handleContentPointerDown = useCallback((e) => {
59294
+ const patternEl = e.target.closest("[data-pattern]");
59295
+ const fromPath = patternEl?.getAttribute("data-pattern-path");
59296
+ if (!fromPath) return;
59297
+ reorderDataRef.current.fromPath = fromPath;
59298
+ reorderDataRef.current.loc = {
59299
+ orbitalName: data.orbitalName,
59300
+ traitName: data.traitName,
59301
+ transitionEvent: data.transitionEvent
59302
+ };
59303
+ reorderListeners?.onPointerDown?.(e);
59304
+ }, [reorderListeners, data.orbitalName, data.traitName, data.transitionEvent]);
58760
59305
  const setContentRef = useCallback((el) => {
58761
59306
  contentRef.current = el;
58762
59307
  l2SetNodeRef(el);
58763
- }, [l2SetNodeRef]);
59308
+ reorderSetNodeRef(el);
59309
+ }, [l2SetNodeRef, reorderSetNodeRef]);
58764
59310
  const statusBorder = isRunning ? "var(--color-primary)" : isError ? "var(--color-danger)" : isSuccess ? "var(--color-success)" : null;
58765
59311
  const borderWidth = isRunning || isError || isSuccess ? "2px" : "1.5px";
58766
59312
  const borderColor = statusBorder ?? (hovered ? "var(--color-primary)" : colors.border);
@@ -58920,10 +59466,11 @@ var OrbPreviewNodeInner = (props) => {
58920
59466
  Box,
58921
59467
  {
58922
59468
  ref: setContentRef,
58923
- className: `orb-preview-live nodrag relative${dragActive || l2IsOver ? " drag-active" : ""}`,
59469
+ className: `orb-preview-live nodrag relative${dragActive || reorderDragActive || l2IsOver ? " drag-active" : ""}`,
58924
59470
  onClick: handleContentClick,
58925
59471
  onMouseMove: handleContentMouseMove,
58926
59472
  onMouseLeave: handleContentMouseLeave,
59473
+ onPointerDown: handleContentPointerDown,
58927
59474
  children: [
58928
59475
  hoverRect && /* @__PURE__ */ jsx(
58929
59476
  "div",
@@ -58995,7 +59542,7 @@ var OrbPreviewNodeInner = (props) => {
58995
59542
  }
58996
59543
  );
58997
59544
  };
58998
- var OrbPreviewNode = React94__default.memo(OrbPreviewNodeInner);
59545
+ var OrbPreviewNode = React95__default.memo(OrbPreviewNodeInner);
58999
59546
  OrbPreviewNode.displayName = "OrbPreviewNode";
59000
59547
  orbPreviewLog.debug("export-resolved", () => ({
59001
59548
  type: typeof OrbPreviewNode,
@@ -59100,7 +59647,7 @@ var EventFlowEdgeInner = (props) => {
59100
59647
  ) })
59101
59648
  ] });
59102
59649
  };
59103
- var EventFlowEdge = React94__default.memo(EventFlowEdgeInner);
59650
+ var EventFlowEdge = React95__default.memo(EventFlowEdgeInner);
59104
59651
  EventFlowEdge.displayName = "EventFlowEdge";
59105
59652
 
59106
59653
  // components/avl/molecules/BehaviorComposeNode.tsx
@@ -59247,7 +59794,7 @@ var BehaviorComposeNodeInner = (props) => {
59247
59794
  }
59248
59795
  );
59249
59796
  };
59250
- var BehaviorComposeNode = React94__default.memo(BehaviorComposeNodeInner);
59797
+ var BehaviorComposeNode = React95__default.memo(BehaviorComposeNodeInner);
59251
59798
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
59252
59799
 
59253
59800
  // components/avl/lib/avl-behavior-compose-converter.ts
@@ -59443,9 +59990,14 @@ function findPatternInTree(root, path) {
59443
59990
  }
59444
59991
  var FIELD_TYPE_OPTIONS = FieldTypeSchema.options.map((v) => ({ value: v, label: v }));
59445
59992
  var EFFECT_TYPE_OPTIONS = Object.keys(EFFECT_TYPE_TO_CATEGORY).map((v) => ({ value: v, label: v }));
59446
- function OrbInspector({ node, schema, editable = false, userType = "builder", themeManifest, onSchemaChange, onClose }) {
59447
- const { selected: selectedPattern } = useContext(PatternSelectionContext);
59448
- const [activeTab, setActiveTab] = useState("inspector");
59993
+ function OrbInspector({ node, schema, editable = false, userType = "builder", themeManifest, defaultTab, onTabChange, onSchemaChange, onClose, selectedPattern: selectedPatternProp }) {
59994
+ const { selected: contextSelectedPattern } = useContext(PatternSelectionContext);
59995
+ const selectedPattern = selectedPatternProp !== void 0 ? selectedPatternProp : contextSelectedPattern;
59996
+ const [activeTab, setActiveTab] = useState(defaultTab ?? "inspector");
59997
+ const handleTabChange = useCallback((tab) => {
59998
+ setActiveTab(tab);
59999
+ onTabChange?.(tab);
60000
+ }, [onTabChange]);
59449
60001
  const eventBus = useEventBus();
59450
60002
  const { t } = useTranslate();
59451
60003
  const orbitalName = node.orbitalName ?? "";
@@ -59600,10 +60152,10 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59600
60152
  }
59601
60153
  )
59602
60154
  ] }),
59603
- /* @__PURE__ */ jsx(Box, { className: "flex px-4 gap-4", children: ["inspector", "styles", "code"].filter((tab) => tab !== "code" || userType === "architect").map((tab) => /* @__PURE__ */ jsx(
60155
+ /* @__PURE__ */ jsx(Box, { className: "flex px-4 gap-4", children: ["inspector", "design", "prototype", "code"].filter((tab) => tab !== "code" || userType === "architect").map((tab) => /* @__PURE__ */ jsx(
59604
60156
  "button",
59605
60157
  {
59606
- onClick: () => setActiveTab(tab),
60158
+ onClick: () => handleTabChange(tab),
59607
60159
  className: `pb-2 text-xs font-medium border-b-2 cursor-pointer bg-transparent border-x-0 border-t-0 px-0 capitalize ${activeTab === tab ? "border-[var(--color-primary)] text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"}`,
59608
60160
  children: t(`orbInspector.tab.${tab}`)
59609
60161
  },
@@ -59629,26 +60181,8 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59629
60181
  onChange: editable ? (code) => eventBus.emit("UI:CODE_CHANGE", { code }) : void 0
59630
60182
  }
59631
60183
  ) })
59632
- ) : activeTab === "styles" ? (
59633
- /* ── Styles Tab ──
59634
- Variant + size pills are clickable when `editable` and emit
59635
- `UI:PROP_CHANGE` with the selection context. The page-level
59636
- dispatcher routes those events to the project schemaEditor or
59637
- to the theme manifest based on `selection.sourceSchemaName`. */
59638
- /* @__PURE__ */ jsx(
59639
- StylesTab,
59640
- {
59641
- patternType,
59642
- patternDef,
59643
- patternConfig,
59644
- editable,
59645
- onPropChange: handlePropChange,
59646
- themeManifest,
59647
- isDesignSystem: selectedPattern?.nodeData.sourceSchemaName === "__design_system__"
59648
- }
59649
- )
59650
- ) : (
59651
- /* ── Inspector Tab ── */
60184
+ ) : activeTab === "design" ? (
60185
+ /* ── Design Tab ── Pattern Props + Styles + render-ui source. */
59652
60186
  /* @__PURE__ */ jsxs(Fragment, { children: [
59653
60187
  selectedPattern && patternDef?.propsSchema && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59654
60188
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("avl.props") }),
@@ -59684,6 +60218,97 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59684
60218
  ] }, propName);
59685
60219
  }) })
59686
60220
  ] }),
60221
+ /* @__PURE__ */ jsx(
60222
+ StylesTab,
60223
+ {
60224
+ patternType,
60225
+ patternDef,
60226
+ patternConfig,
60227
+ editable,
60228
+ onPropChange: handlePropChange,
60229
+ themeManifest,
60230
+ isDesignSystem: selectedPattern?.nodeData.sourceSchemaName === "__design_system__"
60231
+ }
60232
+ ),
60233
+ userType === "architect" && patterns.length > 0 && !selectedPattern && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3", children: [
60234
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: "render-ui" }),
60235
+ /* @__PURE__ */ jsx(Box, { className: "bg-muted/20 rounded-md p-3 font-mono text-xs leading-relaxed overflow-x-auto", children: patterns.map((entry, i) => /* @__PURE__ */ jsxs(Box, { children: [
60236
+ /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: [
60237
+ "slot: ",
60238
+ entry.slot
60239
+ ] }),
60240
+ /* @__PURE__ */ jsx(OrbPatternTree, { config: entry.pattern, depth: 0 })
60241
+ ] }, i)) })
60242
+ ] })
60243
+ ] })
60244
+ ) : activeTab === "prototype" ? (
60245
+ /* ── Prototype Tab ── State Transition + Trigger + Guard + Effects. */
60246
+ /* @__PURE__ */ jsxs(Fragment, { children: [
60247
+ isExpanded && fromState && toState && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
60248
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("avl.transition") }),
60249
+ /* @__PURE__ */ jsxs("svg", { width: "100%", height: 44, viewBox: "0 0 280 44", children: [
60250
+ /* @__PURE__ */ jsx(AvlState, { x: 8, y: 8, name: fromState, role: getStateRole(fromState), width: 90, height: 26 }),
60251
+ /* @__PURE__ */ jsx("line", { x1: 104, y1: 21, x2: 158, y2: 21, stroke: "var(--color-foreground)", strokeWidth: 2, markerEnd: "url(#orb-arrow)" }),
60252
+ /* @__PURE__ */ jsx(AvlState, { x: 164, y: 8, name: toState, role: getStateRole(toState), width: 90, height: 26 }),
60253
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("marker", { id: "orb-arrow", markerWidth: 8, markerHeight: 6, refX: 8, refY: 3, orient: "auto", children: /* @__PURE__ */ jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: "var(--color-foreground)" }) }) })
60254
+ ] }),
60255
+ traitName && /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: [
60256
+ traitName,
60257
+ entityName ? t("orbInspector.onEntity", { entity: entityName }) : ""
60258
+ ] })
60259
+ ] }),
60260
+ isExpanded && transitionEvent && /* @__PURE__ */ jsx(Box, { className: "px-4 py-2 border-b border-border/40", children: /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", children: [
60261
+ /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlEvent, { x: 8, y: 8, size: 12 }) }),
60262
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-semibold text-xs", children: transitionEvent })
60263
+ ] }) }),
60264
+ userType === "architect" && (transition?.guard ?? guard ?? editable) && isExpanded && /* @__PURE__ */ jsx(Box, { className: "px-4 py-2 border-b border-border/40", children: /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
60265
+ /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlGuard, { x: 8, y: 8, size: 12 }) }),
60266
+ editable ? /* @__PURE__ */ jsx(
60267
+ Input,
60268
+ {
60269
+ defaultValue: formatExpression(transition?.guard ?? guard),
60270
+ placeholder: t("orbInspector.guardExpression"),
60271
+ className: "flex-1 text-xs font-mono h-6",
60272
+ onBlur: (e) => handleGuardChange(e.target.value)
60273
+ }
60274
+ ) : /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-mono text-xs text-muted-foreground", children: formatExpression(transition?.guard ?? guard) })
60275
+ ] }) }),
60276
+ userType === "architect" && (effectTypes.length > 0 || editable) && isExpanded && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
60277
+ /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: [
60278
+ t("avl.effects"),
60279
+ " (",
60280
+ effectTypes.length,
60281
+ ")"
60282
+ ] }),
60283
+ /* @__PURE__ */ jsx(Box, { className: "flex flex-col gap-1.5", children: effectTypes.map((type, i) => {
60284
+ const isKnown = KNOWN_EFFECTS.has(type);
60285
+ const category = EFFECT_TYPE_TO_CATEGORY[type];
60286
+ const catColor = category ? EFFECT_CATEGORY_COLORS[category] : void 0;
60287
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
60288
+ /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs w-4 text-right shrink-0", children: [
60289
+ i + 1,
60290
+ "."
60291
+ ] }),
60292
+ isKnown && /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlEffect, { x: 8, y: 8, effectType: type, size: 6, showBackground: true }) }),
60293
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-xs flex-1", style: { color: catColor?.color }, children: effectSummary(type) }),
60294
+ editable && /* @__PURE__ */ jsx(
60295
+ Button,
60296
+ {
60297
+ variant: "ghost",
60298
+ size: "sm",
60299
+ onClick: () => handleRemoveEffect(i),
60300
+ className: "shrink-0 p-0.5 h-6 w-6",
60301
+ children: /* @__PURE__ */ jsx(Icon, { name: "x", size: "xs" })
60302
+ }
60303
+ )
60304
+ ] }, i);
60305
+ }) }),
60306
+ editable && /* @__PURE__ */ jsx(AddEffectButton, { onAdd: handleAddEffect })
60307
+ ] })
60308
+ ] })
60309
+ ) : (
60310
+ /* ── Inspector Tab (overview) ── orbital-scoped sections only. */
60311
+ /* @__PURE__ */ jsxs(Fragment, { children: [
59687
60312
  userType === "architect" && (selectedPattern && isEntityPattern || !selectedPattern && !isExpanded) && entity && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59688
60313
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("avl.entity") }),
59689
60314
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2 mb-2", children: [
@@ -59787,77 +60412,6 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59787
60412
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-xs font-semibold", children: tr.name }),
59788
60413
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: t("orbInspector.statesCount", { count: tr.stateCount }) })
59789
60414
  ] }, tr.name)) })
59790
- ] }),
59791
- isExpanded && fromState && toState && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59792
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("avl.transition") }),
59793
- /* @__PURE__ */ jsxs("svg", { width: "100%", height: 44, viewBox: "0 0 280 44", children: [
59794
- /* @__PURE__ */ jsx(AvlState, { x: 8, y: 8, name: fromState, role: getStateRole(fromState), width: 90, height: 26 }),
59795
- /* @__PURE__ */ jsx("line", { x1: 104, y1: 21, x2: 158, y2: 21, stroke: "var(--color-foreground)", strokeWidth: 2, markerEnd: "url(#orb-arrow)" }),
59796
- /* @__PURE__ */ jsx(AvlState, { x: 164, y: 8, name: toState, role: getStateRole(toState), width: 90, height: 26 }),
59797
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("marker", { id: "orb-arrow", markerWidth: 8, markerHeight: 6, refX: 8, refY: 3, orient: "auto", children: /* @__PURE__ */ jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: "var(--color-foreground)" }) }) })
59798
- ] }),
59799
- traitName && /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: [
59800
- traitName,
59801
- entityName ? t("orbInspector.onEntity", { entity: entityName }) : ""
59802
- ] })
59803
- ] }),
59804
- isExpanded && transitionEvent && /* @__PURE__ */ jsx(Box, { className: "px-4 py-2 border-b border-border/40", children: /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", children: [
59805
- /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlEvent, { x: 8, y: 8, size: 12 }) }),
59806
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-semibold text-xs", children: transitionEvent })
59807
- ] }) }),
59808
- userType === "architect" && (transition?.guard ?? guard ?? editable) && isExpanded && /* @__PURE__ */ jsx(Box, { className: "px-4 py-2 border-b border-border/40", children: /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
59809
- /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlGuard, { x: 8, y: 8, size: 12 }) }),
59810
- editable ? /* @__PURE__ */ jsx(
59811
- Input,
59812
- {
59813
- defaultValue: formatExpression(transition?.guard ?? guard),
59814
- placeholder: t("orbInspector.guardExpression"),
59815
- className: "flex-1 text-xs font-mono h-6",
59816
- onBlur: (e) => handleGuardChange(e.target.value)
59817
- }
59818
- ) : /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-mono text-xs text-muted-foreground", children: formatExpression(transition?.guard ?? guard) })
59819
- ] }) }),
59820
- userType === "architect" && (effectTypes.length > 0 || editable) && isExpanded && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59821
- /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: [
59822
- t("avl.effects"),
59823
- " (",
59824
- effectTypes.length,
59825
- ")"
59826
- ] }),
59827
- /* @__PURE__ */ jsx(Box, { className: "flex flex-col gap-1.5", children: effectTypes.map((type, i) => {
59828
- const isKnown = KNOWN_EFFECTS.has(type);
59829
- const category = EFFECT_TYPE_TO_CATEGORY[type];
59830
- const catColor = category ? EFFECT_CATEGORY_COLORS[category] : void 0;
59831
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
59832
- /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs w-4 text-right shrink-0", children: [
59833
- i + 1,
59834
- "."
59835
- ] }),
59836
- isKnown && /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlEffect, { x: 8, y: 8, effectType: type, size: 6, showBackground: true }) }),
59837
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-xs flex-1", style: { color: catColor?.color }, children: effectSummary(type) }),
59838
- editable && /* @__PURE__ */ jsx(
59839
- Button,
59840
- {
59841
- variant: "ghost",
59842
- size: "sm",
59843
- onClick: () => handleRemoveEffect(i),
59844
- className: "shrink-0 p-0.5 h-6 w-6",
59845
- children: /* @__PURE__ */ jsx(Icon, { name: "x", size: "xs" })
59846
- }
59847
- )
59848
- ] }, i);
59849
- }) }),
59850
- editable && /* @__PURE__ */ jsx(AddEffectButton, { onAdd: handleAddEffect })
59851
- ] }),
59852
- userType === "architect" && patterns.length > 0 && !selectedPattern && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3", children: [
59853
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: "render-ui" }),
59854
- /* @__PURE__ */ jsx(Box, { className: "bg-muted/20 rounded-md p-3 font-mono text-xs leading-relaxed overflow-x-auto", children: patterns.map((entry, i) => /* @__PURE__ */ jsxs(Box, { children: [
59855
- /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: [
59856
- "slot: ",
59857
- entry.slot
59858
- ] }),
59859
- /* @__PURE__ */ jsx(OrbPatternTree, { config: entry.pattern, depth: 0 })
59860
- ] }, i)) })
59861
60415
  ] })
59862
60416
  ] })
59863
60417
  ) })
@@ -60056,6 +60610,133 @@ function TokenRow({ group, tokenKey, value, isColor, onPropChange }) {
60056
60610
  ] });
60057
60611
  }
60058
60612
 
60613
+ // components/avl/organisms/LayersPanel.tsx
60614
+ init_FileTree();
60615
+ function isSExprObject(value) {
60616
+ return value !== null && value !== void 0 && typeof value === "object" && !Array.isArray(value);
60617
+ }
60618
+ function normalizeChildren(children) {
60619
+ if (children === void 0 || children === null) return [];
60620
+ return Array.isArray(children) ? children : [children];
60621
+ }
60622
+ function distinguishingSuffix(config) {
60623
+ if (typeof config.label === "string" && config.label.length > 0) return config.label;
60624
+ if (typeof config.text === "string" && config.text.length > 0) return config.text;
60625
+ if (typeof config.content === "string" && config.content.length > 0) return config.content;
60626
+ return void 0;
60627
+ }
60628
+ function patternRowLabel(value) {
60629
+ if (isSExprObject(value)) {
60630
+ const type = typeof value.type === "string" ? value.type : "unknown";
60631
+ const suffix = distinguishingSuffix(value);
60632
+ return suffix ? `${type} \u2014 ${suffix}` : type;
60633
+ }
60634
+ return value === void 0 || value === null ? "unknown" : String(value);
60635
+ }
60636
+ function pushPatternRows(items, slotId, slotIndex, parentRowId, patternPath, config) {
60637
+ const id = `${slotId}/pattern:${slotIndex}:${patternPath}`;
60638
+ items.push({ id, label: patternRowLabel(config), parentId: parentRowId, icon: "component" });
60639
+ if (!isSExprObject(config)) return;
60640
+ normalizeChildren(config.children).forEach((child, index) => {
60641
+ if (!isSExprObject(child)) return;
60642
+ pushPatternRows(items, slotId, slotIndex, id, `${patternPath}.children.${index}`, child);
60643
+ });
60644
+ }
60645
+ function schemaToLayerItems(schema) {
60646
+ const items = [];
60647
+ const seenSlotIds = /* @__PURE__ */ new Set();
60648
+ for (const appOrbital of parseApplicationLevel(schema).orbitals) {
60649
+ const orbitalId = `orbital:${appOrbital.name}`;
60650
+ items.push({ id: orbitalId, label: appOrbital.name, icon: "box" });
60651
+ const orbitalData = parseOrbitalLevel(schema, appOrbital.name);
60652
+ if (!orbitalData) continue;
60653
+ for (const page of orbitalData.pages) {
60654
+ items.push({
60655
+ id: `${orbitalId}/page:${page.name}`,
60656
+ label: page.name,
60657
+ parentId: orbitalId,
60658
+ icon: "file-text"
60659
+ });
60660
+ }
60661
+ for (const traitInfo of orbitalData.traits) {
60662
+ const traitId = `${orbitalId}/trait:${traitInfo.name}`;
60663
+ items.push({ id: traitId, label: traitInfo.name, parentId: orbitalId, icon: "git-branch" });
60664
+ const traitData = parseTraitLevel(schema, appOrbital.name, traitInfo.name);
60665
+ if (!traitData) continue;
60666
+ traitData.transitions.forEach((transition, transitionIndex) => {
60667
+ const transitionId = `${traitId}/transition:${transitionIndex}`;
60668
+ items.push({
60669
+ id: transitionId,
60670
+ label: transition.event || `${transition.from} \u2192 ${transition.to}`,
60671
+ parentId: traitId,
60672
+ icon: "zap"
60673
+ });
60674
+ const renderUiEffects = transition.effects.filter((effect) => effect.type === "render-ui");
60675
+ renderUiEffects.forEach((effect, slotIndex) => {
60676
+ const slotName = String(effect.args[0] ?? "main");
60677
+ const slotId = `${transitionId}/slot:${slotName}`;
60678
+ if (!seenSlotIds.has(slotId)) {
60679
+ seenSlotIds.add(slotId);
60680
+ items.push({ id: slotId, label: slotName, parentId: transitionId, icon: "layout-panel-top" });
60681
+ }
60682
+ pushPatternRows(items, slotId, slotIndex, slotId, "root", effect.args[1]);
60683
+ });
60684
+ });
60685
+ }
60686
+ }
60687
+ return items;
60688
+ }
60689
+ function parseLayerId(id) {
60690
+ const [head, ...rest] = id.split("/");
60691
+ const orbitalMatch = /^orbital:(.+)$/.exec(head ?? "");
60692
+ if (!orbitalMatch) return null;
60693
+ const parts = { orbitalName: orbitalMatch[1] };
60694
+ for (const segment of rest) {
60695
+ const pageMatch = /^page:(.+)$/.exec(segment);
60696
+ if (pageMatch) {
60697
+ parts.pageName = pageMatch[1];
60698
+ continue;
60699
+ }
60700
+ const traitMatch = /^trait:(.+)$/.exec(segment);
60701
+ if (traitMatch) {
60702
+ parts.traitName = traitMatch[1];
60703
+ continue;
60704
+ }
60705
+ const transitionMatch = /^transition:(\d+)$/.exec(segment);
60706
+ if (transitionMatch) {
60707
+ parts.transitionIndex = Number(transitionMatch[1]);
60708
+ continue;
60709
+ }
60710
+ const slotMatch = /^slot:(.+)$/.exec(segment);
60711
+ if (slotMatch) {
60712
+ parts.slotName = slotMatch[1];
60713
+ continue;
60714
+ }
60715
+ const patternMatch = /^pattern:(\d+):(.+)$/.exec(segment);
60716
+ if (patternMatch) {
60717
+ parts.patternSlotIndex = Number(patternMatch[1]);
60718
+ parts.patternPath = patternMatch[2];
60719
+ continue;
60720
+ }
60721
+ return null;
60722
+ }
60723
+ return parts;
60724
+ }
60725
+ var LayersPanel = ({ schema, selectedId, onSelect, onReorder }) => {
60726
+ const items = useMemo(() => schemaToLayerItems(schema), [schema]);
60727
+ return /* @__PURE__ */ jsx(
60728
+ FileTree,
60729
+ {
60730
+ items,
60731
+ look: "nav",
60732
+ selectedId,
60733
+ onNodeSelect: onSelect,
60734
+ onNodeReorder: onReorder
60735
+ }
60736
+ );
60737
+ };
60738
+ LayersPanel.displayName = "LayersPanel";
60739
+
60059
60740
  // components/avl/organisms/FlowCanvas.tsx
60060
60741
  init_Box();
60061
60742
  init_Typography();
@@ -60273,7 +60954,7 @@ var TraitCardNodeInner = (props) => {
60273
60954
  }
60274
60955
  );
60275
60956
  };
60276
- var TraitCardNode = React94__default.memo(TraitCardNodeInner);
60957
+ var TraitCardNode = React95__default.memo(TraitCardNodeInner);
60277
60958
  TraitCardNode.displayName = "TraitCardNode";
60278
60959
 
60279
60960
  // components/avl/organisms/FlowCanvas.tsx
@@ -60322,7 +61003,10 @@ function FlowCanvasInner({
60322
61003
  userType = "builder",
60323
61004
  themeManifest,
60324
61005
  nodePositions,
60325
- onPositionsChange
61006
+ onPositionsChange,
61007
+ onSelectedNodeChange,
61008
+ onSelectedPatternChange,
61009
+ externalInspector = false
60326
61010
  }) {
60327
61011
  const { t } = useTranslate();
60328
61012
  const NODE_TYPES2 = useMemo(() => ({
@@ -60349,7 +61033,7 @@ function FlowCanvasInner({
60349
61033
  initialOrbital
60350
61034
  );
60351
61035
  const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
60352
- const screenSizeUserOverrideRef = React94__default.useRef(false);
61036
+ const screenSizeUserOverrideRef = React95__default.useRef(false);
60353
61037
  const [screenSize, setScreenSize] = useState(
60354
61038
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
60355
61039
  );
@@ -60366,15 +61050,23 @@ function FlowCanvasInner({
60366
61050
  screenSizeUserOverrideRef.current = true;
60367
61051
  setScreenSize(size);
60368
61052
  }, []);
60369
- const [selectedNode, setSelectedNode] = useState(initialSelectedNode ?? null);
60370
- const [selectedPattern, setSelectedPattern] = useState(null);
61053
+ const [selectedNode, setSelectedNodeInternal] = useState(initialSelectedNode ?? null);
61054
+ const setSelectedNode = useCallback((node) => {
61055
+ setSelectedNodeInternal(node);
61056
+ onSelectedNodeChange?.(node);
61057
+ }, [onSelectedNodeChange]);
61058
+ const [selectedPattern, setSelectedPatternInternal] = useState(null);
61059
+ const setSelectedPattern = useCallback((p) => {
61060
+ setSelectedPatternInternal(p);
61061
+ onSelectedPatternChange?.(p);
61062
+ }, [onSelectedPatternChange]);
60371
61063
  const patternSelectionValue = useMemo(() => ({
60372
61064
  selected: selectedPattern,
60373
61065
  select: (p) => {
60374
61066
  setSelectedPattern(p);
60375
61067
  if (p) setSelectedNode(p.nodeData);
60376
61068
  }
60377
- }), [selectedPattern]);
61069
+ }), [selectedPattern, setSelectedNode, setSelectedPattern]);
60378
61070
  const [atBehaviorLevel, setAtBehaviorLevel] = useState(composeLevel === "behavior");
60379
61071
  const { composeNodes, composeEdges, overviewNodes, overviewEdges, expandedNodes, expandedEdges, behaviorExpandedNodes, behaviorExpandedEdges, traitExpandedNodes, traitExpandedEdges } = useMemo(() => {
60380
61072
  const t2 = perfStart("compose-graph");
@@ -60409,9 +61101,9 @@ function FlowCanvasInner({
60409
61101
  const [nodes, setNodes, onNodesChange] = useNodesState(activeNodes);
60410
61102
  const [edges, setEdges, onEdgesChange] = useEdgesState(activeEdges);
60411
61103
  const reactFlow = useReactFlow();
60412
- const savedPositionsRef = React94__default.useRef(nodePositions);
61104
+ const savedPositionsRef = React95__default.useRef(nodePositions);
60413
61105
  savedPositionsRef.current = nodePositions;
60414
- const nodesRef = React94__default.useRef(nodes);
61106
+ const nodesRef = React95__default.useRef(nodes);
60415
61107
  nodesRef.current = nodes;
60416
61108
  useEffect(() => {
60417
61109
  setEdges([]);
@@ -60485,10 +61177,10 @@ function FlowCanvasInner({
60485
61177
  const orbitalName = nodeData.orbitalName ?? node.id;
60486
61178
  onNodeClick?.({ level: "overview", orbital: orbitalName });
60487
61179
  onNodeSelect?.(orbitalName);
60488
- }, [level, expandedOrbital, onNodeClick, onNodeSelect]);
61180
+ }, [level, expandedOrbital, onNodeClick, onNodeSelect, setSelectedNode]);
60489
61181
  const handleClosePanel = useCallback(() => {
60490
61182
  setSelectedNode(null);
60491
- }, []);
61183
+ }, [setSelectedNode]);
60492
61184
  const handleKeyDown = useCallback((e) => {
60493
61185
  if (e.key === "Escape") {
60494
61186
  if (selectedNode) {
@@ -60513,7 +61205,7 @@ function FlowCanvasInner({
60513
61205
  setSelectedPattern(null);
60514
61206
  }
60515
61207
  }
60516
- }, [level, onLevelChange, selectedNode, selectedPattern, onPatternDelete, atBehaviorLevel, composeLevel, expandedOrbital]);
61208
+ }, [level, onLevelChange, selectedNode, selectedPattern, onPatternDelete, atBehaviorLevel, composeLevel, expandedOrbital, setSelectedNode]);
60517
61209
  useEffect(() => {
60518
61210
  document.addEventListener("keydown", handleKeyDown);
60519
61211
  return () => document.removeEventListener("keydown", handleKeyDown);
@@ -60536,7 +61228,7 @@ function FlowCanvasInner({
60536
61228
  setExpandedOrbital(void 0);
60537
61229
  setSelectedNode(null);
60538
61230
  }
60539
- }, [level, onLevelChange, selectedNode, composeLevel, atBehaviorLevel, expandedOrbital]);
61231
+ }, [level, onLevelChange, selectedNode, composeLevel, atBehaviorLevel, expandedOrbital, setSelectedNode]);
60540
61232
  const eventBus = useEventBus();
60541
61233
  const handleConnect = useCallback((connection) => {
60542
61234
  if (!connection.sourceHandle?.startsWith("event-") || !onEventWire) return;
@@ -60682,7 +61374,7 @@ function FlowCanvasInner({
60682
61374
  }
60683
61375
  )
60684
61376
  ] }),
60685
- selectedNode && /* @__PURE__ */ jsxs(Fragment, { children: [
61377
+ !externalInspector && selectedNode && /* @__PURE__ */ jsxs(Fragment, { children: [
60686
61378
  /* @__PURE__ */ jsx(
60687
61379
  Box,
60688
61380
  {
@@ -60748,7 +61440,7 @@ var ZoomBreadcrumb = ({
60748
61440
  if (eventName && band === "detail") {
60749
61441
  segments.push({ icon: "\u26A1", label: eventName });
60750
61442
  }
60751
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
61443
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
60752
61444
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
60753
61445
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
60754
61446
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -61089,7 +61781,7 @@ var EventWireOverlay = ({
61089
61781
  containerW,
61090
61782
  containerH
61091
61783
  }) => {
61092
- const ids = React94__default.useMemo(() => {
61784
+ const ids = React95__default.useMemo(() => {
61093
61785
  avlOczWireId += 1;
61094
61786
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
61095
61787
  }, []);
@@ -61456,7 +62148,7 @@ var AvlOrbitalsCosmicZoom = ({
61456
62148
  borderRadius: 6,
61457
62149
  border: `1px solid ${color}`
61458
62150
  },
61459
- children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
62151
+ children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
61460
62152
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
61461
62153
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
61462
62154
  Box,
@@ -61946,4 +62638,4 @@ var AvlClickTarget = ({
61946
62638
  };
61947
62639
  AvlClickTarget.displayName = "AvlClickTarget";
61948
62640
 
61949
- export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, AvlApplication, AvlBackwardEdge, AvlBehaviorGlyph, AvlBinding, AvlBindingEdge, AvlBindingRef, AvlClickTarget, AvlClosedCircuit, AvlCosmicZoom, AvlEffect, AvlEmitListen, AvlEntity, AvlEvent, AvlEventWireEdge, AvlExprTree, AvlField, AvlFieldType, AvlGuard, AvlLiteral, AvlOperator, AvlOrbital, AvlOrbitalNode, AvlOrbitalUnit, AvlOrbitalsCosmicZoom, AvlPage, AvlPageEdge, AvlPersistence, AvlSExpr, AvlSlotMap, AvlState, AvlStateMachine, AvlSwimLane, AvlTrait, AvlTraitScene, AvlTransition, AvlTransitionEdge, AvlTransitionLane, AvlTransitionScene, BehaviorComposeNode, BehaviorView, CONNECTION_COLORS, CanvasDndProvider, DOMAIN_COLORS, DetailView, EFFECT_CATEGORY_COLORS, EFFECT_TYPE_TO_CATEGORY, EventFlowEdge, FlowCanvas, MiniStateMachine, ModuleCard, OrbInspector, OrbPreviewNode, STATE_COLORS, SystemNode, ZOOM_BAND_THRESHOLDS, ZoomBandContext, ZoomBreadcrumb, ZoomLegend, arcPath, behaviorsToComposeGraph, computeTraitLayout, computeZoomBand, curveControlPoint, deriveEditFocusFromElement, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, registryEntryToCanvasEntry, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useCanvasDraggable, useCanvasDroppable, useZoomBand, zoomProgress };
62641
+ export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, AvlApplication, AvlBackwardEdge, AvlBehaviorGlyph, AvlBinding, AvlBindingEdge, AvlBindingRef, AvlClickTarget, AvlClosedCircuit, AvlCosmicZoom, AvlEffect, AvlEmitListen, AvlEntity, AvlEvent, AvlEventWireEdge, AvlExprTree, AvlField, AvlFieldType, AvlGuard, AvlLiteral, AvlOperator, AvlOrbital, AvlOrbitalNode, AvlOrbitalUnit, AvlOrbitalsCosmicZoom, AvlPage, AvlPageEdge, AvlPersistence, AvlSExpr, AvlSlotMap, AvlState, AvlStateMachine, AvlSwimLane, AvlTrait, AvlTraitScene, AvlTransition, AvlTransitionEdge, AvlTransitionLane, AvlTransitionScene, BehaviorComposeNode, BehaviorView, CONNECTION_COLORS, CanvasDndProvider, DOMAIN_COLORS, DetailView, EFFECT_CATEGORY_COLORS, EFFECT_TYPE_TO_CATEGORY, EventFlowEdge, FlowCanvas, LayersPanel, MiniStateMachine, ModuleCard, OrbInspector, OrbPreviewNode, STATE_COLORS, SystemNode, ZOOM_BAND_THRESHOLDS, ZoomBandContext, ZoomBreadcrumb, ZoomLegend, arcPath, behaviorsToComposeGraph, computeTraitLayout, computeZoomBand, curveControlPoint, deriveEditFocusFromElement, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseLayerId, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, registryEntryToCanvasEntry, ringPositions, schemaToFlowGraph, schemaToLayerItems, schemaToOverviewGraph, useCanvasDraggable, useCanvasDroppable, useZoomBand, zoomProgress };