@almadar/ui 2.26.0 → 2.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import * as React114 from 'react';
2
- import React114__default, { createContext, useCallback, useState, useRef, useLayoutEffect, useEffect, lazy, useContext, useMemo, Suspense, useId } from 'react';
1
+ import * as React116 from 'react';
2
+ import React116__default, { createContext, useCallback, useState, useRef, useEffect, useLayoutEffect, lazy, useContext, useMemo, Suspense, useId } from 'react';
3
3
  import { EventBusContext } from '@almadar/ui/providers';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import '@tanstack/react-query';
@@ -749,29 +749,41 @@ function subscribeToTraitChanges(listener) {
749
749
  }
750
750
 
751
751
  // lib/verificationRegistry.ts
752
- var checks = /* @__PURE__ */ new Map();
753
- var transitions = [];
754
752
  var MAX_TRANSITIONS = 500;
755
- var listeners2 = /* @__PURE__ */ new Set();
753
+ function getState() {
754
+ if (typeof window !== "undefined") {
755
+ const w = window;
756
+ if (!w.__verificationRegistryState) {
757
+ w.__verificationRegistryState = {
758
+ checks: /* @__PURE__ */ new Map(),
759
+ transitions: [],
760
+ bridgeHealth: null,
761
+ listeners: /* @__PURE__ */ new Set()
762
+ };
763
+ }
764
+ return w.__verificationRegistryState;
765
+ }
766
+ return { checks: /* @__PURE__ */ new Map(), transitions: [], bridgeHealth: null, listeners: /* @__PURE__ */ new Set() };
767
+ }
756
768
  function notifyListeners2() {
757
- listeners2.forEach((l) => l());
769
+ getState().listeners.forEach((l) => l());
758
770
  exposeOnWindow();
759
771
  }
760
772
  function registerCheck(id, label, status = "pending", details) {
761
- checks.set(id, { id, label, status, details, updatedAt: Date.now() });
773
+ getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
762
774
  notifyListeners2();
763
775
  }
764
776
  function getAllChecks() {
765
- return Array.from(checks.values());
777
+ return Array.from(getState().checks.values());
766
778
  }
