@almadar/ui 2.15.13 → 2.16.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.
Files changed (37) hide show
  1. package/dist/avl/index.cjs +1837 -0
  2. package/dist/avl/index.d.cts +312 -0
  3. package/dist/avl/index.d.ts +33 -0
  4. package/dist/avl/index.js +1801 -0
  5. package/dist/components/atoms/avl/AvlApplication.d.ts +8 -0
  6. package/dist/components/atoms/avl/AvlBinding.d.ts +12 -0
  7. package/dist/components/atoms/avl/AvlBindingRef.d.ts +7 -0
  8. package/dist/components/atoms/avl/AvlEffect.d.ts +8 -0
  9. package/dist/components/atoms/avl/AvlEntity.d.ts +9 -0
  10. package/dist/components/atoms/avl/AvlEvent.d.ts +7 -0
  11. package/dist/components/atoms/avl/AvlField.d.ts +10 -0
  12. package/dist/components/atoms/avl/AvlFieldType.d.ts +8 -0
  13. package/dist/components/atoms/avl/AvlGuard.d.ts +7 -0
  14. package/dist/components/atoms/avl/AvlLiteral.d.ts +7 -0
  15. package/dist/components/atoms/avl/AvlOperator.d.ts +8 -0
  16. package/dist/components/atoms/avl/AvlOrbital.d.ts +11 -0
  17. package/dist/components/atoms/avl/AvlPage.d.ts +7 -0
  18. package/dist/components/atoms/avl/AvlPersistence.d.ts +8 -0
  19. package/dist/components/atoms/avl/AvlSExpr.d.ts +8 -0
  20. package/dist/components/atoms/avl/AvlState.d.ts +10 -0
  21. package/dist/components/atoms/avl/AvlTrait.d.ts +13 -0
  22. package/dist/components/atoms/avl/AvlTransition.d.ts +18 -0
  23. package/dist/components/atoms/avl/index.d.ts +20 -0
  24. package/dist/components/atoms/avl/types.d.ts +19 -0
  25. package/dist/components/molecules/avl/AvlClosedCircuit.d.ts +20 -0
  26. package/dist/components/molecules/avl/AvlEmitListen.d.ts +16 -0
  27. package/dist/components/molecules/avl/AvlExprTree.d.ts +13 -0
  28. package/dist/components/molecules/avl/AvlOrbitalUnit.d.ts +20 -0
  29. package/dist/components/molecules/avl/AvlSlotMap.d.ts +17 -0
  30. package/dist/components/molecules/avl/AvlStateMachine.d.ts +22 -0
  31. package/dist/components/molecules/avl/avl-layout.d.ts +31 -0
  32. package/dist/components/molecules/avl/index.d.ts +7 -0
  33. package/dist/illustrations/index.cjs +1789 -20
  34. package/dist/illustrations/index.d.cts +276 -1
  35. package/dist/illustrations/index.d.ts +24 -0
  36. package/dist/illustrations/index.js +1765 -20
  37. package/package.json +6 -1
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
4
+ var React24 = require('react');
5
5
 
6
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
- var React__default = /*#__PURE__*/_interopDefault(React);
8
+ var React24__default = /*#__PURE__*/_interopDefault(React24);
9
9
 
