@aceshooting/lyra-ui 14.0.0 → 14.1.1

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 (475) hide show
  1. package/CHANGELOG.md +155 -19
  2. package/custom-elements.json +1 -1
  3. package/dist/components/agent-tools/commit-card/commit-card.class.d.ts +3 -1
  4. package/dist/components/agent-tools/commit-card/commit-card.class.js +2 -2
  5. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +2 -1
  6. package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +1 -1
  7. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.d.ts +6 -2
  8. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +4 -4
  9. package/dist/components/agent-tools/result-card/result-card.class.d.ts +1 -1
  10. package/dist/components/agent-tools/result-card/result-card.class.js +1 -1
  11. package/dist/components/agent-tools/result-card/result-field.class.d.ts +1 -1
  12. package/dist/components/agent-tools/result-card/result-field.class.js +1 -1
  13. package/dist/components/agent-tools/stack-trace/stack-trace.class.d.ts +1 -1
  14. package/dist/components/agent-tools/stack-trace/stack-trace.class.js +1 -1
  15. package/dist/components/agent-tools/terminal/terminal.class.d.ts +1 -1
  16. package/dist/components/agent-tools/terminal/terminal.class.js +2 -2
  17. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +2 -2
  18. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -1
  19. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
  20. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +2 -2
  21. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.js +4 -4
  22. package/dist/components/agent-tools/trace-tree/span.d.ts +3 -1
  23. package/dist/components/agent-tools/trace-tree/span.js +1 -1
  24. package/dist/components/charts/chart/box-plot.class.d.ts +2 -0
  25. package/dist/components/charts/chart/box-plot.class.js +1 -1
  26. package/dist/components/charts/chart/chart.class.d.ts +6 -1
  27. package/dist/components/charts/chart/chart.class.js +1 -1
  28. package/dist/components/charts/chart/lite-chart.class.d.ts +20 -11
  29. package/dist/components/charts/chart/lite-chart.class.js +10 -8
  30. package/dist/components/conversation/chat-message/chat-message.class.d.ts +4 -3
  31. package/dist/components/conversation/code-block/code-block-core.class.d.ts +4 -3
  32. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  33. package/dist/components/conversation/code-block/code-block-shared.d.ts +3 -3
  34. package/dist/components/conversation/code-block/code-block-shared.js +2 -2
  35. package/dist/components/conversation/code-block/code-block.class.d.ts +4 -3
  36. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  37. package/dist/components/conversation/code-block/shiki-types.d.ts +2 -0
  38. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  39. package/dist/components/conversation/conversation-item/conversation-item.class.js +1 -1
  40. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  41. package/dist/components/conversation/markdown/markdown-core.class.d.ts +1 -1
  42. package/dist/components/conversation/markdown/markdown.class.d.ts +1 -1
  43. package/dist/components/conversation/message-actions/message-actions.class.d.ts +2 -0
  44. package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
  45. package/dist/components/conversation/message-feedback/message-feedback.class.d.ts +3 -1
  46. package/dist/components/conversation/message-feedback/message-feedback.class.js +2 -2
  47. package/dist/components/conversation/message-parts/message-parts.class.d.ts +3 -0
  48. package/dist/components/conversation/model-select/model-select.class.js +3 -3
  49. package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
  50. package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +2 -0
  51. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  52. package/dist/components/conversation/typing-indicator/typing-indicator.class.d.ts +2 -1
  53. package/dist/components/conversation/typing-indicator/typing-indicator.class.js +1 -1
  54. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.d.ts +3 -0
  55. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.js +1 -0
  56. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +4 -2
  57. package/dist/components/conversation/usage-badge/usage-badge.class.js +1 -1
  58. package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -3
  59. package/dist/components/conversation/widget-renderer/resolve.d.ts +4 -6
  60. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  61. package/dist/components/data/calendar/calendar.class.d.ts +6 -3
  62. package/dist/components/data/calendar/calendar.class.js +1 -1
  63. package/dist/components/data/calendar/calendar.styles.js +1 -1
  64. package/dist/components/data/condition-builder/condition-builder.class.d.ts +3 -1
  65. package/dist/components/data/condition-builder/condition-builder.class.js +15 -1
  66. package/dist/components/data/context-meter/context-meter.class.js +2 -2
  67. package/dist/components/data/data-grid/data-grid.class.d.ts +6 -2
  68. package/dist/components/data/data-grid/data-grid.class.js +1 -1
  69. package/dist/components/data/document-library/document-library.class.d.ts +5 -2
  70. package/dist/components/data/document-library/document-library.class.js +1 -1
  71. package/dist/components/data/file-tree/file-tree.class.d.ts +2 -1
  72. package/dist/components/data/file-tree/file-tree.class.js +1 -1
  73. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +5 -2
  74. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  75. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  76. package/dist/components/data/flow-canvas/flow-types.d.ts +2 -1
  77. package/dist/components/data/funnel/funnel.class.d.ts +1 -0
  78. package/dist/components/data/funnel/funnel.class.js +1 -1
  79. package/dist/components/data/gauge/gauge.class.d.ts +4 -1
  80. package/dist/components/data/gauge/gauge.class.js +6 -6
  81. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +5 -2
  82. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +15 -1
  83. package/dist/components/data/heatmap/heatmap.class.d.ts +7 -4
  84. package/dist/components/data/heatmap/heatmap.class.js +1 -1
  85. package/dist/components/data/sparkline/sparkline.class.d.ts +2 -1
  86. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  87. package/dist/components/data/stat/stat.class.d.ts +6 -2
  88. package/dist/components/data/stat/stat.class.js +1 -1
  89. package/dist/components/data/table/table.class.d.ts +5 -2
  90. package/dist/components/data/table/table.class.js +2 -2
  91. package/dist/components/data/timeline/timeline.class.d.ts +7 -2
  92. package/dist/components/data/timeline/timeline.class.js +1 -1
  93. package/dist/components/data/timeline/timeline.styles.js +1 -1
  94. package/dist/components/data/tree/tree-item.class.d.ts +3 -1
  95. package/dist/components/data/tree/tree-item.class.js +1 -1
  96. package/dist/components/data/tree/tree.class.d.ts +4 -1
  97. package/dist/components/data/tree/tree.class.js +1 -1
  98. package/dist/components/data/word-cloud/word-cloud-layout.d.ts +2 -1
  99. package/dist/components/data/word-cloud/word-cloud-layout.js +1 -1
  100. package/dist/components/data/word-cloud/word-cloud.class.d.ts +2 -1
  101. package/dist/components/forms/button/button.class.d.ts +5 -3
  102. package/dist/components/forms/button/button.class.js +1 -1
  103. package/dist/components/forms/checkbox/checkbox.class.d.ts +3 -0
  104. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  105. package/dist/components/forms/code-editor/code-editor.class.d.ts +11 -3
  106. package/dist/components/forms/code-editor/code-editor.class.js +6 -7
  107. package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
  108. package/dist/components/forms/color-picker/color-picker.class.d.ts +5 -1
  109. package/dist/components/forms/color-picker/color-picker.class.js +4 -4
  110. package/dist/components/forms/combobox/combobox.class.d.ts +19 -8
  111. package/dist/components/forms/combobox/combobox.class.js +3 -3
  112. package/dist/components/forms/combobox/option.class.d.ts +4 -0
  113. package/dist/components/forms/combobox/option.class.js +2 -2
  114. package/dist/components/forms/date-picker/calendar-core.d.ts +1 -1
  115. package/dist/components/forms/date-picker/calendar-core.js +1 -1
  116. package/dist/components/forms/date-picker/date-input.class.d.ts +20 -10
  117. package/dist/components/forms/date-picker/date-input.class.js +4 -4
  118. package/dist/components/forms/date-picker/date-picker.class.d.ts +24 -13
  119. package/dist/components/forms/date-picker/date-picker.class.js +7 -7
  120. package/dist/components/forms/date-picker/date-picker.styles.js +1 -1
  121. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +11 -3
  122. package/dist/components/forms/emoji-picker/emoji-picker.class.js +3 -3
  123. package/dist/components/forms/emoji-picker/emoji-types.d.ts +2 -2
  124. package/dist/components/forms/icon-button/icon-button.class.d.ts +4 -2
  125. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  126. package/dist/components/forms/input/input.class.d.ts +5 -1
  127. package/dist/components/forms/input/input.class.js +1 -1
  128. package/dist/components/forms/input/native-time-input.class.d.ts +3 -0
  129. package/dist/components/forms/input/number-input.class.d.ts +3 -0
  130. package/dist/components/forms/input/time-input.class.d.ts +3 -0
  131. package/dist/components/forms/input/time-input.class.js +1 -1
  132. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +5 -1
  133. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  134. package/dist/components/forms/otp-input/otp-input.class.d.ts +5 -1
  135. package/dist/components/forms/otp-input/otp-input.class.js +1 -1
  136. package/dist/components/forms/phone-input/phone-input.class.d.ts +21 -8
  137. package/dist/components/forms/phone-input/phone-input.class.js +1 -1
  138. package/dist/components/forms/radio/radio-button.class.d.ts +4 -0
  139. package/dist/components/forms/radio/radio-group.class.d.ts +4 -1
  140. package/dist/components/forms/radio/radio-group.class.js +1 -1
  141. package/dist/components/forms/radio/radio.class.d.ts +6 -2
  142. package/dist/components/forms/radio/radio.class.js +1 -1
  143. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +7 -1
  144. package/dist/components/forms/rubric-form/rubric-form.class.js +3 -3
  145. package/dist/components/forms/select/select.class.d.ts +8 -2
  146. package/dist/components/forms/select/select.class.js +2 -2
  147. package/dist/components/forms/slider/slider.class.d.ts +12 -6
  148. package/dist/components/forms/slider/slider.class.js +2 -2
  149. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +4 -0
  150. package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
  151. package/dist/components/forms/switch/switch.class.d.ts +5 -1
  152. package/dist/components/forms/switch/switch.class.js +1 -1
  153. package/dist/components/forms/textarea/textarea.class.d.ts +3 -0
  154. package/dist/components/forms/textarea/textarea.class.js +1 -1
  155. package/dist/components/forms/time-range/time-range.class.d.ts +3 -0
  156. package/dist/components/forms/time-range/time-range.class.js +1 -1
  157. package/dist/components/forms/token-input/token-input.class.d.ts +8 -2
  158. package/dist/components/forms/token-input/token-input.class.js +2 -2
  159. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  160. package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -1
  161. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  162. package/dist/components/layout/carousel/carousel.class.d.ts +3 -2
  163. package/dist/components/layout/carousel/carousel.class.js +1 -1
  164. package/dist/components/layout/command-palette/command-palette.class.js +1 -1
  165. package/dist/components/layout/dashboard-grid/dashboard-grid.class.d.ts +2 -0
  166. package/dist/components/layout/dashboard-grid/dashboard-grid.class.js +1 -1
  167. package/dist/components/layout/details/details.class.d.ts +3 -3
  168. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +3 -1
  169. package/dist/components/layout/filter-bar/filter-bar.class.js +1 -1
  170. package/dist/components/layout/menu/menu-label.class.d.ts +3 -3
  171. package/dist/components/layout/menu/menu.class.d.ts +4 -1
  172. package/dist/components/layout/menu/menu.class.js +1 -1
  173. package/dist/components/layout/multi-split/multi-split.class.d.ts +9 -3
  174. package/dist/components/layout/multi-split/multi-split.class.js +1 -1
  175. package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
  176. package/dist/components/layout/reorder-list/reorder-item.class.d.ts +2 -1
  177. package/dist/components/layout/reorder-list/reorder-item.class.js +1 -1
  178. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  179. package/dist/components/layout/reorder-list/reorder-owner.js +1 -1
  180. package/dist/components/layout/split-panel/split-panel.class.d.ts +2 -1
  181. package/dist/components/layout/split-panel/split-panel.class.js +1 -1
  182. package/dist/components/layout/tab-group/tab-group.class.d.ts +3 -1
  183. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  184. package/dist/components/layout/widget/widget.class.d.ts +6 -2
  185. package/dist/components/layout/widget/widget.class.js +1 -1
  186. package/dist/components/media/animation/animation.class.d.ts +3 -2
  187. package/dist/components/media/animation/animation.class.js +1 -1
  188. package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +4 -3
  189. package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
  190. package/dist/components/media/av-player/av-metadata.d.ts +3 -2
  191. package/dist/components/media/av-player/av-player.class.d.ts +4 -3
  192. package/dist/components/media/av-player/av-player.class.js +3 -3
  193. package/dist/components/media/av-player/av-player.styles.js +1 -1
  194. package/dist/components/media/avatar/avatar.class.d.ts +2 -1
  195. package/dist/components/media/avatar/avatar.class.js +1 -1
  196. package/dist/components/media/file-input/file-input.class.d.ts +4 -2
  197. package/dist/components/media/file-input/file-input.class.js +1 -1
  198. package/dist/components/media/file-input/file-input.styles.js +1 -1
  199. package/dist/components/media/image-viewer/image-viewer.class.d.ts +2 -1
  200. package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
  201. package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
  202. package/dist/components/media/map/map.class.d.ts +5 -3
  203. package/dist/components/media/map/map.class.js +1 -1
  204. package/dist/components/media/map/map.styles.js +1 -1
  205. package/dist/components/media/media-card/media-card.class.d.ts +1 -1
  206. package/dist/components/media/media-card/media-card.class.js +1 -1
  207. package/dist/components/media/pan-zoom/pan-zoom.class.js +1 -1
  208. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +1 -1
  209. package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
  210. package/dist/components/media/video/video.class.d.ts +2 -1
  211. package/dist/components/media/video/video.styles.js +1 -1
  212. package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +3 -2
  213. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
  214. package/dist/components/overlays/chip/chip-group.class.d.ts +2 -0
  215. package/dist/components/overlays/chip/chip-group.class.js +1 -1
  216. package/dist/components/overlays/dialog/dialog.class.d.ts +2 -0
  217. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  218. package/dist/components/overlays/empty/empty.class.d.ts +2 -0
  219. package/dist/components/overlays/empty/empty.class.js +1 -1
  220. package/dist/components/overlays/kbd/kbd.class.d.ts +2 -0
  221. package/dist/components/overlays/kbd/kbd.class.js +1 -1
  222. package/dist/components/overlays/overlay/popover.class.d.ts +3 -1
  223. package/dist/components/overlays/overlay/popover.class.js +1 -1
  224. package/dist/components/overlays/overlay/tooltip.class.d.ts +3 -1
  225. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  226. package/dist/components/overlays/rating/rating.class.d.ts +2 -0
  227. package/dist/components/overlays/rating/rating.class.js +1 -1
  228. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +2 -2
  229. package/dist/components/retrieval/entity-card/entity-card.class.d.ts +5 -2
  230. package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
  231. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +4 -2
  232. package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
  233. package/dist/components/retrieval/graph/graph-canvas.js +1 -1
  234. package/dist/components/retrieval/graph/graph.class.d.ts +9 -7
  235. package/dist/components/retrieval/graph/graph.class.js +1 -1
  236. package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +1 -3
  237. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +2 -0
  238. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +1 -1
  239. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +3 -2
  240. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +7 -3
  241. package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +2 -1
  242. package/dist/components/retrieval/provenance-panel/provenance-panel.class.js +1 -1
  243. package/dist/components/retrieval/source-picker/source-picker.class.d.ts +2 -1
  244. package/dist/components/retrieval/source-picker/source-picker.class.js +1 -1
  245. package/dist/components/utility/format/format-number.class.d.ts +3 -1
  246. package/dist/components/utility/format/format-options.js +1 -1
  247. package/dist/components/utility/json-viewer/json-viewer.class.d.ts +3 -2
  248. package/dist/components/utility/json-viewer/json-viewer.class.js +2 -2
  249. package/dist/components/utility/known-date/known-date.class.d.ts +9 -5
  250. package/dist/components/utility/known-date/known-date.class.js +2 -2
  251. package/dist/components/utility/known-date/known-date.styles.js +1 -1
  252. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +3 -1
  253. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  254. package/dist/components/utility/poll-status/poll-status.class.d.ts +3 -0
  255. package/dist/components/utility/poll-status/poll-status.styles.js +1 -1
  256. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.d.ts +1 -0
  257. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  258. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.d.ts +2 -1
  259. package/dist/components/viewers/dataset-viewer/dataset-viewer.styles.js +1 -1
  260. package/dist/components/viewers/document-preview/document-preview.class.d.ts +4 -2
  261. package/dist/components/viewers/document-preview/document-preview.class.js +1 -1
  262. package/dist/components/viewers/document-preview/document-preview.styles.js +1 -1
  263. package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +3 -2
  264. package/dist/components/viewers/document-viewer/document-viewer.class.js +2 -2
  265. package/dist/components/viewers/document-viewer/registry-ownership.d.ts +1 -0
  266. package/dist/components/viewers/document-viewer/registry-ownership.js +1 -0
  267. package/dist/components/viewers/document-viewer/registry.js +1 -1
  268. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.d.ts +7 -1
  269. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
  270. package/dist/components/viewers/email-viewer/email-viewer.class.d.ts +2 -1
  271. package/dist/components/viewers/email-viewer/email-viewer.class.js +2 -2
  272. package/dist/components/viewers/include/include-resource.js +1 -1
  273. package/dist/components/viewers/include/include.class.d.ts +3 -1
  274. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.d.ts +4 -2
  275. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +4 -4
  276. package/dist/components/viewers/notebook-viewer/notebook-viewer.styles.js +1 -1
  277. package/dist/components/viewers/passive-markup.js +1 -1
  278. package/dist/components/viewers/svg-viewer/svg-viewer.class.d.ts +2 -1
  279. package/dist/components/viewers/svg-viewer/svg-viewer.styles.js +1 -1
  280. package/dist/components/viewers/xml-viewer/xml-viewer.class.d.ts +2 -1
  281. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
  282. package/dist/components/viewers/xml-viewer/xml-viewer.js +1 -1
  283. package/dist/custom-elements-jsx.d.ts +1 -1
  284. package/dist/internal/aria-reflection.js +1 -1
  285. package/dist/internal/catalog-picker.js +1 -1
  286. package/dist/internal/default-strings.generated.d.ts +1 -1
  287. package/dist/internal/default-strings.generated.js +1 -1
  288. package/dist/internal/dev-mode-attribute-warning.d.ts +3 -0
  289. package/dist/internal/dev-mode-attribute-warning.js +1 -1
  290. package/dist/internal/form-associated.js +1 -1
  291. package/dist/internal/localization-types.d.ts +1 -1
  292. package/dist/internal/localization.js +1 -1
  293. package/dist/internal/lyra-element.js +1 -1
  294. package/dist/internal/native-control-description.d.ts +7 -0
  295. package/dist/internal/native-control-description.js +1 -0
  296. package/dist/internal/option-selection.js +1 -1
  297. package/dist/internal/overlay-order.d.ts +6 -0
  298. package/dist/internal/overlay-order.js +1 -0
  299. package/dist/internal/overlay-stack.d.ts +1 -1
  300. package/dist/internal/overlay-stack.js +1 -1
  301. package/dist/internal/package-metadata.d.ts +1 -1
  302. package/dist/internal/package-metadata.js +1 -1
  303. package/dist/internal/positioner.d.ts +5 -4
  304. package/dist/internal/reactive-property-writes.d.ts +1 -0
  305. package/dist/internal/reactive-property-writes.js +1 -0
  306. package/dist/internal/svg-title.d.ts +3 -0
  307. package/dist/internal/svg-title.js +1 -0
  308. package/dist/svelte.d.ts +1 -1
  309. package/dist/translations/ar.js +1 -1
  310. package/dist/translations/de.js +1 -1
  311. package/dist/translations/es.js +1 -1
  312. package/dist/translations/fa.js +1 -1
  313. package/dist/translations/fr.js +1 -1
  314. package/dist/translations/he.js +1 -1
  315. package/dist/translations/ja.js +1 -1
  316. package/dist/translations/pt-BR.js +1 -1
  317. package/dist/translations/ru.js +1 -1
  318. package/dist/translations/zh-CN.js +1 -1
  319. package/dist/vue.d.ts +1 -1
  320. package/llms/components/lr-accordion-item.md +4 -0
  321. package/llms/components/lr-accordion.md +4 -0
  322. package/llms/components/lr-agent-trace.md +3 -0
  323. package/llms/components/lr-animation.md +4 -0
  324. package/llms/components/lr-app-rail-item.md +4 -2
  325. package/llms/components/lr-app-rail.md +4 -2
  326. package/llms/components/lr-attachment-chip.md +6 -0
  327. package/llms/components/lr-av-player.md +14 -0
  328. package/llms/components/lr-avatar.md +4 -0
  329. package/llms/components/lr-box-plot.md +6 -0
  330. package/llms/components/lr-button.md +11 -3
  331. package/llms/components/lr-calendar-viewer.md +4 -0
  332. package/llms/components/lr-calendar.md +5 -0
  333. package/llms/components/lr-carousel.md +5 -0
  334. package/llms/components/lr-chart.md +13 -4
  335. package/llms/components/lr-chat-message.md +4 -0
  336. package/llms/components/lr-checkbox.md +3 -0
  337. package/llms/components/lr-chip-group.md +3 -0
  338. package/llms/components/lr-chip.md +3 -0
  339. package/llms/components/lr-code-block-core.md +16 -4
  340. package/llms/components/lr-code-block.md +7 -0
  341. package/llms/components/lr-code-editor.md +18 -5
  342. package/llms/components/lr-color-picker.md +9 -0
  343. package/llms/components/lr-combobox.md +35 -4
  344. package/llms/components/lr-command-palette.md +4 -0
  345. package/llms/components/lr-commit-card.md +3 -0
  346. package/llms/components/lr-compare-panel.md +7 -0
  347. package/llms/components/lr-condition-builder.md +5 -0
  348. package/llms/components/lr-conversation-item.md +3 -0
  349. package/llms/components/lr-copy-button.md +6 -0
  350. package/llms/components/lr-dashboard-grid.md +5 -0
  351. package/llms/components/lr-data-grid.md +11 -1
  352. package/llms/components/lr-dataset-viewer.md +3 -2
  353. package/llms/components/lr-date-input.md +46 -6
  354. package/llms/components/lr-date-picker.md +46 -6
  355. package/llms/components/lr-details.md +4 -0
  356. package/llms/components/lr-dialog.md +4 -0
  357. package/llms/components/lr-document-library.md +4 -0
  358. package/llms/components/lr-document-preview.md +7 -1
  359. package/llms/components/lr-document-viewer.md +9 -3
  360. package/llms/components/lr-dropdown-item.md +4 -0
  361. package/llms/components/lr-dropdown.md +3 -0
  362. package/llms/components/lr-ebook-viewer.md +4 -0
  363. package/llms/components/lr-email-viewer.md +5 -0
  364. package/llms/components/lr-emoji-picker.md +17 -3
  365. package/llms/components/lr-empty.md +3 -0
  366. package/llms/components/lr-entity-card.md +3 -0
  367. package/llms/components/lr-entity-chip.md +4 -0
  368. package/llms/components/lr-file-input.md +7 -0
  369. package/llms/components/lr-file-tree.md +5 -1
  370. package/llms/components/lr-filter-bar.md +5 -0
  371. package/llms/components/lr-flow-canvas.md +8 -1
  372. package/llms/components/lr-flow-node.md +2 -1
  373. package/llms/components/lr-flow-run-status.md +1 -1
  374. package/llms/components/lr-format-number.md +4 -0
  375. package/llms/components/lr-funnel.md +4 -0
  376. package/llms/components/lr-gauge.md +4 -0
  377. package/llms/components/lr-generation-metrics.md +5 -0
  378. package/llms/components/lr-graph-query-builder.md +6 -0
  379. package/llms/components/lr-graph.md +8 -2
  380. package/llms/components/lr-heatmap.md +13 -0
  381. package/llms/components/lr-icon-button.md +7 -0
  382. package/llms/components/lr-image-viewer.md +9 -0
  383. package/llms/components/lr-include.md +5 -0
  384. package/llms/components/lr-ingestion-queue.md +4 -0
  385. package/llms/components/lr-input.md +22 -8
  386. package/llms/components/lr-json-viewer.md +4 -0
  387. package/llms/components/lr-kbd.md +3 -0
  388. package/llms/components/lr-knowledge-graph-explorer.md +7 -0
  389. package/llms/components/lr-known-date.md +7 -0
  390. package/llms/components/lr-lite-chart.md +21 -4
  391. package/llms/components/lr-live-region.md +3 -0
  392. package/llms/components/lr-locale-picker.md +6 -0
  393. package/llms/components/lr-map.md +8 -0
  394. package/llms/components/lr-markdown-core.md +4 -0
  395. package/llms/components/lr-markdown.md +8 -4
  396. package/llms/components/lr-media-card.md +5 -2
  397. package/llms/components/lr-mention-popover.md +5 -0
  398. package/llms/components/lr-menu-item.md +4 -0
  399. package/llms/components/lr-menu-label.md +4 -3
  400. package/llms/components/lr-menu.md +4 -0
  401. package/llms/components/lr-message-actions.md +3 -0
  402. package/llms/components/lr-message-feedback.md +4 -0
  403. package/llms/components/lr-message-parts.md +3 -2
  404. package/llms/components/lr-model-select.md +8 -0
  405. package/llms/components/lr-multi-split.md +15 -6
  406. package/llms/components/lr-native-time-input.md +10 -0
  407. package/llms/components/lr-node-palette.md +3 -0
  408. package/llms/components/lr-notebook-viewer.md +4 -1
  409. package/llms/components/lr-number-input.md +12 -1
  410. package/llms/components/lr-option.md +35 -4
  411. package/llms/components/lr-otp-input.md +10 -0
  412. package/llms/components/lr-pan-zoom.md +1 -2
  413. package/llms/components/lr-phone-input.md +20 -5
  414. package/llms/components/lr-poll-status.md +4 -0
  415. package/llms/components/lr-popover.md +3 -0
  416. package/llms/components/lr-popup.md +3 -2
  417. package/llms/components/lr-prompt-studio.md +7 -0
  418. package/llms/components/lr-provenance-panel.md +3 -0
  419. package/llms/components/lr-push-to-talk.md +3 -0
  420. package/llms/components/lr-radio-button.md +13 -4
  421. package/llms/components/lr-radio-group.md +5 -0
  422. package/llms/components/lr-radio.md +9 -0
  423. package/llms/components/lr-rating.md +3 -0
  424. package/llms/components/lr-reorder-item.md +6 -0
  425. package/llms/components/lr-reorder-list.md +6 -0
  426. package/llms/components/lr-result-card.md +3 -0
  427. package/llms/components/lr-result-field.md +3 -0
  428. package/llms/components/lr-rubric-form.md +12 -0
  429. package/llms/components/lr-select.md +9 -0
  430. package/llms/components/lr-sequence-playback.md +4 -0
  431. package/llms/components/lr-slider.md +16 -4
  432. package/llms/components/lr-source-picker.md +4 -0
  433. package/llms/components/lr-span-waterfall.md +3 -0
  434. package/llms/components/lr-sparkline.md +4 -0
  435. package/llms/components/lr-split-panel.md +4 -0
  436. package/llms/components/lr-stack-trace.md +3 -0
  437. package/llms/components/lr-stat.md +10 -0
  438. package/llms/components/lr-subagent-panel.md +3 -2
  439. package/llms/components/lr-svg-viewer.md +3 -0
  440. package/llms/components/lr-swatch-picker.md +4 -0
  441. package/llms/components/lr-switch.md +6 -0
  442. package/llms/components/lr-tab-group.md +4 -0
  443. package/llms/components/lr-table.md +10 -2
  444. package/llms/components/lr-terminal.md +3 -0
  445. package/llms/components/lr-textarea.md +9 -0
  446. package/llms/components/lr-thread-list.md +6 -3
  447. package/llms/components/lr-time-input.md +3 -0
  448. package/llms/components/lr-time-range.md +5 -0
  449. package/llms/components/lr-timeline-item.md +6 -0
  450. package/llms/components/lr-timeline.md +6 -0
  451. package/llms/components/lr-token-input.md +14 -0
  452. package/llms/components/lr-tool-call-chip.md +5 -3
  453. package/llms/components/lr-tool-param-form.md +4 -0
  454. package/llms/components/lr-tool-result-dialog.md +4 -0
  455. package/llms/components/lr-tool-select-dialog.md +4 -0
  456. package/llms/components/lr-tooltip.md +6 -0
  457. package/llms/components/lr-trace-tree.md +3 -0
  458. package/llms/components/lr-transcript-feed.md +3 -0
  459. package/llms/components/lr-tree-item.md +12 -5
  460. package/llms/components/lr-tree.md +12 -5
  461. package/llms/components/lr-typing-indicator.md +3 -0
  462. package/llms/components/lr-usage-badge.md +4 -0
  463. package/llms/components/lr-video.md +8 -2
  464. package/llms/components/lr-virtual-list.md +5 -3
  465. package/llms/components/lr-voice-picker.md +8 -0
  466. package/llms/components/lr-widget-renderer.md +9 -0
  467. package/llms/components/lr-widget.md +4 -2
  468. package/llms/components/lr-word-cloud.md +4 -0
  469. package/llms/components/lr-xml-viewer.md +9 -2
  470. package/llms/components/lr-zoomable-frame.md +6 -3
  471. package/llms-full.txt +4080 -2711
  472. package/package.json +4 -4
  473. package/vscode-css-data.json +1 -1
  474. package/vscode-html-data.json +1 -1
  475. package/web-types.json +1 -1
