@tectra-ng/charts 0.0.1 → 0.2.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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -1
  3. package/bar-list/README.md +30 -0
  4. package/boxplot/README.md +62 -0
  5. package/bullet/README.md +53 -0
  6. package/candlestick/README.md +57 -0
  7. package/column/README.md +73 -0
  8. package/combo/README.md +83 -0
  9. package/core/README.md +62 -0
  10. package/fesm2022/tectra-ng-charts-bar-list.mjs +299 -0
  11. package/fesm2022/tectra-ng-charts-bar-list.mjs.map +1 -0
  12. package/fesm2022/tectra-ng-charts-boxplot.mjs +887 -0
  13. package/fesm2022/tectra-ng-charts-boxplot.mjs.map +1 -0
  14. package/fesm2022/tectra-ng-charts-bullet.mjs +666 -0
  15. package/fesm2022/tectra-ng-charts-bullet.mjs.map +1 -0
  16. package/fesm2022/tectra-ng-charts-candlestick.mjs +778 -0
  17. package/fesm2022/tectra-ng-charts-candlestick.mjs.map +1 -0
  18. package/fesm2022/tectra-ng-charts-column.mjs +1166 -0
  19. package/fesm2022/tectra-ng-charts-column.mjs.map +1 -0
  20. package/fesm2022/tectra-ng-charts-combo.mjs +1218 -0
  21. package/fesm2022/tectra-ng-charts-combo.mjs.map +1 -0
  22. package/fesm2022/tectra-ng-charts-core.mjs +3679 -0
  23. package/fesm2022/tectra-ng-charts-core.mjs.map +1 -0
  24. package/fesm2022/tectra-ng-charts-funnel.mjs +694 -0
  25. package/fesm2022/tectra-ng-charts-funnel.mjs.map +1 -0
  26. package/fesm2022/tectra-ng-charts-gantt.mjs +947 -0
  27. package/fesm2022/tectra-ng-charts-gantt.mjs.map +1 -0
  28. package/fesm2022/tectra-ng-charts-gauge.mjs +693 -0
  29. package/fesm2022/tectra-ng-charts-gauge.mjs.map +1 -0
  30. package/fesm2022/tectra-ng-charts-heatmap.mjs +935 -0
  31. package/fesm2022/tectra-ng-charts-heatmap.mjs.map +1 -0
  32. package/fesm2022/tectra-ng-charts-line.mjs +1541 -0
  33. package/fesm2022/tectra-ng-charts-line.mjs.map +1 -0
  34. package/fesm2022/tectra-ng-charts-org-chart.mjs +2341 -0
  35. package/fesm2022/tectra-ng-charts-org-chart.mjs.map +1 -0
  36. package/fesm2022/tectra-ng-charts-pie.mjs +1059 -0
  37. package/fesm2022/tectra-ng-charts-pie.mjs.map +1 -0
  38. package/fesm2022/tectra-ng-charts-radar.mjs +924 -0
  39. package/fesm2022/tectra-ng-charts-radar.mjs.map +1 -0
  40. package/fesm2022/tectra-ng-charts-radial-bar.mjs +802 -0
  41. package/fesm2022/tectra-ng-charts-radial-bar.mjs.map +1 -0
  42. package/fesm2022/tectra-ng-charts-range-area.mjs +933 -0
  43. package/fesm2022/tectra-ng-charts-range-area.mjs.map +1 -0
  44. package/fesm2022/tectra-ng-charts-rank-line.mjs +660 -0
  45. package/fesm2022/tectra-ng-charts-rank-line.mjs.map +1 -0
  46. package/fesm2022/tectra-ng-charts-sankey.mjs +837 -0
  47. package/fesm2022/tectra-ng-charts-sankey.mjs.map +1 -0
  48. package/fesm2022/tectra-ng-charts-scatter.mjs +1174 -0
  49. package/fesm2022/tectra-ng-charts-scatter.mjs.map +1 -0
  50. package/fesm2022/tectra-ng-charts-segmented-bar.mjs +328 -0
  51. package/fesm2022/tectra-ng-charts-segmented-bar.mjs.map +1 -0
  52. package/fesm2022/tectra-ng-charts-sunburst.mjs +733 -0
  53. package/fesm2022/tectra-ng-charts-sunburst.mjs.map +1 -0
  54. package/fesm2022/tectra-ng-charts-treemap.mjs +674 -0
  55. package/fesm2022/tectra-ng-charts-treemap.mjs.map +1 -0
  56. package/fesm2022/tectra-ng-charts-waterfall.mjs +809 -0
  57. package/fesm2022/tectra-ng-charts-waterfall.mjs.map +1 -0
  58. package/fesm2022/tectra-ng-charts.mjs +4 -0
  59. package/fesm2022/tectra-ng-charts.mjs.map +1 -0
  60. package/funnel/README.md +53 -0
  61. package/gantt/README.md +53 -0
  62. package/gauge/README.md +41 -0
  63. package/heatmap/README.md +47 -0
  64. package/line/README.md +86 -0
  65. package/org-chart/README.md +57 -0
  66. package/package.json +173 -4
  67. package/pie/README.md +66 -0
  68. package/radar/README.md +64 -0
  69. package/radial-bar/README.md +62 -0
  70. package/range-area/README.md +66 -0
  71. package/rank-line/README.md +51 -0
  72. package/sankey/README.md +52 -0
  73. package/scatter/README.md +71 -0
  74. package/segmented-bar/README.md +35 -0
  75. package/sunburst/README.md +55 -0
  76. package/treemap/README.md +47 -0
  77. package/types/tectra-ng-charts-bar-list.d.ts +724 -0
  78. package/types/tectra-ng-charts-bar-list.d.ts.map +1 -0
  79. package/types/tectra-ng-charts-boxplot.d.ts +882 -0
  80. package/types/tectra-ng-charts-boxplot.d.ts.map +1 -0
  81. package/types/tectra-ng-charts-bullet.d.ts +833 -0
  82. package/types/tectra-ng-charts-bullet.d.ts.map +1 -0
  83. package/types/tectra-ng-charts-candlestick.d.ts +854 -0
  84. package/types/tectra-ng-charts-candlestick.d.ts.map +1 -0
  85. package/types/tectra-ng-charts-column.d.ts +951 -0
  86. package/types/tectra-ng-charts-column.d.ts.map +1 -0
  87. package/types/tectra-ng-charts-combo.d.ts +987 -0
  88. package/types/tectra-ng-charts-combo.d.ts.map +1 -0
  89. package/types/tectra-ng-charts-core.d.ts +859 -0
  90. package/types/tectra-ng-charts-core.d.ts.map +1 -0
  91. package/types/tectra-ng-charts-funnel.d.ts +857 -0
  92. package/types/tectra-ng-charts-funnel.d.ts.map +1 -0
  93. package/types/tectra-ng-charts-gantt.d.ts +884 -0
  94. package/types/tectra-ng-charts-gantt.d.ts.map +1 -0
  95. package/types/tectra-ng-charts-gauge.d.ts +859 -0
  96. package/types/tectra-ng-charts-gauge.d.ts.map +1 -0
  97. package/types/tectra-ng-charts-heatmap.d.ts +914 -0
  98. package/types/tectra-ng-charts-heatmap.d.ts.map +1 -0
  99. package/types/tectra-ng-charts-line.d.ts +1023 -0
  100. package/types/tectra-ng-charts-line.d.ts.map +1 -0
  101. package/types/tectra-ng-charts-org-chart.d.ts +1017 -0
  102. package/types/tectra-ng-charts-org-chart.d.ts.map +1 -0
  103. package/types/tectra-ng-charts-pie.d.ts +983 -0
  104. package/types/tectra-ng-charts-pie.d.ts.map +1 -0
  105. package/types/tectra-ng-charts-radar.d.ts +903 -0
  106. package/types/tectra-ng-charts-radar.d.ts.map +1 -0
  107. package/types/tectra-ng-charts-radial-bar.d.ts +886 -0
  108. package/types/tectra-ng-charts-radial-bar.d.ts.map +1 -0
  109. package/types/tectra-ng-charts-range-area.d.ts +897 -0
  110. package/types/tectra-ng-charts-range-area.d.ts.map +1 -0
  111. package/types/tectra-ng-charts-rank-line.d.ts +839 -0
  112. package/types/tectra-ng-charts-rank-line.d.ts.map +1 -0
  113. package/types/tectra-ng-charts-sankey.d.ts +866 -0
  114. package/types/tectra-ng-charts-sankey.d.ts.map +1 -0
  115. package/types/tectra-ng-charts-scatter.d.ts +987 -0
  116. package/types/tectra-ng-charts-scatter.d.ts.map +1 -0
  117. package/types/tectra-ng-charts-segmented-bar.d.ts +751 -0
  118. package/types/tectra-ng-charts-segmented-bar.d.ts.map +1 -0
  119. package/types/tectra-ng-charts-sunburst.d.ts +864 -0
  120. package/types/tectra-ng-charts-sunburst.d.ts.map +1 -0
  121. package/types/tectra-ng-charts-treemap.d.ts +847 -0
  122. package/types/tectra-ng-charts-treemap.d.ts.map +1 -0
  123. package/types/tectra-ng-charts-waterfall.d.ts +869 -0
  124. package/types/tectra-ng-charts-waterfall.d.ts.map +1 -0
  125. package/types/tectra-ng-charts.d.ts +2 -0
  126. package/types/tectra-ng-charts.d.ts.map +1 -0
  127. package/waterfall/README.md +60 -0
