schematex 0.2.0 → 0.2.3

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 (200) hide show
  1. package/README.md +1 -1
  2. package/dist/ai/ai-sdk.cjs +85 -0
  3. package/dist/ai/ai-sdk.cjs.map +1 -0
  4. package/dist/ai/ai-sdk.d.cts +30 -0
  5. package/dist/ai/ai-sdk.d.ts +30 -0
  6. package/dist/ai/ai-sdk.js +83 -0
  7. package/dist/ai/ai-sdk.js.map +1 -0
  8. package/dist/ai/index.cjs +60 -0
  9. package/dist/ai/index.cjs.map +1 -0
  10. package/dist/ai/index.d.cts +155 -0
  11. package/dist/ai/index.d.ts +155 -0
  12. package/dist/ai/index.js +23 -0
  13. package/dist/ai/index.js.map +1 -0
  14. package/dist/browser.cjs +22 -21
  15. package/dist/browser.cjs.map +1 -1
  16. package/dist/browser.js +20 -19
  17. package/dist/browser.js.map +1 -1
  18. package/dist/{chunk-HLYA4QBB.js → chunk-2BM3HJSK.js} +545 -101
  19. package/dist/chunk-2BM3HJSK.js.map +1 -0
  20. package/dist/{chunk-ZO77FHBF.cjs → chunk-2JDVJRR3.cjs} +14 -6
  21. package/dist/chunk-2JDVJRR3.cjs.map +1 -0
  22. package/dist/{chunk-TIGP2OEJ.js → chunk-2VNMKOUO.js} +20 -5
  23. package/dist/chunk-2VNMKOUO.js.map +1 -0
  24. package/dist/{chunk-ULERCTGS.cjs → chunk-3YZ6FPQW.cjs} +36 -30
  25. package/dist/chunk-3YZ6FPQW.cjs.map +1 -0
  26. package/dist/{chunk-GEPBET4L.js → chunk-45KP67RR.js} +14 -6
  27. package/dist/chunk-45KP67RR.js.map +1 -0
  28. package/dist/chunk-4QP37LD3.js +1112 -0
  29. package/dist/chunk-4QP37LD3.js.map +1 -0
  30. package/dist/{chunk-HKRYKEOV.cjs → chunk-4S2WILLW.cjs} +4 -4
  31. package/dist/{chunk-HKRYKEOV.cjs.map → chunk-4S2WILLW.cjs.map} +1 -1
  32. package/dist/{chunk-IMHR3S5H.cjs → chunk-5AEN2PLB.cjs} +17 -9
  33. package/dist/chunk-5AEN2PLB.cjs.map +1 -0
  34. package/dist/{chunk-SPIW4VWP.js → chunk-5YYAYW67.js} +3 -3
  35. package/dist/{chunk-SPIW4VWP.js.map → chunk-5YYAYW67.js.map} +1 -1
  36. package/dist/{chunk-CEV3GZA3.cjs → chunk-6LZJTAA3.cjs} +552 -108
  37. package/dist/chunk-6LZJTAA3.cjs.map +1 -0
  38. package/dist/{chunk-IY52OWPG.cjs → chunk-A5D2IMOX.cjs} +18 -10
  39. package/dist/chunk-A5D2IMOX.cjs.map +1 -0
  40. package/dist/{chunk-AMP2FFES.cjs → chunk-B37IKTI7.cjs} +229 -52
  41. package/dist/chunk-B37IKTI7.cjs.map +1 -0
  42. package/dist/{chunk-LKHWBDWZ.cjs → chunk-B6INLQBU.cjs} +17 -11
  43. package/dist/chunk-B6INLQBU.cjs.map +1 -0
  44. package/dist/{chunk-DTMCQXXC.cjs → chunk-COLTVQWR.cjs} +184 -16
  45. package/dist/chunk-COLTVQWR.cjs.map +1 -0
  46. package/dist/{chunk-S6VPECM3.cjs → chunk-D7EHZFK4.cjs} +20 -5
  47. package/dist/chunk-D7EHZFK4.cjs.map +1 -0
  48. package/dist/chunk-DNZFOCV7.js +796 -0
  49. package/dist/chunk-DNZFOCV7.js.map +1 -0
  50. package/dist/{chunk-ZGKEFVJQ.cjs → chunk-E65ITQXV.cjs} +188 -32
  51. package/dist/chunk-E65ITQXV.cjs.map +1 -0
  52. package/dist/{chunk-7WXAAVR3.js → chunk-FCGHV6ZK.js} +17 -9
  53. package/dist/chunk-FCGHV6ZK.js.map +1 -0
  54. package/dist/{chunk-A74ZCP5I.js → chunk-FE6GAUNW.js} +36 -30
  55. package/dist/chunk-FE6GAUNW.js.map +1 -0
  56. package/dist/{chunk-MXJ6FHSY.js → chunk-JDTB7IKL.js} +3 -3
  57. package/dist/{chunk-MXJ6FHSY.js.map → chunk-JDTB7IKL.js.map} +1 -1
  58. package/dist/{chunk-RQX53J6M.js → chunk-LR4X4ZRG.js} +180 -24
  59. package/dist/chunk-LR4X4ZRG.js.map +1 -0
  60. package/dist/{chunk-MRGS54WN.js → chunk-M5B2UUNW.js} +3 -3
  61. package/dist/{chunk-MRGS54WN.js.map → chunk-M5B2UUNW.js.map} +1 -1
  62. package/dist/{chunk-LXNFVHDT.cjs → chunk-MCFQAUQV.cjs} +21 -13
  63. package/dist/chunk-MCFQAUQV.cjs.map +1 -0
  64. package/dist/chunk-MOU5QRZY.cjs +1121 -0
  65. package/dist/chunk-MOU5QRZY.cjs.map +1 -0
  66. package/dist/{chunk-TPA36ULU.js → chunk-OC22GGQN.js} +223 -46
  67. package/dist/chunk-OC22GGQN.js.map +1 -0
  68. package/dist/{chunk-2OIW3MAE.js → chunk-PGALHQFF.js} +3 -3
  69. package/dist/{chunk-2OIW3MAE.js.map → chunk-PGALHQFF.js.map} +1 -1
  70. package/dist/{chunk-3M7QWADF.cjs → chunk-QSQX77S2.cjs} +4 -4
  71. package/dist/{chunk-3M7QWADF.cjs.map → chunk-QSQX77S2.cjs.map} +1 -1
  72. package/dist/{chunk-VP54YPOX.cjs → chunk-QXIGHMH2.cjs} +498 -177
  73. package/dist/chunk-QXIGHMH2.cjs.map +1 -0
  74. package/dist/{chunk-YO4GU6JX.js → chunk-RP5UATRA.js} +175 -7
  75. package/dist/chunk-RP5UATRA.js.map +1 -0
  76. package/dist/{chunk-M6AMNXQ7.js → chunk-S3RBKJM5.js} +478 -157
  77. package/dist/chunk-S3RBKJM5.js.map +1 -0
  78. package/dist/{chunk-JZGFSRVT.js → chunk-SN7NTZI6.js} +9 -7
  79. package/dist/chunk-SN7NTZI6.js.map +1 -0
  80. package/dist/{chunk-L6IHSTPP.js → chunk-U6L3FAML.js} +16 -10
  81. package/dist/chunk-U6L3FAML.js.map +1 -0
  82. package/dist/{chunk-5SH5NUDW.js → chunk-UGCUNADI.js} +21 -13
  83. package/dist/chunk-UGCUNADI.js.map +1 -0
  84. package/dist/chunk-ULYRO2KY.cjs +800 -0
  85. package/dist/chunk-ULYRO2KY.cjs.map +1 -0
  86. package/dist/{chunk-4HPT4BOI.cjs → chunk-WYFXOXVK.cjs} +4 -4
  87. package/dist/{chunk-4HPT4BOI.cjs.map → chunk-WYFXOXVK.cjs.map} +1 -1
  88. package/dist/{chunk-YKO7DY2F.cjs → chunk-X7RPFTTR.cjs} +13 -13
  89. package/dist/{chunk-YKO7DY2F.cjs.map → chunk-X7RPFTTR.cjs.map} +1 -1
  90. package/dist/{chunk-4TS5NB7L.js → chunk-YQANC7HQ.js} +3 -3
  91. package/dist/{chunk-4TS5NB7L.js.map → chunk-YQANC7HQ.js.map} +1 -1
  92. package/dist/{chunk-HAIBAF6J.cjs → chunk-Z3DE6S64.cjs} +10 -8
  93. package/dist/chunk-Z3DE6S64.cjs.map +1 -0
  94. package/dist/{chunk-IQIJ6WW6.js → chunk-ZNDIGQJD.js} +15 -7
  95. package/dist/chunk-ZNDIGQJD.js.map +1 -0
  96. package/dist/{chunk-PIQG2Z5N.cjs → chunk-ZNOD4VZT.cjs} +4 -4
  97. package/dist/{chunk-PIQG2Z5N.cjs.map → chunk-ZNOD4VZT.cjs.map} +1 -1
  98. package/dist/diagrams/blockdiagram/index.cjs +5 -5
  99. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  100. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  101. package/dist/diagrams/blockdiagram/index.js +1 -1
  102. package/dist/diagrams/circuit/index.cjs +8 -8
  103. package/dist/diagrams/circuit/index.d.cts +1 -1
  104. package/dist/diagrams/circuit/index.d.ts +1 -1
  105. package/dist/diagrams/circuit/index.js +2 -2
  106. package/dist/diagrams/ecomap/index.cjs +8 -7
  107. package/dist/diagrams/ecomap/index.d.cts +2 -2
  108. package/dist/diagrams/ecomap/index.d.ts +2 -2
  109. package/dist/diagrams/ecomap/index.js +3 -2
  110. package/dist/diagrams/entity/index.cjs +6 -6
  111. package/dist/diagrams/entity/index.d.cts +1 -1
  112. package/dist/diagrams/entity/index.d.ts +1 -1
  113. package/dist/diagrams/entity/index.js +2 -2
  114. package/dist/diagrams/fishbone/index.cjs +8 -8
  115. package/dist/diagrams/fishbone/index.d.cts +1 -1
  116. package/dist/diagrams/fishbone/index.d.ts +1 -1
  117. package/dist/diagrams/fishbone/index.js +2 -2
  118. package/dist/diagrams/flowchart/index.cjs +8 -8
  119. package/dist/diagrams/flowchart/index.d.cts +2 -2
  120. package/dist/diagrams/flowchart/index.d.ts +2 -2
  121. package/dist/diagrams/flowchart/index.js +2 -2
  122. package/dist/diagrams/genogram/index.cjs +10 -9
  123. package/dist/diagrams/genogram/index.d.cts +1 -1
  124. package/dist/diagrams/genogram/index.d.ts +1 -1
  125. package/dist/diagrams/genogram/index.js +3 -2
  126. package/dist/diagrams/ladder/index.cjs +6 -6
  127. package/dist/diagrams/ladder/index.d.cts +1 -1
  128. package/dist/diagrams/ladder/index.d.ts +1 -1
  129. package/dist/diagrams/ladder/index.js +2 -2
  130. package/dist/diagrams/logic/index.cjs +6 -6
  131. package/dist/diagrams/logic/index.d.cts +1 -1
  132. package/dist/diagrams/logic/index.d.ts +1 -1
  133. package/dist/diagrams/logic/index.js +2 -2
  134. package/dist/diagrams/orgchart/index.cjs +7 -7
  135. package/dist/diagrams/orgchart/index.d.cts +5 -2
  136. package/dist/diagrams/orgchart/index.d.ts +5 -2
  137. package/dist/diagrams/orgchart/index.js +2 -2
  138. package/dist/diagrams/pedigree/index.cjs +8 -7
  139. package/dist/diagrams/pedigree/index.d.cts +1 -1
  140. package/dist/diagrams/pedigree/index.d.ts +1 -1
  141. package/dist/diagrams/pedigree/index.js +3 -2
  142. package/dist/diagrams/phylo/index.cjs +7 -7
  143. package/dist/diagrams/phylo/index.d.cts +1 -1
  144. package/dist/diagrams/phylo/index.d.ts +1 -1
  145. package/dist/diagrams/phylo/index.js +2 -2
  146. package/dist/diagrams/sld/index.cjs +6 -6
  147. package/dist/diagrams/sld/index.d.cts +1 -1
  148. package/dist/diagrams/sld/index.d.ts +1 -1
  149. package/dist/diagrams/sld/index.js +2 -2
  150. package/dist/diagrams/sociogram/index.cjs +7 -6
  151. package/dist/diagrams/sociogram/index.d.cts +2 -1
  152. package/dist/diagrams/sociogram/index.d.ts +2 -1
  153. package/dist/diagrams/sociogram/index.js +3 -2
  154. package/dist/diagrams/timing/index.cjs +4 -4
  155. package/dist/diagrams/timing/index.d.cts +1 -1
  156. package/dist/diagrams/timing/index.d.ts +1 -1
  157. package/dist/diagrams/timing/index.js +1 -1
  158. package/dist/diagrams/venn/index.cjs +9 -9
  159. package/dist/diagrams/venn/index.d.cts +1 -1
  160. package/dist/diagrams/venn/index.d.ts +1 -1
  161. package/dist/diagrams/venn/index.js +2 -2
  162. package/dist/{index-ga04CTBI.d.ts → index-C97K-kuw.d.ts} +1 -1
  163. package/dist/{index-SSGpCggE.d.cts → index-lsSaw3E0.d.cts} +1 -1
  164. package/dist/index.cjs +50 -49
  165. package/dist/index.d.cts +2 -2
  166. package/dist/index.d.ts +2 -2
  167. package/dist/index.js +19 -18
  168. package/dist/react.cjs +20 -19
  169. package/dist/react.cjs.map +1 -1
  170. package/dist/react.js +19 -18
  171. package/dist/react.js.map +1 -1
  172. package/dist/{types-BcPhMdHd.d.cts → types-C4LnMEcB.d.cts} +58 -4
  173. package/dist/{types-BcPhMdHd.d.ts → types-C4LnMEcB.d.ts} +58 -4
  174. package/package.json +30 -7
  175. package/dist/chunk-5SH5NUDW.js.map +0 -1
  176. package/dist/chunk-7WXAAVR3.js.map +0 -1
  177. package/dist/chunk-A74ZCP5I.js.map +0 -1
  178. package/dist/chunk-AMP2FFES.cjs.map +0 -1
  179. package/dist/chunk-CEV3GZA3.cjs.map +0 -1
  180. package/dist/chunk-DTMCQXXC.cjs.map +0 -1
  181. package/dist/chunk-GEPBET4L.js.map +0 -1
  182. package/dist/chunk-HAIBAF6J.cjs.map +0 -1
  183. package/dist/chunk-HLYA4QBB.js.map +0 -1
  184. package/dist/chunk-IMHR3S5H.cjs.map +0 -1
  185. package/dist/chunk-IQIJ6WW6.js.map +0 -1
  186. package/dist/chunk-IY52OWPG.cjs.map +0 -1
  187. package/dist/chunk-JZGFSRVT.js.map +0 -1
  188. package/dist/chunk-L6IHSTPP.js.map +0 -1
  189. package/dist/chunk-LKHWBDWZ.cjs.map +0 -1
  190. package/dist/chunk-LXNFVHDT.cjs.map +0 -1
  191. package/dist/chunk-M6AMNXQ7.js.map +0 -1
  192. package/dist/chunk-RQX53J6M.js.map +0 -1
  193. package/dist/chunk-S6VPECM3.cjs.map +0 -1
  194. package/dist/chunk-TIGP2OEJ.js.map +0 -1
  195. package/dist/chunk-TPA36ULU.js.map +0 -1
  196. package/dist/chunk-ULERCTGS.cjs.map +0 -1
  197. package/dist/chunk-VP54YPOX.cjs.map +0 -1
  198. package/dist/chunk-YO4GU6JX.js.map +0 -1
  199. package/dist/chunk-ZGKEFVJQ.cjs.map +0 -1
  200. package/dist/chunk-ZO77FHBF.cjs.map +0 -1
