@almadar/ui 6.3.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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) => {
@@ -3628,7 +3627,7 @@ var init_Select = __esm({
3628
3627
  init_cn();
3629
3628
  init_Icon();
3630
3629
  init_useEventBus();
3631
- Select = React87__default.forwardRef(
3630
+ Select = React88__default.forwardRef(
3632
3631
  (props, _ref) => {
3633
3632
  const { multiple, searchable, clearable } = props;
3634
3633
  if (multiple || searchable || clearable) {
@@ -3645,7 +3644,7 @@ var init_Checkbox = __esm({
3645
3644
  "components/core/atoms/Checkbox.tsx"() {
3646
3645
  init_cn();
3647
3646
  init_useEventBus();
3648
- Checkbox = React87__default.forwardRef(
3647
+ Checkbox = React88__default.forwardRef(
3649
3648
  ({ className, label, id, onChange, ...props }, ref) => {
3650
3649
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3651
3650
  const eventBus = useEventBus();
@@ -3699,7 +3698,7 @@ var init_Spinner = __esm({
3699
3698
  md: "h-6 w-6",
3700
3699
  lg: "h-8 w-8"
3701
3700
  };
3702
- Spinner = React87__default.forwardRef(
3701
+ Spinner = React88__default.forwardRef(
3703
3702
  ({ className, size = "md", overlay, ...props }, ref) => {
3704
3703
  if (overlay) {
3705
3704
  return /* @__PURE__ */ jsx(
@@ -3789,7 +3788,7 @@ var init_Card = __esm({
3789
3788
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
3790
3789
  "tile-image-first": "p-0 overflow-hidden"
3791
3790
  };
3792
- Card = React87__default.forwardRef(
3791
+ Card = React88__default.forwardRef(
3793
3792
  ({
3794
3793
  className,
3795
3794
  variant = "bordered",
@@ -3838,9 +3837,9 @@ var init_Card = __esm({
3838
3837
  }
3839
3838
  );
3840
3839
  Card.displayName = "Card";
3841
- 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 }));
3842
3841
  CardHeader.displayName = "CardHeader";
3843
- CardTitle = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3842
+ CardTitle = React88__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3844
3843
  "h3",
3845
3844
  {
3846
3845
  ref,
@@ -3853,11 +3852,11 @@ var init_Card = __esm({
3853
3852
  }
3854
3853
  ));
3855
3854
  CardTitle.displayName = "CardTitle";
3856
- 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 }));
3857
3856
  CardContent.displayName = "CardContent";
3858
3857
  CardBody = CardContent;
3859
3858
  CardBody.displayName = "CardBody";
3860
- CardFooter = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3859
+ CardFooter = React88__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3861
3860
  "div",
3862
3861
  {
3863
3862
  ref,
@@ -3944,7 +3943,7 @@ var init_FilterPill = __esm({
3944
3943
  md: "w-3.5 h-3.5",
3945
3944
  lg: "w-4 h-4"
3946
3945
  };
3947
- FilterPill = React87__default.forwardRef(
3946
+ FilterPill = React88__default.forwardRef(
3948
3947
  ({
3949
3948
  className,
3950
3949
  variant = "default",
@@ -4073,8 +4072,8 @@ var init_Avatar = __esm({
4073
4072
  actionPayload
4074
4073
  }) => {
4075
4074
  const eventBus = useEventBus();
4076
- const [imgFailed, setImgFailed] = React87__default.useState(false);
4077
- React87__default.useEffect(() => {
4075
+ const [imgFailed, setImgFailed] = React88__default.useState(false);
4076
+ React88__default.useEffect(() => {
4078
4077
  setImgFailed(false);
4079
4078
  }, [src]);
4080
4079
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -4187,7 +4186,7 @@ var init_Center = __esm({
4187
4186
  as: Component = "div"
4188
4187
  }) => {
4189
4188
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
4190
- return React87__default.createElement(Component, {
4189
+ return React88__default.createElement(Component, {
4191
4190
  className: cn(
4192
4191
  inline ? "inline-flex" : "flex",
4193
4192
  horizontal && "justify-center",
@@ -4455,7 +4454,7 @@ var init_Radio = __esm({
4455
4454
  md: "w-2.5 h-2.5",
4456
4455
  lg: "w-3 h-3"
4457
4456
  };
4458
- Radio = React87__default.forwardRef(
4457
+ Radio = React88__default.forwardRef(
4459
4458
  ({
4460
4459
  label,
4461
4460
  helperText,
@@ -4472,12 +4471,12 @@ var init_Radio = __esm({
4472
4471
  onChange,
4473
4472
  ...props
4474
4473
  }, ref) => {
4475
- const reactId = React87__default.useId();
4474
+ const reactId = React88__default.useId();
4476
4475
  const baseId = id || `radio-${reactId}`;
4477
4476
  const hasError = !!error;
4478
4477
  const eventBus = useEventBus();
4479
- const [selected, setSelected] = React87__default.useState(value);
4480
- React87__default.useEffect(() => {
4478
+ const [selected, setSelected] = React88__default.useState(value);
4479
+ React88__default.useEffect(() => {
4481
4480
  if (value !== void 0) setSelected(value);
4482
4481
  }, [value]);
4483
4482
  const pick = (next, e) => {
@@ -4659,7 +4658,7 @@ var init_Switch = __esm({
4659
4658
  "components/core/atoms/Switch.tsx"() {
4660
4659
  "use client";
4661
4660
  init_cn();
4662
- Switch = React87.forwardRef(
4661
+ Switch = React88.forwardRef(
4663
4662
  ({
4664
4663
  checked,
4665
4664
  defaultChecked = false,
@@ -4670,10 +4669,10 @@ var init_Switch = __esm({
4670
4669
  name,
4671
4670
  className
4672
4671
  }, ref) => {
4673
- const [isChecked, setIsChecked] = React87.useState(
4672
+ const [isChecked, setIsChecked] = React88.useState(
4674
4673
  checked !== void 0 ? checked : defaultChecked
4675
4674
  );
4676
- React87.useEffect(() => {
4675
+ React88.useEffect(() => {
4677
4676
  if (checked !== void 0) {
4678
4677
  setIsChecked(checked);
4679
4678
  }
@@ -4836,7 +4835,7 @@ var init_Stack = __esm({
4836
4835
  };
4837
4836
  const isHorizontal = direction === "horizontal";
4838
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";
4839
- return React87__default.createElement(
4838
+ return React88__default.createElement(
4840
4839
  Component,
4841
4840
  {
4842
4841
  className: cn(
@@ -5036,7 +5035,7 @@ var Aside;
5036
5035
  var init_Aside = __esm({
5037
5036
  "components/core/atoms/Aside.tsx"() {
5038
5037
  init_cn();
5039
- Aside = React87__default.forwardRef(
5038
+ Aside = React88__default.forwardRef(
5040
5039
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
5041
5040
  );
5042
5041
  Aside.displayName = "Aside";
@@ -5115,9 +5114,9 @@ var init_LawReferenceTooltip = __esm({
5115
5114
  className
5116
5115
  }) => {
5117
5116
  const { t } = useTranslate();
5118
- const [isVisible, setIsVisible] = React87__default.useState(false);
5119
- const timeoutRef = React87__default.useRef(null);
5120
- 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);
5121
5120
  const handleMouseEnter = () => {
5122
5121
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5123
5122
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -5128,7 +5127,7 @@ var init_LawReferenceTooltip = __esm({
5128
5127
  };
5129
5128
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
5130
5129
  const open = isVisible || revealed;
5131
- React87__default.useEffect(() => {
5130
+ React88__default.useEffect(() => {
5132
5131
  return () => {
5133
5132
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5134
5133
  };
@@ -5338,7 +5337,7 @@ var init_StatusDot = __esm({
5338
5337
  md: "w-2.5 h-2.5",
5339
5338
  lg: "w-3 h-3"
5340
5339
  };
5341
- StatusDot = React87__default.forwardRef(
5340
+ StatusDot = React88__default.forwardRef(
5342
5341
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
5343
5342
  return /* @__PURE__ */ jsx(
5344
5343
  "span",
@@ -5392,7 +5391,7 @@ var init_TrendIndicator = __esm({
5392
5391
  down: "trending-down",
5393
5392
  flat: "arrow-right"
5394
5393
  };
5395
- TrendIndicator = React87__default.forwardRef(
5394
+ TrendIndicator = React88__default.forwardRef(
5396
5395
  ({
5397
5396
  className,
5398
5397
  value,
@@ -5461,7 +5460,7 @@ var init_RangeSlider = __esm({
5461
5460
  md: "w-4 h-4",
5462
5461
  lg: "w-5 h-5"
5463
5462
  };
5464
- RangeSlider = React87__default.forwardRef(
5463
+ RangeSlider = React88__default.forwardRef(
5465
5464
  ({
5466
5465
  className,
5467
5466
  min = 0,
@@ -6118,7 +6117,7 @@ var init_ContentSection = __esm({
6118
6117
  md: "py-16",
6119
6118
  lg: "py-24"
6120
6119
  };
6121
- ContentSection = React87__default.forwardRef(
6120
+ ContentSection = React88__default.forwardRef(
6122
6121
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
6123
6122
  return /* @__PURE__ */ jsx(
6124
6123
  Box,
@@ -6652,7 +6651,7 @@ var init_AnimatedReveal = __esm({
6652
6651
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6653
6652
  "none": {}
6654
6653
  };
6655
- AnimatedReveal = React87__default.forwardRef(
6654
+ AnimatedReveal = React88__default.forwardRef(
6656
6655
  ({
6657
6656
  trigger = "scroll",
6658
6657
  animation = "fade-up",
@@ -6812,7 +6811,7 @@ var init_AnimatedGraphic = __esm({
6812
6811
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6813
6812
  "use client";
6814
6813
  init_cn();
6815
- AnimatedGraphic = React87__default.forwardRef(
6814
+ AnimatedGraphic = React88__default.forwardRef(
6816
6815
  ({
6817
6816
  src,
6818
6817
  svgContent,
@@ -6835,7 +6834,7 @@ var init_AnimatedGraphic = __esm({
6835
6834
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6836
6835
  const resolvedSvg = svgContent ?? fetchedSvg;
6837
6836
  const prevAnimateRef = useRef(animate);
6838
- const setRef = React87__default.useCallback(
6837
+ const setRef = React88__default.useCallback(
6839
6838
  (node) => {
6840
6839
  containerRef.current = node;
6841
6840
  if (typeof ref === "function") ref(node);
@@ -7588,9 +7587,9 @@ function ControlButton({
7588
7587
  className
7589
7588
  }) {
7590
7589
  const eventBus = useEventBus();
7591
- const [isPressed, setIsPressed] = React87.useState(false);
7590
+ const [isPressed, setIsPressed] = React88.useState(false);
7592
7591
  const actualPressed = pressed ?? isPressed;
7593
- const handlePointerDown = React87.useCallback(
7592
+ const handlePointerDown = React88.useCallback(
7594
7593
  (e) => {
7595
7594
  e.preventDefault();
7596
7595
  if (disabled) return;
@@ -7600,7 +7599,7 @@ function ControlButton({
7600
7599
  },
7601
7600
  [disabled, pressEvent, eventBus, onPress]
7602
7601
  );
7603
- const handlePointerUp = React87.useCallback(
7602
+ const handlePointerUp = React88.useCallback(
7604
7603
  (e) => {
7605
7604
  e.preventDefault();
7606
7605
  if (disabled) return;
@@ -7610,7 +7609,7 @@ function ControlButton({
7610
7609
  },
7611
7610
  [disabled, releaseEvent, eventBus, onRelease]
7612
7611
  );
7613
- const handlePointerLeave = React87.useCallback(
7612
+ const handlePointerLeave = React88.useCallback(
7614
7613
  (e) => {
7615
7614
  if (isPressed) {
7616
7615
  setIsPressed(false);
@@ -7869,18 +7868,18 @@ function ControlGrid({
7869
7868
  className
7870
7869
  }) {
7871
7870
  const eventBus = useEventBus();
7872
- const [active, setActive] = React87.useState(/* @__PURE__ */ new Set());
7873
- const [coarse, setCoarse] = React87.useState(
7871
+ const [active, setActive] = React88.useState(/* @__PURE__ */ new Set());
7872
+ const [coarse, setCoarse] = React88.useState(
7874
7873
  () => typeof window !== "undefined" && window.matchMedia("(pointer: coarse)").matches
7875
7874
  );
7876
- React87.useEffect(() => {
7875
+ React88.useEffect(() => {
7877
7876
  if (visibility !== "auto" || typeof window === "undefined") return;
7878
7877
  const mq = window.matchMedia("(pointer: coarse)");
7879
7878
  const onChange = (e) => setCoarse(e.matches);
7880
7879
  mq.addEventListener("change", onChange);
7881
7880
  return () => mq.removeEventListener("change", onChange);
7882
7881
  }, [visibility]);
7883
- const handlePress = React87.useCallback(
7882
+ const handlePress = React88.useCallback(
7884
7883
  (id) => {
7885
7884
  setActive((prev) => new Set(prev).add(id));
7886
7885
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -7894,7 +7893,7 @@ function ControlGrid({
7894
7893
  },
7895
7894
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
7896
7895
  );
7897
- const handleRelease = React87.useCallback(
7896
+ const handleRelease = React88.useCallback(
7898
7897
  (id) => {
7899
7898
  setActive((prev) => {
7900
7899
  const next = new Set(prev);
@@ -8257,7 +8256,7 @@ function GameMenu({
8257
8256
  }) {
8258
8257
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
8259
8258
  const eventBus = useEventBus();
8260
- const handleOptionClick = React87.useCallback(
8259
+ const handleOptionClick = React88.useCallback(
8261
8260
  (option) => {
8262
8261
  if (option.event) {
8263
8262
  eventBus.emit(`UI:${option.event}`, { option });
@@ -8493,7 +8492,7 @@ function StateGraph({
8493
8492
  }) {
8494
8493
  const eventBus = useEventBus();
8495
8494
  const nodes = states ?? [];
8496
- const positions = React87.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8495
+ const positions = React88.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8497
8496
  return /* @__PURE__ */ jsxs(
8498
8497
  Box,
8499
8498
  {
@@ -8564,8 +8563,8 @@ function MiniMap({
8564
8563
  tileAssets,
8565
8564
  unitAssets
8566
8565
  }) {
8567
- const canvasRef = React87.useRef(null);
8568
- const imgCacheRef = React87.useRef(/* @__PURE__ */ new Map());
8566
+ const canvasRef = React88.useRef(null);
8567
+ const imgCacheRef = React88.useRef(/* @__PURE__ */ new Map());
8569
8568
  function loadImg(url) {
8570
8569
  const cached = imgCacheRef.current.get(url);
8571
8570
  if (cached) return cached.complete ? cached : null;
@@ -8581,7 +8580,7 @@ function MiniMap({
8581
8580
  imgCacheRef.current.set(url, img);
8582
8581
  return null;
8583
8582
  }
8584
- React87.useEffect(() => {
8583
+ React88.useEffect(() => {
8585
8584
  const canvas = canvasRef.current;
8586
8585
  if (!canvas) return;
8587
8586
  const ctx = canvas.getContext("2d");
@@ -9815,7 +9814,7 @@ function proceduralShapes(view, pos, fade, progress) {
9815
9814
  }
9816
9815
  }
9817
9816
  }
9818
- function expandFxItem(view, node, epochNowMs, dim, projector) {
9817
+ function expandFxItem(view, node, epochNowMs, dim, projector, fontFamily) {
9819
9818
  if (view.space === "screen") return [];
9820
9819
  const tickMs = node.tickMs ?? DEFAULT_TICK_MS;
9821
9820
  const { ageMs, progress, fade } = fxLifecycle(view, epochNowMs, tickMs);
@@ -9852,6 +9851,7 @@ function expandFxItem(view, node, epochNowMs, dim, projector) {
9852
9851
  }
9853
9852
  if (view.message) {
9854
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";
9855
9855
  const text = {
9856
9856
  type: "draw-text",
9857
9857
  text: view.message,
@@ -9859,18 +9859,18 @@ function expandFxItem(view, node, epochNowMs, dim, projector) {
9859
9859
  offsetY: -(0.15 + 0.55 * progress),
9860
9860
  color: view.color ?? node.textColor ?? DEFAULT_TEXT_COLOR,
9861
9861
  opacity: fade,
9862
- ...pxSize ? { font: `bold ${pxSize}px system-ui, sans-serif` } : {}
9862
+ font: `bold ${pxSize ?? 14}px ${family}`
9863
9863
  };
9864
9864
  out.push(text);
9865
9865
  }
9866
9866
  return out;
9867
9867
  }
9868
- function expandFxLayer(node, epochNowMs, dim, projector) {
9868
+ function expandFxLayer(node, epochNowMs, dim, projector, fontFamily) {
9869
9869
  if (!Array.isArray(node.items)) return [];
9870
9870
  const out = [];
9871
9871
  for (const item of node.items) {
9872
9872
  if (!item || typeof item.id !== "string") continue;
9873
- out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim, projector));
9873
+ out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim, projector, fontFamily));
9874
9874
  }
9875
9875
  return out;
9876
9876
  }
@@ -9937,7 +9937,7 @@ function paintDrawable(painter, node, dctx) {
9937
9937
  break;
9938
9938
  case "draw-fx-layer": {
9939
9939
  const epochNow = dctx.time > 0 && typeof performance !== "undefined" ? performance.timeOrigin + dctx.time : 0;
9940
- for (const child of expandFxLayer(node, epochNow, "2d", dctx.projector)) paintDrawable(painter, child, dctx);
9940
+ for (const child of expandFxLayer(node, epochNow, "2d", dctx.projector, dctx.fontFamily)) paintDrawable(painter, child, dctx);
9941
9941
  break;
9942
9942
  }
9943
9943
  }
@@ -10047,7 +10047,7 @@ function Canvas2D({
10047
10047
  const registerChildDrawable = useCallback((node) => {
10048
10048
  childDrawablesRef.current.push(node);
10049
10049
  }, []);
10050
- const hasJsxChildren = React87.Children.count(children) > 0;
10050
+ const hasJsxChildren = React88.Children.count(children) > 0;
10051
10051
  function isDrawableLayer(node) {
10052
10052
  return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
10053
10053
  }
@@ -10605,7 +10605,7 @@ function Canvas({
10605
10605
  if (mode !== "3d") return;
10606
10606
  const next = childDrawablesRef.current;
10607
10607
  canvasLog.debug("children:adopt", { registered: next.length, adopted: childDrawables.length });
10608
- if (next.length === 0 && React87.Children.count(children) > 0) return;
10608
+ if (next.length === 0 && React88.Children.count(children) > 0) return;
10609
10609
  setChildDrawables(
10610
10610
  (prev) => prev.length === next.length && JSON.stringify(prev) === JSON.stringify(next) ? prev : [...next]
10611
10611
  );
@@ -10643,7 +10643,7 @@ function Canvas({
10643
10643
  };
10644
10644
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10645
10645
  /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Canvas3DHost, { ...props3d }) }),
10646
- 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 }) })
10647
10647
  ] });
10648
10648
  }
10649
10649
  return /* @__PURE__ */ jsx(
@@ -11068,7 +11068,7 @@ function LinearView({
11068
11068
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
11069
11069
  const isDone = i < currentIdx;
11070
11070
  const isCurrent = i === currentIdx;
11071
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
11071
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
11072
11072
  i > 0 && /* @__PURE__ */ jsx(
11073
11073
  Typography,
11074
11074
  {
@@ -11603,7 +11603,7 @@ function SequenceBar({
11603
11603
  else onSlotRemove?.(index);
11604
11604
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
11605
11605
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
11606
- 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: [
11607
11607
  i > 0 && /* @__PURE__ */ jsx(
11608
11608
  Typography,
11609
11609
  {
@@ -12292,7 +12292,7 @@ var init_LearningCanvas = __esm({
12292
12292
  if (drawables?.length && projector) {
12293
12293
  const painter = createWebPainter(ctx, invalidateRef.current);
12294
12294
  const timeMs = needsAnim && typeof performance !== "undefined" ? performance.now() : 0;
12295
- const dctx = { projector, time: timeMs, invalidate: invalidateRef.current };
12295
+ const dctx = { projector, time: timeMs, invalidate: invalidateRef.current, fontFamily: themeBodyFont(canvas) };
12296
12296
  for (const node of drawables) {
12297
12297
  paintDrawable(painter, node, dctx);
12298
12298
  }
@@ -12454,7 +12454,7 @@ var init_ErrorBoundary = __esm({
12454
12454
  }
12455
12455
  );
12456
12456
  };
12457
- ErrorBoundary = class extends React87__default.Component {
12457
+ ErrorBoundary = class extends React88__default.Component {
12458
12458
  constructor(props) {
12459
12459
  super(props);
12460
12460
  __publicField(this, "reset", () => {
@@ -13106,7 +13106,7 @@ var init_Container = __esm({
13106
13106
  as: Component = "div"
13107
13107
  }) => {
13108
13108
  const resolvedSize = maxWidth ?? size ?? "lg";
13109
- return React87__default.createElement(
13109
+ return React88__default.createElement(
13110
13110
  Component,
13111
13111
  {
13112
13112
  className: cn(
@@ -14043,7 +14043,7 @@ var init_FloatingActionButton = __esm({
14043
14043
  document.addEventListener("mousedown", handleClickOutside);
14044
14044
  return () => document.removeEventListener("mousedown", handleClickOutside);
14045
14045
  }, [isExpanded, actions]);
14046
- const positionClasses = {
14046
+ const positionClasses2 = {
14047
14047
  "bottom-right": "bottom-6 right-6",
14048
14048
  "bottom-left": "bottom-6 left-6",
14049
14049
  "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
@@ -14052,7 +14052,7 @@ var init_FloatingActionButton = __esm({
14052
14052
  "top-center": "top-6 left-1/2 -translate-x-1/2"
14053
14053
  };
14054
14054
  if (resolvedAction && (!actions || actions.length === 0)) {
14055
- 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(
14056
14056
  Button,
14057
14057
  {
14058
14058
  variant: resolvedAction.variant || "primary",
@@ -14080,7 +14080,7 @@ var init_FloatingActionButton = __esm({
14080
14080
  ref: fabRef,
14081
14081
  className: cn(
14082
14082
  "fixed z-50 flex flex-col items-end gap-3",
14083
- positionClasses[position],
14083
+ positionClasses2[position],
14084
14084
  position.includes("left") && "items-start",
14085
14085
  className
14086
14086
  ),
@@ -17016,9 +17016,11 @@ var init_Tabs = __esm({
17016
17016
  }
17017
17017
  };
17018
17018
  const handleKeyDown = (e, index) => {
17019
- 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) {
17020
17022
  e.preventDefault();
17021
- const direction = e.key === "ArrowLeft" ? -1 : 1;
17023
+ const direction = e.key === prevKey ? -1 : 1;
17022
17024
  const nextIndex = (index + direction + safeItems.length) % safeItems.length;
17023
17025
  const nextTab = safeItems[nextIndex];
17024
17026
  if (nextTab && !nextTab.disabled) {
@@ -17590,7 +17592,7 @@ var init_CodeBlock = __esm({
17590
17592
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
17591
17593
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
17592
17594
  HIDDEN_LINE_NUMBERS = { display: "none" };
17593
- CodeBlock = React87__default.memo(
17595
+ CodeBlock = React88__default.memo(
17594
17596
  ({
17595
17597
  code: rawCode,
17596
17598
  language = "text",
@@ -18173,14 +18175,77 @@ var init_CodeBlock = __esm({
18173
18175
  CodeBlock.displayName = "CodeBlock";
18174
18176
  }
18175
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
+ });
18176
18240
  var MarkdownContent;
18177
18241
  var init_MarkdownContent = __esm({
18178
18242
  "components/core/molecules/markdown/MarkdownContent.tsx"() {
18179
18243
  init_katex_min();
18180
18244
  init_Box();
18181
18245
  init_CodeBlock();
18246
+ init_MermaidDiagram();
18182
18247
  init_cn();
18183
- MarkdownContent = React87__default.memo(
18248
+ MarkdownContent = React88__default.memo(
18184
18249
  ({ content, direction = "ltr", className }) => {
18185
18250
  const { t: _t } = useTranslate();
18186
18251
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -18225,6 +18290,9 @@ var init_MarkdownContent = __esm({
18225
18290
  if (!inline) {
18226
18291
  const match = /language-(\w+)/.exec(codeClassName ?? "");
18227
18292
  const code = String(children).replace(/\n$/, "");
18293
+ if (match?.[1] === "mermaid") {
18294
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code });
18295
+ }
18228
18296
  if (match) {
18229
18297
  return /* @__PURE__ */ jsx(
18230
18298
  CodeBlock,
@@ -19507,7 +19575,7 @@ var init_StateMachineView = __esm({
19507
19575
  style: { top: title ? 30 : 0 },
19508
19576
  children: [
19509
19577
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
19510
- 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(
19511
19579
  StateNode2,
19512
19580
  {
19513
19581
  state,
@@ -25696,7 +25764,7 @@ var init_Menu = __esm({
25696
25764
  "bottom-end": "bottom-start"
25697
25765
  };
25698
25766
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
25699
- const triggerElement = React87__default.isValidElement(trigger) ? React87__default.cloneElement(trigger, {
25767
+ const triggerElement = React88__default.isValidElement(trigger) ? React88__default.cloneElement(trigger, {
25700
25768
  ref: triggerRef,
25701
25769
  onClick: handleToggle
25702
25770
  }) : /* @__PURE__ */ jsx(
@@ -25799,14 +25867,14 @@ function useDataDnd(args) {
25799
25867
  const isZone = Boolean(dragGroup || accepts || sortable);
25800
25868
  const enabled = isZone || Boolean(dndRoot);
25801
25869
  const eventBus = useEventBus();
25802
- const parentRoot = React87__default.useContext(RootCtx);
25870
+ const parentRoot = React88__default.useContext(RootCtx);
25803
25871
  const isRoot = enabled && parentRoot === null;
25804
- const zoneId = React87__default.useId();
25872
+ const zoneId = React88__default.useId();
25805
25873
  const ownGroup = dragGroup ?? accepts ?? zoneId;
25806
- const [optimisticOrders, setOptimisticOrders] = React87__default.useState(() => /* @__PURE__ */ new Map());
25807
- const optimisticOrdersRef = React87__default.useRef(optimisticOrders);
25874
+ const [optimisticOrders, setOptimisticOrders] = React88__default.useState(() => /* @__PURE__ */ new Map());
25875
+ const optimisticOrdersRef = React88__default.useRef(optimisticOrders);
25808
25876
  optimisticOrdersRef.current = optimisticOrders;
25809
- const clearOptimisticOrder = React87__default.useCallback((group) => {
25877
+ const clearOptimisticOrder = React88__default.useCallback((group) => {
25810
25878
  setOptimisticOrders((prev) => {
25811
25879
  if (!prev.has(group)) return prev;
25812
25880
  const next = new Map(prev);
@@ -25831,7 +25899,7 @@ function useDataDnd(args) {
25831
25899
  const raw = it[dndItemIdField];
25832
25900
  return raw != null ? String(raw) : `__idx_${idx}`;
25833
25901
  }).join("|");
25834
- const itemIds = React87__default.useMemo(
25902
+ const itemIds = React88__default.useMemo(
25835
25903
  () => orderedItems.map((it, idx) => {
25836
25904
  const raw = it[dndItemIdField];
25837
25905
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -25842,7 +25910,7 @@ function useDataDnd(args) {
25842
25910
  const raw = it[dndItemIdField];
25843
25911
  return raw != null ? String(raw) : `__${idx}`;
25844
25912
  }).join("|");
25845
- React87__default.useEffect(() => {
25913
+ React88__default.useEffect(() => {
25846
25914
  const root = isRoot ? null : parentRoot;
25847
25915
  if (root) {
25848
25916
  root.clearOptimisticOrder(ownGroup);
@@ -25850,20 +25918,20 @@ function useDataDnd(args) {
25850
25918
  clearOptimisticOrder(ownGroup);
25851
25919
  }
25852
25920
  }, [itemsContentSig, ownGroup]);
25853
- const zonesRef = React87__default.useRef(/* @__PURE__ */ new Map());
25854
- const registerZone = React87__default.useCallback((zoneId2, meta2) => {
25921
+ const zonesRef = React88__default.useRef(/* @__PURE__ */ new Map());
25922
+ const registerZone = React88__default.useCallback((zoneId2, meta2) => {
25855
25923
  zonesRef.current.set(zoneId2, meta2);
25856
25924
  }, []);
25857
- const unregisterZone = React87__default.useCallback((zoneId2) => {
25925
+ const unregisterZone = React88__default.useCallback((zoneId2) => {
25858
25926
  zonesRef.current.delete(zoneId2);
25859
25927
  }, []);
25860
- const [activeDrag, setActiveDrag] = React87__default.useState(null);
25861
- const [overZoneGroup, setOverZoneGroup] = React87__default.useState(null);
25862
- 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(
25863
25931
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
25864
25932
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
25865
25933
  );
25866
- React87__default.useEffect(() => {
25934
+ React88__default.useEffect(() => {
25867
25935
  const target = isRoot ? null : parentRoot;
25868
25936
  if (!target) {
25869
25937
  zonesRef.current.set(zoneId, meta);
@@ -25882,7 +25950,7 @@ function useDataDnd(args) {
25882
25950
  }, [parentRoot, isRoot, zoneId, meta]);
25883
25951
  const sensors = useAlmadarDndSensors(true);
25884
25952
  const collisionDetection = almadarDndCollisionDetection;
25885
- const findZoneByItem = React87__default.useCallback(
25953
+ const findZoneByItem = React88__default.useCallback(
25886
25954
  (id) => {
25887
25955
  for (const z of zonesRef.current.values()) {
25888
25956
  if (z.itemIds.includes(id)) return z;
@@ -25891,7 +25959,7 @@ function useDataDnd(args) {
25891
25959
  },
25892
25960
  []
25893
25961
  );
25894
- React87__default.useCallback(
25962
+ React88__default.useCallback(
25895
25963
  (group) => {
25896
25964
  for (const z of zonesRef.current.values()) {
25897
25965
  if (z.group === group) return z;
@@ -25900,7 +25968,7 @@ function useDataDnd(args) {
25900
25968
  },
25901
25969
  []
25902
25970
  );
25903
- const handleDragEnd = React87__default.useCallback(
25971
+ const handleDragEnd = React88__default.useCallback(
25904
25972
  (event) => {
25905
25973
  const { active, over } = event;
25906
25974
  const activeIdStr = String(active.id);
@@ -25991,8 +26059,8 @@ function useDataDnd(args) {
25991
26059
  },
25992
26060
  [eventBus]
25993
26061
  );
25994
- const sortableData = React87__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
25995
- const SortableItem = React87__default.useCallback(
26062
+ const sortableData = React88__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
26063
+ const SortableItem = React88__default.useCallback(
25996
26064
  ({ id, children }) => {
25997
26065
  const {
25998
26066
  attributes,
@@ -26032,7 +26100,7 @@ function useDataDnd(args) {
26032
26100
  id: droppableId,
26033
26101
  data: sortableData
26034
26102
  });
26035
- const ctx = React87__default.useContext(RootCtx);
26103
+ const ctx = React88__default.useContext(RootCtx);
26036
26104
  const activeDrag2 = ctx?.activeDrag ?? null;
26037
26105
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
26038
26106
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -26047,7 +26115,7 @@ function useDataDnd(args) {
26047
26115
  showForeignPlaceholder,
26048
26116
  ctxAvailable: ctx != null
26049
26117
  });
26050
- React87__default.useEffect(() => {
26118
+ React88__default.useEffect(() => {
26051
26119
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
26052
26120
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
26053
26121
  return /* @__PURE__ */ jsx(
@@ -26061,11 +26129,11 @@ function useDataDnd(args) {
26061
26129
  }
26062
26130
  );
26063
26131
  };
26064
- const rootContextValue = React87__default.useMemo(
26132
+ const rootContextValue = React88__default.useMemo(
26065
26133
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
26066
26134
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
26067
26135
  );
26068
- const handleDragStart = React87__default.useCallback((event) => {
26136
+ const handleDragStart = React88__default.useCallback((event) => {
26069
26137
  const sourceZone = findZoneByItem(event.active.id);
26070
26138
  const rect = event.active.rect.current.initial;
26071
26139
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -26084,7 +26152,7 @@ function useDataDnd(args) {
26084
26152
  isRoot
26085
26153
  });
26086
26154
  }, [findZoneByItem, isRoot, zoneId]);
26087
- const handleDragOver = React87__default.useCallback((event) => {
26155
+ const handleDragOver = React88__default.useCallback((event) => {
26088
26156
  const { active, over } = event;
26089
26157
  const overData = over?.data?.current;
26090
26158
  const overGroup = overData?.dndGroup ?? null;
@@ -26154,7 +26222,7 @@ function useDataDnd(args) {
26154
26222
  return next;
26155
26223
  });
26156
26224
  }, []);
26157
- const handleDragCancel = React87__default.useCallback((event) => {
26225
+ const handleDragCancel = React88__default.useCallback((event) => {
26158
26226
  setActiveDrag(null);
26159
26227
  setOverZoneGroup(null);
26160
26228
  dndLog.warn("dragCancel", {
@@ -26162,12 +26230,12 @@ function useDataDnd(args) {
26162
26230
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
26163
26231
  });
26164
26232
  }, []);
26165
- const handleDragEndWithCleanup = React87__default.useCallback((event) => {
26233
+ const handleDragEndWithCleanup = React88__default.useCallback((event) => {
26166
26234
  handleDragEnd(event);
26167
26235
  setActiveDrag(null);
26168
26236
  setOverZoneGroup(null);
26169
26237
  }, [handleDragEnd]);
26170
- const wrapContainer = React87__default.useCallback(
26238
+ const wrapContainer = React88__default.useCallback(
26171
26239
  (children) => {
26172
26240
  if (!enabled) return children;
26173
26241
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -26221,7 +26289,7 @@ var init_useDataDnd = __esm({
26221
26289
  init_useAlmadarDndCollision();
26222
26290
  init_Box();
26223
26291
  dndLog = createLogger("almadar:ui:dnd");
26224
- RootCtx = React87__default.createContext(null);
26292
+ RootCtx = React88__default.createContext(null);
26225
26293
  }
26226
26294
  });
26227
26295
  function renderIconInput(icon, props) {
@@ -26736,7 +26804,7 @@ function DataList({
26736
26804
  }) {
26737
26805
  const eventBus = useEventBus();
26738
26806
  const { t } = useTranslate();
26739
- const [visibleCount, setVisibleCount] = React87__default.useState(pageSize || Infinity);
26807
+ const [visibleCount, setVisibleCount] = React88__default.useState(pageSize || Infinity);
26740
26808
  const fieldDefs = fields ?? columns ?? [];
26741
26809
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
26742
26810
  const dnd = useDataDnd({
@@ -26752,14 +26820,14 @@ function DataList({
26752
26820
  dndRoot
26753
26821
  });
26754
26822
  const orderedData = dnd.orderedItems;
26755
- const allData = React87__default.useMemo(
26823
+ const allData = React88__default.useMemo(
26756
26824
  () => sortRows(orderedData, sortBy, sortDirection),
26757
26825
  [orderedData, sortBy, sortDirection]
26758
26826
  );
26759
26827
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
26760
26828
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
26761
26829
  const hasRenderProp = typeof children === "function";
26762
- React87__default.useEffect(() => {
26830
+ React88__default.useEffect(() => {
26763
26831
  const renderItemTypeOf = typeof schemaRenderItem;
26764
26832
  const childrenTypeOf = typeof children;
26765
26833
  if (data.length > 0 && !hasRenderProp) {
@@ -26879,7 +26947,7 @@ function DataList({
26879
26947
  return v === void 0 || v === null || v === "" ? raw : String(v);
26880
26948
  };
26881
26949
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
26882
- groups2.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
26950
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
26883
26951
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
26884
26952
  group.items.map((itemData, index) => {
26885
26953
  const id = itemData.id || `${gi}-${index}`;
@@ -27095,7 +27163,7 @@ function DataList({
27095
27163
  className
27096
27164
  ),
27097
27165
  children: [
27098
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
27166
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
27099
27167
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
27100
27168
  group.items.map(
27101
27169
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -27182,7 +27250,7 @@ var init_FormSection = __esm({
27182
27250
  columns = 1,
27183
27251
  className
27184
27252
  }) => {
27185
- const [collapsed, setCollapsed] = React87__default.useState(defaultCollapsed);
27253
+ const [collapsed, setCollapsed] = React88__default.useState(defaultCollapsed);
27186
27254
  const { t } = useTranslate();
27187
27255
  const eventBus = useEventBus();
27188
27256
  const gridClass = {
@@ -27190,7 +27258,7 @@ var init_FormSection = __esm({
27190
27258
  2: "grid-cols-1 md:grid-cols-2",
27191
27259
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
27192
27260
  }[columns];
27193
- React87__default.useCallback(() => {
27261
+ React88__default.useCallback(() => {
27194
27262
  if (collapsible) {
27195
27263
  setCollapsed((prev) => !prev);
27196
27264
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -27463,6 +27531,112 @@ var init_GridPicker = __esm({
27463
27531
  GridPicker.displayName = "GridPicker";
27464
27532
  }
27465
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
+ });
27466
27640
  function fileIcon(name) {
27467
27641
  const ext = name.split(".").pop()?.toLowerCase() ?? "";
27468
27642
  switch (ext) {
@@ -27488,6 +27662,13 @@ function fileIcon(name) {
27488
27662
  return "file";
27489
27663
  }
27490
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
+ }
27491
27672
  function ancestorsOf(id, byId) {
27492
27673
  const out = /* @__PURE__ */ new Set();
27493
27674
  if (!id) return out;
@@ -27505,6 +27686,8 @@ var init_FileTree = __esm({
27505
27686
  init_Box();
27506
27687
  init_Typography();
27507
27688
  init_Icon();
27689
+ init_useDraggable();
27690
+ init_useDropZone();
27508
27691
  TreeNodeItem = ({
27509
27692
  node,
27510
27693
  depth,
@@ -27588,10 +27771,12 @@ var init_FileTree = __esm({
27588
27771
  depth,
27589
27772
  indent,
27590
27773
  childrenByParent,
27774
+ roots,
27591
27775
  onNodeSelect,
27592
27776
  onNodeAction,
27593
27777
  nodeActionIcon,
27594
27778
  nodeActionLabel,
27779
+ onNodeReorder,
27595
27780
  selectedId,
27596
27781
  look,
27597
27782
  isExpanded,
@@ -27602,6 +27787,7 @@ var init_FileTree = __esm({
27602
27787
  const expanded = hasChildren && isExpanded(item.id, depth);
27603
27788
  const isSelected = selectedId !== void 0 && selectedId !== "" && item.id === selectedId;
27604
27789
  const nav = look === "nav";
27790
+ const rowRef = useRef(null);
27605
27791
  const handleClick = useCallback(() => {
27606
27792
  if (hasChildren && !onNodeSelect) onToggle(item.id, expanded);
27607
27793
  onNodeSelect?.(item.id);
@@ -27614,16 +27800,50 @@ var init_FileTree = __esm({
27614
27800
  e.stopPropagation();
27615
27801
  onNodeAction?.(item.id);
27616
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
+ });
27617
27834
  return /* @__PURE__ */ jsxs(Fragment, { children: [
27618
27835
  /* @__PURE__ */ jsxs(
27619
27836
  Box,
27620
27837
  {
27838
+ ref: rowRef,
27621
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"}`,
27622
27840
  style: { paddingLeft: depth * indent + 8 },
27623
27841
  onClick: handleClick,
27624
27842
  role: "treeitem",
27625
27843
  "aria-selected": isSelected,
27626
27844
  "aria-expanded": hasChildren ? expanded : void 0,
27845
+ ...dragProps,
27846
+ ...dropProps,
27627
27847
  children: [
27628
27848
  hasChildren ? /* @__PURE__ */ jsx(Box, { onClick: handleChevron, className: "flex items-center flex-shrink-0", role: "button", "aria-label": expanded ? "Collapse" : "Expand", children: /* @__PURE__ */ jsx(
27629
27849
  Icon,
@@ -27670,10 +27890,12 @@ var init_FileTree = __esm({
27670
27890
  depth: depth + 1,
27671
27891
  indent,
27672
27892
  childrenByParent,
27893
+ roots,
27673
27894
  onNodeSelect,
27674
27895
  onNodeAction,
27675
27896
  nodeActionIcon,
27676
27897
  nodeActionLabel,
27898
+ onNodeReorder,
27677
27899
  selectedId,
27678
27900
  look,
27679
27901
  isExpanded,
@@ -27691,14 +27913,15 @@ var init_FileTree = __esm({
27691
27913
  onNodeAction,
27692
27914
  nodeActionIcon,
27693
27915
  nodeActionLabel,
27916
+ onNodeReorder,
27694
27917
  className,
27695
27918
  indent = 16
27696
27919
  }) => {
27697
27920
  const [overrides, setOverrides] = useState(() => /* @__PURE__ */ new Map());
27698
- const byId = React87__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
27699
- const selectedAncestors = React87__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
27700
- const lastSelectedRef = React87__default.useRef(selectedId);
27701
- 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(() => {
27702
27925
  if (selectedId === lastSelectedRef.current) return;
27703
27926
  lastSelectedRef.current = selectedId;
27704
27927
  setOverrides((prev) => {
@@ -27739,10 +27962,12 @@ var init_FileTree = __esm({
27739
27962
  depth: 0,
27740
27963
  indent,
27741
27964
  childrenByParent,
27965
+ roots,
27742
27966
  onNodeSelect,
27743
27967
  onNodeAction,
27744
27968
  nodeActionIcon,
27745
27969
  nodeActionLabel,
27970
+ onNodeReorder,
27746
27971
  selectedId,
27747
27972
  look,
27748
27973
  isExpanded,
@@ -27762,6 +27987,7 @@ var init_FileTree = __esm({
27762
27987
  onNodeAction,
27763
27988
  nodeActionIcon,
27764
27989
  nodeActionLabel,
27990
+ onNodeReorder,
27765
27991
  className,
27766
27992
  indent = 16
27767
27993
  }) => {
@@ -27776,6 +28002,7 @@ var init_FileTree = __esm({
27776
28002
  onNodeAction,
27777
28003
  nodeActionIcon,
27778
28004
  nodeActionLabel,
28005
+ onNodeReorder,
27779
28006
  className,
27780
28007
  indent
27781
28008
  }
@@ -28528,7 +28755,7 @@ var init_Flex = __esm({
28528
28755
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
28529
28756
  }
28530
28757
  }
28531
- return React87__default.createElement(Component, {
28758
+ return React88__default.createElement(Component, {
28532
28759
  className: cn(
28533
28760
  inline ? "inline-flex" : "flex",
28534
28761
  directionStyles[direction],
@@ -28647,7 +28874,7 @@ var init_Grid = __esm({
28647
28874
  as: Component = "div"
28648
28875
  }) => {
28649
28876
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
28650
- return React87__default.createElement(
28877
+ return React88__default.createElement(
28651
28878
  Component,
28652
28879
  {
28653
28880
  className: cn(
@@ -29069,9 +29296,9 @@ var init_Popover = __esm({
29069
29296
  onMouseLeave: handleClose,
29070
29297
  onPointerDown: tapTriggerProps.onPointerDown
29071
29298
  };
29072
- const childElement = React87__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29299
+ const childElement = React88__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29073
29300
  const childPointerDown = childElement.props.onPointerDown;
29074
- const triggerElement = React87__default.cloneElement(
29301
+ const triggerElement = React88__default.cloneElement(
29075
29302
  childElement,
29076
29303
  {
29077
29304
  ref: triggerRef,
@@ -29685,9 +29912,9 @@ var init_Tooltip = __esm({
29685
29912
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
29686
29913
  };
29687
29914
  }, []);
29688
- const triggerElement = React87__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29915
+ const triggerElement = React88__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29689
29916
  const childPointerDown = triggerElement.props.onPointerDown;
29690
- const trigger = React87__default.cloneElement(triggerElement, {
29917
+ const trigger = React88__default.cloneElement(triggerElement, {
29691
29918
  ref: triggerRef,
29692
29919
  onMouseEnter: handleMouseEnter,
29693
29920
  onMouseLeave: handleMouseLeave,
@@ -29777,7 +30004,7 @@ var init_WizardProgress = __esm({
29777
30004
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
29778
30005
  const isActive = index === currentStep;
29779
30006
  const isCompleted = index < currentStep;
29780
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
30007
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
29781
30008
  /* @__PURE__ */ jsx(
29782
30009
  "button",
29783
30010
  {
@@ -30839,6 +31066,8 @@ var init_MathCanvas = __esm({
30839
31066
  gridColor = "var(--color-border, #9ca3af)",
30840
31067
  axisColor = "var(--color-muted-foreground, #374151)",
30841
31068
  showTickLabels = false,
31069
+ tickLabelFontSize = 10,
31070
+ labelFontSize = 12,
30842
31071
  showCurveLabels = false,
30843
31072
  curves = [],
30844
31073
  points = [],
@@ -30910,18 +31139,18 @@ var init_MathCanvas = __esm({
30910
31139
  let kx = 0;
30911
31140
  for (let x = Math.ceil(xMin / gridStep) * gridStep; x <= xMax; x += gridStep, kx++) {
30912
31141
  if (kx % labelEveryX === 0 && x !== 0) {
30913
- 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" });
30914
31143
  }
30915
31144
  }
30916
31145
  const labelEveryY = Math.max(1, Math.ceil((yMax - yMin) / gridStep / Math.floor(plotH / 28)));
30917
31146
  let ky = 0;
30918
31147
  for (let y = Math.ceil(yMin / gridStep) * gridStep; y <= yMax; y += gridStep, ky++) {
30919
31148
  if (ky % labelEveryY === 0 && y !== 0) {
30920
- 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" });
30921
31150
  }
30922
31151
  }
30923
31152
  if (xMin <= 0 && xMax >= 0 && yMin <= 0 && yMax >= 0) {
30924
- 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" });
30925
31154
  }
30926
31155
  }
30927
31156
  for (const region of regions) {
@@ -30952,7 +31181,7 @@ var init_MathCanvas = __esm({
30952
31181
  y: (mapY(region.samples[mid].y) + mapY(baseline)) / 2,
30953
31182
  text: region.label,
30954
31183
  color,
30955
- fontSize: 11
31184
+ fontSize: labelFontSize
30956
31185
  });
30957
31186
  }
30958
31187
  }
@@ -30991,7 +31220,7 @@ var init_MathCanvas = __esm({
30991
31220
  const py = mapY(guide.at);
30992
31221
  out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color, dash });
30993
31222
  if (guide.label) {
30994
- 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" });
30995
31224
  }
30996
31225
  }
30997
31226
  }
@@ -31034,7 +31263,7 @@ var init_MathCanvas = __esm({
31034
31263
  y: mapY(lastInRange.y) - 6,
31035
31264
  text: curve.label,
31036
31265
  color: curve.color ?? "#2563eb",
31037
- fontSize: 11
31266
+ fontSize: labelFontSize
31038
31267
  });
31039
31268
  }
31040
31269
  }
@@ -31071,7 +31300,7 @@ var init_MathCanvas = __esm({
31071
31300
  y: xAxisY - peak - 8,
31072
31301
  text: hop.label,
31073
31302
  color,
31074
- fontSize: 10,
31303
+ fontSize: labelFontSize,
31075
31304
  align: "center"
31076
31305
  });
31077
31306
  }
@@ -31098,7 +31327,7 @@ var init_MathCanvas = __esm({
31098
31327
  y: mapY(angle.y + 1.35 * radius * Math.sin(rad)),
31099
31328
  text: angle.label,
31100
31329
  color,
31101
- fontSize: 11,
31330
+ fontSize: labelFontSize,
31102
31331
  align: "center"
31103
31332
  });
31104
31333
  }
@@ -31115,7 +31344,7 @@ var init_MathCanvas = __esm({
31115
31344
  fill: isOpen ? "#ffffff" : p.color ?? "#dc2626"
31116
31345
  });
31117
31346
  if (p.label) {
31118
- 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 });
31119
31348
  }
31120
31349
  }
31121
31350
  for (const v of vectors) {
@@ -31126,7 +31355,7 @@ var init_MathCanvas = __esm({
31126
31355
  const y2 = mapY(v.y + v.vy);
31127
31356
  out.push({ type: "arrow", x1, y1, x2, y2, color: v.color ?? "#7c3aed", lineWidth: 2 });
31128
31357
  if (v.label) {
31129
- 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 });
31130
31359
  }
31131
31360
  }
31132
31361
  out.push(...shapes);
@@ -31145,6 +31374,8 @@ var init_MathCanvas = __esm({
31145
31374
  gridColor,
31146
31375
  axisColor,
31147
31376
  showTickLabels,
31377
+ tickLabelFontSize,
31378
+ labelFontSize,
31148
31379
  showCurveLabels,
31149
31380
  curves,
31150
31381
  points,
@@ -32432,13 +32663,13 @@ var init_MapView = __esm({
32432
32663
  shadowSize: [41, 41]
32433
32664
  });
32434
32665
  L.Marker.prototype.options.icon = defaultIcon;
32435
- const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback97, useState: useState98 } = React87__default;
32666
+ const { useEffect: useEffect68, useRef: useRef67, useCallback: useCallback99, useState: useState101 } = React88__default;
32436
32667
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
32437
32668
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
32438
32669
  function MapUpdater({ centerLat, centerLng, zoom }) {
32439
32670
  const map = useMap();
32440
- const prevRef = useRef65({ centerLat, centerLng, zoom });
32441
- useEffect67(() => {
32671
+ const prevRef = useRef67({ centerLat, centerLng, zoom });
32672
+ useEffect68(() => {
32442
32673
  const prev = prevRef.current;
32443
32674
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
32444
32675
  map.setView([centerLat, centerLng], zoom);
@@ -32449,7 +32680,7 @@ var init_MapView = __esm({
32449
32680
  }
32450
32681
  function MapClickHandler({ onMapClick }) {
32451
32682
  const map = useMap();
32452
- useEffect67(() => {
32683
+ useEffect68(() => {
32453
32684
  if (!onMapClick) return;
32454
32685
  const handler = (e) => {
32455
32686
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -32477,8 +32708,8 @@ var init_MapView = __esm({
32477
32708
  showAttribution = true
32478
32709
  }) {
32479
32710
  const eventBus = useEventBus2();
32480
- const [clickedPosition, setClickedPosition] = useState98(null);
32481
- const handleMapClick = useCallback97((lat, lng) => {
32711
+ const [clickedPosition, setClickedPosition] = useState101(null);
32712
+ const handleMapClick = useCallback99((lat, lng) => {
32482
32713
  if (showClickedPin) {
32483
32714
  setClickedPosition({ lat, lng });
32484
32715
  }
@@ -32487,7 +32718,7 @@ var init_MapView = __esm({
32487
32718
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
32488
32719
  }
32489
32720
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
32490
- const handleMarkerClick = useCallback97((marker) => {
32721
+ const handleMarkerClick = useCallback99((marker) => {
32491
32722
  onMarkerClick?.(marker);
32492
32723
  if (markerClickEvent) {
32493
32724
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -33377,8 +33608,8 @@ function TableView({
33377
33608
  }) {
33378
33609
  const eventBus = useEventBus();
33379
33610
  const { t } = useTranslate();
33380
- const [visibleCount, setVisibleCount] = React87__default.useState(pageSize > 0 ? pageSize : Infinity);
33381
- 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());
33382
33613
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
33383
33614
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
33384
33615
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
@@ -33399,7 +33630,7 @@ function TableView({
33399
33630
  const hasMore = pageSize > 0 && visibleCount < ordered2.length;
33400
33631
  const hasRenderProp = typeof children === "function";
33401
33632
  const idField = dndItemIdField ?? "id";
33402
- React87__default.useEffect(() => {
33633
+ React88__default.useEffect(() => {
33403
33634
  tableViewLog.debug("render", {
33404
33635
  rowCount: data.length,
33405
33636
  colCount: colDefs.length,
@@ -33449,7 +33680,7 @@ function TableView({
33449
33680
  };
33450
33681
  eventBus.emit(`UI:${rowClickEvent}`, payload);
33451
33682
  };
33452
- const colFloors = React87__default.useMemo(
33683
+ const colFloors = React88__default.useMemo(
33453
33684
  () => colDefs.map((col) => {
33454
33685
  const longest = data.reduce((widest, row) => {
33455
33686
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -33592,12 +33823,12 @@ function TableView({
33592
33823
  ]
33593
33824
  }
33594
33825
  );
33595
- 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);
33596
33827
  };
33597
33828
  const items = Array.from(data);
33598
33829
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
33599
33830
  let runningIndex = 0;
33600
- 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: [
33601
33832
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
33602
33833
  group.items.map((row) => renderRow(row, runningIndex++))
33603
33834
  ] }, gi)) });
@@ -34966,7 +35197,7 @@ var init_StepFlow = __esm({
34966
35197
  className
34967
35198
  }) => {
34968
35199
  if (orientation === "vertical") {
34969
- 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: [
34970
35201
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
34971
35202
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
34972
35203
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -34977,7 +35208,7 @@ var init_StepFlow = __esm({
34977
35208
  ] })
34978
35209
  ] }) }, index)) });
34979
35210
  }
34980
- 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: [
34981
35212
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
34982
35213
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
34983
35214
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -35967,7 +36198,7 @@ var init_LikertScale = __esm({
35967
36198
  md: "text-base",
35968
36199
  lg: "text-lg"
35969
36200
  };
35970
- LikertScale = React87__default.forwardRef(
36201
+ LikertScale = React88__default.forwardRef(
35971
36202
  ({
35972
36203
  question,
35973
36204
  options = DEFAULT_LIKERT_OPTIONS,
@@ -35979,7 +36210,7 @@ var init_LikertScale = __esm({
35979
36210
  variant = "radios",
35980
36211
  className
35981
36212
  }, ref) => {
35982
- const groupId = React87__default.useId();
36213
+ const groupId = React88__default.useId();
35983
36214
  const eventBus = useEventBus();
35984
36215
  const handleSelect = useCallback(
35985
36216
  (next) => {
@@ -38402,7 +38633,7 @@ var init_DocBreadcrumb = __esm({
38402
38633
  "aria-label": t("aria.breadcrumb"),
38403
38634
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
38404
38635
  const isLast = idx === items.length - 1;
38405
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
38636
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
38406
38637
  idx > 0 && /* @__PURE__ */ jsx(
38407
38638
  Icon,
38408
38639
  {
@@ -39271,7 +39502,7 @@ var init_MiniStateMachine = __esm({
39271
39502
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
39272
39503
  const tc = transitionCounts[s.name] ?? 0;
39273
39504
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
39274
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
39505
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
39275
39506
  /* @__PURE__ */ jsx(
39276
39507
  AvlState,
39277
39508
  {
@@ -39476,7 +39707,7 @@ var init_PageHeader = __esm({
39476
39707
  info: "bg-info/10 text-info"
39477
39708
  };
39478
39709
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
39479
- 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: [
39480
39711
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
39481
39712
  crumb.href ? /* @__PURE__ */ jsx(
39482
39713
  "a",
@@ -39834,7 +40065,7 @@ var init_Section = __esm({
39834
40065
  as: Component = "section"
39835
40066
  }) => {
39836
40067
  const hasHeader = title || description || action;
39837
- return React87__default.createElement(
40068
+ return React88__default.createElement(
39838
40069
  Component,
39839
40070
  {
39840
40071
  className: cn(
@@ -40208,7 +40439,7 @@ var init_WizardContainer = __esm({
40208
40439
  const isCompleted = index < currentStep;
40209
40440
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
40210
40441
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
40211
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
40442
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
40212
40443
  /* @__PURE__ */ jsx(
40213
40444
  Button,
40214
40445
  {
@@ -41995,7 +42226,7 @@ var init_ImportPreviewTree = __esm({
41995
42226
  const renderUnit = (unit, childrenByParent, depth) => {
41996
42227
  const summary = fieldSummary(unit);
41997
42228
  const children = childrenByParent.get(unit.ref) ?? [];
41998
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
42229
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
41999
42230
  /* @__PURE__ */ jsxs(
42000
42231
  Box,
42001
42232
  {
@@ -42092,7 +42323,7 @@ var init_ImportProgress = __esm({
42092
42323
  PIPELINE.map((key, index) => {
42093
42324
  const isComplete = index < currentIndex;
42094
42325
  const isActive = index === currentIndex;
42095
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
42326
+ return /* @__PURE__ */ jsxs(React88__default.Fragment, { children: [
42096
42327
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
42097
42328
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
42098
42329
  /* @__PURE__ */ jsx(
@@ -42220,6 +42451,69 @@ var init_ReflectionBlock = __esm({
42220
42451
  ReflectionBlock.displayName = "ReflectionBlock";
42221
42452
  }
42222
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
+ });
42223
42517
 
42224
42518
  // components/core/molecules/index.ts
42225
42519
  var init_molecules2 = __esm({
@@ -42970,7 +43264,7 @@ var init_DetailPanel = __esm({
42970
43264
  }) => {
42971
43265
  const eventBus = useEventBus();
42972
43266
  const { t } = useTranslate();
42973
- const [titleDraft, setTitleDraft] = React87__default.useState(null);
43267
+ const [titleDraft, setTitleDraft] = React88__default.useState(null);
42974
43268
  const isFieldDefArray = (arr) => {
42975
43269
  if (!arr || arr.length === 0) return false;
42976
43270
  const first = arr[0];
@@ -43363,8 +43657,224 @@ var init_DetailPanel = __esm({
43363
43657
  DetailPanel.displayName = "DetailPanel";
43364
43658
  }
43365
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
+ });
43366
43876
  function extractTitle(children) {
43367
- if (!React87__default.isValidElement(children)) return void 0;
43877
+ if (!React88__default.isValidElement(children)) return void 0;
43368
43878
  const props = children.props;
43369
43879
  if (typeof props.title === "string") {
43370
43880
  return props.title;
@@ -43726,7 +44236,7 @@ var init_Form = __esm({
43726
44236
  const isSchemaEntity = isOrbitalEntitySchema(entity);
43727
44237
  const resolvedEntity = isSchemaEntity ? entity : void 0;
43728
44238
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
43729
- const normalizedInitialData = React87__default.useMemo(() => {
44239
+ const normalizedInitialData = React88__default.useMemo(() => {
43730
44240
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
43731
44241
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
43732
44242
  const merged = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
@@ -43745,7 +44255,7 @@ var init_Form = __esm({
43745
44255
  }
43746
44256
  return normalized;
43747
44257
  }, [entity, initialData]);
43748
- const entityDerivedFields = React87__default.useMemo(() => {
44258
+ const entityDerivedFields = React88__default.useMemo(() => {
43749
44259
  if (fields && fields.length > 0) return void 0;
43750
44260
  if (!resolvedEntity) return void 0;
43751
44261
  return resolvedEntity.fields.map(
@@ -43766,16 +44276,16 @@ var init_Form = __esm({
43766
44276
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
43767
44277
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
43768
44278
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
43769
- const [formData, setFormData] = React87__default.useState(
44279
+ const [formData, setFormData] = React88__default.useState(
43770
44280
  normalizedInitialData
43771
44281
  );
43772
- const [collapsedSections, setCollapsedSections] = React87__default.useState(
44282
+ const [collapsedSections, setCollapsedSections] = React88__default.useState(
43773
44283
  /* @__PURE__ */ new Set()
43774
44284
  );
43775
- const [submitError, setSubmitError] = React87__default.useState(null);
43776
- const formRef = React87__default.useRef(null);
44285
+ const [submitError, setSubmitError] = React88__default.useState(null);
44286
+ const formRef = React88__default.useRef(null);
43777
44287
  const formMode = props.mode;
43778
- const mountedRef = React87__default.useRef(false);
44288
+ const mountedRef = React88__default.useRef(false);
43779
44289
  if (!mountedRef.current) {
43780
44290
  mountedRef.current = true;
43781
44291
  debug("forms", "mount", {
@@ -43788,7 +44298,7 @@ var init_Form = __esm({
43788
44298
  });
43789
44299
  }
43790
44300
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
43791
- const evalContext = React87__default.useMemo(
44301
+ const evalContext = React88__default.useMemo(
43792
44302
  () => ({
43793
44303
  formValues: formData,
43794
44304
  globalVariables: externalContext?.globalVariables ?? {},
@@ -43797,7 +44307,7 @@ var init_Form = __esm({
43797
44307
  }),
43798
44308
  [formData, externalContext]
43799
44309
  );
43800
- React87__default.useEffect(() => {
44310
+ React88__default.useEffect(() => {
43801
44311
  debug("forms", "initialData-sync", {
43802
44312
  mode: formMode,
43803
44313
  normalizedInitialData,
@@ -43808,7 +44318,7 @@ var init_Form = __esm({
43808
44318
  setFormData(normalizedInitialData);
43809
44319
  }
43810
44320
  }, [normalizedInitialData]);
43811
- const processCalculations = React87__default.useCallback(
44321
+ const processCalculations = React88__default.useCallback(
43812
44322
  (changedFieldId, newFormData) => {
43813
44323
  if (!hiddenCalculations.length) return;
43814
44324
  const context = {
@@ -43833,7 +44343,7 @@ var init_Form = __esm({
43833
44343
  },
43834
44344
  [hiddenCalculations, externalContext, eventBus]
43835
44345
  );
43836
- const checkViolations = React87__default.useCallback(
44346
+ const checkViolations = React88__default.useCallback(
43837
44347
  (changedFieldId, newFormData) => {
43838
44348
  if (!violationTriggers.length) return;
43839
44349
  const context = {
@@ -43871,7 +44381,7 @@ var init_Form = __esm({
43871
44381
  processCalculations(name, newFormData);
43872
44382
  checkViolations(name, newFormData);
43873
44383
  };
43874
- const isFieldVisible = React87__default.useCallback(
44384
+ const isFieldVisible = React88__default.useCallback(
43875
44385
  (fieldName2) => {
43876
44386
  const condition = conditionalFields[fieldName2];
43877
44387
  if (!condition) return true;
@@ -43879,7 +44389,7 @@ var init_Form = __esm({
43879
44389
  },
43880
44390
  [conditionalFields, evalContext]
43881
44391
  );
43882
- const isSectionVisible = React87__default.useCallback(
44392
+ const isSectionVisible = React88__default.useCallback(
43883
44393
  (section) => {
43884
44394
  if (!section.condition) return true;
43885
44395
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -43955,7 +44465,7 @@ var init_Form = __esm({
43955
44465
  eventBus.emit(`UI:${onCancel}`);
43956
44466
  }
43957
44467
  };
43958
- const renderField = React87__default.useCallback(
44468
+ const renderField = React88__default.useCallback(
43959
44469
  (field) => {
43960
44470
  const fieldName2 = field.name || field.field;
43961
44471
  if (!fieldName2) return null;
@@ -43977,7 +44487,7 @@ var init_Form = __esm({
43977
44487
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
43978
44488
  );
43979
44489
  const effectiveFields = entityDerivedFields ?? fields;
43980
- const normalizedFields = React87__default.useMemo(() => {
44490
+ const normalizedFields = React88__default.useMemo(() => {
43981
44491
  if (!effectiveFields || effectiveFields.length === 0) return [];
43982
44492
  return effectiveFields.map((field) => {
43983
44493
  if (typeof field === "string") {
@@ -44012,7 +44522,7 @@ var init_Form = __esm({
44012
44522
  };
44013
44523
  });
44014
44524
  }, [effectiveFields, resolvedEntity, fieldOverrides]);
44015
- const schemaFields = React87__default.useMemo(() => {
44525
+ const schemaFields = React88__default.useMemo(() => {
44016
44526
  if (normalizedFields.length === 0) return null;
44017
44527
  if (isDebugEnabled()) {
44018
44528
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -44022,7 +44532,7 @@ var init_Form = __esm({
44022
44532
  }
44023
44533
  return normalizedFields.map(renderField).filter(Boolean);
44024
44534
  }, [normalizedFields, renderField, entityName, conditionalFields]);
44025
- const sectionElements = React87__default.useMemo(() => {
44535
+ const sectionElements = React88__default.useMemo(() => {
44026
44536
  if (!sections || sections.length === 0) return null;
44027
44537
  return sections.map((section) => {
44028
44538
  if (!isSectionVisible(section)) {
@@ -44858,7 +45368,7 @@ var init_List = __esm({
44858
45368
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
44859
45369
  return [];
44860
45370
  }, [entity]);
44861
- const getItemActions = React87__default.useCallback(
45371
+ const getItemActions = React88__default.useCallback(
44862
45372
  (item) => {
44863
45373
  if (!itemActions) return [];
44864
45374
  if (typeof itemActions === "function") {
@@ -45340,7 +45850,7 @@ var init_MediaGallery = __esm({
45340
45850
  [selectable, selectedItems, selectionEvent, eventBus]
45341
45851
  );
45342
45852
  const entityData = Array.isArray(entity) ? entity : [];
45343
- const items = React87__default.useMemo(() => {
45853
+ const items = React88__default.useMemo(() => {
45344
45854
  if (propItems && propItems.length > 0) return propItems;
45345
45855
  if (entityData.length === 0) return [];
45346
45856
  return entityData.map((record, idx) => {
@@ -45505,7 +46015,7 @@ var init_MediaGallery = __esm({
45505
46015
  }
45506
46016
  });
45507
46017
  function extractTitle2(children) {
45508
- if (!React87__default.isValidElement(children)) return void 0;
46018
+ if (!React88__default.isValidElement(children)) return void 0;
45509
46019
  const props = children.props;
45510
46020
  if (typeof props.title === "string") {
45511
46021
  return props.title;
@@ -45760,7 +46270,7 @@ var init_debugRegistry = __esm({
45760
46270
  }
45761
46271
  });
45762
46272
  function useDebugData() {
45763
- const [data, setData] = React87.useState(() => ({
46273
+ const [data, setData] = React88.useState(() => ({
45764
46274
  traits: [],
45765
46275
  ticks: [],
45766
46276
  guards: [],
@@ -45774,7 +46284,7 @@ function useDebugData() {
45774
46284
  },
45775
46285
  lastUpdate: Date.now()
45776
46286
  }));
45777
- React87.useEffect(() => {
46287
+ React88.useEffect(() => {
45778
46288
  const updateData = () => {
45779
46289
  setData({
45780
46290
  traits: getAllTraits(),
@@ -45883,12 +46393,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
45883
46393
  return positions;
45884
46394
  }
45885
46395
  function WalkMinimap() {
45886
- const [walkStep, setWalkStep] = React87.useState(null);
45887
- const [traits2, setTraits] = React87.useState([]);
45888
- const [coveredEdges, setCoveredEdges] = React87.useState([]);
45889
- const [completedTraits, setCompletedTraits] = React87.useState(/* @__PURE__ */ new Set());
45890
- const prevTraitRef = React87.useRef(null);
45891
- 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(() => {
45892
46402
  const interval = setInterval(() => {
45893
46403
  const w = window;
45894
46404
  const step = w.__orbitalWalkStep;
@@ -46324,15 +46834,15 @@ var init_EntitiesTab = __esm({
46324
46834
  });
46325
46835
  function EventFlowTab({ events: events2 }) {
46326
46836
  const { t } = useTranslate();
46327
- const [filter, setFilter] = React87.useState("all");
46328
- const containerRef = React87.useRef(null);
46329
- const [autoScroll, setAutoScroll] = React87.useState(true);
46330
- 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(() => {
46331
46841
  if (autoScroll && containerRef.current) {
46332
46842
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
46333
46843
  }
46334
46844
  }, [events2.length, autoScroll]);
46335
- const filteredEvents = React87.useMemo(() => {
46845
+ const filteredEvents = React88.useMemo(() => {
46336
46846
  if (filter === "all") return events2;
46337
46847
  return events2.filter((e) => e.type === filter);
46338
46848
  }, [events2, filter]);
@@ -46448,7 +46958,7 @@ var init_EventFlowTab = __esm({
46448
46958
  });
46449
46959
  function GuardsPanel({ guards }) {
46450
46960
  const { t } = useTranslate();
46451
- const [filter, setFilter] = React87.useState("all");
46961
+ const [filter, setFilter] = React88.useState("all");
46452
46962
  if (guards.length === 0) {
46453
46963
  return /* @__PURE__ */ jsx(
46454
46964
  EmptyState,
@@ -46461,7 +46971,7 @@ function GuardsPanel({ guards }) {
46461
46971
  }
46462
46972
  const passedCount = guards.filter((g) => g.result).length;
46463
46973
  const failedCount = guards.length - passedCount;
46464
- const filteredGuards = React87.useMemo(() => {
46974
+ const filteredGuards = React88.useMemo(() => {
46465
46975
  if (filter === "all") return guards;
46466
46976
  if (filter === "passed") return guards.filter((g) => g.result);
46467
46977
  return guards.filter((g) => !g.result);
@@ -46624,10 +47134,10 @@ function EffectBadge({ effect }) {
46624
47134
  }
46625
47135
  function TransitionTimeline({ transitions }) {
46626
47136
  const { t } = useTranslate();
46627
- const containerRef = React87.useRef(null);
46628
- const [autoScroll, setAutoScroll] = React87.useState(true);
46629
- const [expandedId, setExpandedId] = React87.useState(null);
46630
- 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(() => {
46631
47141
  if (autoScroll && containerRef.current) {
46632
47142
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
46633
47143
  }
@@ -46907,9 +47417,9 @@ function getAllEvents(traits2) {
46907
47417
  function EventDispatcherTab({ traits: traits2, schema }) {
46908
47418
  const eventBus = useEventBus();
46909
47419
  const { t } = useTranslate();
46910
- const [log13, setLog] = React87.useState([]);
46911
- const prevStatesRef = React87.useRef(/* @__PURE__ */ new Map());
46912
- React87.useEffect(() => {
47420
+ const [log13, setLog] = React88.useState([]);
47421
+ const prevStatesRef = React88.useRef(/* @__PURE__ */ new Map());
47422
+ React88.useEffect(() => {
46913
47423
  for (const trait of traits2) {
46914
47424
  const prev = prevStatesRef.current.get(trait.id);
46915
47425
  if (prev && prev !== trait.currentState) {
@@ -47078,10 +47588,10 @@ function VerifyModePanel({
47078
47588
  localCount
47079
47589
  }) {
47080
47590
  const { t } = useTranslate();
47081
- const [expanded, setExpanded] = React87.useState(true);
47082
- const scrollRef = React87.useRef(null);
47083
- const prevCountRef = React87.useRef(0);
47084
- React87.useEffect(() => {
47591
+ const [expanded, setExpanded] = React88.useState(true);
47592
+ const scrollRef = React88.useRef(null);
47593
+ const prevCountRef = React88.useRef(0);
47594
+ React88.useEffect(() => {
47085
47595
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
47086
47596
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
47087
47597
  }
@@ -47138,10 +47648,10 @@ function RuntimeDebugger({
47138
47648
  schema
47139
47649
  }) {
47140
47650
  const { t } = useTranslate();
47141
- const [isCollapsed, setIsCollapsed] = React87.useState(mode === "verify" ? true : defaultCollapsed);
47142
- 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());
47143
47653
  const debugData = useDebugData();
47144
- React87.useEffect(() => {
47654
+ React88.useEffect(() => {
47145
47655
  if (mode === "inline") return;
47146
47656
  return onDebugToggle((enabled) => {
47147
47657
  setIsVisible(enabled);
@@ -47150,7 +47660,7 @@ function RuntimeDebugger({
47150
47660
  }
47151
47661
  });
47152
47662
  }, [mode]);
47153
- React87.useEffect(() => {
47663
+ React88.useEffect(() => {
47154
47664
  if (mode === "inline") return;
47155
47665
  const handleKeyDown = (e) => {
47156
47666
  if (e.key === "`" && isVisible) {
@@ -47165,7 +47675,7 @@ function RuntimeDebugger({
47165
47675
  if (!isVisible) {
47166
47676
  return null;
47167
47677
  }
47168
- const positionClasses = {
47678
+ const positionClasses2 = {
47169
47679
  "bottom-right": "bottom-4 right-4",
47170
47680
  "bottom-left": "bottom-4 left-4",
47171
47681
  "top-right": "top-4 right-4",
@@ -47294,7 +47804,7 @@ function RuntimeDebugger({
47294
47804
  className: cn(
47295
47805
  "runtime-debugger",
47296
47806
  "fixed",
47297
- positionClasses[position],
47807
+ positionClasses2[position],
47298
47808
  isCollapsed ? "runtime-debugger--collapsed" : "runtime-debugger--expanded",
47299
47809
  className
47300
47810
  ),
@@ -47376,6 +47886,7 @@ var init_SegmentRenderer = __esm({
47376
47886
  "use client";
47377
47887
  init_MarkdownContent();
47378
47888
  init_CodeBlock();
47889
+ init_MermaidDiagram();
47379
47890
  init_QuizBlock();
47380
47891
  init_ActivationBlock();
47381
47892
  init_ConnectionBlock();
@@ -47407,6 +47918,9 @@ var init_SegmentRenderer = __esm({
47407
47918
  return /* @__PURE__ */ jsx(MarkdownContent, { content: segment.content }, `md-${index}`);
47408
47919
  }
47409
47920
  if (segment.type === "code") {
47921
+ if (segment.language === "mermaid") {
47922
+ return /* @__PURE__ */ jsx(MermaidDiagram, { code: segment.content }, `code-${index}`);
47923
+ }
47410
47924
  if (segment.runnable && onRunCodeSimulation) {
47411
47925
  return /* @__PURE__ */ jsx(
47412
47926
  CodeRunnerPanel,
@@ -47539,99 +48053,6 @@ var init_ShowcaseOrganism = __esm({
47539
48053
  ShowcaseOrganism.displayName = "ShowcaseOrganism";
47540
48054
  }
47541
48055
  });
47542
- var SplitPane;
47543
- var init_SplitPane = __esm({
47544
- "components/core/organisms/layout/SplitPane.tsx"() {
47545
- "use client";
47546
- init_cn();
47547
- SplitPane = ({
47548
- direction = "horizontal",
47549
- ratio: initialRatio = 50,
47550
- minSize = 100,
47551
- resizable = true,
47552
- left,
47553
- right,
47554
- className,
47555
- leftClassName,
47556
- rightClassName
47557
- }) => {
47558
- const [ratio, setRatio] = useState(initialRatio);
47559
- const containerRef = useRef(null);
47560
- const isDragging = useRef(false);
47561
- const handlePointerDown = useCallback(
47562
- (e) => {
47563
- if (!resizable) return;
47564
- e.preventDefault();
47565
- isDragging.current = true;
47566
- e.currentTarget.setPointerCapture(e.pointerId);
47567
- const handlePointerMove = (ev) => {
47568
- if (!isDragging.current || !containerRef.current) return;
47569
- const rect = containerRef.current.getBoundingClientRect();
47570
- let newRatio;
47571
- if (direction === "horizontal") {
47572
- const x = ev.clientX - rect.left;
47573
- newRatio = x / rect.width * 100;
47574
- } else {
47575
- const y = ev.clientY - rect.top;
47576
- newRatio = y / rect.height * 100;
47577
- }
47578
- const minRatio = minSize / (direction === "horizontal" ? rect.width : rect.height) * 100;
47579
- const maxRatio = 100 - minRatio;
47580
- newRatio = Math.max(minRatio, Math.min(maxRatio, newRatio));
47581
- setRatio(newRatio);
47582
- };
47583
- const handlePointerUp = () => {
47584
- isDragging.current = false;
47585
- document.removeEventListener("pointermove", handlePointerMove);
47586
- document.removeEventListener("pointerup", handlePointerUp);
47587
- document.removeEventListener("pointercancel", handlePointerUp);
47588
- };
47589
- document.addEventListener("pointermove", handlePointerMove);
47590
- document.addEventListener("pointerup", handlePointerUp);
47591
- document.addEventListener("pointercancel", handlePointerUp);
47592
- },
47593
- [direction, minSize, resizable]
47594
- );
47595
- const isHorizontal = direction === "horizontal";
47596
- return /* @__PURE__ */ jsxs(
47597
- "div",
47598
- {
47599
- ref: containerRef,
47600
- className: cn(
47601
- "flex w-full h-full",
47602
- isHorizontal ? "flex-row" : "flex-col",
47603
- className
47604
- ),
47605
- children: [
47606
- /* @__PURE__ */ jsx(
47607
- "div",
47608
- {
47609
- className: cn("overflow-auto", leftClassName),
47610
- style: {
47611
- [isHorizontal ? "width" : "height"]: `${ratio}%`,
47612
- flexShrink: 0
47613
- },
47614
- children: left
47615
- }
47616
- ),
47617
- resizable && /* @__PURE__ */ jsx(
47618
- "div",
47619
- {
47620
- onPointerDown: handlePointerDown,
47621
- className: cn(
47622
- "flex-shrink-0 bg-border transition-colors touch-none",
47623
- 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"
47624
- )
47625
- }
47626
- ),
47627
- /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto", rightClassName), children: right })
47628
- ]
47629
- }
47630
- );
47631
- };
47632
- SplitPane.displayName = "SplitPane";
47633
- }
47634
- });
47635
48056
  var StatCard;
47636
48057
  var init_StatCard = __esm({
47637
48058
  "components/core/organisms/StatCard.tsx"() {
@@ -47670,7 +48091,7 @@ var init_StatCard = __esm({
47670
48091
  const labelToUse = propLabel ?? propTitle;
47671
48092
  const eventBus = useEventBus();
47672
48093
  const { t } = useTranslate();
47673
- const handleActionClick = React87__default.useCallback(() => {
48094
+ const handleActionClick = React88__default.useCallback(() => {
47674
48095
  if (action?.event) {
47675
48096
  eventBus.emit(`UI:${action.event}`, {});
47676
48097
  }
@@ -47681,7 +48102,7 @@ var init_StatCard = __esm({
47681
48102
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
47682
48103
  const isLoading = externalLoading ?? false;
47683
48104
  const error = externalError;
47684
- const computeMetricValue = React87__default.useCallback(
48105
+ const computeMetricValue = React88__default.useCallback(
47685
48106
  (metric, items) => {
47686
48107
  if (metric.value !== void 0) {
47687
48108
  return metric.value;
@@ -47720,7 +48141,7 @@ var init_StatCard = __esm({
47720
48141
  },
47721
48142
  []
47722
48143
  );
47723
- const schemaStats = React87__default.useMemo(() => {
48144
+ const schemaStats = React88__default.useMemo(() => {
47724
48145
  if (!metrics || metrics.length === 0) return null;
47725
48146
  return metrics.map((metric) => ({
47726
48147
  label: metric.label,
@@ -47728,7 +48149,7 @@ var init_StatCard = __esm({
47728
48149
  format: metric.format
47729
48150
  }));
47730
48151
  }, [metrics, data, computeMetricValue]);
47731
- const calculatedTrend = React87__default.useMemo(() => {
48152
+ const calculatedTrend = React88__default.useMemo(() => {
47732
48153
  if (manualTrend !== void 0) return manualTrend;
47733
48154
  if (previousValue === void 0 || currentValue === void 0)
47734
48155
  return void 0;
@@ -48368,8 +48789,8 @@ var init_SubagentTracePanel = __esm({
48368
48789
  ] });
48369
48790
  };
48370
48791
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
48371
- const endRef = React87__default.useRef(null);
48372
- React87__default.useEffect(() => {
48792
+ const endRef = React88__default.useRef(null);
48793
+ React88__default.useEffect(() => {
48373
48794
  if (!autoScroll) return;
48374
48795
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
48375
48796
  }, [activities.length, autoScroll]);
@@ -48463,7 +48884,7 @@ var init_SubagentTracePanel = __esm({
48463
48884
  };
48464
48885
  SubagentRichCard = ({ subagent }) => {
48465
48886
  const { t } = useTranslate();
48466
- const activities = React87__default.useMemo(
48887
+ const activities = React88__default.useMemo(
48467
48888
  () => subagentMessagesToActivities(subagent.messages),
48468
48889
  [subagent.messages]
48469
48890
  );
@@ -48540,8 +48961,8 @@ var init_SubagentTracePanel = __esm({
48540
48961
  ] });
48541
48962
  };
48542
48963
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
48543
- const endRef = React87__default.useRef(null);
48544
- React87__default.useEffect(() => {
48964
+ const endRef = React88__default.useRef(null);
48965
+ React88__default.useEffect(() => {
48545
48966
  if (!autoScroll) return;
48546
48967
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
48547
48968
  }, [messages.length, autoScroll]);
@@ -48976,7 +49397,7 @@ var init_Timeline = __esm({
48976
49397
  }) => {
48977
49398
  const { t } = useTranslate();
48978
49399
  const entityData = entity ?? [];
48979
- const items = React87__default.useMemo(() => {
49400
+ const items = React88__default.useMemo(() => {
48980
49401
  if (propItems) return propItems;
48981
49402
  if (entityData.length === 0) return [];
48982
49403
  return entityData.map((record, idx) => {
@@ -49078,7 +49499,7 @@ var init_Timeline = __esm({
49078
49499
  }
49079
49500
  });
49080
49501
  function extractToastProps(children) {
49081
- if (!React87__default.isValidElement(children)) {
49502
+ if (!React88__default.isValidElement(children)) {
49082
49503
  if (typeof children === "string") {
49083
49504
  return { message: children };
49084
49505
  }
@@ -49120,7 +49541,7 @@ var init_ToastSlot = __esm({
49120
49541
  eventBus.emit(`${prefix}CLOSE`);
49121
49542
  };
49122
49543
  if (!isVisible) return null;
49123
- const isCustomContent = React87__default.isValidElement(children) && !message;
49544
+ const isCustomContent = React88__default.isValidElement(children) && !message;
49124
49545
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
49125
49546
  Toast,
49126
49547
  {
@@ -49215,6 +49636,7 @@ var init_component_registry_generated = __esm({
49215
49636
  init_DocSearch();
49216
49637
  init_DocSidebar();
49217
49638
  init_DocTOC();
49639
+ init_DockLayout();
49218
49640
  init_DocumentDetails();
49219
49641
  init_DocumentPanel();
49220
49642
  init_DocumentViewer();
@@ -49245,6 +49667,7 @@ var init_component_registry_generated = __esm({
49245
49667
  init_FlipCard();
49246
49668
  init_FlipContainer();
49247
49669
  init_FloatingActionButton();
49670
+ init_FloatingToolbar();
49248
49671
  init_Form();
49249
49672
  init_FormField();
49250
49673
  init_FormSection();
@@ -49489,6 +49912,7 @@ var init_component_registry_generated = __esm({
49489
49912
  "DocSearch": DocSearch,
49490
49913
  "DocSidebar": DocSidebar,
49491
49914
  "DocTOC": DocTOC,
49915
+ "DockLayout": DockLayout,
49492
49916
  "DocumentDetails": DocumentDetails,
49493
49917
  "DocumentPanel": DocumentPanel,
49494
49918
  "DocumentViewer": DocumentViewer,
@@ -49519,6 +49943,7 @@ var init_component_registry_generated = __esm({
49519
49943
  "FlipCard": FlipCard,
49520
49944
  "FlipContainer": FlipContainer,
49521
49945
  "FloatingActionButton": FloatingActionButton,
49946
+ "FloatingToolbar": FloatingToolbar,
49522
49947
  "Form": Form,
49523
49948
  "FormField": FormField,
49524
49949
  "FormLayout": FormLayout,
@@ -49706,7 +50131,7 @@ function SuspenseConfigProvider({
49706
50131
  config,
49707
50132
  children
49708
50133
  }) {
49709
- return React87__default.createElement(
50134
+ return React88__default.createElement(
49710
50135
  SuspenseConfigContext.Provider,
49711
50136
  { value: config },
49712
50137
  children
@@ -49754,7 +50179,7 @@ function enrichFormFields(fields, entityDef) {
49754
50179
  }
49755
50180
  return { name: field, label: humanizeFieldName(field) };
49756
50181
  }
49757
- 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)) {
49758
50183
  const obj = field;
49759
50184
  const fieldName2 = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
49760
50185
  if (!fieldName2) return field;
@@ -49807,7 +50232,7 @@ function enrichDetailFields(fields, entityDef) {
49807
50232
  const meta = metaFor(field);
49808
50233
  return meta ? { key: field, ...meta } : field;
49809
50234
  }
49810
- 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)) {
49811
50236
  const obj = field;
49812
50237
  const fieldName2 = typeof obj.key === "string" ? obj.key : typeof obj.name === "string" ? obj.name : void 0;
49813
50238
  if (!fieldName2 || obj.type) return field;
@@ -50266,7 +50691,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
50266
50691
  const key = `${parentId}-${index}-trait:${traitName}`;
50267
50692
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
50268
50693
  }
50269
- return /* @__PURE__ */ jsx(React87__default.Fragment, { children: child }, `${parentId}-${index}`);
50694
+ return /* @__PURE__ */ jsx(React88__default.Fragment, { children: child }, `${parentId}-${index}`);
50270
50695
  }
50271
50696
  if (!child || typeof child !== "object") return null;
50272
50697
  const childId = `${parentId}-${index}`;
@@ -50323,7 +50748,7 @@ function isPatternConfig(value) {
50323
50748
  if (value === null || value === void 0) return false;
50324
50749
  if (typeof value !== "object") return false;
50325
50750
  if (Array.isArray(value)) return false;
50326
- if (React87__default.isValidElement(value)) return false;
50751
+ if (React88__default.isValidElement(value)) return false;
50327
50752
  if (value instanceof Date) return false;
50328
50753
  if (typeof value === "function") return false;
50329
50754
  const record = value;
@@ -50336,9 +50761,9 @@ function renderPatternValue(value) {
50336
50761
  if (typeof value === "string") return renderPatternChildren(value, () => {
50337
50762
  });
50338
50763
  if (value instanceof Date) return value.toLocaleString();
50339
- if (React87__default.isValidElement(value)) return value;
50764
+ if (React88__default.isValidElement(value)) return value;
50340
50765
  if (Array.isArray(value)) {
50341
- 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));
50342
50767
  }
50343
50768
  if (isPatternConfig(value)) {
50344
50769
  const { type, ...props } = value;
@@ -50348,7 +50773,7 @@ function renderPatternValue(value) {
50348
50773
  return null;
50349
50774
  }
50350
50775
  function isPlainConfigObject(value) {
50351
- if (React87__default.isValidElement(value)) return false;
50776
+ if (React88__default.isValidElement(value)) return false;
50352
50777
  if (value instanceof Date) return false;
50353
50778
  const proto = Object.getPrototypeOf(value);
50354
50779
  return proto === Object.prototype || proto === null;
@@ -50522,7 +50947,7 @@ function SlotContentRenderer({
50522
50947
  for (const slotKey of CONTENT_NODE_SLOTS) {
50523
50948
  const slotVal = restProps[slotKey];
50524
50949
  if (slotVal === void 0 || slotVal === null) continue;
50525
- 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;
50526
50951
  const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
50527
50952
  if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
50528
50953
  nodeSlotOverrides[slotKey] = renderPatternChildren(
@@ -50576,7 +51001,7 @@ function SlotContentRenderer({
50576
51001
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
50577
51002
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
50578
51003
  const sample = resolvedItems[0];
50579
- 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)) {
50580
51005
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
50581
51006
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
50582
51007
  }
@@ -50776,7 +51201,7 @@ var init_UISlotRenderer = __esm({
50776
51201
  init_useEventBus();
50777
51202
  var busLog = createLogger("almadar:eventbus");
50778
51203
  var subLog2 = createLogger("almadar:eventbus:subscribe");
50779
- var EventBusContext2 = createContext(null);
51204
+ var EventBusContext2 = globalThis.__almadarUiEventBusContext ?? (globalThis.__almadarUiEventBusContext = createContext(null));
50780
51205
  var listenerTags = /* @__PURE__ */ new WeakMap();
50781
51206
  function captureSubscriberTag(listener) {
50782
51207
  const fnName = listener.name;