@aceshooting/lyra-ui 16.0.0 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/CHANGELOG.md +758 -0
  2. package/README.md +2 -2
  3. package/custom-elements.json +1 -1
  4. package/dist/cli/migration-contract.json +1 -1
  5. package/dist/components/agent-tools/browser-frame/browser-frame.class.d.ts +3 -3
  6. package/dist/components/agent-tools/browser-frame/browser-frame.class.js +2 -2
  7. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +2 -2
  8. package/dist/components/agent-tools/compare-panel/compare-panel.class.js +3 -3
  9. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.d.ts +37 -13
  10. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
  11. package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
  12. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +4 -0
  13. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
  14. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +3 -3
  15. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
  16. package/dist/components/charts/chart/chart.class.d.ts +117 -17
  17. package/dist/components/charts/chart/chart.class.js +3 -3
  18. package/dist/components/charts/chart/histogram-bin.d.ts +5 -1
  19. package/dist/components/charts/chart/histogram-bin.js +1 -1
  20. package/dist/components/charts/chart/lite-chart.class.d.ts +9 -0
  21. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  22. package/dist/components/conversation/message-actions/message-actions.styles.js +1 -1
  23. package/dist/components/conversation/model-select/model-select.class.d.ts +13 -4
  24. package/dist/components/conversation/model-select/model-select.class.js +2 -1
  25. package/dist/components/conversation/model-select/model-select.styles.js +1 -1
  26. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +40 -2
  27. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
  28. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +27 -3
  29. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +11 -0
  30. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +31 -3
  31. package/dist/components/conversation/streaming-text/streaming-text.class.js +11 -0
  32. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +30 -2
  33. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.js +4 -3
  34. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  35. package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
  36. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  37. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.js +1 -1
  38. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +4 -0
  39. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +16 -4
  40. package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -1
  41. package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
  42. package/dist/components/data/context-meter/context-meter.class.d.ts +23 -4
  43. package/dist/components/data/context-meter/context-meter.class.js +10 -7
  44. package/dist/components/data/context-meter/context-meter.styles.js +1 -1
  45. package/dist/components/data/data-grid/data-grid.class.d.ts +5 -2
  46. package/dist/components/data/data-grid/data-grid.class.js +1 -1
  47. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +32 -5
  48. package/dist/components/data/flow-canvas/flow-canvas.class.js +3 -1
  49. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  50. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  51. package/dist/components/data/flow-canvas/flow-types.d.ts +10 -1
  52. package/dist/components/data/gauge/gauge.class.d.ts +15 -2
  53. package/dist/components/data/gauge/gauge.class.js +20 -20
  54. package/dist/components/data/gauge/gauge.styles.js +1 -1
  55. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +14 -5
  56. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +2 -2
  57. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +28 -2
  58. package/dist/components/data/sequence-strip/sequence-strip.class.js +3 -2
  59. package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
  60. package/dist/components/data/table/table.class.d.ts +155 -30
  61. package/dist/components/data/table/table.class.js +6 -4
  62. package/dist/components/data/table/table.styles.js +1 -1
  63. package/dist/components/data/timeline/timeline-item.class.d.ts +9 -1
  64. package/dist/components/data/timeline/timeline-item.class.js +2 -2
  65. package/dist/components/data/word-cloud/word-cloud.class.js +1 -1
  66. package/dist/components/data/word-cloud/word-cloud.styles.js +1 -1
  67. package/dist/components/forms/button/button.class.d.ts +30 -1
  68. package/dist/components/forms/button/button.class.js +2 -2
  69. package/dist/components/forms/checkbox/checkbox.class.d.ts +8 -6
  70. package/dist/components/forms/checkbox/checkbox.class.js +2 -2
  71. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +7 -5
  72. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  73. package/dist/components/forms/color-picker/color-picker.class.d.ts +16 -2
  74. package/dist/components/forms/color-picker/color-picker.class.js +2 -2
  75. package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
  76. package/dist/components/forms/combobox/combobox.class.d.ts +52 -7
  77. package/dist/components/forms/combobox/combobox.class.js +2 -2
  78. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  79. package/dist/components/forms/date-picker/date-input.class.d.ts +4 -0
  80. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  81. package/dist/components/forms/icon-button/icon-button.class.d.ts +20 -3
  82. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  83. package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
  84. package/dist/components/forms/input/input.class.d.ts +5 -2
  85. package/dist/components/forms/input/input.class.js +1 -1
  86. package/dist/components/forms/input/time-input.class.d.ts +4 -0
  87. package/dist/components/forms/input/time-input.class.js +1 -1
  88. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +11 -5
  89. package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
  90. package/dist/components/forms/otp-input/otp-input.class.d.ts +7 -2
  91. package/dist/components/forms/otp-input/otp-input.class.js +2 -2
  92. package/dist/components/forms/radio/radio-button.class.d.ts +2 -1
  93. package/dist/components/forms/radio/radio-group.class.d.ts +9 -4
  94. package/dist/components/forms/radio/radio-group.class.js +1 -1
  95. package/dist/components/forms/radio/radio.class.d.ts +13 -7
  96. package/dist/components/forms/radio/radio.class.js +1 -1
  97. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +16 -6
  98. package/dist/components/forms/rubric-form/rubric-form.class.js +2 -2
  99. package/dist/components/forms/select/select.class.d.ts +50 -13
  100. package/dist/components/forms/select/select.class.js +2 -2
  101. package/dist/components/forms/slider/slider.class.d.ts +4 -2
  102. package/dist/components/forms/slider/slider.class.js +1 -1
  103. package/dist/components/forms/switch/switch.class.d.ts +8 -6
  104. package/dist/components/forms/switch/switch.class.js +1 -1
  105. package/dist/components/forms/textarea/textarea.class.d.ts +5 -3
  106. package/dist/components/forms/textarea/textarea.class.js +1 -1
  107. package/dist/components/forms/time-range/time-range.class.d.ts +12 -7
  108. package/dist/components/forms/time-range/time-range.class.js +1 -1
  109. package/dist/components/forms/time-range/time-range.styles.js +1 -1
  110. package/dist/components/forms/token-input/token-input.class.d.ts +6 -4
  111. package/dist/components/forms/token-input/token-input.class.js +1 -1
  112. package/dist/components/layout/app-rail/app-rail-item.class.d.ts +109 -4
  113. package/dist/components/layout/app-rail/app-rail-item.class.js +34 -29
  114. package/dist/components/layout/app-rail/app-rail-item.styles.js +1 -1
  115. package/dist/components/layout/app-rail/app-rail.class.d.ts +25 -3
  116. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  117. package/dist/components/layout/app-rail-group/app-rail-group.class.d.ts +2 -2
  118. package/dist/components/layout/app-rail-group/app-rail-group.class.js +2 -2
  119. package/dist/components/layout/carousel/carousel.class.d.ts +1 -1
  120. package/dist/components/layout/carousel/carousel.class.js +1 -1
  121. package/dist/components/layout/details/accordion.class.d.ts +2 -2
  122. package/dist/components/layout/details/accordion.class.js +2 -2
  123. package/dist/components/layout/filter-bar/filter-bar-register.d.ts +1 -0
  124. package/dist/components/layout/filter-bar/filter-bar-register.js +1 -0
  125. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +153 -16
  126. package/dist/components/layout/filter-bar/filter-bar.class.js +8 -5
  127. package/dist/components/layout/menu/menu-item.class.d.ts +3 -3
  128. package/dist/components/layout/menu/menu-item.class.js +3 -3
  129. package/dist/components/layout/menu/menu.class.d.ts +5 -1
  130. package/dist/components/layout/menu/menu.class.js +2 -2
  131. package/dist/components/layout/reorder-list/reorder-item.styles.js +1 -1
  132. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  133. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +107 -2
  134. package/dist/components/layout/virtual-list/virtual-list.class.js +12 -7
  135. package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +1 -1
  136. package/dist/components/media/avatar-group/avatar-group.class.d.ts +12 -1
  137. package/dist/components/media/avatar-group/avatar-group.class.js +2 -2
  138. package/dist/components/media/drop-zone/drop-zone.class.d.ts +32 -11
  139. package/dist/components/media/drop-zone/drop-zone.class.js +2 -2
  140. package/dist/components/media/file-input/file-input.class.d.ts +40 -19
  141. package/dist/components/media/file-input/file-input.class.js +2 -2
  142. package/dist/components/media/map/map.class.d.ts +138 -12
  143. package/dist/components/media/map/map.class.js +25 -20
  144. package/dist/components/media/map/map.styles.js +1 -1
  145. package/dist/components/overlays/callout/callout.styles.js +1 -1
  146. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  147. package/dist/components/overlays/overlay/dropdown.class.d.ts +13 -3
  148. package/dist/components/overlays/overlay/dropdown.class.js +2 -2
  149. package/dist/components/overlays/overlay/popover.class.d.ts +12 -3
  150. package/dist/components/overlays/overlay/popover.class.js +2 -2
  151. package/dist/components/overlays/rating/rating.class.d.ts +9 -7
  152. package/dist/components/overlays/rating/rating.class.js +1 -1
  153. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +5 -1
  154. package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
  155. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
  156. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +5 -1
  157. package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
  158. package/dist/components/retrieval/graph-legend/graph-legend.styles.js +1 -1
  159. package/dist/components/retrieval/retrieval-value-format.js +1 -1
  160. package/dist/components/retrieval/source-list/source-list.styles.js +1 -1
  161. package/dist/components/utility/copy-button/copy-button.class.d.ts +23 -11
  162. package/dist/components/utility/copy-button/copy-button.class.js +2 -2
  163. package/dist/components/utility/copy-button/copy-button.styles.js +1 -1
  164. package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
  165. package/dist/components/utility/export-button/export-button.class.d.ts +4 -0
  166. package/dist/components/utility/export-button/export-button.class.js +1 -1
  167. package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
  168. package/dist/components/utility/known-date/known-date.class.js +1 -1
  169. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +38 -3
  170. package/dist/components/utility/mention-popover/mention-popover.class.js +2 -1
  171. package/dist/components/utility/mention-popover/mention-popover.styles.js +1 -1
  172. package/dist/components/utility/poll-status/poll-status.styles.js +1 -1
  173. package/dist/components/utility/tour/tour.class.d.ts +4 -0
  174. package/dist/components/utility/tour/tour.class.js +1 -1
  175. package/dist/components/utility/tour/tour.styles.js +1 -1
  176. package/dist/components/viewers/document-preview/document-preview.class.js +2 -2
  177. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +2 -2
  178. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +2 -2
  179. package/dist/components/viewers/highlight-layer/highlight-layer.class.js +2 -2
  180. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
  181. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
  182. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +2 -2
  183. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +2 -2
  184. package/dist/custom-elements-jsx.d.ts +2 -2
  185. package/dist/events.d.ts +20 -13
  186. package/dist/internal/aggregate-file-limits.d.ts +33 -0
  187. package/dist/internal/aggregate-file-limits.js +1 -0
  188. package/dist/internal/catalog-picker.d.ts +15 -2
  189. package/dist/internal/catalog-picker.js +1 -1
  190. package/dist/internal/debounce-controller.d.ts +14 -0
  191. package/dist/internal/debounce-controller.js +1 -1
  192. package/dist/internal/default-strings.generated.d.ts +1 -1
  193. package/dist/internal/default-strings.generated.js +2 -2
  194. package/dist/internal/focus-navigation.d.ts +45 -0
  195. package/dist/internal/focus-navigation.js +1 -1
  196. package/dist/internal/form-associated.js +1 -1
  197. package/dist/internal/initial-slot-collection.d.ts +30 -0
  198. package/dist/internal/initial-slot-collection.js +1 -0
  199. package/dist/internal/intl-cache.js +1 -1
  200. package/dist/internal/invalid-event-alias.d.ts +46 -0
  201. package/dist/internal/invalid-event-alias.js +1 -1
  202. package/dist/internal/localization-runtime.d.ts +24 -0
  203. package/dist/internal/localization-runtime.js +1 -1
  204. package/dist/internal/localization-types.d.ts +1 -1
  205. package/dist/internal/localization.js +1 -1
  206. package/dist/internal/package-metadata.d.ts +1 -1
  207. package/dist/internal/package-metadata.js +1 -1
  208. package/dist/internal/positioning-strategy.d.ts +3 -1
  209. package/dist/internal/state-part.d.ts +49 -0
  210. package/dist/internal/state-part.js +1 -0
  211. package/dist/internal/variants.styles.js +1 -1
  212. package/dist/lyra.d.ts +1 -1
  213. package/dist/lyra.js +1 -1
  214. package/dist/svelte.d.ts +2 -2
  215. package/dist/testing/index.d.ts +1 -1
  216. package/dist/testing/index.js +1 -1
  217. package/dist/testing/lyra-tag-event-map.d.ts +2 -2
  218. package/dist/testing/lyra-tag-event-map.js +1 -1
  219. package/dist/testing/wait-for-mount.d.ts +46 -0
  220. package/dist/testing/wait-for-mount.js +1 -0
  221. package/dist/theme/theme-bootstrap.js +1 -1
  222. package/dist/theme/theme.d.ts +11 -2
  223. package/dist/theme/theme.js +1 -1
  224. package/dist/translations/ar/layout.js +1 -1
  225. package/dist/translations/ar/retrieval.js +1 -1
  226. package/dist/translations/ar/shared.js +1 -1
  227. package/dist/translations/de/layout.js +1 -1
  228. package/dist/translations/de/retrieval.js +1 -1
  229. package/dist/translations/de/shared.js +1 -1
  230. package/dist/translations/es/layout.js +1 -1
  231. package/dist/translations/es/retrieval.js +1 -1
  232. package/dist/translations/es/shared.js +1 -1
  233. package/dist/translations/fa/layout.js +1 -1
  234. package/dist/translations/fa/retrieval.js +1 -1
  235. package/dist/translations/fa/shared.js +1 -1
  236. package/dist/translations/fr/layout.js +1 -1
  237. package/dist/translations/fr/retrieval.js +1 -1
  238. package/dist/translations/fr/shared.js +1 -1
  239. package/dist/translations/he/layout.js +1 -1
  240. package/dist/translations/he/retrieval.js +1 -1
  241. package/dist/translations/he/shared.js +1 -1
  242. package/dist/translations/it/layout.js +1 -1
  243. package/dist/translations/it/retrieval.js +1 -1
  244. package/dist/translations/it/shared.js +1 -1
  245. package/dist/translations/ja/layout.js +1 -1
  246. package/dist/translations/ja/retrieval.js +1 -1
  247. package/dist/translations/ja/shared.js +1 -1
  248. package/dist/translations/pt-BR/layout.js +1 -1
  249. package/dist/translations/pt-BR/retrieval.js +1 -1
  250. package/dist/translations/pt-BR/shared.js +1 -1
  251. package/dist/translations/ro/agent-tools.d.ts +1 -0
  252. package/dist/translations/ro/agent-tools.js +1 -0
  253. package/dist/translations/ro/charts.d.ts +1 -0
  254. package/dist/translations/ro/charts.js +1 -0
  255. package/dist/translations/ro/conversation.d.ts +1 -0
  256. package/dist/translations/ro/conversation.js +1 -0
  257. package/dist/translations/ro/data.d.ts +1 -0
  258. package/dist/translations/ro/data.js +1 -0
  259. package/dist/translations/ro/forms.d.ts +1 -0
  260. package/dist/translations/ro/forms.js +1 -0
  261. package/dist/translations/ro/layout.d.ts +1 -0
  262. package/dist/translations/ro/layout.js +1 -0
  263. package/dist/translations/ro/media.d.ts +1 -0
  264. package/dist/translations/ro/media.js +1 -0
  265. package/dist/translations/ro/overlays.d.ts +1 -0
  266. package/dist/translations/ro/overlays.js +1 -0
  267. package/dist/translations/ro/retrieval.d.ts +1 -0
  268. package/dist/translations/ro/retrieval.js +1 -0
  269. package/dist/translations/ro/shared.d.ts +1 -0
  270. package/dist/translations/ro/shared.js +1 -0
  271. package/dist/translations/ro/utility.d.ts +1 -0
  272. package/dist/translations/ro/utility.js +1 -0
  273. package/dist/translations/ro/viewers.d.ts +1 -0
  274. package/dist/translations/ro/viewers.js +5 -0
  275. package/dist/translations/ro.d.ts +1 -0
  276. package/dist/translations/ro.js +1 -0
  277. package/dist/translations/ru/layout.js +1 -1
  278. package/dist/translations/ru/retrieval.js +1 -1
  279. package/dist/translations/ru/shared.js +1 -1
  280. package/dist/translations/zh-CN/layout.js +1 -1
  281. package/dist/translations/zh-CN/retrieval.js +1 -1
  282. package/dist/translations/zh-CN/shared.js +1 -1
  283. package/dist/utilities/format.d.ts +17 -0
  284. package/dist/utilities/format.js +1 -1
  285. package/dist/vue.d.ts +2 -2
  286. package/llms/components/lr-app-rail-group.md +87 -10
  287. package/llms/components/lr-app-rail-item.md +88 -11
  288. package/llms/components/lr-app-rail.md +88 -11
  289. package/llms/components/lr-attachment-trigger.md +21 -0
  290. package/llms/components/lr-bar-chart.md +3 -2
  291. package/llms/components/lr-bubble-chart.md +3 -2
  292. package/llms/components/lr-button.md +5 -4
  293. package/llms/components/lr-callout.md +10 -0
  294. package/llms/components/lr-card.md +2 -1
  295. package/llms/components/lr-chart.md +43 -12
  296. package/llms/components/lr-citation-badge.md +7 -1
  297. package/llms/components/lr-code-block.md +21 -0
  298. package/llms/components/lr-color-picker.md +12 -7
  299. package/llms/components/lr-combobox.md +20 -1
  300. package/llms/components/lr-confirm-bar.md +36 -7
  301. package/llms/components/lr-context-meter.md +17 -4
  302. package/llms/components/lr-date-input.md +7 -1
  303. package/llms/components/lr-date-picker.md +6 -0
  304. package/llms/components/lr-dialog.md +21 -0
  305. package/llms/components/lr-doughnut-chart.md +3 -2
  306. package/llms/components/lr-drawer.md +10 -0
  307. package/llms/components/lr-drop-zone.md +16 -7
  308. package/llms/components/lr-dropdown-item.md +7 -0
  309. package/llms/components/lr-entity-chip.md +7 -1
  310. package/llms/components/lr-export-button.md +7 -1
  311. package/llms/components/lr-file-input.md +21 -10
  312. package/llms/components/lr-filter-bar.md +177 -18
  313. package/llms/components/lr-flow-canvas.md +16 -9
  314. package/llms/components/lr-gauge.md +22 -2
  315. package/llms/components/lr-histogram.md +7 -2
  316. package/llms/components/lr-icon-button.md +17 -8
  317. package/llms/components/lr-input.md +3 -1
  318. package/llms/components/lr-line-chart.md +3 -2
  319. package/llms/components/lr-lite-chart.md +13 -0
  320. package/llms/components/lr-locale-picker.md +7 -1
  321. package/llms/components/lr-map.md +63 -6
  322. package/llms/components/lr-mention-popover.md +16 -3
  323. package/llms/components/lr-menu-item.md +7 -0
  324. package/llms/components/lr-menu.md +8 -1
  325. package/llms/components/lr-message-actions.md +10 -0
  326. package/llms/components/lr-model-select.md +8 -3
  327. package/llms/components/lr-native-time-input.md +8 -1
  328. package/llms/components/lr-number-input.md +8 -1
  329. package/llms/components/lr-option.md +19 -0
  330. package/llms/components/lr-otp-input.md +6 -0
  331. package/llms/components/lr-pie-chart.md +3 -2
  332. package/llms/components/lr-polar-area-chart.md +3 -2
  333. package/llms/components/lr-prompt-input.md +2 -2
  334. package/llms/components/lr-radar-chart.md +3 -2
  335. package/llms/components/lr-reorder-item.md +12 -0
  336. package/llms/components/lr-reorder-list.md +12 -0
  337. package/llms/components/lr-scatter-chart.md +3 -2
  338. package/llms/components/lr-select.md +19 -2
  339. package/llms/components/lr-sequence-strip.md +10 -4
  340. package/llms/components/lr-streaming-text-core.md +28 -11
  341. package/llms/components/lr-streaming-text.md +41 -6
  342. package/llms/components/lr-suggestion-chips.md +8 -4
  343. package/llms/components/lr-table.md +47 -10
  344. package/llms/components/lr-textarea.md +1 -1
  345. package/llms/components/lr-time-input.md +7 -1
  346. package/llms/components/lr-tool-call-chip.md +7 -1
  347. package/llms/components/lr-tour.md +7 -1
  348. package/llms/components/lr-usage-badge.md +7 -1
  349. package/llms/components/lr-virtual-list.md +53 -0
  350. package/llms/components/lr-voice-picker.md +7 -3
  351. package/llms/shared.md +175 -19
  352. package/llms/tokens.md +17 -1
  353. package/llms-full.txt +1214 -169
  354. package/package.json +43 -3
  355. package/registrations.json +1 -1
  356. package/vscode-css-data.json +1 -1
  357. package/vscode-html-data.json +1 -1
  358. package/web-types.json +1 -1