@@ -0,0 +1,800 @@
1
+ 'use strict';
2
+
3
+ var chunkHDKDQAEQ_cjs = require('./chunk-HDKDQAEQ.cjs');
4
+
5
+ // src/core/legend-parser.ts
6
+ var VALID_POSITIONS = /* @__PURE__ */ new Set([
7
+ "top-left",
8
+ "top-right",
9
+ "bottom-left",
10
+ "bottom-right",
11
+ "outside-right",
12
+ "outside-bottom",
13
+ "right",
14
+ "bottom-center",
15
+ "none"
16
+ ]);
17
+ var VALID_KINDS = /* @__PURE__ */ new Set([
18
+ "shape",
19
+ "fill",
20
+ "fill-pattern",
21
+ "line",
22
+ "marker",
23
+ "edge"
24
+ ]);
25
+ var VALID_PATTERNS = /* @__PURE__ */ new Set([
26
+ "solid",
27
+ "dashed",
28
+ "dotted",
29
+ "double",
30
+ "wavy",
31
+ "zigzag",
32
+ "broken"
33
+ ]);
34
+ function parseLegendDirective(rawLine, overrides) {
35
+ const line2 = rawLine.trim();
36
+ if (!line2.toLowerCase().startsWith("legend")) return false;
37
+ const masterMatch = line2.match(/^legend\s*:\s*(.+)$/i);
38
+ if (masterMatch && !line2.toLowerCase().startsWith("legend.")) {
39
+ return applyMaster(masterMatch[1].trim(), overrides);
40
+ }
41
+ const titleMatch = line2.match(/^legend\.title\s*:\s*(.+)$/i);
42
+ if (titleMatch) {
43
+ overrides.title = unquote(titleMatch[1].trim());
44
+ return true;
45
+ }
46
+ const posMatch = line2.match(/^legend\.position\s*:\s*(.+)$/i);
47
+ if (posMatch) {
48
+ const pos = posMatch[1].trim().toLowerCase();
49
+ if (VALID_POSITIONS.has(pos)) {
50
+ overrides.position = pos;
51
+ return true;
52
+ }
53
+ return false;
54
+ }
55
+ const colsMatch = line2.match(/^legend\.columns\s*:\s*(\d+)\s*$/i);
56
+ if (colsMatch) {
57
+ overrides.columns = Number.parseInt(colsMatch[1], 10);
58
+ return true;
59
+ }
60
+ const labelMatch = line2.match(/^legend\.label\s+([^\s:]+)\s*:\s*(.+)$/i);
61
+ if (labelMatch) {
62
+ overrides.labels ??= {};
63
+ overrides.labels[labelMatch[1]] = unquote(labelMatch[2].trim());
64
+ return true;
65
+ }
66
+ const hideMatch = line2.match(/^legend\.hide\s*:\s*(.+)$/i);
67
+ if (hideMatch) {
68
+ const keys = hideMatch[1].split(",").map((s) => s.trim()).filter(Boolean);
69
+ overrides.hide = (overrides.hide ?? []).concat(keys);
70
+ return true;
71
+ }
72
+ const sectionHideMatch = line2.match(
73
+ /^legend\.section\s+([^\s.]+)\.hide\s*:\s*(true|false)\s*$/i
74
+ );
75
+ if (sectionHideMatch) {
76
+ const id = sectionHideMatch[1];
77
+ const flag = sectionHideMatch[2].toLowerCase() === "true";
78
+ overrides.sections ??= {};
79
+ overrides.sections[id] = { ...overrides.sections[id] ?? {}, hidden: flag };
80
+ return true;
81
+ }
82
+ const sectionMatch = line2.match(/^legend\.section\s+([^\s:]+)\s*:\s*(.+)$/i);
83
+ if (sectionMatch) {
84
+ const id = sectionMatch[1];
85
+ overrides.sections ??= {};
86
+ overrides.sections[id] = {
87
+ ...overrides.sections[id] ?? {},
88
+ title: unquote(sectionMatch[2].trim())
89
+ };
90
+ return true;
91
+ }
92
+ const itemMatch = line2.match(
93
+ /^legend\.item\s+([^\s:]+)\s*:\s*"([^"]*)"\s*(?:\(([^)]*)\))?\s*$/i
94
+ );
95
+ if (itemMatch) {
96
+ const item = buildItem(itemMatch[1], itemMatch[2], itemMatch[3]);
97
+ if (item) {
98
+ overrides.added ??= [];
99
+ overrides.added.push(item);
100
+ return true;
101
+ }
102
+ }
103
+ return false;
104
+ }
105
+ function applyMaster(value, overrides) {
106
+ const parts = value.split(/\s+/).filter(Boolean);
107
+ let consumed = false;
108
+ for (const tok of parts) {
109
+ const t = tok.toLowerCase();
110
+ if (t === "on" || t === "off" || t === "auto") {
111
+ overrides.mode = t;
112
+ consumed = true;
113
+ } else if (VALID_POSITIONS.has(t)) {
114
+ overrides.position = t;
115
+ if (overrides.mode !== "off") overrides.mode = "on";
116
+ consumed = true;
117
+ } else {
118
+ return false;
119
+ }
120
+ }
121
+ return consumed;
122
+ }
123
+ function buildItem(id, label, attrsRaw) {
124
+ const item = { key: id, label, kind: "fill" };
125
+ if (!attrsRaw) return item;
126
+ for (const part of attrsRaw.split(",")) {
127
+ const eq = part.indexOf(":");
128
+ if (eq < 0) continue;
129
+ const k = part.slice(0, eq).trim().toLowerCase();
130
+ const v = part.slice(eq + 1).trim();
131
+ switch (k) {
132
+ case "kind":
133
+ if (VALID_KINDS.has(v)) item.kind = v;
134
+ else return null;
135
+ break;
136
+ case "color":
137
+ item.color = v;
138
+ break;
139
+ case "color2":
140
+ item.color2 = v;
141
+ break;
142
+ case "pattern":
143
+ if (VALID_PATTERNS.has(v))
144
+ item.pattern = v;
145
+ break;
146
+ case "shape":
147
+ item.shape = v;
148
+ break;
149
+ case "marker":
150
+ item.marker = v;
151
+ break;
152
+ case "section":
153
+ item.section = v;
154
+ break;
155
+ case "stroke-width":
156
+ case "strokewidth": {
157
+ const n = Number.parseFloat(v);
158
+ if (Number.isFinite(n)) item.strokeWidth = n;
159
+ break;
160
+ }
161
+ }
162
+ }
163
+ return item;
164
+ }
165
+ function unquote(s) {
166
+ const m = s.match(/^"(.*)"$/);
167
+ return m ? m[1] : s;
168
+ }
169
+
170
+ // src/core/legend.ts
171
+ function applyLegendOverrides(auto, overrides) {
172
+ if (!overrides) return resolveAuto(auto);
173
+ const sections = auto.sections.map((s) => {
174
+ const o = overrides.sections?.[s.id];
175
+ if (!o) return s;
176
+ return { ...s, title: o.title ?? s.title, hidden: o.hidden ?? s.hidden };
177
+ });
178
+ const hideSet = new Set(overrides.hide ?? []);
179
+ const hiddenSectionIds = new Set(
180
+ sections.filter((s) => s.hidden).map((s) => s.id)
181
+ );
182
+ const baseItems = auto.items.filter((it) => {
183
+ if (hideSet.has(it.key)) return false;
184
+ if (it.section && hiddenSectionIds.has(it.section)) return false;
185
+ return true;
186
+ });
187
+ const renamedBase = baseItems.map((it) => {
188
+ const newLabel = overrides.labels?.[it.key];
189
+ return newLabel === void 0 ? it : { ...it, label: newLabel };
190
+ });
191
+ const added = (overrides.added ?? []).map((it) => ({
192
+ ...it,
193
+ section: it.section ?? "custom"
194
+ }));
195
+ let finalSections = sections;
196
+ if (added.some((it) => it.section === "custom") && !finalSections.some((s) => s.id === "custom")) {
197
+ finalSections = [...finalSections, { id: "custom", title: "Custom" }];
198
+ }
199
+ const items = [...renamedBase, ...added];
200
+ let mode = overrides.mode ?? auto.mode;
201
+ if (mode === "auto") mode = items.length > 0 ? "on" : "off";
202
+ return {
203
+ mode,
204
+ title: overrides.title ?? auto.title,
205
+ position: overrides.position ?? auto.position,
206
+ columns: overrides.columns ?? auto.columns,
207
+ sections: finalSections,
208
+ items
209
+ };
210
+ }
211
+ function resolveAuto(spec) {
212
+ if (spec.mode !== "auto") return spec;
213
+ return { ...spec, mode: spec.items.length > 0 ? "on" : "off" };
214
+ }
215
+ var ZERO_BBOX = { x: 0, y: 0, w: 0, h: 0 };
216
+ function normalizePosition(p) {
217
+ switch (p) {
218
+ case "bottom-inline":
219
+ case "outside-bottom":
220
+ case "bottom-left":
221
+ case "bottom-center":
222
+ return "bottom-inline";
223
+ case "bottom-right":
224
+ case "outside-right":
225
+ case "right":
226
+ case "top-right":
227
+ case "top-left":
228
+ return "bottom-right";
229
+ case "none":
230
+ default:
231
+ return p === "none" ? "none" : "bottom-inline";
232
+ }
233
+ }
234
+ var FONT_SIZE = 11;
235
+ var SECTION_FONT_SIZE = 9;
236
+ var TITLE_FONT_SIZE = 12;
237
+ var SWATCH_W = 22;
238
+ var SWATCH_H = 12;
239
+ var SWATCH_LABEL_GAP = 8;
240
+ var ITEM_GAP = 18;
241
+ var SECTION_LABEL_GAP = 14;
242
+ var ROW_H = 18;
243
+ var INLINE_TOP_GAP = 14;
244
+ var INLINE_BOTTOM_PAD = 8;
245
+ var CARD_PAD = 4;
246
+ var CHAR_W = FONT_SIZE * 0.6;
247
+ var SECTION_CHAR_W = SECTION_FONT_SIZE * 0.85;
248
+ var TITLE_CHAR_W = TITLE_FONT_SIZE * 0.65;
249
+ var MIN_INLINE_WIDTH = 480;
250
+ function renderLegend(spec, anchor, theme, config) {
251
+ if (spec.mode === "off" || spec.position === "none" || spec.items.length === 0) {
252
+ return { svg: "", bbox: { ...ZERO_BBOX } };
253
+ }
254
+ const padding = anchor.padding ?? 16;
255
+ const layout = normalizePosition(spec.position);
256
+ const itemsBySection = /* @__PURE__ */ new Map();
257
+ for (const it of spec.items) {
258
+ const sid = it.section ?? "_default";
259
+ const arr = itemsBySection.get(sid) ?? [];
260
+ arr.push(it);
261
+ itemsBySection.set(sid, arr);
262
+ }
263
+ const declared = spec.sections.length ? spec.sections.filter(
264
+ (s) => !s.hidden && (itemsBySection.get(s.id)?.length ?? 0) > 0
265
+ ) : [{ id: "_default", title: "" }];
266
+ const declaredIds = new Set(declared.map((s) => s.id));
267
+ const orderedSections = [...declared];
268
+ for (const [sid] of itemsBySection) {
269
+ if (!declaredIds.has(sid) && (itemsBySection.get(sid)?.length ?? 0) > 0) {
270
+ orderedSections.push({ id: sid, title: capitalize(sid) });
271
+ }
272
+ }
273
+ const showTitle = !!spec.title && spec.title !== "Legend";
274
+ if (layout === "bottom-inline") {
275
+ return renderBottomInline(
276
+ spec,
277
+ orderedSections,
278
+ itemsBySection,
279
+ anchor,
280
+ theme,
281
+ config,
282
+ padding,
283
+ showTitle
284
+ );
285
+ }
286
+ return renderBottomRight(
287
+ spec,
288
+ orderedSections,
289
+ itemsBySection,
290
+ anchor,
291
+ theme,
292
+ config,
293
+ padding,
294
+ showTitle
295
+ );
296
+ }
297
+ function renderBottomInline(spec, sections, bySection, anchor, theme, config, padding, showTitle) {
298
+ const effectiveCanvasW = Math.max(anchor.canvasWidth, MIN_INLINE_WIDTH);
299
+ const startX = padding;
300
+ const endX = effectiveCanvasW - padding;
301
+ const availW = Math.max(120, endX - startX);
302
+ const startY = anchor.canvasHeight + INLINE_TOP_GAP;
303
+ let labelColW = 0;
304
+ for (const s of sections) {
305
+ if (!s.title || s.id === "_default") continue;
306
+ const items = bySection.get(s.id) ?? [];
307
+ if (items.length === 0) continue;
308
+ const lw = SECTION_CHAR_W * s.title.length;
309
+ if (lw > labelColW) labelColW = lw;
310
+ }
311
+ if (showTitle) {
312
+ const tw = TITLE_CHAR_W * spec.title.length;
313
+ if (tw > labelColW) labelColW = tw;
314
+ }
315
+ const itemColX = labelColW > 0 ? labelColW + SECTION_LABEL_GAP : 0;
316
+ const itemAvailW = Math.max(80, availW - itemColX);
317
+ function itemWidth(it) {
318
+ return SWATCH_W + SWATCH_LABEL_GAP + Math.ceil(it.label.length * CHAR_W);
319
+ }
320
+ const sectionRows = [];
321
+ if (showTitle) {
322
+ sectionRows.push({ label: spec.title, rows: [[]] });
323
+ }
324
+ for (const s of sections) {
325
+ const items = bySection.get(s.id) ?? [];
326
+ if (items.length === 0) continue;
327
+ const rows = [];
328
+ let row = [];
329
+ let cursor = 0;
330
+ for (const it of items) {
331
+ const w = itemWidth(it);
332
+ const gap = row.length > 0 ? ITEM_GAP : 0;
333
+ if (cursor > 0 && cursor + gap + w > itemAvailW) {
334
+ rows.push(row);
335
+ row = [];
336
+ cursor = 0;
337
+ }
338
+ const x = cursor + (cursor > 0 ? gap : 0);
339
+ row.push({ item: it, x });
340
+ cursor = x + w;
341
+ }
342
+ if (row.length > 0) rows.push(row);
343
+ const label = s.title && s.id !== "_default" ? s.title.toUpperCase() : null;
344
+ sectionRows.push({ label, rows });
345
+ }
346
+ const out = [];
347
+ out.push(buildStyleBlock(theme, config.fontFamily));
348
+ let cursorY = startY;
349
+ let usedRight = 0;
350
+ for (let si = 0; si < sectionRows.length; si++) {
351
+ const sec = sectionRows[si];
352
+ const isTitleRow = showTitle && si === 0;
353
+ for (let ri = 0; ri < sec.rows.length; ri++) {
354
+ const yMid = cursorY + ROW_H / 2;
355
+ const labelBaseline = yMid + FONT_SIZE / 2 - 2;
356
+ const sectionBaseline = yMid + SECTION_FONT_SIZE / 2 - 1;
357
+ const titleBaseline = yMid + TITLE_FONT_SIZE / 2 - 2;
358
+ if (ri === 0) {
359
+ if (isTitleRow && sec.label) {
360
+ out.push(
361
+ chunkHDKDQAEQ_cjs.text(
362
+ { x: startX, y: titleBaseline, class: "schematex-legend-title" },
363
+ sec.label
364
+ )
365
+ );
366
+ const w = TITLE_CHAR_W * sec.label.length;
367
+ if (startX + w > usedRight) usedRight = startX + w;
368
+ } else if (sec.label) {
369
+ out.push(
370
+ chunkHDKDQAEQ_cjs.text(
371
+ { x: startX, y: sectionBaseline, class: "schematex-legend-section" },
372
+ sec.label
373
+ )
374
+ );
375
+ }
376
+ }
377
+ for (const cell of sec.rows[ri]) {
378
+ const cx = startX + itemColX + cell.x;
379
+ const swatchY = yMid - SWATCH_H / 2;
380
+ const swatch = renderSwatch(cell.item, cx, swatchY, SWATCH_W, SWATCH_H, theme);
381
+ const label = chunkHDKDQAEQ_cjs.text(
382
+ {
383
+ x: cx + SWATCH_W + SWATCH_LABEL_GAP,
384
+ y: labelBaseline,
385
+ class: "schematex-legend-label"
386
+ },
387
+ cell.item.label
388
+ );
389
+ out.push(
390
+ chunkHDKDQAEQ_cjs.group(
391
+ {
392
+ class: "schematex-legend-row",
393
+ "data-legend-key": cell.item.key,
394
+ "data-legend-section": cell.item.section ?? ""
395
+ },
396
+ [swatch, label]
397
+ )
398
+ );
399
+ const right = cx + itemWidth(cell.item);
400
+ if (right > usedRight) usedRight = right;
401
+ }
402
+ cursorY += ROW_H;
403
+ }
404
+ }
405
+ const totalRows = sectionRows.reduce(
406
+ (sum, sec) => sum + Math.max(1, sec.rows.length),
407
+ 0
408
+ );
409
+ const minRight = effectiveCanvasW - padding;
410
+ if (minRight > usedRight) usedRight = minRight;
411
+ const svg = chunkHDKDQAEQ_cjs.group({ class: "schematex-legend" }, out);
412
+ const bbox = {
413
+ x: startX,
414
+ y: startY,
415
+ w: usedRight - startX,
416
+ h: totalRows * ROW_H + INLINE_BOTTOM_PAD
417
+ };
418
+ return { svg, bbox };
419
+ }
420
+ function renderBottomRight(spec, sections, bySection, anchor, theme, config, padding, showTitle) {
421
+ let maxRowW = 0;
422
+ if (showTitle) {
423
+ maxRowW = Math.max(maxRowW, TITLE_CHAR_W * spec.title.length);
424
+ }
425
+ for (const s of sections) {
426
+ const items = bySection.get(s.id) ?? [];
427
+ if (items.length === 0) continue;
428
+ if (s.title && s.id !== "_default") {
429
+ maxRowW = Math.max(maxRowW, SECTION_CHAR_W * s.title.length);
430
+ }
431
+ for (const it of items) {
432
+ const w = SWATCH_W + SWATCH_LABEL_GAP + Math.ceil(it.label.length * CHAR_W);
433
+ if (w > maxRowW) maxRowW = w;
434
+ }
435
+ }
436
+ const boxW = maxRowW + CARD_PAD * 2;
437
+ let rowCount = 0;
438
+ if (showTitle) rowCount++;
439
+ for (const s of sections) {
440
+ const items = bySection.get(s.id) ?? [];
441
+ if (items.length === 0) continue;
442
+ if (s.title && s.id !== "_default") rowCount++;
443
+ rowCount += items.length;
444
+ }
445
+ const boxH = rowCount * ROW_H + CARD_PAD * 2;
446
+ const x = anchor.canvasWidth - boxW - padding;
447
+ const y = anchor.canvasHeight - boxH - padding;
448
+ const out = [];
449
+ out.push(buildStyleBlock(theme, config.fontFamily));
450
+ let cursorY = y + CARD_PAD;
451
+ if (showTitle) {
452
+ cursorY += ROW_H / 2;
453
+ out.push(
454
+ chunkHDKDQAEQ_cjs.text(
455
+ {
456
+ x: x + CARD_PAD,
457
+ y: cursorY + TITLE_FONT_SIZE / 2 - 2,
458
+ class: "schematex-legend-title"
459
+ },
460
+ spec.title
461
+ )
462
+ );
463
+ cursorY += ROW_H / 2;
464
+ }
465
+ for (const s of sections) {
466
+ const items = bySection.get(s.id) ?? [];
467
+ if (items.length === 0) continue;
468
+ if (s.title && s.id !== "_default") {
469
+ cursorY += ROW_H / 2;
470
+ out.push(
471
+ chunkHDKDQAEQ_cjs.text(
472
+ {
473
+ x: x + CARD_PAD,
474
+ y: cursorY + SECTION_FONT_SIZE / 2 - 1,
475
+ class: "schematex-legend-section"
476
+ },
477
+ s.title.toUpperCase()
478
+ )
479
+ );
480
+ cursorY += ROW_H / 2;
481
+ }
482
+ for (const it of items) {
483
+ const yMid = cursorY + ROW_H / 2;
484
+ const swatchY = yMid - SWATCH_H / 2;
485
+ const swatch = renderSwatch(it, x + CARD_PAD, swatchY, SWATCH_W, SWATCH_H, theme);
486
+ const label = chunkHDKDQAEQ_cjs.text(
487
+ {
488
+ x: x + CARD_PAD + SWATCH_W + SWATCH_LABEL_GAP,
489
+ y: yMid + FONT_SIZE / 2 - 2,
490
+ class: "schematex-legend-label"
491
+ },
492
+ it.label
493
+ );
494
+ out.push(
495
+ chunkHDKDQAEQ_cjs.group(
496
+ {
497
+ class: "schematex-legend-row",
498
+ "data-legend-key": it.key,
499
+ "data-legend-section": it.section ?? ""
500
+ },
501
+ [swatch, label]
502
+ )
503
+ );
504
+ cursorY += ROW_H;
505
+ }
506
+ }
507
+ const svg = chunkHDKDQAEQ_cjs.group({ class: "schematex-legend" }, out);
508
+ return { svg, bbox: { x, y, w: boxW, h: boxH } };
509
+ }
510
+ function renderSwatch(item, x, y, w, h, theme) {
511
+ switch (item.kind) {
512
+ case "shape":
513
+ return renderShapeSwatch(item, x, y, w, h, theme);
514
+ case "fill":
515
+ return renderFillSwatch(item, x, y, w, h, theme);
516
+ case "fill-pattern":
517
+ return renderFillPatternSwatch(item, x, y, w, h, theme);
518
+ case "line":
519
+ return renderLineSwatch(item, x, y, w, h, theme);
520
+ case "marker":
521
+ return renderMarkerSwatch(item, x, y, w, h, theme);
522
+ case "edge":
523
+ return renderEdgeSwatch(item, x, y, w, h, theme);
524
+ default:
525
+ return renderFillSwatch(item, x, y, w, h, theme);
526
+ }
527
+ }
528
+ function renderShapeSwatch(item, x, y, w, h, theme) {
529
+ const shape = item.shape ?? "square";
530
+ const cx = x + w / 2;
531
+ const cy = y + h / 2;
532
+ const usedFill = item.fill ?? item.color ?? theme.fill;
533
+ const usedStroke = item.fill !== void 0 ? item.color ?? theme.stroke : theme.stroke;
534
+ const innerR = Math.min(w, h) / 2 - 1;
535
+ switch (shape) {
536
+ case "circle":
537
+ return chunkHDKDQAEQ_cjs.circle({ cx, cy, r: innerR, fill: usedFill, stroke: usedStroke });
538
+ case "diamond": {
539
+ return chunkHDKDQAEQ_cjs.polygon({
540
+ points: `${cx},${cy - innerR} ${cx + innerR},${cy} ${cx},${cy + innerR} ${cx - innerR},${cy}`,
541
+ fill: usedFill,
542
+ stroke: usedStroke
543
+ });
544
+ }
545
+ case "triangle": {
546
+ return chunkHDKDQAEQ_cjs.polygon({
547
+ points: `${cx},${cy - innerR} ${cx + innerR},${cy + innerR * 0.8} ${cx - innerR},${cy + innerR * 0.8}`,
548
+ fill: usedFill,
549
+ stroke: usedStroke
550
+ });
551
+ }
552
+ case "concentric-square": {
553
+ const inner = chunkHDKDQAEQ_cjs.rect({
554
+ x: x + 3,
555
+ y: y + 3,
556
+ width: w - 6,
557
+ height: h - 6,
558
+ fill: usedFill,
559
+ stroke: usedStroke
560
+ });
561
+ const outer = chunkHDKDQAEQ_cjs.rect({
562
+ x: x + 1,
563
+ y: y + 1,
564
+ width: w - 2,
565
+ height: h - 2,
566
+ fill: "none",
567
+ stroke: usedStroke,
568
+ "stroke-width": 1.2
569
+ });
570
+ return inner + outer;
571
+ }
572
+ case "concentric-circle": {
573
+ const innerC = chunkHDKDQAEQ_cjs.circle({
574
+ cx,
575
+ cy,
576
+ r: innerR - 2,
577
+ fill: usedFill,
578
+ stroke: usedStroke
579
+ });
580
+ const outerC = chunkHDKDQAEQ_cjs.circle({
581
+ cx,
582
+ cy,
583
+ r: innerR,
584
+ fill: "none",
585
+ stroke: usedStroke,
586
+ "stroke-width": 1.2
587
+ });
588
+ return innerC + outerC;
589
+ }
590
+ case "square":
591
+ default:
592
+ return chunkHDKDQAEQ_cjs.rect({
593
+ x: x + 1,
594
+ y: y + 1,
595
+ width: w - 2,
596
+ height: h - 2,
597
+ fill: usedFill,
598
+ stroke: usedStroke
599
+ });
600
+ }
601
+ }
602
+ function renderFillSwatch(item, x, y, w, h, theme) {
603
+ return chunkHDKDQAEQ_cjs.rect({
604
+ x: x + 1,
605
+ y: y + 1,
606
+ width: w - 2,
607
+ height: h - 2,
608
+ fill: item.color ?? theme.fill,
609
+ stroke: theme.stroke
610
+ });
611
+ }
612
+ function renderFillPatternSwatch(item, x, y, w, h, theme) {
613
+ const pattern = item.shape ?? "full";
614
+ const innerX = x + 1;
615
+ const innerY = y + 1;
616
+ const innerW = w - 2;
617
+ const innerH = h - 2;
618
+ const color = item.color ?? theme.fill;
619
+ const color2 = item.color2 ?? "transparent";
620
+ const stroke = theme.stroke;
621
+ const baseRect = chunkHDKDQAEQ_cjs.rect({
622
+ x: innerX,
623
+ y: innerY,
624
+ width: innerW,
625
+ height: innerH,
626
+ fill: color2,
627
+ stroke
628
+ });
629
+ switch (pattern) {
630
+ case "half-left":
631
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX, y: innerY, width: innerW / 2, height: innerH, fill: color });
632
+ case "half-right":
633
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX + innerW / 2, y: innerY, width: innerW / 2, height: innerH, fill: color });
634
+ case "half-top":
635
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX, y: innerY, width: innerW, height: innerH / 2, fill: color });
636
+ case "half-bottom":
637
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX, y: innerY + innerH / 2, width: innerW, height: innerH / 2, fill: color });
638
+ case "quad-tl":
639
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX, y: innerY, width: innerW / 2, height: innerH / 2, fill: color });
640
+ case "quad-tr":
641
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX + innerW / 2, y: innerY, width: innerW / 2, height: innerH / 2, fill: color });
642
+ case "quad-bl":
643
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX, y: innerY + innerH / 2, width: innerW / 2, height: innerH / 2, fill: color });
644
+ case "quad-br":
645
+ return baseRect + chunkHDKDQAEQ_cjs.rect({ x: innerX + innerW / 2, y: innerY + innerH / 2, width: innerW / 2, height: innerH / 2, fill: color });
646
+ case "striped":
647
+ case "carrier": {
648
+ const stripes = [baseRect];
649
+ const stripeW = 2;
650
+ for (let sx = innerX; sx < innerX + innerW; sx += stripeW * 2) {
651
+ stripes.push(chunkHDKDQAEQ_cjs.rect({
652
+ x: sx,
653
+ y: innerY,
654
+ width: Math.min(stripeW, innerX + innerW - sx),
655
+ height: innerH,
656
+ fill: color
657
+ }));
658
+ }
659
+ return stripes.join("");
660
+ }
661
+ case "dotted": {
662
+ const dots = [baseRect];
663
+ const cy = innerY + innerH / 2;
664
+ for (let dx = innerX + 3; dx < innerX + innerW - 1; dx += 4) {
665
+ dots.push(chunkHDKDQAEQ_cjs.circle({ cx: dx, cy, r: 1, fill: color }));
666
+ }
667
+ return dots.join("");
668
+ }
669
+ case "full":
670
+ default:
671
+ return chunkHDKDQAEQ_cjs.rect({
672
+ x: innerX,
673
+ y: innerY,
674
+ width: innerW,
675
+ height: innerH,
676
+ fill: color,
677
+ stroke
678
+ });
679
+ }
680
+ }
681
+ function renderLineSwatch(item, x, y, w, h, theme) {
682
+ const cy = y + h / 2;
683
+ const x1 = x + 1;
684
+ const x2 = x + w - 1;
685
+ const stroke = item.color ?? theme.stroke;
686
+ const sw = item.strokeWidth ?? 2;
687
+ const dash = patternDasharray(item.pattern);
688
+ if (item.pattern === "double") {
689
+ const off = Math.max(2, sw);
690
+ return chunkHDKDQAEQ_cjs.line({ x1, y1: cy - off, x2, y2: cy - off, stroke, "stroke-width": sw }) + chunkHDKDQAEQ_cjs.line({ x1, y1: cy + off, x2, y2: cy + off, stroke, "stroke-width": sw });
691
+ }
692
+ if (item.pattern === "wavy") {
693
+ const amp = Math.min(h / 3, 3);
694
+ const period = 6;
695
+ const segs = [`M ${x1} ${cy}`];
696
+ let sx = x1;
697
+ let up = true;
698
+ while (sx < x2) {
699
+ const nx = Math.min(sx + period, x2);
700
+ segs.push(`Q ${sx + period / 2} ${cy + (up ? -amp : amp)} ${nx} ${cy}`);
701
+ sx = nx;
702
+ up = !up;
703
+ }
704
+ return chunkHDKDQAEQ_cjs.path({ d: segs.join(" "), fill: "none", stroke, "stroke-width": sw });
705
+ }
706
+ const attrs = {
707
+ x1,
708
+ y1: cy,
709
+ x2,
710
+ y2: cy,
711
+ stroke,
712
+ "stroke-width": sw,
713
+ "stroke-linecap": "round"
714
+ };
715
+ if (dash) attrs["stroke-dasharray"] = dash;
716
+ return chunkHDKDQAEQ_cjs.line(attrs);
717
+ }
718
+ function renderMarkerSwatch(item, x, y, w, h, theme) {
719
+ const cx = x + w / 2;
720
+ const cy = y + h / 2;
721
+ const color = item.color ?? theme.text;
722
+ const marker = item.marker ?? "dot";
723
+ switch (marker) {
724
+ case "X":
725
+ case "x": {
726
+ const r = Math.min(w, h) / 3;
727
+ return chunkHDKDQAEQ_cjs.line({ x1: cx - r, y1: cy - r, x2: cx + r, y2: cy + r, stroke: color, "stroke-width": 1.6, "stroke-linecap": "round" }) + chunkHDKDQAEQ_cjs.line({ x1: cx + r, y1: cy - r, x2: cx - r, y2: cy + r, stroke: color, "stroke-width": 1.6, "stroke-linecap": "round" });
728
+ }
729
+ case "arrow": {
730
+ const x1 = x + 2;
731
+ const x2 = x + w - 4;
732
+ return chunkHDKDQAEQ_cjs.line({ x1, y1: cy, x2, y2: cy, stroke: color, "stroke-width": 1.6, "stroke-linecap": "round" }) + chunkHDKDQAEQ_cjs.polygon({ points: `${x2},${cy - 3} ${x + w - 1},${cy} ${x2},${cy + 3}`, fill: color });
733
+ }
734
+ case "star":
735
+ return chunkHDKDQAEQ_cjs.text(
736
+ { x: cx, y: cy + 4, "text-anchor": "middle", "font-size": 14, fill: color },
737
+ "\u2605"
738
+ );
739
+ case "slash":
740
+ return chunkHDKDQAEQ_cjs.line({
741
+ x1: cx - 4,
742
+ y1: cy + 5,
743
+ x2: cx + 4,
744
+ y2: cy - 5,
745
+ stroke: color,
746
+ "stroke-width": 1.6
747
+ });
748
+ case "P":
749
+ case "C":
750
+ case "E":
751
+ return chunkHDKDQAEQ_cjs.text(
752
+ { x: cx, y: cy + 4, "text-anchor": "middle", "font-size": 11, "font-weight": "bold", fill: color },
753
+ marker
754
+ );
755
+ case "dot":
756
+ default:
757
+ return chunkHDKDQAEQ_cjs.circle({ cx, cy, r: 3, fill: color });
758
+ }
759
+ }
760
+ function renderEdgeSwatch(item, x, y, w, h, theme) {
761
+ const linePart = renderLineSwatch(item, x, y, w, h, theme);
762
+ if (!item.marker) return linePart;
763
+ return linePart + renderMarkerSwatch(item, x + w - 8, y, 12, h, theme);
764
+ }
765
+ function patternDasharray(p) {
766
+ switch (p) {
767
+ case "dashed":
768
+ return "5,3";
769
+ case "dotted":
770
+ return "1.5,3";
771
+ case "broken":
772
+ return "2,8";
773
+ case "zigzag":
774
+ return "8,3,2,3";
775
+ case "solid":
776
+ case void 0:
777
+ return null;
778
+ default:
779
+ return null;
780
+ }
781
+ }
782
+ function buildStyleBlock(theme, fontFamily) {
783
+ const css = `
784
+ .schematex-legend { font-family: ${fontFamily}; }
785
+ .schematex-legend-title { font-size: ${TITLE_FONT_SIZE}px; font-weight: 700; fill: ${theme.text}; }
786
+ .schematex-legend-section { font-size: ${SECTION_FONT_SIZE}px; font-weight: 600; fill: ${theme.textMuted}; letter-spacing: 0.6px; }
787
+ .schematex-legend-label { font-size: ${FONT_SIZE}px; fill: ${theme.text}; dominant-baseline: alphabetic; }
788
+ `;
789
+ return chunkHDKDQAEQ_cjs.el("style", {}, css);
790
+ }
791
+ function capitalize(s) {
792
+ if (!s) return s;
793
+ return s.charAt(0).toUpperCase() + s.slice(1);
794
+ }
795
+
796
+ exports.applyLegendOverrides = applyLegendOverrides;
797
+ exports.parseLegendDirective = parseLegendDirective;
798
+ exports.renderLegend = renderLegend;
799
+ //# sourceMappingURL=chunk-ULYRO2KY.cjs.map
800
+ //# sourceMappingURL=chunk-ULYRO2KY.cjs.map