@almadar/ui 2.15.13 → 2.16.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.
Files changed (51) hide show
  1. package/dist/avl/index.cjs +1927 -0
  2. package/dist/avl/index.d.cts +314 -0
  3. package/dist/avl/index.d.ts +33 -0
  4. package/dist/avl/index.js +1891 -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/index.cjs +131 -2411
  26. package/dist/components/index.css +0 -508
  27. package/dist/components/index.js +132 -2411
  28. package/dist/components/molecules/avl/AvlClosedCircuit.d.ts +20 -0
  29. package/dist/components/molecules/avl/AvlEmitListen.d.ts +16 -0
  30. package/dist/components/molecules/avl/AvlExprTree.d.ts +13 -0
  31. package/dist/components/molecules/avl/AvlOrbitalUnit.d.ts +20 -0
  32. package/dist/components/molecules/avl/AvlSlotMap.d.ts +18 -0
  33. package/dist/components/molecules/avl/AvlStateMachine.d.ts +22 -0
  34. package/dist/components/molecules/avl/avl-layout.d.ts +32 -0
  35. package/dist/components/molecules/avl/index.d.ts +7 -0
  36. package/dist/components/organisms/component-registry.generated.d.ts +1 -1
  37. package/dist/components/organisms/game/three/index.cjs +1067 -0
  38. package/dist/components/organisms/game/three/index.css +192 -0
  39. package/dist/components/organisms/game/three/index.d.ts +4 -0
  40. package/dist/components/organisms/game/three/index.js +1068 -5
  41. package/dist/illustrations/index.cjs +1879 -20
  42. package/dist/illustrations/index.d.cts +277 -1
  43. package/dist/illustrations/index.d.ts +24 -0
  44. package/dist/illustrations/index.js +1855 -20
  45. package/dist/providers/index.cjs +152 -1521
  46. package/dist/providers/index.css +0 -508
  47. package/dist/providers/index.js +62 -1430
  48. package/dist/runtime/index.cjs +145 -1514
  49. package/dist/runtime/index.css +0 -508
  50. package/dist/runtime/index.js +63 -1431
  51. package/package.json +6 -1
