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