@@ -53,14 +53,14 @@ export declare class LyraBrowserFrame extends LyraElement<LyraBrowserFrameEventM
53
53
  private _phase;get phase():LyraStreamPhase;set phase(next:LyraStreamPhase);controller:BrowserFrameController;
54
54
  /** Pointer markers keyed by stable id. Empty/blank ids are omitted and duplicates normalize
55
55
  * first-wins before rendering. */
56
- pings:readonly BrowserPing[];controls:boolean;private hasDefaultSlotContent;
56
+ pings:readonly BrowserPing[];controls:boolean;private hasDefaultSlotContent;private defaultSlot?;
57
57
  /** The measured `object-fit: contain` content box of the `frame-src` `<img>`, in pixels relative
58
58
  * to `[part='viewport']` -- `null` until the image has loaded and the viewport has a real size
59
59
  * (e.g. no `frameSrc`, or the default slot is in use instead). Pings fall back to plain
60
60
  * percent-of-viewport when `null`. */
61
- private contentRect;private viewportResizeObserver?;private viewportObserverDocument?;private viewportObserverTarget?;private viewportObserverGeneration;private statusAnnouncementSink?;private suppressNextStatusAnnouncement;private syncStatusAnnouncementSink;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues<this>):void;protected updated(_changed:PropertyValues<this>):void;private observeViewport;private resetViewportObserver;private recomputeContentRect;
61
+ private contentRect;private viewportResizeObserver?;private viewportObserverDocument?;private viewportObserverTarget?;private viewportObserverGeneration;private statusAnnouncementSink?;private suppressNextStatusAnnouncement;private syncStatusAnnouncementSink;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues<this>):void;protected updated(_changed:PropertyValues<this>):void;protected firstUpdated(changed:PropertyValues<this>):void;private observeViewport;private resetViewportObserver;private recomputeContentRect;
62
62
  /** Ping coordinates are agent-supplied data, so they are clamped to the documented 0-100 percent
63
63
  * range and emitted through `styleMap` -- interpolating them into a declaration string would let
64
64
  * a crafted `x` inject arbitrary declarations onto `[part="ping"]`, and a non-finite value would
65
65
  * serialize as `left:NaN%`. */
66
- private pingStyle;private onSlotChange;private onFrameLoad;private onFrameError;private onTakeOver;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-browser-frame':LyraBrowserFrame;}}
66
+ private pingStyle;private onSlotChange;private collectDefaultSlotContent;private onFrameLoad;private onFrameError;private onTakeOver;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-browser-frame':LyraBrowserFrame;}}
@@ -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,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{safeMediaSrc}from"../../../internal/safe-url.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./browser-frame.styles.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styleMap}from"lit/directives/style-map.js";import{finiteRange}from"../../../internal/numbers.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_browserFrameControllerAgent,LYRA_DEFAULT_browserFrameControllerUser,LYRA_DEFAULT_browserFrameHandBack,LYRA_DEFAULT_browserFrameLabel,LYRA_DEFAULT_browserFrameStatusConnecting,LYRA_DEFAULT_browserFrameStatusIdle,LYRA_DEFAULT_browserFrameStatusLive,LYRA_DEFAULT_browserFrameStatusStalled,LYRA_DEFAULT_browserFrameStop,LYRA_DEFAULT_browserFrameTakeOver,LYRA_DEFAULT_browserFrameUrlLabel,LYRA_DEFAULT_browserFrameViewOf,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const BROWSER_FRAME_PHASE=literalSetConverter(["idle","connecting","streaming","stalled"],"idle");function containRect(containerW,containerH,naturalW,naturalH){if(naturalW===0||naturalH===0||containerW===0||containerH===0)return{left:0,top:0,width:containerW,height:containerH};const containerRatio=containerW/containerH,naturalRatio=naturalW/naturalH;if(naturalRatio>containerRatio){const height=containerW/naturalRatio;return{left:0,top:(containerH-height)/2,width:containerW,height}}const width=containerH*naturalRatio;return{left:(containerW-width)/2,top:0,width,height:containerH}}const STATUS_KEY={idle:"browserFrameStatusIdle",connecting:"browserFrameStatusConnecting",streaming:"browserFrameStatusLive",stalled:"browserFrameStatusStalled"};class LyraBrowserFrame extends LyraElement{constructor(){super(...arguments),this._frameSrc="",this.url="",this._phase="idle",this.controller="agent",this.pings=[],this.controls=!0,this.hasDefaultSlotContent=!1,this.contentRect=null,this.viewportObserverGeneration=0,this.suppressNextStatusAnnouncement=!0,this.onSlotChange=()=>{this.hasDefaultSlotContent=Array.from(this.children).some(el=>!el.getAttribute("slot")),this.contentRect=null,this.requestUpdate()},this.onFrameLoad=()=>{this.observeViewport(),this.recomputeContentRect()},this.onFrameError=()=>{this.contentRect=null},this.onTakeOver=()=>{const requested=this.controller==="agent"?"user":"agent";this.emit("lr-take-over",{controller:requested})}}static{this.defaultStrings={...super.defaultStrings,browserFrameControllerAgent:LYRA_DEFAULT_browserFrameControllerAgent,browserFrameControllerUser:LYRA_DEFAULT_browserFrameControllerUser,browserFrameHandBack:LYRA_DEFAULT_browserFrameHandBack,browserFrameLabel:LYRA_DEFAULT_browserFrameLabel,browserFrameStatusConnecting:LYRA_DEFAULT_browserFrameStatusConnecting,browserFrameStatusIdle:LYRA_DEFAULT_browserFrameStatusIdle,browserFrameStatusLive:LYRA_DEFAULT_browserFrameStatusLive,browserFrameStatusStalled:LYRA_DEFAULT_browserFrameStatusStalled,browserFrameStop:LYRA_DEFAULT_browserFrameStop,browserFrameTakeOver:LYRA_DEFAULT_browserFrameTakeOver,browserFrameUrlLabel:LYRA_DEFAULT_browserFrameUrlLabel,browserFrameViewOf:LYRA_DEFAULT_browserFrameViewOf,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.ownedCollectionProperties=Object.freeze(["pings"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get frameSrc(){return this._frameSrc}set frameSrc(next){const old=this._frameSrc;this._frameSrc=next??"",old!==this._frameSrc&&(this.contentRect=null,this.requestUpdate("frameSrc",old))}get phase(){return this._phase}set phase(next){const normalized=BROWSER_FRAME_PHASE.normalizeReflected(this,"phase",next),old=this._phase;old!==normalized&&(this._phase=normalized,this.requestUpdate("phase",old))}syncStatusAnnouncementSink(){this.isConnected&&this.statusAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncStatusAnnouncementSink(),this.hasUpdated&&(this.suppressNextStatusAnnouncement=!0,this.requestUpdate(),this.observeViewport(),this.recomputeContentRect())}disconnectedCallback(){super.disconnectedCallback(),this.resetViewportObserver(),this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=void 0,this.suppressNextStatusAnnouncement=!0}adoptedCallback(){super.adoptedCallback(),this.resetViewportObserver(),this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=void 0,this.suppressNextStatusAnnouncement=!0}willUpdate(changed){super.willUpdate(changed),this.hasUpdated&&!this.suppressNextStatusAnnouncement&&changed.has("phase")&&this.statusAnnouncementSink?.announce(this.localize(STATUS_KEY[this.phase]))}updated(_changed){super.updated(_changed),this.suppressNextStatusAnnouncement=!1}observeViewport(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),ownerDocument=this.ownerDocument;if(!this.isConnected||!viewport||this.viewportResizeObserver&&this.viewportObserverDocument===ownerDocument&&this.viewportObserverTarget===viewport)return;this.resetViewportObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.viewportObserverGeneration,observer=new ResizeObserverCtor(()=>{this.viewportResizeObserver!==observer||this.viewportObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.viewportObserverTarget!==viewport||this.recomputeContentRect()});this.viewportResizeObserver=observer,this.viewportObserverDocument=ownerDocument,this.viewportObserverTarget=viewport,observer.observe(viewport)}resetViewportObserver(){this.viewportObserverGeneration+=1,this.viewportResizeObserver?.disconnect(),this.viewportResizeObserver=void 0,this.viewportObserverDocument=void 0,this.viewportObserverTarget=void 0}recomputeContentRect(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),img=this.renderRoot.querySelector('[part="frame"]');if(!viewport||!img||!img.naturalWidth||!img.naturalHeight){this.contentRect=null;return}this.contentRect=containRect(viewport.clientWidth,viewport.clientHeight,img.naturalWidth,img.naturalHeight)}pingStyle(ping){const x=finiteRange(ping.x,0,0,100),y=finiteRange(ping.y,0,0,100),rect=this.contentRect;return rect?styleMap({left:`${rect.left+x/100*rect.width}px`,top:`${rect.top+y/100*rect.height}px`}):styleMap({left:`${x}%`,top:`${y}%`})}render(){const safeSrc=safeMediaSrc(this.frameSrc);return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{safeMediaSrc}from"../../../internal/safe-url.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./browser-frame.styles.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styleMap}from"lit/directives/style-map.js";import{finiteRange}from"../../../internal/numbers.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LYRA_DEFAULT_browserFrameControllerAgent,LYRA_DEFAULT_browserFrameControllerUser,LYRA_DEFAULT_browserFrameHandBack,LYRA_DEFAULT_browserFrameLabel,LYRA_DEFAULT_browserFrameStatusConnecting,LYRA_DEFAULT_browserFrameStatusIdle,LYRA_DEFAULT_browserFrameStatusLive,LYRA_DEFAULT_browserFrameStatusStalled,LYRA_DEFAULT_browserFrameStop,LYRA_DEFAULT_browserFrameTakeOver,LYRA_DEFAULT_browserFrameUrlLabel,LYRA_DEFAULT_browserFrameViewOf,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const BROWSER_FRAME_PHASE=literalSetConverter(["idle","connecting","streaming","stalled"],"idle");function containRect(containerW,containerH,naturalW,naturalH){if(naturalW===0||naturalH===0||containerW===0||containerH===0)return{left:0,top:0,width:containerW,height:containerH};const containerRatio=containerW/containerH,naturalRatio=naturalW/naturalH;if(naturalRatio>containerRatio){const height=containerW/naturalRatio;return{left:0,top:(containerH-height)/2,width:containerW,height}}const width=containerH*naturalRatio;return{left:(containerW-width)/2,top:0,width,height:containerH}}const STATUS_KEY={idle:"browserFrameStatusIdle",connecting:"browserFrameStatusConnecting",streaming:"browserFrameStatusLive",stalled:"browserFrameStatusStalled"};class LyraBrowserFrame extends LyraElement{constructor(){super(...arguments),this._frameSrc="",this.url="",this._phase="idle",this.controller="agent",this.pings=[],this.controls=!0,this.hasDefaultSlotContent=!1,this.contentRect=null,this.viewportObserverGeneration=0,this.suppressNextStatusAnnouncement=!0,this.onSlotChange=()=>{this.collectDefaultSlotContent()},this.onFrameLoad=()=>{this.observeViewport(),this.recomputeContentRect()},this.onFrameError=()=>{this.contentRect=null},this.onTakeOver=()=>{const requested=this.controller==="agent"?"user":"agent";this.emit("lr-take-over",{controller:requested})}}static{this.defaultStrings={...super.defaultStrings,browserFrameControllerAgent:LYRA_DEFAULT_browserFrameControllerAgent,browserFrameControllerUser:LYRA_DEFAULT_browserFrameControllerUser,browserFrameHandBack:LYRA_DEFAULT_browserFrameHandBack,browserFrameLabel:LYRA_DEFAULT_browserFrameLabel,browserFrameStatusConnecting:LYRA_DEFAULT_browserFrameStatusConnecting,browserFrameStatusIdle:LYRA_DEFAULT_browserFrameStatusIdle,browserFrameStatusLive:LYRA_DEFAULT_browserFrameStatusLive,browserFrameStatusStalled:LYRA_DEFAULT_browserFrameStatusStalled,browserFrameStop:LYRA_DEFAULT_browserFrameStop,browserFrameTakeOver:LYRA_DEFAULT_browserFrameTakeOver,browserFrameUrlLabel:LYRA_DEFAULT_browserFrameUrlLabel,browserFrameViewOf:LYRA_DEFAULT_browserFrameViewOf,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.ownedCollectionProperties=Object.freeze(["pings"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get frameSrc(){return this._frameSrc}set frameSrc(next){const old=this._frameSrc;this._frameSrc=next??"",old!==this._frameSrc&&(this.contentRect=null,this.requestUpdate("frameSrc",old))}get phase(){return this._phase}set phase(next){const normalized=BROWSER_FRAME_PHASE.normalizeReflected(this,"phase",next),old=this._phase;old!==normalized&&(this._phase=normalized,this.requestUpdate("phase",old))}syncStatusAnnouncementSink(){this.isConnected&&this.statusAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncStatusAnnouncementSink(),this.hasUpdated&&(this.suppressNextStatusAnnouncement=!0,this.requestUpdate(),this.observeViewport(),this.recomputeContentRect())}disconnectedCallback(){super.disconnectedCallback(),this.resetViewportObserver(),this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=void 0,this.suppressNextStatusAnnouncement=!0}adoptedCallback(){super.adoptedCallback(),this.resetViewportObserver(),this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=void 0,this.suppressNextStatusAnnouncement=!0}willUpdate(changed){super.willUpdate(changed),this.hasUpdated&&!this.suppressNextStatusAnnouncement&&changed.has("phase")&&this.statusAnnouncementSink?.announce(this.localize(STATUS_KEY[this.phase]))}updated(_changed){super.updated(_changed),this.suppressNextStatusAnnouncement=!1}firstUpdated(changed){super.firstUpdated(changed);const slot=this.defaultSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,()=>this.collectDefaultSlotContent())})}observeViewport(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),ownerDocument=this.ownerDocument;if(!this.isConnected||!viewport||this.viewportResizeObserver&&this.viewportObserverDocument===ownerDocument&&this.viewportObserverTarget===viewport)return;this.resetViewportObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.viewportObserverGeneration,observer=new ResizeObserverCtor(()=>{this.viewportResizeObserver!==observer||this.viewportObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.viewportObserverTarget!==viewport||this.recomputeContentRect()});this.viewportResizeObserver=observer,this.viewportObserverDocument=ownerDocument,this.viewportObserverTarget=viewport,observer.observe(viewport)}resetViewportObserver(){this.viewportObserverGeneration+=1,this.viewportResizeObserver?.disconnect(),this.viewportResizeObserver=void 0,this.viewportObserverDocument=void 0,this.viewportObserverTarget=void 0}recomputeContentRect(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),img=this.renderRoot.querySelector('[part="frame"]');if(!viewport||!img||!img.naturalWidth||!img.naturalHeight){this.contentRect=null;return}this.contentRect=containRect(viewport.clientWidth,viewport.clientHeight,img.naturalWidth,img.naturalHeight)}pingStyle(ping){const x=finiteRange(ping.x,0,0,100),y=finiteRange(ping.y,0,0,100),rect=this.contentRect;return rect?styleMap({left:`${rect.left+x/100*rect.width}px`,top:`${rect.top+y/100*rect.height}px`}):styleMap({left:`${x}%`,top:`${y}%`})}collectDefaultSlotContent(){this.hasDefaultSlotContent=Array.from(this.children).some(el=>!el.getAttribute("slot")),this.contentRect=null,this.requestUpdate()}render(){const safeSrc=safeMediaSrc(this.frameSrc);return html`
2
2
  <div
3
3
  part="base"
4
4
  role=${overallSemanticRole(this,"group")??nothing}
@@ -38,4 +38,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
38
38
  ></span>`)}
39
39
  </div>
40
40
  </div>
41
- `}}__decorate([property({attribute:"frame-src"})],LyraBrowserFrame.prototype,"frameSrc",null),__decorate([property()],LyraBrowserFrame.prototype,"url",void 0),__decorate([property({reflect:!0,converter:BROWSER_FRAME_PHASE})],LyraBrowserFrame.prototype,"phase",null),__decorate([property({reflect:!0})],LyraBrowserFrame.prototype,"controller",void 0),__decorate([property({attribute:!1})],LyraBrowserFrame.prototype,"pings",void 0),__decorate([property({type:Boolean,reflect:!0,converter:trueDefaultBooleanConverter})],LyraBrowserFrame.prototype,"controls",void 0),__decorate([state()],LyraBrowserFrame.prototype,"contentRect",void 0);export{LyraBrowserFrame};
41
+ `}}__decorate([property({attribute:"frame-src"})],LyraBrowserFrame.prototype,"frameSrc",null),__decorate([property()],LyraBrowserFrame.prototype,"url",void 0),__decorate([property({reflect:!0,converter:BROWSER_FRAME_PHASE})],LyraBrowserFrame.prototype,"phase",null),__decorate([property({reflect:!0})],LyraBrowserFrame.prototype,"controller",void 0),__decorate([property({attribute:!1})],LyraBrowserFrame.prototype,"pings",void 0),__decorate([property({type:Boolean,reflect:!0,converter:trueDefaultBooleanConverter})],LyraBrowserFrame.prototype,"controls",void 0),__decorate([query("slot:not([name])")],LyraBrowserFrame.prototype,"defaultSlot",void 0),__decorate([state()],LyraBrowserFrame.prototype,"contentRect",void 0);export{LyraBrowserFrame};
@@ -36,8 +36,8 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
36
36
  * @status stable
37
37
  * @since 4.0.0
38
38
  */
39
- export declare class LyraComparePanel extends LyraElement<LyraComparePanelEventMap>{protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];static properties:{labelA:{attribute:string;noAccessor:boolean;};labelB:{attribute:string;noAccessor:boolean;};vote:{reflect:boolean;noAccessor:boolean;};itemId:{attribute:string;noAccessor:boolean;};syncScroll:{type:BooleanConstructor;attribute:string;noAccessor:boolean;};disabled:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};};private hasPromptSlot;private paneAEl?;private paneBEl?;private liveRegion?;private _labelA;private _labelB;private _vote;private _itemId;private _syncScroll;private _disabled;private pendingScrollReset;private suppressSync;private syncScrollRafId?;private syncScrollRafOwner?;private syncScrollRafDocument?;private ownerRealmGeneration;private voteAssignedInCommit;get labelA():string;set labelA(next:string);get labelB():string;set labelB(next:string);get vote():CompareVote|null;set vote(next:CompareVote|null);get itemId():string;set itemId(next:string);
39
+ export declare class LyraComparePanel extends LyraElement<LyraComparePanelEventMap>{protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];static properties:{labelA:{attribute:string;noAccessor:boolean;};labelB:{attribute:string;noAccessor:boolean;};vote:{reflect:boolean;noAccessor:boolean;};itemId:{attribute:string;noAccessor:boolean;};syncScroll:{type:BooleanConstructor;attribute:string;noAccessor:boolean;};disabled:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};};private hasPromptSlot;private promptSlot?;private paneAEl?;private paneBEl?;private liveRegion?;private _labelA;private _labelB;private _vote;private _itemId;private _syncScroll;private _disabled;private pendingScrollReset;private suppressSync;private syncScrollRafId?;private syncScrollRafOwner?;private syncScrollRafDocument?;private ownerRealmGeneration;private voteAssignedInCommit;get labelA():string;set labelA(next:string);get labelB():string;set labelB(next:string);get vote():CompareVote|null;set vote(next:CompareVote|null);get itemId():string;set itemId(next:string);
40
40
  /** Clone-owned vote choices shown in the canonical `a`, `b`, `tie`, `both-bad` order.
41
41
  * JS-only so the positive choice list stays typed instead of relying on a
42
42
  * lossy comma-separated attribute representation. Reassign a new array after changes. */
