@aceshooting/lyra-ui 16.0.0 → 18.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 (358) hide show
  1. package/CHANGELOG.md +758 -0
  2. package/README.md +2 -2
  3. package/custom-elements.json +1 -1
  4. package/dist/cli/migration-contract.json +1 -1
  5. package/dist/components/agent-tools/browser-frame/browser-frame.class.d.ts +3 -3
  6. package/dist/components/agent-tools/browser-frame/browser-frame.class.js +2 -2
  7. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +2 -2
  8. package/dist/components/agent-tools/compare-panel/compare-panel.class.js +3 -3
  9. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.d.ts +37 -13
  10. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
  11. package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
  12. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +4 -0
  13. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
  14. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +3 -3
  15. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
  16. package/dist/components/charts/chart/chart.class.d.ts +117 -17
  17. package/dist/components/charts/chart/chart.class.js +3 -3
  18. package/dist/components/charts/chart/histogram-bin.d.ts +5 -1
  19. package/dist/components/charts/chart/histogram-bin.js +1 -1
  20. package/dist/components/charts/chart/lite-chart.class.d.ts +9 -0
  21. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  22. package/dist/components/conversation/message-actions/message-actions.styles.js +1 -1
  23. package/dist/components/conversation/model-select/model-select.class.d.ts +13 -4
  24. package/dist/components/conversation/model-select/model-select.class.js +2 -1
  25. package/dist/components/conversation/model-select/model-select.styles.js +1 -1
  26. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +40 -2
  27. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
  28. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +27 -3
  29. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +11 -0
  30. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +31 -3
  31. package/dist/components/conversation/streaming-text/streaming-text.class.js +11 -0
  32. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +30 -2
  33. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.js +4 -3
  34. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  35. package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
  36. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  37. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.js +1 -1
  38. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +4 -0
  39. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +16 -4
  40. package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -1
  41. package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
  42. package/dist/components/data/context-meter/context-meter.class.d.ts +23 -4
  43. package/dist/components/data/context-meter/context-meter.class.js +10 -7
  44. package/dist/components/data/context-meter/context-meter.styles.js +1 -1
  45. package/dist/components/data/data-grid/data-grid.class.d.ts +5 -2
  46. package/dist/components/data/data-grid/data-grid.class.js +1 -1
  47. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +32 -5
  48. package/dist/components/data/flow-canvas/flow-canvas.class.js +3 -1
  49. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  50. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  51. package/dist/components/data/flow-canvas/flow-types.d.ts +10 -1
  52. package/dist/components/data/gauge/gauge.class.d.ts +15 -2
  53. package/dist/components/data/gauge/gauge.class.js +20 -20
  54. package/dist/components/data/gauge/gauge.styles.js +1 -1
  55. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +14 -5
  56. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +2 -2
  57. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +28 -2
  58. package/dist/components/data/sequence-strip/sequence-strip.class.js +3 -2
  59. package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
  60. package/dist/components/data/table/table.class.d.ts +155 -30
  61. package/dist/components/data/table/table.class.js +6 -4
  62. package/dist/components/data/table/table.styles.js +1 -1
  63. package/dist/components/data/timeline/timeline-item.class.d.ts +9 -1
  64. package/dist/components/data/timeline/timeline-item.class.js +2 -2
  65. package/dist/components/data/word-cloud/word-cloud.class.js +1 -1
  66. package/dist/components/data/word-cloud/word-cloud.styles.js +1 -1
  67. package/dist/components/forms/button/button.class.d.ts +30 -1
  68. package/dist/components/forms/button/button.class.js +2 -2
  69. package/dist/components/forms/checkbox/checkbox.class.d.ts +8 -6
  70. package/dist/components/forms/checkbox/checkbox.class.js +2 -2
  71. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +7 -5
  72. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  73. package/dist/components/forms/color-picker/color-picker.class.d.ts +16 -2
  74. package/dist/components/forms/color-picker/color-picker.class.js +2 -2
  75. package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
  76. package/dist/components/forms/combobox/combobox.class.d.ts +52 -7
  77. package/dist/components/forms/combobox/combobox.class.js +2 -2
  78. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  79. package/dist/components/forms/date-picker/date-input.class.d.ts +4 -0
  80. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  81. package/dist/components/forms/icon-button/icon-button.class.d.ts +20 -3
  82. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  83. package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
  84. package/dist/components/forms/input/input.class.d.ts +5 -2
  85. package/dist/components/forms/input/input.class.js +1 -1
  86. package/dist/components/forms/input/time-input.class.d.ts +4 -0
  87. package/dist/components/forms/input/time-input.class.js +1 -1
  88. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +11 -5
  89. package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
  90. package/dist/components/forms/otp-input/otp-input.class.d.ts +7 -2
  91. package/dist/components/forms/otp-input/otp-input.class.js +2 -2
  92. package/dist/components/forms/radio/radio-button.class.d.ts +2 -1
  93. package/dist/components/forms/radio/radio-group.class.d.ts +9 -4
  94. package/dist/components/forms/radio/radio-group.class.js +1 -1
  95. package/dist/components/forms/radio/radio.class.d.ts +13 -7
  96. package/dist/components/forms/radio/radio.class.js +1 -1
  97. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +16 -6
  98. package/dist/components/forms/rubric-form/rubric-form.class.js +2 -2
  99. package/dist/components/forms/select/select.class.d.ts +50 -13
  100. package/dist/components/forms/select/select.class.js +2 -2
  101. package/dist/components/forms/slider/slider.class.d.ts +4 -2
  102. package/dist/components/forms/slider/slider.class.js +1 -1
  103. package/dist/components/forms/switch/switch.class.d.ts +8 -6
  104. package/dist/components/forms/switch/switch.class.js +1 -1
  105. package/dist/components/forms/textarea/textarea.class.d.ts +5 -3
  106. package/dist/components/forms/textarea/textarea.class.js +1 -1
  107. package/dist/components/forms/time-range/time-range.class.d.ts +12 -7
  108. package/dist/components/forms/time-range/time-range.class.js +1 -1
  109. package/dist/components/forms/time-range/time-range.styles.js +1 -1
  110. package/dist/components/forms/token-input/token-input.class.d.ts +6 -4
  111. package/dist/components/forms/token-input/token-input.class.js +1 -1
  112. package/dist/components/layout/app-rail/app-rail-item.class.d.ts +109 -4
  113. package/dist/components/layout/app-rail/app-rail-item.class.js +34 -29
  114. package/dist/components/layout/app-rail/app-rail-item.styles.js +1 -1
  115. package/dist/components/layout/app-rail/app-rail.class.d.ts +25 -3
  116. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  117. package/dist/components/layout/app-rail-group/app-rail-group.class.d.ts +2 -2
  118. package/dist/components/layout/app-rail-group/app-rail-group.class.js +2 -2
  119. package/dist/components/layout/carousel/carousel.class.d.ts +1 -1
  120. package/dist/components/layout/carousel/carousel.class.js +1 -1
  121. package/dist/components/layout/details/accordion.class.d.ts +2 -2
  122. package/dist/components/layout/details/accordion.class.js +2 -2
  123. package/dist/components/layout/filter-bar/filter-bar-register.d.ts +1 -0
  124. package/dist/components/layout/filter-bar/filter-bar-register.js +1 -0
  125. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +153 -16
  126. package/dist/components/layout/filter-bar/filter-bar.class.js +8 -5
  127. package/dist/components/layout/menu/menu-item.class.d.ts +3 -3
  128. package/dist/components/layout/menu/menu-item.class.js +3 -3
  129. package/dist/components/layout/menu/menu.class.d.ts +5 -1
  130. package/dist/components/layout/menu/menu.class.js +2 -2
  131. package/dist/components/layout/reorder-list/reorder-item.styles.js +1 -1
  132. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  133. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +107 -2
  134. package/dist/components/layout/virtual-list/virtual-list.class.js +12 -7
  135. package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +1 -1
  136. package/dist/components/media/avatar-group/avatar-group.class.d.ts +12 -1
  137. package/dist/components/media/avatar-group/avatar-group.class.js +2 -2
  138. package/dist/components/media/drop-zone/drop-zone.class.d.ts +32 -11
  139. package/dist/components/media/drop-zone/drop-zone.class.js +2 -2
  140. package/dist/components/media/file-input/file-input.class.d.ts +40 -19
  141. package/dist/components/media/file-input/file-input.class.js +2 -2
  142. package/dist/components/media/map/map.class.d.ts +138 -12
  143. package/dist/components/media/map/map.class.js +25 -20
  144. package/dist/components/media/map/map.styles.js +1 -1
  145. package/dist/components/overlays/callout/callout.styles.js +1 -1
  146. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  147. package/dist/components/overlays/overlay/dropdown.class.d.ts +13 -3
  148. package/dist/components/overlays/overlay/dropdown.class.js +2 -2
  149. package/dist/components/overlays/overlay/popover.class.d.ts +12 -3
  150. package/dist/components/overlays/overlay/popover.class.js +2 -2
  151. package/dist/components/overlays/rating/rating.class.d.ts +9 -7
  152. package/dist/components/overlays/rating/rating.class.js +1 -1
  153. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +5 -1
  154. package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
  155. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
  156. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +5 -1
  157. package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
  158. package/dist/components/retrieval/graph-legend/graph-legend.styles.js +1 -1
  159. package/dist/components/retrieval/retrieval-value-format.js +1 -1
  160. package/dist/components/retrieval/source-list/source-list.styles.js +1 -1
  161. package/dist/components/utility/copy-button/copy-button.class.d.ts +23 -11
  162. package/dist/components/utility/copy-button/copy-button.class.js +2 -2
  163. package/dist/components/utility/copy-button/copy-button.styles.js +1 -1
  164. package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
  165. package/dist/components/utility/export-button/export-button.class.d.ts +4 -0
  166. package/dist/components/utility/export-button/export-button.class.js +1 -1
  167. package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
  168. package/dist/components/utility/known-date/known-date.class.js +1 -1
  169. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +38 -3
  170. package/dist/components/utility/mention-popover/mention-popover.class.js +2 -1
  171. package/dist/components/utility/mention-popover/mention-popover.styles.js +1 -1
  172. package/dist/components/utility/poll-status/poll-status.styles.js +1 -1
  173. package/dist/components/utility/tour/tour.class.d.ts +4 -0
  174. package/dist/components/utility/tour/tour.class.js +1 -1
  175. package/dist/components/utility/tour/tour.styles.js +1 -1
  176. package/dist/components/viewers/document-preview/document-preview.class.js +2 -2
  177. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +2 -2
  178. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +2 -2
  179. package/dist/components/viewers/highlight-layer/highlight-layer.class.js +2 -2
  180. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
  181. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
  182. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +2 -2
  183. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +2 -2
  184. package/dist/custom-elements-jsx.d.ts +2 -2
  185. package/dist/events.d.ts +20 -13
  186. package/dist/internal/aggregate-file-limits.d.ts +33 -0
  187. package/dist/internal/aggregate-file-limits.js +1 -0
  188. package/dist/internal/catalog-picker.d.ts +15 -2
  189. package/dist/internal/catalog-picker.js +1 -1
  190. package/dist/internal/debounce-controller.d.ts +14 -0
  191. package/dist/internal/debounce-controller.js +1 -1
  192. package/dist/internal/default-strings.generated.d.ts +1 -1
  193. package/dist/internal/default-strings.generated.js +2 -2
  194. package/dist/internal/focus-navigation.d.ts +45 -0
  195. package/dist/internal/focus-navigation.js +1 -1
  196. package/dist/internal/form-associated.js +1 -1
  197. package/dist/internal/initial-slot-collection.d.ts +30 -0
  198. package/dist/internal/initial-slot-collection.js +1 -0
  199. package/dist/internal/intl-cache.js +1 -1
  200. package/dist/internal/invalid-event-alias.d.ts +46 -0
  201. package/dist/internal/invalid-event-alias.js +1 -1
  202. package/dist/internal/localization-runtime.d.ts +24 -0
  203. package/dist/internal/localization-runtime.js +1 -1
  204. package/dist/internal/localization-types.d.ts +1 -1
  205. package/dist/internal/localization.js +1 -1
  206. package/dist/internal/package-metadata.d.ts +1 -1
  207. package/dist/internal/package-metadata.js +1 -1
  208. package/dist/internal/positioning-strategy.d.ts +3 -1
  209. package/dist/internal/state-part.d.ts +49 -0
  210. package/dist/internal/state-part.js +1 -0
  211. package/dist/internal/variants.styles.js +1 -1
  212. package/dist/lyra.d.ts +1 -1
  213. package/dist/lyra.js +1 -1
  214. package/dist/svelte.d.ts +2 -2
  215. package/dist/testing/index.d.ts +1 -1
  216. package/dist/testing/index.js +1 -1
  217. package/dist/testing/lyra-tag-event-map.d.ts +2 -2
  218. package/dist/testing/lyra-tag-event-map.js +1 -1
  219. package/dist/testing/wait-for-mount.d.ts +46 -0
  220. package/dist/testing/wait-for-mount.js +1 -0
  221. package/dist/theme/theme-bootstrap.js +1 -1
  222. package/dist/theme/theme.d.ts +11 -2
  223. package/dist/theme/theme.js +1 -1
  224. package/dist/translations/ar/layout.js +1 -1
  225. package/dist/translations/ar/retrieval.js +1 -1
  226. package/dist/translations/ar/shared.js +1 -1
  227. package/dist/translations/de/layout.js +1 -1
  228. package/dist/translations/de/retrieval.js +1 -1
  229. package/dist/translations/de/shared.js +1 -1
  230. package/dist/translations/es/layout.js +1 -1
  231. package/dist/translations/es/retrieval.js +1 -1
  232. package/dist/translations/es/shared.js +1 -1
  233. package/dist/translations/fa/layout.js +1 -1
  234. package/dist/translations/fa/retrieval.js +1 -1
  235. package/dist/translations/fa/shared.js +1 -1
  236. package/dist/translations/fr/layout.js +1 -1
  237. package/dist/translations/fr/retrieval.js +1 -1
  238. package/dist/translations/fr/shared.js +1 -1
  239. package/dist/translations/he/layout.js +1 -1
  240. package/dist/translations/he/retrieval.js +1 -1
  241. package/dist/translations/he/shared.js +1 -1
  242. package/dist/translations/it/layout.js +1 -1
  243. package/dist/translations/it/retrieval.js +1 -1
  244. package/dist/translations/it/shared.js +1 -1
  245. package/dist/translations/ja/layout.js +1 -1
  246. package/dist/translations/ja/retrieval.js +1 -1
  247. package/dist/translations/ja/shared.js +1 -1
  248. package/dist/translations/pt-BR/layout.js +1 -1
  249. package/dist/translations/pt-BR/retrieval.js +1 -1
  250. package/dist/translations/pt-BR/shared.js +1 -1
  251. package/dist/translations/ro/agent-tools.d.ts +1 -0
  252. package/dist/translations/ro/agent-tools.js +1 -0
  253. package/dist/translations/ro/charts.d.ts +1 -0
  254. package/dist/translations/ro/charts.js +1 -0
  255. package/dist/translations/ro/conversation.d.ts +1 -0
  256. package/dist/translations/ro/conversation.js +1 -0
  257. package/dist/translations/ro/data.d.ts +1 -0
  258. package/dist/translations/ro/data.js +1 -0
  259. package/dist/translations/ro/forms.d.ts +1 -0
  260. package/dist/translations/ro/forms.js +1 -0
  261. package/dist/translations/ro/layout.d.ts +1 -0
  262. package/dist/translations/ro/layout.js +1 -0
  263. package/dist/translations/ro/media.d.ts +1 -0
  264. package/dist/translations/ro/media.js +1 -0
  265. package/dist/translations/ro/overlays.d.ts +1 -0
  266. package/dist/translations/ro/overlays.js +1 -0
  267. package/dist/translations/ro/retrieval.d.ts +1 -0
  268. package/dist/translations/ro/retrieval.js +1 -0
  269. package/dist/translations/ro/shared.d.ts +1 -0
  270. package/dist/translations/ro/shared.js +1 -0
  271. package/dist/translations/ro/utility.d.ts +1 -0
  272. package/dist/translations/ro/utility.js +1 -0
  273. package/dist/translations/ro/viewers.d.ts +1 -0
  274. package/dist/translations/ro/viewers.js +5 -0
  275. package/dist/translations/ro.d.ts +1 -0
  276. package/dist/translations/ro.js +1 -0
  277. package/dist/translations/ru/layout.js +1 -1
  278. package/dist/translations/ru/retrieval.js +1 -1
  279. package/dist/translations/ru/shared.js +1 -1
  280. package/dist/translations/zh-CN/layout.js +1 -1
  281. package/dist/translations/zh-CN/retrieval.js +1 -1
  282. package/dist/translations/zh-CN/shared.js +1 -1
  283. package/dist/utilities/format.d.ts +17 -0
  284. package/dist/utilities/format.js +1 -1
  285. package/dist/vue.d.ts +2 -2
  286. package/llms/components/lr-app-rail-group.md +87 -10
  287. package/llms/components/lr-app-rail-item.md +88 -11
  288. package/llms/components/lr-app-rail.md +88 -11
  289. package/llms/components/lr-attachment-trigger.md +21 -0
  290. package/llms/components/lr-bar-chart.md +3 -2
  291. package/llms/components/lr-bubble-chart.md +3 -2
  292. package/llms/components/lr-button.md +5 -4
  293. package/llms/components/lr-callout.md +10 -0
  294. package/llms/components/lr-card.md +2 -1
  295. package/llms/components/lr-chart.md +43 -12
  296. package/llms/components/lr-citation-badge.md +7 -1
  297. package/llms/components/lr-code-block.md +21 -0
  298. package/llms/components/lr-color-picker.md +12 -7
  299. package/llms/components/lr-combobox.md +20 -1
  300. package/llms/components/lr-confirm-bar.md +36 -7
  301. package/llms/components/lr-context-meter.md +17 -4
  302. package/llms/components/lr-date-input.md +7 -1
  303. package/llms/components/lr-date-picker.md +6 -0
  304. package/llms/components/lr-dialog.md +21 -0
  305. package/llms/components/lr-doughnut-chart.md +3 -2
  306. package/llms/components/lr-drawer.md +10 -0
  307. package/llms/components/lr-drop-zone.md +16 -7
  308. package/llms/components/lr-dropdown-item.md +7 -0
  309. package/llms/components/lr-entity-chip.md +7 -1
  310. package/llms/components/lr-export-button.md +7 -1
  311. package/llms/components/lr-file-input.md +21 -10
  312. package/llms/components/lr-filter-bar.md +177 -18
  313. package/llms/components/lr-flow-canvas.md +16 -9
  314. package/llms/components/lr-gauge.md +22 -2
  315. package/llms/components/lr-histogram.md +7 -2
  316. package/llms/components/lr-icon-button.md +17 -8
  317. package/llms/components/lr-input.md +3 -1
  318. package/llms/components/lr-line-chart.md +3 -2
  319. package/llms/components/lr-lite-chart.md +13 -0
  320. package/llms/components/lr-locale-picker.md +7 -1
  321. package/llms/components/lr-map.md +63 -6
  322. package/llms/components/lr-mention-popover.md +16 -3
  323. package/llms/components/lr-menu-item.md +7 -0
  324. package/llms/components/lr-menu.md +8 -1
  325. package/llms/components/lr-message-actions.md +10 -0
  326. package/llms/components/lr-model-select.md +8 -3
  327. package/llms/components/lr-native-time-input.md +8 -1
  328. package/llms/components/lr-number-input.md +8 -1
  329. package/llms/components/lr-option.md +19 -0
  330. package/llms/components/lr-otp-input.md +6 -0
  331. package/llms/components/lr-pie-chart.md +3 -2
  332. package/llms/components/lr-polar-area-chart.md +3 -2
  333. package/llms/components/lr-prompt-input.md +2 -2
  334. package/llms/components/lr-radar-chart.md +3 -2
  335. package/llms/components/lr-reorder-item.md +12 -0
  336. package/llms/components/lr-reorder-list.md +12 -0
  337. package/llms/components/lr-scatter-chart.md +3 -2
  338. package/llms/components/lr-select.md +19 -2
  339. package/llms/components/lr-sequence-strip.md +10 -4
  340. package/llms/components/lr-streaming-text-core.md +28 -11
  341. package/llms/components/lr-streaming-text.md +41 -6
  342. package/llms/components/lr-suggestion-chips.md +8 -4
  343. package/llms/components/lr-table.md +47 -10
  344. package/llms/components/lr-textarea.md +1 -1
  345. package/llms/components/lr-time-input.md +7 -1
  346. package/llms/components/lr-tool-call-chip.md +7 -1
  347. package/llms/components/lr-tour.md +7 -1
  348. package/llms/components/lr-usage-badge.md +7 -1
  349. package/llms/components/lr-virtual-list.md +53 -0
  350. package/llms/components/lr-voice-picker.md +7 -3
  351. package/llms/shared.md +175 -19
  352. package/llms/tokens.md +17 -1
  353. package/llms-full.txt +1214 -169
  354. package/package.json +43 -3
  355. package/registrations.json +1 -1
  356. package/vscode-css-data.json +1 -1
  357. package/vscode-html-data.json +1 -1
  358. package/web-types.json +1 -1
