@omg-dev/app 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist-lib/{ChangelogPage-8lbvM9Pz.js → ChangelogPage-Cjj_DiYL.js} +57 -1
  2. package/dist-lib/{File-B-qYa2zY.js → File-DQRr5F_e.js} +1761 -1826
  3. package/dist-lib/FileEditor-BrI3dfcp.js +6895 -0
  4. package/dist-lib/FileTreePane-J8P-OiHb.js +8413 -0
  5. package/dist-lib/{FileViewer-Clmf04v1.js → FileViewer-DRrfus7c.js} +1 -1
  6. package/dist-lib/{SessionFilesPanel-BKcTU57t.js → SessionFilesPanel-DxVJ43fE.js} +69 -69
  7. package/dist-lib/{TermView-gazV6UMU.js → TermView-B4V-DyD-.js} +521 -530
  8. package/dist-lib/{abnfDiagram-VRR7QNED-Chn1Z_p9.js → abnfDiagram-VRR7QNED-CiXfOnAu.js} +4 -4
  9. package/dist-lib/{arc-B652oHQ-.js → arc-QOMNKQA5.js} +1 -1
  10. package/dist-lib/{architectureDiagram-ZJ3FMSHR-CMatArpz.js → architectureDiagram-ZJ3FMSHR-BcFBTmfD.js} +2059 -2064
  11. package/dist-lib/{blockDiagram-677ZJIJ3-CEOPfI9A.js → blockDiagram-677ZJIJ3-Qj8-RIV3.js} +920 -925
  12. package/dist-lib/{c4Diagram-LMCZKHZV-DcUHrESL.js → c4Diagram-LMCZKHZV-BpinEmj4.js} +598 -593
  13. package/dist-lib/{channel-B5lJFbed.js → channel-D6YHMmF7.js} +1 -1
  14. package/dist-lib/{chat-engine-83mwx0z2.js → chat-engine-CUiDTHFP.js} +1173 -1218
  15. package/dist-lib/chunk-2Q5K7J3B-CFSi414U.js +18 -0
  16. package/dist-lib/{chunk-32BRIVSS-IYmNSvH8.js → chunk-32BRIVSS-DvywQiCk.js} +1 -1
  17. package/dist-lib/{chunk-5VM5RSS4-DO2g-xIj.js → chunk-5VM5RSS4-xd6XuI9Q.js} +1 -1
  18. package/dist-lib/{chunk-BO2N2NFS-kYiI5SD9.js → chunk-BO2N2NFS-BbJdm-59.js} +4892 -4903
  19. package/dist-lib/{chunk-EX3LRPZG-N96wfks9.js → chunk-EX3LRPZG-BLDKx-Yg.js} +507 -514
  20. package/dist-lib/chunk-JWPE2WC7-DnwG7Xzp.js +8 -0
  21. package/dist-lib/chunk-MOJQB5TN-BrENeFT5.js +670 -0
  22. package/dist-lib/chunk-RYQCIY6F-I-J4fVFd.js +313 -0
  23. package/dist-lib/{chunk-V7JOEXUC-DQwf2vkP.js → chunk-V7JOEXUC-Bkakcs1-.js} +458 -453
  24. package/dist-lib/chunk-VR4S4FIN-BDq3jZ0m.js +19 -0
  25. package/dist-lib/{chunk-XXDRQBXY-Ccv4aRcn.js → chunk-XXDRQBXY-DRKeYnrF.js} +1 -1
  26. package/dist-lib/{classDiagram-v2-EOCWNBFH-DOn-rhuL.js → classDiagram-OUVF2IWQ-DISUfvR5.js} +2 -2
  27. package/dist-lib/{classDiagram-OUVF2IWQ-DOn-rhuL.js → classDiagram-v2-EOCWNBFH-DISUfvR5.js} +2 -2
  28. package/dist-lib/{coding-agents-page-8Nf-IuE2.js → coding-agents-page-DtxZ0nbQ.js} +152 -131
  29. package/dist-lib/computer-page-DIJeFOZz.js +8860 -0
  30. package/dist-lib/{cose-bilkent-JH36ORCC-C-tACTrT.js → cose-bilkent-JH36ORCC-DCfmoChv.js} +281 -281
  31. package/dist-lib/{create-BrnHvSDE.js → create-CBk9uwJH.js} +2 -2
  32. package/dist-lib/cynefin-VYW2F7L2-XAY3mHv8.js +24430 -0
  33. package/dist-lib/{cynefinDiagram-TSTJHNR4-Be7CamD2.js → cynefinDiagram-TSTJHNR4-CrgvPEr1.js} +3 -3
  34. package/dist-lib/{cytoscape.esm-B0ledd6M.js → cytoscape.esm-BB6Ga9He.js} +3 -3
  35. package/dist-lib/dagre-VKFMJZFB-CE5k06mJ.js +343 -0
  36. package/dist-lib/{diagram-FQU43EPY-Jg12ow4Z.js → diagram-FQU43EPY-gOcCiJEN.js} +136 -139
  37. package/dist-lib/diagram-G47NLZAW-BVJLfRsd.js +531 -0
  38. package/dist-lib/diagram-NH7WQ7WH-u6QnHasL.js +145 -0
  39. package/dist-lib/diagram-OA4YK3LP-D4Kcl3uM.js +350 -0
  40. package/dist-lib/{diagram-WEI45ONY-D1kKPOc_.js → diagram-WEI45ONY-6a__oIb0.js} +38 -42
  41. package/dist-lib/{ebnfDiagram-CCIWWBDH-BhQWrGMc.js → ebnfDiagram-CCIWWBDH-PXSrB6lG.js} +4 -4
  42. package/dist-lib/{embedded-BmrQsEvQ.js → embedded-PUsgcSTE.js} +13043 -13082
  43. package/dist-lib/{engine-compile-BeDRSL6Y.js → engine-compile-D_stzVMa.js} +2939 -2991
  44. package/dist-lib/{erDiagram-Q63AITRT-D2q6Nmwa.js → erDiagram-Q63AITRT-BbsttUCs.js} +286 -284
  45. package/dist-lib/flowDiagram-23GEKE2U-CX5x3zVA.js +1641 -0
  46. package/dist-lib/{ganttDiagram-NO4QXBWP-C_Lj-cJB.js → ganttDiagram-NO4QXBWP-Bq0aSPs8.js} +2 -2
  47. package/dist-lib/gitGraphDiagram-IHSO6WYX-BjAezjIv.js +815 -0
  48. package/dist-lib/{graph-B68L3K2T.js → graph-DAHC4kPm.js} +2 -2
  49. package/dist-lib/{highlighted-body-OFNGDK62-C2DGVKV8.js → highlighted-body-OFNGDK62-DWhG_ijx.js} +1 -1
  50. package/dist-lib/index-B0neMIbR.js +16520 -0
  51. package/dist-lib/index-BBC0E3Qg.js +4994 -0
  52. package/dist-lib/{index-Dtkd4mEk.js → index-CE7H8LiZ.js} +2 -2
  53. package/dist-lib/{index-DWkBvb-9.js → index-FgVvPpIY.js} +2 -2
  54. package/dist-lib/index.js +1 -1
  55. package/dist-lib/{infoDiagram-FWYZ7A6U-BbUkT0KS.js → infoDiagram-FWYZ7A6U-Bo_FNR91.js} +2 -2
  56. package/dist-lib/ishikawaDiagram-FXEZZL3T-C5bGD-Eb.js +624 -0
  57. package/dist-lib/{journeyDiagram-5HDEW3XC-CgykmVSC.js → journeyDiagram-5HDEW3XC-C8qM7SxF.js} +4 -4
  58. package/dist-lib/kanban-definition-HUTT4EX6-C-EK5Puz.js +724 -0
  59. package/dist-lib/{katex-jHfnQmlp.js → katex-DoRnZ_sp.js} +1 -1
  60. package/dist-lib/{layout-BGrtsiRL.js → layout-DBbo_M5I.js} +2 -2
  61. package/dist-lib/{linear-B5ZSwawJ.js → linear-zGzX0-I0.js} +1 -1
  62. package/dist-lib/{map-hbfFlSln.js → map-DRdzG8Ho.js} +1 -1
  63. package/dist-lib/mermaid-GHXKKRXX-hOE9C3qW.js +4 -0
  64. package/dist-lib/{mindmap-definition-LN4V7U3C-CfhfeEht.js → mindmap-definition-LN4V7U3C-DlVCRx6k.js} +310 -311
  65. package/dist-lib/{pegDiagram-2B236MQR-CYDAJHPF.js → pegDiagram-2B236MQR-DrKNikeG.js} +4 -4
  66. package/dist-lib/{pieDiagram-ENE6RG2P-udKxQm4p.js → pieDiagram-ENE6RG2P-Fm_jc0HL.js} +83 -84
  67. package/dist-lib/quadrantDiagram-ABIIQ3AL-zDRY0VtB.js +1029 -0
  68. package/dist-lib/{railroadDiagram-RFXS5EU6-q0Svkmuy.js → railroadDiagram-RFXS5EU6-BQuFX39y.js} +4 -4
  69. package/dist-lib/{requirementDiagram-TGXJPOKE-tNxRI1gc.js → requirementDiagram-TGXJPOKE-BWwBQZXn.js} +269 -268
  70. package/dist-lib/{resume-session-sheet-Dr_81Gfm.js → resume-session-sheet-DTe_2QtJ.js} +2 -3
  71. package/dist-lib/sankeyDiagram-HTMAVEWB-BjRyuB6L.js +859 -0
  72. package/dist-lib/{sequenceDiagram-DBY2YBRQ-Dvl2_CXL.js → sequenceDiagram-DBY2YBRQ-69pcw_2M.js} +892 -899
  73. package/dist-lib/{session-token-usage-CGhHZ3lT.js → session-token-usage-DY4vFlfs.js} +82 -83
  74. package/dist-lib/{shadow-text-size-CBCTdbYU.js → shadow-text-size-smWA4wIU.js} +1 -2
  75. package/dist-lib/{shipped-page-p3oulUiM.js → shipped-page-B-ruG8li.js} +233 -236
  76. package/dist-lib/sizeCapture-X5ZJPWSS-DqkV8s1N.js +46 -0
  77. package/dist-lib/{stateDiagram-2N3HPSRC-CnWB7HvU.js → stateDiagram-2N3HPSRC-0vE3REl_.js} +4 -4
  78. package/dist-lib/{stateDiagram-v2-6OUMAXLB-DnZ0UI2p.js → stateDiagram-v2-6OUMAXLB-u_56Obsh.js} +2 -2
  79. package/dist-lib/{streamdown-response-Dbn0PKUH.js → streamdown-response-BQy3geXs.js} +290 -297
  80. package/dist-lib/styles.css +1 -1
  81. package/dist-lib/swimlanes-5IMT3BWC-H0raIBd1.js +5332 -0
  82. package/dist-lib/{swimlanesDiagram-G3AALYLV-CKyOeqF_.js → swimlanesDiagram-G3AALYLV-By52HaDu.js} +2 -2
  83. package/dist-lib/timeline-definition-FHXFAJF6-h1LLYUQk.js +1055 -0
  84. package/dist-lib/vennDiagram-L72KCM5P-B4wDw_Kh.js +1578 -0
  85. package/dist-lib/wardleyDiagram-EHGQE667-DLMBGiwD.js +678 -0
  86. package/dist-lib/{xychartDiagram-FW5EYKEG-m3s7caPv.js → xychartDiagram-FW5EYKEG-BHvf5Noj.js} +526 -496
  87. package/package.json +4 -3
  88. package/dist-lib/FileEditor-BIz0qCyW.js +0 -6892
  89. package/dist-lib/FileTreePane-BG2k7gTc.js +0 -8422
  90. package/dist-lib/chunk-2Q5K7J3B-Ex8Ly28R.js +0 -15
  91. package/dist-lib/chunk-JWPE2WC7-DFPBClX_.js +0 -9
  92. package/dist-lib/chunk-MOJQB5TN-dusfI9ob.js +0 -664
  93. package/dist-lib/chunk-RYQCIY6F-fkeERzIG.js +0 -315
  94. package/dist-lib/chunk-VR4S4FIN-hOZG7eF3.js +0 -20
  95. package/dist-lib/cynefin-VYW2F7L2-DQXPWaog.js +0 -23853
  96. package/dist-lib/dagre-VKFMJZFB-BhCjK7XQ.js +0 -346
  97. package/dist-lib/diagram-G47NLZAW-C3_z2t6T.js +0 -530
  98. package/dist-lib/diagram-NH7WQ7WH-DUdK08IT.js +0 -143
  99. package/dist-lib/diagram-OA4YK3LP-TUUyRYY3.js +0 -353
  100. package/dist-lib/flowDiagram-23GEKE2U-DU3S3biU.js +0 -1645
  101. package/dist-lib/gitGraphDiagram-IHSO6WYX-CvGu0XAR.js +0 -828
  102. package/dist-lib/index-DcwavxA1.js +0 -5062
  103. package/dist-lib/index-JkCQXUYs.js +0 -16566
  104. package/dist-lib/ishikawaDiagram-FXEZZL3T-D_Y6Tuyb.js +0 -622
  105. package/dist-lib/kanban-definition-HUTT4EX6-CPFLTskY.js +0 -726
  106. package/dist-lib/mermaid-GHXKKRXX-Ox_2d3uB.js +0 -4
  107. package/dist-lib/quadrantDiagram-ABIIQ3AL-BmDmLczk.js +0 -1025
  108. package/dist-lib/sankeyDiagram-HTMAVEWB-B9Bl7f2P.js +0 -847
  109. package/dist-lib/sizeCapture-X5ZJPWSS-B1EeO3N9.js +0 -47
  110. package/dist-lib/swimlanes-5IMT3BWC-CvqDJcS9.js +0 -5353
  111. package/dist-lib/timeline-definition-FHXFAJF6-b15X0Oru.js +0 -1066
  112. package/dist-lib/vennDiagram-L72KCM5P-C4lh5m77.js +0 -1585
  113. package/dist-lib/wardleyDiagram-EHGQE667-Cev6fT_D.js +0 -684