43
- allowedVotes:readonly CompareVote[];get syncScroll():boolean;set syncScroll(next:boolean);get disabled():boolean;set disabled(next:boolean);private onPromptSlotChange;disconnectedCallback():void;adoptedCallback():void;private resetScrollSyncFrame;private castVote;private voteButton;private onPaneScroll;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-compare-panel':LyraComparePanel;}}
43
+ allowedVotes:readonly CompareVote[];get syncScroll():boolean;set syncScroll(next:boolean);get disabled():boolean;set disabled(next:boolean);private onPromptSlotChange;private collectPromptSlotContent;disconnectedCallback():void;adoptedCallback():void;private resetScrollSyncFrame;private castVote;private voteButton;private onPaneScroll;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-compare-panel':LyraComparePanel;}}
@@ -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{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./compare-panel.styles.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{LYRA_DEFAULT_comparePanel,LYRA_DEFAULT_compareResponseA,LYRA_DEFAULT_compareResponseB,LYRA_DEFAULT_compareVoteBetter,LYRA_DEFAULT_compareVoteBothBad,LYRA_DEFAULT_compareVoteLabel,LYRA_DEFAULT_compareVoteRecorded,LYRA_DEFAULT_compareVoteTie}from"../../../internal/default-strings.generated.js";class LyraComparePanel extends LyraElement{constructor(){super(...arguments),this.hasPromptSlot=!1,this._labelA="",this._labelB="",this._vote=null,this._itemId="",this._syncScroll=!1,this._disabled=!1,this.pendingScrollReset=!1,this.suppressSync=!1,this.ownerRealmGeneration=0,this.voteAssignedInCommit=!1,this.allowedVotes=["a","b","tie","both-bad"],this.onPromptSlotChange=e=>{this.hasPromptSlot=e.target.assignedNodes({flatten:!0}).length>0},this.onPaneScroll=source=>()=>{if(!this.syncScroll||this.suppressSync)return;const from=source==="a"?this.paneAEl:this.paneBEl,to=source==="a"?this.paneBEl:this.paneAEl;if(!from||!to)return;const fromMax=from.scrollHeight-from.clientHeight,toMax=to.scrollHeight-to.clientHeight;if(fromMax<=0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected)return;const fraction=from.scrollTop/fromMax;this.suppressSync=!0,to.scrollTop=fraction*toMax;const generation=this.ownerRealmGeneration,handle=ownerWindow.requestAnimationFrame(()=>{this.syncScrollRafId!==handle||this.syncScrollRafOwner!==ownerWindow||this.syncScrollRafDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1)});this.syncScrollRafId=handle,this.syncScrollRafOwner=ownerWindow,this.syncScrollRafDocument=ownerDocument}}static{this.defaultStrings={...super.defaultStrings,comparePanel:LYRA_DEFAULT_comparePanel,compareResponseA:LYRA_DEFAULT_compareResponseA,compareResponseB:LYRA_DEFAULT_compareResponseB,compareVoteBetter:LYRA_DEFAULT_compareVoteBetter,compareVoteBothBad:LYRA_DEFAULT_compareVoteBothBad,compareVoteLabel:LYRA_DEFAULT_compareVoteLabel,compareVoteRecorded:LYRA_DEFAULT_compareVoteRecorded,compareVoteTie:LYRA_DEFAULT_compareVoteTie}}static{this.ownedCollectionProperties=Object.freeze(["allowedVotes"])}static{this.styles=[LyraElement.styles,styles]}static{this.properties={labelA:{attribute:"label-a",noAccessor:!0},labelB:{attribute:"label-b",noAccessor:!0},vote:{reflect:!0,noAccessor:!0},itemId:{attribute:"item-id",noAccessor:!0},syncScroll:{type:Boolean,attribute:"sync-scroll",noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get labelA(){return this._labelA}set labelA(next){const old=this._labelA;this._labelA=next??"",this.requestUpdate("labelA",old)}get labelB(){return this._labelB}set labelB(next){const old=this._labelB;this._labelB=next??"",this.requestUpdate("labelB",old)}get vote(){return this._vote}set vote(next){this.voteAssignedInCommit=!0;const old=this._vote;this._vote=next??null,this._vote?this.setAttribute("vote",this._vote):this.removeAttribute("vote"),this.requestUpdate("vote",old)}get itemId(){return this._itemId}set itemId(next){const old=this._itemId;this._itemId=next??"",old!==this._itemId&&(this.pendingScrollReset=!0),this.requestUpdate("itemId",old)}get syncScroll(){return this._syncScroll}set syncScroll(next){const old=this._syncScroll;this._syncScroll=!!next,this.requestUpdate("syncScroll",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old)}disconnectedCallback(){this.resetScrollSyncFrame(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetScrollSyncFrame()}resetScrollSyncFrame(){this.ownerRealmGeneration+=1,this.syncScrollRafId!==void 0&&this.syncScrollRafOwner?.cancelAnimationFrame(this.syncScrollRafId),this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1}castVote(choice){if(this.disabled)return;const itemId=this.itemId,labelAText=this.labelA||this.localize("compareResponseA"),labelBText=this.labelB||this.localize("compareResponseB"),label=choice==="a"?labelAText:choice==="b"?labelBText:choice==="tie"?this.localize("compareVoteTie"):this.localize("compareVoteBothBad");this.emit("lr-vote",{choice,itemId},{cancelable:!0}).defaultPrevented||(this.itemId===itemId&&(this.vote=choice),this.liveRegion?.announce(this.localize("compareVoteRecorded",void 0,{label}),{force:!0}))}voteButton(choice,label){return!Array.isArray(this.allowedVotes)||!this.allowedVotes.includes(choice)?nothing:html`<button
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{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./compare-panel.styles.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LYRA_DEFAULT_comparePanel,LYRA_DEFAULT_compareResponseA,LYRA_DEFAULT_compareResponseB,LYRA_DEFAULT_compareVoteBetter,LYRA_DEFAULT_compareVoteBothBad,LYRA_DEFAULT_compareVoteLabel,LYRA_DEFAULT_compareVoteRecorded,LYRA_DEFAULT_compareVoteTie}from"../../../internal/default-strings.generated.js";class LyraComparePanel extends LyraElement{constructor(){super(...arguments),this.hasPromptSlot=!1,this._labelA="",this._labelB="",this._vote=null,this._itemId="",this._syncScroll=!1,this._disabled=!1,this.pendingScrollReset=!1,this.suppressSync=!1,this.ownerRealmGeneration=0,this.voteAssignedInCommit=!1,this.allowedVotes=["a","b","tie","both-bad"],this.onPromptSlotChange=e=>{this.collectPromptSlotContent(e.target)},this.onPaneScroll=source=>()=>{if(!this.syncScroll||this.suppressSync)return;const from=source==="a"?this.paneAEl:this.paneBEl,to=source==="a"?this.paneBEl:this.paneAEl;if(!from||!to)return;const fromMax=from.scrollHeight-from.clientHeight,toMax=to.scrollHeight-to.clientHeight;if(fromMax<=0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected)return;const fraction=from.scrollTop/fromMax;this.suppressSync=!0,to.scrollTop=fraction*toMax;const generation=this.ownerRealmGeneration,handle=ownerWindow.requestAnimationFrame(()=>{this.syncScrollRafId!==handle||this.syncScrollRafOwner!==ownerWindow||this.syncScrollRafDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1)});this.syncScrollRafId=handle,this.syncScrollRafOwner=ownerWindow,this.syncScrollRafDocument=ownerDocument}}static{this.defaultStrings={...super.defaultStrings,comparePanel:LYRA_DEFAULT_comparePanel,compareResponseA:LYRA_DEFAULT_compareResponseA,compareResponseB:LYRA_DEFAULT_compareResponseB,compareVoteBetter:LYRA_DEFAULT_compareVoteBetter,compareVoteBothBad:LYRA_DEFAULT_compareVoteBothBad,compareVoteLabel:LYRA_DEFAULT_compareVoteLabel,compareVoteRecorded:LYRA_DEFAULT_compareVoteRecorded,compareVoteTie:LYRA_DEFAULT_compareVoteTie}}static{this.ownedCollectionProperties=Object.freeze(["allowedVotes"])}static{this.styles=[LyraElement.styles,styles]}static{this.properties={labelA:{attribute:"label-a",noAccessor:!0},labelB:{attribute:"label-b",noAccessor:!0},vote:{reflect:!0,noAccessor:!0},itemId:{attribute:"item-id",noAccessor:!0},syncScroll:{type:Boolean,attribute:"sync-scroll",noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get labelA(){return this._labelA}set labelA(next){const old=this._labelA;this._labelA=next??"",this.requestUpdate("labelA",old)}get labelB(){return this._labelB}set labelB(next){const old=this._labelB;this._labelB=next??"",this.requestUpdate("labelB",old)}get vote(){return this._vote}set vote(next){this.voteAssignedInCommit=!0;const old=this._vote;this._vote=next??null,this._vote?this.setAttribute("vote",this._vote):this.removeAttribute("vote"),this.requestUpdate("vote",old)}get itemId(){return this._itemId}set itemId(next){const old=this._itemId;this._itemId=next??"",old!==this._itemId&&(this.pendingScrollReset=!0),this.requestUpdate("itemId",old)}get syncScroll(){return this._syncScroll}set syncScroll(next){const old=this._syncScroll;this._syncScroll=!!next,this.requestUpdate("syncScroll",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old)}collectPromptSlotContent(slot){this.hasPromptSlot=slot.assignedNodes({flatten:!0}).length>0}disconnectedCallback(){this.resetScrollSyncFrame(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetScrollSyncFrame()}resetScrollSyncFrame(){this.ownerRealmGeneration+=1,this.syncScrollRafId!==void 0&&this.syncScrollRafOwner?.cancelAnimationFrame(this.syncScrollRafId),this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1}castVote(choice){if(this.disabled)return;const itemId=this.itemId,labelAText=this.labelA||this.localize("compareResponseA"),labelBText=this.labelB||this.localize("compareResponseB"),label=choice==="a"?labelAText:choice==="b"?labelBText:choice==="tie"?this.localize("compareVoteTie"):this.localize("compareVoteBothBad");this.emit("lr-vote",{choice,itemId},{cancelable:!0}).defaultPrevented||(this.itemId===itemId&&(this.vote=choice),this.liveRegion?.announce(this.localize("compareVoteRecorded",void 0,{label}),{force:!0}))}voteButton(choice,label){return!Array.isArray(this.allowedVotes)||!this.allowedVotes.includes(choice)?nothing:html`<button
2
2
  part="vote-button"
3
3
  type="button"
4
4
  ?disabled=${this.disabled}
@@ -7,7 +7,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
7
7
  @click=${()=>this.castVote(choice)}
8
8
  >
9
9
  ${label}
10
- </button>`}willUpdate(changed){super.willUpdate(changed),changed.has("itemId")&&!this.voteAssignedInCommit&&(this.vote=null)}updated(changed){super.updated(changed),this.voteAssignedInCommit=!1,changed.has("syncScroll")&&!this.syncScroll&&this.resetScrollSyncFrame(),this.pendingScrollReset&&(this.pendingScrollReset=!1,this.paneAEl&&(this.paneAEl.scrollTop=0),this.paneBEl&&(this.paneBEl.scrollTop=0))}render(){const labelAText=this.labelA||this.localize("compareResponseA"),labelBText=this.labelB||this.localize("compareResponseB");return html`
10
+ </button>`}willUpdate(changed){super.willUpdate(changed),changed.has("itemId")&&!this.voteAssignedInCommit&&(this.vote=null)}updated(changed){super.updated(changed),this.voteAssignedInCommit=!1,changed.has("syncScroll")&&!this.syncScroll&&this.resetScrollSyncFrame(),this.pendingScrollReset&&(this.pendingScrollReset=!1,this.paneAEl&&(this.paneAEl.scrollTop=0),this.paneBEl&&(this.paneBEl.scrollTop=0))}firstUpdated(changed){super.firstUpdated(changed);const slot=this.promptSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectPromptSlotContent(s))})}render(){const labelAText=this.labelA||this.localize("compareResponseA"),labelBText=this.labelB||this.localize("compareResponseB");return html`
11
11
  <div
12
12
  part="base"
13
13
  role=${overallSemanticRole(this,"group")??nothing}
@@ -34,4 +34,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
34
34
  </div>
35
35
  </div>
36
36
  <lr-live-region part="live-region" mode="polite"></lr-live-region>
37
- `}}__decorate([state()],LyraComparePanel.prototype,"hasPromptSlot",void 0),__decorate([query('[part="pane-a"]')],LyraComparePanel.prototype,"paneAEl",void 0),__decorate([query('[part="pane-b"]')],LyraComparePanel.prototype,"paneBEl",void 0),__decorate([query("lr-live-region")],LyraComparePanel.prototype,"liveRegion",void 0),__decorate([property({attribute:!1})],LyraComparePanel.prototype,"allowedVotes",void 0);export{LyraComparePanel};
37
+ `}}__decorate([state()],LyraComparePanel.prototype,"hasPromptSlot",void 0),__decorate([query('slot[name="prompt"]')],LyraComparePanel.prototype,"promptSlot",void 0),__decorate([query('[part="pane-a"]')],LyraComparePanel.prototype,"paneAEl",void 0),__decorate([query('[part="pane-b"]')],LyraComparePanel.prototype,"paneBEl",void 0),__decorate([query("lr-live-region")],LyraComparePanel.prototype,"liveRegion",void 0),__decorate([property({attribute:!1})],LyraComparePanel.prototype,"allowedVotes",void 0);export{LyraComparePanel};
@@ -6,9 +6,13 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
6
6
  export type ConfirmBarVariant=Extract<LyraVariant,'neutral'|'danger'>;
7
7
  /**
8
8
  * Where the bar hands focus once a decision lands. An element, `null` for "no preference", or a
9
- * thunk resolved at that moment -- a host that swaps a focused control out for this bar often
10
- * re-creates that control on the way back, so the element it wants focus returned to does not
11
- * necessarily exist yet when the bar is mounted.
9
+ * thunk -- called at handoff time and, only if that first call does not yet name a live,
10
+ * focusable control, called again once the host has had a chance to react to the decision. A host
11
+ * that swaps a focused control out for this bar often re-creates that control on the way back,
12
+ * asynchronously, so the element it wants focus returned to does not necessarily exist yet at the
13
+ * moment the decision is made; the second call is what lets that motivating case actually work. A
14
+ * plain element value is resolved once, synchronously, and never retried -- it names something
15
+ * that either already exists or never will.
12
16
  */
13
17
  export type ConfirmBarReturnFocusTarget=HTMLElement|null|(()=>HTMLElement|null);
14
18
  /**
@@ -36,7 +40,11 @@ export type ConfirmBarWaitUntil=(promise:Promise<unknown>)=>void;export interfac
36
40
  * it) and the same handoff returns focus there instead, falling back to `[part="status"]` whenever
37
41
  * the named element is missing, detached, `inert` or otherwise refuses focus -- an `inert` element
38
42
  * refuses `focus()` silently, so an unchecked handoff would strand the user on `<body>` at exactly
39
- * the moment a decision was announced.
43
+ * the moment a decision was announced. When `returnFocusTo` is a thunk and that immediate call
44
+ * fails, the same handoff quietly retries once more after the host has had a real chance to react
45
+ * (see `ConfirmBarReturnFocusTarget`'s doc comment) -- the case a thunk exists for in the first
46
+ * place is a host that has not re-created its control yet at the instant the decision lands, and
47
+ * every supported host framework re-renders asynchronously relative to this synchronous handoff.
40
48
  *
41
49
  * "Never steals focus" and "no Escape semantics" describe the bar's behavior when `autofocus` and
42
50
  * `escape-denies` are both left unset (the default). A host that swaps a focused control out for
@@ -213,12 +221,15 @@ autofocus:boolean;
213
221
  escapeDenies:boolean;
214
222
  /** Where focus goes once a decision lands, instead of parking on `[part="status"]`. Property-only
215
223
  * (an element reference has no attribute form), and a thunk is accepted so the lookup happens at
216
- * handoff time rather than at assignment time. The motivating case is the one the class doc
217
- * opens with: a host swaps a focused control out for this bar, and once the decision is made
218
- * focus belongs back on that control (or on whatever replaced it), not on a status line the host
219
- * is about to unmount. Unset (`null`) keeps the shipped behavior exactly. A named target that is
220
- * missing, detached, `inert` or otherwise refuses focus falls back to `[part="status"]` rather
221
- * than to `<body>`. */
224
+ * handoff time rather than at assignment time -- and, if that first lookup does not yet name a
225
+ * live control, is repeated once more after the host has had a chance to react (see
226
+ * `ConfirmBarReturnFocusTarget`). The motivating case is the one the class doc opens with: a
227
+ * host swaps a focused control out for this bar, and once the decision is made focus belongs
228
+ * back on that control (or on whatever replaced it), not on a status line the host is about to
229
+ * unmount -- and that replacement control is typically re-created asynchronously, after the
230
+ * decision has already landed. Unset (`null`) keeps the shipped behavior exactly. A named
231
+ * target that is missing, detached, `inert` or otherwise refuses focus falls back to
232
+ * `[part="status"]` rather than to `<body>`. */
222
233
  returnFocusTo:ConfirmBarReturnFocusTarget;private statusEl?;private liveRegion?;private hasBodySlot;private readonly headingId;
223
234
  /** Bumped by every `decide()` that starts awaiting a `waitUntil()` promise, so a settlement that
224
235
  * arrives after a newer decision began (a bounce, then a second activation) is discarded instead
@@ -261,8 +272,21 @@ private returnFocusAfterBounce;
261
272
  private resolvedReturnFocusTarget;
262
273
  /**
263
274
  * The terminal focus handoff: the host's named return target when it names one that can really
264
- * take focus, else the always-present `[part="status"]`. Unconditional, exactly as the
265
- * `[part="status"]` move it replaces always was -- the control the user just activated is about
266
- * to unmount, so the handoff cannot wait to be sure that control held focus.
275
+ * take focus right now, else the always-present `[part="status"]` -- unconditional, exactly as
276
+ * the `[part="status"]` move it replaces always was, because the control the user just activated
277
+ * is about to unmount and the handoff cannot wait to be sure that control held focus.
278
+ *
279
+ * `returnFocusTo` accepts a thunk precisely so a host can name a control it has not re-created
280
+ * yet -- the class doc's motivating case: a host swaps this bar back out for the control it
281
+ * replaced, and every supported host framework does that asynchronously relative to this
282
+ * synchronous handoff. Resolving the thunk only here would therefore always find that control
283
+ * missing, which is the whole defect this guards against. When the immediate resolution fails
284
+ * (null, disconnected, `inert`, or otherwise not focusable) and `returnFocusTo` is itself a
285
+ * function, `deferComposedFocusRepair()` re-resolves it once the host has had a real chance to
286
+ * react, and moves focus there only if it has since appeared and nothing else has claimed focus
287
+ * in the meantime. A plain element value is never retried: it names something that either
288
+ * already exists or never will, so the single synchronous resolution above is already the final
289
+ * answer, and every previously-working synchronous case (an immediately-resolving thunk or a
290
+ * live element) returns before scheduling anything.
267
291
  */
268
292
  private handOffDecidedFocus;protected updated(changed:PropertyValues):void;private renderHeading;private statusText;private stopNestedLifecycle;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-confirm-bar':LyraConfirmBar;}}
@@ -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,svg}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hasRealContent,hostAriaLabel,nextId}from"../../../internal/a11y.js";import{focusFirstAvailable,isComposedFocusAvailable,repairComposedFocus}from"../../../internal/focus-navigation.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{resolveLocalizedParts}from"../../../internal/localization-runtime.js";import"../../layout/details/details.class.js";import"../../utility/json-viewer/json-viewer.class.js";import"../../utility/live-region/live-region.class.js";import"../../forms/button/button.class.js";import{styles}from"./confirm-bar.styles.js";import{approvalAction}from"../approval-state.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmApprovedAnnounce,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_confirmDeniedAnnounce,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_toolApprovalArgsLabel,LYRA_DEFAULT_toolApprovalGenericTool,LYRA_DEFAULT_toolApprovalHeading}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function approvedIcon(){return svg`
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,svg}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hasRealContent,hostAriaLabel,nextId}from"../../../internal/a11y.js";import{deferComposedFocusRepair,focusFirstAvailable,isComposedFocusAvailable,repairComposedFocus}from"../../../internal/focus-navigation.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{resolveLocalizedParts}from"../../../internal/localization-runtime.js";import"../../layout/details/details.class.js";import"../../utility/json-viewer/json-viewer.class.js";import"../../utility/live-region/live-region.class.js";import"../../forms/button/button.class.js";import{styles}from"./confirm-bar.styles.js";import{approvalAction}from"../approval-state.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmApprovedAnnounce,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_confirmDeniedAnnounce,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_toolApprovalArgsLabel,LYRA_DEFAULT_toolApprovalGenericTool,LYRA_DEFAULT_toolApprovalHeading}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function approvedIcon(){return svg`
2
2
  <svg width="1em" height="1em" viewBox=${ICON_VIEW_BOX} fill="none" stroke="currentColor" stroke-width=${ICON_STROKE_WIDTH} stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
3
3
  <circle cx="12" cy="12" r="9"></circle>
4
4
  <polyline points="8 12.5 11 15.5 16 9.5"></polyline>
@@ -9,7 +9,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
9
9
  <line x1="9" y1="9" x2="15" y2="15"></line>
10
10
  <line x1="15" y1="9" x2="9" y2="15"></line>
11
11
  </svg>
12
- `}class LyraConfirmBar extends LyraElement{constructor(){super(...arguments),this.toolName="",this.heading="",this.args=void 0,this._decision=null,this._pending=null,this.dispatchWriteGuard=new VetoWriteGuard,this.disabled=!1,this.variant="neutral",this.compact=!1,this.frame="card",this.autofocus=!1,this.escapeDenies=!1,this.returnFocusTo=null,this.hasBodySlot=!1,this.headingId=nextId("confirm-bar-heading"),this.deferralGeneration=0,this.onBodySlotChange=e=>{this.hasBodySlot=hasRealContent(e.target.assignedNodes({flatten:!0}))},this.onBaseKeyDown=event=>{if(!this.escapeDenies||event.key!=="Escape")return;const decisionBefore=this.decision,pendingBefore=this.pending;this.decide("denied"),(this.decision!==decisionBefore||this.pending!==pendingBefore)&&event.stopPropagation()}}static{this.defaultStrings={...super.defaultStrings,approve:LYRA_DEFAULT_approve,collapse:LYRA_DEFAULT_collapse,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmApprovedAnnounce:LYRA_DEFAULT_confirmApprovedAnnounce,confirmDenied:LYRA_DEFAULT_confirmDenied,confirmDeniedAnnounce:LYRA_DEFAULT_confirmDeniedAnnounce,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,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,toolApprovalArgsLabel:LYRA_DEFAULT_toolApprovalArgsLabel,toolApprovalGenericTool:LYRA_DEFAULT_toolApprovalGenericTool,toolApprovalHeading:LYRA_DEFAULT_toolApprovalHeading}}static{this.styles=[LyraElement.styles,styles]}get decision(){return this._decision}set decision(value){const previous=this._decision;this._decision=value,markVetoGuardWrite(this.dispatchWriteGuard),this.requestUpdate("decision",previous)}get pending(){return this._pending}set pending(value){const previous=this._pending;this._pending=value,markVetoGuardWrite(this.dispatchWriteGuard),this.requestUpdate("pending",previous)}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated){const defaultSlotNodes=Array.from(this.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||!node.getAttribute("slot"));this.hasBodySlot=hasRealContent(defaultSlotNodes)}changed.has("decision")&&changed.get("decision")!==void 0&&this.decision!=null&&this.pending!=null&&(this.handOffDecidedFocus(),this.pending=null)}firstUpdated(changed){super.firstUpdated(changed),this.autofocus&&this.focusInitial()}focusInitial(){this.updateComplete.then(async()=>{if(!this.isConnected)return;const deny=this.renderRoot.querySelector('[part="deny-button"]');if(await deny?.updateComplete,!this.isConnected)return;(deny&&isComposedFocusAvailable(deny)?deny:this.statusEl)?.focus()})}decide(next){if(this.disabled||this.decision!=null||this.pending!=null)return;const deferrals=[];let dispatching=!0;const waitUntil=promise=>{if(!dispatching){devWarnOnce("lyra-confirm-bar-wait-until-after-dispatch","<lr-confirm-bar>: waitUntil() was called after its lr-approve/lr-deny dispatch had finished, so it did nothing. Call it synchronously from the listener; the promise it receives may settle whenever it likes.");return}deferrals.push(Promise.resolve(promise))};this.dispatchWriteGuard.open();const event=next==="approved"?this.emit("lr-approve",{args:this.args,waitUntil},{cancelable:!0}):this.emit("lr-deny",{waitUntil},{cancelable:!0});dispatching=!1;const listenerResolvedItself=this.dispatchWriteGuard.touched;if(deferrals.length>0||event.defaultPrevented){if(this.statusEl?.focus(),listenerResolvedItself){for(const deferral of deferrals)deferral.catch(()=>{});return}this.pending=approvalAction(next),deferrals.length>0&&this.awaitDeferredDecision(Promise.all(deferrals),next);return}this.handOffDecidedFocus(),this.decision=next}awaitDeferredDecision(promise,next){const action=approvalAction(next);this.deferralGeneration+=1;const generation=this.deferralGeneration,stillOurs=()=>generation===this.deferralGeneration&&this.decision==null&&this.pending===action;promise.then(()=>{stillOurs()&&(this.decision=next)},()=>{stillOurs()&&(this.pending=null,this.returnFocusAfterBounce(action))})}returnFocusAfterBounce(action){this.updateComplete.then(()=>{!this.isConnected||this.decision!=null||this.pending!=null||repairComposedFocus(this,()=>this.renderRoot.querySelector(`[part="${action}-button"]`))})}resolvedReturnFocusTarget(){const target=this.returnFocusTo;return typeof target=="function"?target():target}handOffDecidedFocus(){focusFirstAvailable([this.resolvedReturnFocusTarget(),this.statusEl])}updated(changed){super.updated(changed);const decision=this.decision;if(changed.has("decision")&&changed.get("decision")!==void 0&&decision!=null){const key=decision==="approved"?"confirmApprovedAnnounce":"confirmDeniedAnnounce";this.liveRegion?.announce(this.localize(key),{force:!0}),this.emit("lr-decision-settled",{decision})}}renderHeading(){if(this.heading)return html`${this.heading}`;const toolName=this.toolName||this.localize("toolApprovalGenericTool"),template=this.localize("toolApprovalHeading"),pieces=resolveLocalizedParts(template,marker=>this.localize("toolApprovalHeading",void 0,{tool:marker}));return html`${pieces.map((piece,index)=>index<pieces.length-1?html`${piece}<span part="tool-name">${toolName}</span>`:piece)}`}statusText(){return this.decision==="approved"?this.localize("confirmApproved"):this.localize("confirmDenied")}stopNestedLifecycle(event){event.stopPropagation()}render(){const decided=this.decision!=null,hostLabel=hostAriaLabel(this);return html`
12
+ `}class LyraConfirmBar extends LyraElement{constructor(){super(...arguments),this.toolName="",this.heading="",this.args=void 0,this._decision=null,this._pending=null,this.dispatchWriteGuard=new VetoWriteGuard,this.disabled=!1,this.variant="neutral",this.compact=!1,this.frame="card",this.autofocus=!1,this.escapeDenies=!1,this.returnFocusTo=null,this.hasBodySlot=!1,this.headingId=nextId("confirm-bar-heading"),this.deferralGeneration=0,this.onBodySlotChange=e=>{this.hasBodySlot=hasRealContent(e.target.assignedNodes({flatten:!0}))},this.onBaseKeyDown=event=>{if(!this.escapeDenies||event.key!=="Escape")return;const decisionBefore=this.decision,pendingBefore=this.pending;this.decide("denied"),(this.decision!==decisionBefore||this.pending!==pendingBefore)&&event.stopPropagation()}}static{this.defaultStrings={...super.defaultStrings,approve:LYRA_DEFAULT_approve,collapse:LYRA_DEFAULT_collapse,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmApprovedAnnounce:LYRA_DEFAULT_confirmApprovedAnnounce,confirmDenied:LYRA_DEFAULT_confirmDenied,confirmDeniedAnnounce:LYRA_DEFAULT_confirmDeniedAnnounce,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,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,toolApprovalArgsLabel:LYRA_DEFAULT_toolApprovalArgsLabel,toolApprovalGenericTool:LYRA_DEFAULT_toolApprovalGenericTool,toolApprovalHeading:LYRA_DEFAULT_toolApprovalHeading}}static{this.styles=[LyraElement.styles,styles]}get decision(){return this._decision}set decision(value){const previous=this._decision;this._decision=value,markVetoGuardWrite(this.dispatchWriteGuard),this.requestUpdate("decision",previous)}get pending(){return this._pending}set pending(value){const previous=this._pending;this._pending=value,markVetoGuardWrite(this.dispatchWriteGuard),this.requestUpdate("pending",previous)}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated){const defaultSlotNodes=Array.from(this.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||!node.getAttribute("slot"));this.hasBodySlot=hasRealContent(defaultSlotNodes)}changed.has("decision")&&changed.get("decision")!==void 0&&this.decision!=null&&this.pending!=null&&(this.handOffDecidedFocus(),this.pending=null)}firstUpdated(changed){super.firstUpdated(changed),this.autofocus&&this.focusInitial()}focusInitial(){this.updateComplete.then(async()=>{if(!this.isConnected)return;const deny=this.renderRoot.querySelector('[part="deny-button"]');if(await deny?.updateComplete,!this.isConnected)return;(deny&&isComposedFocusAvailable(deny)?deny:this.statusEl)?.focus()})}decide(next){if(this.disabled||this.decision!=null||this.pending!=null)return;const deferrals=[];let dispatching=!0;const waitUntil=promise=>{if(!dispatching){devWarnOnce("lyra-confirm-bar-wait-until-after-dispatch","<lr-confirm-bar>: waitUntil() was called after its lr-approve/lr-deny dispatch had finished, so it did nothing. Call it synchronously from the listener; the promise it receives may settle whenever it likes.");return}deferrals.push(Promise.resolve(promise))};this.dispatchWriteGuard.open();const event=next==="approved"?this.emit("lr-approve",{args:this.args,waitUntil},{cancelable:!0}):this.emit("lr-deny",{waitUntil},{cancelable:!0});dispatching=!1;const listenerResolvedItself=this.dispatchWriteGuard.touched;if(deferrals.length>0||event.defaultPrevented){if(this.statusEl?.focus(),listenerResolvedItself){for(const deferral of deferrals)deferral.catch(()=>{});return}this.pending=approvalAction(next),deferrals.length>0&&this.awaitDeferredDecision(Promise.all(deferrals),next);return}this.handOffDecidedFocus(),this.decision=next}awaitDeferredDecision(promise,next){const action=approvalAction(next);this.deferralGeneration+=1;const generation=this.deferralGeneration,stillOurs=()=>generation===this.deferralGeneration&&this.decision==null&&this.pending===action;promise.then(()=>{stillOurs()&&(this.decision=next)},()=>{stillOurs()&&(this.pending=null,this.returnFocusAfterBounce(action))})}returnFocusAfterBounce(action){this.updateComplete.then(()=>{!this.isConnected||this.decision!=null||this.pending!=null||repairComposedFocus(this,()=>this.renderRoot.querySelector(`[part="${action}-button"]`))})}resolvedReturnFocusTarget(){const target=this.returnFocusTo;return typeof target=="function"?target():target}handOffDecidedFocus(){const target=this.resolvedReturnFocusTarget();target&&focusFirstAvailable([target])||(focusFirstAvailable([this.statusEl]),typeof this.returnFocusTo=="function"&&this.statusEl&&deferComposedFocusRepair(this,this.statusEl,()=>this.resolvedReturnFocusTarget()))}updated(changed){super.updated(changed);const decision=this.decision;if(changed.has("decision")&&changed.get("decision")!==void 0&&decision!=null){const key=decision==="approved"?"confirmApprovedAnnounce":"confirmDeniedAnnounce";this.liveRegion?.announce(this.localize(key),{force:!0}),this.emit("lr-decision-settled",{decision})}}renderHeading(){if(this.heading)return html`${this.heading}`;const toolName=this.toolName||this.localize("toolApprovalGenericTool"),template=this.localize("toolApprovalHeading"),pieces=resolveLocalizedParts(template,marker=>this.localize("toolApprovalHeading",void 0,{tool:marker}));return html`${pieces.map((piece,index)=>index<pieces.length-1?html`${piece}<span part="tool-name">${toolName}</span>`:piece)}`}statusText(){return this.decision==="approved"?this.localize("confirmApproved"):this.localize("confirmDenied")}stopNestedLifecycle(event){event.stopPropagation()}render(){const decided=this.decision!=null,hostLabel=hostAriaLabel(this);return html`
13
13
  <div
14
14
  part="base"
15
15
  role="group"
@@ -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,svg,nothing}from"lit";import{repeat}from"lit/directives/repeat.js";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{chevronIcon}from"../../../internal/icons.js";import{styles}from"./task-list.styles.js";import{presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_item,LYRA_DEFAULT_items,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_taskListCompletedOfTotal,LYRA_DEFAULT_taskListLabel,LYRA_DEFAULT_taskListStepCompletedAnnounce,LYRA_DEFAULT_taskListStepFailedAnnounce,LYRA_DEFAULT_taskListStepStartedAnnounce,LYRA_DEFAULT_treeNodeMoved}from"../../../internal/default-strings.generated.js";function normalizeTaskStatus(value){return value==="running"||value==="success"||value==="error"?value:"pending"}const DEEP_NESTING_WARNING_KEY="lyra-task-list-nesting-depth",DEEP_NESTING_WARNING="<lr-task-list>: task nesting deeper than one level is ignored.",MAX_RENDERED_TASKS=500;function validTaskItems(value){const items=[];for(const item of Array.isArray(value)?value:[])try{item!==null&&typeof item=="object"&&!Array.isArray(item)&&typeof item.id=="string"&&item.id.trim().length>0&&items.push(item)}catch{}return items}const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
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,svg,nothing}from"lit";import{repeat}from"lit/directives/repeat.js";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId,srOnly}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{chevronIcon}from"../../../internal/icons.js";import{styles}from"./task-list.styles.js";import{presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_item,LYRA_DEFAULT_items,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_taskListCompletedOfTotal,LYRA_DEFAULT_taskListLabel,LYRA_DEFAULT_taskListStepCompletedAnnounce,LYRA_DEFAULT_taskListStepFailedAnnounce,LYRA_DEFAULT_taskListStepStartedAnnounce,LYRA_DEFAULT_treeNodeMoved}from"../../../internal/default-strings.generated.js";function normalizeTaskStatus(value){return value==="running"||value==="success"||value==="error"?value:"pending"}const DEEP_NESTING_WARNING_KEY="lyra-task-list-nesting-depth",DEEP_NESTING_WARNING="<lr-task-list>: task nesting deeper than one level is ignored.",MAX_RENDERED_TASKS=500;function validTaskItems(value){const items=[];for(const item of Array.isArray(value)?value:[])try{item!==null&&typeof item=="object"&&!Array.isArray(item)&&typeof item.id=="string"&&item.id.trim().length>0&&items.push(item)}catch{}return items}const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
2
2
  <svg