@@ -1,4 +1,4 @@
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{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{resolveCssLength}from"../../../internal/css-length.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{getNumberFormat,resolveIntlLocale}from"../../../internal/intl-cache.js";import{chevronIcon}from"../../../internal/icons.js";import{LyraElement}from"../../../internal/lyra-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{finiteCount,finiteDuration,finiteInteger,finiteRange}from"../../../internal/numbers.js";import{sizes}from"../../../internal/sizes.styles.js";import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{aggregateValues,columnId,columnValue,filterRows,pathValue,rowsAsDelimited,searchRows,sortRows}from"./data-grid-processing.js";import{styles}from"./data-grid.styles.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copied,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_dataGridColumnMenu,LYRA_DEFAULT_dataGridPinEnd,LYRA_DEFAULT_dataGridPinStart,LYRA_DEFAULT_dataGridRowsPerPage,LYRA_DEFAULT_dataGridTreeLimitReached,LYRA_DEFAULT_dataGridUnpin,LYRA_DEFAULT_expand,LYRA_DEFAULT_loading,LYRA_DEFAULT_next,LYRA_DEFAULT_noColumns,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_paginationFirstPage,LYRA_DEFAULT_paginationJumpToPage,LYRA_DEFAULT_paginationLabel,LYRA_DEFAULT_paginationLastPage,LYRA_DEFAULT_previous,LYRA_DEFAULT_resizeColumn,LYRA_DEFAULT_resizeValuePixels,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_tableFilterLabel}from"../../../internal/default-strings.generated.js";export*from"./data-grid-types.js";const selectableConverter={fromAttribute(value){return value===null?"none":value===""||value==="multiple"?"multiple":value==="single"||value==="none"?value:"none"},toAttribute(value){return value==="none"?null:value===""||value==="multiple"?"":value}};function displayItemKey(item){return item.kind==="group"?`group:${item.key.length}:${item.key}`:`row:${typeof item.key}:${String(item.key)}`}const DATA_GRID_COLUMN_PROPERTIES=["id","field","label","align","width","minWidth","maxWidth","flex","formatter","value","sortable","sortFn","comparator","sortDescFirst","sortUndefined","searchable","filterable","filterType","filterFn","hidden","hideable","resizable","movable","pinnable","pinned","footer","aggregation","aggregatedFormatter"],DATA_GRID_COLUMN_CALLBACK_PROPERTIES=new Set(["formatter","value","comparator","filterFn","aggregatedFormatter"]),DATA_GRID_SORT_ALGORITHMS=new Set(["alphanumeric","alphanumericCaseSensitive","text","textCaseSensitive","datetime","basic"]),DATA_GRID_FILTER_TYPES=new Set(["text","equals","number-range","date-range","set","includes-any","includes-all"]),DATA_GRID_AGGREGATIONS=new Set(["sum","min","max","mean","median","count","unique","uniqueCount","extent"]);function isSafeColumnPropertyValue(property2,value){if(value===void 0)return!0;if(DATA_GRID_COLUMN_CALLBACK_PROPERTIES.has(property2))return typeof value=="function";switch(property2){case"id":case"field":case"label":return typeof value=="string";case"width":case"minWidth":case"maxWidth":case"flex":return typeof value=="number"&&Number.isFinite(value);case"sortable":case"sortDescFirst":case"searchable":case"filterable":case"hidden":case"hideable":case"resizable":case"movable":case"pinnable":return typeof value=="boolean";case"align":return value==="left"||value==="center"||value==="right"||value==="start"||value==="end";case"sortFn":return typeof value=="string"&&DATA_GRID_SORT_ALGORITHMS.has(value);case"sortUndefined":return value==="first"||value==="last"||value===1||value===-1;case"filterType":return typeof value=="string"&&DATA_GRID_FILTER_TYPES.has(value);case"pinned":return value===!1||value==="left"||value==="right"||value==="start"||value==="end";case"footer":return typeof value=="string"||typeof value=="function";case"aggregation":return typeof value=="function"||typeof value=="string"&&DATA_GRID_AGGREGATIONS.has(value);default:return!1}}function snapshotColumns(value,occurrenceId){const output=[],seen=new Set;let length=0;try{if(!Array.isArray(value))return Object.freeze(output);const descriptor=getOwnDataDescriptor(value,"length"),sourceLength=descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value;typeof sourceLength=="number"&&Number.isSafeInteger(sourceLength)&&sourceLength>=0&&(length=Math.min(sourceLength,MAX_DATA_GRID_COLUMN_ENTRIES))}catch{return Object.freeze(output)}for(let index=0;index<length;index+=1){const candidate=getOwnDataDescriptor(value,String(index));if(candidate===MISSING_OWN_DATA_DESCRIPTOR||candidate===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const column=candidate.value;try{if(column===null||typeof column!="object"||Array.isArray(column))continue;const descriptors=new Map;for(const property2 of DATA_GRID_COLUMN_PROPERTIES)descriptors.set(property2,getOwnDataDescriptor(column,property2));const idDescriptor=descriptors.get("id")??MISSING_OWN_DATA_DESCRIPTOR,fieldDescriptor=descriptors.get("field")??MISSING_OWN_DATA_DESCRIPTOR;if(idDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const hasId=idDescriptor!==MISSING_OWN_DATA_DESCRIPTOR,authoredId=hasId?idDescriptor.value:void 0,hasSafeId=typeof authoredId=="string"&&authoredId.trim()!=="";if(hasId&&authoredId!==void 0&&!hasSafeId)continue;const hasField=fieldDescriptor!==MISSING_OWN_DATA_DESCRIPTOR,authoredField=fieldDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!hasField?void 0:fieldDescriptor.value,hasSafeField=typeof authoredField=="string"&&authoredField.trim()!=="";if(!hasSafeId&&(fieldDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||hasField&&authoredField!==void 0&&!hasSafeField))continue;const identity=hasSafeId?authoredId:hasSafeField?authoredField:occurrenceId(column);if(seen.has(identity))continue;seen.add(identity);const snapshot=Object.create(null);for(const property2 of DATA_GRID_COLUMN_PROPERTIES){const descriptor=descriptors.get(property2);descriptor===void 0||descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||property2==="field"&&!hasSafeField||isSafeColumnPropertyValue(property2,descriptor.value)&&(snapshot[property2]=descriptor.value)}authoredId===void 0&&authoredField===void 0&&(snapshot.id=identity),output.push(Object.freeze(snapshot))}catch{}}return Object.freeze(output)}const INTERACTIVE_SELECTOR='button, a[href], input, select, textarea, summary, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="checkbox"], [role="radio"]',VIRTUALIZATION_THRESHOLD=80,VIRTUAL_OVERSCAN=5,DATA_GRID_TREE_NODE_LIMIT=1e4,DATA_GRID_TREE_DEPTH_LIMIT=64,MAX_DATA_GRID_COLUMN_ENTRIES=1e4,DATA_GRID_DRAG_TYPE="application/x-lyra-data-grid-column";function frozenArray(values){return Object.freeze([...values])}function serializableFilterValue(value){try{const serialized=JSON.stringify({value},(_key,nested)=>typeof nested=="bigint"?nested.toString():typeof nested=="number"&&!Number.isFinite(nested)?null:nested!==null&&typeof nested=="object"&&Object.prototype.toString.call(nested)==="[object Set]"?[...nested]:nested);if(!serialized)return null;const snapshot=JSON.parse(serialized).value??null,stack=[snapshot],visited=new Set;for(;stack.length>0;){const current=stack.pop();if(!(current===null||typeof current!="object"||visited.has(current))){visited.add(current);for(const nested of Object.values(current))stack.push(nested);Object.freeze(current)}}return snapshot}catch{return null}}function isKey(value){return typeof value=="string"&&value.trim()!==""||typeof value=="number"&&Number.isFinite(value)}function snapshotKeys(value){if(!Array.isArray(value))return Object.freeze([]);const output=[],seen=new Set;for(const key of value)!isKey(key)||seen.has(key)||(seen.add(key),output.push(key));return frozenArray(output)}function keysEqual(left,right){return typeof left==typeof right&&left===right}function arrayHasKey(keys,key){return keys.some(candidate=>keysEqual(candidate,key))}function isElementValue(value){if(value===null||typeof value!="object")return!1;const candidate=value;return candidate.nodeType===1&&typeof candidate.closest=="function"}function valueControl(value){return!isElementValue(value)||typeof value.value!="string"?null:value}function checkableControl(value){return!isElementValue(value)||typeof value.checked!="boolean"?null:value}function dateText(value){try{const timestamp=Date.prototype.getTime.call(value);return Number.isFinite(timestamp)?Date.prototype.toISOString.call(value):""}catch{return}}function humanizeIdentifier(value,locale){const intlLocale=resolveIntlLocale(locale);return value.replaceAll(/[._-]+/gu," ").replaceAll(/([a-z\d])([A-Z])/gu,"$1 $2").replace(/^./u,first=>first.toLocaleUpperCase(intlLocale))}function safeText(value){if(value==null)return"";if(typeof value=="object"){const serializedDate=dateText(value);if(serializedDate!==void 0)return serializedDate}if(Array.isArray(value))return value.map(safeText).join(", ");if(typeof value=="object")try{return JSON.stringify(value,(_key,nested)=>typeof nested=="bigint"?nested.toString():nested)??""}catch{return""}return String(value)}function normalizePinSide(side){return side==="start"?"left":side==="end"?"right":side}function normalizedGroupBy(value){return typeof value!="string"?(value??[]).map(entry=>entry.trim()).filter(Boolean).slice(0,DATA_GRID_TREE_DEPTH_LIMIT):value.split(/[\s,]+/u).map(entry=>entry.trim()).filter(Boolean).slice(0,DATA_GRID_TREE_DEPTH_LIMIT)}class LyraDataGrid extends LyraElement{constructor(){super(...arguments),this.appearance="outlined",this.childRows=null,this._columnOrder=Object.freeze([]),this.columnOccurrenceIds=new WeakMap,this.nextColumnOccurrenceId=1,this.rowOccurrenceIds=new WeakMap,this.nextRowOccurrenceId=1,this._columns=Object.freeze([]),this._data=Object.freeze([]),this.dataSource=null,this._expandedRowKeys=Object.freeze([]),this.filterDebounce=250,this.filterFromLeafRows=!1,this._filters=Object.freeze([]),this._groupBy=null,this.label=null,this.loading=!1,this.maxMultiSort=0,this.page=0,this.pageSize=20,this._pageSizeOptions=Object.freeze([10,20,50,100]),this.paginate=!1,this.pinnable=!1,this.reorderable=!1,this.resizable=!1,this.rowClass=null,this.rowDetail=null,this.rowKey=null,this.searchFn=null,this.searchTerm="",this.selectable="none",this.selectableRows=null,this._selectedRowKeys=Object.freeze([]),this.server=!1,this.size="m",this._sort=Object.freeze([]),this.sortDescFirst=!1,this.striped=!1,this.total=-1,this.withColumnMenu=!1,this.withColumnsMenu=!1,this.withoutSortRemoval=!1,this.withSearch=!1,this.columnWidths=new Map,this.columnVisibility=new Map,this.columnPinning=new Map,this.activeFilterColumn=null,this.columnsMenuOpen=!1,this.activeColumnMenu=null,this.liveText="",this.bodyScrollTop=0,this.bodyScrollInlineOffset=0,this.viewportHeight=0,this.focusedRow=-1,this.focusedColumn=0,this.dragGhost="",this.requestGeneration=0,this.ownsLoadingState=!1,this.columnDragSequence=0,this.managedOverlayOwner=null,this.lastSelectedIndex=-1,this.isMounting=!0,this.measuredItemHeights=new Map,this.measuredItemOffsets=Object.freeze([0]),this.measuredItemOffsetSignature="",this.measuredItemOffsetEstimate=0,this.measuredItemOffsetsDirty=!0,this.measurementLocale="",this.measurementDisplaySignature="",this.measurementFontSignature="",this.bodyScrollbarInlineEndGutter=0,this.observedMeasurementElements=new Map,this.measurementUpdateQueued=!1,this.measurementScrollSyncQueued=!1,this.bodyScrollStateSyncQueued=!1,this.relayEditorFocus=event=>{relayNativeEvent(this,event)},this.relayEditorBlur=event=>{relayNativeEvent(this,event)}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,copied:LYRA_DEFAULT_copied,copyFailed:LYRA_DEFAULT_copyFailed,dataGridColumnMenu:LYRA_DEFAULT_dataGridColumnMenu,dataGridPinEnd:LYRA_DEFAULT_dataGridPinEnd,dataGridPinStart:LYRA_DEFAULT_dataGridPinStart,dataGridRowsPerPage:LYRA_DEFAULT_dataGridRowsPerPage,dataGridTreeLimitReached:LYRA_DEFAULT_dataGridTreeLimitReached,dataGridUnpin:LYRA_DEFAULT_dataGridUnpin,expand:LYRA_DEFAULT_expand,loading:LYRA_DEFAULT_loading,next:LYRA_DEFAULT_next,noColumns:LYRA_DEFAULT_noColumns,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,paginationFirstPage:LYRA_DEFAULT_paginationFirstPage,paginationJumpToPage:LYRA_DEFAULT_paginationJumpToPage,paginationLabel:LYRA_DEFAULT_paginationLabel,paginationLastPage:LYRA_DEFAULT_paginationLastPage,previous:LYRA_DEFAULT_previous,resizeColumn:LYRA_DEFAULT_resizeColumn,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showAllColumns:LYRA_DEFAULT_showAllColumns,tableFilterLabel:LYRA_DEFAULT_tableFilterLabel}}static{this.immutableEventDetails=Object.freeze(["request","lr-column-move","lr-data-error"])}static{this.identityEventDetailProperties=Object.freeze({request:Object.freeze(["signal"]),"lr-data-error":Object.freeze(["error","request"])})}static{this.styles=[LyraElement.styles,sizes,srOnly,styles]}get columnOrder(){return this._columnOrder}set columnOrder(value){const previous=this._columnOrder,seen=new Set;this._columnOrder=frozenArray(Array.isArray(value)?value.filter(id=>typeof id!="string"||id.trim()===""||seen.has(id)?!1:(seen.add(id),!0)):[]),this.requestUpdate("columnOrder",previous)}get columns(){return this._columns}set columns(value){const previous=this._columns;this._columns=snapshotColumns(value,column=>{const current=this.columnOccurrenceIds.get(column);if(current)return current;const identity=`column-occurrence-${this.nextColumnOccurrenceId}`;return this.nextColumnOccurrenceId+=1,this.columnOccurrenceIds.set(column,identity),identity}),this.requestUpdate("columns",previous)}get data(){return this._data}set data(value){const previous=this._data;this._data=frozenArray(Array.isArray(value)?value:[]),this.requestUpdate("data",previous)}get expandedRowKeys(){return this._expandedRowKeys}set expandedRowKeys(value){const previous=this._expandedRowKeys;this._expandedRowKeys=snapshotKeys(value),this.requestUpdate("expandedRowKeys",previous),this.requestUpdate("expandedKeys",previous)}get expandedKeys(){return this.expandedRowKeys}set expandedKeys(value){this.expandedRowKeys=value}get filteredCount(){return this.processedClientRows.length}get filters(){return this._filters}set filters(value){const previous=this._filters,next=[];if(Array.isArray(value))for(const filter of value)try{if(!filter||typeof filter.id!="string")continue;const filterValue=filter.value instanceof Set||Array.isArray(filter.value)?frozenArray(filter.value):filter.value;next.push(Object.freeze({id:filter.id,value:filterValue}))}catch{}this._filters=Object.freeze(next),this.requestUpdate("filters",previous)}get groupBy(){return this._groupBy}set groupBy(value){const previous=this._groupBy;this._groupBy=typeof value=="string"?value:Array.isArray(value)?frozenArray(value.filter(item=>typeof item=="string")):null,this.requestUpdate("groupBy",previous)}get pageCount(){const size=this.safePageSize;if(size===0)return 0;if(!this.usesServerData&&normalizedGroupBy(this.groupBy).length>0){const groups=this.topLevelGroupBuckets(this.processedClientRows).length;return groups<=0?0:Math.ceil(groups/size)}const count=this.safeTotal>=0?this.safeTotal:this.filteredCount;return count<=0?0:Math.ceil(count/size)}get pageSizeOptions(){return this._pageSizeOptions}set pageSizeOptions(value){const previous=this._pageSizeOptions;this._pageSizeOptions=frozenArray(Array.isArray(value)?value:[]),this.requestUpdate("pageSizeOptions",previous)}get selectedRowKeys(){return this._selectedRowKeys}set selectedRowKeys(value){const previous=this._selectedRowKeys;this._selectedRowKeys=snapshotKeys(value),this.requestUpdate("selectedRowKeys",previous),this.requestUpdate("selectedKeys",previous)}get selectedKeys(){return this.selectedRowKeys}set selectedKeys(value){this.selectedRowKeys=value}get selectedRows(){return frozenArray(this.allSourceRows.filter((row,index)=>arrayHasKey(this.selectedKeys,this.keyForRow(row,index))))}set selectedRows(next){const source=this.allSourceRows,sourceSet=new Set(source),sourceIndexes=this.sourceIndexMap(source),candidates=Array.isArray(next)?next:[],seen=new Set,rows=candidates.filter(row=>!sourceSet.has(row)||seen.has(row)?!1:(seen.add(row),!0)),limited=this.selectionMode==="single"?rows.slice(0,1):rows;this.selectedKeys=limited.map(row=>this.keyForRow(row,this.sourceIndexFor(row,sourceIndexes)??0))}get sort(){return this._sort}set sort(value){const previous=this._sort,next=[];if(Array.isArray(value))for(const item of value)try{if(!item||typeof item.id!="string")continue;next.push(Object.freeze({id:item.id,desc:!!item.desc}))}catch{}this._sort=Object.freeze(next),this.requestUpdate("sort",previous)}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.hasUpdated&&(this.syncMeasuredBodyWidth(),this.syncBodyScrollState(),this.syncRowMeasurementObserver(),this.correctMeasurementAnchor(),this.measureRenderedItems()),this.dataSource&&this.scheduleServerRequest(!1)}disconnectedCallback(){this.managedOverlay?.deactivate({restoreFocus:!1}),this.managedOverlay=void 0,this.managedOverlayOwner=null,this.requestGeneration+=1,this.requestController?.abort(),this.requestController=void 0,this.ownsLoadingState&&(this.loading=!1),this.ownsLoadingState=!1,this.cancelRequestTimer(),this.resizeSession?.moved&&this.restoreResizeSession(this.resizeSession,!1),this.resizeSession=void 0,this.activeResizeColumn=void 0,this.activeFilterColumn=null,this.activeColumnMenu=null,this.columnsMenuOpen=!1,this.dragGhost="",this.columnDragSession=void 0,this.pendingVirtualScroll=void 0,this.expectedBodyScroll=void 0,this.resetRowMeasurementObserver(),this.sink?.release(),this.sink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.expectedBodyScroll=void 0,this.resetRowMeasurementObserver(),this.isConnected&&this.hasUpdated&&(this.syncMeasuredBodyWidth(),this.syncBodyScrollState(),this.syncRowMeasurementObserver(),this.correctMeasurementAnchor(),this.measureRenderedItems())}willUpdate(changed){super.willUpdate(changed),this.hasUpdated&&changed.has("loading")&&this.loading&&this.announce(this.localize("loading"));const sourceReplaced=changed.has("dataSource")&&changed.get("dataSource")!==void 0,serverDisabled=changed.has("server")&&!this.usesServerData;if((sourceReplaced||serverDisabled)&&(this.requestController||this.requestTimer!==void 0)&&(this.requestGeneration+=1,this.requestController?.abort(),this.requestController=void 0,this.cancelRequestTimer(),this.ownsLoadingState&&(this.loading=!1),this.ownsLoadingState=!1),this.resizeSession&&(changed.has("resizable")||changed.has("columns"))&&!this.columnCanResize(this.resizeSession.columnId)){const session=this.resizeSession;this.resizeSession=void 0,this.activeResizeColumn=void 0,session.moved&&this.restoreResizeSession(session,!0)}if(this.columnDragSession&&(changed.has("reorderable")||changed.has("columns"))&&!this.columnCanMove(this.columnDragSession.sourceId)&&(this.columnDragSession=void 0,this.dragGhost=""),changed.has("columns")&&this.handleColumnsChange(),this.reconcileRowMeasurementCache(changed),!this.usesServerData&&(changed.has("data")||changed.has("rowKey")||changed.has("childRows")||changed.has("server")||changed.has("dataSource"))){const validKeys=this.allSourceRows.map((row,index)=>this.keyForRow(row,index)),validKeySet=new Set(validKeys),selectedKeys=this.selectedKeys.filter(key=>validKeySet.has(key));(selectedKeys.length!==this.selectedKeys.length||selectedKeys.some((key,index)=>!keysEqual(key,this.selectedKeys[index])))&&(this.selectedKeys=selectedKeys),this.lastSelectedIndex=-1}if(this.paginate&&(changed.has("data")||changed.has("filters")||changed.has("searchTerm")||changed.has("groupBy")||changed.has("pageSize")||changed.has("total")||changed.has("server")||changed.has("dataSource"))){const lastPage=Math.max(0,this.pageCount-1);this.page=finiteInteger(this.page,0,0,lastPage)}(changed.has("data")||changed.has("columns")||changed.has("filters")||changed.has("searchTerm")||changed.has("sort")||changed.has("expandedKeys")||changed.has("groupBy")||changed.has("page")||changed.has("pageSize")||changed.has("paginate")||changed.has("childRows"))&&(this.focusedRow=finiteInteger(this.focusedRow,-1,-1,Math.max(-1,this.displayItems.length-1)),this.focusedColumn=finiteInteger(this.focusedColumn,0,0,Math.max(0,this.visibleColumns.length-1)))}updated(changed){if(super.updated(changed),changed.has("dataSource")&&this.dataSource&&this.scheduleServerRequest(!1),(changed.has("sort")||changed.has("filters")||changed.has("searchTerm")||changed.has("page")||changed.has("pageSize")||changed.has("server"))&&(this.server||this.dataSource)){const delayed=changed.has("filters")||changed.has("searchTerm");this.scheduleServerRequest(delayed)}this.syncManagedOverlay(),this.syncMeasuredBodyWidth(),this.queueBodyScrollStateSync(),this.syncRowMeasurementObserver(),this.correctMeasurementAnchor(),this.measureRenderedItems(),this.alignPendingVirtualScroll(),this.isMounting=!1}get currentManagedOverlayOwner(){return this.columnsMenuOpen?"columns":this.activeFilterColumn!==null?`filter:${this.activeFilterColumn}`:this.activeColumnMenu!==null?`column:${this.activeColumnMenu}`:null}managedOverlayElements(owner){if(owner==="columns"){const container=this.renderRoot.querySelector('[part="columns-menu"]');return{panel:container?.querySelector('[role="group"]')??null,trigger:container?.querySelector("button")??null}}const separator=owner.indexOf(":"),kind=owner.slice(0,separator),columnIdValue=owner.slice(separator+1),header=[...this.renderRoot.querySelectorAll('[part~="header-cell"][data-column-id]')].find(candidate=>candidate.getAttribute("data-column-id")===columnIdValue);return header?kind==="filter"?{panel:header.querySelector('[part="filter-panel"]'),trigger:header.querySelector('[part="filter-button"]')}:{panel:header.querySelector('[part="column-menu"] [role="group"]'),trigger:header.querySelector('[part="column-menu-button"]')}:{panel:null,trigger:null}}dismissManagedOverlay(owner){owner==="columns"&&this.columnsMenuOpen?this.columnsMenuOpen=!1:owner.startsWith("filter:")&&this.activeFilterColumn===owner.slice(7)?this.activeFilterColumn=null:owner.startsWith("column:")&&this.activeColumnMenu===owner.slice(7)&&(this.activeColumnMenu=null)}syncManagedOverlay(){const owner=this.currentManagedOverlayOwner;if(owner!==null&&owner===this.managedOverlayOwner&&this.managedOverlay?.isActive()&&this.managedOverlayElements(owner).panel||(this.managedOverlay?.deactivate({restoreFocus:owner===null}),this.managedOverlay=void 0,this.managedOverlayOwner=null,owner===null||!this.isConnected))return;const{panel}=this.managedOverlayElements(owner);panel&&(this.managedOverlayOwner=owner,this.managedOverlay=activateNonmodalOverlay({host:this,panel:()=>this.managedOverlayElements(owner).panel,onEscape:()=>this.dismissManagedOverlay(owner),restoreFocusTo:()=>this.managedOverlayElements(owner).trigger}))}toggleColumnsPanel(){const next=!this.columnsMenuOpen;this.columnsMenuOpen=next,next&&(this.activeFilterColumn=null,this.activeColumnMenu=null)}toggleFilterPanel(id){const next=this.activeFilterColumn===id?null:id;this.activeFilterColumn=next,next!==null&&(this.columnsMenuOpen=!1,this.activeColumnMenu=null)}toggleColumnPanel(id){const next=this.activeColumnMenu===id?null:id;this.activeColumnMenu=next,next!==null&&(this.columnsMenuOpen=!1,this.activeFilterColumn=null)}announce(text){this.sink?.announce(text),this.liveText=text}get usesServerData(){return this.server||this.dataSource!==null}get safePage(){return finiteInteger(this.page,0,0,Math.max(0,this.pageCount-1))}get safePageSize(){return finiteCount(this.pageSize)}get safeTotal(){return this.total===-1?-1:finiteCount(this.total)}sourceProjection(){const result=[],visited=new Set,seenRowKeys=new Set,stack=[];for(let index=this.data.length-1;index>=0;index-=1)stack.push({row:this.data[index],depth:0});let truncated=!1;for(;stack.length>0&&result.length<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(!trackIdentity||trackIdentity&&visited.has(current.row))continue;trackIdentity&&visited.add(current.row);const rowKey=this.rowIdentity(current.row);if(rowKey===void 0||seenRowKeys.has(rowKey))continue;seenRowKeys.add(rowKey),result.push(current.row);const children=this.childrenFor(current.row);if(children.length!==0){if(current.depth>=DATA_GRID_TREE_DEPTH_LIMIT){truncated=!0;continue}for(let index=children.length-1;index>=0;index-=1)stack.push({row:children[index],depth:current.depth+1})}}return stack.length>0&&(truncated=!0),{rows:Object.freeze(result),truncated}}get allSourceRows(){return this.sourceProjection().rows}get canonicalRootRows(){const canonical=new Set(this.allSourceRows);return this.data.filter(row=>canonical.has(row))}sourceIndexMap(rows=this.allSourceRows){const indexes=new Map;return rows.forEach((row,index)=>{indexes.has(row)||indexes.set(row,index)}),indexes}sourceIndexFor(row,indexes){const direct=indexes.get(row);if(direct!==void 0)return direct;const identity=this.rowIdentity(row);if(identity!==void 0){for(const[candidate,index]of indexes)if(Object.is(this.rowIdentity(candidate),identity))return index}}canonicalMembers(rows){const byIdentity=new Map;for(const row of this.allSourceRows){const identity=this.rowIdentity(row);identity!==void 0&&!byIdentity.has(identity)&&byIdentity.set(identity,row)}const output=[],seen=new Set;for(const candidate of rows){const identity=this.rowIdentity(candidate);if(identity===void 0||seen.has(identity))continue;const canonical=byIdentity.get(identity);canonical&&(seen.add(identity),output.push(canonical))}return output}get orderedColumns(){const entries=this.columns.map((column,naturalIndex)=>({column,id:columnId(column,naturalIndex),naturalIndex}));if(this.columnOrder.length===0)return entries;const rank=new Map(this.columnOrder.map((id,index)=>[id,index]));return entries.sort((left,right)=>{const leftRank=rank.get(left.id),rightRank=rank.get(right.id);return leftRank===void 0&&rightRank===void 0?left.naturalIndex-right.naturalIndex:leftRank===void 0?1:rightRank===void 0?-1:leftRank-rightRank})}get visibleColumns(){return this.orderedColumns.filter(({column,id})=>this.columnVisibility.get(id)??column.hidden!==!0).sort((left,right)=>{const leftPin=normalizePinSide(this.getColumnPin(left.id)),rightPin=normalizePinSide(this.getColumnPin(right.id));return leftPin===rightPin?0:leftPin==="left"||rightPin==="right"?-1:1})}get processedClientRows(){const rows=this.canonicalRootRows;if(this.usesServerData)return[...rows];if(this.childRows){const included=rows.filter(row=>this.rowMatches(row)||this.filterFromLeafRows&&this.hasMatchingDescendant(row));return sortRows(included,this.columns,this.sort,this.effectiveLocale)}const filtered=filterRows(rows,this.columns,this.filters,this.effectiveLocale),searched=searchRows(filtered,this.columns,this.searchTerm,this.effectiveLocale,this.searchFn);return sortRows(searched,this.columns,this.sort,this.effectiveLocale)}childrenFor(row){try{const children=typeof this.childRows=="function"?this.childRows(row):this.childRows?pathValue(row,this.childRows):void 0;return Array.isArray(children)?children.slice(0,DATA_GRID_TREE_NODE_LIMIT):[]}catch{return[]}}rowIdentity(row){if(!((typeof row!="object"||row===null)&&typeof row!="function"))try{if(this.rowKey){const candidate=pathValue(row,this.rowKey);return isKey(candidate)?candidate:void 0}const object=row,current=this.rowOccurrenceIds.get(object);if(current)return current;const identity=`row-occurrence-${this.nextRowOccurrenceId}`;return this.nextRowOccurrenceId+=1,this.rowOccurrenceIds.set(object,identity),identity}catch{return}}keyForRow(row,_index){return this.rowIdentity(row)}renderedColumnElements(columnId2,role){const prefix=role?`[role="${role}"]`:"",ownerCss=this.ownerDocument.defaultView?.CSS,escape=ownerCss?.escape;if(typeof escape=="function")try{const matches=[...this.renderRoot.querySelectorAll(`${prefix}[data-column-id="${escape.call(ownerCss,columnId2)}"]`)];if(matches.length>0)return matches}catch{}return[...this.renderRoot.querySelectorAll(`${prefix}[data-column-id]`)].filter(element=>element.getAttribute("data-column-id")===columnId2)}computedToken(name,privateDefault){if(!this.isConnected)return"";const owner=this.ownerDocument.defaultView;if(!owner||typeof owner.getComputedStyle!="function")return"";try{const style=owner.getComputedStyle(this);return style.getPropertyValue(name).trim()||(privateDefault?style.getPropertyValue(privateDefault).trim():"")}catch{return""}}autoSizeColumn(columnId2){const cells=this.renderedColumnElements(columnId2);if(cells.length===0)return;let width=0;for(const cell of cells)width=Math.max(width,cell.scrollWidth);const entry=this.orderedColumns.find(({id})=>id===columnId2);if(!entry)return;const{minimum,maximum}=this.columnBounds(entry.column);this.setColumnWidth(columnId2,finiteRange(width,minimum,minimum,maximum),!1)}autoSizeColumns(){for(const{id}of this.visibleColumns)this.autoSizeColumn(id)}collapseAllRows(){this.expandedKeys=[]}collapseRow(key){this.expandedKeys=this.expandedKeys.filter(candidate=>!keysEqual(candidate,key))}copySelectedRows(options={}){const rowsToCopy=this.selectedRows.length>0?this.selectedRows:this.getProcessedRows(),format=options.format??"tsv",text=this.delimitedRows(rowsToCopy,{...options,delimiter:options.delimiter??(format==="csv"?",":" ")});return this.copyAndReport(text),rowsToCopy.length}expandAllRows(){const keys=[];this.allSourceRows.forEach((row,index)=>{(this.childrenFor(row).length>0||this.rowDetail)&&keys.push(this.keyForRow(row,index))});for(const group of this.groupItems(this.processedClientRows))keys.push(group.key);this.expandedKeys=keys}expandRow(key){arrayHasKey(this.expandedKeys,key)||(this.expandedKeys=[...this.expandedKeys,key])}exportDataAsCsv(options={}){const text=this.getDataAsCsv(options),ownerDocument=this.ownerDocument,owner=ownerDocument.defaultView;if(!owner||typeof owner.URL.createObjectURL!="function")return;const url=owner.URL.createObjectURL(new owner.Blob([text],{type:"text/csv;charset=utf-8"}));try{const anchor=ownerDocument.createElement("a");anchor.href=url,anchor.download=options.fileName||"data.csv",anchor.hidden=!0,ownerDocument.body?.append(anchor),anchor.click(),anchor.remove()}finally{owner.URL.revokeObjectURL(url)}}focus(options={}){const selector=this.focusedRow<0?`[role="columnheader"][data-column-position="${this.focusedColumn}"]`:`[role="gridcell"][data-row-position="${this.focusedRow}"][data-column-position="${this.focusedColumn}"]`;this.renderRoot.querySelector(selector)?.focus(options)}getColumnFacets(columnId2){const uniqueValues=new Map;if(this.usesServerData)return Object.freeze({uniqueValues});const entry=this.orderedColumns.find(({id})=>id===columnId2);if(!entry)return Object.freeze({uniqueValues});const otherFilters=this.filters.filter(filter=>filter.id!==columnId2),rows=searchRows(filterRows(this.canonicalRootRows,this.columns,otherFilters,this.effectiveLocale),this.columns,this.searchTerm,this.effectiveLocale,this.searchFn);let minimum=Number.POSITIVE_INFINITY,maximum=Number.NEGATIVE_INFINITY;for(const row of rows){const value=columnValue(entry.column,row);uniqueValues.set(value,(uniqueValues.get(value)??0)+1);const number=typeof value=="number"?value:Number(value);Number.isFinite(number)&&(minimum=Math.min(minimum,number),maximum=Math.max(maximum,number))}return Number.isFinite(minimum)&&Number.isFinite(maximum)?Object.freeze({uniqueValues,minMax:Object.freeze([minimum,maximum])}):Object.freeze({uniqueValues})}getColumnPin(columnId2){return this.columnPinning.has(columnId2)?this.columnPinning.get(columnId2)??!1:this.orderedColumns.find(({id})=>id===columnId2)?.column.pinned??!1}getDataAsCsv(options={}){return this.delimitedRows(this.getProcessedRows(),options)}getProcessedRows(){return frozenArray(this.processedClientRows)}getVisibleRows(){const rows=this.processedClientRows;if(!this.paginate||this.usesServerData)return frozenArray(rows);const size=this.safePageSize;if(size===0)return[];const start=this.safePage*size;return normalizedGroupBy(this.groupBy).length>0?frozenArray(this.topLevelGroupBuckets(rows).slice(start,start+size).flatMap(bucket=>bucket.rows)):frozenArray(rows.slice(start,start+size))}getState(){return Object.freeze({order:frozenArray(this.columnOrder),widths:Object.freeze(Object.fromEntries(this.columnWidths)),visibility:Object.freeze(Object.fromEntries(this.columnVisibility)),pinning:Object.freeze(Object.fromEntries(this.columnPinning)),sort:frozenArray(this.sort.map(item=>Object.freeze({...item}))),filters:frozenArray(this.filters.map(item=>Object.freeze({id:item.id,value:serializableFilterValue(item.value)}))),search:this.searchTerm,selectedRowKeys:frozenArray(this.selectedRowKeys),expandedRowKeys:frozenArray(this.expandedRowKeys),selectedKeys:frozenArray(this.selectedRowKeys),expandedKeys:frozenArray(this.expandedRowKeys),page:this.safePage,pageSize:this.safePageSize})}handleColumnsChange(){const valid=new Set(this.columns.map((column,index)=>columnId(column,index))),natural=[...valid],order=this.columnOrder.filter(id=>valid.has(id));for(const id of natural)order.includes(id)||order.push(id);this.columnOrder.length>0&&order.join("\0")!==this.columnOrder.join("\0")&&(this.columnOrder=order);const widths=[...this.columnWidths].filter(([id])=>valid.has(id)),visibility=[...this.columnVisibility].filter(([id])=>valid.has(id)),pinning=[...this.columnPinning].filter(([id])=>valid.has(id));widths.length!==this.columnWidths.size&&(this.columnWidths=new Map(widths)),visibility.length!==this.columnVisibility.size&&(this.columnVisibility=new Map(visibility)),pinning.length!==this.columnPinning.size&&(this.columnPinning=new Map(pinning))}handlePageChange(){this.applyPageChange(this.safePage)}applyPageChange(value){let requested;typeof value=="number"?requested=value:requested=Number(valueControl(value?.currentTarget)?.value??this.safePage);const last=Math.max(0,this.pageCount-1),next=finiteInteger(requested,this.safePage,0,last);this.page=next,this.emit("lr-page-change",Object.freeze({page:next,pageSize:this.safePageSize}))}handleSearchTermChange(){this.applySearchTermChange(this.searchTerm)}applySearchTermChange(value){const next=typeof value=="string"?value:valueControl(value?.currentTarget)?.value??this.searchTerm;this.searchTerm=next,this.page!==0&&(this.page=0)}pinColumn(columnId2,side){if(!this.orderedColumns.some(({id})=>id===columnId2))return;const next=new Map(this.columnPinning);next.set(columnId2,side),this.columnPinning=next}async reload(){const owner=this.ownerDocument.defaultView;!this.isConnected||!owner||!this.usesServerData||(this.cancelRequestTimer(),await this.loadServerData(owner))}resetColumns(){this.columnOrder=[],this.columnWidths=new Map,this.columnVisibility=new Map,this.columnPinning=new Map}resetState(){this.resetColumns(),this.sort=[],this.filters=[],this.searchTerm="",this.expandedKeys=[]}scrollToIndex(index,options={}){this.pendingVirtualScroll=void 0,this.pendingMeasurementAnchor=void 0;const rows=this.getVisibleRows();if(rows.length===0)return;const requestedIndex=finiteInteger(index,0,0,rows.length-1),requestedRow=rows[requestedIndex],sourceIndexes=this.sourceIndexMap(),sourceIndex=this.sourceIndexFor(requestedRow,sourceIndexes),requestedKey=this.keyForRow(requestedRow,sourceIndex??requestedIndex),items=this.displayItems,target=items.findIndex(item=>item.kind==="row"&&(item.row===requestedRow||keysEqual(item.key,requestedKey)));if(target<0)return;const body=this.bodyElement;if(!body)return;this.recordMeasurementRowHeight()&&this.invalidateRowMeasurements()&&this.queueMeasurementUpdate();const rendered=this.renderRoot?.querySelector(`[part~="row"][data-visible-index="${target}"]`),rowHeight=this.displayItemHeight(target,items),rowTop=this.displayItemOffset(target,items),currentTop=finiteRange(body.scrollTop,this.bodyScrollTop,0),viewportHeight=finiteRange(body.clientHeight,0,0),alignment=options.align??(rendered?"nearest":"start");let top=rowTop;if(alignment==="center")top-=(viewportHeight-rowHeight)/2;else if(alignment==="end")top-=viewportHeight-rowHeight;else if(alignment==="nearest"){const rowBottom=rowTop+rowHeight;rowTop>=currentTop&&rowBottom<=currentTop+viewportHeight?top=currentTop:rowTop<currentTop?top=rowTop:top=rowBottom-viewportHeight}const maximumTop=Math.max(0,this.displayItemOffset(items.length,items)-viewportHeight);if(top=finiteRange(top,0,0,maximumTop),this.lastMeasurementAnchor=this.measurementAnchorAtOffset(top,items),rendered){rendered.scrollIntoView({block:options.align??"nearest"});return}const targetItem=items[target];targetItem&&(this.pendingVirtualScroll=Object.freeze({itemKey:displayItemKey(targetItem),align:alignment})),this.expectedBodyScroll=Object.freeze({body,top}),this.bodyScrollTop=top,body.scrollTo({top})}setState(state2){const known=new Set(this.columns.map((column,index)=>columnId(column,index)));state2.order&&(this.columnOrder=state2.order.filter(id=>known.has(id))),state2.widths&&(this.columnWidths=this.validColumnMap(state2.widths,known,width=>finiteRange(width,0,0))),state2.visibility&&(this.columnVisibility=this.validColumnMap(state2.visibility,known,Boolean)),state2.pinning&&(this.columnPinning=this.validColumnMap(state2.pinning,known,side=>side==="left"||side==="right"||side==="start"||side==="end"?side:!1)),state2.sort&&(this.sort=state2.sort.filter(item=>known.has(item.id)).map(item=>({id:item.id,desc:!!item.desc}))),state2.filters&&(this.filters=state2.filters.filter(item=>known.has(item.id)).map(item=>({...item}))),state2.search!==void 0&&(this.searchTerm=state2.search);const selectedRowKeys=state2.selectedRowKeys??state2.selectedKeys,expandedRowKeys=state2.expandedRowKeys??state2.expandedKeys;selectedRowKeys&&(this.selectedRowKeys=selectedRowKeys),expandedRowKeys&&(this.expandedRowKeys=expandedRowKeys),state2.page!==void 0&&(this.page=finiteCount(state2.page)),state2.pageSize!==void 0&&(this.pageSize=finiteCount(state2.pageSize))}sizeColumnsToFit(){const body=this.bodyElement;if(!body||this.visibleColumns.length===0)return;const selectionWidth=this.selectionEnabled?resolveCssLength(this.computedToken("--lr-icon-button-size"),{host:this})??0:0,available=Math.max(0,body.clientWidth-selectionWidth),flexible=this.visibleColumns.filter(({column})=>column.flex!==0);if(flexible.length===0)return;const flexValues=flexible.map(({column})=>finiteRange(column.flex??1,1,0)),flexScale=flexValues.reduce((largest,value)=>Math.max(largest,value),0),scaledFlex=flexValues.map(value=>flexScale>0?value/flexScale:value),totalFlex=scaledFlex.reduce((sum,value)=>sum+value,0)||flexible.length,next=new Map(this.columnWidths);for(const[index,{column,id}]of flexible.entries()){const share=available*((scaledFlex[index]??0)/totalFlex),{minimum,maximum}=this.columnBounds(column);next.set(id,finiteRange(share,minimum,minimum,maximum))}this.columnWidths=next}toggleColumn(columnId2,visible){if(!this.orderedColumns.some(({id})=>id===columnId2))return;const next=new Map(this.columnVisibility);next.set(columnId2,visible),this.columnVisibility=next,this.focusedColumn=finiteInteger(this.focusedColumn,0,0,Math.max(0,this.visibleColumns.length-1))}validColumnMap(record,known,convert){const result=new Map;for(const[id,value]of Object.entries(record))known.has(id)&&result.set(id,convert(value));return result}delimitedRows(rows,options){const active=this.visibleColumns.map(({column,id})=>({...column,id,value:row=>{const raw=columnValue(column,row),formatted=column.formatter?.(raw,row);return typeof formatted=="string"?formatted:raw},hidden:!1}));return rowsAsDelimited(rows,active,options)}async copyAndReport(text){const owner=this.isConnected?this.ownerDocument.defaultView:null,outcome=await this.writeClipboard(text,owner);if(!(!owner||!this.isConnected||this.ownerDocument.defaultView!==owner)){if(outcome.ok){this.isMounting||this.announce(this.localize("copied")),this.emit("lr-copy",outcome);return}this.isMounting||this.announce(this.localize("copyFailed")),this.emit("lr-error"),this.emit("lr-copy-error",outcome)}}async writeClipboard(text,owner){const ownerDocument=this.ownerDocument,outcome=await writeClipboardText(owner,text);if(outcome.ok||!owner||ownerDocument.defaultView!==owner||!ownerDocument.body)return outcome;const textarea=ownerDocument.createElement("textarea");textarea.value=text,textarea.style.position="fixed",textarea.style.opacity="0",ownerDocument.body.append(textarea);try{if(textarea.select(),ownerDocument.execCommand?.("copy"))return Object.freeze({ok:!0,text})}finally{textarea.remove()}return outcome}setColumnWidth(columnIdValue,width,emit,finished=!0){const entry=this.orderedColumns.find(({id})=>id===columnIdValue);if(!entry)return;const{minimum,maximum}=this.columnBounds(entry.column),safeWidth=finiteRange(width,minimum,minimum,maximum),next=new Map(this.columnWidths);next.set(columnIdValue,safeWidth),this.columnWidths=next,emit&&this.emit("lr-column-resize",Object.freeze({columnId:columnIdValue,width:safeWidth,finished}))}cancelRequestTimer(){const timer=this.requestTimer;this.requestTimer=void 0,timer&&timer.owner.clearTimeout(timer.handle)}scheduleServerRequest(delayed){const owner=this.ownerDocument.defaultView;if(!this.isConnected||!owner||!this.usesServerData)return;this.cancelRequestTimer();const delay=delayed?finiteDuration(this.filterDebounce,250):0;let handle=0;handle=owner.setTimeout(()=>{this.requestTimer?.owner!==owner||this.requestTimer.handle!==handle||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.requestTimer=void 0,this.loadServerData(owner))},delay),this.requestTimer={owner,handle}}async loadServerData(owner){if(!this.isConnected||this.ownerDocument.defaultView!==owner||!this.usesServerData)return;this.requestController?.abort();const AbortControllerCtor=owner.AbortController;this.requestController=typeof AbortControllerCtor=="function"?new AbortControllerCtor:void 0;const generation=++this.requestGeneration,request=Object.freeze({sort:frozenArray(this.sort.map(item=>Object.freeze({...item}))),filters:frozenArray(this.filters.map(item=>Object.freeze({id:item.id,value:serializableFilterValue(item.value)}))),search:this.searchTerm,page:this.safePage,pageSize:this.safePageSize,signal:this.requestController?.signal}),requestDetail=()=>Object.freeze({...request,sort:frozenArray(request.sort.map(item=>Object.freeze({...item}))),filters:frozenArray(request.filters.map(item=>Object.freeze({id:item.id,value:serializableFilterValue(item.value)})))});if(this.emit("request",requestDetail()),!!this.dataSource){this.ownsLoadingState=!0,this.loading=!0;try{const response=await this.dataSource(request);if(generation!==this.requestGeneration||request.signal?.aborted||!this.isConnected||this.ownerDocument.defaultView!==owner)return;this.data=Array.isArray(response.rows)?response.rows:[],this.total=finiteCount(response.total),this.loading=!1,this.ownsLoadingState=!1}catch(error){if(generation!==this.requestGeneration||request.signal?.aborted||!this.isConnected||this.ownerDocument.defaultView!==owner)return;this.loading=!1,this.ownsLoadingState=!1,this.emit("lr-data-error",Object.freeze({error,request:requestDetail()}))}}}get selectionMode(){return this.selectable===""||this.selectable==="multiple"?"multiple":this.selectable}get selectionEnabled(){return this.selectionMode!=="none"}get ariaColumnCount(){return Math.max(1,this.visibleColumns.length+(this.selectionEnabled?1:0))}rowIsSelectable(row){return this.selectionEnabled&&(this.selectableRows?.(row)??!0)}rowMatches(row){return filterRows([row],this.columns,this.filters,this.effectiveLocale).length>0&&searchRows([row],this.columns,this.searchTerm,this.effectiveLocale,this.searchFn).length>0}processedChildrenFor(row){const children=this.canonicalMembers(this.childrenFor(row));if(children.length===0||this.usesServerData)return children;const included=children.filter(child=>this.rowMatches(child)?!0:this.filterFromLeafRows&&this.hasMatchingDescendant(child));return sortRows(included,this.columns,this.sort,this.effectiveLocale)}hasMatchingDescendant(row){const stack=this.canonicalMembers(this.childrenFor(row)).map(child=>({row:child,depth:1})),visited=new Set;let inspected=0;for(;stack.length>0&&inspected<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(!(trackIdentity&&visited.has(current.row))){if(trackIdentity&&visited.add(current.row),inspected+=1,this.rowMatches(current.row))return!0;if(!(current.depth>=DATA_GRID_TREE_DEPTH_LIMIT))for(const child of this.canonicalMembers(this.childrenFor(current.row)))stack.push({row:child,depth:current.depth+1})}}return!1}get pageRows(){return this.getVisibleRows()}get currentPageSelectableRows(){const result=[],sourceIndex=new Map(this.allSourceRows.map((row,index)=>[row,index])),visited=new Set,stack=[...this.pageRows].reverse().map(row=>({row,depth:0}));let inspected=0;for(;stack.length>0&&inspected<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(trackIdentity&&visited.has(current.row))continue;trackIdentity&&visited.add(current.row),inspected+=1;const index=this.sourceIndexFor(current.row,sourceIndex);if(index===void 0)continue;const key=this.keyForRow(current.row,index);if(this.rowIsSelectable(current.row)&&result.push({row:current.row,key}),current.depth>=DATA_GRID_TREE_DEPTH_LIMIT)continue;const children=this.canonicalMembers(this.childrenFor(current.row));for(let childIndex=children.length-1;childIndex>=0;childIndex-=1){const child=children[childIndex];stack.push({row:child,depth:current.depth+1})}}return result}groupMemberKey(rows){let first;for(const row of rows){const identity=this.rowIdentity(row);if(identity===void 0)continue;const candidate=`${typeof identity}:${safeText(identity)}`;(first===void 0||candidate<first)&&(first=candidate)}return first??"unknown"}groupKey(parent,id,value,rows){const valueType=typeof value;return valueType==="object"&&value!==null||valueType==="function"?`group:${parent}:${id}:${valueType}:member:${this.groupMemberKey(rows)}`:`group:${parent}:${id}:${valueType}:${safeText(value)}`}topLevelGroupBuckets(rows){const field=normalizedGroupBy(this.groupBy)[0];if(!field)return[];const entry=this.orderedColumns.find(({id,column})=>id===field||column.field===field);if(!entry)return[];const buckets=new Map;for(const row of rows){const value=columnValue(entry.column,row),bucket=buckets.get(value)??[];bucket.push(row),buckets.set(value,bucket)}return[...buckets].map(([value,bucketRows])=>({value,rows:bucketRows}))}groupItems(rows){const fields=normalizedGroupBy(this.groupBy);if(fields.length===0||this.usesServerData)return[];const result=[],visit=(groupRows,depth,parent)=>{const field=fields[depth];if(!field)return;const entry=this.orderedColumns.find(({id,column})=>id===field||column.field===field);if(!entry)return;const buckets=new Map;for(const row of groupRows){const value=columnValue(entry.column,row),bucket=buckets.get(value)??[];bucket.push(row),buckets.set(value,bucket)}for(const[value,bucket]of buckets){const key=this.groupKey(parent,entry.id,value,bucket);result.push({kind:"group",key,value,columnId:entry.id,rows:bucket,depth}),depth+1<fields.length&&visit(bucket,depth+1,key)}};return visit(rows,0,"root"),result}get displayItems(){const groups=normalizedGroupBy(this.groupBy);if(groups.length>0&&!this.usesServerData)return this.groupedDisplayItems(this.pageRows,groups,0,"root",this.sourceIndexMap());const result=[],sourceRows=this.allSourceRows,indexes=this.sourceIndexMap(sourceRows),visited=new Set,stack=[...this.pageRows].reverse().map(row=>({row,depth:0}));for(;stack.length>0&&result.length<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(trackIdentity&&visited.has(current.row))continue;trackIdentity&&visited.add(current.row);const sourceIndex=this.sourceIndexFor(current.row,indexes);if(sourceIndex===void 0)continue;const safeIndex=sourceIndex,key=this.keyForRow(current.row,safeIndex);if(result.push({kind:"row",row:current.row,key,depth:current.depth,sourceIndex:safeIndex}),!arrayHasKey(this.expandedKeys,key)||current.depth>=DATA_GRID_TREE_DEPTH_LIMIT)continue;const children=this.processedChildrenFor(current.row);for(let index=children.length-1;index>=0;index-=1)stack.push({row:children[index],depth:current.depth+1})}return result}groupedDisplayItems(rows,fields,depth,parent,sourceIndexes){const field=fields[depth];if(!field)return[];const entry=this.orderedColumns.find(({id,column})=>id===field||column.field===field);if(!entry)return rows.map((row,index)=>({kind:"row",row,key:this.keyForRow(row,this.sourceIndexFor(row,sourceIndexes)??index),depth,sourceIndex:this.sourceIndexFor(row,sourceIndexes)??index}));const buckets=new Map;for(const row of rows){const value=columnValue(entry.column,row),bucket=buckets.get(value)??[];bucket.push(row),buckets.set(value,bucket)}const result=[];for(const[value,bucket]of buckets){const key=this.groupKey(parent,entry.id,value,bucket);if(result.push({kind:"group",key,value,columnId:entry.id,rows:bucket,depth}),!!arrayHasKey(this.expandedKeys,key))if(depth+1<fields.length)result.push(...this.groupedDisplayItems(bucket,fields,depth+1,key,sourceIndexes));else for(const row of bucket){const sourceIndex=this.sourceIndexFor(row,sourceIndexes);result.push({kind:"row",row,key:this.keyForRow(row,sourceIndex??result.length),depth:depth+1,sourceIndex:sourceIndex??result.length})}}return result}measurementSignature(items){return items.map(item=>{const key=displayItemKey(item);return`${key.length}:${key}`}).join("|")}invalidateRowMeasurements(){const anchor=this.lastMeasurementAnchor??this.captureMeasurementAnchor();return this.measuredItemHeights.size===0?(this.measuredItemOffsetsDirty=!0,!1):(anchor&&(this.pendingMeasurementAnchor=anchor),this.measuredItemHeights.clear(),this.measuredItemOffsetsDirty=!0,!0)}reconcileRowMeasurementCache(changed){const items=this.displayItems,signature=this.measurementSignature(items),locale=this.effectiveLocale,changedGeometry=["columns","columnOrder","columnVisibility","columnWidths","data","filters","searchTerm","sort","expandedKeys","groupBy","page","pageSize","paginate","childRows","rowDetail","rowClass","selectable","strings"].some(property2=>changed.has(property2)),localeChanged=this.measurementLocale!==""&&this.measurementLocale!==locale,structureChanged=this.measurementDisplaySignature!==""&&this.measurementDisplaySignature!==signature,rowHeightChanged=this.recordMeasurementRowHeight();(changedGeometry||localeChanged||structureChanged||rowHeightChanged)&&this.invalidateRowMeasurements(),this.measurementLocale=locale,this.measurementDisplaySignature=signature}recordMeasurementRowHeight(){const height=this.resolvedRowHeight,previous=this.measurementRowHeight,fontSignature=this.currentMeasurementFontSignature(),fontChanged=this.measurementFontSignature!==""&&this.measurementFontSignature!==fontSignature;return this.measurementRowHeight=height,this.measurementFontSignature=fontSignature,previous!==void 0&&previous!==height||fontChanged}currentMeasurementFontSignature(){if(!this.isConnected)return"";const owner=this.ownerDocument?.defaultView;if(!owner||typeof owner.getComputedStyle!="function")return"";try{const style=owner.getComputedStyle(this),cell=this.renderRoot?.querySelector('[part~="cell"], [part~="header-cell"], [part="group-value"]'),cellStyle=cell?owner.getComputedStyle(cell):void 0,cellPadding=cellStyle?[cellStyle.paddingBlockStart,cellStyle.paddingBlockEnd,cellStyle.paddingInlineStart,cellStyle.paddingInlineEnd].join(","):this.computedToken("--cell-padding","--_lr-data-grid-cell-padding");return[style.fontFamily,style.fontSize,style.fontStretch,style.fontStyle,style.fontWeight,style.letterSpacing,style.lineHeight,style.wordSpacing,cellPadding].join("\0")}catch{return""}}recordMeasuredBodyWidth(width){if(typeof width!="number"||!Number.isFinite(width)||width<0)return!1;const previous=this.measuredBodyWidth;return this.measuredBodyWidth=width,previous===void 0||previous===width?!1:(this.invalidateRowMeasurements(),!0)}syncMeasuredBodyWidth(){const body=this.bodyElement;body&&(this.syncBodyScrollbarInlineEndGutter(body),this.recordMeasuredBodyWidth(body.clientWidth)&&this.queueMeasurementUpdate())}syncBodyScrollbarInlineEndGutter(body){const scrollbarGutter=finiteRange(body.offsetWidth-body.clientWidth,0,0);if(this.bodyScrollbarInlineEndGutter===scrollbarGutter)return;this.bodyScrollbarInlineEndGutter=scrollbarGutter;const value=`${scrollbarGutter}px`;this.renderRoot.querySelectorAll('[part="header"], [part="footer-row"]').forEach(element=>element.style.setProperty("--data-grid-body-inline-end-gutter",value))}queueMeasurementUpdate(){if(this.measurementUpdateQueued)return;this.measurementUpdateQueued=!0;const owner=this.ownerDocument.defaultView;(owner?.queueMicrotask?.bind(owner)??queueMicrotask)(()=>{this.measurementUpdateQueued=!1,this.isConnected&&this.requestUpdate()})}queueMeasuredScrollTop(body){if(this.measurementScrollSyncQueued)return;this.measurementScrollSyncQueued=!0;const owner=body.ownerDocument.defaultView;(owner?.queueMicrotask?.bind(owner)??queueMicrotask)(()=>{if(this.measurementScrollSyncQueued=!1,!this.isConnected||this.bodyElement!==body)return;const next=finiteRange(body.scrollTop,this.bodyScrollTop,0);this.bodyScrollTop!==next&&(this.bodyScrollTop=next),this.lastMeasurementAnchor=this.captureMeasurementAnchor()})}queueBodyScrollStateSync(){if(this.bodyScrollStateSyncQueued)return;this.bodyScrollStateSyncQueued=!0;const owner=this.ownerDocument.defaultView;(owner?.queueMicrotask?.bind(owner)??queueMicrotask)(()=>{this.bodyScrollStateSyncQueued=!1,this.isConnected&&this.syncBodyScrollState()})}resetRowMeasurementObserver(){this.rowMeasurementObserver?.disconnect(),this.rowMeasurementObserver=void 0,this.rowMeasurementObserverOwner=void 0,this.rowMeasurementObserverBody=void 0,this.observedMeasurementElements.clear();const invalidated=this.invalidateRowMeasurements();this.lastMeasurementAnchor=void 0,invalidated&&this.isConnected&&this.queueMeasurementUpdate()}syncRowMeasurementObserver(){const body=this.bodyElement,owner=body?.ownerDocument.defaultView;if(!body||!owner||!this.isConnected||!owner.ResizeObserver){this.resetRowMeasurementObserver();return}if(this.rowMeasurementObserverOwner!==owner||this.rowMeasurementObserverBody!==body||!this.rowMeasurementObserver){this.resetRowMeasurementObserver();const observer2=new owner.ResizeObserver(entries=>{if(!(this.rowMeasurementObserver!==observer2||this.rowMeasurementObserverOwner!==owner||this.rowMeasurementObserverBody!==body||!this.isConnected||this.ownerDocument.defaultView!==owner)){this.syncBodyScrollState(body);for(const entry of entries){if(entry.target!==body)continue;this.syncBodyScrollbarInlineEndGutter(body);const width=entry.borderBoxSize?.[0]?.inlineSize??entry.contentRect.width;if(this.recordMeasuredBodyWidth(width)){this.queueMeasurementUpdate();return}}this.measureRenderedItems()}});this.rowMeasurementObserver=observer2,this.rowMeasurementObserverOwner=owner,this.rowMeasurementObserverBody=body,observer2.observe(body)}const observer=this.rowMeasurementObserver;if(!observer)return;const current=new Map;this.renderRoot.querySelectorAll("[data-virtual-item-key], [data-virtual-item-detail-for]").forEach(element=>{const key=element.dataset.virtualItemKey??element.dataset.virtualItemDetailFor;key&&current.set(element,key)});for(const element of this.observedMeasurementElements.keys())current.has(element)||(observer.unobserve(element),this.observedMeasurementElements.delete(element));for(const[element,key]of current)this.observedMeasurementElements.get(element)!==key&&(this.observedMeasurementElements.has(element)&&observer.unobserve(element),this.observedMeasurementElements.set(element,key),observer.observe(element))}displayItemOffsets(items){const signature=this.measurementSignature(items),estimate=this.resolvedRowHeight;if(!this.measuredItemOffsetsDirty&&this.measuredItemOffsetSignature===signature&&this.measuredItemOffsetEstimate===estimate)return this.measuredItemOffsets;const offsets=new Array(items.length+1);offsets[0]=0;for(let index=0;index<items.length;index+=1){const measured=this.measuredItemHeights.get(displayItemKey(items[index])),height=finiteRange(measured??estimate,estimate,1,Number.MAX_SAFE_INTEGER);offsets[index+1]=Math.min(Number.MAX_SAFE_INTEGER,offsets[index]+height)}return this.measuredItemOffsets=Object.freeze(offsets),this.measuredItemOffsetSignature=signature,this.measuredItemOffsetEstimate=estimate,this.measuredItemOffsetsDirty=!1,this.measuredItemOffsets}displayItemOffset(index,items){const offsets=this.displayItemOffsets(items),clamped=finiteInteger(index,0,0,items.length);return offsets[clamped]??0}displayItemHeight(index,items){const offsets=this.displayItemOffsets(items);return index<0||index>=items.length?0:Math.max(0,(offsets[index+1]??0)-(offsets[index]??0))}displayItemIndexAtOffset(offset,items){if(items.length===0)return-1;const target=finiteRange(offset,0,0,Number.MAX_SAFE_INTEGER),offsets=this.displayItemOffsets(items);let low=0,high=items.length-1;for(;low<high;){const middle=low+Math.floor((high-low)/2);(offsets[middle+1]??0)<=target?low=middle+1:high=middle}return low}captureMeasurementAnchor(){const body=this.bodyElement,items=this.displayItems;if(!body||items.length===0)return;const scrollTop=finiteRange(body.scrollTop,this.bodyScrollTop,0);return this.measurementAnchorAtOffset(scrollTop,items)}measurementAnchorAtOffset(scrollTop,items){if(items.length===0)return;const index=this.displayItemIndexAtOffset(scrollTop,items),item=items[index];if(!item)return;const offset=Math.max(0,scrollTop-this.displayItemOffset(index,items)),height=this.displayItemHeight(index,items);if(index+1<items.length&&height>1&&offset>=height-1){const next=items[index+1];return Object.freeze({itemKey:displayItemKey(next),offset:0})}return Object.freeze({itemKey:displayItemKey(item),offset})}correctMeasurementAnchor(){const anchor=this.pendingMeasurementAnchor,body=this.bodyElement;if(!anchor||!body)return;const items=this.displayItems,index=items.findIndex(item=>displayItemKey(item)===anchor.itemKey);if(this.pendingMeasurementAnchor=void 0,index<0){this.lastMeasurementAnchor=void 0;return}const next=Math.max(0,this.displayItemOffset(index,items)+anchor.offset);this.expectedBodyScroll=Object.freeze({body,top:next}),body.scrollTop=next,this.lastMeasurementAnchor=anchor,this.queueMeasuredScrollTop(body)}measureRenderedItems(){const rowHeightChanged=this.recordMeasurementRowHeight();rowHeightChanged&&this.invalidateRowMeasurements();const grouped=new Map;if(this.renderRoot.querySelectorAll("[data-virtual-item-key], [data-virtual-item-detail-for]").forEach(element=>{const key=element.dataset.virtualItemKey??element.dataset.virtualItemDetailFor;if(!key)return;const entries=grouped.get(key)??[];entries.push(element),grouped.set(key,entries)}),grouped.size===0){rowHeightChanged&&this.queueMeasurementUpdate();return}const anchor=this.captureMeasurementAnchor();let changed=!1;for(const[key,elements]of grouped){let height=0,measurable=!0;for(const element of elements){let next;try{next=element.getBoundingClientRect().height}catch{measurable=!1;break}if(!Number.isFinite(next)||next<=0){measurable=!1;break}height+=next}if(!measurable||!Number.isFinite(height)||height<=0)continue;const previous=this.measuredItemHeights.get(key),estimate=this.resolvedRowHeight;if(Math.abs(estimate-height)<=1){previous!==void 0&&(this.measuredItemHeights.delete(key),changed=!0);continue}previous!==void 0&&Math.abs(previous-height)<=1||(this.measuredItemHeights.set(key,height),changed=!0)}if(!changed){rowHeightChanged&&this.queueMeasurementUpdate();return}this.measuredItemOffsetsDirty=!0,anchor&&this.pendingMeasurementAnchor===void 0&&(this.pendingMeasurementAnchor=anchor),this.queueMeasurementUpdate()}alignPendingVirtualScroll(){const pending=this.pendingVirtualScroll;if(!pending||this.measurementUpdateQueued||this.pendingMeasurementAnchor!==void 0)return;if(!this.displayItems.some(item=>displayItemKey(item)===pending.itemKey)){this.pendingVirtualScroll=void 0;return}const target=[...this.renderRoot.querySelectorAll('[part~="row"][data-virtual-item-key]')].find(element=>element.dataset.virtualItemKey===pending.itemKey);target&&(this.pendingVirtualScroll=void 0,target.scrollIntoView({block:pending.align}),this.queueBodyScrollStateSync())}get resolvedRowHeight(){const raw=this.computedToken("--row-height","--_lr-data-grid-row-height");return finiteRange(resolveCssLength(raw,{host:this})??56,56,1)}get virtualWindow(){const items=this.displayItems,expandedDetails=!!(this.rowDetail&&items.some(item=>item.kind==="row"&&arrayHasKey(this.expandedKeys,item.key)));if(items.length<VIRTUALIZATION_THRESHOLD||expandedDetails||this.computedToken("--max-height","--_lr-data-grid-max-height")==="none")return{items,allItems:items,start:0,end:items.length};const height=this.resolvedRowHeight,viewport=Math.max(height,this.viewportHeight||height*10),firstVisible=this.displayItemIndexAtOffset(this.bodyScrollTop,items),lastVisible=this.displayItemIndexAtOffset(this.bodyScrollTop+viewport,items),start=Math.max(0,firstVisible-VIRTUAL_OVERSCAN),end=Math.min(items.length,lastVisible+VIRTUAL_OVERSCAN+1);return{items:items.slice(start,end),allItems:items,start,end}}get gridTemplate(){const columns=this.visibleColumns.map(({column,id})=>{const bounds=this.columnBounds(column),width=this.columnWidths.get(id)??column.width;if(width!==void 0&&Number.isFinite(width)&&width>0)return`${finiteRange(width,bounds.minimum,bounds.minimum,bounds.maximum)}px`;const minimum=bounds.minimum>0?`${bounds.minimum}px`:Number.isFinite(column.maxWidth)&&(column.maxWidth??0)>0?"0px":"var(--lr-size-7rem)",maximum=Number.isFinite(column.maxWidth)&&(column.maxWidth??0)>0?`${bounds.maximum}px`:`${finiteRange(column.flex??1,1,0)}fr`;return`minmax(${minimum}, ${maximum})`});return this.selectionEnabled&&columns.unshift("var(--lr-icon-button-size)"),columns.length>0?columns.join(" "):"minmax(var(--lr-size-7rem), 1fr)"}get bodyScrollTranslation(){const logical=finiteRange(this.bodyScrollInlineOffset,0,0,Number.MAX_SAFE_INTEGER);return`${this.effectiveDirection==="rtl"?logical:-logical}px`}columnStyle(column,id){const side=normalizePinSide(this.getColumnPin(id)),pinOffset=side?this.pinOffset(id,side):0;return{...side?{"--pin-offset":`${pinOffset}px`}:{},...Number.isFinite(column.width)&&(column.width??0)>0&&!this.columnWidths.has(id)?{"--column-authored-width":`${column.width}px`}:{}}}estimatedColumnWidth(column,id){const{minimum,maximum}=this.columnBounds(column),explicit=this.columnWidths.get(id)??column.width;if(explicit!==void 0)return finiteRange(explicit,Math.max(112,minimum),minimum,maximum);const raw=this.computedToken("--lr-size-7rem");return finiteRange(resolveCssLength(raw,{host:this})??112,Math.max(112,minimum),minimum,maximum)}columnBounds(column){const minimum=finiteRange(column.minWidth??0,0,0),authoredMaximum=finiteRange(column.maxWidth??Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0);return Object.freeze({minimum,maximum:Math.max(minimum,authoredMaximum)})}pinOffset(id,side){const entries=this.visibleColumns,index=entries.findIndex(entry=>entry.id===id);return index<0?0:(side==="left"?entries.slice(0,index):entries.slice(index+1)).filter(entry=>normalizePinSide(this.getColumnPin(entry.id))===side).reduce((sum,entry)=>sum+this.estimatedColumnWidth(entry.column,entry.id),0)}columnLabel(column,id){return column.label??humanizeIdentifier(column.field??id,this.effectiveLocale)}columnIsSortable(column){return column.sortable!==!1&&!!(column.field||column.value)}sortFor(id){const index=this.sort.findIndex(item=>item.id===id);return{state:index>=0?this.sort[index]:void 0,index}}activateSort(id,additive){const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnIsSortable(entry.column))return;const existing=this.sortFor(id).state,descendingFirst=entry.column.sortDescFirst??this.sortDescFirst;let replacement;existing?existing.desc===descendingFirst?replacement={id,desc:!descendingFirst}:this.withoutSortRemoval&&(replacement={id,desc:descendingFirst}):replacement={id,desc:descendingFirst};let next=additive?this.sort.filter(item=>item.id!==id):[];replacement&&next.push(replacement);const limit=finiteCount(this.maxMultiSort);limit>0&&next.length>limit&&(next=next.slice(next.length-limit)),this.sort=next,this.page=0,this.emit("lr-sort-change",Object.freeze({sort:frozenArray(this.sort.map(item=>Object.freeze({...item})))}))}onHeaderClick(event,id){const target=event.target,interactive=isElementValue(target)?target.closest(INTERACTIVE_SELECTOR):null;interactive&&interactive!==event.currentTarget||this.activateSort(id,event.shiftKey)}onFilterInput(event,id){const control=valueControl(event.currentTarget);if(!control)return;const value=control.value,next=this.filters.filter(filter=>filter.id!==id);value&&next.push({id,value}),this.filters=next,this.page=0,this.emit("lr-filter-change",Object.freeze({filters:frozenArray(next.map(filter=>Object.freeze({...filter})))}))}syncBodyScrollState(source=this.bodyElement){const target=source;if(!isElementValue(target)||typeof target.scrollTop!="number"||typeof target.clientHeight!="number"||typeof target.scrollLeft!="number")return;this.bodyScrollTop=finiteRange(target.scrollTop,this.bodyScrollTop,0),this.viewportHeight=finiteRange(target.clientHeight,this.viewportHeight,0);const inlineExtent=typeof target.scrollWidth=="number"&&typeof target.clientWidth=="number"&&Number.isFinite(target.scrollWidth)&&Number.isFinite(target.clientWidth)?Math.max(0,target.scrollWidth-target.clientWidth):Number.MAX_SAFE_INTEGER;this.bodyScrollInlineOffset=finiteRange(this.effectiveDirection==="rtl"?-target.scrollLeft:target.scrollLeft,0,0,inlineExtent)}onBodyScroll(event){const body=event.currentTarget;this.syncBodyScrollState(body);const expected=this.expectedBodyScroll;expected&&expected.body===body&&Math.abs(finiteRange(body.scrollTop,this.bodyScrollTop,0)-expected.top)<=1?this.expectedBodyScroll=void 0:(this.expectedBodyScroll=void 0,this.pendingMeasurementAnchor=void 0,this.pendingVirtualScroll=void 0),this.lastMeasurementAnchor=this.captureMeasurementAnchor()}onCellClick(event,item,column,columnIdValue,index){const target=event.target,interactive=isElementValue(target)?target.closest(INTERACTIVE_SELECTOR):null;interactive&&interactive!==event.currentTarget&&isElementValue(event.currentTarget)&&event.currentTarget.contains(interactive)||this.emit("lr-cell-click",Object.freeze({rowKey:item.key,columnId:columnIdValue,column,value:columnValue(column,item.row),row:item.row,index}))}emitCellContextMenu(originalEvent,item,column,columnIdValue,index){const detail=Object.freeze({rowKey:item.key,columnId:columnIdValue,column,value:columnValue(column,item.row),row:item.row,index,originalEvent});this.emit("lr-cell-contextmenu",detail,{cancelable:!0}).defaultPrevented&&originalEvent.preventDefault()}descendantRows(row){const result=[],visited=new Set,stack=this.canonicalMembers(this.childrenFor(row)).reverse().map(child=>({row:child,depth:1}));for(;stack.length>0&&result.length<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(trackIdentity&&visited.has(current.row)||(trackIdentity&&visited.add(current.row),result.push(current.row),current.depth>=DATA_GRID_TREE_DEPTH_LIMIT))continue;const children=this.canonicalMembers(this.childrenFor(current.row));for(let index=children.length-1;index>=0;index-=1){const child=children[index];stack.push({row:child,depth:current.depth+1})}}return result}setRowSelected(item,selected,event){if(!this.rowIsSelectable(item.row))return;const selectableItems=this.displayItems.filter(candidate=>candidate.kind==="row"&&this.rowIsSelectable(candidate.row)),position=selectableItems.findIndex(candidate=>keysEqual(candidate.key,item.key));let affected=[item];if(event?.shiftKey&&this.selectionMode==="multiple"&&this.lastSelectedIndex>=0){const from=Math.min(this.lastSelectedIndex,position),to=Math.max(this.lastSelectedIndex,position);affected=selectableItems.slice(from,to+1)}const descendants=this.selectionMode==="multiple"?affected.flatMap(candidate=>this.descendantRows(candidate.row)).filter(row=>this.rowIsSelectable(row)):[],sourceIndexes=this.sourceIndexMap(),keys=[...affected.map(candidate=>candidate.key),...descendants.map((row,index)=>{const sourceIndex=this.sourceIndexFor(row,sourceIndexes);return this.keyForRow(row,sourceIndex??index)})];let next=this.selectionMode==="single"?[]:[...this.selectedKeys];for(const key of keys)next=next.filter(candidate=>!keysEqual(candidate,key)),selected&&next.push(key);this.selectedKeys=next,this.lastSelectedIndex=position,this.emitSelection()}selectCurrentPage(selected){const pageKeys=this.currentPageSelectableRows.map(item=>item.key);let next=this.selectedKeys.filter(key=>!pageKeys.some(pageKey=>keysEqual(pageKey,key)));selected&&(next=[...next,...pageKeys]),this.selectedKeys=next,this.emitSelection()}emitSelection(){const selectedRowKeys=frozenArray(this.selectedRowKeys),selectedRows=frozenArray(this.selectedRows);this.emit("lr-row-select",Object.freeze({selectedRowKeys,selectedKeys:selectedRowKeys,selectedRows}))}rowSelectionState(item){const own=arrayHasKey(this.selectedKeys,item.key);if(this.selectionMode!=="multiple")return{checked:own,indeterminate:!1};const descendants=this.descendantRows(item.row).filter(row=>this.rowIsSelectable(row));if(descendants.length===0)return{checked:own,indeterminate:!1};const sourceIndexes=this.sourceIndexMap(),selected=descendants.filter((row,index)=>{const sourceIndex=this.sourceIndexFor(row,sourceIndexes);return arrayHasKey(this.selectedKeys,this.keyForRow(row,sourceIndex??index))}).length,checked=own&&selected===descendants.length;return{checked,indeterminate:!checked&&(own||selected>0)}}toggleRowExpanded(item,emitUserEvent){const expanded=arrayHasKey(this.expandedKeys,item.key);expanded?this.collapseRow(item.key):this.expandRow(item.key),emitUserEvent&&this.emit(expanded?"lr-row-collapse":"lr-row-expand",Object.freeze({rowKey:item.key,key:item.key,row:item.row}))}toggleGroupExpanded(item){const expanded=arrayHasKey(this.expandedKeys,item.key);expanded?this.collapseRow(item.key):this.expandRow(item.key);const detail=Object.freeze({key:item.key,columnId:item.columnId,value:item.value,rows:frozenArray(item.rows)});this.emit(expanded?"lr-group-collapse":"lr-group-expand",detail)}moveColumn(id,delta,emitUserEvent){const order=this.orderedColumns.map(entry=>entry.id),from=order.indexOf(id);if(from<0)return;const to=finiteInteger(from+delta,from,0,order.length-1);from!==to&&(order.splice(from,1),order.splice(to,0,id),this.columnOrder=order,emitUserEvent&&this.emit("lr-column-move",Object.freeze({columnOrder:frozenArray(order),columnId:id,finished:!0})))}columnCanMove(id){const entry=this.orderedColumns.find(item=>item.id===id);return!!(entry&&(this.reorderable||entry.column.movable))}columnCanResize(id){const entry=this.orderedColumns.find(item=>item.id===id);return!!(entry&&(this.resizable||entry.column.resizable))}onDragStart(event,id){const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnCanMove(id)||!event.dataTransfer){event.preventDefault();return}const token=`${++this.columnDragSequence}:${id}`;this.columnDragSession=Object.freeze({sourceId:id,token}),event.dataTransfer.setData(DATA_GRID_DRAG_TYPE,token),event.dataTransfer.setData("text/plain",id),event.dataTransfer.effectAllowed="move",this.dragGhost=this.columnLabel(entry.column,id)}onDrop(event,targetId){event.preventDefault();const session=this.columnDragSession,token=event.dataTransfer?.getData(DATA_GRID_DRAG_TYPE),sourceId=session?.sourceId;if(this.columnDragSession=void 0,this.dragGhost="",!session||token!==session.token||!sourceId||sourceId===targetId||!this.columnCanMove(sourceId)||!this.columnCanMove(targetId))return;const order=this.orderedColumns.map(entry=>entry.id),source=order.indexOf(sourceId),target=order.indexOf(targetId);source<0||target<0||(order.splice(source,1),order.splice(target,0,sourceId),this.columnOrder=order,this.emit("lr-column-move",Object.freeze({columnOrder:frozenArray(order),columnId:sourceId,finished:!0})))}onResizeStart(event,id){const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnCanResize(id))return;const header=this.renderedColumnElements(id,"columnheader")[0];this.resizeSession={columnId:id,startClientX:event.clientX,startWidth:header?.getBoundingClientRect().width??this.estimatedColumnWidth(entry.column,id),initialStateWidth:this.columnWidths.get(id),pointerId:event.pointerId,moved:!1,direction:this.effectiveDirection},this.activeResizeColumn=id;try{event.currentTarget.setPointerCapture?.(event.pointerId)}catch{}event.preventDefault()}onResizeMove(event){const session=this.resizeSession;if(!session||event.pointerId!==session.pointerId)return;if(!this.columnCanResize(session.columnId)){this.resizeSession=void 0,this.activeResizeColumn=void 0,session.moved&&this.restoreResizeSession(session,!0);return}const direction=session.direction==="rtl"?-1:1;this.setColumnWidth(session.columnId,session.startWidth+(event.clientX-session.startClientX)*direction,!0,!1),session.moved=!0}takeResizeSession(event){const session=this.resizeSession;if(!(!session||event.pointerId!==session.pointerId)){this.resizeSession=void 0,this.activeResizeColumn=void 0;try{event.currentTarget.releasePointerCapture?.(event.pointerId)}catch{}return session}}restoreResizeSession(session,emit){const next=new Map(this.columnWidths);session.initialStateWidth===void 0?next.delete(session.columnId):next.set(session.columnId,session.initialStateWidth),this.columnWidths=next,emit&&this.emit("lr-column-resize",Object.freeze({columnId:session.columnId,width:session.startWidth,finished:!1}))}onResizeEnd(event){const session=this.takeResizeSession(event);if(!session)return;if(!this.columnCanResize(session.columnId)){session.moved&&this.restoreResizeSession(session,!0);return}const width=this.columnWidths.get(session.columnId)??session.startWidth;this.emit("lr-column-resize",Object.freeze({columnId:session.columnId,width,finished:!0}))}onResizeCancel(event){const session=this.takeResizeSession(event);!session||!session.moved||this.restoreResizeSession(session,!0)}onResizeKey(event,id){if(event.key!=="ArrowLeft"&&event.key!=="ArrowRight")return;const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnCanResize(id))return;const logical=(event.key==="ArrowRight"?1:-1)*(this.effectiveDirection==="rtl"?-1:1),current=this.columnWidths.get(id)??this.estimatedColumnWidth(entry.column,id);this.setColumnWidth(id,current+logical*10,!0,!0),event.preventDefault()}onPageSizeChange(event){const control=valueControl(event.currentTarget);control&&(this.pageSize=finiteCount(Number(control.value)),this.page=0,this.emit("lr-page-change",Object.freeze({page:0,pageSize:this.safePageSize})))}focusCell(row,column){const rowLimit=Math.max(-1,this.displayItems.length-1),columnLimit=Math.max(0,this.visibleColumns.length-1);this.focusedRow=finiteInteger(row,this.focusedRow,-1,rowLimit),this.focusedColumn=finiteInteger(column,this.focusedColumn,0,columnLimit);let pendingScrollTop;if(this.focusedRow>=0){const selector=`[role="gridcell"][data-row-position="${this.focusedRow}"]`;if(!this.renderRoot.querySelector(selector)){const top=this.displayItemOffset(this.focusedRow,this.displayItems);pendingScrollTop=top,this.bodyScrollTop=top,this.bodyElement&&(this.bodyElement.scrollTop=top)}}this.updateComplete.then(()=>{pendingScrollTop!==void 0&&this.bodyElement&&(this.bodyElement.scrollTop=pendingScrollTop),this.focus()})}onGridKeyDown(event,rowPosition,columnPosition,item,column,columnIdValue){const target=event.target;if(isElementValue(target)&&target!==event.currentTarget&&target.closest(INTERACTIVE_SELECTOR))return;const rtlMultiplier=this.effectiveDirection==="rtl"?-1:1;if((event.ctrlKey||event.metaKey)&&event.key.toLowerCase()==="a"&&this.selectionMode==="multiple"){this.selectCurrentPage(!0),event.preventDefault();return}if((event.ctrlKey||event.metaKey)&&event.key.toLowerCase()==="c"){this.copySelectedRows(),event.preventDefault();return}if(event.shiftKey&&event.key==="F10"&&item&&column&&columnIdValue){this.emitCellContextMenu(event,item,column,columnIdValue,rowPosition);return}const headerEntry=columnIdValue?this.orderedColumns.find(entry=>entry.id===columnIdValue):void 0;if(rowPosition<0&&columnIdValue&&headerEntry&&(this.reorderable||headerEntry.column.movable)&&event.shiftKey&&!event.altKey&&(event.key==="ArrowLeft"||event.key==="ArrowRight")){const delta=(event.key==="ArrowRight"?1:-1)*rtlMultiplier;this.moveColumn(columnIdValue,delta,!0),event.preventDefault();return}if(!(rowPosition<0&&columnIdValue&&headerEntry&&(this.resizable||headerEntry.column.resizable)&&event.altKey&&(this.onResizeKey(event,columnIdValue),event.defaultPrevented))){if(event.key==="ArrowLeft"||event.key==="ArrowRight"){const delta=(event.key==="ArrowRight"?1:-1)*rtlMultiplier;this.focusCell(rowPosition,columnPosition+delta),event.preventDefault()}else if(event.key==="ArrowUp")this.focusCell(rowPosition-1,columnPosition),event.preventDefault();else if(event.key==="ArrowDown")this.focusCell(rowPosition+1,columnPosition),event.preventDefault();else if(event.key==="Home")this.focusCell(event.ctrlKey||event.metaKey?-1:rowPosition,0),event.preventDefault();else if(event.key==="End")this.focusCell(event.ctrlKey||event.metaKey?this.displayItems.length-1:rowPosition,this.visibleColumns.length-1),event.preventDefault();else if(event.key==="PageUp"||event.key==="PageDown"){const delta=event.key==="PageDown"?this.safePageSize||10:-(this.safePageSize||10);this.focusCell(rowPosition+delta,columnPosition),event.preventDefault()}else if(event.key==="Enter")rowPosition<0&&columnIdValue?this.activateSort(columnIdValue,event.shiftKey):item&&column&&columnIdValue&&this.emit("lr-cell-click",Object.freeze({rowKey:item.key,columnId:columnIdValue,column,value:columnValue(column,item.row),row:item.row,index:rowPosition})),event.preventDefault();else if(event.key===" "&&item){const selected=!arrayHasKey(this.selectedKeys,item.key);this.setRowSelected(item,selected,event),event.preventDefault()}}}setGroupSelected(group,selected){const eligible=group.rows.filter(row=>this.rowIsSelectable(row)),sourceIndexes=this.sourceIndexMap(),groupKeys=eligible.map((row,index)=>{const sourceIndex=this.sourceIndexFor(row,sourceIndexes);return this.keyForRow(row,sourceIndex??index)});let next=this.selectedKeys.filter(key=>!groupKeys.some(groupKey=>keysEqual(groupKey,key)));selected&&(next=[...next,...groupKeys]),this.selectedKeys=next,this.emitSelection()}userPinColumn(id,side){this.pinColumn(id,side),this.emit("lr-column-pin",Object.freeze({columnId:id,side}))}userToggleColumn(id,visible){this.toggleColumn(id,visible),this.emit("lr-column-visibility-change",Object.freeze({columnId:id,visible}))}renderToolbar(){return!this.withSearch&&!this.withColumnsMenu?nothing: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{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{resolveCssLength}from"../../../internal/css-length.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{getNumberFormat,resolveIntlLocale}from"../../../internal/intl-cache.js";import{chevronIcon}from"../../../internal/icons.js";import{LyraElement}from"../../../internal/lyra-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{finiteCount,finiteDuration,finiteInteger,finiteRange}from"../../../internal/numbers.js";import{sizes}from"../../../internal/sizes.styles.js";import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{aggregateValues,columnId,columnValue,filterRows,pathValue,rowsAsDelimited,searchRows,sortRows}from"./data-grid-processing.js";import{styles}from"./data-grid.styles.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copied,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_dataGridColumnMenu,LYRA_DEFAULT_dataGridPinEnd,LYRA_DEFAULT_dataGridPinStart,LYRA_DEFAULT_dataGridRowsPerPage,LYRA_DEFAULT_dataGridTreeLimitReached,LYRA_DEFAULT_dataGridUnpin,LYRA_DEFAULT_expand,LYRA_DEFAULT_loading,LYRA_DEFAULT_next,LYRA_DEFAULT_noColumns,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_paginationFirstPage,LYRA_DEFAULT_paginationJumpToPage,LYRA_DEFAULT_paginationLabel,LYRA_DEFAULT_paginationLastPage,LYRA_DEFAULT_previous,LYRA_DEFAULT_resizeColumn,LYRA_DEFAULT_resizeValuePixels,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_tableFilterLabel}from"../../../internal/default-strings.generated.js";export*from"./data-grid-types.js";const selectableConverter={fromAttribute(value){return value===null?"none":value===""||value==="multiple"?"multiple":value==="single"||value==="none"?value:"none"},toAttribute(value){return value==="none"?null:value===""||value==="multiple"?"":value}};function displayItemKey(item){return item.kind==="group"?`group:${item.key.length}:${item.key}`:`row:${typeof item.key}:${String(item.key)}`}const DATA_GRID_COLUMN_PROPERTIES=["id","field","label","align","width","minWidth","maxWidth","flex","formatter","value","sortable","sortFn","comparator","sortDescFirst","sortUndefined","searchable","filterable","filterType","filterFn","hidden","hideable","resizable","movable","pinnable","pinned","footer","aggregation","aggregatedFormatter"],DATA_GRID_COLUMN_CALLBACK_PROPERTIES=new Set(["formatter","value","comparator","filterFn","aggregatedFormatter"]),DATA_GRID_SORT_ALGORITHMS=new Set(["alphanumeric","alphanumericCaseSensitive","text","textCaseSensitive","datetime","basic"]),DATA_GRID_FILTER_TYPES=new Set(["text","equals","number-range","date-range","set","includes-any","includes-all"]),DATA_GRID_AGGREGATIONS=new Set(["sum","min","max","mean","median","count","unique","uniqueCount","extent"]);function isSafeColumnPropertyValue(property2,value){if(value===void 0)return!0;if(DATA_GRID_COLUMN_CALLBACK_PROPERTIES.has(property2))return typeof value=="function";switch(property2){case"id":case"field":case"label":return typeof value=="string";case"width":case"minWidth":case"maxWidth":case"flex":return typeof value=="number"&&Number.isFinite(value);case"sortable":case"sortDescFirst":case"searchable":case"filterable":case"hidden":case"hideable":case"resizable":case"movable":case"pinnable":return typeof value=="boolean";case"align":return value==="left"||value==="center"||value==="right"||value==="start"||value==="end";case"sortFn":return typeof value=="string"&&DATA_GRID_SORT_ALGORITHMS.has(value);case"sortUndefined":return value==="first"||value==="last"||value===1||value===-1;case"filterType":return typeof value=="string"&&DATA_GRID_FILTER_TYPES.has(value);case"pinned":return value===!1||value==="left"||value==="right"||value==="start"||value==="end";case"footer":return typeof value=="string"||typeof value=="function";case"aggregation":return typeof value=="function"||typeof value=="string"&&DATA_GRID_AGGREGATIONS.has(value);default:return!1}}function snapshotColumns(value,occurrenceId){const output=[],seen=new Set;let length=0;try{if(!Array.isArray(value))return Object.freeze(output);const descriptor=getOwnDataDescriptor(value,"length"),sourceLength=descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value;typeof sourceLength=="number"&&Number.isSafeInteger(sourceLength)&&sourceLength>=0&&(length=Math.min(sourceLength,MAX_DATA_GRID_COLUMN_ENTRIES))}catch{return Object.freeze(output)}for(let index=0;index<length;index+=1){const candidate=getOwnDataDescriptor(value,String(index));if(candidate===MISSING_OWN_DATA_DESCRIPTOR||candidate===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const column=candidate.value;try{if(column===null||typeof column!="object"||Array.isArray(column))continue;const descriptors=new Map;for(const property2 of DATA_GRID_COLUMN_PROPERTIES)descriptors.set(property2,getOwnDataDescriptor(column,property2));const idDescriptor=descriptors.get("id")??MISSING_OWN_DATA_DESCRIPTOR,fieldDescriptor=descriptors.get("field")??MISSING_OWN_DATA_DESCRIPTOR;if(idDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const hasId=idDescriptor!==MISSING_OWN_DATA_DESCRIPTOR,authoredId=hasId?idDescriptor.value:void 0,hasSafeId=typeof authoredId=="string"&&authoredId.trim()!=="";if(hasId&&authoredId!==void 0&&!hasSafeId)continue;const hasField=fieldDescriptor!==MISSING_OWN_DATA_DESCRIPTOR,authoredField=fieldDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!hasField?void 0:fieldDescriptor.value,hasSafeField=typeof authoredField=="string"&&authoredField.trim()!=="";if(!hasSafeId&&(fieldDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||hasField&&authoredField!==void 0&&!hasSafeField))continue;const identity=hasSafeId?authoredId:hasSafeField?authoredField:occurrenceId(column);if(seen.has(identity))continue;seen.add(identity);const snapshot=Object.create(null);for(const property2 of DATA_GRID_COLUMN_PROPERTIES){const descriptor=descriptors.get(property2);descriptor===void 0||descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR||property2==="field"&&!hasSafeField||isSafeColumnPropertyValue(property2,descriptor.value)&&(snapshot[property2]=descriptor.value)}authoredId===void 0&&authoredField===void 0&&(snapshot.id=identity),output.push(Object.freeze(snapshot))}catch{}}return Object.freeze(output)}const INTERACTIVE_SELECTOR='button, a[href], input, select, textarea, summary, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="checkbox"], [role="radio"]',VIRTUALIZATION_THRESHOLD=80,VIRTUAL_OVERSCAN=5,DATA_GRID_TREE_NODE_LIMIT=1e4,DATA_GRID_TREE_DEPTH_LIMIT=64,MAX_DATA_GRID_COLUMN_ENTRIES=1e4,DATA_GRID_DRAG_TYPE="application/x-lyra-data-grid-column";function frozenArray(values){return Object.freeze([...values])}function serializableFilterValue(value){try{const serialized=JSON.stringify({value},(_key,nested)=>typeof nested=="bigint"?nested.toString():typeof nested=="number"&&!Number.isFinite(nested)?null:nested!==null&&typeof nested=="object"&&Object.prototype.toString.call(nested)==="[object Set]"?[...nested]:nested);if(!serialized)return null;const snapshot=JSON.parse(serialized).value??null,stack=[snapshot],visited=new Set;for(;stack.length>0;){const current=stack.pop();if(!(current===null||typeof current!="object"||visited.has(current))){visited.add(current);for(const nested of Object.values(current))stack.push(nested);Object.freeze(current)}}return snapshot}catch{return null}}function isKey(value){return typeof value=="string"&&value.trim()!==""||typeof value=="number"&&Number.isFinite(value)}function snapshotKeys(value){if(!Array.isArray(value))return Object.freeze([]);const output=[],seen=new Set;for(const key of value)!isKey(key)||seen.has(key)||(seen.add(key),output.push(key));return frozenArray(output)}function keysEqual(left,right){return typeof left==typeof right&&left===right}function arrayHasKey(keys,key){return keys.some(candidate=>keysEqual(candidate,key))}function isElementValue(value){if(value===null||typeof value!="object")return!1;const candidate=value;return candidate.nodeType===1&&typeof candidate.closest=="function"}function valueControl(value){return!isElementValue(value)||typeof value.value!="string"?null:value}function checkableControl(value){return!isElementValue(value)||typeof value.checked!="boolean"?null:value}function dateText(value){try{const timestamp=Date.prototype.getTime.call(value);return Number.isFinite(timestamp)?Date.prototype.toISOString.call(value):""}catch{return}}function humanizeIdentifier(value,locale){const intlLocale=resolveIntlLocale(locale);return value.replaceAll(/[._-]+/gu," ").replaceAll(/([a-z\d])([A-Z])/gu,"$1 $2").replace(/^./u,first=>first.toLocaleUpperCase(intlLocale))}function safeText(value){if(value==null)return"";if(typeof value=="object"){const serializedDate=dateText(value);if(serializedDate!==void 0)return serializedDate}if(Array.isArray(value))return value.map(safeText).join(", ");if(typeof value=="object")try{return JSON.stringify(value,(_key,nested)=>typeof nested=="bigint"?nested.toString():nested)??""}catch{return""}return String(value)}function normalizePinSide(side){return side==="start"?"left":side==="end"?"right":side}function normalizedGroupBy(value){return typeof value!="string"?(value??[]).map(entry=>entry.trim()).filter(Boolean).slice(0,DATA_GRID_TREE_DEPTH_LIMIT):value.split(/[\s,]+/u).map(entry=>entry.trim()).filter(Boolean).slice(0,DATA_GRID_TREE_DEPTH_LIMIT)}class LyraDataGrid extends LyraElement{constructor(){super(...arguments),this.appearance="outlined",this.childRows=null,this._columnOrder=Object.freeze([]),this.columnOccurrenceIds=new WeakMap,this.nextColumnOccurrenceId=1,this.rowOccurrenceIds=new WeakMap,this.nextRowOccurrenceId=1,this._columns=Object.freeze([]),this._data=Object.freeze([]),this.dataSource=null,this._expandedRowKeys=Object.freeze([]),this.filterDebounce=250,this.filterFromLeafRows=!1,this._filters=Object.freeze([]),this._groupBy=null,this.label=null,this.loading=!1,this.maxMultiSort=0,this.page=0,this.pageSize=20,this._pageSizeOptions=Object.freeze([10,20,50,100]),this.paginate=!1,this.pinnable=!1,this.reorderable=!1,this.resizable=!1,this.rowClass=null,this.rowDetail=null,this.rowKey=null,this.searchFn=null,this.searchTerm="",this.selectable="none",this.selectableRows=null,this._selectedRowKeys=Object.freeze([]),this.server=!1,this.size="m",this._sort=Object.freeze([]),this.sortDescFirst=!1,this.striped=!1,this.total=-1,this.withColumnMenu=!1,this.withColumnsMenu=!1,this.withoutSortRemoval=!1,this.withSearch=!1,this.columnWidths=new Map,this.columnVisibility=new Map,this.columnPinning=new Map,this.activeFilterColumn=null,this.columnsMenuOpen=!1,this.activeColumnMenu=null,this.liveText="",this.bodyScrollTop=0,this.bodyScrollInlineOffset=0,this.viewportHeight=0,this.focusedRow=-1,this.focusedColumn=0,this.dragGhost="",this.requestGeneration=0,this.ownsLoadingState=!1,this.columnDragSequence=0,this.managedOverlayOwner=null,this.lastSelectedIndex=-1,this.isMounting=!0,this.measuredItemHeights=new Map,this.measuredItemOffsets=Object.freeze([0]),this.measuredItemOffsetSignature="",this.measuredItemOffsetEstimate=0,this.measuredItemOffsetsDirty=!0,this.measurementLocale="",this.measurementDisplaySignature="",this.measurementFontSignature="",this.bodyScrollbarInlineEndGutter=0,this.observedMeasurementElements=new Map,this.measurementUpdateQueued=!1,this.measurementScrollSyncQueued=!1,this.bodyScrollStateSyncQueued=!1,this.relayEditorFocus=event=>{relayNativeEvent(this,event)},this.relayEditorBlur=event=>{relayNativeEvent(this,event)}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,copied:LYRA_DEFAULT_copied,copyFailed:LYRA_DEFAULT_copyFailed,dataGridColumnMenu:LYRA_DEFAULT_dataGridColumnMenu,dataGridPinEnd:LYRA_DEFAULT_dataGridPinEnd,dataGridPinStart:LYRA_DEFAULT_dataGridPinStart,dataGridRowsPerPage:LYRA_DEFAULT_dataGridRowsPerPage,dataGridTreeLimitReached:LYRA_DEFAULT_dataGridTreeLimitReached,dataGridUnpin:LYRA_DEFAULT_dataGridUnpin,expand:LYRA_DEFAULT_expand,loading:LYRA_DEFAULT_loading,next:LYRA_DEFAULT_next,noColumns:LYRA_DEFAULT_noColumns,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,paginationFirstPage:LYRA_DEFAULT_paginationFirstPage,paginationJumpToPage:LYRA_DEFAULT_paginationJumpToPage,paginationLabel:LYRA_DEFAULT_paginationLabel,paginationLastPage:LYRA_DEFAULT_paginationLastPage,previous:LYRA_DEFAULT_previous,resizeColumn:LYRA_DEFAULT_resizeColumn,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showAllColumns:LYRA_DEFAULT_showAllColumns,tableFilterLabel:LYRA_DEFAULT_tableFilterLabel}}static{this.immutableEventDetails=Object.freeze(["request","lr-column-move","lr-data-error"])}static{this.identityEventDetailProperties=Object.freeze({request:Object.freeze(["signal"]),"lr-data-error":Object.freeze(["error","request"])})}static{this.styles=[LyraElement.styles,sizes,srOnly,styles]}get columnOrder(){return this._columnOrder}set columnOrder(value){const previous=this._columnOrder,seen=new Set;this._columnOrder=frozenArray(Array.isArray(value)?value.filter(id=>typeof id!="string"||id.trim()===""||seen.has(id)?!1:(seen.add(id),!0)):[]),this.requestUpdate("columnOrder",previous)}get columns(){return this._columns}set columns(value){const previous=this._columns;this._columns=snapshotColumns(value,column=>{const current=this.columnOccurrenceIds.get(column);if(current)return current;const identity=`column-occurrence-${this.nextColumnOccurrenceId}`;return this.nextColumnOccurrenceId+=1,this.columnOccurrenceIds.set(column,identity),identity}),this.requestUpdate("columns",previous)}get data(){return this._data}set data(value){const previous=this._data;this._data=frozenArray(Array.isArray(value)?value:[]),this.requestUpdate("data",previous)}get expandedRowKeys(){return this._expandedRowKeys}set expandedRowKeys(value){const previous=this._expandedRowKeys;this._expandedRowKeys=snapshotKeys(value),this.requestUpdate("expandedRowKeys",previous),this.requestUpdate("expandedKeys",previous)}get expandedKeys(){return this.expandedRowKeys}set expandedKeys(value){this.expandedRowKeys=value}get filteredCount(){return this.processedClientRows.length}get filters(){return this._filters}set filters(value){const previous=this._filters,next=[];if(Array.isArray(value))for(const filter of value)try{if(!filter||typeof filter.id!="string")continue;const filterValue=filter.value instanceof Set||Array.isArray(filter.value)?frozenArray(filter.value):filter.value;next.push(Object.freeze({id:filter.id,value:filterValue}))}catch{}this._filters=Object.freeze(next),this.requestUpdate("filters",previous)}get groupBy(){return this._groupBy}set groupBy(value){const previous=this._groupBy;this._groupBy=typeof value=="string"?value:Array.isArray(value)?frozenArray(value.filter(item=>typeof item=="string")):null,this.requestUpdate("groupBy",previous)}get pageCount(){const size=this.safePageSize;if(size===0)return 0;if(!this.usesServerData&&normalizedGroupBy(this.groupBy).length>0){const groups=this.topLevelGroupBuckets(this.processedClientRows).length;return groups<=0?0:Math.ceil(groups/size)}const count=this.safeTotal>=0?this.safeTotal:this.filteredCount;return count<=0?0:Math.ceil(count/size)}get pageSizeOptions(){return this._pageSizeOptions}set pageSizeOptions(value){const previous=this._pageSizeOptions;this._pageSizeOptions=frozenArray(Array.isArray(value)?value:[]),this.requestUpdate("pageSizeOptions",previous)}get selectedRowKeys(){return this._selectedRowKeys}set selectedRowKeys(value){const previous=this._selectedRowKeys;this._selectedRowKeys=snapshotKeys(value),this.requestUpdate("selectedRowKeys",previous),this.requestUpdate("selectedKeys",previous)}get selectedKeys(){return this.selectedRowKeys}set selectedKeys(value){this.selectedRowKeys=value}get selectedRows(){return frozenArray(this.allSourceRows.filter((row,index)=>arrayHasKey(this.selectedKeys,this.keyForRow(row,index))))}set selectedRows(next){const source=this.allSourceRows,sourceSet=new Set(source),sourceIndexes=this.sourceIndexMap(source),candidates=Array.isArray(next)?next:[],seen=new Set,rows=candidates.filter(row=>!sourceSet.has(row)||seen.has(row)?!1:(seen.add(row),!0)),limited=this.selectionMode==="single"?rows.slice(0,1):rows;this.selectedKeys=limited.map(row=>this.keyForRow(row,this.sourceIndexFor(row,sourceIndexes)??0))}get sort(){return this._sort}set sort(value){const previous=this._sort,next=[];if(Array.isArray(value))for(const item of value)try{if(!item||typeof item.id!="string")continue;next.push(Object.freeze({id:item.id,desc:!!item.desc}))}catch{}this._sort=Object.freeze(next),this.requestUpdate("sort",previous)}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.hasUpdated&&(this.syncMeasuredBodyWidth(),this.syncBodyScrollState(),this.syncRowMeasurementObserver(),this.correctMeasurementAnchor(),this.measureRenderedItems()),this.dataSource&&this.scheduleServerRequest(!1)}disconnectedCallback(){this.managedOverlay?.deactivate({restoreFocus:!1}),this.managedOverlay=void 0,this.managedOverlayOwner=null,this.requestGeneration+=1,this.requestController?.abort(),this.requestController=void 0,this.ownsLoadingState&&(this.loading=!1),this.ownsLoadingState=!1,this.cancelRequestTimer(),this.resizeSession?.moved&&this.restoreResizeSession(this.resizeSession,!1),this.resizeSession=void 0,this.activeResizeColumn=void 0,this.activeFilterColumn=null,this.activeColumnMenu=null,this.columnsMenuOpen=!1,this.dragGhost="",this.columnDragSession=void 0,this.pendingVirtualScroll=void 0,this.expectedBodyScroll=void 0,this.resetRowMeasurementObserver(),this.sink?.release(),this.sink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.expectedBodyScroll=void 0,this.resetRowMeasurementObserver(),this.isConnected&&this.hasUpdated&&(this.syncMeasuredBodyWidth(),this.syncBodyScrollState(),this.syncRowMeasurementObserver(),this.correctMeasurementAnchor(),this.measureRenderedItems())}willUpdate(changed){super.willUpdate(changed),this.hasUpdated&&changed.has("loading")&&this.loading&&this.announce(this.localize("loading"));const sourceReplaced=changed.has("dataSource")&&changed.get("dataSource")!==void 0,serverDisabled=changed.has("server")&&!this.usesServerData;if((sourceReplaced||serverDisabled)&&(this.requestController||this.requestTimer!==void 0)&&(this.requestGeneration+=1,this.requestController?.abort(),this.requestController=void 0,this.cancelRequestTimer(),this.ownsLoadingState&&(this.loading=!1),this.ownsLoadingState=!1),this.resizeSession&&(changed.has("resizable")||changed.has("columns"))&&!this.columnCanResize(this.resizeSession.columnId)){const session=this.resizeSession;this.resizeSession=void 0,this.activeResizeColumn=void 0,session.moved&&this.restoreResizeSession(session,!0)}if(this.columnDragSession&&(changed.has("reorderable")||changed.has("columns"))&&!this.columnCanMove(this.columnDragSession.sourceId)&&(this.columnDragSession=void 0,this.dragGhost=""),changed.has("columns")&&this.handleColumnsChange(),this.reconcileRowMeasurementCache(changed),!this.usesServerData&&(changed.has("data")||changed.has("rowKey")||changed.has("childRows")||changed.has("server")||changed.has("dataSource"))){const validKeys=this.allSourceRows.map((row,index)=>this.keyForRow(row,index)),validKeySet=new Set(validKeys),selectedKeys=this.selectedKeys.filter(key=>validKeySet.has(key));(selectedKeys.length!==this.selectedKeys.length||selectedKeys.some((key,index)=>!keysEqual(key,this.selectedKeys[index])))&&(this.selectedKeys=selectedKeys),this.lastSelectedIndex=-1}if(this.paginate&&(changed.has("data")||changed.has("filters")||changed.has("searchTerm")||changed.has("groupBy")||changed.has("pageSize")||changed.has("total")||changed.has("server")||changed.has("dataSource"))){const lastPage=Math.max(0,this.pageCount-1);this.page=finiteInteger(this.page,0,0,lastPage)}(changed.has("data")||changed.has("columns")||changed.has("filters")||changed.has("searchTerm")||changed.has("sort")||changed.has("expandedKeys")||changed.has("groupBy")||changed.has("page")||changed.has("pageSize")||changed.has("paginate")||changed.has("childRows"))&&(this.focusedRow=finiteInteger(this.focusedRow,-1,-1,Math.max(-1,this.displayItems.length-1)),this.focusedColumn=finiteInteger(this.focusedColumn,0,0,Math.max(0,this.visibleColumns.length-1)))}updated(changed){if(super.updated(changed),changed.has("dataSource")&&this.dataSource&&this.scheduleServerRequest(!1),(changed.has("sort")||changed.has("filters")||changed.has("searchTerm")||changed.has("page")||changed.has("pageSize")||changed.has("server"))&&(this.server||this.dataSource)){const delayed=changed.has("filters")||changed.has("searchTerm");this.scheduleServerRequest(delayed)}this.syncManagedOverlay(),this.syncMeasuredBodyWidth(),this.queueBodyScrollStateSync(),this.syncRowMeasurementObserver(),this.correctMeasurementAnchor(),this.measureRenderedItems(),this.alignPendingVirtualScroll(),this.isMounting=!1}get currentManagedOverlayOwner(){return this.columnsMenuOpen?"columns":this.activeFilterColumn!==null?`filter:${this.activeFilterColumn}`:this.activeColumnMenu!==null?`column:${this.activeColumnMenu}`:null}managedOverlayElements(owner){if(owner==="columns"){const container=this.renderRoot.querySelector('[part="columns-menu"]');return{panel:container?.querySelector('[role="group"]')??null,trigger:container?.querySelector("button")??null}}const separator=owner.indexOf(":"),kind=owner.slice(0,separator),columnIdValue=owner.slice(separator+1),header=[...this.renderRoot.querySelectorAll('[part~="header-cell"][data-column-id]')].find(candidate=>candidate.getAttribute("data-column-id")===columnIdValue);return header?kind==="filter"?{panel:header.querySelector('[part="filter-panel"]'),trigger:header.querySelector('[part="filter-button"]')}:{panel:header.querySelector('[part="column-menu"] [role="group"]'),trigger:header.querySelector('[part="column-menu-button"]')}:{panel:null,trigger:null}}dismissManagedOverlay(owner){owner==="columns"&&this.columnsMenuOpen?this.columnsMenuOpen=!1:owner.startsWith("filter:")&&this.activeFilterColumn===owner.slice(7)?this.activeFilterColumn=null:owner.startsWith("column:")&&this.activeColumnMenu===owner.slice(7)&&(this.activeColumnMenu=null)}syncManagedOverlay(){const owner=this.currentManagedOverlayOwner;if(owner!==null&&owner===this.managedOverlayOwner&&this.managedOverlay?.isActive()&&this.managedOverlayElements(owner).panel||(this.managedOverlay?.deactivate({restoreFocus:owner===null}),this.managedOverlay=void 0,this.managedOverlayOwner=null,owner===null||!this.isConnected))return;const{panel}=this.managedOverlayElements(owner);panel&&(this.managedOverlayOwner=owner,this.managedOverlay=activateNonmodalOverlay({host:this,panel:()=>this.managedOverlayElements(owner).panel,onEscape:()=>this.dismissManagedOverlay(owner),restoreFocusTo:()=>this.managedOverlayElements(owner).trigger}))}toggleColumnsPanel(){const next=!this.columnsMenuOpen;this.columnsMenuOpen=next,next&&(this.activeFilterColumn=null,this.activeColumnMenu=null)}toggleFilterPanel(id){const next=this.activeFilterColumn===id?null:id;this.activeFilterColumn=next,next!==null&&(this.columnsMenuOpen=!1,this.activeColumnMenu=null)}toggleColumnPanel(id){const next=this.activeColumnMenu===id?null:id;this.activeColumnMenu=next,next!==null&&(this.columnsMenuOpen=!1,this.activeFilterColumn=null)}announce(text){this.sink?.announce(text),this.liveText=text}get usesServerData(){return this.server||this.dataSource!==null}get safePage(){return finiteInteger(this.page,0,0,Math.max(0,this.pageCount-1))}get safePageSize(){return finiteCount(this.pageSize)}get safeTotal(){return this.total===-1?-1:finiteCount(this.total)}sourceProjection(){const result=[],visited=new Set,seenRowKeys=new Set,stack=[];for(let index=this.data.length-1;index>=0;index-=1)stack.push({row:this.data[index],depth:0});let truncated=!1;for(;stack.length>0&&result.length<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(!trackIdentity||trackIdentity&&visited.has(current.row))continue;trackIdentity&&visited.add(current.row);const rowKey=this.rowIdentity(current.row);if(rowKey===void 0||seenRowKeys.has(rowKey))continue;seenRowKeys.add(rowKey),result.push(current.row);const children=this.childrenFor(current.row);if(children.length!==0){if(current.depth>=DATA_GRID_TREE_DEPTH_LIMIT){truncated=!0;continue}for(let index=children.length-1;index>=0;index-=1)stack.push({row:children[index],depth:current.depth+1})}}return stack.length>0&&(truncated=!0),{rows:Object.freeze(result),truncated}}get allSourceRows(){return this.sourceProjection().rows}get canonicalRootRows(){const canonical=new Set(this.allSourceRows);return this.data.filter(row=>canonical.delete(row))}sourceIndexMap(rows=this.allSourceRows){const indexes=new Map;return rows.forEach((row,index)=>{indexes.has(row)||indexes.set(row,index)}),indexes}sourceIndexFor(row,indexes){const direct=indexes.get(row);if(direct!==void 0)return direct;const identity=this.rowIdentity(row);if(identity!==void 0){for(const[candidate,index]of indexes)if(Object.is(this.rowIdentity(candidate),identity))return index}}canonicalMembers(rows){const byIdentity=new Map;for(const row of this.allSourceRows){const identity=this.rowIdentity(row);identity!==void 0&&!byIdentity.has(identity)&&byIdentity.set(identity,row)}const output=[],seen=new Set;for(const candidate of rows){const identity=this.rowIdentity(candidate);if(identity===void 0||seen.has(identity))continue;const canonical=byIdentity.get(identity);canonical&&(seen.add(identity),output.push(canonical))}return output}get orderedColumns(){const entries=this.columns.map((column,naturalIndex)=>({column,id:columnId(column,naturalIndex),naturalIndex}));if(this.columnOrder.length===0)return entries;const rank=new Map(this.columnOrder.map((id,index)=>[id,index]));return entries.sort((left,right)=>{const leftRank=rank.get(left.id),rightRank=rank.get(right.id);return leftRank===void 0&&rightRank===void 0?left.naturalIndex-right.naturalIndex:leftRank===void 0?1:rightRank===void 0?-1:leftRank-rightRank})}get visibleColumns(){return this.orderedColumns.filter(({column,id})=>this.columnVisibility.get(id)??column.hidden!==!0).sort((left,right)=>{const leftPin=normalizePinSide(this.getColumnPin(left.id)),rightPin=normalizePinSide(this.getColumnPin(right.id));return leftPin===rightPin?0:leftPin==="left"||rightPin==="right"?-1:1})}get processedClientRows(){const rows=this.canonicalRootRows;if(this.usesServerData)return[...rows];if(this.childRows){const included=rows.filter(row=>this.rowMatches(row)||this.filterFromLeafRows&&this.hasMatchingDescendant(row));return sortRows(included,this.columns,this.sort,this.effectiveLocale)}const filtered=filterRows(rows,this.columns,this.filters,this.effectiveLocale),searched=searchRows(filtered,this.columns,this.searchTerm,this.effectiveLocale,this.searchFn);return sortRows(searched,this.columns,this.sort,this.effectiveLocale)}childrenFor(row){try{const children=typeof this.childRows=="function"?this.childRows(row):this.childRows?pathValue(row,this.childRows):void 0;return Array.isArray(children)?children.slice(0,DATA_GRID_TREE_NODE_LIMIT):[]}catch{return[]}}rowIdentity(row){if(!((typeof row!="object"||row===null)&&typeof row!="function"))try{if(this.rowKey){const candidate=pathValue(row,this.rowKey);return isKey(candidate)?candidate:void 0}const object=row,current=this.rowOccurrenceIds.get(object);if(current)return current;const identity=`row-occurrence-${this.nextRowOccurrenceId}`;return this.nextRowOccurrenceId+=1,this.rowOccurrenceIds.set(object,identity),identity}catch{return}}keyForRow(row,_index){return this.rowIdentity(row)}renderedColumnElements(columnId2,role){const prefix=role?`[role="${role}"]`:"",ownerCss=this.ownerDocument.defaultView?.CSS,escape=ownerCss?.escape;if(typeof escape=="function")try{const matches=[...this.renderRoot.querySelectorAll(`${prefix}[data-column-id="${escape.call(ownerCss,columnId2)}"]`)];if(matches.length>0)return matches}catch{}return[...this.renderRoot.querySelectorAll(`${prefix}[data-column-id]`)].filter(element=>element.getAttribute("data-column-id")===columnId2)}computedToken(name,privateDefault){if(!this.isConnected)return"";const owner=this.ownerDocument.defaultView;if(!owner||typeof owner.getComputedStyle!="function")return"";try{const style=owner.getComputedStyle(this);return style.getPropertyValue(name).trim()||(privateDefault?style.getPropertyValue(privateDefault).trim():"")}catch{return""}}autoSizeColumn(columnId2){const cells=this.renderedColumnElements(columnId2);if(cells.length===0)return;let width=0;for(const cell of cells)width=Math.max(width,cell.scrollWidth);const entry=this.orderedColumns.find(({id})=>id===columnId2);if(!entry)return;const{minimum,maximum}=this.columnBounds(entry.column);this.setColumnWidth(columnId2,finiteRange(width,minimum,minimum,maximum),!1)}autoSizeColumns(){for(const{id}of this.visibleColumns)this.autoSizeColumn(id)}collapseAllRows(){this.expandedKeys=[]}collapseRow(key){this.expandedKeys=this.expandedKeys.filter(candidate=>!keysEqual(candidate,key))}copySelectedRows(options={}){const rowsToCopy=this.selectedRows.length>0?this.selectedRows:this.getProcessedRows(),format=options.format??"tsv",text=this.delimitedRows(rowsToCopy,{...options,delimiter:options.delimiter??(format==="csv"?",":" ")});return this.copyAndReport(text),rowsToCopy.length}expandAllRows(){const keys=[];this.allSourceRows.forEach((row,index)=>{(this.childrenFor(row).length>0||this.rowDetail)&&keys.push(this.keyForRow(row,index))});for(const group of this.groupItems(this.processedClientRows))keys.push(group.key);this.expandedKeys=keys}expandRow(key){arrayHasKey(this.expandedKeys,key)||(this.expandedKeys=[...this.expandedKeys,key])}exportDataAsCsv(options={}){const text=this.getDataAsCsv(options),ownerDocument=this.ownerDocument,owner=ownerDocument.defaultView;if(!owner||typeof owner.URL.createObjectURL!="function")return;const url=owner.URL.createObjectURL(new owner.Blob([text],{type:"text/csv;charset=utf-8"}));try{const anchor=ownerDocument.createElement("a");anchor.href=url,anchor.download=options.fileName||"data.csv",anchor.hidden=!0,ownerDocument.body?.append(anchor),anchor.click(),anchor.remove()}finally{owner.URL.revokeObjectURL(url)}}focus(options={}){const selector=this.focusedRow<0?`[role="columnheader"][data-column-position="${this.focusedColumn}"]`:`[role="gridcell"][data-row-position="${this.focusedRow}"][data-column-position="${this.focusedColumn}"]`;this.renderRoot.querySelector(selector)?.focus(options)}getColumnFacets(columnId2){const uniqueValues=new Map;if(this.usesServerData)return Object.freeze({uniqueValues});const entry=this.orderedColumns.find(({id})=>id===columnId2);if(!entry)return Object.freeze({uniqueValues});const otherFilters=this.filters.filter(filter=>filter.id!==columnId2),rows=searchRows(filterRows(this.canonicalRootRows,this.columns,otherFilters,this.effectiveLocale),this.columns,this.searchTerm,this.effectiveLocale,this.searchFn);let minimum=Number.POSITIVE_INFINITY,maximum=Number.NEGATIVE_INFINITY;for(const row of rows){const value=columnValue(entry.column,row);uniqueValues.set(value,(uniqueValues.get(value)??0)+1);const number=typeof value=="number"?value:Number(value);Number.isFinite(number)&&(minimum=Math.min(minimum,number),maximum=Math.max(maximum,number))}return Number.isFinite(minimum)&&Number.isFinite(maximum)?Object.freeze({uniqueValues,minMax:Object.freeze([minimum,maximum])}):Object.freeze({uniqueValues})}getColumnPin(columnId2){return this.columnPinning.has(columnId2)?this.columnPinning.get(columnId2)??!1:this.orderedColumns.find(({id})=>id===columnId2)?.column.pinned??!1}getDataAsCsv(options={}){return this.delimitedRows(this.getProcessedRows(),options)}getProcessedRows(){return frozenArray(this.processedClientRows)}getVisibleRows(){const rows=this.processedClientRows;if(!this.paginate||this.usesServerData)return frozenArray(rows);const size=this.safePageSize;if(size===0)return[];const start=this.safePage*size;return normalizedGroupBy(this.groupBy).length>0?frozenArray(this.topLevelGroupBuckets(rows).slice(start,start+size).flatMap(bucket=>bucket.rows)):frozenArray(rows.slice(start,start+size))}getState(){return Object.freeze({order:frozenArray(this.columnOrder),widths:Object.freeze(Object.fromEntries(this.columnWidths)),visibility:Object.freeze(Object.fromEntries(this.columnVisibility)),pinning:Object.freeze(Object.fromEntries(this.columnPinning)),sort:frozenArray(this.sort.map(item=>Object.freeze({...item}))),filters:frozenArray(this.filters.map(item=>Object.freeze({id:item.id,value:serializableFilterValue(item.value)}))),search:this.searchTerm,selectedRowKeys:frozenArray(this.selectedRowKeys),expandedRowKeys:frozenArray(this.expandedRowKeys),selectedKeys:frozenArray(this.selectedRowKeys),expandedKeys:frozenArray(this.expandedRowKeys),page:this.safePage,pageSize:this.safePageSize})}handleColumnsChange(){const valid=new Set(this.columns.map((column,index)=>columnId(column,index))),natural=[...valid],order=this.columnOrder.filter(id=>valid.has(id));for(const id of natural)order.includes(id)||order.push(id);this.columnOrder.length>0&&order.join("\0")!==this.columnOrder.join("\0")&&(this.columnOrder=order);const widths=[...this.columnWidths].filter(([id])=>valid.has(id)),visibility=[...this.columnVisibility].filter(([id])=>valid.has(id)),pinning=[...this.columnPinning].filter(([id])=>valid.has(id));widths.length!==this.columnWidths.size&&(this.columnWidths=new Map(widths)),visibility.length!==this.columnVisibility.size&&(this.columnVisibility=new Map(visibility)),pinning.length!==this.columnPinning.size&&(this.columnPinning=new Map(pinning))}handlePageChange(){this.applyPageChange(this.safePage)}applyPageChange(value){let requested;typeof value=="number"?requested=value:requested=Number(valueControl(value?.currentTarget)?.value??this.safePage);const last=Math.max(0,this.pageCount-1),next=finiteInteger(requested,this.safePage,0,last);this.page=next,this.emit("lr-page-change",Object.freeze({page:next,pageSize:this.safePageSize}))}handleSearchTermChange(){this.applySearchTermChange(this.searchTerm)}applySearchTermChange(value){const next=typeof value=="string"?value:valueControl(value?.currentTarget)?.value??this.searchTerm;this.searchTerm=next,this.page!==0&&(this.page=0)}pinColumn(columnId2,side){if(!this.orderedColumns.some(({id})=>id===columnId2))return;const next=new Map(this.columnPinning);next.set(columnId2,side),this.columnPinning=next}async reload(){const owner=this.ownerDocument.defaultView;!this.isConnected||!owner||!this.usesServerData||(this.cancelRequestTimer(),await this.loadServerData(owner))}resetColumns(){this.columnOrder=[],this.columnWidths=new Map,this.columnVisibility=new Map,this.columnPinning=new Map}resetState(){this.resetColumns(),this.sort=[],this.filters=[],this.searchTerm="",this.expandedKeys=[]}scrollToIndex(index,options={}){this.pendingVirtualScroll=void 0,this.pendingMeasurementAnchor=void 0;const rows=this.getVisibleRows();if(rows.length===0)return;const requestedIndex=finiteInteger(index,0,0,rows.length-1),requestedRow=rows[requestedIndex],sourceIndexes=this.sourceIndexMap(),sourceIndex=this.sourceIndexFor(requestedRow,sourceIndexes),requestedKey=this.keyForRow(requestedRow,sourceIndex??requestedIndex),items=this.displayItems,target=items.findIndex(item=>item.kind==="row"&&(item.row===requestedRow||keysEqual(item.key,requestedKey)));if(target<0)return;const body=this.bodyElement;if(!body)return;this.recordMeasurementRowHeight()&&this.invalidateRowMeasurements()&&this.queueMeasurementUpdate();const rendered=this.renderRoot?.querySelector(`[part~="row"][data-visible-index="${target}"]`),rowHeight=this.displayItemHeight(target,items),rowTop=this.displayItemOffset(target,items),currentTop=finiteRange(body.scrollTop,this.bodyScrollTop,0),viewportHeight=finiteRange(body.clientHeight,0,0),alignment=options.align??(rendered?"nearest":"start");let top=rowTop;if(alignment==="center")top-=(viewportHeight-rowHeight)/2;else if(alignment==="end")top-=viewportHeight-rowHeight;else if(alignment==="nearest"){const rowBottom=rowTop+rowHeight;rowTop>=currentTop&&rowBottom<=currentTop+viewportHeight?top=currentTop:rowTop<currentTop?top=rowTop:top=rowBottom-viewportHeight}const maximumTop=Math.max(0,this.displayItemOffset(items.length,items)-viewportHeight);if(top=finiteRange(top,0,0,maximumTop),this.lastMeasurementAnchor=this.measurementAnchorAtOffset(top,items),rendered){rendered.scrollIntoView({block:options.align??"nearest"});return}const targetItem=items[target];targetItem&&(this.pendingVirtualScroll=Object.freeze({itemKey:displayItemKey(targetItem),align:alignment})),this.expectedBodyScroll=Object.freeze({body,top}),this.bodyScrollTop=top,body.scrollTo({top})}setState(state2){const known=new Set(this.columns.map((column,index)=>columnId(column,index)));state2.order&&(this.columnOrder=state2.order.filter(id=>known.has(id))),state2.widths&&(this.columnWidths=this.validColumnMap(state2.widths,known,width=>finiteRange(width,0,0))),state2.visibility&&(this.columnVisibility=this.validColumnMap(state2.visibility,known,Boolean)),state2.pinning&&(this.columnPinning=this.validColumnMap(state2.pinning,known,side=>side==="left"||side==="right"||side==="start"||side==="end"?side:!1)),state2.sort&&(this.sort=state2.sort.filter(item=>known.has(item.id)).map(item=>({id:item.id,desc:!!item.desc}))),state2.filters&&(this.filters=state2.filters.filter(item=>known.has(item.id)).map(item=>({...item}))),state2.search!==void 0&&(this.searchTerm=state2.search);const selectedRowKeys=state2.selectedRowKeys??state2.selectedKeys,expandedRowKeys=state2.expandedRowKeys??state2.expandedKeys;selectedRowKeys&&(this.selectedRowKeys=selectedRowKeys),expandedRowKeys&&(this.expandedRowKeys=expandedRowKeys),state2.page!==void 0&&(this.page=finiteCount(state2.page)),state2.pageSize!==void 0&&(this.pageSize=finiteCount(state2.pageSize))}sizeColumnsToFit(){const body=this.bodyElement;if(!body||this.visibleColumns.length===0)return;const selectionWidth=this.selectionEnabled?resolveCssLength(this.computedToken("--lr-icon-button-size"),{host:this})??0:0,visible=this.visibleColumns,flexible=visible.filter(({column})=>finiteRange(column.flex??1,1,0)>0);if(flexible.length===0)return;const measuredWidths=new Map([...this.renderRoot.querySelectorAll('[role="columnheader"][data-column-id]')].map(header=>[header.dataset.columnId,resolveCssLength(this.ownerDocument.defaultView?.getComputedStyle(header).width??"",{host:this})??0])),fixedWidth=visible.reduce((total,{column,id})=>{if(finiteRange(column.flex??1,1,0)>0)return total;const bounds=this.columnBounds(column),explicit=this.columnWidths.get(id)??column.width,fallback=explicit!==void 0&&explicit>0?this.estimatedColumnWidth(column,id):Number.isFinite(column.maxWidth)&&(column.maxWidth??0)>0?bounds.maximum:bounds.minimum||this.estimatedColumnWidth(column,id);return total+finiteRange(measuredWidths.get(id)||fallback,fallback,0)},0),available=Math.max(0,body.clientWidth-selectionWidth-fixedWidth),flexValues=flexible.map(({column})=>finiteRange(column.flex??1,1,0)),flexScale=flexValues.reduce((largest,value)=>Math.max(largest,value),0),scaledFlex=flexValues.map(value=>flexScale>0?value/flexScale:value),totalFlex=scaledFlex.reduce((sum,value)=>sum+value,0)||flexible.length,next=new Map(this.columnWidths);for(const[index,{column,id}]of flexible.entries()){const share=available*((scaledFlex[index]??0)/totalFlex),{minimum,maximum}=this.columnBounds(column);next.set(id,finiteRange(share,minimum,minimum,maximum))}this.columnWidths=next}toggleColumn(columnId2,visible){if(!this.orderedColumns.some(({id})=>id===columnId2))return;const next=new Map(this.columnVisibility);next.set(columnId2,visible),this.columnVisibility=next,this.focusedColumn=finiteInteger(this.focusedColumn,0,0,Math.max(0,this.visibleColumns.length-1))}validColumnMap(record,known,convert){const result=new Map;for(const[id,value]of Object.entries(record))known.has(id)&&result.set(id,convert(value));return result}delimitedRows(rows,options){const active=this.visibleColumns.map(({column,id})=>({...column,id,value:row=>{const raw=columnValue(column,row),formatted=column.formatter?.(raw,row);return typeof formatted=="string"?formatted:raw},hidden:!1}));return rowsAsDelimited(rows,active,options)}async copyAndReport(text){const owner=this.isConnected?this.ownerDocument.defaultView:null,outcome=await this.writeClipboard(text,owner);if(!(!owner||!this.isConnected||this.ownerDocument.defaultView!==owner)){if(outcome.ok){this.isMounting||this.announce(this.localize("copied")),this.emit("lr-copy",outcome);return}this.isMounting||this.announce(this.localize("copyFailed")),this.emit("lr-error"),this.emit("lr-copy-error",outcome)}}async writeClipboard(text,owner){const ownerDocument=this.ownerDocument,outcome=await writeClipboardText(owner,text);if(outcome.ok||!owner||ownerDocument.defaultView!==owner||!ownerDocument.body)return outcome;const textarea=ownerDocument.createElement("textarea");textarea.value=text,textarea.style.position="fixed",textarea.style.opacity="0",ownerDocument.body.append(textarea);try{if(textarea.select(),ownerDocument.execCommand?.("copy"))return Object.freeze({ok:!0,text})}finally{textarea.remove()}return outcome}setColumnWidth(columnIdValue,width,emit,finished=!0){const entry=this.orderedColumns.find(({id})=>id===columnIdValue);if(!entry)return;const{minimum,maximum}=this.columnBounds(entry.column),safeWidth=finiteRange(width,minimum,minimum,maximum),next=new Map(this.columnWidths);next.set(columnIdValue,safeWidth),this.columnWidths=next,emit&&this.emit("lr-column-resize",Object.freeze({columnId:columnIdValue,width:safeWidth,finished}))}cancelRequestTimer(){const timer=this.requestTimer;this.requestTimer=void 0,timer&&timer.owner.clearTimeout(timer.handle)}scheduleServerRequest(delayed){const owner=this.ownerDocument.defaultView;if(!this.isConnected||!owner||!this.usesServerData)return;this.cancelRequestTimer();const delay=delayed?finiteDuration(this.filterDebounce,250):0;let handle=0;handle=owner.setTimeout(()=>{this.requestTimer?.owner!==owner||this.requestTimer.handle!==handle||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.requestTimer=void 0,this.loadServerData(owner))},delay),this.requestTimer={owner,handle}}async loadServerData(owner){if(!this.isConnected||this.ownerDocument.defaultView!==owner||!this.usesServerData)return;this.requestController?.abort();const AbortControllerCtor=owner.AbortController;this.requestController=typeof AbortControllerCtor=="function"?new AbortControllerCtor:void 0;const generation=++this.requestGeneration,request=Object.freeze({sort:frozenArray(this.sort.map(item=>Object.freeze({...item}))),filters:frozenArray(this.filters.map(item=>Object.freeze({id:item.id,value:serializableFilterValue(item.value)}))),search:this.searchTerm,page:this.safePage,pageSize:this.safePageSize,signal:this.requestController?.signal}),requestDetail=()=>Object.freeze({...request,sort:frozenArray(request.sort.map(item=>Object.freeze({...item}))),filters:frozenArray(request.filters.map(item=>Object.freeze({id:item.id,value:serializableFilterValue(item.value)})))});if(this.emit("request",requestDetail()),!!this.dataSource){this.ownsLoadingState=!0,this.loading=!0;try{const response=await this.dataSource(request);if(generation!==this.requestGeneration||request.signal?.aborted||!this.isConnected||this.ownerDocument.defaultView!==owner)return;this.data=Array.isArray(response.rows)?response.rows:[],this.total=finiteCount(response.total),this.loading=!1,this.ownsLoadingState=!1}catch(error){if(generation!==this.requestGeneration||request.signal?.aborted||!this.isConnected||this.ownerDocument.defaultView!==owner)return;this.loading=!1,this.ownsLoadingState=!1,this.emit("lr-data-error",Object.freeze({error,request:requestDetail()}))}}}get selectionMode(){return this.selectable===""||this.selectable==="multiple"?"multiple":this.selectable}get selectionEnabled(){return this.selectionMode!=="none"}get ariaColumnCount(){return Math.max(1,this.visibleColumns.length+(this.selectionEnabled?1:0))}rowIsSelectable(row){return this.selectionEnabled&&(this.selectableRows?.(row)??!0)}rowMatches(row){return filterRows([row],this.columns,this.filters,this.effectiveLocale).length>0&&searchRows([row],this.columns,this.searchTerm,this.effectiveLocale,this.searchFn).length>0}processedChildrenFor(row){const children=this.canonicalMembers(this.childrenFor(row));if(children.length===0||this.usesServerData)return children;const included=children.filter(child=>this.rowMatches(child)?!0:this.filterFromLeafRows&&this.hasMatchingDescendant(child));return sortRows(included,this.columns,this.sort,this.effectiveLocale)}hasMatchingDescendant(row){const stack=this.canonicalMembers(this.childrenFor(row)).map(child=>({row:child,depth:1})),visited=new Set;let inspected=0;for(;stack.length>0&&inspected<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(!(trackIdentity&&visited.has(current.row))){if(trackIdentity&&visited.add(current.row),inspected+=1,this.rowMatches(current.row))return!0;if(!(current.depth>=DATA_GRID_TREE_DEPTH_LIMIT))for(const child of this.canonicalMembers(this.childrenFor(current.row)))stack.push({row:child,depth:current.depth+1})}}return!1}get pageRows(){return this.getVisibleRows()}get currentPageSelectableRows(){const result=[],sourceIndex=new Map(this.allSourceRows.map((row,index)=>[row,index])),visited=new Set,stack=[...this.pageRows].reverse().map(row=>({row,depth:0}));let inspected=0;for(;stack.length>0&&inspected<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(trackIdentity&&visited.has(current.row))continue;trackIdentity&&visited.add(current.row),inspected+=1;const index=this.sourceIndexFor(current.row,sourceIndex);if(index===void 0)continue;const key=this.keyForRow(current.row,index);if(this.rowIsSelectable(current.row)&&result.push({row:current.row,key}),current.depth>=DATA_GRID_TREE_DEPTH_LIMIT)continue;const children=this.canonicalMembers(this.childrenFor(current.row));for(let childIndex=children.length-1;childIndex>=0;childIndex-=1){const child=children[childIndex];stack.push({row:child,depth:current.depth+1})}}return result}groupMemberKey(rows){let first;for(const row of rows){const identity=this.rowIdentity(row);if(identity===void 0)continue;const candidate=`${typeof identity}:${safeText(identity)}`;(first===void 0||candidate<first)&&(first=candidate)}return first??"unknown"}groupKey(parent,id,value,rows){const valueType=typeof value;return valueType==="object"&&value!==null||valueType==="function"?`group:${parent}:${id}:${valueType}:member:${this.groupMemberKey(rows)}`:`group:${parent}:${id}:${valueType}:${safeText(value)}`}topLevelGroupBuckets(rows){const field=normalizedGroupBy(this.groupBy)[0];if(!field)return[];const entry=this.orderedColumns.find(({id,column})=>id===field||column.field===field);if(!entry)return[];const buckets=new Map;for(const row of rows){const value=columnValue(entry.column,row),bucket=buckets.get(value)??[];bucket.push(row),buckets.set(value,bucket)}return[...buckets].map(([value,bucketRows])=>({value,rows:bucketRows}))}groupItems(rows){const fields=normalizedGroupBy(this.groupBy);if(fields.length===0||this.usesServerData)return[];const result=[],visit=(groupRows,depth,parent)=>{const field=fields[depth];if(!field)return;const entry=this.orderedColumns.find(({id,column})=>id===field||column.field===field);if(!entry)return;const buckets=new Map;for(const row of groupRows){const value=columnValue(entry.column,row),bucket=buckets.get(value)??[];bucket.push(row),buckets.set(value,bucket)}for(const[value,bucket]of buckets){const key=this.groupKey(parent,entry.id,value,bucket);result.push({kind:"group",key,value,columnId:entry.id,rows:bucket,depth}),depth+1<fields.length&&visit(bucket,depth+1,key)}};return visit(rows,0,"root"),result}get displayItems(){const groups=normalizedGroupBy(this.groupBy);if(groups.length>0&&!this.usesServerData)return this.groupedDisplayItems(this.pageRows,groups,0,"root",this.sourceIndexMap());const result=[],sourceRows=this.allSourceRows,indexes=this.sourceIndexMap(sourceRows),visited=new Set,stack=[...this.pageRows].reverse().map(row=>({row,depth:0}));for(;stack.length>0&&result.length<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(trackIdentity&&visited.has(current.row))continue;trackIdentity&&visited.add(current.row);const sourceIndex=this.sourceIndexFor(current.row,indexes);if(sourceIndex===void 0)continue;const safeIndex=sourceIndex,key=this.keyForRow(current.row,safeIndex);if(result.push({kind:"row",row:current.row,key,depth:current.depth,sourceIndex:safeIndex}),!arrayHasKey(this.expandedKeys,key)||current.depth>=DATA_GRID_TREE_DEPTH_LIMIT)continue;const children=this.processedChildrenFor(current.row);for(let index=children.length-1;index>=0;index-=1)stack.push({row:children[index],depth:current.depth+1})}return result}groupedDisplayItems(rows,fields,depth,parent,sourceIndexes){const field=fields[depth];if(!field)return[];const entry=this.orderedColumns.find(({id,column})=>id===field||column.field===field);if(!entry)return rows.map((row,index)=>({kind:"row",row,key:this.keyForRow(row,this.sourceIndexFor(row,sourceIndexes)??index),depth,sourceIndex:this.sourceIndexFor(row,sourceIndexes)??index}));const buckets=new Map;for(const row of rows){const value=columnValue(entry.column,row),bucket=buckets.get(value)??[];bucket.push(row),buckets.set(value,bucket)}const result=[];for(const[value,bucket]of buckets){const key=this.groupKey(parent,entry.id,value,bucket);if(result.push({kind:"group",key,value,columnId:entry.id,rows:bucket,depth}),!!arrayHasKey(this.expandedKeys,key))if(depth+1<fields.length)result.push(...this.groupedDisplayItems(bucket,fields,depth+1,key,sourceIndexes));else for(const row of bucket){const sourceIndex=this.sourceIndexFor(row,sourceIndexes);result.push({kind:"row",row,key:this.keyForRow(row,sourceIndex??result.length),depth:depth+1,sourceIndex:sourceIndex??result.length})}}return result}measurementSignature(items){return items.map(item=>{const key=displayItemKey(item);return`${key.length}:${key}`}).join("|")}invalidateRowMeasurements(){const anchor=this.lastMeasurementAnchor??this.captureMeasurementAnchor();return this.measuredItemHeights.size===0?(this.measuredItemOffsetsDirty=!0,!1):(anchor&&(this.pendingMeasurementAnchor=anchor),this.measuredItemHeights.clear(),this.measuredItemOffsetsDirty=!0,!0)}reconcileRowMeasurementCache(changed){const items=this.displayItems,signature=this.measurementSignature(items),locale=this.effectiveLocale,changedGeometry=["columns","columnOrder","columnVisibility","columnWidths","data","filters","searchTerm","sort","expandedKeys","groupBy","page","pageSize","paginate","childRows","rowDetail","rowClass","selectable","strings"].some(property2=>changed.has(property2)),localeChanged=this.measurementLocale!==""&&this.measurementLocale!==locale,structureChanged=this.measurementDisplaySignature!==""&&this.measurementDisplaySignature!==signature,rowHeightChanged=this.recordMeasurementRowHeight();(changedGeometry||localeChanged||structureChanged||rowHeightChanged)&&this.invalidateRowMeasurements(),this.measurementLocale=locale,this.measurementDisplaySignature=signature}recordMeasurementRowHeight(){const height=this.resolvedRowHeight,previous=this.measurementRowHeight,fontSignature=this.currentMeasurementFontSignature(),fontChanged=this.measurementFontSignature!==""&&this.measurementFontSignature!==fontSignature;return this.measurementRowHeight=height,this.measurementFontSignature=fontSignature,previous!==void 0&&previous!==height||fontChanged}currentMeasurementFontSignature(){if(!this.isConnected)return"";const owner=this.ownerDocument?.defaultView;if(!owner||typeof owner.getComputedStyle!="function")return"";try{const style=owner.getComputedStyle(this),cell=this.renderRoot?.querySelector('[part~="cell"], [part~="header-cell"], [part="group-value"]'),cellStyle=cell?owner.getComputedStyle(cell):void 0,cellPadding=cellStyle?[cellStyle.paddingBlockStart,cellStyle.paddingBlockEnd,cellStyle.paddingInlineStart,cellStyle.paddingInlineEnd].join(","):this.computedToken("--cell-padding","--_lr-data-grid-cell-padding");return[style.fontFamily,style.fontSize,style.fontStretch,style.fontStyle,style.fontWeight,style.letterSpacing,style.lineHeight,style.wordSpacing,cellPadding].join("\0")}catch{return""}}recordMeasuredBodyWidth(width){if(typeof width!="number"||!Number.isFinite(width)||width<0)return!1;const previous=this.measuredBodyWidth;return this.measuredBodyWidth=width,previous===void 0||previous===width?!1:(this.invalidateRowMeasurements(),!0)}syncMeasuredBodyWidth(){const body=this.bodyElement;body&&(this.syncBodyScrollbarInlineEndGutter(body),this.recordMeasuredBodyWidth(body.clientWidth)&&this.queueMeasurementUpdate())}syncBodyScrollbarInlineEndGutter(body){const scrollbarGutter=finiteRange(body.offsetWidth-body.clientWidth,0,0);if(this.bodyScrollbarInlineEndGutter===scrollbarGutter)return;this.bodyScrollbarInlineEndGutter=scrollbarGutter;const value=`${scrollbarGutter}px`;this.renderRoot.querySelectorAll('[part="header"], [part="footer-row"]').forEach(element=>element.style.setProperty("--data-grid-body-inline-end-gutter",value))}queueMeasurementUpdate(){if(this.measurementUpdateQueued)return;this.measurementUpdateQueued=!0;const owner=this.ownerDocument.defaultView;(owner?.queueMicrotask?.bind(owner)??queueMicrotask)(()=>{this.measurementUpdateQueued=!1,this.isConnected&&this.requestUpdate()})}queueMeasuredScrollTop(body){if(this.measurementScrollSyncQueued)return;this.measurementScrollSyncQueued=!0;const owner=body.ownerDocument.defaultView;(owner?.queueMicrotask?.bind(owner)??queueMicrotask)(()=>{if(this.measurementScrollSyncQueued=!1,!this.isConnected||this.bodyElement!==body)return;const next=finiteRange(body.scrollTop,this.bodyScrollTop,0);this.bodyScrollTop!==next&&(this.bodyScrollTop=next),this.lastMeasurementAnchor=this.captureMeasurementAnchor()})}queueBodyScrollStateSync(){if(this.bodyScrollStateSyncQueued)return;this.bodyScrollStateSyncQueued=!0;const owner=this.ownerDocument.defaultView;(owner?.queueMicrotask?.bind(owner)??queueMicrotask)(()=>{this.bodyScrollStateSyncQueued=!1,this.isConnected&&this.syncBodyScrollState()})}resetRowMeasurementObserver(){this.rowMeasurementObserver?.disconnect(),this.rowMeasurementObserver=void 0,this.rowMeasurementObserverOwner=void 0,this.rowMeasurementObserverBody=void 0,this.observedMeasurementElements.clear();const invalidated=this.invalidateRowMeasurements();this.lastMeasurementAnchor=void 0,invalidated&&this.isConnected&&this.queueMeasurementUpdate()}syncRowMeasurementObserver(){const body=this.bodyElement,owner=body?.ownerDocument.defaultView;if(!body||!owner||!this.isConnected||!owner.ResizeObserver){this.resetRowMeasurementObserver();return}if(this.rowMeasurementObserverOwner!==owner||this.rowMeasurementObserverBody!==body||!this.rowMeasurementObserver){this.resetRowMeasurementObserver();const observer2=new owner.ResizeObserver(entries=>{if(!(this.rowMeasurementObserver!==observer2||this.rowMeasurementObserverOwner!==owner||this.rowMeasurementObserverBody!==body||!this.isConnected||this.ownerDocument.defaultView!==owner)){this.syncBodyScrollState(body);for(const entry of entries){if(entry.target!==body)continue;this.syncBodyScrollbarInlineEndGutter(body);const width=entry.borderBoxSize?.[0]?.inlineSize??entry.contentRect.width;if(this.recordMeasuredBodyWidth(width)){this.queueMeasurementUpdate();return}}this.measureRenderedItems()}});this.rowMeasurementObserver=observer2,this.rowMeasurementObserverOwner=owner,this.rowMeasurementObserverBody=body,observer2.observe(body)}const observer=this.rowMeasurementObserver;if(!observer)return;const current=new Map;this.renderRoot.querySelectorAll("[data-virtual-item-key], [data-virtual-item-detail-for]").forEach(element=>{const key=element.dataset.virtualItemKey??element.dataset.virtualItemDetailFor;key&&current.set(element,key)});for(const element of this.observedMeasurementElements.keys())current.has(element)||(observer.unobserve(element),this.observedMeasurementElements.delete(element));for(const[element,key]of current)this.observedMeasurementElements.get(element)!==key&&(this.observedMeasurementElements.has(element)&&observer.unobserve(element),this.observedMeasurementElements.set(element,key),observer.observe(element))}displayItemOffsets(items){const signature=this.measurementSignature(items),estimate=this.resolvedRowHeight;if(!this.measuredItemOffsetsDirty&&this.measuredItemOffsetSignature===signature&&this.measuredItemOffsetEstimate===estimate)return this.measuredItemOffsets;const offsets=new Array(items.length+1);offsets[0]=0;for(let index=0;index<items.length;index+=1){const measured=this.measuredItemHeights.get(displayItemKey(items[index])),height=finiteRange(measured??estimate,estimate,1,Number.MAX_SAFE_INTEGER);offsets[index+1]=Math.min(Number.MAX_SAFE_INTEGER,offsets[index]+height)}return this.measuredItemOffsets=Object.freeze(offsets),this.measuredItemOffsetSignature=signature,this.measuredItemOffsetEstimate=estimate,this.measuredItemOffsetsDirty=!1,this.measuredItemOffsets}displayItemOffset(index,items){const offsets=this.displayItemOffsets(items),clamped=finiteInteger(index,0,0,items.length);return offsets[clamped]??0}displayItemHeight(index,items){const offsets=this.displayItemOffsets(items);return index<0||index>=items.length?0:Math.max(0,(offsets[index+1]??0)-(offsets[index]??0))}displayItemIndexAtOffset(offset,items){if(items.length===0)return-1;const target=finiteRange(offset,0,0,Number.MAX_SAFE_INTEGER),offsets=this.displayItemOffsets(items);let low=0,high=items.length-1;for(;low<high;){const middle=low+Math.floor((high-low)/2);(offsets[middle+1]??0)<=target?low=middle+1:high=middle}return low}captureMeasurementAnchor(){const body=this.bodyElement,items=this.displayItems;if(!body||items.length===0)return;const scrollTop=finiteRange(body.scrollTop,this.bodyScrollTop,0);return this.measurementAnchorAtOffset(scrollTop,items)}measurementAnchorAtOffset(scrollTop,items){if(items.length===0)return;const index=this.displayItemIndexAtOffset(scrollTop,items),item=items[index];if(!item)return;const offset=Math.max(0,scrollTop-this.displayItemOffset(index,items)),height=this.displayItemHeight(index,items);if(index+1<items.length&&height>1&&offset>=height-1){const next=items[index+1];return Object.freeze({itemKey:displayItemKey(next),offset:0})}return Object.freeze({itemKey:displayItemKey(item),offset})}correctMeasurementAnchor(){const anchor=this.pendingMeasurementAnchor,body=this.bodyElement;if(!anchor||!body)return;const items=this.displayItems,index=items.findIndex(item=>displayItemKey(item)===anchor.itemKey);if(this.pendingMeasurementAnchor=void 0,index<0){this.lastMeasurementAnchor=void 0;return}const next=Math.max(0,this.displayItemOffset(index,items)+anchor.offset);this.expectedBodyScroll=Object.freeze({body,top:next}),body.scrollTop=next,this.lastMeasurementAnchor=anchor,this.queueMeasuredScrollTop(body)}measureRenderedItems(){const rowHeightChanged=this.recordMeasurementRowHeight();rowHeightChanged&&this.invalidateRowMeasurements();const grouped=new Map;if(this.renderRoot.querySelectorAll("[data-virtual-item-key], [data-virtual-item-detail-for]").forEach(element=>{const key=element.dataset.virtualItemKey??element.dataset.virtualItemDetailFor;if(!key)return;const entries=grouped.get(key)??[];entries.push(element),grouped.set(key,entries)}),grouped.size===0){rowHeightChanged&&this.queueMeasurementUpdate();return}const anchor=this.captureMeasurementAnchor();let changed=!1;for(const[key,elements]of grouped){let height=0,measurable=!0;for(const element of elements){let next;try{next=element.getBoundingClientRect().height}catch{measurable=!1;break}if(!Number.isFinite(next)||next<=0){measurable=!1;break}height+=next}if(!measurable||!Number.isFinite(height)||height<=0)continue;const previous=this.measuredItemHeights.get(key),estimate=this.resolvedRowHeight;if(Math.abs(estimate-height)<=1){previous!==void 0&&(this.measuredItemHeights.delete(key),changed=!0);continue}previous!==void 0&&Math.abs(previous-height)<=1||(this.measuredItemHeights.set(key,height),changed=!0)}if(!changed){rowHeightChanged&&this.queueMeasurementUpdate();return}this.measuredItemOffsetsDirty=!0,anchor&&this.pendingMeasurementAnchor===void 0&&(this.pendingMeasurementAnchor=anchor),this.queueMeasurementUpdate()}alignPendingVirtualScroll(){const pending=this.pendingVirtualScroll;if(!pending||this.measurementUpdateQueued||this.pendingMeasurementAnchor!==void 0)return;if(!this.displayItems.some(item=>displayItemKey(item)===pending.itemKey)){this.pendingVirtualScroll=void 0;return}const target=[...this.renderRoot.querySelectorAll('[part~="row"][data-virtual-item-key]')].find(element=>element.dataset.virtualItemKey===pending.itemKey);target&&(this.pendingVirtualScroll=void 0,target.scrollIntoView({block:pending.align}),this.queueBodyScrollStateSync())}get resolvedRowHeight(){const raw=this.computedToken("--row-height","--_lr-data-grid-row-height");return finiteRange(resolveCssLength(raw,{host:this})??56,56,1)}get virtualWindow(){const items=this.displayItems,expandedDetails=!!(this.rowDetail&&items.some(item=>item.kind==="row"&&arrayHasKey(this.expandedKeys,item.key)));if(items.length<VIRTUALIZATION_THRESHOLD||expandedDetails||this.computedToken("--max-height","--_lr-data-grid-max-height")==="none")return{items,allItems:items,start:0,end:items.length};const height=this.resolvedRowHeight,viewport=Math.max(height,this.viewportHeight||height*10),firstVisible=this.displayItemIndexAtOffset(this.bodyScrollTop,items),lastVisible=this.displayItemIndexAtOffset(this.bodyScrollTop+viewport,items),start=Math.max(0,firstVisible-VIRTUAL_OVERSCAN),end=Math.min(items.length,lastVisible+VIRTUAL_OVERSCAN+1);return{items:items.slice(start,end),allItems:items,start,end}}get gridTemplate(){const columns=this.visibleColumns.map(({column,id})=>{const bounds=this.columnBounds(column),width=this.columnWidths.get(id)??column.width;if(width!==void 0&&Number.isFinite(width)&&width>0)return`${finiteRange(width,bounds.minimum,bounds.minimum,bounds.maximum)}px`;const minimum=bounds.minimum>0?`${bounds.minimum}px`:Number.isFinite(column.maxWidth)&&(column.maxWidth??0)>0?"0px":"var(--lr-size-7rem)",maximum=Number.isFinite(column.maxWidth)&&(column.maxWidth??0)>0?`${bounds.maximum}px`:`${finiteRange(column.flex??1,1,0)}fr`;return`minmax(${minimum}, ${maximum})`});return this.selectionEnabled&&columns.unshift("var(--lr-icon-button-size)"),columns.length>0?columns.join(" "):"minmax(var(--lr-size-7rem), 1fr)"}get bodyScrollTranslation(){const logical=finiteRange(this.bodyScrollInlineOffset,0,0,Number.MAX_SAFE_INTEGER);return`${this.effectiveDirection==="rtl"?logical:-logical}px`}columnStyle(column,id){const side=normalizePinSide(this.getColumnPin(id)),pinOffset=side?this.pinOffset(id,side):0;return{...side?{"--pin-offset":`${pinOffset}px`}:{},...Number.isFinite(column.width)&&(column.width??0)>0&&!this.columnWidths.has(id)?{"--column-authored-width":`${column.width}px`}:{}}}estimatedColumnWidth(column,id){const{minimum,maximum}=this.columnBounds(column),explicit=this.columnWidths.get(id)??column.width;if(explicit!==void 0)return finiteRange(explicit,Math.max(112,minimum),minimum,maximum);const raw=this.computedToken("--lr-size-7rem");return finiteRange(resolveCssLength(raw,{host:this})??112,Math.max(112,minimum),minimum,maximum)}columnBounds(column){const minimum=finiteRange(column.minWidth??0,0,0),authoredMaximum=finiteRange(column.maxWidth??Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,0);return Object.freeze({minimum,maximum:Math.max(minimum,authoredMaximum)})}pinOffset(id,side){const entries=this.visibleColumns,index=entries.findIndex(entry=>entry.id===id);return index<0?0:(side==="left"?entries.slice(0,index):entries.slice(index+1)).filter(entry=>normalizePinSide(this.getColumnPin(entry.id))===side).reduce((sum,entry)=>sum+this.estimatedColumnWidth(entry.column,entry.id),0)}columnLabel(column,id){return column.label??humanizeIdentifier(column.field??id,this.effectiveLocale)}columnIsSortable(column){return column.sortable!==!1&&!!(column.field||column.value)}sortFor(id){const index=this.sort.findIndex(item=>item.id===id);return{state:index>=0?this.sort[index]:void 0,index}}activateSort(id,additive){const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnIsSortable(entry.column))return;const existing=this.sortFor(id).state,descendingFirst=entry.column.sortDescFirst??this.sortDescFirst;let replacement;existing?existing.desc===descendingFirst?replacement={id,desc:!descendingFirst}:this.withoutSortRemoval&&(replacement={id,desc:descendingFirst}):replacement={id,desc:descendingFirst};let next=additive?this.sort.filter(item=>item.id!==id):[];replacement&&next.push(replacement);const limit=finiteCount(this.maxMultiSort);limit>0&&next.length>limit&&(next=next.slice(next.length-limit)),this.sort=next,this.page=0,this.emit("lr-sort-change",Object.freeze({sort:frozenArray(this.sort.map(item=>Object.freeze({...item})))}))}onHeaderClick(event,id){const target=event.target,interactive=isElementValue(target)?target.closest(INTERACTIVE_SELECTOR):null;interactive&&interactive!==event.currentTarget||this.activateSort(id,event.shiftKey)}onFilterInput(event,id){const control=valueControl(event.currentTarget);if(!control)return;const value=control.value,next=this.filters.filter(filter=>filter.id!==id);value&&next.push({id,value}),this.filters=next,this.page=0,this.emit("lr-filter-change",Object.freeze({filters:frozenArray(next.map(filter=>Object.freeze({...filter})))}))}syncBodyScrollState(source=this.bodyElement){const target=source;if(!isElementValue(target)||typeof target.scrollTop!="number"||typeof target.clientHeight!="number"||typeof target.scrollLeft!="number")return;this.bodyScrollTop=finiteRange(target.scrollTop,this.bodyScrollTop,0),this.viewportHeight=finiteRange(target.clientHeight,this.viewportHeight,0);const inlineExtent=typeof target.scrollWidth=="number"&&typeof target.clientWidth=="number"&&Number.isFinite(target.scrollWidth)&&Number.isFinite(target.clientWidth)?Math.max(0,target.scrollWidth-target.clientWidth):Number.MAX_SAFE_INTEGER;this.bodyScrollInlineOffset=finiteRange(this.effectiveDirection==="rtl"?-target.scrollLeft:target.scrollLeft,0,0,inlineExtent)}onBodyScroll(event){const body=event.currentTarget;this.syncBodyScrollState(body);const expected=this.expectedBodyScroll;expected&&expected.body===body&&Math.abs(finiteRange(body.scrollTop,this.bodyScrollTop,0)-expected.top)<=1?this.expectedBodyScroll=void 0:(this.expectedBodyScroll=void 0,this.pendingMeasurementAnchor=void 0,this.pendingVirtualScroll=void 0),this.lastMeasurementAnchor=this.captureMeasurementAnchor()}onCellClick(event,item,column,columnIdValue,index){for(const target of event.composedPath()){if(target===event.currentTarget)break;if(isElementValue(target)&&target.matches(INTERACTIVE_SELECTOR))return}this.emit("lr-cell-click",Object.freeze({rowKey:item.key,columnId:columnIdValue,column,value:columnValue(column,item.row),row:item.row,index}))}emitCellContextMenu(originalEvent,item,column,columnIdValue,index){const detail=Object.freeze({rowKey:item.key,columnId:columnIdValue,column,value:columnValue(column,item.row),row:item.row,index,originalEvent});this.emit("lr-cell-contextmenu",detail,{cancelable:!0}).defaultPrevented&&originalEvent.preventDefault()}descendantRows(row){const result=[],visited=new Set,stack=this.canonicalMembers(this.childrenFor(row)).reverse().map(child=>({row:child,depth:1}));for(;stack.length>0&&result.length<DATA_GRID_TREE_NODE_LIMIT;){const current=stack.pop(),trackIdentity=typeof current.row=="object"&&current.row!==null||typeof current.row=="function";if(trackIdentity&&visited.has(current.row)||(trackIdentity&&visited.add(current.row),result.push(current.row),current.depth>=DATA_GRID_TREE_DEPTH_LIMIT))continue;const children=this.canonicalMembers(this.childrenFor(current.row));for(let index=children.length-1;index>=0;index-=1){const child=children[index];stack.push({row:child,depth:current.depth+1})}}return result}setRowSelected(item,selected,event){if(!this.rowIsSelectable(item.row))return;const selectableItems=this.displayItems.filter(candidate=>candidate.kind==="row"&&this.rowIsSelectable(candidate.row)),position=selectableItems.findIndex(candidate=>keysEqual(candidate.key,item.key));let affected=[item];if(event?.shiftKey&&this.selectionMode==="multiple"&&this.lastSelectedIndex>=0){const from=Math.min(this.lastSelectedIndex,position),to=Math.max(this.lastSelectedIndex,position);affected=selectableItems.slice(from,to+1)}const descendants=this.selectionMode==="multiple"?affected.flatMap(candidate=>this.descendantRows(candidate.row)).filter(row=>this.rowIsSelectable(row)):[],sourceIndexes=this.sourceIndexMap(),keys=[...affected.map(candidate=>candidate.key),...descendants.map((row,index)=>{const sourceIndex=this.sourceIndexFor(row,sourceIndexes);return this.keyForRow(row,sourceIndex??index)})];let next=this.selectionMode==="single"?[]:[...this.selectedKeys];for(const key of keys)next=next.filter(candidate=>!keysEqual(candidate,key)),selected&&next.push(key);this.selectedKeys=next,this.lastSelectedIndex=position,this.emitSelection()}selectCurrentPage(selected){const pageKeys=this.currentPageSelectableRows.map(item=>item.key);let next=this.selectedKeys.filter(key=>!pageKeys.some(pageKey=>keysEqual(pageKey,key)));selected&&(next=[...next,...pageKeys]),this.selectedKeys=next,this.emitSelection()}emitSelection(){const selectedRowKeys=frozenArray(this.selectedRowKeys),selectedRows=frozenArray(this.selectedRows);this.emit("lr-row-select",Object.freeze({selectedRowKeys,selectedKeys:selectedRowKeys,selectedRows}))}rowSelectionState(item){const own=arrayHasKey(this.selectedKeys,item.key);if(this.selectionMode!=="multiple")return{checked:own,indeterminate:!1};const descendants=this.descendantRows(item.row).filter(row=>this.rowIsSelectable(row));if(descendants.length===0)return{checked:own,indeterminate:!1};const sourceIndexes=this.sourceIndexMap(),selected=descendants.filter((row,index)=>{const sourceIndex=this.sourceIndexFor(row,sourceIndexes);return arrayHasKey(this.selectedKeys,this.keyForRow(row,sourceIndex??index))}).length,checked=own&&selected===descendants.length;return{checked,indeterminate:!checked&&(own||selected>0)}}toggleRowExpanded(item,emitUserEvent){const expanded=arrayHasKey(this.expandedKeys,item.key);expanded?this.collapseRow(item.key):this.expandRow(item.key),emitUserEvent&&this.emit(expanded?"lr-row-collapse":"lr-row-expand",Object.freeze({rowKey:item.key,key:item.key,row:item.row}))}toggleGroupExpanded(item){const expanded=arrayHasKey(this.expandedKeys,item.key);expanded?this.collapseRow(item.key):this.expandRow(item.key);const detail=Object.freeze({key:item.key,columnId:item.columnId,value:item.value,rows:frozenArray(item.rows)});this.emit(expanded?"lr-group-collapse":"lr-group-expand",detail)}moveColumn(id,delta,emitUserEvent){const order=this.orderedColumns.map(entry=>entry.id),from=order.indexOf(id);if(from<0)return;const to=finiteInteger(from+delta,from,0,order.length-1);from!==to&&(order.splice(from,1),order.splice(to,0,id),this.columnOrder=order,emitUserEvent&&this.emit("lr-column-move",Object.freeze({columnOrder:frozenArray(order),columnId:id,finished:!0})))}columnCanMove(id){const entry=this.orderedColumns.find(item=>item.id===id);return!!(entry&&(this.reorderable||entry.column.movable))}columnCanResize(id){const entry=this.orderedColumns.find(item=>item.id===id);return!!(entry&&(this.resizable||entry.column.resizable))}onDragStart(event,id){const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnCanMove(id)||!event.dataTransfer){event.preventDefault();return}const token=`${++this.columnDragSequence}:${id}`;this.columnDragSession=Object.freeze({sourceId:id,token}),event.dataTransfer.setData(DATA_GRID_DRAG_TYPE,token),event.dataTransfer.setData("text/plain",id),event.dataTransfer.effectAllowed="move",this.dragGhost=this.columnLabel(entry.column,id)}onDrop(event,targetId){event.preventDefault();const session=this.columnDragSession,token=event.dataTransfer?.getData(DATA_GRID_DRAG_TYPE),sourceId=session?.sourceId;if(this.columnDragSession=void 0,this.dragGhost="",!session||token!==session.token||!sourceId||sourceId===targetId||!this.columnCanMove(sourceId)||!this.columnCanMove(targetId))return;const order=this.orderedColumns.map(entry=>entry.id),source=order.indexOf(sourceId),target=order.indexOf(targetId);source<0||target<0||(order.splice(source,1),order.splice(target,0,sourceId),this.columnOrder=order,this.emit("lr-column-move",Object.freeze({columnOrder:frozenArray(order),columnId:sourceId,finished:!0})))}onResizeStart(event,id){const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnCanResize(id))return;const header=this.renderedColumnElements(id,"columnheader")[0];this.resizeSession={columnId:id,startClientX:event.clientX,startWidth:header?.getBoundingClientRect().width??this.estimatedColumnWidth(entry.column,id),initialStateWidth:this.columnWidths.get(id),pointerId:event.pointerId,moved:!1,direction:this.effectiveDirection},this.activeResizeColumn=id;try{event.currentTarget.setPointerCapture?.(event.pointerId)}catch{}event.preventDefault()}onResizeMove(event){const session=this.resizeSession;if(!session||event.pointerId!==session.pointerId)return;if(!this.columnCanResize(session.columnId)){this.resizeSession=void 0,this.activeResizeColumn=void 0,session.moved&&this.restoreResizeSession(session,!0);return}const direction=session.direction==="rtl"?-1:1;this.setColumnWidth(session.columnId,session.startWidth+(event.clientX-session.startClientX)*direction,!0,!1),session.moved=!0}takeResizeSession(event){const session=this.resizeSession;if(!(!session||event.pointerId!==session.pointerId)){this.resizeSession=void 0,this.activeResizeColumn=void 0;try{event.currentTarget.releasePointerCapture?.(event.pointerId)}catch{}return session}}restoreResizeSession(session,emit){const next=new Map(this.columnWidths);session.initialStateWidth===void 0?next.delete(session.columnId):next.set(session.columnId,session.initialStateWidth),this.columnWidths=next,emit&&this.emit("lr-column-resize",Object.freeze({columnId:session.columnId,width:session.startWidth,finished:!1}))}onResizeEnd(event){const session=this.takeResizeSession(event);if(!session)return;if(!this.columnCanResize(session.columnId)){session.moved&&this.restoreResizeSession(session,!0);return}const width=this.columnWidths.get(session.columnId)??session.startWidth;this.emit("lr-column-resize",Object.freeze({columnId:session.columnId,width,finished:!0}))}onResizeCancel(event){const session=this.takeResizeSession(event);!session||!session.moved||this.restoreResizeSession(session,!0)}onResizeKey(event,id){if(event.key!=="ArrowLeft"&&event.key!=="ArrowRight")return;const entry=this.orderedColumns.find(item=>item.id===id);if(!entry||!this.columnCanResize(id))return;const logical=(event.key==="ArrowRight"?1:-1)*(this.effectiveDirection==="rtl"?-1:1),current=this.columnWidths.get(id)??this.estimatedColumnWidth(entry.column,id);this.setColumnWidth(id,current+logical*10,!0,!0),event.preventDefault()}onPageSizeChange(event){const control=valueControl(event.currentTarget);control&&(this.pageSize=finiteCount(Number(control.value)),this.page=0,this.emit("lr-page-change",Object.freeze({page:0,pageSize:this.safePageSize})))}focusCell(row,column){const rowLimit=Math.max(-1,this.displayItems.length-1),columnLimit=Math.max(0,this.visibleColumns.length-1);this.focusedRow=finiteInteger(row,this.focusedRow,-1,rowLimit),this.focusedColumn=finiteInteger(column,this.focusedColumn,0,columnLimit);let pendingScrollTop;if(this.focusedRow>=0){const selector=`[role="gridcell"][data-row-position="${this.focusedRow}"]`;if(!this.renderRoot.querySelector(selector)){const top=this.displayItemOffset(this.focusedRow,this.displayItems);pendingScrollTop=top,this.bodyScrollTop=top,this.bodyElement&&(this.bodyElement.scrollTop=top)}}this.updateComplete.then(()=>{pendingScrollTop!==void 0&&this.bodyElement&&(this.bodyElement.scrollTop=pendingScrollTop),this.focus()})}onGridKeyDown(event,rowPosition,columnPosition,item,column,columnIdValue){const target=event.target;if(isElementValue(target)&&target!==event.currentTarget&&target.closest(INTERACTIVE_SELECTOR))return;const rtlMultiplier=this.effectiveDirection==="rtl"?-1:1;if((event.ctrlKey||event.metaKey)&&event.key.toLowerCase()==="a"&&this.selectionMode==="multiple"){this.selectCurrentPage(!0),event.preventDefault();return}if((event.ctrlKey||event.metaKey)&&event.key.toLowerCase()==="c"){this.copySelectedRows(),event.preventDefault();return}if(event.shiftKey&&event.key==="F10"&&item&&column&&columnIdValue){this.emitCellContextMenu(event,item,column,columnIdValue,rowPosition);return}const headerEntry=columnIdValue?this.orderedColumns.find(entry=>entry.id===columnIdValue):void 0;if(rowPosition<0&&columnIdValue&&headerEntry&&(this.reorderable||headerEntry.column.movable)&&event.shiftKey&&!event.altKey&&(event.key==="ArrowLeft"||event.key==="ArrowRight")){const delta=(event.key==="ArrowRight"?1:-1)*rtlMultiplier;this.moveColumn(columnIdValue,delta,!0),event.preventDefault();return}if(!(rowPosition<0&&columnIdValue&&headerEntry&&(this.resizable||headerEntry.column.resizable)&&event.altKey&&(this.onResizeKey(event,columnIdValue),event.defaultPrevented))){if(event.key==="ArrowLeft"||event.key==="ArrowRight"){const delta=(event.key==="ArrowRight"?1:-1)*rtlMultiplier;this.focusCell(rowPosition,columnPosition+delta),event.preventDefault()}else if(event.key==="ArrowUp")this.focusCell(rowPosition-1,columnPosition),event.preventDefault();else if(event.key==="ArrowDown")this.focusCell(rowPosition+1,columnPosition),event.preventDefault();else if(event.key==="Home")this.focusCell(event.ctrlKey||event.metaKey?-1:rowPosition,0),event.preventDefault();else if(event.key==="End")this.focusCell(event.ctrlKey||event.metaKey?this.displayItems.length-1:rowPosition,this.visibleColumns.length-1),event.preventDefault();else if(event.key==="PageUp"||event.key==="PageDown"){const delta=event.key==="PageDown"?this.safePageSize||10:-(this.safePageSize||10);this.focusCell(rowPosition+delta,columnPosition),event.preventDefault()}else if(event.key==="Enter")rowPosition<0&&columnIdValue?this.activateSort(columnIdValue,event.shiftKey):item&&column&&columnIdValue&&this.emit("lr-cell-click",Object.freeze({rowKey:item.key,columnId:columnIdValue,column,value:columnValue(column,item.row),row:item.row,index:rowPosition})),event.preventDefault();else if(event.key===" "&&item){const selected=!arrayHasKey(this.selectedKeys,item.key);this.setRowSelected(item,selected,event),event.preventDefault()}}}setGroupSelected(group,selected){const eligible=group.rows.filter(row=>this.rowIsSelectable(row)),sourceIndexes=this.sourceIndexMap(),groupKeys=eligible.map((row,index)=>{const sourceIndex=this.sourceIndexFor(row,sourceIndexes);return this.keyForRow(row,sourceIndex??index)});let next=this.selectedKeys.filter(key=>!groupKeys.some(groupKey=>keysEqual(groupKey,key)));selected&&(next=[...next,...groupKeys]),this.selectedKeys=next,this.emitSelection()}userPinColumn(id,side){this.pinColumn(id,side),this.emit("lr-column-pin",Object.freeze({columnId:id,side}))}userToggleColumn(id,visible){this.toggleColumn(id,visible),this.emit("lr-column-visibility-change",Object.freeze({columnId:id,visible}))}renderToolbar(){return!this.withSearch&&!this.withColumnsMenu?nothing:html`
2
2
  <div part="toolbar">
3
3
  ${this.withSearch?html`
4
4
  <input
@@ -11,7 +11,9 @@ export type LibraryDocumentFreshness='fresh'|'aging'|'stale';
11
11
  * `ChatMessage.timestamp`'s own `Date | string` shape from the same `src/ai/types.ts` module for
12
12
  * consistency across this component family.
13
13
  */
14
- export interface LibraryDocument extends DocumentRef{tags?:readonly string[];owner?:string;
14
+ export interface LibraryDocument extends DocumentRef{
15
+ /** Optional tags. An own undefined value is treated like omission. */
16
+ tags?:readonly string[];owner?:string;
15
17
  /** Last-updated timestamp. `Date | string` (ISO-8601), matching `ChatMessage.timestamp`. */
16
18
  updatedAt?:Date|string;freshness?:LibraryDocumentFreshness;}
17
19
  /** Column keys `sortKey` accepts. Not every column is sortable (`type`/`tags`/`select` are not). */
@@ -109,7 +111,8 @@ filter?:(document:LibraryDocument,query:string)=>boolean;
109
111
  sortKey:LibraryDocumentSortKey;
110
112
  /** Controlled canonical sort direction shared with `<lr-table>`. */
111
113
  sortDir:TableSortDirection;
112
- /** Controlled search query applied to document names, owners, and tags. */
114
+ /** Controlled search query applied to document names, owners, and tags. Removing the
115
+ * attribute clears filtering while retaining the native null property readback. */
113
116
  searchTerm:string;loading:boolean;
114
117
  /** Accessible name for the region and the inner grid. Defaults to the localized
115
118
  * `documentLibraryLabel` when unset. An explicitly empty string renders as an empty label
@@ -1,4 +1,4 @@
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}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{getDateTimeFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./document-library.styles.js";import{LYRA_DEFAULT_documentLibraryClearSelection,LYRA_DEFAULT_documentLibraryEmptyHeading,LYRA_DEFAULT_documentLibraryFilterByTag,LYRA_DEFAULT_documentLibraryFreshnessAging,LYRA_DEFAULT_documentLibraryFreshnessColumn,LYRA_DEFAULT_documentLibraryFreshnessFresh,LYRA_DEFAULT_documentLibraryFreshnessStale,LYRA_DEFAULT_documentLibraryLabel,LYRA_DEFAULT_documentLibraryNameColumn,LYRA_DEFAULT_documentLibraryNoMatchesHeading,LYRA_DEFAULT_documentLibraryOwnerColumn,LYRA_DEFAULT_documentLibrarySearchPlaceholder,LYRA_DEFAULT_documentLibrarySelectAll,LYRA_DEFAULT_documentLibrarySelectColumn,LYRA_DEFAULT_documentLibrarySelectDocument,LYRA_DEFAULT_documentLibrarySelectedCount,LYRA_DEFAULT_documentLibraryTagsColumn,LYRA_DEFAULT_documentLibraryTypeColumn,LYRA_DEFAULT_documentLibraryUpdatedColumn,LYRA_DEFAULT_documentLibraryVersionColumn}from"../../../internal/default-strings.generated.js";const FRESHNESS_RANK={fresh:0,aging:1,stale:2},MAX_LIBRARY_COLLECTION_ENTRIES=1e4,INVALID_DOCUMENT_DATE=Symbol("invalid-document-date"),FRESHNESS_TONE={fresh:"success",aging:"warning",stale:"danger"};function projectLibraryStringArray(value){try{if(!Array.isArray(value))return;const length=getOwnDataDescriptor(value,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return;const tags=[];for(let index=0;index<Math.min(length.value,MAX_LIBRARY_COLLECTION_ENTRIES);index+=1){const entry=getOwnDataDescriptor(value,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR||typeof entry.value!="string")return;tags.push(entry.value)}return Object.freeze(tags)}catch{return}}function projectLibraryDate(value){if(typeof value=="string")return value;if(typeof value=="number")return new Date(value);try{return new Date(Date.prototype.getTime.call(value))}catch{return INVALID_DOCUMENT_DATE}}function projectLibraryDocument(candidate){try{if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))return;const id=getOwnDataDescriptor(candidate,"id"),name=getOwnDataDescriptor(candidate,"name"),mimeType=getOwnDataDescriptor(candidate,"mimeType"),uri=getOwnDataDescriptor(candidate,"uri"),version=getOwnDataDescriptor(candidate,"version"),tags=getOwnDataDescriptor(candidate,"tags"),owner=getOwnDataDescriptor(candidate,"owner"),updatedAt=getOwnDataDescriptor(candidate,"updatedAt"),freshness=getOwnDataDescriptor(candidate,"freshness");if(id===MISSING_OWN_DATA_DESCRIPTOR||id===UNSAFE_OWN_DATA_DESCRIPTOR||name===MISSING_OWN_DATA_DESCRIPTOR||name===UNSAFE_OWN_DATA_DESCRIPTOR||mimeType===UNSAFE_OWN_DATA_DESCRIPTOR||uri===UNSAFE_OWN_DATA_DESCRIPTOR||version===UNSAFE_OWN_DATA_DESCRIPTOR||tags===UNSAFE_OWN_DATA_DESCRIPTOR||owner===UNSAFE_OWN_DATA_DESCRIPTOR||updatedAt===UNSAFE_OWN_DATA_DESCRIPTOR||freshness===UNSAFE_OWN_DATA_DESCRIPTOR||typeof id.value!="string"||id.value.trim().length===0||typeof name.value!="string")return;const mimeTypeValue=mimeType===MISSING_OWN_DATA_DESCRIPTOR?void 0:mimeType.value,uriValue=uri===MISSING_OWN_DATA_DESCRIPTOR?void 0:uri.value,versionValue=version===MISSING_OWN_DATA_DESCRIPTOR?void 0:version.value,ownerValue=owner===MISSING_OWN_DATA_DESCRIPTOR?void 0:owner.value,freshnessValue=freshness===MISSING_OWN_DATA_DESCRIPTOR?void 0:freshness.value;if(mimeTypeValue!==void 0&&typeof mimeTypeValue!="string"||uriValue!==void 0&&typeof uriValue!="string"||versionValue!==void 0&&typeof versionValue!="string"||ownerValue!==void 0&&typeof ownerValue!="string"||freshnessValue!==void 0&&freshnessValue!=="fresh"&&freshnessValue!=="aging"&&freshnessValue!=="stale")return;const tagValues=tags===MISSING_OWN_DATA_DESCRIPTOR?void 0:projectLibraryStringArray(tags.value);if(tags!==MISSING_OWN_DATA_DESCRIPTOR&&!tagValues)return;const updatedAtValue=updatedAt===MISSING_OWN_DATA_DESCRIPTOR||updatedAt.value===void 0?void 0:projectLibraryDate(updatedAt.value);return updatedAtValue===INVALID_DOCUMENT_DATE?void 0:Object.freeze({id:id.value,name:name.value,...mimeTypeValue===void 0?{}:{mimeType:mimeTypeValue},...uriValue===void 0?{}:{uri:uriValue},...versionValue===void 0?{}:{version:versionValue},...tagValues===void 0?{}:{tags:tagValues},...ownerValue===void 0?{}:{owner:ownerValue},...updatedAtValue===void 0?{}:{updatedAt:updatedAtValue},...freshnessValue===void 0?{}:{freshness:freshnessValue}})}catch{return}}class LyraDocumentLibrary extends LyraElement{constructor(){super(...arguments),this._documents=Object.freeze([]),this._selectedDocumentIds=Object.freeze([]),this._tagFilter=Object.freeze([]),this.sortKey="name",this.sortDir="asc",this.searchTerm="",this.loading=!1,this.isMounting=!0,this.defaultFilter=(document,query)=>{const locale=this.effectiveLocale;return[document.name,document.owner??"",...document.tags??[]].some(value=>value.toLocaleLowerCase(locale).includes(query))},this.compareDocuments=(a,b)=>{const locale=this.effectiveLocale,dir=this.sortDir==="asc"?1:-1;let result=0;switch(this.sortKey){case"name":result=a.name.localeCompare(b.name,locale,{numeric:!0});break;case"version":result=(a.version??"").localeCompare(b.version??"",locale,{numeric:!0});break;case"owner":result=(a.owner??"").localeCompare(b.owner??"",locale,{numeric:!0});break;case"freshness":result=(a.freshness?FRESHNESS_RANK[a.freshness]:3)-(b.freshness?FRESHNESS_RANK[b.freshness]:3);break;case"updatedAt":result=(this.normalizeDate(a.updatedAt)?.getTime()??0)-(this.normalizeDate(b.updatedAt)?.getTime()??0);break}return result*dir},this.onSearchInput=event=>{event.stopPropagation(),this.searchTerm=event.detail.value,this.emitFilterChange()},this.onTagFilterChange=event=>{event.stopPropagation();const combobox=event.target;this.tagFilter=Array.isArray(combobox.value)?combobox.value:[],this.emitFilterChange()},this.onTableSortRequest=event=>{if(event.stopPropagation(),!this.isSortKey(event.detail.sortKey)){event.preventDefault();return}const detail=Object.freeze({phase:"request",sortKey:event.detail.sortKey,sortDir:event.detail.sortDir});this.emit("lr-sort-request",detail,{cancelable:!0}).defaultPrevented&&event.preventDefault()},this.onTableSortCommit=event=>{event.stopPropagation(),this.isSortKey(event.detail.sortKey)&&(this.sortKey=event.detail.sortKey,this.sortDir=event.detail.sortDir,this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:this.sortKey,sortDir:this.sortDir})))},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onTableSelectionChange=event=>{event.stopPropagation();const table=event.currentTarget;table.selectedRowKeys=new Set(this.selectedDocumentIds)},this.clearSelection=()=>{this.setSelected([])}}static{this.defaultStrings={...super.defaultStrings,documentLibraryClearSelection:LYRA_DEFAULT_documentLibraryClearSelection,documentLibraryEmptyHeading:LYRA_DEFAULT_documentLibraryEmptyHeading,documentLibraryFilterByTag:LYRA_DEFAULT_documentLibraryFilterByTag,documentLibraryFreshnessAging:LYRA_DEFAULT_documentLibraryFreshnessAging,documentLibraryFreshnessColumn:LYRA_DEFAULT_documentLibraryFreshnessColumn,documentLibraryFreshnessFresh:LYRA_DEFAULT_documentLibraryFreshnessFresh,documentLibraryFreshnessStale:LYRA_DEFAULT_documentLibraryFreshnessStale,documentLibraryLabel:LYRA_DEFAULT_documentLibraryLabel,documentLibraryNameColumn:LYRA_DEFAULT_documentLibraryNameColumn,documentLibraryNoMatchesHeading:LYRA_DEFAULT_documentLibraryNoMatchesHeading,documentLibraryOwnerColumn:LYRA_DEFAULT_documentLibraryOwnerColumn,documentLibrarySearchPlaceholder:LYRA_DEFAULT_documentLibrarySearchPlaceholder,documentLibrarySelectAll:LYRA_DEFAULT_documentLibrarySelectAll,documentLibrarySelectColumn:LYRA_DEFAULT_documentLibrarySelectColumn,documentLibrarySelectDocument:LYRA_DEFAULT_documentLibrarySelectDocument,documentLibrarySelectedCount:LYRA_DEFAULT_documentLibrarySelectedCount,documentLibraryTagsColumn:LYRA_DEFAULT_documentLibraryTagsColumn,documentLibraryTypeColumn:LYRA_DEFAULT_documentLibraryTypeColumn,documentLibraryUpdatedColumn:LYRA_DEFAULT_documentLibraryUpdatedColumn,documentLibraryVersionColumn:LYRA_DEFAULT_documentLibraryVersionColumn}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-filter-change","lr-selection-change"])}get documents(){return this.snapshotDocuments(this._documents)}set documents(value){const previous=this._documents;this._documents=this.snapshotDocuments(value),this.requestUpdate("documents",previous)}get selectedDocumentIds(){return this._selectedDocumentIds}set selectedDocumentIds(value){const previous=this._selectedDocumentIds;this._selectedDocumentIds=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("selectedDocumentIds",previous)}get tagFilter(){return this._tagFilter}set tagFilter(value){const previous=this._tagFilter;this._tagFilter=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("tagFilter",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink()}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}snapshotDocuments(documents){const snapshot=[],seen=new Set;try{if(!Array.isArray(documents))return Object.freeze(snapshot);const length=getOwnDataDescriptor(documents,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return Object.freeze(snapshot);for(let index=0;index<Math.min(length.value,MAX_LIBRARY_COLLECTION_ENTRIES);index+=1){const entry=getOwnDataDescriptor(documents,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const document=projectLibraryDocument(entry.value);!document||seen.has(document.id)||(seen.add(document.id),snapshot.push(document))}}catch{}return Object.freeze(snapshot)}snapshotIds(ids){const snapshot=[],seen=new Set;try{for(const id of ids)if(!seen.has(id)&&(seen.add(id),snapshot.push(id),snapshot.length>=MAX_LIBRARY_COLLECTION_ENTRIES))break}catch{}return Object.freeze(snapshot)}willUpdate(changed){if(super.willUpdate(changed),(changed.has("documents")||changed.has("selectedDocumentIds"))&&this.selectedDocumentIds.length>0){const existing=new Set(this._documents.map(doc=>doc.id)),normalized=this.snapshotIds(this.selectedDocumentIds.filter(id=>existing.has(id)));(normalized.length!==this.selectedDocumentIds.length||normalized.some((id,index)=>id!==this.selectedDocumentIds[index]))&&(this.selectedDocumentIds=normalized)}if((changed.has("documents")||changed.has("tagFilter"))&&this.tagFilter.length>0){const availableTags=new Set(this._documents.flatMap(document=>document.tags??[])),normalized=this.snapshotIds(this.tagFilter.filter(tag=>availableTags.has(tag)));(normalized.length!==this.tagFilter.length||normalized.some((tag,index)=>tag!==this.tagFilter[index]))&&(this.tagFilter=normalized)}}updated(changed){super.updated(changed),!this.isMounting&&changed.has("selectedDocumentIds")&&this.announcementSink?.announce(this.selectionCountText()),this.isMounting=!1}selectionCountText(){return this.localize("documentLibrarySelectedCount",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.selectedDocumentIds.length)})}normalizeDate(value){if(value===void 0)return;const date=value instanceof Date?value:new Date(value);return Number.isNaN(date.getTime())?void 0:date}matchesTagFilter(document){if(this.tagFilter.length===0)return!0;const tags=new Set(document.tags??[]);return this.tagFilter.every(tag=>tags.has(tag))}get visibleDocuments(){const query=this.searchTerm.trim().toLocaleLowerCase(this.effectiveLocale),matchFn=this.filter??this.defaultFilter;return[...this._documents.filter(document=>(query===""||matchFn(document,query))&&this.matchesTagFilter(document))].sort(this.compareDocuments)}get allTags(){const tags=new Set;for(const document of this._documents)for(const tag of document.tags??[])tags.add(tag);return[...tags].sort((a,b)=>a.localeCompare(b,this.effectiveLocale))}emitFilterChange(){const tags=Object.freeze([...this.tagFilter]);this.emit("lr-filter-change",Object.freeze({searchTerm:this.searchTerm,tags,matchCount:this.visibleDocuments.length}))}isSortKey(value){return value==="name"||value==="version"||value==="owner"||value==="freshness"||value==="updatedAt"}openDocument(document){this.emit("lr-open",Object.freeze({documentId:document.id}))}setSelected(ids){this.selectedDocumentIds=[...ids];const eventIds=Object.freeze([...this.selectedDocumentIds]);this.emit("lr-selection-change",Object.freeze({documentIds:eventIds}))}toggleSelection(document,checked){const next=new Set(this.selectedDocumentIds);checked?next.add(document.id):next.delete(document.id),this.setSelected(next)}toggleSelectAll(checked,visible){const next=new Set(this.selectedDocumentIds);for(const document of visible)checked?next.add(document.id):next.delete(document.id);this.setSelected(next)}freshnessLabel(freshness){switch(freshness){case"fresh":return this.localize("documentLibraryFreshnessFresh");case"aging":return this.localize("documentLibraryFreshnessAging");case"stale":return this.localize("documentLibraryFreshnessStale")}}renderSelectAllCheckbox(visible){const allSelected=visible.length>0&&visible.every(document=>this.selectedDocumentIds.includes(document.id)),someSelected=!allSelected&&visible.some(document=>this.selectedDocumentIds.includes(document.id));return html`<lr-checkbox
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}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{getDateTimeFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./document-library.styles.js";import{LYRA_DEFAULT_documentLibraryClearSelection,LYRA_DEFAULT_documentLibraryEmptyHeading,LYRA_DEFAULT_documentLibraryFilterByTag,LYRA_DEFAULT_documentLibraryFreshnessAging,LYRA_DEFAULT_documentLibraryFreshnessColumn,LYRA_DEFAULT_documentLibraryFreshnessFresh,LYRA_DEFAULT_documentLibraryFreshnessStale,LYRA_DEFAULT_documentLibraryLabel,LYRA_DEFAULT_documentLibraryNameColumn,LYRA_DEFAULT_documentLibraryNoMatchesHeading,LYRA_DEFAULT_documentLibraryOwnerColumn,LYRA_DEFAULT_documentLibrarySearchPlaceholder,LYRA_DEFAULT_documentLibrarySelectAll,LYRA_DEFAULT_documentLibrarySelectColumn,LYRA_DEFAULT_documentLibrarySelectDocument,LYRA_DEFAULT_documentLibrarySelectedCount,LYRA_DEFAULT_documentLibraryTagsColumn,LYRA_DEFAULT_documentLibraryTypeColumn,LYRA_DEFAULT_documentLibraryUpdatedColumn,LYRA_DEFAULT_documentLibraryVersionColumn}from"../../../internal/default-strings.generated.js";const FRESHNESS_RANK={fresh:0,aging:1,stale:2},MAX_LIBRARY_COLLECTION_ENTRIES=1e4,INVALID_DOCUMENT_DATE=Symbol("invalid-document-date"),FRESHNESS_TONE={fresh:"success",aging:"warning",stale:"danger"};function projectLibraryStringArray(value){try{if(!Array.isArray(value))return;const length=getOwnDataDescriptor(value,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return;const tags=[];for(let index=0;index<Math.min(length.value,MAX_LIBRARY_COLLECTION_ENTRIES);index+=1){const entry=getOwnDataDescriptor(value,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR||typeof entry.value!="string")return;tags.push(entry.value)}return Object.freeze(tags)}catch{return}}function projectLibraryDate(value){if(typeof value=="string")return value;if(typeof value=="number")return new Date(value);try{return new Date(Date.prototype.getTime.call(value))}catch{return INVALID_DOCUMENT_DATE}}function projectLibraryDocument(candidate){try{if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))return;const id=getOwnDataDescriptor(candidate,"id"),name=getOwnDataDescriptor(candidate,"name"),mimeType=getOwnDataDescriptor(candidate,"mimeType"),uri=getOwnDataDescriptor(candidate,"uri"),version=getOwnDataDescriptor(candidate,"version"),tags=getOwnDataDescriptor(candidate,"tags"),owner=getOwnDataDescriptor(candidate,"owner"),updatedAt=getOwnDataDescriptor(candidate,"updatedAt"),freshness=getOwnDataDescriptor(candidate,"freshness");if(id===MISSING_OWN_DATA_DESCRIPTOR||id===UNSAFE_OWN_DATA_DESCRIPTOR||name===MISSING_OWN_DATA_DESCRIPTOR||name===UNSAFE_OWN_DATA_DESCRIPTOR||mimeType===UNSAFE_OWN_DATA_DESCRIPTOR||uri===UNSAFE_OWN_DATA_DESCRIPTOR||version===UNSAFE_OWN_DATA_DESCRIPTOR||tags===UNSAFE_OWN_DATA_DESCRIPTOR||owner===UNSAFE_OWN_DATA_DESCRIPTOR||updatedAt===UNSAFE_OWN_DATA_DESCRIPTOR||freshness===UNSAFE_OWN_DATA_DESCRIPTOR||typeof id.value!="string"||id.value.trim().length===0||typeof name.value!="string")return;const mimeTypeValue=mimeType===MISSING_OWN_DATA_DESCRIPTOR?void 0:mimeType.value,uriValue=uri===MISSING_OWN_DATA_DESCRIPTOR?void 0:uri.value,versionValue=version===MISSING_OWN_DATA_DESCRIPTOR?void 0:version.value,ownerValue=owner===MISSING_OWN_DATA_DESCRIPTOR?void 0:owner.value,freshnessValue=freshness===MISSING_OWN_DATA_DESCRIPTOR?void 0:freshness.value;if(mimeTypeValue!==void 0&&typeof mimeTypeValue!="string"||uriValue!==void 0&&typeof uriValue!="string"||versionValue!==void 0&&typeof versionValue!="string"||ownerValue!==void 0&&typeof ownerValue!="string"||freshnessValue!==void 0&&freshnessValue!=="fresh"&&freshnessValue!=="aging"&&freshnessValue!=="stale")return;const tagsValue=tags===MISSING_OWN_DATA_DESCRIPTOR?void 0:tags.value,tagValues=tagsValue===void 0?void 0:projectLibraryStringArray(tagsValue);if(tagsValue!==void 0&&!tagValues)return;const updatedAtValue=updatedAt===MISSING_OWN_DATA_DESCRIPTOR||updatedAt.value===void 0?void 0:projectLibraryDate(updatedAt.value);return updatedAtValue===INVALID_DOCUMENT_DATE?void 0:Object.freeze({id:id.value,name:name.value,...mimeTypeValue===void 0?{}:{mimeType:mimeTypeValue},...uriValue===void 0?{}:{uri:uriValue},...versionValue===void 0?{}:{version:versionValue},...tagValues===void 0?{}:{tags:tagValues},...ownerValue===void 0?{}:{owner:ownerValue},...updatedAtValue===void 0?{}:{updatedAt:updatedAtValue},...freshnessValue===void 0?{}:{freshness:freshnessValue}})}catch{return}}class LyraDocumentLibrary extends LyraElement{constructor(){super(...arguments),this._documents=Object.freeze([]),this._selectedDocumentIds=Object.freeze([]),this._tagFilter=Object.freeze([]),this.sortKey="name",this.sortDir="asc",this.searchTerm="",this.loading=!1,this.isMounting=!0,this.defaultFilter=(document,query)=>{const locale=this.effectiveLocale;return[document.name,document.owner??"",...document.tags??[]].some(value=>value.toLocaleLowerCase(locale).includes(query))},this.compareDocuments=(a,b)=>{const locale=this.effectiveLocale,dir=this.sortDir==="asc"?1:-1;let result=0;switch(this.sortKey){case"name":result=a.name.localeCompare(b.name,locale,{numeric:!0});break;case"version":result=(a.version??"").localeCompare(b.version??"",locale,{numeric:!0});break;case"owner":result=(a.owner??"").localeCompare(b.owner??"",locale,{numeric:!0});break;case"freshness":result=(a.freshness?FRESHNESS_RANK[a.freshness]:3)-(b.freshness?FRESHNESS_RANK[b.freshness]:3);break;case"updatedAt":result=(this.normalizeDate(a.updatedAt)?.getTime()??0)-(this.normalizeDate(b.updatedAt)?.getTime()??0);break}return result*dir},this.onSearchInput=event=>{event.stopPropagation(),this.searchTerm=event.detail.value,this.emitFilterChange()},this.onTagFilterChange=event=>{event.stopPropagation();const combobox=event.target;this.tagFilter=Array.isArray(combobox.value)?combobox.value:[],this.emitFilterChange()},this.onTableSortRequest=event=>{if(event.stopPropagation(),!this.isSortKey(event.detail.sortKey)){event.preventDefault();return}const detail=Object.freeze({phase:"request",sortKey:event.detail.sortKey,sortDir:event.detail.sortDir});this.emit("lr-sort-request",detail,{cancelable:!0}).defaultPrevented&&event.preventDefault()},this.onTableSortCommit=event=>{event.stopPropagation(),this.isSortKey(event.detail.sortKey)&&(this.sortKey=event.detail.sortKey,this.sortDir=event.detail.sortDir,this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:this.sortKey,sortDir:this.sortDir})))},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onTableSelectionChange=event=>{event.stopPropagation();const table=event.currentTarget;table.selectedRowKeys=new Set(this.selectedDocumentIds)},this.clearSelection=()=>{this.setSelected([])}}static{this.defaultStrings={...super.defaultStrings,documentLibraryClearSelection:LYRA_DEFAULT_documentLibraryClearSelection,documentLibraryEmptyHeading:LYRA_DEFAULT_documentLibraryEmptyHeading,documentLibraryFilterByTag:LYRA_DEFAULT_documentLibraryFilterByTag,documentLibraryFreshnessAging:LYRA_DEFAULT_documentLibraryFreshnessAging,documentLibraryFreshnessColumn:LYRA_DEFAULT_documentLibraryFreshnessColumn,documentLibraryFreshnessFresh:LYRA_DEFAULT_documentLibraryFreshnessFresh,documentLibraryFreshnessStale:LYRA_DEFAULT_documentLibraryFreshnessStale,documentLibraryLabel:LYRA_DEFAULT_documentLibraryLabel,documentLibraryNameColumn:LYRA_DEFAULT_documentLibraryNameColumn,documentLibraryNoMatchesHeading:LYRA_DEFAULT_documentLibraryNoMatchesHeading,documentLibraryOwnerColumn:LYRA_DEFAULT_documentLibraryOwnerColumn,documentLibrarySearchPlaceholder:LYRA_DEFAULT_documentLibrarySearchPlaceholder,documentLibrarySelectAll:LYRA_DEFAULT_documentLibrarySelectAll,documentLibrarySelectColumn:LYRA_DEFAULT_documentLibrarySelectColumn,documentLibrarySelectDocument:LYRA_DEFAULT_documentLibrarySelectDocument,documentLibrarySelectedCount:LYRA_DEFAULT_documentLibrarySelectedCount,documentLibraryTagsColumn:LYRA_DEFAULT_documentLibraryTagsColumn,documentLibraryTypeColumn:LYRA_DEFAULT_documentLibraryTypeColumn,documentLibraryUpdatedColumn:LYRA_DEFAULT_documentLibraryUpdatedColumn,documentLibraryVersionColumn:LYRA_DEFAULT_documentLibraryVersionColumn}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-filter-change","lr-selection-change"])}get documents(){return this.snapshotDocuments(this._documents)}set documents(value){const previous=this._documents;this._documents=this.snapshotDocuments(value),this.requestUpdate("documents",previous)}get selectedDocumentIds(){return this._selectedDocumentIds}set selectedDocumentIds(value){const previous=this._selectedDocumentIds;this._selectedDocumentIds=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("selectedDocumentIds",previous)}get tagFilter(){return this._tagFilter}set tagFilter(value){const previous=this._tagFilter;this._tagFilter=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("tagFilter",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink()}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}snapshotDocuments(documents){const snapshot=[],seen=new Set;try{if(!Array.isArray(documents))return Object.freeze(snapshot);const length=getOwnDataDescriptor(documents,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return Object.freeze(snapshot);for(let index=0;index<Math.min(length.value,MAX_LIBRARY_COLLECTION_ENTRIES);index+=1){const entry=getOwnDataDescriptor(documents,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const document=projectLibraryDocument(entry.value);!document||seen.has(document.id)||(seen.add(document.id),snapshot.push(document))}}catch{}return Object.freeze(snapshot)}snapshotIds(ids){const snapshot=[],seen=new Set;try{for(const id of ids)if(!seen.has(id)&&(seen.add(id),snapshot.push(id),snapshot.length>=MAX_LIBRARY_COLLECTION_ENTRIES))break}catch{}return Object.freeze(snapshot)}willUpdate(changed){if(super.willUpdate(changed),(changed.has("documents")||changed.has("selectedDocumentIds"))&&this.selectedDocumentIds.length>0){const existing=new Set(this._documents.map(doc=>doc.id)),normalized=this.snapshotIds(this.selectedDocumentIds.filter(id=>existing.has(id)));(normalized.length!==this.selectedDocumentIds.length||normalized.some((id,index)=>id!==this.selectedDocumentIds[index]))&&(this.selectedDocumentIds=normalized)}if((changed.has("documents")||changed.has("tagFilter"))&&this.tagFilter.length>0){const availableTags=new Set(this._documents.flatMap(document=>document.tags??[])),normalized=this.snapshotIds(this.tagFilter.filter(tag=>availableTags.has(tag)));(normalized.length!==this.tagFilter.length||normalized.some((tag,index)=>tag!==this.tagFilter[index]))&&(this.tagFilter=normalized)}}updated(changed){super.updated(changed),!this.isMounting&&changed.has("selectedDocumentIds")&&this.announcementSink?.announce(this.selectionCountText()),this.isMounting=!1}selectionCountText(){return this.localize("documentLibrarySelectedCount",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.selectedDocumentIds.length)})}normalizeDate(value){if(value===void 0)return;const date=value instanceof Date?value:new Date(value);return Number.isNaN(date.getTime())?void 0:date}matchesTagFilter(document){if(this.tagFilter.length===0)return!0;const tags=new Set(document.tags??[]);return this.tagFilter.every(tag=>tags.has(tag))}get visibleDocuments(){const query=(this.searchTerm??"").trim().toLocaleLowerCase(this.effectiveLocale),matchFn=this.filter??this.defaultFilter;return[...this._documents.filter(document=>(query===""||matchFn(document,query))&&this.matchesTagFilter(document))].sort(this.compareDocuments)}get allTags(){const tags=new Set;for(const document of this._documents)for(const tag of document.tags??[])tags.add(tag);return[...tags].sort((a,b)=>a.localeCompare(b,this.effectiveLocale))}emitFilterChange(){const tags=Object.freeze([...this.tagFilter]);this.emit("lr-filter-change",Object.freeze({searchTerm:this.searchTerm,tags,matchCount:this.visibleDocuments.length}))}isSortKey(value){return value==="name"||value==="version"||value==="owner"||value==="freshness"||value==="updatedAt"}openDocument(document){this.emit("lr-open",Object.freeze({documentId:document.id}))}setSelected(ids){this.selectedDocumentIds=[...ids];const eventIds=Object.freeze([...this.selectedDocumentIds]);this.emit("lr-selection-change",Object.freeze({documentIds:eventIds}))}toggleSelection(document,checked){const next=new Set(this.selectedDocumentIds);checked?next.add(document.id):next.delete(document.id),this.setSelected(next)}toggleSelectAll(checked,visible){const next=new Set(this.selectedDocumentIds);for(const document of visible)checked?next.add(document.id):next.delete(document.id);this.setSelected(next)}freshnessLabel(freshness){switch(freshness){case"fresh":return this.localize("documentLibraryFreshnessFresh");case"aging":return this.localize("documentLibraryFreshnessAging");case"stale":return this.localize("documentLibraryFreshnessStale")}}renderSelectAllCheckbox(visible){const allSelected=visible.length>0&&visible.every(document=>this.selectedDocumentIds.includes(document.id)),someSelected=!allSelected&&visible.some(document=>this.selectedDocumentIds.includes(document.id));return html`<lr-checkbox
2
2
  .checked=${allSelected}
3
3
  .indeterminate=${someSelected}
4
4
  aria-label=${this.localize("documentLibrarySelectAll")}
@@ -27,7 +27,8 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
27
27
  export declare class LyraFileTree extends LyraElement<LyraFileTreeEventMap>{static styles:import("lit").CSSResultGroup[];private _nodes;
28
28
  /** Clone-owned, cycle-safe readonly node snapshot. Empty/blank paths are omitted and duplicate
29
29
  * paths use the first valid node; projection inspects at most 10,000 source positions across 64
30
- * descendant levels. Reassign after changes. */
30
+ * descendant levels. An unreadable optional field rejects only its node, without reserving the
31
+ * path against a later valid occurrence. Reassign after changes. */
31
32
  get nodes():readonly FileTreeNode[];set nodes(value:readonly FileTreeNode[]);selectedPath:string|null;
32
33
  /** Accessible-name override for the internal `<lr-tree>`; falls back to the localized default
33
34
  * when unset. An explicitly empty string renders as an empty label rather than falling back. */
@@ -1,4 +1,4 @@
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}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{styles}from"./file-tree.styles.js";import{LyraTreeItem}from"../tree/tree-item.class.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_fileTreeDiffSummary,LYRA_DEFAULT_fileTreeLabel,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const MAX_FILE_TREE_NODES=1e4,MAX_FILE_TREE_DEPTH=64,GIT_STATUSES=new Set(["added","modified","deleted","renamed","untracked","conflicted","ignored"]);function boundedArrayShape(value){try{if(!Array.isArray(value))return{isArray:!1,length:0};const descriptor=Object.getOwnPropertyDescriptor(value,"length"),length=descriptor&&"value"in descriptor?descriptor.value:0;return{isArray:!0,length:typeof length=="number"&&Number.isSafeInteger(length)&&length>=0?Math.min(length,MAX_FILE_TREE_NODES):0}}catch{return{isArray:!1,length:0}}}function normalizeFileTreeNodes(value){const rootShape=boundedArrayShape(value),roots=rootShape.isArray?value:[],drafts=[],rootDrafts=[],seenObjects=new WeakSet,seenPaths=new Set,stack=[{input:roots,output:rootDrafts,depth:0,index:0,length:rootShape.length}];let inspected=0;for(;stack.length>0&&drafts.length<MAX_FILE_TREE_NODES&&inspected<MAX_FILE_TREE_NODES;){const frame=stack[stack.length-1];if(frame.index>=frame.length){stack.pop();continue}const sourceIndex=frame.index++;inspected+=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(frame.input,String(sourceIndex))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const candidate=descriptor.value;if(!(typeof candidate!="object"||candidate===null||seenObjects.has(candidate))){seenObjects.add(candidate);try{const record=candidate,path=record.path;if(typeof path!="string"||path.trim().length===0||seenPaths.has(path))continue;seenPaths.add(path);const name=record.name,kind=record.kind,mimeType=record.mimeType,gitStatus=record.gitStatus,additions=record.additions,deletions=record.deletions,hasChildren=record.hasChildren,rawChildren=record.children,fields={path,...typeof name=="string"?{name}:{},...kind==="file"||kind==="directory"?{kind}:{},...typeof mimeType=="string"?{mimeType}:{},...typeof gitStatus=="string"&&GIT_STATUSES.has(gitStatus)?{gitStatus}:{},...additions===void 0?{}:{additions:finiteCount(typeof additions=="number"?additions:0)},...deletions===void 0?{}:{deletions:finiteCount(typeof deletions=="number"?deletions:0)},...hasChildren===void 0?{}:{hasChildren:!!hasChildren}},childShape=boundedArrayShape(rawChildren),childrenProvided=childShape.isArray,draft={fields,children:[],childrenProvided};frame.output.push(draft),drafts.push(draft),childrenProvided&&frame.depth<MAX_FILE_TREE_DEPTH&&stack.push({input:rawChildren,output:draft.children,depth:frame.depth+1,index:0,length:childShape.length})}catch{}}}for(let index=drafts.length-1;index>=0;index--){const draft=drafts[index];draft.normalized=Object.freeze({...draft.fields,...draft.childrenProvided?{children:Object.freeze(draft.children.map(child=>child.normalized))}:{}})}return Object.freeze(rootDrafts.map(draft=>draft.normalized))}const GIT_STATUS_LETTER={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"!"},GIT_STATUS_TONE={added:"success",untracked:"success",modified:"brand",renamed:"brand",deleted:"danger",conflicted:"danger",ignored:"neutral"},GIT_STATUS_KEY={added:"gitStatusAdded",modified:"gitStatusModified",deleted:"gitStatusDeleted",renamed:"gitStatusRenamed",untracked:"gitStatusUntracked",conflicted:"gitStatusConflicted",ignored:"gitStatusIgnored"};function baseName(path){const segments=path.split("/").filter(Boolean);return segments[segments.length-1]??path}function isDirectory(node){return node.kind==="directory"||node.children!==void 0||node.hasChildren===!0}function isLazyUnloaded(node){return isDirectory(node)&&node.hasChildren===!0&&node.children===void 0}class LyraFileTree extends LyraElement{constructor(){super(...arguments),this._nodes=[],this.selectedPath=null,this.nodesByPath=new Map,this.parentPathByPath=new Map,this.onNodeSelect=e=>{e.stopPropagation();const{nodeId}=e.detail,node=this.nodesByPath.get(nodeId);if(!node)return;const wasSelected=this.selectedPath===nodeId;this.selectedPath=nodeId,this.emit("lr-file-select",Object.freeze({filePath:nodeId,node})),!isDirectory(node)&&wasSelected&&this.emit("lr-file-open",Object.freeze({filePath:nodeId,node}))},this.onNodeToggle=e=>{e.stopPropagation();const{nodeId,expanded}=e.detail;if(!expanded)return;const node=this.nodesByPath.get(nodeId);node&&isLazyUnloaded(node)&&this.emit("lr-load-children",Object.freeze({filePath:nodeId}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,fileTreeDiffSummary:LYRA_DEFAULT_fileTreeDiffSummary,fileTreeLabel:LYRA_DEFAULT_fileTreeLabel,gitStatusAdded:LYRA_DEFAULT_gitStatusAdded,gitStatusConflicted:LYRA_DEFAULT_gitStatusConflicted,gitStatusDeleted:LYRA_DEFAULT_gitStatusDeleted,gitStatusIgnored:LYRA_DEFAULT_gitStatusIgnored,gitStatusModified:LYRA_DEFAULT_gitStatusModified,gitStatusRenamed:LYRA_DEFAULT_gitStatusRenamed,gitStatusUntracked:LYRA_DEFAULT_gitStatusUntracked,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get nodes(){return this._nodes}set nodes(value){const previous=this._nodes;this._nodes=normalizeFileTreeNodes(value),this.requestUpdate("nodes",previous)}willUpdate(changed){if(super.willUpdate(changed),changed.has("nodes")){this.nodesByPath=new Map,this.parentPathByPath=new Map;const stack=[...this.nodes].reverse().map(node=>({node,parentPath:void 0}));for(;stack.length>0;){const{node,parentPath}=stack.pop();if(this.nodesByPath.set(node.path,node),parentPath!==void 0&&this.parentPathByPath.set(node.path,parentPath),node.children)for(let index=node.children.length-1;index>=0;index--)stack.push({node:node.children[index],parentPath:node.path})}}}toTreeItem(node){const badges=[];node.gitStatus&&badges.push({text:GIT_STATUS_LETTER[node.gitStatus],tone:GIT_STATUS_TONE[node.gitStatus],label:this.localize(GIT_STATUS_KEY[node.gitStatus])});const description=node.additions!==void 0||node.deletions!==void 0?this.localize("fileTreeDiffSummary",void 0,{additions:getNumberFormat(this.effectiveLocale).format(node.additions??0),deletions:getNumberFormat(this.effectiveLocale).format(node.deletions??0)}):void 0;let children;return isLazyUnloaded(node)?children=[{id:`${node.path} loading`,label:this.localize("loading"),disabled:!0}]:node.children&&(children=node.children.map(c=>this.toTreeItem(c))),{id:node.path,label:node.name??baseName(node.path),selected:this.selectedPath===node.path,children,badges:badges.length>0?badges:void 0,description,icon:isDirectory(node)?void 0:html`<lr-file-icon
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}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{styles}from"./file-tree.styles.js";import{LyraTreeItem}from"../tree/tree-item.class.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_fileTreeDiffSummary,LYRA_DEFAULT_fileTreeLabel,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const MAX_FILE_TREE_NODES=1e4,MAX_FILE_TREE_DEPTH=64,GIT_STATUSES=new Set(["added","modified","deleted","renamed","untracked","conflicted","ignored"]);function boundedArrayShape(value){try{if(!Array.isArray(value))return{isArray:!1,length:0};const descriptor=Object.getOwnPropertyDescriptor(value,"length"),length=descriptor&&"value"in descriptor?descriptor.value:0;return{isArray:!0,length:typeof length=="number"&&Number.isSafeInteger(length)&&length>=0?Math.min(length,MAX_FILE_TREE_NODES):0}}catch{return{isArray:!1,length:0}}}function normalizeFileTreeNodes(value){const rootShape=boundedArrayShape(value),roots=rootShape.isArray?value:[],drafts=[],rootDrafts=[],seenObjects=new WeakSet,seenPaths=new Set,stack=[{input:roots,output:rootDrafts,depth:0,index:0,length:rootShape.length}];let inspected=0;for(;stack.length>0&&drafts.length<MAX_FILE_TREE_NODES&&inspected<MAX_FILE_TREE_NODES;){const frame=stack[stack.length-1];if(frame.index>=frame.length){stack.pop();continue}const sourceIndex=frame.index++;inspected+=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(frame.input,String(sourceIndex))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const candidate=descriptor.value;if(!(typeof candidate!="object"||candidate===null||seenObjects.has(candidate)))try{const record=candidate,path=record.path;if(typeof path!="string"||path.trim().length===0||seenPaths.has(path))continue;const name=record.name,kind=record.kind,mimeType=record.mimeType,gitStatus=record.gitStatus,additions=record.additions,deletions=record.deletions,hasChildren=record.hasChildren,rawChildren=record.children,fields={path,...typeof name=="string"?{name}:{},...kind==="file"||kind==="directory"?{kind}:{},...typeof mimeType=="string"?{mimeType}:{},...typeof gitStatus=="string"&&GIT_STATUSES.has(gitStatus)?{gitStatus}:{},...additions===void 0?{}:{additions:finiteCount(typeof additions=="number"?additions:0)},...deletions===void 0?{}:{deletions:finiteCount(typeof deletions=="number"?deletions:0)},...hasChildren===void 0?{}:{hasChildren:!!hasChildren}},childShape=boundedArrayShape(rawChildren),childrenProvided=childShape.isArray,draft={fields,children:[],childrenProvided};seenObjects.add(candidate),seenPaths.add(path),frame.output.push(draft),drafts.push(draft),childrenProvided&&frame.depth<MAX_FILE_TREE_DEPTH&&stack.push({input:rawChildren,output:draft.children,depth:frame.depth+1,index:0,length:childShape.length})}catch{}}for(let index=drafts.length-1;index>=0;index--){const draft=drafts[index];draft.normalized=Object.freeze({...draft.fields,...draft.childrenProvided?{children:Object.freeze(draft.children.map(child=>child.normalized))}:{}})}return Object.freeze(rootDrafts.map(draft=>draft.normalized))}const GIT_STATUS_LETTER={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"!"},GIT_STATUS_TONE={added:"success",untracked:"success",modified:"brand",renamed:"brand",deleted:"danger",conflicted:"danger",ignored:"neutral"},GIT_STATUS_KEY={added:"gitStatusAdded",modified:"gitStatusModified",deleted:"gitStatusDeleted",renamed:"gitStatusRenamed",untracked:"gitStatusUntracked",conflicted:"gitStatusConflicted",ignored:"gitStatusIgnored"};function baseName(path){const segments=path.split("/").filter(Boolean);return segments[segments.length-1]??path}function isDirectory(node){return node.kind==="directory"||node.children!==void 0||node.hasChildren===!0}function isLazyUnloaded(node){return isDirectory(node)&&node.hasChildren===!0&&node.children===void 0}class LyraFileTree extends LyraElement{constructor(){super(...arguments),this._nodes=[],this.selectedPath=null,this.nodesByPath=new Map,this.parentPathByPath=new Map,this.onNodeSelect=e=>{e.stopPropagation();const{nodeId}=e.detail,node=this.nodesByPath.get(nodeId);if(!node)return;const wasSelected=this.selectedPath===nodeId;this.selectedPath=nodeId,this.emit("lr-file-select",Object.freeze({filePath:nodeId,node})),!isDirectory(node)&&wasSelected&&this.emit("lr-file-open",Object.freeze({filePath:nodeId,node}))},this.onNodeToggle=e=>{e.stopPropagation();const{nodeId,expanded}=e.detail;if(!expanded)return;const node=this.nodesByPath.get(nodeId);node&&isLazyUnloaded(node)&&this.emit("lr-load-children",Object.freeze({filePath:nodeId}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,fileTreeDiffSummary:LYRA_DEFAULT_fileTreeDiffSummary,fileTreeLabel:LYRA_DEFAULT_fileTreeLabel,gitStatusAdded:LYRA_DEFAULT_gitStatusAdded,gitStatusConflicted:LYRA_DEFAULT_gitStatusConflicted,gitStatusDeleted:LYRA_DEFAULT_gitStatusDeleted,gitStatusIgnored:LYRA_DEFAULT_gitStatusIgnored,gitStatusModified:LYRA_DEFAULT_gitStatusModified,gitStatusRenamed:LYRA_DEFAULT_gitStatusRenamed,gitStatusUntracked:LYRA_DEFAULT_gitStatusUntracked,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get nodes(){return this._nodes}set nodes(value){const previous=this._nodes;this._nodes=normalizeFileTreeNodes(value),this.requestUpdate("nodes",previous)}willUpdate(changed){if(super.willUpdate(changed),changed.has("nodes")){this.nodesByPath=new Map,this.parentPathByPath=new Map;const stack=[...this.nodes].reverse().map(node=>({node,parentPath:void 0}));for(;stack.length>0;){const{node,parentPath}=stack.pop();if(this.nodesByPath.set(node.path,node),parentPath!==void 0&&this.parentPathByPath.set(node.path,parentPath),node.children)for(let index=node.children.length-1;index>=0;index--)stack.push({node:node.children[index],parentPath:node.path})}}}toTreeItem(node){const badges=[];node.gitStatus&&badges.push({text:GIT_STATUS_LETTER[node.gitStatus],tone:GIT_STATUS_TONE[node.gitStatus],label:this.localize(GIT_STATUS_KEY[node.gitStatus])});const description=node.additions!==void 0||node.deletions!==void 0?this.localize("fileTreeDiffSummary",void 0,{additions:getNumberFormat(this.effectiveLocale).format(node.additions??0),deletions:getNumberFormat(this.effectiveLocale).format(node.deletions??0)}):void 0;let children;return isLazyUnloaded(node)?children=[{id:`${node.path} loading`,label:this.localize("loading"),disabled:!0}]:node.children&&(children=node.children.map(c=>this.toTreeItem(c))),{id:node.path,label:node.name??baseName(node.path),selected:this.selectedPath===node.path,children,badges:badges.length>0?badges:void 0,description,icon:isDirectory(node)?void 0:html`<lr-file-icon
2
2
  mime-type=${node.mimeType??""}
