@stealthscale/component-charts 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/cyclonedx/bom.json +1 -1
  2. package/dist/index.js +1 -14710
  3. package/dist/pages/area-chart/area-chart.js +1151 -0
  4. package/dist/pages/area-chart/area-chart.props.js +3 -0
  5. package/dist/pages/bar-chart/bar-chart.js +990 -0
  6. package/dist/pages/bar-chart/bar-chart.props.js +3 -0
  7. package/dist/pages/box-plot/box-plot.js +1585 -0
  8. package/dist/pages/box-plot/box-plot.props.js +3 -0
  9. package/dist/pages/bubble-chart/bubble-chart.js +938 -0
  10. package/dist/pages/bubble-chart/bubble-chart.props.js +3 -0
  11. package/dist/pages/burndown-chart/burndown-chart.js +805 -0
  12. package/dist/pages/burndown-chart/burndown-chart.props.js +3 -0
  13. package/dist/pages/candlestick-chart/candlestick-chart.js +853 -0
  14. package/dist/pages/candlestick-chart/candlestick-chart.props.js +3 -0
  15. package/dist/pages/chart/chart.js +1190 -0
  16. package/dist/pages/chart/chart.props.js +3 -0
  17. package/dist/pages/chord-diagram/chord-diagram.js +891 -0
  18. package/dist/pages/chord-diagram/chord-diagram.props.js +3 -0
  19. package/dist/pages/combo-chart/combo-chart.js +873 -0
  20. package/dist/pages/combo-chart/combo-chart.props.js +3 -0
  21. package/dist/pages/distribution-chart/distribution-chart.js +1066 -0
  22. package/dist/pages/distribution-chart/distribution-chart.props.js +3 -0
  23. package/dist/pages/donut-chart/donut-chart.js +726 -0
  24. package/dist/pages/donut-chart/donut-chart.props.js +3 -0
  25. package/dist/pages/funnel-chart/funnel-chart.js +1094 -0
  26. package/dist/pages/funnel-chart/funnel-chart.props.js +3 -0
  27. package/dist/pages/gauge-chart/gauge-chart.js +767 -0
  28. package/dist/pages/gauge-chart/gauge-chart.props.js +3 -0
  29. package/dist/pages/heatmap/heatmap.js +1967 -0
  30. package/dist/pages/heatmap/heatmap.props.js +3 -0
  31. package/dist/pages/histogram-chart/histogram-chart.js +768 -0
  32. package/dist/pages/histogram-chart/histogram-chart.props.js +3 -0
  33. package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.js +701 -0
  34. package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.props.js +3 -0
  35. package/dist/pages/line-chart/line-chart.js +1882 -0
  36. package/dist/pages/line-chart/line-chart.props.js +3 -0
  37. package/dist/pages/pages.json +393 -0
  38. package/dist/pages/pareto-chart/pareto-chart.js +669 -0
  39. package/dist/pages/pareto-chart/pareto-chart.props.js +3 -0
  40. package/dist/pages/percent-stacked-bar/percent-stacked-bar.js +662 -0
  41. package/dist/pages/percent-stacked-bar/percent-stacked-bar.props.js +3 -0
  42. package/dist/pages/pie-chart/pie-chart.js +1007 -0
  43. package/dist/pages/pie-chart/pie-chart.props.js +3 -0
  44. package/dist/pages/polar-area-chart/polar-area-chart.js +812 -0
  45. package/dist/pages/polar-area-chart/polar-area-chart.props.js +3 -0
  46. package/dist/pages/radar-chart/radar-chart.js +1101 -0
  47. package/dist/pages/radar-chart/radar-chart.props.js +3 -0
  48. package/dist/pages/radial-bar-chart/radial-bar-chart.js +766 -0
  49. package/dist/pages/radial-bar-chart/radial-bar-chart.props.js +3 -0
  50. package/dist/pages/range-chart/range-chart.js +914 -0
  51. package/dist/pages/range-chart/range-chart.props.js +3 -0
  52. package/dist/pages/regression-overlay/regression-overlay.js +494 -0
  53. package/dist/pages/regression-overlay/regression-overlay.props.js +3 -0
  54. package/dist/pages/sankey-chart/sankey-chart.js +700 -0
  55. package/dist/pages/sankey-chart/sankey-chart.props.js +3 -0
  56. package/dist/pages/scatter-plot/scatter-plot.js +1248 -0
  57. package/dist/pages/scatter-plot/scatter-plot.props.js +3 -0
  58. package/dist/pages/sparkbar/sparkbar.js +629 -0
  59. package/dist/pages/sparkbar/sparkbar.props.js +3 -0
  60. package/dist/pages/sparkline/sparkline.js +960 -0
  61. package/dist/pages/sparkline/sparkline.props.js +3 -0
  62. package/dist/pages/spend-5xQ76WSj.js +185 -0
  63. package/dist/pages/stacked-area-chart/stacked-area-chart.js +912 -0
  64. package/dist/pages/stacked-area-chart/stacked-area-chart.props.js +3 -0
  65. package/dist/pages/stacked-bar-chart/stacked-bar-chart.js +722 -0
  66. package/dist/pages/stacked-bar-chart/stacked-bar-chart.props.js +3 -0
  67. package/dist/pages/step-line-chart/step-line-chart.js +573 -0
  68. package/dist/pages/step-line-chart/step-line-chart.props.js +3 -0
  69. package/dist/pages/stream-graph/stream-graph.js +1662 -0
  70. package/dist/pages/stream-graph/stream-graph.props.js +3 -0
  71. package/dist/pages/sunburst-chart/sunburst-chart.js +1051 -0
  72. package/dist/pages/sunburst-chart/sunburst-chart.props.js +3 -0
  73. package/dist/pages/timeline-chart/timeline-chart.js +1124 -0
  74. package/dist/pages/timeline-chart/timeline-chart.props.js +3 -0
  75. package/dist/pages/treemap-chart/treemap-chart.js +904 -0
  76. package/dist/pages/treemap-chart/treemap-chart.props.js +3 -0
  77. package/dist/pages/violin-plot/violin-plot.js +1303 -0
  78. package/dist/pages/violin-plot/violin-plot.props.js +3 -0
  79. package/dist/pages/visitors-oFFVcbIZ.js +248 -0
  80. package/dist/pages/waterfall-chart/waterfall-chart.js +1195 -0
  81. package/dist/pages/waterfall-chart/waterfall-chart.props.js +3 -0
  82. package/dist/shared-DVZJ2nST.js +14711 -0
  83. package/dist/theme.js +1 -1
  84. package/locales/en/specimen/area-chart.json +56 -0
  85. package/locales/en/specimen/bar-chart.json +56 -0
  86. package/locales/en/specimen/box-plot.json +65 -0
  87. package/locales/en/specimen/bubble-chart.json +47 -0
  88. package/locales/en/specimen/burndown-chart.json +46 -0
  89. package/locales/en/specimen/candlestick-chart.json +42 -0
  90. package/locales/en/specimen/chart.json +53 -0
  91. package/locales/en/specimen/chord-diagram.json +69 -0
  92. package/locales/en/specimen/combo-chart.json +41 -0
  93. package/locales/en/specimen/distribution-chart.json +47 -0
  94. package/locales/en/specimen/donut-chart.json +63 -0
  95. package/locales/en/specimen/funnel-chart.json +84 -0
  96. package/locales/en/specimen/gauge-chart.json +68 -0
  97. package/locales/en/specimen/heatmap.json +187 -0
  98. package/locales/en/specimen/histogram-chart.json +48 -0
  99. package/locales/en/specimen/horizontal-bar-chart.json +54 -0
  100. package/locales/en/specimen/line-chart.json +106 -0
  101. package/locales/en/specimen/pareto-chart.json +43 -0
  102. package/locales/en/specimen/percent-stacked-bar.json +37 -0
  103. package/locales/en/specimen/pie-chart.json +80 -0
  104. package/locales/en/specimen/polar-area-chart.json +90 -0
  105. package/locales/en/specimen/radar-chart.json +82 -0
  106. package/locales/en/specimen/radial-bar-chart.json +62 -0
  107. package/locales/en/specimen/range-chart.json +42 -0
  108. package/locales/en/specimen/regression-overlay.json +36 -0
  109. package/locales/en/specimen/sankey-chart.json +89 -0
  110. package/locales/en/specimen/scatter-plot.json +88 -0
  111. package/locales/en/specimen/sparkbar.json +51 -0
  112. package/locales/en/specimen/sparkline.json +70 -0
  113. package/locales/en/specimen/stacked-area-chart.json +44 -0
  114. package/locales/en/specimen/stacked-bar-chart.json +34 -0
  115. package/locales/en/specimen/step-line-chart.json +33 -0
  116. package/locales/en/specimen/stream-graph.json +54 -0
  117. package/locales/en/specimen/sunburst-chart.json +110 -0
  118. package/locales/en/specimen/timeline-chart.json +77 -0
  119. package/locales/en/specimen/treemap-chart.json +107 -0
  120. package/locales/en/specimen/violin-plot.json +54 -0
  121. package/locales/en/specimen/waterfall-chart.json +71 -0
  122. package/package.json +8 -7
  123. /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