767
779
  function recordTransition(trace) {
768
780
  const entry = {
769
781
  ...trace,
770
782
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
771
783
  };
772
- transitions.push(entry);
773
- if (transitions.length > MAX_TRANSITIONS) {
774
- transitions.shift();
784
+ getState().transitions.push(entry);
785
+ if (getState().transitions.length > MAX_TRANSITIONS) {
786
+ getState().transitions.shift();
775
787
  }
776
788
  if (entry.event === "INIT") {
777
789
  const hasFetch = entry.effects.some((e) => e.type === "fetch");
@@ -806,10 +818,11 @@ function recordTransition(trace) {
806
818
  notifyListeners2();
807
819
  }
808
820
  function getTransitions() {
809
- return [...transitions];
821
+ return [...getState().transitions];
810
822
  }
811
823
  function getBridgeHealth() {
812
- return null;
824
+ const bh = getState().bridgeHealth;
825
+ return bh ? { ...bh } : null;
813
826
  }
814
827
  function getSummary() {
815
828
  const allChecks = getAllChecks();
@@ -830,8 +843,8 @@ function getSnapshot2() {
830
843
  };
831
844
  }
832
845
  function subscribeToVerification(listener) {
833
- listeners2.add(listener);
834
- return () => listeners2.delete(listener);
846
+ getState().listeners.add(listener);
847
+ return () => getState().listeners.delete(listener);
835
848
  }
836
849
  function exposeOnWindow() {
837
850
  if (typeof window === "undefined") return;
@@ -848,7 +861,7 @@ function exposeOnWindow() {
848
861
  }
849
862
  function waitForTransition(event, timeoutMs = 1e4) {
850
863
  return new Promise((resolve) => {
851
- const existing = transitions.find((t) => t.event === event);
864
+ const existing = getState().transitions.find((t) => t.event === event);
852
865
  if (existing) {
853
866
  resolve(existing);
854
867
  return;
@@ -858,7 +871,7 @@ function waitForTransition(event, timeoutMs = 1e4) {
858
871
  resolve(null);
859
872
  }, timeoutMs);
860
873
  const unsub = subscribeToVerification(() => {
861
- const found = transitions.find((t) => t.event === event);
874
+ const found = getState().transitions.find((t) => t.event === event);
862
875
  if (found) {
863
876
  clearTimeout(timeout);
864
877
  unsub();
@@ -1001,6 +1014,15 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
1001
1014
  const newManager = managerRef.current;
1002
1015
  newManager.resetAll();
1003
1016
  setTraitStates(newManager.getAllStates());
1017
+ bindTraitStateGetter((traitName) => {
1018
+ const allStates = newManager.getAllStates();
1019
+ if (allStates instanceof Map) {
1020
+ const val = allStates.get(traitName);
1021
+ return typeof val === "string" ? val : void 0;
1022
+ }
1023
+ const state = newManager.getState(traitName);
1024
+ return typeof state === "string" ? state : void 0;
1025
+ });
1004
1026
  console.log(
1005
1027
  "[TraitStateMachine] Reset states for page navigation:",
1006
1028
  Array.from(newManager.getAllStates().keys()).join(", ")
@@ -1206,6 +1228,13 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
1206
1228
  updateTraitState(traitName, result.newState);
1207
1229
  const effectTraces = result.effects.map(
1208
1230
  (e) => {
1231
+ if (Array.isArray(e)) {
1232
+ return {
1233
+ type: String(e[0] ?? "unknown"),
1234
+ args: e.slice(1),
1235
+ status: "executed"
1236
+ };
1237
+ }
1209
1238
  const eff = e;
1210
1239
  return {
1211
1240
  type: String(eff.type ?? "unknown"),
@@ -1556,7 +1585,7 @@ var positionStyles = {
1556
1585
  fixed: "fixed",
1557
1586
  sticky: "sticky"
1558
1587
  };
1559
- var Box = React114__default.forwardRef(
1588
+ var Box = React116__default.forwardRef(
1560
1589
  ({
1561
1590
  padding,
1562
1591
  paddingX,
@@ -2034,8 +2063,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2034
2063
  payload,
2035
2064
  timestamp: Date.now()
2036
2065
  };
2037
- const listeners7 = listenersRef.current.get(type);
2038
- const listenerCount = listeners7?.size ?? 0;
2066
+ const listeners6 = listenersRef.current.get(type);
2067
+ const listenerCount = listeners6?.size ?? 0;
2039
2068
  if (debug2) {
2040
2069
  if (listenerCount > 0) {
2041
2070
  console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
@@ -2043,8 +2072,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2043
2072
  console.warn(`[EventBus] Emit: ${type} (NO LISTENERS - event may be lost!)`, payload);
2044
2073
  }
2045
2074
  }
2046
- if (listeners7) {
2047
- const listenersCopy = Array.from(listeners7);
2075
+ if (listeners6) {
2076
+ const listenersCopy = Array.from(listeners6);
2048
2077
  for (const listener of listenersCopy) {
2049
2078
  try {
2050
2079
  listener(event);
@@ -2066,17 +2095,17 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2066
2095
  if (!listenersRef.current.has(type)) {
2067
2096
  listenersRef.current.set(type, /* @__PURE__ */ new Set());
2068
2097
  }
2069
- const listeners7 = listenersRef.current.get(type);
2070
- listeners7.add(listener);
2098
+ const listeners6 = listenersRef.current.get(type);
2099
+ listeners6.add(listener);
2071
2100
  if (debug2) {
2072
- console.log(`[EventBus] Subscribed to '${type}', total: ${listeners7.size}`);
2101
+ console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
2073
2102
  }
2074
2103
  return () => {
2075
- listeners7.delete(listener);
2104
+ listeners6.delete(listener);
2076
2105
  if (debug2) {
2077
- console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners7.size}`);
2106
+ console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners6.size}`);
2078
2107
  }
2079
- if (listeners7.size === 0) {
2108
+ if (listeners6.size === 0) {
2080
2109
  listenersRef.current.delete(type);
2081
2110
  }
2082
2111
  };
@@ -2089,8 +2118,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2089
2118
  return on(type, wrappedListener);
2090
2119
  }, [on]);
2091
2120
  const hasListeners = useCallback((type) => {
2092
- const listeners7 = listenersRef.current.get(type);
2093
- return listeners7 !== void 0 && listeners7.size > 0;
2121
+ const listeners6 = listenersRef.current.get(type);
2122
+ return listeners6 !== void 0 && listeners6.size > 0;
2094
2123
  }, []);
2095
2124
  const onAny = useCallback((listener) => {
2096
2125
  anyListenersRef.current.add(listener);
@@ -2650,7 +2679,7 @@ function resolveIconProp(value, sizeClass) {
2650
2679
  const IconComp = value;
2651
2680
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
2652
2681
  }
2653
- if (React114__default.isValidElement(value)) {
2682
+ if (React116__default.isValidElement(value)) {
2654
2683
  return value;
2655
2684
  }
2656
2685
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -2659,7 +2688,7 @@ function resolveIconProp(value, sizeClass) {
2659
2688
  }
2660
2689
  return value;
2661
2690
  }
2662
- var Button = React114__default.forwardRef(
2691
+ var Button = React116__default.forwardRef(
2663
2692
  ({
2664
2693
  className,
2665
2694
  variant = "primary",
@@ -2755,7 +2784,7 @@ var sizeStyles3 = {
2755
2784
  md: "px-2.5 py-1 text-sm",
2756
2785
  lg: "px-3 py-1.5 text-base"
2757
2786
  };
2758
- var Badge = React114__default.forwardRef(
2787
+ var Badge = React116__default.forwardRef(
2759
2788
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
2760
2789
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
2761
2790
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -2878,7 +2907,7 @@ var Toast = ({
2878
2907
  );
2879
2908
  };
2880
2909
  Toast.displayName = "Toast";
2881
- var Input = React114__default.forwardRef(
2910
+ var Input = React116__default.forwardRef(
2882
2911
  ({
2883
2912
  className,
2884
2913
  inputType,
@@ -2990,7 +3019,7 @@ var Input = React114__default.forwardRef(
2990
3019
  }
2991
3020
  );
2992
3021
  Input.displayName = "Input";
2993
- var Label = React114__default.forwardRef(
3022
+ var Label = React116__default.forwardRef(
2994
3023
  ({ className, required, children, ...props }, ref) => {
2995
3024
  return /* @__PURE__ */ jsxs(
2996
3025
  "label",
@@ -3010,7 +3039,7 @@ var Label = React114__default.forwardRef(
3010
3039
  }
3011
3040
  );
3012
3041
  Label.displayName = "Label";
3013
- var Textarea = React114__default.forwardRef(
3042
+ var Textarea = React116__default.forwardRef(
3014
3043
  ({ className, error, ...props }, ref) => {
3015
3044
  return /* @__PURE__ */ jsx(
3016
3045
  "textarea",
@@ -3033,7 +3062,7 @@ var Textarea = React114__default.forwardRef(
3033
3062
  }
3034
3063
  );
3035
3064
  Textarea.displayName = "Textarea";
3036
- var Select = React114__default.forwardRef(
3065
+ var Select = React116__default.forwardRef(
3037
3066
  ({ className, options, placeholder, error, ...props }, ref) => {
3038
3067
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3039
3068
  /* @__PURE__ */ jsxs(
@@ -3069,7 +3098,7 @@ var Select = React114__default.forwardRef(
3069
3098
  }
3070
3099
  );
3071
3100
  Select.displayName = "Select";
3072
- var Checkbox = React114__default.forwardRef(
3101
+ var Checkbox = React116__default.forwardRef(
3073
3102
  ({ className, label, id, ...props }, ref) => {
3074
3103
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3075
3104
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -3145,7 +3174,7 @@ var shadowStyles2 = {
3145
3174
  md: "shadow",
3146
3175
  lg: "shadow-lg"
3147
3176
  };
3148
- var Card = React114__default.forwardRef(
3177
+ var Card = React116__default.forwardRef(
3149
3178
  ({
3150
3179
  className,
3151
3180
  variant = "bordered",
@@ -3181,9 +3210,9 @@ var Card = React114__default.forwardRef(
3181
3210
  }
3182
3211
  );
3183
3212
  Card.displayName = "Card";
3184
- var CardHeader = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3213
+ var CardHeader = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3185
3214
  CardHeader.displayName = "CardHeader";
3186
- var CardTitle = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3215
+ var CardTitle = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3187
3216
  "h3",
3188
3217
  {
3189
3218
  ref,
@@ -3196,11 +3225,11 @@ var CardTitle = React114__default.forwardRef(({ className, ...props }, ref) => /
3196
3225
  }
3197
3226
  ));
3198
3227
  CardTitle.displayName = "CardTitle";
3199
- var CardContent = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3228
+ var CardContent = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3200
3229
  CardContent.displayName = "CardContent";
3201
3230
  var CardBody = CardContent;
3202
3231
  CardBody.displayName = "CardBody";
3203
- var CardFooter = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3232
+ var CardFooter = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3204
3233
  "div",
3205
3234
  {
3206
3235
  ref,
@@ -3215,7 +3244,7 @@ var sizeStyles4 = {
3215
3244
  md: "h-6 w-6",
3216
3245
  lg: "h-8 w-8"
3217
3246
  };
3218
- var Spinner = React114__default.forwardRef(
3247
+ var Spinner = React116__default.forwardRef(
3219
3248
  ({ className, size = "md", ...props }, ref) => {
3220
3249
  return /* @__PURE__ */ jsx(
3221
3250
  "div",
@@ -3631,7 +3660,7 @@ var ProgressBar = ({
3631
3660
  return null;
3632
3661
  };
3633
3662
  ProgressBar.displayName = "ProgressBar";
3634
- var Radio = React114__default.forwardRef(
3663
+ var Radio = React116__default.forwardRef(
3635
3664
  ({
3636
3665
  label,
3637
3666
  helperText,
@@ -3735,7 +3764,7 @@ var Radio = React114__default.forwardRef(
3735
3764
  }
3736
3765
  );
3737
3766
  Radio.displayName = "Radio";
3738
- var Switch = React114.forwardRef(
3767
+ var Switch = React116.forwardRef(
3739
3768
  ({
3740
3769
  checked,
3741
3770
  defaultChecked = false,
@@ -3746,10 +3775,10 @@ var Switch = React114.forwardRef(
3746
3775
  name,
3747
3776
  className
3748
3777
  }, ref) => {
3749
- const [isChecked, setIsChecked] = React114.useState(
3778
+ const [isChecked, setIsChecked] = React116.useState(
3750
3779
  checked !== void 0 ? checked : defaultChecked
3751
3780
  );
3752
- React114.useEffect(() => {
3781
+ React116.useEffect(() => {
3753
3782
  if (checked !== void 0) {
3754
3783
  setIsChecked(checked);
3755
3784
  }
@@ -4114,8 +4143,8 @@ var LawReferenceTooltip = ({
4114
4143
  position = "top",
4115
4144
  className
4116
4145
  }) => {
4117
- const [isVisible, setIsVisible] = React114__default.useState(false);
4118
- const timeoutRef = React114__default.useRef(null);
4146
+ const [isVisible, setIsVisible] = React116__default.useState(false);
4147
+ const timeoutRef = React116__default.useRef(null);
4119
4148
  const handleMouseEnter = () => {
4120
4149
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4121
4150
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4124,7 +4153,7 @@ var LawReferenceTooltip = ({
4124
4153
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4125
4154
  setIsVisible(false);
4126
4155
  };
4127
- React114__default.useEffect(() => {
4156
+ React116__default.useEffect(() => {
4128
4157
  return () => {
4129
4158
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4130
4159
  };
@@ -4312,7 +4341,7 @@ var sizeStyles5 = {
4312
4341
  md: "w-2.5 h-2.5",
4313
4342
  lg: "w-3 h-3"
4314
4343
  };
4315
- var StatusDot = React114__default.forwardRef(
4344
+ var StatusDot = React116__default.forwardRef(
4316
4345
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4317
4346
  return /* @__PURE__ */ jsx(
4318
4347
  "span",
@@ -4359,7 +4388,7 @@ var iconMap2 = {
4359
4388
  down: TrendingDown,
4360
4389
  flat: ArrowRight
4361
4390
  };
4362
- var TrendIndicator = React114__default.forwardRef(
4391
+ var TrendIndicator = React116__default.forwardRef(
4363
4392
  ({
4364
4393
  className,
4365
4394
  value,
@@ -4418,7 +4447,7 @@ var thumbSizes = {
4418
4447
  md: "w-4 h-4",
4419
4448
  lg: "w-5 h-5"
4420
4449
  };
4421
- var RangeSlider = React114__default.forwardRef(
4450
+ var RangeSlider = React116__default.forwardRef(
4422
4451
  ({
4423
4452
  className,
4424
4453
  min = 0,
@@ -4869,7 +4898,7 @@ var paddingClasses = {
4869
4898
  md: "py-16",
4870
4899
  lg: "py-24"
4871
4900
  };
4872
- var ContentSection = React114__default.forwardRef(
4901
+ var ContentSection = React116__default.forwardRef(
4873
4902
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4874
4903
  return /* @__PURE__ */ jsx(
4875
4904
  Box,
@@ -4888,6 +4917,289 @@ var ContentSection = React114__default.forwardRef(
4888
4917
  }
4889
4918
  );
4890
4919
  ContentSection.displayName = "ContentSection";
4920
+ var initialStyles = {
4921
+ "fade-up": { opacity: 0, transform: "translateY(24px)" },
4922
+ "fade-down": { opacity: 0, transform: "translateY(-24px)" },
4923
+ "fade-in": { opacity: 0 },
4924
+ "fade-left": { opacity: 0, transform: "translateX(24px)" },
4925
+ "fade-right": { opacity: 0, transform: "translateX(-24px)" },
4926
+ "scale": { opacity: 0, transform: "scale(0.92)" },
4927
+ "scale-up": { opacity: 0, transform: "scale(0.92) translateY(16px)" },
4928
+ "none": {}
4929
+ };
4930
+ var animatedStyles = {
4931
+ "fade-up": { opacity: 1, transform: "translateY(0)" },
4932
+ "fade-down": { opacity: 1, transform: "translateY(0)" },
4933
+ "fade-in": { opacity: 1 },
4934
+ "fade-left": { opacity: 1, transform: "translateX(0)" },
4935
+ "fade-right": { opacity: 1, transform: "translateX(0)" },
4936
+ "scale": { opacity: 1, transform: "scale(1)" },
4937
+ "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
4938
+ "none": {}
4939
+ };
4940
+ var AnimatedReveal = React116__default.forwardRef(
4941
+ ({
4942
+ trigger = "scroll",
4943
+ animation = "fade-up",
4944
+ duration = 600,
4945
+ delay = 0,
4946
+ threshold = 0.15,
4947
+ once = true,
4948
+ animate: manualAnimate,
4949
+ easing = "cubic-bezier(0.16, 1, 0.3, 1)",
4950
+ children,
4951
+ className,
4952
+ style,
4953
+ ...props
4954
+ }, forwardedRef) => {
4955
+ const [isAnimated, setIsAnimated] = useState(false);
4956
+ const internalRef = useRef(null);
4957
+ const hasAnimated = useRef(false);
4958
+ const setRef = useCallback(
4959
+ (node) => {
4960
+ internalRef.current = node;
4961
+ if (typeof forwardedRef === "function") forwardedRef(node);
4962
+ else if (forwardedRef) forwardedRef.current = node;
4963
+ },
4964
+ [forwardedRef]
4965
+ );
4966
+ useEffect(() => {
4967
+ if (trigger !== "scroll") return;
4968
+ const el = internalRef.current;
4969
+ if (!el) return;
4970
+ const observer = new IntersectionObserver(
4971
+ ([entry]) => {
4972
+ if (entry.isIntersecting) {
4973
+ if (once && hasAnimated.current) return;
4974
+ hasAnimated.current = true;
4975
+ setIsAnimated(true);
4976
+ } else if (!once) {
4977
+ setIsAnimated(false);
4978
+ }
4979
+ },
4980
+ { threshold }
4981
+ );
4982
+ observer.observe(el);
4983
+ return () => observer.disconnect();
4984
+ }, [trigger, threshold, once]);
4985
+ const handleMouseEnter = trigger === "hover" ? () => setIsAnimated(true) : void 0;
4986
+ const handleMouseLeave = trigger === "hover" ? () => {
4987
+ if (!once || !hasAnimated.current) {
4988
+ hasAnimated.current = true;
4989
+ setIsAnimated(false);
4990
+ }
4991
+ } : void 0;
4992
+ useEffect(() => {
4993
+ if (trigger === "manual" && manualAnimate !== void 0) {
4994
+ setIsAnimated(manualAnimate);
4995
+ }
4996
+ }, [trigger, manualAnimate]);
4997
+ const active = isAnimated;
4998
+ const currentStyle = active ? animatedStyles[animation] : initialStyles[animation];
4999
+ return /* @__PURE__ */ jsx(
5000
+ "div",
5001
+ {
5002
+ ref: setRef,
5003
+ className: cn("will-change-[opacity,transform]", className),
5004
+ style: {
5005
+ ...currentStyle,
5006
+ transitionProperty: "opacity, transform",
5007
+ transitionDuration: `${duration}ms`,
5008
+ transitionDelay: `${delay}ms`,
5009
+ transitionTimingFunction: easing,
5010
+ ...style
5011
+ },
5012
+ onMouseEnter: handleMouseEnter,
5013
+ onMouseLeave: handleMouseLeave,
5014
+ ...props,
5015
+ children: typeof children === "function" ? children(active) : children
5016
+ }
5017
+ );
5018
+ }
5019
+ );
5020
+ AnimatedReveal.displayName = "AnimatedReveal";
5021
+ function useFetchedSvg(src) {
5022
+ const [svg, setSvg] = useState(null);
5023
+ const cache = useRef({});
5024
+ useEffect(() => {
5025
+ if (!src) {
5026
+ setSvg(null);
5027
+ return;
5028
+ }
5029
+ if (cache.current[src]) {
5030
+ setSvg(cache.current[src]);
5031
+ return;
5032
+ }
5033
+ let cancelled = false;
5034
+ fetch(src).then((res) => {
5035
+ if (!res.ok) throw new Error(`Failed to fetch SVG: ${res.status}`);
5036
+ return res.text();
5037
+ }).then((text) => {
5038
+ if (cancelled) return;
5039
+ cache.current[src] = text;
5040
+ setSvg(text);
5041
+ }).catch(() => {
5042
+ if (!cancelled) setSvg(null);
5043
+ });
5044
+ return () => {
5045
+ cancelled = true;
5046
+ };
5047
+ }, [src]);
5048
+ return svg;
5049
+ }
5050
+ function applyDrawAnimation(container, animate, duration, delay, easing) {
5051
+ const paths = container.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
5052
+ paths.forEach((el) => {
5053
+ if ("getTotalLength" in el && typeof el.getTotalLength === "function") {
5054
+ const len = el.getTotalLength();
5055
+ el.style.strokeDasharray = `${len}`;
5056
+ el.style.strokeDashoffset = animate ? "0" : `${len}`;
5057
+ el.style.transition = `stroke-dashoffset ${duration}ms ${easing} ${delay}ms`;
5058
+ }
5059
+ });
5060
+ }
5061
+ function applyFillAnimation(container, animate, duration, delay, easing, fillColor) {
5062
+ const paths = container.querySelectorAll("path, circle, ellipse, rect, polygon");
5063
+ paths.forEach((el) => {
5064
+ if ("getTotalLength" in el && typeof el.getTotalLength === "function") {
5065
+ const geom = el;
5066
+ const len = geom.getTotalLength();
5067
+ geom.style.strokeDasharray = `${len}`;
5068
+ geom.style.strokeDashoffset = animate ? "0" : `${len}`;
5069
+ geom.style.transition = `stroke-dashoffset ${duration * 0.6}ms ${easing} ${delay}ms, fill-opacity ${duration * 0.4}ms ${easing} ${delay + duration * 0.6}ms`;
5070
+ }
5071
+ if (fillColor) el.style.fill = fillColor;
5072
+ el.style.fillOpacity = animate ? "1" : "0";
5073
+ });
5074
+ }
5075
+ function applyPulseAnimation(container, animate, duration) {
5076
+ const svg = container.querySelector("svg");
5077
+ if (!svg) return;
5078
+ if (animate) {
5079
+ svg.style.animation = `ag-pulse ${duration}ms ease-in-out infinite`;
5080
+ } else {
5081
+ svg.style.animation = "none";
5082
+ }
5083
+ }
5084
+ function applyMorphAnimation(container, animate, duration, delay, easing) {
5085
+ const paths = container.querySelectorAll("path, circle, ellipse, rect, polygon");
5086
+ paths.forEach((el) => {
5087
+ el.style.transition = `all ${duration}ms ${easing} ${delay}ms`;
5088
+ el.style.transform = animate ? "scale(1)" : "scale(0)";
5089
+ el.style.transformOrigin = "center";
5090
+ el.style.opacity = animate ? "1" : "0";
5091
+ });
5092
+ }
5093
+ var AnimatedGraphic = React116__default.forwardRef(
5094
+ ({
5095
+ src,
5096
+ svgContent,
5097
+ animation = "draw",
5098
+ animate = false,
5099
+ duration = 1200,
5100
+ delay = 0,
5101
+ easing = "cubic-bezier(0.16, 1, 0.3, 1)",
5102
+ width,
5103
+ height,
5104
+ strokeColor,
5105
+ fillColor,
5106
+ alt,
5107
+ className,
5108
+ style,
5109
+ children,
5110
+ ...props
5111
+ }, ref) => {
5112
+ const containerRef = useRef(null);
5113
+ const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
5114
+ const resolvedSvg = svgContent ?? fetchedSvg;
5115
+ const prevAnimateRef = useRef(animate);
5116
+ const setRef = React116__default.useCallback(
5117
+ (node) => {
5118
+ containerRef.current = node;
5119
+ if (typeof ref === "function") ref(node);
5120
+ else if (ref) ref.current = node;
5121
+ },
5122
+ [ref]
5123
+ );
5124
+ useEffect(() => {
5125
+ const el = containerRef.current;
5126
+ if (!el || !strokeColor) return;
5127
+ const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
5128
+ paths.forEach((p2) => {
5129
+ p2.style.stroke = strokeColor;
5130
+ });
5131
+ }, [resolvedSvg, strokeColor]);
5132
+ useEffect(() => {
5133
+ const el = containerRef.current;
5134
+ if (!el || !resolvedSvg) return;
5135
+ if (animation === "draw" || animation === "fill") {
5136
+ const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
5137
+ paths.forEach((p2) => {
5138
+ if ("getTotalLength" in p2 && typeof p2.getTotalLength === "function") {
5139
+ const len = p2.getTotalLength();
5140
+ p2.style.strokeDasharray = `${len}`;
5141
+ p2.style.strokeDashoffset = `${len}`;
5142
+ }
5143
+ if (animation === "fill") {
5144
+ p2.style.fillOpacity = "0";
5145
+ }
5146
+ });
5147
+ }
5148
+ if (animation === "morph") {
5149
+ const paths = el.querySelectorAll("path, circle, ellipse, rect, polygon");
5150
+ paths.forEach((p2) => {
5151
+ p2.style.transform = "scale(0)";
5152
+ p2.style.transformOrigin = "center";
5153
+ p2.style.opacity = "0";
5154
+ });
5155
+ }
5156
+ }, [resolvedSvg, animation]);
5157
+ useEffect(() => {
5158
+ const el = containerRef.current;
5159
+ if (!el) return;
5160
+ const id = requestAnimationFrame(() => {
5161
+ switch (animation) {
5162
+ case "draw":
5163
+ applyDrawAnimation(el, animate, duration, delay, easing);
5164
+ break;
5165
+ case "fill":
5166
+ applyFillAnimation(el, animate, duration, delay, easing, fillColor);
5167
+ break;
5168
+ case "pulse":
5169
+ applyPulseAnimation(el, animate, duration);
5170
+ break;
5171
+ case "morph":
5172
+ applyMorphAnimation(el, animate, duration, delay, easing);
5173
+ break;
5174
+ }
5175
+ });
5176
+ prevAnimateRef.current = animate;
5177
+ return () => cancelAnimationFrame(id);
5178
+ }, [animate, animation, duration, delay, easing, fillColor, resolvedSvg]);
5179
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
5180
+ /* @__PURE__ */ jsx("style", { children: `@keyframes ag-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.04); opacity: 0.85; } }` }),
5181
+ /* @__PURE__ */ jsx(
5182
+ "div",
5183
+ {
5184
+ ref: setRef,
5185
+ className: cn("inline-flex items-center justify-center", className),
5186
+ style: { width, height, ...style },
5187
+ role: alt ? "img" : void 0,
5188
+ "aria-label": alt,
5189
+ ...props,
5190
+ children: resolvedSvg ? /* @__PURE__ */ jsx(
5191
+ "div",
5192
+ {
5193
+ className: "w-full h-full [&>svg]:w-full [&>svg]:h-full",
5194
+ dangerouslySetInnerHTML: { __html: resolvedSvg }
5195
+ }
5196
+ ) : children
5197
+ }
5198
+ )
5199
+ ] });
5200
+ }
5201
+ );
5202
+ AnimatedGraphic.displayName = "AnimatedGraphic";
4891
5203
  var heartIcon = (filled, size) => /* @__PURE__ */ jsx(
4892
5204
  "svg",
4893
5205
  {
@@ -4972,9 +5284,9 @@ function ScoreDisplay({
4972
5284
  ...rest
4973
5285
  }) {
4974
5286
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
4975
- const [displayValue, setDisplayValue] = React114.useState(resolvedValue);
4976
- const [isAnimating, setIsAnimating] = React114.useState(false);
4977
- React114.useEffect(() => {
5287
+ const [displayValue, setDisplayValue] = React116.useState(resolvedValue);
5288
+ const [isAnimating, setIsAnimating] = React116.useState(false);
5289
+ React116.useEffect(() => {
4978
5290
  if (!animated || displayValue === resolvedValue) {
4979
5291
  setDisplayValue(resolvedValue);
4980
5292
  return;
@@ -5047,9 +5359,9 @@ function ControlButton({
5047
5359
  className
5048
5360
  }) {
5049
5361
  const eventBus = useEventBus();
5050
- const [isPressed, setIsPressed] = React114.useState(false);
5362
+ const [isPressed, setIsPressed] = React116.useState(false);
5051
5363
  const actualPressed = pressed ?? isPressed;
5052
- const handlePointerDown = React114.useCallback(
5364
+ const handlePointerDown = React116.useCallback(
5053
5365
  (e) => {
5054
5366
  e.preventDefault();
5055
5367
  if (disabled) return;
@@ -5059,7 +5371,7 @@ function ControlButton({
5059
5371
  },
5060
5372
  [disabled, pressEvent, eventBus, onPress]
5061
5373
  );
5062
- const handlePointerUp = React114.useCallback(
5374
+ const handlePointerUp = React116.useCallback(
5063
5375
  (e) => {
5064
5376
  e.preventDefault();
5065
5377
  if (disabled) return;
@@ -5069,7 +5381,7 @@ function ControlButton({
5069
5381
  },
5070
5382
  [disabled, releaseEvent, eventBus, onRelease]
5071
5383
  );
5072
- const handlePointerLeave = React114.useCallback(
5384
+ const handlePointerLeave = React116.useCallback(
5073
5385
  (e) => {
5074
5386
  if (isPressed) {
5075
5387
  setIsPressed(false);
@@ -5859,9 +6171,9 @@ function MiniMap({
5859
6171
  viewportRect,
5860
6172
  className
5861
6173
  }) {
5862
- const canvasRef = React114.useRef(null);
5863
- const frameRef = React114.useRef(0);
5864
- React114.useEffect(() => {
6174
+ const canvasRef = React116.useRef(null);
6175
+ const frameRef = React116.useRef(0);
6176
+ React116.useEffect(() => {
5865
6177
  const canvas = canvasRef.current;
5866
6178
  if (!canvas) return;
5867
6179
  const ctx = canvas.getContext("2d");
@@ -5970,7 +6282,7 @@ var ErrorState = ({
5970
6282
  );
5971
6283
  };
5972
6284
  ErrorState.displayName = "ErrorState";
5973
- var ErrorBoundary = class extends React114__default.Component {
6285
+ var ErrorBoundary = class extends React116__default.Component {
5974
6286
  constructor(props) {
5975
6287
  super(props);
5976
6288
  __publicField(this, "reset", () => {
@@ -6333,8 +6645,8 @@ var Tooltip = ({
6333
6645
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
6334
6646
  };
6335
6647
  }, []);
6336
- const triggerElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
6337
- const trigger = React114__default.cloneElement(triggerElement, {
6648
+ const triggerElement = React116__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
6649
+ const trigger = React116__default.cloneElement(triggerElement, {
6338
6650
  ref: triggerRef,
6339
6651
  onMouseEnter: handleMouseEnter,
6340
6652
  onMouseLeave: handleMouseLeave,
@@ -6447,8 +6759,8 @@ var Popover = ({
6447
6759
  onMouseEnter: handleOpen,
6448
6760
  onMouseLeave: handleClose
6449
6761
  };
6450
- const childElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
6451
- const triggerElement = React114__default.cloneElement(
6762
+ const childElement = React116__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
6763
+ const triggerElement = React116__default.cloneElement(
6452
6764
  childElement,
6453
6765
  {
6454
6766
  ref: triggerRef,
@@ -6552,8 +6864,8 @@ var Menu = ({
6552
6864
  "bottom-start": "top-full left-0 mt-2",
6553
6865
  "bottom-end": "top-full right-0 mt-2"
6554
6866
  };
6555
- const triggerChild = React114__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
6556
- const triggerElement = React114__default.cloneElement(
6867
+ const triggerChild = React116__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
6868
+ const triggerElement = React116__default.cloneElement(
6557
6869
  triggerChild,
6558
6870
  {
6559
6871
  ref: triggerRef,
@@ -7253,7 +7565,7 @@ function InputPattern({
7253
7565
  className
7254
7566
  }) {
7255
7567
  const { emit } = useEventBus();
7256
- const [localValue, setLocalValue] = React114__default.useState(value);
7568
+ const [localValue, setLocalValue] = React116__default.useState(value);
7257
7569
  const handleChange = (e) => {
7258
7570
  setLocalValue(e.target.value);
7259
7571
  if (onChange) {
@@ -7290,7 +7602,7 @@ function TextareaPattern({
7290
7602
  className
7291
7603
  }) {
7292
7604
  const { emit } = useEventBus();
7293
- const [localValue, setLocalValue] = React114__default.useState(value);
7605
+ const [localValue, setLocalValue] = React116__default.useState(value);
7294
7606
  const handleChange = (e) => {
7295
7607
  setLocalValue(e.target.value);
7296
7608
  if (onChange) {
@@ -7321,7 +7633,7 @@ function SelectPattern({
7321
7633
  className
7322
7634
  }) {
7323
7635
  const { emit } = useEventBus();
7324
- const [localValue, setLocalValue] = React114__default.useState(value);
7636
+ const [localValue, setLocalValue] = React116__default.useState(value);
7325
7637
  const handleChange = (e) => {
7326
7638
  setLocalValue(e.target.value);
7327
7639
  if (onChange) {
@@ -7350,7 +7662,7 @@ function CheckboxPattern({
7350
7662
  className
7351
7663
  }) {
7352
7664
  const { emit } = useEventBus();
7353
- const [localChecked, setLocalChecked] = React114__default.useState(checked);
7665
+ const [localChecked, setLocalChecked] = React116__default.useState(checked);
7354
7666
  const handleChange = (e) => {
7355
7667
  setLocalChecked(e.target.checked);
7356
7668
  if (onChange) {
@@ -7551,8 +7863,8 @@ function ActionButtons({
7551
7863
  disabled
7552
7864
  }) {
7553
7865
  const eventBus = useEventBus();
7554
- const [activeButtons, setActiveButtons] = React114.useState(/* @__PURE__ */ new Set());
7555
- const handlePress = React114.useCallback(
7866
+ const [activeButtons, setActiveButtons] = React116.useState(/* @__PURE__ */ new Set());
7867
+ const handlePress = React116.useCallback(
7556
7868
  (id) => {
7557
7869
  setActiveButtons((prev) => new Set(prev).add(id));
7558
7870
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -7560,7 +7872,7 @@ function ActionButtons({
7560
7872
  },
7561
7873
  [actionEvent, eventBus, onAction]
7562
7874
  );
7563
- const handleRelease = React114.useCallback(
7875
+ const handleRelease = React116.useCallback(
7564
7876
  (id) => {
7565
7877
  setActiveButtons((prev) => {
7566
7878
  const next = new Set(prev);
@@ -9224,7 +9536,7 @@ var ScaledDiagram = ({
9224
9536
  );
9225
9537
  };
9226
9538
  ScaledDiagram.displayName = "ScaledDiagram";
9227
- var MarkdownContent = React114__default.memo(
9539
+ var MarkdownContent = React116__default.memo(
9228
9540
  ({ content, direction, className }) => {
9229
9541
  const { t: _t } = useTranslate();
9230
9542
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -9326,7 +9638,7 @@ var MarkdownContent = React114__default.memo(
9326
9638
  (prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
9327
9639
  );
9328
9640
  MarkdownContent.displayName = "MarkdownContent";
9329
- var CodeBlock = React114__default.memo(
9641
+ var CodeBlock = React116__default.memo(
9330
9642
  ({
9331
9643
  code: rawCode,
9332
9644
  language = "text",
@@ -10286,7 +10598,7 @@ var StateMachineView = ({
10286
10598
  style: { top: title ? 30 : 0 },
10287
10599
  children: [
10288
10600
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
10289
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React114__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
10601
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React116__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
10290
10602
  StateNode,
10291
10603
  {
10292
10604
  state,
@@ -10480,9 +10792,9 @@ function getEffectSummary(effects) {
10480
10792
  });
10481
10793
  return summaries.join(" | ");
10482
10794
  }
10483
- function extractOutputsFromTransitions(transitions2) {
10795
+ function extractOutputsFromTransitions(transitions) {
10484
10796
  const outputs = /* @__PURE__ */ new Set();
10485
- transitions2.forEach((t) => {
10797
+ transitions.forEach((t) => {
10486
10798
  if (t.effects) {
10487
10799
  t.effects.forEach((effect) => {
10488
10800
  if (Array.isArray(effect)) {
@@ -10507,7 +10819,7 @@ function getNodeRadius(stateName, config) {
10507
10819
  if (textLength > 6) return baseRadius + 8;
10508
10820
  return baseRadius;
10509
10821
  }
10510
- function calculateLayout(states, transitions2, options, config) {
10822
+ function calculateLayout(states, transitions, options, config) {
10511
10823
  const positions = {};
10512
10824
  const entityBoxWidth = options.hasEntity ? 200 : 0;
10513
10825
  const outputBoxWidth = options.hasOutputs ? 200 : 0;
@@ -10516,7 +10828,7 @@ function calculateLayout(states, transitions2, options, config) {
10516
10828
  states.filter((s) => s.isFinal);
10517
10829
  states.filter((s) => !s.isInitial && !s.isFinal);
10518
10830
  let maxLabelLength = 0;
10519
- transitions2.forEach((t) => {
10831
+ transitions.forEach((t) => {
10520
10832
  if (t.effects && t.effects.length > 0) {
10521
10833
  const summary = getEffectSummary(t.effects);
10522
10834
  maxLabelLength = Math.max(maxLabelLength, summary.length);
@@ -10542,7 +10854,7 @@ function calculateLayout(states, transitions2, options, config) {
10542
10854
  if (stateColumn[name] === void 0) {
10543
10855
  stateColumn[name] = col;
10544
10856
  }
10545
- transitions2.forEach((t) => {
10857
+ transitions.forEach((t) => {
10546
10858
  if (t.from === name && t.from !== t.to && !visited.has(t.to)) {
10547
10859
  queue.push({ name: t.to, col: col + 1 });
10548
10860
  }
@@ -10591,11 +10903,11 @@ function calculateLayout(states, transitions2, options, config) {
10591
10903
  });
10592
10904
  return { positions, width, height: height + 60 };
10593
10905
  }
10594
- function calculateTransitionPathData(from, to, transitions2, positions, config) {
10906
+ function calculateTransitionPathData(from, to, transitions, positions, config) {
10595
10907
  const fromPos = positions[from];
10596
10908
  const toPos = positions[to];
10597
10909
  if (!fromPos || !toPos) return null;
10598
- const relevantTransitions = transitions2.filter((t) => t.from === from && t.to === to);
10910
+ const relevantTransitions = transitions.filter((t) => t.from === from && t.to === to);
10599
10911
  if (relevantTransitions.length === 0) return null;
10600
10912
  const fromRadius = getNodeRadius(from, config);
10601
10913
  const toRadius = getNodeRadius(to, config);
@@ -10626,7 +10938,7 @@ function calculateTransitionPathData(from, to, transitions2, positions, config)
10626
10938
  const startY = fromPos.y + ny * fromRadius;
10627
10939
  const endX = toPos.x - nx * (toRadius + 5);
10628
10940
  const endY = toPos.y - ny * (toRadius + 5);
10629
- const hasReverse = transitions2.some((t) => t.from === to && t.to === from);
10941
+ const hasReverse = transitions.some((t) => t.from === to && t.to === from);
10630
10942
  const isReverse = hasReverse && from > to;
10631
10943
  const baseOffset = hasReverse ? 50 : 30;
10632
10944
  const curveOffset = baseOffset + (relevantTransitions.length > 1 ? 20 : 0);
@@ -10641,15 +10953,15 @@ function calculateTransitionPathData(from, to, transitions2, positions, config)
10641
10953
  }
10642
10954
  function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAULT_CONFIG) {
10643
10955
  const states = stateMachine.states || [];
10644
- const transitions2 = stateMachine.transitions || [];
10956
+ const transitions = stateMachine.transitions || [];
10645
10957
  const title = options.title || "";
10646
10958
  const entity = options.entity;
10647
- const outputs = extractOutputsFromTransitions(transitions2);
10959
+ const outputs = extractOutputsFromTransitions(transitions);
10648
10960
  const layoutOptions = {
10649
10961
  hasEntity: !!entity,
10650
10962
  hasOutputs: outputs.length > 0
10651
10963
  };
10652
- const { positions, width, height } = calculateLayout(states, transitions2, layoutOptions, config);
10964
+ const { positions, width, height } = calculateLayout(states, transitions, layoutOptions, config);
10653
10965
  const domStates = Object.entries(positions).map(([name, pos]) => ({
10654
10966
  id: `state-${name}`,
10655
10967
  name,
@@ -10663,14 +10975,14 @@ function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAUL
10663
10975
  const domPaths = [];
10664
10976
  const domLabels = [];
10665
10977
  const drawnPairs = /* @__PURE__ */ new Set();
10666
- transitions2.forEach((transition, idx) => {
10978
+ transitions.forEach((transition, idx) => {
10667
10979
  const pairKey = `${transition.from}->${transition.to}`;
10668
10980
  if (!drawnPairs.has(pairKey)) {
10669
10981
  drawnPairs.add(pairKey);
10670
10982
  const pathData2 = calculateTransitionPathData(
10671
10983
  transition.from,
10672
10984
  transition.to,
10673
- transitions2,
10985
+ transitions,
10674
10986
  positions,
10675
10987
  config
10676
10988
  );
@@ -10691,7 +11003,7 @@ function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAUL
10691
11003
  const pathData = calculateTransitionPathData(
10692
11004
  transition.from,
10693
11005
  transition.to,
10694
- transitions2,
11006
+ transitions,
10695
11007
  positions,
10696
11008
  config
10697
11009
  );
@@ -15623,7 +15935,7 @@ function CraftingRecipe({
15623
15935
  className
15624
15936
  }) {
15625
15937
  const eventBus = useEventBus();
15626
- const handleCraft = React114.useCallback(() => {
15938
+ const handleCraft = React116.useCallback(() => {
15627
15939
  onCraft?.();
15628
15940
  if (craftEvent) {
15629
15941
  eventBus.emit(craftEvent, { output: output.label });
@@ -15640,7 +15952,7 @@ function CraftingRecipe({
15640
15952
  children: [
15641
15953
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
15642
15954
  const hasSufficient = ingredient.available >= ingredient.required;
15643
- return /* @__PURE__ */ jsxs(React114.Fragment, { children: [
15955
+ return /* @__PURE__ */ jsxs(React116.Fragment, { children: [
15644
15956
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
15645
15957
  ItemSlot,
15646
15958
  {
@@ -15919,8 +16231,8 @@ function DPad({
15919
16231
  }) {
15920
16232
  const eventBus = useEventBus();
15921
16233
  const sizes = sizeMap15[size];
15922
- const [activeDirections, setActiveDirections] = React114.useState(/* @__PURE__ */ new Set());
15923
- const handlePress = React114.useCallback(
16234
+ const [activeDirections, setActiveDirections] = React116.useState(/* @__PURE__ */ new Set());
16235
+ const handlePress = React116.useCallback(
15924
16236
  (direction) => {
15925
16237
  setActiveDirections((prev) => new Set(prev).add(direction));
15926
16238
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -15928,7 +16240,7 @@ function DPad({
15928
16240
  },
15929
16241
  [directionEvent, eventBus, onDirection]
15930
16242
  );
15931
- const handleRelease = React114.useCallback(
16243
+ const handleRelease = React116.useCallback(
15932
16244
  (direction) => {
15933
16245
  setActiveDirections((prev) => {
15934
16246
  const next = new Set(prev);
@@ -16705,7 +17017,7 @@ var DataList = ({
16705
17017
  }) => {
16706
17018
  const eventBus = useEventBus();
16707
17019
  const { t } = useTranslate();
16708
- const [visibleCount, setVisibleCount] = React114__default.useState(pageSize || Infinity);
17020
+ const [visibleCount, setVisibleCount] = React116__default.useState(pageSize || Infinity);
16709
17021
  const fields = fieldsProp ?? columnsProp ?? [];
16710
17022
  const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
16711
17023
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -16742,7 +17054,7 @@ var DataList = ({
16742
17054
  const items2 = data.map((item) => item);
16743
17055
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
16744
17056
  const contentField = titleField?.name ?? fields[0]?.name ?? "";
16745
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
17057
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
16746
17058
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
16747
17059
  group.items.map((itemData, index) => {
16748
17060
  const id = itemData.id || `${gi}-${index}`;
@@ -16945,7 +17257,7 @@ var DataList = ({
16945
17257
  className
16946
17258
  ),
16947
17259
  children: [
16948
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
17260
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
16949
17261
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
16950
17262
  group.items.map(
16951
17263
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -17914,7 +18226,7 @@ var WizardProgress = ({
17914
18226
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: steps.map((step, index) => {
17915
18227
  const isActive = index === currentStep;
17916
18228
  const isCompleted = index < currentStep;
17917
- return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
18229
+ return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
17918
18230
  /* @__PURE__ */ jsx(
17919
18231
  "button",
17920
18232
  {
@@ -18606,7 +18918,7 @@ var stateColors = {
18606
18918
  var ProgressDots = ({
18607
18919
  count,
18608
18920
  currentIndex,
18609
- getState,
18921
+ getState: getState2,
18610
18922
  onDotClick,
18611
18923
  className,
18612
18924
  size = "md"
@@ -18618,7 +18930,7 @@ var ProgressDots = ({
18618
18930
  },
18619
18931
  [currentIndex]
18620
18932
  );
18621
- const resolveState = getState ?? defaultGetState;
18933
+ const resolveState = getState2 ?? defaultGetState;
18622
18934
  const dims = sizeMap16[size];
18623
18935
  return /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", className: cn(className), children: Array.from({ length: count }, (_, index) => {
18624
18936
  const state = resolveState(index);
@@ -18739,7 +19051,7 @@ function InventoryGrid({
18739
19051
  const eventBus = useEventBus();
18740
19052
  const slotCount = totalSlots ?? items.length;
18741
19053
  const emptySlotCount = Math.max(0, slotCount - items.length);
18742
- const handleSelect = React114.useCallback(
19054
+ const handleSelect = React116.useCallback(
18743
19055
  (id) => {
18744
19056
  onSelect?.(id);
18745
19057
  if (selectEvent) {
@@ -18912,15 +19224,15 @@ function GameCanvas2D({
18912
19224
  fps = 60,
18913
19225
  className
18914
19226
  }) {
18915
- const canvasRef = React114.useRef(null);
18916
- const rafRef = React114.useRef(0);
18917
- const frameRef = React114.useRef(0);
18918
- const lastTimeRef = React114.useRef(0);
18919
- const onDrawRef = React114.useRef(onDraw);
19227
+ const canvasRef = React116.useRef(null);
19228
+ const rafRef = React116.useRef(0);
19229
+ const frameRef = React116.useRef(0);
19230
+ const lastTimeRef = React116.useRef(0);
19231
+ const onDrawRef = React116.useRef(onDraw);
18920
19232
  onDrawRef.current = onDraw;
18921
- const onTickRef = React114.useRef(onTick);
19233
+ const onTickRef = React116.useRef(onTick);
18922
19234
  onTickRef.current = onTick;
18923
- React114.useEffect(() => {
19235
+ React116.useEffect(() => {
18924
19236
  const canvas = canvasRef.current;
18925
19237
  if (!canvas) return;
18926
19238
  const ctx = canvas.getContext("2d");
@@ -19173,7 +19485,7 @@ function TurnPanel({
19173
19485
  className
19174
19486
  }) {
19175
19487
  const eventBus = useEventBus();
19176
- const handleAction = React114.useCallback(
19488
+ const handleAction = React116.useCallback(
19177
19489
  (event) => {
19178
19490
  if (event) {
19179
19491
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -19298,7 +19610,7 @@ function UnitCommandBar({
19298
19610
  className
19299
19611
  }) {
19300
19612
  const eventBus = useEventBus();
19301
- const handleCommand = React114.useCallback(
19613
+ const handleCommand = React116.useCallback(
19302
19614
  (event) => {
19303
19615
  if (event) {
19304
19616
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -19757,7 +20069,7 @@ function GameMenu({
19757
20069
  } catch {
19758
20070
  }
19759
20071
  const eventBus = eventBusProp || eventBusFromHook;
19760
- const handleOptionClick = React114.useCallback(
20072
+ const handleOptionClick = React116.useCallback(
19761
20073
  (option) => {
19762
20074
  if (option.event && eventBus) {
19763
20075
  eventBus.emit(`UI:${option.event}`, { option });
@@ -19880,7 +20192,7 @@ function GameOverScreen({
19880
20192
  } catch {
19881
20193
  }
19882
20194
  const eventBus = eventBusProp || eventBusFromHook;
19883
- const handleActionClick = React114.useCallback(
20195
+ const handleActionClick = React116.useCallback(
19884
20196
  (action) => {
19885
20197
  if (action.event && eventBus) {
19886
20198
  eventBus.emit(`UI:${action.event}`, { action });
@@ -22980,7 +23292,7 @@ var DocumentViewer = ({
22980
23292
  };
22981
23293
  DocumentViewer.displayName = "DocumentViewer";
22982
23294
  function extractTitle(children) {
22983
- if (!React114__default.isValidElement(children)) return void 0;
23295
+ if (!React116__default.isValidElement(children)) return void 0;
22984
23296
  const props = children.props;
22985
23297
  if (typeof props.title === "string") {
22986
23298
  return props.title;
@@ -23032,7 +23344,7 @@ function LinearView({
23032
23344
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
23033
23345
  const isDone = i < currentIdx;
23034
23346
  const isCurrent = i === currentIdx;
23035
- return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
23347
+ return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
23036
23348
  i > 0 && /* @__PURE__ */ jsx(
23037
23349
  Typography,
23038
23350
  {
@@ -23698,7 +24010,7 @@ var Form = ({
23698
24010
  const normalizedInitialData = initialData ?? {};
23699
24011
  const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
23700
24012
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
23701
- const entityDerivedFields = React114__default.useMemo(() => {
24013
+ const entityDerivedFields = React116__default.useMemo(() => {
23702
24014
  if (fields && fields.length > 0) return void 0;
23703
24015
  if (!resolvedEntity) return void 0;
23704
24016
  return resolvedEntity.fields.map(
@@ -23717,14 +24029,14 @@ var Form = ({
23717
24029
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
23718
24030
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
23719
24031
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
23720
- const [formData, setFormData] = React114__default.useState(
24032
+ const [formData, setFormData] = React116__default.useState(
23721
24033
  normalizedInitialData
23722
24034
  );
23723
- const [collapsedSections, setCollapsedSections] = React114__default.useState(
24035
+ const [collapsedSections, setCollapsedSections] = React116__default.useState(
23724
24036
  /* @__PURE__ */ new Set()
23725
24037
  );
23726
24038
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
23727
- const evalContext = React114__default.useMemo(
24039
+ const evalContext = React116__default.useMemo(
23728
24040
  () => ({
23729
24041
  formValues: formData,
23730
24042
  globalVariables: externalContext?.globalVariables ?? {},
@@ -23733,13 +24045,13 @@ var Form = ({
23733
24045
  }),
23734
24046
  [formData, externalContext]
23735
24047
  );
23736
- React114__default.useEffect(() => {
24048
+ React116__default.useEffect(() => {
23737
24049
  const data = initialData;
23738
24050
  if (data && Object.keys(data).length > 0) {
23739
24051
  setFormData(data);
23740
24052
  }
23741
24053
  }, [initialData]);
23742
- const processCalculations = React114__default.useCallback(
24054
+ const processCalculations = React116__default.useCallback(
23743
24055
  (changedFieldId, newFormData) => {
23744
24056
  if (!hiddenCalculations.length) return;
23745
24057
  const context = {
@@ -23764,7 +24076,7 @@ var Form = ({
23764
24076
  },
23765
24077
  [hiddenCalculations, externalContext, eventBus]
23766
24078
  );
23767
- const checkViolations = React114__default.useCallback(
24079
+ const checkViolations = React116__default.useCallback(
23768
24080
  (changedFieldId, newFormData) => {
23769
24081
  if (!violationTriggers.length) return;
23770
24082
  const context = {
@@ -23801,7 +24113,7 @@ var Form = ({
23801
24113
  processCalculations(name, newFormData);
23802
24114
  checkViolations(name, newFormData);
23803
24115
  };
23804
- const isFieldVisible = React114__default.useCallback(
24116
+ const isFieldVisible = React116__default.useCallback(
23805
24117
  (fieldName) => {
23806
24118
  const condition = conditionalFields[fieldName];
23807
24119
  if (!condition) return true;
@@ -23809,7 +24121,7 @@ var Form = ({
23809
24121
  },
23810
24122
  [conditionalFields, evalContext]
23811
24123
  );
23812
- const isSectionVisible = React114__default.useCallback(
24124
+ const isSectionVisible = React116__default.useCallback(
23813
24125
  (section) => {
23814
24126
  if (!section.condition) return true;
23815
24127
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -23841,7 +24153,7 @@ var Form = ({
23841
24153
  eventBus.emit(`UI:${onCancel}`);
23842
24154
  }
23843
24155
  };
23844
- const renderField = React114__default.useCallback(
24156
+ const renderField = React116__default.useCallback(
23845
24157
  (field) => {
23846
24158
  const fieldName = field.name || field.field;
23847
24159
  if (!fieldName) return null;
@@ -23862,7 +24174,7 @@ var Form = ({
23862
24174
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
23863
24175
  );
23864
24176
  const effectiveFields = entityDerivedFields ?? fields;
23865
- const normalizedFields = React114__default.useMemo(() => {
24177
+ const normalizedFields = React116__default.useMemo(() => {
23866
24178
  if (!effectiveFields || effectiveFields.length === 0) return [];
23867
24179
  return effectiveFields.map((field) => {
23868
24180
  if (typeof field === "string") {
@@ -23884,7 +24196,7 @@ var Form = ({
23884
24196
  return field;
23885
24197
  });
23886
24198
  }, [effectiveFields, resolvedEntity]);
23887
- const schemaFields = React114__default.useMemo(() => {
24199
+ const schemaFields = React116__default.useMemo(() => {
23888
24200
  if (normalizedFields.length === 0) return null;
23889
24201
  if (isDebugEnabled()) {
23890
24202
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -23894,7 +24206,7 @@ var Form = ({
23894
24206
  }
23895
24207
  return normalizedFields.map(renderField).filter(Boolean);
23896
24208
  }, [normalizedFields, renderField, entityName, conditionalFields]);
23897
- const sectionElements = React114__default.useMemo(() => {
24209
+ const sectionElements = React116__default.useMemo(() => {
23898
24210
  if (!sections || sections.length === 0) return null;
23899
24211
  return sections.map((section) => {
23900
24212
  if (!isSectionVisible(section)) {
@@ -25298,7 +25610,7 @@ var List2 = ({
25298
25610
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
25299
25611
  return [];
25300
25612
  }, [entity]);
25301
- const getItemActions = React114__default.useCallback(
25613
+ const getItemActions = React116__default.useCallback(
25302
25614
  (item) => {
25303
25615
  if (!itemActions) return [];
25304
25616
  if (typeof itemActions === "function") {
@@ -25724,7 +26036,7 @@ var MediaGallery = ({
25724
26036
  [selectable, selectedItems, selectionEvent, eventBus]
25725
26037
  );
25726
26038
  const entityData = Array.isArray(entity) ? entity : [];
25727
- const items = React114__default.useMemo(() => {
26039
+ const items = React116__default.useMemo(() => {
25728
26040
  if (propItems) return propItems;
25729
26041
  if (entityData.length === 0) return [];
25730
26042
  return entityData.map((record, idx) => ({
@@ -25886,7 +26198,7 @@ var MediaGallery = ({
25886
26198
  };
25887
26199
  MediaGallery.displayName = "MediaGallery";
25888
26200
  function extractTitle2(children) {
25889
- if (!React114__default.isValidElement(children)) return void 0;
26201
+ if (!React116__default.isValidElement(children)) return void 0;
25890
26202
  const props = children.props;
25891
26203
  if (typeof props.title === "string") {
25892
26204
  return props.title;
@@ -26556,7 +26868,7 @@ var PageHeader = ({
26556
26868
  info: "bg-info/10 text-info"
26557
26869
  };
26558
26870
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
26559
- 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(React114__default.Fragment, { children: [
26871
+ 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(React116__default.Fragment, { children: [
26560
26872
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
26561
26873
  crumb.href ? /* @__PURE__ */ jsx(
26562
26874
  "a",
@@ -26644,24 +26956,24 @@ PageHeader.displayName = "PageHeader";
26644
26956
 
26645
26957
  // lib/tickRegistry.ts
26646
26958
  var ticks = /* @__PURE__ */ new Map();
26647
- var listeners3 = /* @__PURE__ */ new Set();
26959
+ var listeners2 = /* @__PURE__ */ new Set();
26648
26960
  function getAllTicks() {
26649
26961
  return Array.from(ticks.values());
26650
26962
  }
26651
26963
  function subscribeToTickChanges(listener) {
26652
- listeners3.add(listener);
26653
- return () => listeners3.delete(listener);
26964
+ listeners2.add(listener);
26965
+ return () => listeners2.delete(listener);
26654
26966
  }
26655
26967
 
26656
26968
  // lib/guardRegistry.ts
26657
26969
  var guardHistory = [];
26658
- var listeners4 = /* @__PURE__ */ new Set();
26970
+ var listeners3 = /* @__PURE__ */ new Set();
26659
26971
  function getGuardHistory() {
26660
26972
  return [...guardHistory];
26661
26973
  }
26662
26974
  function subscribeToGuardChanges(listener) {
26663
- listeners4.add(listener);
26664
- return () => listeners4.delete(listener);
26975
+ listeners3.add(listener);
26976
+ return () => listeners3.delete(listener);
26665
26977
  }
26666
26978
  function getEntitySnapshot() {
26667
26979
  {
@@ -26671,18 +26983,18 @@ function getEntitySnapshot() {
26671
26983
 
26672
26984
  // lib/debugRegistry.ts
26673
26985
  var events = [];
26674
- var listeners5 = /* @__PURE__ */ new Set();
26986
+ var listeners4 = /* @__PURE__ */ new Set();
26675
26987
  function getDebugEvents() {
26676
26988
  return [...events];
26677
26989
  }
26678
26990
  function subscribeToDebugEvents(listener) {
26679
- listeners5.add(listener);
26680
- return () => listeners5.delete(listener);
26991
+ listeners4.add(listener);
26992
+ return () => listeners4.delete(listener);
26681
26993
  }
26682
26994
 
26683
26995
  // components/organisms/debug/hooks/useDebugData.ts
26684
26996
  function useDebugData() {
26685
- const [data, setData] = React114.useState(() => ({
26997
+ const [data, setData] = React116.useState(() => ({
26686
26998
  traits: [],
26687
26999
  ticks: [],
26688
27000
  guards: [],
@@ -26696,7 +27008,7 @@ function useDebugData() {
26696
27008
  },
26697
27009
  lastUpdate: Date.now()
26698
27010
  }));
26699
- React114.useEffect(() => {
27011
+ React116.useEffect(() => {
26700
27012
  const updateData = () => {
26701
27013
  setData({
26702
27014
  traits: getAllTraits(),
@@ -26740,14 +27052,14 @@ function useDebugData() {
26740
27052
 
26741
27053
  // lib/debugUtils.ts
26742
27054
  var DEBUG_STORAGE_KEY = "orbital-debug";
26743
- var listeners6 = /* @__PURE__ */ new Set();
27055
+ var listeners5 = /* @__PURE__ */ new Set();
26744
27056
  function isDebugEnabled2() {
26745
27057
  if (typeof window === "undefined") return false;
26746
27058
  return localStorage.getItem(DEBUG_STORAGE_KEY) === "true";
26747
27059
  }
26748
27060
  function onDebugToggle(listener) {
26749
- listeners6.add(listener);
26750
- return () => listeners6.delete(listener);
27061
+ listeners5.add(listener);
27062
+ return () => listeners5.delete(listener);
26751
27063
  }
26752
27064
  function TraitsTab({ traits: traits2 }) {
26753
27065
  if (traits2.length === 0) {
@@ -26965,15 +27277,15 @@ var TYPE_BADGES = {
26965
27277
  state: { variant: "danger", icon: "\u{1F4CA}" }
26966
27278
  };
26967
27279
  function EventFlowTab({ events: events2 }) {
26968
- const [filter, setFilter] = React114.useState("all");
26969
- const containerRef = React114.useRef(null);
26970
- const [autoScroll, setAutoScroll] = React114.useState(true);
26971
- React114.useEffect(() => {
27280
+ const [filter, setFilter] = React116.useState("all");
27281
+ const containerRef = React116.useRef(null);
27282
+ const [autoScroll, setAutoScroll] = React116.useState(true);
27283
+ React116.useEffect(() => {
26972
27284
  if (autoScroll && containerRef.current) {
26973
27285
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
26974
27286
  }
26975
27287
  }, [events2.length, autoScroll]);
26976
- const filteredEvents = React114.useMemo(() => {
27288
+ const filteredEvents = React116.useMemo(() => {
26977
27289
  if (filter === "all") return events2;
26978
27290
  return events2.filter((e) => e.type === filter);
26979
27291
  }, [events2, filter]);
@@ -27072,7 +27384,7 @@ function EventFlowTab({ events: events2 }) {
27072
27384
  }
27073
27385
  EventFlowTab.displayName = "EventFlowTab";
27074
27386
  function GuardsPanel({ guards }) {
27075
- const [filter, setFilter] = React114.useState("all");
27387
+ const [filter, setFilter] = React116.useState("all");
27076
27388
  if (guards.length === 0) {
27077
27389
  return /* @__PURE__ */ jsx(
27078
27390
  EmptyState,
@@ -27085,7 +27397,7 @@ function GuardsPanel({ guards }) {
27085
27397
  }
27086
27398
  const passedCount = guards.filter((g) => g.result).length;
27087
27399
  const failedCount = guards.length - passedCount;
27088
- const filteredGuards = React114.useMemo(() => {
27400
+ const filteredGuards = React116.useMemo(() => {
27089
27401
  if (filter === "all") return guards;
27090
27402
  if (filter === "passed") return guards.filter((g) => g.result);
27091
27403
  return guards.filter((g) => !g.result);
@@ -27150,8 +27462,8 @@ var STATUS_CONFIG = {
27150
27462
  warn: { variant: "warning", icon: "!", label: "WARN" },
27151
27463
  pending: { variant: "default", icon: "?", label: "PENDING" }
27152
27464
  };
27153
- function VerificationTab({ checks: checks2, summary }) {
27154
- if (checks2.length === 0) {
27465
+ function VerificationTab({ checks, summary }) {
27466
+ if (checks.length === 0) {
27155
27467
  return /* @__PURE__ */ jsx(
27156
27468
  EmptyState,
27157
27469
  {
@@ -27162,7 +27474,7 @@ function VerificationTab({ checks: checks2, summary }) {
27162
27474
  );
27163
27475
  }
27164
27476
  const sortOrder = { fail: 0, warn: 1, pending: 2, pass: 3 };
27165
- const sorted = [...checks2].sort(
27477
+ const sorted = [...checks].sort(
27166
27478
  (a, b) => (sortOrder[a.status] ?? 4) - (sortOrder[b.status] ?? 4)
27167
27479
  );
27168
27480
  return /* @__PURE__ */ jsxs("div", { className: "debug-tab debug-tab--verification", children: [
@@ -27228,16 +27540,16 @@ function EffectBadge({ effect }) {
27228
27540
  effect.error && /* @__PURE__ */ jsx("span", { className: "text-red-500 truncate max-w-[120px]", title: effect.error, children: effect.error })
27229
27541
  ] });
27230
27542
  }
27231
- function TransitionTimeline({ transitions: transitions2 }) {
27232
- const containerRef = React114.useRef(null);
27233
- const [autoScroll, setAutoScroll] = React114.useState(true);
27234
- const [expandedId, setExpandedId] = React114.useState(null);
27235
- React114.useEffect(() => {
27543
+ function TransitionTimeline({ transitions }) {
27544
+ const containerRef = React116.useRef(null);
27545
+ const [autoScroll, setAutoScroll] = React116.useState(true);
27546
+ const [expandedId, setExpandedId] = React116.useState(null);
27547
+ React116.useEffect(() => {
27236
27548
  if (autoScroll && containerRef.current) {
27237
27549
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
27238
27550
  }
27239
- }, [transitions2.length, autoScroll]);
27240
- if (transitions2.length === 0) {
27551
+ }, [transitions.length, autoScroll]);
27552
+ if (transitions.length === 0) {
27241
27553
  return /* @__PURE__ */ jsx(
27242
27554
  EmptyState,
27243
27555
  {
@@ -27256,11 +27568,11 @@ function TransitionTimeline({ transitions: transitions2 }) {
27256
27568
  second: "2-digit"
27257
27569
  }) + "." + String(d.getMilliseconds()).padStart(3, "0");
27258
27570
  };
27259
- const sorted = [...transitions2].reverse();
27571
+ const sorted = [...transitions].reverse();
27260
27572
  return /* @__PURE__ */ jsxs("div", { className: "debug-tab debug-tab--timeline", children: [
27261
27573
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
27262
27574
  /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-gray-500", children: [
27263
- transitions2.length,
27575
+ transitions.length,
27264
27576
  " transitions recorded"
27265
27577
  ] }),
27266
27578
  /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1 text-xs text-gray-500 cursor-pointer", children: [
@@ -27493,9 +27805,9 @@ function getAllEvents(traits2) {
27493
27805
  }
27494
27806
  function EventDispatcherTab({ traits: traits2, schema }) {
27495
27807
  const eventBus = useEventBus();
27496
- const [log, setLog] = React114.useState([]);
27497
- const prevStatesRef = React114.useRef(/* @__PURE__ */ new Map());
27498
- React114.useEffect(() => {
27808
+ const [log, setLog] = React116.useState([]);
27809
+ const prevStatesRef = React116.useRef(/* @__PURE__ */ new Map());
27810
+ React116.useEffect(() => {
27499
27811
  for (const trait of traits2) {
27500
27812
  const prev = prevStatesRef.current.get(trait.id);
27501
27813
  if (prev && prev !== trait.currentState) {
@@ -27538,7 +27850,7 @@ function EventDispatcherTab({ traits: traits2, schema }) {
27538
27850
  ] }),
27539
27851
  /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
27540
27852
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Available Events" }),
27541
- availableEvents.length === 0 ? /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-gray-400 italic", children: "No transitions from current state" }) : /* @__PURE__ */ jsx(Stack, { gap: "xs", children: availableEvents.map(({ event, transitions: transitions2 }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
27853
+ availableEvents.length === 0 ? /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-gray-400 italic", children: "No transitions from current state" }) : /* @__PURE__ */ jsx(Stack, { gap: "xs", children: availableEvents.map(({ event, transitions }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
27542
27854
  /* @__PURE__ */ jsx(
27543
27855
  Button,
27544
27856
  {
@@ -27549,8 +27861,8 @@ function EventDispatcherTab({ traits: traits2, schema }) {
27549
27861
  children: event
27550
27862
  }
27551
27863
  ),
27552
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-gray-500", children: transitions2.map((t) => `${t.from} -> ${t.to}`).join(", ") }),
27553
- transitions2.some((t) => t.guard) && /* @__PURE__ */ jsx(Badge, { variant: "warning", size: "sm", children: "guarded" })
27864
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-gray-500", children: transitions.map((t) => `${t.from} -> ${t.to}`).join(", ") }),
27865
+ transitions.some((t) => t.guard) && /* @__PURE__ */ jsx(Badge, { variant: "warning", size: "sm", children: "guarded" })
27554
27866
  ] }, event)) })
27555
27867
  ] }),
27556
27868
  unavailableEvents.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
@@ -27578,10 +27890,10 @@ function RuntimeDebugger({
27578
27890
  defaultTab,
27579
27891
  schema
27580
27892
  }) {
27581
- const [isCollapsed, setIsCollapsed] = React114.useState(defaultCollapsed);
27582
- const [isVisible, setIsVisible] = React114.useState(mode === "inline" || isDebugEnabled2());
27893
+ const [isCollapsed, setIsCollapsed] = React116.useState(mode === "verify" ? true : defaultCollapsed);
27894
+ const [isVisible, setIsVisible] = React116.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
27583
27895
  const debugData = useDebugData();
27584
- React114.useEffect(() => {
27896
+ React116.useEffect(() => {
27585
27897
  if (mode === "inline") return;
27586
27898
  return onDebugToggle((enabled) => {
27587
27899
  setIsVisible(enabled);
@@ -27590,7 +27902,7 @@ function RuntimeDebugger({
27590
27902
  }
27591
27903
  });
27592
27904
  }, [mode]);
27593
- React114.useEffect(() => {
27905
+ React116.useEffect(() => {
27594
27906
  if (mode === "inline") return;
27595
27907
  const handleKeyDown = (e) => {
27596
27908
  if (e.key === "`" && isVisible) {
@@ -27717,6 +28029,56 @@ function RuntimeDebugger({
27717
28029
  }
27718
28030
  );
27719
28031
  }
28032
+ if (mode === "verify") {
28033
+ const traitStates = debugData.traits.map((t) => `${t.name}:${t.currentState}`).join(" | ");
28034
+ return /* @__PURE__ */ jsxs(
28035
+ "div",
28036
+ {
28037
+ className: cn(
28038
+ "runtime-debugger runtime-debugger--verify",
28039
+ "h-[35vh] flex flex-col bg-gray-900 text-white border-t-2 border-cyan-500",
28040
+ className
28041
+ ),
28042
+ "data-testid": "debugger-verify",
28043
+ children: [
28044
+ /* @__PURE__ */ jsxs("div", { className: "px-3 py-1.5 flex items-center gap-3 text-xs font-mono border-b border-gray-700 flex-shrink-0", children: [
28045
+ /* @__PURE__ */ jsx(Badge, { variant: failedChecks > 0 ? "danger" : "success", size: "sm", children: failedChecks > 0 ? `${failedChecks} fail` : "OK" }),
28046
+ /* @__PURE__ */ jsxs("span", { className: "text-gray-400", children: [
28047
+ verification.transitions.length,
28048
+ " transitions"
28049
+ ] }),
28050
+ traitStates && /* @__PURE__ */ jsx("span", { className: "text-cyan-400 truncate max-w-[400px]", children: traitStates })
28051
+ ] }),
28052
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "px-2 py-1", children: verification.transitions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-gray-500 text-xs font-mono py-2 text-center", children: "Waiting for transitions..." }) : /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: verification.transitions.map((trace) => {
28053
+ const hasFailedEffects = trace.effects.some((e) => e.status === "failed");
28054
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 text-xs font-mono py-0.5 border-b border-gray-800 last:border-0", children: [
28055
+ /* @__PURE__ */ jsx("span", { className: cn(
28056
+ "mt-1.5 w-1.5 h-1.5 rounded-full flex-shrink-0",
28057
+ hasFailedEffects ? "bg-red-500" : "bg-green-500"
28058
+ ) }),
28059
+ /* @__PURE__ */ jsx(Badge, { variant: "info", size: "sm", className: "flex-shrink-0", children: trace.event }),
28060
+ /* @__PURE__ */ jsxs("span", { className: "text-gray-400 flex-shrink-0", children: [
28061
+ trace.from,
28062
+ " ",
28063
+ "\u2192",
28064
+ " ",
28065
+ trace.to
28066
+ ] }),
28067
+ /* @__PURE__ */ jsx("span", { className: "flex flex-wrap gap-1 ml-1", children: trace.effects.map((eff, i) => /* @__PURE__ */ jsxs("span", { className: cn(
28068
+ "px-1 rounded text-[10px]",
28069
+ eff.status === "executed" ? "bg-green-900/50 text-green-400" : eff.status === "failed" ? "bg-red-900/50 text-red-400" : "bg-yellow-900/50 text-yellow-400"
28070
+ ), children: [
28071
+ eff.status === "executed" ? "\u2713" : eff.status === "failed" ? "\u2717" : "-",
28072
+ " ",
28073
+ eff.type,
28074
+ eff.args.length > 0 && /* @__PURE__ */ jsx("span", { className: "text-gray-500 ml-0.5", children: JSON.stringify(eff.args).slice(0, 30) })
28075
+ ] }, i)) })
28076
+ ] }, trace.id);
28077
+ }) }) }) })
28078
+ ]
28079
+ }
28080
+ );
28081
+ }
27720
28082
  return /* @__PURE__ */ jsx(
27721
28083
  "div",
27722
28084
  {
@@ -28079,7 +28441,7 @@ function SequenceBar({
28079
28441
  onSlotRemove(index);
28080
28442
  }, [onSlotRemove, playing]);
28081
28443
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
28082
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
28444
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
28083
28445
  i > 0 && /* @__PURE__ */ jsx(
28084
28446
  Typography,
28085
28447
  {
@@ -29317,7 +29679,7 @@ var StatCard = ({
29317
29679
  const labelToUse = propLabel ?? propTitle;
29318
29680
  const eventBus = useEventBus();
29319
29681
  const { t } = useTranslate();
29320
- const handleActionClick = React114__default.useCallback(() => {
29682
+ const handleActionClick = React116__default.useCallback(() => {
29321
29683
  if (action?.event) {
29322
29684
  eventBus.emit(`UI:${action.event}`, {});
29323
29685
  }
@@ -29328,7 +29690,7 @@ var StatCard = ({
29328
29690
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
29329
29691
  const isLoading = externalLoading ?? false;
29330
29692
  const error = externalError;
29331
- const computeMetricValue = React114__default.useCallback(
29693
+ const computeMetricValue = React116__default.useCallback(
29332
29694
  (metric, items) => {
29333
29695
  if (metric.value !== void 0) {
29334
29696
  return metric.value;
@@ -29367,7 +29729,7 @@ var StatCard = ({
29367
29729
  },
29368
29730
  []
29369
29731
  );
29370
- const schemaStats = React114__default.useMemo(() => {
29732
+ const schemaStats = React116__default.useMemo(() => {
29371
29733
  if (!metrics || metrics.length === 0) return null;
29372
29734
  return metrics.map((metric) => ({
29373
29735
  label: metric.label,
@@ -29375,7 +29737,7 @@ var StatCard = ({
29375
29737
  format: metric.format
29376
29738
  }));
29377
29739
  }, [metrics, data, computeMetricValue]);
29378
- const calculatedTrend = React114__default.useMemo(() => {
29740
+ const calculatedTrend = React116__default.useMemo(() => {
29379
29741
  if (manualTrend !== void 0) return manualTrend;
29380
29742
  if (previousValue === void 0 || currentValue === void 0)
29381
29743
  return void 0;
@@ -29682,7 +30044,7 @@ function StateArchitectBoard({
29682
30044
  }) {
29683
30045
  const { emit } = useEventBus();
29684
30046
  const { t } = useTranslate();
29685
- const [transitions2, setTransitions] = useState(entity.transitions);
30047
+ const [transitions, setTransitions] = useState(entity.transitions);
29686
30048
  const [headerError, setHeaderError] = useState(false);
29687
30049
  const [playState, setPlayState] = useState("editing");
29688
30050
  const [currentState, setCurrentState] = useState(entity.initialState);
@@ -29728,13 +30090,13 @@ function StateArchitectBoard({
29728
30090
  description: entity.description,
29729
30091
  states: entity.states,
29730
30092
  currentState,
29731
- transitions: transitions2.map((t2) => ({
30093
+ transitions: transitions.map((t2) => ({
29732
30094
  from: t2.from,
29733
30095
  to: t2.to,
29734
30096
  event: t2.event,
29735
30097
  guardHint: t2.guardHint
29736
30098
  }))
29737
- }), [entity, currentState, transitions2]);
30099
+ }), [entity, currentState, transitions]);
29738
30100
  const handleTest = useCallback(() => {
29739
30101
  if (playState !== "editing") return;
29740
30102
  if (testEvent) emit(`UI:${testEvent}`, {});
@@ -29761,7 +30123,7 @@ function StateArchitectBoard({
29761
30123
  const testCase = entity.testCases[testIdx];
29762
30124
  let state = entity.initialState;
29763
30125
  for (const event of testCase.events) {
29764
- const trans = transitions2.find((t2) => t2.from === state && t2.event === event);
30126
+ const trans = transitions.find((t2) => t2.from === state && t2.event === event);
29765
30127
  if (trans) {
29766
30128
  state = trans.to;
29767
30129
  }
@@ -29777,7 +30139,7 @@ function StateArchitectBoard({
29777
30139
  timerRef.current = setTimeout(runNextTest, stepDurationMs);
29778
30140
  };
29779
30141
  timerRef.current = setTimeout(runNextTest, stepDurationMs);
29780
- }, [playState, transitions2, entity, stepDurationMs, testEvent, completeEvent, emit]);
30142
+ }, [playState, transitions, entity, stepDurationMs, testEvent, completeEvent, emit]);
29781
30143
  const handleTryAgain = useCallback(() => {
29782
30144
  if (timerRef.current) clearTimeout(timerRef.current);
29783
30145
  setPlayState("editing");
@@ -29799,13 +30161,13 @@ function StateArchitectBoard({
29799
30161
  name: entity.entityName,
29800
30162
  states: entity.states,
29801
30163
  initialState: entity.initialState,
29802
- transitions: transitions2.map((t2) => ({
30164
+ transitions: transitions.map((t2) => ({
29803
30165
  from: t2.from,
29804
30166
  to: t2.to,
29805
30167
  event: t2.event,
29806
30168
  ...t2.guardHint ? { guard: t2.guardHint } : {}
29807
30169
  }))
29808
- }), [entity, transitions2]);
30170
+ }), [entity, transitions]);
29809
30171
  return /* @__PURE__ */ jsxs(
29810
30172
  VStack,
29811
30173
  {
@@ -29850,7 +30212,7 @@ function StateArchitectBoard({
29850
30212
  /* @__PURE__ */ jsx("marker", { id: "arrowhead", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-border)" }) }),
29851
30213
  /* @__PURE__ */ jsx("marker", { id: "arrowhead-active", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-primary)" }) })
29852
30214
  ] }),
29853
- transitions2.map((t2) => {
30215
+ transitions.map((t2) => {
29854
30216
  const fromPos = positions[t2.from];
29855
30217
  const toPos = positions[t2.to];
29856
30218
  if (!fromPos || !toPos) return null;
@@ -29894,9 +30256,9 @@ function StateArchitectBoard({
29894
30256
  children: selectedState ? t("stateArchitect.addTransition", { state: selectedState }) : t("stateArchitect.addTransitionPrompt")
29895
30257
  }
29896
30258
  ) }),
29897
- transitions2.length > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "p-3 rounded-lg bg-muted/50 border border-border", children: [
29898
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: t("stateArchitect.transitions", { count: transitions2.length }) + ":" }),
29899
- transitions2.map((t2) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
30259
+ transitions.length > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "p-3 rounded-lg bg-muted/50 border border-border", children: [
30260
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: t("stateArchitect.transitions", { count: transitions.length }) + ":" }),
30261
+ transitions.map((t2) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
29900
30262
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: t2.from }),
29901
30263
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "\u2014[" }),
29902
30264
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent font-medium", children: t2.event }),
@@ -30286,7 +30648,7 @@ var Timeline = ({
30286
30648
  }) => {
30287
30649
  const { t } = useTranslate();
30288
30650
  const entityData = Array.isArray(entity) ? entity : [];
30289
- const items = React114__default.useMemo(() => {
30651
+ const items = React116__default.useMemo(() => {
30290
30652
  if (propItems) return propItems;
30291
30653
  if (entityData.length === 0) return [];
30292
30654
  return entityData.map((record, idx) => {
@@ -30388,7 +30750,7 @@ var Timeline = ({
30388
30750
  };
30389
30751
  Timeline.displayName = "Timeline";
30390
30752
  function extractToastProps(children) {
30391
- if (!React114__default.isValidElement(children)) {
30753
+ if (!React116__default.isValidElement(children)) {
30392
30754
  if (typeof children === "string") {
30393
30755
  return { message: children };
30394
30756
  }
@@ -30419,7 +30781,7 @@ var ToastSlot = ({
30419
30781
  eventBus.emit("UI:CLOSE");
30420
30782
  };
30421
30783
  if (!isVisible) return null;
30422
- const isCustomContent = React114__default.isValidElement(children) && !message;
30784
+ const isCustomContent = React116__default.isValidElement(children) && !message;
30423
30785
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
30424
30786
  Toast,
30425
30787
  {
@@ -30663,7 +31025,7 @@ var WizardContainer = ({
30663
31025
  const isCompleted = index < currentStep;
30664
31026
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
30665
31027
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
30666
- return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
31028
+ return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
30667
31029
  /* @__PURE__ */ jsx(
30668
31030
  Button,
30669
31031
  {
@@ -31029,12 +31391,12 @@ WorldMapTemplate.displayName = "WorldMapTemplate";
31029
31391
 
31030
31392
  // components/organisms/component-registry.generated.ts
31031
31393
  function lazyThree(name, loader) {
31032
- const Lazy = React114__default.lazy(() => loader().then((m) => ({ default: m[name] })));
31394
+ const Lazy = React116__default.lazy(() => loader().then((m) => ({ default: m[name] })));
31033
31395
  function ThreeWrapper(props) {
31034
- return React114__default.createElement(
31035
- React114__default.Suspense,
31396
+ return React116__default.createElement(
31397
+ React116__default.Suspense,
31036
31398
  { fallback: null },
31037
- React114__default.createElement(Lazy, props)
31399
+ React116__default.createElement(Lazy, props)
31038
31400
  );
31039
31401
  }
31040
31402
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -31322,7 +31684,7 @@ function SuspenseConfigProvider({
31322
31684
  config,
31323
31685
  children
31324
31686
  }) {
31325
- return React114__default.createElement(
31687
+ return React116__default.createElement(
31326
31688
  SuspenseConfigContext.Provider,
31327
31689
  { value: config },
31328
31690
  children
@@ -31928,7 +32290,7 @@ function VerificationProvider({
31928
32290
  })) : [];
31929
32291
  recordTransition({
31930
32292
  traitName: parsed.traitName,
31931
- from: pending?.from ?? "unknown",
32293
+ from: pending?.from ?? (parsed.event === "INIT" ? "init" : "unknown"),
31932
32294
  to: newState,
31933
32295
  event: parsed.event,
31934
32296
  effects,
@@ -32236,6 +32598,22 @@ function TraitInitializer({ traits: traits2, orbitalNames }) {
32236
32598
  (async () => {
32237
32599
  for (const name of orbitalNames) {
32238
32600
  const effects = await bridge.sendEvent(name, "INIT", {});
32601
+ const effectTraces = [
32602
+ { type: "fetch", args: [], status: "executed" },
32603
+ ...effects.map((eff) => ({
32604
+ type: eff.type,
32605
+ args: eff.type === "render-ui" ? [eff.slot] : [],
32606
+ status: "executed"
32607
+ }))
32608
+ ];
32609
+ recordTransition({
32610
+ traitName: name,
32611
+ from: "init",
32612
+ to: "init",
32613
+ event: "INIT",
32614
+ effects: effectTraces,
32615
+ timestamp: Date.now()
32616
+ });
32239
32617
  for (const eff of effects) {
32240
32618
  if (eff.type === "render-ui" && eff.slot && eff.pattern) {
32241
32619
  slotsActions.setSlotPatterns(