@alfadocs/ui-kit 1.65.0 → 1.67.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 (158) hide show
  1. package/dist/_chunks/ai-credits-exhausted-notice-DfAgfZDF.js +287 -0
  2. package/dist/_chunks/ai-credits-exhausted-notice.agent-DgTSTgez.js +43 -0
  3. package/dist/_chunks/ai-credits-notice-DQ-r3iQU.js +191 -0
  4. package/dist/_chunks/{ai-permission-notice-DpRmZ9Q3.js → ai-permission-notice-qsdm4Sx4.js} +2 -2
  5. package/dist/_chunks/{alert-DdDpOi-P.js → alert-DjsJMGRE.js} +3 -2
  6. package/dist/_chunks/{anamnesis-summary-rows-BIfw890v.js → anamnesis-summary-rows-BQ_EokKz.js} +2 -2
  7. package/dist/_chunks/{audio-recorder-DR-u1qbl.js → audio-recorder-B11RR-rC.js} +2 -2
  8. package/dist/_chunks/{auth-form-parts-Cmb41LSQ.js → auth-form-parts-DwUTH6YN.js} +2 -2
  9. package/dist/_chunks/{booking-DkjatiXc.js → booking-tTVxKPQY.js} +2 -2
  10. package/dist/_chunks/{calendar-workspace-Cp8yTZ1g.js → calendar-workspace-MRrzcxAy.js} +6 -6
  11. package/dist/_chunks/chart-CwmyCuWe.js +1340 -0
  12. package/dist/_chunks/{document-preview-B1dQm292.js → document-preview-VyQOjFVL.js} +2 -2
  13. package/dist/_chunks/{document-scanner-CVPVLK7z.js → document-scanner-CXH_GYh4.js} +2 -2
  14. package/dist/_chunks/{entity-summary-BQ9_KA8S.js → entity-summary-Bj-Wxq7Y.js} +2 -2
  15. package/dist/_chunks/{error-summary-DrUfuKu1.js → error-summary-PUE5Zxp9.js} +2 -2
  16. package/dist/_chunks/{forgot-password-form-CgZkEvZy.js → forgot-password-form-CPOfRE0C.js} +4 -4
  17. package/dist/_chunks/{freemium-paywall-DKJHRFpp.js → freemium-paywall-6DO7noHX.js} +2 -2
  18. package/dist/_chunks/heatmap-C1TeC7wT.js +3650 -0
  19. package/dist/_chunks/help-me-write-templates-Bw3Q58x-.js +687 -0
  20. package/dist/_chunks/hourglass-BEAzW1wE.js +26 -0
  21. package/dist/_chunks/{login-dev-card-PnADNcI9.js → login-dev-card-A-CL3mjt.js} +3 -3
  22. package/dist/_chunks/{marketplace-app-shell-C-2e4eCD.js → marketplace-app-shell-DtSX8sYb.js} +2 -2
  23. package/dist/_chunks/{notes-panel-uEGIL7mi.js → notes-panel-IdsmqRFC.js} +3 -3
  24. package/dist/_chunks/{patient-details-4P1vA9Ls.js → patient-details-C-EWQTms.js} +2 -2
  25. package/dist/_chunks/{patient-field-row-CBXhlfGD.js → patient-field-row-lY-Tb5Mo.js} +155 -176
  26. package/dist/_chunks/{patient-search-DOnDUVsl.js → patient-search-DpAKidZ5.js} +2 -2
  27. package/dist/_chunks/{patient-summary-card-CuDLo8MP.js → patient-summary-card-Bpto_VCD.js} +2 -2
  28. package/dist/_chunks/{payment-automation-upsell-C8MEu0t6.js → payment-automation-upsell-BQ307qEX.js} +2 -2
  29. package/dist/_chunks/{payment-form-C3dGY7v4.js → payment-form-XKtinW8r.js} +2 -2
  30. package/dist/_chunks/{pdf-viewer-DJ9VN7cu.js → pdf-viewer-BvoVMjH4.js} +2 -2
  31. package/dist/_chunks/{practice-results-8h2Utpt3.js → practice-results-BrUDDMXC.js} +2 -2
  32. package/dist/_chunks/{registration-form-BQyT_kBX.js → registration-form-BxwqUZzk.js} +3 -3
  33. package/dist/_chunks/{rich-text-editor-M2gT_E7f.js → rich-text-editor-aCIoptbg.js} +1653 -1743
  34. package/dist/_chunks/{sign-document-CY7xTXbm.js → sign-document-D1P1nUQA.js} +2 -2
  35. package/dist/_chunks/{signature-request-BMCHy2ZO.js → signature-request-3u6TvRt2.js} +2 -2
  36. package/dist/_chunks/{task-editor-CifOznfq.js → task-editor-Bb5MMcid.js} +2 -2
  37. package/dist/_chunks/{tasks-panel-8nLwBw6P.js → tasks-panel-BOb57Ysw.js} +2 -2
  38. package/dist/_chunks/{use-appointment-details-read-B-FEWbQM.js → use-appointment-details-read-CVSPoP5j.js} +4 -4
  39. package/dist/_chunks/voice-control-panel-BJIEbDq6.js +1148 -0
  40. package/dist/_chunks/{warning-stack-HYWAytZV.js → warning-stack-BdY-0bd3.js} +2 -2
  41. package/dist/_chunks/{workflow-map-C2B2qIr1.js → workflow-map-CYbRD9ek.js} +2 -2
  42. package/dist/agent-catalog.json +50 -3
  43. package/dist/agent-i18n/en.json +7 -4
  44. package/dist/components/_shared/use-apex-radial-centre.d.ts +7 -4
  45. package/dist/components/ai-credits-notice/ai-credits-exhausted-notice.agent.d.ts +4 -0
  46. package/dist/components/ai-credits-notice/ai-credits-exhausted-notice.d.ts +96 -0
  47. package/dist/components/ai-credits-notice/ai-credits-notice.d.ts +30 -4
  48. package/dist/components/ai-credits-notice/index.d.ts +3 -0
  49. package/dist/components/ai-credits-notice/index.js +10 -4
  50. package/dist/components/ai-permission-notice/index.js +1 -1
  51. package/dist/components/alert/index.js +1 -1
  52. package/dist/components/appointment-details-panel/index.js +1 -1
  53. package/dist/components/audio-recorder/index.js +1 -1
  54. package/dist/components/booking/index.js +1 -1
  55. package/dist/components/chart/index.js +1 -1
  56. package/dist/components/document-preview/index.js +1 -1
  57. package/dist/components/document-scanner/index.js +1 -1
  58. package/dist/components/entity-summary/index.js +1 -1
  59. package/dist/components/error-summary/index.js +1 -1
  60. package/dist/components/freemium-paywall/index.js +1 -1
  61. package/dist/components/heatmap/heatmap-context.d.ts +3 -0
  62. package/dist/components/heatmap/heatmap-disclosure.d.ts +67 -0
  63. package/dist/components/heatmap/heatmap-grid.d.ts +1 -1
  64. package/dist/components/heatmap/heatmap-legend.d.ts +5 -2
  65. package/dist/components/heatmap/heatmap-model.d.ts +107 -15
  66. package/dist/components/heatmap/heatmap-table-view.d.ts +3 -2
  67. package/dist/components/heatmap/heatmap.d.ts +33 -7
  68. package/dist/components/heatmap/index.d.ts +1 -1
  69. package/dist/components/heatmap/index.js +1 -1
  70. package/dist/components/notes-panel/index.js +1 -1
  71. package/dist/components/patient-details/index.js +1 -1
  72. package/dist/components/patient-search/index.js +1 -1
  73. package/dist/components/patient-summary-card/index.js +1 -1
  74. package/dist/components/payment-form/index.js +1 -1
  75. package/dist/components/pdf-viewer/index.js +1 -1
  76. package/dist/components/practice-results/index.js +1 -1
  77. package/dist/components/rich-text-editor/index.js +1 -1
  78. package/dist/components/sign-document/index.js +1 -1
  79. package/dist/components/task-editor/index.js +1 -1
  80. package/dist/components/tasks-panel/index.js +1 -1
  81. package/dist/components/voice-control-panel/index.d.ts +2 -1
  82. package/dist/components/voice-control-panel/index.js +1 -1
  83. package/dist/components/voice-control-panel/voice-control-panel.d.ts +43 -3
  84. package/dist/components/warning-stack/index.js +1 -1
  85. package/dist/components/workflow/index.js +1 -1
  86. package/dist/i18n/locales/ar.d.ts +29 -12
  87. package/dist/i18n/locales/ar.js +29 -12
  88. package/dist/i18n/locales/de.d.ts +29 -12
  89. package/dist/i18n/locales/de.js +29 -12
  90. package/dist/i18n/locales/el.d.ts +29 -12
  91. package/dist/i18n/locales/el.js +29 -12
  92. package/dist/i18n/locales/en.d.ts +29 -12
  93. package/dist/i18n/locales/en.js +29 -12
  94. package/dist/i18n/locales/es.d.ts +29 -12
  95. package/dist/i18n/locales/es.js +29 -12
  96. package/dist/i18n/locales/fr.d.ts +29 -12
  97. package/dist/i18n/locales/fr.js +29 -12
  98. package/dist/i18n/locales/hi.d.ts +29 -12
  99. package/dist/i18n/locales/hi.js +29 -12
  100. package/dist/i18n/locales/it.d.ts +29 -12
  101. package/dist/i18n/locales/it.js +29 -12
  102. package/dist/i18n/locales/ja.d.ts +29 -12
  103. package/dist/i18n/locales/ja.js +29 -12
  104. package/dist/i18n/locales/nl.d.ts +29 -12
  105. package/dist/i18n/locales/nl.js +29 -12
  106. package/dist/i18n/locales/pl.d.ts +29 -12
  107. package/dist/i18n/locales/pl.js +29 -12
  108. package/dist/i18n/locales/pt.d.ts +29 -12
  109. package/dist/i18n/locales/pt.js +29 -12
  110. package/dist/i18n/locales/ro.d.ts +29 -12
  111. package/dist/i18n/locales/ro.js +29 -12
  112. package/dist/i18n/locales/ru.d.ts +29 -12
  113. package/dist/i18n/locales/ru.js +29 -12
  114. package/dist/i18n/locales/sq.d.ts +29 -12
  115. package/dist/i18n/locales/sq.js +29 -12
  116. package/dist/i18n/locales/sv.d.ts +29 -12
  117. package/dist/i18n/locales/sv.js +29 -12
  118. package/dist/i18n/locales/tr.d.ts +29 -12
  119. package/dist/i18n/locales/tr.js +29 -12
  120. package/dist/i18n/locales/zh.d.ts +29 -12
  121. package/dist/i18n/locales/zh.js +29 -12
  122. package/dist/index.js +814 -809
  123. package/dist/locales/ar.json +29 -12
  124. package/dist/locales/de.json +29 -12
  125. package/dist/locales/el.json +29 -12
  126. package/dist/locales/en.json +29 -12
  127. package/dist/locales/es.json +29 -12
  128. package/dist/locales/fr.json +29 -12
  129. package/dist/locales/hi.json +29 -12
  130. package/dist/locales/it.json +29 -12
  131. package/dist/locales/ja.json +29 -12
  132. package/dist/locales/nl.json +29 -12
  133. package/dist/locales/pl.json +29 -12
  134. package/dist/locales/pt.json +29 -12
  135. package/dist/locales/ro.json +29 -12
  136. package/dist/locales/ru.json +29 -12
  137. package/dist/locales/sq.json +29 -12
  138. package/dist/locales/sv.json +29 -12
  139. package/dist/locales/tr.json +29 -12
  140. package/dist/locales/zh.json +29 -12
  141. package/dist/patterns/anamnesis/index.js +1 -1
  142. package/dist/patterns/calendar/index.js +1 -1
  143. package/dist/patterns/forgot-password-form/index.js +1 -1
  144. package/dist/patterns/help-me-write-templates/help-me-write-templates.d.ts +6 -23
  145. package/dist/patterns/help-me-write-templates/index.js +8 -7
  146. package/dist/patterns/login-form/index.js +1 -1
  147. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  148. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  149. package/dist/patterns/registration-form/index.js +1 -1
  150. package/dist/patterns/signature-request/index.js +1 -1
  151. package/dist/tokens.css +1 -1
  152. package/package.json +1 -1
  153. package/dist/_chunks/ai-credits-notice-pK9BOmEz.js +0 -90
  154. package/dist/_chunks/ai-credits-notice.agent-C9L7orrP.js +0 -17
  155. package/dist/_chunks/chart-CIzXxNeM.js +0 -1322
  156. package/dist/_chunks/heatmap-BxRHM8Et.js +0 -2865
  157. package/dist/_chunks/help-me-write-templates-DFmqnsAa.js +0 -747
  158. package/dist/_chunks/voice-control-panel-C0BfY23Y.js +0 -1009
