@almadar/ui 6.2.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) => {
@@ -7258,6 +7257,7 @@ function NativeSelect({
7258
7257
  error,
7259
7258
  onChange,
7260
7259
  onValueChange,
7260
+ action,
7261
7261
  value,
7262
7262
  ...props
7263
7263
  }) {
@@ -7269,6 +7269,9 @@ function NativeSelect({
7269
7269
  onChange?.(e);
7270
7270
  }
7271
7271
  dispatchValueChange(onValueChange, eventBus, e.target.value);
7272
+ if (action) {
7273
+ eventBus.emit(`UI:${action}`, { value: e.target.value });
7274
+ }
7272
7275
  };
7273
7276
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
7274
7277
  /* @__PURE__ */ jsxs(
@@ -7304,6 +7307,7 @@ function RichSelect({
7304
7307
  error,
7305
7308
  onChange,
7306
7309
  onValueChange,
7310
+ action,
7307
7311
  value,
7308
7312
  multiple,
7309
7313
  searchable,
@@ -7329,6 +7333,9 @@ function RichSelect({
7329
7333
  eventBus.emit(`UI:${onChange}`, { value: next });
7330
7334
  }
7331
7335
  dispatchValueChange(onValueChange, eventBus, next);
7336
+ if (action) {
7337
+ eventBus.emit(`UI:${action}`, { value: next });
7338
+ }
7332
7339
  };
7333
7340
  const clear = (e) => {
7334
7341
  e.stopPropagation();
@@ -7337,6 +7344,9 @@ function RichSelect({
7337
7344
  eventBus.emit(`UI:${onChange}`, { value: next });
7338
7345
  }
7339
7346
  dispatchValueChange(onValueChange, eventBus, next);
7347
+ if (action) {
7348
+ eventBus.emit(`UI:${action}`, { value: next });
7349
+ }
7340
7350
  };
7341
7351
  useEffect(() => {
7342
7352
  const handler = (e) => {
@@ -7443,7 +7453,7 @@ var init_Select = __esm({
7443
7453
  init_cn();
7444
7454
  init_Icon();
7445
7455
  init_useEventBus();
7446
- Select = React94__default.forwardRef(
7456
+ Select = React95__default.forwardRef(
7447
7457
  (props, _ref) => {
7448
7458
  const { multiple, searchable, clearable } = props;
7449
7459
  if (multiple || searchable || clearable) {
@@ -7460,7 +7470,7 @@ var init_Checkbox = __esm({
7460
7470
  "components/core/atoms/Checkbox.tsx"() {
7461
7471
  init_cn();
7462
7472
  init_useEventBus();
7463
- Checkbox = React94__default.forwardRef(
7473
+ Checkbox = React95__default.forwardRef(
7464
7474
  ({ className, label, id, onChange, ...props }, ref) => {
7465
7475
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
7466
7476
  const eventBus = useEventBus();
@@ -7514,7 +7524,7 @@ var init_Spinner = __esm({
7514
7524
  md: "h-6 w-6",
7515
7525
  lg: "h-8 w-8"
7516
7526
  };
7517
- Spinner = React94__default.forwardRef(
7527
+ Spinner = React95__default.forwardRef(
7518
7528
  ({ className, size = "md", overlay, ...props }, ref) => {
7519
7529
  if (overlay) {
7520
7530
  return /* @__PURE__ */ jsx(
@@ -7604,7 +7614,7 @@ var init_Card = __esm({
7604
7614
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
7605
7615
  "tile-image-first": "p-0 overflow-hidden"
7606
7616
  };
7607
- Card = React94__default.forwardRef(
7617
+ Card = React95__default.forwardRef(
7608
7618
  ({
7609
7619
  className,
7610
7620
  variant = "bordered",
@@ -7653,9 +7663,9 @@ var init_Card = __esm({
7653
7663
  }
7654
7664
  );
7655
7665
  Card.displayName = "Card";
7656
- 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 }));
7657
7667
  CardHeader.displayName = "CardHeader";
7658
- CardTitle = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7668
+ CardTitle = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7659
7669
  "h3",
7660
7670
  {
7661
7671
  ref,
@@ -7668,11 +7678,11 @@ var init_Card = __esm({
7668
7678
  }
7669
7679
  ));
7670
7680
  CardTitle.displayName = "CardTitle";
7671
- 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 }));
7672
7682
  CardContent.displayName = "CardContent";
7673
7683
  CardBody = CardContent;
7674
7684
  CardBody.displayName = "CardBody";
7675
- CardFooter = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7685
+ CardFooter = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7676
7686
  "div",
7677
7687
  {
7678
7688
  ref,
@@ -7759,7 +7769,7 @@ var init_FilterPill = __esm({
7759
7769
  md: "w-3.5 h-3.5",
7760
7770
  lg: "w-4 h-4"
7761
7771
  };
7762
- FilterPill = React94__default.forwardRef(
7772
+ FilterPill = React95__default.forwardRef(
7763
7773
  ({
7764
7774
  className,
7765
7775
  variant = "default",
@@ -7888,8 +7898,8 @@ var init_Avatar = __esm({
7888
7898
  actionPayload
7889
7899
  }) => {
7890
7900
  const eventBus = useEventBus();
7891
- const [imgFailed, setImgFailed] = React94__default.useState(false);
7892
- React94__default.useEffect(() => {
7901
+ const [imgFailed, setImgFailed] = React95__default.useState(false);
7902
+ React95__default.useEffect(() => {
7893
7903
  setImgFailed(false);
7894
7904
  }, [src]);
7895
7905
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -8002,7 +8012,7 @@ var init_Center = __esm({
8002
8012
  as: Component = "div"
8003
8013
  }) => {
8004
8014
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
8005
- return React94__default.createElement(Component, {
8015
+ return React95__default.createElement(Component, {
8006
8016
  className: cn(
8007
8017
  inline ? "inline-flex" : "flex",
8008
8018
  horizontal && "justify-center",
@@ -8270,7 +8280,7 @@ var init_Radio = __esm({
8270
8280
  md: "w-2.5 h-2.5",
8271
8281
  lg: "w-3 h-3"
8272
8282
  };
8273
- Radio = React94__default.forwardRef(
8283
+ Radio = React95__default.forwardRef(
8274
8284
  ({
8275
8285
  label,
8276
8286
  helperText,
@@ -8287,12 +8297,12 @@ var init_Radio = __esm({
8287
8297
  onChange,
8288
8298
  ...props
8289
8299
  }, ref) => {
8290
- const reactId = React94__default.useId();
8300
+ const reactId = React95__default.useId();
8291
8301
  const baseId = id || `radio-${reactId}`;
8292
8302
  const hasError = !!error;
8293
8303
  const eventBus = useEventBus();
8294
- const [selected, setSelected] = React94__default.useState(value);
8295
- React94__default.useEffect(() => {
8304
+ const [selected, setSelected] = React95__default.useState(value);
8305
+ React95__default.useEffect(() => {
8296
8306
  if (value !== void 0) setSelected(value);
8297
8307
  }, [value]);
8298
8308
  const pick = (next, e) => {
@@ -8474,7 +8484,7 @@ var init_Switch = __esm({
8474
8484
  "components/core/atoms/Switch.tsx"() {
8475
8485
  "use client";
8476
8486
  init_cn();
8477
- Switch = React94.forwardRef(
8487
+ Switch = React95.forwardRef(
8478
8488
  ({
8479
8489
  checked,
8480
8490
  defaultChecked = false,
@@ -8485,10 +8495,10 @@ var init_Switch = __esm({
8485
8495
  name,
8486
8496
  className
8487
8497
  }, ref) => {
8488
- const [isChecked, setIsChecked] = React94.useState(
8498
+ const [isChecked, setIsChecked] = React95.useState(
8489
8499
  checked !== void 0 ? checked : defaultChecked
8490
8500
  );
8491
- React94.useEffect(() => {
8501
+ React95.useEffect(() => {
8492
8502
  if (checked !== void 0) {
8493
8503
  setIsChecked(checked);
8494
8504
  }
@@ -8766,7 +8776,7 @@ var Aside;
8766
8776
  var init_Aside = __esm({
8767
8777
  "components/core/atoms/Aside.tsx"() {
8768
8778
  init_cn();
8769
- Aside = React94__default.forwardRef(
8779
+ Aside = React95__default.forwardRef(
8770
8780
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
8771
8781
  );
8772
8782
  Aside.displayName = "Aside";
@@ -8845,9 +8855,9 @@ var init_LawReferenceTooltip = __esm({
8845
8855
  className
8846
8856
  }) => {
8847
8857
  const { t } = useTranslate();
8848
- const [isVisible, setIsVisible] = React94__default.useState(false);
8849
- const timeoutRef = React94__default.useRef(null);
8850
- 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);
8851
8861
  const handleMouseEnter = () => {
8852
8862
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8853
8863
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -8858,7 +8868,7 @@ var init_LawReferenceTooltip = __esm({
8858
8868
  };
8859
8869
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
8860
8870
  const open = isVisible || revealed;
8861
- React94__default.useEffect(() => {
8871
+ React95__default.useEffect(() => {
8862
8872
  return () => {
8863
8873
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8864
8874
  };
@@ -9068,7 +9078,7 @@ var init_StatusDot = __esm({
9068
9078
  md: "w-2.5 h-2.5",
9069
9079
  lg: "w-3 h-3"
9070
9080
  };
9071
- StatusDot = React94__default.forwardRef(
9081
+ StatusDot = React95__default.forwardRef(
9072
9082
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
9073
9083
  return /* @__PURE__ */ jsx(
9074
9084
  "span",
@@ -9122,7 +9132,7 @@ var init_TrendIndicator = __esm({
9122
9132
  down: "trending-down",
9123
9133
  flat: "arrow-right"
9124
9134
  };
9125
- TrendIndicator = React94__default.forwardRef(
9135
+ TrendIndicator = React95__default.forwardRef(
9126
9136
  ({
9127
9137
  className,
9128
9138
  value,
@@ -9191,7 +9201,7 @@ var init_RangeSlider = __esm({
9191
9201
  md: "w-4 h-4",
9192
9202
  lg: "w-5 h-5"
9193
9203
  };
9194
- RangeSlider = React94__default.forwardRef(
9204
+ RangeSlider = React95__default.forwardRef(
9195
9205
  ({
9196
9206
  className,
9197
9207
  min = 0,
@@ -9848,7 +9858,7 @@ var init_ContentSection = __esm({
9848
9858
  md: "py-16",
9849
9859
  lg: "py-24"
9850
9860
  };
9851
- ContentSection = React94__default.forwardRef(
9861
+ ContentSection = React95__default.forwardRef(
9852
9862
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
9853
9863
  return /* @__PURE__ */ jsx(
9854
9864
  Box,
@@ -10382,7 +10392,7 @@ var init_AnimatedReveal = __esm({
10382
10392
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
10383
10393
  "none": {}
10384
10394
  };
10385
- AnimatedReveal = React94__default.forwardRef(
10395
+ AnimatedReveal = React95__default.forwardRef(
10386
10396
  ({
10387
10397
  trigger = "scroll",
10388
10398
  animation = "fade-up",
@@ -10542,7 +10552,7 @@ var init_AnimatedGraphic = __esm({
10542
10552
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
10543
10553
  "use client";
10544
10554
  init_cn();
10545
- AnimatedGraphic = React94__default.forwardRef(
10555
+ AnimatedGraphic = React95__default.forwardRef(
10546
10556
  ({
10547
10557
  src,
10548
10558
  svgContent,
@@ -10565,7 +10575,7 @@ var init_AnimatedGraphic = __esm({
10565
10575
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
10566
10576
  const resolvedSvg = svgContent ?? fetchedSvg;
10567
10577
  const prevAnimateRef = useRef(animate);
10568
- const setRef = React94__default.useCallback(
10578
+ const setRef = React95__default.useCallback(
10569
10579
  (node) => {
10570
10580
  containerRef.current = node;
10571
10581
  if (typeof ref === "function") ref(node);
@@ -11317,9 +11327,9 @@ function ControlButton({
11317
11327
  className
11318
11328
  }) {
11319
11329
  const eventBus = useEventBus();
11320
- const [isPressed, setIsPressed] = React94.useState(false);
11330
+ const [isPressed, setIsPressed] = React95.useState(false);
11321
11331
  const actualPressed = pressed ?? isPressed;
11322
- const handlePointerDown = React94.useCallback(
11332
+ const handlePointerDown = React95.useCallback(
11323
11333
  (e) => {
11324
11334
  e.preventDefault();
11325
11335
  if (disabled) return;
@@ -11329,7 +11339,7 @@ function ControlButton({
11329
11339
  },
11330
11340
  [disabled, pressEvent, eventBus, onPress]
11331
11341
  );
11332
- const handlePointerUp = React94.useCallback(
11342
+ const handlePointerUp = React95.useCallback(
11333
11343
  (e) => {
11334
11344
  e.preventDefault();
11335
11345
  if (disabled) return;
@@ -11339,7 +11349,7 @@ function ControlButton({
11339
11349
  },
11340
11350
  [disabled, releaseEvent, eventBus, onRelease]
11341
11351
  );
11342
- const handlePointerLeave = React94.useCallback(
11352
+ const handlePointerLeave = React95.useCallback(
11343
11353
  (e) => {
11344
11354
  if (isPressed) {
11345
11355
  setIsPressed(false);
@@ -11598,18 +11608,18 @@ function ControlGrid({
11598
11608
  className
11599
11609
  }) {
11600
11610
  const eventBus = useEventBus();
11601
- const [active, setActive] = React94.useState(/* @__PURE__ */ new Set());
11602
- const [coarse, setCoarse] = React94.useState(
11611
+ const [active, setActive] = React95.useState(/* @__PURE__ */ new Set());
11612
+ const [coarse, setCoarse] = React95.useState(
11603
11613
  () => typeof window !== "undefined" && window.matchMedia("(pointer: coarse)").matches
11604
11614
  );
11605
- React94.useEffect(() => {
11615
+ React95.useEffect(() => {
11606
11616
  if (visibility !== "auto" || typeof window === "undefined") return;
11607
11617
  const mq = window.matchMedia("(pointer: coarse)");
11608
11618
  const onChange = (e) => setCoarse(e.matches);
11609
11619
  mq.addEventListener("change", onChange);
11610
11620
  return () => mq.removeEventListener("change", onChange);
11611
11621
  }, [visibility]);
11612
- const handlePress = React94.useCallback(
11622
+ const handlePress = React95.useCallback(
11613
11623
  (id) => {
11614
11624
  setActive((prev) => new Set(prev).add(id));
11615
11625
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -11623,7 +11633,7 @@ function ControlGrid({
11623
11633
  },
11624
11634
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
11625
11635
  );
11626
- const handleRelease = React94.useCallback(
11636
+ const handleRelease = React95.useCallback(
11627
11637
  (id) => {
11628
11638
  setActive((prev) => {
11629
11639
  const next = new Set(prev);
@@ -11986,7 +11996,7 @@ function GameMenu({
11986
11996
  }) {
11987
11997
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
11988
11998
  const eventBus = useEventBus();
11989
- const handleOptionClick = React94.useCallback(
11999
+ const handleOptionClick = React95.useCallback(
11990
12000
  (option) => {
11991
12001
  if (option.event) {
11992
12002
  eventBus.emit(`UI:${option.event}`, { option });
@@ -12222,7 +12232,7 @@ function StateGraph({
12222
12232
  }) {
12223
12233
  const eventBus = useEventBus();
12224
12234
  const nodes = states ?? [];
12225
- const positions = React94.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
12235
+ const positions = React95.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
12226
12236
  return /* @__PURE__ */ jsxs(
12227
12237
  Box,
12228
12238
  {
@@ -12293,8 +12303,8 @@ function MiniMap({
12293
12303
  tileAssets,
12294
12304
  unitAssets
12295
12305
  }) {
12296
- const canvasRef = React94.useRef(null);
12297
- const imgCacheRef = React94.useRef(/* @__PURE__ */ new Map());
12306
+ const canvasRef = React95.useRef(null);
12307
+ const imgCacheRef = React95.useRef(/* @__PURE__ */ new Map());
12298
12308
  function loadImg(url) {
12299
12309
  const cached = imgCacheRef.current.get(url);
12300
12310
  if (cached) return cached.complete ? cached : null;
@@ -12310,7 +12320,7 @@ function MiniMap({
12310
12320
  imgCacheRef.current.set(url, img);
12311
12321
  return null;
12312
12322
  }
12313
- React94.useEffect(() => {
12323
+ React95.useEffect(() => {
12314
12324
  const canvas = canvasRef.current;
12315
12325
  if (!canvas) return;
12316
12326
  const ctx = canvas.getContext("2d");
@@ -13544,7 +13554,7 @@ function proceduralShapes(view, pos, fade, progress) {
13544
13554
  }
13545
13555
  }
13546
13556
  }
13547
- function expandFxItem(view, node, epochNowMs, dim) {
13557
+ function expandFxItem(view, node, epochNowMs, dim, projector, fontFamily) {
13548
13558
  if (view.space === "screen") return [];
13549
13559
  const tickMs = node.tickMs ?? DEFAULT_TICK_MS;
13550
13560
  const { ageMs, progress, fade } = fxLifecycle(view, epochNowMs, tickMs);
@@ -13580,24 +13590,27 @@ function expandFxItem(view, node, epochNowMs, dim) {
13580
13590
  out.push(...proceduralShapes(view, pos, fade, progress));
13581
13591
  }
13582
13592
  if (view.message) {
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";
13583
13595
  const text = {
13584
13596
  type: "draw-text",
13585
13597
  text: view.message,
13586
13598
  position: pos,
13587
13599
  offsetY: -(0.15 + 0.55 * progress),
13588
13600
  color: view.color ?? node.textColor ?? DEFAULT_TEXT_COLOR,
13589
- opacity: fade
13601
+ opacity: fade,
13602
+ font: `bold ${pxSize ?? 14}px ${family}`
13590
13603
  };
13591
13604
  out.push(text);
13592
13605
  }
13593
13606
  return out;
13594
13607
  }
13595
- function expandFxLayer(node, epochNowMs, dim) {
13608
+ function expandFxLayer(node, epochNowMs, dim, projector, fontFamily) {
13596
13609
  if (!Array.isArray(node.items)) return [];
13597
13610
  const out = [];
13598
13611
  for (const item of node.items) {
13599
13612
  if (!item || typeof item.id !== "string") continue;
13600
- out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim));
13613
+ out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim, projector, fontFamily));
13601
13614
  }
13602
13615
  return out;
13603
13616
  }
@@ -13664,7 +13677,7 @@ function paintDrawable(painter, node, dctx) {
13664
13677
  break;
13665
13678
  case "draw-fx-layer": {
13666
13679
  const epochNow = dctx.time > 0 && typeof performance !== "undefined" ? performance.timeOrigin + dctx.time : 0;
13667
- for (const child of expandFxLayer(node, epochNow, "2d")) paintDrawable(painter, child, dctx);
13680
+ for (const child of expandFxLayer(node, epochNow, "2d", dctx.projector, dctx.fontFamily)) paintDrawable(painter, child, dctx);
13668
13681
  break;
13669
13682
  }
13670
13683
  }
@@ -13774,7 +13787,7 @@ function Canvas2D({
13774
13787
  const registerChildDrawable = useCallback((node) => {
13775
13788
  childDrawablesRef.current.push(node);
13776
13789
  }, []);
13777
- const hasJsxChildren = React94.Children.count(children) > 0;
13790
+ const hasJsxChildren = React95.Children.count(children) > 0;
13778
13791
  function isDrawableLayer(node) {
13779
13792
  return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
13780
13793
  }
@@ -14332,7 +14345,7 @@ function Canvas({
14332
14345
  if (mode !== "3d") return;
14333
14346
  const next = childDrawablesRef.current;
14334
14347
  canvasLog.debug("children:adopt", { registered: next.length, adopted: childDrawables.length });
14335
- if (next.length === 0 && React94.Children.count(children) > 0) return;
14348
+ if (next.length === 0 && React95.Children.count(children) > 0) return;
14336
14349
  setChildDrawables(
14337
14350
  (prev) => prev.length === next.length && JSON.stringify(prev) === JSON.stringify(next) ? prev : [...next]
14338
14351
  );
@@ -14370,7 +14383,7 @@ function Canvas({
14370
14383
  };
14371
14384
  return /* @__PURE__ */ jsxs(Fragment, { children: [
14372
14385
  /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Canvas3DHost, { ...props3d }) }),
14373
- 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 }) })
14374
14387
  ] });
14375
14388
  }
14376
14389
  return /* @__PURE__ */ jsx(
@@ -14528,7 +14541,7 @@ function LinearView({
14528
14541
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
14529
14542
  const isDone = i < currentIdx;
14530
14543
  const isCurrent = i === currentIdx;
14531
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
14544
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
14532
14545
  i > 0 && /* @__PURE__ */ jsx(
14533
14546
  Typography,
14534
14547
  {
@@ -15063,7 +15076,7 @@ function SequenceBar({
15063
15076
  else onSlotRemove?.(index);
15064
15077
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
15065
15078
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
15066
- 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: [
15067
15080
  i > 0 && /* @__PURE__ */ jsx(
15068
15081
  Typography,
15069
15082
  {
@@ -15761,7 +15774,7 @@ var init_LearningCanvas = __esm({
15761
15774
  if (drawables?.length && projector) {
15762
15775
  const painter = createWebPainter(ctx, invalidateRef.current);
15763
15776
  const timeMs = needsAnim && typeof performance !== "undefined" ? performance.now() : 0;
15764
- const dctx = { projector, time: timeMs, invalidate: invalidateRef.current };
15777
+ const dctx = { projector, time: timeMs, invalidate: invalidateRef.current, fontFamily: themeBodyFont(canvas) };
15765
15778
  for (const node of drawables) {
15766
15779
  paintDrawable(painter, node, dctx);
15767
15780
  }
@@ -15923,7 +15936,7 @@ var init_ErrorBoundary = __esm({
15923
15936
  }
15924
15937
  );
15925
15938
  };
15926
- ErrorBoundary = class extends React94__default.Component {
15939
+ ErrorBoundary = class extends React95__default.Component {
15927
15940
  constructor(props) {
15928
15941
  super(props);
15929
15942
  __publicField(this, "reset", () => {
@@ -16192,7 +16205,7 @@ var init_Container = __esm({
16192
16205
  as: Component = "div"
16193
16206
  }) => {
16194
16207
  const resolvedSize = maxWidth ?? size ?? "lg";
16195
- return React94__default.createElement(
16208
+ return React95__default.createElement(
16196
16209
  Component,
16197
16210
  {
16198
16211
  className: cn(
@@ -17129,7 +17142,7 @@ var init_FloatingActionButton = __esm({
17129
17142
  document.addEventListener("mousedown", handleClickOutside);
17130
17143
  return () => document.removeEventListener("mousedown", handleClickOutside);
17131
17144
  }, [isExpanded, actions]);
17132
- const positionClasses = {
17145
+ const positionClasses2 = {
17133
17146
  "bottom-right": "bottom-6 right-6",
17134
17147
  "bottom-left": "bottom-6 left-6",
17135
17148
  "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
@@ -17138,7 +17151,7 @@ var init_FloatingActionButton = __esm({
17138
17151
  "top-center": "top-6 left-1/2 -translate-x-1/2"
17139
17152
  };
17140
17153
  if (resolvedAction && (!actions || actions.length === 0)) {
17141
- 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(
17142
17155
  Button,
17143
17156
  {
17144
17157
  variant: resolvedAction.variant || "primary",
@@ -17166,7 +17179,7 @@ var init_FloatingActionButton = __esm({
17166
17179
  ref: fabRef,
17167
17180
  className: cn(
17168
17181
  "fixed z-50 flex flex-col items-end gap-3",
17169
- positionClasses[position],
17182
+ positionClasses2[position],
17170
17183
  position.includes("left") && "items-start",
17171
17184
  className
17172
17185
  ),
@@ -19275,9 +19288,11 @@ var init_Tabs = __esm({
19275
19288
  }
19276
19289
  };
19277
19290
  const handleKeyDown = (e, index) => {
19278
- 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) {
19279
19294
  e.preventDefault();
19280
- const direction = e.key === "ArrowLeft" ? -1 : 1;
19295
+ const direction = e.key === prevKey ? -1 : 1;
19281
19296
  const nextIndex = (index + direction + safeItems.length) % safeItems.length;
19282
19297
  const nextTab = safeItems[nextIndex];
19283
19298
  if (nextTab && !nextTab.disabled) {
@@ -19849,7 +19864,7 @@ var init_CodeBlock = __esm({
19849
19864
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
19850
19865
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
19851
19866
  HIDDEN_LINE_NUMBERS = { display: "none" };
19852
- CodeBlock = React94__default.memo(
19867
+ CodeBlock = React95__default.memo(
19853
19868
  ({
19854
19869
  code: rawCode,
19855
19870
  language = "text",
@@ -20432,14 +20447,77 @@ var init_CodeBlock = __esm({
20432
20447
  CodeBlock.displayName = "CodeBlock";
20433
20448
  }
20434
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
+ });
20435
20512
  var MarkdownContent;
20436
20513
  var init_MarkdownContent = __esm({
20437
20514
  "components/core/molecules/markdown/MarkdownContent.tsx"() {
20438
20515
  init_katex_min();
20439
20516
  init_Box();
20440
20517
  init_CodeBlock();
20518
+ init_MermaidDiagram();
20441
20519
  init_cn();
20442
- MarkdownContent = React94__default.memo(
20520
+ MarkdownContent = React95__default.memo(
20443
20521
  ({ content, direction = "ltr", className }) => {
20444
20522
  const { t: _t } = useTranslate();
20445
20523
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -20484,6 +20562,9 @@ var init_MarkdownContent = __esm({
20484
20562
  if (!inline) {
20485
20563
  const match = /language-(\w+)/.exec(codeClassName ?? "");
20486
20564
  const code = String(children).replace(/\n$/, "");
20565
+ if (match?.[1] === "mermaid") {
20566
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code });
20567
+ }
20487
20568
  if (match) {
20488
20569
  return /* @__PURE__ */ jsx(
20489
20570
  CodeBlock,
@@ -21766,7 +21847,7 @@ var init_StateMachineView = __esm({
21766
21847
  style: { top: title ? 30 : 0 },
21767
21848
  children: [
21768
21849
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
21769
- 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(
21770
21851
  StateNode2,
21771
21852
  {
21772
21853
  state,
@@ -27955,7 +28036,7 @@ var init_Menu = __esm({
27955
28036
  "bottom-end": "bottom-start"
27956
28037
  };
27957
28038
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
27958
- const triggerElement = React94__default.isValidElement(trigger) ? React94__default.cloneElement(trigger, {
28039
+ const triggerElement = React95__default.isValidElement(trigger) ? React95__default.cloneElement(trigger, {
27959
28040
  ref: triggerRef,
27960
28041
  onClick: handleToggle
27961
28042
  }) : /* @__PURE__ */ jsx(
@@ -28058,14 +28139,14 @@ function useDataDnd(args) {
28058
28139
  const isZone = Boolean(dragGroup || accepts || sortable);
28059
28140
  const enabled = isZone || Boolean(dndRoot);
28060
28141
  const eventBus = useEventBus();
28061
- const parentRoot = React94__default.useContext(RootCtx);
28142
+ const parentRoot = React95__default.useContext(RootCtx);
28062
28143
  const isRoot = enabled && parentRoot === null;
28063
- const zoneId = React94__default.useId();
28144
+ const zoneId = React95__default.useId();
28064
28145
  const ownGroup = dragGroup ?? accepts ?? zoneId;
28065
- const [optimisticOrders, setOptimisticOrders] = React94__default.useState(() => /* @__PURE__ */ new Map());
28066
- const optimisticOrdersRef = React94__default.useRef(optimisticOrders);
28146
+ const [optimisticOrders, setOptimisticOrders] = React95__default.useState(() => /* @__PURE__ */ new Map());
28147
+ const optimisticOrdersRef = React95__default.useRef(optimisticOrders);
28067
28148
  optimisticOrdersRef.current = optimisticOrders;
28068
- const clearOptimisticOrder = React94__default.useCallback((group) => {
28149
+ const clearOptimisticOrder = React95__default.useCallback((group) => {
28069
28150
  setOptimisticOrders((prev) => {
28070
28151
  if (!prev.has(group)) return prev;
28071
28152
  const next = new Map(prev);
@@ -28090,7 +28171,7 @@ function useDataDnd(args) {
28090
28171
  const raw = it[dndItemIdField];
28091
28172
  return raw != null ? String(raw) : `__idx_${idx}`;
28092
28173
  }).join("|");
28093
- const itemIds = React94__default.useMemo(
28174
+ const itemIds = React95__default.useMemo(
28094
28175
  () => orderedItems.map((it, idx) => {
28095
28176
  const raw = it[dndItemIdField];
28096
28177
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -28101,7 +28182,7 @@ function useDataDnd(args) {
28101
28182
  const raw = it[dndItemIdField];
28102
28183
  return raw != null ? String(raw) : `__${idx}`;
28103
28184
  }).join("|");
28104
- React94__default.useEffect(() => {
28185
+ React95__default.useEffect(() => {
28105
28186
  const root = isRoot ? null : parentRoot;
28106
28187
  if (root) {
28107
28188
  root.clearOptimisticOrder(ownGroup);
@@ -28109,20 +28190,20 @@ function useDataDnd(args) {
28109
28190
  clearOptimisticOrder(ownGroup);
28110
28191
  }
28111
28192
  }, [itemsContentSig, ownGroup]);
28112
- const zonesRef = React94__default.useRef(/* @__PURE__ */ new Map());
28113
- const registerZone = React94__default.useCallback((zoneId2, meta2) => {
28193
+ const zonesRef = React95__default.useRef(/* @__PURE__ */ new Map());
28194
+ const registerZone = React95__default.useCallback((zoneId2, meta2) => {
28114
28195
  zonesRef.current.set(zoneId2, meta2);
28115
28196
  }, []);
28116
- const unregisterZone = React94__default.useCallback((zoneId2) => {
28197
+ const unregisterZone = React95__default.useCallback((zoneId2) => {
28117
28198
  zonesRef.current.delete(zoneId2);
28118
28199
  }, []);
28119
- const [activeDrag, setActiveDrag] = React94__default.useState(null);
28120
- const [overZoneGroup, setOverZoneGroup] = React94__default.useState(null);
28121
- 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(
28122
28203
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
28123
28204
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
28124
28205
  );
28125
- React94__default.useEffect(() => {
28206
+ React95__default.useEffect(() => {
28126
28207
  const target = isRoot ? null : parentRoot;
28127
28208
  if (!target) {
28128
28209
  zonesRef.current.set(zoneId, meta);
@@ -28141,7 +28222,7 @@ function useDataDnd(args) {
28141
28222
  }, [parentRoot, isRoot, zoneId, meta]);
28142
28223
  const sensors = useAlmadarDndSensors(true);
28143
28224
  const collisionDetection = almadarDndCollisionDetection;
28144
- const findZoneByItem = React94__default.useCallback(
28225
+ const findZoneByItem = React95__default.useCallback(
28145
28226
  (id) => {
28146
28227
  for (const z of zonesRef.current.values()) {
28147
28228
  if (z.itemIds.includes(id)) return z;
@@ -28150,7 +28231,7 @@ function useDataDnd(args) {
28150
28231
  },
28151
28232
  []
28152
28233
  );
28153
- React94__default.useCallback(
28234
+ React95__default.useCallback(
28154
28235
  (group) => {
28155
28236
  for (const z of zonesRef.current.values()) {
28156
28237
  if (z.group === group) return z;
@@ -28159,7 +28240,7 @@ function useDataDnd(args) {
28159
28240
  },
28160
28241
  []
28161
28242
  );
28162
- const handleDragEnd = React94__default.useCallback(
28243
+ const handleDragEnd = React95__default.useCallback(
28163
28244
  (event) => {
28164
28245
  const { active, over } = event;
28165
28246
  const activeIdStr = String(active.id);
@@ -28250,8 +28331,8 @@ function useDataDnd(args) {
28250
28331
  },
28251
28332
  [eventBus]
28252
28333
  );
28253
- const sortableData = React94__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
28254
- const SortableItem = React94__default.useCallback(
28334
+ const sortableData = React95__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
28335
+ const SortableItem = React95__default.useCallback(
28255
28336
  ({ id, children }) => {
28256
28337
  const {
28257
28338
  attributes,
@@ -28291,7 +28372,7 @@ function useDataDnd(args) {
28291
28372
  id: droppableId,
28292
28373
  data: sortableData
28293
28374
  });
28294
- const ctx = React94__default.useContext(RootCtx);
28375
+ const ctx = React95__default.useContext(RootCtx);
28295
28376
  const activeDrag2 = ctx?.activeDrag ?? null;
28296
28377
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
28297
28378
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -28306,7 +28387,7 @@ function useDataDnd(args) {
28306
28387
  showForeignPlaceholder,
28307
28388
  ctxAvailable: ctx != null
28308
28389
  });
28309
- React94__default.useEffect(() => {
28390
+ React95__default.useEffect(() => {
28310
28391
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
28311
28392
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
28312
28393
  return /* @__PURE__ */ jsx(
@@ -28320,11 +28401,11 @@ function useDataDnd(args) {
28320
28401
  }
28321
28402
  );
28322
28403
  };
28323
- const rootContextValue = React94__default.useMemo(
28404
+ const rootContextValue = React95__default.useMemo(
28324
28405
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
28325
28406
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
28326
28407
  );
28327
- const handleDragStart = React94__default.useCallback((event) => {
28408
+ const handleDragStart = React95__default.useCallback((event) => {
28328
28409
  const sourceZone = findZoneByItem(event.active.id);
28329
28410
  const rect = event.active.rect.current.initial;
28330
28411
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -28343,7 +28424,7 @@ function useDataDnd(args) {
28343
28424
  isRoot
28344
28425
  });
28345
28426
  }, [findZoneByItem, isRoot, zoneId]);
28346
- const handleDragOver = React94__default.useCallback((event) => {
28427
+ const handleDragOver = React95__default.useCallback((event) => {
28347
28428
  const { active, over } = event;
28348
28429
  const overData = over?.data?.current;
28349
28430
  const overGroup = overData?.dndGroup ?? null;
@@ -28413,7 +28494,7 @@ function useDataDnd(args) {
28413
28494
  return next;
28414
28495
  });
28415
28496
  }, []);
28416
- const handleDragCancel = React94__default.useCallback((event) => {
28497
+ const handleDragCancel = React95__default.useCallback((event) => {
28417
28498
  setActiveDrag(null);
28418
28499
  setOverZoneGroup(null);
28419
28500
  dndLog.warn("dragCancel", {
@@ -28421,12 +28502,12 @@ function useDataDnd(args) {
28421
28502
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
28422
28503
  });
28423
28504
  }, []);
28424
- const handleDragEndWithCleanup = React94__default.useCallback((event) => {
28505
+ const handleDragEndWithCleanup = React95__default.useCallback((event) => {
28425
28506
  handleDragEnd(event);
28426
28507
  setActiveDrag(null);
28427
28508
  setOverZoneGroup(null);
28428
28509
  }, [handleDragEnd]);
28429
- const wrapContainer = React94__default.useCallback(
28510
+ const wrapContainer = React95__default.useCallback(
28430
28511
  (children) => {
28431
28512
  if (!enabled) return children;
28432
28513
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -28480,7 +28561,7 @@ var init_useDataDnd = __esm({
28480
28561
  init_useAlmadarDndCollision();
28481
28562
  init_Box();
28482
28563
  dndLog = createLogger("almadar:ui:dnd");
28483
- RootCtx = React94__default.createContext(null);
28564
+ RootCtx = React95__default.createContext(null);
28484
28565
  }
28485
28566
  });
28486
28567
  function renderIconInput(icon, props) {
@@ -28995,7 +29076,7 @@ function DataList({
28995
29076
  }) {
28996
29077
  const eventBus = useEventBus();
28997
29078
  const { t } = useTranslate();
28998
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize || Infinity);
29079
+ const [visibleCount, setVisibleCount] = React95__default.useState(pageSize || Infinity);
28999
29080
  const fieldDefs = fields ?? columns ?? [];
29000
29081
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
29001
29082
  const dnd = useDataDnd({
@@ -29011,14 +29092,14 @@ function DataList({
29011
29092
  dndRoot
29012
29093
  });
29013
29094
  const orderedData = dnd.orderedItems;
29014
- const allData = React94__default.useMemo(
29095
+ const allData = React95__default.useMemo(
29015
29096
  () => sortRows(orderedData, sortBy, sortDirection),
29016
29097
  [orderedData, sortBy, sortDirection]
29017
29098
  );
29018
29099
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
29019
29100
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
29020
29101
  const hasRenderProp = typeof children === "function";
29021
- React94__default.useEffect(() => {
29102
+ React95__default.useEffect(() => {
29022
29103
  const renderItemTypeOf = typeof schemaRenderItem;
29023
29104
  const childrenTypeOf = typeof children;
29024
29105
  if (data.length > 0 && !hasRenderProp) {
@@ -29138,7 +29219,7 @@ function DataList({
29138
29219
  return v === void 0 || v === null || v === "" ? raw : String(v);
29139
29220
  };
29140
29221
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
29141
- groups2.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
29222
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
29142
29223
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
29143
29224
  group.items.map((itemData, index) => {
29144
29225
  const id = itemData.id || `${gi}-${index}`;
@@ -29354,7 +29435,7 @@ function DataList({
29354
29435
  className
29355
29436
  ),
29356
29437
  children: [
29357
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
29438
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
29358
29439
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
29359
29440
  group.items.map(
29360
29441
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -29441,7 +29522,7 @@ var init_FormSection = __esm({
29441
29522
  columns = 1,
29442
29523
  className
29443
29524
  }) => {
29444
- const [collapsed, setCollapsed] = React94__default.useState(defaultCollapsed);
29525
+ const [collapsed, setCollapsed] = React95__default.useState(defaultCollapsed);
29445
29526
  const { t } = useTranslate();
29446
29527
  const eventBus = useEventBus();
29447
29528
  const gridClass = {
@@ -29449,7 +29530,7 @@ var init_FormSection = __esm({
29449
29530
  2: "grid-cols-1 md:grid-cols-2",
29450
29531
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
29451
29532
  }[columns];
29452
- React94__default.useCallback(() => {
29533
+ React95__default.useCallback(() => {
29453
29534
  if (collapsible) {
29454
29535
  setCollapsed((prev) => !prev);
29455
29536
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -29722,6 +29803,112 @@ var init_GridPicker = __esm({
29722
29803
  GridPicker.displayName = "GridPicker";
29723
29804
  }
29724
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
+ });
29725
29912
  function fileIcon(name) {
29726
29913
  const ext = name.split(".").pop()?.toLowerCase() ?? "";
29727
29914
  switch (ext) {
@@ -29747,6 +29934,13 @@ function fileIcon(name) {
29747
29934
  return "file";
29748
29935
  }
29749
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
+ }
29750
29944
  function ancestorsOf(id, byId) {
29751
29945
  const out = /* @__PURE__ */ new Set();
29752
29946
  if (!id) return out;
@@ -29764,6 +29958,8 @@ var init_FileTree = __esm({
29764
29958
  init_Box();
29765
29959
  init_Typography();
29766
29960
  init_Icon();
29961
+ init_useDraggable();
29962
+ init_useDropZone();
29767
29963
  TreeNodeItem = ({
29768
29964
  node,
29769
29965
  depth,
@@ -29847,10 +30043,12 @@ var init_FileTree = __esm({
29847
30043
  depth,
29848
30044
  indent,
29849
30045
  childrenByParent,
30046
+ roots,
29850
30047
  onNodeSelect,
29851
30048
  onNodeAction,
29852
30049
  nodeActionIcon,
29853
30050
  nodeActionLabel,
30051
+ onNodeReorder,
29854
30052
  selectedId,
29855
30053
  look,
29856
30054
  isExpanded,
@@ -29861,6 +30059,7 @@ var init_FileTree = __esm({
29861
30059
  const expanded = hasChildren && isExpanded(item.id, depth);
29862
30060
  const isSelected = selectedId !== void 0 && selectedId !== "" && item.id === selectedId;
29863
30061
  const nav = look === "nav";
30062
+ const rowRef = useRef(null);
29864
30063
  const handleClick = useCallback(() => {
29865
30064
  if (hasChildren && !onNodeSelect) onToggle(item.id, expanded);
29866
30065
  onNodeSelect?.(item.id);
@@ -29873,16 +30072,50 @@ var init_FileTree = __esm({
29873
30072
  e.stopPropagation();
29874
30073
  onNodeAction?.(item.id);
29875
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
+ });
29876
30106
  return /* @__PURE__ */ jsxs(Fragment, { children: [
29877
30107
  /* @__PURE__ */ jsxs(
29878
30108
  Box,
29879
30109
  {
30110
+ ref: rowRef,
29880
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"}`,
29881
30112
  style: { paddingLeft: depth * indent + 8 },
29882
30113
  onClick: handleClick,
29883
30114
  role: "treeitem",
29884
30115
  "aria-selected": isSelected,
29885
30116
  "aria-expanded": hasChildren ? expanded : void 0,
30117
+ ...dragProps,
30118
+ ...dropProps,
29886
30119
  children: [
29887
30120
  hasChildren ? /* @__PURE__ */ jsx(Box, { onClick: handleChevron, className: "flex items-center flex-shrink-0", role: "button", "aria-label": expanded ? "Collapse" : "Expand", children: /* @__PURE__ */ jsx(
29888
30121
  Icon,
@@ -29929,10 +30162,12 @@ var init_FileTree = __esm({
29929
30162
  depth: depth + 1,
29930
30163
  indent,
29931
30164
  childrenByParent,
30165
+ roots,
29932
30166
  onNodeSelect,
29933
30167
  onNodeAction,
29934
30168
  nodeActionIcon,
29935
30169
  nodeActionLabel,
30170
+ onNodeReorder,
29936
30171
  selectedId,
29937
30172
  look,
29938
30173
  isExpanded,
@@ -29950,14 +30185,15 @@ var init_FileTree = __esm({
29950
30185
  onNodeAction,
29951
30186
  nodeActionIcon,
29952
30187
  nodeActionLabel,
30188
+ onNodeReorder,
29953
30189
  className,
29954
30190
  indent = 16
29955
30191
  }) => {
29956
30192
  const [overrides, setOverrides] = useState(() => /* @__PURE__ */ new Map());
29957
- const byId = React94__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
29958
- const selectedAncestors = React94__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
29959
- const lastSelectedRef = React94__default.useRef(selectedId);
29960
- 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(() => {
29961
30197
  if (selectedId === lastSelectedRef.current) return;
29962
30198
  lastSelectedRef.current = selectedId;
29963
30199
  setOverrides((prev) => {
@@ -29998,10 +30234,12 @@ var init_FileTree = __esm({
29998
30234
  depth: 0,
29999
30235
  indent,
30000
30236
  childrenByParent,
30237
+ roots,
30001
30238
  onNodeSelect,
30002
30239
  onNodeAction,
30003
30240
  nodeActionIcon,
30004
30241
  nodeActionLabel,
30242
+ onNodeReorder,
30005
30243
  selectedId,
30006
30244
  look,
30007
30245
  isExpanded,
@@ -30021,6 +30259,7 @@ var init_FileTree = __esm({
30021
30259
  onNodeAction,
30022
30260
  nodeActionIcon,
30023
30261
  nodeActionLabel,
30262
+ onNodeReorder,
30024
30263
  className,
30025
30264
  indent = 16
30026
30265
  }) => {
@@ -30035,6 +30274,7 @@ var init_FileTree = __esm({
30035
30274
  onNodeAction,
30036
30275
  nodeActionIcon,
30037
30276
  nodeActionLabel,
30277
+ onNodeReorder,
30038
30278
  className,
30039
30279
  indent
30040
30280
  }
@@ -30787,7 +31027,7 @@ var init_Flex = __esm({
30787
31027
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
30788
31028
  }
30789
31029
  }
30790
- return React94__default.createElement(Component, {
31030
+ return React95__default.createElement(Component, {
30791
31031
  className: cn(
30792
31032
  inline ? "inline-flex" : "flex",
30793
31033
  directionStyles[direction],
@@ -30906,7 +31146,7 @@ var init_Grid = __esm({
30906
31146
  as: Component = "div"
30907
31147
  }) => {
30908
31148
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
30909
- return React94__default.createElement(
31149
+ return React95__default.createElement(
30910
31150
  Component,
30911
31151
  {
30912
31152
  className: cn(
@@ -31328,9 +31568,9 @@ var init_Popover = __esm({
31328
31568
  onMouseLeave: handleClose,
31329
31569
  onPointerDown: tapTriggerProps.onPointerDown
31330
31570
  };
31331
- const childElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
31571
+ const childElement = React95__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
31332
31572
  const childPointerDown = childElement.props.onPointerDown;
31333
- const triggerElement = React94__default.cloneElement(
31573
+ const triggerElement = React95__default.cloneElement(
31334
31574
  childElement,
31335
31575
  {
31336
31576
  ref: triggerRef,
@@ -31944,9 +32184,9 @@ var init_Tooltip = __esm({
31944
32184
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
31945
32185
  };
31946
32186
  }, []);
31947
- const triggerElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
32187
+ const triggerElement = React95__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
31948
32188
  const childPointerDown = triggerElement.props.onPointerDown;
31949
- const trigger = React94__default.cloneElement(triggerElement, {
32189
+ const trigger = React95__default.cloneElement(triggerElement, {
31950
32190
  ref: triggerRef,
31951
32191
  onMouseEnter: handleMouseEnter,
31952
32192
  onMouseLeave: handleMouseLeave,
@@ -32036,7 +32276,7 @@ var init_WizardProgress = __esm({
32036
32276
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
32037
32277
  const isActive = index === currentStep;
32038
32278
  const isCompleted = index < currentStep;
32039
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
32279
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
32040
32280
  /* @__PURE__ */ jsx(
32041
32281
  "button",
32042
32282
  {
@@ -33098,6 +33338,8 @@ var init_MathCanvas = __esm({
33098
33338
  gridColor = "var(--color-border, #9ca3af)",
33099
33339
  axisColor = "var(--color-muted-foreground, #374151)",
33100
33340
  showTickLabels = false,
33341
+ tickLabelFontSize = 10,
33342
+ labelFontSize = 12,
33101
33343
  showCurveLabels = false,
33102
33344
  curves = [],
33103
33345
  points = [],
@@ -33169,18 +33411,18 @@ var init_MathCanvas = __esm({
33169
33411
  let kx = 0;
33170
33412
  for (let x = Math.ceil(xMin / gridStep) * gridStep; x <= xMax; x += gridStep, kx++) {
33171
33413
  if (kx % labelEveryX === 0 && x !== 0) {
33172
- 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" });
33173
33415
  }
33174
33416
  }
33175
33417
  const labelEveryY = Math.max(1, Math.ceil((yMax - yMin) / gridStep / Math.floor(plotH / 28)));
33176
33418
  let ky = 0;
33177
33419
  for (let y = Math.ceil(yMin / gridStep) * gridStep; y <= yMax; y += gridStep, ky++) {
33178
33420
  if (ky % labelEveryY === 0 && y !== 0) {
33179
- 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" });
33180
33422
  }
33181
33423
  }
33182
33424
  if (xMin <= 0 && xMax >= 0 && yMin <= 0 && yMax >= 0) {
33183
- 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" });
33184
33426
  }
33185
33427
  }
33186
33428
  for (const region of regions) {
@@ -33211,7 +33453,7 @@ var init_MathCanvas = __esm({
33211
33453
  y: (mapY(region.samples[mid].y) + mapY(baseline)) / 2,
33212
33454
  text: region.label,
33213
33455
  color,
33214
- fontSize: 11
33456
+ fontSize: labelFontSize
33215
33457
  });
33216
33458
  }
33217
33459
  }
@@ -33250,7 +33492,7 @@ var init_MathCanvas = __esm({
33250
33492
  const py = mapY(guide.at);
33251
33493
  out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color, dash });
33252
33494
  if (guide.label) {
33253
- 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" });
33254
33496
  }
33255
33497
  }
33256
33498
  }
@@ -33293,7 +33535,7 @@ var init_MathCanvas = __esm({
33293
33535
  y: mapY(lastInRange.y) - 6,
33294
33536
  text: curve.label,
33295
33537
  color: curve.color ?? "#2563eb",
33296
- fontSize: 11
33538
+ fontSize: labelFontSize
33297
33539
  });
33298
33540
  }
33299
33541
  }
@@ -33330,7 +33572,7 @@ var init_MathCanvas = __esm({
33330
33572
  y: xAxisY - peak - 8,
33331
33573
  text: hop.label,
33332
33574
  color,
33333
- fontSize: 10,
33575
+ fontSize: labelFontSize,
33334
33576
  align: "center"
33335
33577
  });
33336
33578
  }
@@ -33357,7 +33599,7 @@ var init_MathCanvas = __esm({
33357
33599
  y: mapY(angle.y + 1.35 * radius * Math.sin(rad)),
33358
33600
  text: angle.label,
33359
33601
  color,
33360
- fontSize: 11,
33602
+ fontSize: labelFontSize,
33361
33603
  align: "center"
33362
33604
  });
33363
33605
  }
@@ -33374,7 +33616,7 @@ var init_MathCanvas = __esm({
33374
33616
  fill: isOpen ? "#ffffff" : p.color ?? "#dc2626"
33375
33617
  });
33376
33618
  if (p.label) {
33377
- 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 });
33378
33620
  }
33379
33621
  }
33380
33622
  for (const v of vectors) {
@@ -33385,7 +33627,7 @@ var init_MathCanvas = __esm({
33385
33627
  const y2 = mapY(v.y + v.vy);
33386
33628
  out.push({ type: "arrow", x1, y1, x2, y2, color: v.color ?? "#7c3aed", lineWidth: 2 });
33387
33629
  if (v.label) {
33388
- 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 });
33389
33631
  }
33390
33632
  }
33391
33633
  out.push(...shapes);
@@ -33404,6 +33646,8 @@ var init_MathCanvas = __esm({
33404
33646
  gridColor,
33405
33647
  axisColor,
33406
33648
  showTickLabels,
33649
+ tickLabelFontSize,
33650
+ labelFontSize,
33407
33651
  showCurveLabels,
33408
33652
  curves,
33409
33653
  points,
@@ -34691,13 +34935,13 @@ var init_MapView = __esm({
34691
34935
  shadowSize: [41, 41]
34692
34936
  });
34693
34937
  L.Marker.prototype.options.icon = defaultIcon;
34694
- const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback96, useState: useState103 } = React94__default;
34938
+ const { useEffect: useEffect68, useRef: useRef67, useCallback: useCallback98, useState: useState106 } = React95__default;
34695
34939
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
34696
34940
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
34697
34941
  function MapUpdater({ centerLat, centerLng, zoom }) {
34698
34942
  const map = useMap();
34699
- const prevRef = useRef65({ centerLat, centerLng, zoom });
34700
- useEffect67(() => {
34943
+ const prevRef = useRef67({ centerLat, centerLng, zoom });
34944
+ useEffect68(() => {
34701
34945
  const prev = prevRef.current;
34702
34946
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
34703
34947
  map.setView([centerLat, centerLng], zoom);
@@ -34708,7 +34952,7 @@ var init_MapView = __esm({
34708
34952
  }
34709
34953
  function MapClickHandler({ onMapClick }) {
34710
34954
  const map = useMap();
34711
- useEffect67(() => {
34955
+ useEffect68(() => {
34712
34956
  if (!onMapClick) return;
34713
34957
  const handler = (e) => {
34714
34958
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -34736,8 +34980,8 @@ var init_MapView = __esm({
34736
34980
  showAttribution = true
34737
34981
  }) {
34738
34982
  const eventBus = useEventBus2();
34739
- const [clickedPosition, setClickedPosition] = useState103(null);
34740
- const handleMapClick = useCallback96((lat, lng) => {
34983
+ const [clickedPosition, setClickedPosition] = useState106(null);
34984
+ const handleMapClick = useCallback98((lat, lng) => {
34741
34985
  if (showClickedPin) {
34742
34986
  setClickedPosition({ lat, lng });
34743
34987
  }
@@ -34746,7 +34990,7 @@ var init_MapView = __esm({
34746
34990
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
34747
34991
  }
34748
34992
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
34749
- const handleMarkerClick = useCallback96((marker) => {
34993
+ const handleMarkerClick = useCallback98((marker) => {
34750
34994
  onMarkerClick?.(marker);
34751
34995
  if (markerClickEvent) {
34752
34996
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -35636,8 +35880,8 @@ function TableView({
35636
35880
  }) {
35637
35881
  const eventBus = useEventBus();
35638
35882
  const { t } = useTranslate();
35639
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize > 0 ? pageSize : Infinity);
35640
- 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());
35641
35885
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
35642
35886
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
35643
35887
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
@@ -35658,7 +35902,7 @@ function TableView({
35658
35902
  const hasMore = pageSize > 0 && visibleCount < ordered2.length;
35659
35903
  const hasRenderProp = typeof children === "function";
35660
35904
  const idField = dndItemIdField ?? "id";
35661
- React94__default.useEffect(() => {
35905
+ React95__default.useEffect(() => {
35662
35906
  tableViewLog.debug("render", {
35663
35907
  rowCount: data.length,
35664
35908
  colCount: colDefs.length,
@@ -35708,7 +35952,7 @@ function TableView({
35708
35952
  };
35709
35953
  eventBus.emit(`UI:${rowClickEvent}`, payload);
35710
35954
  };
35711
- const colFloors = React94__default.useMemo(
35955
+ const colFloors = React95__default.useMemo(
35712
35956
  () => colDefs.map((col) => {
35713
35957
  const longest = data.reduce((widest, row) => {
35714
35958
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -35851,12 +36095,12 @@ function TableView({
35851
36095
  ]
35852
36096
  }
35853
36097
  );
35854
- 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);
35855
36099
  };
35856
36100
  const items = Array.from(data);
35857
36101
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
35858
36102
  let runningIndex = 0;
35859
- 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: [
35860
36104
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
35861
36105
  group.items.map((row) => renderRow(row, runningIndex++))
35862
36106
  ] }, gi)) });
@@ -37225,7 +37469,7 @@ var init_StepFlow = __esm({
37225
37469
  className
37226
37470
  }) => {
37227
37471
  if (orientation === "vertical") {
37228
- 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: [
37229
37473
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
37230
37474
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
37231
37475
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -37236,7 +37480,7 @@ var init_StepFlow = __esm({
37236
37480
  ] })
37237
37481
  ] }) }, index)) });
37238
37482
  }
37239
- 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: [
37240
37484
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
37241
37485
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
37242
37486
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -38226,7 +38470,7 @@ var init_LikertScale = __esm({
38226
38470
  md: "text-base",
38227
38471
  lg: "text-lg"
38228
38472
  };
38229
- LikertScale = React94__default.forwardRef(
38473
+ LikertScale = React95__default.forwardRef(
38230
38474
  ({
38231
38475
  question,
38232
38476
  options = DEFAULT_LIKERT_OPTIONS,
@@ -38238,7 +38482,7 @@ var init_LikertScale = __esm({
38238
38482
  variant = "radios",
38239
38483
  className
38240
38484
  }, ref) => {
38241
- const groupId = React94__default.useId();
38485
+ const groupId = React95__default.useId();
38242
38486
  const eventBus = useEventBus();
38243
38487
  const handleSelect = useCallback(
38244
38488
  (next) => {
@@ -40661,7 +40905,7 @@ var init_DocBreadcrumb = __esm({
40661
40905
  "aria-label": t("aria.breadcrumb"),
40662
40906
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
40663
40907
  const isLast = idx === items.length - 1;
40664
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
40908
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
40665
40909
  idx > 0 && /* @__PURE__ */ jsx(
40666
40910
  Icon,
40667
40911
  {
@@ -41326,7 +41570,7 @@ var init_PageHeader = __esm({
41326
41570
  info: "bg-info/10 text-info"
41327
41571
  };
41328
41572
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
41329
- 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: [
41330
41574
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
41331
41575
  crumb.href ? /* @__PURE__ */ jsx(
41332
41576
  "a",
@@ -41684,7 +41928,7 @@ var init_Section = __esm({
41684
41928
  as: Component = "section"
41685
41929
  }) => {
41686
41930
  const hasHeader = title || description || action;
41687
- return React94__default.createElement(
41931
+ return React95__default.createElement(
41688
41932
  Component,
41689
41933
  {
41690
41934
  className: cn(
@@ -42058,7 +42302,7 @@ var init_WizardContainer = __esm({
42058
42302
  const isCompleted = index < currentStep;
42059
42303
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42060
42304
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42061
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
42305
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
42062
42306
  /* @__PURE__ */ jsx(
42063
42307
  Button,
42064
42308
  {
@@ -43845,7 +44089,7 @@ var init_ImportPreviewTree = __esm({
43845
44089
  const renderUnit = (unit, childrenByParent, depth) => {
43846
44090
  const summary = fieldSummary(unit);
43847
44091
  const children = childrenByParent.get(unit.ref) ?? [];
43848
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
44092
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
43849
44093
  /* @__PURE__ */ jsxs(
43850
44094
  Box,
43851
44095
  {
@@ -43942,7 +44186,7 @@ var init_ImportProgress = __esm({
43942
44186
  PIPELINE.map((key, index) => {
43943
44187
  const isComplete = index < currentIndex;
43944
44188
  const isActive = index === currentIndex;
43945
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
44189
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
43946
44190
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
43947
44191
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
43948
44192
  /* @__PURE__ */ jsx(
@@ -44070,6 +44314,69 @@ var init_ReflectionBlock = __esm({
44070
44314
  ReflectionBlock.displayName = "ReflectionBlock";
44071
44315
  }
44072
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
+ });
44073
44380
 
44074
44381
  // components/core/molecules/index.ts
44075
44382
  var init_molecules2 = __esm({
@@ -44820,7 +45127,7 @@ var init_DetailPanel = __esm({
44820
45127
  }) => {
44821
45128
  const eventBus = useEventBus();
44822
45129
  const { t } = useTranslate();
44823
- const [titleDraft, setTitleDraft] = React94__default.useState(null);
45130
+ const [titleDraft, setTitleDraft] = React95__default.useState(null);
44824
45131
  const isFieldDefArray = (arr) => {
44825
45132
  if (!arr || arr.length === 0) return false;
44826
45133
  const first = arr[0];
@@ -45213,8 +45520,224 @@ var init_DetailPanel = __esm({
45213
45520
  DetailPanel.displayName = "DetailPanel";
45214
45521
  }
45215
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
+ });
45216
45739
  function extractTitle(children) {
45217
- if (!React94__default.isValidElement(children)) return void 0;
45740
+ if (!React95__default.isValidElement(children)) return void 0;
45218
45741
  const props = children.props;
45219
45742
  if (typeof props.title === "string") {
45220
45743
  return props.title;
@@ -45576,7 +46099,7 @@ var init_Form = __esm({
45576
46099
  const isSchemaEntity = isOrbitalEntitySchema(entity);
45577
46100
  const resolvedEntity = isSchemaEntity ? entity : void 0;
45578
46101
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
45579
- const normalizedInitialData = React94__default.useMemo(() => {
46102
+ const normalizedInitialData = React95__default.useMemo(() => {
45580
46103
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
45581
46104
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
45582
46105
  const merged = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
@@ -45595,7 +46118,7 @@ var init_Form = __esm({
45595
46118
  }
45596
46119
  return normalized;
45597
46120
  }, [entity, initialData]);
45598
- const entityDerivedFields = React94__default.useMemo(() => {
46121
+ const entityDerivedFields = React95__default.useMemo(() => {
45599
46122
  if (fields && fields.length > 0) return void 0;
45600
46123
  if (!resolvedEntity) return void 0;
45601
46124
  return resolvedEntity.fields.map(
@@ -45616,16 +46139,16 @@ var init_Form = __esm({
45616
46139
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
45617
46140
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
45618
46141
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
45619
- const [formData, setFormData] = React94__default.useState(
46142
+ const [formData, setFormData] = React95__default.useState(
45620
46143
  normalizedInitialData
45621
46144
  );
45622
- const [collapsedSections, setCollapsedSections] = React94__default.useState(
46145
+ const [collapsedSections, setCollapsedSections] = React95__default.useState(
45623
46146
  /* @__PURE__ */ new Set()
45624
46147
  );
45625
- const [submitError, setSubmitError] = React94__default.useState(null);
45626
- const formRef = React94__default.useRef(null);
46148
+ const [submitError, setSubmitError] = React95__default.useState(null);
46149
+ const formRef = React95__default.useRef(null);
45627
46150
  const formMode = props.mode;
45628
- const mountedRef = React94__default.useRef(false);
46151
+ const mountedRef = React95__default.useRef(false);
45629
46152
  if (!mountedRef.current) {
45630
46153
  mountedRef.current = true;
45631
46154
  debug("forms", "mount", {
@@ -45638,7 +46161,7 @@ var init_Form = __esm({
45638
46161
  });
45639
46162
  }
45640
46163
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
45641
- const evalContext = React94__default.useMemo(
46164
+ const evalContext = React95__default.useMemo(
45642
46165
  () => ({
45643
46166
  formValues: formData,
45644
46167
  globalVariables: externalContext?.globalVariables ?? {},
@@ -45647,7 +46170,7 @@ var init_Form = __esm({
45647
46170
  }),
45648
46171
  [formData, externalContext]
45649
46172
  );
45650
- React94__default.useEffect(() => {
46173
+ React95__default.useEffect(() => {
45651
46174
  debug("forms", "initialData-sync", {
45652
46175
  mode: formMode,
45653
46176
  normalizedInitialData,
@@ -45658,7 +46181,7 @@ var init_Form = __esm({
45658
46181
  setFormData(normalizedInitialData);
45659
46182
  }
45660
46183
  }, [normalizedInitialData]);
45661
- const processCalculations = React94__default.useCallback(
46184
+ const processCalculations = React95__default.useCallback(
45662
46185
  (changedFieldId, newFormData) => {
45663
46186
  if (!hiddenCalculations.length) return;
45664
46187
  const context = {
@@ -45683,7 +46206,7 @@ var init_Form = __esm({
45683
46206
  },
45684
46207
  [hiddenCalculations, externalContext, eventBus]
45685
46208
  );
45686
- const checkViolations = React94__default.useCallback(
46209
+ const checkViolations = React95__default.useCallback(
45687
46210
  (changedFieldId, newFormData) => {
45688
46211
  if (!violationTriggers.length) return;
45689
46212
  const context = {
@@ -45721,7 +46244,7 @@ var init_Form = __esm({
45721
46244
  processCalculations(name, newFormData);
45722
46245
  checkViolations(name, newFormData);
45723
46246
  };
45724
- const isFieldVisible = React94__default.useCallback(
46247
+ const isFieldVisible = React95__default.useCallback(
45725
46248
  (fieldName2) => {
45726
46249
  const condition = conditionalFields[fieldName2];
45727
46250
  if (!condition) return true;
@@ -45729,7 +46252,7 @@ var init_Form = __esm({
45729
46252
  },
45730
46253
  [conditionalFields, evalContext]
45731
46254
  );
45732
- const isSectionVisible = React94__default.useCallback(
46255
+ const isSectionVisible = React95__default.useCallback(
45733
46256
  (section) => {
45734
46257
  if (!section.condition) return true;
45735
46258
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -45805,7 +46328,7 @@ var init_Form = __esm({
45805
46328
  eventBus.emit(`UI:${onCancel}`);
45806
46329
  }
45807
46330
  };
45808
- const renderField = React94__default.useCallback(
46331
+ const renderField = React95__default.useCallback(
45809
46332
  (field) => {
45810
46333
  const fieldName2 = field.name || field.field;
45811
46334
  if (!fieldName2) return null;
@@ -45827,7 +46350,7 @@ var init_Form = __esm({
45827
46350
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
45828
46351
  );
45829
46352
  const effectiveFields = entityDerivedFields ?? fields;
45830
- const normalizedFields = React94__default.useMemo(() => {
46353
+ const normalizedFields = React95__default.useMemo(() => {
45831
46354
  if (!effectiveFields || effectiveFields.length === 0) return [];
45832
46355
  return effectiveFields.map((field) => {
45833
46356
  if (typeof field === "string") {
@@ -45862,7 +46385,7 @@ var init_Form = __esm({
45862
46385
  };
45863
46386
  });
45864
46387
  }, [effectiveFields, resolvedEntity, fieldOverrides]);
45865
- const schemaFields = React94__default.useMemo(() => {
46388
+ const schemaFields = React95__default.useMemo(() => {
45866
46389
  if (normalizedFields.length === 0) return null;
45867
46390
  if (isDebugEnabled()) {
45868
46391
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -45872,7 +46395,7 @@ var init_Form = __esm({
45872
46395
  }
45873
46396
  return normalizedFields.map(renderField).filter(Boolean);
45874
46397
  }, [normalizedFields, renderField, entityName, conditionalFields]);
45875
- const sectionElements = React94__default.useMemo(() => {
46398
+ const sectionElements = React95__default.useMemo(() => {
45876
46399
  if (!sections || sections.length === 0) return null;
45877
46400
  return sections.map((section) => {
45878
46401
  if (!isSectionVisible(section)) {
@@ -46708,7 +47231,7 @@ var init_List = __esm({
46708
47231
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
46709
47232
  return [];
46710
47233
  }, [entity]);
46711
- const getItemActions = React94__default.useCallback(
47234
+ const getItemActions = React95__default.useCallback(
46712
47235
  (item) => {
46713
47236
  if (!itemActions) return [];
46714
47237
  if (typeof itemActions === "function") {
@@ -47190,7 +47713,7 @@ var init_MediaGallery = __esm({
47190
47713
  [selectable, selectedItems, selectionEvent, eventBus]
47191
47714
  );
47192
47715
  const entityData = Array.isArray(entity) ? entity : [];
47193
- const items = React94__default.useMemo(() => {
47716
+ const items = React95__default.useMemo(() => {
47194
47717
  if (propItems && propItems.length > 0) return propItems;
47195
47718
  if (entityData.length === 0) return [];
47196
47719
  return entityData.map((record, idx) => {
@@ -47355,7 +47878,7 @@ var init_MediaGallery = __esm({
47355
47878
  }
47356
47879
  });
47357
47880
  function extractTitle2(children) {
47358
- if (!React94__default.isValidElement(children)) return void 0;
47881
+ if (!React95__default.isValidElement(children)) return void 0;
47359
47882
  const props = children.props;
47360
47883
  if (typeof props.title === "string") {
47361
47884
  return props.title;
@@ -47629,7 +48152,7 @@ var init_debugRegistry = __esm({
47629
48152
  }
47630
48153
  });
47631
48154
  function useDebugData() {
47632
- const [data, setData] = React94.useState(() => ({
48155
+ const [data, setData] = React95.useState(() => ({
47633
48156
  traits: [],
47634
48157
  ticks: [],
47635
48158
  guards: [],
@@ -47643,7 +48166,7 @@ function useDebugData() {
47643
48166
  },
47644
48167
  lastUpdate: Date.now()
47645
48168
  }));
47646
- React94.useEffect(() => {
48169
+ React95.useEffect(() => {
47647
48170
  const updateData = () => {
47648
48171
  setData({
47649
48172
  traits: getAllTraits(),
@@ -47752,12 +48275,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
47752
48275
  return positions;
47753
48276
  }
47754
48277
  function WalkMinimap() {
47755
- const [walkStep, setWalkStep] = React94.useState(null);
47756
- const [traits2, setTraits] = React94.useState([]);
47757
- const [coveredEdges, setCoveredEdges] = React94.useState([]);
47758
- const [completedTraits, setCompletedTraits] = React94.useState(/* @__PURE__ */ new Set());
47759
- const prevTraitRef = React94.useRef(null);
47760
- 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(() => {
47761
48284
  const interval = setInterval(() => {
47762
48285
  const w = window;
47763
48286
  const step = w.__orbitalWalkStep;
@@ -48193,15 +48716,15 @@ var init_EntitiesTab = __esm({
48193
48716
  });
48194
48717
  function EventFlowTab({ events: events2 }) {
48195
48718
  const { t } = useTranslate();
48196
- const [filter, setFilter] = React94.useState("all");
48197
- const containerRef = React94.useRef(null);
48198
- const [autoScroll, setAutoScroll] = React94.useState(true);
48199
- 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(() => {
48200
48723
  if (autoScroll && containerRef.current) {
48201
48724
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
48202
48725
  }
48203
48726
  }, [events2.length, autoScroll]);
48204
- const filteredEvents = React94.useMemo(() => {
48727
+ const filteredEvents = React95.useMemo(() => {
48205
48728
  if (filter === "all") return events2;
48206
48729
  return events2.filter((e) => e.type === filter);
48207
48730
  }, [events2, filter]);
@@ -48317,7 +48840,7 @@ var init_EventFlowTab = __esm({
48317
48840
  });
48318
48841
  function GuardsPanel({ guards }) {
48319
48842
  const { t } = useTranslate();
48320
- const [filter, setFilter] = React94.useState("all");
48843
+ const [filter, setFilter] = React95.useState("all");
48321
48844
  if (guards.length === 0) {
48322
48845
  return /* @__PURE__ */ jsx(
48323
48846
  EmptyState,
@@ -48330,7 +48853,7 @@ function GuardsPanel({ guards }) {
48330
48853
  }
48331
48854
  const passedCount = guards.filter((g) => g.result).length;
48332
48855
  const failedCount = guards.length - passedCount;
48333
- const filteredGuards = React94.useMemo(() => {
48856
+ const filteredGuards = React95.useMemo(() => {
48334
48857
  if (filter === "all") return guards;
48335
48858
  if (filter === "passed") return guards.filter((g) => g.result);
48336
48859
  return guards.filter((g) => !g.result);
@@ -48493,10 +49016,10 @@ function EffectBadge({ effect }) {
48493
49016
  }
48494
49017
  function TransitionTimeline({ transitions }) {
48495
49018
  const { t } = useTranslate();
48496
- const containerRef = React94.useRef(null);
48497
- const [autoScroll, setAutoScroll] = React94.useState(true);
48498
- const [expandedId, setExpandedId] = React94.useState(null);
48499
- 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(() => {
48500
49023
  if (autoScroll && containerRef.current) {
48501
49024
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
48502
49025
  }
@@ -48776,9 +49299,9 @@ function getAllEvents(traits2) {
48776
49299
  function EventDispatcherTab({ traits: traits2, schema }) {
48777
49300
  const eventBus = useEventBus();
48778
49301
  const { t } = useTranslate();
48779
- const [log11, setLog] = React94.useState([]);
48780
- const prevStatesRef = React94.useRef(/* @__PURE__ */ new Map());
48781
- React94.useEffect(() => {
49302
+ const [log11, setLog] = React95.useState([]);
49303
+ const prevStatesRef = React95.useRef(/* @__PURE__ */ new Map());
49304
+ React95.useEffect(() => {
48782
49305
  for (const trait of traits2) {
48783
49306
  const prev = prevStatesRef.current.get(trait.id);
48784
49307
  if (prev && prev !== trait.currentState) {
@@ -48947,10 +49470,10 @@ function VerifyModePanel({
48947
49470
  localCount
48948
49471
  }) {
48949
49472
  const { t } = useTranslate();
48950
- const [expanded, setExpanded] = React94.useState(true);
48951
- const scrollRef = React94.useRef(null);
48952
- const prevCountRef = React94.useRef(0);
48953
- React94.useEffect(() => {
49473
+ const [expanded, setExpanded] = React95.useState(true);
49474
+ const scrollRef = React95.useRef(null);
49475
+ const prevCountRef = React95.useRef(0);
49476
+ React95.useEffect(() => {
48954
49477
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
48955
49478
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
48956
49479
  }
@@ -49007,10 +49530,10 @@ function RuntimeDebugger({
49007
49530
  schema
49008
49531
  }) {
49009
49532
  const { t } = useTranslate();
49010
- const [isCollapsed, setIsCollapsed] = React94.useState(mode === "verify" ? true : defaultCollapsed);
49011
- 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());
49012
49535
  const debugData = useDebugData();
49013
- React94.useEffect(() => {
49536
+ React95.useEffect(() => {
49014
49537
  if (mode === "inline") return;
49015
49538
  return onDebugToggle((enabled) => {
49016
49539
  setIsVisible(enabled);
@@ -49019,7 +49542,7 @@ function RuntimeDebugger({
49019
49542
  }
49020
49543
  });
49021
49544
  }, [mode]);
49022
- React94.useEffect(() => {
49545
+ React95.useEffect(() => {
49023
49546
  if (mode === "inline") return;
49024
49547
  const handleKeyDown = (e) => {
49025
49548
  if (e.key === "`" && isVisible) {
@@ -49034,7 +49557,7 @@ function RuntimeDebugger({
49034
49557
  if (!isVisible) {
49035
49558
  return null;
49036
49559
  }
49037
- const positionClasses = {
49560
+ const positionClasses2 = {
49038
49561
  "bottom-right": "bottom-4 right-4",
49039
49562
  "bottom-left": "bottom-4 left-4",
49040
49563
  "top-right": "top-4 right-4",
@@ -49163,7 +49686,7 @@ function RuntimeDebugger({
49163
49686
  className: cn(
49164
49687
  "runtime-debugger",
49165
49688
  "fixed",
49166
- positionClasses[position],
49689
+ positionClasses2[position],
49167
49690
  isCollapsed ? "runtime-debugger--collapsed" : "runtime-debugger--expanded",
49168
49691
  className
49169
49692
  ),
@@ -49245,6 +49768,7 @@ var init_SegmentRenderer = __esm({
49245
49768
  "use client";
49246
49769
  init_MarkdownContent();
49247
49770
  init_CodeBlock();
49771
+ init_MermaidDiagram();
49248
49772
  init_QuizBlock();
49249
49773
  init_ActivationBlock();
49250
49774
  init_ConnectionBlock();
@@ -49276,6 +49800,9 @@ var init_SegmentRenderer = __esm({
49276
49800
  return /* @__PURE__ */ jsx(MarkdownContent, { content: segment.content }, `md-${index}`);
49277
49801
  }
49278
49802
  if (segment.type === "code") {
49803
+ if (segment.language === "mermaid") {
49804
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code: segment.content }, `code-${index}`);
49805
+ }
49279
49806
  if (segment.runnable && onRunCodeSimulation) {
49280
49807
  return /* @__PURE__ */ jsx(
49281
49808
  CodeRunnerPanel,
@@ -49408,99 +49935,6 @@ var init_ShowcaseOrganism = __esm({
49408
49935
  ShowcaseOrganism.displayName = "ShowcaseOrganism";
49409
49936
  }
49410
49937
  });
49411
- var SplitPane;
49412
- var init_SplitPane = __esm({
49413
- "components/core/organisms/layout/SplitPane.tsx"() {
49414
- "use client";
49415
- init_cn();
49416
- SplitPane = ({
49417
- direction = "horizontal",
49418
- ratio: initialRatio = 50,
49419
- minSize = 100,
49420
- resizable = true,
49421
- left,
49422
- right,
49423
- className,
49424
- leftClassName,
49425
- rightClassName
49426
- }) => {
49427
- const [ratio, setRatio] = useState(initialRatio);
49428
- const containerRef = useRef(null);
49429
- const isDragging = useRef(false);
49430
- const handlePointerDown = useCallback(
49431
- (e) => {
49432
- if (!resizable) return;
49433
- e.preventDefault();
49434
- isDragging.current = true;
49435
- e.currentTarget.setPointerCapture(e.pointerId);
49436
- const handlePointerMove = (ev) => {
49437
- if (!isDragging.current || !containerRef.current) return;
49438
- const rect = containerRef.current.getBoundingClientRect();
49439
- let newRatio;
49440
- if (direction === "horizontal") {
49441
- const x = ev.clientX - rect.left;
49442
- newRatio = x / rect.width * 100;
49443
- } else {
49444
- const y = ev.clientY - rect.top;
49445
- newRatio = y / rect.height * 100;
49446
- }
49447
- const minRatio = minSize / (direction === "horizontal" ? rect.width : rect.height) * 100;
49448
- const maxRatio = 100 - minRatio;
49449
- newRatio = Math.max(minRatio, Math.min(maxRatio, newRatio));
49450
- setRatio(newRatio);
49451
- };
49452
- const handlePointerUp = () => {
49453
- isDragging.current = false;
49454
- document.removeEventListener("pointermove", handlePointerMove);
49455
- document.removeEventListener("pointerup", handlePointerUp);
49456
- document.removeEventListener("pointercancel", handlePointerUp);
49457
- };
49458
- document.addEventListener("pointermove", handlePointerMove);
49459
- document.addEventListener("pointerup", handlePointerUp);
49460
- document.addEventListener("pointercancel", handlePointerUp);
49461
- },
49462
- [direction, minSize, resizable]
49463
- );
49464
- const isHorizontal = direction === "horizontal";
49465
- return /* @__PURE__ */ jsxs(
49466
- "div",
49467
- {
49468
- ref: containerRef,
49469
- className: cn(
49470
- "flex w-full h-full",
49471
- isHorizontal ? "flex-row" : "flex-col",
49472
- className
49473
- ),
49474
- children: [
49475
- /* @__PURE__ */ jsx(
49476
- "div",
49477
- {
49478
- className: cn("overflow-auto", leftClassName),
49479
- style: {
49480
- [isHorizontal ? "width" : "height"]: `${ratio}%`,
49481
- flexShrink: 0
49482
- },
49483
- children: left
49484
- }
49485
- ),
49486
- resizable && /* @__PURE__ */ jsx(
49487
- "div",
49488
- {
49489
- onPointerDown: handlePointerDown,
49490
- className: cn(
49491
- "flex-shrink-0 bg-border transition-colors touch-none",
49492
- 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"
49493
- )
49494
- }
49495
- ),
49496
- /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto", rightClassName), children: right })
49497
- ]
49498
- }
49499
- );
49500
- };
49501
- SplitPane.displayName = "SplitPane";
49502
- }
49503
- });
49504
49938
  var StatCard;
49505
49939
  var init_StatCard = __esm({
49506
49940
  "components/core/organisms/StatCard.tsx"() {
@@ -49539,7 +49973,7 @@ var init_StatCard = __esm({
49539
49973
  const labelToUse = propLabel ?? propTitle;
49540
49974
  const eventBus = useEventBus();
49541
49975
  const { t } = useTranslate();
49542
- const handleActionClick = React94__default.useCallback(() => {
49976
+ const handleActionClick = React95__default.useCallback(() => {
49543
49977
  if (action?.event) {
49544
49978
  eventBus.emit(`UI:${action.event}`, {});
49545
49979
  }
@@ -49550,7 +49984,7 @@ var init_StatCard = __esm({
49550
49984
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
49551
49985
  const isLoading = externalLoading ?? false;
49552
49986
  const error = externalError;
49553
- const computeMetricValue = React94__default.useCallback(
49987
+ const computeMetricValue = React95__default.useCallback(
49554
49988
  (metric, items) => {
49555
49989
  if (metric.value !== void 0) {
49556
49990
  return metric.value;
@@ -49589,7 +50023,7 @@ var init_StatCard = __esm({
49589
50023
  },
49590
50024
  []
49591
50025
  );
49592
- const schemaStats = React94__default.useMemo(() => {
50026
+ const schemaStats = React95__default.useMemo(() => {
49593
50027
  if (!metrics || metrics.length === 0) return null;
49594
50028
  return metrics.map((metric) => ({
49595
50029
  label: metric.label,
@@ -49597,7 +50031,7 @@ var init_StatCard = __esm({
49597
50031
  format: metric.format
49598
50032
  }));
49599
50033
  }, [metrics, data, computeMetricValue]);
49600
- const calculatedTrend = React94__default.useMemo(() => {
50034
+ const calculatedTrend = React95__default.useMemo(() => {
49601
50035
  if (manualTrend !== void 0) return manualTrend;
49602
50036
  if (previousValue === void 0 || currentValue === void 0)
49603
50037
  return void 0;
@@ -50237,8 +50671,8 @@ var init_SubagentTracePanel = __esm({
50237
50671
  ] });
50238
50672
  };
50239
50673
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
50240
- const endRef = React94__default.useRef(null);
50241
- React94__default.useEffect(() => {
50674
+ const endRef = React95__default.useRef(null);
50675
+ React95__default.useEffect(() => {
50242
50676
  if (!autoScroll) return;
50243
50677
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
50244
50678
  }, [activities.length, autoScroll]);
@@ -50332,7 +50766,7 @@ var init_SubagentTracePanel = __esm({
50332
50766
  };
50333
50767
  SubagentRichCard = ({ subagent }) => {
50334
50768
  const { t } = useTranslate();
50335
- const activities = React94__default.useMemo(
50769
+ const activities = React95__default.useMemo(
50336
50770
  () => subagentMessagesToActivities(subagent.messages),
50337
50771
  [subagent.messages]
50338
50772
  );
@@ -50409,8 +50843,8 @@ var init_SubagentTracePanel = __esm({
50409
50843
  ] });
50410
50844
  };
50411
50845
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
50412
- const endRef = React94__default.useRef(null);
50413
- React94__default.useEffect(() => {
50846
+ const endRef = React95__default.useRef(null);
50847
+ React95__default.useEffect(() => {
50414
50848
  if (!autoScroll) return;
50415
50849
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
50416
50850
  }, [messages.length, autoScroll]);
@@ -50845,7 +51279,7 @@ var init_Timeline = __esm({
50845
51279
  }) => {
50846
51280
  const { t } = useTranslate();
50847
51281
  const entityData = entity ?? [];
50848
- const items = React94__default.useMemo(() => {
51282
+ const items = React95__default.useMemo(() => {
50849
51283
  if (propItems) return propItems;
50850
51284
  if (entityData.length === 0) return [];
50851
51285
  return entityData.map((record, idx) => {
@@ -50947,7 +51381,7 @@ var init_Timeline = __esm({
50947
51381
  }
50948
51382
  });
50949
51383
  function extractToastProps(children) {
50950
- if (!React94__default.isValidElement(children)) {
51384
+ if (!React95__default.isValidElement(children)) {
50951
51385
  if (typeof children === "string") {
50952
51386
  return { message: children };
50953
51387
  }
@@ -50989,7 +51423,7 @@ var init_ToastSlot = __esm({
50989
51423
  eventBus.emit(`${prefix}CLOSE`);
50990
51424
  };
50991
51425
  if (!isVisible) return null;
50992
- const isCustomContent = React94__default.isValidElement(children) && !message;
51426
+ const isCustomContent = React95__default.isValidElement(children) && !message;
50993
51427
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
50994
51428
  Toast,
50995
51429
  {
@@ -51084,6 +51518,7 @@ var init_component_registry_generated = __esm({
51084
51518
  init_DocSearch();
51085
51519
  init_DocSidebar();
51086
51520
  init_DocTOC();
51521
+ init_DockLayout();
51087
51522
  init_DocumentDetails();
51088
51523
  init_DocumentPanel();
51089
51524
  init_DocumentViewer();
@@ -51114,6 +51549,7 @@ var init_component_registry_generated = __esm({
51114
51549
  init_FlipCard();
51115
51550
  init_FlipContainer();
51116
51551
  init_FloatingActionButton();
51552
+ init_FloatingToolbar();
51117
51553
  init_Form();
51118
51554
  init_FormField();
51119
51555
  init_FormSection();
@@ -51358,6 +51794,7 @@ var init_component_registry_generated = __esm({
51358
51794
  "DocSearch": DocSearch,
51359
51795
  "DocSidebar": DocSidebar,
51360
51796
  "DocTOC": DocTOC,
51797
+ "DockLayout": DockLayout,
51361
51798
  "DocumentDetails": DocumentDetails,
51362
51799
  "DocumentPanel": DocumentPanel,
51363
51800
  "DocumentViewer": DocumentViewer,
@@ -51388,6 +51825,7 @@ var init_component_registry_generated = __esm({
51388
51825
  "FlipCard": FlipCard,
51389
51826
  "FlipContainer": FlipContainer,
51390
51827
  "FloatingActionButton": FloatingActionButton,
51828
+ "FloatingToolbar": FloatingToolbar,
51391
51829
  "Form": Form,
51392
51830
  "FormField": FormField,
51393
51831
  "FormLayout": FormLayout,
@@ -51575,7 +52013,7 @@ function SuspenseConfigProvider({
51575
52013
  config,
51576
52014
  children
51577
52015
  }) {
51578
- return React94__default.createElement(
52016
+ return React95__default.createElement(
51579
52017
  SuspenseConfigContext.Provider,
51580
52018
  { value: config },
51581
52019
  children
@@ -51623,7 +52061,7 @@ function enrichFormFields(fields, entityDef) {
51623
52061
  }
51624
52062
  return { name: field, label: humanizeFieldName(field) };
51625
52063
  }
51626
- 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)) {
51627
52065
  const obj = field;
51628
52066
  const fieldName2 = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
51629
52067
  if (!fieldName2) return field;
@@ -51676,7 +52114,7 @@ function enrichDetailFields(fields, entityDef) {
51676
52114
  const meta = metaFor(field);
51677
52115
  return meta ? { key: field, ...meta } : field;
51678
52116
  }
51679
- 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)) {
51680
52118
  const obj = field;
51681
52119
  const fieldName2 = typeof obj.key === "string" ? obj.key : typeof obj.name === "string" ? obj.name : void 0;
51682
52120
  if (!fieldName2 || obj.type) return field;
@@ -52135,7 +52573,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
52135
52573
  const key = `${parentId}-${index}-trait:${traitName}`;
52136
52574
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
52137
52575
  }
52138
- return /* @__PURE__ */ jsx(React94__default.Fragment, { children: child }, `${parentId}-${index}`);
52576
+ return /* @__PURE__ */ jsx(React95__default.Fragment, { children: child }, `${parentId}-${index}`);
52139
52577
  }
52140
52578
  if (!child || typeof child !== "object") return null;
52141
52579
  const childId = `${parentId}-${index}`;
@@ -52192,7 +52630,7 @@ function isPatternConfig(value) {
52192
52630
  if (value === null || value === void 0) return false;
52193
52631
  if (typeof value !== "object") return false;
52194
52632
  if (Array.isArray(value)) return false;
52195
- if (React94__default.isValidElement(value)) return false;
52633
+ if (React95__default.isValidElement(value)) return false;
52196
52634
  if (value instanceof Date) return false;
52197
52635
  if (typeof value === "function") return false;
52198
52636
  const record = value;
@@ -52205,9 +52643,9 @@ function renderPatternValue(value) {
52205
52643
  if (typeof value === "string") return renderPatternChildren(value, () => {
52206
52644
  });
52207
52645
  if (value instanceof Date) return value.toLocaleString();
52208
- if (React94__default.isValidElement(value)) return value;
52646
+ if (React95__default.isValidElement(value)) return value;
52209
52647
  if (Array.isArray(value)) {
52210
- 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));
52211
52649
  }
52212
52650
  if (isPatternConfig(value)) {
52213
52651
  const { type, ...props } = value;
@@ -52217,7 +52655,7 @@ function renderPatternValue(value) {
52217
52655
  return null;
52218
52656
  }
52219
52657
  function isPlainConfigObject(value) {
52220
- if (React94__default.isValidElement(value)) return false;
52658
+ if (React95__default.isValidElement(value)) return false;
52221
52659
  if (value instanceof Date) return false;
52222
52660
  const proto = Object.getPrototypeOf(value);
52223
52661
  return proto === Object.prototype || proto === null;
@@ -52391,7 +52829,7 @@ function SlotContentRenderer({
52391
52829
  for (const slotKey of CONTENT_NODE_SLOTS) {
52392
52830
  const slotVal = restProps[slotKey];
52393
52831
  if (slotVal === void 0 || slotVal === null) continue;
52394
- 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;
52395
52833
  const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
52396
52834
  if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
52397
52835
  nodeSlotOverrides[slotKey] = renderPatternChildren(
@@ -52445,7 +52883,7 @@ function SlotContentRenderer({
52445
52883
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
52446
52884
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
52447
52885
  const sample = resolvedItems[0];
52448
- 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)) {
52449
52887
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
52450
52888
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
52451
52889
  }
@@ -52809,7 +53247,7 @@ var AvlTransition = ({
52809
53247
  opacity = 1,
52810
53248
  className
52811
53249
  }) => {
52812
- const ids = React94__default.useMemo(() => {
53250
+ const ids = React95__default.useMemo(() => {
52813
53251
  avlTransitionId += 1;
52814
53252
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
52815
53253
  }, []);
@@ -53370,7 +53808,7 @@ var AvlStateMachine = ({
53370
53808
  color = "var(--color-primary)",
53371
53809
  animated = false
53372
53810
  }) => {
53373
- const ids = React94__default.useMemo(() => {
53811
+ const ids = React95__default.useMemo(() => {
53374
53812
  avlSmId += 1;
53375
53813
  const base = `avl-sm-${avlSmId}`;
53376
53814
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -53569,7 +54007,7 @@ var AvlOrbitalUnit = ({
53569
54007
  color = "var(--color-primary)",
53570
54008
  animated = false
53571
54009
  }) => {
53572
- const ids = React94__default.useMemo(() => {
54010
+ const ids = React95__default.useMemo(() => {
53573
54011
  avlOuId += 1;
53574
54012
  const base = `avl-ou-${avlOuId}`;
53575
54013
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -53665,7 +54103,7 @@ var AvlClosedCircuit = ({
53665
54103
  color = "var(--color-primary)",
53666
54104
  animated = false
53667
54105
  }) => {
53668
- const ids = React94__default.useMemo(() => {
54106
+ const ids = React95__default.useMemo(() => {
53669
54107
  avlCcId += 1;
53670
54108
  const base = `avl-cc-${avlCcId}`;
53671
54109
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -53820,7 +54258,7 @@ var AvlEmitListen = ({
53820
54258
  color = "var(--color-primary)",
53821
54259
  animated = false
53822
54260
  }) => {
53823
- const ids = React94__default.useMemo(() => {
54261
+ const ids = React95__default.useMemo(() => {
53824
54262
  avlElId += 1;
53825
54263
  const base = `avl-el-${avlElId}`;
53826
54264
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -54094,7 +54532,7 @@ function renderNode(node, color, glowId) {
54094
54532
  const baseR = node.type === "operator" ? 20 : 16;
54095
54533
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
54096
54534
  const nc = nodeColor(node.type, color);
54097
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
54535
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
54098
54536
  node.children.map((child, i) => {
54099
54537
  const childR = Math.max(
54100
54538
  child.type === "operator" ? 20 : 16,
@@ -54151,7 +54589,7 @@ var AvlExprTree = ({
54151
54589
  className,
54152
54590
  color = "var(--color-primary)"
54153
54591
  }) => {
54154
- const ids = React94__default.useMemo(() => {
54592
+ const ids = React95__default.useMemo(() => {
54155
54593
  avlEtId += 1;
54156
54594
  return { glow: `avl-et-${avlEtId}-glow` };
54157
54595
  }, []);
@@ -54986,7 +55424,7 @@ var SystemNode = ({ data }) => {
54986
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) => {
54987
55425
  const tc = transitionCounts[s.name] ?? 0;
54988
55426
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
54989
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
55427
+ return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
54990
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 }),
54991
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 })
54992
55430
  ] }, s.name);
@@ -56073,7 +56511,7 @@ function resolveLambdaBindings(body, params, item, index) {
56073
56511
  }
56074
56512
  return substituted;
56075
56513
  }
56076
- 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") {
56077
56515
  const out = {};
56078
56516
  for (const [k, v] of Object.entries(body)) {
56079
56517
  out[k] = recur(v);
@@ -56106,7 +56544,7 @@ function deferLambdaEntityExprs(value) {
56106
56544
  }
56107
56545
  return arr.map((v) => deferLambdaEntityExprs(v));
56108
56546
  }
56109
- 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)) {
56110
56548
  const out = {};
56111
56549
  for (const [k, v] of Object.entries(value)) {
56112
56550
  out[k] = deferLambdaEntityExprs(v);
@@ -56120,7 +56558,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
56120
56558
  const resolvedBody = deferLambdaEntityExprs(
56121
56559
  resolveLambdaBindings(lambdaBody, params, item, index)
56122
56560
  );
56123
- 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) {
56124
56562
  return null;
56125
56563
  }
56126
56564
  const record = resolvedBody;
@@ -56139,7 +56577,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
56139
56577
  props: childProps,
56140
56578
  priority: 0
56141
56579
  };
56142
- return React94__default.createElement(SlotContentRenderer2, { content: childContent });
56580
+ return React95__default.createElement(SlotContentRenderer2, { content: childContent });
56143
56581
  };
56144
56582
  }
56145
56583
  function convertNode(node, callerKey) {
@@ -56159,7 +56597,7 @@ function convertNode(node, callerKey) {
56159
56597
  });
56160
56598
  return anyChanged ? mapped : node;
56161
56599
  }
56162
- if (typeof node === "object" && !React94__default.isValidElement(node) && !(node instanceof Date)) {
56600
+ if (typeof node === "object" && !React95__default.isValidElement(node) && !(node instanceof Date)) {
56163
56601
  return convertObjectProps(node);
56164
56602
  }
56165
56603
  return node;
@@ -58116,13 +58554,12 @@ function useCanvasDraggable({
58116
58554
  payload,
58117
58555
  disabled
58118
58556
  }) {
58119
- const { setNodeRef, attributes, listeners: listeners7, isDragging, transform } = useDraggable({
58557
+ const { setNodeRef, attributes, listeners: listeners7, isDragging, transform } = useDraggable$1({
58120
58558
  id,
58121
58559
  data: { payload },
58122
58560
  disabled
58123
58561
  });
58124
58562
  const style = {
58125
- transform: CSS.Translate.toString(transform),
58126
58563
  cursor: disabled ? "not-allowed" : isDragging ? "grabbing" : "grab",
58127
58564
  opacity: isDragging ? 0.5 : 1,
58128
58565
  touchAction: "none"
@@ -58174,6 +58611,21 @@ function defaultEmit(eventBus, drop) {
58174
58611
  log9.info("default-emit:behavior", { behaviorName, level: target.level });
58175
58612
  return;
58176
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
+ }
58177
58629
  log9.debug("default-emit:unhandled-kind", { kind: payload.kind });
58178
58630
  }
58179
58631
  function CanvasDndProvider({
@@ -58183,10 +58635,17 @@ function CanvasDndProvider({
58183
58635
  }) {
58184
58636
  const eventBus = useEventBus();
58185
58637
  const sensors = useAlmadarDndSensors(false);
58186
- const [activePayload, setActivePayload] = React94__default.useState(null);
58187
- 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) => {
58188
58644
  const data = e.active.data.current;
58189
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);
58190
58649
  if (payload) {
58191
58650
  setActivePayload(payload);
58192
58651
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
@@ -58194,9 +58653,10 @@ function CanvasDndProvider({
58194
58653
  } else {
58195
58654
  log9.warn("dragStart:missing-payload", { id: e.active.id });
58196
58655
  }
58197
- }, [eventBus]);
58198
- const handleDragEnd = React94__default.useCallback((e) => {
58656
+ }, [eventBus, trackPointer]);
58657
+ const handleDragEnd = React95__default.useCallback((e) => {
58199
58658
  setActivePayload(null);
58659
+ document.removeEventListener("pointermove", trackPointer);
58200
58660
  const activeData = e.active.data.current;
58201
58661
  const payload = activeData?.payload;
58202
58662
  const overData = e.over?.data.current;
@@ -58217,17 +58677,24 @@ function CanvasDndProvider({
58217
58677
  log9.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
58218
58678
  return;
58219
58679
  }
58220
- const activator = e.activatorEvent;
58221
- 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;
58222
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
+ });
58223
58689
  const drop = { payload, target, cursor, resolved };
58224
58690
  const suppressed = onDrop ? onDrop(drop) === true : false;
58225
58691
  if (!suppressed) defaultEmit(eventBus, drop);
58226
- }, [eventBus, onDrop]);
58227
- const handleDragCancel = React94__default.useCallback(() => {
58692
+ }, [eventBus, onDrop, trackPointer]);
58693
+ const handleDragCancel = React95__default.useCallback(() => {
58228
58694
  setActivePayload(null);
58695
+ document.removeEventListener("pointermove", trackPointer);
58229
58696
  log9.info("dragCancel");
58230
- }, []);
58697
+ }, [trackPointer]);
58231
58698
  return /* @__PURE__ */ jsxs(
58232
58699
  DndContext,
58233
58700
  {
@@ -58238,7 +58705,14 @@ function CanvasDndProvider({
58238
58705
  onDragCancel: handleDragCancel,
58239
58706
  children: [
58240
58707
  children,
58241
- 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
58242
58716
  ]
58243
58717
  }
58244
58718
  );
@@ -58307,6 +58781,34 @@ function deriveEditFocusFromElement(el) {
58307
58781
  if (entity !== null) focus.entity = entity;
58308
58782
  return focus;
58309
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
+ }
58310
58812
  function entityNameOf(ref) {
58311
58813
  if (!ref) return void 0;
58312
58814
  if (typeof ref === "string") return ref;
@@ -58592,6 +59094,13 @@ function rectRelativeTo(el, container, zoom) {
58592
59094
  height: (u.bottom - u.top) / z
58593
59095
  };
58594
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
+ }
58595
59104
  var OrbPreviewNodeInner = (props) => {
58596
59105
  const data = props.data;
58597
59106
  const screenSize = useContext(ScreenSizeContext);
@@ -58661,7 +59170,11 @@ var OrbPreviewNodeInner = (props) => {
58661
59170
  rect: rect ?? void 0
58662
59171
  });
58663
59172
  const focus = deriveEditFocusFromElement(patternEl);
58664
- 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
+ }
58665
59178
  } else {
58666
59179
  setSelectedRect(null);
58667
59180
  select(null);
@@ -58697,6 +59210,17 @@ var OrbPreviewNodeInner = (props) => {
58697
59210
  unsub2();
58698
59211
  };
58699
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]);
58700
59224
  const resolveL2Path = useCallback(
58701
59225
  (cursor) => {
58702
59226
  const hit = document.elementFromPoint(cursor.x, cursor.y);
@@ -58707,21 +59231,34 @@ var OrbPreviewNodeInner = (props) => {
58707
59231
  el = el.parentElement;
58708
59232
  }
58709
59233
  if (!el) return null;
58710
- const containerPath = el.dataset?.patternPath;
58711
- if (!containerPath) return { parentPath: "root", index: 0 };
58712
- const pathChildren = el.querySelectorAll(":scope > [data-pattern-path]");
58713
- let insertIndex = pathChildren.length;
58714
- const style = el.firstElementChild ? getComputedStyle(el.firstElementChild) : null;
58715
- const isVertical = style?.flexDirection !== "row";
58716
- for (let i = 0; i < pathChildren.length; i++) {
58717
- const rect = pathChildren[i].getBoundingClientRect();
58718
- const mid = isVertical ? rect.top + rect.height / 2 : rect.left + rect.width / 2;
58719
- const pos = isVertical ? cursor.y : cursor.x;
58720
- if (pos < mid) {
58721
- insertIndex = i;
58722
- break;
58723
- }
58724
- }
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
+ });
58725
59262
  return { parentPath: containerPath, index: insertIndex };
58726
59263
  },
58727
59264
  []
@@ -58741,13 +59278,35 @@ var OrbPreviewNodeInner = (props) => {
58741
59278
  const { setNodeRef: l2SetNodeRef, isOver: l2IsOver } = useCanvasDroppable({
58742
59279
  id: `orb-l2-${data.orbitalName}-${data.traitName ?? ""}-${data.transitionEvent ?? ""}`,
58743
59280
  target: l2Target,
58744
- accepts: ["pattern"],
59281
+ accepts: ["pattern", "pattern-instance"],
58745
59282
  disabled: !isExpanded
58746
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]);
58747
59305
  const setContentRef = useCallback((el) => {
58748
59306
  contentRef.current = el;
58749
59307
  l2SetNodeRef(el);
58750
- }, [l2SetNodeRef]);
59308
+ reorderSetNodeRef(el);
59309
+ }, [l2SetNodeRef, reorderSetNodeRef]);
58751
59310
  const statusBorder = isRunning ? "var(--color-primary)" : isError ? "var(--color-danger)" : isSuccess ? "var(--color-success)" : null;
58752
59311
  const borderWidth = isRunning || isError || isSuccess ? "2px" : "1.5px";
58753
59312
  const borderColor = statusBorder ?? (hovered ? "var(--color-primary)" : colors.border);
@@ -58907,10 +59466,11 @@ var OrbPreviewNodeInner = (props) => {
58907
59466
  Box,
58908
59467
  {
58909
59468
  ref: setContentRef,
58910
- className: `orb-preview-live nodrag relative${dragActive || l2IsOver ? " drag-active" : ""}`,
59469
+ className: `orb-preview-live nodrag relative${dragActive || reorderDragActive || l2IsOver ? " drag-active" : ""}`,
58911
59470
  onClick: handleContentClick,
58912
59471
  onMouseMove: handleContentMouseMove,
58913
59472
  onMouseLeave: handleContentMouseLeave,
59473
+ onPointerDown: handleContentPointerDown,
58914
59474
  children: [
58915
59475
  hoverRect && /* @__PURE__ */ jsx(
58916
59476
  "div",
@@ -58982,7 +59542,7 @@ var OrbPreviewNodeInner = (props) => {
58982
59542
  }
58983
59543
  );
58984
59544
  };
58985
- var OrbPreviewNode = React94__default.memo(OrbPreviewNodeInner);
59545
+ var OrbPreviewNode = React95__default.memo(OrbPreviewNodeInner);
58986
59546
  OrbPreviewNode.displayName = "OrbPreviewNode";
58987
59547
  orbPreviewLog.debug("export-resolved", () => ({
58988
59548
  type: typeof OrbPreviewNode,
@@ -59087,7 +59647,7 @@ var EventFlowEdgeInner = (props) => {
59087
59647
  ) })
59088
59648
  ] });
59089
59649
  };
59090
- var EventFlowEdge = React94__default.memo(EventFlowEdgeInner);
59650
+ var EventFlowEdge = React95__default.memo(EventFlowEdgeInner);
59091
59651
  EventFlowEdge.displayName = "EventFlowEdge";
59092
59652
 
59093
59653
  // components/avl/molecules/BehaviorComposeNode.tsx
@@ -59234,7 +59794,7 @@ var BehaviorComposeNodeInner = (props) => {
59234
59794
  }
59235
59795
  );
59236
59796
  };
59237
- var BehaviorComposeNode = React94__default.memo(BehaviorComposeNodeInner);
59797
+ var BehaviorComposeNode = React95__default.memo(BehaviorComposeNodeInner);
59238
59798
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
59239
59799
 
59240
59800
  // components/avl/lib/avl-behavior-compose-converter.ts
@@ -59430,9 +59990,14 @@ function findPatternInTree(root, path) {
59430
59990
  }
59431
59991
  var FIELD_TYPE_OPTIONS = FieldTypeSchema.options.map((v) => ({ value: v, label: v }));
59432
59992
  var EFFECT_TYPE_OPTIONS = Object.keys(EFFECT_TYPE_TO_CATEGORY).map((v) => ({ value: v, label: v }));
59433
- function OrbInspector({ node, schema, editable = false, userType = "builder", themeManifest, onSchemaChange, onClose }) {
59434
- const { selected: selectedPattern } = useContext(PatternSelectionContext);
59435
- 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]);
59436
60001
  const eventBus = useEventBus();
59437
60002
  const { t } = useTranslate();
59438
60003
  const orbitalName = node.orbitalName ?? "";
@@ -59587,10 +60152,10 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59587
60152
  }
59588
60153
  )
59589
60154
  ] }),
59590
- /* @__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(
59591
60156
  "button",
59592
60157
  {
59593
- onClick: () => setActiveTab(tab),
60158
+ onClick: () => handleTabChange(tab),
59594
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"}`,
59595
60160
  children: t(`orbInspector.tab.${tab}`)
59596
60161
  },
@@ -59616,26 +60181,8 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59616
60181
  onChange: editable ? (code) => eventBus.emit("UI:CODE_CHANGE", { code }) : void 0
59617
60182
  }
59618
60183
  ) })
59619
- ) : activeTab === "styles" ? (
59620
- /* ── Styles Tab ──
59621
- Variant + size pills are clickable when `editable` and emit
59622
- `UI:PROP_CHANGE` with the selection context. The page-level
59623
- dispatcher routes those events to the project schemaEditor or
59624
- to the theme manifest based on `selection.sourceSchemaName`. */
59625
- /* @__PURE__ */ jsx(
59626
- StylesTab,
59627
- {
59628
- patternType,
59629
- patternDef,
59630
- patternConfig,
59631
- editable,
59632
- onPropChange: handlePropChange,
59633
- themeManifest,
59634
- isDesignSystem: selectedPattern?.nodeData.sourceSchemaName === "__design_system__"
59635
- }
59636
- )
59637
- ) : (
59638
- /* ── Inspector Tab ── */
60184
+ ) : activeTab === "design" ? (
60185
+ /* ── Design Tab ── Pattern Props + Styles + render-ui source. */
59639
60186
  /* @__PURE__ */ jsxs(Fragment, { children: [
59640
60187
  selectedPattern && patternDef?.propsSchema && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59641
60188
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("avl.props") }),
@@ -59671,6 +60218,97 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59671
60218
  ] }, propName);
59672
60219
  }) })
59673
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: [
59674
60312
  userType === "architect" && (selectedPattern && isEntityPattern || !selectedPattern && !isExpanded) && entity && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59675
60313
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("avl.entity") }),
59676
60314
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2 mb-2", children: [
@@ -59774,77 +60412,6 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
59774
60412
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-xs font-semibold", children: tr.name }),
59775
60413
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: t("orbInspector.statesCount", { count: tr.stateCount }) })
59776
60414
  ] }, tr.name)) })
59777
- ] }),
59778
- isExpanded && fromState && toState && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59779
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("avl.transition") }),
59780
- /* @__PURE__ */ jsxs("svg", { width: "100%", height: 44, viewBox: "0 0 280 44", children: [
59781
- /* @__PURE__ */ jsx(AvlState, { x: 8, y: 8, name: fromState, role: getStateRole(fromState), width: 90, height: 26 }),
59782
- /* @__PURE__ */ jsx("line", { x1: 104, y1: 21, x2: 158, y2: 21, stroke: "var(--color-foreground)", strokeWidth: 2, markerEnd: "url(#orb-arrow)" }),
59783
- /* @__PURE__ */ jsx(AvlState, { x: 164, y: 8, name: toState, role: getStateRole(toState), width: 90, height: 26 }),
59784
- /* @__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)" }) }) })
59785
- ] }),
59786
- traitName && /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: [
59787
- traitName,
59788
- entityName ? t("orbInspector.onEntity", { entity: entityName }) : ""
59789
- ] })
59790
- ] }),
59791
- 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: [
59792
- /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlEvent, { x: 8, y: 8, size: 12 }) }),
59793
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-semibold text-xs", children: transitionEvent })
59794
- ] }) }),
59795
- 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: [
59796
- /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlGuard, { x: 8, y: 8, size: 12 }) }),
59797
- editable ? /* @__PURE__ */ jsx(
59798
- Input,
59799
- {
59800
- defaultValue: formatExpression(transition?.guard ?? guard),
59801
- placeholder: t("orbInspector.guardExpression"),
59802
- className: "flex-1 text-xs font-mono h-6",
59803
- onBlur: (e) => handleGuardChange(e.target.value)
59804
- }
59805
- ) : /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-mono text-xs text-muted-foreground", children: formatExpression(transition?.guard ?? guard) })
59806
- ] }) }),
59807
- userType === "architect" && (effectTypes.length > 0 || editable) && isExpanded && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
59808
- /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: [
59809
- t("avl.effects"),
59810
- " (",
59811
- effectTypes.length,
59812
- ")"
59813
- ] }),
59814
- /* @__PURE__ */ jsx(Box, { className: "flex flex-col gap-1.5", children: effectTypes.map((type, i) => {
59815
- const isKnown = KNOWN_EFFECTS.has(type);
59816
- const category = EFFECT_TYPE_TO_CATEGORY[type];
59817
- const catColor = category ? EFFECT_CATEGORY_COLORS[category] : void 0;
59818
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
59819
- /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs w-4 text-right shrink-0", children: [
59820
- i + 1,
59821
- "."
59822
- ] }),
59823
- isKnown && /* @__PURE__ */ jsx("svg", { width: 16, height: 16, children: /* @__PURE__ */ jsx(AvlEffect, { x: 8, y: 8, effectType: type, size: 6, showBackground: true }) }),
59824
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-xs flex-1", style: { color: catColor?.color }, children: effectSummary(type) }),
59825
- editable && /* @__PURE__ */ jsx(
59826
- Button,
59827
- {
59828
- variant: "ghost",
59829
- size: "sm",
59830
- onClick: () => handleRemoveEffect(i),
59831
- className: "shrink-0 p-0.5 h-6 w-6",
59832
- children: /* @__PURE__ */ jsx(Icon, { name: "x", size: "xs" })
59833
- }
59834
- )
59835
- ] }, i);
59836
- }) }),
59837
- editable && /* @__PURE__ */ jsx(AddEffectButton, { onAdd: handleAddEffect })
59838
- ] }),
59839
- userType === "architect" && patterns.length > 0 && !selectedPattern && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3", children: [
59840
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: "render-ui" }),
59841
- /* @__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: [
59842
- /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-xs", children: [
59843
- "slot: ",
59844
- entry.slot
59845
- ] }),
59846
- /* @__PURE__ */ jsx(OrbPatternTree, { config: entry.pattern, depth: 0 })
59847
- ] }, i)) })
59848
60415
  ] })
59849
60416
  ] })
59850
60417
  ) })
@@ -60043,6 +60610,133 @@ function TokenRow({ group, tokenKey, value, isColor, onPropChange }) {
60043
60610
  ] });
60044
60611
  }
60045
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
+
60046
60740
  // components/avl/organisms/FlowCanvas.tsx
60047
60741
  init_Box();
60048
60742
  init_Typography();
@@ -60260,7 +60954,7 @@ var TraitCardNodeInner = (props) => {
60260
60954
  }
60261
60955
  );
60262
60956
  };
60263
- var TraitCardNode = React94__default.memo(TraitCardNodeInner);
60957
+ var TraitCardNode = React95__default.memo(TraitCardNodeInner);
60264
60958
  TraitCardNode.displayName = "TraitCardNode";
60265
60959
 
60266
60960
  // components/avl/organisms/FlowCanvas.tsx
@@ -60309,7 +61003,10 @@ function FlowCanvasInner({
60309
61003
  userType = "builder",
60310
61004
  themeManifest,
60311
61005
  nodePositions,
60312
- onPositionsChange
61006
+ onPositionsChange,
61007
+ onSelectedNodeChange,
61008
+ onSelectedPatternChange,
61009
+ externalInspector = false
60313
61010
  }) {
60314
61011
  const { t } = useTranslate();
60315
61012
  const NODE_TYPES2 = useMemo(() => ({
@@ -60336,7 +61033,7 @@ function FlowCanvasInner({
60336
61033
  initialOrbital
60337
61034
  );
60338
61035
  const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
60339
- const screenSizeUserOverrideRef = React94__default.useRef(false);
61036
+ const screenSizeUserOverrideRef = React95__default.useRef(false);
60340
61037
  const [screenSize, setScreenSize] = useState(
60341
61038
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
60342
61039
  );
@@ -60353,15 +61050,23 @@ function FlowCanvasInner({
60353
61050
  screenSizeUserOverrideRef.current = true;
60354
61051
  setScreenSize(size);
60355
61052
  }, []);
60356
- const [selectedNode, setSelectedNode] = useState(initialSelectedNode ?? null);
60357
- 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]);
60358
61063
  const patternSelectionValue = useMemo(() => ({
60359
61064
  selected: selectedPattern,
60360
61065
  select: (p) => {
60361
61066
  setSelectedPattern(p);
60362
61067
  if (p) setSelectedNode(p.nodeData);
60363
61068
  }
60364
- }), [selectedPattern]);
61069
+ }), [selectedPattern, setSelectedNode, setSelectedPattern]);
60365
61070
  const [atBehaviorLevel, setAtBehaviorLevel] = useState(composeLevel === "behavior");
60366
61071
  const { composeNodes, composeEdges, overviewNodes, overviewEdges, expandedNodes, expandedEdges, behaviorExpandedNodes, behaviorExpandedEdges, traitExpandedNodes, traitExpandedEdges } = useMemo(() => {
60367
61072
  const t2 = perfStart("compose-graph");
@@ -60396,9 +61101,9 @@ function FlowCanvasInner({
60396
61101
  const [nodes, setNodes, onNodesChange] = useNodesState(activeNodes);
60397
61102
  const [edges, setEdges, onEdgesChange] = useEdgesState(activeEdges);
60398
61103
  const reactFlow = useReactFlow();
60399
- const savedPositionsRef = React94__default.useRef(nodePositions);
61104
+ const savedPositionsRef = React95__default.useRef(nodePositions);
60400
61105
  savedPositionsRef.current = nodePositions;
60401
- const nodesRef = React94__default.useRef(nodes);
61106
+ const nodesRef = React95__default.useRef(nodes);
60402
61107
  nodesRef.current = nodes;
60403
61108
  useEffect(() => {
60404
61109
  setEdges([]);
@@ -60472,10 +61177,10 @@ function FlowCanvasInner({
60472
61177
  const orbitalName = nodeData.orbitalName ?? node.id;
60473
61178
  onNodeClick?.({ level: "overview", orbital: orbitalName });
60474
61179
  onNodeSelect?.(orbitalName);
60475
- }, [level, expandedOrbital, onNodeClick, onNodeSelect]);
61180
+ }, [level, expandedOrbital, onNodeClick, onNodeSelect, setSelectedNode]);
60476
61181
  const handleClosePanel = useCallback(() => {
60477
61182
  setSelectedNode(null);
60478
- }, []);
61183
+ }, [setSelectedNode]);
60479
61184
  const handleKeyDown = useCallback((e) => {
60480
61185
  if (e.key === "Escape") {
60481
61186
  if (selectedNode) {
@@ -60500,7 +61205,7 @@ function FlowCanvasInner({
60500
61205
  setSelectedPattern(null);
60501
61206
  }
60502
61207
  }
60503
- }, [level, onLevelChange, selectedNode, selectedPattern, onPatternDelete, atBehaviorLevel, composeLevel, expandedOrbital]);
61208
+ }, [level, onLevelChange, selectedNode, selectedPattern, onPatternDelete, atBehaviorLevel, composeLevel, expandedOrbital, setSelectedNode]);
60504
61209
  useEffect(() => {
60505
61210
  document.addEventListener("keydown", handleKeyDown);
60506
61211
  return () => document.removeEventListener("keydown", handleKeyDown);
@@ -60523,7 +61228,7 @@ function FlowCanvasInner({
60523
61228
  setExpandedOrbital(void 0);
60524
61229
  setSelectedNode(null);
60525
61230
  }
60526
- }, [level, onLevelChange, selectedNode, composeLevel, atBehaviorLevel, expandedOrbital]);
61231
+ }, [level, onLevelChange, selectedNode, composeLevel, atBehaviorLevel, expandedOrbital, setSelectedNode]);
60527
61232
  const eventBus = useEventBus();
60528
61233
  const handleConnect = useCallback((connection) => {
60529
61234
  if (!connection.sourceHandle?.startsWith("event-") || !onEventWire) return;
@@ -60669,7 +61374,7 @@ function FlowCanvasInner({
60669
61374
  }
60670
61375
  )
60671
61376
  ] }),
60672
- selectedNode && /* @__PURE__ */ jsxs(Fragment, { children: [
61377
+ !externalInspector && selectedNode && /* @__PURE__ */ jsxs(Fragment, { children: [
60673
61378
  /* @__PURE__ */ jsx(
60674
61379
  Box,
60675
61380
  {
@@ -60735,7 +61440,7 @@ var ZoomBreadcrumb = ({
60735
61440
  if (eventName && band === "detail") {
60736
61441
  segments.push({ icon: "\u26A1", label: eventName });
60737
61442
  }
60738
- 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: [
60739
61444
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
60740
61445
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
60741
61446
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -61076,7 +61781,7 @@ var EventWireOverlay = ({
61076
61781
  containerW,
61077
61782
  containerH
61078
61783
  }) => {
61079
- const ids = React94__default.useMemo(() => {
61784
+ const ids = React95__default.useMemo(() => {
61080
61785
  avlOczWireId += 1;
61081
61786
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
61082
61787
  }, []);
@@ -61443,7 +62148,7 @@ var AvlOrbitalsCosmicZoom = ({
61443
62148
  borderRadius: 6,
61444
62149
  border: `1px solid ${color}`
61445
62150
  },
61446
- 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: [
61447
62152
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
61448
62153
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
61449
62154
  Box,
@@ -61933,4 +62638,4 @@ var AvlClickTarget = ({
61933
62638
  };
61934
62639
  AvlClickTarget.displayName = "AvlClickTarget";
61935
62640
 
61936
- 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 };