3
3
  width="1em"
4
4
  height="1em"
@@ -15,7 +15,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
15
15
  <circle cx="12" cy="12" r="9"></circle>
16
16
  <line x1="9" y1="9" x2="15" y2="15"></line>
17
17
  <line x1="15" y1="9" x2="9" y2="15"></line>
18
- `)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError"};class LyraTaskList extends LyraElement{constructor(){super(...arguments),this.items=[],this.reorderable=!1,this.headingLevel="3",this.expanded=!0,this.collapsible=!0,this.compact=!1,this.frame="card",this.headerId=nextId("task-list-header"),this.bodyId=nextId("task-list-body"),this.isMounting=!0,this.previousStatusById=new Map,this.pendingFocusId=null,this.toggle=()=>{this.collapsible&&(this.expanded=!this.expanded,this.emit("lr-toggle",{expanded:this.expanded}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,item:LYRA_DEFAULT_item,items:LYRA_DEFAULT_items,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,taskListCompletedOfTotal:LYRA_DEFAULT_taskListCompletedOfTotal,taskListLabel:LYRA_DEFAULT_taskListLabel,taskListStepCompletedAnnounce:LYRA_DEFAULT_taskListStepCompletedAnnounce,taskListStepFailedAnnounce:LYRA_DEFAULT_taskListStepFailedAnnounce,taskListStepStartedAnnounce:LYRA_DEFAULT_taskListStepStartedAnnounce,treeNodeMoved:LYRA_DEFAULT_treeNodeMoved}}static{this.ownedCollectionProperties=Object.freeze(["items"])}static{this.styles=[LyraElement.styles,styles]}willUpdate(changed){if(super.willUpdate(changed),changed.has("reorderable")&&!this.reorderable&&this.clearPendingReorder(),changed.has("items")){for(const item of validTaskItems(this.items))for(const child of validTaskItems(item.children))validTaskItems(child.children).length>0&&devWarnOnce(DEEP_NESTING_WARNING_KEY,DEEP_NESTING_WARNING);this.capturePendingReorderFocus()}}updated(changed){super.updated(changed);const wasMounting=this.isMounting||!this.isConnected;this.isMounting=!this.isConnected,changed.has("items")&&(this.diffAndAnnounce(wasMounting),this.confirmPendingReorder())}disconnectedCallback(){super.disconnectedCallback(),this.isMounting=!0,this.previousStatusById.clear(),this.clearPendingReorder()}connectedCallback(){const reconnecting=this.hasUpdated;this.isMounting=!0,this.previousStatusById.clear(),super.connectedCallback(),reconnecting&&this.requestUpdate("items")}flattenOneLevel(items){const out=[];for(const item of validTaskItems(items)){out.push(item);for(const child of validTaskItems(item.children))out.push(child)}return out}diffAndAnnounce(firstSight){const region=this.liveRegion,nextMap=new Map;for(const item of this.flattenOneLevel(validTaskItems(this.items))){const status=normalizeTaskStatus(item.status);if(nextMap.set(item.id,status),!firstSight&&region){const previous=this.previousStatusById.get(item.id);previous!==void 0&&previous!==status&&(status==="running"?(region.mode="polite",region.announce(this.localize("taskListStepStartedAnnounce",void 0,{label:item.label}),{force:!0})):status==="success"?(region.mode="polite",region.announce(this.localize("taskListStepCompletedAnnounce",void 0,{label:item.label}),{force:!0})):status==="error"&&(region.mode="assertive",region.announce(this.localize("taskListStepFailedAnnounce",void 0,{label:item.label}),{force:!0})))}}this.previousStatusById=nextMap}idsAreUnique(){const ids=new Set;for(const item of this.flattenOneLevel(this.items)){if(item.id.trim().length===0||ids.has(item.id))return!1;ids.add(item.id)}return!0}canReorderItems(){if(!this.reorderable||!Array.isArray(this.items))return!1;const items=validTaskItems(this.items);return items.length!==this.items.length||items.some(item=>Array.isArray(item.children)&&validTaskItems(item.children).length!==item.children.length)?!1:this.idsAreUnique()}siblingItems(parentId){return parentId===null?this.items:this.items.find(item=>item.id===parentId)?.children}requestReorder(item,parentId,delta){if(!this.canReorderItems())return;const siblings=this.siblingItems(parentId);if(!siblings)return;const fromIndex=siblings.findIndex(candidate=>candidate.id===item.id),toIndex=fromIndex+delta;fromIndex<0||toIndex<0||toIndex>=siblings.length||(this.pendingReorder={id:item.id,parentId,originalSiblingIds:siblings.map(candidate=>candidate.id),targetSiblingId:siblings[toIndex].id,fromIndex,toIndex},this.pendingFocusId=null,this.emit("lr-reorder",{taskId:item.id,parentTaskId:parentId,fromIndex,toIndex}))}onItemKeyDown(event,item,parentId){event.composedPath()[0]===event.currentTarget&&(!this.canReorderItems()||!(event.ctrlKey||event.metaKey)||event.key!=="ArrowUp"&&event.key!=="ArrowDown"||(event.preventDefault(),this.requestReorder(item,parentId,event.key==="ArrowDown"?1:-1)))}capturePendingReorderFocus(){const pending=this.pendingReorder;if(!pending)return;const active=activeElementIn(this.shadowRoot);this.pendingFocusId=active instanceof HTMLElement&&active.getAttribute("part")==="item"&&active.dataset.id===pending.id?pending.id:null}confirmPendingReorder(){const pending=this.pendingReorder;if(!pending)return;const siblings=this.siblingItems(pending.parentId);if(!siblings||!this.idsAreUnique()){this.clearPendingReorder();return}const siblingIds=siblings.map(item=>item.id);if(!(siblingIds.length!==pending.originalSiblingIds.length||siblingIds.some((id,index)=>id!==pending.originalSiblingIds[index])))return;this.pendingReorder=void 0;const restoreFocus=this.pendingFocusId===pending.id;if(this.pendingFocusId=null,siblingIds[pending.toIndex]!==pending.id||siblingIds[pending.fromIndex]!==pending.targetSiblingId)return;const moved=siblings[pending.toIndex],region=this.liveRegion;region&&(region.mode="polite",region.announce(this.localize("treeNodeMoved",void 0,{label:moved.label,index:getNumberFormat(this.effectiveLocale).format(pending.toIndex+1),total:getNumberFormat(this.effectiveLocale).format(siblings.length)}),{force:!0})),restoreFocus&&this.focusItem(pending.id)}focusItem(id){[...this.shadowRoot?.querySelectorAll('[part="item"]')??[]].find(candidate=>candidate.dataset.id===id)?.focus()}clearPendingReorder(){this.pendingReorder=void 0,this.pendingFocusId=null}renderItem(item,depth,parentId,canReorder){const status=normalizeTaskStatus(item.status),children=depth===0?validTaskItems(item.children):[],hasChildren=children.length>0;return html`
18
+ `)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError"};class LyraTaskList extends LyraElement{constructor(){super(...arguments),this.items=[],this.reorderable=!1,this.headingLevel="3",this.expanded=!0,this.collapsible=!0,this.compact=!1,this.frame="card",this.headerId=nextId("task-list-header"),this.bodyId=nextId("task-list-body"),this.isMounting=!0,this.previousStatusById=new Map,this.pendingFocusId=null,this.toggle=()=>{this.collapsible&&(this.expanded=!this.expanded,this.emit("lr-toggle",{expanded:this.expanded}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,item:LYRA_DEFAULT_item,items:LYRA_DEFAULT_items,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,taskListCompletedOfTotal:LYRA_DEFAULT_taskListCompletedOfTotal,taskListLabel:LYRA_DEFAULT_taskListLabel,taskListStepCompletedAnnounce:LYRA_DEFAULT_taskListStepCompletedAnnounce,taskListStepFailedAnnounce:LYRA_DEFAULT_taskListStepFailedAnnounce,taskListStepStartedAnnounce:LYRA_DEFAULT_taskListStepStartedAnnounce,treeNodeMoved:LYRA_DEFAULT_treeNodeMoved}}static{this.ownedCollectionProperties=Object.freeze(["items"])}static{this.styles=[LyraElement.styles,srOnly,styles]}willUpdate(changed){if(super.willUpdate(changed),changed.has("reorderable")&&!this.reorderable&&this.clearPendingReorder(),changed.has("items")){for(const item of validTaskItems(this.items))for(const child of validTaskItems(item.children))validTaskItems(child.children).length>0&&devWarnOnce(DEEP_NESTING_WARNING_KEY,DEEP_NESTING_WARNING);this.capturePendingReorderFocus()}}updated(changed){super.updated(changed);const wasMounting=this.isMounting||!this.isConnected;this.isMounting=!this.isConnected,changed.has("items")&&(this.diffAndAnnounce(wasMounting),this.confirmPendingReorder())}disconnectedCallback(){super.disconnectedCallback(),this.isMounting=!0,this.previousStatusById.clear(),this.clearPendingReorder()}connectedCallback(){const reconnecting=this.hasUpdated;this.isMounting=!0,this.previousStatusById.clear(),super.connectedCallback(),reconnecting&&this.requestUpdate("items")}flattenOneLevel(items){const out=[];for(const item of validTaskItems(items)){out.push(item);for(const child of validTaskItems(item.children))out.push(child)}return out}diffAndAnnounce(firstSight){const region=this.liveRegion,nextMap=new Map;for(const item of this.flattenOneLevel(validTaskItems(this.items))){const status=normalizeTaskStatus(item.status);if(nextMap.set(item.id,status),!firstSight&&region){const previous=this.previousStatusById.get(item.id);previous!==void 0&&previous!==status&&(status==="running"?(region.mode="polite",region.announce(this.localize("taskListStepStartedAnnounce",void 0,{label:item.label}),{force:!0})):status==="success"?(region.mode="polite",region.announce(this.localize("taskListStepCompletedAnnounce",void 0,{label:item.label}),{force:!0})):status==="error"&&(region.mode="assertive",region.announce(this.localize("taskListStepFailedAnnounce",void 0,{label:item.label}),{force:!0})))}}this.previousStatusById=nextMap}idsAreUnique(){const ids=new Set;for(const item of this.flattenOneLevel(this.items)){if(item.id.trim().length===0||ids.has(item.id))return!1;ids.add(item.id)}return!0}canReorderItems(){if(!this.reorderable||!Array.isArray(this.items))return!1;const items=validTaskItems(this.items);return items.length!==this.items.length||items.some(item=>Array.isArray(item.children)&&validTaskItems(item.children).length!==item.children.length)?!1:this.idsAreUnique()}siblingItems(parentId){return parentId===null?this.items:this.items.find(item=>item.id===parentId)?.children}requestReorder(item,parentId,delta){if(!this.canReorderItems())return;const siblings=this.siblingItems(parentId);if(!siblings)return;const fromIndex=siblings.findIndex(candidate=>candidate.id===item.id),toIndex=fromIndex+delta;fromIndex<0||toIndex<0||toIndex>=siblings.length||(this.pendingReorder={id:item.id,parentId,originalSiblingIds:siblings.map(candidate=>candidate.id),targetSiblingId:siblings[toIndex].id,fromIndex,toIndex},this.pendingFocusId=null,this.emit("lr-reorder",{taskId:item.id,parentTaskId:parentId,fromIndex,toIndex}))}onItemKeyDown(event,item,parentId){event.composedPath()[0]===event.currentTarget&&(!this.canReorderItems()||!(event.ctrlKey||event.metaKey)||event.key!=="ArrowUp"&&event.key!=="ArrowDown"||(event.preventDefault(),this.requestReorder(item,parentId,event.key==="ArrowDown"?1:-1)))}capturePendingReorderFocus(){const pending=this.pendingReorder;if(!pending)return;const active=activeElementIn(this.shadowRoot);this.pendingFocusId=active instanceof HTMLElement&&active.getAttribute("part")==="item"&&active.dataset.id===pending.id?pending.id:null}confirmPendingReorder(){const pending=this.pendingReorder;if(!pending)return;const siblings=this.siblingItems(pending.parentId);if(!siblings||!this.idsAreUnique()){this.clearPendingReorder();return}const siblingIds=siblings.map(item=>item.id);if(!(siblingIds.length!==pending.originalSiblingIds.length||siblingIds.some((id,index)=>id!==pending.originalSiblingIds[index])))return;this.pendingReorder=void 0;const restoreFocus=this.pendingFocusId===pending.id;if(this.pendingFocusId=null,siblingIds[pending.toIndex]!==pending.id||siblingIds[pending.fromIndex]!==pending.targetSiblingId)return;const moved=siblings[pending.toIndex],region=this.liveRegion;region&&(region.mode="polite",region.announce(this.localize("treeNodeMoved",void 0,{label:moved.label,index:getNumberFormat(this.effectiveLocale).format(pending.toIndex+1),total:getNumberFormat(this.effectiveLocale).format(siblings.length)}),{force:!0})),restoreFocus&&this.focusItem(pending.id)}focusItem(id){[...this.shadowRoot?.querySelectorAll('[part="item"]')??[]].find(candidate=>candidate.dataset.id===id)?.focus()}clearPendingReorder(){this.pendingReorder=void 0,this.pendingFocusId=null}renderItem(item,depth,parentId,canReorder){const status=normalizeTaskStatus(item.status),children=depth===0?validTaskItems(item.children):[],hasChildren=children.length>0;return html`
19
19
  <div