@@ -0,0 +1,3679 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, Directive, ElementRef, Injector, PLATFORM_ID, TemplateRef, ViewContainerRef, afterNextRender, booleanAttribute, computed, effect, inject, input, linkedSignal, model, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
4
+ import { formatMessage, injectTranslations } from "@tectra-ng/core/i18n";
5
+ import { TxAnnouncer, nextListIndex, uniqueId } from "@tectra-ng/core/a11y";
6
+ import { TxOverlay, parsePlacement, txArrowOffset } from "@tectra-ng/core/overlay";
7
+ import { TxIcon } from "@tectra-ng/icons";
8
+ import { TxSkeleton } from "@tectra-ng/ui/skeleton";
9
+ import { TxButton } from "@tectra-ng/ui/button";
10
+ import { TxPopover, TxPopoverTrigger } from "@tectra-ng/ui/popover";
11
+ import { injectUnstyled } from "@tectra-ng/core/config";
12
+ import { optionalBoolean } from "@tectra-ng/core/utils";
13
+ const E10 = Math.sqrt(50);
14
+ const E5 = Math.sqrt(10);
15
+ const E2 = Math.sqrt(2);
16
+ function tickStep(start, stop, count) {
17
+ const span = Math.abs(stop - start);
18
+ if (!span || count <= 0 || !Number.isFinite(span)) return 0;
19
+ const raw = span / count;
20
+ const base = 10 ** Math.floor(Math.log10(raw));
21
+ const error = raw / base;
22
+ return (error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1) * base;
23
+ }
24
+ function decimalsOf(step) {
25
+ if (!step || !Number.isFinite(step)) return 0;
26
+ return Math.max(0, -Math.floor(Math.log10(step) + 1e-9));
27
+ }
28
+ function clean(value, decimals) {
29
+ const rounded = Number(value.toFixed(Math.min(20, decimals + 2)));
30
+ return Object.is(rounded, -0) ? 0 : rounded;
31
+ }
32
+ function niceDomain(min, max, count = 5) {
33
+ if (!Number.isFinite(min) || !Number.isFinite(max)) return [0, 1];
34
+ if (min === max) {
35
+ if (min === 0) return [0, 1];
36
+ const pad = Math.abs(min) * .1 || 1;
37
+ return niceDomain(min > 0 ? 0 : min - pad, max < 0 ? 0 : max + pad, count);
38
+ }
39
+ let start = Math.min(min, max);
40
+ let stop = Math.max(min, max);
41
+ for (let round = 0; round < 3; round++) {
42
+ const step = tickStep(start, stop, count);
43
+ const nextStart = Math.floor(start / step) * step;
44
+ const nextStop = Math.ceil(stop / step) * step;
45
+ if (nextStart === start && nextStop === stop) break;
46
+ start = clean(nextStart, decimalsOf(step));
47
+ stop = clean(nextStop, decimalsOf(step));
48
+ }
49
+ return [start, stop];
50
+ }
51
+ function linearTicks(min, max, count = 5) {
52
+ const step = tickStep(min, max, count);
53
+ if (!step) return Number.isFinite(min) ? [min] : [];
54
+ const decimals = decimalsOf(step);
55
+ const first = Math.ceil(min / step - 1e-9);
56
+ const last = Math.floor(max / step + 1e-9);
57
+ const ticks = [];
58
+ for (let index = first; index <= last; index++) ticks.push(clean(index * step, decimals));
59
+ return ticks;
60
+ }
61
+ function linearScale(domain, range) {
62
+ const [d0, d1] = domain;
63
+ const [r0, r1] = range;
64
+ const span = d1 - d0 || 1;
65
+ const map = (value) => r0 + (value - d0) / span * (r1 - r0);
66
+ return {
67
+ kind: "linear",
68
+ domain,
69
+ range,
70
+ map,
71
+ invert: (position) => d0 + (position - r0) / (r1 - r0 || 1) * span,
72
+ ticks: (count = 5) => linearTicks(d0, d1, count)
73
+ };
74
+ }
75
+ function logDomain(min, max) {
76
+ const low = Math.max(min, Number.MIN_VALUE);
77
+ const lowPower = Math.floor(Math.log10(low));
78
+ const highPower = Math.ceil(Math.log10(Math.max(max, low)));
79
+ return [10 ** lowPower, 10 ** Math.max(highPower, lowPower + 1)];
80
+ }
81
+ function logTicks(min, max, count = 5) {
82
+ const low = Math.floor(Math.log10(min));
83
+ const high = Math.ceil(Math.log10(max));
84
+ const decades = high - low;
85
+ const steps = decades * 3 <= count ? [
86
+ 1,
87
+ 2,
88
+ 5
89
+ ] : [1];
90
+ const every = Math.max(1, Math.ceil(decades / Math.max(1, count)));
91
+ const ticks = [];
92
+ for (let power = low; power <= high; power++) {
93
+ if ((power - low) % every) continue;
94
+ for (const step of steps) {
95
+ const value = step * 10 ** power;
96
+ if (value >= min * (1 - 1e-9) && value <= max * (1 + 1e-9)) ticks.push(Number(value.toPrecision(12)));
97
+ }
98
+ }
99
+ return ticks;
100
+ }
101
+ function logScale(domain, range) {
102
+ const [d0, d1] = domain.map((value) => Math.max(value, Number.MIN_VALUE));
103
+ const [r0, r1] = range;
104
+ const l0 = Math.log10(d0);
105
+ const span = Math.log10(d1) - l0 || 1;
106
+ return {
107
+ kind: "log",
108
+ domain: [d0, d1],
109
+ range,
110
+ map: (value) => r0 + (Math.log10(Math.max(value, d0 / 10)) - l0) / span * (r1 - r0),
111
+ invert: (position) => 10 ** (l0 + (position - r0) / (r1 - r0 || 1) * span),
112
+ ticks: (count = 5) => logTicks(d0, d1, count)
113
+ };
114
+ }
115
+ function bandScale(count, range, paddingInner = 0, paddingOuter = 0) {
116
+ const [r0, r1] = range;
117
+ const slots = Math.max(1, count - paddingInner + paddingOuter * 2);
118
+ const step = (r1 - r0) / slots;
119
+ const bandwidth = step * (1 - paddingInner);
120
+ const start = r0 + step * paddingOuter;
121
+ return {
122
+ kind: "band",
123
+ count,
124
+ range,
125
+ step,
126
+ bandwidth,
127
+ start: (index) => start + step * index,
128
+ center: (index) => start + step * index + bandwidth / 2,
129
+ indexAt: (position) => Math.min(count - 1, Math.max(0, Math.floor((position - r0) / ((r1 - r0) / Math.max(1, count)))))
130
+ };
131
+ }
132
+ function pointScale(count, range) {
133
+ const [r0, r1] = range;
134
+ const step = count > 1 ? (r1 - r0) / (count - 1) : 0;
135
+ const at = (index) => count > 1 ? r0 + step * index : (r0 + r1) / 2;
136
+ return {
137
+ kind: "point",
138
+ count,
139
+ range,
140
+ step,
141
+ at,
142
+ indexAt: (position) => count > 1 ? Math.min(count - 1, Math.max(0, Math.round((position - r0) / step))) : 0
143
+ };
144
+ }
145
+ const SECOND = 1e3;
146
+ const MINUTE = 60 * SECOND;
147
+ const HOUR = 60 * MINUTE;
148
+ const DAY = 24 * HOUR;
149
+ const TX_TIME_INTERVALS = [
150
+ {
151
+ unit: "second",
152
+ step: 1,
153
+ duration: SECOND
154
+ },
155
+ {
156
+ unit: "second",
157
+ step: 5,
158
+ duration: 5 * SECOND
159
+ },
160
+ {
161
+ unit: "second",
162
+ step: 15,
163
+ duration: 15 * SECOND
164
+ },
165
+ {
166
+ unit: "second",
167
+ step: 30,
168
+ duration: 30 * SECOND
169
+ },
170
+ {
171
+ unit: "minute",
172
+ step: 1,
173
+ duration: MINUTE
174
+ },
175
+ {
176
+ unit: "minute",
177
+ step: 5,
178
+ duration: 5 * MINUTE
179
+ },
180
+ {
181
+ unit: "minute",
182
+ step: 15,
183
+ duration: 15 * MINUTE
184
+ },
185
+ {
186
+ unit: "minute",
187
+ step: 30,
188
+ duration: 30 * MINUTE
189
+ },
190
+ {
191
+ unit: "hour",
192
+ step: 1,
193
+ duration: HOUR
194
+ },
195
+ {
196
+ unit: "hour",
197
+ step: 3,
198
+ duration: 3 * HOUR
199
+ },
200
+ {
201
+ unit: "hour",
202
+ step: 6,
203
+ duration: 6 * HOUR
204
+ },
205
+ {
206
+ unit: "hour",
207
+ step: 12,
208
+ duration: 12 * HOUR
209
+ },
210
+ {
211
+ unit: "day",
212
+ step: 1,
213
+ duration: DAY
214
+ },
215
+ {
216
+ unit: "day",
217
+ step: 2,
218
+ duration: 2 * DAY
219
+ },
220
+ {
221
+ unit: "week",
222
+ step: 1,
223
+ duration: 7 * DAY
224
+ },
225
+ {
226
+ unit: "month",
227
+ step: 1,
228
+ duration: 30 * DAY
229
+ },
230
+ {
231
+ unit: "month",
232
+ step: 2,
233
+ duration: 61 * DAY
234
+ },
235
+ {
236
+ unit: "month",
237
+ step: 3,
238
+ duration: 91 * DAY
239
+ },
240
+ {
241
+ unit: "month",
242
+ step: 6,
243
+ duration: 182 * DAY
244
+ },
245
+ {
246
+ unit: "year",
247
+ step: 1,
248
+ duration: 365 * DAY
249
+ }
250
+ ];
251
+ function timeInterval(start, stop, count = 6) {
252
+ const span = Math.abs(stop - start);
253
+ const target = span / Math.max(1, count);
254
+ const found = TX_TIME_INTERVALS.find((interval) => interval.duration >= target);
255
+ if (found) return found;
256
+ const years = tickStep(0, span / (365 * DAY), count) || 1;
257
+ return {
258
+ unit: "year",
259
+ step: Math.max(1, Math.round(years)),
260
+ duration: Math.max(1, Math.round(years)) * 365 * DAY
261
+ };
262
+ }
263
+ function floorTime(time, interval) {
264
+ const date = new Date(time);
265
+ const { unit, step } = interval;
266
+ if (unit === "year") return new Date(Math.floor(date.getFullYear() / step) * step, 0, 1);
267
+ if (unit === "month") return new Date(date.getFullYear(), Math.floor(date.getMonth() / step) * step, 1);
268
+ if (unit === "week") return new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay());
269
+ if (unit === "day") {
270
+ const day = new Date(date.getFullYear(), date.getMonth(), date.getDate());
271
+ return step > 1 ? new Date(day.getFullYear(), day.getMonth(), day.getDate() - (day.getDate() - 1) % step) : day;
272
+ }
273
+ if (unit === "hour") return new Date(date.getFullYear(), date.getMonth(), date.getDate(), Math.floor(date.getHours() / step) * step);
274
+ if (unit === "minute") return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), Math.floor(date.getMinutes() / step) * step);
275
+ return /* @__PURE__ */ new Date(Math.floor(time / (step * SECOND)) * step * SECOND);
276
+ }
277
+ function addTime(date, interval) {
278
+ const { unit, step } = interval;
279
+ const next = new Date(date.getTime());
280
+ if (unit === "year") next.setFullYear(next.getFullYear() + step);
281
+ else if (unit === "month") next.setMonth(next.getMonth() + step);
282
+ else if (unit === "week") next.setDate(next.getDate() + 7 * step);
283
+ else if (unit === "day") next.setDate(next.getDate() + step);
284
+ else if (unit === "hour") next.setHours(next.getHours() + step);
285
+ else if (unit === "minute") next.setMinutes(next.getMinutes() + step);
286
+ else next.setSeconds(next.getSeconds() + step);
287
+ return next;
288
+ }
289
+ function timeTicks(start, stop, count = 6) {
290
+ const interval = timeInterval(start, stop, count);
291
+ const ticks = [];
292
+ let tick = floorTime(start, interval);
293
+ if (tick.getTime() < start) tick = addTime(tick, interval);
294
+ while (tick.getTime() <= stop && ticks.length < 1e3) {
295
+ ticks.push(tick.getTime());
296
+ tick = addTime(tick, interval);
297
+ }
298
+ return {
299
+ ticks,
300
+ interval
301
+ };
302
+ }
303
+ function timeScale(domain, range) {
304
+ return {
305
+ ...linearScale(domain, range),
306
+ kind: "time",
307
+ ticks: (count = 6) => timeTicks(domain[0], domain[1], count).ticks,
308
+ interval: (count = 6) => timeInterval(domain[0], domain[1], count)
309
+ };
310
+ }
311
+ function toTime(value) {
312
+ if (value === null || value === void 0 || value === "") return null;
313
+ if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value.getTime();
314
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
315
+ const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
316
+ const time = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])).getTime() : Date.parse(value);
317
+ return Number.isNaN(time) ? null : time;
318
+ }
319
+ function extent(values) {
320
+ let min = Infinity;
321
+ let max = -Infinity;
322
+ for (const value of values) {
323
+ if (value === null || value === void 0 || !Number.isFinite(value)) continue;
324
+ if (value < min) min = value;
325
+ if (value > max) max = value;
326
+ }
327
+ return min === Infinity ? null : [min, max];
328
+ }
329
+ const NUMBER_CACHE = /* @__PURE__ */ new Map();
330
+ const DATE_CACHE = /* @__PURE__ */ new Map();
331
+ function numberFormat(intl, options = {}) {
332
+ const key = `${intl}|${JSON.stringify(options)}`;
333
+ let format = NUMBER_CACHE.get(key);
334
+ if (!format) {
335
+ format = new Intl.NumberFormat(intl, options);
336
+ NUMBER_CACHE.set(key, format);
337
+ }
338
+ return format;
339
+ }
340
+ function dateFormat(intl, options) {
341
+ const key = `${intl}|${JSON.stringify(options)}`;
342
+ let format = DATE_CACHE.get(key);
343
+ if (!format) {
344
+ format = new Intl.DateTimeFormat(intl, options);
345
+ DATE_CACHE.set(key, format);
346
+ }
347
+ return format;
348
+ }
349
+ function chartNumberFormatter(intl, format = "number") {
350
+ if (typeof format === "function") return format;
351
+ const formatter = numberFormat(intl, format === "integer" ? { maximumFractionDigits: 0 } : format === "compact" ? {
352
+ notation: "compact",
353
+ maximumFractionDigits: 1
354
+ } : format === "percent" ? {
355
+ style: "percent",
356
+ maximumFractionDigits: 1
357
+ } : { maximumFractionDigits: 2 });
358
+ return (value) => Number.isFinite(value) ? formatter.format(format === "percent" ? value / 100 : value) : "";
359
+ }
360
+ function tickFormatter(intl, ticks, format = "number") {
361
+ if (typeof format === "function" || format === "compact" || format === "percent") return chartNumberFormatter(intl, format);
362
+ const step = ticks.length > 1 ? Math.abs(ticks[1] - ticks[0]) : 0;
363
+ const decimals = Math.min(2, decimalsOf(step));
364
+ const formatter = numberFormat(intl, {
365
+ minimumFractionDigits: format === "integer" ? 0 : decimals,
366
+ maximumFractionDigits: format === "integer" ? 0 : decimals
367
+ });
368
+ return (value) => formatter.format(value);
369
+ }
370
+ function compactNumber(value, intl = "en-US") {
371
+ return chartNumberFormatter(intl, "compact")(value);
372
+ }
373
+ function timeTickOptions(interval, span) {
374
+ const multiYear = span > 316224e5;
375
+ switch (interval.unit) {
376
+ case "year": return { year: "numeric" };
377
+ case "month": return multiYear ? {
378
+ month: "short",
379
+ year: "numeric"
380
+ } : { month: "short" };
381
+ case "week":
382
+ case "day": return {
383
+ day: "numeric",
384
+ month: "short"
385
+ };
386
+ case "hour":
387
+ case "minute": return {
388
+ hour: "2-digit",
389
+ minute: "2-digit"
390
+ };
391
+ default: return {
392
+ hour: "2-digit",
393
+ minute: "2-digit",
394
+ second: "2-digit"
395
+ };
396
+ }
397
+ }
398
+ function timeTickFormatter(intl, interval, span) {
399
+ const formatter = dateFormat(intl, timeTickOptions(interval, span));
400
+ return (time) => formatter.format(time);
401
+ }
402
+ function timeTooltipFormatter(intl, interval) {
403
+ const formatter = dateFormat(intl, interval.unit === "year" || interval.unit === "month" ? {
404
+ day: "numeric",
405
+ month: "short",
406
+ year: "numeric"
407
+ } : interval.unit === "week" || interval.unit === "day" ? {
408
+ day: "numeric",
409
+ month: "short",
410
+ year: "numeric"
411
+ } : {
412
+ day: "numeric",
413
+ month: "short",
414
+ hour: "2-digit",
415
+ minute: "2-digit"
416
+ });
417
+ return (time) => formatter.format(time);
418
+ }
419
+ function chartMonthNames(intl, month = "long") {
420
+ const formatter = dateFormat(intl, { month });
421
+ return Array.from({ length: 12 }, (_, index) => {
422
+ const name = formatter.format(new Date(2024, index, 15));
423
+ return name.charAt(0).toLocaleUpperCase(intl) + name.slice(1);
424
+ });
425
+ }
426
+ const NARROW = /[.,:;!|il'`ijIft ]/;
427
+ const WIDE = /[MWmw@%]/;
428
+ const UPPER = /[A-ZА-ЯЁЇІЄҐ]/;
429
+ function textWidth(text, fontSize = 12) {
430
+ let width = 0;
431
+ for (const char of text) width += NARROW.test(char) ? .3 : WIDE.test(char) ? .86 : UPPER.test(char) ? .66 : /\d/.test(char) ? .62 : .56;
432
+ return width * fontSize;
433
+ }
434
+ function truncateText(text, maxWidth, fontSize = 12) {
435
+ if (textWidth(text, fontSize) <= maxWidth) return text;
436
+ const chars = [...text];
437
+ while (chars.length > 1 && textWidth(`${chars.join("")}…`, fontSize) > maxWidth) chars.pop();
438
+ return `${chars.join("").trimEnd()}…`;
439
+ }
440
+ const round$1 = (value) => Math.round(value * 100) / 100;
441
+ const pair = (point) => `${round$1(point.x)},${round$1(point.y)}`;
442
+ function slope(a, b) {
443
+ const dx = b.x - a.x;
444
+ return dx ? (b.y - a.y) / dx : 0;
445
+ }
446
+ function sign(value) {
447
+ return value < 0 ? -1 : 1;
448
+ }
449
+ function monotoneTangents(points) {
450
+ const count = points.length;
451
+ if (count < 2) return points.map(() => 0);
452
+ const slopes = points.slice(1).map((point, index) => slope(points[index], point));
453
+ const tangents = new Array(count);
454
+ tangents[0] = slopes[0];
455
+ tangents[count - 1] = slopes[count - 2];
456
+ for (let index = 1; index < count - 1; index++) {
457
+ const before = slopes[index - 1];
458
+ const after = slopes[index];
459
+ if (before * after <= 0) {
460
+ tangents[index] = 0;
461
+ continue;
462
+ }
463
+ const h0 = points[index].x - points[index - 1].x;
464
+ const h1 = points[index + 1].x - points[index].x;
465
+ const weighted = (before * h1 + after * h0) / (h0 + h1);
466
+ tangents[index] = (sign(before) + sign(after)) * Math.min(Math.abs(before), Math.abs(after), .5 * Math.abs(weighted));
467
+ }
468
+ return tangents;
469
+ }
470
+ function segment(points, curve, move) {
471
+ if (!points.length) return "";
472
+ const start = `${move ? "M" : "L"}${pair(points[0])}`;
473
+ if (points.length === 1) return start;
474
+ if (curve === "straight") return start + points.slice(1).map((point) => `L${pair(point)}`).join("");
475
+ if (curve === "step") return start + points.slice(1).map((point, index) => {
476
+ const middle = (points[index].x + point.x) / 2;
477
+ return `H${round$1(middle)}V${round$1(point.y)}H${round$1(point.x)}`;
478
+ }).join("");
479
+ const tangents = monotoneTangents(points);
480
+ return start + points.slice(1).map((point, index) => {
481
+ const previous = points[index];
482
+ const third = (point.x - previous.x) / 3;
483
+ const c1 = {
484
+ x: previous.x + third,
485
+ y: previous.y + third * tangents[index]
486
+ };
487
+ const c2 = {
488
+ x: point.x - third,
489
+ y: point.y - third * tangents[index + 1]
490
+ };
491
+ return `C${pair(c1)} ${pair(c2)} ${pair(point)}`;
492
+ }).join("");
493
+ }
494
+ function splitGaps(points) {
495
+ const runs = [];
496
+ let run = [];
497
+ for (const point of points) if (point) run.push(point);
498
+ else if (run.length) {
499
+ runs.push(run);
500
+ run = [];
501
+ }
502
+ if (run.length) runs.push(run);
503
+ return runs;
504
+ }
505
+ function linePath(points, curve = "smooth") {
506
+ return splitGaps(points).map((run) => segment(run, curve, true)).join("");
507
+ }
508
+ function areaPath(top, bottom, curve = "smooth") {
509
+ const runs = [];
510
+ let current = null;
511
+ top.forEach((point, index) => {
512
+ const base = bottom[index];
513
+ if (point && base) {
514
+ current ??= {
515
+ top: [],
516
+ bottom: []
517
+ };
518
+ current.top.push(point);
519
+ current.bottom.push(base);
520
+ } else if (current) {
521
+ runs.push(current);
522
+ current = null;
523
+ }
524
+ });
525
+ if (current) runs.push(current);
526
+ return runs.filter((run) => run.top.length > 1).map((run) => `${segment(run.top, curve, true)}${segment([...run.bottom].reverse(), curve, false)}Z`).join("");
527
+ }
528
+ const round = (value) => Math.round(value * 100) / 100;
529
+ const TX_FULL_CIRCLE = Math.PI * 2;
530
+ function toRadians(degrees) {
531
+ return degrees * Math.PI / 180;
532
+ }
533
+ function polar(cx, cy, radius, angle) {
534
+ return {
535
+ x: cx + radius * Math.sin(angle),
536
+ y: cy - radius * Math.cos(angle)
537
+ };
538
+ }
539
+ function maxCornerRadius(inner, outer, sweep) {
540
+ const half = Math.min(Math.PI / 2, sweep / 2);
541
+ const sin = Math.sin(half);
542
+ const byThickness = inner > 0 ? (outer - inner) / 2 : outer / 2;
543
+ const byOuter = outer * sin / (1 + sin);
544
+ const byInner = inner > 0 && sin < 1 ? inner * sin / (1 - sin) : Infinity;
545
+ return Math.max(0, Math.min(byThickness, byOuter, byInner));
546
+ }
547
+ function arcPath(cx, cy, inner, outer, start, end, corner = 0) {
548
+ const sweep = end - start;
549
+ if (sweep <= 0 || outer <= 0) return "";
550
+ if (sweep >= TX_FULL_CIRCLE - 1e-6) {
551
+ const middle = start + Math.PI;
552
+ return arcPath(cx, cy, inner, outer, start, middle) + arcPath(cx, cy, inner, outer, middle, start + TX_FULL_CIRCLE);
553
+ }
554
+ const radius = Math.min(Math.max(0, corner), maxCornerRadius(inner, outer, sweep));
555
+ if (radius < .5) {
556
+ const large = sweep > Math.PI ? 1 : 0;
557
+ const a = polar(cx, cy, outer, start);
558
+ const b = polar(cx, cy, outer, end);
559
+ const head = `M${round(a.x)},${round(a.y)}A${round(outer)},${round(outer)} 0 ${large} 1 ${round(b.x)},${round(b.y)}`;
560
+ if (inner <= 0) return `${head}L${round(cx)},${round(cy)}Z`;
561
+ const c = polar(cx, cy, inner, end);
562
+ const d = polar(cx, cy, inner, start);
563
+ return `${head}L${round(c.x)},${round(c.y)}A${round(inner)},${round(inner)} 0 ${large} 0 ${round(d.x)},${round(d.y)}Z`;
564
+ }
565
+ const r = round(radius);
566
+ const outerShift = Math.asin(radius / (outer - radius));
567
+ const outerReach = Math.sqrt((outer - radius) ** 2 - radius ** 2);
568
+ const p1 = polar(cx, cy, outerReach, start);
569
+ const p2 = polar(cx, cy, outer, start + outerShift);
570
+ const p3 = polar(cx, cy, outer, end - outerShift);
571
+ const p4 = polar(cx, cy, outerReach, end);
572
+ const outerLarge = end - start - outerShift * 2 > Math.PI ? 1 : 0;
573
+ const head = `M${round(p1.x)},${round(p1.y)}A${r},${r} 0 0 1 ${round(p2.x)},${round(p2.y)}A${round(outer)},${round(outer)} 0 ${outerLarge} 1 ${round(p3.x)},${round(p3.y)}A${r},${r} 0 0 1 ${round(p4.x)},${round(p4.y)}`;
574
+ if (inner <= 0) return `${head}L${round(cx)},${round(cy)}Z`;
575
+ const innerShift = Math.asin(radius / (inner + radius));
576
+ const innerReach = Math.sqrt((inner + radius) ** 2 - radius ** 2);
577
+ const p5 = polar(cx, cy, innerReach, end);
578
+ const p6 = polar(cx, cy, inner, end - innerShift);
579
+ const p7 = polar(cx, cy, inner, start + innerShift);
580
+ const p8 = polar(cx, cy, innerReach, start);
581
+ const innerLarge = end - start - innerShift * 2 > Math.PI ? 1 : 0;
582
+ return `${head}L${round(p5.x)},${round(p5.y)}A${r},${r} 0 0 1 ${round(p6.x)},${round(p6.y)}A${round(inner)},${round(inner)} 0 ${innerLarge} 0 ${round(p7.x)},${round(p7.y)}A${r},${r} 0 0 1 ${round(p8.x)},${round(p8.y)}Z`;
583
+ }
584
+ function arcBounds(start, end) {
585
+ const points = [
586
+ polar(0, 0, 1, start),
587
+ polar(0, 0, 1, end),
588
+ {
589
+ x: 0,
590
+ y: 0
591
+ }
592
+ ];
593
+ for (let quarter = Math.ceil(start / (Math.PI / 2)); quarter * (Math.PI / 2) <= end; quarter++) points.push(polar(0, 0, 1, quarter * (Math.PI / 2)));
594
+ return {
595
+ minX: Math.min(...points.map((point) => point.x)),
596
+ maxX: Math.max(...points.map((point) => point.x)),
597
+ minY: Math.min(...points.map((point) => point.y)),
598
+ maxY: Math.max(...points.map((point) => point.y))
599
+ };
600
+ }
601
+ function arcSpan(startAngle, endAngle) {
602
+ return [toRadians(startAngle), toRadians(Math.max(startAngle, Math.min(startAngle + 360, endAngle)))];
603
+ }
604
+ function fitArc(width, height, startAngle, endAngle, padding) {
605
+ const [start, end] = arcSpan(startAngle, endAngle);
606
+ const bounds = arcBounds(start, end);
607
+ const boxWidth = bounds.maxX - bounds.minX || 1;
608
+ const boxHeight = bounds.maxY - bounds.minY || 1;
609
+ const radius = Math.max(1, Math.min((width - padding * 2) / boxWidth, (height - padding * 2) / boxHeight));
610
+ return {
611
+ cx: width / 2 - (bounds.minX + bounds.maxX) / 2 * radius,
612
+ cy: height / 2 - (bounds.minY + bounds.maxY) / 2 * radius,
613
+ radius
614
+ };
615
+ }
616
+ function strokeArc(cx, cy, radius, start, end) {
617
+ const sweep = end - start;
618
+ if (sweep <= 0 || radius <= 0) return "";
619
+ if (sweep >= TX_FULL_CIRCLE - 1e-6) {
620
+ const a = polar(cx, cy, radius, start);
621
+ const b = polar(cx, cy, radius, start + Math.PI);
622
+ const r = round(radius);
623
+ return `M${round(a.x)},${round(a.y)}A${r},${r} 0 1 1 ${round(b.x)},${round(b.y)}A${r},${r} 0 1 1 ${round(a.x)},${round(a.y)}`;
624
+ }
625
+ const a = polar(cx, cy, radius, start);
626
+ const b = polar(cx, cy, radius, end);
627
+ const r = round(radius);
628
+ return `M${round(a.x)},${round(a.y)}A${r},${r} 0 ${sweep > Math.PI ? 1 : 0} 1 ${round(b.x)},${round(b.y)}`;
629
+ }
630
+ function angleFrom(x, y, cx, cy, start) {
631
+ let angle = Math.atan2(x - cx, -(y - cy));
632
+ while (angle < start) angle += TX_FULL_CIRCLE;
633
+ while (angle >= start + TX_FULL_CIRCLE) angle -= TX_FULL_CIRCLE;
634
+ return angle;
635
+ }
636
+ function stackValues(series, type = "normal") {
637
+ const length = Math.max(0, ...series.map((values) => values.length));
638
+ const totals = Array.from({ length }, (_, index) => series.reduce((sum, values) => sum + Math.abs(values[index] ?? 0), 0));
639
+ const positive = new Array(length).fill(0);
640
+ const negative = new Array(length).fill(0);
641
+ return series.map((values) => Array.from({ length }, (_, index) => {
642
+ const raw = values[index];
643
+ if (raw === null || raw === void 0 || !Number.isFinite(raw)) return null;
644
+ const value = type === "100%" ? totals[index] ? raw / totals[index] * 100 : 0 : raw;
645
+ if (value >= 0) {
646
+ const start = positive[index];
647
+ positive[index] += value;
648
+ return [start, positive[index]];
649
+ }
650
+ const start = negative[index];
651
+ negative[index] += value;
652
+ return [start, negative[index]];
653
+ }));
654
+ }
655
+ function stackExtent(stacked) {
656
+ let min = 0;
657
+ let max = 0;
658
+ for (const values of stacked) for (const value of values) if (value) {
659
+ min = Math.min(min, value[0], value[1]);
660
+ max = Math.max(max, value[0], value[1]);
661
+ }
662
+ return [min, max];
663
+ }
664
+ function topOfStack(stacked, index, sign) {
665
+ let found = -1;
666
+ stacked.forEach((values, seriesIndex) => {
667
+ const value = values[index];
668
+ if (value && value[1] !== value[0] && Math.sign(value[1] - value[0]) === sign) found = seriesIndex;
669
+ });
670
+ return found;
671
+ }
672
+ function largestTriangleThreeBuckets(points, threshold) {
673
+ const count = points.length;
674
+ if (threshold >= count || threshold < 3) return [...points];
675
+ const sampled = [points[0]];
676
+ const every = (count - 2) / (threshold - 2);
677
+ let anchor = 0;
678
+ for (let bucket = 0; bucket < threshold - 2; bucket++) {
679
+ const nextStart = Math.floor((bucket + 1) * every) + 1;
680
+ const nextEnd = Math.min(count, Math.floor((bucket + 2) * every) + 1);
681
+ let averageX = 0;
682
+ let averageY = 0;
683
+ const nextLength = Math.max(1, nextEnd - nextStart);
684
+ for (let index = nextStart; index < nextEnd; index++) {
685
+ averageX += points[index].x;
686
+ averageY += points[index].y;
687
+ }
688
+ averageX /= nextLength;
689
+ averageY /= nextLength;
690
+ const start = Math.floor(bucket * every) + 1;
691
+ const end = Math.floor((bucket + 1) * every) + 1;
692
+ const a = points[anchor];
693
+ let largest = -1;
694
+ let chosen = start;
695
+ for (let index = start; index < end; index++) {
696
+ const area = Math.abs((a.x - averageX) * (points[index].y - a.y) - (a.x - points[index].x) * (averageY - a.y));
697
+ if (area > largest) {
698
+ largest = area;
699
+ chosen = index;
700
+ }
701
+ }
702
+ sampled.push(points[chosen]);
703
+ anchor = chosen;
704
+ }
705
+ sampled.push(points[count - 1]);
706
+ return sampled;
707
+ }
708
+ function decimateSeries(points, threshold) {
709
+ if (points.length <= threshold) return points.map((point, index) => point ? {
710
+ ...point,
711
+ index
712
+ } : null);
713
+ const result = [];
714
+ let run = [];
715
+ const share = threshold / points.length;
716
+ const flush = () => {
717
+ if (run.length) {
718
+ result.push(...largestTriangleThreeBuckets(run, Math.max(3, Math.round(run.length * share))));
719
+ run = [];
720
+ }
721
+ };
722
+ points.forEach((point, index) => {
723
+ if (point) run.push({
724
+ ...point,
725
+ index
726
+ });
727
+ else {
728
+ flush();
729
+ result.push(null);
730
+ }
731
+ });
732
+ flush();
733
+ return result;
734
+ }
735
+ const TX_CHART_PALETTE_SIZE = 7;
736
+ function chartColor(index) {
737
+ return `var(--tx-chart-series-color${(index % 7 + 7) % 7 + 1})`;
738
+ }
739
+ function chartPalette(count = 7) {
740
+ return Array.from({ length: count }, (_, index) => chartColor(index));
741
+ }
742
+ function seriesColor(color, index) {
743
+ return color || chartColor(index);
744
+ }
745
+ const GAP = 8;
746
+ const LABEL_PAD$1 = 10;
747
+ const ROTATE = -45;
748
+ function valueDomain(options, count) {
749
+ const [rawMin, rawMax] = options.extent ?? [0, 1];
750
+ if (options.scale === "log") {
751
+ const positiveMin = rawMin > 0 ? rawMin : 1;
752
+ return logDomain(options.min ?? positiveMin, options.max ?? Math.max(rawMax, positiveMin));
753
+ }
754
+ const includeZero = options.includeZero ?? true;
755
+ const nice = niceDomain(options.min ?? (includeZero ? Math.min(0, rawMin) : rawMin), options.max ?? (includeZero ? Math.max(0, rawMax) : rawMax), count);
756
+ return [options.min ?? nice[0], options.max ?? nice[1]];
757
+ }
758
+ const NICE_STEPS = [
759
+ 1,
760
+ 2,
761
+ 2.5,
762
+ 5,
763
+ 10
764
+ ];
765
+ function niceStepAtLeast(raw) {
766
+ if (!(raw > 0) || !Number.isFinite(raw)) return 1;
767
+ const base = 10 ** Math.floor(Math.log10(raw));
768
+ return (NICE_STEPS.find((step) => step * base >= raw * (1 - 1e-9)) ?? 10) * base;
769
+ }
770
+ function alignedDomain(options, intervals, zeroAt = null) {
771
+ if (intervals < 1 || options.scale === "log" || options.min !== void 0 || options.max !== void 0) return null;
772
+ const [rawMin, rawMax] = options.extent ?? [0, 1];
773
+ const includeZero = options.includeZero ?? true;
774
+ let min = includeZero ? Math.min(0, rawMin) : rawMin;
775
+ let max = includeZero ? Math.max(0, rawMax) : rawMax;
776
+ if (min === max) {
777
+ min = min > 0 ? 0 : min - 1;
778
+ max = max < 0 ? 0 : max + 1;
779
+ }
780
+ const below = zeroAt !== null && zeroAt > 0 && zeroAt < intervals ? zeroAt : null;
781
+ let step = below !== null ? niceStepAtLeast(Math.max(max / (intervals - below), -min / below)) : niceStepAtLeast((max - min) / intervals);
782
+ for (let round = 0; round < 12; round++) {
783
+ const start = below !== null ? -below * step : Math.floor(min / step + 1e-9) * step;
784
+ if (start + intervals * step >= max - 1e-9 && start <= min + 1e-9) {
785
+ const decimals = Math.max(0, -Math.floor(Math.log10(step) + 1e-9) + 1);
786
+ const ticks = Array.from({ length: intervals + 1 }, (_, index) => Number((start + index * step).toFixed(decimals)) || 0);
787
+ return {
788
+ domain: [ticks[0], ticks[intervals]],
789
+ ticks
790
+ };
791
+ }
792
+ step = niceStepAtLeast(step * 1.0001);
793
+ }
794
+ return null;
795
+ }
796
+ function pickEvery(ticks, every) {
797
+ if (every <= 1) return [...ticks];
798
+ return ticks.filter((_, position) => position % every === 0);
799
+ }
800
+ function cartesianLayout(options) {
801
+ const fontSize = options.fontSize ?? 12;
802
+ const horizontal = options.horizontal ?? false;
803
+ const width = Math.max(1, options.width);
804
+ const height = Math.max(1, options.height);
805
+ const showCategoryAxis = options.showCategoryAxis ?? true;
806
+ const showValueAxis = options.showValueAxis ?? true;
807
+ const valueLength = horizontal ? width * .75 : height - fontSize * 3;
808
+ const tickCount = options.value.tickCount ?? Math.max(2, Math.min(horizontal ? 8 : 6, Math.round(valueLength / (horizontal ? 90 : 62))));
809
+ const domain = valueDomain(options.value, tickCount);
810
+ const valueTicks = (options.value.scale === "log" ? logScale(domain, [0, 1]) : linearScale(domain, [0, 1])).ticks(tickCount);
811
+ const valueFormat = tickFormatter(options.intl, valueTicks, options.value.format);
812
+ const valueLabels = valueTicks.map((tick) => valueFormat(tick));
813
+ const valueLabelWidth = showValueAxis ? Math.max(0, ...valueLabels.map((label) => textWidth(label, fontSize))) : 0;
814
+ const second = horizontal ? void 0 : options.secondaryValue;
815
+ const evenTicks = valueTicks.length > 1 && valueTicks[0] === domain[0] && valueTicks[valueTicks.length - 1] === domain[1] && options.value.scale !== "log";
816
+ const primaryZero = evenTicks ? valueTicks.indexOf(0) : -1;
817
+ const aligned = second && evenTicks ? alignedDomain(second, valueTicks.length - 1, primaryZero > 0 ? primaryZero : null) : null;
818
+ const secondDomain = second ? aligned?.domain ?? valueDomain(second, tickCount) : null;
819
+ const secondTicks = second && secondDomain ? aligned?.ticks ?? (second.scale === "log" ? logScale(secondDomain, [0, 1]) : linearScale(secondDomain, [0, 1])).ticks(tickCount) : [];
820
+ const secondFormat = tickFormatter(options.intl, secondTicks, second?.format);
821
+ const secondLabels = secondTicks.map((tick) => secondFormat(tick));
822
+ const secondLabelWidth = second ? Math.max(0, ...secondLabels.map((label) => textWidth(label, fontSize))) : 0;
823
+ const cat = options.category;
824
+ const count = cat.count ?? cat.labels?.length ?? 0;
825
+ const maxLabelWidth = cat.maxLabelWidth ?? 220;
826
+ const lineHeight = fontSize * 1.25;
827
+ const xTop = options.xAxisPosition === "top";
828
+ const yRight = options.yAxisPosition === "right";
829
+ const categoryLabelTexts = cat.kind === "band" || cat.kind === "point" ? [...cat.labels ?? []] : [];
830
+ const titleSpace = lineHeight + 4;
831
+ let ySpace;
832
+ let xSpace;
833
+ let edgeX;
834
+ if (horizontal) {
835
+ const labelWidth = showCategoryAxis ? Math.min(maxLabelWidth, Math.max(0, ...categoryLabelTexts.map((label) => textWidth(label, fontSize)))) : 0;
836
+ ySpace = showCategoryAxis ? labelWidth + LABEL_PAD$1 + 2 : 4;
837
+ xSpace = showValueAxis ? lineHeight + GAP : GAP;
838
+ edgeX = Math.max(12, (showValueAxis ? textWidth(valueLabels[valueLabels.length - 1] ?? "", fontSize) / 2 : 0) + 2);
839
+ if (cat.title && showCategoryAxis) ySpace += titleSpace;
840
+ if (options.value.title && showValueAxis) xSpace += titleSpace;
841
+ } else {
842
+ ySpace = showValueAxis ? valueLabelWidth + LABEL_PAD$1 + 4 : 4;
843
+ xSpace = showCategoryAxis ? lineHeight + GAP : GAP;
844
+ edgeX = 12;
845
+ if (cat.title && showCategoryAxis) xSpace += titleSpace;
846
+ if (options.value.title && showValueAxis) ySpace += titleSpace;
847
+ }
848
+ const edgeY = horizontal ? 4 : fontSize / 2 + 4;
849
+ const secondSpace = second ? secondLabelWidth + LABEL_PAD$1 + 4 + (second.title ? titleSpace : 0) : 0;
850
+ let left = yRight ? second ? secondSpace : horizontal ? edgeX : 4 : ySpace;
851
+ let right = yRight ? ySpace : second ? secondSpace : edgeX;
852
+ let top = xTop ? xSpace : edgeY;
853
+ let bottom = xTop ? edgeY : xSpace;
854
+ const plotFor = (b, l, r) => ({
855
+ left: l,
856
+ top,
857
+ width: Math.max(1, width - l - r),
858
+ height: Math.max(1, height - top - b)
859
+ });
860
+ let plot = plotFor(bottom, left, right);
861
+ let rotate = 0;
862
+ let categoryTicks = [];
863
+ const buildScale = (area) => {
864
+ const range = horizontal ? [area.top, area.top + area.height] : [area.left, area.left + area.width];
865
+ if (cat.kind === "band") return bandScale(count, range, cat.paddingInner ?? 0, 0);
866
+ if (cat.kind === "point") return pointScale(count, range);
867
+ if (cat.kind === "time") return timeScale(cat.domain ?? [0, 1], range);
868
+ return linearScale(cat.domain ?? [0, 1], range);
869
+ };
870
+ const ticksFor = (scale, area) => {
871
+ if (scale.kind === "band" || scale.kind === "point") return categoryLabelTexts.map((label, index) => ({
872
+ index,
873
+ value: index,
874
+ label
875
+ }));
876
+ const span = horizontal ? area.height : area.width;
877
+ const wanted = Math.max(2, Math.min(12, Math.floor(span / 80)));
878
+ const ticks = scale.kind === "time" ? scale.ticks(wanted) : scale.ticks(wanted);
879
+ const format = cat.format ?? (scale.kind === "time" ? timeTickFormatter(options.intl, scale.interval(wanted), scale.domain[1] - scale.domain[0]) : tickFormatter(options.intl, ticks));
880
+ return ticks.map((value, index) => ({
881
+ index,
882
+ value,
883
+ label: format(value)
884
+ }));
885
+ };
886
+ const position = (scale, tick) => scale.kind === "band" ? scale.center(tick.index) : scale.kind === "point" ? scale.at(tick.index) : scale.map(tick.value);
887
+ let scale = buildScale(plot);
888
+ if (showCategoryAxis && !horizontal) {
889
+ const all = ticksFor(scale, plot);
890
+ const mode = cat.labelMode ?? "auto";
891
+ const widest = Math.max(0, ...all.map((tick) => textWidth(tick.label, fontSize)));
892
+ const spacing = all.length > 1 ? Math.abs(position(scale, all[1]) - position(scale, all[0])) : plot.width;
893
+ const limit = cat.maxLabels && all.length > cat.maxLabels ? Math.ceil(all.length / cat.maxLabels) : 1;
894
+ const fitsFlat = widest + GAP <= spacing * limit;
895
+ const rotatedStep = lineHeight * 1.2;
896
+ const canRotate = mode !== "skip" && (mode === "rotate" || all.length <= 40 && spacing * limit >= rotatedStep);
897
+ if (fitsFlat && mode !== "rotate") categoryTicks = pickEvery(all, limit);
898
+ else if (canRotate) {
899
+ rotate = ROTATE;
900
+ const capped = Math.min(widest, maxLabelWidth, height * .35 / Math.SQRT1_2);
901
+ const rotatedSpace = (capped + lineHeight) * Math.SQRT1_2 + GAP + (cat.title ? titleSpace : 0);
902
+ if (xTop) {
903
+ top = rotatedSpace;
904
+ right = Math.max(right, capped * Math.SQRT1_2 - 4);
905
+ } else {
906
+ bottom = rotatedSpace;
907
+ left = Math.max(left, capped * Math.SQRT1_2 - 4);
908
+ }
909
+ plot = plotFor(bottom, left, right);
910
+ scale = buildScale(plot);
911
+ const nextSpacing = all.length > 1 ? Math.abs(position(scale, all[1]) - position(scale, all[0])) : plot.width;
912
+ categoryTicks = pickEvery(all, Math.max(limit, Math.ceil(rotatedStep / Math.max(1, nextSpacing))));
913
+ } else categoryTicks = pickEvery(all, Math.max(limit, Math.ceil((widest + GAP) / Math.max(1, spacing))));
914
+ if (!rotate && categoryTicks.length && scale.kind !== "band") {
915
+ const first = textWidth(categoryTicks[0].label, fontSize) / 2;
916
+ const last = textWidth(categoryTicks[categoryTicks.length - 1].label, fontSize) / 2;
917
+ const firstOverflow = first - (position(scale, categoryTicks[0]) - 0);
918
+ const lastOverflow = position(scale, categoryTicks[categoryTicks.length - 1]) + last - width;
919
+ if (firstOverflow > 0 || lastOverflow > 0) {
920
+ plot = plotFor(bottom, left + Math.max(0, firstOverflow), right + Math.max(0, lastOverflow + 2));
921
+ scale = buildScale(plot);
922
+ }
923
+ }
924
+ } else if (showCategoryAxis) {
925
+ const all = ticksFor(scale, plot);
926
+ const spacing = all.length > 1 ? Math.abs(position(scale, all[1]) - position(scale, all[0])) : plot.height;
927
+ categoryTicks = pickEvery(all, Math.max(1, Math.ceil(lineHeight / Math.max(1, spacing))));
928
+ }
929
+ const valueRange = horizontal ? [plot.left, plot.left + plot.width] : [plot.top + plot.height, plot.top];
930
+ const value = options.value.scale === "log" ? logScale(domain, valueRange) : linearScale(domain, valueRange);
931
+ const secondaryValue = second && secondDomain ? second.scale === "log" ? logScale(secondDomain, valueRange) : linearScale(secondDomain, valueRange) : null;
932
+ const grid = [];
933
+ const gridMode = options.grid ?? "value";
934
+ const axes = [];
935
+ const right2 = plot.left + plot.width;
936
+ const bottom2 = plot.top + plot.height;
937
+ const valueAxisLabels = valueTicks.map((tick, index) => {
938
+ const at = value.map(tick);
939
+ return horizontal ? {
940
+ text: valueLabels[index],
941
+ x: at,
942
+ y: xTop ? plot.top - GAP : bottom2 + GAP,
943
+ anchor: "middle",
944
+ baseline: xTop ? "auto" : "hanging",
945
+ rotate: 0
946
+ } : {
947
+ text: valueLabels[index],
948
+ x: yRight ? right2 + LABEL_PAD$1 : plot.left - LABEL_PAD$1,
949
+ y: at,
950
+ anchor: yRight ? "start" : "end",
951
+ baseline: "middle",
952
+ rotate: 0
953
+ };
954
+ });
955
+ if (gridMode === "value" || gridMode === "both") valueTicks.forEach((tick) => {
956
+ const at = value.map(tick);
957
+ grid.push(horizontal ? {
958
+ x1: at,
959
+ y1: plot.top,
960
+ x2: at,
961
+ y2: bottom2
962
+ } : {
963
+ x1: plot.left,
964
+ y1: at,
965
+ x2: right2,
966
+ y2: at
967
+ });
968
+ });
969
+ if (gridMode === "category" || gridMode === "both") categoryTicks.forEach((tick) => {
970
+ const at = position(scale, tick);
971
+ grid.push(horizontal ? {
972
+ x1: plot.left,
973
+ y1: at,
974
+ x2: right2,
975
+ y2: at
976
+ } : {
977
+ x1: at,
978
+ y1: plot.top,
979
+ x2: at,
980
+ y2: bottom2
981
+ });
982
+ });
983
+ const xTitle = (text) => ({
984
+ text,
985
+ x: plot.left + plot.width / 2,
986
+ y: xTop ? lineHeight - 2 : height - 4,
987
+ rotate: 0
988
+ });
989
+ const yTitle = (text, onRight = yRight) => ({
990
+ text,
991
+ x: onRight ? width - lineHeight / 2 - 2 : lineHeight / 2 + 2,
992
+ y: plot.top + plot.height / 2,
993
+ rotate: onRight ? 90 : -90
994
+ });
995
+ if (showValueAxis) axes.push({
996
+ position: horizontal ? xTop ? "top" : "bottom" : yRight ? "right" : "left",
997
+ labels: valueAxisLabels,
998
+ line: null,
999
+ title: options.value.title ? horizontal ? xTitle(options.value.title) : yTitle(options.value.title) : void 0
1000
+ });
1001
+ if (second && secondaryValue) {
1002
+ const onRight = !yRight;
1003
+ axes.push({
1004
+ position: onRight ? "right" : "left",
1005
+ labels: secondTicks.map((tick, index) => ({
1006
+ text: secondLabels[index],
1007
+ x: onRight ? right2 + LABEL_PAD$1 : plot.left - LABEL_PAD$1,
1008
+ y: secondaryValue.map(tick),
1009
+ anchor: onRight ? "start" : "end",
1010
+ baseline: "middle",
1011
+ rotate: 0
1012
+ })),
1013
+ line: null,
1014
+ title: second.title ? yTitle(second.title, onRight) : void 0
1015
+ });
1016
+ }
1017
+ if (showCategoryAxis) {
1018
+ const labels = categoryTicks.map((tick) => {
1019
+ const at = position(scale, tick);
1020
+ if (horizontal) {
1021
+ const text = truncateText(tick.label, maxLabelWidth, fontSize);
1022
+ return {
1023
+ text,
1024
+ x: yRight ? right2 + LABEL_PAD$1 : plot.left - LABEL_PAD$1,
1025
+ y: at,
1026
+ anchor: yRight ? "start" : "end",
1027
+ baseline: "middle",
1028
+ rotate: 0,
1029
+ title: text !== tick.label ? tick.label : void 0
1030
+ };
1031
+ }
1032
+ const y = xTop ? plot.top - GAP : bottom2 + GAP;
1033
+ const baseline = xTop ? "auto" : "hanging";
1034
+ if (rotate) {
1035
+ const text = truncateText(tick.label, Math.min(maxLabelWidth, height * .35 / Math.SQRT1_2), fontSize);
1036
+ return {
1037
+ text,
1038
+ x: at,
1039
+ y,
1040
+ anchor: xTop ? "start" : "end",
1041
+ baseline,
1042
+ rotate,
1043
+ title: text !== tick.label ? tick.label : void 0
1044
+ };
1045
+ }
1046
+ return {
1047
+ text: tick.label,
1048
+ x: at,
1049
+ y,
1050
+ anchor: "middle",
1051
+ baseline,
1052
+ rotate: 0
1053
+ };
1054
+ });
1055
+ axes.push({
1056
+ position: horizontal ? yRight ? "right" : "left" : xTop ? "top" : "bottom",
1057
+ labels,
1058
+ line: null,
1059
+ title: cat.title ? horizontal ? yTitle(cat.title) : xTitle(cat.title) : void 0
1060
+ });
1061
+ }
1062
+ const zeroAt = domain[0] < 0 && domain[1] > 0 && options.value.scale !== "log" ? value.map(0) : null;
1063
+ const zero = zeroAt === null ? null : horizontal ? {
1064
+ x1: zeroAt,
1065
+ y1: plot.top,
1066
+ x2: zeroAt,
1067
+ y2: bottom2,
1068
+ zero: true
1069
+ } : {
1070
+ x1: plot.left,
1071
+ y1: zeroAt,
1072
+ x2: right2,
1073
+ y2: zeroAt,
1074
+ zero: true
1075
+ };
1076
+ const categoryPosition = (index, x) => {
1077
+ if (scale.kind === "band") return scale.center(index);
1078
+ if (scale.kind === "point") return scale.at(index);
1079
+ return scale.map(x ?? index);
1080
+ };
1081
+ const categoryIndexAt = (at, xs) => {
1082
+ if (scale.kind === "band" || scale.kind === "point") return scale.indexAt(at);
1083
+ const target = scale.invert(at);
1084
+ const values = xs ?? [];
1085
+ let best = -1;
1086
+ let distance = Infinity;
1087
+ values.forEach((x, index) => {
1088
+ const next = Math.abs(x - target);
1089
+ if (next < distance) {
1090
+ distance = next;
1091
+ best = index;
1092
+ }
1093
+ });
1094
+ return best;
1095
+ };
1096
+ return {
1097
+ plot,
1098
+ value,
1099
+ secondaryValue,
1100
+ category: scale,
1101
+ valueTicks,
1102
+ secondaryValueTicks: secondTicks,
1103
+ axes: {
1104
+ axes,
1105
+ grid,
1106
+ zero
1107
+ },
1108
+ horizontal,
1109
+ categoryPosition,
1110
+ categoryIndexAt
1111
+ };
1112
+ }
1113
+ const TX_CHART_FALLBACK_WIDTH = 640;
1114
+ const TX_CHART_FALLBACK_HEIGHT = 350;
1115
+ const TX_CHART_LEGEND_ROW = 31;
1116
+ const TX_CHART_LEGEND_SIDE = 175;
1117
+ function chartHeightValue(height, fallback = 350) {
1118
+ if (typeof height === "number") return Number.isFinite(height) && height > 0 ? height : fallback;
1119
+ const pixels = /^(\d+(?:\.\d+)?)px$/.exec(height.trim());
1120
+ return pixels ? Number(pixels[1]) : fallback;
1121
+ }
1122
+ function chartBoxHeight(height, legend, toolbar = false) {
1123
+ const total = chartHeightValue(height);
1124
+ return Math.max(1, total - ((legend === "top" || legend === "bottom" ? 1 : 0) + (toolbar && legend !== "top" ? 1 : 0)) * 31);
1125
+ }
1126
+ function initialChartSize(height, legend, width = 640, toolbar = false) {
1127
+ return {
1128
+ width: legend === "left" || legend === "right" ? width - 175 : width,
1129
+ height: chartBoxHeight(height, legend, toolbar)
1130
+ };
1131
+ }
1132
+ const TX_CHART_ENTER_MS = 1100;
1133
+ function prefersReducedMotion(document) {
1134
+ return document.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
1135
+ }
1136
+ function injectChartEntrance() {
1137
+ const host = inject(ElementRef).nativeElement;
1138
+ const document = inject(DOCUMENT);
1139
+ const browser = isPlatformBrowser(inject(PLATFORM_ID));
1140
+ const active = signal(false, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
1141
+ let timer;
1142
+ inject(DestroyRef).onDestroy(() => clearTimeout(timer));
1143
+ const play = () => {
1144
+ if (!browser || prefersReducedMotion(document)) return;
1145
+ clearTimeout(timer);
1146
+ active.set(true);
1147
+ timer = setTimeout(() => active.set(false), TX_CHART_ENTER_MS);
1148
+ };
1149
+ if (browser && !host.hasChildNodes()) play();
1150
+ return {
1151
+ active: active.asReadonly(),
1152
+ play
1153
+ };
1154
+ }
1155
+ var TxChartLegendTemplate = class TxChartLegendTemplate {
1156
+ template = inject(TemplateRef);
1157
+ static ngTemplateContextGuard(_directive, context) {
1158
+ return !!context;
1159
+ }
1160
+ static ɵfac = i0.ɵɵngDeclareFactory({
1161
+ minVersion: "12.0.0",
1162
+ version: "22.2.3",
1163
+ ngImport: i0,
1164
+ type: TxChartLegendTemplate,
1165
+ deps: [],
1166
+ target: i0.ɵɵFactoryTarget.Directive
1167
+ });
1168
+ static ɵdir = i0.ɵɵngDeclareDirective({
1169
+ minVersion: "14.0.0",
1170
+ version: "22.2.3",
1171
+ type: TxChartLegendTemplate,
1172
+ isStandalone: true,
1173
+ selector: "ng-template[txChartLegend]",
1174
+ ngImport: i0
1175
+ });
1176
+ };
1177
+ i0.ɵɵngDeclareClassMetadata({
1178
+ minVersion: "12.0.0",
1179
+ version: "22.2.3",
1180
+ ngImport: i0,
1181
+ type: TxChartLegendTemplate,
1182
+ decorators: [{
1183
+ type: Directive,
1184
+ args: [{ selector: "ng-template[txChartLegend]" }]
1185
+ }]
1186
+ });
1187
+ var TxChartTooltipTemplate = class TxChartTooltipTemplate {
1188
+ template = inject(TemplateRef);
1189
+ static ngTemplateContextGuard(_directive, context) {
1190
+ return !!context;
1191
+ }
1192
+ static ɵfac = i0.ɵɵngDeclareFactory({
1193
+ minVersion: "12.0.0",
1194
+ version: "22.2.3",
1195
+ ngImport: i0,
1196
+ type: TxChartTooltipTemplate,
1197
+ deps: [],
1198
+ target: i0.ɵɵFactoryTarget.Directive
1199
+ });
1200
+ static ɵdir = i0.ɵɵngDeclareDirective({
1201
+ minVersion: "14.0.0",
1202
+ version: "22.2.3",
1203
+ type: TxChartTooltipTemplate,
1204
+ isStandalone: true,
1205
+ selector: "ng-template[txChartTooltip]",
1206
+ ngImport: i0
1207
+ });
1208
+ };
1209
+ i0.ɵɵngDeclareClassMetadata({
1210
+ minVersion: "12.0.0",
1211
+ version: "22.2.3",
1212
+ ngImport: i0,
1213
+ type: TxChartTooltipTemplate,
1214
+ decorators: [{
1215
+ type: Directive,
1216
+ args: [{ selector: "ng-template[txChartTooltip]" }]
1217
+ }]
1218
+ });
1219
+ var TxChartLegend = class TxChartLegend {
1220
+ host = inject(ElementRef);
1221
+ translations = injectTranslations();
1222
+ items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
1223
+ position = input("top", ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
1224
+ align = input("start", ...ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []);
1225
+ variant = input("dot", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
1226
+ toggle = input(true, {
1227
+ ...ngDevMode ? { debugName: "toggle" } : /* istanbul ignore next */ {},
1228
+ transform: booleanAttribute
1229
+ });
1230
+ template = input(null, ...ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []);
1231
+ itemPart = input(void 0, ...ngDevMode ? [{ debugName: "itemPart" }] : /* istanbul ignore next */ []);
1232
+ toggled = output();
1233
+ hovered = output();
1234
+ hasValues = computed(() => this.variant() !== "stat" && this.items().some((item) => item.value !== void 0 || item.percent !== void 0), ...ngDevMode ? [{ debugName: "hasValues" }] : /* istanbul ignore next */ []);
1235
+ onKeydown(event, index) {
1236
+ const count = this.items().length;
1237
+ const vertical = this.position() === "left" || this.position() === "right" || this.hasValues();
1238
+ const forward = vertical ? ["ArrowDown", "ArrowRight"] : ["ArrowRight", "ArrowDown"];
1239
+ const back = vertical ? ["ArrowUp", "ArrowLeft"] : ["ArrowLeft", "ArrowUp"];
1240
+ const next = forward.includes(event.key) ? (index + 1) % count : back.includes(event.key) ? (index - 1 + count) % count : event.key === "Home" ? 0 : event.key === "End" ? count - 1 : -1;
1241
+ if (next < 0) return;
1242
+ event.preventDefault();
1243
+ const buttons = this.host.nativeElement.querySelectorAll(".tx-chart-legend__item");
1244
+ buttons.forEach((button, position) => button.tabIndex = position === next ? 0 : -1);
1245
+ buttons[next]?.focus();
1246
+ }
1247
+ static ɵfac = i0.ɵɵngDeclareFactory({
1248
+ minVersion: "12.0.0",
1249
+ version: "22.2.3",
1250
+ ngImport: i0,
1251
+ type: TxChartLegend,
1252
+ deps: [],
1253
+ target: i0.ɵɵFactoryTarget.Component
1254
+ });
1255
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1256
+ minVersion: "17.0.0",
1257
+ version: "22.2.3",
1258
+ type: TxChartLegend,
1259
+ isStandalone: true,
1260
+ selector: "tx-chart-legend",
1261
+ inputs: {
1262
+ items: {
1263
+ classPropertyName: "items",
1264
+ publicName: "items",
1265
+ isSignal: true,
1266
+ isRequired: false,
1267
+ transformFunction: null
1268
+ },
1269
+ position: {
1270
+ classPropertyName: "position",
1271
+ publicName: "position",
1272
+ isSignal: true,
1273
+ isRequired: false,
1274
+ transformFunction: null
1275
+ },
1276
+ align: {
1277
+ classPropertyName: "align",
1278
+ publicName: "align",
1279
+ isSignal: true,
1280
+ isRequired: false,
1281
+ transformFunction: null
1282
+ },
1283
+ variant: {
1284
+ classPropertyName: "variant",
1285
+ publicName: "variant",
1286
+ isSignal: true,
1287
+ isRequired: false,
1288
+ transformFunction: null
1289
+ },
1290
+ toggle: {
1291
+ classPropertyName: "toggle",
1292
+ publicName: "toggle",
1293
+ isSignal: true,
1294
+ isRequired: false,
1295
+ transformFunction: null
1296
+ },
1297
+ template: {
1298
+ classPropertyName: "template",
1299
+ publicName: "template",
1300
+ isSignal: true,
1301
+ isRequired: false,
1302
+ transformFunction: null
1303
+ },
1304
+ itemPart: {
1305
+ classPropertyName: "itemPart",
1306
+ publicName: "itemPart",
1307
+ isSignal: true,
1308
+ isRequired: false,
1309
+ transformFunction: null
1310
+ }
1311
+ },
1312
+ outputs: {
1313
+ toggled: "toggled",
1314
+ hovered: "hovered"
1315
+ },
1316
+ host: {
1317
+ properties: {
1318
+ "attr.role": "toggle() ? \"group\" : \"list\"",
1319
+ "attr.aria-label": "translations().chartLegend",
1320
+ "attr.data-position": "position()",
1321
+ "attr.data-align": "align()",
1322
+ "attr.data-variant": "variant()",
1323
+ "class.tx-chart-legend--values": "hasValues()"
1324
+ },
1325
+ classAttribute: "tx-chart-legend"
1326
+ },
1327
+ ngImport: i0,
1328
+ template: `
1329
+ @for (item of items(); track item.key; let index = $index) {
1330
+ @if (toggle()) {
1331
+ <button
1332
+ type="button"
1333
+ class="tx-chart-legend__item"
1334
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1335
+ [class]="itemPart()?.class"
1336
+ [style]="itemPart()?.style"
1337
+ [style.--tx-chart-legend-item-color]="item.color"
1338
+ [attr.aria-pressed]="!item.hidden"
1339
+ [attr.data-key]="item.key"
1340
+ [attr.data-marker]="item.marker"
1341
+ [tabindex]="index === 0 ? 0 : -1"
1342
+ (click)="toggled.emit(item.key)"
1343
+ (pointerenter)="hovered.emit(item.key)"
1344
+ (pointerleave)="hovered.emit(null)"
1345
+ (focus)="hovered.emit(item.key)"
1346
+ (blur)="hovered.emit(null)"
1347
+ (keydown)="onKeydown($event, index)"
1348
+ >
1349
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1350
+ </button>
1351
+ } @else {
1352
+ <span
1353
+ class="tx-chart-legend__item"
1354
+ role="listitem"
1355
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1356
+ [class]="itemPart()?.class"
1357
+ [style]="itemPart()?.style"
1358
+ [style.--tx-chart-legend-item-color]="item.color"
1359
+ [attr.data-key]="item.key"
1360
+ [attr.data-marker]="item.marker"
1361
+ (pointerenter)="hovered.emit(item.key)"
1362
+ (pointerleave)="hovered.emit(null)"
1363
+ >
1364
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1365
+ </span>
1366
+ }
1367
+ }
1368
+ <ng-template #plain let-item>
1369
+ @if (variant() === 'stat') {
1370
+ <span class="tx-chart-legend__head">
1371
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1372
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1373
+ </span>
1374
+ <span class="tx-chart-legend__stat">{{ item.value ?? '—' }}</span>
1375
+ @if (item.caption) {
1376
+ <span class="tx-chart-legend__caption">{{ item.caption }}</span>
1377
+ }
1378
+ } @else {
1379
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1380
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1381
+ @if (item.value !== undefined) {
1382
+ <span class="tx-chart-legend__value">{{ item.value }}</span>
1383
+ }
1384
+ @if (item.percent !== undefined) {
1385
+ <span class="tx-chart-legend__percent">{{ item.percent }}</span>
1386
+ }
1387
+ }
1388
+ </ng-template>
1389
+ `,
1390
+ isInline: true,
1391
+ styles: [":host{display:flex;flex-wrap:wrap;align-items:center;min-width:0}:host([data-align=center]){justify-content:center}:host([data-align=end]){justify-content:flex-end}:host([data-position=left]),:host([data-position=right]),:host(.tx-chart-legend--values){flex-direction:column;flex-wrap:nowrap;align-items:stretch}.tx-chart-legend__item{display:inline-flex;align-items:center;min-width:0;margin:0;border:0;background:none;color:inherit;font:inherit;text-align:start;text-transform:inherit;letter-spacing:inherit}button.tx-chart-legend__item{cursor:pointer}.tx-chart-legend__marker{flex-shrink:0;background:var(--tx-chart-legend-item-color)}.tx-chart-legend__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.tx-chart-legend--values) .tx-chart-legend__item{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto}.tx-chart-legend__value,.tx-chart-legend__percent,.tx-chart-legend__stat{font-variant-numeric:tabular-nums;white-space:nowrap}.tx-chart-legend__value,.tx-chart-legend__percent{text-align:end}:host([data-variant=stat]) .tx-chart-legend__item{flex-direction:column;align-items:flex-start}.tx-chart-legend__head{display:inline-flex;align-items:center;max-width:100%}:host([data-styled]){gap:var(--tx-chart-legend-item-gap);color:var(--tx-chart-legend-color);font-size:var(--tx-chart-legend-font-size);font-weight:var(--tx-chart-legend-font-weight);line-height:1.35}:host([data-styled]) .tx-chart-legend__item{gap:var(--tx-chart-legend-marker-gap);padding:var(--tx-chart-legend-padding-y) var(--tx-chart-legend-padding-x);border-radius:var(--tx-chart-legend-border-radius);transition:color var(--tx-chart-motion-hover-duration) ease,opacity var(--tx-chart-motion-hover-duration) ease,background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) button.tx-chart-legend__item:hover{background:var(--tx-chart-legend-hover-background)}:host([data-styled]) button.tx-chart-legend__item:focus-visible{outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:0}:host([data-styled]) .tx-chart-legend__marker{width:var(--tx-chart-legend-marker-size);height:var(--tx-chart-legend-marker-size);border-radius:var(--tx-chart-legend-marker-radius);transition:background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-chart-legend__item--hidden{color:var(--tx-chart-legend-muted-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__marker{background:transparent;box-shadow:inset 0 0 0 1.5px var(--tx-chart-legend-item-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:line-through;text-decoration-color:color-mix(in srgb,currentColor 45%,transparent)}:host([data-styled]) .tx-chart-legend__value,:host([data-styled]) .tx-chart-legend__percent{color:var(--tx-chart-legend-value-color);font-weight:var(--tx-font-weight-regular)}:host([data-styled]) .tx-chart-legend__value{padding-inline-start:var(--tx-chart-legend-value-gap);color:inherit;font-weight:var(--tx-chart-legend-font-weight)}:host([data-styled]) .tx-chart-legend__percent{min-width:4.5ch;padding-inline-start:var(--tx-chart-legend-percent-gap)}:host([data-styled].tx-chart-legend--values),:host([data-styled][data-position=left]),:host([data-styled][data-position=right]){gap:var(--tx-chart-legend-list-gap)}:host([data-styled][data-variant=line]) .tx-chart-legend__marker,:host([data-styled]:not([data-variant=stat])) .tx-chart-legend__item[data-marker=line] .tx-chart-legend__marker{width:var(--tx-chart-legend-line-width);height:var(--tx-chart-legend-line-height);border-radius:var(--tx-radius-full)}:host([data-styled][data-variant=line]) .tx-chart-legend__item--hidden .tx-chart-legend__marker,:host([data-styled]:not([data-variant=stat])) .tx-chart-legend__item--hidden[data-marker=line] .tx-chart-legend__marker{background:repeating-linear-gradient(90deg,var(--tx-chart-legend-item-color) 0 3px,transparent 3px 5px);box-shadow:none}:host([data-styled][data-variant=pill]){gap:calc(var(--tx-chart-legend-item-gap) + 2px)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item{padding:var(--tx-chart-legend-pill-padding-y) var(--tx-chart-legend-pill-padding-x);border-radius:var(--tx-chart-legend-pill-radius);background:color-mix(in srgb,var(--tx-chart-legend-item-color) var(--tx-chart-legend-pill-tint),transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--tx-chart-legend-item-color) 28%,transparent)}:host([data-styled][data-variant=pill]) button.tx-chart-legend__item:hover{background:color-mix(in srgb,var(--tx-chart-legend-item-color) calc(var(--tx-chart-legend-pill-tint) + 8%),transparent)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item--hidden,:host([data-styled][data-variant=pill]) button.tx-chart-legend__item--hidden:hover{background:transparent;box-shadow:inset 0 0 0 1px var(--tx-chart-legend-pill-border-color)}:host([data-styled][data-variant=stat]){gap:var(--tx-chart-legend-item-gap);align-items:stretch}:host([data-styled][data-variant=stat]) .tx-chart-legend__item{gap:2px;min-width:var(--tx-chart-legend-stat-min-width);padding:var(--tx-chart-legend-stat-padding-y) var(--tx-chart-legend-stat-padding-x);border-radius:var(--tx-chart-legend-stat-radius)}:host([data-styled][data-variant=stat]) .tx-chart-legend__head{gap:var(--tx-chart-legend-marker-gap);color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size)}:host([data-styled][data-variant=stat]) .tx-chart-legend__stat{font-size:var(--tx-chart-legend-stat-value-font-size);font-weight:var(--tx-chart-legend-stat-value-font-weight);line-height:1.2}:host([data-styled][data-variant=stat]) .tx-chart-legend__caption{color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size);font-weight:var(--tx-font-weight-regular)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden{opacity:var(--tx-chart-legend-hidden-opacity)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-chart-legend__item,:host([data-styled]) .tx-chart-legend__marker{transition:none}}\n"],
1392
+ dependencies: [{
1393
+ kind: "directive",
1394
+ type: NgTemplateOutlet,
1395
+ selector: "[ngTemplateOutlet]",
1396
+ inputs: [
1397
+ "ngTemplateOutletContext",
1398
+ "ngTemplateOutlet",
1399
+ "ngTemplateOutletInjector"
1400
+ ]
1401
+ }],
1402
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1403
+ });
1404
+ };
1405
+ i0.ɵɵngDeclareClassMetadata({
1406
+ minVersion: "12.0.0",
1407
+ version: "22.2.3",
1408
+ ngImport: i0,
1409
+ type: TxChartLegend,
1410
+ decorators: [{
1411
+ type: Component,
1412
+ args: [{
1413
+ selector: "tx-chart-legend",
1414
+ imports: [NgTemplateOutlet],
1415
+ template: `
1416
+ @for (item of items(); track item.key; let index = $index) {
1417
+ @if (toggle()) {
1418
+ <button
1419
+ type="button"
1420
+ class="tx-chart-legend__item"
1421
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1422
+ [class]="itemPart()?.class"
1423
+ [style]="itemPart()?.style"
1424
+ [style.--tx-chart-legend-item-color]="item.color"
1425
+ [attr.aria-pressed]="!item.hidden"
1426
+ [attr.data-key]="item.key"
1427
+ [attr.data-marker]="item.marker"
1428
+ [tabindex]="index === 0 ? 0 : -1"
1429
+ (click)="toggled.emit(item.key)"
1430
+ (pointerenter)="hovered.emit(item.key)"
1431
+ (pointerleave)="hovered.emit(null)"
1432
+ (focus)="hovered.emit(item.key)"
1433
+ (blur)="hovered.emit(null)"
1434
+ (keydown)="onKeydown($event, index)"
1435
+ >
1436
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1437
+ </button>
1438
+ } @else {
1439
+ <span
1440
+ class="tx-chart-legend__item"
1441
+ role="listitem"
1442
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1443
+ [class]="itemPart()?.class"
1444
+ [style]="itemPart()?.style"
1445
+ [style.--tx-chart-legend-item-color]="item.color"
1446
+ [attr.data-key]="item.key"
1447
+ [attr.data-marker]="item.marker"
1448
+ (pointerenter)="hovered.emit(item.key)"
1449
+ (pointerleave)="hovered.emit(null)"
1450
+ >
1451
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1452
+ </span>
1453
+ }
1454
+ }
1455
+ <ng-template #plain let-item>
1456
+ @if (variant() === 'stat') {
1457
+ <span class="tx-chart-legend__head">
1458
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1459
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1460
+ </span>
1461
+ <span class="tx-chart-legend__stat">{{ item.value ?? '—' }}</span>
1462
+ @if (item.caption) {
1463
+ <span class="tx-chart-legend__caption">{{ item.caption }}</span>
1464
+ }
1465
+ } @else {
1466
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1467
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1468
+ @if (item.value !== undefined) {
1469
+ <span class="tx-chart-legend__value">{{ item.value }}</span>
1470
+ }
1471
+ @if (item.percent !== undefined) {
1472
+ <span class="tx-chart-legend__percent">{{ item.percent }}</span>
1473
+ }
1474
+ }
1475
+ </ng-template>
1476
+ `,
1477
+ changeDetection: ChangeDetectionStrategy.OnPush,
1478
+ host: {
1479
+ class: "tx-chart-legend",
1480
+ "[attr.role]": "toggle() ? \"group\" : \"list\"",
1481
+ "[attr.aria-label]": "translations().chartLegend",
1482
+ "[attr.data-position]": "position()",
1483
+ "[attr.data-align]": "align()",
1484
+ "[attr.data-variant]": "variant()",
1485
+ "[class.tx-chart-legend--values]": "hasValues()"
1486
+ },
1487
+ styles: [":host{display:flex;flex-wrap:wrap;align-items:center;min-width:0}:host([data-align=center]){justify-content:center}:host([data-align=end]){justify-content:flex-end}:host([data-position=left]),:host([data-position=right]),:host(.tx-chart-legend--values){flex-direction:column;flex-wrap:nowrap;align-items:stretch}.tx-chart-legend__item{display:inline-flex;align-items:center;min-width:0;margin:0;border:0;background:none;color:inherit;font:inherit;text-align:start;text-transform:inherit;letter-spacing:inherit}button.tx-chart-legend__item{cursor:pointer}.tx-chart-legend__marker{flex-shrink:0;background:var(--tx-chart-legend-item-color)}.tx-chart-legend__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.tx-chart-legend--values) .tx-chart-legend__item{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto}.tx-chart-legend__value,.tx-chart-legend__percent,.tx-chart-legend__stat{font-variant-numeric:tabular-nums;white-space:nowrap}.tx-chart-legend__value,.tx-chart-legend__percent{text-align:end}:host([data-variant=stat]) .tx-chart-legend__item{flex-direction:column;align-items:flex-start}.tx-chart-legend__head{display:inline-flex;align-items:center;max-width:100%}:host([data-styled]){gap:var(--tx-chart-legend-item-gap);color:var(--tx-chart-legend-color);font-size:var(--tx-chart-legend-font-size);font-weight:var(--tx-chart-legend-font-weight);line-height:1.35}:host([data-styled]) .tx-chart-legend__item{gap:var(--tx-chart-legend-marker-gap);padding:var(--tx-chart-legend-padding-y) var(--tx-chart-legend-padding-x);border-radius:var(--tx-chart-legend-border-radius);transition:color var(--tx-chart-motion-hover-duration) ease,opacity var(--tx-chart-motion-hover-duration) ease,background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) button.tx-chart-legend__item:hover{background:var(--tx-chart-legend-hover-background)}:host([data-styled]) button.tx-chart-legend__item:focus-visible{outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:0}:host([data-styled]) .tx-chart-legend__marker{width:var(--tx-chart-legend-marker-size);height:var(--tx-chart-legend-marker-size);border-radius:var(--tx-chart-legend-marker-radius);transition:background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-chart-legend__item--hidden{color:var(--tx-chart-legend-muted-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__marker{background:transparent;box-shadow:inset 0 0 0 1.5px var(--tx-chart-legend-item-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:line-through;text-decoration-color:color-mix(in srgb,currentColor 45%,transparent)}:host([data-styled]) .tx-chart-legend__value,:host([data-styled]) .tx-chart-legend__percent{color:var(--tx-chart-legend-value-color);font-weight:var(--tx-font-weight-regular)}:host([data-styled]) .tx-chart-legend__value{padding-inline-start:var(--tx-chart-legend-value-gap);color:inherit;font-weight:var(--tx-chart-legend-font-weight)}:host([data-styled]) .tx-chart-legend__percent{min-width:4.5ch;padding-inline-start:var(--tx-chart-legend-percent-gap)}:host([data-styled].tx-chart-legend--values),:host([data-styled][data-position=left]),:host([data-styled][data-position=right]){gap:var(--tx-chart-legend-list-gap)}:host([data-styled][data-variant=line]) .tx-chart-legend__marker,:host([data-styled]:not([data-variant=stat])) .tx-chart-legend__item[data-marker=line] .tx-chart-legend__marker{width:var(--tx-chart-legend-line-width);height:var(--tx-chart-legend-line-height);border-radius:var(--tx-radius-full)}:host([data-styled][data-variant=line]) .tx-chart-legend__item--hidden .tx-chart-legend__marker,:host([data-styled]:not([data-variant=stat])) .tx-chart-legend__item--hidden[data-marker=line] .tx-chart-legend__marker{background:repeating-linear-gradient(90deg,var(--tx-chart-legend-item-color) 0 3px,transparent 3px 5px);box-shadow:none}:host([data-styled][data-variant=pill]){gap:calc(var(--tx-chart-legend-item-gap) + 2px)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item{padding:var(--tx-chart-legend-pill-padding-y) var(--tx-chart-legend-pill-padding-x);border-radius:var(--tx-chart-legend-pill-radius);background:color-mix(in srgb,var(--tx-chart-legend-item-color) var(--tx-chart-legend-pill-tint),transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--tx-chart-legend-item-color) 28%,transparent)}:host([data-styled][data-variant=pill]) button.tx-chart-legend__item:hover{background:color-mix(in srgb,var(--tx-chart-legend-item-color) calc(var(--tx-chart-legend-pill-tint) + 8%),transparent)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item--hidden,:host([data-styled][data-variant=pill]) button.tx-chart-legend__item--hidden:hover{background:transparent;box-shadow:inset 0 0 0 1px var(--tx-chart-legend-pill-border-color)}:host([data-styled][data-variant=stat]){gap:var(--tx-chart-legend-item-gap);align-items:stretch}:host([data-styled][data-variant=stat]) .tx-chart-legend__item{gap:2px;min-width:var(--tx-chart-legend-stat-min-width);padding:var(--tx-chart-legend-stat-padding-y) var(--tx-chart-legend-stat-padding-x);border-radius:var(--tx-chart-legend-stat-radius)}:host([data-styled][data-variant=stat]) .tx-chart-legend__head{gap:var(--tx-chart-legend-marker-gap);color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size)}:host([data-styled][data-variant=stat]) .tx-chart-legend__stat{font-size:var(--tx-chart-legend-stat-value-font-size);font-weight:var(--tx-chart-legend-stat-value-font-weight);line-height:1.2}:host([data-styled][data-variant=stat]) .tx-chart-legend__caption{color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size);font-weight:var(--tx-font-weight-regular)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden{opacity:var(--tx-chart-legend-hidden-opacity)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-chart-legend__item,:host([data-styled]) .tx-chart-legend__marker{transition:none}}\n"]
1488
+ }]
1489
+ }],
1490
+ propDecorators: {
1491
+ items: [{
1492
+ type: i0.Input,
1493
+ args: [{
1494
+ isSignal: true,
1495
+ alias: "items",
1496
+ required: false
1497
+ }]
1498
+ }],
1499
+ position: [{
1500
+ type: i0.Input,
1501
+ args: [{
1502
+ isSignal: true,
1503
+ alias: "position",
1504
+ required: false
1505
+ }]
1506
+ }],
1507
+ align: [{
1508
+ type: i0.Input,
1509
+ args: [{
1510
+ isSignal: true,
1511
+ alias: "align",
1512
+ required: false
1513
+ }]
1514
+ }],
1515
+ variant: [{
1516
+ type: i0.Input,
1517
+ args: [{
1518
+ isSignal: true,
1519
+ alias: "variant",
1520
+ required: false
1521
+ }]
1522
+ }],
1523
+ toggle: [{
1524
+ type: i0.Input,
1525
+ args: [{
1526
+ isSignal: true,
1527
+ alias: "toggle",
1528
+ required: false
1529
+ }]
1530
+ }],
1531
+ template: [{
1532
+ type: i0.Input,
1533
+ args: [{
1534
+ isSignal: true,
1535
+ alias: "template",
1536
+ required: false
1537
+ }]
1538
+ }],
1539
+ itemPart: [{
1540
+ type: i0.Input,
1541
+ args: [{
1542
+ isSignal: true,
1543
+ alias: "itemPart",
1544
+ required: false
1545
+ }]
1546
+ }],
1547
+ toggled: [{
1548
+ type: i0.Output,
1549
+ args: ["toggled"]
1550
+ }],
1551
+ hovered: [{
1552
+ type: i0.Output,
1553
+ args: ["hovered"]
1554
+ }]
1555
+ }
1556
+ });
1557
+ var TxChartAxes = class TxChartAxes {
1558
+ model = input.required({
1559
+ ...ngDevMode ? { debugName: "model" } : /* istanbul ignore next */ {},
1560
+ alias: "tx-chart-axes"
1561
+ });
1562
+ gridPart = input(void 0, ...ngDevMode ? [{ debugName: "gridPart" }] : /* istanbul ignore next */ []);
1563
+ axisPart = input(void 0, ...ngDevMode ? [{ debugName: "axisPart" }] : /* istanbul ignore next */ []);
1564
+ static ɵfac = i0.ɵɵngDeclareFactory({
1565
+ minVersion: "12.0.0",
1566
+ version: "22.2.3",
1567
+ ngImport: i0,
1568
+ type: TxChartAxes,
1569
+ deps: [],
1570
+ target: i0.ɵɵFactoryTarget.Component
1571
+ });
1572
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1573
+ minVersion: "17.0.0",
1574
+ version: "22.2.3",
1575
+ type: TxChartAxes,
1576
+ isStandalone: true,
1577
+ selector: "g[tx-chart-axes]",
1578
+ inputs: {
1579
+ model: {
1580
+ classPropertyName: "model",
1581
+ publicName: "tx-chart-axes",
1582
+ isSignal: true,
1583
+ isRequired: true,
1584
+ transformFunction: null
1585
+ },
1586
+ gridPart: {
1587
+ classPropertyName: "gridPart",
1588
+ publicName: "gridPart",
1589
+ isSignal: true,
1590
+ isRequired: false,
1591
+ transformFunction: null
1592
+ },
1593
+ axisPart: {
1594
+ classPropertyName: "axisPart",
1595
+ publicName: "axisPart",
1596
+ isSignal: true,
1597
+ isRequired: false,
1598
+ transformFunction: null
1599
+ }
1600
+ },
1601
+ host: {
1602
+ attributes: { "aria-hidden": "true" },
1603
+ classAttribute: "tx-chart-axes"
1604
+ },
1605
+ ngImport: i0,
1606
+ template: `
1607
+ <svg:g class="tx-chart-axes__grid" [class]="gridPart()?.class" [style]="gridPart()?.style">
1608
+ @for (line of model().grid; track $index) {
1609
+ <svg:line class="tx-chart-axes__grid-line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1610
+ }
1611
+ </svg:g>
1612
+ @if (model().zero; as zero) {
1613
+ <svg:line class="tx-chart-axes__zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1614
+ }
1615
+ @for (axis of model().axes; track axis.position) {
1616
+ <svg:g class="tx-chart-axes__axis" [attr.data-position]="axis.position" [class]="axisPart()?.class" [style]="axisPart()?.style">
1617
+ @if (axis.line; as line) {
1618
+ <svg:line class="tx-chart-axes__line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1619
+ }
1620
+ @for (label of axis.labels; track $index) {
1621
+ <svg:text
1622
+ class="tx-chart-axes__label"
1623
+ [attr.x]="label.x"
1624
+ [attr.y]="label.y"
1625
+ [attr.text-anchor]="label.anchor"
1626
+ [attr.dominant-baseline]="label.baseline"
1627
+ [attr.transform]="label.rotate ? 'rotate(' + label.rotate + ' ' + label.x + ' ' + label.y + ')' : null"
1628
+ >
1629
+ {{ label.text }}
1630
+ @if (label.title) {
1631
+ <svg:title>{{ label.title }}</svg:title>
1632
+ }
1633
+ </svg:text>
1634
+ }
1635
+ @if (axis.title; as title) {
1636
+ <svg:text
1637
+ class="tx-chart-axes__title"
1638
+ text-anchor="middle"
1639
+ [attr.x]="title.x"
1640
+ [attr.y]="title.y"
1641
+ [attr.transform]="title.rotate ? 'rotate(' + title.rotate + ' ' + title.x + ' ' + title.y + ')' : null"
1642
+ >
1643
+ {{ title.text }}
1644
+ </svg:text>
1645
+ }
1646
+ </svg:g>
1647
+ }
1648
+ `,
1649
+ isInline: true,
1650
+ styles: [".tx-chart-axes__grid-line,.tx-chart-axes__zero,.tx-chart-axes__line{fill:none;shape-rendering:crispEdges}.tx-chart-axes__label,.tx-chart-axes__title{-webkit-user-select:none;user-select:none}:host-context([data-styled]) .tx-chart-axes__grid-line{stroke:var(--tx-chart-grid-color);stroke-width:var(--tx-chart-grid-width);stroke-dasharray:var(--tx-chart-grid-dash)}:host-context([data-styled]) .tx-chart-axes__zero{stroke:var(--tx-chart-zero-line-color);stroke-width:var(--tx-chart-zero-line-width)}:host-context([data-styled]) .tx-chart-axes__line{stroke:var(--tx-chart-axis-line-color)}:host-context([data-styled]) .tx-chart-axes__label{fill:var(--tx-chart-axis-label-color);font-size:var(--tx-chart-axis-label-font-size);font-weight:var(--tx-chart-axis-label-font-weight);font-variant-numeric:tabular-nums}:host-context([data-styled]) .tx-chart-axes__title{fill:var(--tx-chart-axis-title-color);font-size:var(--tx-chart-axis-title-font-size);font-weight:var(--tx-chart-axis-title-font-weight)}\n"],
1651
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1652
+ });
1653
+ };
1654
+ i0.ɵɵngDeclareClassMetadata({
1655
+ minVersion: "12.0.0",
1656
+ version: "22.2.3",
1657
+ ngImport: i0,
1658
+ type: TxChartAxes,
1659
+ decorators: [{
1660
+ type: Component,
1661
+ args: [{
1662
+ selector: "g[tx-chart-axes]",
1663
+ template: `
1664
+ <svg:g class="tx-chart-axes__grid" [class]="gridPart()?.class" [style]="gridPart()?.style">
1665
+ @for (line of model().grid; track $index) {
1666
+ <svg:line class="tx-chart-axes__grid-line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1667
+ }
1668
+ </svg:g>
1669
+ @if (model().zero; as zero) {
1670
+ <svg:line class="tx-chart-axes__zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1671
+ }
1672
+ @for (axis of model().axes; track axis.position) {
1673
+ <svg:g class="tx-chart-axes__axis" [attr.data-position]="axis.position" [class]="axisPart()?.class" [style]="axisPart()?.style">
1674
+ @if (axis.line; as line) {
1675
+ <svg:line class="tx-chart-axes__line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1676
+ }
1677
+ @for (label of axis.labels; track $index) {
1678
+ <svg:text
1679
+ class="tx-chart-axes__label"
1680
+ [attr.x]="label.x"
1681
+ [attr.y]="label.y"
1682
+ [attr.text-anchor]="label.anchor"
1683
+ [attr.dominant-baseline]="label.baseline"
1684
+ [attr.transform]="label.rotate ? 'rotate(' + label.rotate + ' ' + label.x + ' ' + label.y + ')' : null"
1685
+ >
1686
+ {{ label.text }}
1687
+ @if (label.title) {
1688
+ <svg:title>{{ label.title }}</svg:title>
1689
+ }
1690
+ </svg:text>
1691
+ }
1692
+ @if (axis.title; as title) {
1693
+ <svg:text
1694
+ class="tx-chart-axes__title"
1695
+ text-anchor="middle"
1696
+ [attr.x]="title.x"
1697
+ [attr.y]="title.y"
1698
+ [attr.transform]="title.rotate ? 'rotate(' + title.rotate + ' ' + title.x + ' ' + title.y + ')' : null"
1699
+ >
1700
+ {{ title.text }}
1701
+ </svg:text>
1702
+ }
1703
+ </svg:g>
1704
+ }
1705
+ `,
1706
+ changeDetection: ChangeDetectionStrategy.OnPush,
1707
+ host: {
1708
+ class: "tx-chart-axes",
1709
+ "aria-hidden": "true"
1710
+ },
1711
+ styles: [".tx-chart-axes__grid-line,.tx-chart-axes__zero,.tx-chart-axes__line{fill:none;shape-rendering:crispEdges}.tx-chart-axes__label,.tx-chart-axes__title{-webkit-user-select:none;user-select:none}:host-context([data-styled]) .tx-chart-axes__grid-line{stroke:var(--tx-chart-grid-color);stroke-width:var(--tx-chart-grid-width);stroke-dasharray:var(--tx-chart-grid-dash)}:host-context([data-styled]) .tx-chart-axes__zero{stroke:var(--tx-chart-zero-line-color);stroke-width:var(--tx-chart-zero-line-width)}:host-context([data-styled]) .tx-chart-axes__line{stroke:var(--tx-chart-axis-line-color)}:host-context([data-styled]) .tx-chart-axes__label{fill:var(--tx-chart-axis-label-color);font-size:var(--tx-chart-axis-label-font-size);font-weight:var(--tx-chart-axis-label-font-weight);font-variant-numeric:tabular-nums}:host-context([data-styled]) .tx-chart-axes__title{fill:var(--tx-chart-axis-title-color);font-size:var(--tx-chart-axis-title-font-size);font-weight:var(--tx-chart-axis-title-font-weight)}\n"]
1712
+ }]
1713
+ }],
1714
+ propDecorators: {
1715
+ model: [{
1716
+ type: i0.Input,
1717
+ args: [{
1718
+ isSignal: true,
1719
+ alias: "tx-chart-axes",
1720
+ required: true
1721
+ }]
1722
+ }],
1723
+ gridPart: [{
1724
+ type: i0.Input,
1725
+ args: [{
1726
+ isSignal: true,
1727
+ alias: "gridPart",
1728
+ required: false
1729
+ }]
1730
+ }],
1731
+ axisPart: [{
1732
+ type: i0.Input,
1733
+ args: [{
1734
+ isSignal: true,
1735
+ alias: "axisPart",
1736
+ required: false
1737
+ }]
1738
+ }]
1739
+ }
1740
+ });
1741
+ function chartBandRect(band, index, plot, horizontal = false, inset = 2) {
1742
+ const gap = Math.min(inset, band.step * .08);
1743
+ const start = band.start(index) - (band.step - band.bandwidth) / 2 + gap;
1744
+ const size = Math.max(1, band.step - gap * 2);
1745
+ return horizontal ? {
1746
+ x: plot.left,
1747
+ y: start,
1748
+ width: plot.width,
1749
+ height: size
1750
+ } : {
1751
+ x: start,
1752
+ y: plot.top,
1753
+ width: size,
1754
+ height: plot.height
1755
+ };
1756
+ }
1757
+ var TxChartHoverBand = class TxChartHoverBand {
1758
+ rect = input(null, {
1759
+ ...ngDevMode ? { debugName: "rect" } : /* istanbul ignore next */ {},
1760
+ alias: "tx-chart-hover-band"
1761
+ });
1762
+ part = input(void 0, ...ngDevMode ? [{ debugName: "part" }] : /* istanbul ignore next */ []);
1763
+ state = linkedSignal({
1764
+ ...ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {},
1765
+ source: this.rect,
1766
+ computation: (next, previous) => ({
1767
+ rect: next ?? previous?.value.rect ?? null,
1768
+ slide: !!next && !!previous?.source
1769
+ })
1770
+ });
1771
+ static ɵfac = i0.ɵɵngDeclareFactory({
1772
+ minVersion: "12.0.0",
1773
+ version: "22.2.3",
1774
+ ngImport: i0,
1775
+ type: TxChartHoverBand,
1776
+ deps: [],
1777
+ target: i0.ɵɵFactoryTarget.Component
1778
+ });
1779
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1780
+ minVersion: "17.0.0",
1781
+ version: "22.2.3",
1782
+ type: TxChartHoverBand,
1783
+ isStandalone: true,
1784
+ selector: "g[tx-chart-hover-band]",
1785
+ inputs: {
1786
+ rect: {
1787
+ classPropertyName: "rect",
1788
+ publicName: "tx-chart-hover-band",
1789
+ isSignal: true,
1790
+ isRequired: false,
1791
+ transformFunction: null
1792
+ },
1793
+ part: {
1794
+ classPropertyName: "part",
1795
+ publicName: "part",
1796
+ isSignal: true,
1797
+ isRequired: false,
1798
+ transformFunction: null
1799
+ }
1800
+ },
1801
+ host: {
1802
+ attributes: { "aria-hidden": "true" },
1803
+ classAttribute: "tx-chart-hover-band-layer"
1804
+ },
1805
+ ngImport: i0,
1806
+ template: `
1807
+ @if (state().rect; as box) {
1808
+ <svg:rect
1809
+ class="tx-chart-hover-band"
1810
+ [class.tx-chart-hover-band--on]="!!rect()"
1811
+ [class.tx-chart-hover-band--slide]="state().slide"
1812
+ [class]="part()?.class"
1813
+ [style]="part()?.style"
1814
+ [attr.x]="box.x"
1815
+ [attr.y]="box.y"
1816
+ [attr.width]="box.width"
1817
+ [attr.height]="box.height"
1818
+ />
1819
+ }
1820
+ `,
1821
+ isInline: true,
1822
+ styles: [".tx-chart-hover-band{fill:currentColor;opacity:0;pointer-events:none}.tx-chart-hover-band--on{opacity:.08}:host-context([data-styled]) .tx-chart-hover-band{fill:var(--tx-chart-hover-band-color);rx:var(--tx-chart-hover-band-radius);transition:opacity var(--tx-chart-motion-hover-duration) ease}:host-context([data-styled]) .tx-chart-hover-band--on{opacity:1}:host-context([data-styled]) .tx-chart-hover-band--slide{transition:opacity var(--tx-chart-motion-hover-duration) ease,x var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),y var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),width var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),height var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing)}@media(prefers-reduced-motion:reduce){:host-context([data-styled]) .tx-chart-hover-band{transition:none}}\n"],
1823
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1824
+ });
1825
+ };
1826
+ i0.ɵɵngDeclareClassMetadata({
1827
+ minVersion: "12.0.0",
1828
+ version: "22.2.3",
1829
+ ngImport: i0,
1830
+ type: TxChartHoverBand,
1831
+ decorators: [{
1832
+ type: Component,
1833
+ args: [{
1834
+ selector: "g[tx-chart-hover-band]",
1835
+ template: `
1836
+ @if (state().rect; as box) {
1837
+ <svg:rect
1838
+ class="tx-chart-hover-band"
1839
+ [class.tx-chart-hover-band--on]="!!rect()"
1840
+ [class.tx-chart-hover-band--slide]="state().slide"
1841
+ [class]="part()?.class"
1842
+ [style]="part()?.style"
1843
+ [attr.x]="box.x"
1844
+ [attr.y]="box.y"
1845
+ [attr.width]="box.width"
1846
+ [attr.height]="box.height"
1847
+ />
1848
+ }
1849
+ `,
1850
+ changeDetection: ChangeDetectionStrategy.OnPush,
1851
+ host: {
1852
+ class: "tx-chart-hover-band-layer",
1853
+ "aria-hidden": "true"
1854
+ },
1855
+ styles: [".tx-chart-hover-band{fill:currentColor;opacity:0;pointer-events:none}.tx-chart-hover-band--on{opacity:.08}:host-context([data-styled]) .tx-chart-hover-band{fill:var(--tx-chart-hover-band-color);rx:var(--tx-chart-hover-band-radius);transition:opacity var(--tx-chart-motion-hover-duration) ease}:host-context([data-styled]) .tx-chart-hover-band--on{opacity:1}:host-context([data-styled]) .tx-chart-hover-band--slide{transition:opacity var(--tx-chart-motion-hover-duration) ease,x var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),y var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),width var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),height var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing)}@media(prefers-reduced-motion:reduce){:host-context([data-styled]) .tx-chart-hover-band{transition:none}}\n"]
1856
+ }]
1857
+ }],
1858
+ propDecorators: {
1859
+ rect: [{
1860
+ type: i0.Input,
1861
+ args: [{
1862
+ isSignal: true,
1863
+ alias: "tx-chart-hover-band",
1864
+ required: false
1865
+ }]
1866
+ }],
1867
+ part: [{
1868
+ type: i0.Input,
1869
+ args: [{
1870
+ isSignal: true,
1871
+ alias: "part",
1872
+ required: false
1873
+ }]
1874
+ }]
1875
+ }
1876
+ });
1877
+ const LABEL_FONT = 11;
1878
+ const LABEL_HEIGHT = 18;
1879
+ const LABEL_GAP = 4;
1880
+ function chartCategoryIndex(value, labels) {
1881
+ if (typeof value === "number") return Number.isInteger(value) && value >= 0 && value < labels.length ? value : -1;
1882
+ return labels.indexOf(value instanceof Date ? value.toISOString() : String(value));
1883
+ }
1884
+ function colorOf(item) {
1885
+ return item.color ?? `var(--tx-chart-annotation-${item.tone ?? "neutral"}-color)`;
1886
+ }
1887
+ function clamp(value, min, max) {
1888
+ return Math.max(min, Math.min(max, value));
1889
+ }
1890
+ function chartAnnotationShapes(list, mapping) {
1891
+ const { plot } = mapping;
1892
+ const left = plot.left;
1893
+ const right = plot.left + plot.width;
1894
+ const top = plot.top;
1895
+ const bottom = plot.top + plot.height;
1896
+ const pill = (text, x, y, anchor) => {
1897
+ if (!text) return null;
1898
+ const width = textWidth(text, LABEL_FONT) + 12;
1899
+ return {
1900
+ text,
1901
+ x: clamp(anchor === "start" ? x : anchor === "end" ? x - width : x - width / 2, left, Math.max(left, right - width)),
1902
+ y: clamp(y, top, Math.max(top, bottom - LABEL_HEIGHT)),
1903
+ width,
1904
+ height: LABEL_HEIGHT,
1905
+ anchor
1906
+ };
1907
+ };
1908
+ const along = (value) => mapping.x(value);
1909
+ const across = (value, axis = "primary") => mapping.y(value, axis);
1910
+ const shapes = [];
1911
+ (list ?? []).forEach((item, index) => {
1912
+ const color = colorOf(item);
1913
+ const key = `${index}:${item.type}`;
1914
+ if (item.type === "x-line" || item.type === "y-line") {
1915
+ const value = item.type === "x-line" ? along(item.x) : across(item.y, item.axis);
1916
+ if (value === null) return;
1917
+ if (item.type === "x-line" !== !!mapping.horizontal) {
1918
+ if (value < left - .5 || value > right + .5) return;
1919
+ shapes.push({
1920
+ key,
1921
+ kind: "line",
1922
+ color,
1923
+ x1: value,
1924
+ y1: top,
1925
+ x2: value,
1926
+ y2: bottom,
1927
+ label: pill(item.label, value + LABEL_GAP, top + LABEL_GAP, "start")
1928
+ });
1929
+ } else {
1930
+ if (value < top - .5 || value > bottom + .5) return;
1931
+ shapes.push({
1932
+ key,
1933
+ kind: "line",
1934
+ color,
1935
+ x1: left,
1936
+ y1: value,
1937
+ x2: right,
1938
+ y2: value,
1939
+ label: pill(item.label, right - LABEL_GAP, value - LABEL_HEIGHT - LABEL_GAP, "end")
1940
+ });
1941
+ }
1942
+ return;
1943
+ }
1944
+ if (item.type === "x-band" || item.type === "y-band") {
1945
+ let a;
1946
+ let b;
1947
+ if (item.type === "x-band") {
1948
+ const from = mapping.xSpan ? mapping.xSpan(item.from) : null;
1949
+ const to = mapping.xSpan ? mapping.xSpan(item.to) : null;
1950
+ a = from ? Math.min(from[0], from[1]) : along(item.from);
1951
+ b = to ? Math.max(to[0], to[1]) : along(item.to);
1952
+ } else {
1953
+ a = across(item.from, item.axis);
1954
+ b = across(item.to, item.axis);
1955
+ }
1956
+ if (a === null || b === null) return;
1957
+ if (item.type === "x-band" !== !!mapping.horizontal) {
1958
+ const x1 = clamp(Math.min(a, b), left, right);
1959
+ const x2 = clamp(Math.max(a, b), left, right);
1960
+ if (x2 - x1 < .5) return;
1961
+ shapes.push({
1962
+ key,
1963
+ kind: "band",
1964
+ color,
1965
+ x1,
1966
+ y1: top,
1967
+ x2,
1968
+ y2: bottom,
1969
+ label: pill(item.label, x1 + LABEL_GAP, top + LABEL_GAP, "start")
1970
+ });
1971
+ } else {
1972
+ const y1 = clamp(Math.min(a, b), top, bottom);
1973
+ const y2 = clamp(Math.max(a, b), top, bottom);
1974
+ if (y2 - y1 < .5) return;
1975
+ shapes.push({
1976
+ key,
1977
+ kind: "band",
1978
+ color,
1979
+ x1: left,
1980
+ y1,
1981
+ x2: right,
1982
+ y2,
1983
+ label: pill(item.label, left + LABEL_GAP, y1 + LABEL_GAP, "start")
1984
+ });
1985
+ }
1986
+ return;
1987
+ }
1988
+ const x = along(item.x);
1989
+ const y = across(item.y, item.axis);
1990
+ if (x === null || y === null) return;
1991
+ const [px, py] = mapping.horizontal ? [y, x] : [x, y];
1992
+ if (px < left - .5 || px > right + .5 || py < top - .5 || py > bottom + .5) return;
1993
+ shapes.push({
1994
+ key,
1995
+ kind: "point",
1996
+ color,
1997
+ x1: px,
1998
+ y1: py,
1999
+ x2: px,
2000
+ y2: py,
2001
+ label: pill(item.label, px, py - LABEL_HEIGHT - 8, "middle")
2002
+ });
2003
+ });
2004
+ return shapes;
2005
+ }
2006
+ var TxChartAnnotations = class TxChartAnnotations {
2007
+ shapes = input.required({
2008
+ ...ngDevMode ? { debugName: "shapes" } : /* istanbul ignore next */ {},
2009
+ alias: "tx-chart-annotations"
2010
+ });
2011
+ part = input(void 0, ...ngDevMode ? [{ debugName: "part" }] : /* istanbul ignore next */ []);
2012
+ layer = input("all", ...ngDevMode ? [{ debugName: "layer" }] : /* istanbul ignore next */ []);
2013
+ shown = computed(() => {
2014
+ const layer = this.layer();
2015
+ return layer === "back" ? this.shapes().filter((shape) => shape.kind === "band") : layer === "front" ? this.shapes().filter((shape) => shape.kind !== "band" || shape.label) : this.shapes();
2016
+ }, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
2017
+ static ɵfac = i0.ɵɵngDeclareFactory({
2018
+ minVersion: "12.0.0",
2019
+ version: "22.2.3",
2020
+ ngImport: i0,
2021
+ type: TxChartAnnotations,
2022
+ deps: [],
2023
+ target: i0.ɵɵFactoryTarget.Component
2024
+ });
2025
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2026
+ minVersion: "17.0.0",
2027
+ version: "22.2.3",
2028
+ type: TxChartAnnotations,
2029
+ isStandalone: true,
2030
+ selector: "g[tx-chart-annotations]",
2031
+ inputs: {
2032
+ shapes: {
2033
+ classPropertyName: "shapes",
2034
+ publicName: "tx-chart-annotations",
2035
+ isSignal: true,
2036
+ isRequired: true,
2037
+ transformFunction: null
2038
+ },
2039
+ part: {
2040
+ classPropertyName: "part",
2041
+ publicName: "part",
2042
+ isSignal: true,
2043
+ isRequired: false,
2044
+ transformFunction: null
2045
+ },
2046
+ layer: {
2047
+ classPropertyName: "layer",
2048
+ publicName: "layer",
2049
+ isSignal: true,
2050
+ isRequired: false,
2051
+ transformFunction: null
2052
+ }
2053
+ },
2054
+ host: {
2055
+ attributes: { "aria-hidden": "true" },
2056
+ classAttribute: "tx-chart-annotations"
2057
+ },
2058
+ ngImport: i0,
2059
+ template: `
2060
+ @for (shape of shown(); track shape.key) {
2061
+ <svg:g class="tx-chart-annotation" [class]="part()?.class" [style]="part()?.style" [attr.data-kind]="shape.kind" [style.--tx-chart-annotation-color]="shape.color">
2062
+ @if (shape.kind === 'band') {
2063
+ @if (layer() !== 'front') {
2064
+ <svg:rect class="tx-chart-annotation__band" [attr.x]="shape.x1" [attr.y]="shape.y1" [attr.width]="shape.x2 - shape.x1" [attr.height]="shape.y2 - shape.y1" />
2065
+ }
2066
+ } @else if (layer() !== 'back') {
2067
+ @if (shape.kind === 'line') {
2068
+ <svg:line class="tx-chart-annotation__line" [attr.x1]="shape.x1" [attr.y1]="shape.y1" [attr.x2]="shape.x2" [attr.y2]="shape.y2" />
2069
+ } @else {
2070
+ <svg:circle class="tx-chart-annotation__point" [attr.cx]="shape.x1" [attr.cy]="shape.y1" />
2071
+ }
2072
+ }
2073
+ @if (layer() !== 'back' && shape.label; as label) {
2074
+ <svg:rect class="tx-chart-annotation__pill" [attr.x]="label.x" [attr.y]="label.y" [attr.width]="label.width" [attr.height]="label.height" />
2075
+ <svg:text class="tx-chart-annotation__label" [attr.x]="label.x + label.width / 2" [attr.y]="label.y + label.height / 2" text-anchor="middle" dominant-baseline="central">
2076
+ {{ label.text }}
2077
+ </svg:text>
2078
+ }
2079
+ </svg:g>
2080
+ }
2081
+ `,
2082
+ isInline: true,
2083
+ styles: [".tx-chart-annotation{pointer-events:none}.tx-chart-annotation__band{fill:var(--tx-chart-annotation-color);fill-opacity:.1}.tx-chart-annotation__line{stroke:var(--tx-chart-annotation-color);stroke-dasharray:4 4;shape-rendering:crispEdges}.tx-chart-annotation__point{r:5px;fill:var(--tx-chart-annotation-color)}.tx-chart-annotation__pill{fill:var(--tx-chart-annotation-color);fill-opacity:.15}.tx-chart-annotation__label{font-size:11px}:host-context([data-styled]) .tx-chart-annotation__band{fill:color-mix(in srgb,var(--tx-chart-annotation-color) var(--tx-chart-annotation-band-strength),transparent);fill-opacity:1}:host-context([data-styled]) .tx-chart-annotation__line{stroke-width:var(--tx-chart-annotation-line-width);stroke-dasharray:var(--tx-chart-annotation-line-dash)}:host-context([data-styled]) .tx-chart-annotation__point{r:var(--tx-chart-annotation-point-radius);stroke:var(--tx-chart-marker-stroke-color);stroke-width:var(--tx-chart-marker-stroke-width)}:host-context([data-styled]) .tx-chart-annotation__pill{rx:var(--tx-chart-annotation-label-radius);fill:color-mix(in srgb,var(--tx-chart-annotation-color) var(--tx-chart-annotation-label-strength),var(--tx-chart-annotation-label-base));fill-opacity:1;stroke:var(--tx-chart-annotation-color);stroke-width:var(--tx-chart-annotation-label-border-width)}:host-context([data-styled]) .tx-chart-annotation__label{fill:var(--tx-chart-annotation-label-color);font-size:var(--tx-chart-annotation-label-font-size);font-weight:var(--tx-chart-annotation-label-font-weight)}\n"],
2084
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2085
+ });
2086
+ };
2087
+ i0.ɵɵngDeclareClassMetadata({
2088
+ minVersion: "12.0.0",
2089
+ version: "22.2.3",
2090
+ ngImport: i0,
2091
+ type: TxChartAnnotations,
2092
+ decorators: [{
2093
+ type: Component,
2094
+ args: [{
2095
+ selector: "g[tx-chart-annotations]",
2096
+ template: `
2097
+ @for (shape of shown(); track shape.key) {
2098
+ <svg:g class="tx-chart-annotation" [class]="part()?.class" [style]="part()?.style" [attr.data-kind]="shape.kind" [style.--tx-chart-annotation-color]="shape.color">
2099
+ @if (shape.kind === 'band') {
2100
+ @if (layer() !== 'front') {
2101
+ <svg:rect class="tx-chart-annotation__band" [attr.x]="shape.x1" [attr.y]="shape.y1" [attr.width]="shape.x2 - shape.x1" [attr.height]="shape.y2 - shape.y1" />
2102
+ }
2103
+ } @else if (layer() !== 'back') {
2104
+ @if (shape.kind === 'line') {
2105
+ <svg:line class="tx-chart-annotation__line" [attr.x1]="shape.x1" [attr.y1]="shape.y1" [attr.x2]="shape.x2" [attr.y2]="shape.y2" />
2106
+ } @else {
2107
+ <svg:circle class="tx-chart-annotation__point" [attr.cx]="shape.x1" [attr.cy]="shape.y1" />
2108
+ }
2109
+ }
2110
+ @if (layer() !== 'back' && shape.label; as label) {
2111
+ <svg:rect class="tx-chart-annotation__pill" [attr.x]="label.x" [attr.y]="label.y" [attr.width]="label.width" [attr.height]="label.height" />
2112
+ <svg:text class="tx-chart-annotation__label" [attr.x]="label.x + label.width / 2" [attr.y]="label.y + label.height / 2" text-anchor="middle" dominant-baseline="central">
2113
+ {{ label.text }}
2114
+ </svg:text>
2115
+ }
2116
+ </svg:g>
2117
+ }
2118
+ `,
2119
+ changeDetection: ChangeDetectionStrategy.OnPush,
2120
+ host: {
2121
+ class: "tx-chart-annotations",
2122
+ "aria-hidden": "true"
2123
+ },
2124
+ styles: [".tx-chart-annotation{pointer-events:none}.tx-chart-annotation__band{fill:var(--tx-chart-annotation-color);fill-opacity:.1}.tx-chart-annotation__line{stroke:var(--tx-chart-annotation-color);stroke-dasharray:4 4;shape-rendering:crispEdges}.tx-chart-annotation__point{r:5px;fill:var(--tx-chart-annotation-color)}.tx-chart-annotation__pill{fill:var(--tx-chart-annotation-color);fill-opacity:.15}.tx-chart-annotation__label{font-size:11px}:host-context([data-styled]) .tx-chart-annotation__band{fill:color-mix(in srgb,var(--tx-chart-annotation-color) var(--tx-chart-annotation-band-strength),transparent);fill-opacity:1}:host-context([data-styled]) .tx-chart-annotation__line{stroke-width:var(--tx-chart-annotation-line-width);stroke-dasharray:var(--tx-chart-annotation-line-dash)}:host-context([data-styled]) .tx-chart-annotation__point{r:var(--tx-chart-annotation-point-radius);stroke:var(--tx-chart-marker-stroke-color);stroke-width:var(--tx-chart-marker-stroke-width)}:host-context([data-styled]) .tx-chart-annotation__pill{rx:var(--tx-chart-annotation-label-radius);fill:color-mix(in srgb,var(--tx-chart-annotation-color) var(--tx-chart-annotation-label-strength),var(--tx-chart-annotation-label-base));fill-opacity:1;stroke:var(--tx-chart-annotation-color);stroke-width:var(--tx-chart-annotation-label-border-width)}:host-context([data-styled]) .tx-chart-annotation__label{fill:var(--tx-chart-annotation-label-color);font-size:var(--tx-chart-annotation-label-font-size);font-weight:var(--tx-chart-annotation-label-font-weight)}\n"]
2125
+ }]
2126
+ }],
2127
+ propDecorators: {
2128
+ shapes: [{
2129
+ type: i0.Input,
2130
+ args: [{
2131
+ isSignal: true,
2132
+ alias: "tx-chart-annotations",
2133
+ required: true
2134
+ }]
2135
+ }],
2136
+ part: [{
2137
+ type: i0.Input,
2138
+ args: [{
2139
+ isSignal: true,
2140
+ alias: "part",
2141
+ required: false
2142
+ }]
2143
+ }],
2144
+ layer: [{
2145
+ type: i0.Input,
2146
+ args: [{
2147
+ isSignal: true,
2148
+ alias: "layer",
2149
+ required: false
2150
+ }]
2151
+ }]
2152
+ }
2153
+ });
2154
+ const SVG_NS = "http://www.w3.org/2000/svg";
2155
+ const BOM = String.fromCharCode(65279);
2156
+ const LEGEND_ROW = 28;
2157
+ const LEGEND_FONT = 12;
2158
+ const SKIPPED_VALUES = /* @__PURE__ */ new Set([
2159
+ "none",
2160
+ "normal",
2161
+ "auto"
2162
+ ]);
2163
+ const STYLE_PROPERTIES = [
2164
+ "fill",
2165
+ "fill-opacity",
2166
+ "stroke",
2167
+ "stroke-width",
2168
+ "stroke-opacity",
2169
+ "stroke-dasharray",
2170
+ "stroke-linecap",
2171
+ "stroke-linejoin",
2172
+ "stop-color",
2173
+ "stop-opacity",
2174
+ "opacity",
2175
+ "visibility",
2176
+ "display",
2177
+ "transform",
2178
+ "transform-origin",
2179
+ "transform-box",
2180
+ "filter",
2181
+ "font-family",
2182
+ "font-size",
2183
+ "font-weight",
2184
+ "letter-spacing",
2185
+ "text-anchor",
2186
+ "dominant-baseline",
2187
+ "r",
2188
+ "rx",
2189
+ "ry"
2190
+ ];
2191
+ function escapeCsv(value) {
2192
+ return /[",\n\r]/.test(value) ? `"${value.replace(/"/g, "\"\"")}"` : value;
2193
+ }
2194
+ function chartCsv(table, categoryLabel = "") {
2195
+ const rows = [[categoryLabel, ...table.columns.map((column) => column.label)], ...table.rows.map((row) => [row.label, ...row.cells])];
2196
+ return `${BOM}${rows.map((row) => row.map((cell) => escapeCsv(cell ?? "")).join(",")).join("\r\n")}`;
2197
+ }
2198
+ function chartFileName(name, format) {
2199
+ return `${name.normalize("NFKD").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "chart"}.${format}`;
2200
+ }
2201
+ function inlineStyles(source, target, view) {
2202
+ const sources = [source, ...source.querySelectorAll("*")];
2203
+ const targets = [target, ...target.querySelectorAll("*")];
2204
+ sources.forEach((element, index) => {
2205
+ const clone = targets[index];
2206
+ if (!clone) return;
2207
+ if (element.localName === "foreignObject") {
2208
+ clone.remove();
2209
+ return;
2210
+ }
2211
+ const computed = view.getComputedStyle(element);
2212
+ const declarations = STYLE_PROPERTIES.flatMap((property) => {
2213
+ const value = computed.getPropertyValue(property).trim();
2214
+ return property === "fill" || property === "stroke" || !!value && !SKIPPED_VALUES.has(value) ? [`${property}:${value || "none"}`] : [];
2215
+ });
2216
+ clone.removeAttribute("class");
2217
+ clone.setAttribute("style", declarations.join(";"));
2218
+ });
2219
+ }
2220
+ function chartSvgString(svg, options = {}) {
2221
+ const document = svg.ownerDocument;
2222
+ const view = document.defaultView;
2223
+ const [, , width, height] = (svg.getAttribute("viewBox") ?? "0 0 0 0").split(/\s+/).map(Number);
2224
+ const legend = (options.legend ?? []).filter((item) => !item.hidden);
2225
+ const top = legend.length ? LEGEND_ROW : 0;
2226
+ const clone = svg.cloneNode(true);
2227
+ if (view) inlineStyles(svg, clone, view);
2228
+ const root = document.createElementNS(SVG_NS, "svg");
2229
+ root.setAttribute("xmlns", SVG_NS);
2230
+ root.setAttribute("width", String(width));
2231
+ root.setAttribute("height", String(height + top));
2232
+ root.setAttribute("viewBox", `0 0 ${width} ${height + top}`);
2233
+ root.setAttribute("font-family", options.fontFamily ?? "sans-serif");
2234
+ if (options.background) {
2235
+ const background = document.createElementNS(SVG_NS, "rect");
2236
+ background.setAttribute("width", "100%");
2237
+ background.setAttribute("height", "100%");
2238
+ background.setAttribute("fill", options.background);
2239
+ root.appendChild(background);
2240
+ }
2241
+ let x = 0;
2242
+ for (const item of legend) {
2243
+ const marker = document.createElementNS(SVG_NS, "circle");
2244
+ marker.setAttribute("cx", String(x + 5));
2245
+ marker.setAttribute("cy", String(LEGEND_ROW / 2));
2246
+ marker.setAttribute("r", "4");
2247
+ marker.setAttribute("fill", item.color);
2248
+ const label = document.createElementNS(SVG_NS, "text");
2249
+ label.setAttribute("x", String(x + 14));
2250
+ label.setAttribute("y", String(LEGEND_ROW / 2));
2251
+ label.setAttribute("dominant-baseline", "central");
2252
+ label.setAttribute("font-size", String(LEGEND_FONT));
2253
+ label.setAttribute("fill", options.textColor ?? "currentColor");
2254
+ label.textContent = item.label;
2255
+ root.appendChild(marker);
2256
+ root.appendChild(label);
2257
+ x += 14 + textWidth(item.label, LEGEND_FONT) + 16;
2258
+ }
2259
+ const chart = document.createElementNS(SVG_NS, "g");
2260
+ chart.setAttribute("transform", `translate(0 ${top})`);
2261
+ while (clone.firstChild) chart.appendChild(clone.firstChild);
2262
+ root.appendChild(chart);
2263
+ const Serializer = view?.XMLSerializer;
2264
+ return Serializer ? new Serializer().serializeToString(root) : root.outerHTML;
2265
+ }
2266
+ function chartSvgSize(markup) {
2267
+ const match = /viewBox="0 0 ([\d.]+) ([\d.]+)"/.exec(markup);
2268
+ return {
2269
+ width: Number(match?.[1] ?? 0),
2270
+ height: Number(match?.[2] ?? 0)
2271
+ };
2272
+ }
2273
+ function chartPngBlob(document, markup, scale = 2) {
2274
+ const view = document.defaultView;
2275
+ const { width, height } = chartSvgSize(markup);
2276
+ return new Promise((resolve, reject) => {
2277
+ if (!view) {
2278
+ reject(/* @__PURE__ */ new Error("no window"));
2279
+ return;
2280
+ }
2281
+ const image = new view.Image();
2282
+ image.onload = () => {
2283
+ const canvas = document.createElement("canvas");
2284
+ canvas.width = Math.max(1, Math.round(width * scale));
2285
+ canvas.height = Math.max(1, Math.round(height * scale));
2286
+ const context = canvas.getContext("2d");
2287
+ if (!context) {
2288
+ reject(/* @__PURE__ */ new Error("no canvas"));
2289
+ return;
2290
+ }
2291
+ context.scale(scale, scale);
2292
+ context.drawImage(image, 0, 0, width, height);
2293
+ canvas.toBlob((blob) => blob ? resolve(blob) : reject(/* @__PURE__ */ new Error("no blob")), "image/png");
2294
+ };
2295
+ image.onerror = () => reject(/* @__PURE__ */ new Error("image"));
2296
+ image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(markup)}`;
2297
+ });
2298
+ }
2299
+ function downloadChartFile(document, data, filename) {
2300
+ const view = document.defaultView;
2301
+ if (!view) return;
2302
+ const url = view.URL.createObjectURL(data);
2303
+ const link = document.createElement("a");
2304
+ link.href = url;
2305
+ link.download = filename;
2306
+ link.rel = "noopener";
2307
+ link.style.display = "none";
2308
+ document.body.appendChild(link);
2309
+ link.click();
2310
+ link.remove();
2311
+ view.setTimeout(() => view.URL.revokeObjectURL(url), 1e3);
2312
+ }
2313
+ const MENU_KEYS = /* @__PURE__ */ new Set([
2314
+ "ArrowDown",
2315
+ "ArrowUp",
2316
+ "Home",
2317
+ "End"
2318
+ ]);
2319
+ var TxChartMenu = class TxChartMenu {
2320
+ items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
2321
+ ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
2322
+ unstyled = input(void 0, {
2323
+ ...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
2324
+ transform: optionalBoolean
2325
+ });
2326
+ selected = output();
2327
+ isUnstyled = injectUnstyled(this.unstyled);
2328
+ list = viewChild("list", ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
2329
+ onKeydown(event) {
2330
+ if (!MENU_KEYS.has(event.key)) return;
2331
+ const items = Array.from(this.list()?.nativeElement.querySelectorAll("[role=\"menuitem\"]:not(:disabled)") ?? []);
2332
+ const next = nextListIndex(event.key, {
2333
+ count: items.length,
2334
+ current: items.indexOf(event.target)
2335
+ });
2336
+ if (next === null) return;
2337
+ event.preventDefault();
2338
+ items[next]?.focus();
2339
+ }
2340
+ static ɵfac = i0.ɵɵngDeclareFactory({
2341
+ minVersion: "12.0.0",
2342
+ version: "22.2.3",
2343
+ ngImport: i0,
2344
+ type: TxChartMenu,
2345
+ deps: [],
2346
+ target: i0.ɵɵFactoryTarget.Component
2347
+ });
2348
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2349
+ minVersion: "17.0.0",
2350
+ version: "22.2.3",
2351
+ type: TxChartMenu,
2352
+ isStandalone: true,
2353
+ selector: "tx-chart-menu",
2354
+ inputs: {
2355
+ items: {
2356
+ classPropertyName: "items",
2357
+ publicName: "items",
2358
+ isSignal: true,
2359
+ isRequired: false,
2360
+ transformFunction: null
2361
+ },
2362
+ ariaLabel: {
2363
+ classPropertyName: "ariaLabel",
2364
+ publicName: "ariaLabel",
2365
+ isSignal: true,
2366
+ isRequired: false,
2367
+ transformFunction: null
2368
+ },
2369
+ unstyled: {
2370
+ classPropertyName: "unstyled",
2371
+ publicName: "unstyled",
2372
+ isSignal: true,
2373
+ isRequired: false,
2374
+ transformFunction: null
2375
+ }
2376
+ },
2377
+ outputs: { selected: "selected" },
2378
+ host: { classAttribute: "tx-chart-menu" },
2379
+ viewQueries: [{
2380
+ propertyName: "list",
2381
+ first: true,
2382
+ predicate: ["list"],
2383
+ descendants: true,
2384
+ isSignal: true
2385
+ }],
2386
+ ngImport: i0,
2387
+ template: `
2388
+ <div #list class="tx-chart-menu__list" role="menu" tabindex="-1" [attr.aria-label]="ariaLabel() || null" [attr.data-styled]="!isUnstyled() || null" (keydown)="onKeydown($event)">
2389
+ @for (item of items(); track item.id) {
2390
+ <button type="button" role="menuitem" class="tx-chart-menu__item" [disabled]="item.disabled" (click)="selected.emit(item.id)">
2391
+ @if (item.icon) {
2392
+ <tx-icon class="tx-chart-menu__icon" aria-hidden="true" [name]="item.icon" />
2393
+ }
2394
+ <span class="tx-chart-menu__label">{{ item.label }}</span>
2395
+ </button>
2396
+ }
2397
+ </div>
2398
+ `,
2399
+ isInline: true,
2400
+ styles: [":host{display:block}.tx-chart-menu__list{display:flex;flex-direction:column;outline:none}.tx-chart-menu__item{display:flex;align-items:center;width:100%;margin:0;border:0;background:transparent;color:inherit;font:inherit;text-align:start;white-space:nowrap;cursor:pointer}.tx-chart-menu__item:disabled{cursor:default}.tx-chart-menu__icon{flex-shrink:0}.tx-chart-menu__list[data-styled]{gap:var(--tx-actions-menu-list-gap);min-width:var(--tx-actions-menu-list-min-width);padding:var(--tx-actions-menu-list-padding)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item{gap:var(--tx-actions-menu-item-gap);padding:var(--tx-actions-menu-item-padding-y) var(--tx-actions-menu-item-padding-x);border-radius:var(--tx-actions-menu-item-border-radius);color:var(--tx-actions-menu-item-color);font-family:var(--tx-font-family);font-size:var(--tx-actions-menu-item-font-size);font-weight:var(--tx-actions-menu-item-font-weight);line-height:var(--tx-actions-menu-item-line-height);transition:background-color var(--tx-actions-menu-item-transition-duration)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:hover:not(:disabled){background:var(--tx-actions-menu-item-hover-background)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:active:not(:disabled){background:var(--tx-actions-menu-item-active-background)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:focus-visible{outline:2px solid var(--tx-actions-menu-item-focus-ring-color);outline-offset:-2px}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:disabled{opacity:var(--tx-chart-toolbar-disabled-opacity)}@media(prefers-reduced-motion:reduce){.tx-chart-menu__list[data-styled] .tx-chart-menu__item{transition:none}}\n"],
2401
+ dependencies: [{
2402
+ kind: "component",
2403
+ type: TxIcon,
2404
+ selector: "tx-icon",
2405
+ inputs: ["name"]
2406
+ }],
2407
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2408
+ });
2409
+ };
2410
+ i0.ɵɵngDeclareClassMetadata({
2411
+ minVersion: "12.0.0",
2412
+ version: "22.2.3",
2413
+ ngImport: i0,
2414
+ type: TxChartMenu,
2415
+ decorators: [{
2416
+ type: Component,
2417
+ args: [{
2418
+ selector: "tx-chart-menu",
2419
+ imports: [TxIcon],
2420
+ template: `
2421
+ <div #list class="tx-chart-menu__list" role="menu" tabindex="-1" [attr.aria-label]="ariaLabel() || null" [attr.data-styled]="!isUnstyled() || null" (keydown)="onKeydown($event)">
2422
+ @for (item of items(); track item.id) {
2423
+ <button type="button" role="menuitem" class="tx-chart-menu__item" [disabled]="item.disabled" (click)="selected.emit(item.id)">
2424
+ @if (item.icon) {
2425
+ <tx-icon class="tx-chart-menu__icon" aria-hidden="true" [name]="item.icon" />
2426
+ }
2427
+ <span class="tx-chart-menu__label">{{ item.label }}</span>
2428
+ </button>
2429
+ }
2430
+ </div>
2431
+ `,
2432
+ changeDetection: ChangeDetectionStrategy.OnPush,
2433
+ host: { class: "tx-chart-menu" },
2434
+ styles: [":host{display:block}.tx-chart-menu__list{display:flex;flex-direction:column;outline:none}.tx-chart-menu__item{display:flex;align-items:center;width:100%;margin:0;border:0;background:transparent;color:inherit;font:inherit;text-align:start;white-space:nowrap;cursor:pointer}.tx-chart-menu__item:disabled{cursor:default}.tx-chart-menu__icon{flex-shrink:0}.tx-chart-menu__list[data-styled]{gap:var(--tx-actions-menu-list-gap);min-width:var(--tx-actions-menu-list-min-width);padding:var(--tx-actions-menu-list-padding)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item{gap:var(--tx-actions-menu-item-gap);padding:var(--tx-actions-menu-item-padding-y) var(--tx-actions-menu-item-padding-x);border-radius:var(--tx-actions-menu-item-border-radius);color:var(--tx-actions-menu-item-color);font-family:var(--tx-font-family);font-size:var(--tx-actions-menu-item-font-size);font-weight:var(--tx-actions-menu-item-font-weight);line-height:var(--tx-actions-menu-item-line-height);transition:background-color var(--tx-actions-menu-item-transition-duration)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:hover:not(:disabled){background:var(--tx-actions-menu-item-hover-background)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:active:not(:disabled){background:var(--tx-actions-menu-item-active-background)}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:focus-visible{outline:2px solid var(--tx-actions-menu-item-focus-ring-color);outline-offset:-2px}.tx-chart-menu__list[data-styled] .tx-chart-menu__item:disabled{opacity:var(--tx-chart-toolbar-disabled-opacity)}@media(prefers-reduced-motion:reduce){.tx-chart-menu__list[data-styled] .tx-chart-menu__item{transition:none}}\n"]
2435
+ }]
2436
+ }],
2437
+ propDecorators: {
2438
+ items: [{
2439
+ type: i0.Input,
2440
+ args: [{
2441
+ isSignal: true,
2442
+ alias: "items",
2443
+ required: false
2444
+ }]
2445
+ }],
2446
+ ariaLabel: [{
2447
+ type: i0.Input,
2448
+ args: [{
2449
+ isSignal: true,
2450
+ alias: "ariaLabel",
2451
+ required: false
2452
+ }]
2453
+ }],
2454
+ unstyled: [{
2455
+ type: i0.Input,
2456
+ args: [{
2457
+ isSignal: true,
2458
+ alias: "unstyled",
2459
+ required: false
2460
+ }]
2461
+ }],
2462
+ selected: [{
2463
+ type: i0.Output,
2464
+ args: ["selected"]
2465
+ }],
2466
+ list: [{
2467
+ type: i0.ViewChild,
2468
+ args: ["list", { isSignal: true }]
2469
+ }]
2470
+ }
2471
+ });
2472
+ const TOOLTIP_OFFSET = 10;
2473
+ const ARROW_ROOM = 16;
2474
+ const NAVIGATION_KEYS = [
2475
+ "ArrowLeft",
2476
+ "ArrowRight",
2477
+ "ArrowUp",
2478
+ "ArrowDown",
2479
+ "Home",
2480
+ "End",
2481
+ "Escape"
2482
+ ];
2483
+ const ACTION_KEYS = [
2484
+ "Enter",
2485
+ " ",
2486
+ "Backspace"
2487
+ ];
2488
+ const ZOOM_KEYS = [
2489
+ "+",
2490
+ "=",
2491
+ "-",
2492
+ "_",
2493
+ "0"
2494
+ ];
2495
+ const WHEEL_ZOOM = .0025;
2496
+ const FOLLOW_PLACEMENT = "right";
2497
+ const FOLLOW_OFFSET = 14;
2498
+ var TxChartFrame = class TxChartFrame {
2499
+ host = inject(ElementRef);
2500
+ overlay = inject(TxOverlay);
2501
+ viewContainerRef = inject(ViewContainerRef);
2502
+ injector = inject(Injector);
2503
+ announcer = inject(TxAnnouncer);
2504
+ translations = injectTranslations();
2505
+ height = input(350, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
2506
+ size = model({
2507
+ width: 640,
2508
+ height: 320
2509
+ }, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
2510
+ legendItems = input([], ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
2511
+ showLegend = input(true, {
2512
+ ...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
2513
+ transform: booleanAttribute
2514
+ });
2515
+ legendPosition = input("top", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
2516
+ legendAlign = input("start", ...ngDevMode ? [{ debugName: "legendAlign" }] : /* istanbul ignore next */ []);
2517
+ legendVariant = input("dot", ...ngDevMode ? [{ debugName: "legendVariant" }] : /* istanbul ignore next */ []);
2518
+ legendToggle = input(true, {
2519
+ ...ngDevMode ? { debugName: "legendToggle" } : /* istanbul ignore next */ {},
2520
+ transform: booleanAttribute
2521
+ });
2522
+ legendTemplate = input(null, ...ngDevMode ? [{ debugName: "legendTemplate" }] : /* istanbul ignore next */ []);
2523
+ empty = input(false, {
2524
+ ...ngDevMode ? { debugName: "empty" } : /* istanbul ignore next */ {},
2525
+ transform: booleanAttribute
2526
+ });
2527
+ loading = input(false, {
2528
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
2529
+ transform: booleanAttribute
2530
+ });
2531
+ emptyIcon = input("chart-line", ...ngDevMode ? [{ debugName: "emptyIcon" }] : /* istanbul ignore next */ []);
2532
+ summary = input("", ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
2533
+ table = input(null, ...ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []);
2534
+ tooltip = input(null, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
2535
+ tooltipTemplate = input(null, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
2536
+ tooltipPlacement = input("top", ...ngDevMode ? [{ debugName: "tooltipPlacement" }] : /* istanbul ignore next */ []);
2537
+ panelStyle = input({}, ...ngDevMode ? [{ debugName: "panelStyle" }] : /* istanbul ignore next */ []);
2538
+ parts = input({}, ...ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []);
2539
+ styled = input(true, {
2540
+ ...ngDevMode ? { debugName: "styled" } : /* istanbul ignore next */ {},
2541
+ transform: booleanAttribute
2542
+ });
2543
+ interactive = input(true, {
2544
+ ...ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {},
2545
+ transform: booleanAttribute
2546
+ });
2547
+ actionKeys = input(false, {
2548
+ ...ngDevMode ? { debugName: "actionKeys" } : /* istanbul ignore next */ {},
2549
+ transform: booleanAttribute
2550
+ });
2551
+ zoomable = input(false, {
2552
+ ...ngDevMode ? { debugName: "zoomable" } : /* istanbul ignore next */ {},
2553
+ transform: booleanAttribute
2554
+ });
2555
+ zoomedIn = input(false, {
2556
+ ...ngDevMode ? { debugName: "zoomedIn" } : /* istanbul ignore next */ {},
2557
+ transform: booleanAttribute
2558
+ });
2559
+ plotHeight = input(null, ...ngDevMode ? [{ debugName: "plotHeight" }] : /* istanbul ignore next */ []);
2560
+ toolbar = input(false, {
2561
+ ...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
2562
+ transform: booleanAttribute
2563
+ });
2564
+ exportName = input("", ...ngDevMode ? [{ debugName: "exportName" }] : /* istanbul ignore next */ []);
2565
+ pointer = output();
2566
+ navigate = output();
2567
+ legendToggled = output();
2568
+ legendHovered = output();
2569
+ tooltipClosed = output();
2570
+ zoomed = output();
2571
+ panned = output();
2572
+ zoomReset = output();
2573
+ plotRef = viewChild("plot", ...ngDevMode ? [{ debugName: "plotRef" }] : /* istanbul ignore next */ []);
2574
+ anchorRef = viewChild("anchor", ...ngDevMode ? [{ debugName: "anchorRef" }] : /* istanbul ignore next */ []);
2575
+ svgRef = viewChild("chartSvg", ...ngDevMode ? [{ debugName: "svgRef" }] : /* istanbul ignore next */ []);
2576
+ tooltipPanel = viewChild("tooltipPanel", ...ngDevMode ? [{ debugName: "tooltipPanel" }] : /* istanbul ignore next */ []);
2577
+ hintId = uniqueId("tx-chart-hint");
2578
+ shown = signal(null, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
2579
+ following = signal(false, ...ngDevMode ? [{ debugName: "following" }] : /* istanbul ignore next */ []);
2580
+ cursor = null;
2581
+ touches = /* @__PURE__ */ new Map();
2582
+ measured = signal(false, ...ngDevMode ? [{ debugName: "measured" }] : /* istanbul ignore next */ []);
2583
+ ref = null;
2584
+ openPlacement = null;
2585
+ activeRef = signal(null, ...ngDevMode ? [{ debugName: "activeRef" }] : /* istanbul ignore next */ []);
2586
+ side = computed(() => parsePlacement(this.activeRef()?.placement() ?? this.openPlacement ?? this.tooltipPlacement()).side, ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
2587
+ arrowOffset = computed(() => txArrowOffset(this.activeRef()?.placement() ?? "top", {
2588
+ width: 32,
2589
+ height: 32
2590
+ }), ...ngDevMode ? [{ debugName: "arrowOffset" }] : /* istanbul ignore next */ []);
2591
+ fills = computed(() => typeof this.height() === "string", ...ngDevMode ? [{ debugName: "fills" }] : /* istanbul ignore next */ []);
2592
+ cssHeight = computed(() => {
2593
+ const height = this.height();
2594
+ return typeof height === "number" ? `${height}px` : height;
2595
+ }, ...ngDevMode ? [{ debugName: "cssHeight" }] : /* istanbul ignore next */ []);
2596
+ legendVisible = computed(() => this.showLegend() && !this.empty() && !this.loading() && this.legendItems().length > 0, ...ngDevMode ? [{ debugName: "legendVisible" }] : /* istanbul ignore next */ []);
2597
+ viewBox = computed(() => `0 0 ${this.size().width} ${this.size().height}`, ...ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []);
2598
+ placeholderHeight = computed(() => chartBoxHeight(this.height(), this.legendVisible() ? this.legendPosition() : null, this.toolbar()), ...ngDevMode ? [{ debugName: "placeholderHeight" }] : /* istanbul ignore next */ []);
2599
+ toolbarRow = computed(() => !this.toolbar() ? null : this.legendVisible() && this.legendPosition() === "top" ? "legend" : "own", ...ngDevMode ? [{ debugName: "toolbarRow" }] : /* istanbul ignore next */ []);
2600
+ canExport = computed(() => !this.empty() && !this.loading(), ...ngDevMode ? [{ debugName: "canExport" }] : /* istanbul ignore next */ []);
2601
+ popoverTokens = { content: { padding: "0" } };
2602
+ exportItems = computed(() => {
2603
+ const t = this.translations();
2604
+ return [
2605
+ {
2606
+ id: "svg",
2607
+ label: t.chartDownloadSvg,
2608
+ icon: "image"
2609
+ },
2610
+ {
2611
+ id: "png",
2612
+ label: t.chartDownloadPng,
2613
+ icon: "image"
2614
+ },
2615
+ ...this.table() ? [{
2616
+ id: "csv",
2617
+ label: t.chartDownloadCsv,
2618
+ icon: "file"
2619
+ }] : []
2620
+ ];
2621
+ }, ...ngDevMode ? [{ debugName: "exportItems" }] : /* istanbul ignore next */ []);
2622
+ constructor() {
2623
+ afterNextRender(() => this.observe());
2624
+ effect(() => {
2625
+ const data = this.tooltip();
2626
+ untracked(() => this.syncTooltip(data));
2627
+ });
2628
+ inject(DestroyRef).onDestroy(() => this.ref?.close("api"));
2629
+ }
2630
+ announce(message) {
2631
+ this.announcer.announce(message);
2632
+ }
2633
+ onPointer(event, type) {
2634
+ const plot = this.plotRef()?.nativeElement;
2635
+ if (!plot || !this.interactive()) return;
2636
+ const box = plot.getBoundingClientRect();
2637
+ const x = event.clientX - box.left;
2638
+ const y = event.clientY - box.top;
2639
+ if (this.zoomable() && this.pinch(event, type, x, y)) return;
2640
+ this.cursor = type !== "leave" && followsPointer(event) ? {
2641
+ x,
2642
+ y
2643
+ } : null;
2644
+ this.pointer.emit({
2645
+ x,
2646
+ y,
2647
+ type,
2648
+ target: event.target,
2649
+ buttons: event.buttons,
2650
+ pointerType: "pointerType" in event ? event.pointerType : "mouse"
2651
+ });
2652
+ if (this.cursor && this.ref && this.following()) {
2653
+ this.placeAnchor(this.cursor.x, this.cursor.y - ARROW_ROOM, 0, 32);
2654
+ this.ref.updatePosition();
2655
+ }
2656
+ }
2657
+ onKeydown(event) {
2658
+ if (!this.interactive()) return;
2659
+ this.cursor = null;
2660
+ if (NAVIGATION_KEYS.includes(event.key) || this.actionKeys() && ACTION_KEYS.includes(event.key) || this.zoomable() && ZOOM_KEYS.includes(event.key)) {
2661
+ event.preventDefault();
2662
+ this.navigate.emit(event);
2663
+ }
2664
+ }
2665
+ onWheel(event) {
2666
+ const plot = this.plotRef()?.nativeElement;
2667
+ if (!plot || !this.zoomable() || !this.interactive()) return;
2668
+ const box = plot.getBoundingClientRect();
2669
+ if (event.ctrlKey || event.metaKey) {
2670
+ event.preventDefault();
2671
+ this.zoomed.emit({
2672
+ x: event.clientX - box.left,
2673
+ factor: Math.exp(event.deltaY * WHEEL_ZOOM)
2674
+ });
2675
+ } else if (this.zoomedIn() && Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
2676
+ event.preventDefault();
2677
+ this.panned.emit({ dx: -event.deltaX });
2678
+ }
2679
+ }
2680
+ onDoubleClick() {
2681
+ if (this.zoomable() && this.zoomedIn()) this.zoomReset.emit();
2682
+ }
2683
+ pinch(event, type, x, y) {
2684
+ if (!("pointerType" in event) || event.pointerType !== "touch") return false;
2685
+ const before = [...this.touches.values()];
2686
+ if (type === "up" || type === "leave") {
2687
+ this.touches.delete(event.pointerId);
2688
+ return before.length > 1;
2689
+ }
2690
+ if (type === "down" || this.touches.has(event.pointerId)) this.touches.set(event.pointerId, {
2691
+ x,
2692
+ y
2693
+ });
2694
+ const after = [...this.touches.values()];
2695
+ if (after.length < 2) return false;
2696
+ if (before.length >= 2 && type === "move") {
2697
+ const spread = (points) => Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y);
2698
+ const middle = (points) => (points[0].x + points[1].x) / 2;
2699
+ const factor = spread(before) / Math.max(1, spread(after));
2700
+ if (Math.abs(factor - 1) > .002) this.zoomed.emit({
2701
+ x: middle(after),
2702
+ factor
2703
+ });
2704
+ const dx = middle(after) - middle(before);
2705
+ if (dx) this.panned.emit({ dx });
2706
+ }
2707
+ this.pointer.emit({
2708
+ x: 0,
2709
+ y: 0,
2710
+ type: "leave",
2711
+ target: null
2712
+ });
2713
+ return true;
2714
+ }
2715
+ observe() {
2716
+ const plot = this.plotRef()?.nativeElement;
2717
+ if (!plot) return;
2718
+ const measure = () => {
2719
+ const width = Math.round(plot.clientWidth);
2720
+ const height = Math.round(plot.clientHeight);
2721
+ if (width > 0 && height > 0) {
2722
+ const current = this.size();
2723
+ if (current.width !== width || current.height !== height) this.size.set({
2724
+ width,
2725
+ height
2726
+ });
2727
+ this.measured.set(true);
2728
+ }
2729
+ };
2730
+ measure();
2731
+ const view = this.host.nativeElement.ownerDocument.defaultView;
2732
+ if (view && "ResizeObserver" in view) {
2733
+ const observer = new view.ResizeObserver(() => measure());
2734
+ observer.observe(plot);
2735
+ this.injector.get(DestroyRef).onDestroy(() => observer.disconnect());
2736
+ }
2737
+ }
2738
+ syncTooltip(data) {
2739
+ const anchor = this.anchorRef()?.nativeElement;
2740
+ const template = this.tooltipPanel();
2741
+ if (!data) {
2742
+ this.closeTooltip();
2743
+ return;
2744
+ }
2745
+ if (!anchor || !template) return;
2746
+ const cursor = this.cursor;
2747
+ const placement = cursor ? FOLLOW_PLACEMENT : data.placement ?? this.tooltipPlacement();
2748
+ if (cursor) this.placeAnchor(cursor.x, cursor.y - ARROW_ROOM, 0, 32);
2749
+ else {
2750
+ const vertical = parsePlacement(placement).side === "top" || parsePlacement(placement).side === "bottom";
2751
+ const width = vertical ? 32 : 0;
2752
+ const height = vertical ? 0 : 32;
2753
+ this.placeAnchor(data.x - width / 2, data.y - height / 2, width, height);
2754
+ }
2755
+ if (this.ref && (this.openPlacement !== placement || this.following() !== !!cursor)) this.closeTooltip();
2756
+ this.following.set(!!cursor);
2757
+ this.shown.set(data);
2758
+ if (this.ref) {
2759
+ this.ref.updatePosition();
2760
+ return;
2761
+ }
2762
+ const ref = this.overlay.open(template, {
2763
+ origin: anchor,
2764
+ viewContainerRef: this.viewContainerRef,
2765
+ placement,
2766
+ offset: cursor ? FOLLOW_OFFSET : TOOLTIP_OFFSET,
2767
+ layer: "tooltip",
2768
+ closeOnOutsideClick: false,
2769
+ restoreFocus: false,
2770
+ motion: "pop"
2771
+ });
2772
+ ref.element.style.pointerEvents = "none";
2773
+ ref.closed.subscribe((reason) => {
2774
+ if (this.ref === ref) {
2775
+ this.ref = null;
2776
+ this.activeRef.set(null);
2777
+ }
2778
+ if (reason !== "api") this.tooltipClosed.emit();
2779
+ });
2780
+ this.ref = ref;
2781
+ this.openPlacement = placement;
2782
+ this.activeRef.set(ref);
2783
+ }
2784
+ onExport(id) {
2785
+ if (id === "svg" || id === "png" || id === "csv") this.download(id);
2786
+ }
2787
+ download(format) {
2788
+ const document = this.host.nativeElement.ownerDocument;
2789
+ const name = chartFileName(this.exportName() || this.translations().chartDataTable, format);
2790
+ if (format === "csv") {
2791
+ const table = this.table();
2792
+ if (table) downloadChartFile(document, new Blob([chartCsv(table, this.translations().chartCategory)], { type: "text/csv;charset=utf-8" }), name);
2793
+ return;
2794
+ }
2795
+ const svg = this.svgRef()?.nativeElement;
2796
+ if (!svg) return;
2797
+ const style = document.defaultView?.getComputedStyle(this.host.nativeElement);
2798
+ const markup = chartSvgString(svg, {
2799
+ legend: this.showLegend() ? this.legendItems().map((item) => ({
2800
+ ...item,
2801
+ color: this.resolveColor(item.color)
2802
+ })) : [],
2803
+ background: style?.getPropertyValue("--tx-surface-card").trim() || "#ffffff",
2804
+ textColor: style?.color,
2805
+ fontFamily: style?.fontFamily
2806
+ });
2807
+ if (format === "svg") {
2808
+ downloadChartFile(document, new Blob([markup], { type: "image/svg+xml;charset=utf-8" }), name);
2809
+ return;
2810
+ }
2811
+ chartPngBlob(document, markup).then((blob) => downloadChartFile(document, blob, name)).catch(() => void 0);
2812
+ }
2813
+ resolveColor(color) {
2814
+ const host = this.host.nativeElement;
2815
+ const view = host.ownerDocument.defaultView;
2816
+ if (!view || !color.includes("var(")) return color;
2817
+ const probe = host.ownerDocument.createElement("span");
2818
+ probe.style.color = color;
2819
+ host.appendChild(probe);
2820
+ const resolved = view.getComputedStyle(probe).color;
2821
+ probe.remove();
2822
+ return resolved || color;
2823
+ }
2824
+ placeAnchor(x, y, width, height) {
2825
+ const anchor = this.anchorRef()?.nativeElement;
2826
+ if (!anchor) return;
2827
+ anchor.style.width = `${width}px`;
2828
+ anchor.style.height = `${height}px`;
2829
+ anchor.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
2830
+ }
2831
+ closeTooltip() {
2832
+ if (this.ref) {
2833
+ const ref = this.ref;
2834
+ this.ref = null;
2835
+ this.activeRef.set(null);
2836
+ ref.close("api");
2837
+ }
2838
+ }
2839
+ static ɵfac = i0.ɵɵngDeclareFactory({
2840
+ minVersion: "12.0.0",
2841
+ version: "22.2.3",
2842
+ ngImport: i0,
2843
+ type: TxChartFrame,
2844
+ deps: [],
2845
+ target: i0.ɵɵFactoryTarget.Component
2846
+ });
2847
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2848
+ minVersion: "17.0.0",
2849
+ version: "22.2.3",
2850
+ type: TxChartFrame,
2851
+ isStandalone: true,
2852
+ selector: "tx-chart-frame",
2853
+ inputs: {
2854
+ height: {
2855
+ classPropertyName: "height",
2856
+ publicName: "height",
2857
+ isSignal: true,
2858
+ isRequired: false,
2859
+ transformFunction: null
2860
+ },
2861
+ size: {
2862
+ classPropertyName: "size",
2863
+ publicName: "size",
2864
+ isSignal: true,
2865
+ isRequired: false,
2866
+ transformFunction: null
2867
+ },
2868
+ legendItems: {
2869
+ classPropertyName: "legendItems",
2870
+ publicName: "legendItems",
2871
+ isSignal: true,
2872
+ isRequired: false,
2873
+ transformFunction: null
2874
+ },
2875
+ showLegend: {
2876
+ classPropertyName: "showLegend",
2877
+ publicName: "showLegend",
2878
+ isSignal: true,
2879
+ isRequired: false,
2880
+ transformFunction: null
2881
+ },
2882
+ legendPosition: {
2883
+ classPropertyName: "legendPosition",
2884
+ publicName: "legendPosition",
2885
+ isSignal: true,
2886
+ isRequired: false,
2887
+ transformFunction: null
2888
+ },
2889
+ legendAlign: {
2890
+ classPropertyName: "legendAlign",
2891
+ publicName: "legendAlign",
2892
+ isSignal: true,
2893
+ isRequired: false,
2894
+ transformFunction: null
2895
+ },
2896
+ legendVariant: {
2897
+ classPropertyName: "legendVariant",
2898
+ publicName: "legendVariant",
2899
+ isSignal: true,
2900
+ isRequired: false,
2901
+ transformFunction: null
2902
+ },
2903
+ legendToggle: {
2904
+ classPropertyName: "legendToggle",
2905
+ publicName: "legendToggle",
2906
+ isSignal: true,
2907
+ isRequired: false,
2908
+ transformFunction: null
2909
+ },
2910
+ legendTemplate: {
2911
+ classPropertyName: "legendTemplate",
2912
+ publicName: "legendTemplate",
2913
+ isSignal: true,
2914
+ isRequired: false,
2915
+ transformFunction: null
2916
+ },
2917
+ empty: {
2918
+ classPropertyName: "empty",
2919
+ publicName: "empty",
2920
+ isSignal: true,
2921
+ isRequired: false,
2922
+ transformFunction: null
2923
+ },
2924
+ loading: {
2925
+ classPropertyName: "loading",
2926
+ publicName: "loading",
2927
+ isSignal: true,
2928
+ isRequired: false,
2929
+ transformFunction: null
2930
+ },
2931
+ emptyIcon: {
2932
+ classPropertyName: "emptyIcon",
2933
+ publicName: "emptyIcon",
2934
+ isSignal: true,
2935
+ isRequired: false,
2936
+ transformFunction: null
2937
+ },
2938
+ summary: {
2939
+ classPropertyName: "summary",
2940
+ publicName: "summary",
2941
+ isSignal: true,
2942
+ isRequired: false,
2943
+ transformFunction: null
2944
+ },
2945
+ table: {
2946
+ classPropertyName: "table",
2947
+ publicName: "table",
2948
+ isSignal: true,
2949
+ isRequired: false,
2950
+ transformFunction: null
2951
+ },
2952
+ tooltip: {
2953
+ classPropertyName: "tooltip",
2954
+ publicName: "tooltip",
2955
+ isSignal: true,
2956
+ isRequired: false,
2957
+ transformFunction: null
2958
+ },
2959
+ tooltipTemplate: {
2960
+ classPropertyName: "tooltipTemplate",
2961
+ publicName: "tooltipTemplate",
2962
+ isSignal: true,
2963
+ isRequired: false,
2964
+ transformFunction: null
2965
+ },
2966
+ tooltipPlacement: {
2967
+ classPropertyName: "tooltipPlacement",
2968
+ publicName: "tooltipPlacement",
2969
+ isSignal: true,
2970
+ isRequired: false,
2971
+ transformFunction: null
2972
+ },
2973
+ panelStyle: {
2974
+ classPropertyName: "panelStyle",
2975
+ publicName: "panelStyle",
2976
+ isSignal: true,
2977
+ isRequired: false,
2978
+ transformFunction: null
2979
+ },
2980
+ parts: {
2981
+ classPropertyName: "parts",
2982
+ publicName: "parts",
2983
+ isSignal: true,
2984
+ isRequired: false,
2985
+ transformFunction: null
2986
+ },
2987
+ styled: {
2988
+ classPropertyName: "styled",
2989
+ publicName: "styled",
2990
+ isSignal: true,
2991
+ isRequired: false,
2992
+ transformFunction: null
2993
+ },
2994
+ interactive: {
2995
+ classPropertyName: "interactive",
2996
+ publicName: "interactive",
2997
+ isSignal: true,
2998
+ isRequired: false,
2999
+ transformFunction: null
3000
+ },
3001
+ actionKeys: {
3002
+ classPropertyName: "actionKeys",
3003
+ publicName: "actionKeys",
3004
+ isSignal: true,
3005
+ isRequired: false,
3006
+ transformFunction: null
3007
+ },
3008
+ zoomable: {
3009
+ classPropertyName: "zoomable",
3010
+ publicName: "zoomable",
3011
+ isSignal: true,
3012
+ isRequired: false,
3013
+ transformFunction: null
3014
+ },
3015
+ zoomedIn: {
3016
+ classPropertyName: "zoomedIn",
3017
+ publicName: "zoomedIn",
3018
+ isSignal: true,
3019
+ isRequired: false,
3020
+ transformFunction: null
3021
+ },
3022
+ plotHeight: {
3023
+ classPropertyName: "plotHeight",
3024
+ publicName: "plotHeight",
3025
+ isSignal: true,
3026
+ isRequired: false,
3027
+ transformFunction: null
3028
+ },
3029
+ toolbar: {
3030
+ classPropertyName: "toolbar",
3031
+ publicName: "toolbar",
3032
+ isSignal: true,
3033
+ isRequired: false,
3034
+ transformFunction: null
3035
+ },
3036
+ exportName: {
3037
+ classPropertyName: "exportName",
3038
+ publicName: "exportName",
3039
+ isSignal: true,
3040
+ isRequired: false,
3041
+ transformFunction: null
3042
+ }
3043
+ },
3044
+ outputs: {
3045
+ size: "sizeChange",
3046
+ pointer: "pointer",
3047
+ navigate: "navigate",
3048
+ legendToggled: "legendToggled",
3049
+ legendHovered: "legendHovered",
3050
+ tooltipClosed: "tooltipClosed",
3051
+ zoomed: "zoomed",
3052
+ panned: "panned",
3053
+ zoomReset: "zoomReset"
3054
+ },
3055
+ host: {
3056
+ properties: {
3057
+ "attr.data-legend": "legendVisible() ? legendPosition() : null",
3058
+ "attr.data-toolbar": "toolbarRow()",
3059
+ "attr.data-styled": "styled() || null",
3060
+ "class.tx-chart-frame--fill": "fills()",
3061
+ "class.tx-chart-frame--interactive": "interactive()",
3062
+ "style.height": "cssHeight()"
3063
+ },
3064
+ classAttribute: "tx-chart-frame"
3065
+ },
3066
+ viewQueries: [
3067
+ {
3068
+ propertyName: "plotRef",
3069
+ first: true,
3070
+ predicate: ["plot"],
3071
+ descendants: true,
3072
+ isSignal: true
3073
+ },
3074
+ {
3075
+ propertyName: "anchorRef",
3076
+ first: true,
3077
+ predicate: ["anchor"],
3078
+ descendants: true,
3079
+ isSignal: true
3080
+ },
3081
+ {
3082
+ propertyName: "svgRef",
3083
+ first: true,
3084
+ predicate: ["chartSvg"],
3085
+ descendants: true,
3086
+ isSignal: true
3087
+ },
3088
+ {
3089
+ propertyName: "tooltipPanel",
3090
+ first: true,
3091
+ predicate: ["tooltipPanel"],
3092
+ descendants: true,
3093
+ isSignal: true
3094
+ }
3095
+ ],
3096
+ ngImport: i0,
3097
+ template: "@if (toolbar() || zoomedIn()) {\n <div class=\"tx-chart-frame__toolbar\">\n @if (zoomedIn()) {\n <button\n txButton\n type=\"button\"\n class=\"tx-chart-frame__reset\"\n icon=\"search-minus\"\n size=\"small\"\n severity=\"secondary\"\n text\n [label]=\"translations().chartResetZoom\"\n (click)=\"zoomReset.emit()\"\n ></button>\n }\n @if (toolbar() && canExport()) {\n <button\n txButton\n type=\"button\"\n class=\"tx-chart-frame__menu-button\"\n icon=\"bars\"\n size=\"small\"\n severity=\"secondary\"\n text\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"translations().chartMenu\"\n [txPopoverTrigger]=\"exportPopover\"\n ></button>\n <tx-popover #exportPopover placement=\"bottom-end\" [dt]=\"popoverTokens\" [ariaLabel]=\"translations().chartMenu\" [unstyled]=\"!styled()\">\n <tx-chart-menu\n [items]=\"exportItems()\"\n [ariaLabel]=\"translations().chartMenu\"\n [unstyled]=\"!styled()\"\n (selected)=\"exportPopover.hide(); onExport($event)\"\n />\n </tx-popover>\n }\n </div>\n}\n@if (legendVisible()) {\n <tx-chart-legend\n class=\"tx-chart-frame__legend\"\n [class]=\"parts().legend?.class\"\n [style]=\"parts().legend?.style\"\n [attr.data-styled]=\"styled() || null\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [align]=\"legendAlign()\"\n [variant]=\"legendVariant()\"\n [toggle]=\"legendToggle()\"\n [template]=\"legendTemplate()\"\n [itemPart]=\"parts().legendItem\"\n (toggled)=\"legendToggled.emit($event)\"\n (hovered)=\"legendHovered.emit($event)\"\n />\n}\n<div\n #plot\n class=\"tx-chart-frame__plot\"\n [class]=\"parts().plot?.class\"\n [style]=\"parts().plot?.style\"\n [style.height.px]=\"plotHeight()\"\n [class.tx-chart-frame__plot--fixed]=\"plotHeight() !== null\"\n [attr.role]=\"empty() || loading() ? null : 'img'\"\n [attr.aria-label]=\"empty() || loading() ? null : summary()\"\n [attr.aria-describedby]=\"interactive() && !empty() && !loading() ? hintId : null\"\n [attr.tabindex]=\"interactive() && !empty() && !loading() ? 0 : null\"\n [class.tx-chart-frame__plot--zoomable]=\"zoomable()\"\n [class.tx-chart-frame__plot--zoomed]=\"zoomedIn()\"\n (pointermove)=\"onPointer($event, 'move')\"\n (pointerdown)=\"onPointer($event, 'down')\"\n (pointerup)=\"onPointer($event, 'up')\"\n (pointercancel)=\"onPointer($event, 'up')\"\n (pointerleave)=\"onPointer($event, 'leave')\"\n (click)=\"onPointer($event, 'click')\"\n (wheel)=\"onWheel($event)\"\n (dblclick)=\"onDoubleClick()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"pointer.emit({ x: 0, y: 0, type: 'leave', target: null })\"\n>\n @if (loading()) {\n <tx-skeleton\n class=\"tx-chart-frame__skeleton\"\n [class]=\"parts().skeleton?.class\"\n [style]=\"parts().skeleton?.style\"\n width=\"100%\"\n height=\"100%\"\n [unstyled]=\"!styled()\"\n [attr.aria-label]=\"translations().chartLoading\"\n role=\"status\"\n />\n } @else if (empty()) {\n <div class=\"tx-chart-frame__empty\" role=\"status\" [class]=\"parts().empty?.class\" [style]=\"parts().empty?.style\">\n <span class=\"tx-chart-frame__empty-icon\" aria-hidden=\"true\"><tx-icon [name]=\"emptyIcon()\" /></span>\n <span class=\"tx-chart-frame__empty-text\">{{ translations().chartNoData }}</span>\n </div>\n } @else {\n <svg\n #chartSvg\n class=\"tx-chart-frame__svg\"\n [class]=\"parts().svg?.class\"\n [style]=\"parts().svg?.style\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n preserveAspectRatio=\"xMinYMin meet\"\n [attr.viewBox]=\"viewBox()\"\n >\n <ng-content />\n </svg>\n <span #anchor class=\"tx-chart-frame__anchor\" aria-hidden=\"true\"></span>\n }\n</div>\n@if (interactive() && !empty() && !loading()) {\n <span class=\"cdk-visually-hidden\" [id]=\"hintId\">{{ translations().chartNavigateHint }}{{ zoomable() ? '. ' + translations().chartZoomHint : '' }}</span>\n}\n@if (table(); as data) {\n @if (!empty() && !loading()) {\n <table class=\"cdk-visually-hidden\">\n <caption>\n {{ summary() || translations().chartDataTable }}\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">{{ translations().chartCategory }}</th>\n @for (column of data.columns; track column.key) {\n <th scope=\"col\">{{ column.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of data.rows; track $index) {\n <tr>\n <th scope=\"row\">{{ row.label }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n}\n\n<ng-template #tooltipPanel>\n @if (shown(); as data) {\n <div\n class=\"tx-chart-frame__tooltip\"\n role=\"presentation\"\n [class]=\"parts().tooltip?.class\"\n [style]=\"panelStyle()\"\n [style.--tx-chart-tooltip-arrow-offset]=\"arrowOffset()\"\n [attr.data-side]=\"side()\"\n [attr.data-follow]=\"following() || null\"\n [attr.data-styled]=\"styled() || null\"\n >\n @if (styled()) {\n <svg class=\"tx-chart-frame__tooltip-arrow\" aria-hidden=\"true\" viewBox=\"0 0 12 6\" preserveAspectRatio=\"none\">\n <path class=\"tx-chart-frame__tooltip-arrow-fill\" d=\"M0 6 L6 0 L12 6 Z\" />\n <path class=\"tx-chart-frame__tooltip-arrow-line\" d=\"M0 6 L6 0 L12 6\" />\n </svg>\n }\n @if (tooltipTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom\" [ngTemplateOutletContext]=\"{ $implicit: data }\" />\n } @else {\n @if (data.title) {\n <div class=\"tx-chart-frame__tooltip-title\">{{ data.title }}</div>\n }\n @for (row of data.rows; track $index) {\n <div class=\"tx-chart-frame__tooltip-row\" [class.tx-chart-frame__tooltip-row--active]=\"row.active && data.rows.length > 1\">\n <span class=\"tx-chart-frame__tooltip-marker\" [style.background]=\"row.color\"></span>\n <span class=\"tx-chart-frame__tooltip-label\">{{ row.label }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ row.value }}</span>\n @if (row.share) {\n <span class=\"tx-chart-frame__tooltip-share\">{{ row.share }}</span>\n }\n </div>\n }\n @if (data.total) {\n <div class=\"tx-chart-frame__tooltip-row tx-chart-frame__tooltip-total\">\n <span class=\"tx-chart-frame__tooltip-label\">{{ translations().chartTotal }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ data.total }}</span>\n </div>\n }\n @if (data.note) {\n <div class=\"tx-chart-frame__tooltip-note\">{{ data.note }}</div>\n }\n }\n </div>\n }\n</ng-template>\n",
3098
+ styles: [":host{position:relative;display:flex;flex-direction:column;min-width:0;box-sizing:border-box}:host([data-legend=bottom]){flex-direction:column-reverse}:host([data-legend=left]){flex-direction:row}:host([data-legend=right]){flex-direction:row-reverse}:host([data-legend=left]) .tx-chart-frame__legend,:host([data-legend=right]) .tx-chart-frame__legend{flex:0 0 auto;align-self:center;max-height:100%;overflow:auto}.tx-chart-frame__toolbar{position:absolute;top:0;right:0;z-index:1;display:flex;align-items:center;justify-content:flex-end}:host([data-toolbar=own]){padding-top:var(--tx-chart-toolbar-row-height)}:host([data-toolbar=legend]) .tx-chart-frame__legend{padding-inline-end:var(--tx-chart-toolbar-reserve)}.tx-chart-frame__plot{position:relative;flex:1 1 auto;min-width:0;min-height:0;outline:none}.tx-chart-frame__plot--zoomable{touch-action:pan-y}.tx-chart-frame__plot--zoomed{cursor:grab}.tx-chart-frame__plot--zoomed:active{cursor:grabbing}.tx-chart-frame__plot--fixed{flex:0 0 auto}:host([data-legend=left]) .tx-chart-frame__plot--fixed,:host([data-legend=right]) .tx-chart-frame__plot--fixed{flex:1 1 auto;align-self:center}.tx-chart-frame__svg{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:visible}.tx-chart-frame__anchor{position:absolute;top:0;left:0;width:0;height:0;pointer-events:none}.tx-chart-frame__skeleton{position:absolute;inset:0}.tx-chart-frame__empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}.tx-chart-frame__empty-icon{display:inline-flex;align-items:center;justify-content:center}.tx-chart-frame__tooltip{display:flex;flex-direction:column;white-space:nowrap;pointer-events:none}.tx-chart-frame__tooltip-row{display:flex;align-items:center}:host([data-styled]){gap:var(--tx-chart-legend-gap);color:var(--tx-chart-color);font-family:var(--tx-chart-font-family);background:var(--tx-chart-background)}:host([data-styled]) .tx-chart-frame__plot:focus-visible{border-radius:var(--tx-radius-sm);outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:var(--tx-chart-focus-ring-offset)}:host([data-styled]) .tx-chart-frame__empty{gap:var(--tx-chart-empty-gap);color:var(--tx-chart-empty-color);font-size:var(--tx-chart-empty-font-size)}:host([data-styled]) .tx-chart-frame__empty-icon{width:var(--tx-chart-empty-icon-size);height:var(--tx-chart-empty-icon-size);border-radius:var(--tx-radius-full);background:var(--tx-chart-empty-icon-background);color:var(--tx-chart-empty-icon-color);font-size:var(--tx-chart-empty-icon-font-size)}:host([data-styled][data-legend=left]),:host([data-styled][data-legend=right]){gap:var(--tx-chart-legend-item-gap)}:host([data-styled][data-legend=left]) .tx-chart-frame__legend,:host([data-styled][data-legend=right]) .tx-chart-frame__legend{max-width:var(--tx-chart-legend-side-width)}.tx-chart-frame__tooltip[data-styled]{position:relative;gap:var(--tx-chart-tooltip-row-gap);min-width:var(--tx-chart-tooltip-min-width);padding:var(--tx-chart-tooltip-padding);border:var(--tx-chart-tooltip-border-width) solid var(--tx-chart-tooltip-border-color);border-radius:var(--tx-chart-tooltip-border-radius);background:var(--tx-chart-tooltip-background);filter:var(--tx-chart-tooltip-shadow);color:var(--tx-chart-tooltip-color);font-family:var(--tx-chart-font-family);font-size:var(--tx-chart-tooltip-font-size);line-height:1.35}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow{position:absolute;display:block;width:calc(var(--tx-chart-tooltip-arrow-size) * 2);height:var(--tx-chart-tooltip-arrow-size);overflow:visible}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow-fill{fill:var(--tx-chart-tooltip-background)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow-line{fill:none;stroke:var(--tx-chart-tooltip-border-color);stroke-width:var(--tx-chart-tooltip-border-width);stroke-linejoin:round;vector-effect:non-scaling-stroke}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-title{margin-bottom:2px;color:var(--tx-chart-tooltip-muted-color);font-size:var(--tx-chart-tooltip-title-font-size);font-weight:var(--tx-chart-tooltip-title-font-weight)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row{gap:var(--tx-chart-tooltip-marker-gap)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-note{margin-top:2px;color:var(--tx-chart-tooltip-note-color);font-size:var(--tx-chart-tooltip-title-font-size)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-marker{flex-shrink:0;width:var(--tx-chart-tooltip-marker-size);height:var(--tx-chart-tooltip-marker-size);border-radius:var(--tx-radius-full)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-muted-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row--active .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-share{min-width:4ch;color:var(--tx-chart-tooltip-muted-color);font-variant-numeric:tabular-nums;text-align:end}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-value{margin-inline-start:auto;padding-inline-start:var(--tx-chart-tooltip-value-gap);font-weight:var(--tx-chart-tooltip-value-font-weight);font-variant-numeric:tabular-nums}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-total{margin-top:2px;padding-top:calc(var(--tx-chart-tooltip-row-gap) + 2px);border-top:1px solid var(--tx-chart-tooltip-total-border-color)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{left:clamp(var(--tx-chart-tooltip-border-radius) + var(--tx-chart-tooltip-arrow-size),var(--tx-chart-tooltip-arrow-offset),100% - var(--tx-chart-tooltip-border-radius) - var(--tx-chart-tooltip-arrow-size));margin-left:calc(var(--tx-chart-tooltip-arrow-size) * -1)}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{top:clamp(var(--tx-chart-tooltip-border-radius) + var(--tx-chart-tooltip-arrow-size) / 2,var(--tx-chart-tooltip-arrow-offset),100% - var(--tx-chart-tooltip-border-radius) - var(--tx-chart-tooltip-arrow-size) / 2);margin-top:calc(var(--tx-chart-tooltip-arrow-size) / -2)}.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{top:calc(var(--tx-chart-tooltip-arrow-size) * -1)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow{bottom:calc(var(--tx-chart-tooltip-arrow-size) * -1);transform:rotate(180deg)}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow{right:calc(var(--tx-chart-tooltip-arrow-size) * -1.5);transform:rotate(90deg)}.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{left:calc(var(--tx-chart-tooltip-arrow-size) * -1.5);transform:rotate(-90deg)}\n"],
3099
+ dependencies: [
3100
+ {
3101
+ kind: "directive",
3102
+ type: NgTemplateOutlet,
3103
+ selector: "[ngTemplateOutlet]",
3104
+ inputs: [
3105
+ "ngTemplateOutletContext",
3106
+ "ngTemplateOutlet",
3107
+ "ngTemplateOutletInjector"
3108
+ ]
3109
+ },
3110
+ {
3111
+ kind: "component",
3112
+ type: TxChartLegend,
3113
+ selector: "tx-chart-legend",
3114
+ inputs: [
3115
+ "items",
3116
+ "position",
3117
+ "align",
3118
+ "variant",
3119
+ "toggle",
3120
+ "template",
3121
+ "itemPart"
3122
+ ],
3123
+ outputs: ["toggled", "hovered"]
3124
+ },
3125
+ {
3126
+ kind: "component",
3127
+ type: TxIcon,
3128
+ selector: "tx-icon",
3129
+ inputs: ["name"]
3130
+ },
3131
+ {
3132
+ kind: "component",
3133
+ type: TxSkeleton,
3134
+ selector: "tx-skeleton",
3135
+ inputs: [
3136
+ "shape",
3137
+ "size",
3138
+ "width",
3139
+ "height",
3140
+ "borderRadius",
3141
+ "lines",
3142
+ "animation",
3143
+ "dt",
3144
+ "pt",
3145
+ "ptOptions",
3146
+ "unstyled"
3147
+ ]
3148
+ },
3149
+ {
3150
+ kind: "component",
3151
+ type: TxButton,
3152
+ selector: "button[txButton], a[txButton]",
3153
+ inputs: [
3154
+ "label",
3155
+ "severity",
3156
+ "size",
3157
+ "variant",
3158
+ "outlined",
3159
+ "text",
3160
+ "link",
3161
+ "rounded",
3162
+ "raised",
3163
+ "plain",
3164
+ "fluid",
3165
+ "disabled",
3166
+ "tabindex",
3167
+ "icon",
3168
+ "iconPos",
3169
+ "iconOnly",
3170
+ "loading",
3171
+ "loadingIcon",
3172
+ "badge",
3173
+ "badgeSeverity",
3174
+ "dt",
3175
+ "pt",
3176
+ "ptOptions",
3177
+ "unstyled"
3178
+ ]
3179
+ },
3180
+ {
3181
+ kind: "component",
3182
+ type: TxPopover,
3183
+ selector: "tx-popover",
3184
+ inputs: [
3185
+ "placement",
3186
+ "offset",
3187
+ "arrow",
3188
+ "header",
3189
+ "closeButton",
3190
+ "dismissable",
3191
+ "closeOnEscape",
3192
+ "autoFocus",
3193
+ "restoreFocus",
3194
+ "scroll",
3195
+ "ariaLabel",
3196
+ "ariaLabelledBy",
3197
+ "panelClass",
3198
+ "open",
3199
+ "dt",
3200
+ "pt",
3201
+ "ptOptions",
3202
+ "unstyled"
3203
+ ],
3204
+ outputs: [
3205
+ "openChange",
3206
+ "opened",
3207
+ "closed"
3208
+ ]
3209
+ },
3210
+ {
3211
+ kind: "directive",
3212
+ type: TxPopoverTrigger,
3213
+ selector: "[txPopoverTrigger]",
3214
+ inputs: ["txPopoverTrigger"]
3215
+ },
3216
+ {
3217
+ kind: "component",
3218
+ type: TxChartMenu,
3219
+ selector: "tx-chart-menu",
3220
+ inputs: [
3221
+ "items",
3222
+ "ariaLabel",
3223
+ "unstyled"
3224
+ ],
3225
+ outputs: ["selected"]
3226
+ }
3227
+ ],
3228
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
3229
+ });
3230
+ };
3231
+ i0.ɵɵngDeclareClassMetadata({
3232
+ minVersion: "12.0.0",
3233
+ version: "22.2.3",
3234
+ ngImport: i0,
3235
+ type: TxChartFrame,
3236
+ decorators: [{
3237
+ type: Component,
3238
+ args: [{
3239
+ selector: "tx-chart-frame",
3240
+ imports: [
3241
+ NgTemplateOutlet,
3242
+ TxChartLegend,
3243
+ TxIcon,
3244
+ TxSkeleton,
3245
+ TxButton,
3246
+ TxPopover,
3247
+ TxPopoverTrigger,
3248
+ TxChartMenu
3249
+ ],
3250
+ changeDetection: ChangeDetectionStrategy.OnPush,
3251
+ host: {
3252
+ class: "tx-chart-frame",
3253
+ "[attr.data-legend]": "legendVisible() ? legendPosition() : null",
3254
+ "[attr.data-toolbar]": "toolbarRow()",
3255
+ "[attr.data-styled]": "styled() || null",
3256
+ "[class.tx-chart-frame--fill]": "fills()",
3257
+ "[class.tx-chart-frame--interactive]": "interactive()",
3258
+ "[style.height]": "cssHeight()"
3259
+ },
3260
+ template: "@if (toolbar() || zoomedIn()) {\n <div class=\"tx-chart-frame__toolbar\">\n @if (zoomedIn()) {\n <button\n txButton\n type=\"button\"\n class=\"tx-chart-frame__reset\"\n icon=\"search-minus\"\n size=\"small\"\n severity=\"secondary\"\n text\n [label]=\"translations().chartResetZoom\"\n (click)=\"zoomReset.emit()\"\n ></button>\n }\n @if (toolbar() && canExport()) {\n <button\n txButton\n type=\"button\"\n class=\"tx-chart-frame__menu-button\"\n icon=\"bars\"\n size=\"small\"\n severity=\"secondary\"\n text\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"translations().chartMenu\"\n [txPopoverTrigger]=\"exportPopover\"\n ></button>\n <tx-popover #exportPopover placement=\"bottom-end\" [dt]=\"popoverTokens\" [ariaLabel]=\"translations().chartMenu\" [unstyled]=\"!styled()\">\n <tx-chart-menu\n [items]=\"exportItems()\"\n [ariaLabel]=\"translations().chartMenu\"\n [unstyled]=\"!styled()\"\n (selected)=\"exportPopover.hide(); onExport($event)\"\n />\n </tx-popover>\n }\n </div>\n}\n@if (legendVisible()) {\n <tx-chart-legend\n class=\"tx-chart-frame__legend\"\n [class]=\"parts().legend?.class\"\n [style]=\"parts().legend?.style\"\n [attr.data-styled]=\"styled() || null\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [align]=\"legendAlign()\"\n [variant]=\"legendVariant()\"\n [toggle]=\"legendToggle()\"\n [template]=\"legendTemplate()\"\n [itemPart]=\"parts().legendItem\"\n (toggled)=\"legendToggled.emit($event)\"\n (hovered)=\"legendHovered.emit($event)\"\n />\n}\n<div\n #plot\n class=\"tx-chart-frame__plot\"\n [class]=\"parts().plot?.class\"\n [style]=\"parts().plot?.style\"\n [style.height.px]=\"plotHeight()\"\n [class.tx-chart-frame__plot--fixed]=\"plotHeight() !== null\"\n [attr.role]=\"empty() || loading() ? null : 'img'\"\n [attr.aria-label]=\"empty() || loading() ? null : summary()\"\n [attr.aria-describedby]=\"interactive() && !empty() && !loading() ? hintId : null\"\n [attr.tabindex]=\"interactive() && !empty() && !loading() ? 0 : null\"\n [class.tx-chart-frame__plot--zoomable]=\"zoomable()\"\n [class.tx-chart-frame__plot--zoomed]=\"zoomedIn()\"\n (pointermove)=\"onPointer($event, 'move')\"\n (pointerdown)=\"onPointer($event, 'down')\"\n (pointerup)=\"onPointer($event, 'up')\"\n (pointercancel)=\"onPointer($event, 'up')\"\n (pointerleave)=\"onPointer($event, 'leave')\"\n (click)=\"onPointer($event, 'click')\"\n (wheel)=\"onWheel($event)\"\n (dblclick)=\"onDoubleClick()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"pointer.emit({ x: 0, y: 0, type: 'leave', target: null })\"\n>\n @if (loading()) {\n <tx-skeleton\n class=\"tx-chart-frame__skeleton\"\n [class]=\"parts().skeleton?.class\"\n [style]=\"parts().skeleton?.style\"\n width=\"100%\"\n height=\"100%\"\n [unstyled]=\"!styled()\"\n [attr.aria-label]=\"translations().chartLoading\"\n role=\"status\"\n />\n } @else if (empty()) {\n <div class=\"tx-chart-frame__empty\" role=\"status\" [class]=\"parts().empty?.class\" [style]=\"parts().empty?.style\">\n <span class=\"tx-chart-frame__empty-icon\" aria-hidden=\"true\"><tx-icon [name]=\"emptyIcon()\" /></span>\n <span class=\"tx-chart-frame__empty-text\">{{ translations().chartNoData }}</span>\n </div>\n } @else {\n <svg\n #chartSvg\n class=\"tx-chart-frame__svg\"\n [class]=\"parts().svg?.class\"\n [style]=\"parts().svg?.style\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n preserveAspectRatio=\"xMinYMin meet\"\n [attr.viewBox]=\"viewBox()\"\n >\n <ng-content />\n </svg>\n <span #anchor class=\"tx-chart-frame__anchor\" aria-hidden=\"true\"></span>\n }\n</div>\n@if (interactive() && !empty() && !loading()) {\n <span class=\"cdk-visually-hidden\" [id]=\"hintId\">{{ translations().chartNavigateHint }}{{ zoomable() ? '. ' + translations().chartZoomHint : '' }}</span>\n}\n@if (table(); as data) {\n @if (!empty() && !loading()) {\n <table class=\"cdk-visually-hidden\">\n <caption>\n {{ summary() || translations().chartDataTable }}\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">{{ translations().chartCategory }}</th>\n @for (column of data.columns; track column.key) {\n <th scope=\"col\">{{ column.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of data.rows; track $index) {\n <tr>\n <th scope=\"row\">{{ row.label }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n}\n\n<ng-template #tooltipPanel>\n @if (shown(); as data) {\n <div\n class=\"tx-chart-frame__tooltip\"\n role=\"presentation\"\n [class]=\"parts().tooltip?.class\"\n [style]=\"panelStyle()\"\n [style.--tx-chart-tooltip-arrow-offset]=\"arrowOffset()\"\n [attr.data-side]=\"side()\"\n [attr.data-follow]=\"following() || null\"\n [attr.data-styled]=\"styled() || null\"\n >\n @if (styled()) {\n <svg class=\"tx-chart-frame__tooltip-arrow\" aria-hidden=\"true\" viewBox=\"0 0 12 6\" preserveAspectRatio=\"none\">\n <path class=\"tx-chart-frame__tooltip-arrow-fill\" d=\"M0 6 L6 0 L12 6 Z\" />\n <path class=\"tx-chart-frame__tooltip-arrow-line\" d=\"M0 6 L6 0 L12 6\" />\n </svg>\n }\n @if (tooltipTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom\" [ngTemplateOutletContext]=\"{ $implicit: data }\" />\n } @else {\n @if (data.title) {\n <div class=\"tx-chart-frame__tooltip-title\">{{ data.title }}</div>\n }\n @for (row of data.rows; track $index) {\n <div class=\"tx-chart-frame__tooltip-row\" [class.tx-chart-frame__tooltip-row--active]=\"row.active && data.rows.length > 1\">\n <span class=\"tx-chart-frame__tooltip-marker\" [style.background]=\"row.color\"></span>\n <span class=\"tx-chart-frame__tooltip-label\">{{ row.label }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ row.value }}</span>\n @if (row.share) {\n <span class=\"tx-chart-frame__tooltip-share\">{{ row.share }}</span>\n }\n </div>\n }\n @if (data.total) {\n <div class=\"tx-chart-frame__tooltip-row tx-chart-frame__tooltip-total\">\n <span class=\"tx-chart-frame__tooltip-label\">{{ translations().chartTotal }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ data.total }}</span>\n </div>\n }\n @if (data.note) {\n <div class=\"tx-chart-frame__tooltip-note\">{{ data.note }}</div>\n }\n }\n </div>\n }\n</ng-template>\n",
3261
+ styles: [":host{position:relative;display:flex;flex-direction:column;min-width:0;box-sizing:border-box}:host([data-legend=bottom]){flex-direction:column-reverse}:host([data-legend=left]){flex-direction:row}:host([data-legend=right]){flex-direction:row-reverse}:host([data-legend=left]) .tx-chart-frame__legend,:host([data-legend=right]) .tx-chart-frame__legend{flex:0 0 auto;align-self:center;max-height:100%;overflow:auto}.tx-chart-frame__toolbar{position:absolute;top:0;right:0;z-index:1;display:flex;align-items:center;justify-content:flex-end}:host([data-toolbar=own]){padding-top:var(--tx-chart-toolbar-row-height)}:host([data-toolbar=legend]) .tx-chart-frame__legend{padding-inline-end:var(--tx-chart-toolbar-reserve)}.tx-chart-frame__plot{position:relative;flex:1 1 auto;min-width:0;min-height:0;outline:none}.tx-chart-frame__plot--zoomable{touch-action:pan-y}.tx-chart-frame__plot--zoomed{cursor:grab}.tx-chart-frame__plot--zoomed:active{cursor:grabbing}.tx-chart-frame__plot--fixed{flex:0 0 auto}:host([data-legend=left]) .tx-chart-frame__plot--fixed,:host([data-legend=right]) .tx-chart-frame__plot--fixed{flex:1 1 auto;align-self:center}.tx-chart-frame__svg{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:visible}.tx-chart-frame__anchor{position:absolute;top:0;left:0;width:0;height:0;pointer-events:none}.tx-chart-frame__skeleton{position:absolute;inset:0}.tx-chart-frame__empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}.tx-chart-frame__empty-icon{display:inline-flex;align-items:center;justify-content:center}.tx-chart-frame__tooltip{display:flex;flex-direction:column;white-space:nowrap;pointer-events:none}.tx-chart-frame__tooltip-row{display:flex;align-items:center}:host([data-styled]){gap:var(--tx-chart-legend-gap);color:var(--tx-chart-color);font-family:var(--tx-chart-font-family);background:var(--tx-chart-background)}:host([data-styled]) .tx-chart-frame__plot:focus-visible{border-radius:var(--tx-radius-sm);outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:var(--tx-chart-focus-ring-offset)}:host([data-styled]) .tx-chart-frame__empty{gap:var(--tx-chart-empty-gap);color:var(--tx-chart-empty-color);font-size:var(--tx-chart-empty-font-size)}:host([data-styled]) .tx-chart-frame__empty-icon{width:var(--tx-chart-empty-icon-size);height:var(--tx-chart-empty-icon-size);border-radius:var(--tx-radius-full);background:var(--tx-chart-empty-icon-background);color:var(--tx-chart-empty-icon-color);font-size:var(--tx-chart-empty-icon-font-size)}:host([data-styled][data-legend=left]),:host([data-styled][data-legend=right]){gap:var(--tx-chart-legend-item-gap)}:host([data-styled][data-legend=left]) .tx-chart-frame__legend,:host([data-styled][data-legend=right]) .tx-chart-frame__legend{max-width:var(--tx-chart-legend-side-width)}.tx-chart-frame__tooltip[data-styled]{position:relative;gap:var(--tx-chart-tooltip-row-gap);min-width:var(--tx-chart-tooltip-min-width);padding:var(--tx-chart-tooltip-padding);border:var(--tx-chart-tooltip-border-width) solid var(--tx-chart-tooltip-border-color);border-radius:var(--tx-chart-tooltip-border-radius);background:var(--tx-chart-tooltip-background);filter:var(--tx-chart-tooltip-shadow);color:var(--tx-chart-tooltip-color);font-family:var(--tx-chart-font-family);font-size:var(--tx-chart-tooltip-font-size);line-height:1.35}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow{position:absolute;display:block;width:calc(var(--tx-chart-tooltip-arrow-size) * 2);height:var(--tx-chart-tooltip-arrow-size);overflow:visible}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow-fill{fill:var(--tx-chart-tooltip-background)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow-line{fill:none;stroke:var(--tx-chart-tooltip-border-color);stroke-width:var(--tx-chart-tooltip-border-width);stroke-linejoin:round;vector-effect:non-scaling-stroke}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-title{margin-bottom:2px;color:var(--tx-chart-tooltip-muted-color);font-size:var(--tx-chart-tooltip-title-font-size);font-weight:var(--tx-chart-tooltip-title-font-weight)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row{gap:var(--tx-chart-tooltip-marker-gap)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-note{margin-top:2px;color:var(--tx-chart-tooltip-note-color);font-size:var(--tx-chart-tooltip-title-font-size)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-marker{flex-shrink:0;width:var(--tx-chart-tooltip-marker-size);height:var(--tx-chart-tooltip-marker-size);border-radius:var(--tx-radius-full)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-muted-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row--active .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-share{min-width:4ch;color:var(--tx-chart-tooltip-muted-color);font-variant-numeric:tabular-nums;text-align:end}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-value{margin-inline-start:auto;padding-inline-start:var(--tx-chart-tooltip-value-gap);font-weight:var(--tx-chart-tooltip-value-font-weight);font-variant-numeric:tabular-nums}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-total{margin-top:2px;padding-top:calc(var(--tx-chart-tooltip-row-gap) + 2px);border-top:1px solid var(--tx-chart-tooltip-total-border-color)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{left:clamp(var(--tx-chart-tooltip-border-radius) + var(--tx-chart-tooltip-arrow-size),var(--tx-chart-tooltip-arrow-offset),100% - var(--tx-chart-tooltip-border-radius) - var(--tx-chart-tooltip-arrow-size));margin-left:calc(var(--tx-chart-tooltip-arrow-size) * -1)}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{top:clamp(var(--tx-chart-tooltip-border-radius) + var(--tx-chart-tooltip-arrow-size) / 2,var(--tx-chart-tooltip-arrow-offset),100% - var(--tx-chart-tooltip-border-radius) - var(--tx-chart-tooltip-arrow-size) / 2);margin-top:calc(var(--tx-chart-tooltip-arrow-size) / -2)}.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{top:calc(var(--tx-chart-tooltip-arrow-size) * -1)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow{bottom:calc(var(--tx-chart-tooltip-arrow-size) * -1);transform:rotate(180deg)}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow{right:calc(var(--tx-chart-tooltip-arrow-size) * -1.5);transform:rotate(90deg)}.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{left:calc(var(--tx-chart-tooltip-arrow-size) * -1.5);transform:rotate(-90deg)}\n"]
3262
+ }]
3263
+ }],
3264
+ ctorParameters: () => [],
3265
+ propDecorators: {
3266
+ height: [{
3267
+ type: i0.Input,
3268
+ args: [{
3269
+ isSignal: true,
3270
+ alias: "height",
3271
+ required: false
3272
+ }]
3273
+ }],
3274
+ size: [{
3275
+ type: i0.Input,
3276
+ args: [{
3277
+ isSignal: true,
3278
+ alias: "size",
3279
+ required: false
3280
+ }]
3281
+ }, {
3282
+ type: i0.Output,
3283
+ args: ["sizeChange"]
3284
+ }],
3285
+ legendItems: [{
3286
+ type: i0.Input,
3287
+ args: [{
3288
+ isSignal: true,
3289
+ alias: "legendItems",
3290
+ required: false
3291
+ }]
3292
+ }],
3293
+ showLegend: [{
3294
+ type: i0.Input,
3295
+ args: [{
3296
+ isSignal: true,
3297
+ alias: "showLegend",
3298
+ required: false
3299
+ }]
3300
+ }],
3301
+ legendPosition: [{
3302
+ type: i0.Input,
3303
+ args: [{
3304
+ isSignal: true,
3305
+ alias: "legendPosition",
3306
+ required: false
3307
+ }]
3308
+ }],
3309
+ legendAlign: [{
3310
+ type: i0.Input,
3311
+ args: [{
3312
+ isSignal: true,
3313
+ alias: "legendAlign",
3314
+ required: false
3315
+ }]
3316
+ }],
3317
+ legendVariant: [{
3318
+ type: i0.Input,
3319
+ args: [{
3320
+ isSignal: true,
3321
+ alias: "legendVariant",
3322
+ required: false
3323
+ }]
3324
+ }],
3325
+ legendToggle: [{
3326
+ type: i0.Input,
3327
+ args: [{
3328
+ isSignal: true,
3329
+ alias: "legendToggle",
3330
+ required: false
3331
+ }]
3332
+ }],
3333
+ legendTemplate: [{
3334
+ type: i0.Input,
3335
+ args: [{
3336
+ isSignal: true,
3337
+ alias: "legendTemplate",
3338
+ required: false
3339
+ }]
3340
+ }],
3341
+ empty: [{
3342
+ type: i0.Input,
3343
+ args: [{
3344
+ isSignal: true,
3345
+ alias: "empty",
3346
+ required: false
3347
+ }]
3348
+ }],
3349
+ loading: [{
3350
+ type: i0.Input,
3351
+ args: [{
3352
+ isSignal: true,
3353
+ alias: "loading",
3354
+ required: false
3355
+ }]
3356
+ }],
3357
+ emptyIcon: [{
3358
+ type: i0.Input,
3359
+ args: [{
3360
+ isSignal: true,
3361
+ alias: "emptyIcon",
3362
+ required: false
3363
+ }]
3364
+ }],
3365
+ summary: [{
3366
+ type: i0.Input,
3367
+ args: [{
3368
+ isSignal: true,
3369
+ alias: "summary",
3370
+ required: false
3371
+ }]
3372
+ }],
3373
+ table: [{
3374
+ type: i0.Input,
3375
+ args: [{
3376
+ isSignal: true,
3377
+ alias: "table",
3378
+ required: false
3379
+ }]
3380
+ }],
3381
+ tooltip: [{
3382
+ type: i0.Input,
3383
+ args: [{
3384
+ isSignal: true,
3385
+ alias: "tooltip",
3386
+ required: false
3387
+ }]
3388
+ }],
3389
+ tooltipTemplate: [{
3390
+ type: i0.Input,
3391
+ args: [{
3392
+ isSignal: true,
3393
+ alias: "tooltipTemplate",
3394
+ required: false
3395
+ }]
3396
+ }],
3397
+ tooltipPlacement: [{
3398
+ type: i0.Input,
3399
+ args: [{
3400
+ isSignal: true,
3401
+ alias: "tooltipPlacement",
3402
+ required: false
3403
+ }]
3404
+ }],
3405
+ panelStyle: [{
3406
+ type: i0.Input,
3407
+ args: [{
3408
+ isSignal: true,
3409
+ alias: "panelStyle",
3410
+ required: false
3411
+ }]
3412
+ }],
3413
+ parts: [{
3414
+ type: i0.Input,
3415
+ args: [{
3416
+ isSignal: true,
3417
+ alias: "parts",
3418
+ required: false
3419
+ }]
3420
+ }],
3421
+ styled: [{
3422
+ type: i0.Input,
3423
+ args: [{
3424
+ isSignal: true,
3425
+ alias: "styled",
3426
+ required: false
3427
+ }]
3428
+ }],
3429
+ interactive: [{
3430
+ type: i0.Input,
3431
+ args: [{
3432
+ isSignal: true,
3433
+ alias: "interactive",
3434
+ required: false
3435
+ }]
3436
+ }],
3437
+ actionKeys: [{
3438
+ type: i0.Input,
3439
+ args: [{
3440
+ isSignal: true,
3441
+ alias: "actionKeys",
3442
+ required: false
3443
+ }]
3444
+ }],
3445
+ zoomable: [{
3446
+ type: i0.Input,
3447
+ args: [{
3448
+ isSignal: true,
3449
+ alias: "zoomable",
3450
+ required: false
3451
+ }]
3452
+ }],
3453
+ zoomedIn: [{
3454
+ type: i0.Input,
3455
+ args: [{
3456
+ isSignal: true,
3457
+ alias: "zoomedIn",
3458
+ required: false
3459
+ }]
3460
+ }],
3461
+ plotHeight: [{
3462
+ type: i0.Input,
3463
+ args: [{
3464
+ isSignal: true,
3465
+ alias: "plotHeight",
3466
+ required: false
3467
+ }]
3468
+ }],
3469
+ toolbar: [{
3470
+ type: i0.Input,
3471
+ args: [{
3472
+ isSignal: true,
3473
+ alias: "toolbar",
3474
+ required: false
3475
+ }]
3476
+ }],
3477
+ exportName: [{
3478
+ type: i0.Input,
3479
+ args: [{
3480
+ isSignal: true,
3481
+ alias: "exportName",
3482
+ required: false
3483
+ }]
3484
+ }],
3485
+ pointer: [{
3486
+ type: i0.Output,
3487
+ args: ["pointer"]
3488
+ }],
3489
+ navigate: [{
3490
+ type: i0.Output,
3491
+ args: ["navigate"]
3492
+ }],
3493
+ legendToggled: [{
3494
+ type: i0.Output,
3495
+ args: ["legendToggled"]
3496
+ }],
3497
+ legendHovered: [{
3498
+ type: i0.Output,
3499
+ args: ["legendHovered"]
3500
+ }],
3501
+ tooltipClosed: [{
3502
+ type: i0.Output,
3503
+ args: ["tooltipClosed"]
3504
+ }],
3505
+ zoomed: [{
3506
+ type: i0.Output,
3507
+ args: ["zoomed"]
3508
+ }],
3509
+ panned: [{
3510
+ type: i0.Output,
3511
+ args: ["panned"]
3512
+ }],
3513
+ zoomReset: [{
3514
+ type: i0.Output,
3515
+ args: ["zoomReset"]
3516
+ }],
3517
+ plotRef: [{
3518
+ type: i0.ViewChild,
3519
+ args: ["plot", { isSignal: true }]
3520
+ }],
3521
+ anchorRef: [{
3522
+ type: i0.ViewChild,
3523
+ args: ["anchor", { isSignal: true }]
3524
+ }],
3525
+ svgRef: [{
3526
+ type: i0.ViewChild,
3527
+ args: ["chartSvg", { isSignal: true }]
3528
+ }],
3529
+ tooltipPanel: [{
3530
+ type: i0.ViewChild,
3531
+ args: ["tooltipPanel", { isSignal: true }]
3532
+ }]
3533
+ }
3534
+ });
3535
+ function followsPointer(event) {
3536
+ return "pointerType" in event && (event.pointerType === "mouse" || event.pointerType === "pen");
3537
+ }
3538
+ function isPointList(data) {
3539
+ return data.length > 0 && typeof data[0] === "object" && data[0] !== null;
3540
+ }
3541
+ function numeric(value) {
3542
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
3543
+ }
3544
+ function xValue(x, type) {
3545
+ if (type === "time") return toTime(x);
3546
+ const value = typeof x === "number" ? x : Number(x);
3547
+ return Number.isFinite(value) ? value : null;
3548
+ }
3549
+ function normalizeSeries(series, categories = [], type = "category") {
3550
+ const pointMode = series.some((item) => isPointList(item.data));
3551
+ if (type === "category") {
3552
+ if (!pointMode) {
3553
+ const length = Math.max(categories.length, ...series.map((item) => item.data.length), 0);
3554
+ return {
3555
+ labels: Array.from({ length }, (_, index) => categories[index] !== void 0 ? String(categories[index]) : String(index + 1)),
3556
+ xs: Array.from({ length }, (_, index) => index),
3557
+ values: series.map((item) => Array.from({ length }, (_, index) => numeric(item.data[index])))
3558
+ };
3559
+ }
3560
+ const labels = [];
3561
+ const seen = /* @__PURE__ */ new Map();
3562
+ series.forEach((item) => item.data.forEach((point) => {
3563
+ const key = String(point.x);
3564
+ if (!seen.has(key)) {
3565
+ seen.set(key, labels.length);
3566
+ labels.push(key);
3567
+ }
3568
+ }));
3569
+ return {
3570
+ labels,
3571
+ xs: labels.map((_, index) => index),
3572
+ values: series.map((item) => {
3573
+ const row = new Array(labels.length).fill(null);
3574
+ item.data.forEach((point) => row[seen.get(String(point.x)) ?? 0] = numeric(point.y));
3575
+ return row;
3576
+ })
3577
+ };
3578
+ }
3579
+ if (!pointMode) {
3580
+ const order = categories.map((category) => xValue(category, type)).map((x, index) => ({
3581
+ x,
3582
+ index
3583
+ })).filter((entry) => entry.x !== null);
3584
+ order.sort((a, b) => a.x - b.x);
3585
+ return {
3586
+ labels: order.map((entry) => String(categories[entry.index])),
3587
+ xs: order.map((entry) => entry.x),
3588
+ values: series.map((item) => order.map((entry) => numeric(item.data[entry.index])))
3589
+ };
3590
+ }
3591
+ const all = /* @__PURE__ */ new Set();
3592
+ const parsed = series.map((item) => item.data.map((point) => ({
3593
+ x: xValue(point.x, type),
3594
+ y: numeric(point.y)
3595
+ })).filter((point) => point.x !== null));
3596
+ parsed.forEach((points) => points.forEach((point) => all.add(point.x)));
3597
+ const xs = [...all].sort((a, b) => a - b);
3598
+ const position = new Map(xs.map((x, index) => [x, index]));
3599
+ return {
3600
+ labels: xs.map(String),
3601
+ xs,
3602
+ values: parsed.map((points) => {
3603
+ const row = new Array(xs.length).fill(null);
3604
+ points.forEach((point) => row[position.get(point.x) ?? 0] = point.y);
3605
+ return row;
3606
+ })
3607
+ };
3608
+ }
3609
+ function hasChartData(values) {
3610
+ return values.some((row) => row.some((value) => value !== null));
3611
+ }
3612
+ function chartSummary(translations, intl, type, seriesCount, pointCount, range) {
3613
+ const head = formatMessage(translations.chartSummary, {
3614
+ type,
3615
+ series: seriesCount,
3616
+ points: pointCount
3617
+ }, intl);
3618
+ return range ? `${head}, ${formatMessage(translations.chartRange, {
3619
+ min: range[0],
3620
+ max: range[1]
3621
+ }, intl)}` : head;
3622
+ }
3623
+ const TX_CHART_TABLE_ROWS = 250;
3624
+ function tableRows(count, limit = 250) {
3625
+ if (count <= limit) return Array.from({ length: count }, (_, index) => index);
3626
+ const step = (count - 1) / (limit - 1);
3627
+ return Array.from({ length: limit }, (_, index) => Math.round(index * step));
3628
+ }
3629
+ function chartTable(labels, series, format, limit = 250) {
3630
+ return {
3631
+ columns: series.map((item, index) => ({
3632
+ key: `${index}`,
3633
+ label: item.name
3634
+ })),
3635
+ rows: tableRows(labels.length, limit).map((index) => ({
3636
+ label: labels[index],
3637
+ cells: series.map((item, seriesIndex) => {
3638
+ const value = item.values[index];
3639
+ return value === null || value === void 0 ? "—" : format(value, seriesIndex);
3640
+ })
3641
+ }))
3642
+ };
3643
+ }
3644
+ function toggleKey(keys, key) {
3645
+ const next = new Set(keys);
3646
+ if (next.has(key)) next.delete(key);
3647
+ else next.add(key);
3648
+ return next;
3649
+ }
3650
+ function stepIndex(key, index, count, forward = "ArrowRight", back = "ArrowLeft") {
3651
+ if (count <= 0) return -1;
3652
+ if (key === "Home") return 0;
3653
+ if (key === "End") return count - 1;
3654
+ if (index < 0) return key === back ? count - 1 : 0;
3655
+ if (key === forward) return Math.min(count - 1, index + 1);
3656
+ if (key === back) return Math.max(0, index - 1);
3657
+ return index;
3658
+ }
3659
+ function cycleIndex(index, step, allowed) {
3660
+ if (!allowed.length) return -1;
3661
+ const at = allowed.indexOf(index);
3662
+ if (at < 0) return allowed[0];
3663
+ return allowed[(at + step + allowed.length) % allowed.length];
3664
+ }
3665
+ function readTokenNumber(element, name, fallback) {
3666
+ const view = element?.ownerDocument?.defaultView;
3667
+ if (!element || !view) return fallback;
3668
+ return parseRatio(view.getComputedStyle(element).getPropertyValue(name).trim(), fallback);
3669
+ }
3670
+ function parseRatio(raw, fallback) {
3671
+ if (typeof raw === "number") return Number.isFinite(raw) ? raw : fallback;
3672
+ if (!raw) return fallback;
3673
+ const value = Number.parseFloat(raw);
3674
+ if (!Number.isFinite(value)) return fallback;
3675
+ return raw.trim().endsWith("%") ? value / 100 : value;
3676
+ }
3677
+ export { TX_CHART_ENTER_MS, TX_CHART_FALLBACK_HEIGHT, TX_CHART_FALLBACK_WIDTH, TX_CHART_LEGEND_ROW, TX_CHART_LEGEND_SIDE, TX_CHART_PALETTE_SIZE, TX_CHART_TABLE_ROWS, TX_FULL_CIRCLE, TX_TIME_INTERVALS, TxChartAnnotations, TxChartAxes, TxChartFrame, TxChartHoverBand, TxChartLegend, TxChartLegendTemplate, TxChartMenu, TxChartTooltipTemplate, addTime, alignedDomain, angleFrom, arcBounds, arcPath, arcSpan, areaPath, bandScale, cartesianLayout, chartAnnotationShapes, chartBandRect, chartBoxHeight, chartCategoryIndex, chartColor, chartCsv, chartFileName, chartHeightValue, chartMonthNames, chartNumberFormatter, chartPalette, chartPngBlob, chartSummary, chartSvgSize, chartSvgString, chartTable, compactNumber, cycleIndex, dateFormat, decimalsOf, decimateSeries, downloadChartFile, extent, fitArc, floorTime, hasChartData, initialChartSize, injectChartEntrance, largestTriangleThreeBuckets, linePath, linearScale, linearTicks, logDomain, logScale, logTicks, maxCornerRadius, monotoneTangents, niceDomain, normalizeSeries, numberFormat, parseRatio, pointScale, polar, prefersReducedMotion, readTokenNumber, seriesColor, splitGaps, stackExtent, stackValues, stepIndex, strokeArc, tableRows, textWidth, tickFormatter, tickStep, timeInterval, timeScale, timeTickFormatter, timeTickOptions, timeTicks, timeTooltipFormatter, toRadians, toTime, toggleKey, topOfStack, truncateText };
3678
+
3679
+ //# sourceMappingURL=tectra-ng-charts-core.mjs.map