10
10
  function buildForkPaths(x, y, branches, scale) {
11
11
  const inLength = 30 * scale;
@@ -132,7 +132,7 @@ var SvgFlow = ({
132
132
  opacity = 1,
133
133
  className
134
134
  }) => {
135
- const markerId = React__default.default.useMemo(() => {
135
+ const markerId = React24__default.default.useMemo(() => {
136
136
  flowIdCounter += 1;
137
137
  return `almadar-flow-arrow-${flowIdCounter}`;
138
138
  }, []);
@@ -633,7 +633,7 @@ var SvgRing = ({
633
633
  className,
634
634
  label
635
635
  }) => {
636
- const gradientId = React__default.default.useMemo(() => {
636
+ const gradientId = React24__default.default.useMemo(() => {
637
637
  ringIdCounter += 1;
638
638
  return `almadar-ring-glow-${ringIdCounter}`;
639
639
  }, []);
@@ -793,7 +793,7 @@ var AIGenerates = ({
793
793
  color = "var(--color-primary)",
794
794
  animated = false
795
795
  }) => {
796
- const ids = React__default.default.useMemo(() => {
796
+ const ids = React24__default.default.useMemo(() => {
797
797
  aiGeneratesId += 1;
798
798
  const base = `ag-${aiGeneratesId}`;
799
799
  return {
@@ -923,7 +923,7 @@ var ClosedCircuit = ({
923
923
  color = "var(--color-primary)",
924
924
  animated = false
925
925
  }) => {
926
- const ids = React__default.default.useMemo(() => {
926
+ const ids = React24__default.default.useMemo(() => {
927
927
  closedCircuitId += 1;
928
928
  const base = `cc-${closedCircuitId}`;
929
929
  return {
@@ -1069,7 +1069,7 @@ var CommunityOwnership = ({
1069
1069
  color = "var(--color-primary)",
1070
1070
  animated = false
1071
1071
  }) => {
1072
- const ids = React__default.default.useMemo(() => {
1072
+ const ids = React24__default.default.useMemo(() => {
1073
1073
  communityOwnershipId += 1;
1074
1074
  const base = `co-${communityOwnershipId}`;
1075
1075
  return { unitGlow: `${base}-ug` };
@@ -1154,7 +1154,7 @@ var CompileAnywhere = ({
1154
1154
  color = "var(--color-primary)",
1155
1155
  animated = false
1156
1156
  }) => {
1157
- const ids = React__default.default.useMemo(() => {
1157
+ const ids = React24__default.default.useMemo(() => {
1158
1158
  compileAnywhereId += 1;
1159
1159
  const base = `ca-${compileAnywhereId}`;
1160
1160
  return {
@@ -1284,7 +1284,7 @@ var ComposableModels = ({
1284
1284
  color = "var(--color-primary)",
1285
1285
  animated = false
1286
1286
  }) => {
1287
- const ids = React__default.default.useMemo(() => {
1287
+ const ids = React24__default.default.useMemo(() => {
1288
1288
  composableModelsId += 1;
1289
1289
  const base = `cm-${composableModelsId}`;
1290
1290
  return {
@@ -1431,7 +1431,7 @@ var DescribeProveDeploy = ({
1431
1431
  color = "var(--color-primary)",
1432
1432
  animated = false
1433
1433
  }) => {
1434
- const ids = React__default.default.useMemo(() => {
1434
+ const ids = React24__default.default.useMemo(() => {
1435
1435
  describeProveDeployId += 1;
1436
1436
  const base = `dpd-${describeProveDeployId}`;
1437
1437
  return {
@@ -1599,7 +1599,7 @@ var DomainGrid = ({
1599
1599
  color = "var(--color-primary)",
1600
1600
  animated = false
1601
1601
  }) => {
1602
- const ids = React__default.default.useMemo(() => {
1602
+ const ids = React24__default.default.useMemo(() => {
1603
1603
  domainGridId += 1;
1604
1604
  const base = `dg-${domainGridId}`;
1605
1605
  return { clusterGlow: `${base}-cg` };
@@ -1702,7 +1702,7 @@ var EventBus = ({
1702
1702
  color = "var(--color-primary)",
1703
1703
  animated = false
1704
1704
  }) => {
1705
- const ids = React__default.default.useMemo(() => {
1705
+ const ids = React24__default.default.useMemo(() => {
1706
1706
  eventBusId += 1;
1707
1707
  const base = `eb-${eventBusId}`;
1708
1708
  return {
@@ -1814,7 +1814,7 @@ var OrbitalUnit = ({
1814
1814
  color = "var(--color-primary)",
1815
1815
  animated = false
1816
1816
  }) => {
1817
- const ids = React__default.default.useMemo(() => {
1817
+ const ids = React24__default.default.useMemo(() => {
1818
1818
  orbitalUnitId += 1;
1819
1819
  const base = `ou-${orbitalUnitId}`;
1820
1820
  return {
@@ -1980,7 +1980,7 @@ var PlanVerifyRemember = ({
1980
1980
  color = "var(--color-primary)",
1981
1981
  animated = false
1982
1982
  }) => {
1983
- const ids = React__default.default.useMemo(() => {
1983
+ const ids = React24__default.default.useMemo(() => {
1984
1984
  planVerifyRememberId += 1;
1985
1985
  const base = `pvr-${planVerifyRememberId}`;
1986
1986
  return {
@@ -2129,7 +2129,7 @@ var ProveCorrect = ({
2129
2129
  color = "var(--color-primary)",
2130
2130
  animated = false
2131
2131
  }) => {
2132
- const ids = React__default.default.useMemo(() => {
2132
+ const ids = React24__default.default.useMemo(() => {
2133
2133
  proveCorrectId += 1;
2134
2134
  const base = `pc-${proveCorrectId}`;
2135
2135
  return {
@@ -2249,7 +2249,7 @@ var ServiceLayers = ({
2249
2249
  color = "var(--color-primary)",
2250
2250
  animated = false
2251
2251
  }) => {
2252
- const ids = React__default.default.useMemo(() => {
2252
+ const ids = React24__default.default.useMemo(() => {
2253
2253
  serviceLayersId += 1;
2254
2254
  const base = `sly-${serviceLayersId}`;
2255
2255
  return {
@@ -2401,7 +2401,7 @@ var SharedReality = ({
2401
2401
  color = "var(--color-primary)",
2402
2402
  animated = false
2403
2403
  }) => {
2404
- const ids = React__default.default.useMemo(() => {
2404
+ const ids = React24__default.default.useMemo(() => {
2405
2405
  sharedRealityId += 1;
2406
2406
  const base = `sr-${sharedRealityId}`;
2407
2407
  return { grad: `${base}-grad`, unitGlow: `${base}-ug` };
@@ -2503,7 +2503,7 @@ var StandardLibrary = ({
2503
2503
  color = "var(--color-primary)",
2504
2504
  animated = false
2505
2505
  }) => {
2506
- const ids = React__default.default.useMemo(() => {
2506
+ const ids = React24__default.default.useMemo(() => {
2507
2507
  standardLibraryId += 1;
2508
2508
  const base = `sl-${standardLibraryId}`;
2509
2509
  return { glow: `${base}-glow`, groupGlow: `${base}-gg` };
@@ -2612,7 +2612,7 @@ var StateMachine = ({
2612
2612
  color = "var(--color-primary)",
2613
2613
  animated = false
2614
2614
  }) => {
2615
- const ids = React__default.default.useMemo(() => {
2615
+ const ids = React24__default.default.useMemo(() => {
2616
2616
  stateMachineId += 1;
2617
2617
  const base = `sm-${stateMachineId}`;
2618
2618
  return {
@@ -2790,7 +2790,7 @@ var WorldModel = ({
2790
2790
  color = "var(--color-primary)",
2791
2791
  animated = false
2792
2792
  }) => {
2793
- const ids = React__default.default.useMemo(() => {
2793
+ const ids = React24__default.default.useMemo(() => {
2794
2794
  worldModelId += 1;
2795
2795
  const base = `wm-${worldModelId}`;
2796
2796
  return {
@@ -2938,7 +2938,1776 @@ var WorldModel = ({
2938
2938
  };
2939
2939
  WorldModel.displayName = "WorldModel";
2940
2940
 
2941
+ // components/atoms/avl/types.ts
2942
+ var AVL_OPERATOR_COLORS = {
2943
+ arithmetic: "#4A90D9",
2944
+ comparison: "#E8913A",
2945
+ logic: "#9B59B6",
2946
+ string: "#27AE60",
2947
+ collection: "#1ABC9C",
2948
+ time: "#F39C12",
2949
+ control: "#E74C3C",
2950
+ async: "#E91E8F"
2951
+ };
2952
+ var AvlOrbital = ({
2953
+ cx = 0,
2954
+ cy = 0,
2955
+ r = 80,
2956
+ label,
2957
+ color = "var(--color-primary)",
2958
+ opacity = 1,
2959
+ className
2960
+ }) => {
2961
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
2962
+ /* @__PURE__ */ jsxRuntime.jsx(
2963
+ "circle",
2964
+ {
2965
+ cx,
2966
+ cy,
2967
+ r,
2968
+ fill: "none",
2969
+ stroke: color,
2970
+ strokeWidth: 2
2971
+ }
2972
+ ),
2973
+ /* @__PURE__ */ jsxRuntime.jsx(
2974
+ "circle",
2975
+ {
2976
+ cx,
2977
+ cy,
2978
+ r,
2979
+ fill: color,
2980
+ opacity: 0.03
2981
+ }
2982
+ ),
2983
+ label && /* @__PURE__ */ jsxRuntime.jsx(
2984
+ "text",
2985
+ {
2986
+ x: cx,
2987
+ y: cy - r - 8,
2988
+ textAnchor: "middle",
2989
+ fill: color,
2990
+ fontSize: 11,
2991
+ fontFamily: "inherit",
2992
+ fontWeight: "bold",
2993
+ children: label
2994
+ }
2995
+ )
2996
+ ] });
2997
+ };
2998
+ AvlOrbital.displayName = "AvlOrbital";
2999
+ function persistenceStroke(kind) {
3000
+ switch (kind) {
3001
+ case "persistent":
3002
+ return { strokeWidth: 2.5 };
3003
+ case "runtime":
3004
+ return { strokeDasharray: "6 3", strokeWidth: 2 };
3005
+ case "singleton":
3006
+ return { strokeWidth: 3.5 };
3007
+ case "instance":
3008
+ return { strokeDasharray: "2 3", strokeWidth: 2 };
3009
+ }
3010
+ }
3011
+ var AvlEntity = ({
3012
+ x = 0,
3013
+ y = 0,
3014
+ r = 18,
3015
+ fieldCount = 0,
3016
+ persistence = "persistent",
3017
+ label,
3018
+ color = "var(--color-primary)",
3019
+ opacity = 1,
3020
+ className
3021
+ }) => {
3022
+ const strokeProps = persistenceStroke(persistence);
3023
+ const facets = Array.from({ length: fieldCount }, (_, i) => {
3024
+ const angle = Math.PI * 2 * i / fieldCount - Math.PI / 2;
3025
+ const innerR = r + 2;
3026
+ const outerR = r + 10;
3027
+ return {
3028
+ x1: x + innerR * Math.cos(angle),
3029
+ y1: y + innerR * Math.sin(angle),
3030
+ x2: x + outerR * Math.cos(angle),
3031
+ y2: y + outerR * Math.sin(angle)
3032
+ };
3033
+ });
3034
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3035
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r, fill: color, opacity: 0.15 }),
3036
+ /* @__PURE__ */ jsxRuntime.jsx(
3037
+ "circle",
3038
+ {
3039
+ cx: x,
3040
+ cy: y,
3041
+ r,
3042
+ fill: "none",
3043
+ stroke: color,
3044
+ strokeWidth: strokeProps.strokeWidth,
3045
+ strokeDasharray: strokeProps.strokeDasharray
3046
+ }
3047
+ ),
3048
+ persistence === "singleton" && /* @__PURE__ */ jsxRuntime.jsx(
3049
+ "circle",
3050
+ {
3051
+ cx: x,
3052
+ cy: y,
3053
+ r: r - 4,
3054
+ fill: "none",
3055
+ stroke: color,
3056
+ strokeWidth: 1.5
3057
+ }
3058
+ ),
3059
+ facets.map((f, i) => /* @__PURE__ */ jsxRuntime.jsx(
3060
+ "line",
3061
+ {
3062
+ x1: f.x1,
3063
+ y1: f.y1,
3064
+ x2: f.x2,
3065
+ y2: f.y2,
3066
+ stroke: color,
3067
+ strokeWidth: 1,
3068
+ opacity: 0.6
3069
+ },
3070
+ i
3071
+ )),
3072
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3073
+ "text",
3074
+ {
3075
+ x,
3076
+ y: y + r + (fieldCount > 0 ? 18 : 14),
3077
+ textAnchor: "middle",
3078
+ fill: color,
3079
+ fontSize: 10,
3080
+ fontFamily: "inherit",
3081
+ fontWeight: "bold",
3082
+ children: label
3083
+ }
3084
+ )
3085
+ ] });
3086
+ };
3087
+ AvlEntity.displayName = "AvlEntity";
3088
+ var AvlTrait = ({
3089
+ cx = 0,
3090
+ cy = 0,
3091
+ rx = 60,
3092
+ ry = 30,
3093
+ rotation = 0,
3094
+ label,
3095
+ color = "var(--color-primary)",
3096
+ opacity = 1,
3097
+ className
3098
+ }) => {
3099
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, transform: `rotate(${rotation},${cx},${cy})`, children: [
3100
+ /* @__PURE__ */ jsxRuntime.jsx(
3101
+ "ellipse",
3102
+ {
3103
+ cx,
3104
+ cy,
3105
+ rx,
3106
+ ry,
3107
+ fill: "none",
3108
+ stroke: color,
3109
+ strokeWidth: 1.5,
3110
+ strokeDasharray: "4 2"
3111
+ }
3112
+ ),
3113
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3114
+ "text",
3115
+ {
3116
+ x: cx - rx - 6,
3117
+ y: cy,
3118
+ textAnchor: "end",
3119
+ dominantBaseline: "central",
3120
+ fill: color,
3121
+ fontSize: 9,
3122
+ fontFamily: "inherit",
3123
+ opacity: 0.8,
3124
+ transform: `rotate(${-rotation},${cx - rx - 6},${cy})`,
3125
+ children: label
3126
+ }
3127
+ )
3128
+ ] });
3129
+ };
3130
+ AvlTrait.displayName = "AvlTrait";
3131
+ var AvlPage = ({
3132
+ x = 0,
3133
+ y = 0,
3134
+ size = 12,
3135
+ label,
3136
+ color = "var(--color-primary)",
3137
+ opacity = 1,
3138
+ className
3139
+ }) => {
3140
+ const half = size / 2;
3141
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3142
+ /* @__PURE__ */ jsxRuntime.jsx(
3143
+ "rect",
3144
+ {
3145
+ x: x - half,
3146
+ y: y - half,
3147
+ width: size,
3148
+ height: size,
3149
+ fill: color,
3150
+ opacity: 0.3,
3151
+ stroke: color,
3152
+ strokeWidth: 1.5
3153
+ }
3154
+ ),
3155
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3156
+ "text",
3157
+ {
3158
+ x,
3159
+ y: y + half + 12,
3160
+ textAnchor: "middle",
3161
+ fill: color,
3162
+ fontSize: 8,
3163
+ fontFamily: "inherit",
3164
+ children: label
3165
+ }
3166
+ )
3167
+ ] });
3168
+ };
3169
+ AvlPage.displayName = "AvlPage";
3170
+ var AvlApplication = ({
3171
+ x = 0,
3172
+ y = 0,
3173
+ width = 500,
3174
+ height = 350,
3175
+ label,
3176
+ color = "var(--color-primary)",
3177
+ opacity = 1,
3178
+ className
3179
+ }) => {
3180
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3181
+ /* @__PURE__ */ jsxRuntime.jsx(
3182
+ "rect",
3183
+ {
3184
+ x,
3185
+ y,
3186
+ width,
3187
+ height,
3188
+ rx: 12,
3189
+ ry: 12,
3190
+ fill: "none",
3191
+ stroke: color,
3192
+ strokeWidth: 3
3193
+ }
3194
+ ),
3195
+ /* @__PURE__ */ jsxRuntime.jsx(
3196
+ "rect",
3197
+ {
3198
+ x,
3199
+ y,
3200
+ width,
3201
+ height,
3202
+ rx: 12,
3203
+ ry: 12,
3204
+ fill: color,
3205
+ opacity: 0.02
3206
+ }
3207
+ ),
3208
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3209
+ "text",
3210
+ {
3211
+ x: x + 16,
3212
+ y: y + 20,
3213
+ fill: color,
3214
+ fontSize: 12,
3215
+ fontFamily: "inherit",
3216
+ fontWeight: "bold",
3217
+ children: label
3218
+ }
3219
+ )
3220
+ ] });
3221
+ };
3222
+ AvlApplication.displayName = "AvlApplication";
3223
+ var AvlState = ({
3224
+ x = 0,
3225
+ y = 0,
3226
+ name,
3227
+ isInitial = false,
3228
+ isTerminal = false,
3229
+ width = 100,
3230
+ height = 40,
3231
+ color = "var(--color-primary)",
3232
+ opacity = 1,
3233
+ className
3234
+ }) => {
3235
+ const rx = height / 2;
3236
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, transform: `translate(${x},${y})`, children: [
3237
+ isInitial && /* @__PURE__ */ jsxRuntime.jsx(
3238
+ "circle",
3239
+ {
3240
+ cx: -16,
3241
+ cy: height / 2,
3242
+ r: 6,
3243
+ fill: color
3244
+ }
3245
+ ),
3246
+ isTerminal && /* @__PURE__ */ jsxRuntime.jsx(
3247
+ "rect",
3248
+ {
3249
+ x: -4,
3250
+ y: -4,
3251
+ width: width + 8,
3252
+ height: height + 8,
3253
+ rx: rx + 4,
3254
+ ry: rx + 4,
3255
+ fill: "none",
3256
+ stroke: color,
3257
+ strokeWidth: 1,
3258
+ opacity: 0.5
3259
+ }
3260
+ ),
3261
+ /* @__PURE__ */ jsxRuntime.jsx(
3262
+ "rect",
3263
+ {
3264
+ x: 0,
3265
+ y: 0,
3266
+ width,
3267
+ height,
3268
+ rx,
3269
+ ry: rx,
3270
+ fill: "none",
3271
+ stroke: color,
3272
+ strokeWidth: 2
3273
+ }
3274
+ ),
3275
+ name && /* @__PURE__ */ jsxRuntime.jsx(
3276
+ "text",
3277
+ {
3278
+ x: width / 2,
3279
+ y: height / 2,
3280
+ textAnchor: "middle",
3281
+ dominantBaseline: "central",
3282
+ fill: color,
3283
+ fontSize: 11,
3284
+ fontFamily: "inherit",
3285
+ children: name
3286
+ }
3287
+ )
3288
+ ] });
3289
+ };
3290
+ AvlState.displayName = "AvlState";
3291
+ var avlTransitionId = 0;
3292
+ var AvlTransition = ({
3293
+ x1,
3294
+ y1,
3295
+ x2,
3296
+ y2,
3297
+ curved = false,
3298
+ curveAwayFrom,
3299
+ label,
3300
+ color = "var(--color-primary)",
3301
+ opacity = 1,
3302
+ className
3303
+ }) => {
3304
+ const ids = React24__default.default.useMemo(() => {
3305
+ avlTransitionId += 1;
3306
+ return { arrow: `avl-tr-${avlTransitionId}-arrow` };
3307
+ }, []);
3308
+ const mx = (x1 + x2) / 2;
3309
+ const my = (y1 + y2) / 2;
3310
+ const dx = x2 - x1;
3311
+ const dy = y2 - y1;
3312
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
3313
+ const curvature = len * 0.2;
3314
+ let perpX = -dy / len;
3315
+ let perpY = dx / len;
3316
+ if (curveAwayFrom) {
3317
+ const testX = mx + perpX * curvature;
3318
+ const testY = my + perpY * curvature;
3319
+ const distTest = Math.sqrt((testX - curveAwayFrom.x) ** 2 + (testY - curveAwayFrom.y) ** 2);
3320
+ const distMid = Math.sqrt((mx - curveAwayFrom.x) ** 2 + (my - curveAwayFrom.y) ** 2);
3321
+ if (distTest < distMid) {
3322
+ perpX = -perpX;
3323
+ perpY = -perpY;
3324
+ }
3325
+ }
3326
+ const cpx = mx + perpX * curvature;
3327
+ const cpy = my + perpY * curvature;
3328
+ const d = curved ? `M${x1},${y1} Q${cpx},${cpy} ${x2},${y2}` : `M${x1},${y1} L${x2},${y2}`;
3329
+ const labelX = curved ? (x1 + 2 * cpx + x2) / 4 : mx;
3330
+ const labelY = curved ? (y1 + 2 * cpy + y2) / 4 : my;
3331
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3332
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
3333
+ "marker",
3334
+ {
3335
+ id: ids.arrow,
3336
+ markerWidth: "8",
3337
+ markerHeight: "6",
3338
+ refX: "7",
3339
+ refY: "3",
3340
+ orient: "auto",
3341
+ markerUnits: "strokeWidth",
3342
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color })
3343
+ }
3344
+ ) }),
3345
+ /* @__PURE__ */ jsxRuntime.jsx(
3346
+ "path",
3347
+ {
3348
+ d,
3349
+ fill: "none",
3350
+ stroke: color,
3351
+ strokeWidth: 1.5,
3352
+ markerEnd: `url(#${ids.arrow})`
3353
+ }
3354
+ ),
3355
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3356
+ "text",
3357
+ {
3358
+ x: labelX,
3359
+ y: labelY - 6,
3360
+ textAnchor: "middle",
3361
+ fill: color,
3362
+ fontSize: 9,
3363
+ fontFamily: "inherit",
3364
+ opacity: 0.8,
3365
+ children: label
3366
+ }
3367
+ )
3368
+ ] });
3369
+ };
3370
+ AvlTransition.displayName = "AvlTransition";
3371
+ var AvlEvent = ({
3372
+ x = 0,
3373
+ y = 0,
3374
+ size = 16,
3375
+ label,
3376
+ color = "var(--color-primary)",
3377
+ opacity = 1,
3378
+ className
3379
+ }) => {
3380
+ const s = size / 16;
3381
+ const bolt = [
3382
+ `M${x - 2 * s},${y - 8 * s}`,
3383
+ `L${x + 4 * s},${y - 8 * s}`,
3384
+ `L${x + 1 * s},${y - 1 * s}`,
3385
+ `L${x + 5 * s},${y - 1 * s}`,
3386
+ `L${x - 3 * s},${y + 8 * s}`,
3387
+ `L${x},${y + 1 * s}`,
3388
+ `L${x - 4 * s},${y + 1 * s}`,
3389
+ "Z"
3390
+ ].join(" ");
3391
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3392
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: bolt, fill: color }),
3393
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3394
+ "text",
3395
+ {
3396
+ x,
3397
+ y: y + size / 2 + 12,
3398
+ textAnchor: "middle",
3399
+ fill: color,
3400
+ fontSize: 9,
3401
+ fontFamily: "inherit",
3402
+ children: label
3403
+ }
3404
+ )
3405
+ ] });
3406
+ };
3407
+ AvlEvent.displayName = "AvlEvent";
3408
+ var AvlGuard = ({
3409
+ x = 0,
3410
+ y = 0,
3411
+ size = 24,
3412
+ label,
3413
+ color = "var(--color-primary)",
3414
+ opacity = 1,
3415
+ className
3416
+ }) => {
3417
+ const h = size / 2;
3418
+ const points = `${x},${y - h} ${x + h},${y} ${x},${y + h} ${x - h},${y}`;
3419
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3420
+ /* @__PURE__ */ jsxRuntime.jsx(
3421
+ "polygon",
3422
+ {
3423
+ points,
3424
+ fill: "none",
3425
+ stroke: color,
3426
+ strokeWidth: 2,
3427
+ strokeLinejoin: "round"
3428
+ }
3429
+ ),
3430
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3431
+ "text",
3432
+ {
3433
+ x,
3434
+ y,
3435
+ textAnchor: "middle",
3436
+ dominantBaseline: "central",
3437
+ fill: color,
3438
+ fontSize: 8,
3439
+ fontFamily: "inherit",
3440
+ children: label
3441
+ }
3442
+ )
3443
+ ] });
3444
+ };
3445
+ AvlGuard.displayName = "AvlGuard";
3446
+ function effectIcon(type, x, y, s, color) {
3447
+ switch (type) {
3448
+ case "render-ui":
3449
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3450
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: x - s, y: y - s, width: s * 2, height: s * 2, fill: "none", stroke: color, strokeWidth: 1.5, rx: 1 }),
3451
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x, y1: y - s, x2: x, y2: y + s, stroke: color, strokeWidth: 1 }),
3452
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 1 })
3453
+ ] });
3454
+ case "set":
3455
+ return /* @__PURE__ */ jsxRuntime.jsx(
3456
+ "path",
3457
+ {
3458
+ d: `M${x - s * 0.6},${y + s} L${x - s},${y + s * 0.4} L${x + s * 0.4},${y - s} L${x + s},${y - s * 0.4} Z`,
3459
+ fill: "none",
3460
+ stroke: color,
3461
+ strokeWidth: 1.5,
3462
+ strokeLinejoin: "round"
3463
+ }
3464
+ );
3465
+ case "persist":
3466
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3467
+ /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: x, cy: y - s * 0.6, rx: s, ry: s * 0.4, fill: "none", stroke: color, strokeWidth: 1.5 }),
3468
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y - s * 0.6, x2: x - s, y2: y + s * 0.4, stroke: color, strokeWidth: 1.5 }),
3469
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + s, y1: y - s * 0.6, x2: x + s, y2: y + s * 0.4, stroke: color, strokeWidth: 1.5 }),
3470
+ /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: x, cy: y + s * 0.4, rx: s, ry: s * 0.4, fill: "none", stroke: color, strokeWidth: 1.5 })
3471
+ ] });
3472
+ case "fetch":
3473
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3474
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x, y1: y - s, x2: x, y2: y + s * 0.6, stroke: color, strokeWidth: 1.5 }),
3475
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: `${x - s * 0.5},${y + s * 0.1} ${x},${y + s} ${x + s * 0.5},${y + s * 0.1}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" })
3476
+ ] });
3477
+ case "emit":
3478
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3479
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s * 0.3, fill: color }),
3480
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: `M${x - s * 0.7},${y - s * 0.7} A${s},${s} 0 0,1 ${x + s * 0.7},${y - s * 0.7}`, fill: "none", stroke: color, strokeWidth: 1.5 }),
3481
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: `M${x - s},${y - s} A${s * 1.4},${s * 1.4} 0 0,1 ${x + s},${y - s}`, fill: "none", stroke: color, strokeWidth: 1, opacity: 0.6 })
3482
+ ] });
3483
+ case "navigate":
3484
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3485
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y, x2: x + s * 0.6, y2: y, stroke: color, strokeWidth: 1.5 }),
3486
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: `${x + s * 0.1},${y - s * 0.5} ${x + s},${y} ${x + s * 0.1},${y + s * 0.5}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" })
3487
+ ] });
3488
+ case "notify":
3489
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3490
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: `M${x - s * 0.7},${y + s * 0.3} Q${x - s * 0.7},${y - s} ${x},${y - s} Q${x + s * 0.7},${y - s} ${x + s * 0.7},${y + s * 0.3} Z`, fill: "none", stroke: color, strokeWidth: 1.5 }),
3491
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s * 0.8, y1: y + s * 0.3, x2: x + s * 0.8, y2: y + s * 0.3, stroke: color, strokeWidth: 1.5 }),
3492
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y + s * 0.7, r: s * 0.2, fill: color })
3493
+ ] });
3494
+ case "call-service":
3495
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3496
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y - s * 0.3, x2: x + s, y2: y - s * 0.3, stroke: color, strokeWidth: 1.5 }),
3497
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: `${x + s * 0.5},${y - s * 0.7} ${x + s},${y - s * 0.3} ${x + s * 0.5},${y + s * 0.1}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" }),
3498
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + s, y1: y + s * 0.3, x2: x - s, y2: y + s * 0.3, stroke: color, strokeWidth: 1.5 }),
3499
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: `${x - s * 0.5},${y - s * 0.1} ${x - s},${y + s * 0.3} ${x - s * 0.5},${y + s * 0.7}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" })
3500
+ ] });
3501
+ case "spawn":
3502
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3503
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
3504
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s * 0.5, y1: y, x2: x + s * 0.5, y2: y, stroke: color, strokeWidth: 1.5 }),
3505
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x, y1: y - s * 0.5, x2: x, y2: y + s * 0.5, stroke: color, strokeWidth: 1.5 })
3506
+ ] });
3507
+ case "despawn":
3508
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3509
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
3510
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s * 0.5, y1: y, x2: x + s * 0.5, y2: y, stroke: color, strokeWidth: 1.5 })
3511
+ ] });
3512
+ case "do":
3513
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3514
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
3515
+ /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: `${x - s * 0.3},${y - s * 0.5} ${x + s * 0.5},${y} ${x - s * 0.3},${y + s * 0.5}`, fill: color })
3516
+ ] });
3517
+ case "if":
3518
+ return /* @__PURE__ */ jsxRuntime.jsx(
3519
+ "polygon",
3520
+ {
3521
+ points: `${x},${y - s} ${x + s * 0.7},${y} ${x},${y + s} ${x - s * 0.7},${y}`,
3522
+ fill: "none",
3523
+ stroke: color,
3524
+ strokeWidth: 1.5,
3525
+ strokeLinejoin: "round"
3526
+ }
3527
+ );
3528
+ case "log":
3529
+ return /* @__PURE__ */ jsxRuntime.jsx(
3530
+ "text",
3531
+ {
3532
+ x,
3533
+ y,
3534
+ textAnchor: "middle",
3535
+ dominantBaseline: "central",
3536
+ fill: color,
3537
+ fontSize: s * 2.2,
3538
+ fontFamily: "serif",
3539
+ children: "\xB6"
3540
+ }
3541
+ );
3542
+ }
3543
+ }
3544
+ var AvlEffect = ({
3545
+ x = 0,
3546
+ y = 0,
3547
+ effectType,
3548
+ size = 8,
3549
+ label,
3550
+ color = "var(--color-primary)",
3551
+ opacity = 1,
3552
+ className
3553
+ }) => {
3554
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3555
+ effectIcon(effectType, x, y, size, color),
3556
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3557
+ "text",
3558
+ {
3559
+ x,
3560
+ y: y + size + 10,
3561
+ textAnchor: "middle",
3562
+ fill: color,
3563
+ fontSize: 8,
3564
+ fontFamily: "inherit",
3565
+ opacity: 0.7,
3566
+ children: label
3567
+ }
3568
+ )
3569
+ ] });
3570
+ };
3571
+ AvlEffect.displayName = "AvlEffect";
3572
+ var AvlField = ({
3573
+ x = 0,
3574
+ y = 0,
3575
+ angle = 0,
3576
+ length = 30,
3577
+ required = true,
3578
+ label,
3579
+ color = "var(--color-primary)",
3580
+ opacity = 1,
3581
+ className
3582
+ }) => {
3583
+ const x2 = x + length * Math.cos(angle);
3584
+ const y2 = y + length * Math.sin(angle);
3585
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3586
+ /* @__PURE__ */ jsxRuntime.jsx(
3587
+ "line",
3588
+ {
3589
+ x1: x,
3590
+ y1: y,
3591
+ x2,
3592
+ y2,
3593
+ stroke: color,
3594
+ strokeWidth: 1.5,
3595
+ strokeDasharray: required ? void 0 : "3 2"
3596
+ }
3597
+ ),
3598
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x2, cy: y2, r: 2.5, fill: color, opacity: 0.6 }),
3599
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3600
+ "text",
3601
+ {
3602
+ x: x2 + 6 * Math.cos(angle),
3603
+ y: y2 + 6 * Math.sin(angle),
3604
+ textAnchor: Math.cos(angle) >= 0 ? "start" : "end",
3605
+ dominantBaseline: "central",
3606
+ fill: color,
3607
+ fontSize: 8,
3608
+ fontFamily: "inherit",
3609
+ opacity: 0.7,
3610
+ children: label
3611
+ }
3612
+ )
3613
+ ] });
3614
+ };
3615
+ AvlField.displayName = "AvlField";
3616
+ function typeShape(kind, x, y, s, color) {
3617
+ switch (kind) {
3618
+ case "string":
3619
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: color });
3620
+ case "number":
3621
+ return /* @__PURE__ */ jsxRuntime.jsx(
3622
+ "polygon",
3623
+ {
3624
+ points: `${x},${y - s} ${x + s},${y + s * 0.7} ${x - s},${y + s * 0.7}`,
3625
+ fill: color
3626
+ }
3627
+ );
3628
+ case "boolean":
3629
+ return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: x - s * 0.8, y: y - s * 0.8, width: s * 1.6, height: s * 1.6, fill: color });
3630
+ case "date":
3631
+ return /* @__PURE__ */ jsxRuntime.jsx(
3632
+ "polygon",
3633
+ {
3634
+ points: `${x},${y - s} ${x + s},${y} ${x},${y + s} ${x - s},${y}`,
3635
+ fill: color
3636
+ }
3637
+ );
3638
+ case "enum":
3639
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 });
3640
+ case "object":
3641
+ return /* @__PURE__ */ jsxRuntime.jsx(
3642
+ "polygon",
3643
+ {
3644
+ points: Array.from({ length: 6 }, (_, i) => {
3645
+ const a = Math.PI * 2 * i / 6 - Math.PI / 6;
3646
+ return `${x + s * Math.cos(a)},${y + s * Math.sin(a)}`;
3647
+ }).join(" "),
3648
+ fill: color,
3649
+ opacity: 0.8
3650
+ }
3651
+ );
3652
+ case "array":
3653
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
3654
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y - s * 0.6, x2: x + s, y2: y - s * 0.6, stroke: color, strokeWidth: 2 }),
3655
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 2 }),
3656
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y + s * 0.6, x2: x + s, y2: y + s * 0.6, stroke: color, strokeWidth: 2 })
3657
+ ] });
3658
+ }
3659
+ }
3660
+ var AvlFieldType = ({
3661
+ x = 0,
3662
+ y = 0,
3663
+ kind,
3664
+ size = 5,
3665
+ label,
3666
+ color = "var(--color-primary)",
3667
+ opacity = 1,
3668
+ className
3669
+ }) => {
3670
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3671
+ typeShape(kind, x, y, size, color),
3672
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3673
+ "text",
3674
+ {
3675
+ x,
3676
+ y: y + size + 10,
3677
+ textAnchor: "middle",
3678
+ fill: color,
3679
+ fontSize: 8,
3680
+ fontFamily: "inherit",
3681
+ opacity: 0.7,
3682
+ children: label
3683
+ }
3684
+ )
3685
+ ] });
3686
+ };
3687
+ AvlFieldType.displayName = "AvlFieldType";
3688
+ var AvlBinding = ({
3689
+ x1,
3690
+ y1,
3691
+ x2,
3692
+ y2,
3693
+ label,
3694
+ color = "var(--color-primary)",
3695
+ opacity = 1,
3696
+ className
3697
+ }) => {
3698
+ const mx = (x1 + x2) / 2;
3699
+ const my = (y1 + y2) / 2;
3700
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3701
+ /* @__PURE__ */ jsxRuntime.jsx(
3702
+ "line",
3703
+ {
3704
+ x1,
3705
+ y1,
3706
+ x2,
3707
+ y2,
3708
+ stroke: color,
3709
+ strokeWidth: 1,
3710
+ strokeDasharray: "2 3",
3711
+ opacity: 0.6
3712
+ }
3713
+ ),
3714
+ /* @__PURE__ */ jsxRuntime.jsx(
3715
+ "text",
3716
+ {
3717
+ x: mx,
3718
+ y: my - 4,
3719
+ textAnchor: "middle",
3720
+ fill: color,
3721
+ fontSize: 10,
3722
+ fontFamily: "inherit",
3723
+ fontWeight: "bold",
3724
+ children: "@"
3725
+ }
3726
+ ),
3727
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3728
+ "text",
3729
+ {
3730
+ x: mx,
3731
+ y: my + 10,
3732
+ textAnchor: "middle",
3733
+ fill: color,
3734
+ fontSize: 8,
3735
+ fontFamily: "inherit",
3736
+ opacity: 0.6,
3737
+ children: label
3738
+ }
3739
+ )
3740
+ ] });
3741
+ };
3742
+ AvlBinding.displayName = "AvlBinding";
3743
+ var AvlPersistence = ({
3744
+ x = 0,
3745
+ y = 0,
3746
+ kind,
3747
+ size = 20,
3748
+ label,
3749
+ color = "var(--color-primary)",
3750
+ opacity = 1,
3751
+ className
3752
+ }) => {
3753
+ const half = size / 2;
3754
+ const strokeProps = (() => {
3755
+ switch (kind) {
3756
+ case "persistent":
3757
+ return { strokeWidth: 2.5 };
3758
+ case "runtime":
3759
+ return { strokeDasharray: "6 3", strokeWidth: 2 };
3760
+ case "singleton":
3761
+ return { strokeWidth: 3 };
3762
+ case "instance":
3763
+ return { strokeDasharray: "2 3", strokeWidth: 2 };
3764
+ }
3765
+ })();
3766
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3767
+ /* @__PURE__ */ jsxRuntime.jsx(
3768
+ "line",
3769
+ {
3770
+ x1: x - half,
3771
+ y1: y,
3772
+ x2: x + half,
3773
+ y2: y,
3774
+ stroke: color,
3775
+ strokeWidth: strokeProps.strokeWidth,
3776
+ strokeDasharray: strokeProps.strokeDasharray,
3777
+ strokeLinecap: "round"
3778
+ }
3779
+ ),
3780
+ kind === "singleton" && /* @__PURE__ */ jsxRuntime.jsx(
3781
+ "line",
3782
+ {
3783
+ x1: x - half,
3784
+ y1: y + 5,
3785
+ x2: x + half,
3786
+ y2: y + 5,
3787
+ stroke: color,
3788
+ strokeWidth: 1.5,
3789
+ strokeLinecap: "round"
3790
+ }
3791
+ ),
3792
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3793
+ "text",
3794
+ {
3795
+ x,
3796
+ y: y + (kind === "singleton" ? 20 : 14),
3797
+ textAnchor: "middle",
3798
+ fill: color,
3799
+ fontSize: 8,
3800
+ fontFamily: "inherit",
3801
+ opacity: 0.7,
3802
+ children: label
3803
+ }
3804
+ )
3805
+ ] });
3806
+ };
3807
+ AvlPersistence.displayName = "AvlPersistence";
3808
+ var AvlOperator = ({
3809
+ x = 0,
3810
+ y = 0,
3811
+ name,
3812
+ namespace = "arithmetic",
3813
+ size = 16,
3814
+ color,
3815
+ opacity = 1,
3816
+ className
3817
+ }) => {
3818
+ const opColor = color ?? AVL_OPERATOR_COLORS[namespace];
3819
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3820
+ /* @__PURE__ */ jsxRuntime.jsx(
3821
+ "rect",
3822
+ {
3823
+ x: x - size,
3824
+ y: y - size * 0.7,
3825
+ width: size * 2,
3826
+ height: size * 1.4,
3827
+ rx: 4,
3828
+ ry: 4,
3829
+ fill: opColor,
3830
+ fillOpacity: 0.15,
3831
+ stroke: opColor,
3832
+ strokeWidth: 1.5
3833
+ }
3834
+ ),
3835
+ /* @__PURE__ */ jsxRuntime.jsx(
3836
+ "text",
3837
+ {
3838
+ x,
3839
+ y: y + 1,
3840
+ textAnchor: "middle",
3841
+ dominantBaseline: "central",
3842
+ fill: opColor,
3843
+ fontSize: size > 14 ? 10 : 8,
3844
+ fontFamily: "inherit",
3845
+ fontWeight: "bold",
3846
+ children: name
3847
+ }
3848
+ )
3849
+ ] });
3850
+ };
3851
+ AvlOperator.displayName = "AvlOperator";
3852
+ var AvlSExpr = ({
3853
+ x = 0,
3854
+ y = 0,
3855
+ width = 140,
3856
+ height = 80,
3857
+ label,
3858
+ color = "var(--color-primary)",
3859
+ opacity = 1,
3860
+ className
3861
+ }) => {
3862
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3863
+ /* @__PURE__ */ jsxRuntime.jsx(
3864
+ "rect",
3865
+ {
3866
+ x,
3867
+ y,
3868
+ width,
3869
+ height,
3870
+ rx: 6,
3871
+ ry: 6,
3872
+ fill: color,
3873
+ fillOpacity: 0.05,
3874
+ stroke: color,
3875
+ strokeWidth: 1,
3876
+ strokeDasharray: "6 3"
3877
+ }
3878
+ ),
3879
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x + 12, cy: y + 12, r: 3, fill: color, opacity: 0.4 }),
3880
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + 12, y1: y + 15, x2: x + 8, y2: y + 22, stroke: color, strokeWidth: 0.8, opacity: 0.3 }),
3881
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + 12, y1: y + 15, x2: x + 16, y2: y + 22, stroke: color, strokeWidth: 0.8, opacity: 0.3 }),
3882
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3883
+ "text",
3884
+ {
3885
+ x: x + width / 2,
3886
+ y: y + height / 2,
3887
+ textAnchor: "middle",
3888
+ dominantBaseline: "central",
3889
+ fill: color,
3890
+ fontSize: 9,
3891
+ fontFamily: "inherit",
3892
+ opacity: 0.6,
3893
+ children: label
3894
+ }
3895
+ )
3896
+ ] });
3897
+ };
3898
+ AvlSExpr.displayName = "AvlSExpr";
3899
+ var AvlLiteral = ({
3900
+ x = 0,
3901
+ y = 0,
3902
+ value,
3903
+ size = 12,
3904
+ color = "var(--color-primary)",
3905
+ opacity = 1,
3906
+ className
3907
+ }) => {
3908
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3909
+ /* @__PURE__ */ jsxRuntime.jsx(
3910
+ "circle",
3911
+ {
3912
+ cx: x,
3913
+ cy: y,
3914
+ r: size,
3915
+ fill: "none",
3916
+ stroke: color,
3917
+ strokeWidth: 1,
3918
+ opacity: 0.5
3919
+ }
3920
+ ),
3921
+ /* @__PURE__ */ jsxRuntime.jsx(
3922
+ "text",
3923
+ {
3924
+ x,
3925
+ y: y + 1,
3926
+ textAnchor: "middle",
3927
+ dominantBaseline: "central",
3928
+ fill: color,
3929
+ fontSize: size > 10 ? 9 : 7,
3930
+ fontFamily: "inherit",
3931
+ children: value
3932
+ }
3933
+ )
3934
+ ] });
3935
+ };
3936
+ AvlLiteral.displayName = "AvlLiteral";
3937
+ var AvlBindingRef = ({
3938
+ x = 0,
3939
+ y = 0,
3940
+ path,
3941
+ size = 12,
3942
+ color = "var(--color-primary)",
3943
+ opacity = 1,
3944
+ className
3945
+ }) => {
3946
+ const fullLabel = `@${path}`;
3947
+ const autoR = Math.max(size, fullLabel.length * 3.5 + 4);
3948
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
3949
+ /* @__PURE__ */ jsxRuntime.jsx(
3950
+ "circle",
3951
+ {
3952
+ cx: x,
3953
+ cy: y,
3954
+ r: autoR,
3955
+ fill: "none",
3956
+ stroke: color,
3957
+ strokeWidth: 1.5,
3958
+ strokeDasharray: "3 2"
3959
+ }
3960
+ ),
3961
+ /* @__PURE__ */ jsxRuntime.jsx(
3962
+ "text",
3963
+ {
3964
+ x,
3965
+ y: y + 1,
3966
+ textAnchor: "middle",
3967
+ dominantBaseline: "central",
3968
+ fill: color,
3969
+ fontSize: 10,
3970
+ fontFamily: "inherit",
3971
+ children: fullLabel
3972
+ }
3973
+ )
3974
+ ] });
3975
+ };
3976
+ AvlBindingRef.displayName = "AvlBindingRef";
3977
+
3978
+ // components/molecules/avl/avl-layout.ts
3979
+ function ringPositions(cx, cy, r, count, startAngle = -Math.PI / 2) {
3980
+ return Array.from({ length: count }, (_, i) => {
3981
+ const angle = startAngle + Math.PI * 2 * i / count;
3982
+ return {
3983
+ x: cx + r * Math.cos(angle),
3984
+ y: cy + r * Math.sin(angle),
3985
+ angle
3986
+ };
3987
+ });
3988
+ }
3989
+ var avlSmId = 0;
3990
+ var AvlStateMachine = ({
3991
+ states,
3992
+ transitions,
3993
+ className,
3994
+ color = "var(--color-primary)",
3995
+ animated = false
3996
+ }) => {
3997
+ const ids = React24__default.default.useMemo(() => {
3998
+ avlSmId += 1;
3999
+ const base = `avl-sm-${avlSmId}`;
4000
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
4001
+ }, []);
4002
+ const cx = 300;
4003
+ const cy = 200;
4004
+ const r = 150;
4005
+ const stateWidth = 90;
4006
+ const stateHeight = 36;
4007
+ const positions = ringPositions(cx, cy, r, states.length);
4008
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
4009
+ const pairCount = /* @__PURE__ */ new Map();
4010
+ const pairSeen = /* @__PURE__ */ new Map();
4011
+ for (const tr of transitions) {
4012
+ const key = [tr.from, tr.to].sort().join("|");
4013
+ pairCount.set(key, (pairCount.get(key) ?? 0) + 1);
4014
+ }
4015
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4016
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
4017
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
4018
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
4019
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
4020
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
4021
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
4022
+ ] })
4023
+ ] }),
4024
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
4025
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.1 }),
4026
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
4027
+ ] })
4028
+ ] }),
4029
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
4030
+ @keyframes avl-sm-dash { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }
4031
+ ` }),
4032
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: r + 30, fill: `url(#${ids.grad})` }),
4033
+ transitions.map((tr, i) => {
4034
+ const fromIdx = stateIndex.get(tr.from);
4035
+ const toIdx = stateIndex.get(tr.to);
4036
+ if (fromIdx === void 0 || toIdx === void 0) return null;
4037
+ const fp = positions[fromIdx];
4038
+ const tp = positions[toIdx];
4039
+ const dx = tp.x - fp.x;
4040
+ const dy = tp.y - fp.y;
4041
+ const dist4 = Math.sqrt(dx * dx + dy * dy) || 1;
4042
+ const nx = dx / dist4;
4043
+ const ny = dy / dist4;
4044
+ const pairKey = [tr.from, tr.to].sort().join("|");
4045
+ const totalForPair = pairCount.get(pairKey) ?? 1;
4046
+ const seenIdx = pairSeen.get(pairKey) ?? 0;
4047
+ pairSeen.set(pairKey, seenIdx + 1);
4048
+ const pairOffset = totalForPair > 1 ? (seenIdx - (totalForPair - 1) / 2) * 24 : 0;
4049
+ const x1 = fp.x + nx * (stateWidth / 2 + 4);
4050
+ const y1 = fp.y + ny * (stateHeight / 2 + 4);
4051
+ const x2 = tp.x - nx * (stateWidth / 2 + 8);
4052
+ const y2 = tp.y - ny * (stateHeight / 2 + 8);
4053
+ const t = 0.3;
4054
+ const labelX = x1 * (1 - t) + x2 * t;
4055
+ const labelY = y1 * (1 - t) + y2 * t;
4056
+ const perpX = -ny * (20 + Math.abs(pairOffset));
4057
+ const perpY = nx * (20 + Math.abs(pairOffset));
4058
+ const midToCenter = Math.sqrt((labelX - cx) ** 2 + (labelY - cy) ** 2);
4059
+ const testX = labelX + perpX;
4060
+ const testY = labelY + perpY;
4061
+ const testToCenter = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
4062
+ const outSign = testToCenter > midToCenter ? 1 : -1;
4063
+ const lx = labelX + perpX * outSign + -ny * pairOffset;
4064
+ const ly = labelY + perpY * outSign + nx * pairOffset;
4065
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
4066
+ /* @__PURE__ */ jsxRuntime.jsx(
4067
+ AvlTransition,
4068
+ {
4069
+ x1: x1 + -ny * pairOffset,
4070
+ y1: y1 + nx * pairOffset,
4071
+ x2: x2 + -ny * pairOffset,
4072
+ y2: y2 + nx * pairOffset,
4073
+ curved: states.length > 2,
4074
+ curveAwayFrom: { x: cx, y: cy },
4075
+ color,
4076
+ opacity: 0.7
4077
+ }
4078
+ ),
4079
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
4080
+ "text",
4081
+ {
4082
+ x: lx,
4083
+ y: ly,
4084
+ textAnchor: "middle",
4085
+ fill: color,
4086
+ fontSize: 9,
4087
+ fontFamily: "inherit",
4088
+ fontWeight: "bold",
4089
+ opacity: 0.8,
4090
+ children: tr.event
4091
+ }
4092
+ ),
4093
+ tr.guard && /* @__PURE__ */ jsxRuntime.jsxs(
4094
+ "text",
4095
+ {
4096
+ x: lx,
4097
+ y: ly + 12,
4098
+ textAnchor: "middle",
4099
+ fill: color,
4100
+ fontSize: 8,
4101
+ fontFamily: "inherit",
4102
+ opacity: 0.6,
4103
+ children: [
4104
+ "[",
4105
+ tr.guard,
4106
+ "]"
4107
+ ]
4108
+ }
4109
+ ),
4110
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsxRuntime.jsx(
4111
+ AvlEffect,
4112
+ {
4113
+ x: lx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
4114
+ y: ly + (tr.guard ? 22 : 12),
4115
+ effectType: eff,
4116
+ size: 5,
4117
+ color,
4118
+ opacity: 0.7
4119
+ },
4120
+ j
4121
+ ))
4122
+ ] }, `tr-${i}`);
4123
+ }),
4124
+ states.map((state, i) => {
4125
+ const pos = positions[i];
4126
+ return /* @__PURE__ */ jsxRuntime.jsx(
4127
+ AvlState,
4128
+ {
4129
+ x: pos.x - stateWidth / 2,
4130
+ y: pos.y - stateHeight / 2,
4131
+ width: stateWidth,
4132
+ height: stateHeight,
4133
+ name: state.name,
4134
+ isInitial: state.isInitial,
4135
+ isTerminal: state.isTerminal,
4136
+ color
4137
+ },
4138
+ state.name
4139
+ );
4140
+ })
4141
+ ] });
4142
+ };
4143
+ AvlStateMachine.displayName = "AvlStateMachine";
4144
+ var avlOuId = 0;
4145
+ var AvlOrbitalUnit = ({
4146
+ entityName,
4147
+ fields = 4,
4148
+ persistence = "persistent",
4149
+ traits,
4150
+ pages,
4151
+ className,
4152
+ color = "var(--color-primary)",
4153
+ animated = false
4154
+ }) => {
4155
+ const ids = React24__default.default.useMemo(() => {
4156
+ avlOuId += 1;
4157
+ const base = `avl-ou-${avlOuId}`;
4158
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
4159
+ }, []);
4160
+ const cx = 300;
4161
+ const cy = 200;
4162
+ const entityR = 24;
4163
+ const orbitalR = 130;
4164
+ const traitBaseRx = 55;
4165
+ const traitBaseRy = 24;
4166
+ const traitRxStep = 20;
4167
+ const traitRyStep = 8;
4168
+ const traitAngleStep = traits.length > 1 ? 120 / (traits.length - 1) : 0;
4169
+ const traitAngleStart = traits.length > 1 ? -60 : 0;
4170
+ const pageAngleStart = -Math.PI / 3;
4171
+ const pageAngleStep = pages.length > 1 ? Math.PI * 0.8 / (pages.length - 1) : 0;
4172
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4173
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
4174
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
4175
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
4176
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
4177
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
4178
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
4179
+ ] })
4180
+ ] }),
4181
+ /* @__PURE__ */ jsxRuntime.jsxs("radialGradient", { id: ids.grad, cx: "50%", cy: "50%", r: "50%", children: [
4182
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.08 }),
4183
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0 })
4184
+ ] })
4185
+ ] }),
4186
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
4187
+ @keyframes avl-ou-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
4188
+ ` }),
4189
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: orbitalR + 20, fill: `url(#${ids.grad})` }),
4190
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx, cy, r: orbitalR, label: entityName, color }),
4191
+ traits.map((trait, i) => {
4192
+ const rotation = traitAngleStart + i * traitAngleStep;
4193
+ const traitColor = trait.color ?? color;
4194
+ return /* @__PURE__ */ jsxRuntime.jsx(
4195
+ AvlTrait,
4196
+ {
4197
+ cx,
4198
+ cy,
4199
+ rx: traitBaseRx + i * traitRxStep,
4200
+ ry: traitBaseRy + i * traitRyStep,
4201
+ rotation,
4202
+ label: trait.name,
4203
+ color: traitColor,
4204
+ opacity: 0.7
4205
+ },
4206
+ trait.name
4207
+ );
4208
+ }),
4209
+ /* @__PURE__ */ jsxRuntime.jsx(
4210
+ AvlEntity,
4211
+ {
4212
+ x: cx,
4213
+ y: cy,
4214
+ r: entityR,
4215
+ fieldCount: fields,
4216
+ persistence,
4217
+ color
4218
+ }
4219
+ ),
4220
+ pages.map((page, i) => {
4221
+ const angle = pageAngleStart + i * pageAngleStep;
4222
+ const px = cx + orbitalR * Math.cos(angle);
4223
+ const py = cy + orbitalR * Math.sin(angle);
4224
+ return /* @__PURE__ */ jsxRuntime.jsx(
4225
+ AvlPage,
4226
+ {
4227
+ x: px,
4228
+ y: py,
4229
+ size: 10,
4230
+ label: page.name,
4231
+ color
4232
+ },
4233
+ page.name
4234
+ );
4235
+ })
4236
+ ] });
4237
+ };
4238
+ AvlOrbitalUnit.displayName = "AvlOrbitalUnit";
4239
+ var avlCcId = 0;
4240
+ var AvlClosedCircuit = ({
4241
+ states,
4242
+ transitions,
4243
+ className,
4244
+ color = "var(--color-primary)",
4245
+ animated = false
4246
+ }) => {
4247
+ const ids = React24__default.default.useMemo(() => {
4248
+ avlCcId += 1;
4249
+ const base = `avl-cc-${avlCcId}`;
4250
+ return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
4251
+ }, []);
4252
+ const cx = 300;
4253
+ const cy = 200;
4254
+ const r = 120;
4255
+ const stateW = 80;
4256
+ const stateH = 32;
4257
+ const positions = ringPositions(cx, cy, r, states.length);
4258
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
4259
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4260
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
4261
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
4262
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
4263
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
4264
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
4265
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
4266
+ ] })
4267
+ ] }),
4268
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
4269
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.15 }),
4270
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: color, stopOpacity: 0.4 }),
4271
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.15 })
4272
+ ] }),
4273
+ /* @__PURE__ */ jsxRuntime.jsx(
4274
+ "marker",
4275
+ {
4276
+ id: ids.arrow,
4277
+ markerWidth: "8",
4278
+ markerHeight: "6",
4279
+ refX: "7",
4280
+ refY: "3",
4281
+ orient: "auto",
4282
+ markerUnits: "strokeWidth",
4283
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
4284
+ }
4285
+ )
4286
+ ] }),
4287
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
4288
+ @keyframes avl-cc-flow { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
4289
+ ` }),
4290
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: r + 30, fill: "none", stroke: color, strokeWidth: 0.3, opacity: 0.06 }),
4291
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: 50, fill: "none", stroke: color, strokeWidth: 0.5, opacity: 0.08 }),
4292
+ transitions.map((tr, i) => {
4293
+ const fromIdx = stateIndex.get(tr.from);
4294
+ const toIdx = stateIndex.get(tr.to);
4295
+ if (fromIdx === void 0 || toIdx === void 0) return null;
4296
+ const fp = positions[fromIdx];
4297
+ const tp = positions[toIdx];
4298
+ const dx = tp.x - fp.x;
4299
+ const dy = tp.y - fp.y;
4300
+ const dist4 = Math.sqrt(dx * dx + dy * dy) || 1;
4301
+ const nx = dx / dist4;
4302
+ const ny = dy / dist4;
4303
+ const x1 = fp.x + nx * (stateW / 2 + 4);
4304
+ const y1 = fp.y + ny * (stateH / 2 + 4);
4305
+ const x2 = tp.x - nx * (stateW / 2 + 8);
4306
+ const y2 = tp.y - ny * (stateH / 2 + 8);
4307
+ const mx = (x1 + x2) / 2;
4308
+ const my = (y1 + y2) / 2;
4309
+ const curvature = dist4 * 0.25;
4310
+ let perpX = -ny;
4311
+ let perpY = nx;
4312
+ const testX = mx + perpX * curvature;
4313
+ const testY = my + perpY * curvature;
4314
+ const distTest = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
4315
+ const distMid = Math.sqrt((mx - cx) ** 2 + (my - cy) ** 2);
4316
+ if (distTest < distMid) {
4317
+ perpX = -perpX;
4318
+ perpY = -perpY;
4319
+ }
4320
+ const cpx = mx + perpX * curvature;
4321
+ const cpy = my + perpY * curvature;
4322
+ const d = `M${x1},${y1} Q${cpx},${cpy} ${x2},${y2}`;
4323
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
4324
+ /* @__PURE__ */ jsxRuntime.jsx(
4325
+ "path",
4326
+ {
4327
+ d,
4328
+ fill: "none",
4329
+ stroke: `url(#${ids.grad})`,
4330
+ strokeWidth: 1.5,
4331
+ strokeDasharray: animated ? "8 6" : void 0,
4332
+ markerEnd: `url(#${ids.arrow})`,
4333
+ style: animated ? { animation: "avl-cc-flow 1.5s linear infinite" } : void 0
4334
+ }
4335
+ ),
4336
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
4337
+ AvlEvent,
4338
+ {
4339
+ x: cpx,
4340
+ y: cpy - 14,
4341
+ size: 8,
4342
+ label: tr.event,
4343
+ color,
4344
+ opacity: 0.8
4345
+ }
4346
+ ),
4347
+ tr.guard && /* @__PURE__ */ jsxRuntime.jsx(
4348
+ AvlGuard,
4349
+ {
4350
+ x: mx,
4351
+ y: my - 8,
4352
+ size: 10,
4353
+ label: tr.guard,
4354
+ color,
4355
+ opacity: 0.6
4356
+ }
4357
+ ),
4358
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsxRuntime.jsx(
4359
+ AvlEffect,
4360
+ {
4361
+ x: mx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
4362
+ y: my + 14,
4363
+ effectType: eff,
4364
+ size: 5,
4365
+ color,
4366
+ opacity: 0.7
4367
+ },
4368
+ j
4369
+ ))
4370
+ ] }, `cc-tr-${i}`);
4371
+ }),
4372
+ states.map((state, i) => {
4373
+ const pos = positions[i];
4374
+ return /* @__PURE__ */ jsxRuntime.jsx(
4375
+ AvlState,
4376
+ {
4377
+ x: pos.x - stateW / 2,
4378
+ y: pos.y - stateH / 2,
4379
+ width: stateW,
4380
+ height: stateH,
4381
+ name: state.name,
4382
+ color
4383
+ },
4384
+ state.name
4385
+ );
4386
+ }),
4387
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: 3, fill: color, opacity: 0.4 })
4388
+ ] });
4389
+ };
4390
+ AvlClosedCircuit.displayName = "AvlClosedCircuit";
4391
+ var avlElId = 0;
4392
+ var AvlEmitListen = ({
4393
+ emitter,
4394
+ listener,
4395
+ eventName,
4396
+ className,
4397
+ color = "var(--color-primary)",
4398
+ animated = false
4399
+ }) => {
4400
+ const ids = React24__default.default.useMemo(() => {
4401
+ avlElId += 1;
4402
+ const base = `avl-el-${avlElId}`;
4403
+ return { arrow: `${base}-arrow`, grad: `${base}-grad` };
4404
+ }, []);
4405
+ const leftCx = 180;
4406
+ const rightCx = 420;
4407
+ const cy = 200;
4408
+ const orbR = 80;
4409
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4410
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
4411
+ /* @__PURE__ */ jsxRuntime.jsx(
4412
+ "marker",
4413
+ {
4414
+ id: ids.arrow,
4415
+ markerWidth: "8",
4416
+ markerHeight: "6",
4417
+ refX: "7",
4418
+ refY: "3",
4419
+ orient: "auto",
4420
+ markerUnits: "strokeWidth",
4421
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
4422
+ }
4423
+ ),
4424
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
4425
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.5 }),
4426
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.2 })
4427
+ ] })
4428
+ ] }),
4429
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
4430
+ @keyframes avl-el-dash { from { stroke-dashoffset: 16; } to { stroke-dashoffset: 0; } }
4431
+ ` }),
4432
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx: leftCx, cy, r: orbR, label: emitter.name, color }),
4433
+ /* @__PURE__ */ jsxRuntime.jsx(AvlEntity, { x: leftCx, y: cy, r: 18, fieldCount: emitter.fields ?? 3, color }),
4434
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx: rightCx, cy, r: orbR, label: listener.name, color }),
4435
+ /* @__PURE__ */ jsxRuntime.jsx(AvlEntity, { x: rightCx, y: cy, r: 18, fieldCount: listener.fields ?? 3, color }),
4436
+ /* @__PURE__ */ jsxRuntime.jsx(
4437
+ "path",
4438
+ {
4439
+ d: `M${leftCx + orbR + 4},${cy} L${rightCx - orbR - 8},${cy}`,
4440
+ fill: "none",
4441
+ stroke: `url(#${ids.grad})`,
4442
+ strokeWidth: 2,
4443
+ strokeDasharray: "6 4",
4444
+ markerEnd: `url(#${ids.arrow})`,
4445
+ style: animated ? { animation: "avl-el-dash 1s linear infinite" } : void 0
4446
+ }
4447
+ ),
4448
+ /* @__PURE__ */ jsxRuntime.jsx(
4449
+ AvlEffect,
4450
+ {
4451
+ x: leftCx + orbR + 20,
4452
+ y: cy - 20,
4453
+ effectType: "emit",
4454
+ size: 6,
4455
+ color,
4456
+ opacity: 0.8
4457
+ }
4458
+ ),
4459
+ eventName && /* @__PURE__ */ jsxRuntime.jsxs(
4460
+ "text",
4461
+ {
4462
+ x: 300,
4463
+ y: cy - 18,
4464
+ textAnchor: "middle",
4465
+ fill: color,
4466
+ fontSize: 11,
4467
+ fontFamily: "inherit",
4468
+ fontWeight: "bold",
4469
+ opacity: 0.8,
4470
+ children: [
4471
+ "~",
4472
+ eventName
4473
+ ]
4474
+ }
4475
+ ),
4476
+ /* @__PURE__ */ jsxRuntime.jsx(
4477
+ "text",
4478
+ {
4479
+ x: 300,
4480
+ y: cy + 18,
4481
+ textAnchor: "middle",
4482
+ fill: color,
4483
+ fontSize: 12,
4484
+ fontFamily: "inherit",
4485
+ opacity: 0.3,
4486
+ letterSpacing: 4,
4487
+ children: "~ ~ ~"
4488
+ }
4489
+ )
4490
+ ] });
4491
+ };
4492
+ AvlEmitListen.displayName = "AvlEmitListen";
4493
+ var AvlSlotMap = ({
4494
+ slots,
4495
+ pageWidth = 360,
4496
+ pageHeight = 280,
4497
+ className,
4498
+ color = "var(--color-primary)",
4499
+ animated = false
4500
+ }) => {
4501
+ const ox = (600 - pageWidth) / 2;
4502
+ const oy = (400 - pageHeight) / 2;
4503
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4504
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
4505
+ @keyframes avl-slot-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.25; } }
4506
+ ` }),
4507
+ /* @__PURE__ */ jsxRuntime.jsx(
4508
+ "rect",
4509
+ {
4510
+ x: ox,
4511
+ y: oy,
4512
+ width: pageWidth,
4513
+ height: pageHeight,
4514
+ rx: 4,
4515
+ ry: 4,
4516
+ fill: "none",
4517
+ stroke: color,
4518
+ strokeWidth: 2
4519
+ }
4520
+ ),
4521
+ /* @__PURE__ */ jsxRuntime.jsx(
4522
+ "rect",
4523
+ {
4524
+ x: ox,
4525
+ y: oy,
4526
+ width: pageWidth,
4527
+ height: 24,
4528
+ rx: 4,
4529
+ ry: 4,
4530
+ fill: color,
4531
+ opacity: 0.1
4532
+ }
4533
+ ),
4534
+ /* @__PURE__ */ jsxRuntime.jsx(
4535
+ "text",
4536
+ {
4537
+ x: ox + pageWidth / 2,
4538
+ y: oy + 16,
4539
+ textAnchor: "middle",
4540
+ fill: color,
4541
+ fontSize: 10,
4542
+ fontFamily: "inherit",
4543
+ fontWeight: "bold",
4544
+ children: "Page Layout"
4545
+ }
4546
+ ),
4547
+ slots.map((slot) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
4548
+ /* @__PURE__ */ jsxRuntime.jsx(
4549
+ "rect",
4550
+ {
4551
+ x: ox + slot.x,
4552
+ y: oy + 24 + slot.y,
4553
+ width: slot.width,
4554
+ height: slot.height,
4555
+ rx: 3,
4556
+ ry: 3,
4557
+ fill: color,
4558
+ opacity: 0.08,
4559
+ stroke: color,
4560
+ strokeWidth: 1,
4561
+ strokeDasharray: "4 2",
4562
+ style: animated ? { animation: "avl-slot-pulse 2s ease-in-out infinite" } : void 0
4563
+ }
4564
+ ),
4565
+ /* @__PURE__ */ jsxRuntime.jsx(
4566
+ "text",
4567
+ {
4568
+ x: ox + slot.x + slot.width / 2,
4569
+ y: oy + 24 + slot.y + slot.height / 2,
4570
+ textAnchor: "middle",
4571
+ dominantBaseline: "central",
4572
+ fill: color,
4573
+ fontSize: 9,
4574
+ fontFamily: "inherit",
4575
+ opacity: 0.6,
4576
+ children: slot.name
4577
+ }
4578
+ )
4579
+ ] }, slot.name))
4580
+ ] });
4581
+ };
4582
+ AvlSlotMap.displayName = "AvlSlotMap";
4583
+ var avlEtId = 0;
4584
+ function layoutTree(node, x, y, hSpacing, vSpacing) {
4585
+ const children = node.children ?? [];
4586
+ if (children.length === 0) {
4587
+ return { label: node.label, type: node.type, x, y, children: [] };
4588
+ }
4589
+ const totalWidth = (children.length - 1) * hSpacing;
4590
+ const startX = x - totalWidth / 2;
4591
+ const layoutChildren = children.map(
4592
+ (child, i) => layoutTree(child, startX + i * hSpacing, y + vSpacing, hSpacing * 0.65, vSpacing)
4593
+ );
4594
+ return { label: node.label, type: node.type, x, y, children: layoutChildren };
4595
+ }
4596
+ function nodeColor(type, baseColor) {
4597
+ switch (type) {
4598
+ case "operator":
4599
+ return baseColor;
4600
+ case "literal":
4601
+ return baseColor;
4602
+ case "binding":
4603
+ return baseColor;
4604
+ }
4605
+ }
4606
+ function renderNode(node, color, glowId) {
4607
+ const labelLen = node.label.length;
4608
+ const baseR = node.type === "operator" ? 20 : 16;
4609
+ const r = Math.max(baseR, labelLen * 3.5 + 6);
4610
+ const nc = nodeColor(node.type, color);
4611
+ return /* @__PURE__ */ jsxRuntime.jsxs(React24__default.default.Fragment, { children: [
4612
+ node.children.map((child, i) => {
4613
+ const childR = Math.max(
4614
+ child.type === "operator" ? 20 : 16,
4615
+ child.label.length * 3.5 + 6
4616
+ );
4617
+ return /* @__PURE__ */ jsxRuntime.jsx(
4618
+ "line",
4619
+ {
4620
+ x1: node.x,
4621
+ y1: node.y + (node.type === "operator" ? r * 0.7 : r),
4622
+ x2: child.x,
4623
+ y2: child.y - (child.type === "operator" ? childR * 0.7 : childR),
4624
+ stroke: color,
4625
+ strokeWidth: 1,
4626
+ opacity: 0.3
4627
+ },
4628
+ `line-${i}`
4629
+ );
4630
+ }),
4631
+ node.type === "operator" ? /* @__PURE__ */ jsxRuntime.jsx(
4632
+ "rect",
4633
+ {
4634
+ x: node.x - r,
4635
+ y: node.y - r * 0.6,
4636
+ width: r * 2,
4637
+ height: r * 1.2,
4638
+ rx: 4,
4639
+ ry: 4,
4640
+ fill: color,
4641
+ fillOpacity: 0.15,
4642
+ stroke: nc,
4643
+ strokeWidth: 1.5
4644
+ }
4645
+ ) : node.type === "binding" ? /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: node.x, cy: node.y, r, fill: "none", stroke: nc, strokeWidth: 1.5, strokeDasharray: "3 2" }) : /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: node.x, cy: node.y, r, fill: "none", stroke: nc, strokeWidth: 1, opacity: 0.5 }),
4646
+ /* @__PURE__ */ jsxRuntime.jsx(
4647
+ "text",
4648
+ {
4649
+ x: node.x,
4650
+ y: node.y + 1,
4651
+ textAnchor: "middle",
4652
+ dominantBaseline: "central",
4653
+ fill: nc,
4654
+ fontSize: node.type === "operator" ? 11 : 10,
4655
+ fontFamily: "inherit",
4656
+ fontWeight: node.type === "operator" ? "bold" : "normal",
4657
+ children: node.type === "binding" ? `@${node.label}` : node.label
4658
+ }
4659
+ ),
4660
+ node.children.map((child) => renderNode(child, color))
4661
+ ] }, `${node.label}-${node.x}-${node.y}`);
4662
+ }
4663
+ var AvlExprTree = ({
4664
+ expression,
4665
+ className,
4666
+ color = "var(--color-primary)"
4667
+ }) => {
4668
+ const ids = React24__default.default.useMemo(() => {
4669
+ avlEtId += 1;
4670
+ return { glow: `avl-et-${avlEtId}-glow` };
4671
+ }, []);
4672
+ const layout = layoutTree(expression, 300, 70, 150, 85);
4673
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4674
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
4675
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
4676
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
4677
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
4678
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
4679
+ ] })
4680
+ ] }) }),
4681
+ renderNode(layout, color, ids.glow)
4682
+ ] });
4683
+ };
4684
+ AvlExprTree.displayName = "AvlExprTree";
4685
+
2941
4686
  exports.AIGenerates = AIGenerates;
4687
+ exports.AvlApplication = AvlApplication;
4688
+ exports.AvlBinding = AvlBinding;
4689
+ exports.AvlBindingRef = AvlBindingRef;
4690
+ exports.AvlClosedCircuit = AvlClosedCircuit;
4691
+ exports.AvlEffect = AvlEffect;
4692
+ exports.AvlEmitListen = AvlEmitListen;
4693
+ exports.AvlEntity = AvlEntity;
4694
+ exports.AvlEvent = AvlEvent;
4695
+ exports.AvlExprTree = AvlExprTree;
4696
+ exports.AvlField = AvlField;
4697
+ exports.AvlFieldType = AvlFieldType;
4698
+ exports.AvlGuard = AvlGuard;
4699
+ exports.AvlLiteral = AvlLiteral;
4700
+ exports.AvlOperator = AvlOperator;
4701
+ exports.AvlOrbital = AvlOrbital;
4702
+ exports.AvlOrbitalUnit = AvlOrbitalUnit;
4703
+ exports.AvlPage = AvlPage;
4704
+ exports.AvlPersistence = AvlPersistence;
4705
+ exports.AvlSExpr = AvlSExpr;
4706
+ exports.AvlSlotMap = AvlSlotMap;
4707
+ exports.AvlState = AvlState;
4708
+ exports.AvlStateMachine = AvlStateMachine;
4709
+ exports.AvlTrait = AvlTrait;
4710
+ exports.AvlTransition = AvlTransition;
2942
4711
  exports.ClosedCircuit = ClosedCircuit;
2943
4712
  exports.CommunityOwnership = CommunityOwnership;
2944
4713
  exports.CompileAnywhere = CompileAnywhere;