@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.
@@ -1,5 +1,5 @@
1
- import * as React87 from 'react';
2
- import React87__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React88 from 'react';
2
+ import React88__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { EventBusContext, useTraitScopeChain, RenderSlotProvider, useEntitySchemaOptional, useEntityBindingSnapshot, useTraitScope, TraitScopeProvider, useNavStack, useCurrentPagePath, useRenderSlot, useGameAudioContextOptional, matchPathAmong } from '@almadar/ui/providers';
4
4
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
5
5
  import { createContextFromBindings, interpolateValue } from '@almadar/runtime';
@@ -281,7 +281,7 @@ function resolveMarkerExpression(expression, entity, config, state) {
281
281
  function isPlainObject(value) {
282
282
  if (value === null || value === void 0 || typeof value !== "object") return false;
283
283
  if (Array.isArray(value)) return false;
284
- if (React87__default.isValidElement(value)) return false;
284
+ if (React88__default.isValidElement(value)) return false;
285
285
  if (value instanceof Date) return false;
286
286
  if (typeof value === "function") return false;
287
287
  return true;
@@ -290,7 +290,7 @@ function isEvaluatorResolvedData(value) {
290
290
  return evaluatorResolvedData.has(value);
291
291
  }
292
292
  function brandResolved(value) {
293
- if (value !== null && typeof value === "object" && !React87__default.isValidElement(value) && !(value instanceof Date)) {
293
+ if (value !== null && typeof value === "object" && !React88__default.isValidElement(value) && !(value instanceof Date)) {
294
294
  resolvedMarkerFree.add(value);
295
295
  }
296
296
  }
@@ -323,7 +323,7 @@ function walkValue(value, scopeTrait, entity, config, state) {
323
323
  }
324
324
  const resolved = resolveMarkerExpression(value.expression, entity, config, state);
325
325
  markerResolutionCache.set(value, { entity, config, state, resolved });
326
- if (resolved !== null && typeof resolved === "object" && !React87__default.isValidElement(resolved) && !(resolved instanceof Date)) {
326
+ if (resolved !== null && typeof resolved === "object" && !React88__default.isValidElement(resolved) && !(resolved instanceof Date)) {
327
327
  resolvedMarkerFree.add(resolved);
328
328
  evaluatorResolvedData.add(resolved);
329
329
  }
@@ -557,7 +557,7 @@ var init_Box = __esm({
557
557
  fixed: "fixed",
558
558
  sticky: "sticky"
559
559
  };
560
- Box = React87__default.forwardRef(
560
+ Box = React88__default.forwardRef(
561
561
  ({
562
562
  padding,
563
563
  paddingX,
@@ -622,7 +622,7 @@ var init_Box = __esm({
622
622
  onPointerDown?.(e);
623
623
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
624
624
  const isClickable = action || onClick;
625
- return React87__default.createElement(
625
+ return React88__default.createElement(
626
626
  Component,
627
627
  {
628
628
  ref,
@@ -839,7 +839,7 @@ var init_Icon = __esm({
839
839
  const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
840
840
  const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
841
841
  const family = useIconFamily();
842
- const RenderedComponent = React87__default.useMemo(() => {
842
+ const RenderedComponent = React88__default.useMemo(() => {
843
843
  if (directIcon) return null;
844
844
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
845
845
  }, [directIcon, effectiveName, family]);
@@ -968,7 +968,7 @@ var init_atlasSlice = __esm({
968
968
  }
969
969
  });
970
970
  function useAtlasSliceDataUrl(asset) {
971
- const [, bump] = React87.useReducer((x) => x + 1, 0);
971
+ const [, bump] = React88.useReducer((x) => x + 1, 0);
972
972
  if (!isAtlasAsset(asset)) return void 0;
973
973
  const key = `${asset.atlas}#${asset.sprite}`;
974
974
  const cached = sliceDataUrlCache.get(key);
@@ -1031,13 +1031,13 @@ function AtlasImage({
1031
1031
  style,
1032
1032
  "aria-hidden": ariaHidden
1033
1033
  }) {
1034
- const [, bump] = React87.useReducer((x) => x + 1, 0);
1035
- const canvasRef = React87.useRef(null);
1034
+ const [, bump] = React88.useReducer((x) => x + 1, 0);
1035
+ const canvasRef = React88.useRef(null);
1036
1036
  const sliced = isAtlasAsset(asset);
1037
1037
  const atlas = sliced ? getAtlas(asset.atlas, bump) : void 0;
1038
1038
  const img = sliced && asset?.url ? getSheetImage(asset.url, bump) : null;
1039
1039
  const rect = sliced && atlas ? subRectFor(atlas, asset.sprite) : null;
1040
- React87.useEffect(() => {
1040
+ React88.useEffect(() => {
1041
1041
  const canvas = canvasRef.current;
1042
1042
  if (!canvas || !img || !rect) return;
1043
1043
  canvas.width = rect.sw;
@@ -1113,7 +1113,7 @@ function resolveIconProp(value, sizeClass) {
1113
1113
  const IconComp = value;
1114
1114
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1115
1115
  }
1116
- if (React87__default.isValidElement(value)) {
1116
+ if (React88__default.isValidElement(value)) {
1117
1117
  return value;
1118
1118
  }
1119
1119
  if (typeof value === "object" && value !== null && isIconLike(value)) {
@@ -1190,7 +1190,7 @@ var init_Button = __esm({
1190
1190
  md: "h-icon-default w-icon-default",
1191
1191
  lg: "h-icon-default w-icon-default"
1192
1192
  };
1193
- Button = React87__default.forwardRef(
1193
+ Button = React88__default.forwardRef(
1194
1194
  ({
1195
1195
  className,
1196
1196
  variant = "primary",
@@ -1260,7 +1260,7 @@ var Dialog;
1260
1260
  var init_Dialog = __esm({
1261
1261
  "components/core/atoms/Dialog.tsx"() {
1262
1262
  init_cn();
1263
- Dialog = React87__default.forwardRef(
1263
+ Dialog = React88__default.forwardRef(
1264
1264
  ({
1265
1265
  role = "dialog",
1266
1266
  "aria-modal": ariaModal = true,
@@ -1471,7 +1471,7 @@ var init_Typography = __esm({
1471
1471
  if (format !== void 0 && format !== "none" && (typeof body === "string" || typeof body === "number" || body instanceof Date)) {
1472
1472
  body = formatValue(body, format);
1473
1473
  }
1474
- return React87__default.createElement(
1474
+ return React88__default.createElement(
1475
1475
  Component,
1476
1476
  {
1477
1477
  id,
@@ -1681,7 +1681,6 @@ var init_Modal = __esm({
1681
1681
  ),
1682
1682
  style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
1683
1683
  onClick: handleOverlayClick,
1684
- "aria-hidden": "true",
1685
1684
  children: /* @__PURE__ */ jsxs(
1686
1685
  Dialog,
1687
1686
  {
@@ -1916,7 +1915,7 @@ var init_Drawer = __esm({
1916
1915
  };
1917
1916
  const widthClass = width in sizeWidths ? sizeWidths[width] : "";
1918
1917
  const widthStyle = width in sizeWidths ? void 0 : { width };
1919
- const positionClasses = position === "right" ? "right-0 border-l" : "left-0 border-r";
1918
+ const positionClasses2 = position === "right" ? "right-0 border-l" : "left-0 border-r";
1920
1919
  const drawerSign = position === "right" ? 1 : -1;
1921
1920
  const slideTransform = position === "right" ? "translateX(100%)" : "translateX(-100%)";
1922
1921
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1938,7 +1937,7 @@ var init_Drawer = __esm({
1938
1937
  className: cn(
1939
1938
  "fixed top-0 bottom-0 z-50",
1940
1939
  "flex flex-col max-h-screen",
1941
- positionClasses,
1940
+ positionClasses2,
1942
1941
  widthClass,
1943
1942
  drawerAnim,
1944
1943
  className
@@ -2034,7 +2033,7 @@ var init_Badge = __esm({
2034
2033
  md: "px-2.5 py-1 text-sm",
2035
2034
  lg: "px-3 py-1.5 text-base"
2036
2035
  };
2037
- Badge = React87__default.forwardRef(
2036
+ Badge = React88__default.forwardRef(
2038
2037
  ({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
2039
2038
  const iconSizes3 = {
2040
2039
  sm: "h-icon-default w-icon-default",
@@ -2384,7 +2383,7 @@ var init_SvgFlow = __esm({
2384
2383
  width = 100,
2385
2384
  height = 100
2386
2385
  }) => {
2387
- const markerId = React87__default.useMemo(() => {
2386
+ const markerId = React88__default.useMemo(() => {
2388
2387
  flowIdCounter += 1;
2389
2388
  return `almadar-flow-arrow-${flowIdCounter}`;
2390
2389
  }, []);
@@ -2977,7 +2976,7 @@ var init_SvgRing = __esm({
2977
2976
  width = 100,
2978
2977
  height = 100
2979
2978
  }) => {
2980
- const gradientId = React87__default.useMemo(() => {
2979
+ const gradientId = React88__default.useMemo(() => {
2981
2980
  ringIdCounter += 1;
2982
2981
  return `almadar-ring-glow-${ringIdCounter}`;
2983
2982
  }, []);
@@ -3158,7 +3157,7 @@ var init_Input = __esm({
3158
3157
  init_cn();
3159
3158
  init_Icon();
3160
3159
  init_useEventBus();
3161
- Input = React87__default.forwardRef(
3160
+ Input = React88__default.forwardRef(
3162
3161
  ({
3163
3162
  className,
3164
3163
  inputType,
@@ -3182,9 +3181,9 @@ var init_Input = __esm({
3182
3181
  const eventBus = useEventBus();
3183
3182
  const type = inputType || htmlType || "text";
3184
3183
  const isDeclarative = typeof onChange === "string";
3185
- const [localValue, setLocalValue] = React87__default.useState(value);
3186
- const pendingEchoRef = React87__default.useRef(/* @__PURE__ */ new Set());
3187
- React87__default.useEffect(() => {
3184
+ const [localValue, setLocalValue] = React88__default.useState(value);
3185
+ const pendingEchoRef = React88__default.useRef(/* @__PURE__ */ new Set());
3186
+ React88__default.useEffect(() => {
3188
3187
  if (!isDeclarative) return;
3189
3188
  const incoming = value == null ? "" : String(value);
3190
3189
  if (pendingEchoRef.current.has(incoming)) {
@@ -3351,7 +3350,7 @@ var Label;
3351
3350
  var init_Label = __esm({
3352
3351
  "components/core/atoms/Label.tsx"() {
3353
3352
  init_cn();
3354
- Label = React87__default.forwardRef(
3353
+ Label = React88__default.forwardRef(
3355
3354
  ({ className, required, children, ...props }, ref) => {
3356
3355
  return /* @__PURE__ */ jsxs(
3357
3356
  "label",
@@ -3378,7 +3377,7 @@ var init_Textarea = __esm({
3378
3377
  "components/core/atoms/Textarea.tsx"() {
3379
3378
  init_cn();
3380
3379
  init_useEventBus();
3381
- Textarea = React87__default.forwardRef(
3380
+ Textarea = React88__default.forwardRef(
3382
3381
  ({ className, error, onChange, ...props }, ref) => {
3383
3382
  const eventBus = useEventBus();
3384
3383
  const handleChange = (e) => {
@@ -3432,6 +3431,7 @@ function NativeSelect({
3432
3431
  error,
3433
3432
  onChange,
3434
3433
  onValueChange,
3434
+ action,
3435
3435
  value,
3436
3436
  ...props
3437
3437
  }) {
@@ -3443,6 +3443,9 @@ function NativeSelect({
3443
3443
  onChange?.(e);
3444
3444
  }
3445
3445
  dispatchValueChange(onValueChange, eventBus, e.target.value);
3446
+ if (action) {
3447
+ eventBus.emit(`UI:${action}`, { value: e.target.value });
3448
+ }
3446
3449
  };
3447
3450
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3448
3451
  /* @__PURE__ */ jsxs(
@@ -3478,6 +3481,7 @@ function RichSelect({
3478
3481
  error,
3479
3482
  onChange,
3480
3483
  onValueChange,
3484
+ action,
3481
3485
  value,
3482
3486
  multiple,
3483
3487
  searchable,
@@ -3503,6 +3507,9 @@ function RichSelect({
3503
3507
  eventBus.emit(`UI:${onChange}`, { value: next });
3504
3508
  }
3505
3509
  dispatchValueChange(onValueChange, eventBus, next);
3510
+ if (action) {
3511
+ eventBus.emit(`UI:${action}`, { value: next });
3512
+ }
3506
3513
  };
3507
3514
  const clear = (e) => {
3508
3515
  e.stopPropagation();
@@ -3511,6 +3518,9 @@ function RichSelect({
3511
3518
  eventBus.emit(`UI:${onChange}`, { value: next });
3512
3519
  }
3513
3520
  dispatchValueChange(onValueChange, eventBus, next);
3521
+ if (action) {
3522
+ eventBus.emit(`UI:${action}`, { value: next });
3523
+ }
3514
3524
  };
3515
3525
  useEffect(() => {
3516
3526
  const handler = (e) => {
@@ -3617,7 +3627,7 @@ var init_Select = __esm({
3617
3627
  init_cn();
3618
3628
  init_Icon();
3619
3629
  init_useEventBus();
3620
- Select = React87__default.forwardRef(
3630
+ Select = React88__default.forwardRef(
3621
3631
  (props, _ref) => {
3622
3632
  const { multiple, searchable, clearable } = props;
3623
3633
  if (multiple || searchable || clearable) {
@@ -3634,7 +3644,7 @@ var init_Checkbox = __esm({
3634
3644
  "components/core/atoms/Checkbox.tsx"() {
3635
3645
  init_cn();
3636
3646
  init_useEventBus();
3637
- Checkbox = React87__default.forwardRef(
3647
+ Checkbox = React88__default.forwardRef(
3638
3648
  ({ className, label, id, onChange, ...props }, ref) => {
3639
3649
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3640
3650
  const eventBus = useEventBus();
@@ -3688,7 +3698,7 @@ var init_Spinner = __esm({
3688
3698
  md: "h-6 w-6",
3689
3699
  lg: "h-8 w-8"
3690
3700
  };
3691
- Spinner = React87__default.forwardRef(
3701
+ Spinner = React88__default.forwardRef(
3692
3702
  ({ className, size = "md", overlay, ...props }, ref) => {
3693
3703
  if (overlay) {
3694
3704
  return /* @__PURE__ */ jsx(
@@ -3778,7 +3788,7 @@ var init_Card = __esm({
3778
3788
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
3779
3789
  "tile-image-first": "p-0 overflow-hidden"
3780
3790
  };
3781
- Card = React87__default.forwardRef(
3791
+ Card = React88__default.forwardRef(
3782
3792
  ({
3783
3793
  className,
3784
3794
  variant = "bordered",
@@ -3827,9 +3837,9 @@ var init_Card = __esm({
3827
3837
  }
3828
3838
  );
3829
3839
  Card.displayName = "Card";
3830
- CardHeader = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3840
+ CardHeader = React88__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3831
3841
  CardHeader.displayName = "CardHeader";
3832
- CardTitle = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3842
+ CardTitle = React88__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3833
3843
  "h3",
3834
3844
  {
3835
3845
  ref,
@@ -3842,11 +3852,11 @@ var init_Card = __esm({
3842
3852
  }
3843
3853
  ));
3844
3854
  CardTitle.displayName = "CardTitle";
3845
- CardContent = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3855
+ CardContent = React88__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3846
3856
  CardContent.displayName = "CardContent";
3847
3857
  CardBody = CardContent;
3848
3858
  CardBody.displayName = "CardBody";
3849
- CardFooter = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3859
+ CardFooter = React88__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3850
3860
  "div",
3851
3861
  {
3852
3862
  ref,
@@ -3933,7 +3943,7 @@ var init_FilterPill = __esm({
3933
3943
  md: "w-3.5 h-3.5",
3934
3944
  lg: "w-4 h-4"
3935
3945
  };
3936
- FilterPill = React87__default.forwardRef(
3946
+ FilterPill = React88__default.forwardRef(
3937
3947
  ({
3938
3948
  className,
3939
3949
  variant = "default",
@@ -4062,8 +4072,8 @@ var init_Avatar = __esm({
4062
4072
  actionPayload
4063
4073
  }) => {
4064
4074
  const eventBus = useEventBus();
4065
- const [imgFailed, setImgFailed] = React87__default.useState(false);
4066
- React87__default.useEffect(() => {
4075
+ const [imgFailed, setImgFailed] = React88__default.useState(false);
4076
+ React88__default.useEffect(() => {
4067
4077
  setImgFailed(false);
4068
4078
  }, [src]);
4069
4079
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -4176,7 +4186,7 @@ var init_Center = __esm({
4176
4186
  as: Component = "div"
4177
4187
  }) => {
4178
4188
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
4179
- return React87__default.createElement(Component, {
4189
+ return React88__default.createElement(Component, {
4180
4190
  className: cn(
4181
4191
  inline ? "inline-flex" : "flex",
4182
4192
  horizontal && "justify-center",
@@ -4444,7 +4454,7 @@ var init_Radio = __esm({
4444
4454
  md: "w-2.5 h-2.5",
4445
4455
  lg: "w-3 h-3"
4446
4456
  };
4447
- Radio = React87__default.forwardRef(
4457
+ Radio = React88__default.forwardRef(
4448
4458
  ({
4449
4459
  label,
4450
4460
  helperText,
@@ -4461,12 +4471,12 @@ var init_Radio = __esm({
4461
4471
  onChange,
4462
4472
  ...props
4463
4473
  }, ref) => {
4464
- const reactId = React87__default.useId();
4474
+ const reactId = React88__default.useId();
4465
4475
  const baseId = id || `radio-${reactId}`;
4466
4476
  const hasError = !!error;
4467
4477
  const eventBus = useEventBus();
4468
- const [selected, setSelected] = React87__default.useState(value);
4469
- React87__default.useEffect(() => {
4478
+ const [selected, setSelected] = React88__default.useState(value);
4479
+ React88__default.useEffect(() => {
4470
4480
  if (value !== void 0) setSelected(value);
4471
4481
  }, [value]);
4472
4482
  const pick = (next, e) => {
@@ -4648,7 +4658,7 @@ var init_Switch = __esm({
4648
4658
  "components/core/atoms/Switch.tsx"() {
4649
4659
  "use client";
4650
4660
  init_cn();
4651
- Switch = React87.forwardRef(
4661
+ Switch = React88.forwardRef(
4652
4662
  ({
4653
4663
  checked,
4654
4664
  defaultChecked = false,
@@ -4659,10 +4669,10 @@ var init_Switch = __esm({
4659
4669
  name,
4660
4670
  className
4661
4671
  }, ref) => {
4662
- const [isChecked, setIsChecked] = React87.useState(
4672
+ const [isChecked, setIsChecked] = React88.useState(
4663
4673
  checked !== void 0 ? checked : defaultChecked
4664
4674
  );
4665
- React87.useEffect(() => {
4675
+ React88.useEffect(() => {
4666
4676
  if (checked !== void 0) {
4667
4677
  setIsChecked(checked);
4668
4678
  }
@@ -4825,7 +4835,7 @@ var init_Stack = __esm({
4825
4835
  };
4826
4836
  const isHorizontal = direction === "horizontal";
4827
4837
  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";
4828
- return React87__default.createElement(
4838
+ return React88__default.createElement(
4829
4839
  Component,
4830
4840
  {
4831
4841
  className: cn(
@@ -5025,7 +5035,7 @@ var Aside;
5025
5035
  var init_Aside = __esm({
5026
5036
  "components/core/atoms/Aside.tsx"() {
5027
5037
  init_cn();
5028
- Aside = React87__default.forwardRef(
5038
+ Aside = React88__default.forwardRef(
5029
5039
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
5030
5040
  );
5031
5041
  Aside.displayName = "Aside";
@@ -5104,9 +5114,9 @@ var init_LawReferenceTooltip = __esm({
5104
5114
  className
5105
5115
  }) => {
5106
5116
  const { t } = useTranslate();
5107
- const [isVisible, setIsVisible] = React87__default.useState(false);
5108
- const timeoutRef = React87__default.useRef(null);
5109
- const triggerRef = React87__default.useRef(null);
5117
+ const [isVisible, setIsVisible] = React88__default.useState(false);
5118
+ const timeoutRef = React88__default.useRef(null);
5119
+ const triggerRef = React88__default.useRef(null);
5110
5120
  const handleMouseEnter = () => {
5111
5121
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5112
5122
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -5117,7 +5127,7 @@ var init_LawReferenceTooltip = __esm({
5117
5127
  };
5118
5128
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
5119
5129
  const open = isVisible || revealed;
5120
- React87__default.useEffect(() => {
5130
+ React88__default.useEffect(() => {
5121
5131
  return () => {
5122
5132
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5123
5133
  };
@@ -5327,7 +5337,7 @@ var init_StatusDot = __esm({
5327
5337
  md: "w-2.5 h-2.5",
5328
5338
  lg: "w-3 h-3"
5329
5339
  };
5330
- StatusDot = React87__default.forwardRef(
5340
+ StatusDot = React88__default.forwardRef(
5331
5341
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
5332
5342
  return /* @__PURE__ */ jsx(
5333
5343
  "span",
@@ -5381,7 +5391,7 @@ var init_TrendIndicator = __esm({
5381
5391
  down: "trending-down",
5382
5392
  flat: "arrow-right"
5383
5393
  };
5384
- TrendIndicator = React87__default.forwardRef(
5394
+ TrendIndicator = React88__default.forwardRef(
5385
5395
  ({
5386
5396
  className,
5387
5397
  value,
@@ -5450,7 +5460,7 @@ var init_RangeSlider = __esm({
5450
5460
  md: "w-4 h-4",
5451
5461
  lg: "w-5 h-5"
5452
5462
  };
5453
- RangeSlider = React87__default.forwardRef(
5463
+ RangeSlider = React88__default.forwardRef(
5454
5464
  ({
5455
5465
  className,
5456
5466
  min = 0,
@@ -6107,7 +6117,7 @@ var init_ContentSection = __esm({
6107
6117
  md: "py-16",
6108
6118
  lg: "py-24"
6109
6119
  };
6110
- ContentSection = React87__default.forwardRef(
6120
+ ContentSection = React88__default.forwardRef(
6111
6121
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
6112
6122
  return /* @__PURE__ */ jsx(
6113
6123
  Box,
@@ -6641,7 +6651,7 @@ var init_AnimatedReveal = __esm({
6641
6651
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6642
6652
  "none": {}
6643
6653
  };
6644
- AnimatedReveal = React87__default.forwardRef(
6654
+ AnimatedReveal = React88__default.forwardRef(
6645
6655
  ({
6646
6656
  trigger = "scroll",
6647
6657
  animation = "fade-up",
@@ -6801,7 +6811,7 @@ var init_AnimatedGraphic = __esm({
6801
6811
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6802
6812
  "use client";
6803
6813
  init_cn();
6804
- AnimatedGraphic = React87__default.forwardRef(
6814
+ AnimatedGraphic = React88__default.forwardRef(
6805
6815
  ({
6806
6816
  src,
6807
6817
  svgContent,
@@ -6824,7 +6834,7 @@ var init_AnimatedGraphic = __esm({
6824
6834
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6825
6835
  const resolvedSvg = svgContent ?? fetchedSvg;
6826
6836
  const prevAnimateRef = useRef(animate);
6827
- const setRef = React87__default.useCallback(
6837
+ const setRef = React88__default.useCallback(
6828
6838
  (node) => {
6829
6839
  containerRef.current = node;
6830
6840
  if (typeof ref === "function") ref(node);
@@ -7577,9 +7587,9 @@ function ControlButton({
7577
7587
  className
7578
7588
  }) {
7579
7589
  const eventBus = useEventBus();
7580
- const [isPressed, setIsPressed] = React87.useState(false);
7590
+ const [isPressed, setIsPressed] = React88.useState(false);
7581
7591
  const actualPressed = pressed ?? isPressed;
7582
- const handlePointerDown = React87.useCallback(
7592
+ const handlePointerDown = React88.useCallback(
7583
7593
  (e) => {
7584
7594
  e.preventDefault();
7585
7595
  if (disabled) return;
@@ -7589,7 +7599,7 @@ function ControlButton({
7589
7599
  },
7590
7600
  [disabled, pressEvent, eventBus, onPress]
7591
7601
  );
7592
- const handlePointerUp = React87.useCallback(
7602
+ const handlePointerUp = React88.useCallback(
7593
7603
  (e) => {
7594
7604
  e.preventDefault();
7595
7605
  if (disabled) return;
@@ -7599,7 +7609,7 @@ function ControlButton({
7599
7609
  },
7600
7610
  [disabled, releaseEvent, eventBus, onRelease]
7601
7611
  );
7602
- const handlePointerLeave = React87.useCallback(
7612
+ const handlePointerLeave = React88.useCallback(
7603
7613
  (e) => {
7604
7614
  if (isPressed) {
7605
7615
  setIsPressed(false);
@@ -7858,18 +7868,18 @@ function ControlGrid({
7858
7868
  className
7859
7869
  }) {
7860
7870
  const eventBus = useEventBus();
7861
- const [active, setActive] = React87.useState(/* @__PURE__ */ new Set());
7862
- const [coarse, setCoarse] = React87.useState(
7871
+ const [active, setActive] = React88.useState(/* @__PURE__ */ new Set());
7872
+ const [coarse, setCoarse] = React88.useState(
7863
7873
  () => typeof window !== "undefined" && window.matchMedia("(pointer: coarse)").matches
7864
7874
  );
7865
- React87.useEffect(() => {
7875
+ React88.useEffect(() => {
7866
7876
  if (visibility !== "auto" || typeof window === "undefined") return;
7867
7877
  const mq = window.matchMedia("(pointer: coarse)");
7868
7878
  const onChange = (e) => setCoarse(e.matches);
7869
7879
  mq.addEventListener("change", onChange);
7870
7880
  return () => mq.removeEventListener("change", onChange);
7871
7881
  }, [visibility]);
7872
- const handlePress = React87.useCallback(
7882
+ const handlePress = React88.useCallback(
7873
7883
  (id) => {
7874
7884
  setActive((prev) => new Set(prev).add(id));
7875
7885
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -7883,7 +7893,7 @@ function ControlGrid({
7883
7893
  },
7884
7894
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
7885
7895
  );
7886
- const handleRelease = React87.useCallback(
7896
+ const handleRelease = React88.useCallback(
7887
7897
  (id) => {
7888
7898
  setActive((prev) => {
7889
7899
  const next = new Set(prev);
@@ -8246,7 +8256,7 @@ function GameMenu({
8246
8256
  }) {
8247
8257
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
8248
8258
  const eventBus = useEventBus();
8249
- const handleOptionClick = React87.useCallback(
8259
+ const handleOptionClick = React88.useCallback(
8250
8260
  (option) => {
8251
8261
  if (option.event) {
8252
8262
  eventBus.emit(`UI:${option.event}`, { option });
@@ -8482,7 +8492,7 @@ function StateGraph({
8482
8492
  }) {
8483
8493
  const eventBus = useEventBus();
8484
8494
  const nodes = states ?? [];
8485
- const positions = React87.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8495
+ const positions = React88.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8486
8496
  return /* @__PURE__ */ jsxs(
8487
8497
  Box,
8488
8498
  {
@@ -8553,8 +8563,8 @@ function MiniMap({
8553
8563
  tileAssets,
8554
8564
  unitAssets
8555
8565
  }) {
8556
- const canvasRef = React87.useRef(null);
8557
- const imgCacheRef = React87.useRef(/* @__PURE__ */ new Map());
8566
+ const canvasRef = React88.useRef(null);
8567
+ const imgCacheRef = React88.useRef(/* @__PURE__ */ new Map());
8558
8568
  function loadImg(url) {
8559
8569
  const cached = imgCacheRef.current.get(url);
8560
8570
  if (cached) return cached.complete ? cached : null;
@@ -8570,7 +8580,7 @@ function MiniMap({
8570
8580
  imgCacheRef.current.set(url, img);
8571
8581
  return null;
8572
8582
  }
8573
- React87.useEffect(() => {
8583
+ React88.useEffect(() => {
8574
8584
  const canvas = canvasRef.current;
8575
8585
  if (!canvas) return;
8576
8586
  const ctx = canvas.getContext("2d");
@@ -9804,7 +9814,7 @@ function proceduralShapes(view, pos, fade, progress) {
9804
9814
  }
9805
9815
  }
9806
9816
  }
9807
- function expandFxItem(view, node, epochNowMs, dim) {
9817
+ function expandFxItem(view, node, epochNowMs, dim, projector, fontFamily) {
9808
9818
  if (view.space === "screen") return [];
9809
9819
  const tickMs = node.tickMs ?? DEFAULT_TICK_MS;
9810
9820
  const { ageMs, progress, fade } = fxLifecycle(view, epochNowMs, tickMs);
@@ -9840,24 +9850,27 @@ function expandFxItem(view, node, epochNowMs, dim) {
9840
9850
  out.push(...proceduralShapes(view, pos, fade, progress));
9841
9851
  }
9842
9852
  if (view.message) {
9853
+ const pxSize = projector && view.size !== void 0 ? Math.max(10, Math.round(view.size * projector.tileWidth)) : void 0;
9854
+ const family = fontFamily ?? "system-ui, sans-serif";
9843
9855
  const text = {
9844
9856
  type: "draw-text",
9845
9857
  text: view.message,
9846
9858
  position: pos,
9847
9859
  offsetY: -(0.15 + 0.55 * progress),
9848
9860
  color: view.color ?? node.textColor ?? DEFAULT_TEXT_COLOR,
9849
- opacity: fade
9861
+ opacity: fade,
9862
+ font: `bold ${pxSize ?? 14}px ${family}`
9850
9863
  };
9851
9864
  out.push(text);
9852
9865
  }
9853
9866
  return out;
9854
9867
  }
9855
- function expandFxLayer(node, epochNowMs, dim) {
9868
+ function expandFxLayer(node, epochNowMs, dim, projector, fontFamily) {
9856
9869
  if (!Array.isArray(node.items)) return [];
9857
9870
  const out = [];
9858
9871
  for (const item of node.items) {
9859
9872
  if (!item || typeof item.id !== "string") continue;
9860
- out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim));
9873
+ out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim, projector, fontFamily));
9861
9874
  }
9862
9875
  return out;
9863
9876
  }
@@ -9924,7 +9937,7 @@ function paintDrawable(painter, node, dctx) {
9924
9937
  break;
9925
9938
  case "draw-fx-layer": {
9926
9939
  const epochNow = dctx.time > 0 && typeof performance !== "undefined" ? performance.timeOrigin + dctx.time : 0;
9927
- for (const child of expandFxLayer(node, epochNow, "2d")) paintDrawable(painter, child, dctx);
9940
+ for (const child of expandFxLayer(node, epochNow, "2d", dctx.projector, dctx.fontFamily)) paintDrawable(painter, child, dctx);
9928
9941
  break;
9929
9942
  }
9930
9943
  }
@@ -10034,7 +10047,7 @@ function Canvas2D({
10034
10047
  const registerChildDrawable = useCallback((node) => {
10035
10048
  childDrawablesRef.current.push(node);
10036
10049
  }, []);
10037
- const hasJsxChildren = React87.Children.count(children) > 0;
10050
+ const hasJsxChildren = React88.Children.count(children) > 0;
10038
10051
  function isDrawableLayer(node) {
10039
10052
  return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
10040
10053
  }
@@ -10592,7 +10605,7 @@ function Canvas({
10592
10605
  if (mode !== "3d") return;
10593
10606
  const next = childDrawablesRef.current;
10594
10607
  canvasLog.debug("children:adopt", { registered: next.length, adopted: childDrawables.length });
10595
- if (next.length === 0 && React87.Children.count(children) > 0) return;
10608
+ if (next.length === 0 && React88.Children.count(children) > 0) return;
10596
10609
  setChildDrawables(
10597
10610
  (prev) => prev.length === next.length && JSON.stringify(prev) === JSON.stringify(next) ? prev : [...next]
10598
10611
  );
@@ -10630,7 +10643,7 @@ function Canvas({
10630
10643
  };
10631
10644
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10632
10645
  /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Canvas3DHost, { ...props3d }) }),
10633
- React87.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 }) })
10646
+ React88.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 }) })
10634
10647
  ] });
10635
10648
  }
10636
10649
  return /* @__PURE__ */ jsx(
@@ -11055,7 +11068,7 @@ function LinearView({
11055
11068
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
11056
11069
  const isDone = i < currentIdx;
11057
11070
  const isCurrent = i === currentIdx;
11058
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
11071
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
11059
11072
  i > 0 && /* @__PURE__ */ jsx(
11060
11073
  Typography,
11061
11074
  {
@@ -11590,7 +11603,7 @@ function SequenceBar({
11590
11603
  else onSlotRemove?.(index);
11591
11604
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
11592
11605
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
11593
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
11606
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
11594
11607
  i > 0 && /* @__PURE__ */ jsx(
11595
11608
  Typography,
11596
11609
  {
@@ -12279,7 +12292,7 @@ var init_LearningCanvas = __esm({
12279
12292
  if (drawables?.length && projector) {
12280
12293
  const painter = createWebPainter(ctx, invalidateRef.current);
12281
12294
  const timeMs = needsAnim && typeof performance !== "undefined" ? performance.now() : 0;
12282
- const dctx = { projector, time: timeMs, invalidate: invalidateRef.current };
12295
+ const dctx = { projector, time: timeMs, invalidate: invalidateRef.current, fontFamily: themeBodyFont(canvas) };
12283
12296
  for (const node of drawables) {
12284
12297
  paintDrawable(painter, node, dctx);
12285
12298
  }
@@ -12441,7 +12454,7 @@ var init_ErrorBoundary = __esm({
12441
12454
  }
12442
12455
  );
12443
12456
  };
12444
- ErrorBoundary = class extends React87__default.Component {
12457
+ ErrorBoundary = class extends React88__default.Component {
12445
12458
  constructor(props) {
12446
12459
  super(props);
12447
12460
  __publicField(this, "reset", () => {
@@ -13093,7 +13106,7 @@ var init_Container = __esm({
13093
13106
  as: Component = "div"
13094
13107
  }) => {
13095
13108
  const resolvedSize = maxWidth ?? size ?? "lg";
13096
- return React87__default.createElement(
13109
+ return React88__default.createElement(
13097
13110
  Component,
13098
13111
  {
13099
13112
  className: cn(
@@ -14030,7 +14043,7 @@ var init_FloatingActionButton = __esm({
14030
14043
  document.addEventListener("mousedown", handleClickOutside);
14031
14044
  return () => document.removeEventListener("mousedown", handleClickOutside);
14032
14045
  }, [isExpanded, actions]);
14033
- const positionClasses = {
14046
+ const positionClasses2 = {
14034
14047
  "bottom-right": "bottom-6 right-6",
14035
14048
  "bottom-left": "bottom-6 left-6",
14036
14049
  "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
@@ -14039,7 +14052,7 @@ var init_FloatingActionButton = __esm({
14039
14052
  "top-center": "top-6 left-1/2 -translate-x-1/2"
14040
14053
  };
14041
14054
  if (resolvedAction && (!actions || actions.length === 0)) {
14042
- return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses[position], className), children: /* @__PURE__ */ jsx(
14055
+ return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses2[position], className), children: /* @__PURE__ */ jsx(
14043
14056
  Button,
14044
14057
  {
14045
14058
  variant: resolvedAction.variant || "primary",
@@ -14067,7 +14080,7 @@ var init_FloatingActionButton = __esm({
14067
14080
  ref: fabRef,
14068
14081
  className: cn(
14069
14082
  "fixed z-50 flex flex-col items-end gap-3",
14070
- positionClasses[position],
14083
+ positionClasses2[position],
14071
14084
  position.includes("left") && "items-start",
14072
14085
  className
14073
14086
  ),
@@ -17003,9 +17016,11 @@ var init_Tabs = __esm({
17003
17016
  }
17004
17017
  };
17005
17018
  const handleKeyDown = (e, index) => {
17006
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
17019
+ const prevKey = orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
17020
+ const nextKey = orientation === "vertical" ? "ArrowDown" : "ArrowRight";
17021
+ if (e.key === prevKey || e.key === nextKey) {
17007
17022
  e.preventDefault();
17008
- const direction = e.key === "ArrowLeft" ? -1 : 1;
17023
+ const direction = e.key === prevKey ? -1 : 1;
17009
17024
  const nextIndex = (index + direction + safeItems.length) % safeItems.length;
17010
17025
  const nextTab = safeItems[nextIndex];
17011
17026
  if (nextTab && !nextTab.disabled) {
@@ -17577,7 +17592,7 @@ var init_CodeBlock = __esm({
17577
17592
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
17578
17593
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
17579
17594
  HIDDEN_LINE_NUMBERS = { display: "none" };
17580
- CodeBlock = React87__default.memo(
17595
+ CodeBlock = React88__default.memo(
17581
17596
  ({
17582
17597
  code: rawCode,
17583
17598
  language = "text",
@@ -18160,14 +18175,77 @@ var init_CodeBlock = __esm({
18160
18175
  CodeBlock.displayName = "CodeBlock";
18161
18176
  }
18162
18177
  });
18178
+ function loadMermaid() {
18179
+ mermaidModule ?? (mermaidModule = import('mermaid').then((m) => m.default));
18180
+ return mermaidModule;
18181
+ }
18182
+ var mermaidModule, MermaidDiagram;
18183
+ var init_MermaidDiagram = __esm({
18184
+ "components/core/molecules/markdown/MermaidDiagram.tsx"() {
18185
+ init_Box();
18186
+ init_Typography();
18187
+ init_CodeBlock();
18188
+ init_cn();
18189
+ mermaidModule = null;
18190
+ MermaidDiagram = React88__default.memo(
18191
+ ({ code, className }) => {
18192
+ const { resolvedMode } = useTheme();
18193
+ const containerRef = useRef(null);
18194
+ const [error, setError] = useState(null);
18195
+ const reactId = useId();
18196
+ useEffect(() => {
18197
+ let active = true;
18198
+ void (async () => {
18199
+ try {
18200
+ const mermaid = await loadMermaid();
18201
+ mermaid.initialize({
18202
+ startOnLoad: false,
18203
+ securityLevel: "strict",
18204
+ theme: resolvedMode === "dark" ? "dark" : "default"
18205
+ });
18206
+ const domId = `mermaid-${reactId.replace(/[^a-zA-Z0-9]/g, "")}`;
18207
+ const { svg } = await mermaid.render(domId, code);
18208
+ if (!active || !containerRef.current) return;
18209
+ containerRef.current.innerHTML = svg;
18210
+ setError(null);
18211
+ } catch (err) {
18212
+ if (active) setError(err instanceof Error ? err.message : String(err));
18213
+ }
18214
+ })();
18215
+ return () => {
18216
+ active = false;
18217
+ };
18218
+ }, [code, resolvedMode, reactId]);
18219
+ return /* @__PURE__ */ jsxs(Box, { className: cn("not-prose my-4", className), children: [
18220
+ error !== null && /* @__PURE__ */ jsxs(Box, { className: "space-y-2 mb-2", children: [
18221
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error whitespace-pre-wrap", children: error }),
18222
+ /* @__PURE__ */ jsx(CodeBlock, { code, language: "mermaid" })
18223
+ ] }),
18224
+ /* @__PURE__ */ jsx(
18225
+ Box,
18226
+ {
18227
+ ref: containerRef,
18228
+ "data-testid": "mermaid-diagram",
18229
+ className: "overflow-x-auto",
18230
+ style: error !== null ? { display: "none" } : void 0
18231
+ }
18232
+ )
18233
+ ] });
18234
+ },
18235
+ (prev, next) => prev.code === next.code && prev.className === next.className
18236
+ );
18237
+ MermaidDiagram.displayName = "MermaidDiagram";
18238
+ }
18239
+ });
18163
18240
  var MarkdownContent;
18164
18241
  var init_MarkdownContent = __esm({
18165
18242
  "components/core/molecules/markdown/MarkdownContent.tsx"() {
18166
18243
  init_katex_min();
18167
18244
  init_Box();
18168
18245
  init_CodeBlock();
18246
+ init_MermaidDiagram();
18169
18247
  init_cn();
18170
- MarkdownContent = React87__default.memo(
18248
+ MarkdownContent = React88__default.memo(
18171
18249
  ({ content, direction = "ltr", className }) => {
18172
18250
  const { t: _t } = useTranslate();
18173
18251
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -18212,6 +18290,9 @@ var init_MarkdownContent = __esm({
18212
18290
  if (!inline) {
18213
18291
  const match = /language-(\w+)/.exec(codeClassName ?? "");
18214
18292
  const code = String(children).replace(/\n$/, "");
18293
+ if (match?.[1] === "mermaid") {
18294
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code });
18295
+ }
18215
18296
  if (match) {
18216
18297
  return /* @__PURE__ */ jsx(
18217
18298
  CodeBlock,
@@ -19494,7 +19575,7 @@ var init_StateMachineView = __esm({
19494
19575
  style: { top: title ? 30 : 0 },
19495
19576
  children: [
19496
19577
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
19497
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React87__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
19578
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React88__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
19498
19579
  StateNode2,
19499
19580
  {
19500
19581
  state,
@@ -25683,7 +25764,7 @@ var init_Menu = __esm({
25683
25764
  "bottom-end": "bottom-start"
25684
25765
  };
25685
25766
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
25686
- const triggerElement = React87__default.isValidElement(trigger) ? React87__default.cloneElement(trigger, {
25767
+ const triggerElement = React88__default.isValidElement(trigger) ? React88__default.cloneElement(trigger, {
25687
25768
  ref: triggerRef,
25688
25769
  onClick: handleToggle
25689
25770
  }) : /* @__PURE__ */ jsx(
@@ -25786,14 +25867,14 @@ function useDataDnd(args) {
25786
25867
  const isZone = Boolean(dragGroup || accepts || sortable);
25787
25868
  const enabled = isZone || Boolean(dndRoot);
25788
25869
  const eventBus = useEventBus();
25789
- const parentRoot = React87__default.useContext(RootCtx);
25870
+ const parentRoot = React88__default.useContext(RootCtx);
25790
25871
  const isRoot = enabled && parentRoot === null;
25791
- const zoneId = React87__default.useId();
25872
+ const zoneId = React88__default.useId();
25792
25873
  const ownGroup = dragGroup ?? accepts ?? zoneId;
25793
- const [optimisticOrders, setOptimisticOrders] = React87__default.useState(() => /* @__PURE__ */ new Map());
25794
- const optimisticOrdersRef = React87__default.useRef(optimisticOrders);
25874
+ const [optimisticOrders, setOptimisticOrders] = React88__default.useState(() => /* @__PURE__ */ new Map());
25875
+ const optimisticOrdersRef = React88__default.useRef(optimisticOrders);
25795
25876
  optimisticOrdersRef.current = optimisticOrders;
25796
- const clearOptimisticOrder = React87__default.useCallback((group) => {
25877
+ const clearOptimisticOrder = React88__default.useCallback((group) => {
25797
25878
  setOptimisticOrders((prev) => {
25798
25879
  if (!prev.has(group)) return prev;
25799
25880
  const next = new Map(prev);
@@ -25818,7 +25899,7 @@ function useDataDnd(args) {
25818
25899
  const raw = it[dndItemIdField];
25819
25900
  return raw != null ? String(raw) : `__idx_${idx}`;
25820
25901
  }).join("|");
25821
- const itemIds = React87__default.useMemo(
25902
+ const itemIds = React88__default.useMemo(
25822
25903
  () => orderedItems.map((it, idx) => {
25823
25904
  const raw = it[dndItemIdField];
25824
25905
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -25829,7 +25910,7 @@ function useDataDnd(args) {
25829
25910
  const raw = it[dndItemIdField];
25830
25911
  return raw != null ? String(raw) : `__${idx}`;
25831
25912
  }).join("|");
25832
- React87__default.useEffect(() => {
25913
+ React88__default.useEffect(() => {
25833
25914
  const root = isRoot ? null : parentRoot;
25834
25915
  if (root) {
25835
25916
  root.clearOptimisticOrder(ownGroup);
@@ -25837,20 +25918,20 @@ function useDataDnd(args) {
25837
25918
  clearOptimisticOrder(ownGroup);
25838
25919
  }
25839
25920
  }, [itemsContentSig, ownGroup]);
25840
- const zonesRef = React87__default.useRef(/* @__PURE__ */ new Map());
25841
- const registerZone = React87__default.useCallback((zoneId2, meta2) => {
25921
+ const zonesRef = React88__default.useRef(/* @__PURE__ */ new Map());
25922
+ const registerZone = React88__default.useCallback((zoneId2, meta2) => {
25842
25923
  zonesRef.current.set(zoneId2, meta2);
25843
25924
  }, []);
25844
- const unregisterZone = React87__default.useCallback((zoneId2) => {
25925
+ const unregisterZone = React88__default.useCallback((zoneId2) => {
25845
25926
  zonesRef.current.delete(zoneId2);
25846
25927
  }, []);
25847
- const [activeDrag, setActiveDrag] = React87__default.useState(null);
25848
- const [overZoneGroup, setOverZoneGroup] = React87__default.useState(null);
25849
- const meta = React87__default.useMemo(
25928
+ const [activeDrag, setActiveDrag] = React88__default.useState(null);
25929
+ const [overZoneGroup, setOverZoneGroup] = React88__default.useState(null);
25930
+ const meta = React88__default.useMemo(
25850
25931
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
25851
25932
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
25852
25933
  );
25853
- React87__default.useEffect(() => {
25934
+ React88__default.useEffect(() => {
25854
25935
  const target = isRoot ? null : parentRoot;
25855
25936
  if (!target) {
25856
25937
  zonesRef.current.set(zoneId, meta);
@@ -25869,7 +25950,7 @@ function useDataDnd(args) {
25869
25950
  }, [parentRoot, isRoot, zoneId, meta]);
25870
25951
  const sensors = useAlmadarDndSensors(true);
25871
25952
  const collisionDetection = almadarDndCollisionDetection;
25872
- const findZoneByItem = React87__default.useCallback(
25953
+ const findZoneByItem = React88__default.useCallback(
25873
25954
  (id) => {
25874
25955
  for (const z of zonesRef.current.values()) {
25875
25956
  if (z.itemIds.includes(id)) return z;
@@ -25878,7 +25959,7 @@ function useDataDnd(args) {
25878
25959
  },
25879
25960
  []
25880
25961
  );
25881
- React87__default.useCallback(
25962
+ React88__default.useCallback(
25882
25963
  (group) => {
25883
25964
  for (const z of zonesRef.current.values()) {
25884
25965
  if (z.group === group) return z;
@@ -25887,7 +25968,7 @@ function useDataDnd(args) {
25887
25968
  },
25888
25969
  []
25889
25970
  );
25890
- const handleDragEnd = React87__default.useCallback(
25971
+ const handleDragEnd = React88__default.useCallback(
25891
25972
  (event) => {
25892
25973
  const { active, over } = event;
25893
25974
  const activeIdStr = String(active.id);
@@ -25978,8 +26059,8 @@ function useDataDnd(args) {
25978
26059
  },
25979
26060
  [eventBus]
25980
26061
  );
25981
- const sortableData = React87__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
25982
- const SortableItem = React87__default.useCallback(
26062
+ const sortableData = React88__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
26063
+ const SortableItem = React88__default.useCallback(
25983
26064
  ({ id, children }) => {
25984
26065
  const {
25985
26066
  attributes,
@@ -26019,7 +26100,7 @@ function useDataDnd(args) {
26019
26100
  id: droppableId,
26020
26101
  data: sortableData
26021
26102
  });
26022
- const ctx = React87__default.useContext(RootCtx);
26103
+ const ctx = React88__default.useContext(RootCtx);
26023
26104
  const activeDrag2 = ctx?.activeDrag ?? null;
26024
26105
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
26025
26106
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -26034,7 +26115,7 @@ function useDataDnd(args) {
26034
26115
  showForeignPlaceholder,
26035
26116
  ctxAvailable: ctx != null
26036
26117
  });
26037
- React87__default.useEffect(() => {
26118
+ React88__default.useEffect(() => {
26038
26119
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
26039
26120
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
26040
26121
  return /* @__PURE__ */ jsx(
@@ -26048,11 +26129,11 @@ function useDataDnd(args) {
26048
26129
  }
26049
26130
  );
26050
26131
  };
26051
- const rootContextValue = React87__default.useMemo(
26132
+ const rootContextValue = React88__default.useMemo(
26052
26133
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
26053
26134
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
26054
26135
  );
26055
- const handleDragStart = React87__default.useCallback((event) => {
26136
+ const handleDragStart = React88__default.useCallback((event) => {
26056
26137
  const sourceZone = findZoneByItem(event.active.id);
26057
26138
  const rect = event.active.rect.current.initial;
26058
26139
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -26071,7 +26152,7 @@ function useDataDnd(args) {
26071
26152
  isRoot
26072
26153
  });
26073
26154
  }, [findZoneByItem, isRoot, zoneId]);
26074
- const handleDragOver = React87__default.useCallback((event) => {
26155
+ const handleDragOver = React88__default.useCallback((event) => {
26075
26156
  const { active, over } = event;
26076
26157
  const overData = over?.data?.current;
26077
26158
  const overGroup = overData?.dndGroup ?? null;
@@ -26141,7 +26222,7 @@ function useDataDnd(args) {
26141
26222
  return next;
26142
26223
  });
26143
26224
  }, []);
26144
- const handleDragCancel = React87__default.useCallback((event) => {
26225
+ const handleDragCancel = React88__default.useCallback((event) => {
26145
26226
  setActiveDrag(null);
26146
26227
  setOverZoneGroup(null);
26147
26228
  dndLog.warn("dragCancel", {
@@ -26149,12 +26230,12 @@ function useDataDnd(args) {
26149
26230
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
26150
26231
  });
26151
26232
  }, []);
26152
- const handleDragEndWithCleanup = React87__default.useCallback((event) => {
26233
+ const handleDragEndWithCleanup = React88__default.useCallback((event) => {
26153
26234
  handleDragEnd(event);
26154
26235
  setActiveDrag(null);
26155
26236
  setOverZoneGroup(null);
26156
26237
  }, [handleDragEnd]);
26157
- const wrapContainer = React87__default.useCallback(
26238
+ const wrapContainer = React88__default.useCallback(
26158
26239
  (children) => {
26159
26240
  if (!enabled) return children;
26160
26241
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -26208,7 +26289,7 @@ var init_useDataDnd = __esm({
26208
26289
  init_useAlmadarDndCollision();
26209
26290
  init_Box();
26210
26291
  dndLog = createLogger("almadar:ui:dnd");
26211
- RootCtx = React87__default.createContext(null);
26292
+ RootCtx = React88__default.createContext(null);
26212
26293
  }
26213
26294
  });
26214
26295
  function renderIconInput(icon, props) {
@@ -26723,7 +26804,7 @@ function DataList({
26723
26804
  }) {
26724
26805
  const eventBus = useEventBus();
26725
26806
  const { t } = useTranslate();
26726
- const [visibleCount, setVisibleCount] = React87__default.useState(pageSize || Infinity);
26807
+ const [visibleCount, setVisibleCount] = React88__default.useState(pageSize || Infinity);
26727
26808
  const fieldDefs = fields ?? columns ?? [];
26728
26809
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
26729
26810
  const dnd = useDataDnd({
@@ -26739,14 +26820,14 @@ function DataList({
26739
26820
  dndRoot
26740
26821
  });
26741
26822
  const orderedData = dnd.orderedItems;
26742
- const allData = React87__default.useMemo(
26823
+ const allData = React88__default.useMemo(
26743
26824
  () => sortRows(orderedData, sortBy, sortDirection),
26744
26825
  [orderedData, sortBy, sortDirection]
26745
26826
  );
26746
26827
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
26747
26828
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
26748
26829
  const hasRenderProp = typeof children === "function";
26749
- React87__default.useEffect(() => {
26830
+ React88__default.useEffect(() => {
26750
26831
  const renderItemTypeOf = typeof schemaRenderItem;
26751
26832
  const childrenTypeOf = typeof children;
26752
26833
  if (data.length > 0 && !hasRenderProp) {
@@ -26866,7 +26947,7 @@ function DataList({
26866
26947
  return v === void 0 || v === null || v === "" ? raw : String(v);
26867
26948
  };
26868
26949
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
26869
- groups2.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
26950
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
26870
26951
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
26871
26952
  group.items.map((itemData, index) => {
26872
26953
  const id = itemData.id || `${gi}-${index}`;
@@ -27082,7 +27163,7 @@ function DataList({
27082
27163
  className
27083
27164
  ),
27084
27165
  children: [
27085
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
27166
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
27086
27167
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
27087
27168
  group.items.map(
27088
27169
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -27169,7 +27250,7 @@ var init_FormSection = __esm({
27169
27250
  columns = 1,
27170
27251
  className
27171
27252
  }) => {
27172
- const [collapsed, setCollapsed] = React87__default.useState(defaultCollapsed);
27253
+ const [collapsed, setCollapsed] = React88__default.useState(defaultCollapsed);
27173
27254
  const { t } = useTranslate();
27174
27255
  const eventBus = useEventBus();
27175
27256
  const gridClass = {
@@ -27177,7 +27258,7 @@ var init_FormSection = __esm({
27177
27258
  2: "grid-cols-1 md:grid-cols-2",
27178
27259
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
27179
27260
  }[columns];
27180
- React87__default.useCallback(() => {
27261
+ React88__default.useCallback(() => {
27181
27262
  if (collapsible) {
27182
27263
  setCollapsed((prev) => !prev);
27183
27264
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -27450,6 +27531,112 @@ var init_GridPicker = __esm({
27450
27531
  GridPicker.displayName = "GridPicker";
27451
27532
  }
27452
27533
  });
27534
+ function useDraggable({ payload, disabled = false }) {
27535
+ const [isDragging, setIsDragging] = useState(false);
27536
+ const eventBus = useEventBus();
27537
+ const handleDragStart = useCallback(
27538
+ (e) => {
27539
+ if (disabled) {
27540
+ e.preventDefault();
27541
+ return;
27542
+ }
27543
+ e.dataTransfer.setData(ALMADAR_DND_MIME, JSON.stringify(payload));
27544
+ e.dataTransfer.effectAllowed = "copy";
27545
+ setIsDragging(true);
27546
+ eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
27547
+ },
27548
+ [disabled, payload, eventBus]
27549
+ );
27550
+ const handleDragEnd = useCallback(
27551
+ (e) => {
27552
+ setIsDragging(false);
27553
+ eventBus.emit("UI:DRAG_END", { kind: payload.kind, data: payload.data });
27554
+ },
27555
+ [payload, eventBus]
27556
+ );
27557
+ const dragProps = useMemo(
27558
+ () => ({
27559
+ draggable: !disabled,
27560
+ onDragStart: handleDragStart,
27561
+ onDragEnd: handleDragEnd,
27562
+ "aria-grabbed": isDragging
27563
+ }),
27564
+ [disabled, handleDragStart, handleDragEnd, isDragging]
27565
+ );
27566
+ return { dragProps, isDragging };
27567
+ }
27568
+ var ALMADAR_DND_MIME;
27569
+ var init_useDraggable = __esm({
27570
+ "hooks/useDraggable.ts"() {
27571
+ "use client";
27572
+ init_useEventBus();
27573
+ ALMADAR_DND_MIME = "application/x-almadar-dnd";
27574
+ }
27575
+ });
27576
+ function parsePayload(e) {
27577
+ try {
27578
+ const raw = e.dataTransfer.getData(ALMADAR_DND_MIME);
27579
+ if (!raw) return null;
27580
+ const parsed = JSON.parse(raw);
27581
+ if (typeof parsed.kind !== "string" || !parsed.data) return null;
27582
+ return parsed;
27583
+ } catch {
27584
+ return null;
27585
+ }
27586
+ }
27587
+ function hasAlmadarPayload(e) {
27588
+ return e.dataTransfer.types.includes(ALMADAR_DND_MIME);
27589
+ }
27590
+ function useDropZone({ accepts, onDrop, disabled = false }) {
27591
+ const [isOver, setIsOver] = useState(false);
27592
+ const eventBus = useEventBus();
27593
+ const handleDragOver = useCallback(
27594
+ (e) => {
27595
+ if (disabled) return;
27596
+ if (!hasAlmadarPayload(e)) return;
27597
+ e.preventDefault();
27598
+ e.dataTransfer.dropEffect = "copy";
27599
+ setIsOver(true);
27600
+ },
27601
+ [disabled]
27602
+ );
27603
+ const handleDragLeave = useCallback(
27604
+ (e) => {
27605
+ setIsOver(false);
27606
+ },
27607
+ []
27608
+ );
27609
+ const handleDrop = useCallback(
27610
+ (e) => {
27611
+ e.preventDefault();
27612
+ setIsOver(false);
27613
+ if (disabled) return;
27614
+ const payload = parsePayload(e);
27615
+ if (!payload) return;
27616
+ if (!accepts.includes(payload.kind)) return;
27617
+ const position = { x: e.clientX, y: e.clientY };
27618
+ onDrop(payload, position);
27619
+ eventBus.emit("UI:DROP", { kind: payload.kind, data: payload.data, ...position });
27620
+ },
27621
+ [disabled, accepts, onDrop, eventBus]
27622
+ );
27623
+ const dropProps = useMemo(
27624
+ () => ({
27625
+ onDragOver: handleDragOver,
27626
+ onDragLeave: handleDragLeave,
27627
+ onDrop: handleDrop
27628
+ }),
27629
+ [handleDragOver, handleDragLeave, handleDrop]
27630
+ );
27631
+ return { dropProps, isOver };
27632
+ }
27633
+ var init_useDropZone = __esm({
27634
+ "hooks/useDropZone.ts"() {
27635
+ "use client";
27636
+ init_useEventBus();
27637
+ init_useDraggable();
27638
+ }
27639
+ });
27453
27640
  function fileIcon(name) {
27454
27641
  const ext = name.split(".").pop()?.toLowerCase() ?? "";
27455
27642
  switch (ext) {
@@ -27475,6 +27662,13 @@ function fileIcon(name) {
27475
27662
  return "file";
27476
27663
  }
27477
27664
  }
27665
+ function siblingsOf(target, roots, childrenByParent) {
27666
+ if (target.parentId) {
27667
+ const parentSiblings = childrenByParent.get(target.parentId);
27668
+ if (parentSiblings?.some((sibling) => sibling.id === target.id)) return parentSiblings;
27669
+ }
27670
+ return roots;
27671
+ }
27478
27672
  function ancestorsOf(id, byId) {
27479
27673
  const out = /* @__PURE__ */ new Set();
27480
27674
  if (!id) return out;
@@ -27492,6 +27686,8 @@ var init_FileTree = __esm({
27492
27686
  init_Box();
27493
27687
  init_Typography();
27494
27688
  init_Icon();
27689
+ init_useDraggable();
27690
+ init_useDropZone();
27495
27691
  TreeNodeItem = ({
27496
27692
  node,
27497
27693
  depth,
@@ -27575,10 +27771,12 @@ var init_FileTree = __esm({
27575
27771
  depth,
27576
27772
  indent,
27577
27773
  childrenByParent,
27774
+ roots,
27578
27775
  onNodeSelect,
27579
27776
  onNodeAction,
27580
27777
  nodeActionIcon,
27581
27778
  nodeActionLabel,
27779
+ onNodeReorder,
27582
27780
  selectedId,
27583
27781
  look,
27584
27782
  isExpanded,
@@ -27589,6 +27787,7 @@ var init_FileTree = __esm({
27589
27787
  const expanded = hasChildren && isExpanded(item.id, depth);
27590
27788
  const isSelected = selectedId !== void 0 && selectedId !== "" && item.id === selectedId;
27591
27789
  const nav = look === "nav";
27790
+ const rowRef = useRef(null);
27592
27791
  const handleClick = useCallback(() => {
27593
27792
  if (hasChildren && !onNodeSelect) onToggle(item.id, expanded);
27594
27793
  onNodeSelect?.(item.id);
@@ -27601,16 +27800,50 @@ var init_FileTree = __esm({
27601
27800
  e.stopPropagation();
27602
27801
  onNodeAction?.(item.id);
27603
27802
  }, [item.id, onNodeAction]);
27803
+ const { dragProps } = useDraggable({
27804
+ payload: { kind: "tree-node", data: { id: item.id } },
27805
+ disabled: !onNodeReorder
27806
+ });
27807
+ const handleRowDrop = useCallback(
27808
+ (payload, position) => {
27809
+ if (!onNodeReorder) return;
27810
+ const draggedId = typeof payload.data.id === "string" ? payload.data.id : void 0;
27811
+ if (!draggedId || draggedId === item.id) return;
27812
+ const rect = rowRef.current?.getBoundingClientRect();
27813
+ if (!rect || rect.height === 0) return;
27814
+ const relY = position.y - rect.top;
27815
+ const third = rect.height / 3;
27816
+ if (relY >= third && relY <= third * 2) {
27817
+ const existingChildren = childrenByParent.get(item.id);
27818
+ onNodeReorder(draggedId, item.id, existingChildren ? existingChildren.length : 0);
27819
+ return;
27820
+ }
27821
+ const siblings = siblingsOf(item, roots, childrenByParent);
27822
+ const newParentId = siblings === roots ? null : item.parentId ?? null;
27823
+ const targetIndex = siblings.findIndex((sibling) => sibling.id === item.id);
27824
+ const index = relY < third ? targetIndex < 0 ? 0 : targetIndex : targetIndex < 0 ? siblings.length : targetIndex + 1;
27825
+ onNodeReorder(draggedId, newParentId, index);
27826
+ },
27827
+ [onNodeReorder, item, roots, childrenByParent]
27828
+ );
27829
+ const { dropProps } = useDropZone({
27830
+ accepts: ["tree-node"],
27831
+ onDrop: handleRowDrop,
27832
+ disabled: !onNodeReorder
27833
+ });
27604
27834
  return /* @__PURE__ */ jsxs(Fragment, { children: [
27605
27835
  /* @__PURE__ */ jsxs(
27606
27836
  Box,
27607
27837
  {
27838
+ ref: rowRef,
27608
27839
  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"}`,
27609
27840
  style: { paddingLeft: depth * indent + 8 },
27610
27841
  onClick: handleClick,
27611
27842
  role: "treeitem",
27612
27843
  "aria-selected": isSelected,
27613
27844
  "aria-expanded": hasChildren ? expanded : void 0,
27845
+ ...dragProps,
27846
+ ...dropProps,
27614
27847
  children: [
27615
27848
  hasChildren ? /* @__PURE__ */ jsx(Box, { onClick: handleChevron, className: "flex items-center flex-shrink-0", role: "button", "aria-label": expanded ? "Collapse" : "Expand", children: /* @__PURE__ */ jsx(
27616
27849
  Icon,
@@ -27657,10 +27890,12 @@ var init_FileTree = __esm({
27657
27890
  depth: depth + 1,
27658
27891
  indent,
27659
27892
  childrenByParent,
27893
+ roots,
27660
27894
  onNodeSelect,
27661
27895
  onNodeAction,
27662
27896
  nodeActionIcon,
27663
27897
  nodeActionLabel,
27898
+ onNodeReorder,
27664
27899
  selectedId,
27665
27900
  look,
27666
27901
  isExpanded,
@@ -27678,14 +27913,15 @@ var init_FileTree = __esm({
27678
27913
  onNodeAction,
27679
27914
  nodeActionIcon,
27680
27915
  nodeActionLabel,
27916
+ onNodeReorder,
27681
27917
  className,
27682
27918
  indent = 16
27683
27919
  }) => {
27684
27920
  const [overrides, setOverrides] = useState(() => /* @__PURE__ */ new Map());
27685
- const byId = React87__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
27686
- const selectedAncestors = React87__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
27687
- const lastSelectedRef = React87__default.useRef(selectedId);
27688
- React87__default.useEffect(() => {
27921
+ const byId = React88__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
27922
+ const selectedAncestors = React88__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
27923
+ const lastSelectedRef = React88__default.useRef(selectedId);
27924
+ React88__default.useEffect(() => {
27689
27925
  if (selectedId === lastSelectedRef.current) return;
27690
27926
  lastSelectedRef.current = selectedId;
27691
27927
  setOverrides((prev) => {
@@ -27726,10 +27962,12 @@ var init_FileTree = __esm({
27726
27962
  depth: 0,
27727
27963
  indent,
27728
27964
  childrenByParent,
27965
+ roots,
27729
27966
  onNodeSelect,
27730
27967
  onNodeAction,
27731
27968
  nodeActionIcon,
27732
27969
  nodeActionLabel,
27970
+ onNodeReorder,
27733
27971
  selectedId,
27734
27972
  look,
27735
27973
  isExpanded,
@@ -27749,6 +27987,7 @@ var init_FileTree = __esm({
27749
27987
  onNodeAction,
27750
27988
  nodeActionIcon,
27751
27989
  nodeActionLabel,
27990
+ onNodeReorder,
27752
27991
  className,
27753
27992
  indent = 16
27754
27993
  }) => {
@@ -27763,6 +28002,7 @@ var init_FileTree = __esm({
27763
28002
  onNodeAction,
27764
28003
  nodeActionIcon,
27765
28004
  nodeActionLabel,
28005
+ onNodeReorder,
27766
28006
  className,
27767
28007
  indent
27768
28008
  }
@@ -28515,7 +28755,7 @@ var init_Flex = __esm({
28515
28755
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
28516
28756
  }
28517
28757
  }
28518
- return React87__default.createElement(Component, {
28758
+ return React88__default.createElement(Component, {
28519
28759
  className: cn(
28520
28760
  inline ? "inline-flex" : "flex",
28521
28761
  directionStyles[direction],
@@ -28634,7 +28874,7 @@ var init_Grid = __esm({
28634
28874
  as: Component = "div"
28635
28875
  }) => {
28636
28876
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
28637
- return React87__default.createElement(
28877
+ return React88__default.createElement(
28638
28878
  Component,
28639
28879
  {
28640
28880
  className: cn(
@@ -29056,9 +29296,9 @@ var init_Popover = __esm({
29056
29296
  onMouseLeave: handleClose,
29057
29297
  onPointerDown: tapTriggerProps.onPointerDown
29058
29298
  };
29059
- const childElement = React87__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29299
+ const childElement = React88__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29060
29300
  const childPointerDown = childElement.props.onPointerDown;
29061
- const triggerElement = React87__default.cloneElement(
29301
+ const triggerElement = React88__default.cloneElement(
29062
29302
  childElement,
29063
29303
  {
29064
29304
  ref: triggerRef,
@@ -29672,9 +29912,9 @@ var init_Tooltip = __esm({
29672
29912
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
29673
29913
  };
29674
29914
  }, []);
29675
- const triggerElement = React87__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29915
+ const triggerElement = React88__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29676
29916
  const childPointerDown = triggerElement.props.onPointerDown;
29677
- const trigger = React87__default.cloneElement(triggerElement, {
29917
+ const trigger = React88__default.cloneElement(triggerElement, {
29678
29918
  ref: triggerRef,
29679
29919
  onMouseEnter: handleMouseEnter,
29680
29920
  onMouseLeave: handleMouseLeave,
@@ -29764,7 +30004,7 @@ var init_WizardProgress = __esm({
29764
30004
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
29765
30005
  const isActive = index === currentStep;
29766
30006
  const isCompleted = index < currentStep;
29767
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
30007
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
29768
30008
  /* @__PURE__ */ jsx(
29769
30009
  "button",
29770
30010
  {
@@ -30826,6 +31066,8 @@ var init_MathCanvas = __esm({
30826
31066
  gridColor = "var(--color-border, #9ca3af)",
30827
31067
  axisColor = "var(--color-muted-foreground, #374151)",
30828
31068
  showTickLabels = false,
31069
+ tickLabelFontSize = 10,
31070
+ labelFontSize = 12,
30829
31071
  showCurveLabels = false,
30830
31072
  curves = [],
30831
31073
  points = [],
@@ -30897,18 +31139,18 @@ var init_MathCanvas = __esm({
30897
31139
  let kx = 0;
30898
31140
  for (let x = Math.ceil(xMin / gridStep) * gridStep; x <= xMax; x += gridStep, kx++) {
30899
31141
  if (kx % labelEveryX === 0 && x !== 0) {
30900
- out.push({ type: "text", x: mapX(x), y: xAxisY + 12, text: formatTick(x), color: "#6b7280", fontSize: 10, align: "center" });
31142
+ out.push({ type: "text", x: mapX(x), y: xAxisY + 12, text: formatTick(x), color: "#6b7280", fontSize: tickLabelFontSize, align: "center" });
30901
31143
  }
30902
31144
  }
30903
31145
  const labelEveryY = Math.max(1, Math.ceil((yMax - yMin) / gridStep / Math.floor(plotH / 28)));
30904
31146
  let ky = 0;
30905
31147
  for (let y = Math.ceil(yMin / gridStep) * gridStep; y <= yMax; y += gridStep, ky++) {
30906
31148
  if (ky % labelEveryY === 0 && y !== 0) {
30907
- out.push({ type: "text", x: yAxisX - 6, y: mapY(y), text: formatTick(y), color: "#6b7280", fontSize: 10, align: "right" });
31149
+ out.push({ type: "text", x: yAxisX - 6, y: mapY(y), text: formatTick(y), color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
30908
31150
  }
30909
31151
  }
30910
31152
  if (xMin <= 0 && xMax >= 0 && yMin <= 0 && yMax >= 0) {
30911
- out.push({ type: "text", x: yAxisX - 6, y: xAxisY + 12, text: "0", color: "#6b7280", fontSize: 10, align: "right" });
31153
+ out.push({ type: "text", x: yAxisX - 6, y: xAxisY + 12, text: "0", color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
30912
31154
  }
30913
31155
  }
30914
31156
  for (const region of regions) {
@@ -30939,7 +31181,7 @@ var init_MathCanvas = __esm({
30939
31181
  y: (mapY(region.samples[mid].y) + mapY(baseline)) / 2,
30940
31182
  text: region.label,
30941
31183
  color,
30942
- fontSize: 11
31184
+ fontSize: labelFontSize
30943
31185
  });
30944
31186
  }
30945
31187
  }
@@ -30978,7 +31220,7 @@ var init_MathCanvas = __esm({
30978
31220
  const py = mapY(guide.at);
30979
31221
  out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color, dash });
30980
31222
  if (guide.label) {
30981
- out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: 11, align: "right" });
31223
+ out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: labelFontSize, align: "right" });
30982
31224
  }
30983
31225
  }
30984
31226
  }
@@ -31021,7 +31263,7 @@ var init_MathCanvas = __esm({
31021
31263
  y: mapY(lastInRange.y) - 6,
31022
31264
  text: curve.label,
31023
31265
  color: curve.color ?? "#2563eb",
31024
- fontSize: 11
31266
+ fontSize: labelFontSize
31025
31267
  });
31026
31268
  }
31027
31269
  }
@@ -31058,7 +31300,7 @@ var init_MathCanvas = __esm({
31058
31300
  y: xAxisY - peak - 8,
31059
31301
  text: hop.label,
31060
31302
  color,
31061
- fontSize: 10,
31303
+ fontSize: labelFontSize,
31062
31304
  align: "center"
31063
31305
  });
31064
31306
  }
@@ -31085,7 +31327,7 @@ var init_MathCanvas = __esm({
31085
31327
  y: mapY(angle.y + 1.35 * radius * Math.sin(rad)),
31086
31328
  text: angle.label,
31087
31329
  color,
31088
- fontSize: 11,
31330
+ fontSize: labelFontSize,
31089
31331
  align: "center"
31090
31332
  });
31091
31333
  }
@@ -31102,7 +31344,7 @@ var init_MathCanvas = __esm({
31102
31344
  fill: isOpen ? "#ffffff" : p.color ?? "#dc2626"
31103
31345
  });
31104
31346
  if (p.label) {
31105
- out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: 12 });
31347
+ out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: labelFontSize });
31106
31348
  }
31107
31349
  }
31108
31350
  for (const v of vectors) {
@@ -31113,7 +31355,7 @@ var init_MathCanvas = __esm({
31113
31355
  const y2 = mapY(v.y + v.vy);
31114
31356
  out.push({ type: "arrow", x1, y1, x2, y2, color: v.color ?? "#7c3aed", lineWidth: 2 });
31115
31357
  if (v.label) {
31116
- out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: 12 });
31358
+ out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: labelFontSize });
31117
31359
  }
31118
31360
  }
31119
31361
  out.push(...shapes);
@@ -31132,6 +31374,8 @@ var init_MathCanvas = __esm({
31132
31374
  gridColor,
31133
31375
  axisColor,
31134
31376
  showTickLabels,
31377
+ tickLabelFontSize,
31378
+ labelFontSize,
31135
31379
  showCurveLabels,
31136
31380
  curves,
31137
31381
  points,
@@ -32419,13 +32663,13 @@ var init_MapView = __esm({
32419
32663
  shadowSize: [41, 41]
32420
32664
  });
32421
32665
  L.Marker.prototype.options.icon = defaultIcon;
32422
- const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback97, useState: useState98 } = React87__default;
32666
+ const { useEffect: useEffect68, useRef: useRef67, useCallback: useCallback99, useState: useState101 } = React88__default;
32423
32667
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
32424
32668
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
32425
32669
  function MapUpdater({ centerLat, centerLng, zoom }) {
32426
32670
  const map = useMap();
32427
- const prevRef = useRef65({ centerLat, centerLng, zoom });
32428
- useEffect67(() => {
32671
+ const prevRef = useRef67({ centerLat, centerLng, zoom });
32672
+ useEffect68(() => {
32429
32673
  const prev = prevRef.current;
32430
32674
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
32431
32675
  map.setView([centerLat, centerLng], zoom);
@@ -32436,7 +32680,7 @@ var init_MapView = __esm({
32436
32680
  }
32437
32681
  function MapClickHandler({ onMapClick }) {
32438
32682
  const map = useMap();
32439
- useEffect67(() => {
32683
+ useEffect68(() => {
32440
32684
  if (!onMapClick) return;
32441
32685
  const handler = (e) => {
32442
32686
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -32464,8 +32708,8 @@ var init_MapView = __esm({
32464
32708
  showAttribution = true
32465
32709
  }) {
32466
32710
  const eventBus = useEventBus2();
32467
- const [clickedPosition, setClickedPosition] = useState98(null);
32468
- const handleMapClick = useCallback97((lat, lng) => {
32711
+ const [clickedPosition, setClickedPosition] = useState101(null);
32712
+ const handleMapClick = useCallback99((lat, lng) => {
32469
32713
  if (showClickedPin) {
32470
32714
  setClickedPosition({ lat, lng });
32471
32715
  }
@@ -32474,7 +32718,7 @@ var init_MapView = __esm({
32474
32718
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
32475
32719
  }
32476
32720
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
32477
- const handleMarkerClick = useCallback97((marker) => {
32721
+ const handleMarkerClick = useCallback99((marker) => {
32478
32722
  onMarkerClick?.(marker);
32479
32723
  if (markerClickEvent) {
32480
32724
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -33364,8 +33608,8 @@ function TableView({
33364
33608
  }) {
33365
33609
  const eventBus = useEventBus();
33366
33610
  const { t } = useTranslate();
33367
- const [visibleCount, setVisibleCount] = React87__default.useState(pageSize > 0 ? pageSize : Infinity);
33368
- const [localSelected, setLocalSelected] = React87__default.useState(/* @__PURE__ */ new Set());
33611
+ const [visibleCount, setVisibleCount] = React88__default.useState(pageSize > 0 ? pageSize : Infinity);
33612
+ const [localSelected, setLocalSelected] = React88__default.useState(/* @__PURE__ */ new Set());
33369
33613
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
33370
33614
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
33371
33615
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
@@ -33386,7 +33630,7 @@ function TableView({
33386
33630
  const hasMore = pageSize > 0 && visibleCount < ordered2.length;
33387
33631
  const hasRenderProp = typeof children === "function";
33388
33632
  const idField = dndItemIdField ?? "id";
33389
- React87__default.useEffect(() => {
33633
+ React88__default.useEffect(() => {
33390
33634
  tableViewLog.debug("render", {
33391
33635
  rowCount: data.length,
33392
33636
  colCount: colDefs.length,
@@ -33436,7 +33680,7 @@ function TableView({
33436
33680
  };
33437
33681
  eventBus.emit(`UI:${rowClickEvent}`, payload);
33438
33682
  };
33439
- const colFloors = React87__default.useMemo(
33683
+ const colFloors = React88__default.useMemo(
33440
33684
  () => colDefs.map((col) => {
33441
33685
  const longest = data.reduce((widest, row) => {
33442
33686
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -33579,12 +33823,12 @@ function TableView({
33579
33823
  ]
33580
33824
  }
33581
33825
  );
33582
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React87__default.Fragment, { children: rowInner }, id);
33826
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React88__default.Fragment, { children: rowInner }, id);
33583
33827
  };
33584
33828
  const items = Array.from(data);
33585
33829
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
33586
33830
  let runningIndex = 0;
33587
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
33831
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
33588
33832
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
33589
33833
  group.items.map((row) => renderRow(row, runningIndex++))
33590
33834
  ] }, gi)) });
@@ -34953,7 +35197,7 @@ var init_StepFlow = __esm({
34953
35197
  className
34954
35198
  }) => {
34955
35199
  if (orientation === "vertical") {
34956
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React87__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
35200
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React88__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
34957
35201
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
34958
35202
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
34959
35203
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -34964,7 +35208,7 @@ var init_StepFlow = __esm({
34964
35208
  ] })
34965
35209
  ] }) }, index)) });
34966
35210
  }
34967
- 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(React87__default.Fragment, { children: [
35211
+ 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(React88__default.Fragment, { children: [
34968
35212
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
34969
35213
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
34970
35214
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -35954,7 +36198,7 @@ var init_LikertScale = __esm({
35954
36198
  md: "text-base",
35955
36199
  lg: "text-lg"
35956
36200
  };
35957
- LikertScale = React87__default.forwardRef(
36201
+ LikertScale = React88__default.forwardRef(
35958
36202
  ({
35959
36203
  question,
35960
36204
  options = DEFAULT_LIKERT_OPTIONS,
@@ -35966,7 +36210,7 @@ var init_LikertScale = __esm({
35966
36210
  variant = "radios",
35967
36211
  className
35968
36212
  }, ref) => {
35969
- const groupId = React87__default.useId();
36213
+ const groupId = React88__default.useId();
35970
36214
  const eventBus = useEventBus();
35971
36215
  const handleSelect = useCallback(
35972
36216
  (next) => {
@@ -38389,7 +38633,7 @@ var init_DocBreadcrumb = __esm({
38389
38633
  "aria-label": t("aria.breadcrumb"),
38390
38634
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
38391
38635
  const isLast = idx === items.length - 1;
38392
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
38636
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
38393
38637
  idx > 0 && /* @__PURE__ */ jsx(
38394
38638
  Icon,
38395
38639
  {
@@ -39258,7 +39502,7 @@ var init_MiniStateMachine = __esm({
39258
39502
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
39259
39503
  const tc = transitionCounts[s.name] ?? 0;
39260
39504
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
39261
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
39505
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
39262
39506
  /* @__PURE__ */ jsx(
39263
39507
  AvlState,
39264
39508
  {
@@ -39463,7 +39707,7 @@ var init_PageHeader = __esm({
39463
39707
  info: "bg-info/10 text-info"
39464
39708
  };
39465
39709
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
39466
- 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(React87__default.Fragment, { children: [
39710
+ 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(React88__default.Fragment, { children: [
39467
39711
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
39468
39712
  crumb.href ? /* @__PURE__ */ jsx(
39469
39713
  "a",
@@ -39821,7 +40065,7 @@ var init_Section = __esm({
39821
40065
  as: Component = "section"
39822
40066
  }) => {
39823
40067
  const hasHeader = title || description || action;
39824
- return React87__default.createElement(
40068
+ return React88__default.createElement(
39825
40069
  Component,
39826
40070
  {
39827
40071
  className: cn(
@@ -40195,7 +40439,7 @@ var init_WizardContainer = __esm({
40195
40439
  const isCompleted = index < currentStep;
40196
40440
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
40197
40441
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
40198
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
40442
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
40199
40443
  /* @__PURE__ */ jsx(
40200
40444
  Button,
40201
40445
  {
@@ -41982,7 +42226,7 @@ var init_ImportPreviewTree = __esm({
41982
42226
  const renderUnit = (unit, childrenByParent, depth) => {
41983
42227
  const summary = fieldSummary(unit);
41984
42228
  const children = childrenByParent.get(unit.ref) ?? [];
41985
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
42229
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
41986
42230
  /* @__PURE__ */ jsxs(
41987
42231
  Box,
41988
42232
  {
@@ -42079,7 +42323,7 @@ var init_ImportProgress = __esm({
42079
42323
  PIPELINE.map((key, index) => {
42080
42324
  const isComplete = index < currentIndex;
42081
42325
  const isActive = index === currentIndex;
42082
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
42326
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
42083
42327
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
42084
42328
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
42085
42329
  /* @__PURE__ */ jsx(
@@ -42207,6 +42451,69 @@ var init_ReflectionBlock = __esm({
42207
42451
  ReflectionBlock.displayName = "ReflectionBlock";
42208
42452
  }
42209
42453
  });
42454
+ var positionClasses, FloatingToolbar;
42455
+ var init_FloatingToolbar = __esm({
42456
+ "components/core/molecules/FloatingToolbar.tsx"() {
42457
+ "use client";
42458
+ init_Button();
42459
+ init_Box();
42460
+ init_Divider();
42461
+ init_Typography();
42462
+ init_ButtonGroup();
42463
+ init_cn();
42464
+ init_useEventBus();
42465
+ positionClasses = {
42466
+ "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
42467
+ "bottom-left": "bottom-6 left-6",
42468
+ "bottom-right": "bottom-6 right-6"
42469
+ };
42470
+ FloatingToolbar = ({
42471
+ items,
42472
+ position = "bottom-center",
42473
+ children,
42474
+ className
42475
+ }) => {
42476
+ const eventBus = useEventBus();
42477
+ return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses[position]), children: /* @__PURE__ */ jsxs(
42478
+ ButtonGroup,
42479
+ {
42480
+ variant: "default",
42481
+ orientation: "horizontal",
42482
+ className: cn(
42483
+ "items-center gap-1 rounded-full border border-border",
42484
+ "bg-card/95 backdrop-blur-sm shadow-elevation-popover p-1",
42485
+ className
42486
+ ),
42487
+ children: [
42488
+ items.map((item) => /* @__PURE__ */ jsx(
42489
+ Button,
42490
+ {
42491
+ variant: item.active ? "primary" : "ghost",
42492
+ size: "sm",
42493
+ icon: item.icon,
42494
+ action: item.action,
42495
+ actionPayload: item.actionPayload,
42496
+ disabled: item.disabled,
42497
+ "aria-pressed": item.active,
42498
+ "aria-label": item.label,
42499
+ className: "rounded-full",
42500
+ "data-testid": item.testId ?? `floating-toolbar-item-${item.id}`,
42501
+ onClick: () => {
42502
+ if (item.event) eventBus.emit(`UI:${item.event}`, { actionId: item.id });
42503
+ },
42504
+ children: /* @__PURE__ */ jsx(Typography, { as: "span", className: "sr-only", children: item.label })
42505
+ },
42506
+ item.id
42507
+ )),
42508
+ children && items.length > 0 && /* @__PURE__ */ jsx(Divider, { orientation: "vertical", className: "h-6 mx-1" }),
42509
+ children
42510
+ ]
42511
+ }
42512
+ ) });
42513
+ };
42514
+ FloatingToolbar.displayName = "FloatingToolbar";
42515
+ }
42516
+ });
42210
42517
 
42211
42518
  // components/core/molecules/index.ts
42212
42519
  var init_molecules2 = __esm({
@@ -42957,7 +43264,7 @@ var init_DetailPanel = __esm({
42957
43264
  }) => {
42958
43265
  const eventBus = useEventBus();
42959
43266
  const { t } = useTranslate();
42960
- const [titleDraft, setTitleDraft] = React87__default.useState(null);
43267
+ const [titleDraft, setTitleDraft] = React88__default.useState(null);
42961
43268
  const isFieldDefArray = (arr) => {
42962
43269
  if (!arr || arr.length === 0) return false;
42963
43270
  const first = arr[0];
@@ -43350,8 +43657,224 @@ var init_DetailPanel = __esm({
43350
43657
  DetailPanel.displayName = "DetailPanel";
43351
43658
  }
43352
43659
  });
43660
+ var SplitPane;
43661
+ var init_SplitPane = __esm({
43662
+ "components/core/organisms/layout/SplitPane.tsx"() {
43663
+ "use client";
43664
+ init_cn();
43665
+ SplitPane = ({
43666
+ direction = "horizontal",
43667
+ ratio: ratioProp = 50,
43668
+ minSize = 100,
43669
+ resizable = true,
43670
+ left,
43671
+ right,
43672
+ className,
43673
+ leftClassName,
43674
+ rightClassName,
43675
+ onRatioChange
43676
+ }) => {
43677
+ const [uncontrolledRatio, setUncontrolledRatio] = useState(ratioProp);
43678
+ const ratio = onRatioChange ? ratioProp : uncontrolledRatio;
43679
+ const containerRef = useRef(null);
43680
+ const isDragging = useRef(false);
43681
+ const handlePointerDown = useCallback(
43682
+ (e) => {
43683
+ if (!resizable) return;
43684
+ e.preventDefault();
43685
+ isDragging.current = true;
43686
+ e.currentTarget.setPointerCapture(e.pointerId);
43687
+ const handlePointerMove = (ev) => {
43688
+ if (!isDragging.current || !containerRef.current) return;
43689
+ const rect = containerRef.current.getBoundingClientRect();
43690
+ let newRatio;
43691
+ if (direction === "horizontal") {
43692
+ const x = ev.clientX - rect.left;
43693
+ newRatio = x / rect.width * 100;
43694
+ } else {
43695
+ const y = ev.clientY - rect.top;
43696
+ newRatio = y / rect.height * 100;
43697
+ }
43698
+ const minRatio = minSize / (direction === "horizontal" ? rect.width : rect.height) * 100;
43699
+ const maxRatio = 100 - minRatio;
43700
+ newRatio = Math.max(minRatio, Math.min(maxRatio, newRatio));
43701
+ if (onRatioChange) {
43702
+ onRatioChange(newRatio);
43703
+ } else {
43704
+ setUncontrolledRatio(newRatio);
43705
+ }
43706
+ };
43707
+ const handlePointerUp = () => {
43708
+ isDragging.current = false;
43709
+ document.removeEventListener("pointermove", handlePointerMove);
43710
+ document.removeEventListener("pointerup", handlePointerUp);
43711
+ document.removeEventListener("pointercancel", handlePointerUp);
43712
+ };
43713
+ document.addEventListener("pointermove", handlePointerMove);
43714
+ document.addEventListener("pointerup", handlePointerUp);
43715
+ document.addEventListener("pointercancel", handlePointerUp);
43716
+ },
43717
+ [direction, minSize, resizable, onRatioChange]
43718
+ );
43719
+ const isHorizontal = direction === "horizontal";
43720
+ return /* @__PURE__ */ jsxs(
43721
+ "div",
43722
+ {
43723
+ ref: containerRef,
43724
+ className: cn(
43725
+ "flex w-full h-full",
43726
+ isHorizontal ? "flex-row" : "flex-col",
43727
+ className
43728
+ ),
43729
+ children: [
43730
+ /* @__PURE__ */ jsx(
43731
+ "div",
43732
+ {
43733
+ className: cn("overflow-auto", leftClassName),
43734
+ style: {
43735
+ [isHorizontal ? "width" : "height"]: `${ratio}%`,
43736
+ flexShrink: 0
43737
+ },
43738
+ children: left
43739
+ }
43740
+ ),
43741
+ resizable && /* @__PURE__ */ jsx(
43742
+ "div",
43743
+ {
43744
+ onPointerDown: handlePointerDown,
43745
+ className: cn(
43746
+ "flex-shrink-0 bg-border transition-colors touch-none",
43747
+ 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"
43748
+ )
43749
+ }
43750
+ ),
43751
+ /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto", rightClassName), children: right })
43752
+ ]
43753
+ }
43754
+ );
43755
+ };
43756
+ SplitPane.displayName = "SplitPane";
43757
+ }
43758
+ });
43759
+ var DockLayout;
43760
+ var init_DockLayout = __esm({
43761
+ "components/core/organisms/layout/DockLayout.tsx"() {
43762
+ "use client";
43763
+ init_Box();
43764
+ init_Stack();
43765
+ init_cn();
43766
+ init_SplitPane();
43767
+ DockLayout = ({
43768
+ rail,
43769
+ sidebar,
43770
+ main,
43771
+ bottomPanel,
43772
+ statusBar,
43773
+ secondarySidebar,
43774
+ railWidth = 56,
43775
+ secondarySidebarWidth = 280,
43776
+ sidebarCollapsed = false,
43777
+ sidebarWidth = 20,
43778
+ onSidebarWidthChange,
43779
+ sidebarMinSize = 160,
43780
+ bottomPanelCollapsed = false,
43781
+ bottomPanelHeight = 30,
43782
+ onBottomPanelHeightChange,
43783
+ bottomPanelMinSize = 120,
43784
+ secondarySidebarCollapsed = false,
43785
+ className,
43786
+ railClassName,
43787
+ sidebarClassName,
43788
+ mainClassName,
43789
+ bottomPanelClassName,
43790
+ statusBarClassName,
43791
+ secondarySidebarClassName
43792
+ }) => {
43793
+ const showSidebar = Boolean(sidebar) && !sidebarCollapsed;
43794
+ const showBottomPanel = Boolean(bottomPanel) && !bottomPanelCollapsed;
43795
+ const showSecondarySidebar = Boolean(secondarySidebar) && !secondarySidebarCollapsed;
43796
+ const centerRow = /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "flex-1 min-h-0 min-w-0", children: [
43797
+ /* @__PURE__ */ jsx(Box, { className: cn("flex-1 min-w-0 h-full overflow-auto", mainClassName), children: main }),
43798
+ showSecondarySidebar && /* @__PURE__ */ jsx(
43799
+ Box,
43800
+ {
43801
+ className: cn(
43802
+ "flex-shrink-0 h-full overflow-auto border-l border-border",
43803
+ secondarySidebarClassName
43804
+ ),
43805
+ style: { width: secondarySidebarWidth },
43806
+ children: secondarySidebar
43807
+ }
43808
+ )
43809
+ ] });
43810
+ const sidebarAndCenter = showSidebar ? /* @__PURE__ */ jsx(
43811
+ SplitPane,
43812
+ {
43813
+ direction: "horizontal",
43814
+ ratio: sidebarWidth,
43815
+ onRatioChange: onSidebarWidthChange,
43816
+ minSize: sidebarMinSize,
43817
+ resizable: true,
43818
+ left: /* @__PURE__ */ jsx(Box, { className: cn("h-full overflow-auto", sidebarClassName), children: sidebar }),
43819
+ right: centerRow,
43820
+ className: "flex-1 min-h-0 min-w-0"
43821
+ }
43822
+ ) : centerRow;
43823
+ const body = /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "flex-1 min-h-0 min-w-0", children: [
43824
+ rail && /* @__PURE__ */ jsx(
43825
+ Box,
43826
+ {
43827
+ className: cn(
43828
+ "flex-shrink-0 h-full overflow-auto border-r border-border",
43829
+ railClassName
43830
+ ),
43831
+ style: { width: railWidth },
43832
+ children: rail
43833
+ }
43834
+ ),
43835
+ sidebarAndCenter
43836
+ ] });
43837
+ const bodyPlusBottom = showBottomPanel ? /* @__PURE__ */ jsx(
43838
+ SplitPane,
43839
+ {
43840
+ direction: "vertical",
43841
+ ratio: 100 - bottomPanelHeight,
43842
+ onRatioChange: (topRatio) => onBottomPanelHeightChange?.(100 - topRatio),
43843
+ minSize: bottomPanelMinSize,
43844
+ resizable: true,
43845
+ left: body,
43846
+ right: /* @__PURE__ */ jsx(
43847
+ Box,
43848
+ {
43849
+ className: cn(
43850
+ "h-full overflow-auto border-t border-border",
43851
+ bottomPanelClassName
43852
+ ),
43853
+ children: bottomPanel
43854
+ }
43855
+ ),
43856
+ className: "flex-1 min-h-0"
43857
+ }
43858
+ ) : body;
43859
+ return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: cn("w-full h-full overflow-hidden", className), children: [
43860
+ bodyPlusBottom,
43861
+ statusBar && /* @__PURE__ */ jsx(
43862
+ Box,
43863
+ {
43864
+ className: cn(
43865
+ "flex-shrink-0 border-t border-border bg-background",
43866
+ statusBarClassName
43867
+ ),
43868
+ children: statusBar
43869
+ }
43870
+ )
43871
+ ] });
43872
+ };
43873
+ DockLayout.displayName = "DockLayout";
43874
+ }
43875
+ });
43353
43876
  function extractTitle(children) {
43354
- if (!React87__default.isValidElement(children)) return void 0;
43877
+ if (!React88__default.isValidElement(children)) return void 0;
43355
43878
  const props = children.props;
43356
43879
  if (typeof props.title === "string") {
43357
43880
  return props.title;
@@ -43713,7 +44236,7 @@ var init_Form = __esm({
43713
44236
  const isSchemaEntity = isOrbitalEntitySchema(entity);
43714
44237
  const resolvedEntity = isSchemaEntity ? entity : void 0;
43715
44238
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
43716
- const normalizedInitialData = React87__default.useMemo(() => {
44239
+ const normalizedInitialData = React88__default.useMemo(() => {
43717
44240
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
43718
44241
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
43719
44242
  const merged = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
@@ -43732,7 +44255,7 @@ var init_Form = __esm({
43732
44255
  }
43733
44256
  return normalized;
43734
44257
  }, [entity, initialData]);
43735
- const entityDerivedFields = React87__default.useMemo(() => {
44258
+ const entityDerivedFields = React88__default.useMemo(() => {
43736
44259
  if (fields && fields.length > 0) return void 0;
43737
44260
  if (!resolvedEntity) return void 0;
43738
44261
  return resolvedEntity.fields.map(
@@ -43753,16 +44276,16 @@ var init_Form = __esm({
43753
44276
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
43754
44277
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
43755
44278
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
43756
- const [formData, setFormData] = React87__default.useState(
44279
+ const [formData, setFormData] = React88__default.useState(
43757
44280
  normalizedInitialData
43758
44281
  );
43759
- const [collapsedSections, setCollapsedSections] = React87__default.useState(
44282
+ const [collapsedSections, setCollapsedSections] = React88__default.useState(
43760
44283
  /* @__PURE__ */ new Set()
43761
44284
  );
43762
- const [submitError, setSubmitError] = React87__default.useState(null);
43763
- const formRef = React87__default.useRef(null);
44285
+ const [submitError, setSubmitError] = React88__default.useState(null);
44286
+ const formRef = React88__default.useRef(null);
43764
44287
  const formMode = props.mode;
43765
- const mountedRef = React87__default.useRef(false);
44288
+ const mountedRef = React88__default.useRef(false);
43766
44289
  if (!mountedRef.current) {
43767
44290
  mountedRef.current = true;
43768
44291
  debug("forms", "mount", {
@@ -43775,7 +44298,7 @@ var init_Form = __esm({
43775
44298
  });
43776
44299
  }
43777
44300
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
43778
- const evalContext = React87__default.useMemo(
44301
+ const evalContext = React88__default.useMemo(
43779
44302
  () => ({
43780
44303
  formValues: formData,
43781
44304
  globalVariables: externalContext?.globalVariables ?? {},
@@ -43784,7 +44307,7 @@ var init_Form = __esm({
43784
44307
  }),
43785
44308
  [formData, externalContext]
43786
44309
  );
43787
- React87__default.useEffect(() => {
44310
+ React88__default.useEffect(() => {
43788
44311
  debug("forms", "initialData-sync", {
43789
44312
  mode: formMode,
43790
44313
  normalizedInitialData,
@@ -43795,7 +44318,7 @@ var init_Form = __esm({
43795
44318
  setFormData(normalizedInitialData);
43796
44319
  }
43797
44320
  }, [normalizedInitialData]);
43798
- const processCalculations = React87__default.useCallback(
44321
+ const processCalculations = React88__default.useCallback(
43799
44322
  (changedFieldId, newFormData) => {
43800
44323
  if (!hiddenCalculations.length) return;
43801
44324
  const context = {
@@ -43820,7 +44343,7 @@ var init_Form = __esm({
43820
44343
  },
43821
44344
  [hiddenCalculations, externalContext, eventBus]
43822
44345
  );
43823
- const checkViolations = React87__default.useCallback(
44346
+ const checkViolations = React88__default.useCallback(
43824
44347
  (changedFieldId, newFormData) => {
43825
44348
  if (!violationTriggers.length) return;
43826
44349
  const context = {
@@ -43858,7 +44381,7 @@ var init_Form = __esm({
43858
44381
  processCalculations(name, newFormData);
43859
44382
  checkViolations(name, newFormData);
43860
44383
  };
43861
- const isFieldVisible = React87__default.useCallback(
44384
+ const isFieldVisible = React88__default.useCallback(
43862
44385
  (fieldName2) => {
43863
44386
  const condition = conditionalFields[fieldName2];
43864
44387
  if (!condition) return true;
@@ -43866,7 +44389,7 @@ var init_Form = __esm({
43866
44389
  },
43867
44390
  [conditionalFields, evalContext]
43868
44391
  );
43869
- const isSectionVisible = React87__default.useCallback(
44392
+ const isSectionVisible = React88__default.useCallback(
43870
44393
  (section) => {
43871
44394
  if (!section.condition) return true;
43872
44395
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -43942,7 +44465,7 @@ var init_Form = __esm({
43942
44465
  eventBus.emit(`UI:${onCancel}`);
43943
44466
  }
43944
44467
  };
43945
- const renderField = React87__default.useCallback(
44468
+ const renderField = React88__default.useCallback(
43946
44469
  (field) => {
43947
44470
  const fieldName2 = field.name || field.field;
43948
44471
  if (!fieldName2) return null;
@@ -43964,7 +44487,7 @@ var init_Form = __esm({
43964
44487
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
43965
44488
  );
43966
44489
  const effectiveFields = entityDerivedFields ?? fields;
43967
- const normalizedFields = React87__default.useMemo(() => {
44490
+ const normalizedFields = React88__default.useMemo(() => {
43968
44491
  if (!effectiveFields || effectiveFields.length === 0) return [];
43969
44492
  return effectiveFields.map((field) => {
43970
44493
  if (typeof field === "string") {
@@ -43999,7 +44522,7 @@ var init_Form = __esm({
43999
44522
  };
44000
44523
  });
44001
44524
  }, [effectiveFields, resolvedEntity, fieldOverrides]);
44002
- const schemaFields = React87__default.useMemo(() => {
44525
+ const schemaFields = React88__default.useMemo(() => {
44003
44526
  if (normalizedFields.length === 0) return null;
44004
44527
  if (isDebugEnabled()) {
44005
44528
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -44009,7 +44532,7 @@ var init_Form = __esm({
44009
44532
  }
44010
44533
  return normalizedFields.map(renderField).filter(Boolean);
44011
44534
  }, [normalizedFields, renderField, entityName, conditionalFields]);
44012
- const sectionElements = React87__default.useMemo(() => {
44535
+ const sectionElements = React88__default.useMemo(() => {
44013
44536
  if (!sections || sections.length === 0) return null;
44014
44537
  return sections.map((section) => {
44015
44538
  if (!isSectionVisible(section)) {
@@ -44845,7 +45368,7 @@ var init_List = __esm({
44845
45368
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
44846
45369
  return [];
44847
45370
  }, [entity]);
44848
- const getItemActions = React87__default.useCallback(
45371
+ const getItemActions = React88__default.useCallback(
44849
45372
  (item) => {
44850
45373
  if (!itemActions) return [];
44851
45374
  if (typeof itemActions === "function") {
@@ -45327,7 +45850,7 @@ var init_MediaGallery = __esm({
45327
45850
  [selectable, selectedItems, selectionEvent, eventBus]
45328
45851
  );
45329
45852
  const entityData = Array.isArray(entity) ? entity : [];
45330
- const items = React87__default.useMemo(() => {
45853
+ const items = React88__default.useMemo(() => {
45331
45854
  if (propItems && propItems.length > 0) return propItems;
45332
45855
  if (entityData.length === 0) return [];
45333
45856
  return entityData.map((record, idx) => {
@@ -45492,7 +46015,7 @@ var init_MediaGallery = __esm({
45492
46015
  }
45493
46016
  });
45494
46017
  function extractTitle2(children) {
45495
- if (!React87__default.isValidElement(children)) return void 0;
46018
+ if (!React88__default.isValidElement(children)) return void 0;
45496
46019
  const props = children.props;
45497
46020
  if (typeof props.title === "string") {
45498
46021
  return props.title;
@@ -45747,7 +46270,7 @@ var init_debugRegistry = __esm({
45747
46270
  }
45748
46271
  });
45749
46272
  function useDebugData() {
45750
- const [data, setData] = React87.useState(() => ({
46273
+ const [data, setData] = React88.useState(() => ({
45751
46274
  traits: [],
45752
46275
  ticks: [],
45753
46276
  guards: [],
@@ -45761,7 +46284,7 @@ function useDebugData() {
45761
46284
  },
45762
46285
  lastUpdate: Date.now()
45763
46286
  }));
45764
- React87.useEffect(() => {
46287
+ React88.useEffect(() => {
45765
46288
  const updateData = () => {
45766
46289
  setData({
45767
46290
  traits: getAllTraits(),
@@ -45870,12 +46393,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
45870
46393
  return positions;
45871
46394
  }
45872
46395
  function WalkMinimap() {
45873
- const [walkStep, setWalkStep] = React87.useState(null);
45874
- const [traits2, setTraits] = React87.useState([]);
45875
- const [coveredEdges, setCoveredEdges] = React87.useState([]);
45876
- const [completedTraits, setCompletedTraits] = React87.useState(/* @__PURE__ */ new Set());
45877
- const prevTraitRef = React87.useRef(null);
45878
- React87.useEffect(() => {
46396
+ const [walkStep, setWalkStep] = React88.useState(null);
46397
+ const [traits2, setTraits] = React88.useState([]);
46398
+ const [coveredEdges, setCoveredEdges] = React88.useState([]);
46399
+ const [completedTraits, setCompletedTraits] = React88.useState(/* @__PURE__ */ new Set());
46400
+ const prevTraitRef = React88.useRef(null);
46401
+ React88.useEffect(() => {
45879
46402
  const interval = setInterval(() => {
45880
46403
  const w = window;
45881
46404
  const step = w.__orbitalWalkStep;
@@ -46311,15 +46834,15 @@ var init_EntitiesTab = __esm({
46311
46834
  });
46312
46835
  function EventFlowTab({ events: events2 }) {
46313
46836
  const { t } = useTranslate();
46314
- const [filter, setFilter] = React87.useState("all");
46315
- const containerRef = React87.useRef(null);
46316
- const [autoScroll, setAutoScroll] = React87.useState(true);
46317
- React87.useEffect(() => {
46837
+ const [filter, setFilter] = React88.useState("all");
46838
+ const containerRef = React88.useRef(null);
46839
+ const [autoScroll, setAutoScroll] = React88.useState(true);
46840
+ React88.useEffect(() => {
46318
46841
  if (autoScroll && containerRef.current) {
46319
46842
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
46320
46843
  }
46321
46844
  }, [events2.length, autoScroll]);
46322
- const filteredEvents = React87.useMemo(() => {
46845
+ const filteredEvents = React88.useMemo(() => {
46323
46846
  if (filter === "all") return events2;
46324
46847
  return events2.filter((e) => e.type === filter);
46325
46848
  }, [events2, filter]);
@@ -46435,7 +46958,7 @@ var init_EventFlowTab = __esm({
46435
46958
  });
46436
46959
  function GuardsPanel({ guards }) {
46437
46960
  const { t } = useTranslate();
46438
- const [filter, setFilter] = React87.useState("all");
46961
+ const [filter, setFilter] = React88.useState("all");
46439
46962
  if (guards.length === 0) {
46440
46963
  return /* @__PURE__ */ jsx(
46441
46964
  EmptyState,
@@ -46448,7 +46971,7 @@ function GuardsPanel({ guards }) {
46448
46971
  }
46449
46972
  const passedCount = guards.filter((g) => g.result).length;
46450
46973
  const failedCount = guards.length - passedCount;
46451
- const filteredGuards = React87.useMemo(() => {
46974
+ const filteredGuards = React88.useMemo(() => {
46452
46975
  if (filter === "all") return guards;
46453
46976
  if (filter === "passed") return guards.filter((g) => g.result);
46454
46977
  return guards.filter((g) => !g.result);
@@ -46611,10 +47134,10 @@ function EffectBadge({ effect }) {
46611
47134
  }
46612
47135
  function TransitionTimeline({ transitions }) {
46613
47136
  const { t } = useTranslate();
46614
- const containerRef = React87.useRef(null);
46615
- const [autoScroll, setAutoScroll] = React87.useState(true);
46616
- const [expandedId, setExpandedId] = React87.useState(null);
46617
- React87.useEffect(() => {
47137
+ const containerRef = React88.useRef(null);
47138
+ const [autoScroll, setAutoScroll] = React88.useState(true);
47139
+ const [expandedId, setExpandedId] = React88.useState(null);
47140
+ React88.useEffect(() => {
46618
47141
  if (autoScroll && containerRef.current) {
46619
47142
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
46620
47143
  }
@@ -46894,9 +47417,9 @@ function getAllEvents(traits2) {
46894
47417
  function EventDispatcherTab({ traits: traits2, schema }) {
46895
47418
  const eventBus = useEventBus();
46896
47419
  const { t } = useTranslate();
46897
- const [log13, setLog] = React87.useState([]);
46898
- const prevStatesRef = React87.useRef(/* @__PURE__ */ new Map());
46899
- React87.useEffect(() => {
47420
+ const [log13, setLog] = React88.useState([]);
47421
+ const prevStatesRef = React88.useRef(/* @__PURE__ */ new Map());
47422
+ React88.useEffect(() => {
46900
47423
  for (const trait of traits2) {
46901
47424
  const prev = prevStatesRef.current.get(trait.id);
46902
47425
  if (prev && prev !== trait.currentState) {
@@ -47065,10 +47588,10 @@ function VerifyModePanel({
47065
47588
  localCount
47066
47589
  }) {
47067
47590
  const { t } = useTranslate();
47068
- const [expanded, setExpanded] = React87.useState(true);
47069
- const scrollRef = React87.useRef(null);
47070
- const prevCountRef = React87.useRef(0);
47071
- React87.useEffect(() => {
47591
+ const [expanded, setExpanded] = React88.useState(true);
47592
+ const scrollRef = React88.useRef(null);
47593
+ const prevCountRef = React88.useRef(0);
47594
+ React88.useEffect(() => {
47072
47595
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
47073
47596
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
47074
47597
  }
@@ -47125,10 +47648,10 @@ function RuntimeDebugger({
47125
47648
  schema
47126
47649
  }) {
47127
47650
  const { t } = useTranslate();
47128
- const [isCollapsed, setIsCollapsed] = React87.useState(mode === "verify" ? true : defaultCollapsed);
47129
- const [isVisible, setIsVisible] = React87.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
47651
+ const [isCollapsed, setIsCollapsed] = React88.useState(mode === "verify" ? true : defaultCollapsed);
47652
+ const [isVisible, setIsVisible] = React88.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
47130
47653
  const debugData = useDebugData();
47131
- React87.useEffect(() => {
47654
+ React88.useEffect(() => {
47132
47655
  if (mode === "inline") return;
47133
47656
  return onDebugToggle((enabled) => {
47134
47657
  setIsVisible(enabled);
@@ -47137,7 +47660,7 @@ function RuntimeDebugger({
47137
47660
  }
47138
47661
  });
47139
47662
  }, [mode]);
47140
- React87.useEffect(() => {
47663
+ React88.useEffect(() => {
47141
47664
  if (mode === "inline") return;
47142
47665
  const handleKeyDown = (e) => {
47143
47666
  if (e.key === "`" && isVisible) {
@@ -47152,7 +47675,7 @@ function RuntimeDebugger({
47152
47675
  if (!isVisible) {
47153
47676
  return null;
47154
47677
  }
47155
- const positionClasses = {
47678
+ const positionClasses2 = {
47156
47679
  "bottom-right": "bottom-4 right-4",
47157
47680
  "bottom-left": "bottom-4 left-4",
47158
47681
  "top-right": "top-4 right-4",
@@ -47281,7 +47804,7 @@ function RuntimeDebugger({
47281
47804
  className: cn(
47282
47805
  "runtime-debugger",
47283
47806
  "fixed",
47284
- positionClasses[position],
47807
+ positionClasses2[position],
47285
47808
  isCollapsed ? "runtime-debugger--collapsed" : "runtime-debugger--expanded",
47286
47809
  className
47287
47810
  ),
@@ -47363,6 +47886,7 @@ var init_SegmentRenderer = __esm({
47363
47886
  "use client";
47364
47887
  init_MarkdownContent();
47365
47888
  init_CodeBlock();
47889
+ init_MermaidDiagram();
47366
47890
  init_QuizBlock();
47367
47891
  init_ActivationBlock();
47368
47892
  init_ConnectionBlock();
@@ -47394,6 +47918,9 @@ var init_SegmentRenderer = __esm({
47394
47918
  return /* @__PURE__ */ jsx(MarkdownContent, { content: segment.content }, `md-${index}`);
47395
47919
  }
47396
47920
  if (segment.type === "code") {
47921
+ if (segment.language === "mermaid") {
47922
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code: segment.content }, `code-${index}`);
47923
+ }
47397
47924
  if (segment.runnable && onRunCodeSimulation) {
47398
47925
  return /* @__PURE__ */ jsx(
47399
47926
  CodeRunnerPanel,
@@ -47526,99 +48053,6 @@ var init_ShowcaseOrganism = __esm({
47526
48053
  ShowcaseOrganism.displayName = "ShowcaseOrganism";
47527
48054
  }
47528
48055
  });
47529
- var SplitPane;
47530
- var init_SplitPane = __esm({
47531
- "components/core/organisms/layout/SplitPane.tsx"() {
47532
- "use client";
47533
- init_cn();
47534
- SplitPane = ({
47535
- direction = "horizontal",
47536
- ratio: initialRatio = 50,
47537
- minSize = 100,
47538
- resizable = true,
47539
- left,
47540
- right,
47541
- className,
47542
- leftClassName,
47543
- rightClassName
47544
- }) => {
47545
- const [ratio, setRatio] = useState(initialRatio);
47546
- const containerRef = useRef(null);
47547
- const isDragging = useRef(false);
47548
- const handlePointerDown = useCallback(
47549
- (e) => {
47550
- if (!resizable) return;
47551
- e.preventDefault();
47552
- isDragging.current = true;
47553
- e.currentTarget.setPointerCapture(e.pointerId);
47554
- const handlePointerMove = (ev) => {
47555
- if (!isDragging.current || !containerRef.current) return;
47556
- const rect = containerRef.current.getBoundingClientRect();
47557
- let newRatio;
47558
- if (direction === "horizontal") {
47559
- const x = ev.clientX - rect.left;
47560
- newRatio = x / rect.width * 100;
47561
- } else {
47562
- const y = ev.clientY - rect.top;
47563
- newRatio = y / rect.height * 100;
47564
- }
47565
- const minRatio = minSize / (direction === "horizontal" ? rect.width : rect.height) * 100;
47566
- const maxRatio = 100 - minRatio;
47567
- newRatio = Math.max(minRatio, Math.min(maxRatio, newRatio));
47568
- setRatio(newRatio);
47569
- };
47570
- const handlePointerUp = () => {
47571
- isDragging.current = false;
47572
- document.removeEventListener("pointermove", handlePointerMove);
47573
- document.removeEventListener("pointerup", handlePointerUp);
47574
- document.removeEventListener("pointercancel", handlePointerUp);
47575
- };
47576
- document.addEventListener("pointermove", handlePointerMove);
47577
- document.addEventListener("pointerup", handlePointerUp);
47578
- document.addEventListener("pointercancel", handlePointerUp);
47579
- },
47580
- [direction, minSize, resizable]
47581
- );
47582
- const isHorizontal = direction === "horizontal";
47583
- return /* @__PURE__ */ jsxs(
47584
- "div",
47585
- {
47586
- ref: containerRef,
47587
- className: cn(
47588
- "flex w-full h-full",
47589
- isHorizontal ? "flex-row" : "flex-col",
47590
- className
47591
- ),
47592
- children: [
47593
- /* @__PURE__ */ jsx(
47594
- "div",
47595
- {
47596
- className: cn("overflow-auto", leftClassName),
47597
- style: {
47598
- [isHorizontal ? "width" : "height"]: `${ratio}%`,
47599
- flexShrink: 0
47600
- },
47601
- children: left
47602
- }
47603
- ),
47604
- resizable && /* @__PURE__ */ jsx(
47605
- "div",
47606
- {
47607
- onPointerDown: handlePointerDown,
47608
- className: cn(
47609
- "flex-shrink-0 bg-border transition-colors touch-none",
47610
- 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"
47611
- )
47612
- }
47613
- ),
47614
- /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto", rightClassName), children: right })
47615
- ]
47616
- }
47617
- );
47618
- };
47619
- SplitPane.displayName = "SplitPane";
47620
- }
47621
- });
47622
48056
  var StatCard;
47623
48057
  var init_StatCard = __esm({
47624
48058
  "components/core/organisms/StatCard.tsx"() {
@@ -47657,7 +48091,7 @@ var init_StatCard = __esm({
47657
48091
  const labelToUse = propLabel ?? propTitle;
47658
48092
  const eventBus = useEventBus();
47659
48093
  const { t } = useTranslate();
47660
- const handleActionClick = React87__default.useCallback(() => {
48094
+ const handleActionClick = React88__default.useCallback(() => {
47661
48095
  if (action?.event) {
47662
48096
  eventBus.emit(`UI:${action.event}`, {});
47663
48097
  }
@@ -47668,7 +48102,7 @@ var init_StatCard = __esm({
47668
48102
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
47669
48103
  const isLoading = externalLoading ?? false;
47670
48104
  const error = externalError;
47671
- const computeMetricValue = React87__default.useCallback(
48105
+ const computeMetricValue = React88__default.useCallback(
47672
48106
  (metric, items) => {
47673
48107
  if (metric.value !== void 0) {
47674
48108
  return metric.value;
@@ -47707,7 +48141,7 @@ var init_StatCard = __esm({
47707
48141
  },
47708
48142
  []
47709
48143
  );
47710
- const schemaStats = React87__default.useMemo(() => {
48144
+ const schemaStats = React88__default.useMemo(() => {
47711
48145
  if (!metrics || metrics.length === 0) return null;
47712
48146
  return metrics.map((metric) => ({
47713
48147
  label: metric.label,
@@ -47715,7 +48149,7 @@ var init_StatCard = __esm({
47715
48149
  format: metric.format
47716
48150
  }));
47717
48151
  }, [metrics, data, computeMetricValue]);
47718
- const calculatedTrend = React87__default.useMemo(() => {
48152
+ const calculatedTrend = React88__default.useMemo(() => {
47719
48153
  if (manualTrend !== void 0) return manualTrend;
47720
48154
  if (previousValue === void 0 || currentValue === void 0)
47721
48155
  return void 0;
@@ -48355,8 +48789,8 @@ var init_SubagentTracePanel = __esm({
48355
48789
  ] });
48356
48790
  };
48357
48791
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
48358
- const endRef = React87__default.useRef(null);
48359
- React87__default.useEffect(() => {
48792
+ const endRef = React88__default.useRef(null);
48793
+ React88__default.useEffect(() => {
48360
48794
  if (!autoScroll) return;
48361
48795
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
48362
48796
  }, [activities.length, autoScroll]);
@@ -48450,7 +48884,7 @@ var init_SubagentTracePanel = __esm({
48450
48884
  };
48451
48885
  SubagentRichCard = ({ subagent }) => {
48452
48886
  const { t } = useTranslate();
48453
- const activities = React87__default.useMemo(
48887
+ const activities = React88__default.useMemo(
48454
48888
  () => subagentMessagesToActivities(subagent.messages),
48455
48889
  [subagent.messages]
48456
48890
  );
@@ -48527,8 +48961,8 @@ var init_SubagentTracePanel = __esm({
48527
48961
  ] });
48528
48962
  };
48529
48963
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
48530
- const endRef = React87__default.useRef(null);
48531
- React87__default.useEffect(() => {
48964
+ const endRef = React88__default.useRef(null);
48965
+ React88__default.useEffect(() => {
48532
48966
  if (!autoScroll) return;
48533
48967
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
48534
48968
  }, [messages.length, autoScroll]);
@@ -48963,7 +49397,7 @@ var init_Timeline = __esm({
48963
49397
  }) => {
48964
49398
  const { t } = useTranslate();
48965
49399
  const entityData = entity ?? [];
48966
- const items = React87__default.useMemo(() => {
49400
+ const items = React88__default.useMemo(() => {
48967
49401
  if (propItems) return propItems;
48968
49402
  if (entityData.length === 0) return [];
48969
49403
  return entityData.map((record, idx) => {
@@ -49065,7 +49499,7 @@ var init_Timeline = __esm({
49065
49499
  }
49066
49500
  });
49067
49501
  function extractToastProps(children) {
49068
- if (!React87__default.isValidElement(children)) {
49502
+ if (!React88__default.isValidElement(children)) {
49069
49503
  if (typeof children === "string") {
49070
49504
  return { message: children };
49071
49505
  }
@@ -49107,7 +49541,7 @@ var init_ToastSlot = __esm({
49107
49541
  eventBus.emit(`${prefix}CLOSE`);
49108
49542
  };
49109
49543
  if (!isVisible) return null;
49110
- const isCustomContent = React87__default.isValidElement(children) && !message;
49544
+ const isCustomContent = React88__default.isValidElement(children) && !message;
49111
49545
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
49112
49546
  Toast,
49113
49547
  {
@@ -49202,6 +49636,7 @@ var init_component_registry_generated = __esm({
49202
49636
  init_DocSearch();
49203
49637
  init_DocSidebar();
49204
49638
  init_DocTOC();
49639
+ init_DockLayout();
49205
49640
  init_DocumentDetails();
49206
49641
  init_DocumentPanel();
49207
49642
  init_DocumentViewer();
@@ -49232,6 +49667,7 @@ var init_component_registry_generated = __esm({
49232
49667
  init_FlipCard();
49233
49668
  init_FlipContainer();
49234
49669
  init_FloatingActionButton();
49670
+ init_FloatingToolbar();
49235
49671
  init_Form();
49236
49672
  init_FormField();
49237
49673
  init_FormSection();
@@ -49476,6 +49912,7 @@ var init_component_registry_generated = __esm({
49476
49912
  "DocSearch": DocSearch,
49477
49913
  "DocSidebar": DocSidebar,
49478
49914
  "DocTOC": DocTOC,
49915
+ "DockLayout": DockLayout,
49479
49916
  "DocumentDetails": DocumentDetails,
49480
49917
  "DocumentPanel": DocumentPanel,
49481
49918
  "DocumentViewer": DocumentViewer,
@@ -49506,6 +49943,7 @@ var init_component_registry_generated = __esm({
49506
49943
  "FlipCard": FlipCard,
49507
49944
  "FlipContainer": FlipContainer,
49508
49945
  "FloatingActionButton": FloatingActionButton,
49946
+ "FloatingToolbar": FloatingToolbar,
49509
49947
  "Form": Form,
49510
49948
  "FormField": FormField,
49511
49949
  "FormLayout": FormLayout,
@@ -49693,7 +50131,7 @@ function SuspenseConfigProvider({
49693
50131
  config,
49694
50132
  children
49695
50133
  }) {
49696
- return React87__default.createElement(
50134
+ return React88__default.createElement(
49697
50135
  SuspenseConfigContext.Provider,
49698
50136
  { value: config },
49699
50137
  children
@@ -49741,7 +50179,7 @@ function enrichFormFields(fields, entityDef) {
49741
50179
  }
49742
50180
  return { name: field, label: humanizeFieldName(field) };
49743
50181
  }
49744
- if (field && typeof field === "object" && !Array.isArray(field) && !React87__default.isValidElement(field) && !(field instanceof Date)) {
50182
+ if (field && typeof field === "object" && !Array.isArray(field) && !React88__default.isValidElement(field) && !(field instanceof Date)) {
49745
50183
  const obj = field;
49746
50184
  const fieldName2 = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
49747
50185
  if (!fieldName2) return field;
@@ -49794,7 +50232,7 @@ function enrichDetailFields(fields, entityDef) {
49794
50232
  const meta = metaFor(field);
49795
50233
  return meta ? { key: field, ...meta } : field;
49796
50234
  }
49797
- if (field && typeof field === "object" && !Array.isArray(field) && !React87__default.isValidElement(field) && !(field instanceof Date)) {
50235
+ if (field && typeof field === "object" && !Array.isArray(field) && !React88__default.isValidElement(field) && !(field instanceof Date)) {
49798
50236
  const obj = field;
49799
50237
  const fieldName2 = typeof obj.key === "string" ? obj.key : typeof obj.name === "string" ? obj.name : void 0;
49800
50238
  if (!fieldName2 || obj.type) return field;
@@ -50253,7 +50691,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
50253
50691
  const key = `${parentId}-${index}-trait:${traitName}`;
50254
50692
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
50255
50693
  }
50256
- return /* @__PURE__ */ jsx(React87__default.Fragment, { children: child }, `${parentId}-${index}`);
50694
+ return /* @__PURE__ */ jsx(React88__default.Fragment, { children: child }, `${parentId}-${index}`);
50257
50695
  }
50258
50696
  if (!child || typeof child !== "object") return null;
50259
50697
  const childId = `${parentId}-${index}`;
@@ -50310,7 +50748,7 @@ function isPatternConfig(value) {
50310
50748
  if (value === null || value === void 0) return false;
50311
50749
  if (typeof value !== "object") return false;
50312
50750
  if (Array.isArray(value)) return false;
50313
- if (React87__default.isValidElement(value)) return false;
50751
+ if (React88__default.isValidElement(value)) return false;
50314
50752
  if (value instanceof Date) return false;
50315
50753
  if (typeof value === "function") return false;
50316
50754
  const record = value;
@@ -50323,9 +50761,9 @@ function renderPatternValue(value) {
50323
50761
  if (typeof value === "string") return renderPatternChildren(value, () => {
50324
50762
  });
50325
50763
  if (value instanceof Date) return value.toLocaleString();
50326
- if (React87__default.isValidElement(value)) return value;
50764
+ if (React88__default.isValidElement(value)) return value;
50327
50765
  if (Array.isArray(value)) {
50328
- return value.map((item, index) => /* @__PURE__ */ jsx(React87__default.Fragment, { children: renderPatternValue(item) }, index));
50766
+ return value.map((item, index) => /* @__PURE__ */ jsx(React88__default.Fragment, { children: renderPatternValue(item) }, index));
50329
50767
  }
50330
50768
  if (isPatternConfig(value)) {
50331
50769
  const { type, ...props } = value;
@@ -50335,7 +50773,7 @@ function renderPatternValue(value) {
50335
50773
  return null;
50336
50774
  }
50337
50775
  function isPlainConfigObject(value) {
50338
- if (React87__default.isValidElement(value)) return false;
50776
+ if (React88__default.isValidElement(value)) return false;
50339
50777
  if (value instanceof Date) return false;
50340
50778
  const proto = Object.getPrototypeOf(value);
50341
50779
  return proto === Object.prototype || proto === null;
@@ -50509,7 +50947,7 @@ function SlotContentRenderer({
50509
50947
  for (const slotKey of CONTENT_NODE_SLOTS) {
50510
50948
  const slotVal = restProps[slotKey];
50511
50949
  if (slotVal === void 0 || slotVal === null) continue;
50512
- if (React87__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
50950
+ if (React88__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
50513
50951
  const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
50514
50952
  if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
50515
50953
  nodeSlotOverrides[slotKey] = renderPatternChildren(
@@ -50563,7 +51001,7 @@ function SlotContentRenderer({
50563
51001
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
50564
51002
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
50565
51003
  const sample = resolvedItems[0];
50566
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React87__default.isValidElement(sample) && !(sample instanceof Date)) {
51004
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React88__default.isValidElement(sample) && !(sample instanceof Date)) {
50567
51005
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
50568
51006
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
50569
51007
  }
@@ -50763,7 +51201,7 @@ var init_UISlotRenderer = __esm({
50763
51201
  init_useEventBus();
50764
51202
  var busLog = createLogger("almadar:eventbus");
50765
51203
  var subLog2 = createLogger("almadar:eventbus:subscribe");
50766
- var EventBusContext2 = createContext(null);
51204
+ var EventBusContext2 = globalThis.__almadarUiEventBusContext ?? (globalThis.__almadarUiEventBusContext = createContext(null));
50767
51205
  var listenerTags = /* @__PURE__ */ new WeakMap();
50768
51206
  function captureSubscriberTag(listener) {
50769
51207
  const fnName = listener.name;