3
3
  name=${node.name??baseName(node.path)}
4
4
  decorative
@@ -107,7 +107,9 @@ get nodes():readonly FlowNode[];set nodes(value:readonly FlowNode[]);private _ed
107
107
  * first-wins before every render, action, focus, selection, snapshot, and event path. Reassign
108
108
  * the collection to update. */
109
109
  get edges():readonly FlowEdge[];set edges(value:readonly FlowEdge[]);private _orientation;
110
- /** Downstream layout and handle axis. Invalid runtime/attribute values normalize to horizontal. */
110
+ /** Downstream layout and handle axis. Horizontal RTL reflects model coordinates while authored,
111
+ * generated and portable fallback cards retain readable content. Invalid runtime/attribute
112
+ * values normalize to horizontal. */
111
113
  get orientation():LyraOrientation;set orientation(value:LyraOrientation);nodesDraggable:boolean;connectable:boolean;droppable:boolean;
112
114
  /** Freezes pan/zoom/edit gestures and viewport-mutating methods. Enabling it live cancels and
113
115
  * rolls back every active gesture before retiring its global listeners. */
@@ -120,7 +122,8 @@ get selectedEdgeIds():readonly string[];set selectedEdgeIds(value:readonly strin
120
122
  * dotted background's base spacing. */
121
123
  grid:number;layerGap:number;nodeGap:number;private _decorations;
122
124
  /** Deeply snapshotted, frozen run decorations, bounded to 10,000 keys and a finite nested-data
123
- * budget. Reassign the record to update. */
125
+ * budget. Invalid statuses and records with unreadable nested fields are omitted independently,
126
+ * retaining valid neighbors. Reassign the record to update. */
124
127
  get decorations():FlowRunDecorations|null;set decorations(value:FlowRunDecorations|null);accessibleLabel:string|null;
125
128
  /** `minZoom`/`maxZoom` normalized to finite, positive scale bounds before ever reaching
126
129
  * `clampZoom()`'s `Math.min`/`Math.max` — an invalid attribute value would otherwise poison