@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
@@ -0,0 +1,1837 @@
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
+ return Array.from({ length: count }, (_, i) => {
1059
+ const angle = startAngle + Math.PI * 2 * i / count;
1060
+ return {
1061
+ x: cx + r * Math.cos(angle),
1062
+ y: cy + r * Math.sin(angle),
1063
+ angle
1064
+ };
1065
+ });
1066
+ }
1067
+ function arcPath(cx, cy, r, startAngle, endAngle) {
1068
+ const x1 = cx + r * Math.cos(startAngle);
1069
+ const y1 = cy + r * Math.sin(startAngle);
1070
+ const x2 = cx + r * Math.cos(endAngle);
1071
+ const y2 = cy + r * Math.sin(endAngle);
1072
+ const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;
1073
+ return `M${x1},${y1} A${r},${r} 0 ${largeArc},1 ${x2},${y2}`;
1074
+ }
1075
+ function radialPositions(cx, cy, innerR, outerR, count, startAngle = -Math.PI / 2) {
1076
+ return Array.from({ length: count }, (_, i) => {
1077
+ const angle = startAngle + Math.PI * 2 * i / count;
1078
+ return {
1079
+ x1: cx + innerR * Math.cos(angle),
1080
+ y1: cy + innerR * Math.sin(angle),
1081
+ x2: cx + outerR * Math.cos(angle),
1082
+ y2: cy + outerR * Math.sin(angle),
1083
+ angle
1084
+ };
1085
+ });
1086
+ }
1087
+ function gridPositions(startX, startY, cols, cellWidth, cellHeight, count) {
1088
+ return Array.from({ length: count }, (_, i) => {
1089
+ const col = i % cols;
1090
+ const row = Math.floor(i / cols);
1091
+ return {
1092
+ x: startX + col * cellWidth,
1093
+ y: startY + row * cellHeight,
1094
+ col,
1095
+ row
1096
+ };
1097
+ });
1098
+ }
1099
+ function curveControlPoint(x1, y1, x2, y2, offset) {
1100
+ const mx = (x1 + x2) / 2;
1101
+ const my = (y1 + y2) / 2;
1102
+ const dx = x2 - x1;
1103
+ const dy = y2 - y1;
1104
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
1105
+ return {
1106
+ cpx: mx + -dy / len * offset,
1107
+ cpy: my + dx / len * offset
1108
+ };
1109
+ }
1110
+ var avlSmId = 0;
1111
+ var AvlStateMachine = ({
1112
+ states,
1113
+ transitions,
1114
+ className,
1115
+ color = "var(--color-primary)",
1116
+ animated = false
1117
+ }) => {
1118
+ const ids = React6__default.default.useMemo(() => {
1119
+ avlSmId += 1;
1120
+ const base = `avl-sm-${avlSmId}`;
1121
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
1122
+ }, []);
1123
+ const cx = 300;
1124
+ const cy = 200;
1125
+ const r = 150;
1126
+ const stateWidth = 90;
1127
+ const stateHeight = 36;
1128
+ const positions = ringPositions(cx, cy, r, states.length);
1129
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
1130
+ const pairCount = /* @__PURE__ */ new Map();
1131
+ const pairSeen = /* @__PURE__ */ new Map();
1132
+ for (const tr of transitions) {
1133
+ const key = [tr.from, tr.to].sort().join("|");
1134
+ pairCount.set(key, (pairCount.get(key) ?? 0) + 1);
1135
+ }
1136
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1137
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1138
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1139
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
1140
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1141
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1142
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1143
+ ] })
1144
+ ] }),
1145
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1146
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.1 }),
1147
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
1148
+ ] })
1149
+ ] }),
1150
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1151
+ @keyframes avl-sm-dash { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }
1152
+ ` }),
1153
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: r + 30, fill: `url(#${ids.grad})` }),
1154
+ transitions.map((tr, i) => {
1155
+ const fromIdx = stateIndex.get(tr.from);
1156
+ const toIdx = stateIndex.get(tr.to);
1157
+ if (fromIdx === void 0 || toIdx === void 0) return null;
1158
+ const fp = positions[fromIdx];
1159
+ const tp = positions[toIdx];
1160
+ const dx = tp.x - fp.x;
1161
+ const dy = tp.y - fp.y;
1162
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
1163
+ const nx = dx / dist;
1164
+ const ny = dy / dist;
1165
+ const pairKey = [tr.from, tr.to].sort().join("|");
1166
+ const totalForPair = pairCount.get(pairKey) ?? 1;
1167
+ const seenIdx = pairSeen.get(pairKey) ?? 0;
1168
+ pairSeen.set(pairKey, seenIdx + 1);
1169
+ const pairOffset = totalForPair > 1 ? (seenIdx - (totalForPair - 1) / 2) * 24 : 0;
1170
+ const x1 = fp.x + nx * (stateWidth / 2 + 4);
1171
+ const y1 = fp.y + ny * (stateHeight / 2 + 4);
1172
+ const x2 = tp.x - nx * (stateWidth / 2 + 8);
1173
+ const y2 = tp.y - ny * (stateHeight / 2 + 8);
1174
+ const t = 0.3;
1175
+ const labelX = x1 * (1 - t) + x2 * t;
1176
+ const labelY = y1 * (1 - t) + y2 * t;
1177
+ const perpX = -ny * (20 + Math.abs(pairOffset));
1178
+ const perpY = nx * (20 + Math.abs(pairOffset));
1179
+ const midToCenter = Math.sqrt((labelX - cx) ** 2 + (labelY - cy) ** 2);
1180
+ const testX = labelX + perpX;
1181
+ const testY = labelY + perpY;
1182
+ const testToCenter = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
1183
+ const outSign = testToCenter > midToCenter ? 1 : -1;
1184
+ const lx = labelX + perpX * outSign + -ny * pairOffset;
1185
+ const ly = labelY + perpY * outSign + nx * pairOffset;
1186
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1187
+ /* @__PURE__ */ jsxRuntime.jsx(
1188
+ AvlTransition,
1189
+ {
1190
+ x1: x1 + -ny * pairOffset,
1191
+ y1: y1 + nx * pairOffset,
1192
+ x2: x2 + -ny * pairOffset,
1193
+ y2: y2 + nx * pairOffset,
1194
+ curved: states.length > 2,
1195
+ curveAwayFrom: { x: cx, y: cy },
1196
+ color,
1197
+ opacity: 0.7
1198
+ }
1199
+ ),
1200
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
1201
+ "text",
1202
+ {
1203
+ x: lx,
1204
+ y: ly,
1205
+ textAnchor: "middle",
1206
+ fill: color,
1207
+ fontSize: 9,
1208
+ fontFamily: "inherit",
1209
+ fontWeight: "bold",
1210
+ opacity: 0.8,
1211
+ children: tr.event
1212
+ }
1213
+ ),
1214
+ tr.guard && /* @__PURE__ */ jsxRuntime.jsxs(
1215
+ "text",
1216
+ {
1217
+ x: lx,
1218
+ y: ly + 12,
1219
+ textAnchor: "middle",
1220
+ fill: color,
1221
+ fontSize: 8,
1222
+ fontFamily: "inherit",
1223
+ opacity: 0.6,
1224
+ children: [
1225
+ "[",
1226
+ tr.guard,
1227
+ "]"
1228
+ ]
1229
+ }
1230
+ ),
1231
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsxRuntime.jsx(
1232
+ AvlEffect,
1233
+ {
1234
+ x: lx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
1235
+ y: ly + (tr.guard ? 22 : 12),
1236
+ effectType: eff,
1237
+ size: 5,
1238
+ color,
1239
+ opacity: 0.7
1240
+ },
1241
+ j
1242
+ ))
1243
+ ] }, `tr-${i}`);
1244
+ }),
1245
+ states.map((state, i) => {
1246
+ const pos = positions[i];
1247
+ return /* @__PURE__ */ jsxRuntime.jsx(
1248
+ AvlState,
1249
+ {
1250
+ x: pos.x - stateWidth / 2,
1251
+ y: pos.y - stateHeight / 2,
1252
+ width: stateWidth,
1253
+ height: stateHeight,
1254
+ name: state.name,
1255
+ isInitial: state.isInitial,
1256
+ isTerminal: state.isTerminal,
1257
+ color
1258
+ },
1259
+ state.name
1260
+ );
1261
+ })
1262
+ ] });
1263
+ };
1264
+ AvlStateMachine.displayName = "AvlStateMachine";
1265
+ var avlOuId = 0;
1266
+ var AvlOrbitalUnit = ({
1267
+ entityName,
1268
+ fields = 4,
1269
+ persistence = "persistent",
1270
+ traits,
1271
+ pages,
1272
+ className,
1273
+ color = "var(--color-primary)",
1274
+ animated = false
1275
+ }) => {
1276
+ const ids = React6__default.default.useMemo(() => {
1277
+ avlOuId += 1;
1278
+ const base = `avl-ou-${avlOuId}`;
1279
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
1280
+ }, []);
1281
+ const cx = 300;
1282
+ const cy = 200;
1283
+ const entityR = 24;
1284
+ const orbitalR = 130;
1285
+ const traitBaseRx = 55;
1286
+ const traitBaseRy = 24;
1287
+ const traitRxStep = 20;
1288
+ const traitRyStep = 8;
1289
+ const traitAngleStep = traits.length > 1 ? 120 / (traits.length - 1) : 0;
1290
+ const traitAngleStart = traits.length > 1 ? -60 : 0;
1291
+ const pageAngleStart = -Math.PI / 3;
1292
+ const pageAngleStep = pages.length > 1 ? Math.PI * 0.8 / (pages.length - 1) : 0;
1293
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1294
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1295
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1296
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
1297
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1298
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1299
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1300
+ ] })
1301
+ ] }),
1302
+ /* @__PURE__ */ jsxRuntime.jsxs("radialGradient", { id: ids.grad, cx: "50%", cy: "50%", r: "50%", children: [
1303
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.08 }),
1304
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0 })
1305
+ ] })
1306
+ ] }),
1307
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1308
+ @keyframes avl-ou-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
1309
+ ` }),
1310
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: orbitalR + 20, fill: `url(#${ids.grad})` }),
1311
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx, cy, r: orbitalR, label: entityName, color }),
1312
+ traits.map((trait, i) => {
1313
+ const rotation = traitAngleStart + i * traitAngleStep;
1314
+ const traitColor = trait.color ?? color;
1315
+ return /* @__PURE__ */ jsxRuntime.jsx(
1316
+ AvlTrait,
1317
+ {
1318
+ cx,
1319
+ cy,
1320
+ rx: traitBaseRx + i * traitRxStep,
1321
+ ry: traitBaseRy + i * traitRyStep,
1322
+ rotation,
1323
+ label: trait.name,
1324
+ color: traitColor,
1325
+ opacity: 0.7
1326
+ },
1327
+ trait.name
1328
+ );
1329
+ }),
1330
+ /* @__PURE__ */ jsxRuntime.jsx(
1331
+ AvlEntity,
1332
+ {
1333
+ x: cx,
1334
+ y: cy,
1335
+ r: entityR,
1336
+ fieldCount: fields,
1337
+ persistence,
1338
+ color
1339
+ }
1340
+ ),
1341
+ pages.map((page, i) => {
1342
+ const angle = pageAngleStart + i * pageAngleStep;
1343
+ const px = cx + orbitalR * Math.cos(angle);
1344
+ const py = cy + orbitalR * Math.sin(angle);
1345
+ return /* @__PURE__ */ jsxRuntime.jsx(
1346
+ AvlPage,
1347
+ {
1348
+ x: px,
1349
+ y: py,
1350
+ size: 10,
1351
+ label: page.name,
1352
+ color
1353
+ },
1354
+ page.name
1355
+ );
1356
+ })
1357
+ ] });
1358
+ };
1359
+ AvlOrbitalUnit.displayName = "AvlOrbitalUnit";
1360
+ var avlCcId = 0;
1361
+ var AvlClosedCircuit = ({
1362
+ states,
1363
+ transitions,
1364
+ className,
1365
+ color = "var(--color-primary)",
1366
+ animated = false
1367
+ }) => {
1368
+ const ids = React6__default.default.useMemo(() => {
1369
+ avlCcId += 1;
1370
+ const base = `avl-cc-${avlCcId}`;
1371
+ return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
1372
+ }, []);
1373
+ const cx = 300;
1374
+ const cy = 200;
1375
+ const r = 120;
1376
+ const stateW = 80;
1377
+ const stateH = 32;
1378
+ const positions = ringPositions(cx, cy, r, states.length);
1379
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
1380
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1381
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1382
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1383
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
1384
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1385
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1386
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1387
+ ] })
1388
+ ] }),
1389
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1390
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.15 }),
1391
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: color, stopOpacity: 0.4 }),
1392
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.15 })
1393
+ ] }),
1394
+ /* @__PURE__ */ jsxRuntime.jsx(
1395
+ "marker",
1396
+ {
1397
+ id: ids.arrow,
1398
+ markerWidth: "8",
1399
+ markerHeight: "6",
1400
+ refX: "7",
1401
+ refY: "3",
1402
+ orient: "auto",
1403
+ markerUnits: "strokeWidth",
1404
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
1405
+ }
1406
+ )
1407
+ ] }),
1408
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1409
+ @keyframes avl-cc-flow { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
1410
+ ` }),
1411
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: r + 30, fill: "none", stroke: color, strokeWidth: 0.3, opacity: 0.06 }),
1412
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: 50, fill: "none", stroke: color, strokeWidth: 0.5, opacity: 0.08 }),
1413
+ transitions.map((tr, i) => {
1414
+ const fromIdx = stateIndex.get(tr.from);
1415
+ const toIdx = stateIndex.get(tr.to);
1416
+ if (fromIdx === void 0 || toIdx === void 0) return null;
1417
+ const fp = positions[fromIdx];
1418
+ const tp = positions[toIdx];
1419
+ const dx = tp.x - fp.x;
1420
+ const dy = tp.y - fp.y;
1421
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
1422
+ const nx = dx / dist;
1423
+ const ny = dy / dist;
1424
+ const x1 = fp.x + nx * (stateW / 2 + 4);
1425
+ const y1 = fp.y + ny * (stateH / 2 + 4);
1426
+ const x2 = tp.x - nx * (stateW / 2 + 8);
1427
+ const y2 = tp.y - ny * (stateH / 2 + 8);
1428
+ const mx = (x1 + x2) / 2;
1429
+ const my = (y1 + y2) / 2;
1430
+ const curvature = dist * 0.25;
1431
+ let perpX = -ny;
1432
+ let perpY = nx;
1433
+ const testX = mx + perpX * curvature;
1434
+ const testY = my + perpY * curvature;
1435
+ const distTest = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
1436
+ const distMid = Math.sqrt((mx - cx) ** 2 + (my - cy) ** 2);
1437
+ if (distTest < distMid) {
1438
+ perpX = -perpX;
1439
+ perpY = -perpY;
1440
+ }
1441
+ const cpx = mx + perpX * curvature;
1442
+ const cpy = my + perpY * curvature;
1443
+ const d = `M${x1},${y1} Q${cpx},${cpy} ${x2},${y2}`;
1444
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1445
+ /* @__PURE__ */ jsxRuntime.jsx(
1446
+ "path",
1447
+ {
1448
+ d,
1449
+ fill: "none",
1450
+ stroke: `url(#${ids.grad})`,
1451
+ strokeWidth: 1.5,
1452
+ strokeDasharray: animated ? "8 6" : void 0,
1453
+ markerEnd: `url(#${ids.arrow})`,
1454
+ style: animated ? { animation: "avl-cc-flow 1.5s linear infinite" } : void 0
1455
+ }
1456
+ ),
1457
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
1458
+ AvlEvent,
1459
+ {
1460
+ x: cpx,
1461
+ y: cpy - 14,
1462
+ size: 8,
1463
+ label: tr.event,
1464
+ color,
1465
+ opacity: 0.8
1466
+ }
1467
+ ),
1468
+ tr.guard && /* @__PURE__ */ jsxRuntime.jsx(
1469
+ AvlGuard,
1470
+ {
1471
+ x: mx,
1472
+ y: my - 8,
1473
+ size: 10,
1474
+ label: tr.guard,
1475
+ color,
1476
+ opacity: 0.6
1477
+ }
1478
+ ),
1479
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsxRuntime.jsx(
1480
+ AvlEffect,
1481
+ {
1482
+ x: mx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
1483
+ y: my + 14,
1484
+ effectType: eff,
1485
+ size: 5,
1486
+ color,
1487
+ opacity: 0.7
1488
+ },
1489
+ j
1490
+ ))
1491
+ ] }, `cc-tr-${i}`);
1492
+ }),
1493
+ states.map((state, i) => {
1494
+ const pos = positions[i];
1495
+ return /* @__PURE__ */ jsxRuntime.jsx(
1496
+ AvlState,
1497
+ {
1498
+ x: pos.x - stateW / 2,
1499
+ y: pos.y - stateH / 2,
1500
+ width: stateW,
1501
+ height: stateH,
1502
+ name: state.name,
1503
+ color
1504
+ },
1505
+ state.name
1506
+ );
1507
+ }),
1508
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: 3, fill: color, opacity: 0.4 })
1509
+ ] });
1510
+ };
1511
+ AvlClosedCircuit.displayName = "AvlClosedCircuit";
1512
+ var avlElId = 0;
1513
+ var AvlEmitListen = ({
1514
+ emitter,
1515
+ listener,
1516
+ eventName,
1517
+ className,
1518
+ color = "var(--color-primary)",
1519
+ animated = false
1520
+ }) => {
1521
+ const ids = React6__default.default.useMemo(() => {
1522
+ avlElId += 1;
1523
+ const base = `avl-el-${avlElId}`;
1524
+ return { arrow: `${base}-arrow`, grad: `${base}-grad` };
1525
+ }, []);
1526
+ const leftCx = 180;
1527
+ const rightCx = 420;
1528
+ const cy = 200;
1529
+ const orbR = 80;
1530
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1531
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
1532
+ /* @__PURE__ */ jsxRuntime.jsx(
1533
+ "marker",
1534
+ {
1535
+ id: ids.arrow,
1536
+ markerWidth: "8",
1537
+ markerHeight: "6",
1538
+ refX: "7",
1539
+ refY: "3",
1540
+ orient: "auto",
1541
+ markerUnits: "strokeWidth",
1542
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
1543
+ }
1544
+ ),
1545
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
1546
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.5 }),
1547
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.2 })
1548
+ ] })
1549
+ ] }),
1550
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1551
+ @keyframes avl-el-dash { from { stroke-dashoffset: 16; } to { stroke-dashoffset: 0; } }
1552
+ ` }),
1553
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx: leftCx, cy, r: orbR, label: emitter.name, color }),
1554
+ /* @__PURE__ */ jsxRuntime.jsx(AvlEntity, { x: leftCx, y: cy, r: 18, fieldCount: emitter.fields ?? 3, color }),
1555
+ /* @__PURE__ */ jsxRuntime.jsx(AvlOrbital, { cx: rightCx, cy, r: orbR, label: listener.name, color }),
1556
+ /* @__PURE__ */ jsxRuntime.jsx(AvlEntity, { x: rightCx, y: cy, r: 18, fieldCount: listener.fields ?? 3, color }),
1557
+ /* @__PURE__ */ jsxRuntime.jsx(
1558
+ "path",
1559
+ {
1560
+ d: `M${leftCx + orbR + 4},${cy} L${rightCx - orbR - 8},${cy}`,
1561
+ fill: "none",
1562
+ stroke: `url(#${ids.grad})`,
1563
+ strokeWidth: 2,
1564
+ strokeDasharray: "6 4",
1565
+ markerEnd: `url(#${ids.arrow})`,
1566
+ style: animated ? { animation: "avl-el-dash 1s linear infinite" } : void 0
1567
+ }
1568
+ ),
1569
+ /* @__PURE__ */ jsxRuntime.jsx(
1570
+ AvlEffect,
1571
+ {
1572
+ x: leftCx + orbR + 20,
1573
+ y: cy - 20,
1574
+ effectType: "emit",
1575
+ size: 6,
1576
+ color,
1577
+ opacity: 0.8
1578
+ }
1579
+ ),
1580
+ eventName && /* @__PURE__ */ jsxRuntime.jsxs(
1581
+ "text",
1582
+ {
1583
+ x: 300,
1584
+ y: cy - 18,
1585
+ textAnchor: "middle",
1586
+ fill: color,
1587
+ fontSize: 11,
1588
+ fontFamily: "inherit",
1589
+ fontWeight: "bold",
1590
+ opacity: 0.8,
1591
+ children: [
1592
+ "~",
1593
+ eventName
1594
+ ]
1595
+ }
1596
+ ),
1597
+ /* @__PURE__ */ jsxRuntime.jsx(
1598
+ "text",
1599
+ {
1600
+ x: 300,
1601
+ y: cy + 18,
1602
+ textAnchor: "middle",
1603
+ fill: color,
1604
+ fontSize: 12,
1605
+ fontFamily: "inherit",
1606
+ opacity: 0.3,
1607
+ letterSpacing: 4,
1608
+ children: "~ ~ ~"
1609
+ }
1610
+ )
1611
+ ] });
1612
+ };
1613
+ AvlEmitListen.displayName = "AvlEmitListen";
1614
+ var AvlSlotMap = ({
1615
+ slots,
1616
+ pageWidth = 360,
1617
+ pageHeight = 280,
1618
+ className,
1619
+ color = "var(--color-primary)",
1620
+ animated = false
1621
+ }) => {
1622
+ const ox = (600 - pageWidth) / 2;
1623
+ const oy = (400 - pageHeight) / 2;
1624
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1625
+ animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1626
+ @keyframes avl-slot-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.25; } }
1627
+ ` }),
1628
+ /* @__PURE__ */ jsxRuntime.jsx(
1629
+ "rect",
1630
+ {
1631
+ x: ox,
1632
+ y: oy,
1633
+ width: pageWidth,
1634
+ height: pageHeight,
1635
+ rx: 4,
1636
+ ry: 4,
1637
+ fill: "none",
1638
+ stroke: color,
1639
+ strokeWidth: 2
1640
+ }
1641
+ ),
1642
+ /* @__PURE__ */ jsxRuntime.jsx(
1643
+ "rect",
1644
+ {
1645
+ x: ox,
1646
+ y: oy,
1647
+ width: pageWidth,
1648
+ height: 24,
1649
+ rx: 4,
1650
+ ry: 4,
1651
+ fill: color,
1652
+ opacity: 0.1
1653
+ }
1654
+ ),
1655
+ /* @__PURE__ */ jsxRuntime.jsx(
1656
+ "text",
1657
+ {
1658
+ x: ox + pageWidth / 2,
1659
+ y: oy + 16,
1660
+ textAnchor: "middle",
1661
+ fill: color,
1662
+ fontSize: 10,
1663
+ fontFamily: "inherit",
1664
+ fontWeight: "bold",
1665
+ children: "Page Layout"
1666
+ }
1667
+ ),
1668
+ slots.map((slot) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1669
+ /* @__PURE__ */ jsxRuntime.jsx(
1670
+ "rect",
1671
+ {
1672
+ x: ox + slot.x,
1673
+ y: oy + 24 + slot.y,
1674
+ width: slot.width,
1675
+ height: slot.height,
1676
+ rx: 3,
1677
+ ry: 3,
1678
+ fill: color,
1679
+ opacity: 0.08,
1680
+ stroke: color,
1681
+ strokeWidth: 1,
1682
+ strokeDasharray: "4 2",
1683
+ style: animated ? { animation: "avl-slot-pulse 2s ease-in-out infinite" } : void 0
1684
+ }
1685
+ ),
1686
+ /* @__PURE__ */ jsxRuntime.jsx(
1687
+ "text",
1688
+ {
1689
+ x: ox + slot.x + slot.width / 2,
1690
+ y: oy + 24 + slot.y + slot.height / 2,
1691
+ textAnchor: "middle",
1692
+ dominantBaseline: "central",
1693
+ fill: color,
1694
+ fontSize: 9,
1695
+ fontFamily: "inherit",
1696
+ opacity: 0.6,
1697
+ children: slot.name
1698
+ }
1699
+ )
1700
+ ] }, slot.name))
1701
+ ] });
1702
+ };
1703
+ AvlSlotMap.displayName = "AvlSlotMap";
1704
+ var avlEtId = 0;
1705
+ function layoutTree(node, x, y, hSpacing, vSpacing) {
1706
+ const children = node.children ?? [];
1707
+ if (children.length === 0) {
1708
+ return { label: node.label, type: node.type, x, y, children: [] };
1709
+ }
1710
+ const totalWidth = (children.length - 1) * hSpacing;
1711
+ const startX = x - totalWidth / 2;
1712
+ const layoutChildren = children.map(
1713
+ (child, i) => layoutTree(child, startX + i * hSpacing, y + vSpacing, hSpacing * 0.65, vSpacing)
1714
+ );
1715
+ return { label: node.label, type: node.type, x, y, children: layoutChildren };
1716
+ }
1717
+ function nodeColor(type, baseColor) {
1718
+ switch (type) {
1719
+ case "operator":
1720
+ return baseColor;
1721
+ case "literal":
1722
+ return baseColor;
1723
+ case "binding":
1724
+ return baseColor;
1725
+ }
1726
+ }
1727
+ function renderNode(node, color, glowId) {
1728
+ const labelLen = node.label.length;
1729
+ const baseR = node.type === "operator" ? 20 : 16;
1730
+ const r = Math.max(baseR, labelLen * 3.5 + 6);
1731
+ const nc = nodeColor(node.type, color);
1732
+ return /* @__PURE__ */ jsxRuntime.jsxs(React6__default.default.Fragment, { children: [
1733
+ node.children.map((child, i) => {
1734
+ const childR = Math.max(
1735
+ child.type === "operator" ? 20 : 16,
1736
+ child.label.length * 3.5 + 6
1737
+ );
1738
+ return /* @__PURE__ */ jsxRuntime.jsx(
1739
+ "line",
1740
+ {
1741
+ x1: node.x,
1742
+ y1: node.y + (node.type === "operator" ? r * 0.7 : r),
1743
+ x2: child.x,
1744
+ y2: child.y - (child.type === "operator" ? childR * 0.7 : childR),
1745
+ stroke: color,
1746
+ strokeWidth: 1,
1747
+ opacity: 0.3
1748
+ },
1749
+ `line-${i}`
1750
+ );
1751
+ }),
1752
+ node.type === "operator" ? /* @__PURE__ */ jsxRuntime.jsx(
1753
+ "rect",
1754
+ {
1755
+ x: node.x - r,
1756
+ y: node.y - r * 0.6,
1757
+ width: r * 2,
1758
+ height: r * 1.2,
1759
+ rx: 4,
1760
+ ry: 4,
1761
+ fill: color,
1762
+ fillOpacity: 0.15,
1763
+ stroke: nc,
1764
+ strokeWidth: 1.5
1765
+ }
1766
+ ) : 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 }),
1767
+ /* @__PURE__ */ jsxRuntime.jsx(
1768
+ "text",
1769
+ {
1770
+ x: node.x,
1771
+ y: node.y + 1,
1772
+ textAnchor: "middle",
1773
+ dominantBaseline: "central",
1774
+ fill: nc,
1775
+ fontSize: node.type === "operator" ? 11 : 10,
1776
+ fontFamily: "inherit",
1777
+ fontWeight: node.type === "operator" ? "bold" : "normal",
1778
+ children: node.type === "binding" ? `@${node.label}` : node.label
1779
+ }
1780
+ ),
1781
+ node.children.map((child) => renderNode(child, color))
1782
+ ] }, `${node.label}-${node.x}-${node.y}`);
1783
+ }
1784
+ var AvlExprTree = ({
1785
+ expression,
1786
+ className,
1787
+ color = "var(--color-primary)"
1788
+ }) => {
1789
+ const ids = React6__default.default.useMemo(() => {
1790
+ avlEtId += 1;
1791
+ return { glow: `avl-et-${avlEtId}-glow` };
1792
+ }, []);
1793
+ const layout = layoutTree(expression, 300, 70, 150, 85);
1794
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1795
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1796
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
1797
+ /* @__PURE__ */ jsxRuntime.jsxs("feMerge", { children: [
1798
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "blur" }),
1799
+ /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" })
1800
+ ] })
1801
+ ] }) }),
1802
+ renderNode(layout, color, ids.glow)
1803
+ ] });
1804
+ };
1805
+ AvlExprTree.displayName = "AvlExprTree";
1806
+
1807
+ exports.AVL_FIELD_TYPE_SHAPES = AVL_FIELD_TYPE_SHAPES;
1808
+ exports.AVL_OPERATOR_COLORS = AVL_OPERATOR_COLORS;
1809
+ exports.AvlApplication = AvlApplication;
1810
+ exports.AvlBinding = AvlBinding;
1811
+ exports.AvlBindingRef = AvlBindingRef;
1812
+ exports.AvlClosedCircuit = AvlClosedCircuit;
1813
+ exports.AvlEffect = AvlEffect;
1814
+ exports.AvlEmitListen = AvlEmitListen;
1815
+ exports.AvlEntity = AvlEntity;
1816
+ exports.AvlEvent = AvlEvent;
1817
+ exports.AvlExprTree = AvlExprTree;
1818
+ exports.AvlField = AvlField;
1819
+ exports.AvlFieldType = AvlFieldType;
1820
+ exports.AvlGuard = AvlGuard;
1821
+ exports.AvlLiteral = AvlLiteral;
1822
+ exports.AvlOperator = AvlOperator;
1823
+ exports.AvlOrbital = AvlOrbital;
1824
+ exports.AvlOrbitalUnit = AvlOrbitalUnit;
1825
+ exports.AvlPage = AvlPage;
1826
+ exports.AvlPersistence = AvlPersistence;
1827
+ exports.AvlSExpr = AvlSExpr;
1828
+ exports.AvlSlotMap = AvlSlotMap;
1829
+ exports.AvlState = AvlState;
1830
+ exports.AvlStateMachine = AvlStateMachine;
1831
+ exports.AvlTrait = AvlTrait;
1832
+ exports.AvlTransition = AvlTransition;
1833
+ exports.arcPath = arcPath;
1834
+ exports.curveControlPoint = curveControlPoint;
1835
+ exports.gridPositions = gridPositions;
1836
+ exports.radialPositions = radialPositions;
1837
+ exports.ringPositions = ringPositions;