@@ -1,2865 +0,0 @@
1
- import { jsx as v, jsxs as P, Fragment as La } from "react/jsx-runtime";
2
- import { useContext as Ea, createContext as Aa, useId as Ka, useRef as $, useMemo as _, useState as le, useCallback as C, useEffect as gt, memo as Ca, forwardRef as fa, lazy as va, Suspense as Ha } from "react";
3
- import { useTranslation as Ht } from "react-i18next";
4
- import { u as Oa } from "./registry-DvAUVLHh.js";
5
- import { f as wa } from "./intl-locale-FWh-Y5_3.js";
6
- import { B as za } from "./button-D-MQxsA_.js";
7
- import { E as Va } from "./empty-state-pL1qum99.js";
8
- import { L as Ba } from "./live-region-C41SO3cA.js";
9
- import { S as jt } from "./skeleton-B1KTdJ4N.js";
10
- import { T as ba, a as Fa } from "./tooltip-uEBdD1-5.js";
11
- import { p as Ga } from "./privacy-mask-Ch7743uk.js";
12
- import { u as Je } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
13
- import { i as $a } from "./is-development-CLUAnsU7.js";
14
- import { c as oe } from "./index-D2ZczOXr.js";
15
- import { C as Da } from "./chevron-down-DWE7GSq9.js";
16
- import { E as ja } from "./error-boundary-Dzgu3O6W.js";
17
- import { c as ya } from "./createLucideIcon-DhHxpK9K.js";
18
- /**
19
- * @license lucide-react v1.22.0 - ISC
20
- *
21
- * This source code is licensed under the ISC license.
22
- * See the LICENSE file in the root directory of this source tree.
23
- */
24
- const Pa = [
25
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
26
- ["path", { d: "M3 9h18", key: "1pudct" }],
27
- ["path", { d: "M3 15h18", key: "5xshup" }],
28
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
29
- ["path", { d: "M15 3v18", key: "14nvp0" }]
30
- ], qa = ya("grid-3x3", Pa);
31
- /**
32
- * @license lucide-react v1.22.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */
37
- const Wa = [
38
- [
39
- "path",
40
- {
41
- d: "M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",
42
- key: "gugj83"
43
- }
44
- ]
45
- ], Ua = ya("table-2", Wa), ut = {
46
- type: "object",
47
- properties: {
48
- rowId: { type: "string", description: "Row id, from rowIds." },
49
- columnId: {
50
- type: ["string", "number"],
51
- description: "Column id, from columnIds."
52
- }
53
- },
54
- required: ["rowId", "columnId"]
55
- }, Ya = {
56
- id: "heatmap",
57
- capabilities: [
58
- "select_single",
59
- "select_multiple",
60
- "range_pick",
61
- "expand",
62
- "sort",
63
- "view_change"
64
- ],
65
- state: {
66
- selection: {
67
- type: "Array<{ rowId, columnId }>",
68
- descriptionKey: "ui.agent.heatmap.state.selection",
69
- description: "Row and column ids of the selected cells.",
70
- read: (e) => e.getSelection()
71
- },
72
- selectionMode: {
73
- type: "'none' | 'single' | 'multiple' | 'range'",
74
- descriptionKey: "ui.agent.heatmap.state.selectionMode",
75
- description: "How cells can be selected in this heatmap.",
76
- read: (e) => e.getSelectionMode()
77
- },
78
- view: {
79
- type: "'heatmap' | 'table'",
80
- descriptionKey: "ui.agent.heatmap.state.view",
81
- description: "Whether the heatmap or its table view is showing.",
82
- read: (e) => e.getView()
83
- },
84
- sortRows: {
85
- type: "'none' | 'label' | 'total-asc' | 'total-desc'",
86
- descriptionKey: "ui.agent.heatmap.state.sortRows",
87
- description: "Current row order.",
88
- read: (e) => e.getSortRows()
89
- },
90
- rowIds: {
91
- type: "string[]",
92
- descriptionKey: "ui.agent.heatmap.state.rowIds",
93
- description: "Row ids in display order, every group expanded. Opaque, never a label.",
94
- read: (e) => e.getRowIds()
95
- },
96
- columnIds: {
97
- type: "Array<string | number>",
98
- descriptionKey: "ui.agent.heatmap.state.columnIds",
99
- description: "Column ids in order. Opaque, never a label.",
100
- read: (e) => e.getColumnIds()
101
- },
102
- groupIds: {
103
- type: "string[]",
104
- descriptionKey: "ui.agent.heatmap.state.groupIds",
105
- description: "Group ids in display order, empty unless rows are grouped. A group not listed in `groups` shows as group-1, group-2 and so on.",
106
- read: (e) => e.getGroupIds()
107
- },
108
- collapsedGroups: {
109
- type: "string[]",
110
- descriptionKey: "ui.agent.heatmap.state.collapsedGroups",
111
- description: "Ids (as in groupIds) of the row groups that are collapsed.",
112
- read: (e) => e.getCollapsedGroups()
113
- }
114
- },
115
- actions: {
116
- select_cell: {
117
- safety: "read",
118
- argsType: "{ rowId: string, columnId: string | number }",
119
- argsSchema: ut,
120
- idempotent: !0,
121
- descriptionKey: "ui.agent.heatmap.actions.selectCell",
122
- description: "Make one cell the whole selection.",
123
- errors: [
124
- 'Selection is off (selection="none").',
125
- "The row or column id does not exist."
126
- ],
127
- examples: [
128
- {
129
- args: { rowId: "chair-1", columnId: 10 },
130
- note: "Select chair 1 at 10:00."
131
- }
132
- ],
133
- invoke: (e, t) => {
134
- e.selectCells([t]);
135
- }
136
- },
137
- select_cells: {
138
- safety: "read",
139
- argsType: "{ cells: Array<{ rowId, columnId }> }",
140
- argsSchema: {
141
- type: "object",
142
- properties: {
143
- cells: {
144
- type: "array",
145
- items: ut,
146
- description: "Cells to select; replaces the selection. Single mode keeps the first."
147
- }
148
- },
149
- required: ["cells"]
150
- },
151
- idempotent: !0,
152
- descriptionKey: "ui.agent.heatmap.actions.selectCells",
153
- description: "Replace the selection with the given cells.",
154
- errors: [
155
- 'Selection is off (selection="none").',
156
- "A row or column id does not exist; nothing is selected."
157
- ],
158
- invoke: (e, t) => {
159
- e.selectCells(t.cells);
160
- }
161
- },
162
- select_range: {
163
- safety: "read",
164
- argsType: "{ from: { rowId, columnId }, to: { rowId, columnId } }",
165
- argsSchema: {
166
- type: "object",
167
- properties: {
168
- from: { ...ut, description: "One corner, inclusive." },
169
- to: { ...ut, description: "The opposite corner, inclusive." }
170
- },
171
- required: ["from", "to"]
172
- },
173
- idempotent: !0,
174
- descriptionKey: "ui.agent.heatmap.actions.selectRange",
175
- description: "Select the rectangle of cells between two corners, in the rows as shown.",
176
- errors: [
177
- 'Needs selection="range" or "multiple".',
178
- "A corner names a row or column that does not exist."
179
- ],
180
- invoke: (e, t) => {
181
- e.selectRange(t.from, t.to);
182
- }
183
- },
184
- clear_selection: {
185
- safety: "read",
186
- idempotent: !0,
187
- descriptionKey: "ui.agent.heatmap.actions.clearSelection",
188
- description: "Deselect every cell.",
189
- errors: ['Selection is off (selection="none").'],
190
- invoke: (e) => {
191
- e.clearSelection();
192
- }
193
- },
194
- read_cell: {
195
- safety: "read",
196
- argsType: "{ rowId: string, columnId: string | number }",
197
- argsSchema: ut,
198
- returns: "{ value, count, status, step } | null",
199
- returnsSchema: {
200
- type: ["object", "null"],
201
- properties: {
202
- value: { type: ["number", "null"] },
203
- count: { type: "number" },
204
- status: { enum: ["value", "empty", "low-sample"] },
205
- step: { type: ["number", "null"] }
206
- }
207
- },
208
- idempotent: !0,
209
- descriptionKey: "ui.agent.heatmap.actions.readCell",
210
- description: "Read a cell's value, count, status and colour step (no labels).",
211
- invoke: (e, t) => e.readCell(t)
212
- },
213
- toggle_table_view: {
214
- safety: "read",
215
- descriptionKey: "ui.agent.heatmap.actions.toggleTableView",
216
- description: "Switch between the heatmap and its table view.",
217
- returns: "'heatmap' | 'table'",
218
- returnsSchema: { enum: ["heatmap", "table"] },
219
- invoke: (e) => {
220
- const t = e.getView() === "table" ? "heatmap" : "table";
221
- return e.setView(t), t;
222
- }
223
- },
224
- set_view: {
225
- safety: "read",
226
- argsType: "{ view: 'heatmap' | 'table' }",
227
- argsSchema: {
228
- type: "object",
229
- properties: {
230
- view: {
231
- enum: ["heatmap", "table"],
232
- description: "The coloured grid, or the same data as a table."
233
- }
234
- },
235
- required: ["view"]
236
- },
237
- idempotent: !0,
238
- descriptionKey: "ui.agent.heatmap.actions.setView",
239
- description: "Show the heatmap or its table view.",
240
- invoke: (e, t) => {
241
- e.getView() !== t.view && e.setView(t.view);
242
- }
243
- },
244
- sort_rows: {
245
- safety: "read",
246
- argsType: "{ sort: 'none' | 'label' | 'total-asc' | 'total-desc' }",
247
- argsSchema: {
248
- type: "object",
249
- properties: {
250
- sort: {
251
- enum: ["none", "label", "total-asc", "total-desc"],
252
- description: "Row order within each group: as given, by label, or by row total."
253
- }
254
- },
255
- required: ["sort"]
256
- },
257
- idempotent: !0,
258
- descriptionKey: "ui.agent.heatmap.actions.sortRows",
259
- description: "Reorder the rows.",
260
- invoke: (e, t) => {
261
- e.setSortRows(t.sort);
262
- }
263
- },
264
- expand_group: {
265
- safety: "read",
266
- argsType: "{ groupId: string }",
267
- argsSchema: {
268
- type: "object",
269
- properties: {
270
- groupId: { type: "string", description: "Group id, from groupIds." }
271
- },
272
- required: ["groupId"]
273
- },
274
- idempotent: !0,
275
- descriptionKey: "ui.agent.heatmap.actions.expandGroup",
276
- description: "Show a group's rows.",
277
- errors: [
278
- "Rows are not grouped (groupRows is off).",
279
- "The group id does not exist (see groupIds)."
280
- ],
281
- invoke: (e, t) => {
282
- e.setGroupCollapsed(t.groupId, !1);
283
- }
284
- },
285
- collapse_group: {
286
- safety: "read",
287
- argsType: "{ groupId: string }",
288
- argsSchema: {
289
- type: "object",
290
- properties: {
291
- groupId: { type: "string", description: "Group id, from groupIds." }
292
- },
293
- required: ["groupId"]
294
- },
295
- idempotent: !0,
296
- descriptionKey: "ui.agent.heatmap.actions.collapseGroup",
297
- description: "Hide a group's rows, leaving its totals row.",
298
- errors: [
299
- "Rows are not grouped (groupRows is off).",
300
- "The group id does not exist (see groupIds)."
301
- ],
302
- invoke: (e, t) => {
303
- e.setGroupCollapsed(t.groupId, !0);
304
- }
305
- }
306
- },
307
- domHooks: {
308
- root: {
309
- attr: "data-component",
310
- value: "heatmap",
311
- description: "Marks the Heatmap root."
312
- },
313
- instanceId: {
314
- attr: "data-component-id",
315
- sourceProp: "id",
316
- description: "Sourced from the id prop on Heatmap."
317
- },
318
- item: {
319
- attr: "data-heatmap-cell-id",
320
- description: 'On every data cell: "<rowId>:<columnId>", built from the opaque ids, never from labels. A group header row and its cells carry data-heatmap-group-id, the group id as in groupIds.'
321
- }
322
- }
323
- }, Tt = Aa(null);
324
- function xa() {
325
- return Ea(Tt);
326
- }
327
- function Ia(e, t) {
328
- const a = new Intl.NumberFormat(
329
- e,
330
- t === "rate" ? { style: "percent", maximumFractionDigits: 0 } : { maximumFractionDigits: 2 }
331
- );
332
- return (o) => a.format(o);
333
- }
334
- function ka(e) {
335
- const t = new Intl.NumberFormat(e, { maximumFractionDigits: 0 });
336
- return (a) => t.format(a);
337
- }
338
- const Ja = "–";
339
- function Qa({
340
- t: e,
341
- privacyMode: t,
342
- privacyScope: a = "rows",
343
- valueType: o,
344
- formatValue: s,
345
- formatCount: c,
346
- groups: l
347
- }) {
348
- const b = new Map(l == null ? void 0 : l.map((p) => [p.id, p.label])), w = Ga(), m = t, x = t && a === "all", k = t && a === "all", g = (p) => p.status === "empty" ? e("heatmap.noData") : p.status === "low-sample" ? e("heatmap.lowSample") : p.label !== void 0 && !t ? p.label : p.value === null ? e("heatmap.noData") : s(p.value), M = (p) => p.count === void 0 ? null : o === "rate" && p.status === "value" && p.value !== null ? e("heatmap.countOf", {
349
- part: c(Math.round(p.value * p.count)),
350
- total: c(p.count)
351
- }) : e("heatmap.records", {
352
- count: p.count,
353
- formatted: c(p.count)
354
- });
355
- return {
356
- masksRows: m,
357
- masksColumns: x,
358
- masksGroups: k,
359
- rowLabel: (p) => m ? w : p.label,
360
- columnLabel: (p) => x ? w : p.label,
361
- // A group missing from `groups` has only its id to show, which may be a
362
- // name, so privacy mode masks it whatever the scope.
363
- groupLabel: (p) => k ? w : b.get(p) ?? (t ? w : p),
364
- cellName: (p, E) => e("heatmap.cellName", { row: p, column: E }),
365
- groupRowText: (p, E) => e("heatmap.groupRow", {
366
- group: p,
367
- method: e(E === "sum" ? "heatmap.totals.sum" : "heatmap.totals.mean")
368
- }),
369
- tableText: (p) => {
370
- const E = p.status === "empty" ? null : M(p), D = g(p);
371
- return E === null ? D : e("heatmap.valueWithCount", { value: D, count: E });
372
- },
373
- methodLabel: (p) => e(p === "sum" ? "heatmap.totals.sum" : "heatmap.totals.mean"),
374
- valueText: g,
375
- visibleText: (p) => p.status === "empty" ? Ja : p.status === "low-sample" ? "" : g(p),
376
- countText: M,
377
- sentence: (p, E, D) => {
378
- const A = M(D), I = g(D);
379
- return A === null || D.status === "empty" ? e("heatmap.cell", { row: p, column: E, value: I }) : e("heatmap.cellWithCount", {
380
- row: p,
381
- column: E,
382
- value: I,
383
- count: A
384
- });
385
- },
386
- formatValue: s
387
- };
388
- }
389
- const be = 10, Xt = Math.floor(be / 2), Qe = be - 1, Ye = be / 2, Ze = (e, t, a) => Math.min(a, Math.max(t, e)), aa = /* @__PURE__ */ new Set();
390
- function Pt(e) {
391
- !$a() || aa.has(e) || (aa.add(e), console.warn(`Heatmap: ${e}`));
392
- }
393
- function ra(e) {
394
- return e[0] <= e[1] ? e : (Pt(
395
- `scale domain [${e[0]}, ${e[1]}] is reversed; using [${e[1]}, ${e[0]}].`
396
- ), [e[1], e[0]]);
397
- }
398
- function Sa(e) {
399
- const t = e.filter(Number.isFinite).sort((a, o) => a - o);
400
- return t.filter((a, o) => o === 0 || a !== t[o - 1]);
401
- }
402
- function Xa(e) {
403
- let t = 1 / 0, a = -1 / 0;
404
- for (const o of e)
405
- Number.isFinite(o) && (o < t && (t = o), o > a && (a = o));
406
- return t === 1 / 0 ? null : [t, a];
407
- }
408
- function Za(e, t, a) {
409
- if (!(a > t)) return Xt;
410
- const o = Ze((e - t) / (a - t), 0, 1);
411
- return Math.min(Qe, Math.floor(o * be));
412
- }
413
- function er(e, t, a, o) {
414
- if (e < a) {
415
- const l = a - t, b = l > 0 ? Ze((a - e) / l, 0, 1) : 1;
416
- return Ye - 1 - Math.min(Ye - 1, Math.floor(b * Ye));
417
- }
418
- const s = o - a, c = s > 0 ? Ze((e - a) / s, 0, 1) : e > a ? 1 : 0;
419
- return Ye + Math.min(Ye - 1, Math.floor(c * Ye));
420
- }
421
- function tr(e, t) {
422
- if (e.type !== "diverging" || e.midpoint === void 0) return !1;
423
- const a = Math.max(
424
- Math.abs(e.midpoint),
425
- Math.abs(e.min ?? 0),
426
- Math.abs(e.max ?? 0)
427
- );
428
- return Math.abs(t - e.midpoint) <= a * Number.EPSILON * 16;
429
- }
430
- function ar(e, t) {
431
- const a = e.length;
432
- if (a === 0) return NaN;
433
- if (a === 1) return e[0];
434
- const o = Ze(t, 0, 1) * (a - 1), s = Math.floor(o), c = Math.min(a - 1, s + 1);
435
- return e[s] + (e[c] - e[s]) * (o - s);
436
- }
437
- function rr(e, t) {
438
- const a = Math.max(1, Math.round(t)), o = [];
439
- for (let s = 1; s < a; s += 1)
440
- o.push(ar(e, s / a));
441
- return o;
442
- }
443
- function nr(e, t) {
444
- if (e.length === 0) return [];
445
- const a = e[0], o = (s) => {
446
- let c = 0, l = e.length - 1;
447
- for (; c < l; ) {
448
- const b = c + l >>> 1;
449
- e[b] < s ? c = b + 1 : l = b;
450
- }
451
- return e[c];
452
- };
453
- return Sa(
454
- rr(e, t).map(o)
455
- ).filter((s) => s > a);
456
- }
457
- function na(e, t) {
458
- let a = 0, o = t.length;
459
- for (; a < o; ) {
460
- const s = a + o >>> 1;
461
- t[s] <= e ? a = s + 1 : o = s;
462
- }
463
- return a;
464
- }
465
- function qt(e, t) {
466
- return t <= 1 ? Xt : Math.round(
467
- Ze(e, 0, t - 1) * Qe / (t - 1)
468
- );
469
- }
470
- function Wt(e, t) {
471
- const a = Xa(t);
472
- switch (e.type) {
473
- case "diverging": {
474
- const o = e.domain && e.domain !== "auto" ? ra(e.domain) : null, s = e.midpoint ?? (o && (o[0] > 0 || o[1] < 0) ? (o[0] + o[1]) / 2 : 0);
475
- let c, l;
476
- if (o)
477
- [c, l] = o;
478
- else {
479
- const b = a ? Math.max(
480
- Math.abs(a[0] - s),
481
- Math.abs(a[1] - s)
482
- ) : 0;
483
- c = s - b, l = s + b;
484
- }
485
- return {
486
- type: "diverging",
487
- min: c,
488
- max: l,
489
- midpoint: s,
490
- thresholds: [],
491
- stepOf: (b) => er(b, c, s, l)
492
- };
493
- }
494
- case "quantile": {
495
- const o = t.filter(Number.isFinite).slice().sort((l, b) => l - b), s = Ze(
496
- Math.round(e.buckets ?? be),
497
- 2,
498
- be
499
- ), c = nr(o, s);
500
- return {
501
- type: "quantile",
502
- min: (a == null ? void 0 : a[0]) ?? null,
503
- max: (a == null ? void 0 : a[1]) ?? null,
504
- thresholds: c,
505
- stepOf: (l) => qt(na(l, c), c.length + 1)
506
- };
507
- }
508
- case "threshold": {
509
- const o = e.thresholds.filter(Number.isFinite), s = Sa(o);
510
- s.length !== o.length && Pt("duplicate thresholds merged."), s.length > Qe && Pt(
511
- `${s.length} thresholds given; ten steps take at most ${Qe}, so the highest ${s.length - Qe} are dropped.`
512
- );
513
- const c = s.slice(0, Qe);
514
- return {
515
- type: "threshold",
516
- min: (a == null ? void 0 : a[0]) ?? null,
517
- max: (a == null ? void 0 : a[1]) ?? null,
518
- thresholds: c,
519
- stepOf: (l) => qt(na(l, c), c.length + 1)
520
- };
521
- }
522
- case "sequential":
523
- default: {
524
- const o = e.domain && e.domain !== "auto" ? ra(e.domain) : null, s = o ? o[0] : (a == null ? void 0 : a[0]) ?? null, c = o ? o[1] : (a == null ? void 0 : a[1]) ?? null;
525
- return {
526
- type: "sequential",
527
- min: s,
528
- max: c,
529
- thresholds: [],
530
- stepOf: (l) => s === null || c === null ? Xt : Za(l, s, c)
531
- };
532
- }
533
- }
534
- }
535
- function or(e) {
536
- let t = 0, a = !1, o = 0, s = !1;
537
- for (const c of e)
538
- c.value === null || !Number.isFinite(c.value) || (t += c.value, a = !0, c.count !== void 0 && (o += c.count, s = !0));
539
- return { value: a ? t : null, count: s ? o : void 0 };
540
- }
541
- function sr(e) {
542
- let t = 0, a = 0, o = 0, s = !1;
543
- for (const c of e) {
544
- if (c.value === null || !Number.isFinite(c.value)) continue;
545
- const l = c.count ?? 1;
546
- t += c.value * l, a += l, c.count !== void 0 && (o += c.count, s = !0);
547
- }
548
- return {
549
- value: a > 0 ? t / a : null,
550
- count: s ? o : void 0
551
- };
552
- }
553
- function pt(e, t) {
554
- return t === "sum" ? or(e) : sr(e);
555
- }
556
- function ir(e, t) {
557
- const a = new Set(t == null ? void 0 : t.map((l) => l.id)), o = new Set(a), s = /* @__PURE__ */ new Map();
558
- let c = 0;
559
- for (const l of e) {
560
- const b = l.group;
561
- if (b === void 0 || s.has(b)) continue;
562
- if (a.has(b)) {
563
- s.set(b, b);
564
- continue;
565
- }
566
- let w;
567
- do
568
- c += 1, w = `group-${c}`;
569
- while (o.has(w));
570
- o.add(w), s.set(b, w);
571
- }
572
- return s;
573
- }
574
- function Zt(e, t) {
575
- return t !== void 0 && e !== void 0 && e < t;
576
- }
577
- function lr(e, t) {
578
- if (e == null)
579
- return { value: null, status: "empty" };
580
- const a = typeof e == "number" ? { value: e } : e, o = a.value === null || !Number.isFinite(a.value) ? null : a.value, s = Zt(a.count, t) && (o !== null || (a.count ?? 0) > 0) ? "low-sample" : o === null ? "empty" : "value";
581
- return { value: o, count: a.count, label: a.label, status: s };
582
- }
583
- function dr(e, t, a, o, s) {
584
- return e.map(
585
- (c, l) => t.map(
586
- (b, w) => {
587
- var m;
588
- return lr(
589
- a ? a(c, b, l, w) : (m = o == null ? void 0 : o[l]) == null ? void 0 : m[w],
590
- s
591
- );
592
- }
593
- )
594
- );
595
- }
596
- function cr(e) {
597
- const t = [];
598
- for (const a of e)
599
- for (const o of a)
600
- o.status === "value" && o.value !== null && t.push(o.value);
601
- return t;
602
- }
603
- function ur(e) {
604
- return e.some((t) => t.some((a) => a.status !== "empty"));
605
- }
606
- function pr(e, t, a, o, s, c) {
607
- const l = e.map((k) => pt(k, o)), b = [];
608
- for (let k = 0; k < a; k += 1)
609
- b.push(
610
- pt(
611
- e.map((g) => g[k]),
612
- s
613
- )
614
- );
615
- const w = /* @__PURE__ */ new Map();
616
- t.forEach((k, g) => {
617
- if (k.group === void 0) return;
618
- const M = w.get(k.group) ?? [];
619
- M.push(g), w.set(k.group, M);
620
- });
621
- const m = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
622
- for (const [k, g] of w) {
623
- const M = [];
624
- for (let p = 0; p < a; p += 1)
625
- M.push(
626
- pt(
627
- g.map((E) => e[E][p]),
628
- c
629
- )
630
- );
631
- m.set(k, M), x.set(
632
- k,
633
- pt(
634
- g.flatMap((p) => e[p]),
635
- o
636
- )
637
- );
638
- }
639
- return {
640
- rows: l,
641
- columns: b,
642
- grand: pt(e.flat(), o),
643
- groupColumns: m,
644
- groups: x
645
- };
646
- }
647
- const Bt = (e) => `d:${e}`, mr = (e) => `g:${e}`, Mt = "f";
648
- function hr(e, t, a, o, s) {
649
- const c = [...e];
650
- if (o === "label")
651
- return c.sort((l, b) => s.compare(t[l].label, t[b].label));
652
- if (o === "total-asc" || o === "total-desc") {
653
- const l = o === "total-asc" ? 1 : -1;
654
- return c.sort((b, w) => {
655
- var k, g;
656
- const m = (k = a[b]) == null ? void 0 : k.value, x = (g = a[w]) == null ? void 0 : g.value;
657
- return m == null ? x == null ? 0 : 1 : x == null ? -1 : (m - x) * l;
658
- });
659
- }
660
- return c;
661
- }
662
- function oa(e, t, a, o) {
663
- var w;
664
- if (!a)
665
- return t.map((m) => ({
666
- kind: "data",
667
- key: Bt(e[m].id),
668
- rowIndex: m,
669
- groupId: e[m].group
670
- }));
671
- const s = [], c = /* @__PURE__ */ new Map(), l = [];
672
- e.forEach((m) => {
673
- m.group !== void 0 && !c.has(m.group) && (c.set(m.group, []), s.push(m.group));
674
- });
675
- for (const m of t) {
676
- const x = e[m].group;
677
- x === void 0 ? l.push(m) : (w = c.get(x)) == null || w.push(m);
678
- }
679
- const b = [];
680
- for (const m of s) {
681
- const x = c.get(m) ?? [], k = o.has(m);
682
- if (b.push({
683
- kind: "group",
684
- key: mr(m),
685
- groupId: m,
686
- collapsed: k,
687
- rowIndexes: x
688
- }), !k)
689
- for (const g of x)
690
- b.push({
691
- kind: "data",
692
- key: Bt(e[g].id),
693
- rowIndex: g,
694
- groupId: m
695
- });
696
- }
697
- for (const m of l)
698
- b.push({ kind: "data", key: Bt(e[m].id), rowIndex: m });
699
- return b;
700
- }
701
- function Na({
702
- cell: e,
703
- label: t,
704
- open: a,
705
- onOpenChange: o,
706
- side: s = "top",
707
- children: c
708
- }) {
709
- const l = xa(), b = t ?? (l == null ? void 0 : l.tooltipText(e)) ?? "";
710
- return /* @__PURE__ */ v(
711
- ba,
712
- {
713
- label: b,
714
- open: a,
715
- onOpenChange: o,
716
- side: s,
717
- delayDuration: 0,
718
- children: c
719
- }
720
- );
721
- }
722
- Na.displayName = "HeatmapTooltip";
723
- function sa({
724
- label: e,
725
- onOpenChange: t
726
- }) {
727
- return /* @__PURE__ */ v(ba, { label: e, open: !0, onOpenChange: t, delayDuration: 0, children: /* @__PURE__ */ v(
728
- "span",
729
- {
730
- "aria-hidden": "true",
731
- "data-component": "heatmap-tooltip",
732
- className: "ds:pointer-events-none ds:absolute ds:inset-0"
733
- }
734
- ) });
735
- }
736
- const gr = 1e3, fr = 3;
737
- function ia({ offset: e, viewport: t, lead: a, pitch: o, count: s }, c = fr) {
738
- if (s <= 0) return [0, 0];
739
- if (!(o > 0)) return [0, s];
740
- const l = Math.abs(e) - a, b = Math.floor(l / o) - c, w = Math.ceil((l + t) / o) + c, m = Math.max(0, Math.min(s - 1, b)), x = Math.max(m + 1, Math.min(s, w));
741
- return [m, x];
742
- }
743
- function la(e, t, a) {
744
- const [o, s] = e, c = [];
745
- for (let l = o; l < s; l += 1) c.push(l);
746
- return a === null || a < 0 || a >= t ? {
747
- indexes: c,
748
- lead: o,
749
- middle: 0,
750
- middleAfter: 0,
751
- tail: Math.max(0, t - s)
752
- } : a < o ? {
753
- indexes: [a, ...c],
754
- lead: a,
755
- middle: o - a - 1,
756
- middleAfter: 1,
757
- tail: Math.max(0, t - s)
758
- } : a >= s ? {
759
- indexes: [...c, a],
760
- lead: o,
761
- middle: a - s,
762
- middleAfter: c.length,
763
- tail: t - a - 1
764
- } : {
765
- indexes: c,
766
- lead: o,
767
- middle: 0,
768
- middleAfter: 0,
769
- tail: Math.max(0, t - s)
770
- };
771
- }
772
- function Rt(e) {
773
- return {
774
- indexes: Array.from({ length: e }, (t, a) => a),
775
- lead: 0,
776
- middle: 0,
777
- middleAfter: 0,
778
- tail: 0
779
- };
780
- }
781
- function da(e, t) {
782
- if (e.indexes.every((o) => o < t)) return e;
783
- const a = e.indexes.filter((o) => o < t);
784
- return {
785
- indexes: a,
786
- lead: Math.min(e.lead, t),
787
- middle: 0,
788
- middleAfter: 0,
789
- tail: Math.max(0, t - (a.length + Math.min(e.lead, t)))
790
- };
791
- }
792
- function ca(e, t) {
793
- return e.lead !== t.lead || e.tail !== t.tail || e.middle !== t.middle || e.indexes.length !== t.indexes.length ? !1 : e.indexes.every((a, o) => a === t.indexes[o]);
794
- }
795
- const Ut = (e, t) => `${e}-${Math.min(9, Math.max(0, Math.round(t)))}`, _a = {
796
- "primary-0": "ds:bg-[var(--heatmap-primary-0)] ds:text-[color:var(--heatmap-primary-0-foreground)]",
797
- "primary-1": "ds:bg-[var(--heatmap-primary-1)] ds:text-[color:var(--heatmap-primary-1-foreground)]",
798
- "primary-2": "ds:bg-[var(--heatmap-primary-2)] ds:text-[color:var(--heatmap-primary-2-foreground)]",
799
- "primary-3": "ds:bg-[var(--heatmap-primary-3)] ds:text-[color:var(--heatmap-primary-3-foreground)]",
800
- "primary-4": "ds:bg-[var(--heatmap-primary-4)] ds:text-[color:var(--heatmap-primary-4-foreground)]",
801
- "primary-5": "ds:bg-[var(--heatmap-primary-5)] ds:text-[color:var(--heatmap-primary-5-foreground)]",
802
- "primary-6": "ds:bg-[var(--heatmap-primary-6)] ds:text-[color:var(--heatmap-primary-6-foreground)]",
803
- "primary-7": "ds:bg-[var(--heatmap-primary-7)] ds:text-[color:var(--heatmap-primary-7-foreground)]",
804
- "primary-8": "ds:bg-[var(--heatmap-primary-8)] ds:text-[color:var(--heatmap-primary-8-foreground)]",
805
- "primary-9": "ds:bg-[var(--heatmap-primary-9)] ds:text-[color:var(--heatmap-primary-9-foreground)]",
806
- "success-0": "ds:bg-[var(--heatmap-success-0)] ds:text-[color:var(--heatmap-success-0-foreground)]",
807
- "success-1": "ds:bg-[var(--heatmap-success-1)] ds:text-[color:var(--heatmap-success-1-foreground)]",
808
- "success-2": "ds:bg-[var(--heatmap-success-2)] ds:text-[color:var(--heatmap-success-2-foreground)]",
809
- "success-3": "ds:bg-[var(--heatmap-success-3)] ds:text-[color:var(--heatmap-success-3-foreground)]",
810
- "success-4": "ds:bg-[var(--heatmap-success-4)] ds:text-[color:var(--heatmap-success-4-foreground)]",
811
- "success-5": "ds:bg-[var(--heatmap-success-5)] ds:text-[color:var(--heatmap-success-5-foreground)]",
812
- "success-6": "ds:bg-[var(--heatmap-success-6)] ds:text-[color:var(--heatmap-success-6-foreground)]",
813
- "success-7": "ds:bg-[var(--heatmap-success-7)] ds:text-[color:var(--heatmap-success-7-foreground)]",
814
- "success-8": "ds:bg-[var(--heatmap-success-8)] ds:text-[color:var(--heatmap-success-8-foreground)]",
815
- "success-9": "ds:bg-[var(--heatmap-success-9)] ds:text-[color:var(--heatmap-success-9-foreground)]",
816
- "destructive-0": "ds:bg-[var(--heatmap-destructive-0)] ds:text-[color:var(--heatmap-destructive-0-foreground)]",
817
- "destructive-1": "ds:bg-[var(--heatmap-destructive-1)] ds:text-[color:var(--heatmap-destructive-1-foreground)]",
818
- "destructive-2": "ds:bg-[var(--heatmap-destructive-2)] ds:text-[color:var(--heatmap-destructive-2-foreground)]",
819
- "destructive-3": "ds:bg-[var(--heatmap-destructive-3)] ds:text-[color:var(--heatmap-destructive-3-foreground)]",
820
- "destructive-4": "ds:bg-[var(--heatmap-destructive-4)] ds:text-[color:var(--heatmap-destructive-4-foreground)]",
821
- "destructive-5": "ds:bg-[var(--heatmap-destructive-5)] ds:text-[color:var(--heatmap-destructive-5-foreground)]",
822
- "destructive-6": "ds:bg-[var(--heatmap-destructive-6)] ds:text-[color:var(--heatmap-destructive-6-foreground)]",
823
- "destructive-7": "ds:bg-[var(--heatmap-destructive-7)] ds:text-[color:var(--heatmap-destructive-7-foreground)]",
824
- "destructive-8": "ds:bg-[var(--heatmap-destructive-8)] ds:text-[color:var(--heatmap-destructive-8-foreground)]",
825
- "destructive-9": "ds:bg-[var(--heatmap-destructive-9)] ds:text-[color:var(--heatmap-destructive-9-foreground)]",
826
- "diverging-0": "ds:bg-[var(--heatmap-diverging-0)] ds:text-[color:var(--heatmap-diverging-0-foreground)]",
827
- "diverging-1": "ds:bg-[var(--heatmap-diverging-1)] ds:text-[color:var(--heatmap-diverging-1-foreground)]",
828
- "diverging-2": "ds:bg-[var(--heatmap-diverging-2)] ds:text-[color:var(--heatmap-diverging-2-foreground)]",
829
- "diverging-3": "ds:bg-[var(--heatmap-diverging-3)] ds:text-[color:var(--heatmap-diverging-3-foreground)]",
830
- "diverging-4": "ds:bg-[var(--heatmap-diverging-4)] ds:text-[color:var(--heatmap-diverging-4-foreground)]",
831
- "diverging-5": "ds:bg-[var(--heatmap-diverging-5)] ds:text-[color:var(--heatmap-diverging-5-foreground)]",
832
- "diverging-6": "ds:bg-[var(--heatmap-diverging-6)] ds:text-[color:var(--heatmap-diverging-6-foreground)]",
833
- "diverging-7": "ds:bg-[var(--heatmap-diverging-7)] ds:text-[color:var(--heatmap-diverging-7-foreground)]",
834
- "diverging-8": "ds:bg-[var(--heatmap-diverging-8)] ds:text-[color:var(--heatmap-diverging-8-foreground)]",
835
- "diverging-9": "ds:bg-[var(--heatmap-diverging-9)] ds:text-[color:var(--heatmap-diverging-9-foreground)]",
836
- // A value exactly on a diverging scale's midpoint: neutral, so a cell
837
- // with no change never looks like one with a small change.
838
- midpoint: "ds:bg-[var(--heatmap-midpoint)] ds:text-[color:var(--heatmap-midpoint-foreground)]",
839
- empty: "ds:border ds:border-dashed ds:border-[color:var(--heatmap-empty-border)] ds:bg-[var(--heatmap-empty)] ds:text-[color:var(--heatmap-empty-foreground)]",
840
- "low-sample": "ds:border ds:border-[color:var(--heatmap-empty-border)] ds:bg-[var(--heatmap-low-sample-surface)] ds:bg-[image:var(--heatmap-low-sample)] ds:text-[color:var(--heatmap-empty-foreground)]",
841
- aggregate: "ds:bg-[var(--muted)] ds:text-[color:var(--foreground)] ds:font-semibold"
842
- }, ua = oe(
843
- "ds:flex ds:min-w-0 ds:max-w-full ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-[color:var(--foreground)]"
844
- ), vr = oe(
845
- "ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]"
846
- ), wr = oe(
847
- [
848
- "ds:relative ds:max-w-full ds:overflow-auto ds:overscroll-contain",
849
- "ds:max-h-[var(--heatmap-max-block-size)]",
850
- "ds:bg-[var(--background)]",
851
- // Keep a cell scrolled into view clear of the sticky header, footer and
852
- // row-header column. The sizes are measured and set on this element.
853
- "ds:scroll-pt-[var(--heatmap-sticky-block-start)] ds:scroll-pb-[var(--heatmap-sticky-block-end)] ds:scroll-ps-[var(--heatmap-sticky-inline-start)]"
854
- ].join(" ")
855
- ), br = oe(
856
- // Focusable only to hold focus during a retry; not a control, so no ring.
857
- "ds:min-w-0 ds:max-w-full ds:outline-none",
858
- {
859
- variants: {
860
- capped: {
861
- true: "ds:flex ds:h-[var(--heatmap-max-block-size)] ds:flex-col",
862
- false: "ds:block ds:max-h-[var(--heatmap-max-block-size)]"
863
- }
864
- },
865
- defaultVariants: { capped: !1 }
866
- }
867
- ), yr = oe(
868
- [
869
- "ds:grid ds:w-max ds:min-w-full",
870
- "ds:[grid-template-rows:auto] ds:auto-rows-[var(--heatmap-row-track)]",
871
- "ds:gap-[var(--heatmap-gap)]",
872
- "ds:outline-none"
873
- ].join(" "),
874
- {
875
- variants: {
876
- size: {
877
- sm: "ds:[--heatmap-cell-inline:var(--min-target-size)] ds:[--heatmap-cell-block:var(--min-target-size)]",
878
- md: "ds:[--heatmap-cell-inline:max(var(--min-target-size),var(--spacing-2xl))] ds:[--heatmap-cell-block:var(--min-target-size)]",
879
- lg: "ds:[--heatmap-cell-inline:max(var(--min-target-size),calc(var(--spacing-2xl)_+_var(--spacing-md)))] ds:[--heatmap-cell-block:max(var(--min-target-size),var(--spacing-2xl))]"
880
- },
881
- density: {
882
- default: "ds:[--heatmap-gap:var(--spacing-2xs)]",
883
- compact: "ds:[--heatmap-gap:var(--spacing-none)]"
884
- },
885
- virtualised: {
886
- true: "ds:[--heatmap-track:var(--heatmap-cell-inline)] ds:[--heatmap-row-track:var(--heatmap-cell-block)]",
887
- false: "ds:[--heatmap-track:minmax(var(--heatmap-cell-inline),1fr)] ds:[--heatmap-row-track:minmax(var(--heatmap-cell-block),auto)]"
888
- },
889
- totalsColumn: {
890
- true: "ds:grid-cols-[max-content_repeat(var(--heatmap-columns),var(--heatmap-track))_max-content]",
891
- false: "ds:grid-cols-[max-content_repeat(var(--heatmap-columns),var(--heatmap-track))]"
892
- }
893
- },
894
- defaultVariants: {
895
- size: "md",
896
- density: "default",
897
- virtualised: !1,
898
- totalsColumn: !1
899
- }
900
- }
901
- ), At = oe(
902
- "ds:col-span-full ds:grid ds:grid-cols-subgrid",
903
- {
904
- variants: {
905
- position: {
906
- // The header and footer rows stick to the scroll box's block edges,
907
- // above the row headers that stick to its inline start.
908
- // Each also covers the row gap on its inner side, so cells
909
- // scrolling underneath never show through the gap.
910
- header: "ds:sticky ds:top-0 ds:z-[calc(var(--z-sticky)+1)] ds:bg-[var(--background)] ds:after:pointer-events-none ds:after:absolute ds:after:inset-x-0 ds:after:top-[calc(100%_-_var(--spacing-2xs))] ds:after:h-[calc(var(--heatmap-gap)_+_var(--spacing-2xs))] ds:after:bg-[var(--background)] ds:after:content-['']",
911
- footer: "ds:sticky ds:bottom-0 ds:z-[calc(var(--z-sticky)+1)] ds:bg-[var(--background)] ds:after:pointer-events-none ds:after:absolute ds:after:inset-x-0 ds:after:bottom-[calc(100%_-_var(--spacing-2xs))] ds:after:h-[calc(var(--heatmap-gap)_+_var(--spacing-2xs))] ds:after:bg-[var(--background)] ds:after:content-['']",
912
- body: ""
913
- }
914
- },
915
- defaultVariants: { position: "body" }
916
- }
917
- ), Xe = oe("ds:pointer-events-none", {
918
- variants: {
919
- axis: {
920
- "row-lead": "ds:col-span-full ds:row-span-[var(--heatmap-row-lead)]",
921
- "row-middle": "ds:col-span-full ds:row-span-[var(--heatmap-row-middle)]",
922
- "row-tail": "ds:col-span-full ds:row-span-[var(--heatmap-row-tail)]",
923
- "col-lead": "ds:col-span-[var(--heatmap-col-lead)]",
924
- "col-middle": "ds:col-span-[var(--heatmap-col-middle)]",
925
- // Holds the skipped columns after the window, so the row-totals cell
926
- // lands in its own track at the end and never next to the window.
927
- "col-tail": "ds:col-span-[var(--heatmap-col-tail)]"
928
- }
929
- }
930
- }), Ma = "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:data-[highlighted=true]:bg-[var(--muted)] ds:data-[highlighted=true]:text-[color:var(--foreground)]", Ft = oe(
931
- [
932
- "ds:flex ds:min-w-0 ds:items-end ds:justify-center ds:text-center",
933
- "ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-2xs)] ds:py-[var(--spacing-xs)]",
934
- "type-meta ds:text-[color:var(--muted-foreground)] ds:break-normal ds:[overflow-wrap:anywhere]",
935
- Ma
936
- ].join(" "),
937
- {
938
- variants: {
939
- corner: {
940
- // The top-start corner sticks with the row headers below it.
941
- true: "ds:sticky ds:start-0 ds:z-[var(--z-sticky)] ds:items-end ds:justify-start ds:text-start ds:bg-[var(--background)] ds:pe-[var(--spacing-sm)]",
942
- false: ""
943
- }
944
- },
945
- defaultVariants: { corner: !1 }
946
- }
947
- ), Yt = oe(
948
- [
949
- "ds:sticky ds:start-0 ds:z-[var(--z-sticky)] ds:flex ds:min-w-0 ds:items-center",
950
- "ds:max-w-[calc(var(--spacing-2xl)*4)] ds:gap-[var(--spacing-xs)]",
951
- "ds:bg-[var(--background)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-sm)]",
952
- // Cover the gaps at the inline end and below too, so cells scrolling
953
- // underneath never show through between row headers.
954
- "ds:after:pointer-events-none ds:after:absolute ds:after:top-0 ds:after:bottom-[calc(var(--heatmap-gap)*-1)] ds:after:start-full ds:after:w-[var(--heatmap-gap)] ds:after:bg-[var(--background)] ds:after:content-['']",
955
- // The strip below overlaps its neighbours slightly so a fractional row
956
- // position never leaves a hairline seam.
957
- "ds:before:pointer-events-none ds:before:absolute ds:before:inset-x-0 ds:before:top-[calc(100%_-_var(--spacing-2xs))] ds:before:h-[calc(var(--heatmap-gap)_+_var(--spacing-2xs)*2)] ds:before:bg-[var(--background)] ds:before:content-['']",
958
- "type-body-sm ds:text-start ds:break-normal ds:[overflow-wrap:anywhere]",
959
- Ma
960
- ].join(" "),
961
- {
962
- variants: {
963
- kind: {
964
- data: "",
965
- group: "ds:font-semibold",
966
- total: "ds:font-semibold"
967
- },
968
- // A virtualised grid needs every row the same height: no wrapping.
969
- // The label truncates inside its own span (heatmapRowLabelVariants):
970
- // overflow on the header itself would clip its gap-covering strips.
971
- virtualised: {
972
- true: "ds:whitespace-nowrap",
973
- false: ""
974
- }
975
- },
976
- defaultVariants: { kind: "data", virtualised: !1 }
977
- }
978
- ), pa = oe("ds:min-w-0", {
979
- variants: {
980
- virtualised: {
981
- true: "ds:overflow-hidden ds:text-ellipsis",
982
- false: ""
983
- }
984
- },
985
- defaultVariants: { virtualised: !1 }
986
- }), Lt = oe(
987
- [
988
- "ds:relative ds:flex ds:min-w-0 ds:items-center ds:justify-center",
989
- "ds:min-h-[var(--heatmap-cell-block)] ds:overflow-hidden ds:px-[var(--spacing-2xs)]",
990
- "type-meta ds:tabular-nums ds:whitespace-nowrap ds:select-none",
991
- "ds:forced-colors:[forced-color-adjust:none]",
992
- "ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-ring",
993
- "ds:focus-visible:outline-offset-[calc(var(--focus-ring-width)*-1)]",
994
- "ds:focus-visible:shadow-[inset_0_0_0_calc(var(--focus-ring-width)*2)_var(--background)]",
995
- "ds:forced-colors:focus-visible:outline-[Highlight]",
996
- "ds:aria-selected:shadow-[inset_0_0_0_var(--spacing-2xs)_var(--background),inset_0_0_0_calc(var(--spacing-2xs)*2)_var(--foreground),inset_0_0_0_calc(var(--spacing-2xs)*3)_var(--background)]",
997
- "ds:aria-selected:focus-visible:shadow-[inset_0_0_0_calc(var(--focus-ring-width)_+_var(--spacing-2xs))_var(--background),inset_0_0_0_calc(var(--focus-ring-width)_+_var(--spacing-2xs)*2)_var(--foreground),inset_0_0_0_calc(var(--focus-ring-width)_+_var(--spacing-2xs)*3)_var(--background)]"
998
- ].join(" "),
999
- {
1000
- variants: {
1001
- tone: _a,
1002
- interactive: {
1003
- true: "ds:cursor-pointer",
1004
- false: "ds:cursor-default"
1005
- }
1006
- },
1007
- defaultVariants: { tone: "empty", interactive: !1 }
1008
- }
1009
- ), xr = oe(
1010
- "ds:flex ds:min-w-0 ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-meta ds:text-[color:var(--muted-foreground)]"
1011
- ), Ir = oe(
1012
- "ds:flex ds:w-[calc(var(--spacing-xl)*6)] ds:min-w-0 ds:max-w-full ds:shrink ds:items-stretch",
1013
- {
1014
- variants: {
1015
- variant: {
1016
- stepped: "ds:gap-[var(--spacing-2xs)]",
1017
- continuous: "ds:overflow-hidden ds:rounded-[var(--radius-sm)]"
1018
- }
1019
- },
1020
- defaultVariants: { variant: "stepped" }
1021
- }
1022
- ), mt = oe(
1023
- "ds:inline-block ds:forced-colors:[forced-color-adjust:none]",
1024
- {
1025
- variants: {
1026
- tone: _a,
1027
- shape: {
1028
- stepped: "ds:h-[var(--spacing-sm)] ds:min-w-0 ds:flex-1 ds:rounded-[var(--radius-sm)]",
1029
- continuous: "ds:h-[var(--spacing-sm)] ds:min-w-0 ds:flex-1",
1030
- key: "ds:size-[var(--spacing-md)] ds:shrink-0 ds:rounded-[var(--radius-sm)]",
1031
- label: "ds:shrink-0 ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-xs)] ds:whitespace-nowrap"
1032
- }
1033
- },
1034
- defaultVariants: { tone: "empty", shape: "key" }
1035
- }
1036
- ), Ra = "", Kt = (e, t) => `${e}${Ra}${String(t)}`, Et = (e) => {
1037
- const t = e.indexOf(Ra);
1038
- return [e.slice(0, t), e.slice(t + 1)];
1039
- };
1040
- function kr(e, t, a) {
1041
- return e.status === "low-sample" ? "low-sample" : e.status === "empty" || e.value === null ? "empty" : tr(t, e.value) ? "midpoint" : Ut(a, t.stepOf(e.value));
1042
- }
1043
- function Jt(e, t) {
1044
- return {
1045
- value: e.value,
1046
- count: e.count,
1047
- status: e.value === null ? "empty" : Zt(e.count, t) ? "low-sample" : "value"
1048
- };
1049
- }
1050
- const Qt = (e) => e.status === "value" ? "aggregate" : e.status;
1051
- function Ct(e, t) {
1052
- const a = [];
1053
- return e.lead > 0 && a.push(
1054
- /* @__PURE__ */ v(
1055
- "div",
1056
- {
1057
- "aria-hidden": "true",
1058
- className: Xe({ axis: "col-lead" })
1059
- },
1060
- "lead"
1061
- )
1062
- ), e.indexes.forEach((o, s) => {
1063
- e.middle > 0 && s === e.middleAfter && a.push(
1064
- /* @__PURE__ */ v(
1065
- "div",
1066
- {
1067
- "aria-hidden": "true",
1068
- className: Xe({ axis: "col-middle" })
1069
- },
1070
- "middle"
1071
- )
1072
- ), a.push(t(o));
1073
- }), e.tail > 0 && a.push(
1074
- /* @__PURE__ */ v(
1075
- "div",
1076
- {
1077
- "aria-hidden": "true",
1078
- className: Xe({ axis: "col-tail" })
1079
- },
1080
- "tail"
1081
- )
1082
- ), a;
1083
- }
1084
- const Sr = Ca(function({
1085
- ctx: t,
1086
- row: a,
1087
- ariaRowIndex: o,
1088
- highlighted: s,
1089
- activeCol: c,
1090
- tooltipCol: l,
1091
- selectedCols: b
1092
- }) {
1093
- var D, A;
1094
- const w = t.columns.length, m = _(
1095
- () => new Set(b === "" ? [] : b.split(",").map(Number)),
1096
- [b]
1097
- );
1098
- if (a.kind === "group") {
1099
- const I = t.describer.groupLabel(a.groupId), q = t.groupIds.get(a.groupId), H = `${t.idBase}-label-${o}`, L = ((D = t.totals) == null ? void 0 : D.groupColumns.get(a.groupId)) ?? [], ve = (A = t.totals) == null ? void 0 : A.groups.get(a.groupId), j = (V, U, we, ee) => {
1100
- const y = Jt(V ?? { value: null }, t.minCount), S = we(y);
1101
- return /* @__PURE__ */ P(
1102
- "div",
1103
- {
1104
- role: "gridcell",
1105
- "aria-colindex": U + 2,
1106
- "aria-expanded": !a.collapsed,
1107
- "aria-label": S,
1108
- tabIndex: c === U ? 0 : -1,
1109
- "data-heatmap-group-id": q,
1110
- className: Lt({
1111
- tone: Qt(y),
1112
- interactive: !0
1113
- }),
1114
- children: [
1115
- t.describer.visibleText(y),
1116
- ee && l === U ? /* @__PURE__ */ v(
1117
- sa,
1118
- {
1119
- label: S,
1120
- onOpenChange: t.onTooltipOpenChange
1121
- }
1122
- ) : null
1123
- ]
1124
- },
1125
- U
1126
- );
1127
- }, J = t.describer.groupRowText(
1128
- I,
1129
- t.groupColumnMethod
1130
- );
1131
- return /* @__PURE__ */ P(
1132
- "div",
1133
- {
1134
- role: "row",
1135
- "aria-rowindex": o,
1136
- "data-heatmap-body-row": "",
1137
- "data-heatmap-group-id": q,
1138
- className: At({ position: "body" }),
1139
- children: [
1140
- /* @__PURE__ */ P(
1141
- "div",
1142
- {
1143
- role: "rowheader",
1144
- "aria-colindex": 1,
1145
- "aria-labelledby": H,
1146
- "data-highlighted": s,
1147
- className: Yt({
1148
- kind: "group",
1149
- virtualised: t.virtualised
1150
- }),
1151
- children: [
1152
- /* @__PURE__ */ v(
1153
- "button",
1154
- {
1155
- type: "button",
1156
- tabIndex: -1,
1157
- "aria-expanded": !a.collapsed,
1158
- "aria-label": a.collapsed ? t.expandLabel(I) : t.collapseLabel(I),
1159
- onMouseDown: (V) => V.preventDefault(),
1160
- onClick: () => t.onToggleGroup(a.groupId),
1161
- className: "ds:inline-flex ds:size-[var(--spacing-lg)] ds:shrink-0 ds:cursor-pointer ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)] ds:bg-transparent ds:text-[color:inherit] ds:hover:bg-[var(--muted)] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-ring ds:forced-colors:focus-visible:outline-[Highlight]",
1162
- children: /* @__PURE__ */ v(
1163
- Da,
1164
- {
1165
- "aria-hidden": "true",
1166
- className: [
1167
- "ds:size-4 ds:transition-transform ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
1168
- a.collapsed ? "ds:-rotate-90 ds:rtl:rotate-90" : ""
1169
- ].join(" ")
1170
- }
1171
- )
1172
- }
1173
- ),
1174
- /* @__PURE__ */ v(
1175
- "span",
1176
- {
1177
- id: H,
1178
- className: pa({
1179
- virtualised: t.virtualised
1180
- }),
1181
- children: I
1182
- }
1183
- )
1184
- ]
1185
- }
1186
- ),
1187
- Ct(
1188
- t.colWindow,
1189
- (V) => j(
1190
- L[V],
1191
- V,
1192
- (U) => t.describer.sentence(
1193
- J,
1194
- t.describer.columnLabel(t.columns[V]),
1195
- U
1196
- ),
1197
- !0
1198
- )
1199
- ),
1200
- t.rowTotals ? j(
1201
- ve,
1202
- w,
1203
- (V) => t.describer.sentence(
1204
- I,
1205
- t.describer.methodLabel(t.rowTotals || "mean"),
1206
- V
1207
- ),
1208
- !1
1209
- ) : null
1210
- ]
1211
- }
1212
- );
1213
- }
1214
- const x = a.rowIndex, k = t.rows[x], g = t.describer.rowLabel(k), M = t.matrix[x], p = (I) => {
1215
- const q = M[I], H = t.columns[I], L = m.has(I);
1216
- return /* @__PURE__ */ P(
1217
- "div",
1218
- {
1219
- role: "gridcell",
1220
- "aria-colindex": I + 2,
1221
- "aria-label": t.describer.sentence(
1222
- g,
1223
- t.describer.columnLabel(H),
1224
- q
1225
- ),
1226
- "aria-describedby": c === I ? t.describedBy : void 0,
1227
- "aria-selected": t.selectable ? L : void 0,
1228
- tabIndex: c === I ? 0 : -1,
1229
- "data-heatmap-cell-id": `${k.id}:${String(H.id)}`,
1230
- "data-status": q.status,
1231
- className: Lt({
1232
- tone: kr(q, t.scale, t.palette),
1233
- interactive: t.interactive
1234
- }),
1235
- children: [
1236
- t.showValues || q.status === "empty" ? t.describer.visibleText(q) : null,
1237
- l === I ? /* @__PURE__ */ v(
1238
- sa,
1239
- {
1240
- label: t.tooltipText(t.cellInfo(x, I)),
1241
- onOpenChange: t.onTooltipOpenChange
1242
- }
1243
- ) : null
1244
- ]
1245
- },
1246
- I
1247
- );
1248
- };
1249
- let E = null;
1250
- if (t.rowTotals && t.totals) {
1251
- const I = Jt(t.totals.rows[x], t.minCount);
1252
- E = /* @__PURE__ */ v(
1253
- "div",
1254
- {
1255
- role: "gridcell",
1256
- "aria-colindex": w + 2,
1257
- "aria-label": t.describer.sentence(
1258
- g,
1259
- t.describer.methodLabel(t.rowTotals),
1260
- I
1261
- ),
1262
- tabIndex: c === w ? 0 : -1,
1263
- className: Lt({ tone: Qt(I) }),
1264
- children: t.describer.visibleText(I)
1265
- }
1266
- );
1267
- }
1268
- return /* @__PURE__ */ P(
1269
- "div",
1270
- {
1271
- role: "row",
1272
- "aria-rowindex": o,
1273
- "data-heatmap-body-row": "",
1274
- "data-heatmap-row-id": k.id,
1275
- className: At({ position: "body" }),
1276
- children: [
1277
- /* @__PURE__ */ v(
1278
- "div",
1279
- {
1280
- role: "rowheader",
1281
- "aria-colindex": 1,
1282
- "data-highlighted": s,
1283
- className: Yt({
1284
- kind: "data",
1285
- virtualised: t.virtualised
1286
- }),
1287
- children: /* @__PURE__ */ v(
1288
- "span",
1289
- {
1290
- className: pa({ virtualised: t.virtualised }),
1291
- children: g
1292
- }
1293
- )
1294
- }
1295
- ),
1296
- Ct(t.colWindow, p),
1297
- E
1298
- ]
1299
- }
1300
- );
1301
- }), Gt = {
1302
- headerBlock: 48,
1303
- footerBlock: 0,
1304
- rowPitch: 46,
1305
- leadInline: 120,
1306
- colPitch: 46,
1307
- viewportBlock: 600,
1308
- viewportInline: 900
1309
- }, ma = (e) => Math.max(
1310
- 1,
1311
- Math.floor(
1312
- (e.viewportBlock - e.headerBlock - e.footerBlock) / Math.max(1, e.rowPitch)
1313
- )
1314
- );
1315
- function Nr(e) {
1316
- const {
1317
- title: t,
1318
- rowsLabel: a,
1319
- rows: o,
1320
- columns: s,
1321
- matrix: c,
1322
- body: l,
1323
- scale: b,
1324
- palette: w,
1325
- describer: m,
1326
- showValues: x,
1327
- totals: k,
1328
- rowTotals: g,
1329
- columnTotals: M,
1330
- groupColumnMethod: p,
1331
- groupIds: E,
1332
- minCount: D,
1333
- selectionMode: A,
1334
- selected: I,
1335
- columnIndexOfKey: q,
1336
- interactive: H,
1337
- virtualised: L,
1338
- size: ve,
1339
- density: j,
1340
- cellInfo: J,
1341
- tooltipText: V,
1342
- describeFocused: U,
1343
- onActivate: we,
1344
- onRange: ee,
1345
- onToggleGroup: y
1346
- } = e, { t: S } = Ht("ui"), ae = Ka(), Q = $(null), Y = $(null), _e = $(null), Oe = $(null), K = s.length, Me = K + (g ? 1 : 0), O = !!(M && k), de = _(
1347
- () => [
1348
- ...l.map((n) => n.key),
1349
- ...O ? [Mt] : []
1350
- ],
1351
- [l, O]
1352
- ), ye = _(() => {
1353
- const n = /* @__PURE__ */ new Map();
1354
- return de.forEach((r, d) => n.set(r, d)), n;
1355
- }, [de]), [F, et] = le(() => ({
1356
- rowKey: de[0] ?? Mt,
1357
- col: 0
1358
- })), te = (() => {
1359
- const n = ye.get(F.rowKey);
1360
- if (n !== void 0) return n;
1361
- const r = o.find((u) => `d:${u.id}` === F.rowKey);
1362
- return ((r == null ? void 0 : r.group) === void 0 ? void 0 : ye.get(`g:${r.group}`)) ?? 0;
1363
- })(), z = Math.min(
1364
- Math.max(0, F.col),
1365
- Math.max(0, Me - 1)
1366
- ), ce = de[te], xe = $(!1), [Ie, G] = le(!1), me = $(!1), ke = $("pointer"), [tt, ze] = le(null), Le = $(null), [ft, Se] = le(!1), Ve = C((n) => {
1367
- const r = Le.current;
1368
- r === n || r && n && r.rowKey === n.rowKey && r.col === n.col || (Le.current = n, ze(n), Se(!1));
1369
- }, []), X = tt ?? (Ie && ce ? { rowKey: ce, col: z } : null), Ee = ft ? null : tt ?? (Ie && ke.current === "keyboard" && ce ? { rowKey: ce, col: z } : null), [re, Ot] = le(Gt), Re = $(re);
1370
- Re.current = re;
1371
- const at = C(() => {
1372
- var Z, _t;
1373
- const n = Q.current, r = Y.current;
1374
- if (!n || !r) return;
1375
- const d = window.getComputedStyle(r), u = parseFloat(d.rowGap) || 0, h = parseFloat(d.columnGap) || 0, N = d.gridTemplateColumns.split(" ").map((Ue) => parseFloat(Ue)).filter((Ue) => Number.isFinite(Ue)), W = ((Z = _e.current) == null ? void 0 : Z.getBoundingClientRect().height) ?? 0, se = r.querySelector(
1376
- "[data-heatmap-body-row]"
1377
- ), ne = (se == null ? void 0 : se.getBoundingClientRect().height) ?? 0, ie = {
1378
- headerBlock: W + u,
1379
- footerBlock: ((_t = Oe.current) == null ? void 0 : _t.getBoundingClientRect().height) ?? 0,
1380
- rowPitch: (ne || W || Gt.rowPitch) + u,
1381
- leadInline: (N[0] ?? 0) + h,
1382
- colPitch: (N[1] ?? Gt.colPitch) + h,
1383
- viewportBlock: n.clientHeight,
1384
- viewportInline: n.clientWidth
1385
- }, He = Re.current;
1386
- Object.keys(ie).some(
1387
- (Ue) => Math.abs(ie[Ue] - He[Ue]) > 0.5
1388
- ) && Ot(ie);
1389
- }, []);
1390
- Je(() => {
1391
- at();
1392
- const n = Q.current;
1393
- if (!n || typeof ResizeObserver > "u") return;
1394
- const r = new ResizeObserver(() => at());
1395
- return r.observe(n), Y.current && r.observe(Y.current), () => r.disconnect();
1396
- }, [at, l.length, K, ve, j]);
1397
- const vt = ce === Mt ? null : te, Be = z < K ? z : null, rt = C(() => {
1398
- if (!L)
1399
- return { rows: Rt(l.length), cols: Rt(K) };
1400
- const n = Q.current, r = Re.current, d = ia({
1401
- offset: (n == null ? void 0 : n.scrollTop) ?? 0,
1402
- viewport: r.viewportBlock,
1403
- lead: r.headerBlock,
1404
- pitch: r.rowPitch,
1405
- count: l.length
1406
- }), u = ia({
1407
- offset: (n == null ? void 0 : n.scrollLeft) ?? 0,
1408
- viewport: r.viewportInline,
1409
- lead: r.leadInline,
1410
- pitch: r.colPitch,
1411
- count: K
1412
- });
1413
- return {
1414
- rows: la(d, l.length, vt),
1415
- cols: la(u, K, Be)
1416
- };
1417
- }, [L, l.length, K, vt, Be]), [he, zt] = le(rt), Fe = _(() => Rt(l.length), [l.length]), wt = _(() => Rt(K), [K]), ge = _(
1418
- () => L ? {
1419
- rows: da(he.rows, l.length),
1420
- cols: da(he.cols, K)
1421
- } : { rows: Fe, cols: wt },
1422
- [L, he, l.length, K, Fe, wt]
1423
- ), Ae = C(() => {
1424
- const n = rt();
1425
- zt(
1426
- (r) => ca(r.rows, n.rows) && ca(r.cols, n.cols) ? r : n
1427
- );
1428
- }, [rt]);
1429
- Je(() => {
1430
- Ae();
1431
- }, [Ae, re]);
1432
- const Ne = $(0), nt = C(() => {
1433
- !L || Ne.current || (Ne.current = window.requestAnimationFrame(() => {
1434
- Ne.current = 0, Ae();
1435
- }));
1436
- }, [L, Ae]);
1437
- gt(() => () => window.cancelAnimationFrame(Ne.current), []), Je(() => {
1438
- ce !== void 0 && ce !== F.rowKey && et({ rowKey: ce, col: z });
1439
- }), Je(() => {
1440
- if (!me.current || xe.current) return;
1441
- const n = document.activeElement;
1442
- n && n !== document.body && n.isConnected || (xe.current = !0);
1443
- });
1444
- const bt = C(
1445
- (n, r) => {
1446
- var d;
1447
- return ((d = Y.current) == null ? void 0 : d.querySelector(
1448
- `[role="row"][aria-rowindex="${n + 2}"] > [aria-colindex="${r + 2}"]`
1449
- )) ?? null;
1450
- },
1451
- []
1452
- );
1453
- Je(() => {
1454
- var r;
1455
- if (!xe.current) return;
1456
- const n = bt(te, z);
1457
- n && (xe.current = !1, n.focus({ preventScroll: !0 }), (r = n.scrollIntoView) == null || r.call(n, { block: "nearest", inline: "nearest" }));
1458
- });
1459
- const Ke = () => Y.current ? window.getComputedStyle(Y.current).direction === "rtl" : !1, B = $(null), Ge = (n) => {
1460
- const r = l[n];
1461
- return r && r.kind === "data" ? r.rowIndex : null;
1462
- }, ue = $(!1), $e = (n, r) => {
1463
- const d = Math.max(0, Math.min(de.length - 1, n)), u = Math.max(0, Math.min(Me - 1, r));
1464
- return xe.current = !0, Se(!1), et({ rowKey: de[d], col: u }), { row: d, col: u };
1465
- }, Ce = (n, r, d) => {
1466
- const u = l[n];
1467
- if (u) {
1468
- if (u.kind === "group") {
1469
- y(u.groupId);
1470
- return;
1471
- }
1472
- if (!(r >= K)) {
1473
- if (A === "range" && d && B.current) {
1474
- ee(B.current, { rowIndex: u.rowIndex, col: r });
1475
- return;
1476
- }
1477
- B.current = { rowIndex: u.rowIndex, col: r }, we(u.rowIndex, r, !0);
1478
- }
1479
- }
1480
- }, De = (n) => {
1481
- if (n.target instanceof Element && n.target.closest("button"))
1482
- return;
1483
- ke.current = "keyboard";
1484
- const r = de.length - 1, d = Me - 1, u = Ke() ? -1 : 1;
1485
- let h = te, N = z;
1486
- const W = n.ctrlKey || n.metaKey;
1487
- switch (n.key) {
1488
- case "ArrowRight":
1489
- N += u;
1490
- break;
1491
- case "ArrowLeft":
1492
- N -= u;
1493
- break;
1494
- case "ArrowDown":
1495
- h += 1;
1496
- break;
1497
- case "ArrowUp":
1498
- h -= 1;
1499
- break;
1500
- case "Home":
1501
- N = 0, W && (h = 0);
1502
- break;
1503
- case "End":
1504
- N = d, W && (h = r);
1505
- break;
1506
- case "PageDown": {
1507
- const ie = l.findIndex(
1508
- (Z, _t) => _t > te && Z.kind === "group"
1509
- );
1510
- h = l.some((Z) => Z.kind === "group") ? ie === -1 ? r : ie : te + ma(Re.current);
1511
- break;
1512
- }
1513
- case "PageUp": {
1514
- let ie = -1;
1515
- for (let Z = Math.min(te, l.length) - 1; Z >= 0; Z -= 1)
1516
- if (l[Z].kind === "group") {
1517
- ie = Z;
1518
- break;
1519
- }
1520
- h = l.some((Z) => Z.kind === "group") ? ie === -1 ? 0 : ie : te - ma(Re.current);
1521
- break;
1522
- }
1523
- case "Enter":
1524
- case " ":
1525
- n.preventDefault(), Ce(te, z, n.shiftKey);
1526
- return;
1527
- case "Escape":
1528
- Ee && (n.preventDefault(), Se(!0));
1529
- return;
1530
- default:
1531
- return;
1532
- }
1533
- n.preventDefault();
1534
- const se = $e(h, N), ne = n.key.startsWith("Arrow");
1535
- if (A === "range" && n.shiftKey && ne) {
1536
- const ie = Ge(se.row), He = B.current ?? (() => {
1537
- const Z = Ge(te);
1538
- return Z === null || z >= K ? null : { rowIndex: Z, col: z };
1539
- })();
1540
- He && ie !== null && se.col < K && (B.current = He, ee(He, { rowIndex: ie, col: se.col }));
1541
- }
1542
- }, je = (n) => {
1543
- var N;
1544
- if (!(n instanceof Element)) return null;
1545
- const r = n.closest('[role="gridcell"]'), d = r == null ? void 0 : r.parentElement;
1546
- if (!r || !d || !((N = Y.current) != null && N.contains(r))) return null;
1547
- const u = Number(d.getAttribute("aria-rowindex")) - 2, h = Number(r.getAttribute("aria-colindex")) - 2;
1548
- return !Number.isInteger(u) || u < 0 || h < 0 ? null : { row: u, col: h };
1549
- }, ot = $(!1), pe = $("mouse"), yt = (n) => {
1550
- if (ke.current = "pointer", pe.current = n.pointerType, A !== "range" || n.pointerType !== "mouse" || n.button !== 0)
1551
- return;
1552
- const r = je(n.target);
1553
- if (ue.current = !1, !r) return;
1554
- const d = Ge(r.row);
1555
- if (d === null || r.col >= K) return;
1556
- if (n.shiftKey && B.current)
1557
- ee(B.current, { rowIndex: d, col: r.col });
1558
- else {
1559
- B.current = { rowIndex: d, col: r.col };
1560
- const h = Kt(o[d].id, s[r.col].id);
1561
- I.size === 1 && I.has(h) ? ue.current = !0 : ee(B.current, B.current);
1562
- }
1563
- ot.current = !0;
1564
- const u = () => {
1565
- ot.current = !1, window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", u);
1566
- };
1567
- window.addEventListener("pointerup", u), window.addEventListener("pointercancel", u);
1568
- }, xt = (n) => {
1569
- if (n.pointerType !== "mouse") return;
1570
- const r = je(n.target);
1571
- if (Ve(
1572
- r ? { rowKey: de[r.row], col: r.col } : null
1573
- ), ot.current && r && B.current) {
1574
- const d = Ge(r.row);
1575
- d !== null && r.col < K && ((d !== B.current.rowIndex || r.col !== B.current.col) && (ue.current = !1), ue.current || ee(B.current, { rowIndex: d, col: r.col }));
1576
- }
1577
- }, fe = $(null), Te = C(() => {
1578
- fe.current && (document.removeEventListener("pointerover", fe.current), fe.current = null);
1579
- }, []);
1580
- gt(() => Te, [Te]);
1581
- const Pe = (n) => {
1582
- Te();
1583
- const r = n.relatedTarget;
1584
- if (r instanceof Element && r.closest('[data-component="tooltip"]')) {
1585
- const d = (u) => {
1586
- var N;
1587
- const h = u.target;
1588
- h instanceof Element && h.closest('[data-component="tooltip"]') || (Te(), h instanceof Node && ((N = Y.current) != null && N.contains(h)) || Ve(null));
1589
- };
1590
- fe.current = d, document.addEventListener("pointerover", d);
1591
- return;
1592
- }
1593
- Ve(null);
1594
- }, st = (n) => {
1595
- var u;
1596
- const r = n.target instanceof Element ? n.target.closest("button") : null;
1597
- if (r) {
1598
- const h = Number((u = r.closest('[role="row"]')) == null ? void 0 : u.getAttribute("aria-rowindex")) - 2;
1599
- Number.isInteger(h) && h >= 0 && $e(h, z);
1600
- return;
1601
- }
1602
- const d = je(n.target);
1603
- if (d) {
1604
- if ($e(d.row, d.col), xe.current = !1, A === "range" && pe.current === "mouse") {
1605
- const h = l[d.row];
1606
- (h == null ? void 0 : h.kind) === "group" ? Ce(d.row, d.col, !1) : (h == null ? void 0 : h.kind) === "data" && d.col < K && we(h.rowIndex, d.col, ue.current), ue.current = !1;
1607
- return;
1608
- }
1609
- Ce(d.row, d.col, n.shiftKey);
1610
- }
1611
- }, it = $(!1);
1612
- gt(() => {
1613
- let n = 0;
1614
- const r = () => {
1615
- it.current = !0, window.cancelAnimationFrame(n), n = window.requestAnimationFrame(() => {
1616
- it.current = !1;
1617
- });
1618
- };
1619
- return window.addEventListener("scroll", r, { capture: !0 }), () => {
1620
- window.removeEventListener("scroll", r, { capture: !0 }), window.cancelAnimationFrame(n);
1621
- };
1622
- }, []);
1623
- const It = C((n) => {
1624
- n || it.current && Le.current === null || Se(!0);
1625
- }, []), kt = C(
1626
- (n) => S("heatmap.expandGroup", { group: n }),
1627
- [S]
1628
- ), lt = C(
1629
- (n) => S("heatmap.collapseGroup", { group: n }),
1630
- [S]
1631
- ), R = `${ae}-description`, qe = l[te], dt = U && (qe == null ? void 0 : qe.kind) === "data" && z < K ? V(J(qe.rowIndex, z)) : null, St = _(
1632
- () => ({
1633
- rows: o,
1634
- columns: s,
1635
- matrix: c,
1636
- scale: b,
1637
- palette: w,
1638
- describer: m,
1639
- showValues: x,
1640
- totals: k,
1641
- rowTotals: g,
1642
- groupColumnMethod: p,
1643
- groupIds: E,
1644
- minCount: D,
1645
- selectable: A !== "none",
1646
- interactive: H,
1647
- virtualised: L,
1648
- colWindow: ge.cols,
1649
- idBase: ae,
1650
- describedBy: U ? R : void 0,
1651
- cellInfo: J,
1652
- tooltipText: V,
1653
- onTooltipOpenChange: It,
1654
- onToggleGroup: y,
1655
- expandLabel: kt,
1656
- collapseLabel: lt
1657
- }),
1658
- [
1659
- o,
1660
- s,
1661
- c,
1662
- b,
1663
- w,
1664
- m,
1665
- x,
1666
- k,
1667
- g,
1668
- p,
1669
- E,
1670
- D,
1671
- A,
1672
- H,
1673
- L,
1674
- ge.cols,
1675
- ae,
1676
- U,
1677
- R,
1678
- J,
1679
- V,
1680
- It,
1681
- y,
1682
- kt,
1683
- lt
1684
- ]
1685
- ), ct = _(() => {
1686
- const n = /* @__PURE__ */ new Map();
1687
- for (const d of I) {
1688
- const [u, h] = Et(d), N = q(h);
1689
- if (N === void 0) continue;
1690
- const W = n.get(u) ?? [];
1691
- W.push(N), n.set(u, W);
1692
- }
1693
- const r = /* @__PURE__ */ new Map();
1694
- for (const [d, u] of n)
1695
- r.set(d, u.sort((h, N) => h - N).join(","));
1696
- return r;
1697
- }, [I, q]), We = (X == null ? void 0 : X.col) ?? -1, Vt = /* @__PURE__ */ P(
1698
- "div",
1699
- {
1700
- ref: _e,
1701
- role: "row",
1702
- "aria-rowindex": 1,
1703
- className: At({ position: "header" }),
1704
- children: [
1705
- /* @__PURE__ */ v(
1706
- "div",
1707
- {
1708
- role: "columnheader",
1709
- "aria-colindex": 1,
1710
- className: Ft({ corner: !0 }),
1711
- children: a ?? /* @__PURE__ */ v("span", { className: "ds:sr-only", children: S("heatmap.rowsHeader") })
1712
- }
1713
- ),
1714
- Ct(ge.cols, (n) => /* @__PURE__ */ v(
1715
- "div",
1716
- {
1717
- role: "columnheader",
1718
- "aria-colindex": n + 2,
1719
- "data-highlighted": We === n,
1720
- className: Ft(),
1721
- children: m.columnLabel(s[n])
1722
- },
1723
- n
1724
- )),
1725
- g ? /* @__PURE__ */ v(
1726
- "div",
1727
- {
1728
- role: "columnheader",
1729
- "aria-colindex": K + 2,
1730
- "data-highlighted": We === K,
1731
- className: Ft(),
1732
- children: m.methodLabel(g)
1733
- }
1734
- ) : null
1735
- ]
1736
- }
1737
- );
1738
- let Nt = null;
1739
- if (M && k) {
1740
- const n = l.length, r = m.methodLabel(M), d = te === n, u = (h, N, W, se = r) => {
1741
- const ne = Jt(h, D);
1742
- return /* @__PURE__ */ v(
1743
- "div",
1744
- {
1745
- role: "gridcell",
1746
- "aria-colindex": N + 2,
1747
- "aria-label": m.sentence(se, W, ne),
1748
- tabIndex: d && z === N ? 0 : -1,
1749
- className: Lt({ tone: Qt(ne) }),
1750
- children: m.visibleText(ne)
1751
- },
1752
- N
1753
- );
1754
- };
1755
- Nt = /* @__PURE__ */ P(
1756
- "div",
1757
- {
1758
- ref: Oe,
1759
- role: "row",
1760
- "aria-rowindex": n + 2,
1761
- className: At({ position: "footer" }),
1762
- children: [
1763
- /* @__PURE__ */ v(
1764
- "div",
1765
- {
1766
- role: "rowheader",
1767
- "aria-colindex": 1,
1768
- "data-highlighted": (X == null ? void 0 : X.rowKey) === Mt,
1769
- className: Yt({ kind: "total", virtualised: L }),
1770
- children: r
1771
- }
1772
- ),
1773
- Ct(
1774
- ge.cols,
1775
- (h) => u(k.columns[h], h, m.columnLabel(s[h]))
1776
- ),
1777
- g ? u(
1778
- k.grand,
1779
- K,
1780
- m.methodLabel(g),
1781
- // The corner aggregates every cell by the row method, so it
1782
- // is named for all cells, not for the footer's own method.
1783
- S("heatmap.allCells")
1784
- ) : null
1785
- ]
1786
- }
1787
- );
1788
- }
1789
- const i = [], f = ge.rows;
1790
- f.lead > 0 && i.push(
1791
- /* @__PURE__ */ v(
1792
- "div",
1793
- {
1794
- "aria-hidden": "true",
1795
- className: Xe({ axis: "row-lead" })
1796
- },
1797
- "row-lead"
1798
- )
1799
- ), f.indexes.forEach((n, r) => {
1800
- f.middle > 0 && r === f.middleAfter && i.push(
1801
- /* @__PURE__ */ v(
1802
- "div",
1803
- {
1804
- "aria-hidden": "true",
1805
- className: Xe({ axis: "row-middle" })
1806
- },
1807
- "row-middle"
1808
- )
1809
- );
1810
- const d = l[n];
1811
- if (!d) return;
1812
- const u = n === te;
1813
- i.push(
1814
- /* @__PURE__ */ v(
1815
- Sr,
1816
- {
1817
- ctx: St,
1818
- row: d,
1819
- ariaRowIndex: n + 2,
1820
- highlighted: (X == null ? void 0 : X.rowKey) === d.key,
1821
- activeCol: u ? z : -1,
1822
- tooltipCol: (Ee == null ? void 0 : Ee.rowKey) === d.key ? Ee.col : -1,
1823
- selectedCols: d.kind === "data" ? ct.get(o[d.rowIndex].id) ?? "" : ""
1824
- },
1825
- d.key
1826
- )
1827
- );
1828
- }), f.tail > 0 && i.push(
1829
- /* @__PURE__ */ v(
1830
- "div",
1831
- {
1832
- "aria-hidden": "true",
1833
- className: Xe({ axis: "row-tail" })
1834
- },
1835
- "row-tail"
1836
- )
1837
- );
1838
- const T = {
1839
- "--heatmap-columns": String(Math.max(1, K)),
1840
- "--heatmap-row-lead": String(f.lead),
1841
- "--heatmap-row-middle": String(f.middle),
1842
- "--heatmap-row-tail": String(f.tail),
1843
- "--heatmap-col-lead": String(ge.cols.lead),
1844
- "--heatmap-col-middle": String(ge.cols.middle),
1845
- "--heatmap-col-tail": String(ge.cols.tail),
1846
- "--heatmap-sticky-block-start": `${re.headerBlock}px`,
1847
- "--heatmap-sticky-block-end": `${re.footerBlock}px`,
1848
- "--heatmap-sticky-inline-start": `${re.leadInline}px`
1849
- };
1850
- return /* @__PURE__ */ P(
1851
- "div",
1852
- {
1853
- ref: Q,
1854
- onScroll: nt,
1855
- style: T,
1856
- "data-component": "heatmap-grid",
1857
- className: wr(),
1858
- children: [
1859
- /* @__PURE__ */ P(
1860
- "div",
1861
- {
1862
- ref: Y,
1863
- role: "grid",
1864
- tabIndex: -1,
1865
- "aria-label": t,
1866
- "aria-rowcount": de.length + 1,
1867
- "aria-colcount": Me + 1,
1868
- "aria-multiselectable": A === "multiple" || A === "range" ? !0 : void 0,
1869
- "data-heatmap-grid": "",
1870
- className: yr({
1871
- size: ve,
1872
- density: j,
1873
- virtualised: L,
1874
- totalsColumn: !!g
1875
- }),
1876
- onKeyDown: De,
1877
- onPointerDown: yt,
1878
- onPointerMove: xt,
1879
- onPointerLeave: Pe,
1880
- onClick: st,
1881
- onFocus: (n) => {
1882
- n.target.matches(":focus-visible") && (ke.current = "keyboard"), me.current = !0, G(!0);
1883
- },
1884
- onBlur: (n) => {
1885
- n.currentTarget.contains(n.relatedTarget) || (me.current = !1, G(!1));
1886
- },
1887
- children: [
1888
- Vt,
1889
- i,
1890
- Nt
1891
- ]
1892
- }
1893
- ),
1894
- dt !== null ? /* @__PURE__ */ v("span", { id: R, hidden: !0, children: dt }) : null
1895
- ]
1896
- }
1897
- );
1898
- }
1899
- const $t = Array.from({ length: be }, (e, t) => t);
1900
- function _r(e, t) {
1901
- return {
1902
- start: e.min === null ? "" : t(e.min),
1903
- end: e.max === null ? "" : t(e.max),
1904
- middle: e.type === "diverging" && e.midpoint !== void 0 ? t(e.midpoint) : void 0
1905
- };
1906
- }
1907
- const ea = fa(
1908
- ({
1909
- variant: e = "stepped",
1910
- palette: t,
1911
- scale: a,
1912
- values: o,
1913
- valueFormatter: s,
1914
- showEmpty: c,
1915
- showLowSample: l,
1916
- minCount: b,
1917
- className: w
1918
- }, m) => {
1919
- const { t: x, i18n: k } = Ht("ui"), g = xa(), M = wa(k.resolvedLanguage ?? k.language), p = _(
1920
- () => a ? Wt(a, o ?? []) : (g == null ? void 0 : g.scale) ?? Wt({ type: "sequential" }, o ?? []),
1921
- [a, o, g == null ? void 0 : g.scale]
1922
- ), E = t ?? (g == null ? void 0 : g.palette) ?? (p.type === "diverging" ? "diverging" : "primary"), D = s ?? (g == null ? void 0 : g.describer.formatValue) ?? Ia(M, "number"), A = (p.type === "quantile" || p.type === "threshold") && p.thresholds.length > 0, I = p.thresholds.length + 1, q = A ? Array.from(
1923
- { length: I },
1924
- (y, S) => qt(S, I)
1925
- ) : [], H = p.thresholds.map(D), L = _r(p, D), ve = A ? x("heatmap.legend.descriptionBands", {
1926
- count: I,
1927
- formatted: ka(M)(I),
1928
- edges: new Intl.ListFormat(M, {
1929
- type: "conjunction"
1930
- }).format(H)
1931
- }) : L.middle !== void 0 ? x("heatmap.legend.descriptionDiverging", {
1932
- min: L.start,
1933
- max: L.end,
1934
- midpoint: L.middle
1935
- }) : x("heatmap.legend.description", {
1936
- min: L.start,
1937
- max: L.end
1938
- }), j = (p.type === "quantile" || p.type === "threshold") && !A ? [p.min === null ? be / 2 : p.stepOf(p.min)] : null, J = c ?? (g == null ? void 0 : g.hasEmpty) ?? !1, V = l ?? (g == null ? void 0 : g.hasLowSample) ?? !1, U = b ?? (g == null ? void 0 : g.minCount), we = e === "continuous" ? "continuous" : "stepped", ee = (y) => /* @__PURE__ */ v("span", { className: Ir({ variant: e }), children: y.map((S) => /* @__PURE__ */ v(
1939
- "span",
1940
- {
1941
- className: mt({
1942
- tone: Ut(E, S),
1943
- shape: we
1944
- })
1945
- },
1946
- S
1947
- )) });
1948
- return /* @__PURE__ */ P(
1949
- "div",
1950
- {
1951
- ref: m,
1952
- role: "group",
1953
- "aria-label": x("heatmap.legend.label"),
1954
- "data-component": "heatmap-legend",
1955
- className: xr({ className: w }),
1956
- children: [
1957
- /* @__PURE__ */ v("span", { className: "ds:sr-only", children: ve }),
1958
- A ? /* @__PURE__ */ v(
1959
- "span",
1960
- {
1961
- "aria-hidden": "true",
1962
- "data-legend": "bands",
1963
- className: "ds:flex ds:min-w-0 ds:max-w-full ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)] ds:tabular-nums",
1964
- children: q.map((y, S) => /* @__PURE__ */ P(
1965
- "span",
1966
- {
1967
- className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
1968
- children: [
1969
- /* @__PURE__ */ v(
1970
- "span",
1971
- {
1972
- "data-step": y,
1973
- className: mt({
1974
- tone: Ut(E, y),
1975
- shape: "key"
1976
- })
1977
- }
1978
- ),
1979
- S < H.length ? /* @__PURE__ */ v("span", { className: "ds:shrink-0", children: H[S] }) : null
1980
- ]
1981
- },
1982
- y
1983
- ))
1984
- }
1985
- ) : /* @__PURE__ */ P(
1986
- "span",
1987
- {
1988
- "aria-hidden": "true",
1989
- className: "ds:flex ds:min-w-0 ds:max-w-full ds:items-center ds:gap-[var(--spacing-xs)] ds:tabular-nums",
1990
- children: [
1991
- /* @__PURE__ */ v("span", { className: "ds:shrink-0", children: L.start }),
1992
- L.middle !== void 0 ? /* @__PURE__ */ P(La, { children: [
1993
- ee($t.slice(0, be / 2)),
1994
- /* @__PURE__ */ v(
1995
- "span",
1996
- {
1997
- "data-legend": "midpoint",
1998
- className: mt({
1999
- tone: "midpoint",
2000
- shape: "label"
2001
- }),
2002
- children: L.middle
2003
- }
2004
- ),
2005
- ee($t.slice(be / 2))
2006
- ] }) : ee(j ?? $t),
2007
- /* @__PURE__ */ v("span", { className: "ds:shrink-0", children: L.end })
2008
- ]
2009
- }
2010
- ),
2011
- J ? /* @__PURE__ */ P("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
2012
- /* @__PURE__ */ v(
2013
- "span",
2014
- {
2015
- "aria-hidden": "true",
2016
- className: mt({ tone: "empty" })
2017
- }
2018
- ),
2019
- x("heatmap.legend.noData")
2020
- ] }) : null,
2021
- V ? /* @__PURE__ */ P("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
2022
- /* @__PURE__ */ v(
2023
- "span",
2024
- {
2025
- "aria-hidden": "true",
2026
- className: mt({ tone: "low-sample" })
2027
- }
2028
- ),
2029
- U === void 0 ? x("heatmap.legend.lowSample") : x("heatmap.legend.lowSampleUnder", {
2030
- value: new Intl.NumberFormat(M).format(U)
2031
- })
2032
- ] }) : null
2033
- ]
2034
- }
2035
- );
2036
- }
2037
- );
2038
- ea.displayName = "HeatmapLegend";
2039
- const ta = () => import("./data-table-COoCQ4n_.js").then((e) => e.h).then((e) => ({
2040
- default: e.DataTable
2041
- })), Mr = va(ta);
2042
- function ha() {
2043
- ta().catch(() => {
2044
- });
2045
- }
2046
- function ht(e, t) {
2047
- const a = (e == null ? void 0 : e.value) ?? null;
2048
- return {
2049
- value: a,
2050
- count: e == null ? void 0 : e.count,
2051
- status: a === null ? "empty" : Zt(e == null ? void 0 : e.count, t) ? "low-sample" : "value"
2052
- };
2053
- }
2054
- function Rr({
2055
- title: e,
2056
- rowsLabel: t,
2057
- rows: a,
2058
- columns: o,
2059
- matrix: s,
2060
- body: c,
2061
- grouped: l,
2062
- groupIds: b,
2063
- describer: w,
2064
- totals: m,
2065
- rowTotals: x,
2066
- columnTotals: k,
2067
- groupColumnMethod: g,
2068
- minCount: M,
2069
- onLoadError: p
2070
- }) {
2071
- const { t: E } = Ht("ui"), D = _(
2072
- () => [
2073
- ...l ? [
2074
- {
2075
- colId: "group",
2076
- field: "group",
2077
- headerName: E("heatmap.table.group"),
2078
- // A sort here would pull rows out of their groups.
2079
- sortable: !1
2080
- }
2081
- ] : [],
2082
- {
2083
- colId: "row",
2084
- field: "row",
2085
- headerName: t ?? E("heatmap.rowsHeader"),
2086
- sortable: !l
2087
- },
2088
- ...o.map(
2089
- (y, S) => ({
2090
- colId: `c${S}`,
2091
- headerName: w.columnLabel(y),
2092
- valueGetter: (ae) => {
2093
- var Q;
2094
- return ((Q = ae.data) == null ? void 0 : Q.cells[S]) ?? "";
2095
- },
2096
- sortable: !1
2097
- })
2098
- ),
2099
- ...x ? [
2100
- {
2101
- colId: "total",
2102
- field: "total",
2103
- headerName: w.methodLabel(x),
2104
- sortable: !1
2105
- }
2106
- ] : []
2107
- ],
2108
- [l, t, o, w, x, E]
2109
- ), A = _(
2110
- () => c.map((y) => {
2111
- if (y.kind === "group") {
2112
- const Q = w.groupLabel(y.groupId), Y = (m == null ? void 0 : m.groupColumns.get(y.groupId)) ?? [];
2113
- return {
2114
- id: `group:${b.get(y.groupId) ?? ""}`,
2115
- group: Q,
2116
- row: w.groupRowText(Q, g),
2117
- cells: o.map(
2118
- (_e, Oe) => w.tableText(ht(Y[Oe], M))
2119
- ),
2120
- total: x && m ? w.tableText(
2121
- ht(m.groups.get(y.groupId), M)
2122
- ) : void 0
2123
- };
2124
- }
2125
- const S = y.rowIndex, ae = a[S].group;
2126
- return {
2127
- id: `row:${a[S].id}`,
2128
- group: l && ae !== void 0 ? w.groupLabel(ae) : void 0,
2129
- row: w.rowLabel(a[S]),
2130
- cells: s[S].map((Q) => w.tableText(Q)),
2131
- total: x && m ? w.tableText(ht(m.rows[S], M)) : void 0
2132
- };
2133
- }),
2134
- [
2135
- c,
2136
- a,
2137
- o,
2138
- s,
2139
- l,
2140
- b,
2141
- w,
2142
- x,
2143
- m,
2144
- g,
2145
- M
2146
- ]
2147
- ), I = _(
2148
- () => k && m ? [
2149
- {
2150
- id: "heatmap-column-totals",
2151
- row: w.methodLabel(k),
2152
- cells: m.columns.map(
2153
- (y) => w.tableText(ht(y, M))
2154
- ),
2155
- // The grand total, by the row method, as the grid's corner.
2156
- total: x ? w.tableText(ht(m.grand, M)) : void 0
2157
- }
2158
- ] : void 0,
2159
- [k, x, m, w, M]
2160
- ), q = A.length + ((I == null ? void 0 : I.length) ?? 0), H = $(q);
2161
- H.current = q;
2162
- const [L, ve] = le(null), j = L === q, J = $(null);
2163
- Je(() => {
2164
- const y = J.current;
2165
- if (j || !y || typeof ResizeObserver > "u") return;
2166
- const S = new ResizeObserver(() => {
2167
- y.scrollHeight > y.clientHeight + 1 && ve(H.current);
2168
- }), ae = () => {
2169
- S.observe(y);
2170
- for (const Y of Array.from(y.children)) S.observe(Y);
2171
- };
2172
- ae();
2173
- const Q = new MutationObserver(ae);
2174
- return Q.observe(y, { childList: !0 }), () => {
2175
- S.disconnect(), Q.disconnect();
2176
- };
2177
- }, [j]);
2178
- const V = _(
2179
- () => ({
2180
- getRowId: (y) => y.data.id,
2181
- domLayout: j ? "normal" : "autoHeight"
2182
- }),
2183
- [j]
2184
- ), [U, we] = le(0), ee = _(
2185
- () => U === 0 ? Mr : va(ta),
2186
- [U]
2187
- );
2188
- return /* @__PURE__ */ v(
2189
- "div",
2190
- {
2191
- ref: J,
2192
- role: "group",
2193
- "aria-label": e,
2194
- tabIndex: -1,
2195
- "data-component": "heatmap-table",
2196
- "data-layout": j ? "capped" : "fit",
2197
- className: br({ capped: j }),
2198
- children: /* @__PURE__ */ v(
2199
- ja,
2200
- {
2201
- size: "sm",
2202
- onError: () => p == null ? void 0 : p(),
2203
- onRetry: () => {
2204
- var y;
2205
- we((S) => S + 1), (y = J.current) == null || y.focus();
2206
- },
2207
- children: /* @__PURE__ */ v(
2208
- Ha,
2209
- {
2210
- fallback: /* @__PURE__ */ v("div", { role: "status", "aria-label": E("heatmap.loadingTable"), children: /* @__PURE__ */ v(
2211
- jt,
2212
- {
2213
- variant: "rectangular",
2214
- className: "ds:h-[calc(var(--min-target-size)*4)] ds:w-full"
2215
- }
2216
- ) }),
2217
- children: /* @__PURE__ */ v(
2218
- ee,
2219
- {
2220
- columnDefs: D,
2221
- rowData: A,
2222
- pinnedBottomRowData: I,
2223
- density: "compact",
2224
- heightClass: j ? "ds:min-h-0 ds:flex-1" : "",
2225
- gridOptions: V
2226
- }
2227
- )
2228
- }
2229
- )
2230
- }
2231
- )
2232
- }
2233
- );
2234
- }
2235
- const Tr = { type: "sequential", domain: "auto" }, Dt = (e) => new Set((e ?? []).map((t) => Kt(t.rowId, t.columnId))), ga = { text: "", privacyMode: !1, repeat: 0 }, Ta = fa(
2236
- ({
2237
- title: e,
2238
- rows: t,
2239
- columns: a,
2240
- getCell: o,
2241
- cells: s,
2242
- groups: c,
2243
- scale: l = Tr,
2244
- palette: b,
2245
- valueType: w = "number",
2246
- minCount: m,
2247
- valueFormatter: x,
2248
- showValues: k = !1,
2249
- legend: g = "stepped",
2250
- rowTotals: M = !1,
2251
- columnTotals: p = !1,
2252
- sortRows: E,
2253
- defaultSortRows: D = "none",
2254
- onSortRowsChange: A,
2255
- groupRows: I = !1,
2256
- defaultCollapsedGroups: q,
2257
- selection: H = "none",
2258
- selectedCells: L,
2259
- defaultSelectedCells: ve,
2260
- onSelectionChange: j,
2261
- onCellClick: J,
2262
- renderTooltip: V,
2263
- density: U = "default",
2264
- size: we = "md",
2265
- loading: ee = !1,
2266
- privacyMode: y = !1,
2267
- privacyScope: S = "rows",
2268
- rowsLabel: ae,
2269
- defaultView: Q = "heatmap",
2270
- onViewChange: Y,
2271
- id: _e,
2272
- className: Oe,
2273
- children: K
2274
- }, Me) => {
2275
- const { t: O, i18n: de } = Ht("ui"), ye = wa(de.resolvedLanguage ?? de.language), F = _(
2276
- () => dr(t, a, o, s, m),
2277
- [t, a, o, s, m]
2278
- ), et = _(() => cr(F), [F]), te = JSON.stringify(l), z = _(
2279
- () => Wt(l, et),
2280
- // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed by content
2281
- [te, et]
2282
- ), ce = b ?? (z.type === "diverging" ? "diverging" : "primary"), xe = _(
2283
- () => x ?? Ia(ye, w),
2284
- [x, ye, w]
2285
- ), Ie = _(() => ka(ye), [ye]), G = _(
2286
- () => Qa({
2287
- t: O,
2288
- privacyMode: y,
2289
- privacyScope: S,
2290
- valueType: w,
2291
- formatValue: xe,
2292
- formatCount: Ie,
2293
- groups: c
2294
- }),
2295
- [
2296
- O,
2297
- y,
2298
- S,
2299
- w,
2300
- xe,
2301
- Ie,
2302
- c
2303
- ]
2304
- ), me = _(
2305
- () => ir(t, c),
2306
- [t, c]
2307
- ), ke = p || M || "mean", tt = M || "mean", ze = _(
2308
- () => pr(
2309
- F,
2310
- t,
2311
- a.length,
2312
- tt,
2313
- p || "mean",
2314
- ke
2315
- ),
2316
- [
2317
- F,
2318
- t,
2319
- a.length,
2320
- tt,
2321
- p,
2322
- ke
2323
- ]
2324
- ), [Le, ft] = le(ga), Se = $(0), Ve = $(y);
2325
- Ve.current = y;
2326
- const X = C((i, f = !1) => {
2327
- window.clearTimeout(Se.current);
2328
- const T = Ve.current, n = () => ft((r) => ({
2329
- text: i,
2330
- privacyMode: T,
2331
- repeat: r.text === i ? r.repeat + 1 : 0
2332
- }));
2333
- f ? Se.current = window.setTimeout(n, 300) : n();
2334
- }, []);
2335
- gt(() => () => window.clearTimeout(Se.current), []), gt(() => {
2336
- window.clearTimeout(Se.current), ft((i) => i.text === "" ? i : ga);
2337
- }, [y]);
2338
- const Ee = Le.privacyMode === y ? (
2339
- // The same words twice leave the DOM unchanged and a screen reader
2340
- // silent: a trailing no-break space on every other repeat changes
2341
- // the text without changing what is read.
2342
- `${Le.text}${Le.repeat % 2 === 1 ? " " : ""}`
2343
- ) : "", [re, Ot] = le(Q), Re = C(
2344
- (i) => {
2345
- Ot(i), Y == null || Y(i), X(
2346
- O(i === "table" ? "heatmap.announce.tableView" : "heatmap.announce.heatmapView")
2347
- );
2348
- },
2349
- [Y, X, O]
2350
- ), [at, vt] = le(D), Be = E ?? at, rt = C(
2351
- (i) => {
2352
- E === void 0 && vt(i), A == null || A(i);
2353
- },
2354
- [E, A]
2355
- ), [he, zt] = le(
2356
- () => new Set(q ?? [])
2357
- ), Fe = C(
2358
- (i, f) => {
2359
- if (he.has(i) === f) return;
2360
- zt((n) => {
2361
- if (n.has(i) === f) return n;
2362
- const r = new Set(n);
2363
- return f ? r.add(i) : r.delete(i), r;
2364
- });
2365
- const T = G.groupLabel(i);
2366
- X(
2367
- f ? O("heatmap.announce.groupCollapsed", { group: T }) : O("heatmap.announce.groupExpanded", { group: T })
2368
- );
2369
- },
2370
- [he, X, G, O]
2371
- ), wt = C(
2372
- (i) => Fe(i, !he.has(i)),
2373
- [he, Fe]
2374
- ), ge = _(
2375
- () => new Intl.Collator(ye, { numeric: !0, sensitivity: "base" }),
2376
- [ye]
2377
- ), Ae = Be === "label" && G.masksRows ? "none" : Be, Ne = _(
2378
- () => hr(
2379
- t.map((i, f) => f),
2380
- t,
2381
- ze.rows,
2382
- Ae,
2383
- ge
2384
- ),
2385
- [t, ze.rows, Ae, ge]
2386
- ), nt = _(
2387
- () => oa(t, Ne, I, he),
2388
- [t, Ne, I, he]
2389
- ), bt = _(
2390
- () => oa(t, Ne, I, /* @__PURE__ */ new Set()),
2391
- [t, Ne, I]
2392
- ), Ke = _(
2393
- () => new Map(t.map((i, f) => [i.id, f])),
2394
- [t]
2395
- ), B = _(
2396
- () => new Map(a.map((i, f) => [String(i.id), f])),
2397
- [a]
2398
- ), Ge = C(
2399
- (i) => B.get(i),
2400
- [B]
2401
- ), ue = C(
2402
- (i, f) => {
2403
- const T = t[i], n = a[f], r = F[i][f];
2404
- return {
2405
- rowId: T.id,
2406
- columnId: n.id,
2407
- row: T,
2408
- column: n,
2409
- rowIndex: i,
2410
- columnIndex: f,
2411
- value: r.value,
2412
- count: r.count,
2413
- label: r.label,
2414
- status: r.status,
2415
- step: r.status === "value" && r.value !== null ? z.stepOf(r.value) : null
2416
- };
2417
- },
2418
- [t, a, F, z]
2419
- ), $e = C(
2420
- (i) => {
2421
- const f = i.row.group === void 0 ? void 0 : me.get(i.row.group);
2422
- return {
2423
- rowId: i.rowId,
2424
- columnId: i.columnId,
2425
- row: {
2426
- id: i.row.id,
2427
- label: G.rowLabel(i.row),
2428
- ...f === void 0 ? {} : { group: f }
2429
- },
2430
- column: {
2431
- id: i.column.id,
2432
- label: G.columnLabel(i.column)
2433
- },
2434
- rowIndex: i.rowIndex,
2435
- columnIndex: i.columnIndex,
2436
- value: i.value,
2437
- count: i.count,
2438
- status: i.status,
2439
- step: i.step
2440
- };
2441
- },
2442
- [G, me]
2443
- ), Ce = C(
2444
- (i) => V ? V(y ? $e(i) : i, {
2445
- privacyMode: y
2446
- }) : G.sentence(
2447
- G.rowLabel(i.row),
2448
- G.columnLabel(i.column),
2449
- F[i.rowIndex][i.columnIndex]
2450
- ),
2451
- [V, y, $e, G, F]
2452
- ), De = L !== void 0, [je, ot] = le(
2453
- () => Dt(ve)
2454
- ), pe = _(() => {
2455
- const i = De ? Dt(L) : je, f = /* @__PURE__ */ new Set();
2456
- for (const T of i) {
2457
- const [n, r] = Et(T);
2458
- Ke.has(n) && B.has(r) && f.add(T);
2459
- }
2460
- return f;
2461
- }, [
2462
- De,
2463
- L,
2464
- je,
2465
- Ke,
2466
- B
2467
- ]), yt = C(
2468
- (i) => {
2469
- const f = [];
2470
- for (const T of i) {
2471
- const [n, r] = Et(T), d = Ke.get(n), u = B.get(r);
2472
- d !== void 0 && u !== void 0 && f.push(ue(d, u));
2473
- }
2474
- return f;
2475
- },
2476
- [Ke, B, ue]
2477
- ), xt = C(
2478
- (i, f) => G.cellName(
2479
- G.rowLabel(t[i]),
2480
- G.columnLabel(a[f])
2481
- ),
2482
- [G, t, a]
2483
- ), fe = C(
2484
- (i, f, T = !1) => {
2485
- De || ot(i), j == null || j(yt(i)), X(f, T);
2486
- },
2487
- [De, j, yt, X]
2488
- ), Te = C(
2489
- (i) => i === 0 ? O("heatmap.announce.cleared") : O("heatmap.announce.count", {
2490
- count: i,
2491
- formatted: Ie(i)
2492
- }),
2493
- [O, Ie]
2494
- ), Pe = _(
2495
- () => nt.flatMap((i) => i.kind === "data" ? [i.rowIndex] : []),
2496
- [nt]
2497
- ), st = C(
2498
- (i, f) => {
2499
- const T = Pe.indexOf(i.rowIndex), n = Pe.indexOf(f.rowIndex), r = /* @__PURE__ */ new Set();
2500
- if (T === -1 || n === -1) return r;
2501
- const [d, u] = T <= n ? [T, n] : [n, T], [h, N] = i.col <= f.col ? [i.col, f.col] : [f.col, i.col];
2502
- for (let W = d; W <= u; W += 1) {
2503
- const se = t[Pe[W]].id;
2504
- for (let ne = h; ne <= N; ne += 1)
2505
- r.add(Kt(se, a[ne].id));
2506
- }
2507
- return r;
2508
- },
2509
- [Pe, t, a]
2510
- ), it = C(
2511
- (i, f, T) => {
2512
- if (J == null || J(ue(i, f)), !T || H === "none") return;
2513
- const n = Kt(t[i].id, a[f].id), r = xt(i, f);
2514
- if (H === "multiple") {
2515
- const u = new Set(pe), h = !u.has(n);
2516
- h ? u.add(n) : u.delete(n), fe(
2517
- u,
2518
- O(h ? "heatmap.announce.added" : "heatmap.announce.removed", {
2519
- cell: r,
2520
- count: u.size,
2521
- formatted: Ie(u.size)
2522
- })
2523
- );
2524
- return;
2525
- }
2526
- const d = pe.size === 1 && pe.has(n);
2527
- fe(
2528
- d ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([n]),
2529
- d ? O("heatmap.announce.cleared") : O("heatmap.announce.selected", { cell: r })
2530
- );
2531
- },
2532
- [
2533
- J,
2534
- ue,
2535
- H,
2536
- t,
2537
- a,
2538
- xt,
2539
- pe,
2540
- fe,
2541
- Ie,
2542
- O
2543
- ]
2544
- ), It = C(
2545
- (i, f) => {
2546
- if (H !== "range" && H !== "multiple") return;
2547
- const T = st(i, f);
2548
- T.size === pe.size && [...T].every((n) => pe.has(n)) || fe(T, Te(T.size), !0);
2549
- },
2550
- [H, st, pe, fe, Te]
2551
- ), kt = _(
2552
- () => new Map([...me].map(([i, f]) => [f, i])),
2553
- [me]
2554
- ), lt = {
2555
- selected: pe,
2556
- selection: H,
2557
- view: re,
2558
- sortRows: Be,
2559
- collapsed: he,
2560
- groupRows: I,
2561
- rows: t,
2562
- columns: a,
2563
- expandedBody: bt,
2564
- groupIds: me,
2565
- groupByPublicId: kt,
2566
- rowIndexById: Ke,
2567
- columnIndexById: B,
2568
- matrix: F,
2569
- scale: z,
2570
- setView: Re,
2571
- setSortRows: rt,
2572
- setGroupCollapsed: Fe,
2573
- commitSelection: fe,
2574
- rectangle: st,
2575
- countMessage: Te
2576
- }, R = $(lt);
2577
- R.current = lt;
2578
- const qe = _(() => {
2579
- const i = (r) => {
2580
- const { columns: d, columnIndexById: u } = R.current, h = [];
2581
- for (const N of r) {
2582
- const [W, se] = Et(N), ne = u.get(se);
2583
- ne !== void 0 && h.push({ rowId: W, columnId: d[ne].id });
2584
- }
2585
- return h;
2586
- }, f = (r) => {
2587
- const { rowIndexById: d, columnIndexById: u } = R.current, h = d.get(r.rowId), N = u.get(String(r.columnId));
2588
- return h === void 0 || N === void 0 ? null : { rowIndex: h, col: N };
2589
- }, T = (r) => {
2590
- const d = f(r);
2591
- if (!d)
2592
- throw new Error(
2593
- `Heatmap: no cell at row "${r.rowId}", column "${String(r.columnId)}".`
2594
- );
2595
- return d;
2596
- }, n = () => {
2597
- if (R.current.selection === "none")
2598
- throw new Error('Heatmap: selection is off (selection="none").');
2599
- };
2600
- return {
2601
- getSelection: () => i(R.current.selected),
2602
- getSelectionMode: () => R.current.selection,
2603
- selectCells: (r) => {
2604
- n(), r.forEach(T);
2605
- const { selection: d } = R.current, u = d === "single" ? r.slice(0, 1) : r, h = Dt(u);
2606
- R.current.commitSelection(
2607
- h,
2608
- R.current.countMessage(h.size)
2609
- );
2610
- },
2611
- selectRange: (r, d) => {
2612
- const { selection: u } = R.current;
2613
- if (u !== "range" && u !== "multiple")
2614
- throw new Error(
2615
- 'Heatmap: select_range needs selection="range" or "multiple".'
2616
- );
2617
- const h = T(r), N = T(d), W = R.current.rectangle(h, N);
2618
- R.current.commitSelection(
2619
- W,
2620
- R.current.countMessage(W.size)
2621
- );
2622
- },
2623
- clearSelection: () => {
2624
- n(), R.current.selected.size !== 0 && R.current.commitSelection(
2625
- /* @__PURE__ */ new Set(),
2626
- R.current.countMessage(0)
2627
- );
2628
- },
2629
- readCell: (r) => {
2630
- const d = f(r);
2631
- if (!d) return null;
2632
- const u = R.current.matrix[d.rowIndex][d.col];
2633
- return {
2634
- value: u.value,
2635
- count: u.count,
2636
- status: u.status,
2637
- step: u.status === "value" && u.value !== null ? R.current.scale.stepOf(u.value) : null
2638
- };
2639
- },
2640
- getView: () => R.current.view,
2641
- setView: (r) => R.current.setView(r),
2642
- getSortRows: () => R.current.sortRows,
2643
- setSortRows: (r) => R.current.setSortRows(r),
2644
- getRowIds: () => {
2645
- const { expandedBody: r, rows: d } = R.current;
2646
- return r.flatMap(
2647
- (u) => u.kind === "data" ? [d[u.rowIndex].id] : []
2648
- );
2649
- },
2650
- getColumnIds: () => R.current.columns.map((r) => r.id),
2651
- getGroupIds: () => {
2652
- const {
2653
- groupRows: r,
2654
- expandedBody: d,
2655
- groupIds: u
2656
- } = R.current;
2657
- return r ? d.flatMap(
2658
- (h) => h.kind === "group" ? [u.get(h.groupId) ?? ""] : []
2659
- ) : [];
2660
- },
2661
- getCollapsedGroups: () => {
2662
- const { collapsed: r, groupIds: d } = R.current;
2663
- return [...r].flatMap((u) => {
2664
- const h = d.get(u);
2665
- return h === void 0 ? [] : [h];
2666
- });
2667
- },
2668
- setGroupCollapsed: (r, d) => {
2669
- const { groupRows: u, groupByPublicId: h } = R.current;
2670
- if (!u)
2671
- throw new Error(
2672
- "Heatmap: rows are not grouped (groupRows is off)."
2673
- );
2674
- const N = h.get(r);
2675
- if (N === void 0)
2676
- throw new Error(`Heatmap: no group "${r}".`);
2677
- R.current.setGroupCollapsed(N, d);
2678
- }
2679
- };
2680
- }, []);
2681
- Oa(Ya, qe, _e);
2682
- const dt = _(
2683
- () => F.some((i) => i.some((f) => f.status === "empty")),
2684
- [F]
2685
- ), St = _(
2686
- () => F.some((i) => i.some((f) => f.status === "low-sample")),
2687
- [F]
2688
- ), ct = _(
2689
- () => ({
2690
- palette: ce,
2691
- scale: z,
2692
- describer: G,
2693
- hasEmpty: dt,
2694
- hasLowSample: St,
2695
- minCount: m,
2696
- tooltipText: Ce
2697
- }),
2698
- [
2699
- ce,
2700
- z,
2701
- G,
2702
- dt,
2703
- St,
2704
- m,
2705
- Ce
2706
- ]
2707
- ), We = ua({ className: Oe });
2708
- if (ee)
2709
- return /* @__PURE__ */ v(Tt.Provider, { value: ct, children: /* @__PURE__ */ P(
2710
- "div",
2711
- {
2712
- ref: Me,
2713
- "data-component": "heatmap",
2714
- "data-component-id": _e,
2715
- className: We,
2716
- children: [
2717
- /* @__PURE__ */ P(
2718
- "div",
2719
- {
2720
- role: "status",
2721
- "aria-label": O("heatmap.loading"),
2722
- "aria-busy": "true",
2723
- className: ua(),
2724
- children: [
2725
- /* @__PURE__ */ v(
2726
- jt,
2727
- {
2728
- variant: "rectangular",
2729
- className: "ds:h-[var(--spacing-md)] ds:w-[calc(var(--spacing-xl)*6)] ds:max-w-full"
2730
- }
2731
- ),
2732
- /* @__PURE__ */ v(
2733
- jt,
2734
- {
2735
- variant: "rectangular",
2736
- className: "ds:h-[calc(var(--min-target-size)*5)] ds:w-full"
2737
- }
2738
- )
2739
- ]
2740
- }
2741
- ),
2742
- K
2743
- ]
2744
- }
2745
- ) });
2746
- if (t.length === 0 || a.length === 0 || !ur(F))
2747
- return /* @__PURE__ */ v(Tt.Provider, { value: ct, children: /* @__PURE__ */ P(
2748
- "div",
2749
- {
2750
- ref: Me,
2751
- "data-component": "heatmap",
2752
- "data-component-id": _e,
2753
- className: We,
2754
- children: [
2755
- /* @__PURE__ */ v(
2756
- Va,
2757
- {
2758
- variant: "no-results",
2759
- size: "sm",
2760
- title: O("heatmap.empty.title"),
2761
- description: O("heatmap.empty.description")
2762
- }
2763
- ),
2764
- K
2765
- ]
2766
- }
2767
- ) });
2768
- const Vt = t.length * a.length > gr, Nt = H !== "none" || J !== void 0;
2769
- return /* @__PURE__ */ v(Tt.Provider, { value: ct, children: /* @__PURE__ */ P(
2770
- "div",
2771
- {
2772
- ref: Me,
2773
- "data-component": "heatmap",
2774
- "data-component-id": _e,
2775
- className: We,
2776
- children: [
2777
- /* @__PURE__ */ P("div", { className: vr(), children: [
2778
- g !== !1 ? /* @__PURE__ */ v(ea, { variant: g }) : null,
2779
- /* @__PURE__ */ v(
2780
- za,
2781
- {
2782
- intent: "outline",
2783
- size: "sm",
2784
- className: "ds:ms-auto",
2785
- startIcon: re === "table" ? /* @__PURE__ */ v(qa, { "aria-hidden": "true" }) : /* @__PURE__ */ v(Ua, { "aria-hidden": "true" }),
2786
- onPointerEnter: re === "table" ? void 0 : ha,
2787
- onFocus: re === "table" ? void 0 : ha,
2788
- onClick: () => Re(re === "table" ? "heatmap" : "table"),
2789
- children: O(re === "table" ? "heatmap.viewAsHeatmap" : "heatmap.viewAsTable")
2790
- }
2791
- )
2792
- ] }),
2793
- re === "table" ? /* @__PURE__ */ v(
2794
- Rr,
2795
- {
2796
- onLoadError: () => X(O("heatmap.announce.tableFailed")),
2797
- title: e,
2798
- rowsLabel: ae,
2799
- rows: t,
2800
- columns: a,
2801
- matrix: F,
2802
- body: bt,
2803
- grouped: I,
2804
- groupIds: me,
2805
- describer: G,
2806
- totals: ze,
2807
- rowTotals: M,
2808
- columnTotals: p,
2809
- groupColumnMethod: ke,
2810
- minCount: m
2811
- },
2812
- `${y}-${S}`
2813
- ) : /* @__PURE__ */ v(Fa, { delayDuration: 0, children: /* @__PURE__ */ v(
2814
- Nr,
2815
- {
2816
- title: e,
2817
- rowsLabel: ae,
2818
- rows: t,
2819
- columns: a,
2820
- matrix: F,
2821
- body: nt,
2822
- scale: z,
2823
- palette: ce,
2824
- describer: G,
2825
- showValues: k,
2826
- totals: ze,
2827
- rowTotals: M,
2828
- columnTotals: p,
2829
- groupColumnMethod: ke,
2830
- groupIds: me,
2831
- minCount: m,
2832
- selectionMode: H,
2833
- selected: pe,
2834
- columnIndexOfKey: Ge,
2835
- interactive: Nt,
2836
- virtualised: Vt,
2837
- size: we,
2838
- density: U,
2839
- cellInfo: ue,
2840
- tooltipText: Ce,
2841
- describeFocused: V !== void 0,
2842
- onActivate: it,
2843
- onRange: It,
2844
- onToggleGroup: wt
2845
- }
2846
- ) }),
2847
- K,
2848
- /* @__PURE__ */ v(Ba, { children: Ee }, String(y))
2849
- ]
2850
- }
2851
- ) });
2852
- }
2853
- );
2854
- Ta.displayName = "Heatmap";
2855
- const Wr = Object.assign(Ta, {
2856
- Legend: ea,
2857
- Tooltip: Na
2858
- });
2859
- export {
2860
- Wr as H,
2861
- ea as a,
2862
- Na as b,
2863
- Ya as h
2864
- };
2865
- //# sourceMappingURL=heatmap-BxRHM8Et.js.map