@@ -0,0 +1,1967 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { $ as cohortCells, L as Heatmap, R as calendarCells, z as heatmapDomain } from "../../shared-DVZJ2nST.js";
3
+ import { u as recipe } from "../../recipes-BbGw00ut.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
8
+ import { Stack } from "@stealthscale/component-layout";
9
+ import { Heading, Text } from "@stealthscale/component-typography";
10
+ //#region src/heatmap/examples/readings.ts
11
+ /**
12
+ * Keys of the days of the week, Monday first.
13
+ */
14
+ const WEEKDAYS = [
15
+ "mon",
16
+ "tue",
17
+ "wed",
18
+ "thu",
19
+ "fri",
20
+ "sat",
21
+ "sun"
22
+ ];
23
+ /**
24
+ * Keys of the working days, Monday to Friday.
25
+ */
26
+ const WORKDAYS = WEEKDAYS.slice(0, 5);
27
+ /**
28
+ * Keys of the trading hours, from 08 to 19.
29
+ */
30
+ const TRADING_HOURS = Array.from({ length: 12 }, (_, at) => String(at + 8).padStart(2, "0"));
31
+ /**
32
+ * Returns the headings of hours from their keys, each written as the hour on the clock, such as
33
+ * "17:00" for "17".
34
+ *
35
+ * @param keys - The hours' two-digit keys, in order.
36
+ */
37
+ function hoursOf(keys) {
38
+ return keys.map((key) => ({
39
+ key,
40
+ label: `${key}:00`
41
+ }));
42
+ }
43
+ /**
44
+ * Returns readings from a row of values per row key, in the columns' order. A short row leaves the
45
+ * rest of its cells missing.
46
+ *
47
+ * @param columns - The columns' keys, in order.
48
+ * @param rows - Each row's key with its values.
49
+ */
50
+ function gridOf(columns, rows) {
51
+ return rows.flatMap(([row, values]) => columns.map((column, at) => ({
52
+ column,
53
+ row,
54
+ value: values[at] ?? null
55
+ })));
56
+ }
57
+ /**
58
+ * Lists a week of card authorisations per hour: a lunchtime peak, a larger evening peak at 17:00,
59
+ * and a weekend at 40% of a working day. Tuesday at 17:00 is the busiest hour, with 405.
60
+ */
61
+ const AUTHORISATIONS = WEEKDAYS.flatMap((row, day) => TRADING_HOURS.map((column, hour) => {
62
+ const lunchtime = Math.max(0, 9 - Math.abs(hour - 4) * 3);
63
+ const evening = Math.max(0, 11 - Math.abs(hour - 9) * 2);
64
+ const weekend = day > 4 ? .4 : 1;
65
+ return {
66
+ column,
67
+ row,
68
+ value: Math.round(((lunchtime + evening) * weekend + (day * 7 + hour * 3) % 5) * 27)
69
+ };
70
+ }));
71
+ /**
72
+ * Keys of the wards.
73
+ */
74
+ const WARDS = [
75
+ "cardiology",
76
+ "neurology",
77
+ "oncology",
78
+ "paediatrics",
79
+ "respiratory"
80
+ ];
81
+ /**
82
+ * Lists the beds occupied per ward on the working days of one week. The oncology feed was down all
83
+ * week and nobody counted paediatrics on Wednesday: six readings are missing, beside real counts
84
+ * as low as 8.
85
+ */
86
+ const OCCUPANCY = gridOf(WORKDAYS, [
87
+ ["cardiology", [
88
+ 22,
89
+ 24,
90
+ 23,
91
+ 26,
92
+ 21
93
+ ]],
94
+ ["neurology", [
95
+ 14,
96
+ 12,
97
+ 15,
98
+ 17,
99
+ 13
100
+ ]],
101
+ ["oncology", [
102
+ null,
103
+ null,
104
+ null,
105
+ null,
106
+ null
107
+ ]],
108
+ ["paediatrics", [
109
+ 9,
110
+ 11,
111
+ null,
112
+ 12,
113
+ 8
114
+ ]],
115
+ ["respiratory", [
116
+ 18,
117
+ 19,
118
+ 21,
119
+ 24,
120
+ 20
121
+ ]]
122
+ ]);
123
+ /**
124
+ * Lists the build minutes per pipeline on the working days of one week. Friday is when everyone
125
+ * merges: payments-web builds for 388 minutes then.
126
+ */
127
+ const BUILD_MINUTES = gridOf(WORKDAYS, [
128
+ ["checkout-api", [
129
+ 128,
130
+ 143,
131
+ 96,
132
+ 212,
133
+ 341
134
+ ]],
135
+ ["ledger-worker", [
136
+ 64,
137
+ 71,
138
+ 58,
139
+ 88,
140
+ 154
141
+ ]],
142
+ ["payments-web", [
143
+ 186,
144
+ 174,
145
+ 203,
146
+ 241,
147
+ 388
148
+ ]],
149
+ ["risk-engine", [
150
+ 42,
151
+ 55,
152
+ 37,
153
+ 61,
154
+ 119
155
+ ]]
156
+ ]);
157
+ /**
158
+ * Keys of the depots.
159
+ */
160
+ const DEPOTS = [
161
+ "antwerpen",
162
+ "duisburg",
163
+ "rotterdam"
164
+ ];
165
+ /**
166
+ * Keys of the depots' hours, every second hour from 06 to 16.
167
+ */
168
+ const DEPOT_HOURS = [
169
+ "06",
170
+ "08",
171
+ "10",
172
+ "12",
173
+ "14",
174
+ "16"
175
+ ];
176
+ /**
177
+ * Lists the parcels scanned per depot and hour this week: from 590 to 1,940.
178
+ */
179
+ const SCANS_THIS_WEEK = gridOf(DEPOT_HOURS, [
180
+ ["antwerpen", [
181
+ 980,
182
+ 1420,
183
+ 1610,
184
+ 1290,
185
+ 940,
186
+ 720
187
+ ]],
188
+ ["duisburg", [
189
+ 760,
190
+ 1120,
191
+ 1380,
192
+ 1040,
193
+ 810,
194
+ 590
195
+ ]],
196
+ ["rotterdam", [
197
+ 1240,
198
+ 1810,
199
+ 1940,
200
+ 1520,
201
+ 1180,
202
+ 860
203
+ ]]
204
+ ]);
205
+ /**
206
+ * Lists the parcels scanned per depot and hour last week: the same shape at about half the volume,
207
+ * from 320 to 1,060.
208
+ */
209
+ const SCANS_LAST_WEEK = gridOf(DEPOT_HOURS, [
210
+ ["antwerpen", [
211
+ 540,
212
+ 790,
213
+ 880,
214
+ 700,
215
+ 510,
216
+ 390
217
+ ]],
218
+ ["duisburg", [
219
+ 410,
220
+ 620,
221
+ 750,
222
+ 570,
223
+ 440,
224
+ 320
225
+ ]],
226
+ ["rotterdam", [
227
+ 690,
228
+ 980,
229
+ 1060,
230
+ 840,
231
+ 650,
232
+ 470
233
+ ]]
234
+ ]);
235
+ /**
236
+ * Keys of the teams.
237
+ */
238
+ const TEAMS = [
239
+ "customer-success",
240
+ "data-platform",
241
+ "design",
242
+ "payments",
243
+ "security"
244
+ ];
245
+ /**
246
+ * Keys of the quarters.
247
+ */
248
+ const QUARTERS = [
249
+ "q1",
250
+ "q2",
251
+ "q3",
252
+ "q4"
253
+ ];
254
+ /**
255
+ * Lists the headcount against plan per team and quarter: payments at 9 under plan in Q2 is the
256
+ * furthest under, security at 11 over in Q4 the furthest over.
257
+ */
258
+ const HEADCOUNT_VARIANCE = gridOf(QUARTERS, [
259
+ ["customer-success", [
260
+ -3,
261
+ -1,
262
+ 2,
263
+ 4
264
+ ]],
265
+ ["data-platform", [
266
+ 1,
267
+ 3,
268
+ 6,
269
+ 9
270
+ ]],
271
+ ["design", [
272
+ 0,
273
+ -2,
274
+ -4,
275
+ -5
276
+ ]],
277
+ ["payments", [
278
+ -6,
279
+ -9,
280
+ -4,
281
+ 1
282
+ ]],
283
+ ["security", [
284
+ 2,
285
+ 2,
286
+ 5,
287
+ 11
288
+ ]]
289
+ ]);
290
+ /**
291
+ * Keys of the hours of the morning checkout-api failed, from 09 to 14.
292
+ */
293
+ const INCIDENT_HOURS = [
294
+ "09",
295
+ "10",
296
+ "11",
297
+ "12",
298
+ "13",
299
+ "14"
300
+ ];
301
+ /**
302
+ * Lists the 5xx responses per service and hour the morning checkout-api failed: 512 at 12:00.
303
+ */
304
+ const ERRORS = gridOf(INCIDENT_HOURS, [
305
+ ["auth-gateway", [
306
+ 2,
307
+ 1,
308
+ 4,
309
+ 3,
310
+ 2,
311
+ 1
312
+ ]],
313
+ ["checkout-api", [
314
+ 6,
315
+ 9,
316
+ 148,
317
+ 512,
318
+ 96,
319
+ 12
320
+ ]],
321
+ ["ledger-worker", [
322
+ 0,
323
+ 0,
324
+ 2,
325
+ 34,
326
+ 8,
327
+ 1
328
+ ]],
329
+ ["search-index", [
330
+ 11,
331
+ 8,
332
+ 14,
333
+ 22,
334
+ 17,
335
+ 9
336
+ ]]
337
+ ]);
338
+ /**
339
+ * Keys of the teaching weeks, from 1 to 36.
340
+ */
341
+ const TERM_WEEKS = Array.from({ length: 36 }, (_, at) => String(at + 1));
342
+ /**
343
+ * Lists the share of pupils present per school day and teaching week, in percent: from 97% down to
344
+ * 82% at the bottom of a dip through the winter term, in weeks 15 and 16.
345
+ */
346
+ const ATTENDANCE = WORKDAYS.flatMap((row, day) => TERM_WEEKS.map((column, week) => ({
347
+ column,
348
+ row,
349
+ value: 97 - Math.max(0, 9 - Math.abs(week - 14)) - day - (week * 5 + day * 3) % 4
350
+ })));
351
+ //#endregion
352
+ //#region src/heatmap/examples/attendance.example.tsx
353
+ var attendance_example_exports = /* @__PURE__ */ __exportAll({
354
+ Attendance: () => Attendance,
355
+ source: () => source$16
356
+ });
357
+ function Attendance() {
358
+ const $ = c(20);
359
+ const { t } = useWords("heatmap");
360
+ let t0;
361
+ if ($[0] !== t) {
362
+ t0 = t("attendance.caption");
363
+ $[0] = t;
364
+ $[1] = t0;
365
+ } else t0 = $[1];
366
+ let t1;
367
+ if ($[2] !== t) {
368
+ t1 = TERM_WEEKS.map((key) => ({
369
+ key,
370
+ label: t("attendance.week", { week: key })
371
+ }));
372
+ $[2] = t;
373
+ $[3] = t1;
374
+ } else t1 = $[3];
375
+ let t2;
376
+ if ($[4] !== t) {
377
+ t2 = t("attendance.corner");
378
+ $[4] = t;
379
+ $[5] = t2;
380
+ } else t2 = $[5];
381
+ let t3;
382
+ if ($[6] !== t) {
383
+ t3 = t("attendance.label");
384
+ $[6] = t;
385
+ $[7] = t3;
386
+ } else t3 = $[7];
387
+ let t4;
388
+ if ($[8] !== t) {
389
+ t4 = WORKDAYS.map((key_0) => ({
390
+ key: key_0,
391
+ label: t(`days.${key_0}`)
392
+ }));
393
+ $[8] = t;
394
+ $[9] = t4;
395
+ } else t4 = $[9];
396
+ let t5;
397
+ if ($[10] !== t) {
398
+ t5 = t("attendance.value");
399
+ $[10] = t;
400
+ $[11] = t5;
401
+ } else t5 = $[11];
402
+ let t6;
403
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
404
+ t6 = {
405
+ style: "unit",
406
+ unit: "percent"
407
+ };
408
+ $[12] = t6;
409
+ } else t6 = $[12];
410
+ let t7;
411
+ if ($[13] !== t0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
412
+ t7 = /* @__PURE__ */ jsx(Heatmap, {
413
+ caption: t0,
414
+ cells: ATTENDANCE,
415
+ columns: t1,
416
+ corner: t2,
417
+ label: t3,
418
+ rows: t4,
419
+ size: "sm",
420
+ valueLabel: t5,
421
+ valueOptions: t6
422
+ });
423
+ $[13] = t0;
424
+ $[14] = t1;
425
+ $[15] = t2;
426
+ $[16] = t3;
427
+ $[17] = t4;
428
+ $[18] = t5;
429
+ $[19] = t7;
430
+ } else t7 = $[19];
431
+ return t7;
432
+ }
433
+ const source$16 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { ATTENDANCE, TERM_WEEKS, WORKDAYS } from \"./readings.ts\";\n\nexport function Attendance(): ReactElement {\n const { t } = useWords(\"heatmap\");\n\n return (\n <Heatmap\n caption={t(\"attendance.caption\")}\n cells={ATTENDANCE}\n columns={TERM_WEEKS.map((key) => ({ key, label: t(\"attendance.week\", { week: key }) }))}\n corner={t(\"attendance.corner\")}\n label={t(\"attendance.label\")}\n rows={WORKDAYS.map((key) => ({ key, label: t(`days.${key}`) }))}\n size=\"sm\"\n valueLabel={t(\"attendance.value\")}\n valueOptions={{ style: \"unit\", unit: \"percent\" }}\n />\n );\n}\n";
434
+ //#endregion
435
+ //#region src/heatmap/examples/authorisations.example.tsx
436
+ var authorisations_example_exports = /* @__PURE__ */ __exportAll({
437
+ Authorisations: () => Authorisations,
438
+ source: () => source$15
439
+ });
440
+ function Authorisations() {
441
+ const $ = c(19);
442
+ const { t } = useWords("heatmap");
443
+ let T0;
444
+ let t0;
445
+ if ($[0] !== t) {
446
+ const [busiest] = AUTHORISATIONS.toSorted(_temp$2);
447
+ T0 = Heatmap;
448
+ t0 = t("authorisations.caption", {
449
+ count: busiest?.value,
450
+ day: t(`days.${busiest?.row ?? ""}`),
451
+ hour: busiest?.column
452
+ });
453
+ $[0] = t;
454
+ $[1] = T0;
455
+ $[2] = t0;
456
+ } else {
457
+ T0 = $[1];
458
+ t0 = $[2];
459
+ }
460
+ let t1;
461
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
462
+ t1 = hoursOf(TRADING_HOURS);
463
+ $[3] = t1;
464
+ } else t1 = $[3];
465
+ let t2;
466
+ if ($[4] !== t) {
467
+ t2 = t("authorisations.corner");
468
+ $[4] = t;
469
+ $[5] = t2;
470
+ } else t2 = $[5];
471
+ let t3;
472
+ if ($[6] !== t) {
473
+ t3 = t("authorisations.label");
474
+ $[6] = t;
475
+ $[7] = t3;
476
+ } else t3 = $[7];
477
+ let t4;
478
+ if ($[8] !== t) {
479
+ t4 = WEEKDAYS.map((key) => ({
480
+ key,
481
+ label: t(`days.${key}`)
482
+ }));
483
+ $[8] = t;
484
+ $[9] = t4;
485
+ } else t4 = $[9];
486
+ let t5;
487
+ if ($[10] !== t) {
488
+ t5 = t("authorisations.value");
489
+ $[10] = t;
490
+ $[11] = t5;
491
+ } else t5 = $[11];
492
+ let t6;
493
+ if ($[12] !== T0 || $[13] !== t0 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5) {
494
+ t6 = /* @__PURE__ */ jsx(T0, {
495
+ caption: t0,
496
+ cells: AUTHORISATIONS,
497
+ columns: t1,
498
+ corner: t2,
499
+ label: t3,
500
+ rows: t4,
501
+ valueLabel: t5
502
+ });
503
+ $[12] = T0;
504
+ $[13] = t0;
505
+ $[14] = t2;
506
+ $[15] = t3;
507
+ $[16] = t4;
508
+ $[17] = t5;
509
+ $[18] = t6;
510
+ } else t6 = $[18];
511
+ return t6;
512
+ }
513
+ function _temp$2(first, second) {
514
+ return (second.value ?? 0) - (first.value ?? 0);
515
+ }
516
+ const source$15 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { AUTHORISATIONS, hoursOf, TRADING_HOURS, WEEKDAYS } from \"./readings.ts\";\n\nexport function Authorisations(): ReactElement {\n const { t } = useWords(\"heatmap\");\n const [busiest] = AUTHORISATIONS.toSorted(\n (first, second) => (second.value ?? 0) - (first.value ?? 0),\n );\n\n return (\n <Heatmap\n caption={t(\"authorisations.caption\", {\n count: busiest?.value,\n day: t(`days.${busiest?.row ?? \"\"}`),\n hour: busiest?.column,\n })}\n cells={AUTHORISATIONS}\n columns={hoursOf(TRADING_HOURS)}\n corner={t(\"authorisations.corner\")}\n label={t(\"authorisations.label\")}\n rows={WEEKDAYS.map((key) => ({ key, label: t(`days.${key}`) }))}\n valueLabel={t(\"authorisations.value\")}\n />\n );\n}\n";
517
+ //#endregion
518
+ //#region src/heatmap/examples/days.ts
519
+ /**
520
+ * Milliseconds in a day.
521
+ */
522
+ const DAY = 864e5;
523
+ /**
524
+ * Returns a reading per day from a civil date on, each valued from its weekday, 0 being Sunday,
525
+ * its place in the run and its date.
526
+ *
527
+ * @param from - The first day, written `YYYY-MM-DD`.
528
+ * @param count - The number of days.
529
+ * @param value - Returns a day's value from its weekday, its place and its date.
530
+ */
531
+ function daysOf(from, count, value) {
532
+ const start = Date.parse(`${from}T00:00:00Z`);
533
+ return Array.from({ length: count }, (_, at) => {
534
+ const day = new Date(start + at * DAY);
535
+ const date = day.toISOString().slice(0, 10);
536
+ return {
537
+ date,
538
+ value: value(day.getUTCDay(), at, date)
539
+ };
540
+ });
541
+ }
542
+ /**
543
+ * Returns whether a weekday, 0 being Sunday, is on a weekend.
544
+ */
545
+ function weekend(weekday) {
546
+ return weekday === 0 || weekday === 6;
547
+ }
548
+ /**
549
+ * Lists a year of deploys per day from 1 October 2025: none at weekends, one a day over the
550
+ * holidays, a release push in the week of 9 March, and no record from 9 to 22 February, when the
551
+ * collector was offline. The release week is the busiest, with 80 deploys.
552
+ */
553
+ const DEPLOYS = daysOf("2025-10-01", 365, (weekday, at, date) => {
554
+ if (date >= "2026-02-09" && date <= "2026-02-22") return null;
555
+ if (weekend(weekday)) return 0;
556
+ if (date >= "2025-12-22" && date <= "2026-01-02") return 1;
557
+ return 3 + at * 7 % 11 + (date >= "2026-03-09" && date <= "2026-03-13" ? 8 : 0);
558
+ });
559
+ /**
560
+ * Lists 13 weeks of on-call pages per day from Monday 5 January 2026: one to six on a working day,
561
+ * up to two at a weekend, and 14 during the incident on Tuesday 17 February.
562
+ */
563
+ const PAGES = daysOf("2026-01-05", 91, (weekday, at, date) => {
564
+ if (date === "2026-02-17") return 14;
565
+ return weekend(weekday) ? at % 3 : 1 + at * 5 % 6;
566
+ });
567
+ /**
568
+ * Lists a quarter of hotel rooms booked per night from 1 April 2026, of 84: 30 to 54 on a
569
+ * weeknight, 70 to 82 on a Friday or a Saturday, and all 84 over the conference from 12 to 14 May.
570
+ */
571
+ const BOOKINGS = daysOf("2026-04-01", 91, (weekday, at, date) => {
572
+ if (date >= "2026-05-12" && date <= "2026-05-14") return 84;
573
+ return weekday === 5 || weekday === 6 ? 70 + at * 3 % 13 : 30 + at * 7 % 25;
574
+ });
575
+ //#endregion
576
+ //#region src/heatmap/examples/bookings.example.tsx
577
+ var bookings_example_exports = /* @__PURE__ */ __exportAll({
578
+ Bookings: () => Bookings,
579
+ source: () => source$14
580
+ });
581
+ function Bookings() {
582
+ const $ = c(21);
583
+ const { i18n, t } = useWords("heatmap");
584
+ const [picked, setPicked] = useState();
585
+ let t0;
586
+ if ($[0] !== i18n.language) {
587
+ t0 = calendarCells(BOOKINGS, { locale: i18n.language });
588
+ $[0] = i18n.language;
589
+ $[1] = t0;
590
+ } else t0 = $[1];
591
+ let t1;
592
+ if ($[2] !== t) {
593
+ t1 = t("bookings.caption");
594
+ $[2] = t;
595
+ $[3] = t1;
596
+ } else t1 = $[3];
597
+ let t2;
598
+ if ($[4] !== t) {
599
+ t2 = t("bookings.label");
600
+ $[4] = t;
601
+ $[5] = t2;
602
+ } else t2 = $[5];
603
+ let t3;
604
+ if ($[6] !== t) {
605
+ t3 = t("bookings.value");
606
+ $[6] = t;
607
+ $[7] = t3;
608
+ } else t3 = $[7];
609
+ let t4;
610
+ if ($[8] !== t0 || $[9] !== t1 || $[10] !== t2 || $[11] !== t3) {
611
+ t4 = /* @__PURE__ */ jsx(Heatmap, {
612
+ ...t0,
613
+ caption: t1,
614
+ label: t2,
615
+ onSelect: setPicked,
616
+ size: "lg",
617
+ valueLabel: t3
618
+ });
619
+ $[8] = t0;
620
+ $[9] = t1;
621
+ $[10] = t2;
622
+ $[11] = t3;
623
+ $[12] = t4;
624
+ } else t4 = $[12];
625
+ let t5;
626
+ if ($[13] !== picked || $[14] !== t) {
627
+ t5 = picked === void 0 ? t("bookings.none") : t("bookings.picked", {
628
+ count: picked.value,
629
+ date: picked.label
630
+ });
631
+ $[13] = picked;
632
+ $[14] = t;
633
+ $[15] = t5;
634
+ } else t5 = $[15];
635
+ let t6;
636
+ if ($[16] !== t5) {
637
+ t6 = /* @__PURE__ */ jsx(Text, {
638
+ as: "output",
639
+ size: "sm",
640
+ tone: "muted",
641
+ children: t5
642
+ });
643
+ $[16] = t5;
644
+ $[17] = t6;
645
+ } else t6 = $[17];
646
+ let t7;
647
+ if ($[18] !== t4 || $[19] !== t6) {
648
+ t7 = /* @__PURE__ */ jsxs(Stack, { children: [t4, t6] });
649
+ $[18] = t4;
650
+ $[19] = t6;
651
+ $[20] = t7;
652
+ } else t7 = $[20];
653
+ return t7;
654
+ }
655
+ const source$14 = "import { type ReactElement, useState } from \"react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { CalendarCell, Heatmap, calendarCells } from \"@stealthscale/component-charts\";\n\nimport { BOOKINGS } from \"./days.ts\";\n\nexport function Bookings(): ReactElement {\n const { i18n, t } = useWords(\"heatmap\");\n const [picked, setPicked] = useState<CalendarCell>();\n\n return (\n <Stack>\n <Heatmap\n {...calendarCells(BOOKINGS, { locale: i18n.language })}\n caption={t(\"bookings.caption\")}\n label={t(\"bookings.label\")}\n onSelect={setPicked}\n size=\"lg\"\n valueLabel={t(\"bookings.value\")}\n />\n <Text as=\"output\" size=\"sm\" tone=\"muted\">\n {picked === undefined\n ? t(\"bookings.none\")\n : t(\"bookings.picked\", { count: picked.value, date: picked.label })}\n </Text>\n </Stack>\n );\n}\n";
656
+ //#endregion
657
+ //#region src/heatmap/examples/builds.example.tsx
658
+ var builds_example_exports = /* @__PURE__ */ __exportAll({
659
+ Builds: () => Builds,
660
+ source: () => source$13
661
+ });
662
+ function Builds() {
663
+ const $ = c(18);
664
+ const { t } = useWords("heatmap");
665
+ let T0;
666
+ let t0;
667
+ if ($[0] !== t) {
668
+ const [slowest] = BUILD_MINUTES.filter(_temp$1).toSorted(_temp2);
669
+ T0 = Heatmap;
670
+ t0 = t("builds.caption", {
671
+ minutes: slowest?.value,
672
+ pipeline: slowest?.row
673
+ });
674
+ $[0] = t;
675
+ $[1] = T0;
676
+ $[2] = t0;
677
+ } else {
678
+ T0 = $[1];
679
+ t0 = $[2];
680
+ }
681
+ let t1;
682
+ if ($[3] !== t) {
683
+ t1 = WORKDAYS.map((key) => ({
684
+ key,
685
+ label: t(`days.${key}`)
686
+ }));
687
+ $[3] = t;
688
+ $[4] = t1;
689
+ } else t1 = $[4];
690
+ let t2;
691
+ if ($[5] !== t) {
692
+ t2 = t("builds.corner");
693
+ $[5] = t;
694
+ $[6] = t2;
695
+ } else t2 = $[6];
696
+ let t3;
697
+ if ($[7] !== t) {
698
+ t3 = t("builds.label");
699
+ $[7] = t;
700
+ $[8] = t3;
701
+ } else t3 = $[8];
702
+ let t4;
703
+ if ($[9] !== t) {
704
+ t4 = t("builds.value");
705
+ $[9] = t;
706
+ $[10] = t4;
707
+ } else t4 = $[10];
708
+ let t5;
709
+ if ($[11] !== T0 || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4) {
710
+ t5 = /* @__PURE__ */ jsx(T0, {
711
+ caption: t0,
712
+ cells: BUILD_MINUTES,
713
+ columns: t1,
714
+ corner: t2,
715
+ label: t3,
716
+ size: "lg",
717
+ valueLabel: t4,
718
+ values: true
719
+ });
720
+ $[11] = T0;
721
+ $[12] = t0;
722
+ $[13] = t1;
723
+ $[14] = t2;
724
+ $[15] = t3;
725
+ $[16] = t4;
726
+ $[17] = t5;
727
+ } else t5 = $[17];
728
+ return t5;
729
+ }
730
+ function _temp2(first, second) {
731
+ return (second.value ?? 0) - (first.value ?? 0);
732
+ }
733
+ function _temp$1(cell) {
734
+ return cell.column === "fri";
735
+ }
736
+ const source$13 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { BUILD_MINUTES, WORKDAYS } from \"./readings.ts\";\n\nexport function Builds(): ReactElement {\n const { t } = useWords(\"heatmap\");\n const [slowest] = BUILD_MINUTES.filter((cell) => cell.column === \"fri\").toSorted(\n (first, second) => (second.value ?? 0) - (first.value ?? 0),\n );\n\n return (\n <Heatmap\n caption={t(\"builds.caption\", { minutes: slowest?.value, pipeline: slowest?.row })}\n cells={BUILD_MINUTES}\n columns={WORKDAYS.map((key) => ({ key, label: t(`days.${key}`) }))}\n corner={t(\"builds.corner\")}\n label={t(\"builds.label\")}\n size=\"lg\"\n valueLabel={t(\"builds.value\")}\n values\n />\n );\n}\n";
737
+ //#endregion
738
+ //#region src/heatmap/examples/clinic.example.tsx
739
+ var clinic_example_exports = /* @__PURE__ */ __exportAll({
740
+ Clinic: () => Clinic,
741
+ source: () => source$12
742
+ });
743
+ const INTAKES = [
744
+ [
745
+ 24,
746
+ 21,
747
+ 19,
748
+ 17,
749
+ 16,
750
+ 15
751
+ ],
752
+ [
753
+ 31,
754
+ 26,
755
+ 23,
756
+ 21,
757
+ 19
758
+ ],
759
+ [
760
+ 7,
761
+ 7,
762
+ 6,
763
+ 6
764
+ ],
765
+ [
766
+ 28,
767
+ 24,
768
+ 21
769
+ ],
770
+ [22, 19],
771
+ [19]
772
+ ];
773
+ function Clinic() {
774
+ const $ = c(23);
775
+ const { i18n, t } = useWords("heatmap");
776
+ let T0;
777
+ let t0;
778
+ if ($[0] !== i18n.language || $[1] !== t) {
779
+ const month = new Intl.DateTimeFormat(i18n.language, {
780
+ month: "short",
781
+ timeZone: "UTC"
782
+ });
783
+ const cohorts = INTAKES.map((retained, at) => ({
784
+ key: String(at),
785
+ label: month.format(Date.UTC(2026, at, 1)),
786
+ retained,
787
+ size: retained[0] ?? 0
788
+ }));
789
+ T0 = Heatmap;
790
+ let t1;
791
+ if ($[4] !== t) {
792
+ t1 = (cohort) => t("clinic.cohort", {
793
+ label: cohort.label,
794
+ size: cohort.size
795
+ });
796
+ $[4] = t;
797
+ $[5] = t1;
798
+ } else t1 = $[5];
799
+ let t2;
800
+ if ($[6] !== t) {
801
+ t2 = (period) => t("clinic.period", { period });
802
+ $[6] = t;
803
+ $[7] = t2;
804
+ } else t2 = $[7];
805
+ t0 = cohortCells(cohorts, {
806
+ label: t1,
807
+ locale: i18n.language,
808
+ measure: "count",
809
+ periodLabel: t2
810
+ });
811
+ $[0] = i18n.language;
812
+ $[1] = t;
813
+ $[2] = T0;
814
+ $[3] = t0;
815
+ } else {
816
+ T0 = $[2];
817
+ t0 = $[3];
818
+ }
819
+ let t1;
820
+ if ($[8] !== t) {
821
+ t1 = t("clinic.caption");
822
+ $[8] = t;
823
+ $[9] = t1;
824
+ } else t1 = $[9];
825
+ let t2;
826
+ if ($[10] !== t) {
827
+ t2 = t("clinic.corner");
828
+ $[10] = t;
829
+ $[11] = t2;
830
+ } else t2 = $[11];
831
+ let t3;
832
+ if ($[12] !== t) {
833
+ t3 = t("clinic.label");
834
+ $[12] = t;
835
+ $[13] = t3;
836
+ } else t3 = $[13];
837
+ let t4;
838
+ if ($[14] !== t) {
839
+ t4 = t("clinic.value");
840
+ $[14] = t;
841
+ $[15] = t4;
842
+ } else t4 = $[15];
843
+ let t5;
844
+ if ($[16] !== T0 || $[17] !== t0 || $[18] !== t1 || $[19] !== t2 || $[20] !== t3 || $[21] !== t4) {
845
+ t5 = /* @__PURE__ */ jsx(T0, {
846
+ ...t0,
847
+ caption: t1,
848
+ corner: t2,
849
+ label: t3,
850
+ valueLabel: t4,
851
+ values: true
852
+ });
853
+ $[16] = T0;
854
+ $[17] = t0;
855
+ $[18] = t1;
856
+ $[19] = t2;
857
+ $[20] = t3;
858
+ $[21] = t4;
859
+ $[22] = t5;
860
+ } else t5 = $[22];
861
+ return t5;
862
+ }
863
+ const source$12 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap, cohortCells } from \"@stealthscale/component-charts\";\n\nconst INTAKES = [\n [24, 21, 19, 17, 16, 15],\n [31, 26, 23, 21, 19],\n [7, 7, 6, 6],\n [28, 24, 21],\n [22, 19],\n [19],\n];\n\nexport function Clinic(): ReactElement {\n const { i18n, t } = useWords(\"heatmap\");\n const month = new Intl.DateTimeFormat(i18n.language, { month: \"short\", timeZone: \"UTC\" });\n const cohorts = INTAKES.map((retained, at) => ({\n key: String(at),\n label: month.format(Date.UTC(2026, at, 1)),\n retained,\n size: retained[0] ?? 0,\n }));\n\n return (\n <Heatmap\n {...cohortCells(cohorts, {\n label: (cohort) => t(\"clinic.cohort\", { label: cohort.label, size: cohort.size }),\n locale: i18n.language,\n measure: \"count\",\n periodLabel: (period) => t(\"clinic.period\", { period }),\n })}\n caption={t(\"clinic.caption\")}\n corner={t(\"clinic.corner\")}\n label={t(\"clinic.label\")}\n valueLabel={t(\"clinic.value\")}\n values\n />\n );\n}\n";
864
+ //#endregion
865
+ //#region src/heatmap/examples/deploys.example.tsx
866
+ var deploys_example_exports = /* @__PURE__ */ __exportAll({
867
+ Deploys: () => Deploys,
868
+ source: () => source$11
869
+ });
870
+ function Deploys() {
871
+ const $ = c(16);
872
+ const { i18n, t } = useWords("heatmap");
873
+ let t0;
874
+ if ($[0] !== i18n.language) {
875
+ t0 = calendarCells(DEPLOYS, {
876
+ from: "2025-10-01",
877
+ locale: i18n.language,
878
+ to: "2026-09-30"
879
+ });
880
+ $[0] = i18n.language;
881
+ $[1] = t0;
882
+ } else t0 = $[1];
883
+ const calendar = t0;
884
+ let t1;
885
+ if ($[2] !== t) {
886
+ t1 = t("deploys.caption", { count: 80 });
887
+ $[2] = t;
888
+ $[3] = t1;
889
+ } else t1 = $[3];
890
+ let t2;
891
+ if ($[4] !== t) {
892
+ t2 = t("deploys.label");
893
+ $[4] = t;
894
+ $[5] = t2;
895
+ } else t2 = $[5];
896
+ let t3;
897
+ if ($[6] !== t) {
898
+ t3 = t("deploys.missing");
899
+ $[6] = t;
900
+ $[7] = t3;
901
+ } else t3 = $[7];
902
+ let t4;
903
+ if ($[8] !== t) {
904
+ t4 = t("deploys.value");
905
+ $[8] = t;
906
+ $[9] = t4;
907
+ } else t4 = $[9];
908
+ let t5;
909
+ if ($[10] !== calendar || $[11] !== t1 || $[12] !== t2 || $[13] !== t3 || $[14] !== t4) {
910
+ t5 = /* @__PURE__ */ jsx(Heatmap, {
911
+ ...calendar,
912
+ caption: t1,
913
+ label: t2,
914
+ missingLabel: t3,
915
+ size: "sm",
916
+ valueLabel: t4
917
+ });
918
+ $[10] = calendar;
919
+ $[11] = t1;
920
+ $[12] = t2;
921
+ $[13] = t3;
922
+ $[14] = t4;
923
+ $[15] = t5;
924
+ } else t5 = $[15];
925
+ return t5;
926
+ }
927
+ const source$11 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap, calendarCells } from \"@stealthscale/component-charts\";\n\nimport { DEPLOYS } from \"./days.ts\";\n\nexport function Deploys(): ReactElement {\n const { i18n, t } = useWords(\"heatmap\");\n const calendar = calendarCells(DEPLOYS, {\n from: \"2025-10-01\",\n locale: i18n.language,\n to: \"2026-09-30\",\n });\n\n return (\n <Heatmap\n {...calendar}\n caption={t(\"deploys.caption\", { count: 80 })}\n label={t(\"deploys.label\")}\n missingLabel={t(\"deploys.missing\")}\n size=\"sm\"\n valueLabel={t(\"deploys.value\")}\n />\n );\n}\n";
928
+ //#endregion
929
+ //#region src/heatmap/examples/depots.example.tsx
930
+ var depots_example_exports = /* @__PURE__ */ __exportAll({
931
+ Depots: () => Depots,
932
+ source: () => source$10
933
+ });
934
+ const WEEKS = [{
935
+ cells: SCANS_THIS_WEEK,
936
+ week: "this"
937
+ }, {
938
+ cells: SCANS_LAST_WEEK,
939
+ week: "last"
940
+ }];
941
+ function Depots() {
942
+ const $ = c(5);
943
+ const { t } = useWords("heatmap");
944
+ let t0;
945
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
946
+ t0 = heatmapDomain([...SCANS_THIS_WEEK, ...SCANS_LAST_WEEK]);
947
+ $[0] = t0;
948
+ } else t0 = $[0];
949
+ const domain = t0;
950
+ let t1;
951
+ if ($[1] !== t) {
952
+ t1 = WEEKS.map((t2) => {
953
+ const { cells, week } = t2;
954
+ return /* @__PURE__ */ jsxs(Stack, {
955
+ gap: "sm",
956
+ children: [/* @__PURE__ */ jsx(Heading, {
957
+ as: "h3",
958
+ size: "sm",
959
+ children: t(`depots.${week}`)
960
+ }), /* @__PURE__ */ jsx(Heatmap, {
961
+ cells,
962
+ columns: hoursOf(DEPOT_HOURS),
963
+ corner: t("depots.corner"),
964
+ domain,
965
+ label: t("depots.label", { week: t(`depots.weeks.${week}`) }),
966
+ rows: DEPOTS.map((key) => ({
967
+ key,
968
+ label: t(`names.${key}`)
969
+ })),
970
+ valueLabel: t("depots.value")
971
+ })]
972
+ }, week);
973
+ });
974
+ $[1] = t;
975
+ $[2] = t1;
976
+ } else t1 = $[2];
977
+ let t2;
978
+ if ($[3] !== t1) {
979
+ t2 = /* @__PURE__ */ jsx(Stack, {
980
+ gap: "lg",
981
+ children: t1
982
+ });
983
+ $[3] = t1;
984
+ $[4] = t2;
985
+ } else t2 = $[4];
986
+ return t2;
987
+ }
988
+ const source$10 = "import { type ReactElement } from \"react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Heading } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap, heatmapDomain } from \"@stealthscale/component-charts\";\n\nimport { DEPOT_HOURS, DEPOTS, hoursOf, SCANS_LAST_WEEK, SCANS_THIS_WEEK } from \"./readings.ts\";\n\nconst WEEKS = [\n { cells: SCANS_THIS_WEEK, week: \"this\" },\n { cells: SCANS_LAST_WEEK, week: \"last\" },\n];\n\nexport function Depots(): ReactElement {\n const { t } = useWords(\"heatmap\");\n const domain = heatmapDomain([...SCANS_THIS_WEEK, ...SCANS_LAST_WEEK]);\n\n return (\n <Stack gap=\"lg\">\n {WEEKS.map(({ cells, week }) => (\n <Stack gap=\"sm\" key={week}>\n <Heading as=\"h3\" size=\"sm\">\n {t(`depots.${week}`)}\n </Heading>\n <Heatmap\n cells={cells}\n columns={hoursOf(DEPOT_HOURS)}\n corner={t(\"depots.corner\")}\n domain={domain}\n label={t(\"depots.label\", { week: t(`depots.weeks.${week}`) })}\n rows={DEPOTS.map((key) => ({ key, label: t(`names.${key}`) }))}\n valueLabel={t(\"depots.value\")}\n />\n </Stack>\n ))}\n </Stack>\n );\n}\n";
989
+ //#endregion
990
+ //#region src/heatmap/examples/incidents.example.tsx
991
+ var incidents_example_exports = /* @__PURE__ */ __exportAll({
992
+ Incidents: () => Incidents,
993
+ source: () => source$9
994
+ });
995
+ function Incidents() {
996
+ const $ = c(22);
997
+ const { t } = useWords("heatmap");
998
+ const [picked, setPicked] = useState();
999
+ let t0;
1000
+ if ($[0] !== t) {
1001
+ t0 = t("incidents.caption");
1002
+ $[0] = t;
1003
+ $[1] = t0;
1004
+ } else t0 = $[1];
1005
+ let t1;
1006
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1007
+ t1 = hoursOf(INCIDENT_HOURS);
1008
+ $[2] = t1;
1009
+ } else t1 = $[2];
1010
+ let t2;
1011
+ if ($[3] !== t) {
1012
+ t2 = t("incidents.corner");
1013
+ $[3] = t;
1014
+ $[4] = t2;
1015
+ } else t2 = $[4];
1016
+ let t3;
1017
+ if ($[5] !== t) {
1018
+ t3 = t("incidents.label");
1019
+ $[5] = t;
1020
+ $[6] = t3;
1021
+ } else t3 = $[6];
1022
+ let t4;
1023
+ if ($[7] !== t) {
1024
+ t4 = t("incidents.value");
1025
+ $[7] = t;
1026
+ $[8] = t4;
1027
+ } else t4 = $[8];
1028
+ let t5;
1029
+ if ($[9] !== t0 || $[10] !== t2 || $[11] !== t3 || $[12] !== t4) {
1030
+ t5 = /* @__PURE__ */ jsx(Heatmap, {
1031
+ caption: t0,
1032
+ cells: ERRORS,
1033
+ columns: t1,
1034
+ corner: t2,
1035
+ label: t3,
1036
+ onSelect: setPicked,
1037
+ size: "lg",
1038
+ valueLabel: t4
1039
+ });
1040
+ $[9] = t0;
1041
+ $[10] = t2;
1042
+ $[11] = t3;
1043
+ $[12] = t4;
1044
+ $[13] = t5;
1045
+ } else t5 = $[13];
1046
+ let t6;
1047
+ if ($[14] !== picked || $[15] !== t) {
1048
+ t6 = picked === void 0 ? t("incidents.none") : t("incidents.picked", {
1049
+ count: picked.value,
1050
+ hour: picked.column,
1051
+ service: picked.row
1052
+ });
1053
+ $[14] = picked;
1054
+ $[15] = t;
1055
+ $[16] = t6;
1056
+ } else t6 = $[16];
1057
+ let t7;
1058
+ if ($[17] !== t6) {
1059
+ t7 = /* @__PURE__ */ jsx(Text, {
1060
+ as: "output",
1061
+ size: "sm",
1062
+ tone: "muted",
1063
+ children: t6
1064
+ });
1065
+ $[17] = t6;
1066
+ $[18] = t7;
1067
+ } else t7 = $[18];
1068
+ let t8;
1069
+ if ($[19] !== t5 || $[20] !== t7) {
1070
+ t8 = /* @__PURE__ */ jsxs(Stack, {
1071
+ align: "flex-start",
1072
+ children: [t5, t7]
1073
+ });
1074
+ $[19] = t5;
1075
+ $[20] = t7;
1076
+ $[21] = t8;
1077
+ } else t8 = $[21];
1078
+ return t8;
1079
+ }
1080
+ const source$9 = "import { type ReactElement, useState } from \"react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap, HeatmapCell } from \"@stealthscale/component-charts\";\n\nimport { ERRORS, hoursOf, INCIDENT_HOURS } from \"./readings.ts\";\n\nexport function Incidents(): ReactElement {\n const { t } = useWords(\"heatmap\");\n const [picked, setPicked] = useState<HeatmapCell>();\n\n return (\n <Stack align=\"flex-start\">\n <Heatmap\n caption={t(\"incidents.caption\")}\n cells={ERRORS}\n columns={hoursOf(INCIDENT_HOURS)}\n corner={t(\"incidents.corner\")}\n label={t(\"incidents.label\")}\n onSelect={setPicked}\n size=\"lg\"\n valueLabel={t(\"incidents.value\")}\n />\n <Text as=\"output\" size=\"sm\" tone=\"muted\">\n {picked === undefined\n ? t(\"incidents.none\")\n : t(\"incidents.picked\", {\n count: picked.value,\n hour: picked.column,\n service: picked.row,\n })}\n </Text>\n </Stack>\n );\n}\n";
1081
+ //#endregion
1082
+ //#region src/heatmap/examples/pages.example.tsx
1083
+ var pages_example_exports = /* @__PURE__ */ __exportAll({
1084
+ Pages: () => Pages,
1085
+ source: () => source$8
1086
+ });
1087
+ function Pages() {
1088
+ const $ = c(13);
1089
+ const { i18n, t } = useWords("heatmap");
1090
+ let t0;
1091
+ if ($[0] !== i18n.language) {
1092
+ t0 = calendarCells(PAGES, {
1093
+ locale: i18n.language,
1094
+ weekStartsOn: "mon"
1095
+ });
1096
+ $[0] = i18n.language;
1097
+ $[1] = t0;
1098
+ } else t0 = $[1];
1099
+ let t1;
1100
+ if ($[2] !== t) {
1101
+ t1 = t("pages.caption", { count: 14 });
1102
+ $[2] = t;
1103
+ $[3] = t1;
1104
+ } else t1 = $[3];
1105
+ let t2;
1106
+ if ($[4] !== t) {
1107
+ t2 = t("pages.label");
1108
+ $[4] = t;
1109
+ $[5] = t2;
1110
+ } else t2 = $[5];
1111
+ let t3;
1112
+ if ($[6] !== t) {
1113
+ t3 = t("pages.value");
1114
+ $[6] = t;
1115
+ $[7] = t3;
1116
+ } else t3 = $[7];
1117
+ let t4;
1118
+ if ($[8] !== t0 || $[9] !== t1 || $[10] !== t2 || $[11] !== t3) {
1119
+ t4 = /* @__PURE__ */ jsx(Heatmap, {
1120
+ ...t0,
1121
+ caption: t1,
1122
+ label: t2,
1123
+ valueLabel: t3
1124
+ });
1125
+ $[8] = t0;
1126
+ $[9] = t1;
1127
+ $[10] = t2;
1128
+ $[11] = t3;
1129
+ $[12] = t4;
1130
+ } else t4 = $[12];
1131
+ return t4;
1132
+ }
1133
+ const source$8 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap, calendarCells } from \"@stealthscale/component-charts\";\n\nimport { PAGES } from \"./days.ts\";\n\nexport function Pages(): ReactElement {\n const { i18n, t } = useWords(\"heatmap\");\n\n return (\n <Heatmap\n {...calendarCells(PAGES, { locale: i18n.language, weekStartsOn: \"mon\" })}\n caption={t(\"pages.caption\", { count: 14 })}\n label={t(\"pages.label\")}\n valueLabel={t(\"pages.value\")}\n />\n );\n}\n";
1134
+ //#endregion
1135
+ //#region src/heatmap/examples/palette.example.tsx
1136
+ var palette_example_exports = /* @__PURE__ */ __exportAll({
1137
+ Palette: () => Palette,
1138
+ source: () => source$7
1139
+ });
1140
+ function Palette() {
1141
+ const $ = c(14);
1142
+ const { t } = useWords("heatmap");
1143
+ let t0;
1144
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1145
+ t0 = hoursOf(TRADING_HOURS);
1146
+ $[0] = t0;
1147
+ } else t0 = $[0];
1148
+ let t1;
1149
+ if ($[1] !== t) {
1150
+ t1 = t("authorisations.corner");
1151
+ $[1] = t;
1152
+ $[2] = t1;
1153
+ } else t1 = $[2];
1154
+ let t2;
1155
+ if ($[3] !== t) {
1156
+ t2 = t("authorisations.label");
1157
+ $[3] = t;
1158
+ $[4] = t2;
1159
+ } else t2 = $[4];
1160
+ let t3;
1161
+ if ($[5] !== t) {
1162
+ t3 = WEEKDAYS.map((key) => ({
1163
+ key,
1164
+ label: t(`days.${key}`)
1165
+ }));
1166
+ $[5] = t;
1167
+ $[6] = t3;
1168
+ } else t3 = $[6];
1169
+ let t4;
1170
+ if ($[7] !== t) {
1171
+ t4 = t("authorisations.value");
1172
+ $[7] = t;
1173
+ $[8] = t4;
1174
+ } else t4 = $[8];
1175
+ let t5;
1176
+ if ($[9] !== t1 || $[10] !== t2 || $[11] !== t3 || $[12] !== t4) {
1177
+ t5 = /* @__PURE__ */ jsx(Heatmap, {
1178
+ cells: AUTHORISATIONS,
1179
+ color: "purple",
1180
+ columns: t0,
1181
+ corner: t1,
1182
+ label: t2,
1183
+ rows: t3,
1184
+ valueLabel: t4
1185
+ });
1186
+ $[9] = t1;
1187
+ $[10] = t2;
1188
+ $[11] = t3;
1189
+ $[12] = t4;
1190
+ $[13] = t5;
1191
+ } else t5 = $[13];
1192
+ return t5;
1193
+ }
1194
+ const source$7 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { AUTHORISATIONS, hoursOf, TRADING_HOURS, WEEKDAYS } from \"./readings.ts\";\n\nexport function Palette(): ReactElement {\n const { t } = useWords(\"heatmap\");\n\n return (\n <Heatmap\n cells={AUTHORISATIONS}\n color=\"purple\"\n columns={hoursOf(TRADING_HOURS)}\n corner={t(\"authorisations.corner\")}\n label={t(\"authorisations.label\")}\n rows={WEEKDAYS.map((key) => ({ key, label: t(`days.${key}`) }))}\n valueLabel={t(\"authorisations.value\")}\n />\n );\n}\n";
1195
+ //#endregion
1196
+ //#region src/heatmap/examples/quarter.example.tsx
1197
+ var quarter_example_exports = /* @__PURE__ */ __exportAll({
1198
+ Quarter: () => Quarter,
1199
+ source: () => source$6
1200
+ });
1201
+ function Quarter(props) {
1202
+ const $ = c(14);
1203
+ const { i18n, t } = useWords("heatmap");
1204
+ let t0;
1205
+ if ($[0] !== i18n.language) {
1206
+ t0 = calendarCells(DEPLOYS, {
1207
+ from: "2026-01-01",
1208
+ locale: i18n.language,
1209
+ to: "2026-03-31"
1210
+ });
1211
+ $[0] = i18n.language;
1212
+ $[1] = t0;
1213
+ } else t0 = $[1];
1214
+ const calendar = t0;
1215
+ let t1;
1216
+ if ($[2] !== t) {
1217
+ t1 = t("quarter.label");
1218
+ $[2] = t;
1219
+ $[3] = t1;
1220
+ } else t1 = $[3];
1221
+ let t2;
1222
+ if ($[4] !== t) {
1223
+ t2 = t("deploys.missing");
1224
+ $[4] = t;
1225
+ $[5] = t2;
1226
+ } else t2 = $[5];
1227
+ let t3;
1228
+ if ($[6] !== t) {
1229
+ t3 = t("deploys.value");
1230
+ $[6] = t;
1231
+ $[7] = t3;
1232
+ } else t3 = $[7];
1233
+ let t4;
1234
+ if ($[8] !== calendar || $[9] !== props || $[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
1235
+ t4 = /* @__PURE__ */ jsx(Heatmap, {
1236
+ ...calendar,
1237
+ label: t1,
1238
+ missingLabel: t2,
1239
+ valueLabel: t3,
1240
+ ...props
1241
+ });
1242
+ $[8] = calendar;
1243
+ $[9] = props;
1244
+ $[10] = t1;
1245
+ $[11] = t2;
1246
+ $[12] = t3;
1247
+ $[13] = t4;
1248
+ } else t4 = $[13];
1249
+ return t4;
1250
+ }
1251
+ const source$6 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap, calendarCells } from \"@stealthscale/component-charts\";\n\nimport { DEPLOYS } from \"./days.ts\";\n\nexport function Quarter(\n props: Omit<Parameters<typeof Heatmap>[0], \"cells\" | \"label\">,\n): ReactElement {\n const { i18n, t } = useWords(\"heatmap\");\n const calendar = calendarCells(DEPLOYS, {\n from: \"2026-01-01\",\n locale: i18n.language,\n to: \"2026-03-31\",\n });\n\n return (\n <Heatmap\n {...calendar}\n label={t(\"quarter.label\")}\n missingLabel={t(\"deploys.missing\")}\n valueLabel={t(\"deploys.value\")}\n {...props}\n />\n );\n}\n";
1252
+ //#endregion
1253
+ //#region src/heatmap/examples/quiet.example.tsx
1254
+ var quiet_example_exports = /* @__PURE__ */ __exportAll({
1255
+ Quiet: () => Quiet,
1256
+ source: () => source$5
1257
+ });
1258
+ function Quiet() {
1259
+ const $ = c(11);
1260
+ const { t } = useWords("heatmap");
1261
+ let t0;
1262
+ if ($[0] !== t) {
1263
+ t0 = t("quiet.caption");
1264
+ $[0] = t;
1265
+ $[1] = t0;
1266
+ } else t0 = $[1];
1267
+ let t1;
1268
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1269
+ t1 = [];
1270
+ $[2] = t1;
1271
+ } else t1 = $[2];
1272
+ let t2;
1273
+ if ($[3] !== t) {
1274
+ t2 = t("quiet.empty");
1275
+ $[3] = t;
1276
+ $[4] = t2;
1277
+ } else t2 = $[4];
1278
+ let t3;
1279
+ if ($[5] !== t) {
1280
+ t3 = t("quiet.label");
1281
+ $[5] = t;
1282
+ $[6] = t3;
1283
+ } else t3 = $[6];
1284
+ let t4;
1285
+ if ($[7] !== t0 || $[8] !== t2 || $[9] !== t3) {
1286
+ t4 = /* @__PURE__ */ jsx(Heatmap, {
1287
+ caption: t0,
1288
+ cells: t1,
1289
+ empty: t2,
1290
+ label: t3
1291
+ });
1292
+ $[7] = t0;
1293
+ $[8] = t2;
1294
+ $[9] = t3;
1295
+ $[10] = t4;
1296
+ } else t4 = $[10];
1297
+ return t4;
1298
+ }
1299
+ const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"heatmap\");\n\n return (\n <Heatmap\n caption={t(\"quiet.caption\")}\n cells={[]}\n empty={t(\"quiet.empty\")}\n label={t(\"quiet.label\")}\n />\n );\n}\n";
1300
+ //#endregion
1301
+ //#region src/heatmap/examples/readout.example.tsx
1302
+ var readout_example_exports = /* @__PURE__ */ __exportAll({
1303
+ Readout: () => Readout,
1304
+ source: () => source$4
1305
+ });
1306
+ function Readout() {
1307
+ const $ = c(16);
1308
+ const { t } = useWords("heatmap");
1309
+ let t0;
1310
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1311
+ t0 = Math.max(...AUTHORISATIONS.map(_temp));
1312
+ $[0] = t0;
1313
+ } else t0 = $[0];
1314
+ const most = t0;
1315
+ let t1;
1316
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1317
+ t1 = hoursOf(TRADING_HOURS);
1318
+ $[1] = t1;
1319
+ } else t1 = $[1];
1320
+ let t2;
1321
+ if ($[2] !== t) {
1322
+ t2 = t("authorisations.corner");
1323
+ $[2] = t;
1324
+ $[3] = t2;
1325
+ } else t2 = $[3];
1326
+ let t3;
1327
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1328
+ t3 = AUTHORISATIONS.findIndex((cell_0) => cell_0.value === most);
1329
+ $[4] = t3;
1330
+ } else t3 = $[4];
1331
+ let t4;
1332
+ if ($[5] !== t) {
1333
+ t4 = t("authorisations.label");
1334
+ $[5] = t;
1335
+ $[6] = t4;
1336
+ } else t4 = $[6];
1337
+ let t5;
1338
+ if ($[7] !== t) {
1339
+ t5 = WEEKDAYS.map((key) => ({
1340
+ key,
1341
+ label: t(`days.${key}`)
1342
+ }));
1343
+ $[7] = t;
1344
+ $[8] = t5;
1345
+ } else t5 = $[8];
1346
+ let t6;
1347
+ if ($[9] !== t) {
1348
+ t6 = t("authorisations.value");
1349
+ $[9] = t;
1350
+ $[10] = t6;
1351
+ } else t6 = $[10];
1352
+ let t7;
1353
+ if ($[11] !== t2 || $[12] !== t4 || $[13] !== t5 || $[14] !== t6) {
1354
+ t7 = /* @__PURE__ */ jsx(Heatmap, {
1355
+ cells: AUTHORISATIONS,
1356
+ columns: t1,
1357
+ corner: t2,
1358
+ defaultIndex: t3,
1359
+ label: t4,
1360
+ rows: t5,
1361
+ valueLabel: t6
1362
+ });
1363
+ $[11] = t2;
1364
+ $[12] = t4;
1365
+ $[13] = t5;
1366
+ $[14] = t6;
1367
+ $[15] = t7;
1368
+ } else t7 = $[15];
1369
+ return t7;
1370
+ }
1371
+ function _temp(cell) {
1372
+ return cell.value ?? 0;
1373
+ }
1374
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { AUTHORISATIONS, hoursOf, TRADING_HOURS, WEEKDAYS } from \"./readings.ts\";\n\nexport function Readout(): ReactElement {\n const { t } = useWords(\"heatmap\");\n const most = Math.max(...AUTHORISATIONS.map((cell) => cell.value ?? 0));\n\n return (\n <Heatmap\n cells={AUTHORISATIONS}\n columns={hoursOf(TRADING_HOURS)}\n corner={t(\"authorisations.corner\")}\n defaultIndex={AUTHORISATIONS.findIndex((cell) => cell.value === most)}\n label={t(\"authorisations.label\")}\n rows={WEEKDAYS.map((key) => ({ key, label: t(`days.${key}`) }))}\n valueLabel={t(\"authorisations.value\")}\n />\n );\n}\n";
1375
+ //#endregion
1376
+ //#region src/heatmap/examples/signups.example.tsx
1377
+ var signups_example_exports = /* @__PURE__ */ __exportAll({
1378
+ Signups: () => Signups,
1379
+ source: () => source$3
1380
+ });
1381
+ const SIGNUPS = [
1382
+ 1840,
1383
+ 1520,
1384
+ 1610,
1385
+ 1980,
1386
+ 1750,
1387
+ 1690,
1388
+ 1880,
1389
+ 1420
1390
+ ].map((size, at) => {
1391
+ const first = (at >= 4 ? .6 : .52) + (at * 5 % 7 - 3) * .01;
1392
+ const kept = .86 + at * 3 % 4 * .01;
1393
+ return {
1394
+ retained: Array.from({ length: 8 - at }, (_, period) => {
1395
+ if (period === 0) return size;
1396
+ if (at === 2 && period === 2) return null;
1397
+ return Math.round(size * first * kept ** (period - 1));
1398
+ }),
1399
+ size
1400
+ };
1401
+ });
1402
+ function Signups() {
1403
+ const $ = c(26);
1404
+ const { i18n, t } = useWords("heatmap");
1405
+ let T0;
1406
+ let t0;
1407
+ if ($[0] !== i18n.language || $[1] !== t) {
1408
+ const month = new Intl.DateTimeFormat(i18n.language, {
1409
+ month: "short",
1410
+ timeZone: "UTC",
1411
+ year: "numeric"
1412
+ });
1413
+ const cohorts = SIGNUPS.map((t1, at) => {
1414
+ const { retained, size } = t1;
1415
+ return {
1416
+ key: `2026-${String(at + 1).padStart(2, "0")}`,
1417
+ label: month.format(Date.UTC(2026, at, 1)),
1418
+ retained,
1419
+ size
1420
+ };
1421
+ });
1422
+ T0 = Heatmap;
1423
+ let t2;
1424
+ if ($[4] !== t) {
1425
+ t2 = (cohort) => t("signups.cohort", {
1426
+ label: cohort.label,
1427
+ size: cohort.size
1428
+ });
1429
+ $[4] = t;
1430
+ $[5] = t2;
1431
+ } else t2 = $[5];
1432
+ let t3;
1433
+ if ($[6] !== t) {
1434
+ t3 = (period) => t("signups.period", { period });
1435
+ $[6] = t;
1436
+ $[7] = t3;
1437
+ } else t3 = $[7];
1438
+ t0 = cohortCells(cohorts, {
1439
+ average: t("signups.average"),
1440
+ label: t2,
1441
+ locale: i18n.language,
1442
+ periodLabel: t3
1443
+ });
1444
+ $[0] = i18n.language;
1445
+ $[1] = t;
1446
+ $[2] = T0;
1447
+ $[3] = t0;
1448
+ } else {
1449
+ T0 = $[2];
1450
+ t0 = $[3];
1451
+ }
1452
+ let t1;
1453
+ if ($[8] !== t) {
1454
+ t1 = t("signups.caption");
1455
+ $[8] = t;
1456
+ $[9] = t1;
1457
+ } else t1 = $[9];
1458
+ let t2;
1459
+ if ($[10] !== t) {
1460
+ t2 = t("signups.corner");
1461
+ $[10] = t;
1462
+ $[11] = t2;
1463
+ } else t2 = $[11];
1464
+ let t3;
1465
+ if ($[12] !== t) {
1466
+ t3 = t("signups.label");
1467
+ $[12] = t;
1468
+ $[13] = t3;
1469
+ } else t3 = $[13];
1470
+ let t4;
1471
+ if ($[14] !== t) {
1472
+ t4 = t("signups.missing");
1473
+ $[14] = t;
1474
+ $[15] = t4;
1475
+ } else t4 = $[15];
1476
+ let t5;
1477
+ if ($[16] !== t) {
1478
+ t5 = t("signups.value");
1479
+ $[16] = t;
1480
+ $[17] = t5;
1481
+ } else t5 = $[17];
1482
+ let t6;
1483
+ if ($[18] !== T0 || $[19] !== t0 || $[20] !== t1 || $[21] !== t2 || $[22] !== t3 || $[23] !== t4 || $[24] !== t5) {
1484
+ t6 = /* @__PURE__ */ jsx(T0, {
1485
+ ...t0,
1486
+ caption: t1,
1487
+ corner: t2,
1488
+ label: t3,
1489
+ missingLabel: t4,
1490
+ valueLabel: t5,
1491
+ values: true
1492
+ });
1493
+ $[18] = T0;
1494
+ $[19] = t0;
1495
+ $[20] = t1;
1496
+ $[21] = t2;
1497
+ $[22] = t3;
1498
+ $[23] = t4;
1499
+ $[24] = t5;
1500
+ $[25] = t6;
1501
+ } else t6 = $[25];
1502
+ return t6;
1503
+ }
1504
+ const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap, cohortCells } from \"@stealthscale/component-charts\";\n\nconst SIGNUPS = [1840, 1520, 1610, 1980, 1750, 1690, 1880, 1420].map((size, at) => {\n const first = (at >= 4 ? 0.6 : 0.52) + (((at * 5) % 7) - 3) * 0.01;\n const kept = 0.86 + ((at * 3) % 4) * 0.01;\n\n return {\n retained: Array.from({ length: 8 - at }, (_, period) => {\n if (period === 0) return size;\n if (at === 2 && period === 2) return null;\n\n return Math.round(size * first * kept ** (period - 1));\n }),\n size,\n };\n});\n\nexport function Signups(): ReactElement {\n const { i18n, t } = useWords(\"heatmap\");\n const month = new Intl.DateTimeFormat(i18n.language, {\n month: \"short\",\n timeZone: \"UTC\",\n year: \"numeric\",\n });\n const cohorts = SIGNUPS.map(({ retained, size }, at) => ({\n key: `2026-${String(at + 1).padStart(2, \"0\")}`,\n label: month.format(Date.UTC(2026, at, 1)),\n retained,\n size,\n }));\n\n return (\n <Heatmap\n {...cohortCells(cohorts, {\n average: t(\"signups.average\"),\n label: (cohort) => t(\"signups.cohort\", { label: cohort.label, size: cohort.size }),\n locale: i18n.language,\n periodLabel: (period) => t(\"signups.period\", { period }),\n })}\n caption={t(\"signups.caption\")}\n corner={t(\"signups.corner\")}\n label={t(\"signups.label\")}\n missingLabel={t(\"signups.missing\")}\n valueLabel={t(\"signups.value\")}\n values\n />\n );\n}\n";
1505
+ //#endregion
1506
+ //#region src/heatmap/examples/sizes.example.tsx
1507
+ var sizes_example_exports = /* @__PURE__ */ __exportAll({
1508
+ Sizes: () => Sizes,
1509
+ source: () => source$2
1510
+ });
1511
+ function Sizes(props) {
1512
+ const $ = c(12);
1513
+ const { t } = useWords("heatmap");
1514
+ let t0;
1515
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1516
+ t0 = hoursOf(INCIDENT_HOURS);
1517
+ $[0] = t0;
1518
+ } else t0 = $[0];
1519
+ let t1;
1520
+ if ($[1] !== t) {
1521
+ t1 = t("sizes.corner");
1522
+ $[1] = t;
1523
+ $[2] = t1;
1524
+ } else t1 = $[2];
1525
+ let t2;
1526
+ if ($[3] !== t) {
1527
+ t2 = t("sizes.label");
1528
+ $[3] = t;
1529
+ $[4] = t2;
1530
+ } else t2 = $[4];
1531
+ let t3;
1532
+ if ($[5] !== t) {
1533
+ t3 = t("sizes.value");
1534
+ $[5] = t;
1535
+ $[6] = t3;
1536
+ } else t3 = $[6];
1537
+ let t4;
1538
+ if ($[7] !== props || $[8] !== t1 || $[9] !== t2 || $[10] !== t3) {
1539
+ t4 = /* @__PURE__ */ jsx(Heatmap, {
1540
+ cells: ERRORS,
1541
+ columns: t0,
1542
+ corner: t1,
1543
+ label: t2,
1544
+ valueLabel: t3,
1545
+ ...props
1546
+ });
1547
+ $[7] = props;
1548
+ $[8] = t1;
1549
+ $[9] = t2;
1550
+ $[10] = t3;
1551
+ $[11] = t4;
1552
+ } else t4 = $[11];
1553
+ return t4;
1554
+ }
1555
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { ERRORS, hoursOf, INCIDENT_HOURS } from \"./readings.ts\";\n\nexport function Sizes(props: Omit<Parameters<typeof Heatmap>[0], \"cells\" | \"label\">): ReactElement {\n const { t } = useWords(\"heatmap\");\n\n return (\n <Heatmap\n cells={ERRORS}\n columns={hoursOf(INCIDENT_HOURS)}\n corner={t(\"sizes.corner\")}\n label={t(\"sizes.label\")}\n valueLabel={t(\"sizes.value\")}\n {...props}\n />\n );\n}\n";
1556
+ //#endregion
1557
+ //#region src/heatmap/examples/variance.example.tsx
1558
+ var variance_example_exports = /* @__PURE__ */ __exportAll({
1559
+ Variance: () => Variance,
1560
+ source: () => source$1
1561
+ });
1562
+ function Variance() {
1563
+ const $ = c(20);
1564
+ const { t } = useWords("heatmap");
1565
+ let t0;
1566
+ if ($[0] !== t) {
1567
+ t0 = t("variance.caption");
1568
+ $[0] = t;
1569
+ $[1] = t0;
1570
+ } else t0 = $[1];
1571
+ let t1;
1572
+ if ($[2] !== t) {
1573
+ t1 = QUARTERS.map((key) => ({
1574
+ key,
1575
+ label: t(`quarters.${key}`)
1576
+ }));
1577
+ $[2] = t;
1578
+ $[3] = t1;
1579
+ } else t1 = $[3];
1580
+ let t2;
1581
+ if ($[4] !== t) {
1582
+ t2 = t("variance.corner");
1583
+ $[4] = t;
1584
+ $[5] = t2;
1585
+ } else t2 = $[5];
1586
+ let t3;
1587
+ if ($[6] !== t) {
1588
+ t3 = t("variance.label");
1589
+ $[6] = t;
1590
+ $[7] = t3;
1591
+ } else t3 = $[7];
1592
+ let t4;
1593
+ if ($[8] !== t) {
1594
+ t4 = TEAMS.map((key_0) => ({
1595
+ key: key_0,
1596
+ label: t(`names.${key_0}`)
1597
+ }));
1598
+ $[8] = t;
1599
+ $[9] = t4;
1600
+ } else t4 = $[9];
1601
+ let t5;
1602
+ if ($[10] !== t) {
1603
+ t5 = t("variance.value");
1604
+ $[10] = t;
1605
+ $[11] = t5;
1606
+ } else t5 = $[11];
1607
+ let t6;
1608
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1609
+ t6 = { signDisplay: "exceptZero" };
1610
+ $[12] = t6;
1611
+ } else t6 = $[12];
1612
+ let t7;
1613
+ if ($[13] !== t0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
1614
+ t7 = /* @__PURE__ */ jsx(Heatmap, {
1615
+ caption: t0,
1616
+ cells: HEADCOUNT_VARIANCE,
1617
+ columns: t1,
1618
+ corner: t2,
1619
+ label: t3,
1620
+ rows: t4,
1621
+ scale: "diverging",
1622
+ size: "lg",
1623
+ valueLabel: t5,
1624
+ valueOptions: t6,
1625
+ values: true
1626
+ });
1627
+ $[13] = t0;
1628
+ $[14] = t1;
1629
+ $[15] = t2;
1630
+ $[16] = t3;
1631
+ $[17] = t4;
1632
+ $[18] = t5;
1633
+ $[19] = t7;
1634
+ } else t7 = $[19];
1635
+ return t7;
1636
+ }
1637
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { HEADCOUNT_VARIANCE, QUARTERS, TEAMS } from \"./readings.ts\";\n\nexport function Variance(): ReactElement {\n const { t } = useWords(\"heatmap\");\n\n return (\n <Heatmap\n caption={t(\"variance.caption\")}\n cells={HEADCOUNT_VARIANCE}\n columns={QUARTERS.map((key) => ({ key, label: t(`quarters.${key}`) }))}\n corner={t(\"variance.corner\")}\n label={t(\"variance.label\")}\n rows={TEAMS.map((key) => ({ key, label: t(`names.${key}`) }))}\n scale=\"diverging\"\n size=\"lg\"\n valueLabel={t(\"variance.value\")}\n valueOptions={{ signDisplay: \"exceptZero\" }}\n values\n />\n );\n}\n";
1638
+ //#endregion
1639
+ //#region src/heatmap/examples/wards.example.tsx
1640
+ var wards_example_exports = /* @__PURE__ */ __exportAll({
1641
+ Wards: () => Wards,
1642
+ source: () => source
1643
+ });
1644
+ function Wards() {
1645
+ const $ = c(22);
1646
+ const { t } = useWords("heatmap");
1647
+ let t0;
1648
+ if ($[0] !== t) {
1649
+ t0 = t("wards.caption");
1650
+ $[0] = t;
1651
+ $[1] = t0;
1652
+ } else t0 = $[1];
1653
+ let t1;
1654
+ if ($[2] !== t) {
1655
+ t1 = WORKDAYS.map((key) => ({
1656
+ key,
1657
+ label: t(`wards.days.${key}`)
1658
+ }));
1659
+ $[2] = t;
1660
+ $[3] = t1;
1661
+ } else t1 = $[3];
1662
+ let t2;
1663
+ if ($[4] !== t) {
1664
+ t2 = t("wards.corner");
1665
+ $[4] = t;
1666
+ $[5] = t2;
1667
+ } else t2 = $[5];
1668
+ let t3;
1669
+ if ($[6] !== t) {
1670
+ t3 = t("wards.label");
1671
+ $[6] = t;
1672
+ $[7] = t3;
1673
+ } else t3 = $[7];
1674
+ let t4;
1675
+ if ($[8] !== t) {
1676
+ t4 = t("wards.missing");
1677
+ $[8] = t;
1678
+ $[9] = t4;
1679
+ } else t4 = $[9];
1680
+ let t5;
1681
+ if ($[10] !== t) {
1682
+ t5 = WARDS.map((key_0) => ({
1683
+ key: key_0,
1684
+ label: t(`names.${key_0}`)
1685
+ }));
1686
+ $[10] = t;
1687
+ $[11] = t5;
1688
+ } else t5 = $[11];
1689
+ let t6;
1690
+ if ($[12] !== t) {
1691
+ t6 = t("wards.value");
1692
+ $[12] = t;
1693
+ $[13] = t6;
1694
+ } else t6 = $[13];
1695
+ let t7;
1696
+ if ($[14] !== t0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6) {
1697
+ t7 = /* @__PURE__ */ jsx(Heatmap, {
1698
+ caption: t0,
1699
+ cells: OCCUPANCY,
1700
+ columns: t1,
1701
+ corner: t2,
1702
+ label: t3,
1703
+ missingLabel: t4,
1704
+ rows: t5,
1705
+ valueLabel: t6
1706
+ });
1707
+ $[14] = t0;
1708
+ $[15] = t1;
1709
+ $[16] = t2;
1710
+ $[17] = t3;
1711
+ $[18] = t4;
1712
+ $[19] = t5;
1713
+ $[20] = t6;
1714
+ $[21] = t7;
1715
+ } else t7 = $[21];
1716
+ return t7;
1717
+ }
1718
+ const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Heatmap } from \"@stealthscale/component-charts\";\n\nimport { OCCUPANCY, WARDS, WORKDAYS } from \"./readings.ts\";\n\nexport function Wards(): ReactElement {\n const { t } = useWords(\"heatmap\");\n\n return (\n <Heatmap\n caption={t(\"wards.caption\")}\n cells={OCCUPANCY}\n columns={WORKDAYS.map((key) => ({ key, label: t(`wards.days.${key}`) }))}\n corner={t(\"wards.corner\")}\n label={t(\"wards.label\")}\n missingLabel={t(\"wards.missing\")}\n rows={WARDS.map((key) => ({ key, label: t(`names.${key}`) }))}\n valueLabel={t(\"wards.value\")}\n />\n );\n}\n";
1719
+ //#endregion
1720
+ //#region src/heatmap/heatmap.specimen.tsx
1721
+ /**
1722
+ * Catalogue page for the heatmap.
1723
+ *
1724
+ * @remarks
1725
+ * `scenesOf` generates the shape and size scenes from the heat recipe, the shapes rendered as a
1726
+ * calendar quarter. The other scenes are hand-written: a week of card authorisations with the
1727
+ * busiest hour in the caption, the readout at that hour, missing readings beside the fewest
1728
+ * counted, values printed in the cells, two weeks read on one domain, a diverging scale, a picked
1729
+ * cell, a dense grid that scrolls, a year of deploys as a calendar, a calendar whose weeks start
1730
+ * on Monday, a picked day, signup cohorts with their average, clinic cohorts with their counts, a
1731
+ * stated palette, the authorisations at a phone's width, and a heatmap without cells. Every scene
1732
+ * renders a component from `examples/` and shows that file as its source. The words are keys
1733
+ * under `heatmap` in `locales/en/specimen/heatmap.json`. The page imports the heatmap's barrel
1734
+ * directly, because the props reader follows a specimen's own imports and not an examples barrel.
1735
+ */
1736
+ /**
1737
+ * Hand-written scene for a week of card authorisations.
1738
+ */
1739
+ const authorised = {
1740
+ about: "heatmap.authorisations.about",
1741
+ draw: () => /* @__PURE__ */ jsx(Room, {
1742
+ size: "2xl",
1743
+ children: /* @__PURE__ */ jsx(Authorisations, {})
1744
+ }),
1745
+ example: authorisations_example_exports,
1746
+ title: "heatmap.authorisations.title"
1747
+ };
1748
+ /**
1749
+ * Hand-written scene for the readout at the busiest hour.
1750
+ */
1751
+ const readout = {
1752
+ about: "heatmap.readout.about",
1753
+ draw: () => /* @__PURE__ */ jsx(Room, {
1754
+ size: "2xl",
1755
+ children: /* @__PURE__ */ jsx(Readout, {})
1756
+ }),
1757
+ example: readout_example_exports,
1758
+ title: "heatmap.readout.title"
1759
+ };
1760
+ /**
1761
+ * Hand-written scene for missing readings beside the fewest counted.
1762
+ */
1763
+ const missing = {
1764
+ about: "heatmap.wards.about",
1765
+ draw: () => /* @__PURE__ */ jsx(Room, {
1766
+ size: "md",
1767
+ children: /* @__PURE__ */ jsx(Wards, {})
1768
+ }),
1769
+ example: wards_example_exports,
1770
+ title: "heatmap.wards.title"
1771
+ };
1772
+ /**
1773
+ * Hand-written scene for values printed in the cells.
1774
+ */
1775
+ const printed = {
1776
+ about: "heatmap.builds.about",
1777
+ draw: () => /* @__PURE__ */ jsx(Room, {
1778
+ size: "md",
1779
+ children: /* @__PURE__ */ jsx(Builds, {})
1780
+ }),
1781
+ example: builds_example_exports,
1782
+ title: "heatmap.builds.title"
1783
+ };
1784
+ /**
1785
+ * Hand-written scene for two weeks read on one domain.
1786
+ */
1787
+ const compared = {
1788
+ about: "heatmap.depots.about",
1789
+ draw: () => /* @__PURE__ */ jsx(Room, {
1790
+ size: "md",
1791
+ children: /* @__PURE__ */ jsx(Depots, {})
1792
+ }),
1793
+ example: depots_example_exports,
1794
+ title: "heatmap.depots.title"
1795
+ };
1796
+ /**
1797
+ * Hand-written scene for a diverging scale.
1798
+ */
1799
+ const diverged = {
1800
+ about: "heatmap.variance.about",
1801
+ draw: () => /* @__PURE__ */ jsx(Room, {
1802
+ size: "md",
1803
+ children: /* @__PURE__ */ jsx(Variance, {})
1804
+ }),
1805
+ example: variance_example_exports,
1806
+ title: "heatmap.variance.title"
1807
+ };
1808
+ /**
1809
+ * Hand-written scene for a picked cell.
1810
+ */
1811
+ const picked = {
1812
+ about: "heatmap.incidents.about",
1813
+ draw: () => /* @__PURE__ */ jsx(Room, {
1814
+ size: "md",
1815
+ children: /* @__PURE__ */ jsx(Incidents, {})
1816
+ }),
1817
+ example: incidents_example_exports,
1818
+ title: "heatmap.incidents.title"
1819
+ };
1820
+ /**
1821
+ * Hand-written scene for a dense grid that scrolls sideways.
1822
+ */
1823
+ const dense = {
1824
+ about: "heatmap.attendance.about",
1825
+ draw: () => /* @__PURE__ */ jsx(Room, {
1826
+ size: "md",
1827
+ children: /* @__PURE__ */ jsx(Attendance, {})
1828
+ }),
1829
+ example: attendance_example_exports,
1830
+ title: "heatmap.attendance.title"
1831
+ };
1832
+ /**
1833
+ * Hand-written scene for a year of deploys laid out as a calendar.
1834
+ */
1835
+ const calendar = {
1836
+ about: "heatmap.deploys.about",
1837
+ draw: () => /* @__PURE__ */ jsx(Room, {
1838
+ size: "2xl",
1839
+ children: /* @__PURE__ */ jsx(Deploys, {})
1840
+ }),
1841
+ example: deploys_example_exports,
1842
+ title: "heatmap.deploys.title"
1843
+ };
1844
+ /**
1845
+ * Hand-written scene for a calendar whose weeks start on Monday.
1846
+ */
1847
+ const weekStart = {
1848
+ about: "heatmap.pages.about",
1849
+ draw: () => /* @__PURE__ */ jsx(Room, {
1850
+ size: "md",
1851
+ children: /* @__PURE__ */ jsx(Pages, {})
1852
+ }),
1853
+ example: pages_example_exports,
1854
+ title: "heatmap.pages.title"
1855
+ };
1856
+ /**
1857
+ * Hand-written scene for a picked day.
1858
+ */
1859
+ const pickedDay = {
1860
+ about: "heatmap.bookings.about",
1861
+ draw: () => /* @__PURE__ */ jsx(Room, {
1862
+ size: "lg",
1863
+ children: /* @__PURE__ */ jsx(Bookings, {})
1864
+ }),
1865
+ example: bookings_example_exports,
1866
+ title: "heatmap.bookings.title"
1867
+ };
1868
+ /**
1869
+ * Hand-written scene for signup cohorts with their average.
1870
+ */
1871
+ const cohorts = {
1872
+ about: "heatmap.signups.about",
1873
+ draw: () => /* @__PURE__ */ jsx(Room, {
1874
+ size: "3xl",
1875
+ children: /* @__PURE__ */ jsx(Signups, {})
1876
+ }),
1877
+ example: signups_example_exports,
1878
+ title: "heatmap.signups.title"
1879
+ };
1880
+ /**
1881
+ * Hand-written scene for clinic cohorts with their counts.
1882
+ */
1883
+ const counted = {
1884
+ about: "heatmap.clinic.about",
1885
+ draw: () => /* @__PURE__ */ jsx(Room, {
1886
+ size: "2xl",
1887
+ children: /* @__PURE__ */ jsx(Clinic, {})
1888
+ }),
1889
+ example: clinic_example_exports,
1890
+ title: "heatmap.clinic.title"
1891
+ };
1892
+ /**
1893
+ * Hand-written scene for a stated palette.
1894
+ */
1895
+ const tinted = {
1896
+ about: "heatmap.palette.about",
1897
+ draw: () => /* @__PURE__ */ jsx(Room, {
1898
+ size: "2xl",
1899
+ children: /* @__PURE__ */ jsx(Palette, {})
1900
+ }),
1901
+ example: palette_example_exports,
1902
+ title: "heatmap.palette.title"
1903
+ };
1904
+ /**
1905
+ * Hand-written scene for the authorisations at a phone's width.
1906
+ */
1907
+ const narrow = {
1908
+ about: "heatmap.narrow.about",
1909
+ draw: () => /* @__PURE__ */ jsx(Room, {
1910
+ size: "xs",
1911
+ children: /* @__PURE__ */ jsx(Authorisations, {})
1912
+ }),
1913
+ example: authorisations_example_exports,
1914
+ title: "heatmap.narrow.title"
1915
+ };
1916
+ /**
1917
+ * Hand-written scene for a heatmap without cells.
1918
+ */
1919
+ const empty = {
1920
+ about: "heatmap.quiet.about",
1921
+ draw: () => /* @__PURE__ */ jsx(Room, {
1922
+ size: "md",
1923
+ children: /* @__PURE__ */ jsx(Quiet, {})
1924
+ }),
1925
+ example: quiet_example_exports,
1926
+ title: "heatmap.quiet.title"
1927
+ };
1928
+ var heatmap_specimen_default = specimen({
1929
+ about: "heatmap.about",
1930
+ id: "components/charts/heatmap",
1931
+ imports: "import { Heatmap } from \"@stealthscale/component-charts\";",
1932
+ scenes: [
1933
+ authorised,
1934
+ readout,
1935
+ missing,
1936
+ printed,
1937
+ compared,
1938
+ diverged,
1939
+ picked,
1940
+ dense,
1941
+ calendar,
1942
+ weekStart,
1943
+ pickedDay,
1944
+ cohorts,
1945
+ counted,
1946
+ ...scenesOf(recipe, {
1947
+ axes: {
1948
+ shape: {
1949
+ direction: "column",
1950
+ draw: (props) => /* @__PURE__ */ jsx(Quarter, { ...props }),
1951
+ example: quarter_example_exports
1952
+ },
1953
+ size: { direction: "column" }
1954
+ },
1955
+ draw: (props) => /* @__PURE__ */ jsx(Sizes, { ...props }),
1956
+ example: sizes_example_exports,
1957
+ namespace: "heatmap",
1958
+ order: ["shape", "size"]
1959
+ }),
1960
+ tinted,
1961
+ narrow,
1962
+ empty
1963
+ ],
1964
+ title: "heatmap.title"
1965
+ });
1966
+ //#endregion
1967
+ export { authorised, calendar, cohorts, compared, counted, heatmap_specimen_default as default, dense, diverged, empty, missing, narrow, picked, pickedDay, printed, readout, tinted, weekStart };