@@ -0,0 +1,1927 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React6 = require('react');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var React6__default = /*#__PURE__*/_interopDefault(React6);
9
+
10
+ // components/atoms/avl/types.ts
11
+ var AVL_OPERATOR_COLORS = {
12
+ arithmetic: "#4A90D9",
13
+ comparison: "#E8913A",
14
+ logic: "#9B59B6",
15
+ string: "#27AE60",
16
+ collection: "#1ABC9C",
17
+ time: "#F39C12",
18
+ control: "#E74C3C",
19
+ async: "#E91E8F"
20
+ };
21
+ var AVL_FIELD_TYPE_SHAPES = {
22
+ string: "circle",
23
+ number: "triangle",
24
+ boolean: "square",
25
+ date: "diamond",
26
+ enum: "ring",
27
+ object: "hexagon",
28
+ array: "bars"
29
+ };
30
+ var AvlOrbital = ({
31
+ cx = 0,
32
+ cy = 0,
33
+ r = 80,
34
+ label,
35
+ color = "var(--color-primary)",
36
+ opacity = 1,
37
+ className
38
+ }) => {
39
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
40
+ /* @__PURE__ */ jsxRuntime.jsx(
41
+ "circle",
42
+ {
43
+ cx,
44
+ cy,
45
+ r,
46
+ fill: "none",
47
+ stroke: color,
48
+ strokeWidth: 2
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsxRuntime.jsx(
52
+ "circle",
53
+ {
54
+ cx,
55
+ cy,
56
+ r,
57
+ fill: color,
58
+ opacity: 0.03
59
+ }
60
+ ),
61
+ label && /* @__PURE__ */ jsxRuntime.jsx(
62
+ "text",
63
+ {
64
+ x: cx,
65
+ y: cy - r - 8,
66
+ textAnchor: "middle",
67
+ fill: color,
68
+ fontSize: 11,
69
+ fontFamily: "inherit",
70
+ fontWeight: "bold",
71
+ children: label
72
+ }
73
+ )
74
+ ] });
75
+ };
76
+ AvlOrbital.displayName = "AvlOrbital";
77
+ function persistenceStroke(kind) {
78
+ switch (kind) {
79
+ case "persistent":
80
+ return { strokeWidth: 2.5 };
81
+ case "runtime":
82
+ return { strokeDasharray: "6 3", strokeWidth: 2 };
83
+ case "singleton":
84
+ return { strokeWidth: 3.5 };
85
+ case "instance":
86
+ return { strokeDasharray: "2 3", strokeWidth: 2 };
87
+ }
88
+ }
89
+ var AvlEntity = ({
90
+ x = 0,
91
+ y = 0,
92
+ r = 18,
93
+ fieldCount = 0,
94
+ persistence = "persistent",
95
+ label,
96
+ color = "var(--color-primary)",
97
+ opacity = 1,
98
+ className
99
+ }) => {
100
+ const strokeProps = persistenceStroke(persistence);
101
+ const facets = Array.from({ length: fieldCount }, (_, i) => {
102
+ const angle = Math.PI * 2 * i / fieldCount - Math.PI / 2;
103
+ const innerR = r + 2;
104
+ const outerR = r + 10;
105
+ return {
106
+ x1: x + innerR * Math.cos(angle),
107
+ y1: y + innerR * Math.sin(angle),
108
+ x2: x + outerR * Math.cos(angle),
109
+ y2: y + outerR * Math.sin(angle)
110
+ };
111
+ });
112
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
113
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r, fill: color, opacity: 0.15 }),
114
+ /* @__PURE__ */ jsxRuntime.jsx(
115
+ "circle",
116
+ {
117
+ cx: x,
118
+ cy: y,
119
+ r,
120
+ fill: "none",
121
+ stroke: color,
122
+ strokeWidth: strokeProps.strokeWidth,
123
+ strokeDasharray: strokeProps.strokeDasharray
124
+ }
125
+ ),
126
+ persistence === "singleton" && /* @__PURE__ */ jsxRuntime.jsx(
127
+ "circle",
128
+ {
129
+ cx: x,
130
+ cy: y,
131
+ r: r - 4,
132
+ fill: "none",
133
+ stroke: color,
134
+ strokeWidth: 1.5
135
+ }
136
+ ),
137
+ facets.map((f, i) => /* @__PURE__ */ jsxRuntime.jsx(
138
+ "line",
139
+ {
140
+ x1: f.x1,
141
+ y1: f.y1,
142
+ x2: f.x2,
143
+ y2: f.y2,
144
+ stroke: color,
145
+ strokeWidth: 1,
146
+ opacity: 0.6
147
+ },
148
+ i
149
+ )),
150
+ label && /* @__PURE__ */ jsxRuntime.jsx(
151
+ "text",
152
+ {
153
+ x,
154
+ y: y + r + (fieldCount > 0 ? 18 : 14),
155
+ textAnchor: "middle",
156
+ fill: color,
157
+ fontSize: 10,
158
+ fontFamily: "inherit",
159
+ fontWeight: "bold",
160
+ children: label
161
+ }
162
+ )
163
+ ] });
164
+ };
165
+ AvlEntity.displayName = "AvlEntity";
166
+ var AvlTrait = ({
167
+ cx = 0,
168
+ cy = 0,
169
+ rx = 60,
170
+ ry = 30,
171
+ rotation = 0,
172
+ label,
173
+ color = "var(--color-primary)",
174
+ opacity = 1,
175
+ className
176
+ }) => {
177
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, transform: `rotate(${rotation},${cx},${cy})`, children: [
178
+ /* @__PURE__ */ jsxRuntime.jsx(
179
+ "ellipse",
180
+ {
181
+ cx,
182
+ cy,
183
+ rx,
184
+ ry,
185
+ fill: "none",
186
+ stroke: color,
187
+ strokeWidth: 1.5,
188
+ strokeDasharray: "4 2"
189
+ }
190
+ ),
191
+ label && /* @__PURE__ */ jsxRuntime.jsx(
192
+ "text",
193
+ {
194
+ x: cx - rx - 6,
195
+ y: cy,
196
+ textAnchor: "end",
197
+ dominantBaseline: "central",
198
+ fill: color,
199
+ fontSize: 9,
200
+ fontFamily: "inherit",
201
+ opacity: 0.8,
202
+ transform: `rotate(${-rotation},${cx - rx - 6},${cy})`,
203
+ children: label
204
+ }
205
+ )
206
+ ] });
207
+ };
208
+ AvlTrait.displayName = "AvlTrait";
209
+ var AvlPage = ({
210
+ x = 0,
211
+ y = 0,
212
+ size = 12,
213
+ label,
214
+ color = "var(--color-primary)",
215
+ opacity = 1,
216
+ className
217
+ }) => {
218
+ const half = size / 2;
219
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
220
+ /* @__PURE__ */ jsxRuntime.jsx(
221
+ "rect",
222
+ {
223
+ x: x - half,
224
+ y: y - half,
225
+ width: size,
226
+ height: size,
227
+ fill: color,
228
+ opacity: 0.3,
229
+ stroke: color,
230
+ strokeWidth: 1.5
231
+ }
232
+ ),
233
+ label && /* @__PURE__ */ jsxRuntime.jsx(
234
+ "text",
235
+ {
236
+ x,
237
+ y: y + half + 12,
238
+ textAnchor: "middle",
239
+ fill: color,
240
+ fontSize: 8,
241
+ fontFamily: "inherit",
242
+ children: label
243
+ }
244
+ )
245
+ ] });
246
+ };
247
+ AvlPage.displayName = "AvlPage";
248
+ var AvlApplication = ({
249
+ x = 0,
250
+ y = 0,
251
+ width = 500,
252
+ height = 350,
253
+ label,
254
+ color = "var(--color-primary)",
255
+ opacity = 1,
256
+ className
257
+ }) => {
258
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
259
+ /* @__PURE__ */ jsxRuntime.jsx(
260
+ "rect",
261
+ {
262
+ x,
263
+ y,
264
+ width,
265
+ height,
266
+ rx: 12,
267
+ ry: 12,
268
+ fill: "none",
269
+ stroke: color,
270
+ strokeWidth: 3
271
+ }
272
+ ),
273
+ /* @__PURE__ */ jsxRuntime.jsx(
274
+ "rect",
275
+ {
276
+ x,
277
+ y,
278
+ width,
279
+ height,
280
+ rx: 12,
281
+ ry: 12,
282
+ fill: color,
283
+ opacity: 0.02
284
+ }
285
+ ),
286
+ label && /* @__PURE__ */ jsxRuntime.jsx(
287
+ "text",
288
+ {
289
+ x: x + 16,
290
+ y: y + 20,
291
+ fill: color,
292
+ fontSize: 12,
293
+ fontFamily: "inherit",
294
+ fontWeight: "bold",
295
+ children: label
296
+ }
297
+ )
298
+ ] });
299
+ };
300
+ AvlApplication.displayName = "AvlApplication";
301
+ var AvlState = ({
302
+ x = 0,
303
+ y = 0,
304
+ name,
305
+ isInitial = false,
306
+ isTerminal = false,
307
+ width = 100,
308
+ height = 40,
309
+ color = "var(--color-primary)",
310
+ opacity = 1,
311
+ className
312
+ }) => {
313
+ const rx = height / 2;
314
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, transform: `translate(${x},${y})`, children: [
315
+ isInitial && /* @__PURE__ */ jsxRuntime.jsx(
316
+ "circle",
317
+ {
318
+ cx: -16,
319
+ cy: height / 2,
320
+ r: 6,
321
+ fill: color
322
+ }
323
+ ),
324
+ isTerminal && /* @__PURE__ */ jsxRuntime.jsx(
325
+ "rect",
326
+ {
327
+ x: -4,
328
+ y: -4,
329
+ width: width + 8,
330
+ height: height + 8,
331
+ rx: rx + 4,
332
+ ry: rx + 4,
333
+ fill: "none",
334
+ stroke: color,
335
+ strokeWidth: 1,
336
+ opacity: 0.5
337
+ }
338
+ ),
339
+ /* @__PURE__ */ jsxRuntime.jsx(
340
+ "rect",
341
+ {
342
+ x: 0,
343
+ y: 0,
344
+ width,
345
+ height,
346
+ rx,
347
+ ry: rx,
348
+ fill: "none",
349
+ stroke: color,
350
+ strokeWidth: 2
351
+ }
352
+ ),
353
+ name && /* @__PURE__ */ jsxRuntime.jsx(
354
+ "text",
355
+ {
356
+ x: width / 2,
357
+ y: height / 2,
358
+ textAnchor: "middle",
359
+ dominantBaseline: "central",
360
+ fill: color,
361
+ fontSize: 11,
362
+ fontFamily: "inherit",
363
+ children: name
364
+ }
365
+ )
366
+ ] });
367
+ };
368
+ AvlState.displayName = "AvlState";
369
+ var avlTransitionId = 0;
370
+ var AvlTransition = ({
371
+ x1,
372
+ y1,
373
+ x2,
374
+ y2,
375
+ curved = false,
376
+ curveAwayFrom,
377
+ label,
378
+ color = "var(--color-primary)",
379
+ opacity = 1,
380
+ className
381
+ }) => {
382
+ const ids = React6__default.default.useMemo(() => {
383
+ avlTransitionId += 1;
384
+ return { arrow: `avl-tr-${avlTransitionId}-arrow` };
385
+ }, []);
386
+ const mx = (x1 + x2) / 2;
387
+ const my = (y1 + y2) / 2;
388
+ const dx = x2 - x1;
389
+ const dy = y2 - y1;
390
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
391
+ const curvature = len * 0.2;
392
+ let perpX = -dy / len;
393
+ let perpY = dx / len;
394
+ if (curveAwayFrom) {
395
+ const testX = mx + perpX * curvature;
396
+ const testY = my + perpY * curvature;
397
+ const distTest = Math.sqrt((testX - curveAwayFrom.x) ** 2 + (testY - curveAwayFrom.y) ** 2);
398
+ const distMid = Math.sqrt((mx - curveAwayFrom.x) ** 2 + (my - curveAwayFrom.y) ** 2);
399
+ if (distTest < distMid) {
400
+ perpX = -perpX;
401
+ perpY = -perpY;
402
+ }
403
+ }
404
+ const cpx = mx + perpX * curvature;
405
+ const cpy = my + perpY * curvature;
406
+ const d = curved ? `M${x1},${y1} Q${cpx},${cpy} ${x2},${y2}` : `M${x1},${y1} L${x2},${y2}`;
407
+ const labelX = curved ? (x1 + 2 * cpx + x2) / 4 : mx;
408
+ const labelY = curved ? (y1 + 2 * cpy + y2) / 4 : my;
409
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
410
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
411
+ "marker",
412
+ {
413
+ id: ids.arrow,
414
+ markerWidth: "8",
415
+ markerHeight: "6",
416
+ refX: "7",
417
+ refY: "3",
418
+ orient: "auto",
419
+ markerUnits: "strokeWidth",
420
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color })
421
+ }
422
+ ) }),
423
+ /* @__PURE__ */ jsxRuntime.jsx(
424
+ "path",
425
+ {
426
+ d,
427
+ fill: "none",
428
+ stroke: color,
429
+ strokeWidth: 1.5,
430
+ markerEnd: `url(#${ids.arrow})`
431
+ }
432
+ ),
433
+ label && /* @__PURE__ */ jsxRuntime.jsx(
434
+ "text",
435
+ {
436
+ x: labelX,
437
+ y: labelY - 6,
438
+ textAnchor: "middle",
439
+ fill: color,
440
+ fontSize: 9,
441
+ fontFamily: "inherit",
442
+ opacity: 0.8,
443
+ children: label
444
+ }
445
+ )
446
+ ] });
447
+ };
448
+ AvlTransition.displayName = "AvlTransition";
449
+ var AvlEvent = ({
450
+ x = 0,
451
+ y = 0,
452
+ size = 16,
453
+ label,
454
+ color = "var(--color-primary)",
455
+ opacity = 1,
456
+ className
457
+ }) => {
458
+ const s = size / 16;
459
+ const bolt = [
460
+ `M${x - 2 * s},${y - 8 * s}`,
461
+ `L${x + 4 * s},${y - 8 * s}`,
462
+ `L${x + 1 * s},${y - 1 * s}`,
463
+ `L${x + 5 * s},${y - 1 * s}`,
464
+ `L${x - 3 * s},${y + 8 * s}`,
465
+ `L${x},${y + 1 * s}`,
466
+ `L${x - 4 * s},${y + 1 * s}`,
467
+ "Z"
468
+ ].join(" ");
469
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
470
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: bolt, fill: color }),
471
+ label && /* @__PURE__ */ jsxRuntime.jsx(
472
+ "text",
473
+ {
474
+ x,
475
+ y: y + size / 2 + 12,
476
+ textAnchor: "middle",
477
+ fill: color,
478
+ fontSize: 9,
479
+ fontFamily: "inherit",
480
+ children: label
481
+ }
482
+ )
483
+ ] });
484
+ };
485
+ AvlEvent.displayName = "AvlEvent";
486
+ var AvlGuard = ({
487
+ x = 0,
488
+ y = 0,
489
+ size = 24,
490
+ label,
491
+ color = "var(--color-primary)",
492
+ opacity = 1,
493
+ className
494
+ }) => {
495
+ const h = size / 2;
496
+ const points = `${x},${y - h} ${x + h},${y} ${x},${y + h} ${x - h},${y}`;
497
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
498
+ /* @__PURE__ */ jsxRuntime.jsx(
499
+ "polygon",
500
+ {
501
+ points,
502
+ fill: "none",
503
+ stroke: color,
504
+ strokeWidth: 2,
505
+ strokeLinejoin: "round"
506
+ }
507
+ ),
508
+ label && /* @__PURE__ */ jsxRuntime.jsx(
509
+ "text",
510
+ {
511
+ x,
512
+ y,
513
+ textAnchor: "middle",
514
+ dominantBaseline: "central",
515
+ fill: color,
516
+ fontSize: 8,
517
+ fontFamily: "inherit",
518
+ children: label
519
+ }
520
+ )
521
+ ] });
522
+ };
523
+ AvlGuard.displayName = "AvlGuard";
524
+ function effectIcon(type, x, y, s, color) {
525
+ switch (type) {
526
+ case "render-ui":
527
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
528
+ /* @__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 }),
529
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x, y1: y - s, x2: x, y2: y + s, stroke: color, strokeWidth: 1 }),
530
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 1 })
531
+ ] });
532
+ case "set":
533
+ return /* @__PURE__ */ jsxRuntime.jsx(
534
+ "path",
535
+ {
536
+ 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`,
537
+ fill: "none",
538
+ stroke: color,
539
+ strokeWidth: 1.5,
540
+ strokeLinejoin: "round"
541
+ }
542
+ );
543
+ case "persist":
544
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
545
+ /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: x, cy: y - s * 0.6, rx: s, ry: s * 0.4, fill: "none", stroke: color, strokeWidth: 1.5 }),
546
+ /* @__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 }),
547
+ /* @__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 }),
548
+ /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: x, cy: y + s * 0.4, rx: s, ry: s * 0.4, fill: "none", stroke: color, strokeWidth: 1.5 })
549
+ ] });
550
+ case "fetch":
551
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
552
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x, y1: y - s, x2: x, y2: y + s * 0.6, stroke: color, strokeWidth: 1.5 }),
553
+ /* @__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" })
554
+ ] });
555
+ case "emit":
556
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
557
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s * 0.3, fill: color }),
558
+ /* @__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 }),
559
+ /* @__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 })
560
+ ] });
561
+ case "navigate":
562
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
563
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y, x2: x + s * 0.6, y2: y, stroke: color, strokeWidth: 1.5 }),
564
+ /* @__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" })
565
+ ] });
566
+ case "notify":
567
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
568
+ /* @__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 }),
569
+ /* @__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 }),
570
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y + s * 0.7, r: s * 0.2, fill: color })
571
+ ] });
572
+ case "call-service":
573
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
574
+ /* @__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 }),
575
+ /* @__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" }),
576
+ /* @__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 }),
577
+ /* @__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" })
578
+ ] });
579
+ case "spawn":
580
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
581
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
582
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s * 0.5, y1: y, x2: x + s * 0.5, y2: y, stroke: color, strokeWidth: 1.5 }),
583
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x, y1: y - s * 0.5, x2: x, y2: y + s * 0.5, stroke: color, strokeWidth: 1.5 })
584
+ ] });
585
+ case "despawn":
586
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
587
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
588
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s * 0.5, y1: y, x2: x + s * 0.5, y2: y, stroke: color, strokeWidth: 1.5 })
589
+ ] });
590
+ case "do":
591
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
592
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
593
+ /* @__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 })
594
+ ] });
595
+ case "if":
596
+ return /* @__PURE__ */ jsxRuntime.jsx(
597
+ "polygon",
598
+ {
599
+ points: `${x},${y - s} ${x + s * 0.7},${y} ${x},${y + s} ${x - s * 0.7},${y}`,
600
+ fill: "none",
601
+ stroke: color,
602
+ strokeWidth: 1.5,
603
+ strokeLinejoin: "round"
604
+ }
605
+ );
606
+ case "log":
607
+ return /* @__PURE__ */ jsxRuntime.jsx(
608
+ "text",
609
+ {
610
+ x,
611
+ y,
612
+ textAnchor: "middle",
613
+ dominantBaseline: "central",
614
+ fill: color,
615
+ fontSize: s * 2.2,
616
+ fontFamily: "serif",
617
+ children: "\xB6"
618
+ }
619
+ );
620
+ }
621
+ }
622
+ var AvlEffect = ({
623
+ x = 0,
624
+ y = 0,
625
+ effectType,
626
+ size = 8,
627
+ label,
628
+ color = "var(--color-primary)",
629
+ opacity = 1,
630
+ className
631
+ }) => {
632
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
633
+ effectIcon(effectType, x, y, size, color),
634
+ label && /* @__PURE__ */ jsxRuntime.jsx(
635
+ "text",
636
+ {
637
+ x,
638
+ y: y + size + 10,
639
+ textAnchor: "middle",
640
+ fill: color,
641
+ fontSize: 8,
642
+ fontFamily: "inherit",
643
+ opacity: 0.7,
644
+ children: label
645
+ }
646
+ )
647
+ ] });
648
+ };
649
+ AvlEffect.displayName = "AvlEffect";
650
+ var AvlField = ({
651
+ x = 0,
652
+ y = 0,
653
+ angle = 0,
654
+ length = 30,
655
+ required = true,
656
+ label,
657
+ color = "var(--color-primary)",
658
+ opacity = 1,
659
+ className
660
+ }) => {
661
+ const x2 = x + length * Math.cos(angle);
662
+ const y2 = y + length * Math.sin(angle);
663
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
664
+ /* @__PURE__ */ jsxRuntime.jsx(
665
+ "line",
666
+ {
667
+ x1: x,
668
+ y1: y,
669
+ x2,
670
+ y2,
671
+ stroke: color,
672
+ strokeWidth: 1.5,
673
+ strokeDasharray: required ? void 0 : "3 2"
674
+ }
675
+ ),
676
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x2, cy: y2, r: 2.5, fill: color, opacity: 0.6 }),
677
+ label && /* @__PURE__ */ jsxRuntime.jsx(
678
+ "text",
679
+ {
680
+ x: x2 + 6 * Math.cos(angle),
681
+ y: y2 + 6 * Math.sin(angle),
682
+ textAnchor: Math.cos(angle) >= 0 ? "start" : "end",
683
+ dominantBaseline: "central",
684
+ fill: color,
685
+ fontSize: 8,
686
+ fontFamily: "inherit",
687
+ opacity: 0.7,
688
+ children: label
689
+ }
690
+ )
691
+ ] });
692
+ };
693
+ AvlField.displayName = "AvlField";
694
+ function typeShape(kind, x, y, s, color) {
695
+ switch (kind) {
696
+ case "string":
697
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: color });
698
+ case "number":
699
+ return /* @__PURE__ */ jsxRuntime.jsx(
700
+ "polygon",
701
+ {
702
+ points: `${x},${y - s} ${x + s},${y + s * 0.7} ${x - s},${y + s * 0.7}`,
703
+ fill: color
704
+ }
705
+ );
706
+ case "boolean":
707
+ 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 });
708
+ case "date":
709
+ return /* @__PURE__ */ jsxRuntime.jsx(
710
+ "polygon",
711
+ {
712
+ points: `${x},${y - s} ${x + s},${y} ${x},${y + s} ${x - s},${y}`,
713
+ fill: color
714
+ }
715
+ );
716
+ case "enum":
717
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 });
718
+ case "object":
719
+ return /* @__PURE__ */ jsxRuntime.jsx(
720
+ "polygon",
721
+ {
722
+ points: Array.from({ length: 6 }, (_, i) => {
723
+ const a = Math.PI * 2 * i / 6 - Math.PI / 6;
724
+ return `${x + s * Math.cos(a)},${y + s * Math.sin(a)}`;
725
+ }).join(" "),
726
+ fill: color,
727
+ opacity: 0.8
728
+ }
729
+ );
730
+ case "array":
731
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
732
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y - s * 0.6, x2: x + s, y2: y - s * 0.6, stroke: color, strokeWidth: 2 }),
733
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 2 }),
734
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x - s, y1: y + s * 0.6, x2: x + s, y2: y + s * 0.6, stroke: color, strokeWidth: 2 })
735
+ ] });
736
+ }
737
+ }
738
+ var AvlFieldType = ({
739
+ x = 0,
740
+ y = 0,
741
+ kind,
742
+ size = 5,
743
+ label,
744
+ color = "var(--color-primary)",
745
+ opacity = 1,
746
+ className
747
+ }) => {
748
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
749
+ typeShape(kind, x, y, size, color),
750
+ label && /* @__PURE__ */ jsxRuntime.jsx(
751
+ "text",
752
+ {
753
+ x,
754
+ y: y + size + 10,
755
+ textAnchor: "middle",
756
+ fill: color,
757
+ fontSize: 8,
758
+ fontFamily: "inherit",
759
+ opacity: 0.7,
760
+ children: label
761
+ }
762
+ )
763
+ ] });
764
+ };
765
+ AvlFieldType.displayName = "AvlFieldType";
766
+ var AvlBinding = ({
767
+ x1,
768
+ y1,
769
+ x2,
770
+ y2,
771
+ label,
772
+ color = "var(--color-primary)",
773
+ opacity = 1,
774
+ className
775
+ }) => {
776
+ const mx = (x1 + x2) / 2;
777
+ const my = (y1 + y2) / 2;
778
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
779
+ /* @__PURE__ */ jsxRuntime.jsx(
780
+ "line",
781
+ {
782
+ x1,
783
+ y1,
784
+ x2,
785
+ y2,
786
+ stroke: color,
787
+ strokeWidth: 1,
788
+ strokeDasharray: "2 3",
789
+ opacity: 0.6
790
+ }
791
+ ),
792
+ /* @__PURE__ */ jsxRuntime.jsx(
793
+ "text",
794
+ {
795
+ x: mx,
796
+ y: my - 4,
797
+ textAnchor: "middle",
798
+ fill: color,
799
+ fontSize: 10,
800
+ fontFamily: "inherit",
801
+ fontWeight: "bold",
802
+ children: "@"
803
+ }
804
+ ),
805
+ label && /* @__PURE__ */ jsxRuntime.jsx(
806
+ "text",
807
+ {
808
+ x: mx,
809
+ y: my + 10,
810
+ textAnchor: "middle",
811
+ fill: color,
812
+ fontSize: 8,
813
+ fontFamily: "inherit",
814
+ opacity: 0.6,
815
+ children: label
816
+ }
817
+ )
818
+ ] });
819
+ };
820
+ AvlBinding.displayName = "AvlBinding";
821
+ var AvlPersistence = ({
822
+ x = 0,
823
+ y = 0,
824
+ kind,
825
+ size = 20,
826
+ label,
827
+ color = "var(--color-primary)",
828
+ opacity = 1,
829
+ className
830
+ }) => {
831
+ const half = size / 2;
832
+ const strokeProps = (() => {
833
+ switch (kind) {
834
+ case "persistent":
835
+ return { strokeWidth: 2.5 };
836
+ case "runtime":
837
+ return { strokeDasharray: "6 3", strokeWidth: 2 };
838
+ case "singleton":
839
+ return { strokeWidth: 3 };
840
+ case "instance":
841
+ return { strokeDasharray: "2 3", strokeWidth: 2 };
842
+ }
843
+ })();
844
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
845
+ /* @__PURE__ */ jsxRuntime.jsx(
846
+ "line",
847
+ {
848
+ x1: x - half,
849
+ y1: y,
850
+ x2: x + half,
851
+ y2: y,
852
+ stroke: color,
853
+ strokeWidth: strokeProps.strokeWidth,
854
+ strokeDasharray: strokeProps.strokeDasharray,
855
+ strokeLinecap: "round"
856
+ }
857
+ ),
858
+ kind === "singleton" && /* @__PURE__ */ jsxRuntime.jsx(
859
+ "line",
860
+ {
861
+ x1: x - half,
862
+ y1: y + 5,
863
+ x2: x + half,
864
+ y2: y + 5,
865
+ stroke: color,
866
+ strokeWidth: 1.5,
867
+ strokeLinecap: "round"
868
+ }
869
+ ),
870
+ label && /* @__PURE__ */ jsxRuntime.jsx(
871
+ "text",
872
+ {
873
+ x,
874
+ y: y + (kind === "singleton" ? 20 : 14),
875
+ textAnchor: "middle",
876
+ fill: color,
877
+ fontSize: 8,
878
+ fontFamily: "inherit",
879
+ opacity: 0.7,
880
+ children: label
881
+ }
882
+ )
883
+ ] });
884
+ };
885
+ AvlPersistence.displayName = "AvlPersistence";
886
+ var AvlOperator = ({
887
+ x = 0,
888
+ y = 0,
889
+ name,
890
+ namespace = "arithmetic",
891
+ size = 16,
892
+ color,
893
+ opacity = 1,
894
+ className
895
+ }) => {
896
+ const opColor = color ?? AVL_OPERATOR_COLORS[namespace];
897
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
898
+ /* @__PURE__ */ jsxRuntime.jsx(
899
+ "rect",
900
+ {
901
+ x: x - size,
902
+ y: y - size * 0.7,
903
+ width: size * 2,
904
+ height: size * 1.4,
905
+ rx: 4,
906
+ ry: 4,
907
+ fill: opColor,
908
+ fillOpacity: 0.15,
909
+ stroke: opColor,
910
+ strokeWidth: 1.5
911
+ }
912
+ ),
913
+ /* @__PURE__ */ jsxRuntime.jsx(
914
+ "text",
915
+ {
916
+ x,
917
+ y: y + 1,
918
+ textAnchor: "middle",
919
+ dominantBaseline: "central",
920
+ fill: opColor,
921
+ fontSize: size > 14 ? 10 : 8,
922
+ fontFamily: "inherit",
923
+ fontWeight: "bold",
924
+ children: name
925
+ }
926
+ )
927
+ ] });
928
+ };
929
+ AvlOperator.displayName = "AvlOperator";
930
+ var AvlSExpr = ({
931
+ x = 0,
932
+ y = 0,
933
+ width = 140,
934
+ height = 80,
935
+ label,
936
+ color = "var(--color-primary)",
937
+ opacity = 1,
938
+ className
939
+ }) => {
940
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
941
+ /* @__PURE__ */ jsxRuntime.jsx(
942
+ "rect",
943
+ {
944
+ x,
945
+ y,
946
+ width,
947
+ height,
948
+ rx: 6,
949
+ ry: 6,
950
+ fill: color,
951
+ fillOpacity: 0.05,
952
+ stroke: color,
953
+ strokeWidth: 1,
954
+ strokeDasharray: "6 3"
955
+ }
956
+ ),
957
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x + 12, cy: y + 12, r: 3, fill: color, opacity: 0.4 }),
958
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + 12, y1: y + 15, x2: x + 8, y2: y + 22, stroke: color, strokeWidth: 0.8, opacity: 0.3 }),
959
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + 12, y1: y + 15, x2: x + 16, y2: y + 22, stroke: color, strokeWidth: 0.8, opacity: 0.3 }),
960
+ label && /* @__PURE__ */ jsxRuntime.jsx(
961
+ "text",
962
+ {
963
+ x: x + width / 2,
964
+ y: y + height / 2,
965
+ textAnchor: "middle",
966
+ dominantBaseline: "central",
967
+ fill: color,
968
+ fontSize: 9,
969
+ fontFamily: "inherit",
970
+ opacity: 0.6,
971
+ children: label
972
+ }
973
+ )
974
+ ] });
975
+ };
976
+ AvlSExpr.displayName = "AvlSExpr";
977
+ var AvlLiteral = ({
978
+ x = 0,
979
+ y = 0,
980
+ value,
981
+ size = 12,
982
+ color = "var(--color-primary)",
983
+ opacity = 1,
984
+ className
985
+ }) => {
986
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
987
+ /* @__PURE__ */ jsxRuntime.jsx(
988
+ "circle",
989
+ {
990
+ cx: x,
991
+ cy: y,
992
+ r: size,
993
+ fill: "none",
994
+ stroke: color,
995
+ strokeWidth: 1,
996
+ opacity: 0.5
997
+ }
998
+ ),
999
+ /* @__PURE__ */ jsxRuntime.jsx(
1000
+ "text",
1001
+ {
1002
+ x,
1003
+ y: y + 1,
1004
+ textAnchor: "middle",
1005
+ dominantBaseline: "central",
1006
+ fill: color,
1007
+ fontSize: size > 10 ? 9 : 7,
1008
+ fontFamily: "inherit",
1009
+ children: value
1010
+ }
1011
+ )
1012
+ ] });
1013
+ };
1014
+ AvlLiteral.displayName = "AvlLiteral";
1015
+ var AvlBindingRef = ({
1016
+ x = 0,
1017
+ y = 0,
1018
+ path,
1019
+ size = 12,
1020
+ color = "var(--color-primary)",
1021
+ opacity = 1,
1022
+ className
1023
+ }) => {
1024
+ const fullLabel = `@${path}`;
1025
+ const autoR = Math.max(size, fullLabel.length * 3.5 + 4);
1026
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className, opacity, children: [
1027
+ /* @__PURE__ */ jsxRuntime.jsx(
1028
+ "circle",
1029
+ {
1030
+ cx: x,
1031
+ cy: y,
1032
+ r: autoR,
1033
+ fill: "none",
1034
+ stroke: color,
1035
+ strokeWidth: 1.5,
1036
+ strokeDasharray: "3 2"
1037
+ }
1038
+ ),
1039
+ /* @__PURE__ */ jsxRuntime.jsx(
1040
+ "text",
1041
+ {
1042
+ x,
1043
+ y: y + 1,
1044
+ textAnchor: "middle",
1045
+ dominantBaseline: "central",
1046
+ fill: color,
1047
+ fontSize: 10,
1048
+ fontFamily: "inherit",
1049
+ children: fullLabel
1050
+ }
1051
+ )
1052
+ ] });
1053
+ };
1054
+ AvlBindingRef.displayName = "AvlBindingRef";
1055
+
1056
+ // components/molecules/avl/avl-layout.ts
1057
+ function ringPositions(cx, cy, r, count, startAngle = -Math.PI / 2) {
1058
+ if (count === 0) return [];
1059
+ if (count === 1) {
1060
+ return [{ x: cx, y: cy, angle: 0 }];
1061
+ }
1062
+ if (count === 2) {
1063
+ return [
1064
+ { x: cx - r * 0.7, y: cy, angle: Math.PI },
1065
+ { x: cx + r * 0.7, y: cy, angle: 0 }
1066
+ ];
1067
+ }
1068
+ return Array.from({ length: count }, (_, i) => {
1069
+ const angle = startAngle + Math.PI * 2 * i / count;
1070
+ return {
1071
+ x: cx + r * Math.cos(angle),
1072
+ y: cy + r * Math.sin(angle),
1073
+ angle
1074
+ };
1075
+ });
1076
+ }
1077
+ function arcPath(cx, cy, r, startAngle, endAngle) {
1078
+ const x1 = cx + r * Math.cos(startAngle);
1079
+ const y1 = cy + r * Math.sin(startAngle);
1080
+ const x2 = cx + r * Math.cos(endAngle);
1081
+ const y2 = cy + r * Math.sin(endAngle);
1082
+ const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;
1083
+ return `M${x1},${y1} A${r},${r} 0 ${largeArc},1 ${x2},${y2}`;
1084
+ }
1085
+ function radialPositions(cx, cy, innerR, outerR, count, startAngle = -Math.PI / 2) {
1086
+ return Array.from({ length: count }, (_, i) => {
1087
+ const angle = startAngle + Math.PI * 2 * i / count;
1088
+ return {
1089
+ x1: cx + innerR * Math.cos(angle),
1090
+ y1: cy + innerR * Math.sin(angle),
1091
+ x2: cx + outerR * Math.cos(angle),
1092
+ y2: cy + outerR * Math.sin(angle),
1093
+ angle
1094
+ };
1095
+ });
1096
+ }
1097
+ function gridPositions(startX, startY, cols, cellWidth, cellHeight, count) {
1098
+ return Array.from({ length: count }, (_, i) => {
1099
+ const col = i % cols;
1100
+ const row = Math.floor(i / cols);
1101
+ return {
1102
+ x: startX + col * cellWidth,
1103
+ y: startY + row * cellHeight,
1104
+ col,
1105
+ row
1106
+ };
1107
+ });
1108
+ }
1109
+ function curveControlPoint(x1, y1, x2, y2, offset) {
1110
+ const mx = (x1 + x2) / 2;
1111
+ const my = (y1 + y2) / 2;
1112
+ const dx = x2 - x1;
1113
+ const dy = y2 - y1;
1114
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
1115
+ return {
1116
+ cpx: mx + -dy / len * offset,
1117
+ cpy: my + dx / len * offset
1118
+ };
1119
+ }
1120
+ var avlSmId = 0;
1121
+ var AvlStateMachine = ({
1122
+ states,
1123
+ transitions,
1124
+ className,
1125
+ color = "var(--color-primary)",
1126
+ animated = false
1127
+ }) => {
1128
+ const ids = React6__default.default.useMemo(() => {
1129
+ avlSmId += 1;
1130
+ const base = `avl-sm-${avlSmId}`;
1131
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
1132
+ }, []);
1133
+ const cx = 300;
1134
+ const cy = 200;
1135
+ const r = 150;
1136
+ const stateWidth = 90;
1137
+ const stateHeight = 36;
1138
+ const positions = ringPositions(cx, cy, r, states.length);
1139
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
1140
+ const pairCount = /* @__PURE__ */ new Map();
1141
+ const pairSeen = /* @__PURE__ */ new Map();
1142
+ for (const tr of transitions) {
1143
+ const key = [tr.from, tr.to].sort().join("|");
1144
+ pairCount.set(key, (pairCount.get(key) ?? 0) + 1);
1145
+ }
1146
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1147
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1148
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1149
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
1150
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1151
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1152
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1153
+ ] })
1154
+ ] }),
1155
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1156
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.1 }),
1157
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
1158
+ ] })
1159
+ ] }),
1160
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1161
+ @keyframes avl-sm-dash { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }
1162
+ ` }),
1163
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: r + 30, fill: `url(#${ids.grad})` }),
1164
+ transitions.map((tr, i) => {
1165
+ if (tr.from !== tr.to) return null;
1166
+ const idx = stateIndex.get(tr.from);
1167
+ if (idx === void 0) return null;
1168
+ const pos = positions[idx];
1169
+ const loopR = 20;
1170
+ const loopY = pos.y - stateHeight / 2 - 4;
1171
+ const d = `M${pos.x - 14},${loopY} C${pos.x - 14},${loopY - loopR * 2} ${pos.x + 14},${loopY - loopR * 2} ${pos.x + 14},${loopY}`;
1172
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1173
+ /* @__PURE__ */ jsxRuntime.jsx(
1174
+ "path",
1175
+ {
1176
+ d,
1177
+ fill: "none",
1178
+ stroke: color,
1179
+ strokeWidth: 1.5,
1180
+ opacity: 0.7,
1181
+ markerEnd: `url(#${ids.grad})`
1182
+ }
1183
+ ),
1184
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
1185
+ "text",
1186
+ {
1187
+ x: pos.x,
1188
+ y: loopY - loopR * 2 + 4,
1189
+ textAnchor: "middle",
1190
+ fill: color,
1191
+ fontSize: 9,
1192
+ fontFamily: "inherit",
1193
+ fontWeight: "bold",
1194
+ opacity: 0.8,
1195
+ children: tr.event
1196
+ }
1197
+ )
1198
+ ] }, `self-${i}`);
1199
+ }),
1200
+ transitions.map((tr, i) => {
1201
+ if (tr.from === tr.to) return null;
1202
+ const fromIdx = stateIndex.get(tr.from);
1203
+ const toIdx = stateIndex.get(tr.to);
1204
+ if (fromIdx === void 0 || toIdx === void 0) return null;
1205
+ const fp = positions[fromIdx];
1206
+ const tp = positions[toIdx];
1207
+ const dx = tp.x - fp.x;
1208
+ const dy = tp.y - fp.y;
1209
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
1210
+ const nx = dx / dist;
1211
+ const ny = dy / dist;
1212
+ const pairKey = [tr.from, tr.to].sort().join("|");
1213
+ const totalForPair = pairCount.get(pairKey) ?? 1;
1214
+ const seenIdx = pairSeen.get(pairKey) ?? 0;
1215
+ pairSeen.set(pairKey, seenIdx + 1);
1216
+ const pairOffset = totalForPair > 1 ? (seenIdx - (totalForPair - 1) / 2) * 24 : 0;
1217
+ const x1 = fp.x + nx * (stateWidth / 2 + 4);
1218
+ const y1 = fp.y + ny * (stateHeight / 2 + 4);
1219
+ const x2 = tp.x - nx * (stateWidth / 2 + 8);
1220
+ const y2 = tp.y - ny * (stateHeight / 2 + 8);
1221
+ const t = 0.3;
1222
+ const labelX = x1 * (1 - t) + x2 * t;
1223
+ const labelY = y1 * (1 - t) + y2 * t;
1224
+ const perpX = -ny * (20 + Math.abs(pairOffset));
1225
+ const perpY = nx * (20 + Math.abs(pairOffset));
1226
+ const midToCenter = Math.sqrt((labelX - cx) ** 2 + (labelY - cy) ** 2);
1227
+ const testX = labelX + perpX;
1228
+ const testY = labelY + perpY;
1229
+ const testToCenter = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
1230
+ const outSign = testToCenter > midToCenter ? 1 : -1;
1231
+ const lx = labelX + perpX * outSign + -ny * pairOffset;
1232
+ const ly = labelY + perpY * outSign + nx * pairOffset;
1233
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1234
+ /* @__PURE__ */ jsxRuntime.jsx(
1235
+ AvlTransition,
1236
+ {
1237
+ x1: x1 + -ny * pairOffset,
1238
+ y1: y1 + nx * pairOffset,
1239
+ x2: x2 + -ny * pairOffset,
1240
+ y2: y2 + nx * pairOffset,
1241
+ curved: states.length > 2,
1242
+ curveAwayFrom: { x: cx, y: cy },
1243
+ color,
1244
+ opacity: 0.7
1245
+ }
1246
+ ),
1247
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
1248
+ "text",
1249
+ {
1250
+ x: lx,
1251
+ y: ly,
1252
+ textAnchor: "middle",
1253
+ fill: color,
1254
+ fontSize: 9,
1255
+ fontFamily: "inherit",
1256
+ fontWeight: "bold",
1257
+ opacity: 0.8,
1258
+ children: tr.event
1259
+ }
1260
+ ),
1261
+ tr.guard && /* @__PURE__ */ jsxRuntime.jsxs(
1262
+ "text",
1263
+ {
1264
+ x: lx,
1265
+ y: ly + 12,
1266
+ textAnchor: "middle",
1267
+ fill: color,
1268
+ fontSize: 8,
1269
+ fontFamily: "inherit",
1270
+ opacity: 0.6,
1271
+ children: [
1272
+ "[",
1273
+ tr.guard,
1274
+ "]"
1275
+ ]
1276
+ }
1277
+ ),
1278
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsxRuntime.jsx(
1279
+ AvlEffect,
1280
+ {
1281
+ x: lx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
1282
+ y: ly + (tr.guard ? 22 : 12),
1283
+ effectType: eff,
1284
+ size: 5,
1285
+ color,
1286
+ opacity: 0.7
1287
+ },
1288
+ j
1289
+ ))
1290
+ ] }, `tr-${i}`);
1291
+ }),
1292
+ states.map((state, i) => {
1293
+ const pos = positions[i];
1294
+ return /* @__PURE__ */ jsxRuntime.jsx(
1295
+ AvlState,
1296
+ {
1297
+ x: pos.x - stateWidth / 2,
1298
+ y: pos.y - stateHeight / 2,
1299
+ width: stateWidth,
1300
+ height: stateHeight,
1301
+ name: state.name,
1302
+ isInitial: state.isInitial,
1303
+ isTerminal: state.isTerminal,
1304
+ color
1305
+ },
1306
+ state.name
1307
+ );
1308
+ })
1309
+ ] });
1310
+ };
1311
+ AvlStateMachine.displayName = "AvlStateMachine";
1312
+ var avlOuId = 0;
1313
+ var AvlOrbitalUnit = ({
1314
+ entityName,
1315
+ fields = 4,
1316
+ persistence = "persistent",
1317
+ traits,
1318
+ pages,
1319
+ className,
1320
+ color = "var(--color-primary)",
1321
+ animated = false
1322
+ }) => {
1323
+ const ids = React6__default.default.useMemo(() => {
1324
+ avlOuId += 1;
1325
+ const base = `avl-ou-${avlOuId}`;
1326
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
1327
+ }, []);
1328
+ const cx = 300;
1329
+ const cy = 200;
1330
+ const entityR = 24;
1331
+ const orbitalR = 130;
1332
+ const traitBaseRx = 55;
1333
+ const traitBaseRy = 24;
1334
+ const traitRxStep = 20;
1335
+ const traitRyStep = 8;
1336
+ const traitAngleStep = traits.length > 1 ? 120 / (traits.length - 1) : 0;
1337
+ const traitAngleStart = traits.length > 1 ? -60 : 0;
1338
+ const pageAngleStart = -Math.PI / 3;
1339
+ const pageAngleStep = pages.length > 1 ? Math.PI * 0.8 / (pages.length - 1) : 0;
1340
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1341
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1342
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1343
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
1344
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1345
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1346
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1347
+ ] })
1348
+ ] }),
1349
+ /* @__PURE__ */ jsxRuntime.jsxs("radialGradient", { id: ids.grad, cx: "50%", cy: "50%", r: "50%", children: [
1350
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.08 }),
1351
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0 })
1352
+ ] })
1353
+ ] }),
1354
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1355
+ @keyframes avl-ou-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
1356
+ ` }),
1357
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: orbitalR + 20, fill: `url(#${ids.grad})` }),
1358
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx, cy, r: orbitalR, label: entityName, color }),
1359
+ traits.map((trait, i) => {
1360
+ const rotation = traitAngleStart + i * traitAngleStep;
1361
+ const traitColor = trait.color ?? color;
1362
+ return /* @__PURE__ */ jsxRuntime.jsx(
1363
+ AvlTrait,
1364
+ {
1365
+ cx,
1366
+ cy,
1367
+ rx: traitBaseRx + i * traitRxStep,
1368
+ ry: traitBaseRy + i * traitRyStep,
1369
+ rotation,
1370
+ label: trait.name,
1371
+ color: traitColor,
1372
+ opacity: 0.7
1373
+ },
1374
+ trait.name
1375
+ );
1376
+ }),
1377
+ /* @__PURE__ */ jsxRuntime.jsx(
1378
+ AvlEntity,
1379
+ {
1380
+ x: cx,
1381
+ y: cy,
1382
+ r: entityR,
1383
+ fieldCount: fields,
1384
+ persistence,
1385
+ color
1386
+ }
1387
+ ),
1388
+ pages.map((page, i) => {
1389
+ const angle = pageAngleStart + i * pageAngleStep;
1390
+ const px = cx + orbitalR * Math.cos(angle);
1391
+ const py = cy + orbitalR * Math.sin(angle);
1392
+ return /* @__PURE__ */ jsxRuntime.jsx(
1393
+ AvlPage,
1394
+ {
1395
+ x: px,
1396
+ y: py,
1397
+ size: 10,
1398
+ label: page.name,
1399
+ color
1400
+ },
1401
+ page.name
1402
+ );
1403
+ })
1404
+ ] });
1405
+ };
1406
+ AvlOrbitalUnit.displayName = "AvlOrbitalUnit";
1407
+ var avlCcId = 0;
1408
+ var AvlClosedCircuit = ({
1409
+ states,
1410
+ transitions,
1411
+ className,
1412
+ color = "var(--color-primary)",
1413
+ animated = false
1414
+ }) => {
1415
+ const ids = React6__default.default.useMemo(() => {
1416
+ avlCcId += 1;
1417
+ const base = `avl-cc-${avlCcId}`;
1418
+ return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
1419
+ }, []);
1420
+ const cx = 300;
1421
+ const cy = 200;
1422
+ const r = 120;
1423
+ const stateW = 80;
1424
+ const stateH = 32;
1425
+ const positions = ringPositions(cx, cy, r, states.length);
1426
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
1427
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1428
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1429
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1430
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
1431
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1432
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1433
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1434
+ ] })
1435
+ ] }),
1436
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1437
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.15 }),
1438
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: color, stopOpacity: 0.4 }),
1439
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.15 })
1440
+ ] }),
1441
+ /* @__PURE__ */ jsxRuntime.jsx(
1442
+ "marker",
1443
+ {
1444
+ id: ids.arrow,
1445
+ markerWidth: "8",
1446
+ markerHeight: "6",
1447
+ refX: "7",
1448
+ refY: "3",
1449
+ orient: "auto",
1450
+ markerUnits: "strokeWidth",
1451
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
1452
+ }
1453
+ )
1454
+ ] }),
1455
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1456
+ @keyframes avl-cc-flow { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
1457
+ ` }),
1458
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: r + 30, fill: "none", stroke: color, strokeWidth: 0.3, opacity: 0.06 }),
1459
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: 50, fill: "none", stroke: color, strokeWidth: 0.5, opacity: 0.08 }),
1460
+ transitions.map((tr, i) => {
1461
+ const fromIdx = stateIndex.get(tr.from);
1462
+ const toIdx = stateIndex.get(tr.to);
1463
+ if (fromIdx === void 0 || toIdx === void 0) return null;
1464
+ const fp = positions[fromIdx];
1465
+ const tp = positions[toIdx];
1466
+ const dx = tp.x - fp.x;
1467
+ const dy = tp.y - fp.y;
1468
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
1469
+ const nx = dx / dist;
1470
+ const ny = dy / dist;
1471
+ const x1 = fp.x + nx * (stateW / 2 + 4);
1472
+ const y1 = fp.y + ny * (stateH / 2 + 4);
1473
+ const x2 = tp.x - nx * (stateW / 2 + 8);
1474
+ const y2 = tp.y - ny * (stateH / 2 + 8);
1475
+ const mx = (x1 + x2) / 2;
1476
+ const my = (y1 + y2) / 2;
1477
+ const curvature = dist * 0.25;
1478
+ let perpX = -ny;
1479
+ let perpY = nx;
1480
+ const testX = mx + perpX * curvature;
1481
+ const testY = my + perpY * curvature;
1482
+ const distTest = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
1483
+ const distMid = Math.sqrt((mx - cx) ** 2 + (my - cy) ** 2);
1484
+ if (distTest < distMid) {
1485
+ perpX = -perpX;
1486
+ perpY = -perpY;
1487
+ }
1488
+ const cpx = mx + perpX * curvature;
1489
+ const cpy = my + perpY * curvature;
1490
+ const d = `M${x1},${y1} Q${cpx},${cpy} ${x2},${y2}`;
1491
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1492
+ /* @__PURE__ */ jsxRuntime.jsx(
1493
+ "path",
1494
+ {
1495
+ d,
1496
+ fill: "none",
1497
+ stroke: `url(#${ids.grad})`,
1498
+ strokeWidth: 1.5,
1499
+ strokeDasharray: animated ? "8 6" : void 0,
1500
+ markerEnd: `url(#${ids.arrow})`,
1501
+ style: animated ? { animation: "avl-cc-flow 1.5s linear infinite" } : void 0
1502
+ }
1503
+ ),
1504
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
1505
+ AvlEvent,
1506
+ {
1507
+ x: cpx,
1508
+ y: cpy - 14,
1509
+ size: 8,
1510
+ label: tr.event,
1511
+ color,
1512
+ opacity: 0.8
1513
+ }
1514
+ ),
1515
+ tr.guard && /* @__PURE__ */ jsxRuntime.jsx(
1516
+ AvlGuard,
1517
+ {
1518
+ x: mx,
1519
+ y: my - 8,
1520
+ size: 10,
1521
+ label: tr.guard,
1522
+ color,
1523
+ opacity: 0.6
1524
+ }
1525
+ ),
1526
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsxRuntime.jsx(
1527
+ AvlEffect,
1528
+ {
1529
+ x: mx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
1530
+ y: my + 14,
1531
+ effectType: eff,
1532
+ size: 5,
1533
+ color,
1534
+ opacity: 0.7
1535
+ },
1536
+ j
1537
+ ))
1538
+ ] }, `cc-tr-${i}`);
1539
+ }),
1540
+ states.map((state, i) => {
1541
+ const pos = positions[i];
1542
+ return /* @__PURE__ */ jsxRuntime.jsx(
1543
+ AvlState,
1544
+ {
1545
+ x: pos.x - stateW / 2,
1546
+ y: pos.y - stateH / 2,
1547
+ width: stateW,
1548
+ height: stateH,
1549
+ name: state.name,
1550
+ color
1551
+ },
1552
+ state.name
1553
+ );
1554
+ }),
1555
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: 3, fill: color, opacity: 0.4 })
1556
+ ] });
1557
+ };
1558
+ AvlClosedCircuit.displayName = "AvlClosedCircuit";
1559
+ var avlElId = 0;
1560
+ var AvlEmitListen = ({
1561
+ emitter,
1562
+ listener,
1563
+ eventName,
1564
+ className,
1565
+ color = "var(--color-primary)",
1566
+ animated = false
1567
+ }) => {
1568
+ const ids = React6__default.default.useMemo(() => {
1569
+ avlElId += 1;
1570
+ const base = `avl-el-${avlElId}`;
1571
+ return { arrow: `${base}-arrow`, grad: `${base}-grad` };
1572
+ }, []);
1573
+ const leftCx = 180;
1574
+ const rightCx = 420;
1575
+ const cy = 200;
1576
+ const orbR = 80;
1577
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1578
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1579
+ /* @__PURE__ */ jsxRuntime.jsx(
1580
+ "marker",
1581
+ {
1582
+ id: ids.arrow,
1583
+ markerWidth: "8",
1584
+ markerHeight: "6",
1585
+ refX: "7",
1586
+ refY: "3",
1587
+ orient: "auto",
1588
+ markerUnits: "strokeWidth",
1589
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
1590
+ }
1591
+ ),
1592
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
1593
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.5 }),
1594
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.2 })
1595
+ ] })
1596
+ ] }),
1597
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1598
+ @keyframes avl-el-dash { from { stroke-dashoffset: 16; } to { stroke-dashoffset: 0; } }
1599
+ ` }),
1600
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx: leftCx, cy, r: orbR, label: emitter.name, color }),
1601
+ /* @__PURE__ */ jsxRuntime.jsx(AvlEntity, { x: leftCx, y: cy, r: 18, fieldCount: emitter.fields ?? 3, color }),
1602
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx: rightCx, cy, r: orbR, label: listener.name, color }),
1603
+ /* @__PURE__ */ jsxRuntime.jsx(AvlEntity, { x: rightCx, y: cy, r: 18, fieldCount: listener.fields ?? 3, color }),
1604
+ /* @__PURE__ */ jsxRuntime.jsx(
1605
+ "path",
1606
+ {
1607
+ d: `M${leftCx + orbR + 4},${cy} L${rightCx - orbR - 8},${cy}`,
1608
+ fill: "none",
1609
+ stroke: `url(#${ids.grad})`,
1610
+ strokeWidth: 2,
1611
+ strokeDasharray: "6 4",
1612
+ markerEnd: `url(#${ids.arrow})`,
1613
+ style: animated ? { animation: "avl-el-dash 1s linear infinite" } : void 0
1614
+ }
1615
+ ),
1616
+ /* @__PURE__ */ jsxRuntime.jsx(
1617
+ AvlEffect,
1618
+ {
1619
+ x: leftCx + orbR + 20,
1620
+ y: cy - 20,
1621
+ effectType: "emit",
1622
+ size: 6,
1623
+ color,
1624
+ opacity: 0.8
1625
+ }
1626
+ ),
1627
+ eventName && /* @__PURE__ */ jsxRuntime.jsxs(
1628
+ "text",
1629
+ {
1630
+ x: 300,
1631
+ y: cy - 18,
1632
+ textAnchor: "middle",
1633
+ fill: color,
1634
+ fontSize: 11,
1635
+ fontFamily: "inherit",
1636
+ fontWeight: "bold",
1637
+ opacity: 0.8,
1638
+ children: [
1639
+ "~",
1640
+ eventName
1641
+ ]
1642
+ }
1643
+ ),
1644
+ /* @__PURE__ */ jsxRuntime.jsx(
1645
+ "text",
1646
+ {
1647
+ x: 300,
1648
+ y: cy + 18,
1649
+ textAnchor: "middle",
1650
+ fill: color,
1651
+ fontSize: 12,
1652
+ fontFamily: "inherit",
1653
+ opacity: 0.3,
1654
+ letterSpacing: 4,
1655
+ children: "~ ~ ~"
1656
+ }
1657
+ )
1658
+ ] });
1659
+ };
1660
+ AvlEmitListen.displayName = "AvlEmitListen";
1661
+ var SLOT_PRESETS = {
1662
+ header: { x: 10, y: 5, width: 340, height: 35 },
1663
+ main: { x: 120, y: 50, width: 230, height: 195 },
1664
+ sidebar: { x: 10, y: 50, width: 100, height: 195 },
1665
+ modal: { x: 80, y: 60, width: 200, height: 140 },
1666
+ drawer: { x: 220, y: 50, width: 130, height: 195 },
1667
+ toast: { x: 220, y: 210, width: 130, height: 35 },
1668
+ footer: { x: 10, y: 220, width: 340, height: 30 },
1669
+ center: { x: 60, y: 50, width: 240, height: 195 },
1670
+ "hud-top": { x: 10, y: 5, width: 340, height: 30 },
1671
+ "hud-bottom": { x: 10, y: 220, width: 340, height: 30 }
1672
+ };
1673
+ function resolveSlot(slot, fallbackIdx) {
1674
+ if (slot.x !== void 0 && slot.y !== void 0 && slot.width !== void 0 && slot.height !== void 0) {
1675
+ return slot;
1676
+ }
1677
+ const preset = SLOT_PRESETS[slot.name];
1678
+ if (preset) {
1679
+ return {
1680
+ name: slot.name,
1681
+ x: slot.x ?? preset.x,
1682
+ y: slot.y ?? preset.y,
1683
+ width: slot.width ?? preset.width,
1684
+ height: slot.height ?? preset.height
1685
+ };
1686
+ }
1687
+ const col = fallbackIdx % 2;
1688
+ const row = Math.floor(fallbackIdx / 2);
1689
+ return {
1690
+ name: slot.name,
1691
+ x: 10 + col * 175,
1692
+ y: 50 + row * 100,
1693
+ width: 165,
1694
+ height: 90
1695
+ };
1696
+ }
1697
+ var AvlSlotMap = ({
1698
+ slots,
1699
+ pageWidth = 360,
1700
+ pageHeight = 280,
1701
+ className,
1702
+ color = "var(--color-primary)",
1703
+ animated = false
1704
+ }) => {
1705
+ const ox = (600 - pageWidth) / 2;
1706
+ const oy = (400 - pageHeight) / 2;
1707
+ let unknownIdx = 0;
1708
+ const resolvedSlots = slots.map((slot) => {
1709
+ const isUnknown = !SLOT_PRESETS[slot.name] && (slot.x === void 0 || slot.y === void 0);
1710
+ const resolved = resolveSlot(slot, isUnknown ? unknownIdx : 0);
1711
+ if (isUnknown) unknownIdx++;
1712
+ return resolved;
1713
+ });
1714
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1715
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1716
+ @keyframes avl-slot-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.25; } }
1717
+ ` }),
1718
+ /* @__PURE__ */ jsxRuntime.jsx(
1719
+ "rect",
1720
+ {
1721
+ x: ox,
1722
+ y: oy,
1723
+ width: pageWidth,
1724
+ height: pageHeight,
1725
+ rx: 4,
1726
+ ry: 4,
1727
+ fill: "none",
1728
+ stroke: color,
1729
+ strokeWidth: 2
1730
+ }
1731
+ ),
1732
+ /* @__PURE__ */ jsxRuntime.jsx(
1733
+ "rect",
1734
+ {
1735
+ x: ox,
1736
+ y: oy,
1737
+ width: pageWidth,
1738
+ height: 24,
1739
+ rx: 4,
1740
+ ry: 4,
1741
+ fill: color,
1742
+ opacity: 0.1
1743
+ }
1744
+ ),
1745
+ /* @__PURE__ */ jsxRuntime.jsx(
1746
+ "text",
1747
+ {
1748
+ x: ox + pageWidth / 2,
1749
+ y: oy + 16,
1750
+ textAnchor: "middle",
1751
+ fill: color,
1752
+ fontSize: 10,
1753
+ fontFamily: "inherit",
1754
+ fontWeight: "bold",
1755
+ children: "Page Layout"
1756
+ }
1757
+ ),
1758
+ resolvedSlots.map((slot) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1759
+ /* @__PURE__ */ jsxRuntime.jsx(
1760
+ "rect",
1761
+ {
1762
+ x: ox + slot.x,
1763
+ y: oy + 24 + slot.y,
1764
+ width: slot.width,
1765
+ height: slot.height,
1766
+ rx: 3,
1767
+ ry: 3,
1768
+ fill: color,
1769
+ opacity: 0.08,
1770
+ stroke: color,
1771
+ strokeWidth: 1,
1772
+ strokeDasharray: "4 2",
1773
+ style: animated ? { animation: "avl-slot-pulse 2s ease-in-out infinite" } : void 0
1774
+ }
1775
+ ),
1776
+ /* @__PURE__ */ jsxRuntime.jsx(
1777
+ "text",
1778
+ {
1779
+ x: ox + slot.x + slot.width / 2,
1780
+ y: oy + 24 + slot.y + slot.height / 2,
1781
+ textAnchor: "middle",
1782
+ dominantBaseline: "central",
1783
+ fill: color,
1784
+ fontSize: 9,
1785
+ fontFamily: "inherit",
1786
+ opacity: 0.6,
1787
+ children: slot.name
1788
+ }
1789
+ )
1790
+ ] }, slot.name))
1791
+ ] });
1792
+ };
1793
+ AvlSlotMap.displayName = "AvlSlotMap";
1794
+ var avlEtId = 0;
1795
+ function layoutTree(node, x, y, hSpacing, vSpacing) {
1796
+ const children = node.children ?? [];
1797
+ if (children.length === 0) {
1798
+ return { label: node.label, type: node.type, x, y, children: [] };
1799
+ }
1800
+ const totalWidth = (children.length - 1) * hSpacing;
1801
+ const startX = x - totalWidth / 2;
1802
+ const layoutChildren = children.map(
1803
+ (child, i) => layoutTree(child, startX + i * hSpacing, y + vSpacing, hSpacing * 0.65, vSpacing)
1804
+ );
1805
+ return { label: node.label, type: node.type, x, y, children: layoutChildren };
1806
+ }
1807
+ function nodeColor(type, baseColor) {
1808
+ switch (type) {
1809
+ case "operator":
1810
+ return baseColor;
1811
+ case "literal":
1812
+ return baseColor;
1813
+ case "binding":
1814
+ return baseColor;
1815
+ }
1816
+ }
1817
+ function renderNode(node, color, glowId) {
1818
+ const labelLen = node.label.length;
1819
+ const baseR = node.type === "operator" ? 20 : 16;
1820
+ const r = Math.max(baseR, labelLen * 3.5 + 6);
1821
+ const nc = nodeColor(node.type, color);
1822
+ return /* @__PURE__ */ jsxRuntime.jsxs(React6__default.default.Fragment, { children: [
1823
+ node.children.map((child, i) => {
1824
+ const childR = Math.max(
1825
+ child.type === "operator" ? 20 : 16,
1826
+ child.label.length * 3.5 + 6
1827
+ );
1828
+ return /* @__PURE__ */ jsxRuntime.jsx(
1829
+ "line",
1830
+ {
1831
+ x1: node.x,
1832
+ y1: node.y + (node.type === "operator" ? r * 0.7 : r),
1833
+ x2: child.x,
1834
+ y2: child.y - (child.type === "operator" ? childR * 0.7 : childR),
1835
+ stroke: color,
1836
+ strokeWidth: 1,
1837
+ opacity: 0.3
1838
+ },
1839
+ `line-${i}`
1840
+ );
1841
+ }),
1842
+ node.type === "operator" ? /* @__PURE__ */ jsxRuntime.jsx(
1843
+ "rect",
1844
+ {
1845
+ x: node.x - r,
1846
+ y: node.y - r * 0.6,
1847
+ width: r * 2,
1848
+ height: r * 1.2,
1849
+ rx: 4,
1850
+ ry: 4,
1851
+ fill: color,
1852
+ fillOpacity: 0.15,
1853
+ stroke: nc,
1854
+ strokeWidth: 1.5
1855
+ }
1856
+ ) : 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 }),
1857
+ /* @__PURE__ */ jsxRuntime.jsx(
1858
+ "text",
1859
+ {
1860
+ x: node.x,
1861
+ y: node.y + 1,
1862
+ textAnchor: "middle",
1863
+ dominantBaseline: "central",
1864
+ fill: nc,
1865
+ fontSize: node.type === "operator" ? 11 : 10,
1866
+ fontFamily: "inherit",
1867
+ fontWeight: node.type === "operator" ? "bold" : "normal",
1868
+ children: node.type === "binding" ? `@${node.label}` : node.label
1869
+ }
1870
+ ),
1871
+ node.children.map((child) => renderNode(child, color))
1872
+ ] }, `${node.label}-${node.x}-${node.y}`);
1873
+ }
1874
+ var AvlExprTree = ({
1875
+ expression,
1876
+ className,
1877
+ color = "var(--color-primary)"
1878
+ }) => {
1879
+ const ids = React6__default.default.useMemo(() => {
1880
+ avlEtId += 1;
1881
+ return { glow: `avl-et-${avlEtId}-glow` };
1882
+ }, []);
1883
+ const layout = layoutTree(expression, 300, 70, 150, 85);
1884
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1885
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1886
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
1887
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1888
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1889
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1890
+ ] })
1891
+ ] }) }),
1892
+ renderNode(layout, color, ids.glow)
1893
+ ] });
1894
+ };
1895
+ AvlExprTree.displayName = "AvlExprTree";
1896
+
1897
+ exports.AVL_FIELD_TYPE_SHAPES = AVL_FIELD_TYPE_SHAPES;
1898
+ exports.AVL_OPERATOR_COLORS = AVL_OPERATOR_COLORS;
1899
+ exports.AvlApplication = AvlApplication;
1900
+ exports.AvlBinding = AvlBinding;
1901
+ exports.AvlBindingRef = AvlBindingRef;
1902
+ exports.AvlClosedCircuit = AvlClosedCircuit;
1903
+ exports.AvlEffect = AvlEffect;
1904
+ exports.AvlEmitListen = AvlEmitListen;
1905
+ exports.AvlEntity = AvlEntity;
1906
+ exports.AvlEvent = AvlEvent;
1907
+ exports.AvlExprTree = AvlExprTree;
1908
+ exports.AvlField = AvlField;
1909
+ exports.AvlFieldType = AvlFieldType;
1910
+ exports.AvlGuard = AvlGuard;
1911
+ exports.AvlLiteral = AvlLiteral;
1912
+ exports.AvlOperator = AvlOperator;
1913
+ exports.AvlOrbital = AvlOrbital;
1914
+ exports.AvlOrbitalUnit = AvlOrbitalUnit;
1915
+ exports.AvlPage = AvlPage;
1916
+ exports.AvlPersistence = AvlPersistence;
1917
+ exports.AvlSExpr = AvlSExpr;
1918
+ exports.AvlSlotMap = AvlSlotMap;
1919
+ exports.AvlState = AvlState;
1920
+ exports.AvlStateMachine = AvlStateMachine;
1921
+ exports.AvlTrait = AvlTrait;
1922
+ exports.AvlTransition = AvlTransition;
1923
+ exports.arcPath = arcPath;
1924
+ exports.curveControlPoint = curveControlPoint;
1925
+ exports.gridPositions = gridPositions;
1926
+ exports.radialPositions = radialPositions;
1927
+ exports.ringPositions = ringPositions;