@@ -1,5 +1,5 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{specialistTokens}from"../../../internal/specialist-tokens.styles.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{loadChartJs}from"./chart-core-loader.js";import{onAnnotationPluginRegistered}from"../../../internal/chart-annotation-registration.js";import{loadChartJsWithZoom,loadChartJsWithZoomResult,loadChartJsWithDataLabelsResult,loadChartJsWithAnnotationResult}from"./chart-feature-loader.js";import{styles}from"./chart.styles.js";import"../../overlays/skeleton/skeleton.class.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{escapeCsvField}from"../../utility/export-button/csv.js";import{trueDefaultBooleanFromAttributeConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{finiteAdd,finiteNumber}from"../../../internal/numbers.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{FALLBACK_GRID_COLOR,FALLBACK_LEGEND_COLOR,FALLBACK_TICK_COLOR,FALLBACK_TICK_FONT_SIZE,FALLBACK_TOOLTIP_BG,FALLBACK_TOOLTIP_TEXT,resolveCanvasColor,resolveCanvasColors,seriesPalette,translucentAreaColor}from"./chart-colors.js";import{createForcedColorPattern,forcedColorEncoding,forcedColorsActive}from"./chart-forced-colors.js";import{legendVisibilityDetail,normalizeHiddenDatasets}from"./chart-legend-visibility.js";import{sampleChartTableIndexes}from"./chart-table-sampling.js";import{LYRA_DEFAULT_chart,LYRA_DEFAULT_chartAnnotationsUnavailable,LYRA_DEFAULT_chartAxisTotal,LYRA_DEFAULT_chartBubblePointCoordinates,LYRA_DEFAULT_chartCategory,LYRA_DEFAULT_chartData,LYRA_DEFAULT_chartDataLabelsUnavailable,LYRA_DEFAULT_chartDataSampled,LYRA_DEFAULT_chartLabeledPoint,LYRA_DEFAULT_chartMissingLibrary,LYRA_DEFAULT_chartPointCoordinates,LYRA_DEFAULT_chartPointLabel,LYRA_DEFAULT_chartPrimaryAxis,LYRA_DEFAULT_chartSecondaryAxis,LYRA_DEFAULT_chartSeriesLabel,LYRA_DEFAULT_chartSeriesNoData,LYRA_DEFAULT_chartStackTotalsUnavailable,LYRA_DEFAULT_chartSummary,LYRA_DEFAULT_chartSummaryEmpty,LYRA_DEFAULT_chartSummarySeparator,LYRA_DEFAULT_chartSummaryWithData,LYRA_DEFAULT_chartTotal,LYRA_DEFAULT_chartTrendDecreasing,LYRA_DEFAULT_chartTrendFlat,LYRA_DEFAULT_chartTrendIncreasing,LYRA_DEFAULT_chartTypeBar,LYRA_DEFAULT_chartTypeBubble,LYRA_DEFAULT_chartTypeDoughnut,LYRA_DEFAULT_chartTypeLine,LYRA_DEFAULT_chartTypePie,LYRA_DEFAULT_chartTypePolarArea,LYRA_DEFAULT_chartTypeRadar,LYRA_DEFAULT_chartTypeScatter,LYRA_DEFAULT_chartValueLabel,LYRA_DEFAULT_chartValuePercentageLabel,LYRA_DEFAULT_chartZoomUnavailable,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_liteChartMarkSummary,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_resetZoom,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";import{seriesPalette as seriesPalette2}from"./chart-colors.js";const CHART_TYPES=new Set(["line","bar","scatter","pie","doughnut","radar","polarArea","bubble"]),CHART_TYPE_MESSAGE_KEYS={line:"chartTypeLine",bar:"chartTypeBar",scatter:"chartTypeScatter",pie:"chartTypePie",doughnut:"chartTypeDoughnut",radar:"chartTypeRadar",polarArea:"chartTypePolarArea",bubble:"chartTypeBubble"};function normalizeChartType(value){return typeof value=="string"&&CHART_TYPES.has(value)?value:"bar"}function normalizeChartGrid(value){return value==="x"||value==="y"||value==="none"||value==="both"?value:"both"}function normalizeLegendPosition(value){return value==="left"||value==="top"||value==="right"||value==="bottom"||value==="center"||value==="chartArea"||value==="start"||value==="end"||value==="auto"?value:projectLegendPosition(value)??"top"}function isArcDatasetType(datasetType){return datasetType==="pie"||datasetType==="doughnut"||datasetType==="polarArea"}function isPointDatasetType(datasetType){return datasetType==="line"||datasetType==="radar"||datasetType==="scatter"||datasetType==="bubble"}function isChartRecord(value){try{return typeof value=="object"&&value!==null&&!Array.isArray(value)}catch{return!1}}const MAX_CHART_INPUT_ENTRIES=1e4,MAX_CHART_CONFIGURATION_DEPTH=32,OMIT_CHART_CONFIGURATION_VALUE=Symbol("omit-chart-configuration-value");function admitChartArray(value){try{if(!Array.isArray(value))return;const descriptor=getOwnDataDescriptor(value,"length");return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0?void 0:{source:value,length:Math.min(descriptor.value,MAX_CHART_INPUT_ENTRIES)}}catch{return}}function chartArrayIsStillAdmitted(admission){const descriptor=chartRecordValue(admission.source,"length");return descriptor!==MISSING_OWN_DATA_DESCRIPTOR&&descriptor!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=admission.length}function copyChartArrayEntries(admission){if(!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=Array.from({length:admission.length},()=>{});for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||(output[index]=descriptor.value)}return Object.freeze(output)}function chartEnumerableKeys(value){try{return Object.keys(value)}catch{return}}const canonicalChartSeriesSnapshots=new WeakMap,admittedChartPlugins=new WeakSet,canonicalChartDatasetValues=new WeakMap,canonicalChartDatasetDataValues=new WeakMap;function canonicalChartSeries(value){if(isChartRecord(value))return canonicalChartSeriesSnapshots.has(value)?value:projectChartSeries(value)}function canonicalSeriesData(series){const canonical=canonicalChartSeries(series);return canonical?canonicalChartSeriesSnapshots.get(canonical)?.data??[]:[]}function canonicalSeriesPoints(series){const canonical=canonicalChartSeries(series);return canonical?canonicalChartSeriesSnapshots.get(canonical)?.points:void 0}function chartRecordValue(value,property2){return getOwnDataDescriptor(value,property2)}function projectChartNumberData(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>null);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const candidate=descriptor.value;output[index]=typeof candidate=="number"&&Number.isFinite(candidate)?candidate:null}return Object.freeze(output)}function projectChartPoint(value){if(!isChartRecord(value))return null;const x=chartRecordValue(value,"x"),y=chartRecordValue(value,"y"),r=chartRecordValue(value,"r"),label=chartRecordValue(value,"label");return x===MISSING_OWN_DATA_DESCRIPTOR||x===UNSAFE_OWN_DATA_DESCRIPTOR||y===MISSING_OWN_DATA_DESCRIPTOR||y===UNSAFE_OWN_DATA_DESCRIPTOR||r===UNSAFE_OWN_DATA_DESCRIPTOR||label===UNSAFE_OWN_DATA_DESCRIPTOR||typeof x.value!="number"||!Number.isFinite(x.value)||typeof y.value!="number"||!Number.isFinite(y.value)?null:Object.freeze({x:x.value,y:y.value,...r!==MISSING_OWN_DATA_DESCRIPTOR&&typeof r.value=="number"&&Number.isFinite(r.value)&&r.value>=0?{r:r.value}:{},...label!==MISSING_OWN_DATA_DESCRIPTOR&&typeof label.value=="string"?{label:label.value}:{}})}function projectChartDatum(value){if(typeof value=="number")return Number.isFinite(value)?value:null;if(typeof value=="string"||typeof value=="bigint")return value;if(!isChartRecord(value))return null;const x=chartRecordValue(value,"x"),y=chartRecordValue(value,"y"),r=chartRecordValue(value,"r"),label=chartRecordValue(value,"label"),output={};let hasValue=!1;for(const[property2,descriptor]of[["x",x],["y",y],["r",r]])descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="number"||!Number.isFinite(descriptor.value)||(output[property2]=descriptor.value,hasValue=!0);return label!==MISSING_OWN_DATA_DESCRIPTOR&&label!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof label.value=="string"&&(output.label=label.value,hasValue=!0),hasValue?Object.freeze(output):null}function projectChartDatasetValues(admission){if(!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=Array.from({length:admission.length},()=>null);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||(output[index]=projectChartDatum(descriptor.value))}return Object.freeze(output)}function projectChartPoints(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>null);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||(output[index]=projectChartPoint(descriptor.value))}return Object.freeze(output)}function projectChartStrings(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>"");for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="string"||(output[index]=descriptor.value)}return Object.freeze(output)}function projectChartPointRadii(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>Number.NaN);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="number"||!Number.isFinite(descriptor.value)||(output[index]=descriptor.value)}return Object.freeze(output)}const CHART_ANNOTATION_TONES=new Set(["neutral","brand","success","warning","danger"]);function projectHiddenDatasetIndexes(value){if(value===void 0)return;const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index)),candidate=descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value;descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof candidate!="number"||!Number.isInteger(candidate)||output.push(candidate)}return Object.freeze(output)}function projectChartAnnotations(value){const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const entry=chartRecordValue(admission.source,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR||!isChartRecord(entry.value))continue;const axis=chartRecordValue(entry.value,"axis"),lineValue=chartRecordValue(entry.value,"value"),from=chartRecordValue(entry.value,"from"),to=chartRecordValue(entry.value,"to"),label=chartRecordValue(entry.value,"label"),tone=chartRecordValue(entry.value,"tone");if(axis===UNSAFE_OWN_DATA_DESCRIPTOR||lineValue===UNSAFE_OWN_DATA_DESCRIPTOR||from===UNSAFE_OWN_DATA_DESCRIPTOR||to===UNSAFE_OWN_DATA_DESCRIPTOR||label===UNSAFE_OWN_DATA_DESCRIPTOR||tone===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const axisValue=axis===MISSING_OWN_DATA_DESCRIPTOR?void 0:axis.value,line=lineValue===MISSING_OWN_DATA_DESCRIPTOR?void 0:lineValue.value,fromValue=from===MISSING_OWN_DATA_DESCRIPTOR?void 0:from.value,toValue=to===MISSING_OWN_DATA_DESCRIPTOR?void 0:to.value,labelValue=label===MISSING_OWN_DATA_DESCRIPTOR?void 0:label.value,toneValue=tone===MISSING_OWN_DATA_DESCRIPTOR?void 0:tone.value;if(axisValue!==void 0&&axisValue!=="x"&&axisValue!=="y"||labelValue!==void 0&&typeof labelValue!="string"||toneValue!==void 0&&(typeof toneValue!="string"||!CHART_ANNOTATION_TONES.has(toneValue)))continue;const normalizedAxis=axisValue==="x"||axisValue==="y"?axisValue:void 0,common={...normalizedAxis!==void 0?{axis:normalizedAxis}:{},...typeof labelValue=="string"?{label:labelValue}:{},...typeof toneValue=="string"?{tone:toneValue}:{}};if(typeof line=="number"&&Number.isFinite(line)){output.push(Object.freeze({...common,value:line}));continue}typeof fromValue=="number"&&Number.isFinite(fromValue)&&typeof toValue=="number"&&Number.isFinite(toValue)&&output.push(Object.freeze({...common,from:Math.min(fromValue,toValue),to:Math.max(fromValue,toValue)}))}return Object.freeze(output)}const CHART_SERIES_PROPERTIES=["label","data","points","color","fill","width","dash","noTooltip","axis","pointColors","pointRadius","segmentColors","type"];function projectChartSeries(value){try{if(!isChartRecord(value))return;const descriptors=new Map;for(const property2 of CHART_SERIES_PROPERTIES){const descriptor=chartRecordValue(value,property2);if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)return;descriptors.set(property2,descriptor)}const valueAt=property2=>{const descriptor=descriptors.get(property2);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||descriptor===void 0?void 0:descriptor.value},label=valueAt("label");if(label!==void 0&&typeof label!="string")return;const output={label:label??""},rawData=valueAt("data"),rawDataAdmission=admitChartArray(rawData),data=projectChartNumberData(rawData,rawDataAdmission),rawPoints=valueAt("points"),rawPointsAdmission=admitChartArray(rawPoints),points=projectChartPoints(rawPoints,rawPointsAdmission),color=valueAt("color"),fill=valueAt("fill"),width=valueAt("width"),dash=valueAt("dash"),noTooltip=valueAt("noTooltip"),axis=valueAt("axis"),pointColors=projectChartStrings(valueAt("pointColors")),pointRadius=valueAt("pointRadius"),segmentColors=projectChartStrings(valueAt("segmentColors")),type=valueAt("type");if(data&&rawDataAdmission&&(output.data=rawDataAdmission.source),points&&rawPointsAdmission&&(output.points=rawPointsAdmission.source),typeof color=="string")output.color=color;else{const colors=projectChartStrings(color);colors&&(output.color=colors)}if(typeof fill=="boolean"&&(output.fill=fill),typeof width=="number"&&Number.isFinite(width)&&(output.width=width),typeof dash=="boolean"&&(output.dash=dash),typeof noTooltip=="boolean"&&(output.noTooltip=noTooltip),(axis==="y"||axis==="y2")&&(output.axis=axis),pointColors&&(output.pointColors=pointColors),typeof pointRadius=="number"&&Number.isFinite(pointRadius))output.pointRadius=pointRadius;else{const radii=projectChartPointRadii(pointRadius);radii&&(output.pointRadius=radii)}segmentColors&&(output.segmentColors=segmentColors),(type==="line"||type==="bar")&&(output.type=type);const series=Object.freeze(output);return canonicalChartSeriesSnapshots.set(series,{data:data??Object.freeze([]),...points?{points}:{}}),series}catch{return}}function normalizeChartSeries(value){const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const series=canonicalChartSeries(descriptor.value);series&&output.push(series)}return Object.freeze(output)}function isSafeChartConfigurationRecord(value){if(!isChartRecord(value))return!1;try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;const constructor=getOwnDataDescriptor(prototype,"constructor");if(constructor===MISSING_OWN_DATA_DESCRIPTOR||constructor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof constructor.value!="function")return!1;const name=getOwnDataDescriptor(constructor.value,"name"),constructorPrototype=getOwnDataDescriptor(constructor.value,"prototype");return name!==MISSING_OWN_DATA_DESCRIPTOR&&name!==UNSAFE_OWN_DATA_DESCRIPTOR&&name.value==="Object"&&constructorPrototype!==MISSING_OWN_DATA_DESCRIPTOR&&constructorPrototype!==UNSAFE_OWN_DATA_DESCRIPTOR&&constructorPrototype.value===prototype}catch{return!1}}function projectLegendPosition(value){if(!isSafeChartConfigurationRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys||keys.length>MAX_CHART_INPUT_ENTRIES)return;const output={};for(const key of keys){if(UNSAFE_KEYS.has(key))return;const descriptor=chartRecordValue(value,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||typeof descriptor.value!="number"||!Number.isFinite(descriptor.value))return;output[key]=descriptor.value}return Object.freeze(output)}function copyChartConfigurationValue(value,budget,depth=0){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(depth>MAX_CHART_CONFIGURATION_DEPTH||budget.remaining<=0||budget.active.has(value))return OMIT_CHART_CONFIGURATION_VALUE;const array=admitChartArray(value);if(array&&!chartArrayIsStillAdmitted(array))return OMIT_CHART_CONFIGURATION_VALUE;if(array){budget.remaining-=1,budget.active.add(value);try{const output=Array.from({length:array.length},()=>{});for(let index=0;index<array.length&&budget.remaining>0;index+=1){budget.remaining-=1;const descriptor=chartRecordValue(array.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const entry=copyChartConfigurationValue(descriptor.value,budget,depth+1);entry!==OMIT_CHART_CONFIGURATION_VALUE&&(output[index]=entry)}const copied=Object.freeze(output),canonical=canonicalChartDatasetDataValues.get(array.source);return canonical&&canonicalChartDatasetDataValues.set(copied,canonical),copied}finally{budget.active.delete(value)}}if(!isSafeChartConfigurationRecord(value))return value;budget.remaining-=1,budget.active.add(value);try{const keys=chartEnumerableKeys(value);if(!keys)return OMIT_CHART_CONFIGURATION_VALUE;const output=Object.create(null);for(const key of keys){if(budget.remaining<=0)break;if(budget.remaining-=1,UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)continue;const entry=copyChartConfigurationValue(descriptor.value,budget,depth+1);entry!==OMIT_CHART_CONFIGURATION_VALUE&&(output[key]=entry)}return Object.freeze(output)}finally{budget.active.delete(value)}}function projectChartPlugins(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||descriptor.value===null||typeof descriptor.value!="object"&&typeof descriptor.value!="function")continue;const plugin=descriptor.value;if(admittedChartPlugins.has(plugin)){output.push(plugin);continue}const id=chartRecordValue(plugin,"id");id===MISSING_OWN_DATA_DESCRIPTOR||id===UNSAFE_OWN_DATA_DESCRIPTOR||typeof id.value!="string"||id.value.trim()===""||(admittedChartPlugins.add(plugin),output.push(plugin))}return Object.freeze(output)}function projectChartDatasetConfiguration(value){if(!isSafeChartConfigurationRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys)return;const output=Object.create(null),priorCanonicalValues=canonicalChartDatasetValues.get(value);let canonicalValues;for(const key of keys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)continue;const candidate=descriptor.value,array=admitChartArray(candidate);if(key==="data"){if(array){if(!chartArrayIsStillAdmitted(array)){output[key]=Object.freeze([]),canonicalValues=Object.freeze([]);continue}const copied=copyChartArrayEntries(array);output[key]=copied;const canonical=priorCanonicalValues??canonicalChartDatasetDataValues.get(array.source)??projectChartDatasetValues(array);canonicalValues=canonical,canonicalChartDatasetDataValues.set(copied,canonical)}continue}if(key==="label"){typeof candidate=="string"||typeof candidate=="number"||typeof candidate=="boolean"||typeof candidate=="bigint"?output[key]=candidate:array&&(output[key]=copyChartArrayEntries(array));continue}if(key==="hidden"||key==="noTooltip"){typeof candidate=="boolean"&&(output[key]=candidate);continue}if(key==="axis"||key==="yAxisID"||key==="type"){typeof candidate=="string"&&(output[key]=candidate);continue}output[key]=array?copyChartArrayEntries(array):candidate}const dataset=Object.freeze(output);return canonicalValues&&canonicalChartDatasetValues.set(dataset,canonicalValues),dataset}function projectChartDatasetConfigurations(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const dataset=projectChartDatasetConfiguration(descriptor.value);dataset&&output.push(dataset)}return Object.freeze(output)}function projectChartDataConfiguration(value){if(!isSafeChartConfigurationRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys)return;const output=Object.create(null);for(const key of keys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);if(!(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)){if(key==="labels"){const labels=admitChartArray(descriptor.value);output[key]=labels?copyChartArrayEntries(labels):Object.freeze([]);continue}if(key==="datasets"){output[key]=projectChartDatasetConfigurations(descriptor.value);continue}output[key]=descriptor.value}}return Object.freeze(output)}function projectChartConfiguration(value){if(!isSafeChartConfigurationRecord(value))return;const budget={remaining:MAX_CHART_INPUT_ENTRIES,active:new Set},output=Object.create(null),type=chartRecordValue(value,"type"),data=chartRecordValue(value,"data"),options=chartRecordValue(value,"options"),plugins=chartRecordValue(value,"plugins");type!==MISSING_OWN_DATA_DESCRIPTOR&&type!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof type.value=="string"&&(output.type=type.value);for(const[property2,descriptor]of[["data",data],["options",options]]){if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const copied=copyChartConfigurationValue(descriptor.value,budget);if(copied!==OMIT_CHART_CONFIGURATION_VALUE){if(property2==="data"){const projected=projectChartDataConfiguration(copied);output[property2]=projected??copied;continue}output[property2]=copied}}if(plugins!==MISSING_OWN_DATA_DESCRIPTOR&&plugins!==UNSAFE_OWN_DATA_DESCRIPTOR){const pluginArray=admitChartArray(plugins.value);if(pluginArray)output.plugins=projectChartPlugins(plugins.value,pluginArray);else{const copied=copyChartConfigurationValue(plugins.value,budget);copied!==OMIT_CHART_CONFIGURATION_VALUE&&(output.plugins=copied)}}return Object.freeze(output)}const UNSAFE_KEYS=new Set(["__proto__","constructor","prototype"]);function deepMerge(base,override,seen=new WeakMap){if(!isSafeChartConfigurationRecord(base)||!isSafeChartConfigurationRecord(override))return override===void 0?base:override;const baseRecord=base,overrideRecord=override,baseKeys=chartEnumerableKeys(baseRecord),overrideKeys=chartEnumerableKeys(overrideRecord);if(!baseKeys||!overrideKeys)return override;const previous=seen.get(overrideRecord);if(previous!==void 0)return previous;const result={};for(const key of baseKeys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(baseRecord,key);descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||(result[key]=descriptor.value)}seen.set(overrideRecord,result);try{for(const key of overrideKeys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(overrideRecord,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)continue;const baseDescriptor=chartRecordValue(baseRecord,key),baseValue=baseDescriptor===MISSING_OWN_DATA_DESCRIPTOR||baseDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:baseDescriptor.value;result[key]=deepMerge(baseValue,descriptor.value,seen)}}finally{seen.delete(overrideRecord)}return result}function normalizedChartPoint(value){return projectChartPoint(projectChartDatum(value))}function chartNumericValue(value){const numeric=typeof value=="number"?value:typeof value=="string"||typeof value=="bigint"?Number(value):Number.NaN;return Number.isFinite(numeric)?numeric:void 0}function chartDatumNumericValue(value){const projected=projectChartDatum(value);if(isChartRecord(projected))for(const property2 of["y","r","x"]){const descriptor=chartRecordValue(projected,property2);if(descriptor!==MISSING_OWN_DATA_DESCRIPTOR&&descriptor!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof descriptor.value=="number"&&Number.isFinite(descriptor.value))return descriptor.value}return chartNumericValue(projected)}function nonNegativeFinite(value,fallback){return typeof value=="number"&&Number.isFinite(value)&&value>=0?value:fallback}function labelText(value,depth=0){if(value==null)return"";if(typeof value=="string"||typeof value=="number"||typeof value=="boolean"||typeof value=="bigint")return String(value);const admission=admitChartArray(value);if(depth<MAX_CHART_CONFIGURATION_DEPTH&&admission){const values=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));values.push(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?"":labelText(descriptor.value,depth+1))}return values.join(" ")}return""}function chartDatasetValue(dataset,property2){if(!isChartRecord(dataset))return;const descriptor=chartRecordValue(dataset,property2);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value}function chartDatasetLabel(dataset){return labelText(chartDatasetValue(dataset,"label"))}function chartDatasetValues(dataset){if(isChartRecord(dataset)){const snapshot=canonicalChartDatasetValues.get(dataset);if(snapshot)return snapshot}const data=chartDatasetValue(dataset,"data"),admission=admitChartArray(data);return admission?canonicalChartDatasetDataValues.get(admission.source)??copyChartArrayEntries(admission):Object.freeze([])}function chartDatasetPeerValues(dataset){const admission=admitChartArray(chartDatasetValue(dataset,"data"));return admission?copyChartArrayEntries(admission):Object.freeze([])}function chartIndex(value){return typeof value=="number"&&Number.isSafeInteger(value)&&value>=0?value:void 0}function chartCallbackDatasetIndex(value){return chartIndex(chartDatasetValue(value,"datasetIndex"))}function chartCallbackIndexes(value){const datasetIndex=chartCallbackDatasetIndex(value),index=chartIndex(chartDatasetValue(value,"index"))??chartIndex(chartDatasetValue(value,"dataIndex"));return datasetIndex===void 0||index===void 0?void 0:{datasetIndex,index}}function projectChartLegendItem(value){if(!isChartRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys||keys.length>MAX_CHART_INPUT_ENTRIES)return;const output=Object.create(null);for(const key of keys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||(output[key]=descriptor.value)}return output}function projectChartLegendItems(value){const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const item=projectChartLegendItem(descriptor.value);item&&output.push(item)}return Object.freeze(output)}function chartDatasetBoolean(dataset,property2){const value=chartDatasetValue(dataset,property2);return typeof value=="boolean"?value:void 0}function chartDatasetAxis(dataset){return chartDatasetValue(dataset,"yAxisID")==="y2"||chartDatasetValue(dataset,"axis")==="y2"?"y2":"y"}class LyraChart extends LyraElement{static{this.defaultStrings={...super.defaultStrings,chart:LYRA_DEFAULT_chart,chartAnnotationsUnavailable:LYRA_DEFAULT_chartAnnotationsUnavailable,chartAxisTotal:LYRA_DEFAULT_chartAxisTotal,chartBubblePointCoordinates:LYRA_DEFAULT_chartBubblePointCoordinates,chartCategory:LYRA_DEFAULT_chartCategory,chartData:LYRA_DEFAULT_chartData,chartDataLabelsUnavailable:LYRA_DEFAULT_chartDataLabelsUnavailable,chartDataSampled:LYRA_DEFAULT_chartDataSampled,chartLabeledPoint:LYRA_DEFAULT_chartLabeledPoint,chartMissingLibrary:LYRA_DEFAULT_chartMissingLibrary,chartPointCoordinates:LYRA_DEFAULT_chartPointCoordinates,chartPointLabel:LYRA_DEFAULT_chartPointLabel,chartPrimaryAxis:LYRA_DEFAULT_chartPrimaryAxis,chartSecondaryAxis:LYRA_DEFAULT_chartSecondaryAxis,chartSeriesLabel:LYRA_DEFAULT_chartSeriesLabel,chartSeriesNoData:LYRA_DEFAULT_chartSeriesNoData,chartStackTotalsUnavailable:LYRA_DEFAULT_chartStackTotalsUnavailable,chartSummary:LYRA_DEFAULT_chartSummary,chartSummaryEmpty:LYRA_DEFAULT_chartSummaryEmpty,chartSummarySeparator:LYRA_DEFAULT_chartSummarySeparator,chartSummaryWithData:LYRA_DEFAULT_chartSummaryWithData,chartTotal:LYRA_DEFAULT_chartTotal,chartTrendDecreasing:LYRA_DEFAULT_chartTrendDecreasing,chartTrendFlat:LYRA_DEFAULT_chartTrendFlat,chartTrendIncreasing:LYRA_DEFAULT_chartTrendIncreasing,chartTypeBar:LYRA_DEFAULT_chartTypeBar,chartTypeBubble:LYRA_DEFAULT_chartTypeBubble,chartTypeDoughnut:LYRA_DEFAULT_chartTypeDoughnut,chartTypeLine:LYRA_DEFAULT_chartTypeLine,chartTypePie:LYRA_DEFAULT_chartTypePie,chartTypePolarArea:LYRA_DEFAULT_chartTypePolarArea,chartTypeRadar:LYRA_DEFAULT_chartTypeRadar,chartTypeScatter:LYRA_DEFAULT_chartTypeScatter,chartValueLabel:LYRA_DEFAULT_chartValueLabel,chartValuePercentageLabel:LYRA_DEFAULT_chartValuePercentageLabel,chartZoomUnavailable:LYRA_DEFAULT_chartZoomUnavailable,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,liteChartMarkSummary:LYRA_DEFAULT_liteChartMarkSummary,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,resetZoom:LYRA_DEFAULT_resetZoom,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.immutableEventDetails=Object.freeze(["lr-before-legend-visibility-change","lr-legend-visibility-change","lr-before-datum-visibility-change","lr-datum-visibility-change"])}static{this.ownedCollectionProperties=Object.freeze(["annotations","hiddenDatasets"])}static{this.styles=[LyraElement.styles,specialistTokens,styles,srOnly]}constructor(){super(),this.type="bar",this.labels=[],this._datasets=Object.freeze([]),this.datasetsSource=this._datasets,this._hiddenDatums=Object.freeze([]),this.legendMode="auto",this.legendDisplay="auto",this.description=null,this.grid="both",this.axes="both",this.compact=!1,this.indexAxis="x",this.label=null,this.legendPosition="top",this.scaleType="linear",this.annotations=[],this.max=null,this.min=null,this._plugins=Object.freeze([]),this.pluginsSource=this._plugins,this.area=!1,this.zoom=!1,this.height="280px",this.xLabel=null,this.yLabel=null,this.y2Label="",this.beginAtZero=!0,this.showDataTable=!1,this.dataTableToggle=!1,this.dataTableExpandedOverride=null,this.dataTableId=nextId("chart-data-table"),this.stacked=!1,this.withoutAnimation=!1,this.withoutLegend=!1,this.withoutTooltip=!1,this.dataLabels=!1,this.stackTotals=!1,this.configSource=void 0,this.loading=!0,this.loadFailed=!1,this.loadLibrary=withZoom=>withZoom?loadChartJsWithZoom():loadChartJs(),this.loadZoomFeature=()=>loadChartJsWithZoomResult(),this.loadDataLabelsFeature=()=>loadChartJsWithDataLabelsResult(),this.loadAnnotationFeature=()=>loadChartJsWithAnnotationResult(),this.loadGeneration=0,this.zoomLoadGeneration=0,this.dataLabelsLoadGeneration=0,this.annotationLoadGeneration=0,this.zoomFeatureState="idle",this.dataLabelsFeatureState="idle",this.annotationFeatureState="idle",this.zoomed=!1,this.visible=!0,this.intersectionGeneration=0,this.scaledSliceDatasets=new Set,this.autoLegendPosition="right",this.chartAreaUpdateQueued=!1,this.builtPlugins=[],this.suppressZoomComplete=!1,this.descriptionId=nextId("chart-description"),this.keyboardDatumIndex=0,this.keyboardDatumAnnouncement="",this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.announcedFeatureWarnings=new Set,this.onReducedMotionChange=()=>{!this.isConnected||this.ownerWindow!==this.reducedMotionWindow||this.drawIfVisible()},new ThemeWatcher(this,()=>{this.chart&&this.refreshTheme()})}canonicalLabels(){const source=this.labels;if(this.labelsSnapshot&&Object.is(this.labelsSnapshot.source,source))return this.labelsSnapshot.value;const value=projectChartStrings(source)??Object.freeze([]);return this.labelsSnapshot={source,value},value}canonicalAnnotations(){const source=this.annotations;if(this.annotationsSnapshot&&Object.is(this.annotationsSnapshot.source,source))return this.annotationsSnapshot.value;const value=projectChartAnnotations(source);return this.annotationsSnapshot={source,value},value}canonicalHiddenDatasets(){const source=this.hiddenDatasets;if(this.hiddenDatasetsSnapshot&&Object.is(this.hiddenDatasetsSnapshot.source,source))return this.hiddenDatasetsSnapshot.value;const value=projectHiddenDatasetIndexes(source);return this.hiddenDatasetsSnapshot={source,value},value}get datasets(){return this._datasets}set datasets(value){if(Object.is(value,this.datasetsSource)||Object.is(value,this._datasets))return;const previous=this._datasets;this._datasets=normalizeChartSeries(value),this.datasetsSource=value,this.requestUpdate("datasets",previous)}get hiddenDatums(){return this._hiddenDatums}set hiddenDatums(value){const previous=this._hiddenDatums;this._hiddenDatums=projectHiddenDatasetIndexes(value)??Object.freeze([]),this.requestUpdate("hiddenDatums",previous)}get plugins(){return this._plugins}set plugins(value){if(Object.is(value,this.pluginsSource)||Object.is(value,this._plugins))return;const previous=this._plugins;this._plugins=projectChartPlugins(value),this.pluginsSource=value,this.requestUpdate("plugins",previous)}get dataTableVisible(){return this.dataTableToggle?this.dataTableExpandedOverride??this.showDataTable:this.showDataTable}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get config(){return this._config}set config(value){if(Object.is(value,this.configSource))return;const previous=this._config;this._config=projectChartConfiguration(value),this.configSource=value,this.requestUpdate("config",previous)}normalizeEffectiveConfig(config){return config}effectiveConfig(){return this.normalizeEffectiveConfig(this.config??this.slottedConfig)}onConfigSlotChange(event){const script=event.currentTarget.assignedElements({flatten:!0}).find(element=>element.localName==="script"&&element.type.trim().toLowerCase()==="application/json");let next;if(script)try{const parsed=JSON.parse(script.textContent??"");next=projectChartConfiguration(parsed)}catch{next=void 0}this.slottedConfig=next}effectiveData(){const generated={labels:[...this.canonicalLabels()],datasets:this.datasets.map(series=>{const{points:_points,...safeSeries}=series;return{...safeSeries,data:[...canonicalSeriesPoints(series)??canonicalSeriesData(series)],yAxisID:series.axis==="y2"?"y2":"y"}})},override=projectChartDataConfiguration(this.effectiveConfig()?.data),merged=override?deepMerge(generated,override):generated,projected=projectChartDataConfiguration(merged);return{labels:projected?.labels??[],datasets:projected?.datasets??[]}}callbackDatasetIndex(value,effective=this.effectiveData()){const datasetIndex=chartCallbackDatasetIndex(value);if(datasetIndex===void 0)return;const visualDatasetCount=this.visualDatasetSourceIndexes?.length??effective.datasets.length;if(datasetIndex>=visualDatasetCount)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex;return effective.datasets[sourceDatasetIndex]?datasetIndex:void 0}callbackIndexes(value,effective=this.effectiveData()){const hit=chartCallbackIndexes(value);if(!hit)return;const visualDatasetCount=this.visualDatasetSourceIndexes?.length??effective.datasets.length;if(hit.datasetIndex>=visualDatasetCount)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[hit.datasetIndex]??hit.datasetIndex,dataset=effective.datasets[sourceDatasetIndex];if(!dataset)return;const visualRowCount=this.visualRowSourceIndexes?.length??this.datasetValues(dataset).length;return hit.index<visualRowCount?hit:void 0}effectiveHiddenDatasetIndexes(){const effective=this.effectiveData(),controlled=normalizeHiddenDatasets(this.canonicalHiddenDatasets(),effective.datasets.length);return controlled!==void 0?controlled:effective.datasets.flatMap((dataset,index)=>chartDatasetBoolean(dataset,"hidden")===!0?[index]:[])}applyDatasetVisibility(){if(!this.chart)return!1;const chart=this.chart,sourceDatasetCount=this.effectiveData().datasets.length,datasetCount=this.visualDatasetSourceIndexes?.length??sourceDatasetCount,controlled=normalizeHiddenDatasets(this.canonicalHiddenDatasets(),sourceDatasetCount);if(controlled===void 0){for(let index=0;index<datasetCount;index++)try{const metadata=chart.getDatasetMeta?.(index);metadata&&(metadata.hidden=null)}catch{}return datasetCount>0}const hidden=new Set(controlled);for(let index=0;index<datasetCount;index++){const sourceIndex=this.visualDatasetSourceIndexes?.[index]??index;try{chart.setDatasetVisibility(index,!hidden.has(sourceIndex))}catch{}}return datasetCount>0}isSliceChart(){return["pie","doughnut","polarArea"].includes(this.effectiveType())}applyDatumVisibility(){if(!this.chart||!this.isSliceChart())return!1;const sample=this.dataTableSample(),rows=this.visualRowSourceIndexes,hidden=new Set(normalizeHiddenDatasets(this.hiddenDatums,sample.rowCount));let changed=!1;for(let index=0;index<(rows?.length??sample.rowCount);index++){const visible=!hidden.has(rows?.[index]??index);try{this.chart.getDataVisibility?.(index)===!visible&&(this.chart.toggleDataVisibility?.(index),changed=!0)}catch{}}return changed}hasExplicitConfigData(){const config=this.effectiveConfig();if(!isSafeChartConfigurationRecord(config))return!1;const data=chartRecordValue(config,"data");return data!==MISSING_OWN_DATA_DESCRIPTOR&&data!==UNSAFE_OWN_DATA_DESCRIPTOR}datasetLabel(dataset,index){return chartDatasetLabel(dataset)||this.localize("chartPointLabel",void 0,{n:getNumberFormat(this.effectiveLocale).format(index+1)})}datasetValues(dataset){return chartDatasetValues(dataset)}isPointDataset(dataset){const values=this.datasetValues(dataset);return this.effectiveType()==="scatter"||this.effectiveType()==="bubble"||values.some(value=>normalizedChartPoint(value)!==null)}appendData(label,values,maxPoints=0){const limit=Number.isFinite(maxPoints)?Math.max(0,Math.floor(maxPoints)):0,appendedValues=projectChartNumberData(values)??Object.freeze([]);if(this.hasExplicitConfigData()){const effective=this.effectiveData();let domainLength2=effective.labels.length;for(const dataset of effective.datasets)this.isPointDataset(dataset)||(domainLength2=Math.max(domainLength2,this.datasetValues(dataset).length));const labels2=[...effective.labels,...Array.from({length:Math.max(0,domainLength2-effective.labels.length)},()=>""),label],effectiveConfig=this.effectiveConfig(),currentData=projectChartDataConfiguration(effectiveConfig?.data)??{},explicitLabels=admitChartArray(currentData.labels)!==void 0,explicitDatasets=admitChartArray(currentData.datasets)!==void 0,nextLabels=limit>0?labels2.slice(-limit):labels2;if(explicitLabels||(this.labels=nextLabels.map(labelText)),!explicitDatasets){const datasets2=this.datasets.map((series,index)=>{if(canonicalSeriesPoints(series)!==void 0)return series;const current=canonicalSeriesData(series),data=[...current,...Array.from({length:Math.max(0,domainLength2-current.length)},()=>null),appendedValues[index]??null];return{...series,data:limit>0?data.slice(-limit):data}});this.datasets=datasets2}if(explicitLabels||explicitDatasets){const nextData={...currentData};explicitLabels&&(nextData.labels=nextLabels),explicitDatasets&&(nextData.datasets=effective.datasets.map((dataset,index)=>{if(this.isPointDataset(dataset))return dataset;const current=this.datasetValues(dataset),peer=chartDatasetPeerValues(dataset),padding=Array.from({length:Math.max(0,domainLength2-current.length)},()=>null),data=[...peer,...padding,appendedValues[index]??null],canonical=[...current,...padding,appendedValues[index]??null],nextData2=limit>0?data.slice(-limit):data,nextCanonical=limit>0?canonical.slice(-limit):canonical;return canonicalChartDatasetDataValues.set(nextData2,Object.freeze(nextCanonical)),{...dataset,data:nextData2}})),this.config={...effectiveConfig,data:nextData}}return}const currentLabels=this.canonicalLabels();let domainLength=currentLabels.length;for(const series of this.datasets)canonicalSeriesPoints(series)===void 0&&(domainLength=Math.max(domainLength,canonicalSeriesData(series).length));const labels=[...currentLabels,...Array.from({length:Math.max(0,domainLength-currentLabels.length)},()=>""),label],datasets=this.datasets.map((series,index)=>{if(canonicalSeriesPoints(series)!==void 0)return series;const current=canonicalSeriesData(series),data=[...current,...Array.from({length:Math.max(0,domainLength-current.length)},()=>null),appendedValues[index]??null];return{...series,data:limit>0?data.slice(-limit):data}});this.labels=limit>0?labels.slice(-limit):labels,this.datasets=datasets}exportData(format){if(format==="png")return this.chart?.toBase64Image?.()??"";const effective=this.effectiveData(),columns=effective.datasets.map((dataset,datasetIndex)=>{const values=this.datasetValues(dataset),label=this.datasetLabel(dataset,datasetIndex),points=values.map(normalizedChartPoint).filter(point=>point!==null);return{dataset,label,point:this.isPointDataset(dataset),radius:points.some(point=>point.r!=null),pointLabel:points.some(point=>point.label!=null)}}),header=["label",...columns.flatMap(column=>column.point?[`${column.label} x`,`${column.label} y`,...column.radius?[`${column.label} r`]:[],...column.pointLabel?[`${column.label} label`]:[]]:[column.label])].map(escapeCsvField).join(",");let rowCount=effective.labels.length;for(const dataset of effective.datasets)rowCount=Math.max(rowCount,this.datasetValues(dataset).length);const exportCell=(value,metadata)=>typeof value!="number"||!Number.isFinite(value)?value??"":this.formatExportValue(value,metadata)??value,rows=Array.from({length:rowCount},(_,index)=>{const firstPoint=effective.datasets.map(dataset=>normalizedChartPoint(this.datasetValues(dataset)[index])).find(point=>point!==null),label=labelText(effective.labels[index])||firstPoint?.label||"";return[label,...columns.flatMap((column,datasetIndex)=>{const value=this.datasetValues(column.dataset)[index],axis=this.datasetValueAxis(column.dataset),metadata={datasetIndex,index,label:label||void 0,seriesLabel:column.label,...axis===void 0?{}:{axis}};if(!column.point)return[exportCell(value,metadata)];const point=normalizedChartPoint(value);return point?[exportCell(point.x,{...metadata,statistic:"x"}),exportCell(point.y,{...metadata,statistic:"y"}),...column.radius?[point.r==null?"":exportCell(point.r,{...metadata,statistic:"r"})]:[],...column.pointLabel?[point.label??""]:[]]:["","",...column.radius?[""]:[],...column.pointLabel?[""]:[]]})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
2
- `)}connectedCallback(){super.connectedCallback(),this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=onAnnotationPluginRegistered(()=>this.rebuildAfterAnnotationRegistration()),this.syncAnnouncementSinks(),this.visible=!this.ownerWindow?.IntersectionObserver,this.armReducedMotionWatcher();const ownerWindow=this.ownerWindow,ResizeObserverCtor=ownerWindow?.ResizeObserver;ResizeObserverCtor&&(this.resizeObserver=new ResizeObserverCtor(entries=>{const width=entries[0]?.contentRect.width??this.getBoundingClientRect().width;if(Number.isFinite(width)&&this.lastObservedInlineSize!==void 0&&Math.abs(width-this.lastObservedInlineSize)<.5||(this.lastObservedInlineSize=width,this.resizeDrawFrame!==void 0))return;const frameOwner=this.ownerWindow;frameOwner&&(this.resizeDrawFrameOwner=frameOwner,this.resizeDrawFrame=frameOwner.requestAnimationFrame(()=>{this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,!(!this.isConnected||this.ownerWindow!==frameOwner)&&(this.updateAutoLegendPosition()||this.drawIfVisible())}))}),this.resizeObserver.observe(this)),this.updateAutoLegendPosition();const generation=++this.loadGeneration;this.zoom&&this.requestZoomFeature(),this.loadLibrary(this.zoom).then(async mod=>{try{await this.updateComplete}catch{return}if(await new Promise(resolve=>this.updateBrowserDerivedState(resolve)),!(generation!==this.loadGeneration||!this.isConnected)){if(this.loading=!1,!mod){this.loadFailed=!0;return}this.loadFailed=!1,this.chartJsModule=mod,this.drawIfVisible()}}),this.needsDataLabels&&this.requestDataLabelsFeature(),this.needsAnnotations&&this.requestAnnotationFeature();const IntersectionObserverCtor=ownerWindow?.IntersectionObserver;if(IntersectionObserverCtor){const observerGeneration=++this.intersectionGeneration,observer=new IntersectionObserverCtor(entries=>{if(observerGeneration!==this.intersectionGeneration||this.intersectionObserver!==observer||!this.isConnected||this.ownerWindow!==ownerWindow)return;const wasVisible=this.visible;this.visible=entries[0]?.isIntersecting??!0,this.visible&&!wasVisible&&this.drawIfVisible()});this.intersectionObserver=observer,observer.observe(this)}}disconnectedCallback(){super.disconnectedCallback(),this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=void 0,this.releaseAnnouncementSinks(),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.announcedFeatureWarnings.clear(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeDrawFrame!==void 0&&this.resizeDrawFrameOwner?.cancelAnimationFrame(this.resizeDrawFrame),this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,this.lastObservedInlineSize=void 0,this.loadGeneration+=1,this.zoomLoadGeneration+=1,this.dataLabelsLoadGeneration+=1,this.annotationLoadGeneration+=1,this.discardChart(!1),this.builtPlugins=[],this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.intersectionGeneration+=1,this.visible=!0,this.disarmReducedMotionWatcher()}adoptedCallback(){super.adoptedCallback(),this.releaseAnnouncementSinks(),this.syncAnnouncementSinks(),this.armReducedMotionWatcher()}armReducedMotionWatcher(){const ownerWindow=this.ownerWindow;ownerWindow?.matchMedia&&(this.reducedMotionWindow===ownerWindow&&this.reducedMotionQuery||(this.disarmReducedMotionWatcher(),this.reducedMotionWindow=ownerWindow,this.reducedMotionQuery=ownerWindow.matchMedia("(prefers-reduced-motion: reduce)"),this.reducedMotionQuery.addEventListener("change",this.onReducedMotionChange)))}disarmReducedMotionWatcher(){this.reducedMotionQuery?.removeEventListener("change",this.onReducedMotionChange),this.reducedMotionQuery=void 0,this.reducedMotionWindow=void 0}syncAnnouncementSinks(){!this.isConnected||this.politeAnnouncementSink?.element.ownerDocument===this.ownerDocument&&this.assertiveAnnouncementSink?.element.ownerDocument===this.ownerDocument||(this.releaseAnnouncementSinks(),this.politeAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.assertiveAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}))}releaseAnnouncementSinks(){this.politeAnnouncementSink?.release(),this.politeAnnouncementSink=void 0,this.assertiveAnnouncementSink?.release(),this.assertiveAnnouncementSink=void 0}get ownerWindow(){return this.ownerDocument?.defaultView??void 0}computedStyle(element=this){const view=this.ownerWindow;return view?view.getComputedStyle(element):"style"in element?element.style:this.style}applyDataLabelsPlugin(plugin){this.dataLabelsPlugin=plugin;let rebuilt=!1;plugin&&this.needsDataLabels&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],rebuilt=!0),this.drawIfVisible(),rebuilt&&this.showsLegend&&this.requestUpdate()}get zoomFeatureAvailable(){return this.zoom&&this.zoomFeatureState==="available"}featureWarningMessages(){if(this.loading||this.loadFailed)return[];const messages=[];return this.zoom&&this.zoomFeatureState==="unavailable"&&messages.push(this.localize("chartZoomUnavailable")),this.dataLabelsFeatureState==="unavailable"&&(this.dataLabels&&messages.push(this.localize("chartDataLabelsUnavailable")),this.stackTotals&&messages.push(this.localize("chartStackTotalsUnavailable"))),this.needsAnnotations&&this.annotationFeatureState==="unavailable"&&messages.push(this.localize("chartAnnotationsUnavailable")),messages}requestZoomFeature(){const generation=++this.zoomLoadGeneration;if(!this.zoom){this.zoomFeatureState="idle";return}this.zoomFeatureState="loading",this.loadZoomFeature().then(result=>{generation!==this.zoomLoadGeneration||!this.isConnected||!this.zoom||(this.zoomFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.drawIfVisible(),this.requestUpdate())})}requestAnnotationFeature(){const generation=++this.annotationLoadGeneration;if(!this.needsAnnotations){this.annotationFeatureState="idle";return}this.annotationFeatureState="loading",this.loadAnnotationFeature().then(result=>{generation!==this.annotationLoadGeneration||!this.isConnected||!this.needsAnnotations||(result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.annotationFeatureState=result.kind==="available"?"available":"unavailable",this.applyAnnotationPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate())})}applyAnnotationPlugin(plugin){this.annotationPlugin=plugin,plugin&&this.needsAnnotations&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[]),this.drawIfVisible()}rebuildAfterAnnotationRegistration(){!this.chart||this.needsAnnotations||(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],this.drawIfVisible())}requestDataLabelsFeature(){const generation=++this.dataLabelsLoadGeneration;if(!this.needsDataLabels){this.dataLabelsFeatureState="idle";return}this.dataLabelsFeatureState="loading",this.loadDataLabelsFeature().then(result=>{generation!==this.dataLabelsLoadGeneration||!this.isConnected||!this.needsDataLabels||(this.dataLabelsFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.applyDataLabelsPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate())})}willUpdate(changed){super.willUpdate(changed),this.zoomed&&this.effectiveType()!==this.builtType&&(this.zoomed=!1,this.emit("lr-zoom",{zoomed:!1}))}updated(changed){if(super.updated(changed),!this.isConnected)return;const wasMounting=this.isMounting;this.isMounting=!1,changed.has("keyboardDatumAnnouncement")&&changed.get("keyboardDatumAnnouncement")!==void 0&&this.keyboardDatumAnnouncement!==""&&this.politeAnnouncementSink?.announce(this.keyboardDatumAnnouncement),changed.has("loadFailed")&&changed.get("loadFailed")!==void 0&&this.loadFailed&&this.assertiveAnnouncementSink?.announce(this.localize("chartMissingLibrary"));const dataTruncation=this.dataTruncationMessage();if(wasMounting&&(this.lastDataTruncationAnnouncement=dataTruncation),!this.loading&&!this.loadFailed){const featureWarnings=this.featureWarningMessages();for(const warning of featureWarnings)this.announcedFeatureWarnings.has(warning)||this.assertiveAnnouncementSink?.announce(warning);this.announcedFeatureWarnings=new Set(featureWarnings),!wasMounting&&dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.politeAnnouncementSink?.announce(dataTruncation))}if(this.setAttribute("aria-busy",String(this.loading)),changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}if(this.loading)return;changed.has("zoom")&&this.requestZoomFeature(),(changed.has("dataLabels")||changed.has("stackTotals"))&&this.requestDataLabelsFeature(),changed.has("annotations")&&this.requestAnnotationFeature();const contentChanged=this.chartContentChanged(changed),effectiveDirection=this.effectiveDirection,effectiveLocale=this.effectiveLocale,contextChanged=this.lastDrawnDirection!==void 0&&this.lastDrawnDirection!==effectiveDirection||this.lastDrawnLocale!==void 0&&this.lastDrawnLocale!==effectiveLocale;if(this.lastDrawnDirection=effectiveDirection,this.lastDrawnLocale=effectiveLocale,!contentChanged&&!contextChanged){changed.has("hiddenDatums")&&this.visible&&this.applyDatumVisibility()&&this.chart?.update("none");return}this.drawIfVisible()}chartContentChanged(changed){return["type","labels","datasets","hiddenDatasets","description","grid","axes","compact","indexAxis","label","legendPosition","min","max","scaleType","annotations","plugins","autoLegendPosition","valueFormatter","formatter","area","height","xLabel","yLabel","y2Label","beginAtZero","stacked","withoutAnimation","withoutLegend","withoutTooltip","dataLabels","stackTotals","config","slottedConfig","zoom","locale","strings","loading"].some(name=>changed.has(name))}seriesToDataset(s,index,palette,effectiveType,chartStyle=this.chartStyleOptions(palette),rowIndexes){const series=canonicalChartSeries(s);if(!series)return{label:"",data:[]};const points=canonicalSeriesPoints(series),fullNormalizedData=points?points.map(normalizedChartPoint):canonicalSeriesData(series).map(value=>typeof value=="number"&&Number.isFinite(value)?value:null),normalizedData=rowIndexes?rowIndexes.map(rowIndex=>fullNormalizedData[rowIndex]??null):fullNormalizedData,borderFallback=chartStyle.borderColors[index%chartStyle.borderColors.length]??palette[index%palette.length],fillFallback=chartStyle.fillColors[index%chartStyle.fillColors.length]??palette[index%palette.length],sourceColors=projectChartStrings(series.color),authoredColors=sourceColors&&rowIndexes?rowIndexes.map(rowIndex=>sourceColors[rowIndex]??""):typeof series.color=="string"?series.color:sourceColors,colors=typeof authoredColors=="string"?[resolveCanvasColor(this,authoredColors,borderFallback??"transparent")]:authoredColors?resolveCanvasColors(this,authoredColors,borderFallback??"transparent"):void 0,sliceChart=effectiveType==="pie"||effectiveType==="doughnut"||effectiveType==="polarArea",sliceFillColors=sliceChart&&chartStyle.fillColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.fillColors[sourceIndex%chartStyle.fillColors.length]}):void 0,sliceBorderColors=sliceChart&&chartStyle.borderColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.borderColors[sourceIndex%chartStyle.borderColors.length]}):void 0,fill=series.fill??this.area,backgroundColor=colors??sliceFillColors??fillFallback,datasetType=series.type??effectiveType,authoredSegmentColors=series.segmentColors?.length&&rowIndexes?rowIndexes.map(rowIndex=>series.segmentColors[rowIndex%series.segmentColors.length]):series.segmentColors,segmentColors=authoredSegmentColors?resolveCanvasColors(this,authoredSegmentColors,colors?.[0]??borderFallback??"transparent"):void 0,authoredPointColors=series.pointColors&&rowIndexes?rowIndexes.map(rowIndex=>series.pointColors[rowIndex]??""):series.pointColors,backgroundColors=projectChartStrings(backgroundColor),backgroundColorValue=typeof backgroundColor=="string"?backgroundColor:void 0,resolvedBackgroundColor=datasetType==="line"&&fill&&(colors||!chartStyle.authoredFillColors[index%chartStyle.authoredFillColors.length])?backgroundColors?backgroundColors.map(color=>translucentAreaColor(this,color)):backgroundColorValue&&translucentAreaColor(this,backgroundColorValue):backgroundColor,encoding=forcedColorEncoding(index),resolvedBackgroundColors=projectChartStrings(resolvedBackgroundColor),resolvedBackgroundColorValue=typeof resolvedBackgroundColor=="string"?resolvedBackgroundColor:void 0,encodedBackgroundColor=chartStyle.forcedColors?resolvedBackgroundColors?resolvedBackgroundColors.map((color,itemIndex)=>this.forcedColorPattern(sliceChart?itemIndex:index,color)):resolvedBackgroundColorValue&&this.forcedColorPattern(index,resolvedBackgroundColorValue):resolvedBackgroundColor,pointRadii=projectChartPointRadii(series.pointRadius);return{label:series.label,data:normalizedData,type:series.type,fill,...datasetType==="bar"&&this.hasConfiguredBarOption("borderRadius")?{}:{borderRadius:chartStyle.borderRadius},...datasetType==="bar"&&!Number.isFinite(series.width)&&this.hasConfiguredBarOption("borderWidth")||isArcDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"arc","borderWidth")?{}:{borderWidth:nonNegativeFinite(series.width,datasetType==="line"||datasetType==="radar"?chartStyle.lineBorderWidth:chartStyle.borderWidth)},borderDash:series.dash?[4,4]:chartStyle.forcedColors?[...encoding.dash]:void 0,pointStyle:chartStyle.forcedColors?encoding.pointStyle:void 0,backgroundColor:encodedBackgroundColor,borderColor:colors?.[0]??sliceBorderColors??borderFallback,pointBackgroundColor:authoredPointColors?resolveCanvasColors(this,authoredPointColors,colors?.[0]??borderFallback??"transparent"):void 0,...isPointDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"point","radius")?{}:{pointRadius:pointRadii?(rowIndexes?rowIndexes.map(rowIndex=>pointRadii[rowIndex]):pointRadii).map(radius=>nonNegativeFinite(radius,chartStyle.pointRadius)):nonNegativeFinite(series.pointRadius,chartStyle.pointRadius)},...segmentColors?.length?{segment:{borderColor:ctx=>segmentColors[ctx.p0DataIndex%segmentColors.length]}}:{},yAxisID:series.axis==="y2"?"y2":"y"}}hasConfiguredElementOption(datasetTypeKey,elementKey,option){const read=(value,key)=>{if(!isChartRecord(value))return;const descriptor=chartRecordValue(value,key);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value},options=this.effectiveConfig()?.options,dataset=read(read(options,"datasets"),datasetTypeKey),scopes=[dataset,read(read(dataset,"elements"),elementKey),read(read(options,"elements"),elementKey),options],prefixed=`${elementKey}${option[0].toUpperCase()}${option.slice(1)}`;return scopes.some(scope=>read(scope,prefixed)!==void 0||read(scope,option)!==void 0)}hasConfiguredBarOption(option){return this.hasConfiguredElementOption("bar","bar",option)}themeColors(){const cs=this.computedStyle(),grid=cs.getPropertyValue("--grid-color").trim()||cs.getPropertyValue("--lr-chart-grid-color").trim()||cs.getPropertyValue("--_lr-chart-grid-color").trim(),tick=cs.getPropertyValue("--lr-chart-tick-color").trim()||cs.getPropertyValue("--_lr-chart-tick-color").trim(),legend=cs.getPropertyValue("--lr-chart-legend-color").trim()||cs.getPropertyValue("--_lr-chart-legend-color").trim(),tooltipBg=cs.getPropertyValue("--lr-chart-tooltip-bg").trim()||cs.getPropertyValue("--_lr-chart-tooltip-bg").trim(),tooltipText=cs.getPropertyValue("--lr-chart-tooltip-text").trim()||cs.getPropertyValue("--_lr-chart-tooltip-text").trim();return{grid:resolveCanvasColor(this,grid,FALLBACK_GRID_COLOR),tick:resolveCanvasColor(this,tick,FALLBACK_TICK_COLOR),tickFontSize:this.styleNumber("--lr-chart-tick-font-size","--_lr-chart-tick-font-size",FALLBACK_TICK_FONT_SIZE),legend:resolveCanvasColor(this,legend,FALLBACK_LEGEND_COLOR),tooltipBg:resolveCanvasColor(this,tooltipBg,FALLBACK_TOOLTIP_BG),tooltipText:resolveCanvasColor(this,tooltipText,FALLBACK_TOOLTIP_TEXT)}}styleColor(name,fallback){const value=this.computedStyle().getPropertyValue(name).trim();return value?resolveCanvasColor(this,value,fallback):fallback}styleNumber(name,fallbackToken,fallback){const computed=this.computedStyle(),value=computed.getPropertyValue(name).trim()||computed.getPropertyValue(fallbackToken).trim(),direct=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))(?:px)?$/i.exec(value);if(direct){const resolved=Number.parseFloat(direct[1]);if(Number.isFinite(resolved)&&resolved>=0)return resolved}if(!value||!this.ownerWindow)return fallback;const probe=this.ownerDocument.createElement("span");probe.hidden=!0,probe.setAttribute("aria-hidden","true"),probe.style.inlineSize=value,(this.shadowRoot??this).append(probe);try{const resolved=Number.parseFloat(this.computedStyle(probe).inlineSize);return Number.isFinite(resolved)&&resolved>=0?resolved:fallback}finally{probe.remove()}}explicitTickFontSize(){const resolved=this.styleNumber("--lr-chart-tick-font-size","--lr-chart-tick-font-size",NaN);return Number.isNaN(resolved)?void 0:resolved}forcedColorPattern(index,background){return this.ownerWindow?createForcedColorPattern(this.ownerDocument,index,background,this.styleColor("--lr-color-surface",FALLBACK_TOOLTIP_BG)):background}chartStyleOptions(palette){const computed=this.computedStyle(),authoredFillColors=palette.map((_,index)=>index<6&&!!computed.getPropertyValue(`--fill-color-${index+1}`).trim()),borderColors=palette.map((fallback,index)=>index<6?this.styleColor(`--border-color-${index+1}`,fallback):fallback),fillColors=palette.map((fallback,index)=>index<6?this.styleColor(`--fill-color-${index+1}`,fallback):fallback);return{borderColors,fillColors,authoredFillColors,borderRadius:this.styleNumber("--border-radius","--lr-radius",6),borderWidth:this.styleNumber("--border-width","--lr-border-width-thin",1),gridBorderWidth:this.styleNumber("--grid-border-width","--lr-border-width-thin",1),lineBorderWidth:this.styleNumber("--line-border-width","--lr-border-width-medium",2),pointRadius:this.styleNumber("--point-radius","--lr-space-2xs",4),forcedColors:forcedColorsActive(this.ownerWindow)}}get needsDataLabels(){return this.dataLabels||this.stackTotals}get needsAnnotations(){return this.normalizedAnnotations().length>0}normalizedAnnotations(){return this.canonicalAnnotations()}annotationColor(tone){const token=`--lr-color-${tone??"neutral"}`,raw=this.computedStyle().getPropertyValue(token).trim();return resolveCanvasColor(this,raw,FALLBACK_TICK_COLOR)}annotationOptions(){const entries={};return this.normalizedAnnotations().forEach((entry,index)=>{const axis=entry.axis==="x"?"x":"y",color=this.annotationColor(entry.tone),label=entry.label?{content:entry.label,display:!0,color:this.themeColors().tick}:void 0;if(typeof entry.value=="number"){entries[`lr-annotation-${index}`]={type:"line",scaleID:axis,value:entry.value,borderColor:color,borderWidth:2,...label?{label}:{}};return}const bounds=axis==="y"?{yMin:entry.from,yMax:entry.to}:{xMin:entry.from,xMax:entry.to};entries[`lr-annotation-${index}`]={type:"box",...bounds,backgroundColor:translucentAreaColor(this,color),borderColor:color,borderWidth:0,...label?{label}:{}}}),entries}datalabelsOptions(theme,effectiveType){if(!this.needsDataLabels)return{display:!1};const effective=this.effectiveData(),datasets=effective.datasets,stackTotalsActive=this.stackTotals&&this.stacked&&(effectiveType==="bar"||effectiveType==="line"),sourceDatasetIndex=visualIndex=>this.visualDatasetSourceIndexes?.[visualIndex]??visualIndex,sourceRowIndex=visualIndex=>this.visualRowSourceIndexes?.[visualIndex]??visualIndex,topDatasetIndexByAxis=new Map;if(stackTotalsActive){const visualDatasetCount=this.visualDatasetSourceIndexes?.length??datasets.length;for(let visualIndex=0;visualIndex<visualDatasetCount;visualIndex+=1){const dataset=datasets[sourceDatasetIndex(visualIndex)],axis=chartDatasetAxis(dataset);topDatasetIndexByAxis.set(axis,visualIndex)}}const totalsByAxis=stackTotalsActive?{y:this.computeStackTotals("y"),y2:this.computeStackTotals("y2")}:void 0;return{color:theme.tick,align:stackTotalsActive?"end":"center",anchor:stackTotalsActive?"end":"center",display:context=>{const indexes=this.callbackIndexes(context,effective);if(!indexes)return!1;const{datasetIndex,index}=indexes,dataset=datasets[sourceDatasetIndex(datasetIndex)],axis=chartDatasetAxis(dataset);return stackTotalsActive?topDatasetIndexByAxis.get(axis)!==datasetIndex?this.dataLabels:totalsByAxis?.[axis][sourceRowIndex(index)]==null?this.dataLabels:!0:this.dataLabels},formatter:(value,context)=>{const indexes=this.callbackIndexes(context,effective);if(!indexes)return"";const{datasetIndex,index}=indexes,dataset=datasets[sourceDatasetIndex(datasetIndex)],axis=chartDatasetAxis(dataset),metadata=this.datumFormatterMetadata(datasetIndex,index,effective);if(stackTotalsActive&&topDatasetIndexByAxis.get(axis)===datasetIndex){const total=totalsByAxis?.[axis][sourceRowIndex(index)];if(total!=null)return this.formatDataLabel(total,this.stackTotalMetadata(metadata))}const numeric=chartDatumNumericValue(this.scaledSliceDatasets.has(datasetIndex)?this.datasetValues(dataset)[sourceRowIndex(index)]:value);return numeric===void 0?"":this.formatDataLabel(numeric,metadata)}}}formatDataLabel(value,metadata={}){if(this.formatter||this.valueFormatter){const formatted=this.formatter?.({value,surface:"visual",...metadata})??this.valueFormatter?.(value,"tooltip");if(formatted!=null)return String(formatted)}return value.toLocaleString(this.effectiveLocale)}computeStackTotals(axisId="y"){const effective=this.effectiveData(),members=effective.datasets.filter(dataset=>chartDatasetAxis(dataset)===axisId),categoryCount=members.reduce((max,dataset)=>Math.max(max,this.datasetValues(dataset).length),effective.labels.length),totals=[];for(let i=0;i<categoryCount;i++){let sum=0,any=!1;for(const dataset of members){const value=this.datasetValues(dataset)[i],numeric=chartDatumNumericValue(value);numeric!==void 0&&(sum=finiteAdd(sum,numeric),any=!0)}totals.push(any?sum:null)}return totals}seriesPalette(){return seriesPalette(this)}tickOptions(theme,kind="value",axis="y"){return{color:theme.tick,font:{size:theme.tickFontSize},...(this.formatter||this.valueFormatter)&&kind==="value"?{callback:value=>this.formatValue(value,"tick",{axis})}:{}}}effectiveIndexAxis(){return this.indexAxis==="y"?"y":"x"}valueScaleType(){return this.scaleType==="logarithmic"?"logarithmic":"linear"}valueBeginAtZero(){return this.valueScaleType()==="logarithmic"?void 0:this.beginAtZero}scaleBounds(){const min=this.min!==null&&Number.isFinite(this.min)?finiteNumber(this.min,0):void 0,max=this.max!==null&&Number.isFinite(this.max)?finiteNumber(this.max,0):void 0;return{...min!==void 0?{min}:{},...max!==void 0?{max}:{}}}gridAxisVisible(axis){const grid=normalizeChartGrid(this.grid);return grid==="both"||grid===axis}axisVisible(axis){const axes=normalizeChartGrid(this.axes);return!this.compact&&(axes==="both"||axes===axis)}buildScales(effectiveType,theme,chartStyle){if(effectiveType==="pie"||effectiveType==="doughnut")return{};if(effectiveType==="radar"||effectiveType==="polarArea"){const explicitPointLabelFontSize=this.explicitTickFontSize();return{r:{beginAtZero:this.beginAtZero,...this.scaleBounds(),ticks:{...this.tickOptions(theme,"value","r"),showLabelBackdrop:!1,z:1},grid:{color:theme.grid,display:this.gridAxisVisible("y"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},angleLines:{color:theme.grid,display:this.gridAxisVisible("x"),lineWidth:chartStyle.gridBorderWidth},pointLabels:{color:theme.tick,...explicitPointLabelFontSize!==void 0?{font:{size:explicitPointLabelFontSize}}:{}}}}}const hasY2=this.effectiveData().datasets.some(dataset=>chartDatasetAxis(dataset)==="y2"),rtl=this.effectiveDirection==="rtl",stacked=this.stacked&&(effectiveType==="bar"||effectiveType==="line"),horizontalCategorical=(effectiveType==="bar"||effectiveType==="line")&&this.effectiveIndexAxis()==="y",xKind=effectiveType==="scatter"||effectiveType==="bubble"||horizontalCategorical?"value":"category",yKind=horizontalCategorical?"category":"value",valueAxis=horizontalCategorical?"x":"y",bounds=this.scaleBounds();return{x:{display:this.axisVisible("x"),type:xKind==="value"?this.valueScaleType():"category",beginAtZero:xKind==="value"?this.valueBeginAtZero():void 0,...valueAxis==="x"?bounds:{},title:{display:!!this.xLabel,text:this.xLabel,color:theme.tick},ticks:this.tickOptions(theme,xKind,"x"),grid:{color:theme.grid,display:this.gridAxisVisible("x"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},stacked},y:{display:this.axisVisible("y"),type:yKind==="value"?this.valueScaleType():"category",position:rtl?"right":"left",beginAtZero:yKind==="value"?this.valueBeginAtZero():void 0,...valueAxis==="y"?bounds:{},title:{display:!!this.yLabel,text:this.yLabel,color:theme.tick},ticks:this.tickOptions(theme,yKind,"y"),grid:{color:theme.grid,display:this.gridAxisVisible("y"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},stacked},...hasY2?{y2:{display:this.axisVisible("y"),type:this.valueScaleType(),position:rtl?"left":"right",...valueAxis==="y"?bounds:{},grid:{drawOnChartArea:!1,color:theme.grid,display:this.gridAxisVisible("y"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},title:{display:!!this.y2Label,text:this.y2Label,color:theme.tick},ticks:this.tickOptions(theme,"value","y2"),stacked}}:{}}}handlePointClick(event,chart){let elements;try{elements=chart.getElementsAtEventForMode(event,"nearest",{intersect:!0},!0)}catch{return}const admission=admitChartArray(elements);if(!admission||!chartArrayIsStillAdmitted(admission))return;const first=chartRecordValue(admission.source,"0");if(first===MISSING_OWN_DATA_DESCRIPTOR||first===UNSAFE_OWN_DATA_DESCRIPTOR)return;const effective=this.effectiveData(),hit=this.callbackIndexes(first.value,effective);if(!hit)return;const datasetIndex=this.visualDatasetSourceIndexes?.[hit.datasetIndex]??hit.datasetIndex,index=this.visualRowSourceIndexes?.[hit.index]??hit.index,value=this.datasetValues(effective.datasets[datasetIndex])[index]??null,label=normalizedChartPoint(value)?.label??(labelText(effective.labels[index])||void 0);this.activateDatum({datasetIndex,index,label,value})}chartDatums(){const effective=this.effectiveData(),datasets=(this.visualDatasetSourceIndexes??effective.datasets.map((_dataset,index)=>index)).map(index=>effective.datasets[index]);let rowIndexes=this.visualRowSourceIndexes;if(!rowIndexes){let sourceRowCount=effective.labels.length;for(const dataset of datasets)sourceRowCount=Math.max(sourceRowCount,chartDatasetValues(dataset).length);rowIndexes=Array.from({length:sourceRowCount},(_value,index)=>index)}const labels=rowIndexes.map(index=>effective.labels[index]),rowCount=rowIndexes.length,sample=sampleChartTableIndexes(rowCount,datasets.length),datums=[];return sample.seriesIndexes.forEach(datasetIndex=>{const dataset=datasets[datasetIndex];if(!dataset)return;const values=chartDatasetValues(dataset);sample.rowIndexes.forEach(localIndex=>{const sourceIndex=rowIndexes[localIndex]??localIndex,value=values[sourceIndex];value!=null&&(typeof value=="number"&&!Number.isFinite(value)||datums.push({datasetIndex:this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex,index:sourceIndex,label:normalizedChartPoint(value)?.label??(labelText(labels[localIndex])||void 0),value}))})}),datums}datumDisplayValue(value,context={surface:"spoken"}){const{surface,...metadata}=context,format=(numeric2,statistic)=>surface==="table"?this.formatTableValue(numeric2,{...metadata,statistic}):this.formatSpokenValue(numeric2,{...metadata,statistic}),point=normalizedChartPoint(value);if(point){const x=format(point.x,"x"),y=format(point.y,"y"),coordinates=point.r==null?this.localize("chartPointCoordinates",void 0,{x,y}):this.localize("chartBubblePointCoordinates",void 0,{x,y,radius:format(point.r,"r")});return point.label!==void 0?this.localize("chartLabeledPoint",void 0,{label:point.label,coordinates}):coordinates}const numeric=chartDatumNumericValue(value);return numeric===void 0?labelText(value):format(numeric)}datumAnnouncement(datum,position,total){const dataset=this.effectiveData().datasets[datum.datasetIndex],series=chartDatasetLabel(dataset)||this.localize("chartSeriesLabel");return this.localize("liteChartMarkSummary",void 0,{series,label:datum.label??this.localize("chartPointLabel",void 0,{n:getNumberFormat(this.effectiveLocale).format(datum.index+1)}),value:this.datumDisplayValue(datum.value,{surface:"spoken",datasetIndex:datum.datasetIndex,index:datum.index,label:datum.label,seriesLabel:series,...this.datasetValueAxis(dataset)===void 0?{}:{axis:this.datasetValueAxis(dataset)}}),index:getNumberFormat(this.effectiveLocale).format(position+1),total:getNumberFormat(this.effectiveLocale).format(total)})}activateDatum(datum){const datums=this.chartDatums(),position=datums.findIndex(candidate=>candidate.datasetIndex===datum.datasetIndex&&candidate.index===datum.index);position>=0&&(this.keyboardDatumIndex=position,this.keyboardDatumAnnouncement=this.datumAnnouncement(datum,position,datums.length));const type=this.effectiveType(),kind=type==="bar"?"bar":type==="pie"||type==="doughnut"||type==="polarArea"?"slice":type==="line"?"segment":"point";this.emit("lr-datum-activate",{...datum,kind}),this.emit("lr-point-click",datum)}onCanvasFocus(){const datums=this.chartDatums();datums.length&&(this.keyboardDatumIndex=Math.min(this.keyboardDatumIndex,datums.length-1),this.keyboardDatumAnnouncement=this.datumAnnouncement(datums[this.keyboardDatumIndex],this.keyboardDatumIndex,datums.length))}onCanvasKeyDown(event){const datums=this.chartDatums();if(!datums.length)return;if(this.keyboardDatumIndex=Math.min(this.keyboardDatumIndex,datums.length-1),event.key==="Enter"||event.key===" "){event.preventDefault(),this.activateDatum(datums[this.keyboardDatumIndex]);return}const rtl=this.effectiveDirection==="rtl",forward=rtl?"ArrowLeft":"ArrowRight",backward=rtl?"ArrowRight":"ArrowLeft";let next=this.keyboardDatumIndex;if(event.key===forward||event.key==="ArrowDown")next=Math.min(datums.length-1,next+1);else if(event.key===backward||event.key==="ArrowUp")next=Math.max(0,next-1);else if(event.key==="Home")next=0;else if(event.key==="End")next=datums.length-1;else return;event.preventDefault(),this.keyboardDatumIndex=next,this.keyboardDatumAnnouncement=this.datumAnnouncement(datums[next],next,datums.length)}effectiveType(){return this.effectiveConfig()?.type??normalizeChartType(this.type)}localizedChartType(){const type=this.effectiveType(),key=CHART_TYPE_MESSAGE_KEYS[type];return key?this.localize(key):String(type)}formatValue(value,context,metadata={}){const numeric=chartDatumNumericValue(value);return numeric===void 0?value:this.formatter?.({value:numeric,surface:context,...metadata})??this.valueFormatter?.(numeric,context)??value}datasetValueAxis(dataset){const type=this.effectiveType();if(!(type==="pie"||type==="doughnut"))return type==="radar"||type==="polarArea"?"r":(type==="bar"||type==="line")&&this.effectiveIndexAxis()==="y"?"x":dataset===void 0?void 0:chartDatasetAxis(dataset)}datumFormatterMetadata(visualDatasetIndex,visualRowIndex,effective=this.effectiveData()){return this.sourceDatumFormatterMetadata(this.visualDatasetSourceIndexes?.[visualDatasetIndex]??visualDatasetIndex,visualRowIndex===void 0?void 0:this.visualRowSourceIndexes?.[visualRowIndex]??visualRowIndex,effective)}sourceDatumFormatterMetadata(datasetIndex,index,effective=this.effectiveData()){const dataset=effective.datasets[datasetIndex],point=index===void 0||dataset===void 0?null:normalizedChartPoint(this.datasetValues(dataset)[index]),label=index===void 0?void 0:point?.label??(labelText(effective.labels[index])||void 0),axis=this.datasetValueAxis(dataset);return{datasetIndex,...index===void 0?{}:{index},...label===void 0?{}:{label},...dataset===void 0?{}:{seriesLabel:this.datasetLabel(dataset,datasetIndex)},...axis===void 0?{}:{axis}}}stackTotalMetadata(metadata){return{...metadata.index===void 0?{}:{index:metadata.index},...metadata.label===void 0?{}:{label:metadata.label},...metadata.axis===void 0?{}:{axis:metadata.axis},statistic:"total"}}legendValue(item,_chart,effective=this.effectiveData()){const datasetIndex=this.callbackDatasetIndex(item,effective);if(datasetIndex===void 0)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex,data=this.datasetValues(effective.datasets[sourceDatasetIndex]);if(!data.length)return;const visualRows=this.visualRowSourceIndexes??data.map((_value,index)=>index),indexDescriptor=chartRecordValue(item,"index");if(indexDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR)return;if(indexDescriptor!==MISSING_OWN_DATA_DESCRIPTOR){const itemIndex=chartIndex(indexDescriptor.value);return itemIndex===void 0||itemIndex>=visualRows.length?void 0:chartDatumNumericValue(data[visualRows[itemIndex]]??null)}let sum=0,hasValue=!1;for(const sourceRowIndex of visualRows){const datum=data[sourceRowIndex],value=chartDatumNumericValue(datum);value!==void 0&&(sum=finiteAdd(sum,value),hasValue=!0)}return hasValue?sum:void 0}legendLabels(chart){const generateLabels=this.chartJsModule?.defaults?.plugins?.legend?.labels?.generateLabels;let generated;if(generateLabels)try{generated=projectChartLegendItems(generateLabels(chart))}catch{generated=void 0}const effective=this.effectiveData(),fallbackDatasets=(this.visualDatasetSourceIndexes??effective.datasets.map((_dataset,index)=>index)).map(sourceIndex=>effective.datasets[sourceIndex]);return(generated??fallbackDatasets.map((dataset,index)=>({text:chartDatasetLabel(dataset)||String(index+1),datasetIndex:index}))).map(item=>{const value=this.legendValue(item,chart,effective),visualDatasetIndex=this.callbackDatasetIndex(item,effective),visualRowIndex=chartIndex(chartDatasetValue(item,"index")),formatted=this.formatValue(value,"legend",visualDatasetIndex===void 0?{}:this.datumFormatterMetadata(visualDatasetIndex,visualRowIndex,effective));return formatted===value||formatted===void 0?item:{...item,text:this.localize("chartValueLabel",void 0,{label:labelText(chartDatasetValue(item,"text")),value:String(formatted)})}})}tooltipLabel(context,horizontal=!1){const parsed=projectChartDatum(chartDatasetValue(context,"parsed")),raw=projectChartDatum(chartDatasetValue(context,"raw")),parsedPoint=normalizedChartPoint(parsed);let rawValue=(horizontal&&!normalizedChartPoint(raw)?parsedPoint?.x:parsedPoint?.y)??parsed??raw;const scaledSlices=this.scaledSliceDatasets.size>0,effective=scaledSlices||this.formatter!==void 0?this.effectiveData():void 0,hit=effective===void 0?void 0:this.callbackIndexes(context,effective),indexes=scaledSlices?hit:void 0,scaled=indexes!==void 0&&effective!==void 0&&this.scaledSliceDatasets.has(indexes.datasetIndex);if(scaled){const dataset=effective.datasets[this.visualDatasetSourceIndexes?.[indexes.datasetIndex]??indexes.datasetIndex];rawValue=this.datasetValues(dataset)[this.visualRowSourceIndexes?.[indexes.index]??indexes.index]}let formatted=this.formatValue(rawValue,"tooltip",hit===void 0||effective===void 0?{}:this.datumFormatterMetadata(hit.datasetIndex,hit.index,effective));if(!scaled&&formatted===rawValue||formatted===void 0)return;scaled&&typeof formatted=="number"&&(formatted=this.formatSummaryValue(formatted));const label=chartDatasetLabel(chartDatasetValue(context,"dataset"));return label?this.localize("chartValueLabel",void 0,{label,value:String(formatted)}):String(formatted)}updateAutoLegendPosition(){const width=this.getBoundingClientRect().width||this.clientWidth,next=width>0&&width<480?"bottom":"right";return next===this.autoLegendPosition?!1:(this.autoLegendPosition=next,!0)}legendPositionForConfig(){const position=normalizeLegendPosition(this.legendPosition);return position==="auto"?this.autoLegendPosition:position==="start"?this.effectiveDirection==="rtl"?"right":"left":position==="end"?this.effectiveDirection==="rtl"?"left":"right":position}legendPositionForLayout(){const position=this.legendPositionForConfig();return position==="top"||position==="right"||position==="left"?position:"bottom"}legendGridPlacement(){const position=normalizeLegendPosition(this.legendPosition);if(position==="auto")return this.autoLegendPosition==="right"?"inline-end":"bottom";if(position==="start")return"inline-start";if(position==="end")return"inline-end";if(position==="top")return"top";const rtl=this.effectiveDirection==="rtl";return position==="left"?rtl?"inline-end":"inline-start":position==="right"?rtl?"inline-start":"inline-end":"bottom"}updateChartArea(chart=this.chart){const area=chart?.chartArea;if(!area)return;const next={top:Number(area.top),left:Number(area.left),right:Number(area.right),bottom:Number(area.bottom),width:Number(area.width),height:Number(area.height)};if(![next.top,next.left,next.right,next.bottom,next.width,next.height].every(Number.isFinite))return;const previous=this.resolvedChartArea;previous&&previous.top===next.top&&previous.left===next.left&&previous.right===next.right&&previous.bottom===next.bottom&&previous.width===next.width&&previous.height===next.height||(this.resolvedChartArea=next,this.chartAreaUpdateQueued||(this.chartAreaUpdateQueued=!0,queueMicrotask(()=>{this.chartAreaUpdateQueued=!1,this.isConnected&&this.requestUpdate()})))}get chartArea(){return this.resolvedChartArea}set chartArea(_value){}buildConfig(){const theme=this.themeColors(),effectiveType=this.effectiveType();let tooltipIndexAxis=this.effectiveIndexAxis();const palette=this.seriesPalette(),chartStyle=this.chartStyleOptions(palette),rawDataEscapeHatch=this.hasExplicitConfigData(),labels=this.canonicalLabels();let visualRows,visualSeries;if(rawDataEscapeHatch)this.visualRowSourceIndexes=void 0,this.visualDatasetSourceIndexes=void 0;else{let rowCount=labels.length;for(const series of this.datasets)rowCount=Math.max(rowCount,(canonicalSeriesPoints(series)??canonicalSeriesData(series)).length);const sample=sampleChartTableIndexes(rowCount,this.datasets.length);visualRows=sample.rowIndexes.length<rowCount?sample.rowIndexes:void 0,visualSeries=sample.seriesIndexes.length<this.datasets.length?sample.seriesIndexes:void 0,this.visualRowSourceIndexes=visualRows,this.visualDatasetSourceIndexes=visualSeries}const generated={type:effectiveType,data:{labels:visualRows?visualRows.map(index=>labels[index]??""):[...labels],datasets:visualSeries?visualSeries.map(sourceIndex=>this.seriesToDataset(this.datasets[sourceIndex],sourceIndex,palette,effectiveType,chartStyle,visualRows)):this.datasets.map((s,i)=>this.seriesToDataset(s,i,palette,effectiveType,chartStyle,visualRows))},...this.plugins.length||this.needsDataLabels&&this.dataLabelsPlugin?{plugins:[...this.plugins,...this.needsDataLabels&&this.dataLabelsPlugin?[this.dataLabelsPlugin]:[]]}:{},options:{locale:this.effectiveLocale,responsive:!0,maintainAspectRatio:!1,...this.compact&&!["pie","doughnut","radar","polarArea"].includes(effectiveType)?{layout:{padding:0,autoPadding:!1}}:{},indexAxis:this.effectiveIndexAxis(),animation:this.withoutAnimation||prefersReducedMotion(this.ownerWindow)?!1:void 0,interaction:{intersect:!1,mode:effectiveType==="scatter"?"nearest":"index"},onClick:(event,_elements,chart)=>this.handlePointClick(event,chart),plugins:{...this.needsAnnotations&&this.annotationPlugin?{annotation:{annotations:this.annotationOptions()}}:{},legend:{display:!1,position:this.legendPositionForConfig(),labels:{color:theme.legend,...this.formatter||this.valueFormatter?{generateLabels:chart=>this.legendLabels(chart)}:{}}},tooltip:{enabled:!this.withoutTooltip,backgroundColor:theme.tooltipBg,titleColor:theme.tooltipText,bodyColor:theme.tooltipText,...this.formatter||this.valueFormatter||(effectiveType==="pie"||effectiveType==="doughnut")&&!this.hasExplicitConfigData()?{callbacks:{label:context=>this.tooltipLabel(context,tooltipIndexAxis==="y")}}:{},filter:item=>{const effective=this.effectiveData(),datasetIndex=this.callbackDatasetIndex(item,effective);if(datasetIndex===void 0)return!1;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex;return chartDatasetBoolean(effective.datasets[sourceDatasetIndex],"noTooltip")!==!0}},zoom:this.zoom&&this.zoomFeatureState!=="unavailable"?{pan:{enabled:!1},zoom:{wheel:{enabled:!0},drag:{enabled:!0},pinch:{enabled:!0},mode:"x",onZoomComplete:()=>{this.suppressZoomComplete||(this.zoomed=!0,this.emit("lr-zoom",{zoomed:!0}))}},limits:{x:{min:"original",max:"original"}}}:void 0,datalabels:this.datalabelsOptions(theme,effectiveType)},onResize:chart=>this.updateChartArea(chart),scales:this.buildScales(effectiveType,theme,chartStyle)}},effectiveConfig=this.effectiveConfig();if(!effectiveConfig)return generated;const merged=deepMerge(generated,effectiveConfig);tooltipIndexAxis=merged.options.indexAxis==="y"?"y":"x";const requiredPlugins=[...this.plugins,...this.needsDataLabels&&this.dataLabelsPlugin?[this.dataLabelsPlugin]:[]],mergedPluginAdmission=admitChartArray(merged.plugins),mergedPlugins=projectChartPlugins(merged.plugins,mergedPluginAdmission);return mergedPluginAdmission||requiredPlugins.length?merged.plugins=[...mergedPlugins,...requiredPlugins.filter(plugin=>!mergedPlugins.includes(plugin))]:merged.plugins!==void 0&&(merged.plugins=[]),merged}scaleExtremeSlices(config){if(this.scaledSliceDatasets.clear(),!(config.type!=="pie"&&config.type!=="doughnut"||this.hasExplicitConfigData()))for(const[index,dataset]of config.data.datasets.entries()){const source=this.datasetValues(dataset),maximum=source.reduce((largest,value)=>{const number=chartDatumNumericValue(value);return number===void 0?largest:Math.max(largest,Math.abs(number))},0);maximum<=Number.MAX_SAFE_INTEGER||(dataset.data=source.map(value=>{const number=chartDatumNumericValue(value);return number===void 0?value:number/maximum}),this.scaledSliceDatasets.add(index))}}draw(){if(!this.chartJsModule||!this.canvasEl)return;const config=this.buildConfig();this.scaleExtremeSlices(config);const effectiveType=config.type,nextPlugins=projectChartPlugins(config.plugins),samePlugins=nextPlugins.length===this.builtPlugins.length&&nextPlugins.every((plugin,index)=>plugin===this.builtPlugins[index]);if(this.chart&&this.builtType===effectiveType&&samePlugins){this.chart.data=config.data,this.chart.options=config.options??{},this.applyDatasetVisibility(),this.chart.update("none"),this.applyDatumVisibility()&&this.chart.update("none"),this.updateChartArea(this.chart);return}this.discardChart(!0),this.chart=new this.chartJsModule.Chart(this.canvasEl,config),this.builtType=effectiveType,this.builtPlugins=[...nextPlugins];const datasetsControlled=this.canonicalHiddenDatasets()!==void 0;datasetsControlled&&this.applyDatasetVisibility(),(this.applyDatumVisibility()||datasetsControlled)&&this.chart.update("none"),this.updateChartArea(this.chart)}drawIfVisible(){!this.isConnected||!this.visible||this.draw()}discardChart(announceZoomReset){this.chart?.destroy(),this.chart=void 0,this.resolvedChartArea=void 0,this.zoomed&&(this.zoomed=!1,announceZoomReset&&this.emit("lr-zoom",{zoomed:!1}))}renderChart(){this.drawIfVisible()}resetZoom(){this.suppressZoomComplete=!0;try{this.chart?.resetZoom?.()}finally{this.suppressZoomComplete=!1}this.zoomed=!1,this.emit("lr-zoom",{zoomed:!1})}refreshTheme(){this.drawIfVisible(),this.showsLegend&&this.requestUpdate()}summarizeSeries(dataset){let count=0,first=0,last=0,min=0,minIndex=0,max=0,maxIndex=0;for(const[index,datum]of this.datasetValues(dataset).entries()){const value=chartDatumNumericValue(datum);value!==void 0&&(count===0&&(first=value,min=value,minIndex=index,max=value,maxIndex=index),last=value,value<min&&(min=value,minIndex=index),value>max&&(max=value,maxIndex=index),count++)}return count?{count,first,last,min,minIndex,max,maxIndex}:void 0}formatSummaryValue(value){return getNumberFormat(this.effectiveLocale).format(value)}formatTableValue(value,metadata={}){return this.formatter?.({value,surface:"table",...metadata})??this.valueFormatter?.(value,"table")??this.formatSummaryValue(value)}formatExportValue(value,metadata={}){return this.formatter?.({value,surface:"export",...metadata})??this.valueFormatter?.(value,"table")}formatSpokenValue(value,metadata={}){return this.formatter?.({value,surface:"spoken",...metadata})??this.valueFormatter?.(value,"table")??this.formatSummaryValue(value)}tableStackAxes(){const type=this.effectiveType();if(!this.stackTotals||!this.stacked||type!=="bar"&&type!=="line")return[];const present=new Set;for(const dataset of this.effectiveData().datasets)present.add(chartDatasetAxis(dataset));return["y","y2"].filter(axis=>present.has(axis))}tableStackTotalLabel(axis,axisCount){if(axisCount===1)return this.localize("chartTotal");const axisLabel=axis==="y2"?this.y2Label||this.localize("chartSecondaryAxis"):this.yLabel||this.localize("chartPrimaryAxis");return this.localize("chartAxisTotal",void 0,{axis:axisLabel})}accessibleName(fallback){return this.getAttribute("aria-label")??this.label??fallback}chartDescription(){if(this.description)return this.description;const effective=this.effectiveData(),sample=this.dataTableSample(effective),includePointDetails=!this.hasCustomDataTable(),summaries=sample.seriesIndexes.map(index=>{const dataset=effective.datasets[index],seriesLabel=this.datasetLabel(dataset,index),values=this.summarizeSeries(dataset);if(!values)return this.localize("chartSeriesNoData",void 0,{label:seriesLabel});const trend=values.last>values.first?this.localize("chartTrendIncreasing"):values.last<values.first?this.localize("chartTrendDecreasing"):this.localize("chartTrendFlat"),rawValues=this.datasetValues(dataset),datumLabelAt=rowIndex=>{const datum=rawValues[rowIndex];return normalizedChartPoint(datum)?.label??(labelText(effective.labels[rowIndex])||void 0)},summary=this.localize("chartSummary",void 0,{label:seriesLabel,count:this.formatSummaryValue(values.count),min:this.formatSpokenValue(values.min,{datasetIndex:index,index:values.minIndex,label:datumLabelAt(values.minIndex),seriesLabel,statistic:"min"}),max:this.formatSpokenValue(values.max,{datasetIndex:index,index:values.maxIndex,label:datumLabelAt(values.maxIndex),seriesLabel,statistic:"max"}),trend}),pointDetails=includePointDetails?sample.rowIndexes.flatMap(rowIndex=>{const point=rawValues[rowIndex];return normalizedChartPoint(point)?[this.datumDisplayValue(point,{surface:"spoken",datasetIndex:index,index:rowIndex,label:datumLabelAt(rowIndex),seriesLabel})]:[]}):[];return pointDetails.length?[summary,...pointDetails].join(this.localize("chartSummarySeparator")):summary}),base=summaries.length?this.localize("chartSummaryWithData",void 0,{type:this.localizedChartType(),summaries:summaries.join(this.localize("chartSummarySeparator"))}):this.localize("chartSummaryEmpty",void 0,{type:this.localizedChartType()}),annotationLabels=this.normalizedAnnotations().map(entry=>entry.label?.trim()).filter(label=>!!label);return annotationLabels.length?[base,...annotationLabels].join(this.localize("chartSummarySeparator")):base}dataTableSample(effective=this.effectiveData()){let rowCount=effective.labels.length;for(const dataset of effective.datasets)rowCount=Math.max(rowCount,this.datasetValues(dataset).length);const indexes=sampleChartTableIndexes(rowCount,effective.datasets.length);return{rowCount,seriesCount:effective.datasets.length,...indexes}}generatedDataIsSampled(){if(this.hasCustomDataTable())return!1;const sample=this.dataTableSample();return sample.rowCount===0||sample.seriesCount===0?!1:sample.rowIndexes.length<sample.rowCount||sample.seriesIndexes.length<sample.seriesCount}dataTruncationMessage(){return this.generatedDataIsSampled()?this.localize("chartDataSampled"):""}renderDataTable(){const effective=this.effectiveData(),sample=this.dataTableSample(effective),valuesBySeries=new Map(sample.seriesIndexes.map(index=>[index,this.datasetValues(effective.datasets[index])])),stackAxes=this.tableStackAxes(),stackTotals=new Map(stackAxes.map(axis=>[axis,this.computeStackTotals(axis)])),stackValueAxes=new Map(stackAxes.map(axis=>[axis,this.datasetValueAxis(effective.datasets.find(dataset=>chartDatasetAxis(dataset)===axis))]));return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{specialistTokens}from"../../../internal/specialist-tokens.styles.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{loadChartJs}from"./chart-core-loader.js";import{onAnnotationPluginRegistered}from"../../../internal/chart-annotation-registration.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{loadChartJsWithZoom,loadChartJsWithZoomResult,loadChartJsWithDataLabelsResult,loadChartJsWithAnnotationResult}from"./chart-feature-loader.js";import{styles}from"./chart.styles.js";import"../../overlays/skeleton/skeleton.class.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{escapeCsvField}from"../../utility/export-button/csv.js";import{trueDefaultBooleanFromAttributeConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{finiteAdd,finiteNumber}from"../../../internal/numbers.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{FALLBACK_GRID_COLOR,FALLBACK_LEGEND_COLOR,FALLBACK_TICK_COLOR,FALLBACK_TICK_FONT_SIZE,FALLBACK_TOOLTIP_BG,FALLBACK_TOOLTIP_TEXT,resolveCanvasColor,resolveCanvasColors,seriesPalette,translucentAreaColor}from"./chart-colors.js";import{createForcedColorPattern,forcedColorEncoding,forcedColorsActive}from"./chart-forced-colors.js";import{legendVisibilityDetail,normalizeHiddenDatasets}from"./chart-legend-visibility.js";import{sampleChartTableIndexes}from"./chart-table-sampling.js";import{LYRA_DEFAULT_chart,LYRA_DEFAULT_chartAnnotationsUnavailable,LYRA_DEFAULT_chartAxisTotal,LYRA_DEFAULT_chartBubblePointCoordinates,LYRA_DEFAULT_chartCategory,LYRA_DEFAULT_chartData,LYRA_DEFAULT_chartDataLabelsUnavailable,LYRA_DEFAULT_chartDataSampled,LYRA_DEFAULT_chartLabeledPoint,LYRA_DEFAULT_chartMissingLibrary,LYRA_DEFAULT_chartPointCoordinates,LYRA_DEFAULT_chartPointLabel,LYRA_DEFAULT_chartPrimaryAxis,LYRA_DEFAULT_chartSecondaryAxis,LYRA_DEFAULT_chartSeriesLabel,LYRA_DEFAULT_chartSeriesNoData,LYRA_DEFAULT_chartStackTotalsUnavailable,LYRA_DEFAULT_chartSummary,LYRA_DEFAULT_chartSummaryEmpty,LYRA_DEFAULT_chartSummarySeparator,LYRA_DEFAULT_chartSummaryWithData,LYRA_DEFAULT_chartTotal,LYRA_DEFAULT_chartTrendDecreasing,LYRA_DEFAULT_chartTrendFlat,LYRA_DEFAULT_chartTrendIncreasing,LYRA_DEFAULT_chartTypeBar,LYRA_DEFAULT_chartTypeBubble,LYRA_DEFAULT_chartTypeDoughnut,LYRA_DEFAULT_chartTypeLine,LYRA_DEFAULT_chartTypePie,LYRA_DEFAULT_chartTypePolarArea,LYRA_DEFAULT_chartTypeRadar,LYRA_DEFAULT_chartTypeScatter,LYRA_DEFAULT_chartValueLabel,LYRA_DEFAULT_chartValuePercentageLabel,LYRA_DEFAULT_chartZoomUnavailable,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_liteChartMarkSummary,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_resetZoom,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";import{seriesPalette as seriesPalette2}from"./chart-colors.js";const CHART_TYPES=new Set(["line","bar","scatter","pie","doughnut","radar","polarArea","bubble"]),CHART_TYPE_MESSAGE_KEYS={line:"chartTypeLine",bar:"chartTypeBar",scatter:"chartTypeScatter",pie:"chartTypePie",doughnut:"chartTypeDoughnut",radar:"chartTypeRadar",polarArea:"chartTypePolarArea",bubble:"chartTypeBubble"};function normalizeChartType(value){return typeof value=="string"&&CHART_TYPES.has(value)?value:"bar"}function normalizeChartGrid(value){return value==="x"||value==="y"||value==="none"||value==="both"?value:"both"}function normalizeLegendPosition(value){return value==="left"||value==="top"||value==="right"||value==="bottom"||value==="center"||value==="chartArea"||value==="start"||value==="end"||value==="auto"?value:projectLegendPosition(value)??"top"}function isArcDatasetType(datasetType){return datasetType==="pie"||datasetType==="doughnut"||datasetType==="polarArea"}function isPointDatasetType(datasetType){return datasetType==="line"||datasetType==="radar"||datasetType==="scatter"||datasetType==="bubble"}function isChartRecord(value){try{return typeof value=="object"&&value!==null&&!Array.isArray(value)}catch{return!1}}const MAX_CHART_INPUT_ENTRIES=1e4,MAX_CHART_CONFIGURATION_DEPTH=32,OMIT_CHART_CONFIGURATION_VALUE=Symbol("omit-chart-configuration-value");function admitChartArray(value){try{if(!Array.isArray(value))return;const descriptor=getOwnDataDescriptor(value,"length");return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0?void 0:{source:value,length:Math.min(descriptor.value,MAX_CHART_INPUT_ENTRIES)}}catch{return}}function chartArrayIsStillAdmitted(admission){const descriptor=chartRecordValue(admission.source,"length");return descriptor!==MISSING_OWN_DATA_DESCRIPTOR&&descriptor!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=admission.length}function copyChartArrayEntries(admission){if(!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=Array.from({length:admission.length},()=>{});for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||(output[index]=descriptor.value)}return Object.freeze(output)}function chartEnumerableKeys(value){try{return Object.keys(value)}catch{return}}const canonicalChartSeriesSnapshots=new WeakMap,admittedChartPlugins=new WeakSet,canonicalChartDatasetValues=new WeakMap,canonicalChartDatasetDataValues=new WeakMap;function canonicalChartSeries(value){if(isChartRecord(value))return canonicalChartSeriesSnapshots.has(value)?value:projectChartSeries(value)}function canonicalSeriesData(series){const canonical=canonicalChartSeries(series);return canonical?canonicalChartSeriesSnapshots.get(canonical)?.data??[]:[]}function canonicalSeriesPoints(series){const canonical=canonicalChartSeries(series);return canonical?canonicalChartSeriesSnapshots.get(canonical)?.points:void 0}function chartRecordValue(value,property2){return getOwnDataDescriptor(value,property2)}function projectChartNumberData(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>null);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const candidate=descriptor.value;output[index]=typeof candidate=="number"&&Number.isFinite(candidate)?candidate:null}return Object.freeze(output)}function projectChartPoint(value){if(!isChartRecord(value))return null;const x=chartRecordValue(value,"x"),y=chartRecordValue(value,"y"),r=chartRecordValue(value,"r"),label=chartRecordValue(value,"label");return x===MISSING_OWN_DATA_DESCRIPTOR||x===UNSAFE_OWN_DATA_DESCRIPTOR||y===MISSING_OWN_DATA_DESCRIPTOR||y===UNSAFE_OWN_DATA_DESCRIPTOR||r===UNSAFE_OWN_DATA_DESCRIPTOR||label===UNSAFE_OWN_DATA_DESCRIPTOR||typeof x.value!="number"||!Number.isFinite(x.value)||typeof y.value!="number"||!Number.isFinite(y.value)?null:Object.freeze({x:x.value,y:y.value,...r!==MISSING_OWN_DATA_DESCRIPTOR&&typeof r.value=="number"&&Number.isFinite(r.value)&&r.value>=0?{r:r.value}:{},...label!==MISSING_OWN_DATA_DESCRIPTOR&&typeof label.value=="string"?{label:label.value}:{}})}function projectChartDatum(value){if(typeof value=="number")return Number.isFinite(value)?value:null;if(typeof value=="string"||typeof value=="bigint")return value;if(!isChartRecord(value))return null;const x=chartRecordValue(value,"x"),y=chartRecordValue(value,"y"),r=chartRecordValue(value,"r"),label=chartRecordValue(value,"label"),output={};let hasValue=!1;for(const[property2,descriptor]of[["x",x],["y",y],["r",r]])descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="number"||!Number.isFinite(descriptor.value)||(output[property2]=descriptor.value,hasValue=!0);return label!==MISSING_OWN_DATA_DESCRIPTOR&&label!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof label.value=="string"&&(output.label=label.value,hasValue=!0),hasValue?Object.freeze(output):null}function projectChartDatasetValues(admission){if(!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=Array.from({length:admission.length},()=>null);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||(output[index]=projectChartDatum(descriptor.value))}return Object.freeze(output)}function projectChartPoints(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>null);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||(output[index]=projectChartPoint(descriptor.value))}return Object.freeze(output)}function projectChartStrings(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>"");for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="string"||(output[index]=descriptor.value)}return Object.freeze(output)}function projectChartPointRadii(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=Array.from({length:admission.length},()=>Number.NaN);for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof descriptor.value!="number"||!Number.isFinite(descriptor.value)||(output[index]=descriptor.value)}return Object.freeze(output)}const CHART_ANNOTATION_TONES=new Set(["neutral","brand","success","warning","danger"]);function projectHiddenDatasetIndexes(value){if(value===void 0)return;const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index)),candidate=descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value;descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof candidate!="number"||!Number.isInteger(candidate)||output.push(candidate)}return Object.freeze(output)}function projectChartAnnotations(value){const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const entry=chartRecordValue(admission.source,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR||!isChartRecord(entry.value))continue;const axis=chartRecordValue(entry.value,"axis"),lineValue=chartRecordValue(entry.value,"value"),from=chartRecordValue(entry.value,"from"),to=chartRecordValue(entry.value,"to"),label=chartRecordValue(entry.value,"label"),tone=chartRecordValue(entry.value,"tone");if(axis===UNSAFE_OWN_DATA_DESCRIPTOR||lineValue===UNSAFE_OWN_DATA_DESCRIPTOR||from===UNSAFE_OWN_DATA_DESCRIPTOR||to===UNSAFE_OWN_DATA_DESCRIPTOR||label===UNSAFE_OWN_DATA_DESCRIPTOR||tone===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const axisValue=axis===MISSING_OWN_DATA_DESCRIPTOR?void 0:axis.value,line=lineValue===MISSING_OWN_DATA_DESCRIPTOR?void 0:lineValue.value,fromValue=from===MISSING_OWN_DATA_DESCRIPTOR?void 0:from.value,toValue=to===MISSING_OWN_DATA_DESCRIPTOR?void 0:to.value,labelValue=label===MISSING_OWN_DATA_DESCRIPTOR?void 0:label.value,toneValue=tone===MISSING_OWN_DATA_DESCRIPTOR?void 0:tone.value;if(axisValue!==void 0&&axisValue!=="x"&&axisValue!=="y"||labelValue!==void 0&&typeof labelValue!="string"||toneValue!==void 0&&(typeof toneValue!="string"||!CHART_ANNOTATION_TONES.has(toneValue)))continue;const normalizedAxis=axisValue==="x"||axisValue==="y"?axisValue:void 0,common={...normalizedAxis!==void 0?{axis:normalizedAxis}:{},...typeof labelValue=="string"?{label:labelValue}:{},...typeof toneValue=="string"?{tone:toneValue}:{}};if(typeof line=="number"&&Number.isFinite(line)){output.push(Object.freeze({...common,value:line}));continue}typeof fromValue=="number"&&Number.isFinite(fromValue)&&typeof toValue=="number"&&Number.isFinite(toValue)&&output.push(Object.freeze({...common,from:Math.min(fromValue,toValue),to:Math.max(fromValue,toValue)}))}return Object.freeze(output)}const CHART_SERIES_PROPERTIES=["label","data","points","color","fill","width","dash","noTooltip","axis","stack","pointColors","pointRadius","segmentColors","type"];function projectChartSeries(value){try{if(!isChartRecord(value))return;const descriptors=new Map;for(const property2 of CHART_SERIES_PROPERTIES){const descriptor=chartRecordValue(value,property2);if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)return;descriptors.set(property2,descriptor)}const valueAt=property2=>{const descriptor=descriptors.get(property2);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||descriptor===void 0?void 0:descriptor.value},label=valueAt("label");if(label!==void 0&&typeof label!="string")return;const output={label:label??""},rawData=valueAt("data"),rawDataAdmission=admitChartArray(rawData),data=projectChartNumberData(rawData,rawDataAdmission),rawPoints=valueAt("points"),rawPointsAdmission=admitChartArray(rawPoints),points=projectChartPoints(rawPoints,rawPointsAdmission),color=valueAt("color"),fill=valueAt("fill"),width=valueAt("width"),dash=valueAt("dash"),noTooltip=valueAt("noTooltip"),axis=valueAt("axis"),stack=valueAt("stack"),pointColors=projectChartStrings(valueAt("pointColors")),pointRadius=valueAt("pointRadius"),segmentColors=projectChartStrings(valueAt("segmentColors")),type=valueAt("type");if(data&&rawDataAdmission&&(output.data=rawDataAdmission.source),points&&rawPointsAdmission&&(output.points=rawPointsAdmission.source),typeof color=="string")output.color=color;else{const colors=projectChartStrings(color);colors&&(output.color=colors)}if(typeof fill=="boolean"&&(output.fill=fill),typeof width=="number"&&Number.isFinite(width)&&(output.width=width),typeof dash=="boolean"&&(output.dash=dash),typeof noTooltip=="boolean"&&(output.noTooltip=noTooltip),(axis==="y"||axis==="y2")&&(output.axis=axis),typeof stack=="string"&&(output.stack=stack),pointColors&&(output.pointColors=pointColors),typeof pointRadius=="number"&&Number.isFinite(pointRadius))output.pointRadius=pointRadius;else{const radii=projectChartPointRadii(pointRadius);radii&&(output.pointRadius=radii)}segmentColors&&(output.segmentColors=segmentColors),(type==="line"||type==="bar")&&(output.type=type);const series=Object.freeze(output);return canonicalChartSeriesSnapshots.set(series,{data:data??Object.freeze([]),...points?{points}:{}}),series}catch{return}}function normalizeChartSeries(value){const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const series=canonicalChartSeries(descriptor.value);series&&output.push(series)}return Object.freeze(output)}function isSafeChartConfigurationRecord(value){if(!isChartRecord(value))return!1;try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;const constructor=getOwnDataDescriptor(prototype,"constructor");if(constructor===MISSING_OWN_DATA_DESCRIPTOR||constructor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof constructor.value!="function")return!1;const name=getOwnDataDescriptor(constructor.value,"name"),constructorPrototype=getOwnDataDescriptor(constructor.value,"prototype");return name!==MISSING_OWN_DATA_DESCRIPTOR&&name!==UNSAFE_OWN_DATA_DESCRIPTOR&&name.value==="Object"&&constructorPrototype!==MISSING_OWN_DATA_DESCRIPTOR&&constructorPrototype!==UNSAFE_OWN_DATA_DESCRIPTOR&&constructorPrototype.value===prototype}catch{return!1}}function projectLegendPosition(value){if(!isSafeChartConfigurationRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys||keys.length>MAX_CHART_INPUT_ENTRIES)return;const output={};for(const key of keys){if(UNSAFE_KEYS.has(key))return;const descriptor=chartRecordValue(value,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||typeof descriptor.value!="number"||!Number.isFinite(descriptor.value))return;output[key]=descriptor.value}return Object.freeze(output)}function copyChartConfigurationValue(value,budget,depth=0){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(depth>MAX_CHART_CONFIGURATION_DEPTH||budget.remaining<=0||budget.active.has(value))return OMIT_CHART_CONFIGURATION_VALUE;const array=admitChartArray(value);if(array&&!chartArrayIsStillAdmitted(array))return OMIT_CHART_CONFIGURATION_VALUE;if(array){budget.remaining-=1,budget.active.add(value);try{const output=Array.from({length:array.length},()=>{});for(let index=0;index<array.length&&budget.remaining>0;index+=1){budget.remaining-=1;const descriptor=chartRecordValue(array.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const entry=copyChartConfigurationValue(descriptor.value,budget,depth+1);entry!==OMIT_CHART_CONFIGURATION_VALUE&&(output[index]=entry)}const copied=Object.freeze(output),canonical=canonicalChartDatasetDataValues.get(array.source);return canonical&&canonicalChartDatasetDataValues.set(copied,canonical),copied}finally{budget.active.delete(value)}}if(!isSafeChartConfigurationRecord(value))return value;budget.remaining-=1,budget.active.add(value);try{const keys=chartEnumerableKeys(value);if(!keys)return OMIT_CHART_CONFIGURATION_VALUE;const output=Object.create(null);for(const key of keys){if(budget.remaining<=0)break;if(budget.remaining-=1,UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)continue;const entry=copyChartConfigurationValue(descriptor.value,budget,depth+1);entry!==OMIT_CHART_CONFIGURATION_VALUE&&(output[key]=entry)}return Object.freeze(output)}finally{budget.active.delete(value)}}function projectChartPlugins(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||descriptor.value===null||typeof descriptor.value!="object"&&typeof descriptor.value!="function")continue;const plugin=descriptor.value;if(admittedChartPlugins.has(plugin)){output.push(plugin);continue}const id=chartRecordValue(plugin,"id");id===MISSING_OWN_DATA_DESCRIPTOR||id===UNSAFE_OWN_DATA_DESCRIPTOR||typeof id.value!="string"||id.value.trim()===""||(admittedChartPlugins.add(plugin),output.push(plugin))}return Object.freeze(output)}function projectChartDatasetConfiguration(value){if(!isSafeChartConfigurationRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys)return;const output=Object.create(null),priorCanonicalValues=canonicalChartDatasetValues.get(value);let canonicalValues;for(const key of keys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)continue;const candidate=descriptor.value,array=admitChartArray(candidate);if(key==="data"){if(array){if(!chartArrayIsStillAdmitted(array)){output[key]=Object.freeze([]),canonicalValues=Object.freeze([]);continue}const copied=copyChartArrayEntries(array);output[key]=copied;const canonical=priorCanonicalValues??canonicalChartDatasetDataValues.get(array.source)??projectChartDatasetValues(array);canonicalValues=canonical,canonicalChartDatasetDataValues.set(copied,canonical)}continue}if(key==="label"){typeof candidate=="string"||typeof candidate=="number"||typeof candidate=="boolean"||typeof candidate=="bigint"?output[key]=candidate:array&&(output[key]=copyChartArrayEntries(array));continue}if(key==="hidden"||key==="noTooltip"){typeof candidate=="boolean"&&(output[key]=candidate);continue}if(key==="axis"||key==="yAxisID"||key==="type"||key==="stack"){typeof candidate=="string"&&(output[key]=candidate);continue}output[key]=array?copyChartArrayEntries(array):candidate}const dataset=Object.freeze(output);return canonicalValues&&canonicalChartDatasetValues.set(dataset,canonicalValues),dataset}function projectChartDatasetConfigurations(value,admission=admitChartArray(value)){if(!admission||!chartArrayIsStillAdmitted(admission))return Object.freeze([]);const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const dataset=projectChartDatasetConfiguration(descriptor.value);dataset&&output.push(dataset)}return Object.freeze(output)}function projectChartDataConfiguration(value){if(!isSafeChartConfigurationRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys)return;const output=Object.create(null);for(const key of keys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);if(!(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)){if(key==="labels"){const labels=admitChartArray(descriptor.value);output[key]=labels?copyChartArrayEntries(labels):Object.freeze([]);continue}if(key==="datasets"){output[key]=projectChartDatasetConfigurations(descriptor.value);continue}output[key]=descriptor.value}}return Object.freeze(output)}function projectChartConfiguration(value){if(!isSafeChartConfigurationRecord(value))return;const budget={remaining:MAX_CHART_INPUT_ENTRIES,active:new Set},output=Object.create(null),type=chartRecordValue(value,"type"),data=chartRecordValue(value,"data"),options=chartRecordValue(value,"options"),plugins=chartRecordValue(value,"plugins");type!==MISSING_OWN_DATA_DESCRIPTOR&&type!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof type.value=="string"&&(output.type=type.value);for(const[property2,descriptor]of[["data",data],["options",options]]){if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const copied=copyChartConfigurationValue(descriptor.value,budget);if(copied!==OMIT_CHART_CONFIGURATION_VALUE){if(property2==="data"){const projected=projectChartDataConfiguration(copied);output[property2]=projected??copied;continue}output[property2]=copied}}if(plugins!==MISSING_OWN_DATA_DESCRIPTOR&&plugins!==UNSAFE_OWN_DATA_DESCRIPTOR){const pluginArray=admitChartArray(plugins.value);if(pluginArray)output.plugins=projectChartPlugins(plugins.value,pluginArray);else{const copied=copyChartConfigurationValue(plugins.value,budget);copied!==OMIT_CHART_CONFIGURATION_VALUE&&(output.plugins=copied)}}return Object.freeze(output)}const UNSAFE_KEYS=new Set(["__proto__","constructor","prototype"]);function deepMerge(base,override,seen=new WeakMap){if(!isSafeChartConfigurationRecord(base)||!isSafeChartConfigurationRecord(override))return override===void 0?base:override;const baseRecord=base,overrideRecord=override,baseKeys=chartEnumerableKeys(baseRecord),overrideKeys=chartEnumerableKeys(overrideRecord);if(!baseKeys||!overrideKeys)return override;const previous=seen.get(overrideRecord);if(previous!==void 0)return previous;const result={};for(const key of baseKeys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(baseRecord,key);descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||(result[key]=descriptor.value)}seen.set(overrideRecord,result);try{for(const key of overrideKeys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(overrideRecord,key);if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable)continue;const baseDescriptor=chartRecordValue(baseRecord,key),baseValue=baseDescriptor===MISSING_OWN_DATA_DESCRIPTOR||baseDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:baseDescriptor.value;result[key]=deepMerge(baseValue,descriptor.value,seen)}}finally{seen.delete(overrideRecord)}return result}function normalizedChartPoint(value){return projectChartPoint(projectChartDatum(value))}function chartNumericValue(value){const numeric=typeof value=="number"?value:typeof value=="string"||typeof value=="bigint"?Number(value):Number.NaN;return Number.isFinite(numeric)?numeric:void 0}function chartDatumNumericValue(value){const projected=projectChartDatum(value);if(isChartRecord(projected))for(const property2 of["y","r","x"]){const descriptor=chartRecordValue(projected,property2);if(descriptor!==MISSING_OWN_DATA_DESCRIPTOR&&descriptor!==UNSAFE_OWN_DATA_DESCRIPTOR&&typeof descriptor.value=="number"&&Number.isFinite(descriptor.value))return descriptor.value}return chartNumericValue(projected)}function nonNegativeFinite(value,fallback){return typeof value=="number"&&Number.isFinite(value)&&value>=0?value:fallback}function labelText(value,depth=0){if(value==null)return"";if(typeof value=="string"||typeof value=="number"||typeof value=="boolean"||typeof value=="bigint")return String(value);const admission=admitChartArray(value);if(depth<MAX_CHART_CONFIGURATION_DEPTH&&admission){const values=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));values.push(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?"":labelText(descriptor.value,depth+1))}return values.join(" ")}return""}function chartDatasetValue(dataset,property2){if(!isChartRecord(dataset))return;const descriptor=chartRecordValue(dataset,property2);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value}function chartDatasetLabel(dataset){return labelText(chartDatasetValue(dataset,"label"))}function chartDatasetValues(dataset){if(isChartRecord(dataset)){const snapshot=canonicalChartDatasetValues.get(dataset);if(snapshot)return snapshot}const data=chartDatasetValue(dataset,"data"),admission=admitChartArray(data);return admission?canonicalChartDatasetDataValues.get(admission.source)??copyChartArrayEntries(admission):Object.freeze([])}function chartDatasetPeerValues(dataset){const admission=admitChartArray(chartDatasetValue(dataset,"data"));return admission?copyChartArrayEntries(admission):Object.freeze([])}function chartIndex(value){return typeof value=="number"&&Number.isSafeInteger(value)&&value>=0?value:void 0}function chartCallbackDatasetIndex(value){return chartIndex(chartDatasetValue(value,"datasetIndex"))}function chartCallbackIndexes(value){const datasetIndex=chartCallbackDatasetIndex(value),index=chartIndex(chartDatasetValue(value,"index"))??chartIndex(chartDatasetValue(value,"dataIndex"));return datasetIndex===void 0||index===void 0?void 0:{datasetIndex,index}}function projectChartLegendItem(value){if(!isChartRecord(value))return;const keys=chartEnumerableKeys(value);if(!keys||keys.length>MAX_CHART_INPUT_ENTRIES)return;const output=Object.create(null);for(const key of keys){if(UNSAFE_KEYS.has(key))continue;const descriptor=chartRecordValue(value,key);descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!descriptor.enumerable||(output[key]=descriptor.value)}return output}function projectChartLegendItems(value){const admission=admitChartArray(value);if(!admission||!chartArrayIsStillAdmitted(admission))return;const output=[];for(let index=0;index<admission.length;index+=1){const descriptor=chartRecordValue(admission.source,String(index));if(descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const item=projectChartLegendItem(descriptor.value);item&&output.push(item)}return Object.freeze(output)}function chartDatasetBoolean(dataset,property2){const value=chartDatasetValue(dataset,property2);return typeof value=="boolean"?value:void 0}function chartDatasetAxis(dataset){return chartDatasetValue(dataset,"yAxisID")==="y2"||chartDatasetValue(dataset,"axis")==="y2"?"y2":"y"}function chartDatasetStack(dataset){const value=chartDatasetValue(dataset,"stack");return typeof value=="string"?value:void 0}class LyraChart extends LyraElement{static{this.defaultStrings={...super.defaultStrings,chart:LYRA_DEFAULT_chart,chartAnnotationsUnavailable:LYRA_DEFAULT_chartAnnotationsUnavailable,chartAxisTotal:LYRA_DEFAULT_chartAxisTotal,chartBubblePointCoordinates:LYRA_DEFAULT_chartBubblePointCoordinates,chartCategory:LYRA_DEFAULT_chartCategory,chartData:LYRA_DEFAULT_chartData,chartDataLabelsUnavailable:LYRA_DEFAULT_chartDataLabelsUnavailable,chartDataSampled:LYRA_DEFAULT_chartDataSampled,chartLabeledPoint:LYRA_DEFAULT_chartLabeledPoint,chartMissingLibrary:LYRA_DEFAULT_chartMissingLibrary,chartPointCoordinates:LYRA_DEFAULT_chartPointCoordinates,chartPointLabel:LYRA_DEFAULT_chartPointLabel,chartPrimaryAxis:LYRA_DEFAULT_chartPrimaryAxis,chartSecondaryAxis:LYRA_DEFAULT_chartSecondaryAxis,chartSeriesLabel:LYRA_DEFAULT_chartSeriesLabel,chartSeriesNoData:LYRA_DEFAULT_chartSeriesNoData,chartStackTotalsUnavailable:LYRA_DEFAULT_chartStackTotalsUnavailable,chartSummary:LYRA_DEFAULT_chartSummary,chartSummaryEmpty:LYRA_DEFAULT_chartSummaryEmpty,chartSummarySeparator:LYRA_DEFAULT_chartSummarySeparator,chartSummaryWithData:LYRA_DEFAULT_chartSummaryWithData,chartTotal:LYRA_DEFAULT_chartTotal,chartTrendDecreasing:LYRA_DEFAULT_chartTrendDecreasing,chartTrendFlat:LYRA_DEFAULT_chartTrendFlat,chartTrendIncreasing:LYRA_DEFAULT_chartTrendIncreasing,chartTypeBar:LYRA_DEFAULT_chartTypeBar,chartTypeBubble:LYRA_DEFAULT_chartTypeBubble,chartTypeDoughnut:LYRA_DEFAULT_chartTypeDoughnut,chartTypeLine:LYRA_DEFAULT_chartTypeLine,chartTypePie:LYRA_DEFAULT_chartTypePie,chartTypePolarArea:LYRA_DEFAULT_chartTypePolarArea,chartTypeRadar:LYRA_DEFAULT_chartTypeRadar,chartTypeScatter:LYRA_DEFAULT_chartTypeScatter,chartValueLabel:LYRA_DEFAULT_chartValueLabel,chartValuePercentageLabel:LYRA_DEFAULT_chartValuePercentageLabel,chartZoomUnavailable:LYRA_DEFAULT_chartZoomUnavailable,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,liteChartMarkSummary:LYRA_DEFAULT_liteChartMarkSummary,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,resetZoom:LYRA_DEFAULT_resetZoom,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.immutableEventDetails=Object.freeze(["lr-before-legend-visibility-change","lr-legend-visibility-change","lr-before-datum-visibility-change","lr-datum-visibility-change"])}static{this.ownedCollectionProperties=Object.freeze(["annotations","hiddenDatasets"])}static{this.styles=[LyraElement.styles,specialistTokens,styles,srOnly]}constructor(){super(),this.type="bar",this.labels=[],this._datasets=Object.freeze([]),this.datasetsSource=this._datasets,this._hiddenDatums=Object.freeze([]),this.legendMode="auto",this.legendDisplay="auto",this.description=null,this.grid="both",this.axes="both",this.compact=!1,this.indexAxis="x",this.label=null,this.legendPosition="top",this.scaleType="linear",this.annotations=[],this.max=null,this.min=null,this._plugins=Object.freeze([]),this.pluginsSource=this._plugins,this.area=!1,this.zoom=!1,this.height="280px",this.xLabel=null,this.yLabel=null,this.y2Label="",this.beginAtZero=!0,this.showDataTable=!1,this.dataTableToggle=!1,this.dataTableExpandedOverride=null,this.dataTableId=nextId("chart-data-table"),this.stacked=!1,this.withoutAnimation=!1,this.withoutLegend=!1,this.withoutTooltip=!1,this.dataLabels=!1,this.stackTotals=!1,this.configSource=void 0,this.loading=!0,this.loadFailed=!1,this.loadLibrary=withZoom=>withZoom?loadChartJsWithZoom():loadChartJs(),this.loadZoomFeature=()=>loadChartJsWithZoomResult(),this.loadDataLabelsFeature=()=>loadChartJsWithDataLabelsResult(),this.loadAnnotationFeature=()=>loadChartJsWithAnnotationResult(),this.loadGeneration=0,this.zoomLoadGeneration=0,this.dataLabelsLoadGeneration=0,this.annotationLoadGeneration=0,this.zoomFeatureState="idle",this.dataLabelsFeatureState="idle",this.annotationFeatureState="idle",this.zoomed=!1,this.visible=!0,this.intersectionGeneration=0,this.scaledSliceDatasets=new Set,this.autoLegendPosition="right",this.chartAreaUpdateQueued=!1,this.builtPlugins=[],this.suppressZoomComplete=!1,this.descriptionId=nextId("chart-description"),this.keyboardDatumIndex=0,this.keyboardDatumAnnouncement="",this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.announcedFeatureWarnings=new Set,this.onReducedMotionChange=()=>{!this.isConnected||this.ownerWindow!==this.reducedMotionWindow||this.drawIfVisible()},new ThemeWatcher(this,()=>{this.chart&&this.refreshTheme()})}canonicalLabels(){const source=this.labels;if(this.labelsSnapshot&&Object.is(this.labelsSnapshot.source,source))return this.labelsSnapshot.value;const value=projectChartStrings(source)??Object.freeze([]);return this.labelsSnapshot={source,value},value}canonicalAnnotations(){const source=this.annotations;if(this.annotationsSnapshot&&Object.is(this.annotationsSnapshot.source,source))return this.annotationsSnapshot.value;const value=projectChartAnnotations(source);return this.annotationsSnapshot={source,value},value}canonicalHiddenDatasets(){const source=this.hiddenDatasets;if(this.hiddenDatasetsSnapshot&&Object.is(this.hiddenDatasetsSnapshot.source,source))return this.hiddenDatasetsSnapshot.value;const value=projectHiddenDatasetIndexes(source);return this.hiddenDatasetsSnapshot={source,value},value}get datasets(){return this._datasets}set datasets(value){if(Object.is(value,this.datasetsSource)||Object.is(value,this._datasets))return;const previous=this._datasets;this._datasets=normalizeChartSeries(value),this.datasetsSource=value,this.requestUpdate("datasets",previous)}get hiddenDatums(){return this._hiddenDatums}set hiddenDatums(value){const previous=this._hiddenDatums;this._hiddenDatums=projectHiddenDatasetIndexes(value)??Object.freeze([]),this.requestUpdate("hiddenDatums",previous)}get plugins(){return this._plugins}set plugins(value){if(Object.is(value,this.pluginsSource)||Object.is(value,this._plugins))return;const previous=this._plugins;this._plugins=projectChartPlugins(value),this.pluginsSource=value,this.requestUpdate("plugins",previous)}get dataTableVisible(){return this.dataTableToggle?this.dataTableExpandedOverride??this.showDataTable:this.showDataTable}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get config(){return this._config}set config(value){if(Object.is(value,this.configSource))return;const previous=this._config;this._config=projectChartConfiguration(value),this.configSource=value,this.requestUpdate("config",previous)}normalizeEffectiveConfig(config){return config}effectiveConfig(){return this.normalizeEffectiveConfig(this.config??this.slottedConfig)}onConfigSlotChange(event){const slot=event.currentTarget;slot===this.configSlotEl&&this.collectConfigFromSlot(slot)}collectConfigFromSlot(slot){const script=slot.assignedElements({flatten:!0}).find(element=>element.localName==="script"&&element.type.trim().toLowerCase()==="application/json");let next;if(script)try{const parsed=JSON.parse(script.textContent??"");next=projectChartConfiguration(parsed)}catch{next=void 0}this.slottedConfig=next}effectiveData(){const generated={labels:[...this.canonicalLabels()],datasets:this.datasets.map(series=>{const{points:_points,...safeSeries}=series;return{...safeSeries,data:[...canonicalSeriesPoints(series)??canonicalSeriesData(series)],yAxisID:series.axis==="y2"?"y2":"y"}})},override=projectChartDataConfiguration(this.effectiveConfig()?.data),merged=override?deepMerge(generated,override):generated,projected=projectChartDataConfiguration(merged);return{labels:projected?.labels??[],datasets:projected?.datasets??[]}}callbackDatasetIndex(value,effective=this.effectiveData()){const datasetIndex=chartCallbackDatasetIndex(value);if(datasetIndex===void 0)return;const visualDatasetCount=this.visualDatasetSourceIndexes?.length??effective.datasets.length;if(datasetIndex>=visualDatasetCount)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex;return effective.datasets[sourceDatasetIndex]?datasetIndex:void 0}callbackIndexes(value,effective=this.effectiveData()){const hit=chartCallbackIndexes(value);if(!hit)return;const visualDatasetCount=this.visualDatasetSourceIndexes?.length??effective.datasets.length;if(hit.datasetIndex>=visualDatasetCount)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[hit.datasetIndex]??hit.datasetIndex,dataset=effective.datasets[sourceDatasetIndex];if(!dataset)return;const visualRowCount=this.visualRowSourceIndexes?.length??this.datasetValues(dataset).length;return hit.index<visualRowCount?hit:void 0}effectiveHiddenDatasetIndexes(){const effective=this.effectiveData(),controlled=normalizeHiddenDatasets(this.canonicalHiddenDatasets(),effective.datasets.length);return controlled!==void 0?controlled:effective.datasets.flatMap((dataset,index)=>chartDatasetBoolean(dataset,"hidden")===!0?[index]:[])}applyDatasetVisibility(){if(!this.chart)return!1;const chart=this.chart,sourceDatasetCount=this.effectiveData().datasets.length,datasetCount=this.visualDatasetSourceIndexes?.length??sourceDatasetCount,controlled=normalizeHiddenDatasets(this.canonicalHiddenDatasets(),sourceDatasetCount);if(controlled===void 0){for(let index=0;index<datasetCount;index++)try{const metadata=chart.getDatasetMeta?.(index);metadata&&(metadata.hidden=null)}catch{}return datasetCount>0}const hidden=new Set(controlled);for(let index=0;index<datasetCount;index++){const sourceIndex=this.visualDatasetSourceIndexes?.[index]??index;try{chart.setDatasetVisibility(index,!hidden.has(sourceIndex))}catch{}}return datasetCount>0}isSliceChart(){return["pie","doughnut","polarArea"].includes(this.effectiveType())}applyDatumVisibility(){if(!this.chart||!this.isSliceChart())return!1;const sample=this.dataTableSample(),rows=this.visualRowSourceIndexes,hidden=new Set(normalizeHiddenDatasets(this.hiddenDatums,sample.rowCount));let changed=!1;for(let index=0;index<(rows?.length??sample.rowCount);index++){const visible=!hidden.has(rows?.[index]??index);try{this.chart.getDataVisibility?.(index)===!visible&&(this.chart.toggleDataVisibility?.(index),changed=!0)}catch{}}return changed}hasExplicitConfigData(){const config=this.effectiveConfig();if(!isSafeChartConfigurationRecord(config))return!1;const data=chartRecordValue(config,"data");return data!==MISSING_OWN_DATA_DESCRIPTOR&&data!==UNSAFE_OWN_DATA_DESCRIPTOR}datasetLabel(dataset,index){return chartDatasetLabel(dataset)||this.localize("chartPointLabel",void 0,{n:getNumberFormat(this.effectiveLocale).format(index+1)})}datasetValues(dataset){return chartDatasetValues(dataset)}isPointDataset(dataset){const values=this.datasetValues(dataset);return this.effectiveType()==="scatter"||this.effectiveType()==="bubble"||values.some(value=>normalizedChartPoint(value)!==null)}appendData(label,values,maxPoints=0){const limit=Number.isFinite(maxPoints)?Math.max(0,Math.floor(maxPoints)):0,appendedValues=projectChartNumberData(values)??Object.freeze([]);if(this.hasExplicitConfigData()){const effective=this.effectiveData();let domainLength2=effective.labels.length;for(const dataset of effective.datasets)this.isPointDataset(dataset)||(domainLength2=Math.max(domainLength2,this.datasetValues(dataset).length));const labels2=[...effective.labels,...Array.from({length:Math.max(0,domainLength2-effective.labels.length)},()=>""),label],effectiveConfig=this.effectiveConfig(),currentData=projectChartDataConfiguration(effectiveConfig?.data)??{},explicitLabels=admitChartArray(currentData.labels)!==void 0,explicitDatasets=admitChartArray(currentData.datasets)!==void 0,nextLabels=limit>0?labels2.slice(-limit):labels2;if(explicitLabels||(this.labels=nextLabels.map(labelText)),!explicitDatasets){const datasets2=this.datasets.map((series,index)=>{if(canonicalSeriesPoints(series)!==void 0)return series;const current=canonicalSeriesData(series),data=[...current,...Array.from({length:Math.max(0,domainLength2-current.length)},()=>null),appendedValues[index]??null];return{...series,data:limit>0?data.slice(-limit):data}});this.datasets=datasets2}if(explicitLabels||explicitDatasets){const nextData={...currentData};explicitLabels&&(nextData.labels=nextLabels),explicitDatasets&&(nextData.datasets=effective.datasets.map((dataset,index)=>{if(this.isPointDataset(dataset))return dataset;const current=this.datasetValues(dataset),peer=chartDatasetPeerValues(dataset),padding=Array.from({length:Math.max(0,domainLength2-current.length)},()=>null),data=[...peer,...padding,appendedValues[index]??null],canonical=[...current,...padding,appendedValues[index]??null],nextData2=limit>0?data.slice(-limit):data,nextCanonical=limit>0?canonical.slice(-limit):canonical;return canonicalChartDatasetDataValues.set(nextData2,Object.freeze(nextCanonical)),{...dataset,data:nextData2}})),this.config={...effectiveConfig,data:nextData}}return}const currentLabels=this.canonicalLabels();let domainLength=currentLabels.length;for(const series of this.datasets)canonicalSeriesPoints(series)===void 0&&(domainLength=Math.max(domainLength,canonicalSeriesData(series).length));const labels=[...currentLabels,...Array.from({length:Math.max(0,domainLength-currentLabels.length)},()=>""),label],datasets=this.datasets.map((series,index)=>{if(canonicalSeriesPoints(series)!==void 0)return series;const current=canonicalSeriesData(series),data=[...current,...Array.from({length:Math.max(0,domainLength-current.length)},()=>null),appendedValues[index]??null];return{...series,data:limit>0?data.slice(-limit):data}});this.labels=limit>0?labels.slice(-limit):labels,this.datasets=datasets}exportData(format){if(format==="png")return this.chart?.toBase64Image?.()??"";const effective=this.effectiveData(),columns=effective.datasets.map((dataset,datasetIndex)=>{const values=this.datasetValues(dataset),label=this.datasetLabel(dataset,datasetIndex),points=values.map(normalizedChartPoint).filter(point=>point!==null);return{dataset,label,point:this.isPointDataset(dataset),radius:points.some(point=>point.r!=null),pointLabel:points.some(point=>point.label!=null)}}),header=["label",...columns.flatMap(column=>column.point?[`${column.label} x`,`${column.label} y`,...column.radius?[`${column.label} r`]:[],...column.pointLabel?[`${column.label} label`]:[]]:[column.label])].map(escapeCsvField).join(",");let rowCount=effective.labels.length;for(const dataset of effective.datasets)rowCount=Math.max(rowCount,this.datasetValues(dataset).length);const exportCell=(value,metadata)=>typeof value!="number"||!Number.isFinite(value)?value??"":this.formatExportValue(value,metadata)??value,rows=Array.from({length:rowCount},(_,index)=>{const firstPoint=effective.datasets.map(dataset=>normalizedChartPoint(this.datasetValues(dataset)[index])).find(point=>point!==null),label=labelText(effective.labels[index])||firstPoint?.label||"";return[label,...columns.flatMap((column,datasetIndex)=>{const value=this.datasetValues(column.dataset)[index],axis=this.datasetValueAxis(column.dataset),metadata={datasetIndex,index,label:label||void 0,seriesLabel:column.label,...axis===void 0?{}:{axis}};if(!column.point)return[exportCell(value,metadata)];const point=normalizedChartPoint(value);return point?[exportCell(point.x,{...metadata,statistic:"x"}),exportCell(point.y,{...metadata,statistic:"y"}),...column.radius?[point.r==null?"":exportCell(point.r,{...metadata,statistic:"r"})]:[],...column.pointLabel?[point.label??""]:[]]:["","",...column.radius?[""]:[],...column.pointLabel?[""]:[]]})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
2
+ `)}connectedCallback(){super.connectedCallback(),this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=onAnnotationPluginRegistered(()=>this.rebuildAfterAnnotationRegistration()),this.syncAnnouncementSinks(),this.visible=!this.ownerWindow?.IntersectionObserver,this.armReducedMotionWatcher();const ownerWindow=this.ownerWindow,ResizeObserverCtor=ownerWindow?.ResizeObserver;ResizeObserverCtor&&(this.resizeObserver=new ResizeObserverCtor(entries=>{const width=entries[0]?.contentRect.width??this.getBoundingClientRect().width;if(Number.isFinite(width)&&this.lastObservedInlineSize!==void 0&&Math.abs(width-this.lastObservedInlineSize)<.5||(this.lastObservedInlineSize=width,this.resizeDrawFrame!==void 0))return;const frameOwner=this.ownerWindow;frameOwner&&(this.resizeDrawFrameOwner=frameOwner,this.resizeDrawFrame=frameOwner.requestAnimationFrame(()=>{this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,!(!this.isConnected||this.ownerWindow!==frameOwner)&&(this.updateAutoLegendPosition()||this.drawIfVisible())}))}),this.resizeObserver.observe(this)),this.updateAutoLegendPosition();const generation=++this.loadGeneration;this.zoom&&this.requestZoomFeature(),this.loadLibrary(this.zoom).then(async mod=>{try{await this.updateComplete}catch{return}if(await new Promise(resolve=>this.updateBrowserDerivedState(resolve)),!(generation!==this.loadGeneration||!this.isConnected)){if(this.loading=!1,!mod){this.loadFailed=!0;return}this.loadFailed=!1,this.chartJsModule=mod,this.drawIfVisible()}}),this.needsDataLabels&&this.requestDataLabelsFeature(),this.needsAnnotations&&this.requestAnnotationFeature();const IntersectionObserverCtor=ownerWindow?.IntersectionObserver;if(IntersectionObserverCtor){const observerGeneration=++this.intersectionGeneration,observer=new IntersectionObserverCtor(entries=>{if(observerGeneration!==this.intersectionGeneration||this.intersectionObserver!==observer||!this.isConnected||this.ownerWindow!==ownerWindow)return;const wasVisible=this.visible;this.visible=entries[0]?.isIntersecting??!0,this.visible&&!wasVisible&&this.drawIfVisible()});this.intersectionObserver=observer,observer.observe(this)}}disconnectedCallback(){super.disconnectedCallback(),this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=void 0,this.releaseAnnouncementSinks(),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.announcedFeatureWarnings.clear(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeDrawFrame!==void 0&&this.resizeDrawFrameOwner?.cancelAnimationFrame(this.resizeDrawFrame),this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,this.lastObservedInlineSize=void 0,this.loadGeneration+=1,this.zoomLoadGeneration+=1,this.dataLabelsLoadGeneration+=1,this.annotationLoadGeneration+=1,this.discardChart(!1),this.builtPlugins=[],this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.intersectionGeneration+=1,this.visible=!0,this.disarmReducedMotionWatcher()}adoptedCallback(){super.adoptedCallback(),this.releaseAnnouncementSinks(),this.syncAnnouncementSinks(),this.armReducedMotionWatcher()}armReducedMotionWatcher(){const ownerWindow=this.ownerWindow;ownerWindow?.matchMedia&&(this.reducedMotionWindow===ownerWindow&&this.reducedMotionQuery||(this.disarmReducedMotionWatcher(),this.reducedMotionWindow=ownerWindow,this.reducedMotionQuery=ownerWindow.matchMedia("(prefers-reduced-motion: reduce)"),this.reducedMotionQuery.addEventListener("change",this.onReducedMotionChange)))}disarmReducedMotionWatcher(){this.reducedMotionQuery?.removeEventListener("change",this.onReducedMotionChange),this.reducedMotionQuery=void 0,this.reducedMotionWindow=void 0}syncAnnouncementSinks(){!this.isConnected||this.politeAnnouncementSink?.element.ownerDocument===this.ownerDocument&&this.assertiveAnnouncementSink?.element.ownerDocument===this.ownerDocument||(this.releaseAnnouncementSinks(),this.politeAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.assertiveAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}))}releaseAnnouncementSinks(){this.politeAnnouncementSink?.release(),this.politeAnnouncementSink=void 0,this.assertiveAnnouncementSink?.release(),this.assertiveAnnouncementSink=void 0}get ownerWindow(){return this.ownerDocument?.defaultView??void 0}computedStyle(element=this){const view=this.ownerWindow;return view?view.getComputedStyle(element):"style"in element?element.style:this.style}applyDataLabelsPlugin(plugin){this.dataLabelsPlugin=plugin;let rebuilt=!1;plugin&&this.needsDataLabels&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],rebuilt=!0),this.drawIfVisible(),rebuilt&&this.showsLegend&&this.requestUpdate()}get zoomFeatureAvailable(){return this.zoom&&this.zoomFeatureState==="available"}featureWarningMessages(){if(this.loading||this.loadFailed)return[];const messages=[];return this.zoom&&this.zoomFeatureState==="unavailable"&&messages.push(this.localize("chartZoomUnavailable")),this.dataLabelsFeatureState==="unavailable"&&(this.dataLabels&&messages.push(this.localize("chartDataLabelsUnavailable")),this.stackTotals&&messages.push(this.localize("chartStackTotalsUnavailable"))),this.needsAnnotations&&this.annotationFeatureState==="unavailable"&&messages.push(this.localize("chartAnnotationsUnavailable")),messages}requestZoomFeature(){const generation=++this.zoomLoadGeneration;if(!this.zoom){this.zoomFeatureState="idle";return}this.zoomFeatureState="loading",this.loadZoomFeature().then(result=>{generation!==this.zoomLoadGeneration||!this.isConnected||!this.zoom||(this.zoomFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.drawIfVisible(),this.requestUpdate())})}requestAnnotationFeature(){const generation=++this.annotationLoadGeneration;if(!this.needsAnnotations){this.annotationFeatureState="idle";return}this.annotationFeatureState="loading",this.loadAnnotationFeature().then(result=>{generation!==this.annotationLoadGeneration||!this.isConnected||!this.needsAnnotations||(result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.annotationFeatureState=result.kind==="available"?"available":"unavailable",this.applyAnnotationPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate())})}applyAnnotationPlugin(plugin){this.annotationPlugin=plugin,plugin&&this.needsAnnotations&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[]),this.drawIfVisible()}rebuildAfterAnnotationRegistration(){!this.chart||this.needsAnnotations||(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],this.drawIfVisible())}requestDataLabelsFeature(){const generation=++this.dataLabelsLoadGeneration;if(!this.needsDataLabels){this.dataLabelsFeatureState="idle";return}this.dataLabelsFeatureState="loading",this.loadDataLabelsFeature().then(result=>{generation!==this.dataLabelsLoadGeneration||!this.isConnected||!this.needsDataLabels||(this.dataLabelsFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.applyDataLabelsPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate())})}willUpdate(changed){super.willUpdate(changed),this.zoomed&&this.effectiveType()!==this.builtType&&(this.zoomed=!1,this.emit("lr-zoom",{zoomed:!1}))}firstUpdated(changed){super.firstUpdated(changed),queueMicrotask(()=>{collectInitialSlotAssignment(this.configSlotEl,s=>this.collectConfigFromSlot(s))})}updated(changed){if(super.updated(changed),!this.isConnected)return;const wasMounting=this.isMounting;this.isMounting=!1,changed.has("keyboardDatumAnnouncement")&&changed.get("keyboardDatumAnnouncement")!==void 0&&this.keyboardDatumAnnouncement!==""&&this.politeAnnouncementSink?.announce(this.keyboardDatumAnnouncement),changed.has("loadFailed")&&changed.get("loadFailed")!==void 0&&this.loadFailed&&this.assertiveAnnouncementSink?.announce(this.localize("chartMissingLibrary"));const dataTruncation=this.dataTruncationMessage();if(wasMounting&&(this.lastDataTruncationAnnouncement=dataTruncation),!this.loading&&!this.loadFailed){const featureWarnings=this.featureWarningMessages();for(const warning of featureWarnings)this.announcedFeatureWarnings.has(warning)||this.assertiveAnnouncementSink?.announce(warning);this.announcedFeatureWarnings=new Set(featureWarnings),!wasMounting&&dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.politeAnnouncementSink?.announce(dataTruncation))}if(this.setAttribute("aria-busy",String(this.loading)),changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}if(this.loading)return;changed.has("zoom")&&this.requestZoomFeature(),(changed.has("dataLabels")||changed.has("stackTotals"))&&this.requestDataLabelsFeature(),changed.has("annotations")&&this.requestAnnotationFeature();const contentChanged=this.chartContentChanged(changed),effectiveDirection=this.effectiveDirection,effectiveLocale=this.effectiveLocale,contextChanged=this.lastDrawnDirection!==void 0&&this.lastDrawnDirection!==effectiveDirection||this.lastDrawnLocale!==void 0&&this.lastDrawnLocale!==effectiveLocale;if(this.lastDrawnDirection=effectiveDirection,this.lastDrawnLocale=effectiveLocale,!contentChanged&&!contextChanged){changed.has("hiddenDatums")&&this.visible&&this.applyDatumVisibility()&&this.chart?.update("none");return}this.drawIfVisible()}chartContentChanged(changed){return["type","labels","datasets","hiddenDatasets","description","grid","axes","compact","indexAxis","label","legendPosition","min","max","scaleType","annotations","plugins","autoLegendPosition","valueFormatter","formatter","tooltipTitleFormatter","tooltipFooterFormatter","area","height","xLabel","yLabel","y2Label","beginAtZero","stacked","stackedAxes","withoutAnimation","withoutLegend","withoutTooltip","dataLabels","stackTotals","config","slottedConfig","zoom","locale","strings","loading"].some(name=>changed.has(name))}seriesToDataset(s,index,palette,effectiveType,chartStyle=this.chartStyleOptions(palette),rowIndexes){const series=canonicalChartSeries(s);if(!series)return{label:"",data:[]};const points=canonicalSeriesPoints(series),fullNormalizedData=points?points.map(normalizedChartPoint):canonicalSeriesData(series).map(value=>typeof value=="number"&&Number.isFinite(value)?value:null),normalizedData=rowIndexes?rowIndexes.map(rowIndex=>fullNormalizedData[rowIndex]??null):fullNormalizedData,borderFallback=chartStyle.borderColors[index%chartStyle.borderColors.length]??palette[index%palette.length],fillFallback=chartStyle.fillColors[index%chartStyle.fillColors.length]??palette[index%palette.length],sourceColors=projectChartStrings(series.color),authoredColors=sourceColors&&rowIndexes?rowIndexes.map(rowIndex=>sourceColors[rowIndex]??""):typeof series.color=="string"?series.color:sourceColors,colors=typeof authoredColors=="string"?[resolveCanvasColor(this,authoredColors,borderFallback??"transparent")]:authoredColors?resolveCanvasColors(this,authoredColors,borderFallback??"transparent"):void 0,sliceChart=effectiveType==="pie"||effectiveType==="doughnut"||effectiveType==="polarArea",sliceFillColors=sliceChart&&chartStyle.fillColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.fillColors[sourceIndex%chartStyle.fillColors.length]}):void 0,sliceBorderColors=sliceChart&&chartStyle.borderColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.borderColors[sourceIndex%chartStyle.borderColors.length]}):void 0,fill=series.fill??this.area,backgroundColor=colors??sliceFillColors??fillFallback,datasetType=series.type??effectiveType,authoredSegmentColors=series.segmentColors?.length&&rowIndexes?rowIndexes.map(rowIndex=>series.segmentColors[rowIndex%series.segmentColors.length]):series.segmentColors,segmentColors=authoredSegmentColors?resolveCanvasColors(this,authoredSegmentColors,colors?.[0]??borderFallback??"transparent"):void 0,authoredPointColors=series.pointColors&&rowIndexes?rowIndexes.map(rowIndex=>series.pointColors[rowIndex]??""):series.pointColors,backgroundColors=projectChartStrings(backgroundColor),backgroundColorValue=typeof backgroundColor=="string"?backgroundColor:void 0,resolvedBackgroundColor=datasetType==="line"&&fill&&(colors||!chartStyle.authoredFillColors[index%chartStyle.authoredFillColors.length])?backgroundColors?backgroundColors.map(color=>translucentAreaColor(this,color)):backgroundColorValue&&translucentAreaColor(this,backgroundColorValue):backgroundColor,encoding=forcedColorEncoding(index),resolvedBackgroundColors=projectChartStrings(resolvedBackgroundColor),resolvedBackgroundColorValue=typeof resolvedBackgroundColor=="string"?resolvedBackgroundColor:void 0,encodedBackgroundColor=chartStyle.forcedColors?resolvedBackgroundColors?resolvedBackgroundColors.map((color,itemIndex)=>this.forcedColorPattern(sliceChart?itemIndex:index,color)):resolvedBackgroundColorValue&&this.forcedColorPattern(index,resolvedBackgroundColorValue):resolvedBackgroundColor,pointRadii=projectChartPointRadii(series.pointRadius);return{label:series.label,data:normalizedData,type:series.type,fill,...datasetType==="bar"&&this.hasConfiguredBarOption("borderRadius")?{}:{borderRadius:chartStyle.borderRadius},...datasetType==="bar"&&!Number.isFinite(series.width)&&this.hasConfiguredBarOption("borderWidth")||isArcDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"arc","borderWidth")?{}:{borderWidth:nonNegativeFinite(series.width,datasetType==="line"||datasetType==="radar"?chartStyle.lineBorderWidth:chartStyle.borderWidth)},borderDash:series.dash?[4,4]:chartStyle.forcedColors?[...encoding.dash]:void 0,pointStyle:chartStyle.forcedColors?encoding.pointStyle:void 0,backgroundColor:encodedBackgroundColor,borderColor:colors?.[0]??sliceBorderColors??borderFallback,pointBackgroundColor:authoredPointColors?resolveCanvasColors(this,authoredPointColors,colors?.[0]??borderFallback??"transparent"):void 0,...isPointDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"point","radius")?{}:{pointRadius:pointRadii?(rowIndexes?rowIndexes.map(rowIndex=>pointRadii[rowIndex]):pointRadii).map(radius=>nonNegativeFinite(radius,chartStyle.pointRadius)):nonNegativeFinite(series.pointRadius,chartStyle.pointRadius)},...segmentColors?.length?{segment:{borderColor:ctx=>segmentColors[ctx.p0DataIndex%segmentColors.length]}}:{},yAxisID:series.axis==="y2"?"y2":"y",...series.stack!==void 0?{stack:series.stack}:{}}}hasConfiguredElementOption(datasetTypeKey,elementKey,option){const read=(value,key)=>{if(!isChartRecord(value))return;const descriptor=chartRecordValue(value,key);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value},options=this.effectiveConfig()?.options,dataset=read(read(options,"datasets"),datasetTypeKey),scopes=[dataset,read(read(dataset,"elements"),elementKey),read(read(options,"elements"),elementKey),options],prefixed=`${elementKey}${option[0].toUpperCase()}${option.slice(1)}`;return scopes.some(scope=>read(scope,prefixed)!==void 0||read(scope,option)!==void 0)}hasConfiguredBarOption(option){return this.hasConfiguredElementOption("bar","bar",option)}themeColors(){const cs=this.computedStyle(),grid=cs.getPropertyValue("--grid-color").trim()||cs.getPropertyValue("--lr-chart-grid-color").trim()||cs.getPropertyValue("--_lr-chart-grid-color").trim(),tick=cs.getPropertyValue("--lr-chart-tick-color").trim()||cs.getPropertyValue("--_lr-chart-tick-color").trim(),legend=cs.getPropertyValue("--lr-chart-legend-color").trim()||cs.getPropertyValue("--_lr-chart-legend-color").trim(),tooltipBg=cs.getPropertyValue("--lr-chart-tooltip-bg").trim()||cs.getPropertyValue("--_lr-chart-tooltip-bg").trim(),tooltipText=cs.getPropertyValue("--lr-chart-tooltip-text").trim()||cs.getPropertyValue("--_lr-chart-tooltip-text").trim();return{grid:resolveCanvasColor(this,grid,FALLBACK_GRID_COLOR),tick:resolveCanvasColor(this,tick,FALLBACK_TICK_COLOR),tickFontSize:this.styleNumber("--lr-chart-tick-font-size","--_lr-chart-tick-font-size",FALLBACK_TICK_FONT_SIZE),legend:resolveCanvasColor(this,legend,FALLBACK_LEGEND_COLOR),tooltipBg:resolveCanvasColor(this,tooltipBg,FALLBACK_TOOLTIP_BG),tooltipText:resolveCanvasColor(this,tooltipText,FALLBACK_TOOLTIP_TEXT)}}styleColor(name,fallback){const value=this.computedStyle().getPropertyValue(name).trim();return value?resolveCanvasColor(this,value,fallback):fallback}styleNumber(name,fallbackToken,fallback){const computed=this.computedStyle(),value=computed.getPropertyValue(name).trim()||computed.getPropertyValue(fallbackToken).trim(),direct=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))(?:px)?$/i.exec(value);if(direct){const resolved=Number.parseFloat(direct[1]);if(Number.isFinite(resolved)&&resolved>=0)return resolved}if(!value||!this.ownerWindow)return fallback;const probe=this.ownerDocument.createElement("span");probe.hidden=!0,probe.setAttribute("aria-hidden","true"),probe.style.inlineSize=value,(this.shadowRoot??this).append(probe);try{const resolved=Number.parseFloat(this.computedStyle(probe).inlineSize);return Number.isFinite(resolved)&&resolved>=0?resolved:fallback}finally{probe.remove()}}explicitTickFontSize(){const resolved=this.styleNumber("--lr-chart-tick-font-size","--lr-chart-tick-font-size",NaN);return Number.isNaN(resolved)?void 0:resolved}forcedColorPattern(index,background){return this.ownerWindow?createForcedColorPattern(this.ownerDocument,index,background,this.styleColor("--lr-color-surface",FALLBACK_TOOLTIP_BG)):background}chartStyleOptions(palette){const computed=this.computedStyle(),authoredFillColors=palette.map((_,index)=>index<6&&!!computed.getPropertyValue(`--fill-color-${index+1}`).trim()),borderColors=palette.map((fallback,index)=>index<6?this.styleColor(`--border-color-${index+1}`,fallback):fallback),fillColors=palette.map((fallback,index)=>index<6?this.styleColor(`--fill-color-${index+1}`,fallback):fallback);return{borderColors,fillColors,authoredFillColors,borderRadius:this.styleNumber("--border-radius","--lr-radius",6),borderWidth:this.styleNumber("--border-width","--lr-border-width-thin",1),gridBorderWidth:this.styleNumber("--grid-border-width","--lr-border-width-thin",1),lineBorderWidth:this.styleNumber("--line-border-width","--lr-border-width-medium",2),pointRadius:this.styleNumber("--point-radius","--lr-space-2xs",4),forcedColors:forcedColorsActive(this.ownerWindow)}}get needsDataLabels(){return this.dataLabels||this.stackTotals}get needsAnnotations(){return this.normalizedAnnotations().length>0}normalizedAnnotations(){return this.canonicalAnnotations()}annotationColor(tone){const token=`--lr-color-${tone??"neutral"}`,raw=this.computedStyle().getPropertyValue(token).trim();return resolveCanvasColor(this,raw,FALLBACK_TICK_COLOR)}annotationOptions(){const entries={};return this.normalizedAnnotations().forEach((entry,index)=>{const axis=entry.axis==="x"?"x":"y",color=this.annotationColor(entry.tone),label=entry.label?{content:entry.label,display:!0,color:this.themeColors().tick}:void 0;if(typeof entry.value=="number"){entries[`lr-annotation-${index}`]={type:"line",scaleID:axis,value:entry.value,borderColor:color,borderWidth:2,...label?{label}:{}};return}const bounds=axis==="y"?{yMin:entry.from,yMax:entry.to}:{xMin:entry.from,xMax:entry.to};entries[`lr-annotation-${index}`]={type:"box",...bounds,backgroundColor:translucentAreaColor(this,color),borderColor:color,borderWidth:0,...label?{label}:{}}}),entries}datalabelsOptions(theme,effectiveType){if(!this.needsDataLabels)return{display:!1};const effective=this.effectiveData(),datasets=effective.datasets,stackTotalsPossible=this.stackTotals&&(effectiveType==="bar"||effectiveType==="line"),sourceDatasetIndex=visualIndex=>this.visualDatasetSourceIndexes?.[visualIndex]??visualIndex,sourceRowIndex=visualIndex=>this.visualRowSourceIndexes?.[visualIndex]??visualIndex,topDatasetIndexByGroup=new Map;if(stackTotalsPossible){const visualDatasetCount=this.visualDatasetSourceIndexes?.length??datasets.length;for(let visualIndex=0;visualIndex<visualDatasetCount;visualIndex+=1){const dataset=datasets[sourceDatasetIndex(visualIndex)],axis=chartDatasetAxis(dataset);if(!this.axisStacked(axis))continue;let byGroup=topDatasetIndexByGroup.get(axis);byGroup||(byGroup=new Map,topDatasetIndexByGroup.set(axis,byGroup)),byGroup.set(chartDatasetStack(dataset),visualIndex)}}const totalsByGroup=new Map,totalsFor=(axis,stack)=>{let byGroup=totalsByGroup.get(axis);byGroup||(byGroup=new Map,totalsByGroup.set(axis,byGroup));let totals=byGroup.get(stack);return totals||(totals=this.computeStackTotals(axis,stack),byGroup.set(stack,totals)),totals},stackTotalsActive=[...topDatasetIndexByGroup.values()].some(byGroup=>byGroup.size>0);return{color:theme.tick,align:stackTotalsActive?"end":"center",anchor:stackTotalsActive?"end":"center",display:context=>{const indexes=this.callbackIndexes(context,effective);if(!indexes)return!1;const{datasetIndex,index}=indexes,dataset=datasets[sourceDatasetIndex(datasetIndex)],axis=chartDatasetAxis(dataset),stack=chartDatasetStack(dataset);return stackTotalsPossible&&this.axisStacked(axis)?topDatasetIndexByGroup.get(axis)?.get(stack)!==datasetIndex?this.dataLabels:totalsFor(axis,stack)[sourceRowIndex(index)]==null?this.dataLabels:!0:this.dataLabels},formatter:(value,context)=>{const indexes=this.callbackIndexes(context,effective);if(!indexes)return"";const{datasetIndex,index}=indexes,dataset=datasets[sourceDatasetIndex(datasetIndex)],axis=chartDatasetAxis(dataset),stack=chartDatasetStack(dataset),metadata=this.datumFormatterMetadata(datasetIndex,index,effective);if(stackTotalsPossible&&this.axisStacked(axis)&&topDatasetIndexByGroup.get(axis)?.get(stack)===datasetIndex){const total=totalsFor(axis,stack)[sourceRowIndex(index)];if(total!=null)return this.formatDataLabel(total,this.stackTotalMetadata(metadata))}const numeric=chartDatumNumericValue(this.scaledSliceDatasets.has(datasetIndex)?this.datasetValues(dataset)[sourceRowIndex(index)]:value);return numeric===void 0?"":this.formatDataLabel(numeric,metadata)}}}formatDataLabel(value,metadata={}){if(this.formatter||this.valueFormatter){const formatted=this.formatter?.({value,surface:"visual",...metadata})??this.valueFormatter?.(value,"tooltip");if(formatted!=null)return String(formatted)}return value.toLocaleString(this.effectiveLocale)}computeStackTotals(axisId="y",stackGroup=void 0){const effective=this.effectiveData(),members=effective.datasets.filter(dataset=>chartDatasetAxis(dataset)===axisId&&chartDatasetStack(dataset)===stackGroup),categoryCount=members.reduce((max,dataset)=>Math.max(max,this.datasetValues(dataset).length),effective.labels.length),totals=[];for(let i=0;i<categoryCount;i++){let sum=0,any=!1;for(const dataset of members){const value=this.datasetValues(dataset)[i],numeric=chartDatumNumericValue(value);numeric!==void 0&&(sum=finiteAdd(sum,numeric),any=!0)}totals.push(any?sum:null)}return totals}seriesPalette(){return seriesPalette(this)}tickOptions(theme,kind="value",axis="y"){return{color:theme.tick,font:{size:theme.tickFontSize},...(this.formatter||this.valueFormatter)&&kind==="value"?{callback:value=>this.formatValue(value,"tick",{axis})}:{}}}effectiveIndexAxis(){return this.indexAxis==="y"?"y":"x"}valueScaleType(){return this.scaleType==="logarithmic"?"logarithmic":"linear"}valueBeginAtZero(){return this.valueScaleType()==="logarithmic"?void 0:this.beginAtZero}scaleBounds(){const min=this.min!==null&&Number.isFinite(this.min)?finiteNumber(this.min,0):void 0,max=this.max!==null&&Number.isFinite(this.max)?finiteNumber(this.max,0):void 0;return{...min!==void 0?{min}:{},...max!==void 0?{max}:{}}}gridAxisVisible(axis){const grid=normalizeChartGrid(this.grid);return grid==="both"||grid===axis}axisVisible(axis){const axes=normalizeChartGrid(this.axes);return!this.compact&&(axes==="both"||axes===axis)}axisStacked(axisId){return axisId==="y2"?this.stackedAxes?.y2??this.stacked:this.stackedAxes?.y??this.stacked}buildScales(effectiveType,theme,chartStyle){if(effectiveType==="pie"||effectiveType==="doughnut")return{};if(effectiveType==="radar"||effectiveType==="polarArea"){const explicitPointLabelFontSize=this.explicitTickFontSize();return{r:{beginAtZero:this.beginAtZero,...this.scaleBounds(),ticks:{...this.tickOptions(theme,"value","r"),showLabelBackdrop:!1,z:1},grid:{color:theme.grid,display:this.gridAxisVisible("y"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},angleLines:{color:theme.grid,display:this.gridAxisVisible("x"),lineWidth:chartStyle.gridBorderWidth},pointLabels:{color:theme.tick,...explicitPointLabelFontSize!==void 0?{font:{size:explicitPointLabelFontSize}}:{}}}}}const hasY2=this.effectiveData().datasets.some(dataset=>chartDatasetAxis(dataset)==="y2"),rtl=this.effectiveDirection==="rtl",stackableType=effectiveType==="bar"||effectiveType==="line",stackedX=stackableType&&this.axisStacked("x"),stackedY=stackableType&&this.axisStacked("y"),stackedY2=stackableType&&this.axisStacked("y2"),horizontalCategorical=(effectiveType==="bar"||effectiveType==="line")&&this.effectiveIndexAxis()==="y",xKind=effectiveType==="scatter"||effectiveType==="bubble"||horizontalCategorical?"value":"category",yKind=horizontalCategorical?"category":"value",valueAxis=horizontalCategorical?"x":"y",bounds=this.scaleBounds();return{x:{display:this.axisVisible("x"),type:xKind==="value"?this.valueScaleType():"category",beginAtZero:xKind==="value"?this.valueBeginAtZero():void 0,...valueAxis==="x"?bounds:{},title:{display:!!this.xLabel,text:this.xLabel,color:theme.tick},ticks:this.tickOptions(theme,xKind,"x"),grid:{color:theme.grid,display:this.gridAxisVisible("x"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},stacked:stackedX},y:{display:this.axisVisible("y"),type:yKind==="value"?this.valueScaleType():"category",position:rtl?"right":"left",beginAtZero:yKind==="value"?this.valueBeginAtZero():void 0,...valueAxis==="y"?bounds:{},title:{display:!!this.yLabel,text:this.yLabel,color:theme.tick},ticks:this.tickOptions(theme,yKind,"y"),grid:{color:theme.grid,display:this.gridAxisVisible("y"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},stacked:stackedY},...hasY2?{y2:{display:this.axisVisible("y"),type:this.valueScaleType(),position:rtl?"left":"right",...valueAxis==="y"?bounds:{},grid:{drawOnChartArea:!1,color:theme.grid,display:this.gridAxisVisible("y"),lineWidth:chartStyle.gridBorderWidth},border:{width:chartStyle.gridBorderWidth},title:{display:!!this.y2Label,text:this.y2Label,color:theme.tick},ticks:this.tickOptions(theme,"value","y2"),stacked:stackedY2}}:{}}}handlePointClick(event,chart){let elements;try{elements=chart.getElementsAtEventForMode(event,"nearest",{intersect:!0},!0)}catch{return}const admission=admitChartArray(elements);if(!admission||!chartArrayIsStillAdmitted(admission))return;const first=chartRecordValue(admission.source,"0");if(first===MISSING_OWN_DATA_DESCRIPTOR||first===UNSAFE_OWN_DATA_DESCRIPTOR)return;const effective=this.effectiveData(),hit=this.callbackIndexes(first.value,effective);if(!hit)return;const datasetIndex=this.visualDatasetSourceIndexes?.[hit.datasetIndex]??hit.datasetIndex,index=this.visualRowSourceIndexes?.[hit.index]??hit.index,value=this.datasetValues(effective.datasets[datasetIndex])[index]??null,label=normalizedChartPoint(value)?.label??(labelText(effective.labels[index])||void 0);this.activateDatum({datasetIndex,index,label,value})}chartDatums(){const effective=this.effectiveData(),datasets=(this.visualDatasetSourceIndexes??effective.datasets.map((_dataset,index)=>index)).map(index=>effective.datasets[index]);let rowIndexes=this.visualRowSourceIndexes;if(!rowIndexes){let sourceRowCount=effective.labels.length;for(const dataset of datasets)sourceRowCount=Math.max(sourceRowCount,chartDatasetValues(dataset).length);rowIndexes=Array.from({length:sourceRowCount},(_value,index)=>index)}const labels=rowIndexes.map(index=>effective.labels[index]),rowCount=rowIndexes.length,sample=sampleChartTableIndexes(rowCount,datasets.length),datums=[];return sample.seriesIndexes.forEach(datasetIndex=>{const dataset=datasets[datasetIndex];if(!dataset)return;const values=chartDatasetValues(dataset);sample.rowIndexes.forEach(localIndex=>{const sourceIndex=rowIndexes[localIndex]??localIndex,value=values[sourceIndex];value!=null&&(typeof value=="number"&&!Number.isFinite(value)||datums.push({datasetIndex:this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex,index:sourceIndex,label:normalizedChartPoint(value)?.label??(labelText(labels[localIndex])||void 0),value}))})}),datums}datumDisplayValue(value,context={surface:"spoken"}){const{surface,...metadata}=context,format=(numeric2,statistic)=>surface==="table"?this.formatTableValue(numeric2,{...metadata,statistic}):this.formatSpokenValue(numeric2,{...metadata,statistic}),point=normalizedChartPoint(value);if(point){const x=format(point.x,"x"),y=format(point.y,"y"),coordinates=point.r==null?this.localize("chartPointCoordinates",void 0,{x,y}):this.localize("chartBubblePointCoordinates",void 0,{x,y,radius:format(point.r,"r")});return point.label!==void 0?this.localize("chartLabeledPoint",void 0,{label:point.label,coordinates}):coordinates}const numeric=chartDatumNumericValue(value);return numeric===void 0?labelText(value):format(numeric)}datumAnnouncement(datum,position,total){const dataset=this.effectiveData().datasets[datum.datasetIndex],series=chartDatasetLabel(dataset)||this.localize("chartSeriesLabel");return this.localize("liteChartMarkSummary",void 0,{series,label:datum.label??this.localize("chartPointLabel",void 0,{n:getNumberFormat(this.effectiveLocale).format(datum.index+1)}),value:this.datumDisplayValue(datum.value,{surface:"spoken",datasetIndex:datum.datasetIndex,index:datum.index,label:datum.label,seriesLabel:series,...this.datasetValueAxis(dataset)===void 0?{}:{axis:this.datasetValueAxis(dataset)}}),index:getNumberFormat(this.effectiveLocale).format(position+1),total:getNumberFormat(this.effectiveLocale).format(total)})}activateDatum(datum){const datums=this.chartDatums(),position=datums.findIndex(candidate=>candidate.datasetIndex===datum.datasetIndex&&candidate.index===datum.index);position>=0&&(this.keyboardDatumIndex=position,this.keyboardDatumAnnouncement=this.datumAnnouncement(datum,position,datums.length));const type=this.effectiveType(),kind=type==="bar"?"bar":type==="pie"||type==="doughnut"||type==="polarArea"?"slice":type==="line"?"segment":"point";this.emit("lr-datum-activate",{...datum,kind}),this.emit("lr-point-click",datum)}onCanvasFocus(){const datums=this.chartDatums();datums.length&&(this.keyboardDatumIndex=Math.min(this.keyboardDatumIndex,datums.length-1),this.keyboardDatumAnnouncement=this.datumAnnouncement(datums[this.keyboardDatumIndex],this.keyboardDatumIndex,datums.length))}onCanvasKeyDown(event){const datums=this.chartDatums();if(!datums.length)return;if(this.keyboardDatumIndex=Math.min(this.keyboardDatumIndex,datums.length-1),event.key==="Enter"||event.key===" "){event.preventDefault(),this.activateDatum(datums[this.keyboardDatumIndex]);return}const rtl=this.effectiveDirection==="rtl",forward=rtl?"ArrowLeft":"ArrowRight",backward=rtl?"ArrowRight":"ArrowLeft";let next=this.keyboardDatumIndex;if(event.key===forward||event.key==="ArrowDown")next=Math.min(datums.length-1,next+1);else if(event.key===backward||event.key==="ArrowUp")next=Math.max(0,next-1);else if(event.key==="Home")next=0;else if(event.key==="End")next=datums.length-1;else return;event.preventDefault(),this.keyboardDatumIndex=next,this.keyboardDatumAnnouncement=this.datumAnnouncement(datums[next],next,datums.length)}effectiveType(){return this.effectiveConfig()?.type??normalizeChartType(this.type)}localizedChartType(){const type=this.effectiveType(),key=CHART_TYPE_MESSAGE_KEYS[type];return key?this.localize(key):String(type)}formatValue(value,context,metadata={}){const numeric=chartDatumNumericValue(value);return numeric===void 0?value:this.formatter?.({value:numeric,surface:context,...metadata})??this.valueFormatter?.(numeric,context)??value}datasetValueAxis(dataset){const type=this.effectiveType();if(!(type==="pie"||type==="doughnut"))return type==="radar"||type==="polarArea"?"r":(type==="bar"||type==="line")&&this.effectiveIndexAxis()==="y"?"x":dataset===void 0?void 0:chartDatasetAxis(dataset)}datumFormatterMetadata(visualDatasetIndex,visualRowIndex,effective=this.effectiveData()){return this.sourceDatumFormatterMetadata(this.visualDatasetSourceIndexes?.[visualDatasetIndex]??visualDatasetIndex,visualRowIndex===void 0?void 0:this.visualRowSourceIndexes?.[visualRowIndex]??visualRowIndex,effective)}sourceDatumFormatterMetadata(datasetIndex,index,effective=this.effectiveData()){const dataset=effective.datasets[datasetIndex],point=index===void 0||dataset===void 0?null:normalizedChartPoint(this.datasetValues(dataset)[index]),label=index===void 0?void 0:point?.label??(labelText(effective.labels[index])||void 0),axis=this.datasetValueAxis(dataset);return{datasetIndex,...index===void 0?{}:{index},...label===void 0?{}:{label},...dataset===void 0?{}:{seriesLabel:this.datasetLabel(dataset,datasetIndex)},...axis===void 0?{}:{axis}}}stackTotalMetadata(metadata){return{...metadata.index===void 0?{}:{index:metadata.index},...metadata.label===void 0?{}:{label:metadata.label},...metadata.axis===void 0?{}:{axis:metadata.axis},statistic:"total"}}legendValue(item,_chart,effective=this.effectiveData()){const datasetIndex=this.callbackDatasetIndex(item,effective);if(datasetIndex===void 0)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex,data=this.datasetValues(effective.datasets[sourceDatasetIndex]);if(!data.length)return;const visualRows=this.visualRowSourceIndexes??data.map((_value,index)=>index),indexDescriptor=chartRecordValue(item,"index");if(indexDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR)return;if(indexDescriptor!==MISSING_OWN_DATA_DESCRIPTOR){const itemIndex=chartIndex(indexDescriptor.value);return itemIndex===void 0||itemIndex>=visualRows.length?void 0:chartDatumNumericValue(data[visualRows[itemIndex]]??null)}let sum=0,hasValue=!1;for(const sourceRowIndex of visualRows){const datum=data[sourceRowIndex],value=chartDatumNumericValue(datum);value!==void 0&&(sum=finiteAdd(sum,value),hasValue=!0)}return hasValue?sum:void 0}legendLabels(chart){const generateLabels=this.chartJsModule?.defaults?.plugins?.legend?.labels?.generateLabels;let generated;if(generateLabels)try{generated=projectChartLegendItems(generateLabels(chart))}catch{generated=void 0}const effective=this.effectiveData(),fallbackDatasets=(this.visualDatasetSourceIndexes??effective.datasets.map((_dataset,index)=>index)).map(sourceIndex=>effective.datasets[sourceIndex]);return(generated??fallbackDatasets.map((dataset,index)=>({text:chartDatasetLabel(dataset)||String(index+1),datasetIndex:index}))).map(item=>{const value=this.legendValue(item,chart,effective),visualDatasetIndex=this.callbackDatasetIndex(item,effective),visualRowIndex=chartIndex(chartDatasetValue(item,"index")),formatted=this.formatValue(value,"legend",visualDatasetIndex===void 0?{}:this.datumFormatterMetadata(visualDatasetIndex,visualRowIndex,effective));return formatted===value||formatted===void 0?item:{...item,text:this.localize("chartValueLabel",void 0,{label:labelText(chartDatasetValue(item,"text")),value:String(formatted)})}})}tooltipLabel(context,horizontal=!1){const parsed=projectChartDatum(chartDatasetValue(context,"parsed")),raw=projectChartDatum(chartDatasetValue(context,"raw")),parsedPoint=normalizedChartPoint(parsed);let rawValue=(horizontal&&!normalizedChartPoint(raw)?parsedPoint?.x:parsedPoint?.y)??parsed??raw;const scaledSlices=this.scaledSliceDatasets.size>0,effective=scaledSlices||this.formatter!==void 0?this.effectiveData():void 0,hit=effective===void 0?void 0:this.callbackIndexes(context,effective),indexes=scaledSlices?hit:void 0,scaled=indexes!==void 0&&effective!==void 0&&this.scaledSliceDatasets.has(indexes.datasetIndex);if(scaled){const dataset=effective.datasets[this.visualDatasetSourceIndexes?.[indexes.datasetIndex]??indexes.datasetIndex];rawValue=this.datasetValues(dataset)[this.visualRowSourceIndexes?.[indexes.index]??indexes.index]}let formatted=this.formatValue(rawValue,"tooltip",hit===void 0||effective===void 0?{}:this.datumFormatterMetadata(hit.datasetIndex,hit.index,effective));if(!scaled&&formatted===rawValue||formatted===void 0)return;scaled&&typeof formatted=="number"&&(formatted=this.formatSummaryValue(formatted));const label=chartDatasetLabel(chartDatasetValue(context,"dataset"));return label?this.localize("chartValueLabel",void 0,{label,value:String(formatted)}):String(formatted)}tooltipItemContext(context,horizontal,effective){const parsed=projectChartDatum(chartDatasetValue(context,"parsed")),raw=projectChartDatum(chartDatasetValue(context,"raw")),parsedPoint=normalizedChartPoint(parsed);let rawValue=(horizontal&&!normalizedChartPoint(raw)?parsedPoint?.x:parsedPoint?.y)??parsed??raw;const hit=this.callbackIndexes(context,effective);if(hit!==void 0&&this.scaledSliceDatasets.has(hit.datasetIndex)){const dataset=effective.datasets[this.visualDatasetSourceIndexes?.[hit.datasetIndex]??hit.datasetIndex];rawValue=this.datasetValues(dataset)[this.visualRowSourceIndexes?.[hit.index]??hit.index]}const numeric=chartDatumNumericValue(rawValue);if(numeric===void 0)return;const metadata=hit===void 0?{}:this.datumFormatterMetadata(hit.datasetIndex,hit.index,effective);return{value:numeric,surface:"tooltip",...metadata}}tooltipGroupText(items,horizontal,formatter){if(!formatter)return;const effective=this.effectiveData(),contexts=items.map(item=>this.tooltipItemContext(item,horizontal,effective)).filter(context=>context!==void 0);if(contexts.length)return formatter(contexts)}updateAutoLegendPosition(){const width=this.getBoundingClientRect().width||this.clientWidth,next=width>0&&width<480?"bottom":"right";return next===this.autoLegendPosition?!1:(this.autoLegendPosition=next,!0)}legendPositionForConfig(){const position=normalizeLegendPosition(this.legendPosition);return position==="auto"?this.autoLegendPosition:position==="start"?this.effectiveDirection==="rtl"?"right":"left":position==="end"?this.effectiveDirection==="rtl"?"left":"right":position}legendPositionForLayout(){const position=this.legendPositionForConfig();return position==="top"||position==="right"||position==="left"?position:"bottom"}legendGridPlacement(){const position=normalizeLegendPosition(this.legendPosition);if(position==="auto")return this.autoLegendPosition==="right"?"inline-end":"bottom";if(position==="start")return"inline-start";if(position==="end")return"inline-end";if(position==="top")return"top";const rtl=this.effectiveDirection==="rtl";return position==="left"?rtl?"inline-end":"inline-start":position==="right"?rtl?"inline-start":"inline-end":"bottom"}updateChartArea(chart=this.chart){const area=chart?.chartArea;if(!area)return;const next={top:Number(area.top),left:Number(area.left),right:Number(area.right),bottom:Number(area.bottom),width:Number(area.width),height:Number(area.height)};if(![next.top,next.left,next.right,next.bottom,next.width,next.height].every(Number.isFinite))return;const previous=this.resolvedChartArea;previous&&previous.top===next.top&&previous.left===next.left&&previous.right===next.right&&previous.bottom===next.bottom&&previous.width===next.width&&previous.height===next.height||(this.resolvedChartArea=next,this.chartAreaUpdateQueued||(this.chartAreaUpdateQueued=!0,queueMicrotask(()=>{this.chartAreaUpdateQueued=!1,this.isConnected&&this.requestUpdate()})))}get chartArea(){return this.resolvedChartArea}set chartArea(_value){}buildConfig(){const theme=this.themeColors(),effectiveType=this.effectiveType();let tooltipIndexAxis=this.effectiveIndexAxis();const palette=this.seriesPalette(),chartStyle=this.chartStyleOptions(palette),rawDataEscapeHatch=this.hasExplicitConfigData(),wantsTooltipLabelCallback=!!(this.formatter||this.valueFormatter)||(effectiveType==="pie"||effectiveType==="doughnut")&&!rawDataEscapeHatch,labels=this.canonicalLabels();let visualRows,visualSeries;if(rawDataEscapeHatch)this.visualRowSourceIndexes=void 0,this.visualDatasetSourceIndexes=void 0;else{let rowCount=labels.length;for(const series of this.datasets)rowCount=Math.max(rowCount,(canonicalSeriesPoints(series)??canonicalSeriesData(series)).length);const sample=sampleChartTableIndexes(rowCount,this.datasets.length);visualRows=sample.rowIndexes.length<rowCount?sample.rowIndexes:void 0,visualSeries=sample.seriesIndexes.length<this.datasets.length?sample.seriesIndexes:void 0,this.visualRowSourceIndexes=visualRows,this.visualDatasetSourceIndexes=visualSeries}const generated={type:effectiveType,data:{labels:visualRows?visualRows.map(index=>labels[index]??""):[...labels],datasets:visualSeries?visualSeries.map(sourceIndex=>this.seriesToDataset(this.datasets[sourceIndex],sourceIndex,palette,effectiveType,chartStyle,visualRows)):this.datasets.map((s,i)=>this.seriesToDataset(s,i,palette,effectiveType,chartStyle,visualRows))},...this.plugins.length||this.needsDataLabels&&this.dataLabelsPlugin?{plugins:[...this.plugins,...this.needsDataLabels&&this.dataLabelsPlugin?[this.dataLabelsPlugin]:[]]}:{},options:{locale:this.effectiveLocale,responsive:!0,maintainAspectRatio:!1,...this.compact&&!["pie","doughnut","radar","polarArea"].includes(effectiveType)?{layout:{padding:0,autoPadding:!1}}:{},indexAxis:this.effectiveIndexAxis(),animation:this.withoutAnimation||prefersReducedMotion(this.ownerWindow)?!1:void 0,interaction:{intersect:!1,mode:effectiveType==="scatter"?"nearest":"index"},onClick:(event,_elements,chart)=>this.handlePointClick(event,chart),plugins:{...this.needsAnnotations&&this.annotationPlugin?{annotation:{annotations:this.annotationOptions()}}:{},legend:{display:!1,position:this.legendPositionForConfig(),labels:{color:theme.legend,...this.formatter||this.valueFormatter?{generateLabels:chart=>this.legendLabels(chart)}:{}}},tooltip:{enabled:!this.withoutTooltip,backgroundColor:theme.tooltipBg,titleColor:theme.tooltipText,bodyColor:theme.tooltipText,...wantsTooltipLabelCallback||this.tooltipTitleFormatter||this.tooltipFooterFormatter?{callbacks:{...wantsTooltipLabelCallback?{label:context=>this.tooltipLabel(context,tooltipIndexAxis==="y")}:{},...this.tooltipTitleFormatter?{title:items=>this.tooltipGroupText(items,tooltipIndexAxis==="y",this.tooltipTitleFormatter)}:{},...this.tooltipFooterFormatter?{footer:items=>this.tooltipGroupText(items,tooltipIndexAxis==="y",this.tooltipFooterFormatter)}:{}}}:{},filter:item=>{const effective=this.effectiveData(),datasetIndex=this.callbackDatasetIndex(item,effective);if(datasetIndex===void 0)return!1;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex;return chartDatasetBoolean(effective.datasets[sourceDatasetIndex],"noTooltip")!==!0}},zoom:this.zoom&&this.zoomFeatureState!=="unavailable"?{pan:{enabled:!1},zoom:{wheel:{enabled:!0},drag:{enabled:!0},pinch:{enabled:!0},mode:"x",onZoomComplete:()=>{this.suppressZoomComplete||(this.zoomed=!0,this.emit("lr-zoom",{zoomed:!0}))}},limits:{x:{min:"original",max:"original"}}}:void 0,datalabels:this.datalabelsOptions(theme,effectiveType)},onResize:chart=>this.updateChartArea(chart),scales:this.buildScales(effectiveType,theme,chartStyle)}},effectiveConfig=this.effectiveConfig();if(!effectiveConfig)return generated;const merged=deepMerge(generated,effectiveConfig);tooltipIndexAxis=merged.options.indexAxis==="y"?"y":"x";const requiredPlugins=[...this.plugins,...this.needsDataLabels&&this.dataLabelsPlugin?[this.dataLabelsPlugin]:[]],mergedPluginAdmission=admitChartArray(merged.plugins),mergedPlugins=projectChartPlugins(merged.plugins,mergedPluginAdmission);return mergedPluginAdmission||requiredPlugins.length?merged.plugins=[...mergedPlugins,...requiredPlugins.filter(plugin=>!mergedPlugins.includes(plugin))]:merged.plugins!==void 0&&(merged.plugins=[]),merged}scaleExtremeSlices(config){if(this.scaledSliceDatasets.clear(),!(config.type!=="pie"&&config.type!=="doughnut"||this.hasExplicitConfigData()))for(const[index,dataset]of config.data.datasets.entries()){const source=this.datasetValues(dataset),maximum=source.reduce((largest,value)=>{const number=chartDatumNumericValue(value);return number===void 0?largest:Math.max(largest,Math.abs(number))},0);maximum<=Number.MAX_SAFE_INTEGER||(dataset.data=source.map(value=>{const number=chartDatumNumericValue(value);return number===void 0?value:number/maximum}),this.scaledSliceDatasets.add(index))}}draw(){if(!this.chartJsModule||!this.canvasEl)return;const config=this.buildConfig();this.scaleExtremeSlices(config);const effectiveType=config.type,nextPlugins=projectChartPlugins(config.plugins),samePlugins=nextPlugins.length===this.builtPlugins.length&&nextPlugins.every((plugin,index)=>plugin===this.builtPlugins[index]);if(this.chart&&this.builtType===effectiveType&&samePlugins){this.chart.data=config.data,this.chart.options=config.options??{},this.applyDatasetVisibility(),this.chart.update("none"),this.applyDatumVisibility()&&this.chart.update("none"),this.updateChartArea(this.chart);return}this.discardChart(!0),this.chart=new this.chartJsModule.Chart(this.canvasEl,config),this.builtType=effectiveType,this.builtPlugins=[...nextPlugins];const datasetsControlled=this.canonicalHiddenDatasets()!==void 0;datasetsControlled&&this.applyDatasetVisibility(),(this.applyDatumVisibility()||datasetsControlled)&&this.chart.update("none"),this.updateChartArea(this.chart)}drawIfVisible(){!this.isConnected||!this.visible||this.draw()}discardChart(announceZoomReset){this.chart?.destroy(),this.chart=void 0,this.resolvedChartArea=void 0,this.zoomed&&(this.zoomed=!1,announceZoomReset&&this.emit("lr-zoom",{zoomed:!1}))}renderChart(){this.drawIfVisible()}resetZoom(){this.suppressZoomComplete=!0;try{this.chart?.resetZoom?.()}finally{this.suppressZoomComplete=!1}this.zoomed=!1,this.emit("lr-zoom",{zoomed:!1})}refreshTheme(){this.drawIfVisible(),this.showsLegend&&this.requestUpdate()}summarizeSeries(dataset){let count=0,first=0,last=0,min=0,minIndex=0,max=0,maxIndex=0;for(const[index,datum]of this.datasetValues(dataset).entries()){const value=chartDatumNumericValue(datum);value!==void 0&&(count===0&&(first=value,min=value,minIndex=index,max=value,maxIndex=index),last=value,value<min&&(min=value,minIndex=index),value>max&&(max=value,maxIndex=index),count++)}return count?{count,first,last,min,minIndex,max,maxIndex}:void 0}formatSummaryValue(value){return getNumberFormat(this.effectiveLocale).format(value)}formatTableValue(value,metadata={}){return this.formatter?.({value,surface:"table",...metadata})??this.valueFormatter?.(value,"table")??this.formatSummaryValue(value)}formatExportValue(value,metadata={}){return this.formatter?.({value,surface:"export",...metadata})??this.valueFormatter?.(value,"table")}formatSpokenValue(value,metadata={}){return this.formatter?.({value,surface:"spoken",...metadata})??this.valueFormatter?.(value,"table")??this.formatSummaryValue(value)}tableStackAxes(){const type=this.effectiveType();if(!this.stackTotals||type!=="bar"&&type!=="line")return[];const present=new Set;for(const dataset of this.effectiveData().datasets){const axis=chartDatasetAxis(dataset);this.axisStacked(axis)&&present.add(axis)}return["y","y2"].filter(axis=>present.has(axis))}tableStackTotalLabel(axis,axisCount){if(axisCount===1)return this.localize("chartTotal");const axisLabel=axis==="y2"?this.y2Label||this.localize("chartSecondaryAxis"):this.yLabel||this.localize("chartPrimaryAxis");return this.localize("chartAxisTotal",void 0,{axis:axisLabel})}accessibleName(fallback){return this.getAttribute("aria-label")??this.label??fallback}chartDescription(){if(this.description)return this.description;const effective=this.effectiveData(),sample=this.dataTableSample(effective),includePointDetails=!this.hasCustomDataTable(),summaries=sample.seriesIndexes.map(index=>{const dataset=effective.datasets[index],seriesLabel=this.datasetLabel(dataset,index),values=this.summarizeSeries(dataset);if(!values)return this.localize("chartSeriesNoData",void 0,{label:seriesLabel});const trend=values.last>values.first?this.localize("chartTrendIncreasing"):values.last<values.first?this.localize("chartTrendDecreasing"):this.localize("chartTrendFlat"),rawValues=this.datasetValues(dataset),datumLabelAt=rowIndex=>{const datum=rawValues[rowIndex];return normalizedChartPoint(datum)?.label??(labelText(effective.labels[rowIndex])||void 0)},summary=this.localize("chartSummary",void 0,{label:seriesLabel,count:this.formatSummaryValue(values.count),min:this.formatSpokenValue(values.min,{datasetIndex:index,index:values.minIndex,label:datumLabelAt(values.minIndex),seriesLabel,statistic:"min"}),max:this.formatSpokenValue(values.max,{datasetIndex:index,index:values.maxIndex,label:datumLabelAt(values.maxIndex),seriesLabel,statistic:"max"}),trend}),pointDetails=includePointDetails?sample.rowIndexes.flatMap(rowIndex=>{const point=rawValues[rowIndex];return normalizedChartPoint(point)?[this.datumDisplayValue(point,{surface:"spoken",datasetIndex:index,index:rowIndex,label:datumLabelAt(rowIndex),seriesLabel})]:[]}):[];return pointDetails.length?[summary,...pointDetails].join(this.localize("chartSummarySeparator")):summary}),base=summaries.length?this.localize("chartSummaryWithData",void 0,{type:this.localizedChartType(),summaries:summaries.join(this.localize("chartSummarySeparator"))}):this.localize("chartSummaryEmpty",void 0,{type:this.localizedChartType()}),annotationLabels=this.normalizedAnnotations().map(entry=>entry.label?.trim()).filter(label=>!!label);return annotationLabels.length?[base,...annotationLabels].join(this.localize("chartSummarySeparator")):base}dataTableSample(effective=this.effectiveData()){let rowCount=effective.labels.length;for(const dataset of effective.datasets)rowCount=Math.max(rowCount,this.datasetValues(dataset).length);const indexes=sampleChartTableIndexes(rowCount,effective.datasets.length);return{rowCount,seriesCount:effective.datasets.length,...indexes}}generatedDataIsSampled(){if(this.hasCustomDataTable())return!1;const sample=this.dataTableSample();return sample.rowCount===0||sample.seriesCount===0?!1:sample.rowIndexes.length<sample.rowCount||sample.seriesIndexes.length<sample.seriesCount}dataTruncationMessage(){return this.generatedDataIsSampled()?this.localize("chartDataSampled"):""}renderDataTable(){const effective=this.effectiveData(),sample=this.dataTableSample(effective),valuesBySeries=new Map(sample.seriesIndexes.map(index=>[index,this.datasetValues(effective.datasets[index])])),stackAxes=this.tableStackAxes(),stackTotals=new Map(stackAxes.map(axis=>[axis,this.computeStackTotals(axis)])),stackValueAxes=new Map(stackAxes.map(axis=>[axis,this.datasetValueAxis(effective.datasets.find(dataset=>chartDatasetAxis(dataset)===axis))]));return html`
3
3
  <table class=${this.dataTableVisible?nothing:"sr-only"}>
4
4
  <caption>${this.accessibleName(this.localize("chartData"))}</caption>
5
5
  <thead>
@@ -119,4 +119,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
119
119
  ${hasCustomDataTable?nothing:this.renderDataTable()}
120
120
  </div>
121
121
  </div>
122
- `}get showsLegend(){return!this.withoutLegend}}__decorate([property({converter:{fromAttribute:value=>normalizeChartType(value)}})],LyraChart.prototype,"type",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"labels",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"datasets",null),__decorate([property({attribute:!1})],LyraChart.prototype,"hiddenDatasets",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"hiddenDatums",null),__decorate([property({attribute:"legend-mode",converter:{fromAttribute:value=>value==="datum"?"datum":value==="dataset"?"dataset":"auto"}})],LyraChart.prototype,"legendMode",void 0),__decorate([property({attribute:"legend-display",converter:{fromAttribute:value=>["label","value","percentage","value-percentage"].includes(value??"")?value:"auto"}})],LyraChart.prototype,"legendDisplay",void 0),__decorate([property()],LyraChart.prototype,"description",void 0),__decorate([property({converter:{fromAttribute:value=>normalizeChartGrid(value)}})],LyraChart.prototype,"grid",void 0),__decorate([property({converter:{fromAttribute:value=>normalizeChartGrid(value)}})],LyraChart.prototype,"axes",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"compact",void 0),__decorate([property({attribute:"index-axis"})],LyraChart.prototype,"indexAxis",void 0),__decorate([property()],LyraChart.prototype,"label",void 0),__decorate([property({attribute:"legend-position",converter:{fromAttribute:value=>normalizeLegendPosition(value)}})],LyraChart.prototype,"legendPosition",void 0),__decorate([property({attribute:"scale-type"})],LyraChart.prototype,"scaleType",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"annotations",void 0),__decorate([property({type:Number})],LyraChart.prototype,"max",void 0),__decorate([property({type:Number})],LyraChart.prototype,"min",void 0),__decorate([property({type:Array})],LyraChart.prototype,"plugins",null),__decorate([property({attribute:!1})],LyraChart.prototype,"valueFormatter",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"formatter",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"area",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"zoom",void 0),__decorate([property()],LyraChart.prototype,"height",void 0),__decorate([property({attribute:"x-label"})],LyraChart.prototype,"xLabel",void 0),__decorate([property({attribute:"y-label"})],LyraChart.prototype,"yLabel",void 0),__decorate([property({attribute:"y2-label"})],LyraChart.prototype,"y2Label",void 0),__decorate([property({type:Boolean,attribute:"begin-at-zero",converter:trueDefaultBooleanConverter})],LyraChart.prototype,"beginAtZero",void 0),__decorate([property({type:Boolean,attribute:"show-data-table"})],LyraChart.prototype,"showDataTable",void 0),__decorate([property({type:Boolean,attribute:"data-table-toggle"})],LyraChart.prototype,"dataTableToggle",void 0),__decorate([state()],LyraChart.prototype,"dataTableExpandedOverride",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"stacked",void 0),__decorate([property({type:Boolean,attribute:"without-animation",reflect:!0})],LyraChart.prototype,"withoutAnimation",void 0),__decorate([property({type:Boolean,attribute:"without-legend",reflect:!0})],LyraChart.prototype,"withoutLegend",void 0),__decorate([property({type:Boolean,attribute:"without-tooltip",reflect:!0})],LyraChart.prototype,"withoutTooltip",void 0),__decorate([property({type:Boolean,attribute:"data-labels"})],LyraChart.prototype,"dataLabels",void 0),__decorate([property({type:Boolean,attribute:"stack-totals"})],LyraChart.prototype,"stackTotals",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"config",null),__decorate([state()],LyraChart.prototype,"slottedConfig",void 0),__decorate([state()],LyraChart.prototype,"loading",void 0),__decorate([state()],LyraChart.prototype,"loadFailed",void 0),__decorate([state()],LyraChart.prototype,"zoomed",void 0),__decorate([state()],LyraChart.prototype,"visible",void 0),__decorate([query("canvas")],LyraChart.prototype,"canvasEl",void 0),__decorate([state()],LyraChart.prototype,"autoLegendPosition",void 0),__decorate([state()],LyraChart.prototype,"keyboardDatumAnnouncement",void 0);export{LyraChart,seriesPalette2 as seriesPalette};
122
+ `}get showsLegend(){return!this.withoutLegend}}__decorate([property({converter:{fromAttribute:value=>normalizeChartType(value)}})],LyraChart.prototype,"type",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"labels",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"datasets",null),__decorate([property({attribute:!1})],LyraChart.prototype,"hiddenDatasets",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"hiddenDatums",null),__decorate([property({attribute:"legend-mode",converter:{fromAttribute:value=>value==="datum"?"datum":value==="dataset"?"dataset":"auto"}})],LyraChart.prototype,"legendMode",void 0),__decorate([property({attribute:"legend-display",converter:{fromAttribute:value=>["label","value","percentage","value-percentage"].includes(value??"")?value:"auto"}})],LyraChart.prototype,"legendDisplay",void 0),__decorate([property()],LyraChart.prototype,"description",void 0),__decorate([property({converter:{fromAttribute:value=>normalizeChartGrid(value)}})],LyraChart.prototype,"grid",void 0),__decorate([property({converter:{fromAttribute:value=>normalizeChartGrid(value)}})],LyraChart.prototype,"axes",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"compact",void 0),__decorate([property({attribute:"index-axis"})],LyraChart.prototype,"indexAxis",void 0),__decorate([property()],LyraChart.prototype,"label",void 0),__decorate([property({attribute:"legend-position",converter:{fromAttribute:value=>normalizeLegendPosition(value)}})],LyraChart.prototype,"legendPosition",void 0),__decorate([property({attribute:"scale-type"})],LyraChart.prototype,"scaleType",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"annotations",void 0),__decorate([property({type:Number})],LyraChart.prototype,"max",void 0),__decorate([property({type:Number})],LyraChart.prototype,"min",void 0),__decorate([property({type:Array})],LyraChart.prototype,"plugins",null),__decorate([property({attribute:!1})],LyraChart.prototype,"valueFormatter",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"formatter",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"tooltipTitleFormatter",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"tooltipFooterFormatter",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"area",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"zoom",void 0),__decorate([property()],LyraChart.prototype,"height",void 0),__decorate([property({attribute:"x-label"})],LyraChart.prototype,"xLabel",void 0),__decorate([property({attribute:"y-label"})],LyraChart.prototype,"yLabel",void 0),__decorate([property({attribute:"y2-label"})],LyraChart.prototype,"y2Label",void 0),__decorate([property({type:Boolean,attribute:"begin-at-zero",converter:trueDefaultBooleanConverter})],LyraChart.prototype,"beginAtZero",void 0),__decorate([property({type:Boolean,attribute:"show-data-table"})],LyraChart.prototype,"showDataTable",void 0),__decorate([property({type:Boolean,attribute:"data-table-toggle"})],LyraChart.prototype,"dataTableToggle",void 0),__decorate([state()],LyraChart.prototype,"dataTableExpandedOverride",void 0),__decorate([property({type:Boolean})],LyraChart.prototype,"stacked",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"stackedAxes",void 0),__decorate([property({type:Boolean,attribute:"without-animation",reflect:!0})],LyraChart.prototype,"withoutAnimation",void 0),__decorate([property({type:Boolean,attribute:"without-legend",reflect:!0})],LyraChart.prototype,"withoutLegend",void 0),__decorate([property({type:Boolean,attribute:"without-tooltip",reflect:!0})],LyraChart.prototype,"withoutTooltip",void 0),__decorate([property({type:Boolean,attribute:"data-labels"})],LyraChart.prototype,"dataLabels",void 0),__decorate([property({type:Boolean,attribute:"stack-totals"})],LyraChart.prototype,"stackTotals",void 0),__decorate([property({attribute:!1})],LyraChart.prototype,"config",null),__decorate([state()],LyraChart.prototype,"slottedConfig",void 0),__decorate([state()],LyraChart.prototype,"loading",void 0),__decorate([state()],LyraChart.prototype,"loadFailed",void 0),__decorate([state()],LyraChart.prototype,"zoomed",void 0),__decorate([state()],LyraChart.prototype,"visible",void 0),__decorate([query("canvas")],LyraChart.prototype,"canvasEl",void 0),__decorate([query("slot.config-slot")],LyraChart.prototype,"configSlotEl",void 0),__decorate([state()],LyraChart.prototype,"autoLegendPosition",void 0),__decorate([state()],LyraChart.prototype,"keyboardDatumAnnouncement",void 0);export{LyraChart,seriesPalette2 as seriesPalette};
@@ -5,5 +5,9 @@ export declare function normalizeHistogramBinCount(binCount:unknown):number;
5
5
  * Non-finite `binCount` (or <= 0) yields no buckets; a fractional `binCount`
6
6
  * is floored and an excessive count is capped; non-finite samples in
7
7
  * `values` are dropped rather than corrupting bucket-index math. Pass a BCP 47
8
- * `locale` to localize the generated range labels. */
8
+ * `locale` to localize the generated range labels -- an omitted value (or `'auto'`) resolves to
9
+ * the page's active `setLyraLocale()` locale the same way `utilities/format.ts`'s helpers do
10
+ * (see `resolveActiveOrExplicitLocale()`), falling back to `'en'` only once none has been set;
11
+ * an explicit tag always stays authoritative. `<lr-histogram>` itself is unaffected -- it always
12
+ * passes its own resolved `effectiveLocale` here. */
9
13
  export declare function binValues(values:readonly number[],binCount:number,locale?:string):HistogramBucket[];
@@ -1 +1 @@
1
- import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteInterpolate,finiteRatio}from"../../../internal/numbers.js";const MAX_HISTOGRAM_BINS=1e3,LEFT_TO_RIGHT_ISOLATE="⁦",POP_DIRECTIONAL_ISOLATE="⁩";function normalizeHistogramBinCount(binCount){const numeric=typeof binCount=="number"?binCount:Number(binCount);return Number.isFinite(numeric)?Math.min(MAX_HISTOGRAM_BINS,Math.max(0,Math.floor(numeric))):0}function binValues(values,binCount,locale){const finite=values.filter(v=>Number.isFinite(v));if(finite.length===0)return[];const bins=normalizeHistogramBinCount(binCount);if(bins<=0)return[];let lo=finite[0],hi=finite[0];for(const v of finite)v<lo&&(lo=v),v>hi&&(hi=v);const constant=hi===lo,numberFormat=getNumberFormat(locale,{minimumFractionDigits:1,maximumFractionDigits:1});if(constant)return[{label:`${LEFT_TO_RIGHT_ISOLATE}${numberFormat.format(lo)}${POP_DIRECTIONAL_ISOLATE}`,count:finite.length}];const labelHi=hi,formatRange=numberFormat.formatRange?.bind(numberFormat),buckets=Array.from({length:bins},(_,i)=>{const bLo=finiteInterpolate(lo,labelHi,i/bins),bHi=finiteInterpolate(lo,labelHi,(i+1)/bins);return{label:`${LEFT_TO_RIGHT_ISOLATE}${formatRange?formatRange(bLo,bHi):`${numberFormat.format(bLo)}–${numberFormat.format(bHi)}`}${POP_DIRECTIONAL_ISOLATE}`,count:0}});for(const v of finite){const index=Math.floor(finiteRatio(v,lo,hi)*bins);buckets[Math.min(bins-1,Math.max(0,index))].count++}return buckets}export{binValues,normalizeHistogramBinCount};
1
+ import{getNumberFormat}from"../../../internal/intl-cache.js";import{resolveActiveOrExplicitLocale}from"../../../internal/localization-runtime.js";import{finiteInterpolate,finiteRatio}from"../../../internal/numbers.js";const MAX_HISTOGRAM_BINS=1e3,LEFT_TO_RIGHT_ISOLATE="⁦",POP_DIRECTIONAL_ISOLATE="⁩";function normalizeHistogramBinCount(binCount){const numeric=typeof binCount=="number"?binCount:Number(binCount);return Number.isFinite(numeric)?Math.min(MAX_HISTOGRAM_BINS,Math.max(0,Math.floor(numeric))):0}function binValues(values,binCount,locale){const finite=values.filter(v=>Number.isFinite(v));if(finite.length===0)return[];const bins=normalizeHistogramBinCount(binCount);if(bins<=0)return[];let lo=finite[0],hi=finite[0];for(const v of finite)v<lo&&(lo=v),v>hi&&(hi=v);const constant=hi===lo,numberFormat=getNumberFormat(resolveActiveOrExplicitLocale(locale),{minimumFractionDigits:1,maximumFractionDigits:1});if(constant)return[{label:`${LEFT_TO_RIGHT_ISOLATE}${numberFormat.format(lo)}${POP_DIRECTIONAL_ISOLATE}`,count:finite.length}];const labelHi=hi,formatRange=numberFormat.formatRange?.bind(numberFormat),buckets=Array.from({length:bins},(_,i)=>{const bLo=finiteInterpolate(lo,labelHi,i/bins),bHi=finiteInterpolate(lo,labelHi,(i+1)/bins);return{label:`${LEFT_TO_RIGHT_ISOLATE}${formatRange?formatRange(bLo,bHi):`${numberFormat.format(bLo)}–${numberFormat.format(bHi)}`}${POP_DIRECTIONAL_ISOLATE}`,count:0}});for(const v of finite){const index=Math.floor(finiteRatio(v,lo,hi)*bins);buckets[Math.min(bins-1,Math.max(0,index))].count++}return buckets}export{binValues,normalizeHistogramBinCount};
@@ -73,6 +73,15 @@ export type LyraLiteChartTableCellFormatter=(value:number,context:LyraLiteChartT
73
73
  * Public collection properties take bounded, clone-owned readonly snapshots. Create a new
74
74
  * collection and reassign it after changes; mutating the assigned array does not update the view.
75
75
  *
76
+ * Two `lr-chart` surfaces have no counterpart here, deliberately: a per-series `stack` group id
77
+ * and a per-axis `stackedAxes` override. This chart has exactly one value scale (no `y2`), so "an
78
+ * unstacked overlay on a second axis" has no equivalent shape, and `stacked` already sums the
79
+ * whole category into one segmented bar; a per-series stack-group id would need the bar-geometry
80
+ * pass below to track independent running offsets per group instead of one per category. Tooltip
81
+ * title/footer formatters are likewise absent: the hover tooltip here is a native SVG `<title>`
82
+ * per mark (`pointText`), not a multi-item tooltip with separate regions for several datasets
83
+ * sharing a hovered category.
84
+ *
76
85
  * @customElement lr-lite-chart
77
86
  * @event lr-datum-activate - Fired when a bar/point is activated. The
78
87
  * normalized detail includes `kind`, `datasetIndex`, `index`, `label`, and
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{--_lr-code-block-copy-bg:var(--lr-icon-button-background,transparent);--_lr-code-block-copy-bg-hover:var(--lr-icon-button-background-hover,var(--lr-color-brand-quiet));--_lr-code-block-copy-bg-active:var(--lr-icon-button-background-active,color-mix(in oklab, var(--lr-icon-button-background-hover,var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active)));--_lr-code-block-copy-color:var(--lr-icon-button-color,var(--lr-color-text-quiet));--_lr-code-block-copy-color-hover:var(--lr-icon-button-color-hover,var(--lr-color-brand));--_lr-code-block-copy-color-active:var(--lr-icon-button-color-active,var(--lr-icon-button-color-hover,var(--lr-color-brand)));--_lr-code-block-copy-radius:var(--lr-icon-button-radius,var(--lr-radius));block-size:100%;font-size:var(--lr-font-size-sm);display:block}[part=base]{box-sizing:border-box;border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);flex-direction:column;block-size:100%;display:flex;overflow:hidden}[part=header]{align-items:center;gap:var(--lr-space-xs);min-inline-size:0;padding:var(--lr-space-xs) var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface);font-family:var(--lr-font);display:flex}[part=toggle]{font:inherit;inline-size:var(--lr-size-1-25rem);block-size:var(--lr-size-1-25rem);min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);color:var(--lr-color-text-quiet);border-radius:var(--lr-radius);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part=toggle]:hover{background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=toggle]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active));color:var(--lr-color-brand)}[part=toggle] .chevron{transition:transform var(--lr-transition-fast);display:inline-flex}:host(:not([collapsed])) [part=toggle] .chevron{transform:rotate(90deg)}:host([collapsed]:dir(rtl)) [part=toggle] .chevron{transform:scaleX(-1)}[part=filename]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;font-family:var(--lr-code-block-font,var(--lr-font-mono));font-size:var(--lr-font-size-xs);font-weight:var(--lr-font-weight-semibold);color:var(--lr-color-text);flex:auto;overflow:hidden}[part=language]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;max-inline-size:100%;padding:var(--lr-size-0-0625rem) var(--lr-size-0-4375rem);border-radius:var(--lr-radius-pill);background:var(--lr-code-block-language-bg,var(--lr-color-brand-quiet));color:var(--lr-code-block-language-color,var(--lr-color-brand));font-size:var(--lr-size-0-6875rem);line-height:var(--lr-line-height-1-4);text-transform:uppercase;letter-spacing:var(--lr-size-0-02em);flex:0 auto;overflow:hidden}[part~=copy-button]{font-size:var(--lr-font-size-xs);line-height:var(--lr-line-height-none);--lr-icon-button-background:var(--_lr-code-block-copy-bg);--lr-icon-button-background-hover:var(--_lr-code-block-copy-bg-hover);--lr-icon-button-background-active:var(--_lr-code-block-copy-bg-active);--lr-icon-button-color:var(--_lr-code-block-copy-color);--lr-icon-button-color-hover:var(--_lr-code-block-copy-color-hover);--lr-icon-button-color-active:var(--_lr-code-block-copy-color-active);--lr-icon-button-radius:var(--_lr-code-block-copy-radius);flex:none;margin-inline-start:auto}[part~=copy-button-text]::part(button){padding:var(--lr-size-0-1875rem) var(--lr-space-xs)}[part=toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=header-actions]{align-items:center;gap:var(--lr-space-2xs);flex:none;display:inline-flex}[part=header-actions][hidden]{display:none}[part=body]{block-size:100%;max-block-size:var(--lr-code-block-max-height,none);scrollbar-width:var(--lr-theme-scrollbar-width,auto);scrollbar-gutter:var(--lr-theme-scrollbar-gutter,auto);flex:auto;display:block;overflow:auto}[part=body][hidden]{display:none}[part=body]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=body] lr-skeleton{padding:var(--lr-space-s) var(--lr-space-m);--lr-skeleton-w:100%;--lr-skeleton-h:var(--lr-size-8rem);display:block}[part=pre]{padding:var(--lr-space-s) var(--lr-space-m);box-sizing:border-box;background:var(--lr-color-surface);inline-size:max-content;min-inline-size:100%;font-family:var(--lr-code-block-font,var(--lr-font-mono));font-size:inherit;line-height:var(--lr-line-height-normal);white-space:pre;tab-size:var(--lr-code-block-tab-size,2);direction:ltr;unicode-bidi:isolate;margin:0}[part=code]{font-family:inherit;display:grid}[part=pre] .line{display:block}[part=pre] .line-number{min-inline-size:var(--lr-size-2-5ch);color:var(--lr-color-text-quiet);text-align:end;user-select:none;margin-inline-end:var(--lr-space-s);display:inline-block}[part=pre] [data-highlighted]{background:var(--lr-code-block-highlighted-line-bg,var(--lr-color-warning-quiet))}[part=pre] [data-active]{outline:var(--lr-border-width-thin) solid var(--lr-code-block-active-line-outline-color,var(--lr-color-brand));outline-offset:calc(-1 * var(--lr-border-width-thin))}[part=pre] button.line-gutter{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);color:inherit;font:inherit;text-align:start;cursor:pointer;background:0 0;border:none;justify-content:end;align-items:center;margin:0;margin-inline-end:var(--lr-space-s);padding:0;display:inline-flex}[part=pre] button.line-gutter:hover{background:var(--lr-color-brand-quiet)}[part=pre] button.line-gutter:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=pre] button.line-gutter:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=body][data-dark-theme=true] [part=pre],[part=body][data-dark-theme=true] [part=pre] span{color:var(--shiki-dark,inherit)!important;background-color:var(--shiki-dark-bg,transparent)!important}[part=body][data-dark-theme=true] [part=pre] .line-number,[part=body][data-dark-theme=true] [part=pre] button.line-gutter{color:var(--lr-color-text-quiet)!important}[part=body][data-dark-theme=true] [part=pre] [data-highlighted]{background:var(--lr-code-block-highlighted-line-bg,var(--lr-color-warning-quiet))!important}@media (prefers-reduced-motion:reduce){[part=toggle] .chevron{transition:none!important}}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{--_lr-code-block-copy-bg:transparent;--_lr-code-block-copy-bg-hover:var(--lr-color-brand-quiet);--_lr-code-block-copy-bg-active:color-mix(in oklab, var(--lr-icon-button-background-hover,var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active));--_lr-code-block-copy-color:var(--lr-color-text-quiet);--_lr-code-block-copy-color-hover:var(--lr-color-brand);--_lr-code-block-copy-color-active:var(--lr-icon-button-color-hover,var(--lr-color-brand));--_lr-code-block-copy-radius:var(--lr-radius);block-size:100%;font-size:var(--lr-font-size-sm);display:block}[part=base]{box-sizing:border-box;border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);flex-direction:column;block-size:100%;display:flex;overflow:hidden}[part=header]{align-items:center;gap:var(--lr-space-xs);min-inline-size:0;padding:var(--lr-space-xs) var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface);font-family:var(--lr-font);display:flex}[part=toggle]{font:inherit;inline-size:var(--lr-size-1-25rem);block-size:var(--lr-size-1-25rem);min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);color:var(--lr-color-text-quiet);border-radius:var(--lr-radius);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part=toggle]:hover{background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=toggle]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active));color:var(--lr-color-brand)}[part=toggle] .chevron{transition:transform var(--lr-transition-fast);display:inline-flex}:host(:not([collapsed])) [part=toggle] .chevron{transform:rotate(90deg)}:host([collapsed]:dir(rtl)) [part=toggle] .chevron{transform:scaleX(-1)}[part=filename]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;font-family:var(--lr-code-block-font,var(--lr-font-mono));font-size:var(--lr-font-size-xs);font-weight:var(--lr-font-weight-semibold);color:var(--lr-color-text);flex:auto;overflow:hidden}[part=language]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;max-inline-size:100%;padding:var(--lr-size-0-0625rem) var(--lr-size-0-4375rem);border-radius:var(--lr-radius-pill);background:var(--lr-code-block-language-bg,var(--lr-color-brand-quiet));color:var(--lr-code-block-language-color,var(--lr-color-brand));font-size:var(--lr-size-0-6875rem);line-height:var(--lr-line-height-1-4);text-transform:uppercase;letter-spacing:var(--lr-size-0-02em);flex:0 auto;overflow:hidden}[part~=copy-button]{font-size:var(--lr-font-size-xs);line-height:var(--lr-line-height-none);--_lr-icon-button-background-default:var(--_lr-code-block-copy-bg);--_lr-icon-button-background-hover-default:var(--_lr-code-block-copy-bg-hover);--_lr-icon-button-background-active-default:var(--_lr-code-block-copy-bg-active);--_lr-icon-button-color-default:var(--_lr-code-block-copy-color);--_lr-icon-button-color-hover-default:var(--_lr-code-block-copy-color-hover);--_lr-icon-button-color-active-default:var(--_lr-code-block-copy-color-active);--_lr-icon-button-radius-default:var(--_lr-code-block-copy-radius);flex:none;margin-inline-start:auto}[part~=copy-button-text]::part(button){padding:var(--lr-size-0-1875rem) var(--lr-space-xs)}[part=toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=header-actions]{align-items:center;gap:var(--lr-space-2xs);flex:none;display:inline-flex}[part=header-actions][hidden]{display:none}[part=body]{block-size:100%;max-block-size:var(--lr-code-block-max-height,none);scrollbar-width:var(--lr-theme-scrollbar-width,auto);scrollbar-gutter:var(--lr-theme-scrollbar-gutter,auto);flex:auto;display:block;overflow:auto}[part=body][hidden]{display:none}[part=body]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=body] lr-skeleton{padding:var(--lr-space-s) var(--lr-space-m);--lr-skeleton-w:100%;--lr-skeleton-h:var(--lr-size-8rem);display:block}[part=pre]{padding:var(--lr-space-s) var(--lr-space-m);box-sizing:border-box;background:var(--lr-color-surface);inline-size:max-content;min-inline-size:100%;font-family:var(--lr-code-block-font,var(--lr-font-mono));font-size:inherit;line-height:var(--lr-line-height-normal);white-space:pre;tab-size:var(--lr-code-block-tab-size,2);direction:ltr;unicode-bidi:isolate;margin:0}[part=code]{font-family:inherit;display:grid}[part=pre] .line{display:block}[part=pre] .line-number{min-inline-size:var(--lr-size-2-5ch);color:var(--lr-color-text-quiet);text-align:end;user-select:none;margin-inline-end:var(--lr-space-s);display:inline-block}[part=pre] [data-highlighted]{background:var(--lr-code-block-highlighted-line-bg,var(--lr-color-warning-quiet))}[part=pre] [data-active]{outline:var(--lr-border-width-thin) solid var(--lr-code-block-active-line-outline-color,var(--lr-color-brand));outline-offset:calc(-1 * var(--lr-border-width-thin))}[part=pre] button.line-gutter{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);color:inherit;font:inherit;text-align:start;cursor:pointer;background:0 0;border:none;justify-content:end;align-items:center;margin:0;margin-inline-end:var(--lr-space-s);padding:0;display:inline-flex}[part=pre] button.line-gutter:hover{background:var(--lr-color-brand-quiet)}[part=pre] button.line-gutter:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=pre] button.line-gutter:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=body][data-dark-theme=true] [part=pre],[part=body][data-dark-theme=true] [part=pre] span{color:var(--shiki-dark,inherit)!important;background-color:var(--shiki-dark-bg,transparent)!important}[part=body][data-dark-theme=true] [part=pre] .line-number,[part=body][data-dark-theme=true] [part=pre] button.line-gutter{color:var(--lr-color-text-quiet)!important}[part=body][data-dark-theme=true] [part=pre] [data-highlighted]{background:var(--lr-code-block-highlighted-line-bg,var(--lr-color-warning-quiet))!important}@media (prefers-reduced-motion:reduce){[part=toggle] .chevron{transition:none!important}}`;export{styles};