20
20
  part="item"
21
21
  role="listitem"
@@ -71,6 +71,10 @@ export type ToolCallStatus=LyraToolStatus;export interface ToolChipSelectDetail{
71
71
  * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner radius, on the
72
72
  * anchored detail tooltip.
73
73
  * @cssprop [--lr-overlay-shadow-anchored=var(--lr-shadow-m)] - Elevation of the anchored surface.
74
+ * @cssprop --lr-positioning-strategy - Cascading `absolute`/`fixed` override for the detail
75
+ * tooltip's `fixed` default, read from computed style when it is (re)positioned. Set it once on
76
+ * `:root`, a theme, or one clipping ancestor to change every unset tool call chip beneath it; an
77
+ * unrecognized value falls back to `fixed`.
74
78
  * @status stable
75
79
  * @since 4.0.0
76
80
  */
@@ -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,svg,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{nextId}from"../../../internal/a11y.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{styles}from"./tool-call-chip.styles.js";import{LYRA_DEFAULT_accessibleLabelSeparator,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusDenied,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_toolCall}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
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,svg,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{nextId}from"../../../internal/a11y.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{styles}from"./tool-call-chip.styles.js";import{LYRA_DEFAULT_accessibleLabelSeparator,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusDenied,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_toolCall}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
2
2
  <svg
3
3
  width="1em"
4
4
  height="1em"
@@ -15,7 +15,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
15
15
  <circle cx="12" cy="12" r="9"></circle>
16
16
  <line x1="9" y1="9" x2="15" y2="15"></line>
17
17
  <line x1="15" y1="9" x2="9" y2="15"></line>
18
- `)}function deniedIcon(){return icon(svg`<circle cx="12" cy="12" r="9"></circle><line x1="6" y1="18" x2="18" y2="6"></line>`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon,denied:deniedIcon},STATUS_LABEL={pending:"Pending",running:"Running",success:"Success",error:"Error",denied:"Denied"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_VALUES=new Set(Object.keys(STATUS_LABEL)),statusConverter={fromAttribute(value){return value!==null&&STATUS_VALUES.has(value)?value:"pending"},toAttribute(value){return value}};class LyraToolCallChip extends LyraElement{constructor(){super(...arguments),this.name="",this.category="",this.status="pending",this.summary="",this.icon="",this.callId="",this.hasDetailSlot=!1,this.tooltipOpen=!1,this.tooltipId=nextId("tool-call-chip-tooltip"),this.hovering=!1,this.focused=!1,this.onDetailSlotChange=e=>{this.hasDetailSlot=this.hasPreviewNodes(e.target.assignedNodes({flatten:!0})),this.hasDetailSlot||this.hideTooltip()},this.onMouseEnter=()=>{this.hovering=!0,this.showTooltip()},this.onMouseLeave=()=>{this.hovering=!1,!this.focused&&this.hideTooltip()},this.onFocus=()=>{this.focused=!0,this.showTooltip()},this.onBlur=()=>{this.focused=!1,!this.hovering&&this.hideTooltip()},this.onKeyDown=e=>{e.key==="Escape"&&this.tooltipOpen&&(e.stopPropagation(),this.hideTooltip())},this.onClick=()=>{this.emit("lr-tool-call-chip-select",{name:this.name,callId:this.callId})}}static{this.defaultStrings={...super.defaultStrings,accessibleLabelSeparator:LYRA_DEFAULT_accessibleLabelSeparator,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusDenied:LYRA_DEFAULT_statusDenied,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,toolCall:LYRA_DEFAULT_toolCall}}static{this.styles=[LyraElement.styles,styles]}hasPreviewNodes(nodes){return nodes.some(node=>{if(node.nodeType===3)return!!node.textContent?.trim();if(node.nodeType!==1)return!1;const slotName=node.getAttribute("slot");return slotName===null||slotName===""})}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasDetailSlot=this.hasPreviewNodes(Array.from(this.childNodes)))}updated(changed){if(super.updated(changed),changed.has("tooltipOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen)){const anchor=this.renderRoot.querySelector('[part="base"]'),tooltip=this.renderRoot.querySelector('[part="tooltip"]');anchor&&tooltip&&(this.cleanupPositioner=place(anchor,tooltip,{placement:"top-start"}))}}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen=!1,this.hovering=!1,this.focused=!1}showTooltip(){!this.hasDetailSlot||this.tooltipOpen||(this.tooltipOpen=!0)}hideTooltip(){this.tooltipOpen&&(this.tooltipOpen=!1)}focus(options){this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}click(){this.baseEl?.click()}get effectiveStatus(){return STATUS_VALUES.has(this.status)?this.status:"pending"}get safeDurationMs(){return this.durationMs!=null&&Number.isFinite(this.durationMs)?finiteRange(this.durationMs,0,0):null}get accessibleLabel(){const parts=[this.name||this.localize("toolCall")];this.summary&&parts.push(this.summary),parts.push(this.localize(STATUS_LABEL_KEY[this.effectiveStatus]));const durationMs=this.safeDurationMs;return durationMs!=null&&parts.push(this.localizedDuration(durationMs)),parts.join(this.localize("accessibleLabelSeparator"))}localizedDuration(ms){const duration=durationMessageValue(ms);return this.localize(duration.key,void 0,{value:getNumberFormat(this.effectiveLocale,{maximumFractionDigits:duration.key==="durationSeconds"?1:0}).format(duration.value)})}render(){const hasCategory=(this.category??"").length>0,hasSummary=(this.summary??"").length>0,durationMs=this.safeDurationMs,hasDuration=durationMs!=null,status=this.effectiveStatus;return html`
18
+ `)}function deniedIcon(){return icon(svg`<circle cx="12" cy="12" r="9"></circle><line x1="6" y1="18" x2="18" y2="6"></line>`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon,denied:deniedIcon},STATUS_LABEL={pending:"Pending",running:"Running",success:"Success",error:"Error",denied:"Denied"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_VALUES=new Set(Object.keys(STATUS_LABEL)),statusConverter={fromAttribute(value){return value!==null&&STATUS_VALUES.has(value)?value:"pending"},toAttribute(value){return value}};class LyraToolCallChip extends LyraElement{constructor(){super(...arguments),this.name="",this.category="",this.status="pending",this.summary="",this.icon="",this.callId="",this.hasDetailSlot=!1,this.tooltipOpen=!1,this.tooltipId=nextId("tool-call-chip-tooltip"),this.hovering=!1,this.focused=!1,this.onDetailSlotChange=e=>{this.hasDetailSlot=this.hasPreviewNodes(e.target.assignedNodes({flatten:!0})),this.hasDetailSlot||this.hideTooltip()},this.onMouseEnter=()=>{this.hovering=!0,this.showTooltip()},this.onMouseLeave=()=>{this.hovering=!1,!this.focused&&this.hideTooltip()},this.onFocus=()=>{this.focused=!0,this.showTooltip()},this.onBlur=()=>{this.focused=!1,!this.hovering&&this.hideTooltip()},this.onKeyDown=e=>{e.key==="Escape"&&this.tooltipOpen&&(e.stopPropagation(),this.hideTooltip())},this.onClick=()=>{this.emit("lr-tool-call-chip-select",{name:this.name,callId:this.callId})}}static{this.defaultStrings={...super.defaultStrings,accessibleLabelSeparator:LYRA_DEFAULT_accessibleLabelSeparator,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusDenied:LYRA_DEFAULT_statusDenied,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,toolCall:LYRA_DEFAULT_toolCall}}static{this.styles=[LyraElement.styles,styles]}hasPreviewNodes(nodes){return nodes.some(node=>{if(node.nodeType===3)return!!node.textContent?.trim();if(node.nodeType!==1)return!1;const slotName=node.getAttribute("slot");return slotName===null||slotName===""})}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasDetailSlot=this.hasPreviewNodes(Array.from(this.childNodes)))}updated(changed){if(super.updated(changed),changed.has("tooltipOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen)){const anchor=this.renderRoot.querySelector('[part="base"]'),tooltip=this.renderRoot.querySelector('[part="tooltip"]');anchor&&tooltip&&(this.cleanupPositioner=place(anchor,tooltip,{placement:"top-start",strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")}))}}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen=!1,this.hovering=!1,this.focused=!1}showTooltip(){!this.hasDetailSlot||this.tooltipOpen||(this.tooltipOpen=!0)}hideTooltip(){this.tooltipOpen&&(this.tooltipOpen=!1)}focus(options){this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}click(){this.baseEl?.click()}get effectiveStatus(){return STATUS_VALUES.has(this.status)?this.status:"pending"}get safeDurationMs(){return this.durationMs!=null&&Number.isFinite(this.durationMs)?finiteRange(this.durationMs,0,0):null}get accessibleLabel(){const parts=[this.name||this.localize("toolCall")];this.summary&&parts.push(this.summary),parts.push(this.localize(STATUS_LABEL_KEY[this.effectiveStatus]));const durationMs=this.safeDurationMs;return durationMs!=null&&parts.push(this.localizedDuration(durationMs)),parts.join(this.localize("accessibleLabelSeparator"))}localizedDuration(ms){const duration=durationMessageValue(ms);return this.localize(duration.key,void 0,{value:getNumberFormat(this.effectiveLocale,{maximumFractionDigits:duration.key==="durationSeconds"?1:0}).format(duration.value)})}render(){const hasCategory=(this.category??"").length>0,hasSummary=(this.summary??"").length>0,durationMs=this.safeDurationMs,hasDuration=durationMs!=null,status=this.effectiveStatus;return html`
19
19
  <button
20
20
  part="base"
21
21
  type="button"
@@ -140,8 +140,8 @@ export interface FlatToolParamSchema{readonly type:'object';readonly properties:
140
140
  * @cssstate valid - Every field currently satisfies the supported schema subset, whether or not the
141
141
  * user has touched anything.
142
142
  * @cssstate invalid - At least one field, or the schema shape itself, is currently in error.
143
- * @cssstate user-valid - `valid`, and the user has interacted (edited a field, left one, or a
144
- * `reportValidity()` call which is what a submit attempt runs).
143
+ * @cssstate user-valid - `valid`, and the user has interacted: edited a field, left one,
144
+ * `reportValidity()`, or a submission attempt. Not after a silent `checkValidity()` alone.
145
145
  * @cssstate user-invalid - `invalid`, and the user has interacted. A pristine required field is
146
146
  * invalid but deliberately does not match this, so a consumer's `:state(user-invalid)` styling
147
147
  * cannot paint the form red before the user has typed anything. A form reset makes it pristine
@@ -180,7 +180,7 @@ get formError():string;
180
180
  * Computes the supported flat JSON Schema subset against the exact value
181
181
  * that will be submitted. Defaults are already materialized in `effective`.
182
182
  */
183
- private computeValidation;
183
+ private computeValidation;private markInteracted;
184
184
  /** Resynchronizes validity without revealing inline errors. */
185
185
  checkValidity():boolean;
186
186
  /**
@@ -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{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{AnchoredValidityController,resolveValidityAnchor,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{styles}from"./tool-param-form.styles.js";import"../../forms/select/select.class.js";import"../../forms/combobox/option.class.js";import"../../forms/input/number-input.class.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LYRA_DEFAULT_fieldMustBeBoolean,LYRA_DEFAULT_fieldMustBeInteger,LYRA_DEFAULT_fieldMustBeNumber,LYRA_DEFAULT_fieldMustBeOneOf,LYRA_DEFAULT_fieldMustBeString,LYRA_DEFAULT_fieldMustEqual,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_noData,LYRA_DEFAULT_schemaMustBeObject,LYRA_DEFAULT_schemaPropertiesMustBeFlat,LYRA_DEFAULT_toolParamBooleanFalse,LYRA_DEFAULT_toolParamBooleanTrue,LYRA_DEFAULT_toolParamBooleanUnset,LYRA_DEFAULT_toolParamMissingProperty,LYRA_DEFAULT_toolParamSchemaLimit,LYRA_DEFAULT_unsupportedFieldType,LYRA_DEFAULT_valueMustBeSerializable}from"../../../internal/default-strings.generated.js";const MAX_SCHEMA_FIELDS=100,MAX_ENUM_OPTIONS=500,MAX_VALUE_ENTRIES=1e4,MAX_VALUE_NODES=5e4,MAX_VALUE_INSPECTIONS=MAX_VALUE_NODES*2,MAX_VALUE_DEPTH=16,OMIT_VALUE=Symbol("omit-tool-param-value"),LIMIT_VALUE=Symbol("limit-tool-param-value"),FUNCTION_TO_STRING=Function.prototype.toString,OBJECT_CONSTRUCTOR_SOURCE=FUNCTION_TO_STRING.call(Object);function isPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;if(Object.getPrototypeOf(prototype)!==null)return!1;const constructorDescriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");if(!constructorDescriptor||!("value"in constructorDescriptor)||typeof constructorDescriptor.value!="function")return!1;const constructor=constructorDescriptor.value,constructorPrototype=Object.getOwnPropertyDescriptor(constructor,"prototype");return!!(constructorPrototype&&"value"in constructorPrototype&&constructorPrototype.value===prototype&&FUNCTION_TO_STRING.call(constructor)===OBJECT_CONSTRUCTOR_SOURCE)}catch{return!1}}function checkpointSnapshot(budget){return{remaining:budget.remaining,seenEntries:budget.seenEntries.length,truncated:budget.truncated}}function restoreSnapshotCheckpoint(budget,checkpoint){for(budget.remaining=checkpoint.remaining,budget.truncated=checkpoint.truncated;budget.seenEntries.length>checkpoint.seenEntries;){const source=budget.seenEntries.pop();source&&budget.seen.delete(source)}}function rememberSnapshot(budget,source,output){budget.seen.set(source,output),budget.seenEntries.push(source)}function omitInvalidValue(budget,checkpoint){return restoreSnapshotCheckpoint(budget,checkpoint),budget.invalid=!0,OMIT_VALUE}function snapshotValueEntry(value,budget,depth){if(value===null||typeof value!="object"&&typeof value!="function")return value;const checkpoint=checkpointSnapshot(budget);if(typeof value=="function")return omitInvalidValue(budget,checkpoint);if(depth>MAX_VALUE_DEPTH||budget.remaining<=0)return budget.truncated=!0,LIMIT_VALUE;const existing=budget.seen.get(value);if(existing!==void 0)return existing;let isArray=!1;try{isArray=Array.isArray(value)}catch{return omitInvalidValue(budget,checkpoint)}if(isArray){if(budget.remainingInspections<=0)return budget.truncated=!0,LIMIT_VALUE;budget.remainingInspections-=1;const output2=[];rememberSnapshot(budget,value,output2);let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0)sourceLength=descriptor.value;else return omitInvalidValue(budget,checkpoint)}catch{return omitInvalidValue(budget,checkpoint)}sourceLength>MAX_VALUE_ENTRIES&&(budget.truncated=!0);const length=Math.min(sourceLength,MAX_VALUE_ENTRIES);let outputLength=length;for(let index=0;index<length;index+=1){if(budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0,outputLength=index;break}budget.remainingInspections-=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{budget.invalid=!0;continue}if(!descriptor)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE){outputLength=index;break}Object.defineProperty(output2,String(index),{value:entry,enumerable:!0,configurable:!1,writable:!1})}return output2.length=outputLength,Object.freeze(output2)}if(!isPlainRecord(value))return omitInvalidValue(budget,checkpoint);const output={};rememberSnapshot(budget,value,output);let retained=0;try{for(const key in value){if(retained>=MAX_VALUE_ENTRIES||budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1;const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor||!descriptor.enumerable)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE)break;retained+=1,Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return omitInvalidValue(budget,checkpoint)}return Object.freeze(output)}function snapshotFormValue(value){if(value==null)return{value:Object.freeze({}),invalid:!1,truncated:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{value:Object.freeze({}),invalid:!0,truncated:!1}}if(typeof value!="object"||isArray||!isPlainRecord(value))return{value:Object.freeze({}),invalid:!0,truncated:!1};const budget={remaining:MAX_VALUE_NODES,remainingInspections:MAX_VALUE_INSPECTIONS,seen:new WeakMap,seenEntries:[],invalid:!1,truncated:!1},snapshot=snapshotValueEntry(value,budget,0);return{value:snapshot===OMIT_VALUE||snapshot===LIMIT_VALUE?Object.freeze({}):snapshot,invalid:budget.invalid||snapshot===OMIT_VALUE,truncated:budget.truncated||snapshot===LIMIT_VALUE}}const EMPTY_SCHEMA=Object.freeze({type:"object",properties:Object.freeze({})});function snapshotSchemaStringArray(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{isArray:!1,exceededLimit:!1}}if(!isArray)return{isArray:!1,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(sourceLength=descriptor.value)}catch{return{isArray:!0,value:Object.freeze([]),exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_SCHEMA_FIELDS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}descriptor&&"value"in descriptor&&typeof descriptor.value=="string"&&output.push(descriptor.value)}return{isArray:!0,value:Object.freeze(output),exceededLimit:sourceLength>MAX_SCHEMA_FIELDS}}function snapshotSchemaEnum(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{malformed:!0,exceededLimit:!1}}if(!isArray)return{malformed:!0,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(!descriptor||!("value"in descriptor)||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0)return{malformed:!0,exceededLimit:!1};sourceLength=descriptor.value}catch{return{malformed:!0,exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_ENUM_OPTIONS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}if(descriptor){if(!("value"in descriptor)||typeof descriptor.value!="string")return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS};output.push(descriptor.value)}}return{value:Object.freeze(output),malformed:!1,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}function snapshotSchemaProperty(value){let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value)}catch{return{malformed:!0,exceededLimit:!1}}const withoutEnum={};let enumDescriptor;for(const key of Reflect.ownKeys(descriptors)){const descriptor=descriptors[key];if(descriptor?.enumerable){if(key==="enum"){enumDescriptor=descriptor;continue}if(!("value"in descriptor))return{malformed:!0,exceededLimit:!1};Object.defineProperty(withoutEnum,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}}const propertySnapshot=snapshotFormValue(withoutEnum);if(propertySnapshot.invalid||propertySnapshot.truncated)return{malformed:!0,exceededLimit:!1};let choices,exceededLimit=!1,hasEnum=!1;if(enumDescriptor){if(!("value"in enumDescriptor))return{malformed:!0,exceededLimit:!1};if(hasEnum=!0,enumDescriptor.value!==void 0){const enumSnapshot=snapshotSchemaEnum(enumDescriptor.value);if(enumSnapshot.malformed)return{malformed:!0,exceededLimit:enumSnapshot.exceededLimit};choices=enumSnapshot.value,exceededLimit=enumSnapshot.exceededLimit}}const output={};for(const key of Reflect.ownKeys(propertySnapshot.value)){const descriptor=Object.getOwnPropertyDescriptor(propertySnapshot.value,key);!descriptor?.enumerable||!("value"in descriptor)||Object.defineProperty(output,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return hasEnum&&Object.defineProperty(output,"enum",{value:choices,enumerable:!0,configurable:!1,writable:!1}),{value:Object.freeze(output),malformed:!1,exceededLimit}}function snapshotSchema(value){if(value==null)return{schema:EMPTY_SCHEMA,shapeError:"",exceededLimits:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}if(typeof value!="object"||isArray)return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};let rootDescriptors;try{rootDescriptors=Object.getOwnPropertyDescriptors(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}const typeDescriptor=rootDescriptors.type;if(!typeDescriptor||!("value"in typeDescriptor)||typeDescriptor.value!=="object")return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};const propertiesDescriptor=rootDescriptors.properties,propertiesValue=propertiesDescriptor&&"value"in propertiesDescriptor?propertiesDescriptor.value:void 0;if(propertiesValue===null||typeof propertiesValue!="object"||!isPlainRecord(propertiesValue))return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1};const properties=Object.create(null);let shapeError="",exceededLimits=!1,seenFields=0,propertyDescriptors;try{propertyDescriptors=Object.getOwnPropertyDescriptors(propertiesValue)}catch{return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1}}for(const key of Reflect.ownKeys(propertyDescriptors)){const descriptor=propertyDescriptors[key];if(typeof key!="string"||!descriptor?.enumerable)continue;if(seenFields+=1,seenFields>MAX_SCHEMA_FIELDS){exceededLimits=!0;break}if(!("value"in descriptor)||descriptor.value===null||typeof descriptor.value!="object"||!isPlainRecord(descriptor.value)){shapeError="properties";continue}const propertySnapshot=snapshotSchemaProperty(descriptor.value);if(propertySnapshot.malformed||!propertySnapshot.value){shapeError="properties",propertySnapshot.exceededLimit&&(exceededLimits=!0);continue}propertySnapshot.exceededLimit&&(exceededLimits=!0),properties[key]=propertySnapshot.value}const requiredDescriptor=rootDescriptors.required;let required;if(requiredDescriptor&&"value"in requiredDescriptor){const requiredSnapshot=snapshotSchemaStringArray(requiredDescriptor.value);requiredSnapshot.isArray?(required=requiredSnapshot.value,requiredSnapshot.exceededLimit&&(exceededLimits=!0)):requiredDescriptor.enumerable&&(shapeError="properties")}else requiredDescriptor?.enumerable&&(shapeError="properties");return{schema:Object.freeze({type:"object",properties:Object.freeze(properties),...required===void 0?{}:{required}}),shapeError,exceededLimits}}function cloneFormValue(value,_ownerWindow){return snapshotFormValue(value).value}class LyraToolParamForm extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldMustBeBoolean:LYRA_DEFAULT_fieldMustBeBoolean,fieldMustBeInteger:LYRA_DEFAULT_fieldMustBeInteger,fieldMustBeNumber:LYRA_DEFAULT_fieldMustBeNumber,fieldMustBeOneOf:LYRA_DEFAULT_fieldMustBeOneOf,fieldMustBeString:LYRA_DEFAULT_fieldMustBeString,fieldMustEqual:LYRA_DEFAULT_fieldMustEqual,fieldRequired:LYRA_DEFAULT_fieldRequired,noData:LYRA_DEFAULT_noData,schemaMustBeObject:LYRA_DEFAULT_schemaMustBeObject,schemaPropertiesMustBeFlat:LYRA_DEFAULT_schemaPropertiesMustBeFlat,toolParamBooleanFalse:LYRA_DEFAULT_toolParamBooleanFalse,toolParamBooleanTrue:LYRA_DEFAULT_toolParamBooleanTrue,toolParamBooleanUnset:LYRA_DEFAULT_toolParamBooleanUnset,toolParamMissingProperty:LYRA_DEFAULT_toolParamMissingProperty,toolParamSchemaLimit:LYRA_DEFAULT_toolParamSchemaLimit,unsupportedFieldType:LYRA_DEFAULT_unsupportedFieldType,valueMustBeSerializable:LYRA_DEFAULT_valueMustBeSerializable}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-validity-change","lr-input"])}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},schema:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(){super(),this._errors={},this._formError="",this.showFormError=!1,this.touchedFields=new Set,this.baseId=nextId("tool-param-form"),this._fieldsetDisabled=!1,this._name="",this._schema=EMPTY_SCHEMA,this.schemaInputShapeError="",this.schemaInputExceededLimits=!1,this._value=Object.freeze({}),this.valueInputInvalid=!1,this.valueInputTruncated=!1,this.defaultValueSnapshot=Object.freeze({}),this.defaultValueCaptured=!1,this._effectiveValue=Object.freeze({}),this._validityFlags={},this._disabled=!1,this.hasInteracted=!1,this.visibleErrorSnapshot=new Map,this.suppressNextErrorAnnouncement=!0,this.stopNestedControlEvent=e=>{e.stopPropagation()},this.onFieldFocus=()=>{this.emit("focus")},this.onFieldBlur=()=>{this.emit("blur")},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.syncFormState()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){const field=this.firstInvalidField();if(field){const input=field.querySelector("input.control");if(input)return input;for(const child of field.children){const anchor=resolveValidityAnchor(child);if(anchor)return anchor}}return this.firstMissingPropertyError()}firstInvalidField(){if(!this.renderRoot)return;const fields=Array.from(this.renderRoot.querySelectorAll('[part="field"]'));for(const key of Object.keys(this._errors)){const field=fields.find(candidate=>candidate.dataset.key===key);if(field)return field}}get missingRequiredKeys(){const properties=this.schemaProperties;return this.requiredKeys.filter(key=>!Object.prototype.hasOwnProperty.call(properties,key)&&!!this._errors[key])}firstMissingPropertyError(){if(!this.renderRoot)return;const errors=Array.from(this.renderRoot.querySelectorAll('[part="error"][data-missing-property]'));for(const key of Object.keys(this._errors)){const error=errors.find(candidate=>candidate.dataset.key===key);if(error)return error}}focusFirstControl(){if(!this.renderRoot)return;const controls=this.renderRoot.querySelectorAll("input.control, lr-select");for(const control of controls)if(!(control.disabled||control.getAttribute("aria-disabled")==="true")){control.focus();return}}click(){this.effectiveDisabled||this.focusFirstControl()}connectedCallback(){this.defaultValueCaptured||(this.defaultValueSnapshot=cloneFormValue(this._value,this.ownerDocument.defaultView),this.defaultValueCaptured=!0),super.connectedCallback(),this.errorAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this})),this.hasUpdated&&(this.suppressNextErrorAnnouncement=!0,this.requestUpdate()),this.syncFormState()}disconnectedCallback(){super.disconnectedCallback(),this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.suppressNextErrorAnnouncement=!0}get effectiveValue(){return snapshotFormValue(this._effectiveValue).value}get schemaProperties(){return this._schema.properties}get requiredKeys(){return this._schema.required??Object.freeze([])}resolveEffectiveValue(){const props=this.schemaProperties,out={...this.value};for(const[key,prop]of Object.entries(props))!Object.prototype.hasOwnProperty.call(this.value,key)&&prop.default!==void 0&&Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:prop.default});return snapshotFormValue(out).value}get schema(){return this._schema}set schema(next){const old=this._schema,snapshot=snapshotSchema(next);this._schema=snapshot.schema,this.schemaInputShapeError=snapshot.shapeError,this.schemaInputExceededLimits=snapshot.exceededLimits,this.syncFormState(),this.requestUpdate("schema",old)}get value(){return this._value}set value(next){const old=this._value,snapshot=snapshotFormValue(next);this._value=snapshot.value,this.valueInputInvalid=snapshot.invalid,this.valueInputTruncated=snapshot.truncated,this.syncFormState(),this.requestUpdate("value",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.applyValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get errors(){return this.publicValidityErrors()}publicValidityErrors(){const errors={...this._errors};return this.willValidate&&(this.validityController.customValidityMessage||this._formError)&&(errors.base=this.validationMessage),Object.freeze(errors)}publishValiditySnapshot(){if(!this.isConnected)return;const valid=!this.willValidate||this.validity.valid,errors=valid?Object.freeze({}):this.publicValidityErrors(),key=JSON.stringify({valid,errors});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,errors})))}get formError(){return this._formError}computeValidation(effective){const props=this.schemaProperties,required=new Set(this.requiredKeys),out={},flags={},addError=(key,message)=>{Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:message})};for(const[key,prop]of Object.entries(props)){const type=prop?.type;if(type!=="string"&&type!=="number"&&type!=="integer"&&type!=="boolean"){addError(key,this.localize("unsupportedFieldType",void 0,{type:String(type)})),flags.customError=!0;continue}if(!(Object.prototype.hasOwnProperty.call(effective,key)&&effective[key]!==void 0)){required.has(key)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);continue}const v=effective[key];if(type==="string"&&typeof v!="string"){addError(key,this.localize("fieldMustBeString")),flags.typeMismatch=!0;continue}if(type==="number"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeNumber")),flags.typeMismatch=!0;continue}if(type==="integer"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeInteger")),flags.typeMismatch=!0;continue}if(type==="integer"&&!Number.isInteger(v)){addError(key,this.localize("fieldMustBeInteger")),flags.stepMismatch=!0;continue}if(type==="boolean"&&typeof v!="boolean"){addError(key,this.localize("fieldMustBeBoolean")),flags.typeMismatch=!0;continue}if(type==="string"&&Array.isArray(prop.enum)&&!prop.enum.includes(v)){addError(key,this.localize("fieldMustBeOneOf",void 0,{values:getListFormat(this.effectiveLocale,{style:"long",type:"disjunction"}).format(prop.enum)})),flags.customError=!0;continue}prop.const!==void 0&&v!==prop.const&&(addError(key,this.localize("fieldMustEqual",void 0,{value:JSON.stringify(prop.const)})),flags.customError=!0)}for(const key of required)Object.prototype.hasOwnProperty.call(props,key)||(!Object.prototype.hasOwnProperty.call(effective,key)||effective[key]===void 0)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);return{errors:out,flags}}checkValidity(){return this.syncFormState(),this.internals.checkValidity()}reportValidity(){this.hasInteracted=!0,this.syncFormState(),Object.keys(this._errors).length>0&&(this.touchedFields=new Set([...this.touchedFields,...Object.keys(this._errors)])),this._formError&&(this.showFormError=!0),this.requestUpdate();const valid=this.internals.reportValidity();return!valid&&!this.firstInvalidField()&&this.missingRequiredKeys.length>0&&this.updateComplete.then(()=>{const error=this.firstMissingPropertyError();this.validityController.refreshAnchor(),error?.focus()}),valid}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidityCustomStates(),this.publishValiditySnapshot(),this.requestUpdate()}formResetCallback(){this.hasInteracted=!1,this.value=cloneFormValue(this.defaultValueSnapshot,this.ownerDocument.defaultView),this.touchedFields=new Set,this.showFormError=!1}formStateRestoreCallback(state2,_mode){let restored={};if(typeof state2=="string")try{const parsed=JSON.parse(state2);parsed!==null&&typeof parsed=="object"&&!Array.isArray(parsed)&&(restored=parsed)}catch{}this.value=restored}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.applyValidity(),this.requestUpdate()}schemaShapeError(){return this.schemaInputShapeError==="object"?this.localize("schemaMustBeObject"):this.schemaInputShapeError==="properties"?this.localize("schemaPropertiesMustBeFlat"):this.schemaInputExceededLimits?this.localize("toolParamSchemaLimit",void 0,{fields:getNumberFormat(this.effectiveLocale).format(MAX_SCHEMA_FIELDS),options:getNumberFormat(this.effectiveLocale).format(MAX_ENUM_OPTIONS)}):""}serializeEffectiveValue(effective){const serialized=JSON.stringify(effective,(_key,value)=>{if(typeof value=="number"&&!Number.isFinite(value))throw new TypeError("Non-finite numbers are not JSON values.");return value});if(typeof serialized!="string")throw new TypeError("Value did not serialize to JSON.");return serialized}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncInternals(formValue){this.internals.setFormValue(formValue,formValue),this.applyValidity()}applyValidity(){if(this.validityController){if(this.barredFromValidation||Object.keys(this._validityFlags).length===0)this.validityController.setValidity({});else{const firstMessage=Object.values(this._errors)[0]??this._formError;this.validityController.setValidity(this._validityFlags,firstMessage)}this.syncValidityCustomStates(),this.publishValiditySnapshot()}}syncValidityCustomStates(){syncValidityStates(this.internals,{required:this.requiredKeys.length>0,hasInteracted:this.hasInteracted,barred:this.barredFromValidation})}syncFormState(){let effective=Object.freeze({}),errors={},flags={},formError="",formValue=null;try{if(formError=this.schemaShapeError(),this.valueInputInvalid||this.valueInputTruncated)throw new TypeError("The value could not be retained within the public snapshot boundary.");effective=this.resolveEffectiveValue();const validation=this.computeValidation(effective);errors=validation.errors,flags=validation.flags,formValue=this.serializeEffectiveValue(effective)}catch{formError=this.localize("valueMustBeSerializable"),formValue=null}formError&&(flags.customError=!0,formValue=null),this._effectiveValue=effective,JSON.stringify(this._errors)!==JSON.stringify(errors)&&(this._errors=errors),this._formError=formError,this._validityFlags=flags,this.syncInternals(formValue)}updated(changed){if(super.updated(changed),this.publishValiditySnapshot(),changed.has("value")||changed.has("schema")||changed.has("_errors")||changed.has("_formError")){const nestedUpdates=Array.from(this.firstInvalidField()?.children??[]).filter(element=>typeof element[VALIDITY_ANCHOR]=="function").map(element=>element.updateComplete).filter(update=>update!==void 0);nestedUpdates.length>0&&Promise.all(nestedUpdates).then(()=>this.validityController.refreshAnchor())}const currentErrors=new Map;for(const node of this.renderRoot.querySelectorAll('[part="error"]')){const fieldKey=node.closest('[part~="field"]')?.dataset.key,key=node.dataset.key??fieldKey??"form",text=node.textContent?.trim()??"";text&&currentErrors.set(key,text)}if(!this.suppressNextErrorAnnouncement){const freshMessages=[];for(const[key,text]of currentErrors)this.visibleErrorSnapshot.get(key)!==text&&!freshMessages.includes(text)&&freshMessages.push(text);freshMessages.length>0&&this.errorAnnouncementSink?.announce(freshMessages.join(" "))}this.visibleErrorSnapshot=currentErrors,this.suppressNextErrorAnnouncement=!1}setFieldValue(key,val){this.effectiveDisabled||(this.hasInteracted=!0,this.value={...this.value,[key]:val},this.emit("lr-input",{value:this.effectiveValue}))}markTouched(key){this.hasInteracted=!0,this.syncValidityCustomStates(),!this.touchedFields.has(key)&&(this.touchedFields=new Set(this.touchedFields).add(key))}onTextInput(key,e){this.setFieldValue(key,e.target.value)}onNumberInput(key,e){e.stopPropagation();const n=e.target.valueAsNumber;this.setFieldValue(key,Number.isNaN(n)?void 0:n)}onSelectChange(key,e){e.stopPropagation(),this.setFieldValue(key,e.target.value)}onBooleanSelectChange(key,e){e.stopPropagation();const value=e.target.value;if(value===""){if(this.effectiveDisabled)return;if(this.hasInteracted=!0,this.schemaProperties[key]?.default!==void 0)this.value={...this.value,[key]:void 0};else{const next={...this.value};Reflect.deleteProperty(next,key),this.value=next}this.emit("lr-input",{value:this.effectiveValue});return}this.setFieldValue(key,value==="true")}renderControl(key,prop,fieldId,label,required,describedBy,errorMessage,effective){if(prop.type==="string"&&prop.enum&&prop.enum.length>0)return html`<lr-select
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{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{nextId}from"../../../internal/a11y.js";import{AnchoredValidityController,resolveValidityAnchor,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{styles}from"./tool-param-form.styles.js";import"../../forms/select/select.class.js";import"../../forms/combobox/option.class.js";import"../../forms/input/number-input.class.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInteractionOnInvalid,installInvalidEventAlias,withStaticValidityCheck}from"../../../internal/invalid-event-alias.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LYRA_DEFAULT_fieldMustBeBoolean,LYRA_DEFAULT_fieldMustBeInteger,LYRA_DEFAULT_fieldMustBeNumber,LYRA_DEFAULT_fieldMustBeOneOf,LYRA_DEFAULT_fieldMustBeString,LYRA_DEFAULT_fieldMustEqual,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_noData,LYRA_DEFAULT_schemaMustBeObject,LYRA_DEFAULT_schemaPropertiesMustBeFlat,LYRA_DEFAULT_toolParamBooleanFalse,LYRA_DEFAULT_toolParamBooleanTrue,LYRA_DEFAULT_toolParamBooleanUnset,LYRA_DEFAULT_toolParamMissingProperty,LYRA_DEFAULT_toolParamSchemaLimit,LYRA_DEFAULT_unsupportedFieldType,LYRA_DEFAULT_valueMustBeSerializable}from"../../../internal/default-strings.generated.js";const MAX_SCHEMA_FIELDS=100,MAX_ENUM_OPTIONS=500,MAX_VALUE_ENTRIES=1e4,MAX_VALUE_NODES=5e4,MAX_VALUE_INSPECTIONS=MAX_VALUE_NODES*2,MAX_VALUE_DEPTH=16,OMIT_VALUE=Symbol("omit-tool-param-value"),LIMIT_VALUE=Symbol("limit-tool-param-value"),FUNCTION_TO_STRING=Function.prototype.toString,OBJECT_CONSTRUCTOR_SOURCE=FUNCTION_TO_STRING.call(Object);function isPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;if(Object.getPrototypeOf(prototype)!==null)return!1;const constructorDescriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");if(!constructorDescriptor||!("value"in constructorDescriptor)||typeof constructorDescriptor.value!="function")return!1;const constructor=constructorDescriptor.value,constructorPrototype=Object.getOwnPropertyDescriptor(constructor,"prototype");return!!(constructorPrototype&&"value"in constructorPrototype&&constructorPrototype.value===prototype&&FUNCTION_TO_STRING.call(constructor)===OBJECT_CONSTRUCTOR_SOURCE)}catch{return!1}}function checkpointSnapshot(budget){return{remaining:budget.remaining,seenEntries:budget.seenEntries.length,truncated:budget.truncated}}function restoreSnapshotCheckpoint(budget,checkpoint){for(budget.remaining=checkpoint.remaining,budget.truncated=checkpoint.truncated;budget.seenEntries.length>checkpoint.seenEntries;){const source=budget.seenEntries.pop();source&&budget.seen.delete(source)}}function rememberSnapshot(budget,source,output){budget.seen.set(source,output),budget.seenEntries.push(source)}function omitInvalidValue(budget,checkpoint){return restoreSnapshotCheckpoint(budget,checkpoint),budget.invalid=!0,OMIT_VALUE}function snapshotValueEntry(value,budget,depth){if(value===null||typeof value!="object"&&typeof value!="function")return value;const checkpoint=checkpointSnapshot(budget);if(typeof value=="function")return omitInvalidValue(budget,checkpoint);if(depth>MAX_VALUE_DEPTH||budget.remaining<=0)return budget.truncated=!0,LIMIT_VALUE;const existing=budget.seen.get(value);if(existing!==void 0)return existing;let isArray=!1;try{isArray=Array.isArray(value)}catch{return omitInvalidValue(budget,checkpoint)}if(isArray){if(budget.remainingInspections<=0)return budget.truncated=!0,LIMIT_VALUE;budget.remainingInspections-=1;const output2=[];rememberSnapshot(budget,value,output2);let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0)sourceLength=descriptor.value;else return omitInvalidValue(budget,checkpoint)}catch{return omitInvalidValue(budget,checkpoint)}sourceLength>MAX_VALUE_ENTRIES&&(budget.truncated=!0);const length=Math.min(sourceLength,MAX_VALUE_ENTRIES);let outputLength=length;for(let index=0;index<length;index+=1){if(budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0,outputLength=index;break}budget.remainingInspections-=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{budget.invalid=!0;continue}if(!descriptor)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE){outputLength=index;break}Object.defineProperty(output2,String(index),{value:entry,enumerable:!0,configurable:!1,writable:!1})}return output2.length=outputLength,Object.freeze(output2)}if(!isPlainRecord(value))return omitInvalidValue(budget,checkpoint);const output={};rememberSnapshot(budget,value,output);let retained=0;try{for(const key in value){if(retained>=MAX_VALUE_ENTRIES||budget.remaining<=0||budget.remainingInspections<=0){budget.truncated=!0;break}budget.remainingInspections-=1;const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor||!descriptor.enumerable)continue;if(!("value"in descriptor)){budget.invalid=!0;continue}const entryCheckpoint=checkpointSnapshot(budget);budget.remaining-=1;const entry=snapshotValueEntry(descriptor.value,budget,depth+1);if(entry===OMIT_VALUE){restoreSnapshotCheckpoint(budget,entryCheckpoint);continue}if(entry===LIMIT_VALUE)break;retained+=1,Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return omitInvalidValue(budget,checkpoint)}return Object.freeze(output)}function snapshotFormValue(value){if(value==null)return{value:Object.freeze({}),invalid:!1,truncated:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{value:Object.freeze({}),invalid:!0,truncated:!1}}if(typeof value!="object"||isArray||!isPlainRecord(value))return{value:Object.freeze({}),invalid:!0,truncated:!1};const budget={remaining:MAX_VALUE_NODES,remainingInspections:MAX_VALUE_INSPECTIONS,seen:new WeakMap,seenEntries:[],invalid:!1,truncated:!1},snapshot=snapshotValueEntry(value,budget,0);return{value:snapshot===OMIT_VALUE||snapshot===LIMIT_VALUE?Object.freeze({}):snapshot,invalid:budget.invalid||snapshot===OMIT_VALUE,truncated:budget.truncated||snapshot===LIMIT_VALUE}}const EMPTY_SCHEMA=Object.freeze({type:"object",properties:Object.freeze({})});function snapshotSchemaStringArray(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{isArray:!1,exceededLimit:!1}}if(!isArray)return{isArray:!1,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(sourceLength=descriptor.value)}catch{return{isArray:!0,value:Object.freeze([]),exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_SCHEMA_FIELDS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}descriptor&&"value"in descriptor&&typeof descriptor.value=="string"&&output.push(descriptor.value)}return{isArray:!0,value:Object.freeze(output),exceededLimit:sourceLength>MAX_SCHEMA_FIELDS}}function snapshotSchemaEnum(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return{malformed:!0,exceededLimit:!1}}if(!isArray)return{malformed:!0,exceededLimit:!1};let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");if(!descriptor||!("value"in descriptor)||typeof descriptor.value!="number"||!Number.isSafeInteger(descriptor.value)||descriptor.value<0)return{malformed:!0,exceededLimit:!1};sourceLength=descriptor.value}catch{return{malformed:!0,exceededLimit:!1}}const output=[];for(let index=0;index<Math.min(sourceLength,MAX_ENUM_OPTIONS);index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}if(descriptor){if(!("value"in descriptor)||typeof descriptor.value!="string")return{malformed:!0,exceededLimit:sourceLength>MAX_ENUM_OPTIONS};output.push(descriptor.value)}}return{value:Object.freeze(output),malformed:!1,exceededLimit:sourceLength>MAX_ENUM_OPTIONS}}function snapshotSchemaProperty(value){let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value)}catch{return{malformed:!0,exceededLimit:!1}}const withoutEnum={};let enumDescriptor;for(const key of Reflect.ownKeys(descriptors)){const descriptor=descriptors[key];if(descriptor?.enumerable){if(key==="enum"){enumDescriptor=descriptor;continue}if(!("value"in descriptor))return{malformed:!0,exceededLimit:!1};Object.defineProperty(withoutEnum,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}}const propertySnapshot=snapshotFormValue(withoutEnum);if(propertySnapshot.invalid||propertySnapshot.truncated)return{malformed:!0,exceededLimit:!1};let choices,exceededLimit=!1,hasEnum=!1;if(enumDescriptor){if(!("value"in enumDescriptor))return{malformed:!0,exceededLimit:!1};if(hasEnum=!0,enumDescriptor.value!==void 0){const enumSnapshot=snapshotSchemaEnum(enumDescriptor.value);if(enumSnapshot.malformed)return{malformed:!0,exceededLimit:enumSnapshot.exceededLimit};choices=enumSnapshot.value,exceededLimit=enumSnapshot.exceededLimit}}const output={};for(const key of Reflect.ownKeys(propertySnapshot.value)){const descriptor=Object.getOwnPropertyDescriptor(propertySnapshot.value,key);!descriptor?.enumerable||!("value"in descriptor)||Object.defineProperty(output,key,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return hasEnum&&Object.defineProperty(output,"enum",{value:choices,enumerable:!0,configurable:!1,writable:!1}),{value:Object.freeze(output),malformed:!1,exceededLimit}}function snapshotSchema(value){if(value==null)return{schema:EMPTY_SCHEMA,shapeError:"",exceededLimits:!1};let isArray=!1;try{isArray=Array.isArray(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}if(typeof value!="object"||isArray)return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};let rootDescriptors;try{rootDescriptors=Object.getOwnPropertyDescriptors(value)}catch{return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1}}const typeDescriptor=rootDescriptors.type;if(!typeDescriptor||!("value"in typeDescriptor)||typeDescriptor.value!=="object")return{schema:EMPTY_SCHEMA,shapeError:"object",exceededLimits:!1};const propertiesDescriptor=rootDescriptors.properties,propertiesValue=propertiesDescriptor&&"value"in propertiesDescriptor?propertiesDescriptor.value:void 0;if(propertiesValue===null||typeof propertiesValue!="object"||!isPlainRecord(propertiesValue))return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1};const properties=Object.create(null);let shapeError="",exceededLimits=!1,seenFields=0,propertyDescriptors;try{propertyDescriptors=Object.getOwnPropertyDescriptors(propertiesValue)}catch{return{schema:EMPTY_SCHEMA,shapeError:"properties",exceededLimits:!1}}for(const key of Reflect.ownKeys(propertyDescriptors)){const descriptor=propertyDescriptors[key];if(typeof key!="string"||!descriptor?.enumerable)continue;if(seenFields+=1,seenFields>MAX_SCHEMA_FIELDS){exceededLimits=!0;break}if(!("value"in descriptor)||descriptor.value===null||typeof descriptor.value!="object"||!isPlainRecord(descriptor.value)){shapeError="properties";continue}const propertySnapshot=snapshotSchemaProperty(descriptor.value);if(propertySnapshot.malformed||!propertySnapshot.value){shapeError="properties",propertySnapshot.exceededLimit&&(exceededLimits=!0);continue}propertySnapshot.exceededLimit&&(exceededLimits=!0),properties[key]=propertySnapshot.value}const requiredDescriptor=rootDescriptors.required;let required;if(requiredDescriptor&&"value"in requiredDescriptor){const requiredSnapshot=snapshotSchemaStringArray(requiredDescriptor.value);requiredSnapshot.isArray?(required=requiredSnapshot.value,requiredSnapshot.exceededLimit&&(exceededLimits=!0)):requiredDescriptor.enumerable&&(shapeError="properties")}else requiredDescriptor?.enumerable&&(shapeError="properties");return{schema:Object.freeze({type:"object",properties:Object.freeze(properties),...required===void 0?{}:{required}}),shapeError,exceededLimits}}function cloneFormValue(value,_ownerWindow){return snapshotFormValue(value).value}class LyraToolParamForm extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldMustBeBoolean:LYRA_DEFAULT_fieldMustBeBoolean,fieldMustBeInteger:LYRA_DEFAULT_fieldMustBeInteger,fieldMustBeNumber:LYRA_DEFAULT_fieldMustBeNumber,fieldMustBeOneOf:LYRA_DEFAULT_fieldMustBeOneOf,fieldMustBeString:LYRA_DEFAULT_fieldMustBeString,fieldMustEqual:LYRA_DEFAULT_fieldMustEqual,fieldRequired:LYRA_DEFAULT_fieldRequired,noData:LYRA_DEFAULT_noData,schemaMustBeObject:LYRA_DEFAULT_schemaMustBeObject,schemaPropertiesMustBeFlat:LYRA_DEFAULT_schemaPropertiesMustBeFlat,toolParamBooleanFalse:LYRA_DEFAULT_toolParamBooleanFalse,toolParamBooleanTrue:LYRA_DEFAULT_toolParamBooleanTrue,toolParamBooleanUnset:LYRA_DEFAULT_toolParamBooleanUnset,toolParamMissingProperty:LYRA_DEFAULT_toolParamMissingProperty,toolParamSchemaLimit:LYRA_DEFAULT_toolParamSchemaLimit,unsupportedFieldType:LYRA_DEFAULT_unsupportedFieldType,valueMustBeSerializable:LYRA_DEFAULT_valueMustBeSerializable}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-validity-change","lr-input"])}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},schema:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(){super(),this._errors={},this._formError="",this.showFormError=!1,this.touchedFields=new Set,this.baseId=nextId("tool-param-form"),this._fieldsetDisabled=!1,this._name="",this._schema=EMPTY_SCHEMA,this.schemaInputShapeError="",this.schemaInputExceededLimits=!1,this._value=Object.freeze({}),this.valueInputInvalid=!1,this.valueInputTruncated=!1,this.defaultValueSnapshot=Object.freeze({}),this.defaultValueCaptured=!1,this._effectiveValue=Object.freeze({}),this._validityFlags={},this._disabled=!1,this.hasInteracted=!1,this.visibleErrorSnapshot=new Map,this.suppressNextErrorAnnouncement=!0,this.markInteracted=()=>{this.hasInteracted||(this.hasInteracted=!0,this.syncValidityCustomStates())},this.stopNestedControlEvent=e=>{e.stopPropagation()},this.onFieldFocus=()=>{this.emit("focus")},this.onFieldBlur=()=>{this.emit("blur")},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),installInteractionOnInvalid(this,this.markInteracted),this.syncFormState()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){const field=this.firstInvalidField();if(field){const input=field.querySelector("input.control");if(input)return input;for(const child of field.children){const anchor=resolveValidityAnchor(child);if(anchor)return anchor}}return this.firstMissingPropertyError()}firstInvalidField(){if(!this.renderRoot)return;const fields=Array.from(this.renderRoot.querySelectorAll('[part="field"]'));for(const key of Object.keys(this._errors)){const field=fields.find(candidate=>candidate.dataset.key===key);if(field)return field}}get missingRequiredKeys(){const properties=this.schemaProperties;return this.requiredKeys.filter(key=>!Object.prototype.hasOwnProperty.call(properties,key)&&!!this._errors[key])}firstMissingPropertyError(){if(!this.renderRoot)return;const errors=Array.from(this.renderRoot.querySelectorAll('[part="error"][data-missing-property]'));for(const key of Object.keys(this._errors)){const error=errors.find(candidate=>candidate.dataset.key===key);if(error)return error}}focusFirstControl(){if(!this.renderRoot)return;const controls=this.renderRoot.querySelectorAll("input.control, lr-select");for(const control of controls)if(!(control.disabled||control.getAttribute("aria-disabled")==="true")){control.focus();return}}click(){this.effectiveDisabled||this.focusFirstControl()}connectedCallback(){this.defaultValueCaptured||(this.defaultValueSnapshot=cloneFormValue(this._value,this.ownerDocument.defaultView),this.defaultValueCaptured=!0),super.connectedCallback(),this.errorAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this})),this.hasUpdated&&(this.suppressNextErrorAnnouncement=!0,this.requestUpdate()),this.syncFormState()}disconnectedCallback(){super.disconnectedCallback(),this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.suppressNextErrorAnnouncement=!0}get effectiveValue(){return snapshotFormValue(this._effectiveValue).value}get schemaProperties(){return this._schema.properties}get requiredKeys(){return this._schema.required??Object.freeze([])}resolveEffectiveValue(){const props=this.schemaProperties,out={...this.value};for(const[key,prop]of Object.entries(props))!Object.prototype.hasOwnProperty.call(this.value,key)&&prop.default!==void 0&&Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:prop.default});return snapshotFormValue(out).value}get schema(){return this._schema}set schema(next){const old=this._schema,snapshot=snapshotSchema(next);this._schema=snapshot.schema,this.schemaInputShapeError=snapshot.shapeError,this.schemaInputExceededLimits=snapshot.exceededLimits,this.syncFormState(),this.requestUpdate("schema",old)}get value(){return this._value}set value(next){const old=this._value,snapshot=snapshotFormValue(next);this._value=snapshot.value,this.valueInputInvalid=snapshot.invalid,this.valueInputTruncated=snapshot.truncated,this.syncFormState(),this.requestUpdate("value",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.applyValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get errors(){return this.publicValidityErrors()}publicValidityErrors(){const errors={...this._errors};return this.willValidate&&(this.validityController.customValidityMessage||this._formError)&&(errors.base=this.validationMessage),Object.freeze(errors)}publishValiditySnapshot(){if(!this.isConnected)return;const valid=!this.willValidate||this.validity.valid,errors=valid?Object.freeze({}):this.publicValidityErrors(),key=JSON.stringify({valid,errors});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,errors})))}get formError(){return this._formError}computeValidation(effective){const props=this.schemaProperties,required=new Set(this.requiredKeys),out={},flags={},addError=(key,message)=>{Object.defineProperty(out,key,{configurable:!0,enumerable:!0,writable:!0,value:message})};for(const[key,prop]of Object.entries(props)){const type=prop?.type;if(type!=="string"&&type!=="number"&&type!=="integer"&&type!=="boolean"){addError(key,this.localize("unsupportedFieldType",void 0,{type:String(type)})),flags.customError=!0;continue}if(!(Object.prototype.hasOwnProperty.call(effective,key)&&effective[key]!==void 0)){required.has(key)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);continue}const v=effective[key];if(type==="string"&&typeof v!="string"){addError(key,this.localize("fieldMustBeString")),flags.typeMismatch=!0;continue}if(type==="number"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeNumber")),flags.typeMismatch=!0;continue}if(type==="integer"&&(typeof v!="number"||!Number.isFinite(v))){addError(key,this.localize("fieldMustBeInteger")),flags.typeMismatch=!0;continue}if(type==="integer"&&!Number.isInteger(v)){addError(key,this.localize("fieldMustBeInteger")),flags.stepMismatch=!0;continue}if(type==="boolean"&&typeof v!="boolean"){addError(key,this.localize("fieldMustBeBoolean")),flags.typeMismatch=!0;continue}if(type==="string"&&Array.isArray(prop.enum)&&!prop.enum.includes(v)){addError(key,this.localize("fieldMustBeOneOf",void 0,{values:getListFormat(this.effectiveLocale,{style:"long",type:"disjunction"}).format(prop.enum)})),flags.customError=!0;continue}prop.const!==void 0&&v!==prop.const&&(addError(key,this.localize("fieldMustEqual",void 0,{value:JSON.stringify(prop.const)})),flags.customError=!0)}for(const key of required)Object.prototype.hasOwnProperty.call(props,key)||(!Object.prototype.hasOwnProperty.call(effective,key)||effective[key]===void 0)&&(addError(key,this.localize("fieldRequired")),flags.valueMissing=!0);return{errors:out,flags}}checkValidity(){return this.syncFormState(),withStaticValidityCheck(this,()=>this.internals.checkValidity())}reportValidity(){this.hasInteracted=!0,this.syncFormState(),Object.keys(this._errors).length>0&&(this.touchedFields=new Set([...this.touchedFields,...Object.keys(this._errors)])),this._formError&&(this.showFormError=!0),this.requestUpdate();const valid=this.internals.reportValidity();return!valid&&!this.firstInvalidField()&&this.missingRequiredKeys.length>0&&this.updateComplete.then(()=>{const error=this.firstMissingPropertyError();this.validityController.refreshAnchor(),error?.focus()}),valid}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidityCustomStates(),this.publishValiditySnapshot(),this.requestUpdate()}formResetCallback(){this.hasInteracted=!1,this.value=cloneFormValue(this.defaultValueSnapshot,this.ownerDocument.defaultView),this.touchedFields=new Set,this.showFormError=!1}formStateRestoreCallback(state2,_mode){let restored={};if(typeof state2=="string")try{const parsed=JSON.parse(state2);parsed!==null&&typeof parsed=="object"&&!Array.isArray(parsed)&&(restored=parsed)}catch{}this.value=restored}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.applyValidity(),this.requestUpdate()}schemaShapeError(){return this.schemaInputShapeError==="object"?this.localize("schemaMustBeObject"):this.schemaInputShapeError==="properties"?this.localize("schemaPropertiesMustBeFlat"):this.schemaInputExceededLimits?this.localize("toolParamSchemaLimit",void 0,{fields:getNumberFormat(this.effectiveLocale).format(MAX_SCHEMA_FIELDS),options:getNumberFormat(this.effectiveLocale).format(MAX_ENUM_OPTIONS)}):""}serializeEffectiveValue(effective){const serialized=JSON.stringify(effective,(_key,value)=>{if(typeof value=="number"&&!Number.isFinite(value))throw new TypeError("Non-finite numbers are not JSON values.");return value});if(typeof serialized!="string")throw new TypeError("Value did not serialize to JSON.");return serialized}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncInternals(formValue){this.internals.setFormValue(formValue,formValue),this.applyValidity()}applyValidity(){if(this.validityController){if(this.barredFromValidation||Object.keys(this._validityFlags).length===0)this.validityController.setValidity({});else{const firstMessage=Object.values(this._errors)[0]??this._formError;this.validityController.setValidity(this._validityFlags,firstMessage)}this.syncValidityCustomStates(),this.publishValiditySnapshot()}}syncValidityCustomStates(){syncValidityStates(this.internals,{required:this.requiredKeys.length>0,hasInteracted:this.hasInteracted,barred:this.barredFromValidation})}syncFormState(){let effective=Object.freeze({}),errors={},flags={},formError="",formValue=null;try{if(formError=this.schemaShapeError(),this.valueInputInvalid||this.valueInputTruncated)throw new TypeError("The value could not be retained within the public snapshot boundary.");effective=this.resolveEffectiveValue();const validation=this.computeValidation(effective);errors=validation.errors,flags=validation.flags,formValue=this.serializeEffectiveValue(effective)}catch{formError=this.localize("valueMustBeSerializable"),formValue=null}formError&&(flags.customError=!0,formValue=null),this._effectiveValue=effective,JSON.stringify(this._errors)!==JSON.stringify(errors)&&(this._errors=errors),this._formError=formError,this._validityFlags=flags,this.syncInternals(formValue)}updated(changed){if(super.updated(changed),this.publishValiditySnapshot(),changed.has("value")||changed.has("schema")||changed.has("_errors")||changed.has("_formError")){const nestedUpdates=Array.from(this.firstInvalidField()?.children??[]).filter(element=>typeof element[VALIDITY_ANCHOR]=="function").map(element=>element.updateComplete).filter(update=>update!==void 0);nestedUpdates.length>0&&Promise.all(nestedUpdates).then(()=>this.validityController.refreshAnchor())}const currentErrors=new Map;for(const node of this.renderRoot.querySelectorAll('[part="error"]')){const fieldKey=node.closest('[part~="field"]')?.dataset.key,key=node.dataset.key??fieldKey??"form",text=node.textContent?.trim()??"";text&&currentErrors.set(key,text)}if(!this.suppressNextErrorAnnouncement){const freshMessages=[];for(const[key,text]of currentErrors)this.visibleErrorSnapshot.get(key)!==text&&!freshMessages.includes(text)&&freshMessages.push(text);freshMessages.length>0&&this.errorAnnouncementSink?.announce(freshMessages.join(" "))}this.visibleErrorSnapshot=currentErrors,this.suppressNextErrorAnnouncement=!1}setFieldValue(key,val){this.effectiveDisabled||(this.hasInteracted=!0,this.value={...this.value,[key]:val},this.emit("lr-input",{value:this.effectiveValue}))}markTouched(key){this.hasInteracted=!0,this.syncValidityCustomStates(),!this.touchedFields.has(key)&&(this.touchedFields=new Set(this.touchedFields).add(key))}onTextInput(key,e){this.setFieldValue(key,e.target.value)}onNumberInput(key,e){e.stopPropagation();const n=e.target.valueAsNumber;this.setFieldValue(key,Number.isNaN(n)?void 0:n)}onSelectChange(key,e){e.stopPropagation(),this.setFieldValue(key,e.target.value)}onBooleanSelectChange(key,e){e.stopPropagation();const value=e.target.value;if(value===""){if(this.effectiveDisabled)return;if(this.hasInteracted=!0,this.schemaProperties[key]?.default!==void 0)this.value={...this.value,[key]:void 0};else{const next={...this.value};Reflect.deleteProperty(next,key),this.value=next}this.emit("lr-input",{value:this.effectiveValue});return}this.setFieldValue(key,value==="true")}renderControl(key,prop,fieldId,label,required,describedBy,errorMessage,effective){if(prop.type==="string"&&prop.enum&&prop.enum.length>0)return html`<lr-select
2
2
  id=${fieldId}
3
3
  .label=${label}
4
4
  .hint=${prop.description??""}