@aceshooting/lyra-ui 32.0.0 → 33.0.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 (468) hide show
  1. package/CHANGELOG.md +224 -1380
  2. package/README.md +36 -7
  3. package/custom-elements.slim.json +1 -0
  4. package/design-tokens.json +1 -1
  5. package/dist/accent-roles.css +1 -0
  6. package/dist/all.d.ts +1 -1
  7. package/dist/all.js +1 -1
  8. package/dist/autoloader.d.ts +10 -0
  9. package/dist/autoloader.js +1 -1
  10. package/dist/cli/migrate-wa.mjs +54 -44
  11. package/dist/cli/migration-contract.json.gz +0 -0
  12. package/dist/components/agent-tools/budget-meter/budget-meter.class.d.ts +1 -0
  13. package/dist/components/agent-tools/budget-meter/budget-meter.styles.js +1 -1
  14. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +1 -1
  15. package/dist/components/charts/chart/box-plot.class.d.ts +3 -0
  16. package/dist/components/charts/chart/chart-band.js +1 -1
  17. package/dist/components/charts/chart/chart-input-projection.js +1 -1
  18. package/dist/components/charts/chart/chart-surface.styles.js +1 -1
  19. package/dist/components/charts/chart/chart-types.d.ts +16 -2
  20. package/dist/components/charts/chart/chart.class.d.ts +4 -1
  21. package/dist/components/charts/chart/chart.class.js +3 -3
  22. package/dist/components/charts/chart/lite-chart.class.d.ts +3 -0
  23. package/dist/components/charts/chart/lite-chart.styles.js +1 -1
  24. package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +10 -0
  25. package/dist/components/conversation/code-block/code-block-base.class.d.ts +31 -3
  26. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  27. package/dist/components/conversation/code-block/code-block-core.class.d.ts +46 -2
  28. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  29. package/dist/components/conversation/code-block/code-block-shared.d.ts +6 -2
  30. package/dist/components/conversation/code-block/code-block-shared.js +5 -4
  31. package/dist/components/conversation/code-block/code-block.class.d.ts +48 -3
  32. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  33. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  34. package/dist/components/conversation/code-block/code-grammar-registry.d.ts +35 -0
  35. package/dist/components/conversation/code-block/code-grammar-registry.js +1 -0
  36. package/dist/components/conversation/markdown/markdown-core.class.d.ts +12 -0
  37. package/dist/components/conversation/markdown/markdown.class.d.ts +12 -0
  38. package/dist/components/conversation/markdown/markdown.styles.js +1 -1
  39. package/dist/components/conversation/model-select/model-select.class.d.ts +12 -5
  40. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +1 -1
  41. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +1 -0
  42. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  43. package/dist/components/conversation/thread-list/thread-list.class.d.ts +3 -0
  44. package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
  45. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +1 -1
  46. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +12 -5
  47. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +4 -0
  48. package/dist/components/data/heatmap/heatmap.class.d.ts +21 -2
  49. package/dist/components/data/heatmap/heatmap.class.js +2 -2
  50. package/dist/components/data/heatmap/heatmap.styles.js +1 -1
  51. package/dist/components/data/stat/stat.class.d.ts +24 -1
  52. package/dist/components/data/stat/stat.class.js +2 -2
  53. package/dist/components/data/stat/stat.styles.js +1 -1
  54. package/dist/components/data/table/table-row-attributes.js +1 -0
  55. package/dist/components/data/table/table-support.d.ts +64 -5
  56. package/dist/components/data/table/table-support.js +1 -1
  57. package/dist/components/data/table/table.class.d.ts +78 -7
  58. package/dist/components/data/table/table.class.js +10 -10
  59. package/dist/components/data/table/table.styles.js +1 -1
  60. package/dist/components/data/timeline/timeline-item.class.d.ts +27 -5
  61. package/dist/components/data/timeline/timeline-item.class.js +11 -7
  62. package/dist/components/data/timeline/timeline-item.styles.js +1 -1
  63. package/dist/components/data/timeline/timeline.class.d.ts +54 -8
  64. package/dist/components/data/timeline/timeline.class.js +11 -7
  65. package/dist/components/data/timeline/timeline.styles.js +1 -1
  66. package/dist/components/data/tree/tree-item.class.d.ts +2 -0
  67. package/dist/components/data/tree/tree-item.class.js +2 -2
  68. package/dist/components/data/tree/tree-item.styles.js +1 -1
  69. package/dist/components/forms/button/button.class.d.ts +13 -0
  70. package/dist/components/forms/button/button.styles.js +1 -1
  71. package/dist/components/forms/catalog-picker-base.d.ts +14 -1
  72. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  73. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +28 -2
  74. package/dist/components/forms/checkbox-group/checkbox-group.class.js +3 -3
  75. package/dist/components/forms/checkbox-group/checkbox-group.styles.js +1 -1
  76. package/dist/components/forms/code-editor/code-editor.class.d.ts +18 -3
  77. package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
  78. package/dist/components/forms/color-picker/color-picker.class.d.ts +25 -5
  79. package/dist/components/forms/color-picker/color-picker.class.js +3 -3
  80. package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
  81. package/dist/components/forms/combobox/combobox-option-html.js +1 -0
  82. package/dist/components/forms/combobox/combobox.class.d.ts +140 -12
  83. package/dist/components/forms/combobox/combobox.class.js +113 -22
  84. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  85. package/dist/components/forms/country-picker/country-picker.class.d.ts +4 -3
  86. package/dist/components/forms/currency-picker/currency-picker.class.d.ts +4 -3
  87. package/dist/components/forms/date-picker/date-input.class.d.ts +53 -3
  88. package/dist/components/forms/date-picker/date-input.class.js +2 -2
  89. package/dist/components/forms/date-picker/date-input.styles.js +1 -1
  90. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +14 -0
  91. package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
  92. package/dist/components/forms/icon-button/icon-button.class.d.ts +2 -1
  93. package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
  94. package/dist/components/forms/input/input-shared.d.ts +24 -3
  95. package/dist/components/forms/input/input.styles.js +1 -1
  96. package/dist/components/forms/input/time-input.class.d.ts +19 -4
  97. package/dist/components/forms/input/time-input.styles.js +1 -1
  98. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +17 -5
  99. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
  100. package/dist/components/forms/otp-input/otp-input.class.d.ts +8 -3
  101. package/dist/components/forms/otp-input/otp-input.styles.js +1 -1
  102. package/dist/components/forms/phone-input/phone-input.class.d.ts +18 -3
  103. package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
  104. package/dist/components/forms/radio/radio-group.class.d.ts +23 -2
  105. package/dist/components/forms/radio/radio-group.class.js +2 -2
  106. package/dist/components/forms/radio/radio-group.styles.js +1 -1
  107. package/dist/components/forms/radio/radio.class.js +2 -2
  108. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +4 -0
  109. package/dist/components/forms/select/select.class.d.ts +16 -4
  110. package/dist/components/forms/select/select.class.js +1 -1
  111. package/dist/components/forms/select/select.styles.js +1 -1
  112. package/dist/components/forms/signature-pad/signature-pad.class.d.ts +8 -3
  113. package/dist/components/forms/signature-pad/signature-pad.styles.js +1 -1
  114. package/dist/components/forms/slider/slider.class.d.ts +29 -2
  115. package/dist/components/forms/slider/slider.class.js +3 -3
  116. package/dist/components/forms/slider/slider.styles.js +1 -1
  117. package/dist/components/forms/switch/switch.class.d.ts +2 -0
  118. package/dist/components/forms/switch/switch.styles.js +1 -1
  119. package/dist/components/forms/textarea/textarea.class.d.ts +20 -3
  120. package/dist/components/forms/textarea/textarea.styles.js +1 -1
  121. package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +4 -3
  122. package/dist/components/forms/token-input/token-input.class.d.ts +99 -21
  123. package/dist/components/forms/token-input/token-input.class.js +11 -8
  124. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  125. package/dist/components/forms/unit-picker/unit-picker.class.d.ts +4 -3
  126. package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -0
  127. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  128. package/dist/components/layout/button-group/button-group.class.d.ts +4 -0
  129. package/dist/components/layout/button-group/button-group.class.js +1 -1
  130. package/dist/components/layout/card/card.class.d.ts +15 -1
  131. package/dist/components/layout/card/card.styles.js +1 -1
  132. package/dist/components/layout/command-palette/command-palette.class.d.ts +1 -1
  133. package/dist/components/layout/details/details.class.d.ts +6 -0
  134. package/dist/components/layout/details/details.styles.js +1 -1
  135. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +6 -0
  136. package/dist/components/layout/filter-bar/filter-bar.styles.js +1 -1
  137. package/dist/components/layout/index.d.ts +1 -1
  138. package/dist/components/layout/index.js +1 -1
  139. package/dist/components/layout/menu/dropdown-item.class.d.ts +8 -2
  140. package/dist/components/layout/menu/dropdown-item.class.js +1 -1
  141. package/dist/components/layout/menu/menu-item.class.d.ts +7 -0
  142. package/dist/components/layout/menu/menu-item.styles.js +1 -1
  143. package/dist/components/layout/menu/menu-label.class.d.ts +5 -0
  144. package/dist/components/layout/menu/menu-label.class.js +1 -1
  145. package/dist/components/layout/menu/menu.class.d.ts +4 -1
  146. package/dist/components/layout/menu/menu.styles.js +1 -1
  147. package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.d.ts +1 -1
  148. package/dist/components/layout/page/page.class.d.ts +9 -1
  149. package/dist/components/layout/page/page.class.js +2 -2
  150. package/dist/components/layout/segmented/segmented.class.d.ts +22 -3
  151. package/dist/components/layout/segmented/segmented.class.js +3 -4
  152. package/dist/components/layout/segmented/segmented.styles.js +1 -1
  153. package/dist/components/layout/stepper/step.class.d.ts +102 -0
  154. package/dist/components/layout/stepper/step.class.js +18 -0
  155. package/dist/components/layout/stepper/step.styles.js +1 -0
  156. package/dist/components/layout/stepper/stepper.class.d.ts +106 -13
  157. package/dist/components/layout/stepper/stepper.class.js +6 -2
  158. package/dist/components/layout/stepper/stepper.styles.js +1 -1
  159. package/dist/components/layout/tab-group/tab-group.class.d.ts +10 -1
  160. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  161. package/dist/components/layout/tab-group/tab-group.styles.js +1 -1
  162. package/dist/components/layout/tab-group/tab-panel.class.d.ts +1 -0
  163. package/dist/components/layout/tab-group/tab-panel.class.js +1 -1
  164. package/dist/components/layout/tab-group/tab.class.d.ts +4 -0
  165. package/dist/components/layout/widget/widget.class.d.ts +1 -0
  166. package/dist/components/layout/widget/widget.styles.js +1 -1
  167. package/dist/components/lr-code-block-core.d.ts +1 -1
  168. package/dist/components/lr-code-block.d.ts +1 -1
  169. package/dist/components/lr-counter.d.ts +1 -0
  170. package/dist/components/lr-counter.js +1 -0
  171. package/dist/components/lr-lightbox-item.d.ts +1 -0
  172. package/dist/components/lr-lightbox-item.js +1 -0
  173. package/dist/components/lr-lightbox.d.ts +1 -1
  174. package/dist/components/lr-lightbox.js +1 -1
  175. package/dist/components/lr-number-ticker.d.ts +1 -0
  176. package/dist/components/lr-number-ticker.js +1 -0
  177. package/dist/components/lr-step.d.ts +1 -0
  178. package/dist/components/lr-step.js +1 -0
  179. package/dist/components/media/file-input/file-input.class.d.ts +8 -1
  180. package/dist/components/media/file-input/file-input.class.js +2 -2
  181. package/dist/components/media/file-input/file-input.styles.js +1 -1
  182. package/dist/components/media/index.d.ts +1 -1
  183. package/dist/components/media/index.js +1 -1
  184. package/dist/components/media/lightbox/lightbox-item.class.d.ts +67 -0
  185. package/dist/components/media/lightbox/lightbox-item.class.js +9 -0
  186. package/dist/components/media/lightbox/lightbox-item.styles.js +1 -0
  187. package/dist/components/media/lightbox/lightbox-source.js +1 -1
  188. package/dist/components/media/lightbox/lightbox-types.d.ts +4 -1
  189. package/dist/components/media/lightbox/lightbox.class.d.ts +123 -30
  190. package/dist/components/media/lightbox/lightbox.class.js +18 -12
  191. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  192. package/dist/components/media/map/map-anchor-avoid.js +1 -1
  193. package/dist/components/media/map/map-drawing-controller.js +1 -1
  194. package/dist/components/media/map/map.class.d.ts +137 -7
  195. package/dist/components/media/map/map.class.js +6 -6
  196. package/dist/components/media/map/map.styles.js +1 -1
  197. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +9 -0
  198. package/dist/components/media/sequence-playback/sequence-playback.class.js +2 -2
  199. package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
  200. package/dist/components/media/video/video.class.d.ts +4 -0
  201. package/dist/components/media/video/video.class.js +2 -2
  202. package/dist/components/media/video/video.styles.js +1 -1
  203. package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +15 -0
  204. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
  205. package/dist/components/overlays/badge/badge.class.d.ts +2 -0
  206. package/dist/components/overlays/badge/badge.styles.js +1 -1
  207. package/dist/components/overlays/badge/tag.class.d.ts +2 -0
  208. package/dist/components/overlays/badge/tag.class.js +1 -1
  209. package/dist/components/overlays/chip/chip-group.class.d.ts +31 -4
  210. package/dist/components/overlays/chip/chip-group.class.js +3 -3
  211. package/dist/components/overlays/context-menu/context-menu.class.d.ts +6 -1
  212. package/dist/components/overlays/context-menu/context-menu.class.js +1 -1
  213. package/dist/components/overlays/dialog/dialog.class.d.ts +54 -6
  214. package/dist/components/overlays/dialog/dialog.class.js +3 -3
  215. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  216. package/dist/components/overlays/dialog/prompt.d.ts +60 -0
  217. package/dist/components/overlays/dialog/prompt.js +1 -0
  218. package/dist/components/overlays/drawer/drawer.class.d.ts +22 -1
  219. package/dist/components/overlays/drawer/drawer.class.js +1 -1
  220. package/dist/components/overlays/empty/empty.class.d.ts +1 -0
  221. package/dist/components/overlays/empty/empty.class.js +1 -1
  222. package/dist/components/overlays/overlay/dropdown.class.d.ts +5 -1
  223. package/dist/components/overlays/overlay/dropdown.class.js +1 -1
  224. package/dist/components/overlays/overlay/overlay.styles.js +1 -1
  225. package/dist/components/overlays/overlay/popover.class.d.ts +30 -4
  226. package/dist/components/overlays/overlay/popover.class.js +2 -2
  227. package/dist/components/overlays/overlay/tooltip.class.d.ts +7 -0
  228. package/dist/components/overlays/overlay/tooltip.class.js +4 -4
  229. package/dist/components/overlays/toast/toast-item.class.d.ts +3 -2
  230. package/dist/components/overlays/toast/toast-item.class.js +1 -1
  231. package/dist/components/overlays/toast/toast-item.styles.js +1 -1
  232. package/dist/components/overlays/toast/toast.class.d.ts +6 -0
  233. package/dist/components/overlays/toast/toast.class.js +1 -1
  234. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +1 -1
  235. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +1 -1
  236. package/dist/components/utility/copy-button/copy-button.class.d.ts +4 -1
  237. package/dist/components/utility/copy-button/copy-button.class.js +2 -2
  238. package/dist/components/utility/counter/counter-time.d.ts +15 -0
  239. package/dist/components/utility/counter/counter-time.js +1 -0
  240. package/dist/components/utility/counter/counter.class.d.ts +67 -0
  241. package/dist/components/utility/counter/counter.class.js +1 -0
  242. package/dist/components/utility/counter/counter.styles.js +1 -0
  243. package/dist/components/utility/divider/divider.class.d.ts +21 -3
  244. package/dist/components/utility/divider/divider.class.js +5 -1
  245. package/dist/components/utility/export-button/export-button.class.d.ts +6 -1
  246. package/dist/components/utility/export-button/export-button.styles.js +1 -1
  247. package/dist/components/utility/icon/icon-library-bootstrap.d.ts +50 -0
  248. package/dist/components/utility/icon/icon-library-bootstrap.js +1 -0
  249. package/dist/components/utility/icon/icon-library-font-awesome.d.ts +68 -0
  250. package/dist/components/utility/icon/icon-library-font-awesome.js +1 -0
  251. package/dist/components/utility/icon/icon-library.d.ts +14 -1
  252. package/dist/components/utility/icon/icon-library.js +1 -1
  253. package/dist/components/utility/icon/icon-sprite.js +1 -0
  254. package/dist/components/utility/icon/icon.class.d.ts +4 -2
  255. package/dist/components/utility/icon/icon.class.js +2 -2
  256. package/dist/components/utility/index.d.ts +1 -1
  257. package/dist/components/utility/index.js +1 -1
  258. package/dist/components/utility/known-date/known-date.class.d.ts +14 -0
  259. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +1 -1
  260. package/dist/components/utility/number-ticker/number-ticker.class.d.ts +66 -0
  261. package/dist/components/utility/number-ticker/number-ticker.class.js +1 -0
  262. package/dist/components/utility/number-ticker/number-ticker.styles.js +1 -0
  263. package/dist/components/utility/tour/tour.class.d.ts +1 -1
  264. package/dist/components/viewers/include/include.class.d.ts +4 -1
  265. package/dist/components/viewers/include/include.class.js +1 -1
  266. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +10 -1
  267. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
  268. package/dist/components/viewers/pdf-viewer/pdf-viewer.styles.js +1 -1
  269. package/dist/custom-elements-jsx.d.ts +1 -1
  270. package/dist/event-classes.d.ts +2342 -0
  271. package/dist/event-classes.js +1 -0
  272. package/dist/events.d.ts +48 -22
  273. package/dist/framework-types.d.ts +2 -2
  274. package/dist/internal/accessibility-visibility.js +1 -1
  275. package/dist/internal/all-defined-arguments.d.ts +19 -0
  276. package/dist/internal/all-defined-arguments.js +1 -0
  277. package/dist/internal/autoloader-manifest.js +1 -1
  278. package/dist/internal/autoloader-tags.d.ts +1 -1
  279. package/dist/internal/autoloader-tags.js +1 -1
  280. package/dist/internal/checked-control-label.js +1 -1
  281. package/dist/internal/component-loaders.generated.js +1 -1
  282. package/dist/internal/declarative-overlay-action.js +1 -0
  283. package/dist/internal/dedent.js +7 -0
  284. package/dist/internal/default-strings/forms.generated.js +1 -1
  285. package/dist/internal/default-strings/layout.generated.js +1 -1
  286. package/dist/internal/dev-mode-attribute-warning.development.js +1 -1
  287. package/dist/internal/document-token-css.generated.js +10 -0
  288. package/dist/internal/document-tokens.generated.js +2 -11
  289. package/dist/internal/document-tokens.js +2 -2
  290. package/dist/internal/dom-guards.js +1 -1
  291. package/dist/internal/external-label-association.js +1 -0
  292. package/dist/internal/focus-navigation.js +1 -1
  293. package/dist/internal/form-control/chrome.styles.js +1 -1
  294. package/dist/internal/form-control-labels.js +1 -1
  295. package/dist/internal/form-control.styles.js +1 -1
  296. package/dist/internal/interactive-control.styles.js +2 -2
  297. package/dist/internal/labeled-group.js +1 -1
  298. package/dist/internal/localization-runtime.d.ts +5 -0
  299. package/dist/internal/localization-runtime.js +1 -1
  300. package/dist/internal/localization-types.d.ts +1 -1
  301. package/dist/internal/localization.js +2 -2
  302. package/dist/internal/lyra-element.d.ts +11 -2
  303. package/dist/internal/lyra-element.js +2 -2
  304. package/dist/internal/lyra-event.d.ts +22 -0
  305. package/dist/internal/lyra-event.js +1 -0
  306. package/dist/internal/overlay-shared.d.ts +5 -2
  307. package/dist/internal/overlay-shared.js +1 -1
  308. package/dist/internal/package-metadata.js +1 -1
  309. package/dist/internal/root-registration-allowlist.js +1 -1
  310. package/dist/internal/scoped-definitions.generated.js +1 -1
  311. package/dist/internal/shiki/core.d.ts +4 -1
  312. package/dist/internal/shiki/tokenize.js +1 -1
  313. package/dist/internal/srcset.js +1 -0
  314. package/dist/internal/theme-observation.js +1 -1
  315. package/dist/lyra.d.ts +1 -1
  316. package/dist/lyra.js +1 -1
  317. package/dist/ssr/all.d.ts +1 -1
  318. package/dist/ssr/all.js +1 -1
  319. package/dist/ssr.d.ts +5 -5
  320. package/dist/ssr.js +1 -1
  321. package/dist/styles/native.css +1 -1
  322. package/dist/styles/palette.css +1 -0
  323. package/dist/styles/tokens-root.css +1 -1
  324. package/dist/styles/utilities.css +1 -1
  325. package/dist/svelte.d.ts +1 -1
  326. package/dist/testing/happy-dom-shims.d.ts +11 -2
  327. package/dist/testing/happy-dom-shims.js +1 -1
  328. package/dist/testing/index.d.ts +1 -1
  329. package/dist/testing/index.js +1 -1
  330. package/dist/testing/lyra-tag-event-map.d.ts +2 -2
  331. package/dist/testing/lyra-tag-event-map.js +1 -1
  332. package/dist/theme-core.css +1 -1
  333. package/dist/theme.css +1 -1
  334. package/dist/utilities/defined.d.ts +10 -1
  335. package/dist/utilities/defined.js +1 -1
  336. package/dist/utilities/form.d.ts +9 -0
  337. package/dist/utilities/form.js +1 -0
  338. package/dist/utilities/index.d.ts +1 -1
  339. package/dist/utilities/index.js +1 -1
  340. package/dist/vue.d.ts +1 -1
  341. package/llms/components/lr-app-rail.md +4 -2
  342. package/llms/components/lr-badge.md +4 -4
  343. package/llms/components/lr-bar-chart.md +1 -1
  344. package/llms/components/lr-box-plot.md +6 -1
  345. package/llms/components/lr-bubble-chart.md +1 -1
  346. package/llms/components/lr-budget-meter.md +2 -2
  347. package/llms/components/lr-button-group.md +7 -3
  348. package/llms/components/lr-button.md +11 -1
  349. package/llms/components/lr-card.md +11 -1
  350. package/llms/components/lr-chart.md +21 -7
  351. package/llms/components/lr-checkbox-group.md +11 -1
  352. package/llms/components/lr-chip.md +11 -1
  353. package/llms/components/lr-citation-badge.md +1 -1
  354. package/llms/components/lr-code-block-core.md +39 -9
  355. package/llms/components/lr-code-block.md +59 -6
  356. package/llms/components/lr-code-editor.md +11 -1
  357. package/llms/components/lr-color-picker.md +19 -6
  358. package/llms/components/lr-combobox.md +81 -9
  359. package/llms/components/lr-context-menu.md +6 -4
  360. package/llms/components/lr-copy-button.md +6 -4
  361. package/llms/components/lr-counter.md +60 -0
  362. package/llms/components/lr-country-picker.md +4 -0
  363. package/llms/components/lr-currency-picker.md +4 -0
  364. package/llms/components/lr-date-input.md +1 -1
  365. package/llms/components/lr-date-picker.md +25 -1
  366. package/llms/components/lr-details.md +6 -2
  367. package/llms/components/lr-dialog.md +101 -9
  368. package/llms/components/lr-divider.md +14 -5
  369. package/llms/components/lr-doughnut-chart.md +1 -1
  370. package/llms/components/lr-drawer.md +32 -7
  371. package/llms/components/lr-dropdown-item.md +1 -1
  372. package/llms/components/lr-dropdown.md +8 -4
  373. package/llms/components/lr-emoji-picker.md +10 -1
  374. package/llms/components/lr-empty.md +3 -2
  375. package/llms/components/lr-entity-chip.md +1 -1
  376. package/llms/components/lr-export-button.md +6 -3
  377. package/llms/components/lr-file-input.md +13 -1
  378. package/llms/components/lr-filter-bar.md +6 -2
  379. package/llms/components/lr-graph-query-builder.md +10 -1
  380. package/llms/components/lr-heatmap.md +20 -3
  381. package/llms/components/lr-histogram.md +7 -2
  382. package/llms/components/lr-icon-button.md +3 -1
  383. package/llms/components/lr-icon.md +104 -0
  384. package/llms/components/lr-include.md +3 -0
  385. package/llms/components/lr-input.md +9 -1
  386. package/llms/components/lr-known-date.md +10 -1
  387. package/llms/components/lr-lightbox-item.md +14 -0
  388. package/llms/components/lr-lightbox.md +119 -14
  389. package/llms/components/lr-line-chart.md +7 -2
  390. package/llms/components/lr-lite-chart.md +3 -2
  391. package/llms/components/lr-locale-picker.md +17 -1
  392. package/llms/components/lr-map.md +122 -11
  393. package/llms/components/lr-markdown-core.md +15 -4
  394. package/llms/components/lr-markdown.md +13 -4
  395. package/llms/components/lr-mention-popover.md +1 -1
  396. package/llms/components/lr-menu-item.md +1 -1
  397. package/llms/components/lr-menu-label.md +5 -2
  398. package/llms/components/lr-menu.md +22 -7
  399. package/llms/components/lr-model-select.md +13 -3
  400. package/llms/components/lr-native-time-input.md +11 -1
  401. package/llms/components/lr-number-input.md +11 -1
  402. package/llms/components/lr-number-ticker.md +60 -0
  403. package/llms/components/lr-otp-input.md +11 -1
  404. package/llms/components/lr-page.md +7 -1
  405. package/llms/components/lr-pagination.md +18 -0
  406. package/llms/components/lr-pdf-viewer.md +6 -1
  407. package/llms/components/lr-phone-input.md +11 -1
  408. package/llms/components/lr-pie-chart.md +1 -1
  409. package/llms/components/lr-polar-area-chart.md +1 -1
  410. package/llms/components/lr-popover.md +26 -6
  411. package/llms/components/lr-radar-chart.md +1 -1
  412. package/llms/components/lr-radio-group.md +11 -1
  413. package/llms/components/lr-rubric-form.md +7 -1
  414. package/llms/components/lr-scatter-chart.md +1 -1
  415. package/llms/components/lr-segmented.md +20 -2
  416. package/llms/components/lr-select.md +11 -3
  417. package/llms/components/lr-selection-toolbar.md +1 -1
  418. package/llms/components/lr-sequence-playback.md +8 -2
  419. package/llms/components/lr-signature-pad.md +8 -1
  420. package/llms/components/lr-slider.md +17 -4
  421. package/llms/components/lr-stat.md +20 -5
  422. package/llms/components/lr-step.md +67 -0
  423. package/llms/components/lr-stepper.md +64 -8
  424. package/llms/components/lr-suggestion-chips.md +3 -2
  425. package/llms/components/lr-switch.md +4 -3
  426. package/llms/components/lr-tab-group.md +10 -3
  427. package/llms/components/lr-tab-panel.md +2 -2
  428. package/llms/components/lr-table.md +87 -8
  429. package/llms/components/lr-tag.md +1 -1
  430. package/llms/components/lr-textarea.md +17 -1
  431. package/llms/components/lr-thread-list.md +4 -2
  432. package/llms/components/lr-time-input.md +9 -2
  433. package/llms/components/lr-time-zone-picker.md +4 -0
  434. package/llms/components/lr-timeline-item.md +1 -1
  435. package/llms/components/lr-timeline.md +47 -3
  436. package/llms/components/lr-toast-item.md +1 -1
  437. package/llms/components/lr-toast.md +8 -3
  438. package/llms/components/lr-token-input.md +68 -11
  439. package/llms/components/lr-tool-call-chip.md +1 -1
  440. package/llms/components/lr-tooltip.md +8 -3
  441. package/llms/components/lr-tree-item.md +1 -1
  442. package/llms/components/lr-tree.md +2 -1
  443. package/llms/components/lr-unit-picker.md +4 -0
  444. package/llms/components/lr-usage-badge.md +1 -1
  445. package/llms/components/lr-video.md +5 -4
  446. package/llms/components/lr-voice-picker.md +10 -2
  447. package/llms/components/lr-widget.md +2 -2
  448. package/llms/components/lr-zoomable-frame.md +8 -0
  449. package/llms/index.md +205 -201
  450. package/llms/migration.md +103 -16
  451. package/llms/peers.md +3 -3
  452. package/llms/shared/events-and-types.md +36 -0
  453. package/llms/shared/forms-and-accessibility.md +4 -1
  454. package/llms/shared/frameworks-and-ssr.md +10 -1
  455. package/llms/shared/imports-and-registration.md +68 -2
  456. package/llms/shared/localization-and-rtl.md +5 -0
  457. package/llms/shared/native-styles-and-utilities.md +142 -7
  458. package/llms/shared/styles-and-tokens.md +60 -6
  459. package/llms/shared/testing-and-utilities.md +30 -0
  460. package/llms/shared.md +354 -17
  461. package/llms/tokens.md +6 -1
  462. package/llms.txt +3 -3
  463. package/locales.json +1 -1
  464. package/package.json +48 -10
  465. package/registrations.json +1 -1
  466. package/skills/compose-lyra-interfaces/SKILL.md +1 -1
  467. package/skills/lyra-ui/SKILL.md +1 -1
  468. package/skills/lyra-ui/commands/migrate.md +1 -1