@@ -0,0 +1,8 @@
1
+ import { _ as i } from "./index-B0neMIbR.js";
2
+ function t(c, e) {
3
+ c.accDescr && e.setAccDescription?.(c.accDescr), c.accTitle && e.setAccTitle?.(c.accTitle), c.title && e.setDiagramTitle?.(c.title);
4
+ }
5
+ i(t, "populateCommonDb");
6
+ export {
7
+ t as p
8
+ };
@@ -0,0 +1,670 @@
1
+ import { _ as p, l as w, F as L, z as E, q as I, W as X, e as q, i as H, c as G } from "./index-B0neMIbR.js";
2
+ var z = "", b = "", N = "", A = [], R = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ p((e) => H(e, G()), "sanitizeText"), F = /* @__PURE__ */ p((e) => {
3
+ switch (e.type) {
4
+ case "terminal":
5
+ return { ...e, value: k(e.value) };
6
+ case "nonterminal":
7
+ return { ...e, name: k(e.name) };
8
+ case "sequence":
9
+ return { ...e, elements: e.elements.map(F) };
10
+ case "choice":
11
+ return { ...e, alternatives: e.alternatives.map(F) };
12
+ case "optional":
13
+ return { ...e, element: F(e.element) };
14
+ case "repetition":
15
+ return {
16
+ ...e,
17
+ element: F(e.element),
18
+ separator: e.separator ? F(e.separator) : void 0
19
+ };
20
+ case "special":
21
+ return { ...e, text: k(e.text) };
22
+ }
23
+ }, "sanitizeAstNode"), U = /* @__PURE__ */ p(() => {
24
+ z = "", b = "", N = "", A.length = 0, R.clear(), I(), w.debug("[Railroad] Database cleared");
25
+ }, "clear"), W = /* @__PURE__ */ p((e) => {
26
+ z = k(e), w.debug("[Railroad] Title set:", e);
27
+ }, "setTitle"), _ = /* @__PURE__ */ p(() => z, "getTitle"), j = /* @__PURE__ */ p((e) => {
28
+ const i = {
29
+ ...e,
30
+ name: k(e.name),
31
+ definition: F(e.definition),
32
+ comment: e.comment ? k(e.comment) : void 0
33
+ };
34
+ w.debug("[Railroad] Adding rule:", i.name), R.has(i.name) && w.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`), A.push(i), R.set(i.name, i);
35
+ }, "addRule"), K = /* @__PURE__ */ p(() => A, "getRules"), J = /* @__PURE__ */ p((e) => R.get(e), "getRule"), Q = /* @__PURE__ */ p((e) => {
36
+ b = k(e).replace(/^\s+/g, ""), w.debug("[Railroad] Accessibility title set:", e);
37
+ }, "setAccTitle"), Z = /* @__PURE__ */ p(() => b, "getAccTitle"), V = /* @__PURE__ */ p((e) => {
38
+ N = k(e).replace(/\n\s+/g, `
39
+ `), w.debug("[Railroad] Accessibility description set:", e);
40
+ }, "setAccDescription"), ee = /* @__PURE__ */ p(() => N, "getAccDescription"), te = W, re = _, ie = {
41
+ clear: U,
42
+ setTitle: W,
43
+ getTitle: _,
44
+ addRule: j,
45
+ getRules: K,
46
+ getRule: J,
47
+ setAccTitle: Q,
48
+ getAccTitle: Z,
49
+ setAccDescription: V,
50
+ getAccDescription: ee,
51
+ setDiagramTitle: te,
52
+ getDiagramTitle: re
53
+ }, g = {
54
+ // Layout
55
+ compactMode: !1,
56
+ // Spacing
57
+ padding: 10,
58
+ verticalSeparation: 8,
59
+ horizontalSeparation: 10,
60
+ arcRadius: 10,
61
+ // Typography
62
+ fontSize: 14,
63
+ fontFamily: "monospace",
64
+ // Colors - Terminal
65
+ terminalFill: "#FFFFC0",
66
+ terminalStroke: "#000000",
67
+ terminalTextColor: "#000000",
68
+ // Colors - Non-terminal
69
+ nonTerminalFill: "#FFFFFF",
70
+ nonTerminalStroke: "#000000",
71
+ nonTerminalTextColor: "#000000",
72
+ // Colors - Lines
73
+ lineColor: "#000000",
74
+ strokeWidth: 2,
75
+ // Colors - Markers
76
+ markerFill: "#000000",
77
+ // Colors - Comment
78
+ commentFill: "#E8E8E8",
79
+ commentStroke: "#888888",
80
+ commentTextColor: "#666666",
81
+ // Colors - Special
82
+ specialFill: "#F0E0FF",
83
+ specialStroke: "#8800CC",
84
+ // Other
85
+ ruleNameColor: "#000066",
86
+ showMarkers: !0,
87
+ markerRadius: 5
88
+ }, ne = /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i, ae = /^[\w "',.-]+$/, oe = /* @__PURE__ */ new Set([
89
+ "compactMode",
90
+ "padding",
91
+ "verticalSeparation",
92
+ "horizontalSeparation",
93
+ "arcRadius",
94
+ "fontSize",
95
+ "fontFamily",
96
+ "terminalFill",
97
+ "terminalStroke",
98
+ "terminalTextColor",
99
+ "nonTerminalFill",
100
+ "nonTerminalStroke",
101
+ "nonTerminalTextColor",
102
+ "lineColor",
103
+ "strokeWidth",
104
+ "markerFill",
105
+ "commentFill",
106
+ "commentStroke",
107
+ "commentTextColor",
108
+ "specialFill",
109
+ "specialStroke",
110
+ "ruleNameColor",
111
+ "showMarkers",
112
+ "markerRadius"
113
+ ]), B = /* @__PURE__ */ p((e) => e ? Object.keys(e).every(
114
+ (i) => i === "railroad" || oe.has(i)
115
+ ) : !1, "isRailroadStyleOptions"), le = /* @__PURE__ */ p((e) => e ? "railroad" in e && e.railroad ? e.railroad : B(e) ? e : {} : {}, "extractRailroadOverrides"), se = /* @__PURE__ */ p((e) => {
116
+ if (!e || B(e))
117
+ return {};
118
+ const {
119
+ railroad: i,
120
+ svgId: a,
121
+ theme: r,
122
+ look: t,
123
+ ...n
124
+ } = e;
125
+ return n;
126
+ }, "extractThemeOverrides"), m = /* @__PURE__ */ p((e, i) => {
127
+ if (typeof e != "string")
128
+ return i;
129
+ const a = e.trim();
130
+ return ne.test(a) ? a : i;
131
+ }, "sanitizeColorValue"), Y = /* @__PURE__ */ p((e, i) => {
132
+ if (typeof e != "string")
133
+ return i;
134
+ const a = e.trim();
135
+ return ae.test(a) ? a : i;
136
+ }, "sanitizeFontFamilyValue"), S = /* @__PURE__ */ p((e, i) => {
137
+ const a = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : Number.NaN;
138
+ return Number.isFinite(a) && a >= 0 ? a : i;
139
+ }, "sanitizeNumberValue"), de = /* @__PURE__ */ p((e) => {
140
+ const i = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : Number.NaN;
141
+ return Number.isFinite(i) && i > 0 ? i : void 0;
142
+ }, "parseThemeFontSize"), ce = /* @__PURE__ */ p((e) => {
143
+ const i = Y(
144
+ e.fontFamily,
145
+ g.fontFamily
146
+ ), a = de(e.fontSize) ?? g.fontSize;
147
+ return {
148
+ ...g,
149
+ fontFamily: i,
150
+ fontSize: a,
151
+ terminalFill: m(
152
+ e.secondBkg ?? e.secondaryColor,
153
+ g.terminalFill
154
+ ),
155
+ terminalStroke: m(
156
+ e.secondaryBorderColor ?? e.lineColor,
157
+ g.terminalStroke
158
+ ),
159
+ terminalTextColor: m(
160
+ e.secondaryTextColor ?? e.textColor,
161
+ g.terminalTextColor
162
+ ),
163
+ nonTerminalFill: m(
164
+ e.mainBkg ?? e.background,
165
+ g.nonTerminalFill
166
+ ),
167
+ nonTerminalStroke: m(
168
+ e.primaryBorderColor ?? e.lineColor,
169
+ g.nonTerminalStroke
170
+ ),
171
+ nonTerminalTextColor: m(
172
+ e.primaryTextColor ?? e.textColor,
173
+ g.nonTerminalTextColor
174
+ ),
175
+ lineColor: m(e.lineColor, g.lineColor),
176
+ markerFill: m(e.lineColor, g.markerFill),
177
+ commentFill: m(
178
+ e.labelBackground ?? e.tertiaryColor,
179
+ g.commentFill
180
+ ),
181
+ commentStroke: m(
182
+ e.tertiaryBorderColor ?? e.lineColor,
183
+ g.commentStroke
184
+ ),
185
+ commentTextColor: m(
186
+ e.tertiaryTextColor ?? e.textColor,
187
+ g.commentTextColor
188
+ ),
189
+ specialFill: m(
190
+ e.tertiaryColor ?? e.secondaryColor,
191
+ g.specialFill
192
+ ),
193
+ specialStroke: m(
194
+ e.tertiaryBorderColor ?? e.secondaryBorderColor,
195
+ g.specialStroke
196
+ ),
197
+ ruleNameColor: m(
198
+ e.titleColor ?? e.textColor,
199
+ g.ruleNameColor
200
+ )
201
+ };
202
+ }, "buildThemeDefaults"), M = /* @__PURE__ */ p((e) => {
203
+ const i = E(), a = {
204
+ ...X(),
205
+ ...i.themeVariables ?? {},
206
+ ...se(e)
207
+ }, r = ce(a), t = {
208
+ ...i.railroad ?? {},
209
+ ...le(e)
210
+ };
211
+ return {
212
+ compactMode: t.compactMode ?? r.compactMode,
213
+ padding: S(t.padding, r.padding),
214
+ verticalSeparation: S(
215
+ t.verticalSeparation,
216
+ r.verticalSeparation
217
+ ),
218
+ horizontalSeparation: S(
219
+ t.horizontalSeparation,
220
+ r.horizontalSeparation
221
+ ),
222
+ arcRadius: S(t.arcRadius, r.arcRadius),
223
+ fontSize: S(t.fontSize, r.fontSize),
224
+ fontFamily: Y(t.fontFamily, r.fontFamily),
225
+ terminalFill: m(t.terminalFill, r.terminalFill),
226
+ terminalStroke: m(
227
+ t.terminalStroke,
228
+ r.terminalStroke
229
+ ),
230
+ terminalTextColor: m(
231
+ t.terminalTextColor,
232
+ r.terminalTextColor
233
+ ),
234
+ nonTerminalFill: m(
235
+ t.nonTerminalFill,
236
+ r.nonTerminalFill
237
+ ),
238
+ nonTerminalStroke: m(
239
+ t.nonTerminalStroke,
240
+ r.nonTerminalStroke
241
+ ),
242
+ nonTerminalTextColor: m(
243
+ t.nonTerminalTextColor,
244
+ r.nonTerminalTextColor
245
+ ),
246
+ lineColor: m(t.lineColor, r.lineColor),
247
+ strokeWidth: S(t.strokeWidth, r.strokeWidth),
248
+ markerFill: m(t.markerFill, r.markerFill),
249
+ commentFill: m(t.commentFill, r.commentFill),
250
+ commentStroke: m(t.commentStroke, r.commentStroke),
251
+ commentTextColor: m(
252
+ t.commentTextColor,
253
+ r.commentTextColor
254
+ ),
255
+ specialFill: m(t.specialFill, r.specialFill),
256
+ specialStroke: m(t.specialStroke, r.specialStroke),
257
+ ruleNameColor: m(t.ruleNameColor, r.ruleNameColor),
258
+ showMarkers: t.showMarkers ?? r.showMarkers,
259
+ markerRadius: S(t.markerRadius, r.markerRadius)
260
+ };
261
+ }, "buildRailroadStyleOptions"), ue = /* @__PURE__ */ p((e) => {
262
+ const {
263
+ fontFamily: i,
264
+ fontSize: a,
265
+ terminalFill: r,
266
+ terminalStroke: t,
267
+ terminalTextColor: n,
268
+ nonTerminalFill: h,
269
+ nonTerminalStroke: s,
270
+ nonTerminalTextColor: o,
271
+ lineColor: u,
272
+ strokeWidth: c,
273
+ markerFill: d,
274
+ commentFill: x,
275
+ commentStroke: l,
276
+ commentTextColor: f,
277
+ specialFill: y,
278
+ specialStroke: v,
279
+ ruleNameColor: C
280
+ } = M(e);
281
+ return `
282
+ .railroad-diagram {
283
+ font-family: ${i};
284
+ font-size: ${a}px;
285
+ }
286
+
287
+ .railroad-terminal rect {
288
+ fill: ${r};
289
+ stroke: ${t};
290
+ stroke-width: ${c}px;
291
+ }
292
+
293
+ .railroad-terminal text {
294
+ fill: ${n};
295
+ font-family: ${i};
296
+ font-size: ${a}px;
297
+ text-anchor: middle;
298
+ dominant-baseline: middle;
299
+ }
300
+
301
+ .railroad-nonterminal rect {
302
+ fill: ${h};
303
+ stroke: ${s};
304
+ stroke-width: ${c}px;
305
+ }
306
+
307
+ .railroad-nonterminal text {
308
+ fill: ${o};
309
+ font-family: ${i};
310
+ font-size: ${a}px;
311
+ text-anchor: middle;
312
+ dominant-baseline: middle;
313
+ }
314
+
315
+ .railroad-line {
316
+ stroke: ${u};
317
+ stroke-width: ${c}px;
318
+ fill: none;
319
+ }
320
+
321
+ .railroad-start circle,
322
+ .railroad-end circle {
323
+ fill: ${d};
324
+ }
325
+
326
+ .railroad-comment ellipse {
327
+ fill: ${x};
328
+ stroke: ${l};
329
+ stroke-width: ${c}px;
330
+ }
331
+
332
+ .railroad-comment text {
333
+ fill: ${f};
334
+ font-style: italic;
335
+ font-family: ${i};
336
+ font-size: ${a}px;
337
+ text-anchor: middle;
338
+ dominant-baseline: middle;
339
+ }
340
+
341
+ .railroad-special rect {
342
+ fill: ${y};
343
+ stroke: ${v};
344
+ stroke-width: ${c}px;
345
+ stroke-dasharray: 5,3;
346
+ }
347
+
348
+ .railroad-special text {
349
+ fill: ${o};
350
+ font-family: ${i};
351
+ font-size: ${a}px;
352
+ text-anchor: middle;
353
+ dominant-baseline: middle;
354
+ }
355
+
356
+ .railroad-rule-name {
357
+ font-weight: bold;
358
+ fill: ${C};
359
+ font-family: ${i};
360
+ font-size: ${a}px;
361
+ }
362
+
363
+ .railroad-group {
364
+ /* Grouping container, no specific styles */
365
+ }
366
+ `;
367
+ }, "getStyles"), T = class {
368
+ constructor() {
369
+ this.d = "";
370
+ }
371
+ static {
372
+ p(this, "PathBuilder");
373
+ }
374
+ moveTo(e, i) {
375
+ return this.d += `M ${e} ${i} `, this;
376
+ }
377
+ lineTo(e, i) {
378
+ return this.d += `L ${e} ${i} `, this;
379
+ }
380
+ horizontalTo(e) {
381
+ return this.d += `H ${e} `, this;
382
+ }
383
+ verticalTo(e) {
384
+ return this.d += `V ${e} `, this;
385
+ }
386
+ arcTo(e, i, a, r, t, n, h) {
387
+ return this.d += `A ${e} ${i} ${a} ${r ? 1 : 0} ${t ? 1 : 0} ${n} ${h} `, this;
388
+ }
389
+ build() {
390
+ return this.d.trim();
391
+ }
392
+ }, me = class {
393
+ constructor(e, i = M()) {
394
+ this.textCache = /* @__PURE__ */ new Map(), this.svg = e, this.config = i;
395
+ }
396
+ static {
397
+ p(this, "RailroadRenderer");
398
+ }
399
+ /**
400
+ * Measure text dimensions
401
+ */
402
+ measureText(e) {
403
+ if (this.textCache.has(e))
404
+ return this.textCache.get(e);
405
+ const i = this.svg.append("text").attr("font-family", this.config.fontFamily).attr("font-size", this.config.fontSize).text(e), a = i.node().getBBox(), r = { width: a.width, height: a.height };
406
+ return i.remove(), this.textCache.set(e, r), r;
407
+ }
408
+ /**
409
+ * Render terminal symbol (rounded rectangle)
410
+ */
411
+ renderTerminal(e, i) {
412
+ const a = this.measureText(i), r = a.width + this.config.padding * 2, t = a.height + this.config.padding * 2, n = e.append("g").attr("class", "railroad-terminal");
413
+ return n.append("rect").attr("x", 0).attr("y", 0).attr("width", r).attr("height", t).attr("rx", 10).attr("ry", 10), n.append("text").attr("x", r / 2).attr("y", t / 2).text(i), {
414
+ element: n.node(),
415
+ dimensions: {
416
+ width: r,
417
+ height: t,
418
+ up: t / 2,
419
+ down: t / 2
420
+ }
421
+ };
422
+ }
423
+ /**
424
+ * Render non-terminal symbol (rectangle)
425
+ */
426
+ renderNonTerminal(e, i) {
427
+ const a = this.measureText(i), r = a.width + this.config.padding * 2, t = a.height + this.config.padding * 2, n = e.append("g").attr("class", "railroad-nonterminal");
428
+ return n.append("rect").attr("x", 0).attr("y", 0).attr("width", r).attr("height", t), n.append("text").attr("x", r / 2).attr("y", t / 2).text(i), {
429
+ element: n.node(),
430
+ dimensions: {
431
+ width: r,
432
+ height: t,
433
+ up: t / 2,
434
+ down: t / 2
435
+ }
436
+ };
437
+ }
438
+ /**
439
+ * Render sequence (horizontal concatenation)
440
+ */
441
+ renderSequence(e, i) {
442
+ const a = i.map((o) => this.renderExpression(e, o));
443
+ let r = 0, t = 0, n = 0;
444
+ for (const o of a)
445
+ r += o.dimensions.width, t = Math.max(t, o.dimensions.up), n = Math.max(n, o.dimensions.down);
446
+ r += (a.length - 1) * this.config.horizontalSeparation;
447
+ const h = e.append("g").attr("class", "railroad-sequence");
448
+ let s = 0;
449
+ for (let o = 0; o < a.length; o++) {
450
+ const u = a[o], c = t - u.dimensions.up;
451
+ if (h.node().appendChild(u.element).setAttribute("transform", `translate(${s}, ${c})`), o < a.length - 1) {
452
+ const x = s + u.dimensions.width, l = x + this.config.horizontalSeparation, f = t;
453
+ h.append("path").attr("class", "railroad-line").attr("d", new T().moveTo(x, f).lineTo(l, f).build());
454
+ }
455
+ s += u.dimensions.width + this.config.horizontalSeparation;
456
+ }
457
+ return {
458
+ element: h.node(),
459
+ dimensions: {
460
+ width: r,
461
+ height: t + n,
462
+ up: t,
463
+ down: n
464
+ }
465
+ };
466
+ }
467
+ /**
468
+ * Render choice (vertical alternatives)
469
+ */
470
+ renderChoice(e, i) {
471
+ const a = i.map((d) => this.renderExpression(e, d));
472
+ let r = 0, t = 0;
473
+ for (const d of a)
474
+ r = Math.max(r, d.dimensions.width), t += d.dimensions.height;
475
+ t += (a.length - 1) * this.config.verticalSeparation;
476
+ const n = this.config.arcRadius, h = n * 4, s = r + h, o = e.append("g").attr("class", "railroad-choice");
477
+ let u = 0;
478
+ const c = t / 2;
479
+ for (const d of a) {
480
+ const x = u, l = x + d.dimensions.up, f = n * 2 + (r - d.dimensions.width) / 2;
481
+ o.node().appendChild(d.element).setAttribute("transform", `translate(${f}, ${x})`);
482
+ const v = new T(), C = l > c;
483
+ l === c ? v.moveTo(0, c).lineTo(f, l) : v.moveTo(0, c).arcTo(
484
+ n,
485
+ n,
486
+ 0,
487
+ !1,
488
+ C,
489
+ n,
490
+ c + (C ? n : -n)
491
+ ).lineTo(n, l - (C ? n : -n)).arcTo(n, n, 0, !1, !C, n * 2, l).lineTo(f, l), o.append("path").attr("class", "railroad-line").attr("d", v.build());
492
+ const $ = new T(), O = f + d.dimensions.width, P = s - n * 2;
493
+ l === c ? $.moveTo(O, l).lineTo(s, c) : $.moveTo(O, l).lineTo(P, l).arcTo(
494
+ n,
495
+ n,
496
+ 0,
497
+ !1,
498
+ !C,
499
+ s - n,
500
+ l + (C ? -n : n)
501
+ ).lineTo(s - n, c + (C ? n : -n)).arcTo(n, n, 0, !1, C, s, c), o.append("path").attr("class", "railroad-line").attr("d", $.build()), u += d.dimensions.height + this.config.verticalSeparation;
502
+ }
503
+ return {
504
+ element: o.node(),
505
+ dimensions: {
506
+ width: s,
507
+ height: t,
508
+ up: c,
509
+ down: t - c
510
+ }
511
+ };
512
+ }
513
+ /**
514
+ * Render optional (bypass path above)
515
+ */
516
+ renderOptional(e, i) {
517
+ const a = this.renderExpression(e, i), r = this.config.arcRadius, t = r * 2, n = a.dimensions.width + r * 4, h = a.dimensions.height + t, s = e.append("g").attr("class", "railroad-optional"), o = r * 2, u = t;
518
+ s.node().appendChild(a.element).setAttribute("transform", `translate(${o}, ${u})`);
519
+ const d = u + a.dimensions.up, x = new T().moveTo(0, d).lineTo(r * 2, d);
520
+ s.append("path").attr("class", "railroad-line").attr("d", x.build());
521
+ const l = new T().moveTo(o + a.dimensions.width, d).lineTo(n, d);
522
+ s.append("path").attr("class", "railroad-line").attr("d", l.build());
523
+ const f = new T().moveTo(0, d).arcTo(r, r, 0, !1, !1, r, d - r).lineTo(r, r).arcTo(r, r, 0, !1, !0, r * 2, 0).lineTo(n - r * 2, 0).arcTo(r, r, 0, !1, !0, n - r, r).lineTo(n - r, d - r).arcTo(r, r, 0, !1, !1, n, d);
524
+ return s.append("path").attr("class", "railroad-line").attr("d", f.build()), {
525
+ element: s.node(),
526
+ dimensions: {
527
+ width: n,
528
+ height: h,
529
+ up: d,
530
+ down: h - d
531
+ }
532
+ };
533
+ }
534
+ /**
535
+ * Render repetition (loop back path)
536
+ */
537
+ renderRepetition(e, i, a) {
538
+ const r = this.renderExpression(e, i), t = this.config.arcRadius, n = t * 2, h = r.dimensions.width + t * 4, s = a === 0, o = r.dimensions.height + n + (s ? n : 0), u = e.append("g").attr("class", "railroad-repetition"), c = t * 2, d = s ? n : 0;
539
+ u.node().appendChild(r.element).setAttribute("transform", `translate(${c}, ${d})`);
540
+ const l = d + r.dimensions.up;
541
+ u.append("path").attr("class", "railroad-line").attr(
542
+ "d",
543
+ new T().moveTo(0, l).lineTo(t * 2, l).build()
544
+ ), u.append("path").attr("class", "railroad-line").attr(
545
+ "d",
546
+ new T().moveTo(c + r.dimensions.width, l).lineTo(h, l).build()
547
+ );
548
+ const f = d + r.dimensions.height + t, y = new T().moveTo(c + r.dimensions.width, l).arcTo(
549
+ t,
550
+ t,
551
+ 0,
552
+ !1,
553
+ !0,
554
+ c + r.dimensions.width + t,
555
+ l + t
556
+ ).lineTo(c + r.dimensions.width + t, f).arcTo(
557
+ t,
558
+ t,
559
+ 0,
560
+ !1,
561
+ !0,
562
+ c + r.dimensions.width,
563
+ f + t
564
+ ).lineTo(t * 2, f + t).arcTo(t, t, 0, !1, !0, t, f).lineTo(t, l + t).arcTo(t, t, 0, !1, !0, t * 2, l);
565
+ if (u.append("path").attr("class", "railroad-line").attr("d", y.build()), s) {
566
+ const v = new T().moveTo(0, l).arcTo(t, t, 0, !1, !1, t, l - t).lineTo(t, t).arcTo(t, t, 0, !1, !0, t * 2, 0).lineTo(h - t * 2, 0).arcTo(t, t, 0, !1, !0, h - t, t).lineTo(h - t, l - t).arcTo(t, t, 0, !1, !1, h, l);
567
+ u.append("path").attr("class", "railroad-line").attr("d", v.build());
568
+ }
569
+ return {
570
+ element: u.node(),
571
+ dimensions: {
572
+ width: h,
573
+ height: o,
574
+ up: l,
575
+ down: o - l
576
+ }
577
+ };
578
+ }
579
+ /**
580
+ * Render special sequence
581
+ */
582
+ renderSpecial(e, i) {
583
+ const a = this.measureText("? " + i + " ?"), r = a.width + this.config.padding * 2, t = a.height + this.config.padding * 2, n = e.append("g").attr("class", "railroad-special");
584
+ return n.append("rect").attr("x", 0).attr("y", 0).attr("width", r).attr("height", t), n.append("text").attr("x", r / 2).attr("y", t / 2).text("? " + i + " ?"), {
585
+ element: n.node(),
586
+ dimensions: {
587
+ width: r,
588
+ height: t,
589
+ up: t / 2,
590
+ down: t / 2
591
+ }
592
+ };
593
+ }
594
+ /**
595
+ * Render an expression (recursive)
596
+ */
597
+ renderExpression(e, i) {
598
+ switch (i.type) {
599
+ case "terminal":
600
+ return this.renderTerminal(e, i.value);
601
+ case "nonterminal":
602
+ return this.renderNonTerminal(e, i.name);
603
+ case "sequence":
604
+ return this.renderSequence(e, i.elements);
605
+ case "choice":
606
+ return this.renderChoice(e, i.alternatives);
607
+ case "optional":
608
+ return this.renderOptional(e, i.element);
609
+ case "repetition":
610
+ return this.renderRepetition(e, i.element, i.min);
611
+ case "special":
612
+ return this.renderSpecial(e, i.text);
613
+ default:
614
+ throw new Error(`Unknown node type: ${i.type}`);
615
+ }
616
+ }
617
+ /**
618
+ * Render a single rule
619
+ */
620
+ renderRule(e, i) {
621
+ const a = this.svg.append("g").attr("class", "railroad-rule").attr("transform", `translate(0, ${i})`), r = e.name + " =", t = this.measureText(r).width + 20, n = t + 20, h = a.append("g"), s = this.renderExpression(h, e.definition), o = Math.max(20, s.dimensions.up), u = o - s.dimensions.up;
622
+ return h.attr("transform", `translate(${n}, ${u})`), a.append("g").attr("class", "railroad-rule-name-group").append("text").attr("class", "railroad-rule-name").attr("x", 0).attr("y", o).text(r), a.append("g").attr("class", "railroad-start").append("circle").attr("cx", t).attr("cy", o).attr("r", this.config.markerRadius), a.append("g").attr("class", "railroad-end").append("circle").attr("cx", n + s.dimensions.width + 10).attr("cy", o).attr("r", this.config.markerRadius), a.append("path").attr("class", "railroad-line").attr(
623
+ "d",
624
+ new T().moveTo(t + this.config.markerRadius, o).lineTo(n, o).build()
625
+ ), a.append("path").attr("class", "railroad-line").attr(
626
+ "d",
627
+ new T().moveTo(n + s.dimensions.width, o).lineTo(n + s.dimensions.width + 10 - this.config.markerRadius, o).build()
628
+ ), {
629
+ height: Math.max(40, u + s.dimensions.height + this.config.padding * 2),
630
+ width: n + s.dimensions.width + 10 + this.config.markerRadius
631
+ };
632
+ }
633
+ /**
634
+ * Render all rules
635
+ */
636
+ renderDiagram(e) {
637
+ let i = this.config.padding, a = 0;
638
+ for (const r of e) {
639
+ const t = this.renderRule(r, i);
640
+ i += t.height + this.config.verticalSeparation, a = Math.max(a, t.width);
641
+ }
642
+ return {
643
+ width: a + this.config.padding * 2,
644
+ height: i + this.config.padding
645
+ };
646
+ }
647
+ }, D = /* @__PURE__ */ p((e, i, a) => {
648
+ q(e, i.height, i.width, a), e.attr("viewBox", `0 0 ${i.width} ${i.height}`);
649
+ }, "configureRailroadSvgSize"), he = /* @__PURE__ */ p((e, i, a) => {
650
+ w.debug(`[Railroad] Rendering diagram
651
+ ` + e);
652
+ try {
653
+ const r = L(i);
654
+ r.attr("class", "railroad-diagram");
655
+ const n = E().railroad?.useMaxWidth ?? !0, h = ie.getRules();
656
+ if (w.debug(`[Railroad] Rendering ${h.length} rules`), h.length === 0) {
657
+ w.warn("[Railroad] No rules to render"), D(r, { height: 100, width: 200 }, n);
658
+ return;
659
+ }
660
+ const o = new me(r, M()).renderDiagram(h);
661
+ D(r, o, n), w.debug("[Railroad] Render complete");
662
+ } catch (r) {
663
+ throw w.error("[Railroad] Render error:", r), r;
664
+ }
665
+ }, "draw"), ge = { draw: he };
666
+ export {
667
+ ie as d,
668
+ ue as g,
669
+ ge as r
670
+ };