@@ -1,6 +1,6 @@
1
1
  import{__decorate}from"tslib";import{layoutScale}from"../../../internal/layout-scale.js";import{HeatmapMatrixSourceController}from"./heatmap-matrix-source-controller.js";import{matrixRectangle}from"./heatmap-matrix-source.js";import{revealSource,sourceCsv,sourceWillUpdate,sourceUpdated,paintSource,renderSource}from"./heatmap-source-view.js";import{lyraLocaleCatalogVersion}from"../../../internal/localization-runtime.js";import{getOwnDataDescriptor}from"../../../internal/data-descriptors.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{syncAriaDescribedByElements}from"../../../internal/aria-reflection.js";import{normalizeLabel}from"../../../internal/accessible-name.js";import{finiteCount,finiteInteger,finiteNumber,finiteRange,minMax}from"../../../internal/numbers.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{armClickSuppression,capturePointer,consumeSuppressedClick,releasePointer}from"../../../internal/pointer-capture.js";import{watchDevicePixelRatio}from"../../../internal/owned-observer.js";import{isHandledOrComposingKey,isRepeatedActivationKey,shouldIgnoreNavigationKey}from"../../../internal/list-navigation.js";import{LYRA_CONTEXT_UPDATE}from"../../../internal/context-update.js";import{formatChartValue}from"../../../internal/chart-number-format.js";import{getScratchCtx,resolveBoundedCanvasAllocation}from"../../../internal/canvas.js";import{resolveCanvasColor}from"../../../internal/canvas-color.js";import{resolveCssTokenLength}from"../../../internal/css-token-length.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{activeElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{linearAlpha,linearBucket,midpointAlpha,midpointBucket,sqrtStep}from"./heatmap-scale.js";import{styles}from"./heatmap.styles.js";import{resolveRgb,formatRgb}from"./heatmap-colors.js";import{hexToRgb,resolveRgb as resolveRgb2}from"./heatmap-colors.js";import{DEFAULT_BUCKET_COUNT,MAX_HEATMAP_CELLS,MAX_HEATMAP_DECORATIONS,MAX_ACCESSIBLE_HEATMAP_CELLS,normalizeBucketCount}from"./heatmap-limits.js";import{MAX_BUCKET_COUNT,MAX_HEATMAP_CELLS as MAX_HEATMAP_CELLS2,MAX_HEATMAP_DECORATIONS as MAX_HEATMAP_DECORATIONS2,MAX_ACCESSIBLE_HEATMAP_CELLS as MAX_ACCESSIBLE_HEATMAP_CELLS2,normalizeBucketCount as normalizeBucketCount2}from"./heatmap-limits.js";import{buildCalendarGrid,parseIsoDate,quartileBucket}from"./calendar-grid.js";import{accessibleMatrixCellRect,calendarCellAt as readCalendarCell,calendarCellRect,calendarDateAt as readCalendarDate,isoDateAtOffset,calendarValueAt as readCalendarValue,firstInteractiveCalendarCell as findFirstInteractiveCalendarCell,firstInteractiveMatrixCell as findFirstInteractiveMatrixCell,hitTestCalendar as hitTestCalendarGrid,hitTestMatrix as hitTestMatrixGrid,matrixCellRect,nextInteractiveCalendarCell as findNextInteractiveCalendarCell,nextInteractiveMatrixCell as findNextInteractiveMatrixCell}from"./heatmap-grid-navigation.js";import{getDateTimeFormat}from"../../../internal/intl-cache.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{HeatmapLabelCache}from"./heatmap-label-cache.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{csvRow}from"../../../internal/csv.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{PAD_LEFT,PAD_TOP,ROW_LABEL_INSET,MAX_ROW_LABEL_FRACTION,MAX_COL_LABEL_HEIGHT,COL_LABEL_INSET,labelExtentConverter,STICKY_LABELS,LEGEND_PLACEMENT,AXIS_SELECTION,FALLBACK_NO_DATA_FILL,FALLBACK_STICKY_LABEL_BG,RAMP_STEPS,FALLBACK_SCALE_LO,FALLBACK_SCALE_HI,FALLBACK_LABEL_FONT,CAL_PAD_LEFT,CAL_WEEKDAY_LABEL_INSET,CAL_LABEL_H,CAL_CELL,CAL_GAP,DEFAULT_MATRIX_CELL_SIZE,MAX_MATRIX_ROW_HEIGHT,DEFAULT_ACCESSIBLE_TARGET_SIZE_PX,FIT_MIN_CELL,RING_LINE_WIDTH,FALLBACK_FOCUS_RING_COLOR,FALLBACK_ANNOTATION_COLOR,FALLBACK_SELECTED_COLOR,SCOPED_COLOR,MAX_CANVAS_DIMENSION,MAX_CANVAS_PIXELS,ARROW_KEYS,ignoresGridKey,GRID_KEYS,MS_PER_DAY,CAL_MONTH_LABEL_GAP,optionalCellSizeConverter,DEFAULT_MATRIX_DATA,normalizeCellSizeClamp,bucketCountConverter,mixRgb,CALENDAR_SPACING_PROPERTIES}from"./heatmap-config.js";import{legendStopsChanged}from"./heatmap-model.js";import{blankNumberConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_heatmapCalendarCellLabel,LYRA_DEFAULT_heatmapCalendarLabel,LYRA_DEFAULT_heatmapDecorationLimit,LYRA_DEFAULT_heatmapDefaultColLabel,LYRA_DEFAULT_heatmapDefaultRowLabel,LYRA_DEFAULT_heatmapInputLimit,LYRA_DEFAULT_heatmapMatrixCellLabel,LYRA_DEFAULT_heatmapMatrixLabel,LYRA_DEFAULT_heatmapNoDataValue,LYRA_DEFAULT_heatmapProjectionLimit,LYRA_DEFAULT_heatmapSelectedCellLabel,LYRA_DEFAULT_heatmapSelectedCount,LYRA_DEFAULT_heatmapSourceError,LYRA_DEFAULT_heatmapSourceExactWindow,LYRA_DEFAULT_heatmapSourceKeyboardHelp,LYRA_DEFAULT_heatmapSourceMax,LYRA_DEFAULT_heatmapSourceMean,LYRA_DEFAULT_heatmapSourceMin,LYRA_DEFAULT_heatmapSourceRangeLabel,LYRA_DEFAULT_heatmapSourceSummary,LYRA_DEFAULT_heatmapValueLabel}from"../../../internal/default-strings/data.generated.js";import{LYRA_DEFAULT_loading,LYRA_DEFAULT_noData}from"../../../internal/default-strings/shared.generated.js";class LyraHeatmap extends LyraElement{static{this.defaultStrings={...super.defaultStrings,heatmapCalendarCellLabel:LYRA_DEFAULT_heatmapCalendarCellLabel,heatmapCalendarLabel:LYRA_DEFAULT_heatmapCalendarLabel,heatmapDecorationLimit:LYRA_DEFAULT_heatmapDecorationLimit,heatmapDefaultColLabel:LYRA_DEFAULT_heatmapDefaultColLabel,heatmapDefaultRowLabel:LYRA_DEFAULT_heatmapDefaultRowLabel,heatmapInputLimit:LYRA_DEFAULT_heatmapInputLimit,heatmapMatrixCellLabel:LYRA_DEFAULT_heatmapMatrixCellLabel,heatmapMatrixLabel:LYRA_DEFAULT_heatmapMatrixLabel,heatmapNoDataValue:LYRA_DEFAULT_heatmapNoDataValue,heatmapProjectionLimit:LYRA_DEFAULT_heatmapProjectionLimit,heatmapSelectedCellLabel:LYRA_DEFAULT_heatmapSelectedCellLabel,heatmapSelectedCount:LYRA_DEFAULT_heatmapSelectedCount,heatmapSourceError:LYRA_DEFAULT_heatmapSourceError,heatmapSourceExactWindow:LYRA_DEFAULT_heatmapSourceExactWindow,heatmapSourceKeyboardHelp:LYRA_DEFAULT_heatmapSourceKeyboardHelp,heatmapSourceMax:LYRA_DEFAULT_heatmapSourceMax,heatmapSourceMean:LYRA_DEFAULT_heatmapSourceMean,heatmapSourceMin:LYRA_DEFAULT_heatmapSourceMin,heatmapSourceRangeLabel:LYRA_DEFAULT_heatmapSourceRangeLabel,heatmapSourceSummary:LYRA_DEFAULT_heatmapSourceSummary,heatmapValueLabel:LYRA_DEFAULT_heatmapValueLabel,loading:LYRA_DEFAULT_loading,noData:LYRA_DEFAULT_noData}}get matrixSource(){return this.sourceInput}set matrixSource(value){const old=this.sourceInput;this.sourceInput=value,this.sourceBindingGeneration++,value===null?this.matrixController?.detach():this.matrixController?.invalidate(),this.sourceNeedsConfigure=!0,this.requestUpdate("matrixSource",old,{hasChanged:()=>!0})}get matrixViewport(){return this.sourceViewportInput}set matrixViewport(value){const old=this.sourceViewportInput;this.sourceViewportInvalid=!1;try{this.sourceViewportInput=value===null?null:matrixRectangle(value)}catch{this.sourceViewportInvalid=!0,this.sourceViewportInput=null}this.sourceViewportExplicit=!0,this.sourceNeedsConfigure=!0;const next=this.sourceViewportInput;!this.sourceViewportInvalid&&(old===next||old!==null&&next!==null&&old.rowStart===next.rowStart&&old.rowEnd===next.rowEnd&&old.columnStart===next.columnStart&&old.columnEnd===next.columnEnd)||this.matrixController?.invalidate(),this.requestUpdate("matrixViewport",old,{hasChanged:()=>!0})}scheduleUpdate(){return this.matrixSource&&!this.matrixController&&this.isConnected&&(this.matrixController=new HeatmapMatrixSourceController(this,()=>{this.sourceResult++},()=>this.effectiveLocale)),super.scheduleUpdate()}revealSourceCell(row,col){return revealSource(this,row,col)}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-selection-change"])}static{this.ownedCollectionProperties=Object.freeze(["data","annotations","legendStops","colorSteps","selectedCells"])}static{this.identityCollectionObjectProperties=Object.freeze(["data"])}static{this.styles=[LyraElement.styles,styles,srOnly]}static get observedAttributes(){return[...new Set([...super.observedAttributes,"role"])]}get cellBudget(){return Math.max(1,Math.min(1e5,finiteCount(this.maxCells,MAX_HEATMAP_CELLS)))}get effectiveMode(){return this.data.kind}get stickyLabels(){return this._stickyLabels}set stickyLabels(next){const normalized=STICKY_LABELS.normalizeReflected(this,"sticky-labels",next),old=this._stickyLabels;old!==normalized&&(this._stickyLabels=normalized,this.requestUpdate("stickyLabels",old))}get effectiveStickyLabels(){return this.effectiveMode==="matrix"?this._stickyLabels:"none"}get freezesRowLabels(){const sticky=this.effectiveStickyLabels;return sticky==="rows"||sticky==="both"}get freezesColLabels(){const sticky=this.effectiveStickyLabels;return sticky==="cols"||sticky==="both"}get effectiveColLabelRotation(){if(typeof this.colLabelRotation!="number")return 0;const degrees=finiteNumber(this.colLabelRotation,0);return Math.min(90,Math.max(0,degrees))}get matrixPadLeft(){if(this.rowLabelWidth==="auto")return this.resolvedRowLabelWidth;if(typeof this.rowLabelWidth!="number")return PAD_LEFT;const resolved=finiteNumber(this.rowLabelWidth,PAD_LEFT);return resolved>=0?resolved:PAD_LEFT}get matrixGeometry(){if(!(this.matrixSource||this.effectiveMode!=="matrix"))return this.lastPaintedMatrixGeometry}set matrixGeometry(_value){}get calendarGeometry(){if(this.effectiveMode==="calendar")return this.lastPaintedCalendarGeometry}set calendarGeometry(_value){}exportData(format){if(format==="csv")return this.exportCsv();if(this.matrixSource&&(!this.matrixController||this.matrixController.loading||this.matrixController.error||this.sourceNeedsConfigure)||format!=="png"||!this.canvasHasContent||this.drawDirty||!this.canvas||this.canvas.width<=0||this.canvas.height<=0)return"";try{const rowBand=this.frozenBandCanvas("row-labels"),colBand=this.frozenBandCanvas("col-labels");if(!rowBand&&!colBand)return this.canvas.toDataURL("image/png");const composite=this.ownerDocument.createElement("canvas");composite.width=this.canvas.width,composite.height=this.canvas.height;const context=composite.getContext("2d");return context?(context.drawImage(this.canvas,0,0),rowBand&&rowBand.width>0&&rowBand.height>0&&context.drawImage(rowBand,0,0),colBand&&colBand.width>0&&colBand.height>0&&context.drawImage(colBand,0,0),composite.toDataURL("image/png")):""}catch{return""}}exportCsv(){if(this.matrixSource)return this.matrixController?sourceCsv(this):"";const data=this.data;if(data.kind==="calendar"){const header2="date,value",rows2=data.days.filter(day=>!this.isNoData(day.value)).map(day=>csvRow([day.date,day.value]));return[header2,...rows2].join(`\r
2
2
  `)}const header="row,column,value",rows=[];return data.values.forEach((rowValues,rowIndex)=>{const rowLabel=data.rowLabels[rowIndex]??"";rowValues.forEach((value,colIndex)=>{if(this.isNoData(value))return;const colLabel=data.colLabels[colIndex]??"";rows.push(csvRow([rowLabel,colLabel,value]))})}),[header,...rows].join(`\r
3
- `)}get matrixPadTop(){if(this.colLabelHeight==="auto")return this.resolvedColLabelHeight;if(typeof this.colLabelHeight!="number")return PAD_TOP;const resolved=finiteNumber(this.colLabelHeight,PAD_TOP);return resolved>=0?resolved:PAD_TOP}measureColLabelHeight(cs){const labels=this.matrixColLabels;if(labels.length===0)return PAD_TOP;const ctx=getScratchCtx(this.ownerDocument);if(!ctx)return PAD_TOP;ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);let widest=0;const interval=finiteInteger(this.colLabelInterval,1,1);for(let index=0;index<labels.length;index+=interval)widest=Math.max(widest,this.labelWidth(ctx,labels[index]));const radians=this.effectiveColLabelRotation*Math.PI/180,projected=widest*Math.sin(radians);return Math.max(PAD_TOP,Math.min(Math.ceil(projected)+COL_LABEL_INSET,MAX_COL_LABEL_HEIGHT))}measureRowLabelWidth(cs){const labels=this.matrixRowLabels;if(labels.length===0)return PAD_LEFT;const ctx=getScratchCtx(this.ownerDocument);if(!ctx)return PAD_LEFT;ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);let widest=0;for(const label of labels)widest=Math.max(widest,this.labelWidth(ctx,label));const hostWidth=this.clientWidth||0,cap=hostWidth>0?hostWidth*MAX_ROW_LABEL_FRACTION:Number.POSITIVE_INFINITY;return Math.min(Math.max(PAD_LEFT,Math.ceil(widest)+ROW_LABEL_INSET*2),cap)}withLabelCache(paint){const previous=this.labelCache;this.labelCache=new HeatmapLabelCache;try{paint()}finally{this.labelCache=previous}}labelWidth(ctx,label){return this.labelCache?.width(ctx,label)??ctx.measureText(label).width}ellipsize(ctx,label,maxWidth){return this.labelCache?.clip(ctx,label,maxWidth,()=>this.ellipsizeLabel(ctx,label,maxWidth))??this.ellipsizeLabel(ctx,label,maxWidth)}ellipsizeLabel(ctx,label,maxWidth){if(maxWidth<=0)return"";if(this.labelWidth(ctx,label)<=maxWidth)return label;const characters=[...label],shortened=kept=>`${characters.slice(0,kept).join("")}…`;let fits=0,most=characters.length-1;for(;fits<most;){const kept=fits+most+1>>1;this.labelWidth(ctx,shortened(kept))<=maxWidth?fits=kept:most=kept-1}return fits>0||this.labelWidth(ctx,"…")<=maxWidth?shortened(fits):""}get calendarPadLeft(){const requested=this.calendarWeekdayLabelWidth;return requested==="auto"?this.resolvedCalendarWeekdayLabelWidth:requested??CAL_PAD_LEFT}measureCalendarWeekdayLabelWidth(cs,firstWeekStart){const ctx=getScratchCtx(this.ownerDocument);if(!ctx)return CAL_PAD_LEFT;ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);let widest=0;for(const label of this.weekdayLabels(firstWeekStart))label&&(widest=Math.max(widest,this.labelWidth(ctx,label)));const hostWidth=this.clientWidth||0,cap=hostWidth>0?Math.max(CAL_PAD_LEFT,hostWidth*MAX_ROW_LABEL_FRACTION):Number.POSITIVE_INFINITY;return Math.min(Math.max(CAL_PAD_LEFT,Math.ceil(widest)+CAL_WEEKDAY_LABEL_INSET*2),cap)}get matrixRowLabels(){return this.cachedMatrixData.rowLabels}get matrixColLabels(){return this.cachedMatrixData.colLabels}get matrixValues(){return this.cachedMatrixData.values}get calendarDays(){return this.data.kind==="calendar"?this.data.days:[]}get calendarData(){return this.data.kind==="calendar"?this.data:void 0}get cellSize(){return this._cellSize??(this.effectiveMode==="calendar"?CAL_CELL:DEFAULT_MATRIX_CELL_SIZE)}set cellSize(value){const oldValue=this._cellSize;this._cellSize=value==null?void 0:finiteRange(value,this.effectiveMode==="calendar"?CAL_CELL:DEFAULT_MATRIX_CELL_SIZE,1),this.requestUpdate("cellSize",oldValue)}get rowHeight(){return this._rowHeight}set rowHeight(value){const oldValue=this._rowHeight;this._rowHeight=value==null||!Number.isFinite(value)?void 0:finiteRange(value,1,1,MAX_MATRIX_ROW_HEIGHT),this.requestUpdate("rowHeight",oldValue)}get legendPlacement(){return this._legendPlacement}set legendPlacement(next){const normalized=LEGEND_PLACEMENT.normalizeReflected(this,"legend-placement",next),old=this._legendPlacement;old!==normalized&&(this._legendPlacement=normalized,this.requestUpdate("legendPlacement",old))}get axisSelection(){return this._axisSelection}set axisSelection(next){const normalized=AXIS_SELECTION.normalizeReflected(this,"axis-selection",next),old=this._axisSelection;old!==normalized&&(this._axisSelection=normalized,this.requestUpdate("axisSelection",old))}get signedDomain(){return this.domain!==void 0||this.midpoint!==void 0}rampAlpha(value,lo,hi){const anchor=this.midpoint;return anchor===void 0?linearAlpha(value,lo,hi):midpointAlpha(value,lo,hi,anchor)}rampBucket(value,lo,hi,steps){const anchor=this.midpoint;return anchor===void 0?linearBucket(value,lo,hi,steps):midpointBucket(value,lo,hi,anchor,steps)}isNoData(value){return Number.isFinite(value)?value<0&&!this.signedDomain:!0}get maxCellSize(){return this._maxCellSize}set maxCellSize(value){const oldValue=this._maxCellSize;this._maxCellSize=normalizeCellSizeClamp(value),this.requestUpdate("maxCellSize",oldValue)}get minCellSize(){return this._minCellSize}set minCellSize(value){const oldValue=this._minCellSize;this._minCellSize=normalizeCellSizeClamp(value),this.requestUpdate("minCellSize",oldValue)}get normalizedFirstDayOfWeek(){return(finiteInteger(this.calendarData?.firstDayOfWeek??0,0)%7+7)%7}get bucketCount(){return this._bucketCount}set bucketCount(value){const oldValue=this._bucketCount;this._bucketCount=normalizeBucketCount(value),this.requestUpdate("bucketCount",oldValue)}toggleRowSelection(row){this.toggleSelectionAxis(row,!0)}toggleColumnSelection(col){this.toggleSelectionAxis(col,!1)}get calendarWeekdayLabelText(){return this.calendarData?.weekdayLabelText}get calendarWeekdayLabelWidth(){const value=this.calendarData?.weekdayLabelWidth;if(value==="auto")return value;if(typeof value!="number")return;const resolved=finiteNumber(value,CAL_PAD_LEFT);return resolved>=0?resolved:void 0}get calendarMonthLabelText(){return this.calendarData?.monthLabelText}get calendarColumnX(){return this.calendarData?.columnX}get calendarRowY(){return this.calendarData?.rowY}constructor(){super(),this.sourceBindingGeneration=0,this.sourceInput=null,this.sourceViewportInput=null,this.sourceViewportInvalid=!1,this.matrixReducer="mean",this.sourceNeedsConfigure=!0,this.sourceViewportExplicit=!1,this.sourceRevealIntent=0,this.sourceNavigationIntent=0,this.sourceResult=0,this.sourceTooltip=null,this.sourceFocusVersion=0,this.sourceRestoringFocus=!1,this.sourceHasSucceeded=!1,this.sourceFailureAnnounced=!1,this.sourceSelectedKeys=new Set,this.sourceSelectionKey="",this.sourceSelectedCellsEpoch=-1,this.sourceWidth=0,this.data=DEFAULT_MATRIX_DATA,this.maxCells=1e4,this._stickyLabels="none",this.resolvedColLabelHeight=PAD_TOP,this.resolvedRowLabelWidth=PAD_LEFT,this.resolvedCalendarWeekdayLabelWidth=CAL_PAD_LEFT,this.withoutLegend=!1,this._legendPlacement="bottom",this.fill=!1,this._axisSelection="none",this.axisFocus={row:0,col:0},this.scale="linear",this.cellGapX=1,this.cellGapY=1,this.cellRadius=0,this.colLabelInterval=1,this.fitToWidth=!1,this._bucketCount=DEFAULT_BUCKET_COUNT,this.annotations=[],this.selectedCell=null,this.label=null,this.description=null,this.multiple=!1,this.selectedCells=[],this.accessibleCells=!1,this.cachedValueRange=null,this.cachedMatrixData={rowLabels:[],colLabels:[],values:[],truncated:!1},this.cachedCalendarGrid=buildCalendarGrid(this.calendarDays),this.cachedCalendarSortedValues=[],this.cachedCalendarCellsByPos=new Map,this.cachedCalendarCellsByDate=new Map,this.cachedAnnotations=[],this.cachedLegendStops=[],this.cachedColorSteps=[],this.cachedCalendarAnnotationDates=new Set,this.cachedMatrixAnnotationPositions=new Set,this.decorationProjectionTruncated=!1,this.cachedCalendarDateByPos=[],this.cachedRamp=null,this.canvasHasContent=!1,this.canvasVisible=!0,this.drawDirty=!1,this.overlayRevision=0,this.hoverCell=null,this.focusedCell=null,this.liveText="",this.accessibleTargetSizePx=DEFAULT_ACCESSIBLE_TARGET_SIZE_PX,this.restoringAccessibleFocus=!1,this.accessibleFocusGeneration=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.authorRole=null,this.authorAriaLabel=null,this.generatedAriaLabel="",this.accessibleDescription="",this.syncingGeneratedSemantics=!1,this.hasSyncedDescribedByElements=!1,this.initialLimitUpdate=!0,this.lastLimitNotice="",this.canvasBlurred=!1,this.onCanvasFocusChange=event=>{const blurred=event.type==="blur";this.canvasBlurred!==blurred&&(this.canvasBlurred=blurred,this.focusedCell&&(this.repaintFocusRing(blurred?this.focusedCell:null)||this.requestDraw()))},this.scheduleDraw=()=>{if(this.drawFrameRequest)return;const owner=this.ownerDocument.defaultView;if(!owner||!this.isConnected)return;const request={owner,handle:0};request.handle=owner.requestAnimationFrame(()=>{this.drawFrameRequest===request&&(this.drawFrameRequest=void 0,this.isConnected&&this.ownerDocument.defaultView===owner&&this.requestDraw())}),this.drawFrameRequest=request},this.selectedPositions=new Map,this.selectionAnchor=null,this.onSelectionPointerDown=event=>{if(event.button!==0||!event.isPrimary||this.selectionGesture||(this.canceledSelectionPointer=void 0,this.releaseSelectionClick?.(),this.releaseSelectionClick=void 0,!this.multiple))return;const current=this.selectionContext;if(!current?.())return;const pos=this.selectionPointerPosition(event);if(!pos||!current())return;if(event.preventDefault(),this.selectionRangeBase=void 0,this.selectionAnchor=pos,this.focusedCell=pos,this.accessibleCells?this.focusAccessibleCell(pos):this.canvas?.focus(),!current()){this.canceledSelectionPointer=event.pointerId,this.suppressNextSelectionClick();return}const target=event.currentTarget;this.selectionGesture={current,pointerId:event.pointerId,target,start:pos,previous:pos,moved:!1,selecting:!this.selectedPositions.has(this.accessibleCellKey(pos)),cells:new Map(this.selectedPositions)},capturePointer(target,event.pointerId),this.paintSelectionTo(pos)},this.onSelectionPointerMove=event=>{const gesture=this.selectionGesture;if(!gesture||gesture.pointerId!==event.pointerId)return;if(!gesture.current()){this.cancelSelectionGesture();return}const pos=this.selectionPointerPosition(event);if(!gesture.current()){this.cancelSelectionGesture();return}pos&&!this.samePos(pos,gesture.previous)&&this.paintSelectionTo(pos)},this.onSelectionPointerUp=event=>{if(this.canceledSelectionPointer===event.pointerId){this.canceledSelectionPointer=void 0,this.suppressNextSelectionClick();return}const gesture=this.selectionGesture;if(!gesture||gesture.pointerId!==event.pointerId)return;if(!gesture.current()){this.cancelSelectionGesture(!0);return}const pos=this.selectionPointerPosition(event);if(!gesture.current()){this.cancelSelectionGesture(!0);return}pos&&this.paintSelectionTo(pos),this.cancelSelectionGesture(!0),gesture.current()&&(this.proposeSelection(gesture.cells,"pointer"),!gesture.moved&&gesture.current(!0)&&this.emitCellClick(gesture.start,"pointer",!1,()=>gesture.current(!0)))},this.onSelectionPointerCancel=event=>{this.selectionGesture?.pointerId===event.pointerId&&this.cancelSelectionGesture()},this.tooltipSize={inline:0,block:0},this.onPointerMove=e=>{const next=this.hitTest(e.offsetX,e.offsetY);this.samePos(this.hoverCell,next)||(this.hoverCell=next)},this.onPointerLeave=()=>{this.hoverCell=null},this.onCanvasClick=e=>{if(this.consumeSelectionClick(e))return;const pos=this.hitTest(e.offsetX,e.offsetY);pos&&(this.focusedCell=pos,this.announce(pos),this.emitCellClick(pos))},this.onKeyDown=e=>{this.selectionKeyDown(e,this.focusedCell)||ignoresGridKey(e)||this.navigateGridKey(e)},this.canvasColorCache=new Map,this.onAccessibleCellFocus=e=>{if(this.restoringAccessibleFocus)return;const key=e.currentTarget.dataset.cellKey,pos=key?this.accessibleCellAtKey(key):null;pos&&(this.samePos(pos,this.focusedCell)||(this.selectionAnchor=pos,this.selectionRangeBase=void 0),this.focusedCell=pos,this.announce(pos))},this.onAccessibleCellClick=e=>{if(this.consumeSelectionClick(e))return;const key=e.currentTarget.dataset.cellKey,pos=key?this.accessibleCellAtKey(key):null;pos&&(this.focusedCell=pos,this.announce(pos),this.emitCellClick(pos,e.detail===0?"keyboard":"pointer"))},this.onAccessibleCellKeyDown=e=>{const key=e.currentTarget.dataset.cellKey,pos=key?this.accessibleCellAtKey(key):null;pos&&(this.selectionKeyDown(e,pos)||!GRID_KEYS.has(e.key)||ignoresGridKey(e)||(e.preventDefault(),this.focusedCell=pos,this.navigateGridKey(e),this.focusAccessibleCell(this.focusedCell)))},this.onAxisTargetClick=event=>{const target=event.currentTarget,index=Number(target.dataset.axisIndex),axis=target.dataset.axis==="row"?"row":"col";this.axisFocus={...this.axisFocus,[axis]:index},axis==="row"?this.toggleRowSelection(index):this.toggleColumnSelection(index)},this.onAxisTargetKeyDown=event=>{if(shouldIgnoreNavigationKey(event))return;const target=event.currentTarget,axis=target.dataset.axis==="row"?"row":"col",index=Number(target.dataset.axisIndex),buttons=Array.from(target.parentElement?.querySelectorAll(".axis-target:not([disabled])")??[]),position=buttons.indexOf(target),back=axis==="row"?"ArrowUp":"ArrowLeft",forward=axis==="row"?"ArrowDown":"ArrowRight",nextPosition=event.key===back?position-1:event.key===forward?position+1:event.key==="Home"?0:event.key==="End"?buttons.length-1:void 0;if(nextPosition===void 0)return;event.preventDefault();const next=buttons[Math.max(0,Math.min(buttons.length-1,nextPosition))];!next||next===target||(target.setAttribute("tabindex","-1"),next.setAttribute("tabindex","0"),next.focus(),this.axisFocus={...this.axisFocus,[axis]:Number(next.dataset.axisIndex??index)})},new ThemeWatcher(this,()=>this.onThemeSignal()),this.calendarSpacingTrackingArmed=!0}requestUpdate(name,oldValue,options){name===LYRA_CONTEXT_UPDATE&&this.syncingGeneratedSemantics||(this.calendarSpacingTrackingArmed&&name!==void 0&&CALENDAR_SPACING_PROPERTIES.has(name)&&(this.explicitCalendarSpacingProperties??=new Set).add(name),name===void 0&&(this.sourceBindingGeneration=(this.sourceBindingGeneration??0)+1,this.matrixController?.invalidate(),this.sourceNeedsConfigure=!0),super.requestUpdate(name,oldValue,options))}explicitCalendarSpacing(name){if(!this.explicitCalendarSpacingProperties?.has(name))return;const value=this[name];return value??void 0}warnOnLegendRampMismatch(){const rampColors=this.cachedColorSteps.map(color=>sanitizeCssColor(color)??color);if(rampColors.length===0)return;const legendColors=this.cachedLegendStops.filter(stop=>!!stop.color&&stop.partOfRamp!==!1).map(stop=>sanitizeCssColor(stop.color??"")??stop.color??"");legendColors.length===0||legendColors.length===rampColors.length&&legendColors.every((color,index)=>color===rampColors[index])||devWarnOnce("lyra-heatmap-legend-ramp-mismatch",`<${this.localName}>: legendStops describes ${legendColors.length} colour(s) that do not match the ${rampColors.length} colorSteps the cells are painted from, so the legend may misdescribe the ramp. Supply legendStops built from the same array as colorSteps, or omit it to keep the built-in gradient key.`)}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),!(oldValue===value||this.syncingGeneratedSemantics)&&(name==="role"&&(this.authorRole=value),name==="aria-label"&&(this.authorAriaLabel=value))}connectedCallback(){super.connectedCallback(),this.matrixSource&&!this.matrixController&&this.requestUpdate("matrixSource"),this.sourceNeedsConfigure=!0,this.refreshAccessibleTargetSize();const owner=this.ownerDocument.defaultView,ResizeObserverCtor=owner?.ResizeObserver;if(owner&&ResizeObserverCtor){let observer;observer=new ResizeObserverCtor(()=>{!this.isConnected||this.ownerDocument.defaultView!==owner||this.resizeObserver!==observer||this.scheduleDraw()}),this.resizeObserver=observer,observer.observe(this)}const IntersectionObserverCtor=owner?.IntersectionObserver;if(this.canvasVisible=!0,owner&&IntersectionObserverCtor){let observer;observer=new IntersectionObserverCtor(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==owner||this.intersectionObserver!==observer)return;const entry=entries.find(candidate=>candidate.target===this);!entry||entry.isIntersecting===this.canvasVisible||(this.canvasVisible=entry.isIntersecting,this.canvasVisible&&this.drawDirty&&this.scheduleDraw())}),this.intersectionObserver=observer,observer.observe(this)}this.cachedRamp=null,this.resolvedStepsMemo=void 0,this.paintedTheme=void 0,this.canvasColorCache.clear(),this.watchDpr(),this.drawDirty&&!ResizeObserverCtor&&this.scheduleDraw()}disconnectedCallback(){this.sourceBindingGeneration++,this.dismissTooltip(),super.disconnectedCallback(),this.cancelSelectionGesture(),this.canceledSelectionPointer=void 0,this.releaseSelectionClick?.(),this.releaseSelectionClick=void 0,this.selectionAnchor=null,this.selectionRangeBase=void 0,this.accessibleFocusGeneration++,this.pendingAccessibleFocus=void 0,this.pendingAccessibleFocusOrigin=void 0,this.restoringAccessibleFocus=!1,this.hoverCell=null,this.focusedCell=null,this.canvasBlurred=!1,this.liveText="",this.canvasHasContent=!1,this.drawDirty=!0,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.canvasVisible=!0,this.stopWatchingDpr?.(),this.stopWatchingDpr=void 0,this.cancelDrawFrame()}adoptedCallback(){this.sourceBindingGeneration++,super.adoptedCallback(),this.matrixController?.requests.adopted(),this.sourceNeedsConfigure=!0,this.announcements.adopted()}watchDpr(){this.stopWatchingDpr=watchDevicePixelRatio(this.ownerDocument.defaultView,()=>this.requestDraw())}willUpdate(changed){if(super.willUpdate(changed),this.selectionContext=this.captureSelectionContext(),changed.has("matrixSource")&&!this.matrixSource&&changed.set("data",void 0),this.matrixSource){this.clearGeneratedSemantics(),this.matrixController&&sourceWillUpdate(this,changed);return}(changed.size===0||[...changed.keys()].some(key=>!["hoverCell","focusedCell","liveText"].includes(String(key))))&&this.overlayRevision++,(changed.has("data")||changed.has("maxCells")||changed.has("domain")||changed.has("midpoint")||!this.hasUpdated)&&this.rebuildCanonicalMatrixData(),(changed.has("annotations")||changed.has("legendStops")||changed.has("colorSteps")||!this.hasUpdated)&&this.rebuildBoundedDecorations();const accessibleModeChanged=changed.has("accessibleCells")&&this.hasUpdated,collectionChanged=changed.has("data")||changed.has("maxCells")||changed.has("cellInteractive"),activeRenderedControl=collectionChanged||accessibleModeChanged?shadowFocusTarget(this):null,activeAccessibleCell=activeRenderedControl?.matches('[part="cell"]')?activeRenderedControl:null,renderedAccessibleCells=activeAccessibleCell?.matches('[part="cell"]')?[...this.renderRoot.querySelectorAll('[part="cell"]')]:[],accessibleFocusSnapshot=activeAccessibleCell?.matches('[part="cell"]')?{identity:activeAccessibleCell.dataset.cellIdentity,index:renderedAccessibleCells.indexOf(activeAccessibleCell)}:void 0;collectionChanged&&(this.focusedCell=null,this.hoverCell=null,this.liveText="");const locale=this.effectiveLocale;if(changed.has("data")||changed.has("maxCells")||changed.has("locale")||this.lastUpdatedLocale!==locale||!this.hasUpdated){this.cachedCalendarGrid=buildCalendarGrid(this.calendarDays,this.normalizedFirstDayOfWeek,this.calendarMonthLabelText,locale,this.cellBudget),this.cachedCalendarSortedValues=this.cachedCalendarGrid.cells.map(cell=>cell.value).filter(value=>!this.isNoData(value)).sort((a,b)=>a-b),this.cachedCalendarCellsByPos=new Map(this.cachedCalendarGrid.cells.map(cell=>[`${cell.week}:${cell.weekday}`,cell])),this.cachedCalendarCellsByDate=new Map(this.cachedCalendarGrid.cells.map(cell=>[cell.date,cell]));const{firstWeekStart,weekCount}=this.cachedCalendarGrid;this.cachedCalendarDateByPos=Array.from({length:weekCount*7},(_,index)=>isoDateAtOffset(firstWeekStart,index))}if(changed.has("colorSteps")||changed.has("withoutLegend")||!this.hasUpdated){const colorSteps=this.withoutLegend?[]:this.cachedColorSteps.map(sanitizeCssColor);colorSteps.length>=2&&colorSteps.every(color=>color!==void 0)?this.style.setProperty("--lr-heatmap-color-steps-gradient",`linear-gradient(to right, ${colorSteps.join(", ")})`):this.style.removeProperty("--lr-heatmap-color-steps-gradient")}if((changed.has("data")||changed.has("maxCells")||changed.has("domain")||changed.has("midpoint")||!this.hasUpdated)&&(this.cachedValueRange=this.computeValueRange()),(collectionChanged||!this.hasUpdated)&&(this.accessibleIndex=void 0),(collectionChanged||accessibleModeChanged||changed.has("multiple"))&&(this.cancelSelectionGesture(),this.selectionAnchor=null,this.selectionRangeBase=void 0,this.proposedSelectionKeys=void 0),collectionChanged||changed.has("selectedCells")||changed.has("multiple")||!this.hasUpdated){const previous=this.selectedPositions;if(this.rebuildSelectedPositions(),this.pendingSelectionRepaint=void 0,!collectionChanged&&changed.has("selectedCells")){const cells=[...previous].filter(([key])=>!this.selectedPositions.has(key)).map(([,pos])=>pos);for(const[key,pos]of this.selectedPositions)previous.has(key)||cells.push(pos);cells.length<=16&&(this.pendingSelectionRepaint=cells)}changed.has("selectedCells")&&this.selectionGesture&&this.cancelSelectionGesture(),changed.has("selectedCells")&&this.selectionRangeBase&&(this.proposedSelectionKeys?.size!==this.selectedPositions.size||[...this.selectedPositions.keys()].some(key=>!this.proposedSelectionKeys?.has(key)))&&(this.selectionAnchor=this.focusedCell,this.selectionRangeBase=void 0)}if(accessibleFocusSnapshot){const positions=this.accessibleCellPositions(),target=(accessibleFocusSnapshot.identity==null?void 0:positions.find(pos=>this.accessibleCellIdentity(pos)===accessibleFocusSnapshot.identity))??positions[Math.min(Math.max(accessibleFocusSnapshot.index,0),positions.length-1)]??null;this.focusedCell=target,this.liveText=target?this.resolveCellText(target):"",this.pendingAccessibleFocus=target??"base",this.pendingAccessibleFocusOrigin=activeAccessibleCell??void 0,this.restoringAccessibleFocus=!0,this.accessibleFocusGeneration++}if(accessibleModeChanged){const previouslyAccessible=changed.get("accessibleCells")===!0;if(previouslyAccessible&&!this.accessibleCells&&activeAccessibleCell){const key=activeAccessibleCell.dataset.cellKey,target=key?this.accessibleCellAtKey(key):null;target&&(this.focusedCell=target,this.liveText=this.resolveCellText(target)),this.pendingAccessibleFocus="canvas",this.pendingAccessibleFocusOrigin=activeAccessibleCell,this.restoringAccessibleFocus=!0,this.accessibleFocusGeneration++}else if(!previouslyAccessible&&this.accessibleCells&&activeRenderedControl?.matches('[part="canvas"]')){const positions=this.accessibleCellPositions(),target=this.focusedCell?positions.find(pos=>this.samePos(pos,this.focusedCell))??positions[0]??null:positions[0]??null;this.focusedCell=target,this.liveText=target?this.resolveCellText(target):"",this.pendingAccessibleFocus=target??"base",this.pendingAccessibleFocusOrigin=activeRenderedControl,this.restoringAccessibleFocus=!0,this.accessibleFocusGeneration++}}if(!this.hasUpdated||changed.size===0||[...changed.keys()].some(key=>!["hoverCell","focusedCell","liveText"].includes(String(key)))){const bounds=this.cachedValueRange,range=bounds?`${this.formatNumericValue(bounds[0])}–${this.formatNumericValue(bounds[1])}`:this.localize("heatmapNoDataValue"),valueLabel=this.localizedValueLabel();let label;if(this.effectiveMode==="calendar")label=this.localize("heatmapCalendarLabel",void 0,{days:this.formatLocaleNumber(this.cachedCalendarGrid.cells.length),label:valueLabel,range});else{const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;label=this.localize("heatmapMatrixLabel",void 0,{rows:this.formatLocaleNumber(rows),cols:this.formatLocaleNumber(cols),label:valueLabel,range})}const selectedText=this.selectedCellDescription(),authoredLabel=normalizeLabel(this.label);this.accessibleDescription=normalizeLabel(this.description)??(authoredLabel?label:"");const generatedAriaLabel=[authoredLabel??label,selectedText,this.projectionDescription()].filter(Boolean).join(" ");this.generatedAriaLabel=generatedAriaLabel,this.syncingGeneratedSemantics=!0;try{this.authorRole===null&&this.getAttribute("role")!=="group"&&this.setAttribute("role","group"),this.authorAriaLabel===null&&this.getAttribute("aria-label")!==generatedAriaLabel&&this.setAttribute("aria-label",generatedAriaLabel)}finally{this.syncingGeneratedSemantics=!1}}}clearGeneratedSemantics(){if(this.generatedAriaLabel!==""){this.syncingGeneratedSemantics=!0;try{this.authorRole===null&&this.getAttribute("role")==="group"&&this.removeAttribute("role"),this.authorAriaLabel===null&&this.getAttribute("aria-label")===this.generatedAriaLabel&&this.removeAttribute("aria-label"),this.generatedAriaLabel=""}finally{this.syncingGeneratedSemantics=!1}}}rebuildBoundedDecorations(){this.cachedAnnotations=this.annotations.slice(0,MAX_HEATMAP_DECORATIONS).map(entry=>entry??{}),this.cachedLegendStops=(this.legendStops??[]).slice(0,MAX_HEATMAP_DECORATIONS).map(entry=>entry??{}),this.cachedColorSteps=(this.colorSteps??[]).slice(0,MAX_HEATMAP_DECORATIONS),this.warnOnLegendRampMismatch(),this.cachedCalendarAnnotationDates=new Set(this.cachedAnnotations.flatMap(annotation=>annotation.date==null?[]:[annotation.date])),this.cachedMatrixAnnotationPositions=new Set(this.cachedAnnotations.flatMap(annotation=>annotation.row==null||annotation.col==null?[]:[`${annotation.row}:${annotation.col}`])),this.decorationProjectionTruncated=this.annotations.length>MAX_HEATMAP_DECORATIONS||(this.legendStops?.length??0)>MAX_HEATMAP_DECORATIONS||(this.colorSteps?.length??0)>MAX_HEATMAP_DECORATIONS}get ownedInputTruncated(){return["annotations","legendStops","colorSteps","selectedCells"].some(name=>publicCollectionTruncation(this,name)!==void 0)}get projectionTruncated(){return this.decorationProjectionTruncated||this.ownedInputTruncated||(this.effectiveMode==="calendar"?this.cachedCalendarGrid.truncated:this.cachedMatrixData.truncated)}get cellProjectionTruncated(){return this.effectiveMode==="calendar"?this.cachedCalendarGrid.truncated:this.cachedMatrixData.truncated}projectedCellCount(){return this.effectiveMode==="calendar"?this.cachedCalendarGrid.weekCount*7:this.matrixRowLabels.length*this.matrixColLabels.length}projectionDescription(){const messages=[];return this.cellProjectionTruncated&&messages.push(this.localize("heatmapProjectionLimit",void 0,{count:this.formatLocaleNumber(this.projectedCellCount())})),this.decorationProjectionTruncated&&messages.push(this.localize("heatmapDecorationLimit",void 0,{count:this.formatLocaleNumber(MAX_HEATMAP_DECORATIONS)})),this.ownedInputTruncated&&messages.push(this.localize("heatmapInputLimit")),messages.join(" ")}rebuildCanonicalMatrixData(){if(this.data.kind!=="matrix"){this.cachedMatrixData={rowLabels:[],colLabels:[],values:[],truncated:!1};return}const own=(value,key)=>{if(!value||typeof value!="object")return;const descriptor=getOwnDataDescriptor(value,key);return typeof descriptor=="object"?descriptor.value:void 0},rows=own(this.data,"rowLabels"),cols=own(this.data,"colLabels"),source=own(this.data,"values"),count=value=>{const length=own(value,"length");return finiteCount(typeof length=="number"?length:0,0)},colCount=Math.min(count(cols),this.cellBudget),rowLimit=colCount===0?this.cellBudget:Math.floor(this.cellBudget/colCount),rowCount=Math.min(count(rows),rowLimit),labels=(source2,length)=>{const result=new Array(length);if(!source2||typeof source2!="object")return result;for(let index=0;index<length;index++){const descriptor=getOwnDataDescriptor(source2,String(index));if(typeof descriptor!="object")continue;const value=descriptor.value;result[index]=value===null||typeof value!="object"&&typeof value!="function"?String(value):""}return result},rowLabels=labels(rows,rowCount),colLabels=labels(cols,colCount);let truncated=rowCount!==count(rows)||colCount!==count(cols)||count(source)>rowCount;const values=Array.from({length:rowCount},(_,row)=>{const input=own(source,String(row));return count(input)>colCount&&(truncated=!0),Array.from({length:colCount},(_2,col)=>{const value=own(input,String(col));return typeof value=="number"?value:this.signedDomain?Number.NaN:-1})});this.cachedMatrixData={rowLabels,colLabels,values,truncated}}selectedCellDescription(){if(this.multiple){const count=this.currentSelectedPositions.size;return count?this.localize("heatmapSelectedCount",void 0,{count:this.formatLocaleNumber(count)}):""}if(!this.selectedCell)return"";if(this.effectiveMode==="calendar"){if(this.selectedCell.date==null)return"";const match=this.cachedCalendarCellsByDate.get(this.selectedCell.date);return match?this.localize("heatmapSelectedCellLabel",void 0,{cell:this.calendarCellText({week:match.week,weekday:match.weekday,date:match.date})}):""}const{row,col}=this.selectedCell;return row==null||col==null||row<0||row>=this.matrixRowLabels.length||col<0||col>=this.matrixColLabels.length?"":this.localize("heatmapSelectedCellLabel",void 0,{cell:this.matrixCellText({row,col})})}computeValueRange(){const pinned=this.domain;if(pinned){const[lo,hi]=pinned;if(Number.isFinite(lo)&&Number.isFinite(hi)&&lo!==hi)return lo<hi?[lo,hi]:[hi,lo]}const source=this.effectiveMode==="calendar"?this.cachedCalendarGrid.cells.map(cell=>cell.value):this.matrixValues.flat();return minMax(source.filter(v=>!this.isNoData(v)))}localizedValueLabel(){return this.valueLabel===void 0?this.localize("heatmapValueLabel"):this.valueLabel}formatNumericValue(value){return formatChartValue(value,this.effectiveLocale)}syncExternalDescription(){const describedBy=this.getAttribute("aria-describedby");if(!describedBy&&!this.hasSyncedDescribedByElements)return;const control=this.accessibleCells?this.renderRoot.querySelector('[part="cells"]'):this.canvas;this.hasSyncedDescribedByElements=syncAriaDescribedByElements(this,control??void 0,describedBy)}updated(changed){super.updated(changed),this.syncTooltipOverlay();const locale=this.effectiveLocale,localeChanged=this.lastUpdatedLocale!==locale;if(this.lastUpdatedLocale=locale,this.matrixSource){this.matrixController&&sourceUpdated(this);return}this.syncExternalDescription(),this.syncAccessibleTabStop();const notice=this.projectionDescription();if(!this.initialLimitUpdate&&notice&&notice!==this.lastLimitNotice&&this.announcements.announcePolite(notice),this.initialLimitUpdate=!1,this.lastLimitNotice=notice,this.hoverCell&&this.scheduleAfterUpdate(()=>this.measureTooltip(),"heatmap-tooltip-metrics"),["data","maxCells","cellSize","rowHeight","cellGapX","cellGapY","cellRadius","colLabelInterval","maxCellSize","minCellSize","valueLabel","scale","domain","midpoint","fitToWidth","rowLabelWidth","colLabelHeight","colLabelRotation","bucketCount","annotations","focusedCell","colorSteps","cellColor","selectedCell","selectedCells","multiple","selectionPreview","legendStops","accessibleCells","accessibleTargetSizePx","locale","stickyLabels","fill"].some(name=>changed.has(name))||localeChanged){if(!localeChanged&&changed.has("focusedCell")&&[...changed.keys()].every(key=>key==="focusedCell"||key==="liveText")&&this.repaintFocusRing(changed.get("focusedCell")))return;const smallSelection=this.pendingSelectionRepaint,onlySelectionAndFocus=[...changed.keys()].every(key=>["selectedCells","focusedCell","liveText"].includes(String(key))),repainted=!localeChanged&&smallSelection!==void 0&&onlySelectionAndFocus&&(!changed.has("focusedCell")||this.repaintFocusRing(changed.get("focusedCell")))&&smallSelection.every(pos=>this.repaintCell(pos));this.pendingSelectionRepaint=void 0,repainted||this.requestDraw()}const pending=this.pendingAccessibleFocus;if(pending===void 0)return;this.pendingAccessibleFocus=void 0;const origin=this.pendingAccessibleFocusOrigin;this.pendingAccessibleFocusOrigin=void 0;const generation=this.accessibleFocusGeneration;this.scheduleAfterUpdate(()=>{try{if(generation!==this.accessibleFocusGeneration||!this.isConnected)return;if(origin){const internalActive=shadowFocusTarget(this),documentActive=activeElementIn(this.ownerDocument),focusStayedAtOrigin=internalActive===origin,originWasRemovedWithoutReplacement=internalActive===null&&(documentActive===null||documentActive===this||documentActive===this.ownerDocument.body);if(!focusStayedAtOrigin&&!originWasRemovedWithoutReplacement)return}if(pending==="base"){this.shadowRoot?.querySelector('[part="base"]')?.focus();return}if(pending==="canvas"){this.shadowRoot?.querySelector('[part="canvas"]')?.focus();return}const identity=this.accessibleCellIdentity(pending);[...this.shadowRoot?.querySelectorAll('[part="cell"]')??[]].find(candidate=>candidate.dataset.cellIdentity===identity)?.focus()}finally{this.restoringAccessibleFocus=!1}},"heatmap-accessible-focus")}refreshTheme(){this.resolvedStepsMemo=void 0,this.cachedRamp=null,this.refreshAccessibleTargetSize()||this.requestDraw()}themeSignature(){const cs=this.ownerDocument.defaultView?.getComputedStyle(this);return cs?[...this.scaleEndpoints(cs),this.readToken(cs,"no-data-fill",FALLBACK_NO_DATA_FILL),this.labelColor(cs),this.readToken(cs,"label-font",FALLBACK_LABEL_FONT),this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR),this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR),this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR),this.stickyLabelBg(cs),...this.resolvedColorSteps()].join("\0"):""}onThemeSignal(){this.resolvedStepsMemo=void 0;const signature=this.themeSignature(),resized=this.refreshAccessibleTargetSize();signature===this.paintedTheme&&!this.cellColor||(this.paintedTheme=signature,this.cachedRamp=null,resized||this.scheduleDraw())}refreshAccessibleTargetSize(){const raw=this.ownerDocument.defaultView?.getComputedStyle(this).getPropertyValue("--lr-icon-button-size").trim()??"",resolved=resolveCssTokenLength(raw,{host:this}),next=resolved!==void 0&&Number.isFinite(resolved)&&resolved>0?resolved:DEFAULT_ACCESSIBLE_TARGET_SIZE_PX;return next===this.accessibleTargetSizePx?!1:(this.accessibleTargetSizePx=next,!0)}readToken(cs,name,fallback){return cs.getPropertyValue(`--lr-heatmap-${name}`).trim()||cs.getPropertyValue(`--_lr-heatmap-${name}`).trim()||fallback}scaleEndpoints(cs){return[this.readToken(cs,"scale-lo",FALLBACK_SCALE_LO),this.readToken(cs,"scale-hi",FALLBACK_SCALE_HI)]}labelColor(cs){return cs.getPropertyValue("--lr-color-text-quiet").trim()||"#6b7280"}stickyLabelBg(cs){const color=this.readToken(cs,"sticky-label-bg",FALLBACK_STICKY_LABEL_BG);return formatRgb(resolveRgb(color,FALLBACK_STICKY_LABEL_BG,this.ownerDocument))}strokeCellState(ctx,x,y,size,state2,color,paintedShape){const shape=paintedShape??this.calendarCellShape(size),width=shape?.custom?shape.w:size,height=shape?.custom?shape.h:size;shape?.custom&&(ctx.save(),ctx.beginPath(),ctx.roundRect(x,y,shape.w,shape.h,shape.radius),ctx.clip());const inset=Math.min(state2==="annotation"?.5:state2==="selected"?3.5:6.5,Math.max(.5,(Math.min(width,height)-RING_LINE_WIDTH-1)/2)),w=Math.max(1,width-inset*2),h=Math.max(1,height-inset*2);ctx.lineWidth=RING_LINE_WIDTH,ctx.strokeStyle=color,ctx.setLineDash?.(state2==="annotation"?[]:state2==="selected"?[4,2]:[1,2]),shape?.custom&&shape.radius>0?(ctx.beginPath(),ctx.roundRect(x+inset,y+inset,w,h,Math.max(0,shape.radius-inset)),ctx.stroke()):ctx.strokeRect(x+inset,y+inset,w,h),ctx.setLineDash?.([]),shape?.custom&&ctx.restore()}isSelectedPos(pos){return this.multiple?this.currentSelectedPositions.has(this.accessibleCellKey(pos)):this.selectedCell?"week"in pos?this.selectedCell.date==null?!1:this.calendarCellAt(pos).date===this.selectedCell.date:this.selectedCell.row===pos.row&&this.selectedCell.col===pos.col:!1}draw(){if(this.matrixSource){this.matrixController&&paintSource(this);return}if(!this.canvasVisible){this.drawDirty=!0;return}this.syncDeferredFitFrame(!1),this.drawDirty=!1,this.canvasHasContent=!1,this.paintedTheme??=this.themeSignature(),this.effectiveMode==="calendar"?this.drawCalendar():this.drawMatrix()}requestDraw(){this.drawDirty=!0,this.isConnected&&(this.canvasVisible?this.draw():this.syncDeferredFitFrame(!0))}syncDeferredFitFrame(deferred){const base=this.shadowRoot?.querySelector('[part="base"]');if(!base)return;let contained=!1;deferred&&this.fitToWidth&&this.clientWidth>0&&(contained=(this.effectiveMode==="calendar"?this.columnXFor(Math.max(1,this.cachedCalendarGrid.weekCount)):this.matrixPadLeft+this.matrixColLabels.length*this.matrixCellSize(this.matrixColLabels.length))<=this.clientWidth),base.toggleAttribute("data-fit-frame-contained",contained)}ringedCell(){return this.canvasBlurred?null:this.focusedCell}repaintFocusRing(previous){if(!this.canvasHasContent||!this.canvas||this.drawDirty)return!1;const current=this.ringedCell();if(this.effectiveMode==="calendar"){if(previous&&!("week"in previous)||current&&!("week"in current))return!1;this.repaintCalendarFocusCell(previous&&"week"in previous?previous:null),current&&(!previous||!this.samePos(previous,current))&&this.repaintCalendarFocusCell(current)}else{if(previous&&!("row"in previous)||current&&!("row"in current))return!1;this.repaintMatrixFocusCell(previous&&"row"in previous?previous:null),current&&(!previous||!this.samePos(previous,current))&&this.repaintMatrixFocusCell(current)}return!0}cancelDrawFrame(){const request=this.drawFrameRequest;request&&request.owner.cancelAnimationFrame(request.handle),this.drawFrameRequest=void 0}resolveColorStep(color,fallback){const safe=sanitizeCssColor(color);if(!safe)return fallback;const ctx=SCOPED_COLOR.test(safe)?null:getScratchCtx(this.ownerDocument);return ctx?(ctx.fillStyle=safe,ctx.fillStyle):resolveCanvasColor(this,safe,fallback)}resolvedColorSteps(){const source=this.cachedColorSteps;return(this.resolvedStepsMemo?.source!==source||this.resolvedStepsMemo.document!==this.ownerDocument)&&(this.resolvedStepsMemo={source,document:this.ownerDocument,colors:source.map(step=>this.resolveColorStep(step,""))}),this.resolvedStepsMemo.colors}colorRamp(bucketCount,cs){const steps=this.cachedColorSteps;if(steps&&steps.length>=2){const key2=`steps ${steps.join(" ")}`;if(this.cachedRamp?.key===key2)return this.cachedRamp;const resolved=this.resolvedColorSteps().map((color,index)=>color||(index===steps.length-1?FALLBACK_SCALE_HI:FALLBACK_SCALE_LO)),colors2=resolved.map(color=>formatRgb(resolveRgb(color,FALLBACK_SCALE_LO,this.ownerDocument))),loRgb2=resolveRgb(resolved[0],FALLBACK_SCALE_LO,this.ownerDocument),hiRgb2=resolveRgb(resolved[resolved.length-1],FALLBACK_SCALE_HI,this.ownerDocument);return this.cachedRamp={key:key2,colors:colors2,loRgb:loRgb2,hiRgb:hiRgb2},this.cachedRamp}const[scaleLo,scaleHi]=this.scaleEndpoints(cs),normalizedBucketCount=normalizeBucketCount(bucketCount),key=`${scaleLo}\0${scaleHi}\0${normalizedBucketCount}`;if(this.cachedRamp?.key===key)return this.cachedRamp;const loRgb=resolveRgb(scaleLo,FALLBACK_SCALE_LO,this.ownerDocument),hiRgb=resolveRgb(scaleHi,FALLBACK_SCALE_HI,this.ownerDocument),colors=Array.from({length:normalizedBucketCount},(_,i)=>mixRgb(loRgb,hiRgb,i/(normalizedBucketCount-1)));return this.cachedRamp={key,colors,loRgb,hiRgb},this.cachedRamp}calendarCellSize(){return this.calendarSpacing().cellSize}calendarSpacing(){const{weekCount}=this.cachedCalendarGrid,rawGapX=this.explicitCalendarSpacing("cellGapX"),rawGapY=this.explicitCalendarSpacing("cellGapY"),rawRadius=this.explicitCalendarSpacing("cellRadius"),boundGap=(raw,size2)=>raw===void 0?CAL_GAP:finiteRange(raw,CAL_GAP,0,Math.max(0,size2-1));let size;if(this.fitToWidth&&weekCount>0){const fitGap=boundGap(rawGapX,this.cellSize),hostWidth=this.clientWidth||this.calendarPadLeft+weekCount*(this.cellSize+fitGap);size=this.clampFitCellSize((hostWidth-this.calendarPadLeft)/weekCount-fitGap)}else size=this.cellSize;return this.accessibleCells&&(size=Math.max(size,this.accessibleTargetSizePx)),{cellSize:size,gapX:boundGap(rawGapX,size),gapY:boundGap(rawGapY,size),radius:rawRadius===void 0?0:finiteRange(rawRadius,0,0,size/2)}}clampFitCellSize(size){const floored=finiteRange(size,FIT_MIN_CELL,Math.max(FIT_MIN_CELL,this.minCellSize??FIT_MIN_CELL));return this.maxCellSize==null?floored:Math.min(floored,this.maxCellSize)}columnXFor(week){return(this.calendarPaintColumns??this.calendarColumnPositions())[week]??this.calendarPadLeft}rowYFor(weekday){return(this.calendarPaintRows??this.calendarRowPositions())[weekday]??CAL_LABEL_H}calendarColumnPositions(spacing=this.calendarSpacing()){const{cellSize,gapX:gap}=spacing,weekCount=this.cachedCalendarGrid.weekCount,callback=this.calendarColumnX,padLeft=this.calendarPadLeft,cached=this.cachedColumnGeometry;if(cached!==void 0&&cached.callback===callback&&cached.padLeft===padLeft&&cached.cellSize===cellSize&&cached.gap===gap&&cached.weekCount===weekCount)return cached.positions;const positions=[];for(let index=0;index<=weekCount;index++){const fallback=index===0?padLeft:positions[index-1]+cellSize+gap;let candidate=fallback;if(callback)try{const supplied=callback(index);Number.isFinite(supplied)&&supplied>=0&&(index===0||supplied>=positions[index-1]+cellSize)&&(candidate=supplied)}catch{candidate=fallback}positions.push(candidate)}return this.cachedColumnGeometry={callback,padLeft,cellSize,gap,weekCount,positions},positions}calendarRowPositions(spacing=this.calendarSpacing()){const{cellSize,gapY:gap}=spacing,callback=this.calendarRowY,cached=this.cachedRowGeometry;if(cached!==void 0&&cached.callback===callback&&cached.cellSize===cellSize&&cached.gap===gap)return cached.positions;const positions=[];for(let index=0;index<=7;index++){const fallback=index===0?CAL_LABEL_H:positions[index-1]+cellSize+gap;let candidate=fallback;if(callback)try{const supplied=callback(index);Number.isFinite(supplied)&&supplied>=0&&(index===0||supplied>=positions[index-1]+cellSize)&&(candidate=supplied)}catch{candidate=fallback}positions.push(candidate)}return this.cachedRowGeometry={callback,cellSize,gap,positions},positions}weekdayLabels(firstWeekStart){const formatter=getDateTimeFormat(this.effectiveLocale||void 0,{weekday:"short",timeZone:"UTC"}),labels=["","","","","","",""];for(const weekday of[1,3,5]){const row=(weekday-this.normalizedFirstDayOfWeek+7)%7;labels[row]=this.calendarWeekdayLabelText?.(weekday)??formatter.format(new Date(firstWeekStart.getTime()+row*MS_PER_DAY))}return labels}paintCalendarAxisLabels(ctx,cellSize,cs,firstWeekStart,monthLabels,months=!0,weekdays=!0){if(ctx.fillStyle=this.labelColor(cs),ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT),months){const canvasRight=this.columnXFor(Math.max(1,this.cachedCalendarGrid.weekCount)),placed=[];monthLabels.forEach((month,index)=>{const label=this.ellipsize(ctx,month.label,canvasRight);if(!label)return;const width=this.labelWidth(ctx,label),x=Math.max(0,Math.min(this.columnXFor(month.week),canvasRight-width)),nextWeek=monthLabels[index+1]?.week??Math.max(month.week+1,this.cachedCalendarGrid.weekCount),entry={label,x,end:x+width+CAL_MONTH_LABEL_GAP,span:nextWeek-month.week};let previous=placed[placed.length-1];for(;previous&&entry.x<previous.end&&entry.span>previous.span;)placed.pop(),previous=placed[placed.length-1];previous&&entry.x<previous.end||placed.push(entry)});for(const{label,x}of placed)ctx.fillText(label,x,CAL_LABEL_H-4)}if(weekdays){const available=this.calendarPadLeft-CAL_WEEKDAY_LABEL_INSET*2;this.weekdayLabels(firstWeekStart).forEach((label,weekday)=>{const shown=label?this.ellipsize(ctx,label,available):"";shown&&ctx.fillText(shown,CAL_WEEKDAY_LABEL_INSET,this.rowYFor(weekday)+cellSize-1)})}}drawCalendar(){try{this.withLabelCache(()=>this.paintCalendar())}finally{this.calendarPaintColumns=void 0,this.calendarPaintRows=void 0}}paintCalendar(){if(!this.canvas)return;const{weekCount,firstWeekStart,monthLabels}=this.cachedCalendarGrid,cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;this.calendarWeekdayLabelWidth==="auto"&&(this.resolvedCalendarWeekdayLabelWidth=this.measureCalendarWeekdayLabelWidth(cs,firstWeekStart));const spacing=this.calendarSpacing(),cellSize=spacing.cellSize;this.calendarPaintColumns=this.calendarColumnPositions(spacing),this.calendarPaintRows=this.calendarRowPositions(spacing);const w=this.columnXFor(Math.max(1,weekCount)),h=this.rowYFor(7),ctx=this.sizeCanvas(this.canvas,w,h);if(!ctx)return;ctx.clearRect(0,0,w,h);const fill=this.fillContext(normalizeBucketCount(this.bucketCount),cs,"calendar");this.canvasColorCache.clear();for(let week=0;week<weekCount;week++)for(let weekday=0;weekday<7;weekday++)this.paintCalendarCell(ctx,week,weekday,cellSize,spacing.radius,fill);if(this.cachedAnnotations.length)for(const ann of this.cachedAnnotations){if(ann.date==null)continue;const match=this.cachedCalendarCellsByDate.get(ann.date);if(!match)continue;const x=this.columnXFor(match.week),y=this.rowYFor(match.weekday);this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR))}for(const match of this.selectedPaintPositions())if("week"in match){const x=this.columnXFor(match.week),y=this.rowYFor(match.weekday);this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR))}const ringed=this.ringedCell();if(ringed&&"week"in ringed){const{week,weekday}=ringed;if(week<weekCount&&weekday<7){const x=this.columnXFor(week),y=this.rowYFor(weekday);this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR))}}this.paintCalendarAxisLabels(ctx,cellSize,cs,firstWeekStart,monthLabels),this.canvasHasContent=!0,this.recordCalendarGeometry(spacing,weekCount)&&this.accessibleCells&&this.scheduleAfterUpdate(()=>this.requestUpdate(),"heatmap-calendar-accessible-geometry")}matrixCellSize(cols){let size;if(this.fitToWidth&&cols>0){const padLeft=this.matrixPadLeft,hostWidth=this.clientWidth||padLeft+cols*this.cellSize;size=this.clampFitCellSize((hostWidth-padLeft)/cols)}else size=this.cellSize;if(!this.accessibleCells)return size;const target=this.accessibleTargetSizePx,custom=finiteNumber(this.cellGapX,1)!==1||finiteNumber(this.cellGapY,1)!==1||finiteRange(this.cellRadius,0,0)>0,gap=this.rowHeight!==void 0?finiteRange(this.cellGapX,1,0,target):custom?Math.max(finiteRange(this.cellGapX,1,0,target),finiteRange(this.cellGapY,1,0,target)):0;return Math.max(size,target+gap)}matrixRowHeight(cellSize){if(this.rowHeight===void 0)return cellSize;const height=finiteRange(this.rowHeight,cellSize,1);if(!this.accessibleCells)return height;const target=this.accessibleTargetSizePx;return Math.max(height,target+finiteRange(this.cellGapY,1,0,target))}matrixCellShape(size,height=this.matrixRowHeight(size)){if(height===size&&finiteNumber(this.cellGapX,1)===1&&finiteNumber(this.cellGapY,1)===1&&finiteRange(this.cellRadius,0,0)===0)return{w:size-1,h:size-1,radius:0,custom:!1};const target=this.accessibleCells?this.accessibleTargetSizePx:1,w=size-finiteRange(this.cellGapX,1,0,Math.max(0,size-Math.min(size,target))),h=height-finiteRange(this.cellGapY,1,0,Math.max(0,height-Math.min(height,target))),radius=finiteRange(this.cellRadius,0,0,Math.min(w,h)/2);return{w,h,radius,custom:height!==size||w!==size-1||h!==size-1||radius!==0}}calendarCellShape(size){const radius=this.calendarSpacing().radius;return radius>0?{w:size,h:size,radius:Math.min(radius,size/2),custom:!0}:void 0}fillMatrixCell(ctx,x,y,shape){shape.radius===0?ctx.fillRect(x,y,shape.w,shape.h):(ctx.beginPath(),ctx.roundRect(x,y,shape.w,shape.h,shape.radius),ctx.fill())}fillContext(bucketCount,cs,mode){const[lo,hi]=this.cachedValueRange??[0,1];return{ramp:this.colorRamp(bucketCount,cs),noData:this.readToken(cs,"no-data-fill",FALLBACK_NO_DATA_FILL),lo,hi,mode,styles:cs}}cellFill(value,override,fill){const{ramp,noData,lo,hi,mode,styles:styles2}=fill;if(override!=null)return this.resolveCellColor(override,styles2);if(this.isNoData(value))return noData;if(this.scale==="sqrt"){const step=sqrtStep(value,hi,ramp.colors.length);return step<0?noData:ramp.colors[step]}return this.cachedColorSteps.length>=2?ramp.colors[this.rampBucket(value,lo,hi,ramp.colors.length)]:mode==="calendar"?ramp.colors[quartileBucket(value,this.cachedCalendarSortedValues,ramp.colors.length)]:mixRgb(ramp.loRgb,ramp.hiRgb,this.rampAlpha(value,lo,hi))}paintMatrixCell(ctx,row,col,x,y,shape,fill){const value=this.matrixValues[row]?.[col]??Number.NaN;ctx.fillStyle=this.cellFill(value,this.cellColor?.({row,col},value),fill),this.fillMatrixCell(ctx,x,y,shape)}paintMatrixFocusOverlays(ctx,row,col,cellSize,rowHeight,shape,cs,state2){const x=this.matrixPadLeft+col*cellSize,y=this.matrixPadTop+row*rowHeight;state2==="annotation"&&this.cachedMatrixAnnotationPositions.has(`${row}:${col}`)&&this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR),shape),state2==="selected"&&this.isSelectedPos({row,col})&&this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR),shape);const focused=this.ringedCell();state2==="focus"&&focused&&"row"in focused&&focused.row===row&&focused.col===col&&this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR),shape)}focusRepaintBounds(ctx,x,y,cellSize,cellHeight=cellSize){const padding=RING_LINE_WIDTH+1,dpr=ctx.getTransform().a,left=Math.floor((x-padding)*dpr)/dpr,top=Math.floor((y-padding)*dpr)/dpr,right=Math.ceil((x+cellSize+padding)*dpr)/dpr,bottom=Math.ceil((y+cellHeight+padding)*dpr)/dpr;return{left,top,width:right-left,height:bottom-top,radius:Math.ceil((2*padding+1/dpr)/cellSize),rowRadius:Math.ceil((2*padding+1/dpr)/cellHeight)}}repaintMatrixFocusCell(pos){this.withLabelCache(()=>this.paintMatrixFocusCell(pos))}paintMatrixFocusCell(pos){if(!pos||!this.canvas)return;const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;if(pos.row<0||pos.row>=rows||pos.col<0||pos.col>=cols)return;const cellSize=this.matrixCellSize(cols),rowHeight=this.matrixRowHeight(cellSize),shape=this.matrixCellShape(cellSize,rowHeight),padLeft=this.matrixPadLeft,padTop=this.matrixPadTop,x=padLeft+pos.col*cellSize,y=padTop+pos.row*rowHeight,ctx=this.canvas.getContext("2d");if(!ctx)return;const cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;const{left,top,width,height,radius,rowRadius}=this.focusRepaintBounds(ctx,x,y,cellSize,rowHeight),firstRow=Math.max(0,pos.row-rowRadius),lastRow=Math.min(rows-1,pos.row+rowRadius),firstCol=Math.max(0,pos.col-radius),lastCol=Math.min(cols-1,pos.col+radius),fill=this.fillContext(RAMP_STEPS,cs,"matrix"),scratch=rowHeight===cellSize?void 0:this.ownerDocument.createElement("canvas"),dpr=ctx.getTransform().a,scratchLeft=Math.floor((this.matrixPadLeft+firstCol*cellSize-RING_LINE_WIDTH-1)*dpr)/dpr,scratchTop=Math.floor((this.matrixPadTop+firstRow*rowHeight-RING_LINE_WIDTH-1)*dpr)/dpr;if(scratch){const right=Math.ceil((this.matrixPadLeft+(lastCol+1)*cellSize+RING_LINE_WIDTH+1)*dpr),bottom=Math.ceil((this.matrixPadTop+(lastRow+1)*rowHeight+RING_LINE_WIDTH+1)*dpr);scratch.width=right-Math.round(scratchLeft*dpr),scratch.height=bottom-Math.round(scratchTop*dpr)}const paintCtx=scratch?.getContext("2d")??ctx;if(scratch&&paintCtx===ctx){this.drawMatrix();return}paintCtx.save();try{scratch?paintCtx.setTransform(dpr,0,0,dpr,-scratchLeft*dpr,-scratchTop*dpr):(paintCtx.beginPath(),paintCtx.rect(left,top,width,height),paintCtx.clip(),paintCtx.clearRect(left,top,width,height));for(let row=firstRow;row<=lastRow;row++)for(let col=firstCol;col<=lastCol;col++)this.paintMatrixCell(paintCtx,row,col,padLeft+col*cellSize,padTop+row*rowHeight,shape,fill);for(const state2 of["annotation","selected","focus"])for(let row=firstRow;row<=lastRow;row++)for(let col=firstCol;col<=lastCol;col++)this.paintMatrixFocusOverlays(paintCtx,row,col,cellSize,rowHeight,shape,cs,state2);left<this.matrixPadLeft&&this.paintMatrixRowLabels(paintCtx,this.matrixPadLeft,this.matrixPadTop,rowHeight,cs,{top,bottom:top+height}),top<this.matrixPadTop&&this.paintMatrixColLabels(paintCtx,this.matrixPadLeft,this.matrixPadTop,cellSize,cs,{first:firstCol,last:lastCol})}finally{paintCtx.restore()}if(scratch){ctx.save();try{ctx.setTransform(1,0,0,1,0,0),ctx.clearRect(left*dpr,top*dpr,width*dpr,height*dpr),ctx.drawImage(scratch,Math.round((left-scratchLeft)*dpr),Math.round((top-scratchTop)*dpr),Math.round(width*dpr),Math.round(height*dpr),Math.round(left*dpr),Math.round(top*dpr),Math.round(width*dpr),Math.round(height*dpr))}finally{ctx.restore()}}}paintCalendarCell(ctx,week,weekday,cellSize,radius,fill){const value=this.calendarValueAt(week,weekday);ctx.fillStyle=this.cellFill(value,this.cellColor?.(this.calendarPos(week,weekday),value),fill),this.fillCalendarCell(ctx,this.columnXFor(week),this.rowYFor(weekday),cellSize,radius)}fillCalendarCell(ctx,x,y,size,radius){radius===0?ctx.fillRect(x,y,size,size):(ctx.beginPath(),ctx.roundRect(x,y,size,size,radius),ctx.fill())}recordCalendarGeometry(spacing,weekCount){const next={padLeft:this.calendarPadLeft,padTop:CAL_LABEL_H,cellSize:spacing.cellSize,cellWidth:spacing.cellSize,cellHeight:spacing.cellSize,cellGapX:spacing.gapX,cellGapY:spacing.gapY,cellRadius:spacing.radius,weekCount,firstDayOfWeek:this.normalizedFirstDayOfWeek},previous=this.lastPaintedCalendarGeometry;if(previous&&Object.keys(next).every(key=>previous[key]===next[key]))return!1;const frozen=Object.freeze(next);return this.lastPaintedCalendarGeometry=frozen,this.emit("lr-calendar-geometry-change",frozen),!0}paintCalendarFocusOverlays(ctx,week,weekday,cellSize,cs,state2){const date=this.calendarDateAt(week,weekday),x=this.columnXFor(week),y=this.rowYFor(weekday);state2==="annotation"&&this.cachedCalendarCellsByDate.has(date)&&this.cachedCalendarAnnotationDates.has(date)&&this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR)),state2==="selected"&&(this.multiple||this.cachedCalendarCellsByDate.has(date))&&this.isSelectedPos({week,weekday,date})&&this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR));const focused=this.ringedCell();state2==="focus"&&focused&&"week"in focused&&focused.week===week&&focused.weekday===weekday&&this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR))}repaintCalendarFocusCell(pos){this.withLabelCache(()=>this.paintCalendarFocusCell(pos))}paintCalendarFocusCell(pos){if(!pos||!this.canvas)return;const{weekCount,firstWeekStart}=this.cachedCalendarGrid;if(pos.week<0||pos.week>=weekCount||pos.weekday<0||pos.weekday>=7)return;const cellSize=this.calendarCellSize(),x=this.columnXFor(pos.week),y=this.rowYFor(pos.weekday),ctx=this.canvas.getContext("2d");if(!ctx)return;const cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;const{left,top,width,height,radius}=this.focusRepaintBounds(ctx,x,y,cellSize),firstWeek=Math.max(0,pos.week-radius),lastWeek=Math.min(weekCount-1,pos.week+radius),firstDay=Math.max(0,pos.weekday-radius),lastDay=Math.min(6,pos.weekday+radius),fill=this.fillContext(normalizeBucketCount(this.bucketCount),cs,"calendar"),cellRadius=this.calendarSpacing().radius;ctx.save();try{ctx.beginPath(),ctx.rect(left,top,width,height),ctx.clip(),ctx.clearRect(left,top,width,height);for(let week=firstWeek;week<=lastWeek;week++)for(let day=firstDay;day<=lastDay;day++)this.paintCalendarCell(ctx,week,day,cellSize,cellRadius,fill);for(const state2 of["annotation","selected","focus"])for(let week=firstWeek;week<=lastWeek;week++)for(let day=firstDay;day<=lastDay;day++)this.paintCalendarFocusOverlays(ctx,week,day,cellSize,cs,state2);this.paintCalendarAxisLabels(ctx,cellSize,cs,firstWeekStart,this.cachedCalendarGrid.monthLabels,top<CAL_LABEL_H,left<this.calendarPadLeft)}finally{ctx.restore()}}drawMatrix(){this.withLabelCache(()=>this.paintMatrix())}paintMatrix(){if(!this.canvas)return;const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length,cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;this.rowLabelWidth==="auto"&&(this.resolvedRowLabelWidth=this.measureRowLabelWidth(cs)),this.colLabelHeight==="auto"&&(this.resolvedColLabelHeight=this.measureColLabelHeight(cs));const padLeft=this.matrixPadLeft,padTop=this.matrixPadTop,cellSize=this.matrixCellSize(cols),rowHeight=this.matrixRowHeight(cellSize),shape=this.matrixCellShape(cellSize,rowHeight),dimensions=shape.custom?{cellWidth:shape.w,cellHeight:shape.h,cellRadius:shape.radius}:{},previous=this.lastPaintedMatrixGeometry,geometry=previous&&previous.padLeft===padLeft&&previous.padTop===padTop&&previous.cellSize===cellSize&&previous.rowHeight===(rowHeight===cellSize?void 0:rowHeight)&&previous.cellWidth===dimensions.cellWidth&&previous.cellHeight===dimensions.cellHeight&&previous.cellRadius===dimensions.cellRadius?previous:Object.freeze({padLeft,padTop,cellSize,...rowHeight===cellSize?{}:{rowHeight},...dimensions});this.lastPaintedMatrixGeometry=geometry;const geometryChanged=geometry!==previous;geometryChanged&&this.emit("lr-matrix-geometry-change",geometry);const w=padLeft+cols*cellSize,h=padTop+rows*rowHeight,ctx=this.sizeCanvas(this.canvas,w,h);if(!ctx)return;ctx.clearRect(0,0,w,h);const fill=this.fillContext(RAMP_STEPS,cs,"matrix");this.canvasColorCache.clear();for(let row=0;row<rows;row++)for(let col=0;col<cols;col++)this.paintMatrixCell(ctx,row,col,padLeft+col*cellSize,padTop+row*rowHeight,shape,fill);if(this.cachedAnnotations.length)for(const ann of this.cachedAnnotations){if(ann.row==null||ann.col==null||ann.row<0||ann.row>=rows||ann.col<0||ann.col>=cols)continue;const x=padLeft+ann.col*cellSize,y=padTop+ann.row*rowHeight;this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR),shape)}for(const selected of this.selectedPaintPositions()){if(!("row"in selected))continue;const{row,col}=selected;if(row>=0&&row<rows&&col>=0&&col<cols){const x=padLeft+col*cellSize,y=padTop+row*rowHeight;this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR),shape)}}const ringedMatrix=this.ringedCell();if(ringedMatrix&&"row"in ringedMatrix){const{row,col}=ringedMatrix;if(row<rows&&col<cols){const x=padLeft+col*cellSize,y=padTop+row*rowHeight;this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR),shape)}}this.paintMatrixRowLabels(ctx,padLeft,padTop,rowHeight,cs),this.paintMatrixColLabels(ctx,padLeft,padTop,cellSize,cs),this.paintFrozenLabelBands(padLeft,padTop,cellSize,rowHeight,w,h,ctx.getTransform().a,cs),this.canvasHasContent=!0,geometryChanged&&(this.accessibleCells||this.effectiveAxisSelection!=="none")&&this.scheduleAfterUpdate(()=>this.requestUpdate(),"heatmap-matrix-accessible-geometry")}paintMatrixRowLabels(ctx,padLeft,padTop,cellSize,cs,dirty){ctx.fillStyle=this.labelColor(cs),ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);const rowLabelSpace=padLeft-ROW_LABEL_INSET*2;let first=0,last=this.matrixRowLabels.length-1;if(dirty){const{fontBoundingBoxAscent,fontBoundingBoxDescent}=ctx.measureText("M"),baseline=padTop+cellSize/2+3;first=Math.max(first,Math.floor((dirty.top-fontBoundingBoxDescent-baseline)/cellSize)),last=Math.min(last,Math.ceil((dirty.bottom+fontBoundingBoxAscent-baseline)/cellSize))}for(let r=first;r<=last;r++){const shown=this.ellipsize(ctx,this.matrixRowLabels[r],rowLabelSpace);shown&&ctx.fillText(shown,ROW_LABEL_INSET,padTop+r*cellSize+cellSize/2+3)}}paintMatrixColLabels(ctx,padLeft,padTop,cellSize,cs,columns){ctx.fillStyle=this.labelColor(cs),ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);const colRotation=this.effectiveColLabelRotation,interval=finiteInteger(this.colLabelInterval,1,1);if(colRotation===0){const cols=this.matrixColLabels.length;this.matrixColLabels.forEach((label,c)=>{if(c%interval!==0||columns&&(c<columns.first-interval+1||c>columns.last))return;const shown=this.ellipsize(ctx,label,Math.min(interval,cols-c)*cellSize-2);shown&&ctx.fillText(shown,padLeft+c*cellSize+2,padTop-COL_LABEL_INSET)});return}const radians=colRotation*Math.PI/180,previousAlign=ctx.textAlign;ctx.textAlign="right",this.matrixColLabels.forEach((label,c)=>{c%interval===0&&(ctx.save(),ctx.translate(padLeft+c*cellSize+cellSize/2,padTop-COL_LABEL_INSET),ctx.rotate(radians),ctx.fillText(label,0,0),ctx.restore())}),ctx.textAlign=previousAlign}paintFrozenLabelBands(padLeft,padTop,cellSize,rowHeight,width,height,scale,cs){if(this.effectiveStickyLabels==="none")return;const backdrop=this.stickyLabelBg(cs),rowBand=this.frozenBandCanvas("row-labels");rowBand&&this.paintFrozenBand(rowBand,padLeft,height,scale,backdrop,bandCtx=>this.paintMatrixRowLabels(bandCtx,padLeft,padTop,rowHeight,cs));const colBand=this.frozenBandCanvas("col-labels");colBand&&this.paintFrozenBand(colBand,width,padTop,scale,backdrop,bandCtx=>this.paintMatrixColLabels(bandCtx,padLeft,padTop,cellSize,cs))}frozenBandCanvas(part){return this.shadowRoot?.querySelector(`[part="${part}"]`)??null}sizeCanvas(canvas,width,height,desiredScale=this.ownerDocument.defaultView?.devicePixelRatio){const{pixelWidth,pixelHeight,scale}=resolveBoundedCanvasAllocation({cssWidth:width,cssHeight:height,desiredScale,maxDimension:MAX_CANVAS_DIMENSION,maxPixels:MAX_CANVAS_PIXELS});canvas.width=pixelWidth,canvas.height=pixelHeight,canvas.style.width=`${width}px`,canvas.style.height=`${height}px`;const ctx=canvas.getContext("2d");return ctx?.scale(scale,scale),ctx}paintFrozenBand(canvas,width,height,scale,backdrop,paint){const ctx=this.sizeCanvas(canvas,width,height,scale);ctx&&(ctx.clearRect(0,0,width,height),ctx.fillStyle=backdrop,ctx.fillRect(0,0,width,height),paint(ctx))}hitTest(x,y){return this.effectiveMode==="calendar"?this.hitTestCalendar(x,y):this.hitTestMatrix(x,y)}matrixNavigationGeometry(rows,cols){const painted=this.lastPaintedMatrixGeometry;if(painted)return{rows,cols,padLeft:painted.padLeft,padTop:painted.padTop,cellSize:painted.cellSize,rowHeight:painted.rowHeight??painted.cellSize,cellWidth:painted.cellWidth??painted.cellSize-1,cellHeight:painted.cellHeight??painted.cellSize-1,customShape:painted.cellWidth!==void 0};const cellSize=this.matrixCellSize(cols),rowHeight=this.matrixRowHeight(cellSize),shape=this.matrixCellShape(cellSize,rowHeight);return{rows,cols,padLeft:this.matrixPadLeft,padTop:this.matrixPadTop,cellSize,rowHeight,cellWidth:shape.w,cellHeight:shape.h,customShape:shape.custom}}calendarNavigationGeometry(){const spacing=this.calendarSpacing(),cellSize=spacing.cellSize,columnPositions=this.calendarColumnPositions(spacing),rowPositions=this.calendarRowPositions(spacing);return{weekCount:this.cachedCalendarGrid.weekCount,cellSize,columnPositions,rowPositions,padLeft:this.calendarPadLeft,padTop:CAL_LABEL_H}}hitTestMatrix(x,y){const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;return rows===0||cols===0?null:hitTestMatrixGrid(x,y,this.matrixNavigationGeometry(rows,cols),pos=>this.isCellInteractive(pos))}firstInteractiveMatrixCell(rows,cols){return findFirstInteractiveMatrixCell(rows,cols,pos=>this.isCellInteractive(pos))}nextInteractiveMatrixCell(row,col,dRow,dCol,rows,cols){return findNextInteractiveMatrixCell(row,col,dRow,dCol,rows,cols,pos=>this.isCellInteractive(pos))}firstInteractiveCalendarCell(weekCount){return findFirstInteractiveCalendarCell(weekCount,(week,weekday)=>this.calendarPos(week,weekday),pos=>this.isCellInteractive(pos))}nextInteractiveCalendarCell(week,weekday,dWeek,dWeekday,weekCount){return findNextInteractiveCalendarCell(week,weekday,dWeek,dWeekday,weekCount,(nextWeek,nextWeekday)=>this.calendarPos(nextWeek,nextWeekday),pos=>this.isCellInteractive(pos))}hitTestCalendar(x,y){const weekCount=this.cachedCalendarGrid.weekCount;if(weekCount===0)return null;const spacing=this.calendarSpacing(),columnPositions=this.calendarColumnPositions(spacing);return hitTestCalendarGrid(x,y,weekCount,columnPositions,()=>spacing.cellSize,()=>this.calendarRowPositions(spacing),(week,weekday)=>this.calendarPos(week,weekday),pos=>this.isCellInteractive(pos))}calendarCellAt(pos){return readCalendarCell(pos.week,pos.weekday,this.cachedCalendarCellsByPos,this.cachedCalendarDateByPos,this.cachedCalendarGrid.firstWeekStart,this.signedDomain)}calendarValueAt(week,weekday){return readCalendarValue(week,weekday,this.cachedCalendarCellsByPos,this.signedDomain)}calendarDateAt(week,weekday){return readCalendarDate(week,weekday,this.cachedCalendarDateByPos,this.cachedCalendarGrid.firstWeekStart)}calendarPos(week,weekday){return{week,weekday,date:this.calendarDateAt(week,weekday)}}cellRect(pos){return"week"in pos?calendarCellRect(pos.week,pos.weekday,this.calendarNavigationGeometry()):matrixCellRect(pos,this.matrixNavigationGeometry(this.matrixRowLabels.length,this.matrixColLabels.length))}accessibleCellRect(pos){return"week"in pos||!this.lastPaintedMatrixGeometry?this.cellRect(pos):accessibleMatrixCellRect(pos,this.lastPaintedMatrixGeometry)}defaultCellText(pos){return"week"in pos?this.calendarCellText(pos):this.matrixCellText(pos)}matrixCellText(pos){const rowLabel=this.matrixRowLabels[pos.row]??this.localize("heatmapDefaultRowLabel",void 0,{n:this.formatLocaleNumber(pos.row+1)}),colLabel=this.matrixColLabels[pos.col]??this.localize("heatmapDefaultColLabel",void 0,{n:this.formatLocaleNumber(pos.col+1)}),v=this.matrixValues[pos.row]?.[pos.col],valueText=v==null||this.isNoData(v)?this.localize("heatmapNoDataValue"):this.formatNumericValue(v);return this.localize("heatmapMatrixCellLabel",void 0,{row:rowLabel,col:colLabel,value:valueText})}calendarCellText(pos){const{date,value}=this.calendarCellAt(pos),label=getDateTimeFormat(this.effectiveLocale||void 0,{month:"short",day:"numeric",calendar:"gregory",timeZone:"UTC"}).format(parseIsoDate(date)),valueText=this.isNoData(value)?this.localize("heatmapNoDataValue"):this.formatNumericValue(value);return this.localize("heatmapCalendarCellLabel",void 0,{date:label,value:valueText})}valueAt(pos){return"week"in pos?this.calendarCellAt(pos).value:this.matrixValues[pos.row]?.[pos.col]??-1}resolveCellText(pos){return this.cellText?this.cellText(pos,this.valueAt(pos)):this.defaultCellText(pos)}isCellInteractive(pos){return this.cellInteractive?.(pos,this.valueAt(pos))??!0}announce(pos,isSelectedOverride){const text=this.resolveCellText(pos),announcement=isSelectedOverride??this.isSelectedPos(pos)?this.localize("heatmapSelectedCellLabel",void 0,{cell:text}):text;this.liveText=announcement,this.announcements.announcePolite(announcement)}emitCellClick(pos,source="pointer",select=!0,current){if(!this.isCellInteractive(pos)||current&&!current())return;if(this.multiple&&select){const generation=this.sourceBindingGeneration;if(this.selectionAnchor=pos,this.selectionRangeBase=void 0,this.toggleSelectionPositions([pos],source),!this.isConnected||this.matrixSource||this.sourceBindingGeneration!==generation)return}let detail;if("week"in pos){const{date,value}=this.calendarCellAt(pos);detail={date,value}}else{const value=this.matrixValues[pos.row]?.[pos.col]??-1;detail={row:pos.row,col:pos.col,value}}this.emit("lr-cell-activate",{...detail})}get currentSelectedPositions(){return this.selectionPreview??this.selectedPositions}selectedPaintPositions(){if(this.multiple)return[...this.currentSelectedPositions.values()];const selected=this.selectedCell;if(!selected)return[];if(this.effectiveMode==="calendar"){const match=selected.date?this.cachedCalendarCellsByDate.get(selected.date):void 0;return match?[match]:[]}return selected.row!=null&&selected.col!=null?[{row:selected.row,col:selected.col}]:[]}rebuildSelectedPositions(){const positions=new Map,input=Array.isArray(this.selectedCells)?this.selectedCells:[],dates=input.length&&this.effectiveMode==="calendar"?new Map(this.accessibleCellPositions().map(pos=>[this.accessibleCellIdentity(pos),pos])):void 0;for(let index=0;index<Math.min(input.length,MAX_HEATMAP_CELLS);index++){const cell=input[index];if(!cell||typeof cell!="object")continue;const pos=dates?typeof cell.date=="string"?dates.get(cell.date):void 0:Number.isInteger(cell.row)&&Number.isInteger(cell.col)?this.accessibleCellAtKey(`matrix-${cell.row}-${cell.col}`):void 0;pos&&positions.set(this.accessibleCellKey(pos),pos)}this.selectedPositions=positions}selectionCoordinates(pos){return"week"in pos?{row:pos.weekday,col:pos.week}:pos}proposeSelection(positions,source){if(positions.size===this.selectedPositions.size&&[...positions.keys()].every(key=>this.selectedPositions.has(key)))return;this.proposedSelectionKeys=new Set(positions.keys());const selectedCells=[...positions.values()].sort((a,b)=>{const first=this.selectionCoordinates(a),second=this.selectionCoordinates(b);return first.row-second.row||first.col-second.col}).map(pos=>"week"in pos?{date:pos.date}:{row:pos.row,col:pos.col});this.emit("lr-selection-change",{selectedCells,source})}toggleSelectionPositions(positions,source){if(!this.multiple||positions.length===0)return;const next=new Map(this.selectedPositions),remove=positions.every(pos=>next.has(this.accessibleCellKey(pos)));for(const pos of positions){const key=this.accessibleCellKey(pos);remove?next.delete(key):next.set(key,pos)}this.proposeSelection(next,source)}toggleSelectionAxis(index,row){!this.multiple||!Number.isInteger(index)||index<0||(this.cancelSelectionGesture(),this.selectionRangeBase=void 0,this.toggleSelectionPositions(this.accessibleCellPositions().filter(pos=>{const coordinates=this.selectionCoordinates(pos);return(row?coordinates.row:coordinates.col)===index}),row?"row":"column"))}selectionKeyDown(event,pos){if(!this.multiple||isHandledOrComposingKey(event)||event.altKey)return!1;if(event.key==="Escape"&&this.selectionGesture&&!shouldIgnoreNavigationKey(event))return event.preventDefault(),this.cancelSelectionGesture(),!0;if(event.key!==" "||!pos||!(event.shiftKey||event.ctrlKey||event.metaKey))return!1;event.preventDefault();const coordinates=this.selectionCoordinates(pos);return event.ctrlKey||event.metaKey?this.toggleColumnSelection(coordinates.col):this.toggleRowSelection(coordinates.row),!0}extendSelection(previous,next,range){if(!this.multiple)return;if(!range){this.selectionAnchor=next,this.selectionRangeBase=void 0;return}this.selectionAnchor??=previous??next,this.selectionRangeBase??=new Map(this.selectedPositions);const from=this.selectionCoordinates(this.selectionAnchor),to=this.selectionCoordinates(next),selected=new Map(this.selectionRangeBase);for(let row=Math.min(from.row,to.row);row<=Math.max(from.row,to.row);row++)for(let col=Math.min(from.col,to.col);col<=Math.max(from.col,to.col);col++){const key=this.effectiveMode==="calendar"?`calendar-${col}-${row}`:`matrix-${row}-${col}`,pos=this.accessibleCellAtKey(key);pos&&selected.set(key,pos)}return this.proposeSelection(selected,"keyboard"),new Set(selected.keys())}selectionPointerPosition(event){if(!this.canvas)return null;const rect=this.canvas.getBoundingClientRect(),scale=layoutScale(this.canvas);return this.hitTest((event.clientX-rect.left)/scale.x,(event.clientY-rect.top)/scale.y)}captureSelectionContext(){const data=this.data,maxCells=this.maxCells,interactive=this.cellInteractive,selected=this.selectedCells,accessible=this.accessibleCells,source=this.matrixSource,owner=this.ownerDocument;return(allowSelectionChange=!1)=>this.isConnected&&this.ownerDocument===owner&&this.multiple&&this.data===data&&Object.is(this.maxCells,maxCells)&&this.cellInteractive===interactive&&this.accessibleCells===accessible&&this.matrixSource===source&&(allowSelectionChange||this.selectedCells===selected)}paintSelectionTo(pos){const gesture=this.selectionGesture;if(!gesture)return;this.samePos(pos,gesture.previous)||(gesture.moved=!0);const from=this.selectionCoordinates(gesture.previous),to=this.selectionCoordinates(pos),steps=Math.max(Math.abs(to.row-from.row),Math.abs(to.col-from.col),1),changed=[];for(let step=0;step<=steps;step++){const row=Math.round(from.row+(to.row-from.row)*step/steps),col=Math.round(from.col+(to.col-from.col)*step/steps),key=this.effectiveMode==="calendar"?`calendar-${col}-${row}`:`matrix-${row}-${col}`,candidate=this.accessibleCellAtKey(key);candidate&&(gesture.cells.has(key)!==gesture.selecting&&changed.push(candidate),gesture.selecting?gesture.cells.set(key,candidate):gesture.cells.delete(key))}if(gesture.previous=pos,this.selectionPreview!==gesture.cells){this.selectionPreview=gesture.cells;return}this.requestUpdate(),(changed.length>16||!changed.every(cell=>this.repaintCell(cell)))&&this.requestDraw()}repaintCell(pos){return!this.canvasHasContent||!this.canvas||this.drawDirty?!1:("week"in pos?this.repaintCalendarFocusCell(pos):this.repaintMatrixFocusCell(pos),!0)}cancelSelectionGesture(pointerEnded=!1){const gesture=this.selectionGesture;this.selectionGesture=void 0,this.selectionPreview=void 0,gesture&&(pointerEnded||(this.canceledSelectionPointer=gesture.pointerId),this.suppressNextSelectionClick(),releasePointer(gesture.target,gesture.pointerId))}suppressNextSelectionClick(){const view=this.ownerDocument.defaultView;view&&(this.releaseSelectionClick?.(),this.selectionClickKey??=nextId("heatmap-selection"),this.releaseSelectionClick=armClickSuppression(view,this.selectionClickKey))}consumeSelectionClick(event){return event.detail!==0&&this.selectionClickKey!==void 0&&consumeSuppressedClick(event,this.selectionClickKey)}get gridScrollportRendered(){return this.effectiveStickyLabels!=="none"||this.fill&&this.effectiveMode==="matrix"}get gridScrollport(){return this.shadowRoot?.querySelector('[part="grid"]')??null}measureTooltip(){const tooltip=this.shadowRoot?.querySelector('[part="tooltip"]');if(!tooltip||tooltip.hidden)return;const view=this.ownerDocument.defaultView,gap=view?Math.abs(finiteNumber(Number.parseFloat(view.getComputedStyle(tooltip).marginBlockStart),0)):0,inline=tooltip.offsetWidth,block=tooltip.offsetHeight+gap;inline===this.tooltipSize.inline&&block===this.tooltipSize.block||(this.tooltipSize={inline,block},this.requestUpdate())}tooltipAnchor(pos){const rect=this.cellRect(pos),center=rect.x+rect.w/2,port=this.gridScrollport,frame=port??this.shadowRoot?.querySelector('[part="base"]');if(!frame)return{style:{left:`${center}px`,top:`${rect.y}px`},below:!1};const{inline,block}=this.tooltipSize,scrollLeft=port?.scrollLeft??0,scrollTop=port?.scrollTop??0,windowStart=scrollLeft+(port&&this.freezesRowLabels?this.matrixPadLeft:0),windowEnd=scrollLeft+frame.clientWidth,windowTop=scrollTop+(port&&this.freezesColLabels?this.matrixPadTop:0),windowBottom=scrollTop+frame.clientHeight,below=rect.y-block<windowTop&&rect.y+rect.h+block<=windowBottom;return{style:{left:`${Math.max(windowStart+inline/2,Math.min(center,windowEnd-inline/2))}px`,top:`${below?rect.y+rect.h:rect.y}px`},below}}scrollCellIntoView(pos){const port=this.gridScrollport;if(!port)return;const rect=this.cellRect(pos),bandInline=this.freezesRowLabels?this.matrixPadLeft:0,bandBlock=this.freezesColLabels?this.matrixPadTop:0,left=Math.min(Math.max(port.scrollLeft,rect.x+rect.w-port.clientWidth),rect.x-bandInline),top=Math.min(Math.max(port.scrollTop,rect.y+rect.h-port.clientHeight),rect.y-bandBlock);left!==port.scrollLeft&&(port.scrollLeft=left),top!==port.scrollTop&&(port.scrollTop=top)}samePos(a,b){return a===b?!0:!a||!b?!1:"week"in a&&"week"in b?a.week===b.week&&a.weekday===b.weekday:"row"in a&&"row"in b?a.row===b.row&&a.col===b.col:!1}edgeCell(e){if(e.key!=="Home"&&e.key!=="End")return null;const row=this.focusedCell&&!(e.ctrlKey||e.metaKey)?this.selectionCoordinates(this.focusedCell).row:void 0,cells=this.accessibleCellPositions().filter(pos=>row===void 0||this.selectionCoordinates(pos).row===row);return cells[e.key==="Home"?0:cells.length-1]??null}navigateGridKey(e){const previous=this.focusedCell,edge=this.edgeCell(e);if(edge?(e.preventDefault(),this.focusedCell=edge,this.scrollCellIntoView(edge)):this.effectiveMode==="calendar"?this.onCalendarKeyDown(e):this.onMatrixKeyDown(e),(edge||ARROW_KEYS.has(e.key))&&this.focusedCell){const proposedKeys=this.extendSelection(previous,this.focusedCell,e.shiftKey);this.announce(this.focusedCell,proposedKeys?.has(this.accessibleCellKey(this.focusedCell)))}}onMatrixKeyDown(e){const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;if(rows===0||cols===0)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.focusedCell&&!isRepeatedActivationKey(e)&&this.emitCellClick(this.focusedCell,"keyboard");return}if(!ARROW_KEYS.has(e.key))return;if(e.preventDefault(),!this.focusedCell||!("row"in this.focusedCell)){const next2=this.firstInteractiveMatrixCell(rows,cols);if(!next2)return;this.focusedCell=next2,this.scrollCellIntoView(next2);return}const{row,col}=this.focusedCell;let dRow=0,dCol=0;e.key==="ArrowUp"?dRow=-1:e.key==="ArrowDown"?dRow=1:e.key==="ArrowLeft"?dCol=-1:e.key==="ArrowRight"&&(dCol=1);const next=this.nextInteractiveMatrixCell(row,col,dRow,dCol,rows,cols);this.focusedCell=next,this.scrollCellIntoView(next)}onCalendarKeyDown(e){const{weekCount}=this.cachedCalendarGrid;if(weekCount===0)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.focusedCell&&!isRepeatedActivationKey(e)&&this.emitCellClick(this.focusedCell,"keyboard");return}if(!ARROW_KEYS.has(e.key))return;if(e.preventDefault(),!this.focusedCell||!("week"in this.focusedCell)){const next2=this.firstInteractiveCalendarCell(weekCount);if(!next2)return;this.focusedCell=next2;return}const{week,weekday}=this.focusedCell;let dWeek=0,dWeekday=0;e.key==="ArrowUp"?dWeekday=-1:e.key==="ArrowDown"?dWeekday=1:e.key==="ArrowLeft"?dWeek=-1:e.key==="ArrowRight"&&(dWeek=1);const next=this.nextInteractiveCalendarCell(week,weekday,dWeek,dWeekday,weekCount);this.focusedCell=next}resolveCellColor(value,cs){let color=this.canvasColorCache.get(value);if(color===void 0){const ctx=SCOPED_COLOR.test(value)?null:getScratchCtx(this.ownerDocument);if(ctx){ctx.fillStyle="rgb(1, 2, 3)";const rejected=ctx.fillStyle;ctx.fillStyle=value,ctx.fillStyle!==rejected&&(color=ctx.fillStyle)}color??=resolveCanvasColor(this,value,this.readToken(cs,"no-data-fill",FALLBACK_NO_DATA_FILL)),this.canvasColorCache.set(value,color)}return color}accessibleCellIndex(){if(this.accessibleIndex)return this.accessibleIndex;const positions=[];if(this.effectiveMode==="calendar"){const{weekCount}=this.cachedCalendarGrid;for(let week=0;week<weekCount;week++)for(let weekday=0;weekday<7;weekday++){const pos=this.calendarPos(week,weekday);this.isCellInteractive(pos)&&positions.push(pos)}}else for(let row=0;row<this.matrixRowLabels.length;row++)for(let col=0;col<this.matrixColLabels.length;col++){const pos={row,col};this.isCellInteractive(pos)&&positions.push(pos)}const byKey=new Map;return positions.forEach((position,index)=>byKey.set(this.accessibleCellKey(position),index)),this.accessibleIndex={positions,byKey}}accessibleCellPositions(){return this.accessibleCellIndex().positions}accessibleCellKey(pos){return"week"in pos?`calendar-${pos.week}-${pos.weekday}`:`matrix-${pos.row}-${pos.col}`}accessibleCellIdentity(pos){return"week"in pos?pos.date:this.accessibleCellKey(pos)}accessibleCellAtKey(key){const{positions,byKey}=this.accessibleCellIndex(),index=byKey.get(key);return index===void 0?null:positions[index]}focusAccessibleCell(pos){pos&&this.updateComplete.then(()=>{[...this.shadowRoot?.querySelectorAll('[part="cell"]')??[]].find(candidate=>candidate.dataset.cellKey===this.accessibleCellKey(pos))?.focus()})}accessibleWindowStart(){if(!this.accessibleCells)return 0;const{positions,byKey}=this.accessibleCellIndex(),focusIndex=this.focusedCell?byKey.get(this.accessibleCellKey(this.focusedCell))??0:0;return Math.max(0,Math.min(Math.max(0,positions.length-MAX_ACCESSIBLE_HEATMAP_CELLS),focusIndex-Math.floor(MAX_ACCESSIBLE_HEATMAP_CELLS/2)))}syncAccessibleTabStop(){if(!this.accessibleCells)return;const target=this.focusedCell??this.accessibleCellPositions()[0],key=target?this.accessibleCellKey(target):void 0,previous=this.renderRoot.querySelector('[part="cell"][tabindex="0"]');previous?.dataset.cellKey!==key&&(previous?.setAttribute("tabindex","-1"),key&&this.renderRoot.querySelector(`[data-cell-key="${key}"]`)?.setAttribute("tabindex","0"))}renderAccessibleCells(start){if(!this.accessibleCells)return html``;const positions=this.accessibleCellPositions(),tabStop=this.focusedCell??positions[0]??null,renderedPositions=positions.slice(start,start+MAX_ACCESSIBLE_HEATMAP_CELLS),renderedRows=new Map;for(const pos of renderedPositions){const rowIndex="week"in pos?pos.weekday+1:pos.row+1,row=renderedRows.get(rowIndex);row?row.push(pos):renderedRows.set(rowIndex,[pos])}const rowCount=this.effectiveMode==="calendar"?7:this.matrixRowLabels.length,colCount=this.effectiveMode==="calendar"?this.cachedCalendarGrid.weekCount:this.matrixColLabels.length,calendar=this.effectiveMode==="calendar"?this.calendarNavigationGeometry():void 0;return html`
3
+ `)}get matrixPadTop(){if(this.colLabelHeight==="auto")return this.resolvedColLabelHeight;if(typeof this.colLabelHeight!="number")return PAD_TOP;const resolved=finiteNumber(this.colLabelHeight,PAD_TOP);return resolved>=0?resolved:PAD_TOP}measureColLabelHeight(cs){const labels=this.matrixColLabels;if(labels.length===0)return PAD_TOP;const ctx=getScratchCtx(this.ownerDocument);if(!ctx)return PAD_TOP;ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);let widest=0;const interval=finiteInteger(this.colLabelInterval,1,1);for(let index=0;index<labels.length;index+=interval)widest=Math.max(widest,this.labelWidth(ctx,labels[index]));const radians=this.effectiveColLabelRotation*Math.PI/180,projected=widest*Math.sin(radians);return Math.max(PAD_TOP,Math.min(Math.ceil(projected)+COL_LABEL_INSET,MAX_COL_LABEL_HEIGHT))}measureRowLabelWidth(cs){const labels=this.matrixRowLabels;if(labels.length===0)return PAD_LEFT;const ctx=getScratchCtx(this.ownerDocument);if(!ctx)return PAD_LEFT;ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);let widest=0;for(const label of labels)widest=Math.max(widest,this.labelWidth(ctx,label));const hostWidth=this.clientWidth||0,cap=hostWidth>0?hostWidth*MAX_ROW_LABEL_FRACTION:Number.POSITIVE_INFINITY;return Math.min(Math.max(PAD_LEFT,Math.ceil(widest)+ROW_LABEL_INSET*2),cap)}withLabelCache(paint){const previous=this.labelCache;this.labelCache=new HeatmapLabelCache;try{paint()}finally{this.labelCache=previous}}labelWidth(ctx,label){return this.labelCache?.width(ctx,label)??ctx.measureText(label).width}ellipsize(ctx,label,maxWidth){return this.labelCache?.clip(ctx,label,maxWidth,()=>this.ellipsizeLabel(ctx,label,maxWidth))??this.ellipsizeLabel(ctx,label,maxWidth)}ellipsizeLabel(ctx,label,maxWidth){if(maxWidth<=0)return"";if(this.labelWidth(ctx,label)<=maxWidth)return label;const characters=[...label],shortened=kept=>`${characters.slice(0,kept).join("")}…`;let fits=0,most=characters.length-1;for(;fits<most;){const kept=fits+most+1>>1;this.labelWidth(ctx,shortened(kept))<=maxWidth?fits=kept:most=kept-1}return fits>0||this.labelWidth(ctx,"…")<=maxWidth?shortened(fits):""}get calendarPadLeft(){const requested=this.calendarWeekdayLabelWidth;return requested==="auto"?this.resolvedCalendarWeekdayLabelWidth:requested??CAL_PAD_LEFT}measureCalendarWeekdayLabelWidth(cs,firstWeekStart){const ctx=getScratchCtx(this.ownerDocument);if(!ctx)return CAL_PAD_LEFT;ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);let widest=0;for(const label of this.weekdayLabels(firstWeekStart))label&&(widest=Math.max(widest,this.labelWidth(ctx,label)));const hostWidth=this.clientWidth||0,cap=hostWidth>0?Math.max(CAL_PAD_LEFT,hostWidth*MAX_ROW_LABEL_FRACTION):Number.POSITIVE_INFINITY;return Math.min(Math.max(CAL_PAD_LEFT,Math.ceil(widest)+CAL_WEEKDAY_LABEL_INSET*2),cap)}get matrixRowLabels(){return this.cachedMatrixData.rowLabels}get matrixColLabels(){return this.cachedMatrixData.colLabels}get matrixValues(){return this.cachedMatrixData.values}get calendarDays(){return this.data.kind==="calendar"?this.data.days:[]}get calendarData(){return this.data.kind==="calendar"?this.data:void 0}get cellSize(){return this._cellSize??(this.effectiveMode==="calendar"?CAL_CELL:DEFAULT_MATRIX_CELL_SIZE)}set cellSize(value){const oldValue=this._cellSize;this._cellSize=value==null?void 0:finiteRange(value,this.effectiveMode==="calendar"?CAL_CELL:DEFAULT_MATRIX_CELL_SIZE,1),this.requestUpdate("cellSize",oldValue)}get rowHeight(){return this._rowHeight}set rowHeight(value){const oldValue=this._rowHeight;this._rowHeight=value==null||!Number.isFinite(value)?void 0:finiteRange(value,1,1,MAX_MATRIX_ROW_HEIGHT),this.requestUpdate("rowHeight",oldValue)}get legendPlacement(){return this._legendPlacement}set legendPlacement(next){const normalized=LEGEND_PLACEMENT.normalizeReflected(this,"legend-placement",next),old=this._legendPlacement;old!==normalized&&(this._legendPlacement=normalized,this.requestUpdate("legendPlacement",old))}get axisSelection(){return this._axisSelection}set axisSelection(next){const normalized=AXIS_SELECTION.normalizeReflected(this,"axis-selection",next),old=this._axisSelection;old!==normalized&&(this._axisSelection=normalized,this.requestUpdate("axisSelection",old))}get signedDomain(){return this.domain!==void 0||this.midpoint!==void 0}rampAlpha(value,lo,hi){const anchor=this.midpoint;return anchor===void 0?linearAlpha(value,lo,hi):midpointAlpha(value,lo,hi,anchor)}rampBucket(value,lo,hi,steps){const anchor=this.midpoint;return anchor===void 0?linearBucket(value,lo,hi,steps):midpointBucket(value,lo,hi,anchor,steps)}isNoData(value){return Number.isFinite(value)?value<0&&!this.signedDomain:!0}get maxCellSize(){return this._maxCellSize}set maxCellSize(value){const oldValue=this._maxCellSize;this._maxCellSize=normalizeCellSizeClamp(value),this.requestUpdate("maxCellSize",oldValue)}get minCellSize(){return this._minCellSize}set minCellSize(value){const oldValue=this._minCellSize;this._minCellSize=normalizeCellSizeClamp(value),this.requestUpdate("minCellSize",oldValue)}get normalizedFirstDayOfWeek(){return(finiteInteger(this.calendarData?.firstDayOfWeek??0,0)%7+7)%7}get bucketCount(){return this._bucketCount}set bucketCount(value){const oldValue=this._bucketCount;this._bucketCount=normalizeBucketCount(value),this.requestUpdate("bucketCount",oldValue)}toggleRowSelection(row){this.toggleSelectionAxis(row,!0)}toggleColumnSelection(col){this.toggleSelectionAxis(col,!1)}get calendarWeekdayLabelText(){return this.calendarData?.weekdayLabelText}get calendarWeekdayLabelWidth(){const value=this.calendarData?.weekdayLabelWidth;if(value==="auto")return value;if(typeof value!="number")return;const resolved=finiteNumber(value,CAL_PAD_LEFT);return resolved>=0?resolved:void 0}get calendarMonthLabelText(){return this.calendarData?.monthLabelText}get calendarColumnX(){return this.calendarData?.columnX}get calendarRowY(){return this.calendarData?.rowY}constructor(){super(),this.sourceBindingGeneration=0,this.sourceInput=null,this.sourceViewportInput=null,this.sourceViewportInvalid=!1,this.matrixReducer="mean",this.sourceNeedsConfigure=!0,this.sourceViewportExplicit=!1,this.sourceRevealIntent=0,this.sourceNavigationIntent=0,this.sourceResult=0,this.sourceTooltip=null,this.sourceFocusVersion=0,this.sourceRestoringFocus=!1,this.sourceHasSucceeded=!1,this.sourceFailureAnnounced=!1,this.sourceSelectedKeys=new Set,this.sourceSelectionKey="",this.sourceSelectedCellsEpoch=-1,this.sourceWidth=0,this.data=DEFAULT_MATRIX_DATA,this.maxCells=1e4,this._stickyLabels="none",this.resolvedColLabelHeight=PAD_TOP,this.resolvedRowLabelWidth=PAD_LEFT,this.resolvedCalendarWeekdayLabelWidth=CAL_PAD_LEFT,this.withoutLegend=!1,this._legendPlacement="bottom",this.fill=!1,this.fitBlock=!1,this._axisSelection="none",this.axisFocus={row:0,col:0},this.scale="linear",this.cellGapX=1,this.cellGapY=1,this.cellRadius=0,this.colLabelInterval=1,this.fitToWidth=!1,this._bucketCount=DEFAULT_BUCKET_COUNT,this.annotations=[],this.selectedCell=null,this.label=null,this.description=null,this.multiple=!1,this.selectedCells=[],this.accessibleCells=!1,this.cachedValueRange=null,this.cachedMatrixData={rowLabels:[],colLabels:[],values:[],truncated:!1},this.cachedCalendarGrid=buildCalendarGrid(this.calendarDays),this.cachedCalendarSortedValues=[],this.cachedCalendarCellsByPos=new Map,this.cachedCalendarCellsByDate=new Map,this.cachedAnnotations=[],this.cachedLegendStops=[],this.cachedColorSteps=[],this.cachedCalendarAnnotationDates=new Set,this.cachedMatrixAnnotationPositions=new Set,this.decorationProjectionTruncated=!1,this.cachedCalendarDateByPos=[],this.cachedRamp=null,this.canvasHasContent=!1,this.canvasVisible=!0,this.drawDirty=!1,this.overlayRevision=0,this.hoverCell=null,this.focusedCell=null,this.liveText="",this.accessibleTargetSizePx=DEFAULT_ACCESSIBLE_TARGET_SIZE_PX,this.restoringAccessibleFocus=!1,this.accessibleFocusGeneration=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.authorRole=null,this.authorAriaLabel=null,this.generatedAriaLabel="",this.accessibleDescription="",this.syncingGeneratedSemantics=!1,this.hasSyncedDescribedByElements=!1,this.initialLimitUpdate=!0,this.lastLimitNotice="",this.canvasBlurred=!1,this.onCanvasFocusChange=event=>{const blurred=event.type==="blur";this.canvasBlurred!==blurred&&(this.canvasBlurred=blurred,this.focusedCell&&(this.repaintFocusRing(blurred?this.focusedCell:null)||this.requestDraw()))},this.scheduleDraw=()=>{if(this.drawFrameRequest)return;const owner=this.ownerDocument.defaultView;if(!owner||!this.isConnected)return;const request={owner,handle:0};request.handle=owner.requestAnimationFrame(()=>{this.drawFrameRequest===request&&(this.drawFrameRequest=void 0,this.isConnected&&this.ownerDocument.defaultView===owner&&this.requestDraw())}),this.drawFrameRequest=request},this.selectedPositions=new Map,this.selectionAnchor=null,this.onSelectionPointerDown=event=>{if(event.button!==0||!event.isPrimary||this.selectionGesture||(this.canceledSelectionPointer=void 0,this.releaseSelectionClick?.(),this.releaseSelectionClick=void 0,!this.multiple))return;const current=this.selectionContext;if(!current?.())return;const pos=this.selectionPointerPosition(event);if(!pos||!current())return;if(event.preventDefault(),this.selectionRangeBase=void 0,this.selectionAnchor=pos,this.focusedCell=pos,this.accessibleCells?this.focusAccessibleCell(pos):this.canvas?.focus(),!current()){this.canceledSelectionPointer=event.pointerId,this.suppressNextSelectionClick();return}const target=event.currentTarget;this.selectionGesture={current,pointerId:event.pointerId,target,start:pos,previous:pos,moved:!1,selecting:!this.selectedPositions.has(this.accessibleCellKey(pos)),cells:new Map(this.selectedPositions)},capturePointer(target,event.pointerId),this.paintSelectionTo(pos)},this.onSelectionPointerMove=event=>{const gesture=this.selectionGesture;if(!gesture||gesture.pointerId!==event.pointerId)return;if(!gesture.current()){this.cancelSelectionGesture();return}const pos=this.selectionPointerPosition(event);if(!gesture.current()){this.cancelSelectionGesture();return}pos&&!this.samePos(pos,gesture.previous)&&this.paintSelectionTo(pos)},this.onSelectionPointerUp=event=>{if(this.canceledSelectionPointer===event.pointerId){this.canceledSelectionPointer=void 0,this.suppressNextSelectionClick();return}const gesture=this.selectionGesture;if(!gesture||gesture.pointerId!==event.pointerId)return;if(!gesture.current()){this.cancelSelectionGesture(!0);return}const pos=this.selectionPointerPosition(event);if(!gesture.current()){this.cancelSelectionGesture(!0);return}pos&&this.paintSelectionTo(pos),this.cancelSelectionGesture(!0),gesture.current()&&(this.proposeSelection(gesture.cells,"pointer"),!gesture.moved&&gesture.current(!0)&&this.emitCellClick(gesture.start,"pointer",!1,()=>gesture.current(!0)))},this.onSelectionPointerCancel=event=>{this.selectionGesture?.pointerId===event.pointerId&&this.cancelSelectionGesture()},this.tooltipSize={inline:0,block:0},this.onPointerMove=e=>{const next=this.hitTest(e.offsetX,e.offsetY);this.samePos(this.hoverCell,next)||(this.hoverCell=next)},this.onPointerLeave=()=>{this.hoverCell=null},this.onCanvasClick=e=>{if(this.consumeSelectionClick(e))return;const pos=this.hitTest(e.offsetX,e.offsetY);pos&&(this.focusedCell=pos,this.announce(pos),this.emitCellClick(pos))},this.onKeyDown=e=>{this.selectionKeyDown(e,this.focusedCell)||ignoresGridKey(e)||this.navigateGridKey(e)},this.canvasColorCache=new Map,this.onAccessibleCellFocus=e=>{if(this.restoringAccessibleFocus)return;const key=e.currentTarget.dataset.cellKey,pos=key?this.accessibleCellAtKey(key):null;pos&&(this.samePos(pos,this.focusedCell)||(this.selectionAnchor=pos,this.selectionRangeBase=void 0),this.focusedCell=pos,this.announce(pos))},this.onAccessibleCellClick=e=>{if(this.consumeSelectionClick(e))return;const key=e.currentTarget.dataset.cellKey,pos=key?this.accessibleCellAtKey(key):null;pos&&(this.focusedCell=pos,this.announce(pos),this.emitCellClick(pos,e.detail===0?"keyboard":"pointer"))},this.onAccessibleCellKeyDown=e=>{const key=e.currentTarget.dataset.cellKey,pos=key?this.accessibleCellAtKey(key):null;pos&&(this.selectionKeyDown(e,pos)||!GRID_KEYS.has(e.key)||ignoresGridKey(e)||(e.preventDefault(),this.focusedCell=pos,this.navigateGridKey(e),this.focusAccessibleCell(this.focusedCell)))},this.onAxisTargetClick=event=>{const target=event.currentTarget,index=Number(target.dataset.axisIndex),axis=target.dataset.axis==="row"?"row":"col";this.axisFocus={...this.axisFocus,[axis]:index},axis==="row"?this.toggleRowSelection(index):this.toggleColumnSelection(index)},this.onAxisTargetKeyDown=event=>{if(shouldIgnoreNavigationKey(event))return;const target=event.currentTarget,axis=target.dataset.axis==="row"?"row":"col",index=Number(target.dataset.axisIndex),buttons=Array.from(target.parentElement?.querySelectorAll(".axis-target:not([disabled])")??[]),position=buttons.indexOf(target),back=axis==="row"?"ArrowUp":"ArrowLeft",forward=axis==="row"?"ArrowDown":"ArrowRight",nextPosition=event.key===back?position-1:event.key===forward?position+1:event.key==="Home"?0:event.key==="End"?buttons.length-1:void 0;if(nextPosition===void 0)return;event.preventDefault();const next=buttons[Math.max(0,Math.min(buttons.length-1,nextPosition))];!next||next===target||(target.setAttribute("tabindex","-1"),next.setAttribute("tabindex","0"),next.focus(),this.axisFocus={...this.axisFocus,[axis]:Number(next.dataset.axisIndex??index)})},new ThemeWatcher(this,()=>this.onThemeSignal()),this.calendarSpacingTrackingArmed=!0}requestUpdate(name,oldValue,options){name===LYRA_CONTEXT_UPDATE&&this.syncingGeneratedSemantics||(this.calendarSpacingTrackingArmed&&name!==void 0&&CALENDAR_SPACING_PROPERTIES.has(name)&&(this.explicitCalendarSpacingProperties??=new Set).add(name),name===void 0&&(this.sourceBindingGeneration=(this.sourceBindingGeneration??0)+1,this.matrixController?.invalidate(),this.sourceNeedsConfigure=!0),super.requestUpdate(name,oldValue,options))}explicitCalendarSpacing(name){if(!this.explicitCalendarSpacingProperties?.has(name))return;const value=this[name];return value??void 0}warnOnLegendRampMismatch(){const rampColors=this.cachedColorSteps.map(color=>sanitizeCssColor(color)??color);if(rampColors.length===0)return;const legendColors=this.cachedLegendStops.filter(stop=>!!stop.color&&stop.partOfRamp!==!1).map(stop=>sanitizeCssColor(stop.color??"")??stop.color??"");legendColors.length===0||legendColors.length===rampColors.length&&legendColors.every((color,index)=>color===rampColors[index])||devWarnOnce("lyra-heatmap-legend-ramp-mismatch",`<${this.localName}>: legendStops describes ${legendColors.length} colour(s) that do not match the ${rampColors.length} colorSteps the cells are painted from, so the legend may misdescribe the ramp. Supply legendStops built from the same array as colorSteps, or omit it to keep the built-in gradient key.`)}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),!(oldValue===value||this.syncingGeneratedSemantics)&&(name==="role"&&(this.authorRole=value),name==="aria-label"&&(this.authorAriaLabel=value))}connectedCallback(){super.connectedCallback(),this.matrixSource&&!this.matrixController&&this.requestUpdate("matrixSource"),this.sourceNeedsConfigure=!0,this.refreshAccessibleTargetSize();const owner=this.ownerDocument.defaultView,ResizeObserverCtor=owner?.ResizeObserver;if(owner&&ResizeObserverCtor){let observer;observer=new ResizeObserverCtor(()=>{!this.isConnected||this.ownerDocument.defaultView!==owner||this.resizeObserver!==observer||this.scheduleDraw()}),this.resizeObserver=observer,observer.observe(this)}const IntersectionObserverCtor=owner?.IntersectionObserver;if(this.canvasVisible=!0,owner&&IntersectionObserverCtor){let observer;observer=new IntersectionObserverCtor(entries=>{if(!this.isConnected||this.ownerDocument.defaultView!==owner||this.intersectionObserver!==observer)return;const entry=entries.find(candidate=>candidate.target===this);!entry||entry.isIntersecting===this.canvasVisible||(this.canvasVisible=entry.isIntersecting,this.canvasVisible&&this.drawDirty&&this.scheduleDraw())}),this.intersectionObserver=observer,observer.observe(this)}this.cachedRamp=null,this.resolvedStepsMemo=void 0,this.paintedTheme=void 0,this.canvasColorCache.clear(),this.watchDpr(),this.drawDirty&&!ResizeObserverCtor&&this.scheduleDraw()}disconnectedCallback(){this.sourceBindingGeneration++,this.dismissTooltip(),super.disconnectedCallback(),this.cancelSelectionGesture(),this.canceledSelectionPointer=void 0,this.releaseSelectionClick?.(),this.releaseSelectionClick=void 0,this.selectionAnchor=null,this.selectionRangeBase=void 0,this.accessibleFocusGeneration++,this.pendingAccessibleFocus=void 0,this.pendingAccessibleFocusOrigin=void 0,this.restoringAccessibleFocus=!1,this.hoverCell=null,this.focusedCell=null,this.canvasBlurred=!1,this.liveText="",this.canvasHasContent=!1,this.drawDirty=!0,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.canvasVisible=!0,this.stopWatchingDpr?.(),this.stopWatchingDpr=void 0,this.cancelDrawFrame()}adoptedCallback(){this.sourceBindingGeneration++,super.adoptedCallback(),this.matrixController?.requests.adopted(),this.sourceNeedsConfigure=!0,this.announcements.adopted()}watchDpr(){this.stopWatchingDpr=watchDevicePixelRatio(this.ownerDocument.defaultView,()=>this.requestDraw())}willUpdate(changed){if(super.willUpdate(changed),this.selectionContext=this.captureSelectionContext(),changed.has("matrixSource")&&!this.matrixSource&&changed.set("data",void 0),this.matrixSource){this.clearGeneratedSemantics(),this.matrixController&&sourceWillUpdate(this,changed);return}(changed.size===0||[...changed.keys()].some(key=>!["hoverCell","focusedCell","liveText"].includes(String(key))))&&this.overlayRevision++,(changed.has("data")||changed.has("maxCells")||changed.has("domain")||changed.has("midpoint")||!this.hasUpdated)&&this.rebuildCanonicalMatrixData(),(changed.has("annotations")||changed.has("legendStops")||changed.has("colorSteps")||!this.hasUpdated)&&this.rebuildBoundedDecorations();const accessibleModeChanged=changed.has("accessibleCells")&&this.hasUpdated,collectionChanged=changed.has("data")||changed.has("maxCells")||changed.has("cellInteractive"),activeRenderedControl=collectionChanged||accessibleModeChanged?shadowFocusTarget(this):null,activeAccessibleCell=activeRenderedControl?.matches('[part="cell"]')?activeRenderedControl:null,renderedAccessibleCells=activeAccessibleCell?.matches('[part="cell"]')?[...this.renderRoot.querySelectorAll('[part="cell"]')]:[],accessibleFocusSnapshot=activeAccessibleCell?.matches('[part="cell"]')?{identity:activeAccessibleCell.dataset.cellIdentity,index:renderedAccessibleCells.indexOf(activeAccessibleCell)}:void 0;collectionChanged&&(this.focusedCell=null,this.hoverCell=null,this.liveText="");const locale=this.effectiveLocale;if(changed.has("data")||changed.has("maxCells")||changed.has("locale")||this.lastUpdatedLocale!==locale||!this.hasUpdated){this.cachedCalendarGrid=buildCalendarGrid(this.calendarDays,this.normalizedFirstDayOfWeek,this.calendarMonthLabelText,locale,this.cellBudget),this.cachedCalendarSortedValues=this.cachedCalendarGrid.cells.map(cell=>cell.value).filter(value=>!this.isNoData(value)).sort((a,b)=>a-b),this.cachedCalendarCellsByPos=new Map(this.cachedCalendarGrid.cells.map(cell=>[`${cell.week}:${cell.weekday}`,cell])),this.cachedCalendarCellsByDate=new Map(this.cachedCalendarGrid.cells.map(cell=>[cell.date,cell]));const{firstWeekStart,weekCount}=this.cachedCalendarGrid;this.cachedCalendarDateByPos=Array.from({length:weekCount*7},(_,index)=>isoDateAtOffset(firstWeekStart,index))}if(changed.has("colorSteps")||changed.has("withoutLegend")||!this.hasUpdated){const colorSteps=this.withoutLegend?[]:this.cachedColorSteps.map(sanitizeCssColor);colorSteps.length>=2&&colorSteps.every(color=>color!==void 0)?this.style.setProperty("--lr-heatmap-color-steps-gradient",`linear-gradient(to right, ${colorSteps.join(", ")})`):this.style.removeProperty("--lr-heatmap-color-steps-gradient")}if((changed.has("data")||changed.has("maxCells")||changed.has("domain")||changed.has("midpoint")||!this.hasUpdated)&&(this.cachedValueRange=this.computeValueRange()),(collectionChanged||!this.hasUpdated)&&(this.accessibleIndex=void 0),(collectionChanged||accessibleModeChanged||changed.has("multiple"))&&(this.cancelSelectionGesture(),this.selectionAnchor=null,this.selectionRangeBase=void 0,this.proposedSelectionKeys=void 0),collectionChanged||changed.has("selectedCells")||changed.has("multiple")||!this.hasUpdated){const previous=this.selectedPositions;if(this.rebuildSelectedPositions(),this.pendingSelectionRepaint=void 0,!collectionChanged&&changed.has("selectedCells")){const cells=[...previous].filter(([key])=>!this.selectedPositions.has(key)).map(([,pos])=>pos);for(const[key,pos]of this.selectedPositions)previous.has(key)||cells.push(pos);cells.length<=16&&(this.pendingSelectionRepaint=cells)}changed.has("selectedCells")&&this.selectionGesture&&this.cancelSelectionGesture(),changed.has("selectedCells")&&this.selectionRangeBase&&(this.proposedSelectionKeys?.size!==this.selectedPositions.size||[...this.selectedPositions.keys()].some(key=>!this.proposedSelectionKeys?.has(key)))&&(this.selectionAnchor=this.focusedCell,this.selectionRangeBase=void 0)}if(accessibleFocusSnapshot){const positions=this.accessibleCellPositions(),target=(accessibleFocusSnapshot.identity==null?void 0:positions.find(pos=>this.accessibleCellIdentity(pos)===accessibleFocusSnapshot.identity))??positions[Math.min(Math.max(accessibleFocusSnapshot.index,0),positions.length-1)]??null;this.focusedCell=target,this.liveText=target?this.resolveCellText(target):"",this.pendingAccessibleFocus=target??"base",this.pendingAccessibleFocusOrigin=activeAccessibleCell??void 0,this.restoringAccessibleFocus=!0,this.accessibleFocusGeneration++}if(accessibleModeChanged){const previouslyAccessible=changed.get("accessibleCells")===!0;if(previouslyAccessible&&!this.accessibleCells&&activeAccessibleCell){const key=activeAccessibleCell.dataset.cellKey,target=key?this.accessibleCellAtKey(key):null;target&&(this.focusedCell=target,this.liveText=this.resolveCellText(target)),this.pendingAccessibleFocus="canvas",this.pendingAccessibleFocusOrigin=activeAccessibleCell,this.restoringAccessibleFocus=!0,this.accessibleFocusGeneration++}else if(!previouslyAccessible&&this.accessibleCells&&activeRenderedControl?.matches('[part="canvas"]')){const positions=this.accessibleCellPositions(),target=this.focusedCell?positions.find(pos=>this.samePos(pos,this.focusedCell))??positions[0]??null:positions[0]??null;this.focusedCell=target,this.liveText=target?this.resolveCellText(target):"",this.pendingAccessibleFocus=target??"base",this.pendingAccessibleFocusOrigin=activeRenderedControl,this.restoringAccessibleFocus=!0,this.accessibleFocusGeneration++}}if(!this.hasUpdated||changed.size===0||[...changed.keys()].some(key=>!["hoverCell","focusedCell","liveText"].includes(String(key)))){const bounds=this.cachedValueRange,range=bounds?`${this.formatNumericValue(bounds[0])}–${this.formatNumericValue(bounds[1])}`:this.localize("heatmapNoDataValue"),valueLabel=this.localizedValueLabel();let label;if(this.effectiveMode==="calendar")label=this.localize("heatmapCalendarLabel",void 0,{days:this.formatLocaleNumber(this.cachedCalendarGrid.cells.length),label:valueLabel,range});else{const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;label=this.localize("heatmapMatrixLabel",void 0,{rows:this.formatLocaleNumber(rows),cols:this.formatLocaleNumber(cols),label:valueLabel,range})}const selectedText=this.selectedCellDescription(),authoredLabel=normalizeLabel(this.label);this.accessibleDescription=normalizeLabel(this.description)??(authoredLabel?label:"");const generatedAriaLabel=[authoredLabel??label,selectedText,this.projectionDescription()].filter(Boolean).join(" ");this.generatedAriaLabel=generatedAriaLabel,this.syncingGeneratedSemantics=!0;try{this.authorRole===null&&this.getAttribute("role")!=="group"&&this.setAttribute("role","group"),this.authorAriaLabel===null&&this.getAttribute("aria-label")!==generatedAriaLabel&&this.setAttribute("aria-label",generatedAriaLabel)}finally{this.syncingGeneratedSemantics=!1}}}clearGeneratedSemantics(){if(this.generatedAriaLabel!==""){this.syncingGeneratedSemantics=!0;try{this.authorRole===null&&this.getAttribute("role")==="group"&&this.removeAttribute("role"),this.authorAriaLabel===null&&this.getAttribute("aria-label")===this.generatedAriaLabel&&this.removeAttribute("aria-label"),this.generatedAriaLabel=""}finally{this.syncingGeneratedSemantics=!1}}}rebuildBoundedDecorations(){this.cachedAnnotations=this.annotations.slice(0,MAX_HEATMAP_DECORATIONS).map(entry=>entry??{}),this.cachedLegendStops=(this.legendStops??[]).slice(0,MAX_HEATMAP_DECORATIONS).map(entry=>entry??{}),this.cachedColorSteps=(this.colorSteps??[]).slice(0,MAX_HEATMAP_DECORATIONS),this.warnOnLegendRampMismatch(),this.cachedCalendarAnnotationDates=new Set(this.cachedAnnotations.flatMap(annotation=>annotation.date==null?[]:[annotation.date])),this.cachedMatrixAnnotationPositions=new Set(this.cachedAnnotations.flatMap(annotation=>annotation.row==null||annotation.col==null?[]:[`${annotation.row}:${annotation.col}`])),this.decorationProjectionTruncated=this.annotations.length>MAX_HEATMAP_DECORATIONS||(this.legendStops?.length??0)>MAX_HEATMAP_DECORATIONS||(this.colorSteps?.length??0)>MAX_HEATMAP_DECORATIONS}get ownedInputTruncated(){return["annotations","legendStops","colorSteps","selectedCells"].some(name=>publicCollectionTruncation(this,name)!==void 0)}get projectionTruncated(){return this.decorationProjectionTruncated||this.ownedInputTruncated||(this.effectiveMode==="calendar"?this.cachedCalendarGrid.truncated:this.cachedMatrixData.truncated)}get cellProjectionTruncated(){return this.effectiveMode==="calendar"?this.cachedCalendarGrid.truncated:this.cachedMatrixData.truncated}projectedCellCount(){return this.effectiveMode==="calendar"?this.cachedCalendarGrid.weekCount*7:this.matrixRowLabels.length*this.matrixColLabels.length}projectionDescription(){const messages=[];return this.cellProjectionTruncated&&messages.push(this.localize("heatmapProjectionLimit",void 0,{count:this.formatLocaleNumber(this.projectedCellCount())})),this.decorationProjectionTruncated&&messages.push(this.localize("heatmapDecorationLimit",void 0,{count:this.formatLocaleNumber(MAX_HEATMAP_DECORATIONS)})),this.ownedInputTruncated&&messages.push(this.localize("heatmapInputLimit")),messages.join(" ")}rebuildCanonicalMatrixData(){if(this.data.kind!=="matrix"){this.cachedMatrixData={rowLabels:[],colLabels:[],values:[],truncated:!1};return}const own=(value,key)=>{if(!value||typeof value!="object")return;const descriptor=getOwnDataDescriptor(value,key);return typeof descriptor=="object"?descriptor.value:void 0},rows=own(this.data,"rowLabels"),cols=own(this.data,"colLabels"),source=own(this.data,"values"),count=value=>{const length=own(value,"length");return finiteCount(typeof length=="number"?length:0,0)},colCount=Math.min(count(cols),this.cellBudget),rowLimit=colCount===0?this.cellBudget:Math.floor(this.cellBudget/colCount),rowCount=Math.min(count(rows),rowLimit),labels=(source2,length)=>{const result=new Array(length);if(!source2||typeof source2!="object")return result;for(let index=0;index<length;index++){const descriptor=getOwnDataDescriptor(source2,String(index));if(typeof descriptor!="object")continue;const value=descriptor.value;result[index]=value===null||typeof value!="object"&&typeof value!="function"?String(value):""}return result},rowLabels=labels(rows,rowCount),colLabels=labels(cols,colCount);let truncated=rowCount!==count(rows)||colCount!==count(cols)||count(source)>rowCount;const values=Array.from({length:rowCount},(_,row)=>{const input=own(source,String(row));return count(input)>colCount&&(truncated=!0),Array.from({length:colCount},(_2,col)=>{const value=own(input,String(col));return typeof value=="number"?value:this.signedDomain?Number.NaN:-1})});this.cachedMatrixData={rowLabels,colLabels,values,truncated}}selectedCellDescription(){if(this.multiple){const count=this.currentSelectedPositions.size;return count?this.localize("heatmapSelectedCount",void 0,{count:this.formatLocaleNumber(count)}):""}if(!this.selectedCell)return"";if(this.effectiveMode==="calendar"){if(this.selectedCell.date==null)return"";const match=this.cachedCalendarCellsByDate.get(this.selectedCell.date);return match?this.localize("heatmapSelectedCellLabel",void 0,{cell:this.calendarCellText({week:match.week,weekday:match.weekday,date:match.date})}):""}const{row,col}=this.selectedCell;return row==null||col==null||row<0||row>=this.matrixRowLabels.length||col<0||col>=this.matrixColLabels.length?"":this.localize("heatmapSelectedCellLabel",void 0,{cell:this.matrixCellText({row,col})})}computeValueRange(){const pinned=this.domain;if(pinned){const[lo,hi]=pinned;if(Number.isFinite(lo)&&Number.isFinite(hi)&&lo!==hi)return lo<hi?[lo,hi]:[hi,lo]}const source=this.effectiveMode==="calendar"?this.cachedCalendarGrid.cells.map(cell=>cell.value):this.matrixValues.flat();return minMax(source.filter(v=>!this.isNoData(v)))}localizedValueLabel(){return this.valueLabel===void 0?this.localize("heatmapValueLabel"):this.valueLabel}formatNumericValue(value){return formatChartValue(value,this.effectiveLocale)}syncExternalDescription(){const describedBy=this.getAttribute("aria-describedby");if(!describedBy&&!this.hasSyncedDescribedByElements)return;const control=this.accessibleCells?this.renderRoot.querySelector('[part="cells"]'):this.canvas;this.hasSyncedDescribedByElements=syncAriaDescribedByElements(this,control??void 0,describedBy)}updated(changed){super.updated(changed),this.syncTooltipOverlay();const locale=this.effectiveLocale,localeChanged=this.lastUpdatedLocale!==locale;if(this.lastUpdatedLocale=locale,this.matrixSource){this.matrixController&&sourceUpdated(this);return}this.syncExternalDescription(),this.syncAccessibleTabStop();const notice=this.projectionDescription();if(!this.initialLimitUpdate&&notice&&notice!==this.lastLimitNotice&&this.announcements.announcePolite(notice),this.initialLimitUpdate=!1,this.lastLimitNotice=notice,this.hoverCell&&this.scheduleAfterUpdate(()=>this.measureTooltip(),"heatmap-tooltip-metrics"),["data","maxCells","cellSize","rowHeight","cellGapX","cellGapY","cellRadius","colLabelInterval","maxCellSize","minCellSize","valueLabel","scale","domain","midpoint","fitToWidth","rowLabelWidth","colLabelHeight","colLabelRotation","bucketCount","annotations","focusedCell","colorSteps","cellColor","selectedCell","selectedCells","multiple","selectionPreview","legendStops","accessibleCells","accessibleTargetSizePx","locale","stickyLabels","fill","fitBlock"].some(name=>changed.has(name))||localeChanged){if(!localeChanged&&changed.has("focusedCell")&&[...changed.keys()].every(key=>key==="focusedCell"||key==="liveText")&&this.repaintFocusRing(changed.get("focusedCell")))return;const smallSelection=this.pendingSelectionRepaint,onlySelectionAndFocus=[...changed.keys()].every(key=>["selectedCells","focusedCell","liveText"].includes(String(key))),repainted=!localeChanged&&smallSelection!==void 0&&onlySelectionAndFocus&&(!changed.has("focusedCell")||this.repaintFocusRing(changed.get("focusedCell")))&&smallSelection.every(pos=>this.repaintCell(pos));this.pendingSelectionRepaint=void 0,repainted||this.requestDraw()}const pending=this.pendingAccessibleFocus;if(pending===void 0)return;this.pendingAccessibleFocus=void 0;const origin=this.pendingAccessibleFocusOrigin;this.pendingAccessibleFocusOrigin=void 0;const generation=this.accessibleFocusGeneration;this.scheduleAfterUpdate(()=>{try{if(generation!==this.accessibleFocusGeneration||!this.isConnected)return;if(origin){const internalActive=shadowFocusTarget(this),documentActive=activeElementIn(this.ownerDocument),focusStayedAtOrigin=internalActive===origin,originWasRemovedWithoutReplacement=internalActive===null&&(documentActive===null||documentActive===this||documentActive===this.ownerDocument.body);if(!focusStayedAtOrigin&&!originWasRemovedWithoutReplacement)return}if(pending==="base"){this.shadowRoot?.querySelector('[part="base"]')?.focus();return}if(pending==="canvas"){this.shadowRoot?.querySelector('[part="canvas"]')?.focus();return}const identity=this.accessibleCellIdentity(pending);[...this.shadowRoot?.querySelectorAll('[part="cell"]')??[]].find(candidate=>candidate.dataset.cellIdentity===identity)?.focus()}finally{this.restoringAccessibleFocus=!1}},"heatmap-accessible-focus")}refreshTheme(){this.resolvedStepsMemo=void 0,this.cachedRamp=null,this.refreshAccessibleTargetSize()||this.requestDraw()}themeSignature(){const cs=this.ownerDocument.defaultView?.getComputedStyle(this);return cs?[...this.scaleEndpoints(cs),this.readToken(cs,"no-data-fill",FALLBACK_NO_DATA_FILL),this.labelColor(cs),this.readToken(cs,"label-font",FALLBACK_LABEL_FONT),this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR),this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR),this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR),this.stickyLabelBg(cs),...this.resolvedColorSteps()].join("\0"):""}onThemeSignal(){this.resolvedStepsMemo=void 0;const signature=this.themeSignature(),resized=this.refreshAccessibleTargetSize();signature===this.paintedTheme&&!this.cellColor||(this.paintedTheme=signature,this.cachedRamp=null,resized||this.scheduleDraw())}refreshAccessibleTargetSize(){const raw=this.ownerDocument.defaultView?.getComputedStyle(this).getPropertyValue("--lr-icon-button-size").trim()??"",resolved=resolveCssTokenLength(raw,{host:this}),next=resolved!==void 0&&Number.isFinite(resolved)&&resolved>0?resolved:DEFAULT_ACCESSIBLE_TARGET_SIZE_PX;return next===this.accessibleTargetSizePx?!1:(this.accessibleTargetSizePx=next,!0)}readToken(cs,name,fallback){return cs.getPropertyValue(`--lr-heatmap-${name}`).trim()||cs.getPropertyValue(`--_lr-heatmap-${name}`).trim()||fallback}scaleEndpoints(cs){return[this.readToken(cs,"scale-lo",FALLBACK_SCALE_LO),this.readToken(cs,"scale-hi",FALLBACK_SCALE_HI)]}labelColor(cs){return cs.getPropertyValue("--lr-color-text-quiet").trim()||"#6b7280"}stickyLabelBg(cs){const color=this.readToken(cs,"sticky-label-bg",FALLBACK_STICKY_LABEL_BG);return formatRgb(resolveRgb(color,FALLBACK_STICKY_LABEL_BG,this.ownerDocument))}strokeCellState(ctx,x,y,size,state2,color,paintedShape){const shape=paintedShape??this.calendarCellShape(size),width=shape?.custom?shape.w:size,height=shape?.custom?shape.h:size;shape?.custom&&(ctx.save(),ctx.beginPath(),ctx.roundRect(x,y,shape.w,shape.h,shape.radius),ctx.clip());const inset=Math.min(state2==="annotation"?.5:state2==="selected"?3.5:6.5,Math.max(.5,(Math.min(width,height)-RING_LINE_WIDTH-1)/2)),w=Math.max(1,width-inset*2),h=Math.max(1,height-inset*2);ctx.lineWidth=RING_LINE_WIDTH,ctx.strokeStyle=color,ctx.setLineDash?.(state2==="annotation"?[]:state2==="selected"?[4,2]:[1,2]),shape?.custom&&shape.radius>0?(ctx.beginPath(),ctx.roundRect(x+inset,y+inset,w,h,Math.max(0,shape.radius-inset)),ctx.stroke()):ctx.strokeRect(x+inset,y+inset,w,h),ctx.setLineDash?.([]),shape?.custom&&ctx.restore()}isSelectedPos(pos){return this.multiple?this.currentSelectedPositions.has(this.accessibleCellKey(pos)):this.selectedCell?"week"in pos?this.selectedCell.date==null?!1:this.calendarCellAt(pos).date===this.selectedCell.date:this.selectedCell.row===pos.row&&this.selectedCell.col===pos.col:!1}draw(){if(this.matrixSource){this.matrixController&&paintSource(this);return}if(!this.canvasVisible){this.drawDirty=!0;return}this.syncDeferredFitFrame(!1),this.drawDirty=!1,this.canvasHasContent=!1,this.paintedTheme??=this.themeSignature(),this.effectiveMode==="calendar"?this.drawCalendar():this.drawMatrix()}requestDraw(){this.drawDirty=!0,this.isConnected&&(this.canvasVisible?this.draw():this.syncDeferredFitFrame(!0))}syncDeferredFitFrame(deferred){const base=this.shadowRoot?.querySelector('[part="base"]');if(!base)return;let contained=!1;deferred&&this.fitToWidth&&this.clientWidth>0&&(contained=(this.effectiveMode==="calendar"?this.columnXFor(Math.max(1,this.cachedCalendarGrid.weekCount)):this.matrixPadLeft+this.matrixColLabels.length*this.matrixCellSize(this.matrixColLabels.length))<=this.clientWidth),base.toggleAttribute("data-fit-frame-contained",contained)}ringedCell(){return this.canvasBlurred?null:this.focusedCell}repaintFocusRing(previous){if(!this.canvasHasContent||!this.canvas||this.drawDirty)return!1;const current=this.ringedCell();if(this.effectiveMode==="calendar"){if(previous&&!("week"in previous)||current&&!("week"in current))return!1;this.repaintCalendarFocusCell(previous&&"week"in previous?previous:null),current&&(!previous||!this.samePos(previous,current))&&this.repaintCalendarFocusCell(current)}else{if(previous&&!("row"in previous)||current&&!("row"in current))return!1;this.repaintMatrixFocusCell(previous&&"row"in previous?previous:null),current&&(!previous||!this.samePos(previous,current))&&this.repaintMatrixFocusCell(current)}return!0}cancelDrawFrame(){const request=this.drawFrameRequest;request&&request.owner.cancelAnimationFrame(request.handle),this.drawFrameRequest=void 0}resolveColorStep(color,fallback){const safe=sanitizeCssColor(color);if(!safe)return fallback;const ctx=SCOPED_COLOR.test(safe)?null:getScratchCtx(this.ownerDocument);return ctx?(ctx.fillStyle=safe,ctx.fillStyle):resolveCanvasColor(this,safe,fallback)}resolvedColorSteps(){const source=this.cachedColorSteps;return(this.resolvedStepsMemo?.source!==source||this.resolvedStepsMemo.document!==this.ownerDocument)&&(this.resolvedStepsMemo={source,document:this.ownerDocument,colors:source.map(step=>this.resolveColorStep(step,""))}),this.resolvedStepsMemo.colors}colorRamp(bucketCount,cs){const steps=this.cachedColorSteps;if(steps&&steps.length>=2){const key2=`steps ${steps.join(" ")}`;if(this.cachedRamp?.key===key2)return this.cachedRamp;const resolved=this.resolvedColorSteps().map((color,index)=>color||(index===steps.length-1?FALLBACK_SCALE_HI:FALLBACK_SCALE_LO)),colors2=resolved.map(color=>formatRgb(resolveRgb(color,FALLBACK_SCALE_LO,this.ownerDocument))),loRgb2=resolveRgb(resolved[0],FALLBACK_SCALE_LO,this.ownerDocument),hiRgb2=resolveRgb(resolved[resolved.length-1],FALLBACK_SCALE_HI,this.ownerDocument);return this.cachedRamp={key:key2,colors:colors2,loRgb:loRgb2,hiRgb:hiRgb2},this.cachedRamp}const[scaleLo,scaleHi]=this.scaleEndpoints(cs),normalizedBucketCount=normalizeBucketCount(bucketCount),key=`${scaleLo}\0${scaleHi}\0${normalizedBucketCount}`;if(this.cachedRamp?.key===key)return this.cachedRamp;const loRgb=resolveRgb(scaleLo,FALLBACK_SCALE_LO,this.ownerDocument),hiRgb=resolveRgb(scaleHi,FALLBACK_SCALE_HI,this.ownerDocument),colors=Array.from({length:normalizedBucketCount},(_,i)=>mixRgb(loRgb,hiRgb,i/(normalizedBucketCount-1)));return this.cachedRamp={key,colors,loRgb,hiRgb},this.cachedRamp}calendarCellSize(){return this.calendarSpacing().cellSize}calendarSpacing(){const{weekCount}=this.cachedCalendarGrid,rawGapX=this.explicitCalendarSpacing("cellGapX"),rawGapY=this.explicitCalendarSpacing("cellGapY"),rawRadius=this.explicitCalendarSpacing("cellRadius"),boundGap=(raw,size2)=>raw===void 0?CAL_GAP:finiteRange(raw,CAL_GAP,0,Math.max(0,size2-1));let size;if(this.fitToWidth&&weekCount>0){const fitGap=boundGap(rawGapX,this.cellSize),hostWidth=this.clientWidth||this.calendarPadLeft+weekCount*(this.cellSize+fitGap);size=this.clampFitCellSize((hostWidth-this.calendarPadLeft)/weekCount-fitGap)}else size=this.cellSize;return this.accessibleCells&&(size=Math.max(size,this.accessibleTargetSizePx)),{cellSize:size,gapX:boundGap(rawGapX,size),gapY:boundGap(rawGapY,size),radius:rawRadius===void 0?0:finiteRange(rawRadius,0,0,size/2)}}clampFitCellSize(size){const floored=finiteRange(size,FIT_MIN_CELL,Math.max(FIT_MIN_CELL,this.minCellSize??FIT_MIN_CELL));return this.maxCellSize==null?floored:Math.min(floored,this.maxCellSize)}columnXFor(week){return(this.calendarPaintColumns??this.calendarColumnPositions())[week]??this.calendarPadLeft}rowYFor(weekday){return(this.calendarPaintRows??this.calendarRowPositions())[weekday]??CAL_LABEL_H}calendarColumnPositions(spacing=this.calendarSpacing()){const{cellSize,gapX:gap}=spacing,weekCount=this.cachedCalendarGrid.weekCount,callback=this.calendarColumnX,padLeft=this.calendarPadLeft,cached=this.cachedColumnGeometry;if(cached!==void 0&&cached.callback===callback&&cached.padLeft===padLeft&&cached.cellSize===cellSize&&cached.gap===gap&&cached.weekCount===weekCount)return cached.positions;const positions=[];for(let index=0;index<=weekCount;index++){const fallback=index===0?padLeft:positions[index-1]+cellSize+gap;let candidate=fallback;if(callback)try{const supplied=callback(index);Number.isFinite(supplied)&&supplied>=0&&(index===0||supplied>=positions[index-1]+cellSize)&&(candidate=supplied)}catch{candidate=fallback}positions.push(candidate)}return this.cachedColumnGeometry={callback,padLeft,cellSize,gap,weekCount,positions},positions}calendarRowPositions(spacing=this.calendarSpacing()){const{cellSize,gapY:gap}=spacing,callback=this.calendarRowY,cached=this.cachedRowGeometry;if(cached!==void 0&&cached.callback===callback&&cached.cellSize===cellSize&&cached.gap===gap)return cached.positions;const positions=[];for(let index=0;index<=7;index++){const fallback=index===0?CAL_LABEL_H:positions[index-1]+cellSize+gap;let candidate=fallback;if(callback)try{const supplied=callback(index);Number.isFinite(supplied)&&supplied>=0&&(index===0||supplied>=positions[index-1]+cellSize)&&(candidate=supplied)}catch{candidate=fallback}positions.push(candidate)}return this.cachedRowGeometry={callback,cellSize,gap,positions},positions}weekdayLabels(firstWeekStart){const formatter=getDateTimeFormat(this.effectiveLocale||void 0,{weekday:"short",timeZone:"UTC"}),labels=["","","","","","",""];for(const weekday of[1,3,5]){const row=(weekday-this.normalizedFirstDayOfWeek+7)%7;labels[row]=this.calendarWeekdayLabelText?.(weekday)??formatter.format(new Date(firstWeekStart.getTime()+row*MS_PER_DAY))}return labels}paintCalendarAxisLabels(ctx,cellSize,cs,firstWeekStart,monthLabels,months=!0,weekdays=!0){if(ctx.fillStyle=this.labelColor(cs),ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT),months){const canvasRight=this.columnXFor(Math.max(1,this.cachedCalendarGrid.weekCount)),placed=[];monthLabels.forEach((month,index)=>{const label=this.ellipsize(ctx,month.label,canvasRight);if(!label)return;const width=this.labelWidth(ctx,label),x=Math.max(0,Math.min(this.columnXFor(month.week),canvasRight-width)),nextWeek=monthLabels[index+1]?.week??Math.max(month.week+1,this.cachedCalendarGrid.weekCount),entry={label,x,end:x+width+CAL_MONTH_LABEL_GAP,span:nextWeek-month.week};let previous=placed[placed.length-1];for(;previous&&entry.x<previous.end&&entry.span>previous.span;)placed.pop(),previous=placed[placed.length-1];previous&&entry.x<previous.end||placed.push(entry)});for(const{label,x}of placed)ctx.fillText(label,x,CAL_LABEL_H-4)}if(weekdays){const available=this.calendarPadLeft-CAL_WEEKDAY_LABEL_INSET*2;this.weekdayLabels(firstWeekStart).forEach((label,weekday)=>{const shown=label?this.ellipsize(ctx,label,available):"";shown&&ctx.fillText(shown,CAL_WEEKDAY_LABEL_INSET,this.rowYFor(weekday)+cellSize-1)})}}drawCalendar(){try{this.withLabelCache(()=>this.paintCalendar())}finally{this.calendarPaintColumns=void 0,this.calendarPaintRows=void 0}}paintCalendar(){if(!this.canvas)return;const{weekCount,firstWeekStart,monthLabels}=this.cachedCalendarGrid,cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;this.calendarWeekdayLabelWidth==="auto"&&(this.resolvedCalendarWeekdayLabelWidth=this.measureCalendarWeekdayLabelWidth(cs,firstWeekStart));const spacing=this.calendarSpacing(),cellSize=spacing.cellSize;this.calendarPaintColumns=this.calendarColumnPositions(spacing),this.calendarPaintRows=this.calendarRowPositions(spacing);const w=this.columnXFor(Math.max(1,weekCount)),h=this.rowYFor(7),ctx=this.sizeCanvas(this.canvas,w,h);if(!ctx)return;ctx.clearRect(0,0,w,h);const fill=this.fillContext(normalizeBucketCount(this.bucketCount),cs,"calendar");this.canvasColorCache.clear();for(let week=0;week<weekCount;week++)for(let weekday=0;weekday<7;weekday++)this.paintCalendarCell(ctx,week,weekday,cellSize,spacing.radius,fill);if(this.cachedAnnotations.length)for(const ann of this.cachedAnnotations){if(ann.date==null)continue;const match=this.cachedCalendarCellsByDate.get(ann.date);if(!match)continue;const x=this.columnXFor(match.week),y=this.rowYFor(match.weekday);this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR))}for(const match of this.selectedPaintPositions())if("week"in match){const x=this.columnXFor(match.week),y=this.rowYFor(match.weekday);this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR))}const ringed=this.ringedCell();if(ringed&&"week"in ringed){const{week,weekday}=ringed;if(week<weekCount&&weekday<7){const x=this.columnXFor(week),y=this.rowYFor(weekday);this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR))}}this.paintCalendarAxisLabels(ctx,cellSize,cs,firstWeekStart,monthLabels),this.canvasHasContent=!0,this.recordCalendarGeometry(spacing,weekCount)&&this.accessibleCells&&this.scheduleAfterUpdate(()=>this.requestUpdate(),"heatmap-calendar-accessible-geometry")}matrixCellSize(cols){let size;if(this.fitToWidth&&cols>0){const padLeft=this.matrixPadLeft,hostWidth=this.clientWidth||padLeft+cols*this.cellSize;size=this.clampFitCellSize((hostWidth-padLeft)/cols)}else size=this.cellSize;if(!this.accessibleCells)return size;const target=this.accessibleTargetSizePx,custom=finiteNumber(this.cellGapX,1)!==1||finiteNumber(this.cellGapY,1)!==1||finiteRange(this.cellRadius,0,0)>0,gap=this.rowHeight!==void 0?finiteRange(this.cellGapX,1,0,target):custom?Math.max(finiteRange(this.cellGapX,1,0,target),finiteRange(this.cellGapY,1,0,target)):0;return Math.max(size,target+gap)}matrixRowHeight(cellSize){if(this.rowHeight===void 0)return cellSize;const height=finiteRange(this.rowHeight,cellSize,1);if(!this.accessibleCells)return height;const target=this.accessibleTargetSizePx;return Math.max(height,target+finiteRange(this.cellGapY,1,0,target))}matrixCellShape(size,height=this.matrixRowHeight(size)){if(height===size&&finiteNumber(this.cellGapX,1)===1&&finiteNumber(this.cellGapY,1)===1&&finiteRange(this.cellRadius,0,0)===0)return{w:size-1,h:size-1,radius:0,custom:!1};const target=this.accessibleCells?this.accessibleTargetSizePx:1,w=size-finiteRange(this.cellGapX,1,0,Math.max(0,size-Math.min(size,target))),h=height-finiteRange(this.cellGapY,1,0,Math.max(0,height-Math.min(height,target))),radius=finiteRange(this.cellRadius,0,0,Math.min(w,h)/2);return{w,h,radius,custom:height!==size||w!==size-1||h!==size-1||radius!==0}}calendarCellShape(size){const radius=this.calendarSpacing().radius;return radius>0?{w:size,h:size,radius:Math.min(radius,size/2),custom:!0}:void 0}fillMatrixCell(ctx,x,y,shape){shape.radius===0?ctx.fillRect(x,y,shape.w,shape.h):(ctx.beginPath(),ctx.roundRect(x,y,shape.w,shape.h,shape.radius),ctx.fill())}fillContext(bucketCount,cs,mode){const[lo,hi]=this.cachedValueRange??[0,1];return{ramp:this.colorRamp(bucketCount,cs),noData:this.readToken(cs,"no-data-fill",FALLBACK_NO_DATA_FILL),lo,hi,mode,styles:cs}}cellFill(value,override,fill){const{ramp,noData,lo,hi,mode,styles:styles2}=fill;if(override!=null)return this.resolveCellColor(override,styles2);if(this.isNoData(value))return noData;if(this.scale==="sqrt"){const step=sqrtStep(value,hi,ramp.colors.length);return step<0?noData:ramp.colors[step]}return this.cachedColorSteps.length>=2?ramp.colors[this.rampBucket(value,lo,hi,ramp.colors.length)]:mode==="calendar"?ramp.colors[quartileBucket(value,this.cachedCalendarSortedValues,ramp.colors.length)]:mixRgb(ramp.loRgb,ramp.hiRgb,this.rampAlpha(value,lo,hi))}paintMatrixCell(ctx,row,col,x,y,shape,fill){const value=this.matrixValues[row]?.[col]??Number.NaN;ctx.fillStyle=this.cellFill(value,this.cellColor?.({row,col},value),fill),this.fillMatrixCell(ctx,x,y,shape)}paintMatrixFocusOverlays(ctx,row,col,cellSize,rowHeight,shape,cs,state2){const x=this.matrixPadLeft+col*cellSize,y=this.matrixPadTop+row*rowHeight;state2==="annotation"&&this.cachedMatrixAnnotationPositions.has(`${row}:${col}`)&&this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR),shape),state2==="selected"&&this.isSelectedPos({row,col})&&this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR),shape);const focused=this.ringedCell();state2==="focus"&&focused&&"row"in focused&&focused.row===row&&focused.col===col&&this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR),shape)}focusRepaintBounds(ctx,x,y,cellSize,cellHeight=cellSize){const padding=RING_LINE_WIDTH+1,dpr=ctx.getTransform().a,left=Math.floor((x-padding)*dpr)/dpr,top=Math.floor((y-padding)*dpr)/dpr,right=Math.ceil((x+cellSize+padding)*dpr)/dpr,bottom=Math.ceil((y+cellHeight+padding)*dpr)/dpr;return{left,top,width:right-left,height:bottom-top,radius:Math.ceil((2*padding+1/dpr)/cellSize),rowRadius:Math.ceil((2*padding+1/dpr)/cellHeight)}}repaintMatrixFocusCell(pos){this.withLabelCache(()=>this.paintMatrixFocusCell(pos))}paintMatrixFocusCell(pos){if(!pos||!this.canvas)return;const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;if(pos.row<0||pos.row>=rows||pos.col<0||pos.col>=cols)return;const cellSize=this.matrixCellSize(cols),rowHeight=this.matrixRowHeight(cellSize),shape=this.matrixCellShape(cellSize,rowHeight),padLeft=this.matrixPadLeft,padTop=this.matrixPadTop,x=padLeft+pos.col*cellSize,y=padTop+pos.row*rowHeight,ctx=this.canvas.getContext("2d");if(!ctx)return;const cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;const{left,top,width,height,radius,rowRadius}=this.focusRepaintBounds(ctx,x,y,cellSize,rowHeight),firstRow=Math.max(0,pos.row-rowRadius),lastRow=Math.min(rows-1,pos.row+rowRadius),firstCol=Math.max(0,pos.col-radius),lastCol=Math.min(cols-1,pos.col+radius),fill=this.fillContext(RAMP_STEPS,cs,"matrix"),scratch=rowHeight===cellSize?void 0:this.ownerDocument.createElement("canvas"),dpr=ctx.getTransform().a,scratchLeft=Math.floor((this.matrixPadLeft+firstCol*cellSize-RING_LINE_WIDTH-1)*dpr)/dpr,scratchTop=Math.floor((this.matrixPadTop+firstRow*rowHeight-RING_LINE_WIDTH-1)*dpr)/dpr;if(scratch){const right=Math.ceil((this.matrixPadLeft+(lastCol+1)*cellSize+RING_LINE_WIDTH+1)*dpr),bottom=Math.ceil((this.matrixPadTop+(lastRow+1)*rowHeight+RING_LINE_WIDTH+1)*dpr);scratch.width=right-Math.round(scratchLeft*dpr),scratch.height=bottom-Math.round(scratchTop*dpr)}const paintCtx=scratch?.getContext("2d")??ctx;if(scratch&&paintCtx===ctx){this.drawMatrix();return}paintCtx.save();try{scratch?paintCtx.setTransform(dpr,0,0,dpr,-scratchLeft*dpr,-scratchTop*dpr):(paintCtx.beginPath(),paintCtx.rect(left,top,width,height),paintCtx.clip(),paintCtx.clearRect(left,top,width,height));for(let row=firstRow;row<=lastRow;row++)for(let col=firstCol;col<=lastCol;col++)this.paintMatrixCell(paintCtx,row,col,padLeft+col*cellSize,padTop+row*rowHeight,shape,fill);for(const state2 of["annotation","selected","focus"])for(let row=firstRow;row<=lastRow;row++)for(let col=firstCol;col<=lastCol;col++)this.paintMatrixFocusOverlays(paintCtx,row,col,cellSize,rowHeight,shape,cs,state2);left<this.matrixPadLeft&&this.paintMatrixRowLabels(paintCtx,this.matrixPadLeft,this.matrixPadTop,rowHeight,cs,{top,bottom:top+height}),top<this.matrixPadTop&&this.paintMatrixColLabels(paintCtx,this.matrixPadLeft,this.matrixPadTop,cellSize,cs,{first:firstCol,last:lastCol})}finally{paintCtx.restore()}if(scratch){ctx.save();try{ctx.setTransform(1,0,0,1,0,0),ctx.clearRect(left*dpr,top*dpr,width*dpr,height*dpr),ctx.drawImage(scratch,Math.round((left-scratchLeft)*dpr),Math.round((top-scratchTop)*dpr),Math.round(width*dpr),Math.round(height*dpr),Math.round(left*dpr),Math.round(top*dpr),Math.round(width*dpr),Math.round(height*dpr))}finally{ctx.restore()}}}paintCalendarCell(ctx,week,weekday,cellSize,radius,fill){const value=this.calendarValueAt(week,weekday);ctx.fillStyle=this.cellFill(value,this.cellColor?.(this.calendarPos(week,weekday),value),fill),this.fillCalendarCell(ctx,this.columnXFor(week),this.rowYFor(weekday),cellSize,radius)}fillCalendarCell(ctx,x,y,size,radius){radius===0?ctx.fillRect(x,y,size,size):(ctx.beginPath(),ctx.roundRect(x,y,size,size,radius),ctx.fill())}recordCalendarGeometry(spacing,weekCount){const next={padLeft:this.calendarPadLeft,padTop:CAL_LABEL_H,cellSize:spacing.cellSize,cellWidth:spacing.cellSize,cellHeight:spacing.cellSize,cellGapX:spacing.gapX,cellGapY:spacing.gapY,cellRadius:spacing.radius,weekCount,firstDayOfWeek:this.normalizedFirstDayOfWeek},previous=this.lastPaintedCalendarGeometry;if(previous&&Object.keys(next).every(key=>previous[key]===next[key]))return!1;const frozen=Object.freeze(next);return this.lastPaintedCalendarGeometry=frozen,this.emit("lr-calendar-geometry-change",frozen),!0}paintCalendarFocusOverlays(ctx,week,weekday,cellSize,cs,state2){const date=this.calendarDateAt(week,weekday),x=this.columnXFor(week),y=this.rowYFor(weekday);state2==="annotation"&&this.cachedCalendarCellsByDate.has(date)&&this.cachedCalendarAnnotationDates.has(date)&&this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR)),state2==="selected"&&(this.multiple||this.cachedCalendarCellsByDate.has(date))&&this.isSelectedPos({week,weekday,date})&&this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR));const focused=this.ringedCell();state2==="focus"&&focused&&"week"in focused&&focused.week===week&&focused.weekday===weekday&&this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR))}repaintCalendarFocusCell(pos){this.withLabelCache(()=>this.paintCalendarFocusCell(pos))}paintCalendarFocusCell(pos){if(!pos||!this.canvas)return;const{weekCount,firstWeekStart}=this.cachedCalendarGrid;if(pos.week<0||pos.week>=weekCount||pos.weekday<0||pos.weekday>=7)return;const cellSize=this.calendarCellSize(),x=this.columnXFor(pos.week),y=this.rowYFor(pos.weekday),ctx=this.canvas.getContext("2d");if(!ctx)return;const cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;const{left,top,width,height,radius}=this.focusRepaintBounds(ctx,x,y,cellSize),firstWeek=Math.max(0,pos.week-radius),lastWeek=Math.min(weekCount-1,pos.week+radius),firstDay=Math.max(0,pos.weekday-radius),lastDay=Math.min(6,pos.weekday+radius),fill=this.fillContext(normalizeBucketCount(this.bucketCount),cs,"calendar"),cellRadius=this.calendarSpacing().radius;ctx.save();try{ctx.beginPath(),ctx.rect(left,top,width,height),ctx.clip(),ctx.clearRect(left,top,width,height);for(let week=firstWeek;week<=lastWeek;week++)for(let day=firstDay;day<=lastDay;day++)this.paintCalendarCell(ctx,week,day,cellSize,cellRadius,fill);for(const state2 of["annotation","selected","focus"])for(let week=firstWeek;week<=lastWeek;week++)for(let day=firstDay;day<=lastDay;day++)this.paintCalendarFocusOverlays(ctx,week,day,cellSize,cs,state2);this.paintCalendarAxisLabels(ctx,cellSize,cs,firstWeekStart,this.cachedCalendarGrid.monthLabels,top<CAL_LABEL_H,left<this.calendarPadLeft)}finally{ctx.restore()}}drawMatrix(){this.withLabelCache(()=>this.paintMatrix())}paintMatrix(){if(!this.canvas)return;const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length,cs=this.ownerDocument.defaultView?.getComputedStyle(this);if(!cs)return;this.rowLabelWidth==="auto"&&(this.resolvedRowLabelWidth=this.measureRowLabelWidth(cs)),this.colLabelHeight==="auto"&&(this.resolvedColLabelHeight=this.measureColLabelHeight(cs));const padLeft=this.matrixPadLeft,padTop=this.matrixPadTop,cellSize=this.matrixCellSize(cols),rowHeight=this.matrixRowHeight(cellSize),shape=this.matrixCellShape(cellSize,rowHeight),dimensions=shape.custom?{cellWidth:shape.w,cellHeight:shape.h,cellRadius:shape.radius}:{},previous=this.lastPaintedMatrixGeometry,geometry=previous&&previous.padLeft===padLeft&&previous.padTop===padTop&&previous.cellSize===cellSize&&previous.rowHeight===(rowHeight===cellSize?void 0:rowHeight)&&previous.cellWidth===dimensions.cellWidth&&previous.cellHeight===dimensions.cellHeight&&previous.cellRadius===dimensions.cellRadius?previous:Object.freeze({padLeft,padTop,cellSize,...rowHeight===cellSize?{}:{rowHeight},...dimensions});this.lastPaintedMatrixGeometry=geometry;const geometryChanged=geometry!==previous;geometryChanged&&this.emit("lr-matrix-geometry-change",geometry);const w=padLeft+cols*cellSize,h=padTop+rows*rowHeight,ctx=this.sizeCanvas(this.canvas,w,h);if(!ctx)return;ctx.clearRect(0,0,w,h);const fill=this.fillContext(RAMP_STEPS,cs,"matrix");this.canvasColorCache.clear();for(let row=0;row<rows;row++)for(let col=0;col<cols;col++)this.paintMatrixCell(ctx,row,col,padLeft+col*cellSize,padTop+row*rowHeight,shape,fill);if(this.cachedAnnotations.length)for(const ann of this.cachedAnnotations){if(ann.row==null||ann.col==null||ann.row<0||ann.row>=rows||ann.col<0||ann.col>=cols)continue;const x=padLeft+ann.col*cellSize,y=padTop+ann.row*rowHeight;this.strokeCellState(ctx,x,y,cellSize,"annotation",this.readToken(cs,"annotation-color",FALLBACK_ANNOTATION_COLOR),shape)}for(const selected of this.selectedPaintPositions()){if(!("row"in selected))continue;const{row,col}=selected;if(row>=0&&row<rows&&col>=0&&col<cols){const x=padLeft+col*cellSize,y=padTop+row*rowHeight;this.strokeCellState(ctx,x,y,cellSize,"selected",this.readToken(cs,"selected-color",FALLBACK_SELECTED_COLOR),shape)}}const ringedMatrix=this.ringedCell();if(ringedMatrix&&"row"in ringedMatrix){const{row,col}=ringedMatrix;if(row<rows&&col<cols){const x=padLeft+col*cellSize,y=padTop+row*rowHeight;this.strokeCellState(ctx,x,y,cellSize,"focus",this.readToken(cs,"focus-ring-color",FALLBACK_FOCUS_RING_COLOR),shape)}}this.paintMatrixRowLabels(ctx,padLeft,padTop,rowHeight,cs),this.paintMatrixColLabels(ctx,padLeft,padTop,cellSize,cs),this.paintFrozenLabelBands(padLeft,padTop,cellSize,rowHeight,w,h,ctx.getTransform().a,cs),this.canvasHasContent=!0,geometryChanged&&(this.accessibleCells||this.effectiveAxisSelection!=="none")&&this.scheduleAfterUpdate(()=>this.requestUpdate(),"heatmap-matrix-accessible-geometry")}paintMatrixRowLabels(ctx,padLeft,padTop,cellSize,cs,dirty){ctx.fillStyle=this.labelColor(cs),ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);const rowLabelSpace=padLeft-ROW_LABEL_INSET*2;let first=0,last=this.matrixRowLabels.length-1;if(dirty){const{fontBoundingBoxAscent,fontBoundingBoxDescent}=ctx.measureText("M"),baseline=padTop+cellSize/2+3;first=Math.max(first,Math.floor((dirty.top-fontBoundingBoxDescent-baseline)/cellSize)),last=Math.min(last,Math.ceil((dirty.bottom+fontBoundingBoxAscent-baseline)/cellSize))}for(let r=first;r<=last;r++){const shown=this.ellipsize(ctx,this.matrixRowLabels[r],rowLabelSpace);shown&&ctx.fillText(shown,ROW_LABEL_INSET,padTop+r*cellSize+cellSize/2+3)}}paintMatrixColLabels(ctx,padLeft,padTop,cellSize,cs,columns){ctx.fillStyle=this.labelColor(cs),ctx.font=this.readToken(cs,"label-font",FALLBACK_LABEL_FONT);const colRotation=this.effectiveColLabelRotation,interval=finiteInteger(this.colLabelInterval,1,1);if(colRotation===0){const cols=this.matrixColLabels.length;this.matrixColLabels.forEach((label,c)=>{if(c%interval!==0||columns&&(c<columns.first-interval+1||c>columns.last))return;const shown=this.ellipsize(ctx,label,Math.min(interval,cols-c)*cellSize-2);shown&&ctx.fillText(shown,padLeft+c*cellSize+2,padTop-COL_LABEL_INSET)});return}const radians=colRotation*Math.PI/180,previousAlign=ctx.textAlign;ctx.textAlign="right",this.matrixColLabels.forEach((label,c)=>{c%interval===0&&(ctx.save(),ctx.translate(padLeft+c*cellSize+cellSize/2,padTop-COL_LABEL_INSET),ctx.rotate(radians),ctx.fillText(label,0,0),ctx.restore())}),ctx.textAlign=previousAlign}paintFrozenLabelBands(padLeft,padTop,cellSize,rowHeight,width,height,scale,cs){if(this.effectiveStickyLabels==="none")return;const backdrop=this.stickyLabelBg(cs),rowBand=this.frozenBandCanvas("row-labels");rowBand&&this.paintFrozenBand(rowBand,padLeft,height,scale,backdrop,bandCtx=>this.paintMatrixRowLabels(bandCtx,padLeft,padTop,rowHeight,cs));const colBand=this.frozenBandCanvas("col-labels");colBand&&this.paintFrozenBand(colBand,width,padTop,scale,backdrop,bandCtx=>this.paintMatrixColLabels(bandCtx,padLeft,padTop,cellSize,cs))}frozenBandCanvas(part){return this.shadowRoot?.querySelector(`[part="${part}"]`)??null}sizeCanvas(canvas,width,height,desiredScale=this.ownerDocument.defaultView?.devicePixelRatio){const{pixelWidth,pixelHeight,scale}=resolveBoundedCanvasAllocation({cssWidth:width,cssHeight:height,desiredScale,maxDimension:MAX_CANVAS_DIMENSION,maxPixels:MAX_CANVAS_PIXELS});canvas.width=pixelWidth,canvas.height=pixelHeight,canvas.style.width=`${width}px`,canvas.style.height=`${height}px`;const ctx=canvas.getContext("2d");return ctx?.scale(scale,scale),ctx}paintFrozenBand(canvas,width,height,scale,backdrop,paint){const ctx=this.sizeCanvas(canvas,width,height,scale);ctx&&(ctx.clearRect(0,0,width,height),ctx.fillStyle=backdrop,ctx.fillRect(0,0,width,height),paint(ctx))}hitTest(x,y){return this.effectiveMode==="calendar"?this.hitTestCalendar(x,y):this.hitTestMatrix(x,y)}matrixNavigationGeometry(rows,cols){const painted=this.lastPaintedMatrixGeometry;if(painted)return{rows,cols,padLeft:painted.padLeft,padTop:painted.padTop,cellSize:painted.cellSize,rowHeight:painted.rowHeight??painted.cellSize,cellWidth:painted.cellWidth??painted.cellSize-1,cellHeight:painted.cellHeight??painted.cellSize-1,customShape:painted.cellWidth!==void 0};const cellSize=this.matrixCellSize(cols),rowHeight=this.matrixRowHeight(cellSize),shape=this.matrixCellShape(cellSize,rowHeight);return{rows,cols,padLeft:this.matrixPadLeft,padTop:this.matrixPadTop,cellSize,rowHeight,cellWidth:shape.w,cellHeight:shape.h,customShape:shape.custom}}calendarNavigationGeometry(){const spacing=this.calendarSpacing(),cellSize=spacing.cellSize,columnPositions=this.calendarColumnPositions(spacing),rowPositions=this.calendarRowPositions(spacing);return{weekCount:this.cachedCalendarGrid.weekCount,cellSize,columnPositions,rowPositions,padLeft:this.calendarPadLeft,padTop:CAL_LABEL_H}}hitTestMatrix(x,y){const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;return rows===0||cols===0?null:hitTestMatrixGrid(x,y,this.matrixNavigationGeometry(rows,cols),pos=>this.isCellInteractive(pos))}firstInteractiveMatrixCell(rows,cols){return findFirstInteractiveMatrixCell(rows,cols,pos=>this.isCellInteractive(pos))}nextInteractiveMatrixCell(row,col,dRow,dCol,rows,cols){return findNextInteractiveMatrixCell(row,col,dRow,dCol,rows,cols,pos=>this.isCellInteractive(pos))}firstInteractiveCalendarCell(weekCount){return findFirstInteractiveCalendarCell(weekCount,(week,weekday)=>this.calendarPos(week,weekday),pos=>this.isCellInteractive(pos))}nextInteractiveCalendarCell(week,weekday,dWeek,dWeekday,weekCount){return findNextInteractiveCalendarCell(week,weekday,dWeek,dWeekday,weekCount,(nextWeek,nextWeekday)=>this.calendarPos(nextWeek,nextWeekday),pos=>this.isCellInteractive(pos))}hitTestCalendar(x,y){const weekCount=this.cachedCalendarGrid.weekCount;if(weekCount===0)return null;const spacing=this.calendarSpacing(),columnPositions=this.calendarColumnPositions(spacing);return hitTestCalendarGrid(x,y,weekCount,columnPositions,()=>spacing.cellSize,()=>this.calendarRowPositions(spacing),(week,weekday)=>this.calendarPos(week,weekday),pos=>this.isCellInteractive(pos))}calendarCellAt(pos){return readCalendarCell(pos.week,pos.weekday,this.cachedCalendarCellsByPos,this.cachedCalendarDateByPos,this.cachedCalendarGrid.firstWeekStart,this.signedDomain)}calendarValueAt(week,weekday){return readCalendarValue(week,weekday,this.cachedCalendarCellsByPos,this.signedDomain)}calendarDateAt(week,weekday){return readCalendarDate(week,weekday,this.cachedCalendarDateByPos,this.cachedCalendarGrid.firstWeekStart)}calendarPos(week,weekday){return{week,weekday,date:this.calendarDateAt(week,weekday)}}cellRect(pos){return"week"in pos?calendarCellRect(pos.week,pos.weekday,this.calendarNavigationGeometry()):matrixCellRect(pos,this.matrixNavigationGeometry(this.matrixRowLabels.length,this.matrixColLabels.length))}accessibleCellRect(pos){return"week"in pos||!this.lastPaintedMatrixGeometry?this.cellRect(pos):accessibleMatrixCellRect(pos,this.lastPaintedMatrixGeometry)}defaultCellText(pos){return"week"in pos?this.calendarCellText(pos):this.matrixCellText(pos)}matrixCellText(pos){const rowLabel=this.matrixRowLabels[pos.row]??this.localize("heatmapDefaultRowLabel",void 0,{n:this.formatLocaleNumber(pos.row+1)}),colLabel=this.matrixColLabels[pos.col]??this.localize("heatmapDefaultColLabel",void 0,{n:this.formatLocaleNumber(pos.col+1)}),v=this.matrixValues[pos.row]?.[pos.col],valueText=v==null||this.isNoData(v)?this.localize("heatmapNoDataValue"):this.formatNumericValue(v);return this.localize("heatmapMatrixCellLabel",void 0,{row:rowLabel,col:colLabel,value:valueText})}calendarCellText(pos){const{date,value}=this.calendarCellAt(pos),label=getDateTimeFormat(this.effectiveLocale||void 0,{month:"short",day:"numeric",calendar:"gregory",timeZone:"UTC"}).format(parseIsoDate(date)),valueText=this.isNoData(value)?this.localize("heatmapNoDataValue"):this.formatNumericValue(value);return this.localize("heatmapCalendarCellLabel",void 0,{date:label,value:valueText})}valueAt(pos){return"week"in pos?this.calendarCellAt(pos).value:this.matrixValues[pos.row]?.[pos.col]??-1}resolveCellText(pos){return this.cellText?this.cellText(pos,this.valueAt(pos)):this.defaultCellText(pos)}isCellInteractive(pos){return this.cellInteractive?.(pos,this.valueAt(pos))??!0}announce(pos,isSelectedOverride){const text=this.resolveCellText(pos),announcement=isSelectedOverride??this.isSelectedPos(pos)?this.localize("heatmapSelectedCellLabel",void 0,{cell:text}):text;this.liveText=announcement,this.announcements.announcePolite(announcement)}emitCellClick(pos,source="pointer",select=!0,current){if(!this.isCellInteractive(pos)||current&&!current())return;if(this.multiple&&select){const generation=this.sourceBindingGeneration;if(this.selectionAnchor=pos,this.selectionRangeBase=void 0,this.toggleSelectionPositions([pos],source),!this.isConnected||this.matrixSource||this.sourceBindingGeneration!==generation)return}let detail;if("week"in pos){const{date,value}=this.calendarCellAt(pos);detail={date,value}}else{const value=this.matrixValues[pos.row]?.[pos.col]??-1;detail={row:pos.row,col:pos.col,value}}this.emit("lr-cell-activate",{...detail})}get currentSelectedPositions(){return this.selectionPreview??this.selectedPositions}selectedPaintPositions(){if(this.multiple)return[...this.currentSelectedPositions.values()];const selected=this.selectedCell;if(!selected)return[];if(this.effectiveMode==="calendar"){const match=selected.date?this.cachedCalendarCellsByDate.get(selected.date):void 0;return match?[match]:[]}return selected.row!=null&&selected.col!=null?[{row:selected.row,col:selected.col}]:[]}rebuildSelectedPositions(){const positions=new Map,input=Array.isArray(this.selectedCells)?this.selectedCells:[],dates=input.length&&this.effectiveMode==="calendar"?new Map(this.accessibleCellPositions().map(pos=>[this.accessibleCellIdentity(pos),pos])):void 0;for(let index=0;index<Math.min(input.length,MAX_HEATMAP_CELLS);index++){const cell=input[index];if(!cell||typeof cell!="object")continue;const pos=dates?typeof cell.date=="string"?dates.get(cell.date):void 0:Number.isInteger(cell.row)&&Number.isInteger(cell.col)?this.accessibleCellAtKey(`matrix-${cell.row}-${cell.col}`):void 0;pos&&positions.set(this.accessibleCellKey(pos),pos)}this.selectedPositions=positions}selectionCoordinates(pos){return"week"in pos?{row:pos.weekday,col:pos.week}:pos}proposeSelection(positions,source){if(positions.size===this.selectedPositions.size&&[...positions.keys()].every(key=>this.selectedPositions.has(key)))return;this.proposedSelectionKeys=new Set(positions.keys());const selectedCells=[...positions.values()].sort((a,b)=>{const first=this.selectionCoordinates(a),second=this.selectionCoordinates(b);return first.row-second.row||first.col-second.col}).map(pos=>"week"in pos?{date:pos.date}:{row:pos.row,col:pos.col});this.emit("lr-selection-change",{selectedCells,source})}toggleSelectionPositions(positions,source){if(!this.multiple||positions.length===0)return;const next=new Map(this.selectedPositions),remove=positions.every(pos=>next.has(this.accessibleCellKey(pos)));for(const pos of positions){const key=this.accessibleCellKey(pos);remove?next.delete(key):next.set(key,pos)}this.proposeSelection(next,source)}toggleSelectionAxis(index,row){!this.multiple||!Number.isInteger(index)||index<0||(this.cancelSelectionGesture(),this.selectionRangeBase=void 0,this.toggleSelectionPositions(this.accessibleCellPositions().filter(pos=>{const coordinates=this.selectionCoordinates(pos);return(row?coordinates.row:coordinates.col)===index}),row?"row":"column"))}selectionKeyDown(event,pos){if(!this.multiple||isHandledOrComposingKey(event)||event.altKey)return!1;if(event.key==="Escape"&&this.selectionGesture&&!shouldIgnoreNavigationKey(event))return event.preventDefault(),this.cancelSelectionGesture(),!0;if(event.key!==" "||!pos||!(event.shiftKey||event.ctrlKey||event.metaKey))return!1;event.preventDefault();const coordinates=this.selectionCoordinates(pos);return event.ctrlKey||event.metaKey?this.toggleColumnSelection(coordinates.col):this.toggleRowSelection(coordinates.row),!0}extendSelection(previous,next,range){if(!this.multiple)return;if(!range){this.selectionAnchor=next,this.selectionRangeBase=void 0;return}this.selectionAnchor??=previous??next,this.selectionRangeBase??=new Map(this.selectedPositions);const from=this.selectionCoordinates(this.selectionAnchor),to=this.selectionCoordinates(next),selected=new Map(this.selectionRangeBase);for(let row=Math.min(from.row,to.row);row<=Math.max(from.row,to.row);row++)for(let col=Math.min(from.col,to.col);col<=Math.max(from.col,to.col);col++){const key=this.effectiveMode==="calendar"?`calendar-${col}-${row}`:`matrix-${row}-${col}`,pos=this.accessibleCellAtKey(key);pos&&selected.set(key,pos)}return this.proposeSelection(selected,"keyboard"),new Set(selected.keys())}selectionPointerPosition(event){if(!this.canvas)return null;const rect=this.canvas.getBoundingClientRect(),scale=layoutScale(this.canvas);return this.hitTest((event.clientX-rect.left)/scale.x,(event.clientY-rect.top)/scale.y)}captureSelectionContext(){const data=this.data,maxCells=this.maxCells,interactive=this.cellInteractive,selected=this.selectedCells,accessible=this.accessibleCells,source=this.matrixSource,owner=this.ownerDocument;return(allowSelectionChange=!1)=>this.isConnected&&this.ownerDocument===owner&&this.multiple&&this.data===data&&Object.is(this.maxCells,maxCells)&&this.cellInteractive===interactive&&this.accessibleCells===accessible&&this.matrixSource===source&&(allowSelectionChange||this.selectedCells===selected)}paintSelectionTo(pos){const gesture=this.selectionGesture;if(!gesture)return;this.samePos(pos,gesture.previous)||(gesture.moved=!0);const from=this.selectionCoordinates(gesture.previous),to=this.selectionCoordinates(pos),steps=Math.max(Math.abs(to.row-from.row),Math.abs(to.col-from.col),1),changed=[];for(let step=0;step<=steps;step++){const row=Math.round(from.row+(to.row-from.row)*step/steps),col=Math.round(from.col+(to.col-from.col)*step/steps),key=this.effectiveMode==="calendar"?`calendar-${col}-${row}`:`matrix-${row}-${col}`,candidate=this.accessibleCellAtKey(key);candidate&&(gesture.cells.has(key)!==gesture.selecting&&changed.push(candidate),gesture.selecting?gesture.cells.set(key,candidate):gesture.cells.delete(key))}if(gesture.previous=pos,this.selectionPreview!==gesture.cells){this.selectionPreview=gesture.cells;return}this.requestUpdate(),(changed.length>16||!changed.every(cell=>this.repaintCell(cell)))&&this.requestDraw()}repaintCell(pos){return!this.canvasHasContent||!this.canvas||this.drawDirty?!1:("week"in pos?this.repaintCalendarFocusCell(pos):this.repaintMatrixFocusCell(pos),!0)}cancelSelectionGesture(pointerEnded=!1){const gesture=this.selectionGesture;this.selectionGesture=void 0,this.selectionPreview=void 0,gesture&&(pointerEnded||(this.canceledSelectionPointer=gesture.pointerId),this.suppressNextSelectionClick(),releasePointer(gesture.target,gesture.pointerId))}suppressNextSelectionClick(){const view=this.ownerDocument.defaultView;view&&(this.releaseSelectionClick?.(),this.selectionClickKey??=nextId("heatmap-selection"),this.releaseSelectionClick=armClickSuppression(view,this.selectionClickKey))}consumeSelectionClick(event){return event.detail!==0&&this.selectionClickKey!==void 0&&consumeSuppressedClick(event,this.selectionClickKey)}get gridScrollportRendered(){return this.effectiveStickyLabels!=="none"||(this.fill||this.fitBlock)&&this.effectiveMode==="matrix"}get gridScrollport(){return this.shadowRoot?.querySelector('[part="grid"]')??null}measureTooltip(){const tooltip=this.shadowRoot?.querySelector('[part="tooltip"]');if(!tooltip||tooltip.hidden)return;const view=this.ownerDocument.defaultView,gap=view?Math.abs(finiteNumber(Number.parseFloat(view.getComputedStyle(tooltip).marginBlockStart),0)):0,inline=tooltip.offsetWidth,block=tooltip.offsetHeight+gap;inline===this.tooltipSize.inline&&block===this.tooltipSize.block||(this.tooltipSize={inline,block},this.requestUpdate())}tooltipAnchor(pos){const rect=this.cellRect(pos),center=rect.x+rect.w/2,port=this.gridScrollport,frame=port??this.shadowRoot?.querySelector('[part="base"]');if(!frame)return{style:{left:`${center}px`,top:`${rect.y}px`},below:!1};const{inline,block}=this.tooltipSize,scrollLeft=port?.scrollLeft??0,scrollTop=port?.scrollTop??0,windowStart=scrollLeft+(port&&this.freezesRowLabels?this.matrixPadLeft:0),windowEnd=scrollLeft+frame.clientWidth,windowTop=scrollTop+(port&&this.freezesColLabels?this.matrixPadTop:0),windowBottom=scrollTop+frame.clientHeight,below=rect.y-block<windowTop&&rect.y+rect.h+block<=windowBottom;return{style:{left:`${Math.max(windowStart+inline/2,Math.min(center,windowEnd-inline/2))}px`,top:`${below?rect.y+rect.h:rect.y}px`},below}}scrollCellIntoView(pos){const port=this.gridScrollport;if(!port)return;const rect=this.cellRect(pos),bandInline=this.freezesRowLabels?this.matrixPadLeft:0,bandBlock=this.freezesColLabels?this.matrixPadTop:0,left=Math.min(Math.max(port.scrollLeft,rect.x+rect.w-port.clientWidth),rect.x-bandInline),top=Math.min(Math.max(port.scrollTop,rect.y+rect.h-port.clientHeight),rect.y-bandBlock);left!==port.scrollLeft&&(port.scrollLeft=left),top!==port.scrollTop&&(port.scrollTop=top)}samePos(a,b){return a===b?!0:!a||!b?!1:"week"in a&&"week"in b?a.week===b.week&&a.weekday===b.weekday:"row"in a&&"row"in b?a.row===b.row&&a.col===b.col:!1}edgeCell(e){if(e.key!=="Home"&&e.key!=="End")return null;const row=this.focusedCell&&!(e.ctrlKey||e.metaKey)?this.selectionCoordinates(this.focusedCell).row:void 0,cells=this.accessibleCellPositions().filter(pos=>row===void 0||this.selectionCoordinates(pos).row===row);return cells[e.key==="Home"?0:cells.length-1]??null}navigateGridKey(e){const previous=this.focusedCell,edge=this.edgeCell(e);if(edge?(e.preventDefault(),this.focusedCell=edge,this.scrollCellIntoView(edge)):this.effectiveMode==="calendar"?this.onCalendarKeyDown(e):this.onMatrixKeyDown(e),(edge||ARROW_KEYS.has(e.key))&&this.focusedCell){const proposedKeys=this.extendSelection(previous,this.focusedCell,e.shiftKey);this.announce(this.focusedCell,proposedKeys?.has(this.accessibleCellKey(this.focusedCell)))}}onMatrixKeyDown(e){const rows=this.matrixRowLabels.length,cols=this.matrixColLabels.length;if(rows===0||cols===0)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.focusedCell&&!isRepeatedActivationKey(e)&&this.emitCellClick(this.focusedCell,"keyboard");return}if(!ARROW_KEYS.has(e.key))return;if(e.preventDefault(),!this.focusedCell||!("row"in this.focusedCell)){const next2=this.firstInteractiveMatrixCell(rows,cols);if(!next2)return;this.focusedCell=next2,this.scrollCellIntoView(next2);return}const{row,col}=this.focusedCell;let dRow=0,dCol=0;e.key==="ArrowUp"?dRow=-1:e.key==="ArrowDown"?dRow=1:e.key==="ArrowLeft"?dCol=-1:e.key==="ArrowRight"&&(dCol=1);const next=this.nextInteractiveMatrixCell(row,col,dRow,dCol,rows,cols);this.focusedCell=next,this.scrollCellIntoView(next)}onCalendarKeyDown(e){const{weekCount}=this.cachedCalendarGrid;if(weekCount===0)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.focusedCell&&!isRepeatedActivationKey(e)&&this.emitCellClick(this.focusedCell,"keyboard");return}if(!ARROW_KEYS.has(e.key))return;if(e.preventDefault(),!this.focusedCell||!("week"in this.focusedCell)){const next2=this.firstInteractiveCalendarCell(weekCount);if(!next2)return;this.focusedCell=next2;return}const{week,weekday}=this.focusedCell;let dWeek=0,dWeekday=0;e.key==="ArrowUp"?dWeekday=-1:e.key==="ArrowDown"?dWeekday=1:e.key==="ArrowLeft"?dWeek=-1:e.key==="ArrowRight"&&(dWeek=1);const next=this.nextInteractiveCalendarCell(week,weekday,dWeek,dWeekday,weekCount);this.focusedCell=next}resolveCellColor(value,cs){let color=this.canvasColorCache.get(value);if(color===void 0){const ctx=SCOPED_COLOR.test(value)?null:getScratchCtx(this.ownerDocument);if(ctx){ctx.fillStyle="rgb(1, 2, 3)";const rejected=ctx.fillStyle;ctx.fillStyle=value,ctx.fillStyle!==rejected&&(color=ctx.fillStyle)}color??=resolveCanvasColor(this,value,this.readToken(cs,"no-data-fill",FALLBACK_NO_DATA_FILL)),this.canvasColorCache.set(value,color)}return color}accessibleCellIndex(){if(this.accessibleIndex)return this.accessibleIndex;const positions=[];if(this.effectiveMode==="calendar"){const{weekCount}=this.cachedCalendarGrid;for(let week=0;week<weekCount;week++)for(let weekday=0;weekday<7;weekday++){const pos=this.calendarPos(week,weekday);this.isCellInteractive(pos)&&positions.push(pos)}}else for(let row=0;row<this.matrixRowLabels.length;row++)for(let col=0;col<this.matrixColLabels.length;col++){const pos={row,col};this.isCellInteractive(pos)&&positions.push(pos)}const byKey=new Map;return positions.forEach((position,index)=>byKey.set(this.accessibleCellKey(position),index)),this.accessibleIndex={positions,byKey}}accessibleCellPositions(){return this.accessibleCellIndex().positions}accessibleCellKey(pos){return"week"in pos?`calendar-${pos.week}-${pos.weekday}`:`matrix-${pos.row}-${pos.col}`}accessibleCellIdentity(pos){return"week"in pos?pos.date:this.accessibleCellKey(pos)}accessibleCellAtKey(key){const{positions,byKey}=this.accessibleCellIndex(),index=byKey.get(key);return index===void 0?null:positions[index]}focusAccessibleCell(pos){pos&&this.updateComplete.then(()=>{[...this.shadowRoot?.querySelectorAll('[part="cell"]')??[]].find(candidate=>candidate.dataset.cellKey===this.accessibleCellKey(pos))?.focus()})}accessibleWindowStart(){if(!this.accessibleCells)return 0;const{positions,byKey}=this.accessibleCellIndex(),focusIndex=this.focusedCell?byKey.get(this.accessibleCellKey(this.focusedCell))??0:0;return Math.max(0,Math.min(Math.max(0,positions.length-MAX_ACCESSIBLE_HEATMAP_CELLS),focusIndex-Math.floor(MAX_ACCESSIBLE_HEATMAP_CELLS/2)))}syncAccessibleTabStop(){if(!this.accessibleCells)return;const target=this.focusedCell??this.accessibleCellPositions()[0],key=target?this.accessibleCellKey(target):void 0,previous=this.renderRoot.querySelector('[part="cell"][tabindex="0"]');previous?.dataset.cellKey!==key&&(previous?.setAttribute("tabindex","-1"),key&&this.renderRoot.querySelector(`[data-cell-key="${key}"]`)?.setAttribute("tabindex","0"))}renderAccessibleCells(start){if(!this.accessibleCells)return html``;const positions=this.accessibleCellPositions(),tabStop=this.focusedCell??positions[0]??null,renderedPositions=positions.slice(start,start+MAX_ACCESSIBLE_HEATMAP_CELLS),renderedRows=new Map;for(const pos of renderedPositions){const rowIndex="week"in pos?pos.weekday+1:pos.row+1,row=renderedRows.get(rowIndex);row?row.push(pos):renderedRows.set(rowIndex,[pos])}const rowCount=this.effectiveMode==="calendar"?7:this.matrixRowLabels.length,colCount=this.effectiveMode==="calendar"?this.cachedCalendarGrid.weekCount:this.matrixColLabels.length,calendar=this.effectiveMode==="calendar"?this.calendarNavigationGeometry():void 0;return html`
4
4
  <div part="cells" role="grid" aria-label=${this.authorAriaLabel??this.generatedAriaLabel} aria-rowcount=${rowCount} aria-colcount=${colCount} aria-multiselectable=${this.multiple?"true":nothing} aria-describedby=${[this.getAttribute("aria-describedby")??"",this.accessibleDescription?"description":"",this.projectionTruncated?"projection-limit":""].filter(Boolean).join(" ")||nothing} >
5
5
  ${[...renderedRows].map(([rowIndex,rowPositions])=>html`
6
6
  <div class="cell-row" role="row" aria-rowindex=${rowIndex}>
@@ -47,4 +47,4 @@ import{__decorate}from"tslib";import{layoutScale}from"../../../internal/layout-s
47
47
  >
48
48
  ${legendFirst?nothing:legend}
49
49
  </div>
50
- `}}__decorate([property({attribute:!1,noAccessor:!0})],LyraHeatmap.prototype,"matrixSource",null),__decorate([property({attribute:!1,noAccessor:!0})],LyraHeatmap.prototype,"matrixViewport",null),__decorate([property({attribute:"matrix-reducer"})],LyraHeatmap.prototype,"matrixReducer",void 0),__decorate([state()],LyraHeatmap.prototype,"sourceResult",void 0),__decorate([state()],LyraHeatmap.prototype,"sourceTooltip",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"data",void 0),__decorate([property({converter:blankNumberConverter(1e4),attribute:"max-cells"})],LyraHeatmap.prototype,"maxCells",void 0),__decorate([property({converter:labelExtentConverter,attribute:"row-label-width",reflect:!0})],LyraHeatmap.prototype,"rowLabelWidth",void 0),__decorate([property({converter:labelExtentConverter,attribute:"col-label-height"})],LyraHeatmap.prototype,"colLabelHeight",void 0),__decorate([property({converter:blankNumberConverter(void 0),attribute:"col-label-rotation"})],LyraHeatmap.prototype,"colLabelRotation",void 0),__decorate([property({converter:STICKY_LABELS,attribute:"sticky-labels",reflect:!0})],LyraHeatmap.prototype,"stickyLabels",null),__decorate([property({type:Number,attribute:"cell-size",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"cellSize",null),__decorate([property({type:Number,attribute:"row-height",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"rowHeight",null),__decorate([property({attribute:"value-label"})],LyraHeatmap.prototype,"valueLabel",void 0),__decorate([property({type:Boolean,attribute:"without-legend",reflect:!0})],LyraHeatmap.prototype,"withoutLegend",void 0),__decorate([property({converter:LEGEND_PLACEMENT,attribute:"legend-placement",reflect:!0})],LyraHeatmap.prototype,"legendPlacement",null),__decorate([property({type:Boolean,reflect:!0})],LyraHeatmap.prototype,"fill",void 0),__decorate([property({converter:AXIS_SELECTION,attribute:"axis-selection",reflect:!0})],LyraHeatmap.prototype,"axisSelection",null),__decorate([state()],LyraHeatmap.prototype,"axisFocus",void 0),__decorate([property()],LyraHeatmap.prototype,"scale",void 0),__decorate([property({converter:blankNumberConverter(null),attribute:"cell-gap-x"})],LyraHeatmap.prototype,"cellGapX",void 0),__decorate([property({converter:blankNumberConverter(null),attribute:"cell-gap-y"})],LyraHeatmap.prototype,"cellGapY",void 0),__decorate([property({converter:blankNumberConverter(null),attribute:"cell-radius"})],LyraHeatmap.prototype,"cellRadius",void 0),__decorate([property({converter:blankNumberConverter(1),attribute:"col-label-interval"})],LyraHeatmap.prototype,"colLabelInterval",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"domain",void 0),__decorate([property({converter:blankNumberConverter(void 0)})],LyraHeatmap.prototype,"midpoint",void 0),__decorate([property({type:Boolean,attribute:"fit-to-width"})],LyraHeatmap.prototype,"fitToWidth",void 0),__decorate([property({type:Number,attribute:"max-cell-size",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"maxCellSize",null),__decorate([property({type:Number,attribute:"min-cell-size",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"minCellSize",null),__decorate([property({attribute:"bucket-count",converter:bucketCountConverter})],LyraHeatmap.prototype,"bucketCount",null),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"annotations",void 0),__decorate([property({attribute:!1,hasChanged:legendStopsChanged})],LyraHeatmap.prototype,"legendStops",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"selectedCell",void 0),__decorate([property()],LyraHeatmap.prototype,"label",void 0),__decorate([property()],LyraHeatmap.prototype,"description",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraHeatmap.prototype,"multiple",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"selectedCells",void 0),__decorate([property({type:Boolean,attribute:"accessible-cells"})],LyraHeatmap.prototype,"accessibleCells",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"cellText",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"cellInteractive",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"cellColor",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"colorSteps",void 0),__decorate([query('[part="canvas"]')],LyraHeatmap.prototype,"canvas",void 0),__decorate([state()],LyraHeatmap.prototype,"hoverCell",void 0),__decorate([state()],LyraHeatmap.prototype,"focusedCell",void 0),__decorate([state()],LyraHeatmap.prototype,"liveText",void 0),__decorate([state()],LyraHeatmap.prototype,"accessibleTargetSizePx",void 0),__decorate([state()],LyraHeatmap.prototype,"selectionPreview",void 0);export{LyraHeatmap,MAX_ACCESSIBLE_HEATMAP_CELLS2 as MAX_ACCESSIBLE_HEATMAP_CELLS,MAX_BUCKET_COUNT,MAX_HEATMAP_CELLS2 as MAX_HEATMAP_CELLS,MAX_HEATMAP_DECORATIONS2 as MAX_HEATMAP_DECORATIONS,hexToRgb,normalizeBucketCount2 as normalizeBucketCount,resolveRgb2 as resolveRgb};
50
+ `}}__decorate([property({attribute:!1,noAccessor:!0})],LyraHeatmap.prototype,"matrixSource",null),__decorate([property({attribute:!1,noAccessor:!0})],LyraHeatmap.prototype,"matrixViewport",null),__decorate([property({attribute:"matrix-reducer"})],LyraHeatmap.prototype,"matrixReducer",void 0),__decorate([state()],LyraHeatmap.prototype,"sourceResult",void 0),__decorate([state()],LyraHeatmap.prototype,"sourceTooltip",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"data",void 0),__decorate([property({converter:blankNumberConverter(1e4),attribute:"max-cells"})],LyraHeatmap.prototype,"maxCells",void 0),__decorate([property({converter:labelExtentConverter,attribute:"row-label-width",reflect:!0})],LyraHeatmap.prototype,"rowLabelWidth",void 0),__decorate([property({converter:labelExtentConverter,attribute:"col-label-height"})],LyraHeatmap.prototype,"colLabelHeight",void 0),__decorate([property({converter:blankNumberConverter(void 0),attribute:"col-label-rotation"})],LyraHeatmap.prototype,"colLabelRotation",void 0),__decorate([property({converter:STICKY_LABELS,attribute:"sticky-labels",reflect:!0})],LyraHeatmap.prototype,"stickyLabels",null),__decorate([property({type:Number,attribute:"cell-size",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"cellSize",null),__decorate([property({type:Number,attribute:"row-height",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"rowHeight",null),__decorate([property({attribute:"value-label"})],LyraHeatmap.prototype,"valueLabel",void 0),__decorate([property({type:Boolean,attribute:"without-legend",reflect:!0})],LyraHeatmap.prototype,"withoutLegend",void 0),__decorate([property({converter:LEGEND_PLACEMENT,attribute:"legend-placement",reflect:!0})],LyraHeatmap.prototype,"legendPlacement",null),__decorate([property({type:Boolean,reflect:!0})],LyraHeatmap.prototype,"fill",void 0),__decorate([property({type:Boolean,attribute:"fit-block",reflect:!0})],LyraHeatmap.prototype,"fitBlock",void 0),__decorate([property({converter:AXIS_SELECTION,attribute:"axis-selection",reflect:!0})],LyraHeatmap.prototype,"axisSelection",null),__decorate([state()],LyraHeatmap.prototype,"axisFocus",void 0),__decorate([property()],LyraHeatmap.prototype,"scale",void 0),__decorate([property({converter:blankNumberConverter(null),attribute:"cell-gap-x"})],LyraHeatmap.prototype,"cellGapX",void 0),__decorate([property({converter:blankNumberConverter(null),attribute:"cell-gap-y"})],LyraHeatmap.prototype,"cellGapY",void 0),__decorate([property({converter:blankNumberConverter(null),attribute:"cell-radius"})],LyraHeatmap.prototype,"cellRadius",void 0),__decorate([property({converter:blankNumberConverter(1),attribute:"col-label-interval"})],LyraHeatmap.prototype,"colLabelInterval",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"domain",void 0),__decorate([property({converter:blankNumberConverter(void 0)})],LyraHeatmap.prototype,"midpoint",void 0),__decorate([property({type:Boolean,attribute:"fit-to-width"})],LyraHeatmap.prototype,"fitToWidth",void 0),__decorate([property({type:Number,attribute:"max-cell-size",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"maxCellSize",null),__decorate([property({type:Number,attribute:"min-cell-size",converter:optionalCellSizeConverter})],LyraHeatmap.prototype,"minCellSize",null),__decorate([property({attribute:"bucket-count",converter:bucketCountConverter})],LyraHeatmap.prototype,"bucketCount",null),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"annotations",void 0),__decorate([property({attribute:!1,hasChanged:legendStopsChanged})],LyraHeatmap.prototype,"legendStops",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"selectedCell",void 0),__decorate([property()],LyraHeatmap.prototype,"label",void 0),__decorate([property()],LyraHeatmap.prototype,"description",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraHeatmap.prototype,"multiple",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"selectedCells",void 0),__decorate([property({type:Boolean,attribute:"accessible-cells"})],LyraHeatmap.prototype,"accessibleCells",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"cellText",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"cellInteractive",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"cellColor",void 0),__decorate([property({attribute:!1})],LyraHeatmap.prototype,"colorSteps",void 0),__decorate([query('[part="canvas"]')],LyraHeatmap.prototype,"canvas",void 0),__decorate([state()],LyraHeatmap.prototype,"hoverCell",void 0),__decorate([state()],LyraHeatmap.prototype,"focusedCell",void 0),__decorate([state()],LyraHeatmap.prototype,"liveText",void 0),__decorate([state()],LyraHeatmap.prototype,"accessibleTargetSizePx",void 0),__decorate([state()],LyraHeatmap.prototype,"selectionPreview",void 0);export{LyraHeatmap,MAX_ACCESSIBLE_HEATMAP_CELLS2 as MAX_ACCESSIBLE_HEATMAP_CELLS,MAX_BUCKET_COUNT,MAX_HEATMAP_CELLS2 as MAX_HEATMAP_CELLS,MAX_HEATMAP_DECORATIONS2 as MAX_HEATMAP_DECORATIONS,hexToRgb,normalizeBucketCount2 as normalizeBucketCount,resolveRgb2 as resolveRgb};
@@ -1 +1 @@
1
- import{activeFill,focusRingOffset,focusRingOutline,iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{blockHost}from"../../../internal/layout-fragments.styles.js";const styles=css` .source-axes{display:flex;justify-content:space-between;gap:var(--lr-space-xs);font-size:var(--lr-font-size-sm)}[part=source-exact-window]{overflow:auto;max-inline-size:100%;contain:inline-size}[part=source-exact-window] [role=row]{display:flex;inline-size:max-content}[part=source-exact-window] [role=gridcell]{flex:none}[part=source-exact-window] [part=cell]{position:relative;inline-size:auto;block-size:auto;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);padding:var(--lr-space-xs);white-space:nowrap;color:var(--lr-color-text);background:var(--lr-color-surface);border:var(--lr-border-width-thin) solid var(--lr-color-border)}:host{${blockHost} --_lr-heatmap-scale-lo:var(--lr-color-brand-quiet);--_lr-heatmap-scale-hi:var(--lr-color-brand);--_lr-heatmap-no-data-fill:var(--lr-color-no-data);--_lr-heatmap-label-font:var(--lr-size-10px) var(--lr-font);--_lr-heatmap-tooltip-bg:var(--lr-color-surface);--_lr-heatmap-tooltip-color:var(--lr-color-text);--_lr-heatmap-focus-ring-color:var(--lr-focus-ring-color);--_lr-heatmap-annotation-color:var(--lr-color-danger);--_lr-heatmap-selected-color:var(--lr-color-success);--_lr-heatmap-sticky-label-bg:var(--lr-color-surface)}[part=base]{position:relative;display:flex;flex-direction:column;gap:var(--lr-space-xs);min-inline-size:0;max-inline-size:100%}:host([fill]){block-size:100%;min-block-size:0}:host([fill]) [part=base]{block-size:100%;box-sizing:border-box}:host([fill]) [part=grid]{flex:1 1 auto;min-block-size:0}[part=base]:where([data-fit-frame-contained]){overflow:clip}[part=base]:where([data-fit-frame-contained]) [part=canvas]{max-inline-size:100%}canvas{display:block;inline-size:100%;direction:ltr;cursor:pointer}[part=canvas]:hover{outline:var(--lr-border-width-thin) solid var(--lr-heatmap-hover-ring-color,var(--lr-heatmap-focus-ring-color,var(--_lr-heatmap-focus-ring-color)));${focusRingOffset}}:host([multiple]) [part=canvas],:host([multiple]) [part=cell]{touch-action:none;user-select:none}[part=canvas]:active{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=cells]{position:absolute;inset:0;direction:ltr;pointer-events:none}[part=grid]{position:relative;overflow:auto;direction:ltr;min-inline-size:0;max-inline-size:100%;max-block-size:var(--lr-heatmap-grid-max-block-size,none)}.grid-stack{position:relative;display:grid;grid-template-areas:'stack'}.grid-stack>*{grid-area:stack;align-self:start;justify-self:start}[part=row-labels],[part=col-labels]{position:sticky;display:block;pointer-events:none;z-index:var(--lr-layer-content)}[part=row-labels]{inset-inline-start:0}[part=col-labels]{inset-block-start:0}.cell-row{display:contents}.surface-frame{position:relative}.axis-targets{position:absolute;inset-block-start:0;inset-inline-start:0;direction:ltr;pointer-events:none;z-index:var(--lr-layer-content)}.grid-stack>.axis-targets{position:relative}.grid-stack>.axis-targets[data-frozen-rows]{position:sticky;inset-inline-start:0}.grid-stack>.axis-targets[data-frozen-cols]{position:sticky;inset-block-start:0}[part~=row-label],[part~=col-label]{position:absolute;box-sizing:border-box;padding:0;border:0;border-radius:var(--lr-radius-xs);background:transparent;color:transparent;cursor:pointer;pointer-events:auto;transition:var(--lr-transition-interactive);${iconHitTarget}}[part~=row-label]:disabled,[part~=col-label]:disabled{cursor:default}[part~=row-label-pressed]{box-shadow:inset var(--lr-border-width-thick) 0 0 0 var(--lr-heatmap-axis-pressed-color,var(--lr-color-brand))}[part~=col-label-pressed]{box-shadow:inset 0 calc(-1 * var(--lr-border-width-thick)) 0 0 var(--lr-heatmap-axis-pressed-color,var(--lr-color-brand))}[part~=row-label]:enabled:hover,[part~=col-label]:enabled:hover{background:var(--lr-heatmap-axis-hover-bg,color-mix(in srgb,var(--lr-color-brand) 12%,transparent))}[part~=row-label]:enabled:active,[part~=col-label]:enabled:active{background: ${activeFill("var(--lr-heatmap-axis-hover-bg, color-mix(in srgb, var(--lr-color-brand) 12%, transparent))")}}[part~=row-label]:focus-visible,[part~=col-label]:focus-visible{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=cell]{position:absolute;display:block;padding:0;border:0;border-radius:0;background:transparent;color:transparent;cursor:pointer;pointer-events:auto;${iconHitTarget}}[part=cell]:hover{outline:var(--lr-border-width-thin) solid var(--lr-heatmap-hover-ring-color,var(--lr-heatmap-focus-ring-color,var(--_lr-heatmap-focus-ring-color)));${focusRingOffset}}[part=cell]:active{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=cell]:focus-visible{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=canvas]:focus-visible{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=tooltip]{position:absolute;transform:translate(-50%,-100%);margin-block-start:var(--lr-size-neg-6px);padding:var(--lr-size-2px) var(--lr-size-6px);border-radius:var(--lr-radius);background:var(--lr-heatmap-tooltip-bg,var(--_lr-heatmap-tooltip-bg));color:var(--lr-heatmap-tooltip-color,var(--_lr-heatmap-tooltip-color));font-size:var(--lr-font-size-xs);white-space:nowrap;box-shadow:var(--lr-shadow-m);pointer-events:none;z-index:var(--lr-layer-content)}[part=tooltip],[part=legend-lo],[part=legend-hi],[part=legend-stop-label]{unicode-bidi:plaintext}[part=tooltip].tooltip-below{transform:translate(-50%,0);margin-block-start:var(--lr-size-6px)}[part=tooltip][hidden]{display:none}[part=legend]{display:flex;flex:none;flex-wrap:wrap;align-items:center;gap:var(--lr-heatmap-legend-gap,var(--lr-space-xs));min-inline-size:0;max-inline-size:100%;box-sizing:border-box;padding:var(--lr-heatmap-legend-padding,0);border-radius:var(--lr-heatmap-legend-radius,0);background:var(--lr-heatmap-legend-bg,transparent);font-size:var(--lr-heatmap-legend-font-size,var(--lr-font-size-xs));color:var(--lr-heatmap-legend-color,var(--lr-color-text-quiet));overflow-wrap:anywhere}[part=legend] .bar{flex:0 1 var(--lr-heatmap-legend-ramp-inline-size,var(--lr-size-6rem));min-inline-size:0;inline-size:var(--lr-heatmap-legend-ramp-inline-size,var(--lr-size-6rem));block-size:var(--lr-heatmap-legend-ramp-block-size,var(--lr-size-0-5rem));border-radius:var(--lr-heatmap-legend-ramp-radius,var(--lr-size-2px));background:var(--lr-heatmap-color-steps-gradient,linear-gradient(to right,var(--lr-heatmap-scale-lo,var(--_lr-heatmap-scale-lo)),var(--lr-heatmap-scale-hi,var(--_lr-heatmap-scale-hi))))}:host(:dir(rtl)) [part=legend] .bar{transform:scaleX(-1)}[part=legend-stop]{display:inline-flex;align-items:center;gap:var(--lr-size-3px);min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=legend-swatch]{flex:0 0 auto;inline-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));block-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));border-radius:var(--lr-radius-xs)}[part=legend-stop-label]{min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}[part=legend-lo],[part=legend-hi],[part=legend-value-label]{min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=legend-annotation]{display:inline-flex;align-items:center;gap:var(--lr-size-3px);min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=legend-annotation] .ring-swatch{flex:0 0 auto;inline-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));block-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));border-radius:50%;border:var(--lr-border-width-medium) solid var(--lr-heatmap-annotation-color,var(--_lr-heatmap-annotation-color))}@media (forced-colors:active){[part=legend] .bar,[part=legend-swatch],[part=legend-annotation] .ring-swatch{forced-color-adjust:none;outline:var(--lr-border-width-thin) solid CanvasText}[part~=row-label]:enabled:hover,[part~=col-label]:enabled:hover{border:var(--lr-border-width-thin) solid ButtonText}[part~=row-label-pressed],[part~=col-label-pressed]{border:var(--lr-border-width-thick) solid Highlight}}`;export{styles};
1
+ import{activeFill,focusRingOffset,focusRingOutline,iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{blockHost}from"../../../internal/layout-fragments.styles.js";const styles=css` .source-axes{display:flex;justify-content:space-between;gap:var(--lr-space-xs);font-size:var(--lr-font-size-sm)}[part=source-exact-window]{overflow:auto;max-inline-size:100%;contain:inline-size}[part=source-exact-window] [role=row]{display:flex;inline-size:max-content}[part=source-exact-window] [role=gridcell]{flex:none}[part=source-exact-window] [part=cell]{position:relative;inline-size:auto;block-size:auto;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);padding:var(--lr-space-xs);white-space:nowrap;color:var(--lr-color-text);background:var(--lr-color-surface);border:var(--lr-border-width-thin) solid var(--lr-color-border)}:host{${blockHost} --_lr-heatmap-scale-lo:var(--lr-color-brand-quiet);--_lr-heatmap-scale-hi:var(--lr-color-brand);--_lr-heatmap-no-data-fill:var(--lr-color-no-data);--_lr-heatmap-label-font:var(--lr-size-10px) var(--lr-font);--_lr-heatmap-tooltip-bg:var(--lr-color-surface);--_lr-heatmap-tooltip-color:var(--lr-color-text);--_lr-heatmap-focus-ring-color:var(--lr-focus-ring-color);--_lr-heatmap-annotation-color:var(--lr-color-danger);--_lr-heatmap-selected-color:var(--lr-color-success);--_lr-heatmap-sticky-label-bg:var(--lr-color-surface)}[part=base]{position:relative;display:flex;flex-direction:column;gap:var(--lr-space-xs);min-inline-size:0;max-inline-size:100%}:host([fill]){block-size:100%;min-block-size:0}:host([fill]) [part=base]{block-size:100%;box-sizing:border-box}:host([fill]) [part=grid]{flex:1 1 auto;min-block-size:0}:host([fit-block]){min-block-size:0}:host([fit-block]) [part=base]{max-block-size:inherit;box-sizing:border-box}:host([fit-block]) [part=grid]{flex:1 1 auto;min-block-size:0}[part=base]:where([data-fit-frame-contained]){overflow:clip}[part=base]:where([data-fit-frame-contained]) [part=canvas]{max-inline-size:100%}canvas{display:block;inline-size:100%;direction:ltr;cursor:pointer}[part=canvas]:hover{outline:var(--lr-border-width-thin) solid var(--lr-heatmap-hover-ring-color,var(--lr-heatmap-focus-ring-color,var(--_lr-heatmap-focus-ring-color)));${focusRingOffset}}:host([multiple]) [part=canvas],:host([multiple]) [part=cell]{touch-action:none;user-select:none}[part=canvas]:active{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=cells]{position:absolute;inset:0;direction:ltr;pointer-events:none}[part=grid]{position:relative;overflow:auto;direction:ltr;min-inline-size:0;max-inline-size:100%;max-block-size:var(--lr-heatmap-grid-max-block-size,none)}.grid-stack{position:relative;display:grid;grid-template-areas:'stack'}.grid-stack>*{grid-area:stack;align-self:start;justify-self:start}[part=row-labels],[part=col-labels]{position:sticky;display:block;pointer-events:none;z-index:var(--lr-layer-content)}[part=row-labels]{inset-inline-start:0}[part=col-labels]{inset-block-start:0}.cell-row{display:contents}.surface-frame{position:relative}.axis-targets{position:absolute;inset-block-start:0;inset-inline-start:0;direction:ltr;pointer-events:none;z-index:var(--lr-layer-content)}.grid-stack>.axis-targets{position:relative}.grid-stack>.axis-targets[data-frozen-rows]{position:sticky;inset-inline-start:0}.grid-stack>.axis-targets[data-frozen-cols]{position:sticky;inset-block-start:0}[part~=row-label],[part~=col-label]{position:absolute;box-sizing:border-box;padding:0;border:0;border-radius:var(--lr-radius-xs);background:transparent;color:transparent;cursor:pointer;pointer-events:auto;transition:var(--lr-transition-interactive);${iconHitTarget}}[part~=row-label]:disabled,[part~=col-label]:disabled{cursor:default}[part~=row-label-pressed]{box-shadow:inset var(--lr-border-width-thick) 0 0 0 var(--lr-heatmap-axis-pressed-color,var(--lr-color-brand))}[part~=col-label-pressed]{box-shadow:inset 0 calc(-1 * var(--lr-border-width-thick)) 0 0 var(--lr-heatmap-axis-pressed-color,var(--lr-color-brand))}[part~=row-label]:enabled:hover,[part~=col-label]:enabled:hover{background:var(--lr-heatmap-axis-hover-bg,color-mix(in srgb,var(--lr-color-brand) 12%,transparent))}[part~=row-label]:enabled:active,[part~=col-label]:enabled:active{background: ${activeFill("var(--lr-heatmap-axis-hover-bg, color-mix(in srgb, var(--lr-color-brand) 12%, transparent))")}}[part~=row-label]:focus-visible,[part~=col-label]:focus-visible{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=cell]{position:absolute;display:block;padding:0;border:0;border-radius:0;background:transparent;color:transparent;cursor:pointer;pointer-events:auto;${iconHitTarget}}[part=cell]:hover{outline:var(--lr-border-width-thin) solid var(--lr-heatmap-hover-ring-color,var(--lr-heatmap-focus-ring-color,var(--_lr-heatmap-focus-ring-color)));${focusRingOffset}}[part=cell]:active{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=cell]:focus-visible{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=canvas]:focus-visible{${focusRingOutline("var(--lr-heatmap-focus-ring-color, var(--_lr-heatmap-focus-ring-color))")} ${focusRingOffset}}[part=tooltip]{position:absolute;transform:translate(-50%,-100%);margin-block-start:var(--lr-size-neg-6px);padding:var(--lr-size-2px) var(--lr-size-6px);border-radius:var(--lr-radius);background:var(--lr-heatmap-tooltip-bg,var(--_lr-heatmap-tooltip-bg));color:var(--lr-heatmap-tooltip-color,var(--_lr-heatmap-tooltip-color));font-size:var(--lr-font-size-xs);white-space:nowrap;box-shadow:var(--lr-shadow-m);pointer-events:none;z-index:var(--lr-layer-content)}[part=tooltip],[part=legend-lo],[part=legend-hi],[part=legend-stop-label]{unicode-bidi:plaintext}[part=tooltip].tooltip-below{transform:translate(-50%,0);margin-block-start:var(--lr-size-6px)}[part=tooltip][hidden]{display:none}[part=legend]{display:flex;flex:none;flex-wrap:wrap;align-items:center;gap:var(--lr-heatmap-legend-gap,var(--lr-space-xs));justify-content:var(--lr-heatmap-legend-justify,normal);--_lr-heatmap-legend-offset:calc(var(--lr-heatmap-legend-offset, var(--lr-space-xs)) - var(--lr-space-xs));margin-block-start:var(--_lr-heatmap-legend-offset);min-inline-size:0;max-inline-size:100%;box-sizing:border-box;padding:var(--lr-heatmap-legend-padding,0);border-radius:var(--lr-heatmap-legend-radius,0);background:var(--lr-heatmap-legend-bg,transparent);font-family:var(--lr-heatmap-legend-font-family,inherit);font-size:var(--lr-heatmap-legend-font-size,var(--lr-font-size-xs));color:var(--lr-heatmap-legend-color,var(--lr-color-text-quiet));overflow-wrap:anywhere;border-block-start:var(--lr-heatmap-legend-divider,none)}:host([legend-placement=top]) [part=legend]{margin-block:0 var(--_lr-heatmap-legend-offset);border-block-start:none;border-block-end:var(--lr-heatmap-legend-divider,none)}[part=legend] .bar{flex:0 1 var(--lr-heatmap-legend-ramp-inline-size,var(--lr-size-6rem));min-inline-size:0;inline-size:var(--lr-heatmap-legend-ramp-inline-size,var(--lr-size-6rem));block-size:var(--lr-heatmap-legend-ramp-block-size,var(--lr-size-0-5rem));border-radius:var(--lr-heatmap-legend-ramp-radius,var(--lr-size-2px));background:var(--lr-heatmap-color-steps-gradient,linear-gradient(to right,var(--lr-heatmap-scale-lo,var(--_lr-heatmap-scale-lo)),var(--lr-heatmap-scale-hi,var(--_lr-heatmap-scale-hi))))}:host(:dir(rtl)) [part=legend] .bar{transform:scaleX(-1)}[part=legend-stop]{display:inline-flex;align-items:center;gap:var(--lr-size-3px);min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=legend-swatch]{flex:0 0 auto;inline-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));block-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));border-radius:var(--lr-heatmap-legend-swatch-radius,var(--lr-radius-xs))}[part=legend-stop-label]{min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}[part=legend-lo],[part=legend-hi],[part=legend-value-label]{min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=legend-annotation]{display:inline-flex;align-items:center;gap:var(--lr-size-3px);min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=legend-annotation] .ring-swatch{flex:0 0 auto;inline-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));block-size:var(--lr-heatmap-legend-swatch-size,var(--lr-size-0-6rem));border-radius:50%;border:var(--lr-border-width-medium) solid var(--lr-heatmap-annotation-color,var(--_lr-heatmap-annotation-color))}@media (forced-colors:active){[part=legend] .bar,[part=legend-swatch],[part=legend-annotation] .ring-swatch{forced-color-adjust:none;outline:var(--lr-border-width-thin) solid CanvasText}[part~=row-label]:enabled:hover,[part~=col-label]:enabled:hover{border:var(--lr-border-width-thin) solid ButtonText}[part~=row-label-pressed],[part~=col-label-pressed]{border:var(--lr-border-width-thick) solid Highlight}}`;export{styles};
@@ -46,6 +46,7 @@ readonly exactValue?:string;}
46
46
  * @cssprop [--lr-stat-bg=var(--lr-color-surface)] - Resting background of the card. The pressed
47
47
  * fill of a linked card mixes from this value too, so one override retints both. `frame="plain"`
48
48
  * still paints transparent.
49
+ * @cssprop [--lr-stat-radius=var(--lr-radius)] - Corner radius of the card.
49
50
  * @cssprop [--lr-stat-padding=var(--lr-space-m)] - Padding of the card, read by both `[part="base"]`
50
51
  * and the linked-card content wrapper so a linked and unlinked stat never drift. The compact
51
52
  * density (`size="s"` and below) and `frame="plain"` read the same property with their own
@@ -54,6 +55,8 @@ readonly exactValue?:string;}
54
55
  * @cssprop [--lr-stat-gap=var(--lr-space-xs)] - Gap between the card's stacked parts, read by both
55
56
  * `[part="base"]` and the linked-card content wrapper. The compact density reads the same
56
57
  * property with its own current default (`var(--lr-size-0-125rem)`) as its fallback.
58
+ * @cssprop [--lr-stat-rows-gap=var(--lr-size-0-125rem)] - Gap between the breakdown `row`s inside
59
+ * `[part="rows"]`; the space between sections (caption, sub, spark, rows) is `--lr-stat-gap`.
57
60
  * @cssprop [--lr-stat-trend-good-color=var(--lr-color-success)] - Text color of the trend pill
58
61
  * when its polarity is "good". Independent of the headline value's `variant="success"` tint,
59
62
  * which reads the shared `--lr-color-success` token directly.
@@ -64,6 +67,8 @@ readonly exactValue?:string;}
64
67
  * reads the shared `--lr-color-danger` token directly.
65
68
  * @cssprop [--lr-stat-trend-bad-bg=color-mix(in srgb, var(--lr-color-danger) 8%, transparent)] -
66
69
  * Background of the trend pill when its polarity is "bad".
70
+ * @cssprop [--lr-stat-value-color=inherit] - Headline value color for the neutral variant; the
71
+ * status variants, `emphasis` and `prose` keep their own colors.
67
72
  * @cssprop [--lr-stat-value-brand-color=var(--lr-color-brand)] - Headline value color for the
68
73
  * `brand` variant.
69
74
  * @cssprop [--lr-stat-value-success-color=var(--lr-color-success)] - Headline value color for the
@@ -81,6 +86,18 @@ readonly exactValue?:string;}
81
86
  * tabular, so numbers align without a monospace face that lacks non-Latin glyphs.
82
87
  * @cssprop [--lr-stat-value-font-size=var(--lr-font-size-2xl)] - Headline value size. `prose` keeps its own smaller size.
83
88
  * @cssprop [--lr-stat-value-font-weight=var(--lr-font-weight-bold)] - Headline value weight. `prose` keeps its own weight.
89
+ * @cssprop [--lr-stat-value-letter-spacing=normal] - Headline value letter spacing.
90
+ * @cssprop [--lr-stat-value-line-height=inherit] - Headline value line height.
91
+ * @cssprop [--lr-stat-label-line-height=inherit] - Metric label line height.
92
+ * @cssprop [--lr-stat-align=normal] - Alignment of the vertical tile's stacked content: `center`
93
+ * centres the label, value row, icon and trend chips and their text; `start` and `end` work too.
94
+ * Unset, content stretches and text follows the inherited alignment.
95
+ * @cssprop [--lr-stat-border-color=var(--lr-color-border-subtle)] - Resting edge colour of the tile.
96
+ * A linked tile's resting edge defaults to `--lr-color-border` instead; hover and press keep
97
+ * their own `--lr-stat-link-*` tokens.
98
+ * @cssprop [--lr-stat-value-margin=0] - Margin around the headline value inside its row.
99
+ * @cssprop [--lr-stat-value-row-align=baseline] - Cross-axis alignment (`align-items`) of the value,
100
+ * unit and exact-value row.
84
101
  * @cssprop [--lr-stat-label-font-size=var(--lr-font-size-xs)] - Metric label size.
85
102
  * @cssprop [--lr-stat-label-font-weight=var(--lr-font-weight-semibold)] - Metric label weight.
86
103
  * @cssprop [--lr-stat-label-color=var(--lr-color-text-quiet)] - Metric label color.
@@ -92,6 +109,8 @@ readonly exactValue?:string;}
92
109
  * @cssprop [--lr-stat-caption-color=var(--lr-color-text-quiet)] - Caption color.
93
110
  * @cssprop [--lr-stat-icon-size=inherit] - Font size of the icon container; `lr-icon` and
94
111
  * `1em`-sized glyphs in the `start` slot follow it.
112
+ * @cssprop [--lr-stat-icon-box-size=auto] - Inline and block size of the icon chip box, padding
113
+ * included; the glyph's line box centres in it. Unset, the chip hugs its glyph.
95
114
  * @cssprop [--lr-stat-icon-padding=0] - Inset of the icon chip around its glyph.
96
115
  * @cssprop [--lr-stat-icon-radius=0] - Corner radius of the icon chip.
97
116
  * @cssprop [--lr-stat-icon-bg=transparent] - Background of the icon chip.
@@ -173,6 +192,10 @@ orientation:StatOrientation;
173
192
  * the vertical orientation, the caption (with the breakdown rows after it) is pushed to the
174
193
  * block end, so tiles in a grid row share one height and one caption baseline. Also stretches a
175
194
  * `frame='plain'` stat. */
176
- fill:boolean;private hasIcon;private hasCaptionSlot;private hasSparkSlot;private hasSubSlot;private hasActionsSlot;private readonly labelId;private readonly valueId;private readonly unitId;private rowLabelIds;protected willUpdate(changed:PropertyValues):void;private onIconSlotChange;private onCaptionSlotChange;private onSparkSlotChange;private onSubSlotChange;private onActionsSlotChange;private onLinkedContentClick;
195
+ fill:boolean;
196
+ /** Keeps the headline `value` on one line, ending it with an ellipsis when it does not fit. The
197
+ * full text stays in the accessibility tree, and `exact-value` still describes it. Off by
198
+ * default, so a long value wraps. Reflects as the `truncate` attribute. */
199
+ truncate:boolean;private hasIcon;private hasCaptionSlot;private hasSparkSlot;private hasSubSlot;private hasActionsSlot;private readonly labelId;private readonly valueId;private readonly unitId;private rowLabelIds;protected willUpdate(changed:PropertyValues):void;private onIconSlotChange;private onCaptionSlotChange;private onSparkSlotChange;private onSubSlotChange;private onActionsSlotChange;private onLinkedContentClick;
177
200
  /** Activates the real whole-card anchor when this stat is linked.*/
178
201
  click():void;private readonly announcements;private inputLimitMessage;protected updated(changed:PropertyValues):void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-stat':LyraStat;}}