@aceshooting/lyra-ui 23.0.0 → 24.1.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 (280) hide show
  1. package/CHANGELOG.md +16 -39
  2. package/README.md +72 -35
  3. package/custom-elements.json +1 -1
  4. package/design-tokens.json +1 -1
  5. package/dist/cli/lyra-rename-ledger.mjs +1 -1
  6. package/dist/cli/migration-contract.json +1 -1
  7. package/dist/cli/migration-contract.mjs +1 -1
  8. package/dist/cli/migration-renames.mjs +2 -2
  9. package/dist/cli/migration-transforms.mjs +2 -2
  10. package/dist/components/agent-tools/approval-queue/approval-queue.class.d.ts +1 -4
  11. package/dist/components/agent-tools/approval-queue/approval-queue.class.js +1 -3
  12. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +1 -4
  13. package/dist/components/agent-tools/compare-panel/compare-panel.class.js +1 -1
  14. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.d.ts +1 -7
  15. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
  16. package/dist/components/agent-tools/context-inspector/context-inspector.class.d.ts +1 -1
  17. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.d.ts +2 -5
  18. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +1 -3
  19. package/dist/components/agent-tools/terminal/terminal.class.d.ts +1 -4
  20. package/dist/components/agent-tools/terminal/terminal.class.js +2 -2
  21. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.class.d.ts +1 -7
  22. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.class.js +1 -1
  23. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +1 -4
  24. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +1 -3
  25. package/dist/components/charts/chart/lite-chart-axis-layout.d.ts +13 -0
  26. package/dist/components/charts/chart/lite-chart-axis-layout.js +1 -0
  27. package/dist/components/charts/chart/lite-chart.class.d.ts +1 -11
  28. package/dist/components/charts/chart/lite-chart.class.js +4 -4
  29. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +13 -3
  30. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +1 -2
  31. package/dist/components/conversation/chat-message/chat-message.class.d.ts +3 -9
  32. package/dist/components/conversation/chat-message/chat-message.class.js +1 -1
  33. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  34. package/dist/components/conversation/code-block/code-block-core.class.d.ts +6 -8
  35. package/dist/components/conversation/code-block/code-block-shared.d.ts +1 -4
  36. package/dist/components/conversation/code-block/code-block.class.d.ts +4 -6
  37. package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -3
  38. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  39. package/dist/components/conversation/markdown/markdown-core.class.d.ts +1 -4
  40. package/dist/components/conversation/markdown/markdown.class.d.ts +1 -4
  41. package/dist/components/conversation/message-actions/message-actions.class.d.ts +1 -4
  42. package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
  43. package/dist/components/conversation/message-feedback/message-feedback.class.d.ts +1 -4
  44. package/dist/components/conversation/message-feedback/message-feedback.class.js +2 -2
  45. package/dist/components/conversation/message-parts/message-parts.class.d.ts +2 -5
  46. package/dist/components/conversation/message-parts/message-parts.class.js +3 -3
  47. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +1 -1
  48. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +2 -0
  49. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +0 -1
  50. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +2 -0
  51. package/dist/components/conversation/streaming-text/streaming-text.class.js +0 -1
  52. package/dist/components/conversation/thread-list/thread-list.class.d.ts +6 -17
  53. package/dist/components/conversation/thread-list/thread-list.class.js +6 -6
  54. package/dist/components/data/context-meter/context-meter.class.d.ts +1 -6
  55. package/dist/components/data/context-meter/context-meter.class.js +1 -1
  56. package/dist/components/data/data-grid/data-grid.class.d.ts +0 -1
  57. package/dist/components/data/data-grid/data-grid.class.js +2 -2
  58. package/dist/components/data/document-library/document-library.class.d.ts +6 -13
  59. package/dist/components/data/document-library/document-library.class.js +1 -2
  60. package/dist/components/data/heatmap/heatmap-grid-navigation.d.ts +7 -0
  61. package/dist/components/data/heatmap/heatmap-grid-navigation.js +1 -0
  62. package/dist/components/data/heatmap/heatmap.class.d.ts +3 -23
  63. package/dist/components/data/heatmap/heatmap.class.js +2 -2
  64. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +3 -9
  65. package/dist/components/data/sequence-strip/sequence-strip.class.js +3 -3
  66. package/dist/components/data/table/table.class.d.ts +5 -14
  67. package/dist/components/data/table/table.class.js +6 -6
  68. package/dist/components/forms/button/button.class.d.ts +2 -2
  69. package/dist/components/forms/button/button.class.js +9 -9
  70. package/dist/components/forms/combobox/combobox.class.d.ts +1 -4
  71. package/dist/components/forms/combobox/combobox.class.js +2 -2
  72. package/dist/components/forms/input/time-input.class.d.ts +1 -1
  73. package/dist/components/forms/input/time-input.class.js +1 -1
  74. package/dist/components/forms/select/select.class.d.ts +1 -2
  75. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +3 -1
  76. package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
  77. package/dist/components/layout/app-rail/app-rail-item.class.d.ts +3 -6
  78. package/dist/components/layout/app-rail/app-rail-item.class.js +1 -1
  79. package/dist/components/layout/app-rail/app-rail.class.d.ts +2 -4
  80. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  81. package/dist/components/layout/app-rail-group/app-rail-group.class.d.ts +2 -6
  82. package/dist/components/layout/app-rail-group/app-rail-group.class.js +1 -1
  83. package/dist/components/layout/carousel/carousel.class.d.ts +1 -4
  84. package/dist/components/layout/carousel/carousel.class.js +2 -2
  85. package/dist/components/layout/command-palette/command-palette.class.js +1 -1
  86. package/dist/components/layout/details/details.class.d.ts +2 -4
  87. package/dist/components/layout/details/details.class.js +1 -1
  88. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +3 -7
  89. package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
  90. package/dist/components/layout/menu/menu.class.js +1 -1
  91. package/dist/components/layout/multi-split/multi-split.class.d.ts +2 -4
  92. package/dist/components/layout/multi-split/multi-split.class.js +1 -1
  93. package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.d.ts +2 -4
  94. package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.js +1 -1
  95. package/dist/components/layout/reorder-list/reorder-item.class.d.ts +1 -4
  96. package/dist/components/layout/reorder-list/reorder-item.class.js +2 -2
  97. package/dist/components/media/attachment-trigger/attachment-trigger.class.d.ts +5 -9
  98. package/dist/components/media/attachment-trigger/attachment-trigger.class.js +5 -5
  99. package/dist/components/media/av-player/av-player.class.js +3 -3
  100. package/dist/components/media/file-input/file-input.class.d.ts +3 -6
  101. package/dist/components/media/file-input/file-input.class.js +3 -3
  102. package/dist/components/media/lightbox/lightbox.class.d.ts +11 -20
  103. package/dist/components/media/lightbox/lightbox.class.js +1 -1
  104. package/dist/components/media/map/map-data-layers.d.ts +20 -0
  105. package/dist/components/media/map/map-data-layers.js +1 -0
  106. package/dist/components/media/map/map.class.js +3 -3
  107. package/dist/components/media/media-time.d.ts +2 -0
  108. package/dist/components/media/media-time.js +1 -0
  109. package/dist/components/media/video/video.class.js +5 -5
  110. package/dist/components/media/video-playlist/video-playlist.class.js +2 -2
  111. package/dist/components/overlays/callout/callout.class.d.ts +2 -5
  112. package/dist/components/overlays/callout/callout.class.js +2 -2
  113. package/dist/components/overlays/dialog/dialog.class.d.ts +4 -7
  114. package/dist/components/overlays/dialog/dialog.class.js +2 -2
  115. package/dist/components/overlays/overlay/dropdown.class.d.ts +5 -10
  116. package/dist/components/overlays/overlay/dropdown.class.js +2 -2
  117. package/dist/components/overlays/overlay/popover.class.d.ts +2 -3
  118. package/dist/components/overlays/popup/popup.class.js +1 -1
  119. package/dist/components/overlays/progress/progress-bar.class.d.ts +1 -4
  120. package/dist/components/overlays/progress/progress-bar.class.js +2 -2
  121. package/dist/components/overlays/progress/progress-ring.class.d.ts +1 -4
  122. package/dist/components/overlays/progress/progress-ring.class.js +2 -2
  123. package/dist/components/overlays/progress/progress-shared.d.ts +3 -3
  124. package/dist/components/overlays/progress/progress-shared.js +1 -1
  125. package/dist/components/overlays/toast/toast-item.class.js +1 -1
  126. package/dist/components/retrieval/graph/graph.class.d.ts +5 -10
  127. package/dist/components/retrieval/graph/graph.class.js +1 -1
  128. package/dist/components/retrieval/knowledge-base/knowledge-base.class.d.ts +7 -14
  129. package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +2 -3
  130. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +2 -8
  131. package/dist/components/retrieval/memory-panel/memory-panel.class.js +0 -4
  132. package/dist/components/retrieval/rag-answer/rag-answer.class.js +1 -1
  133. package/dist/components/utility/export-button/export-button.class.d.ts +6 -10
  134. package/dist/components/utility/export-button/export-button.class.js +1 -1
  135. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  136. package/dist/components/viewers/geojson-view/geojson-view.class.d.ts +1 -1
  137. package/dist/components/viewers/highlight-layer/highlight-layer-timing.js +1 -1
  138. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +4 -4
  139. package/dist/events.d.ts +17 -78
  140. package/dist/framework-types.d.ts +1 -1
  141. package/dist/internal/catalog-picker.js +1 -1
  142. package/dist/internal/css-motion-time.d.ts +7 -0
  143. package/dist/internal/css-motion-time.js +1 -0
  144. package/dist/internal/data-state-renderer.d.ts +1 -3
  145. package/dist/internal/data-state-renderer.js +1 -1
  146. package/dist/internal/localization-runtime.d.ts +2 -0
  147. package/dist/internal/localization-runtime.js +1 -1
  148. package/dist/internal/lyra-element.js +2 -2
  149. package/dist/internal/package-metadata.d.ts +1 -1
  150. package/dist/internal/package-metadata.js +1 -1
  151. package/dist/looks/data.css +1 -1
  152. package/dist/looks/terminal.css +1 -1
  153. package/dist/lyra.d.ts +1 -592
  154. package/dist/lyra.js +1 -1
  155. package/dist/testing/event-factory.d.ts +2 -2
  156. package/dist/testing/interaction-drivers.d.ts +5 -3
  157. package/dist/testing/lyra-tag-event-map.js +1 -1
  158. package/dist/theme/looks/data.d.ts +1 -1
  159. package/dist/theme/looks/data.js +1 -1
  160. package/dist/theme/looks/terminal.d.ts +1 -1
  161. package/dist/theme/looks/terminal.js +1 -1
  162. package/dist/theme/theme.d.ts +2 -80
  163. package/dist/theme/theme.js +1 -1
  164. package/llms/components/lr-agent-workspace.md +24 -2
  165. package/llms/components/lr-alert.md +1 -1
  166. package/llms/components/lr-animation.md +1 -1
  167. package/llms/components/lr-app-rail.md +8 -10
  168. package/llms/components/lr-approval-queue.md +2 -4
  169. package/llms/components/lr-attachment-trigger.md +3 -4
  170. package/llms/components/lr-badge.md +2 -2
  171. package/llms/components/lr-button.md +45 -99
  172. package/llms/components/lr-callout.md +3 -4
  173. package/llms/components/lr-carousel.md +3 -5
  174. package/llms/components/lr-chat-message.md +1 -2
  175. package/llms/components/lr-claim-evidence.md +1 -1
  176. package/llms/components/lr-code-block-core.md +2 -2
  177. package/llms/components/lr-code-block.md +5 -6
  178. package/llms/components/lr-color-picker.md +1 -1
  179. package/llms/components/lr-combobox.md +5 -6
  180. package/llms/components/lr-compare-panel.md +2 -4
  181. package/llms/components/lr-confirm-bar.md +3 -7
  182. package/llms/components/lr-context-inspector.md +3 -2
  183. package/llms/components/lr-context-menu.md +2 -2
  184. package/llms/components/lr-context-meter.md +2 -4
  185. package/llms/components/lr-copy-button.md +1 -1
  186. package/llms/components/lr-data-grid.md +4 -7
  187. package/llms/components/lr-details.md +3 -3
  188. package/llms/components/lr-dialog.md +4 -6
  189. package/llms/components/lr-dock-panel.md +5 -6
  190. package/llms/components/lr-document-library.md +5 -7
  191. package/llms/components/lr-drawer.md +3 -3
  192. package/llms/components/lr-dropdown.md +4 -5
  193. package/llms/components/lr-eval-run.md +3 -5
  194. package/llms/components/lr-export-button.md +4 -7
  195. package/llms/components/lr-file-input.md +0 -5
  196. package/llms/components/lr-funnel.md +1 -1
  197. package/llms/components/lr-graph.md +3 -7
  198. package/llms/components/lr-icon.md +1 -1
  199. package/llms/components/lr-include.md +1 -1
  200. package/llms/components/lr-input.md +31 -79
  201. package/llms/components/lr-json-viewer.md +1 -1
  202. package/llms/components/lr-knowledge-base.md +4 -6
  203. package/llms/components/lr-knowledge-graph-explorer.md +2 -5
  204. package/llms/components/lr-known-date.md +1 -1
  205. package/llms/components/lr-lightbox.md +9 -7
  206. package/llms/components/lr-lite-chart.md +1 -5
  207. package/llms/components/lr-markdown-core.md +3 -4
  208. package/llms/components/lr-markdown.md +3 -5
  209. package/llms/components/lr-mcp-app.md +1 -1
  210. package/llms/components/lr-message-actions.md +2 -3
  211. package/llms/components/lr-message-feedback.md +1 -3
  212. package/llms/components/lr-message-parts.md +4 -5
  213. package/llms/components/lr-multi-split.md +8 -7
  214. package/llms/components/lr-native-time-input.md +1 -1
  215. package/llms/components/lr-navigation-menu.md +5 -5
  216. package/llms/components/lr-number-input.md +3 -1
  217. package/llms/components/lr-otp-input.md +2 -0
  218. package/llms/components/lr-page.md +1 -1
  219. package/llms/components/lr-pan-zoom.md +1 -1
  220. package/llms/components/lr-phone-input.md +3 -1
  221. package/llms/components/lr-popover.md +2 -2
  222. package/llms/components/lr-progress-bar.md +3 -5
  223. package/llms/components/lr-progress-ring.md +5 -7
  224. package/llms/components/lr-prompt-input.md +1 -1
  225. package/llms/components/lr-prompt-queue.md +1 -1
  226. package/llms/components/lr-prompt-studio.md +1 -1
  227. package/llms/components/lr-rag-eval-dashboard.md +1 -1
  228. package/llms/components/lr-rating.md +2 -2
  229. package/llms/components/lr-realtime-session.md +1 -1
  230. package/llms/components/lr-reorder-item.md +1 -1
  231. package/llms/components/lr-reorder-list.md +2 -3
  232. package/llms/components/lr-retrieval-compare.md +1 -1
  233. package/llms/components/lr-select.md +3 -1
  234. package/llms/components/lr-selection-toolbar.md +1 -1
  235. package/llms/components/lr-sequence-strip.md +3 -8
  236. package/llms/components/lr-span-waterfall.md +1 -1
  237. package/llms/components/lr-split-panel.md +1 -1
  238. package/llms/components/lr-streaming-text-core.md +2 -1
  239. package/llms/components/lr-streaming-text.md +3 -2
  240. package/llms/components/lr-subagent-panel.md +1 -1
  241. package/llms/components/lr-swatch-picker.md +7 -6
  242. package/llms/components/lr-switch.md +3 -1
  243. package/llms/components/lr-table.md +33 -85
  244. package/llms/components/lr-terminal.md +2 -5
  245. package/llms/components/lr-textarea.md +1 -1
  246. package/llms/components/lr-thread-list.md +8 -14
  247. package/llms/components/lr-time-input.md +1 -1
  248. package/llms/components/lr-toggle-group.md +2 -2
  249. package/llms/components/lr-toggle.md +1 -1
  250. package/llms/components/lr-tool-approval-dialog.md +4 -7
  251. package/llms/components/lr-tool-call-block.md +1 -1
  252. package/llms/components/lr-tool-timeline.md +2 -5
  253. package/llms/components/lr-video-playlist.md +1 -1
  254. package/llms/components/lr-video.md +1 -1
  255. package/llms/components/lr-widget-renderer.md +7 -6
  256. package/llms/components/lr-zoomable-frame.md +1 -1
  257. package/llms/index.md +3 -618
  258. package/llms/migration.md +614 -614
  259. package/llms/shared/events-and-types.md +32 -31
  260. package/llms/shared/frameworks-and-ssr.md +7 -3
  261. package/llms/shared/imports-and-registration.md +22 -22
  262. package/llms/shared/localization-and-rtl.md +2 -2
  263. package/llms/shared/native-styles-and-utilities.md +263 -0
  264. package/llms/shared/styles-and-tokens.md +85 -676
  265. package/llms/shared/testing-and-utilities.md +12 -11
  266. package/llms/shared/v23-to-v24-migration.md +167 -0
  267. package/llms/shared.md +149 -494
  268. package/llms/tokens.md +3 -3
  269. package/llms.txt +9 -4
  270. package/package.json +7 -311
  271. package/registrations.json +1 -1
  272. package/vscode-html-data.json +1 -1
  273. package/web-types.json +1 -1
  274. package/dist/ssr-loader.d.ts +0 -2
  275. package/dist/ssr-loader.js +0 -1
  276. package/dist/theme/presets/shadcn.d.ts +0 -22
  277. package/dist/theme/presets/shadcn.js +0 -1
  278. package/dist/theme/presets.d.ts +0 -49
  279. package/dist/theme/presets.js +0 -1
  280. package/dist/themes/shadcn.css +0 -1
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isRtl}from"../../../internal/rtl.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{styles}from"./dock-panel.styles.js";import{resolveCssLength}from"../../../internal/css-length.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{LYRA_DEFAULT_dockPanelCollapse,LYRA_DEFAULT_dockPanelExpand,LYRA_DEFAULT_dockPanelResize,LYRA_DEFAULT_resizeValuePixels}from"../../../internal/default-strings.generated.js";const KEYBOARD_STEP_PX=16;class LyraDockPanel extends LyraElement{constructor(){super(...arguments),this.placement="end",this.extent="280px",this.minExtent="160px",this.maxExtent="",this.collapsible=!1,this.collapsed=!1,this.withoutResize=!1,this.drag=null,this.contentId=nextId("dock-panel-content"),this.onPointerDown=e=>{if(!e.isPrimary||e.button!==0||this.withoutResize||this.collapsed||this.drag)return;const handle=e.currentTarget,ownerWindow=handle.ownerDocument.defaultView;if(!ownerWindow)return;const axis=this.axis,growSign=this.growSign;this.drag={pointerId:e.pointerId,startPos:axis==="inline"?e.clientX:e.clientY,startSizePx:this.currentSizePx(),axis,growSign,placement:this.placement,minExtent:this.minExtent,maxExtent:this.maxExtent,containerPx:this.containerPx(),expectedExtent:this.extent,finalExtent:this.extent,acceptedResize:!1},this.dragOwnerWindow=ownerWindow,handle.setPointerCapture(e.pointerId),ownerWindow.addEventListener("pointermove",this.onPointerMove),ownerWindow.addEventListener("pointerup",this.onPointerUp),ownerWindow.addEventListener("pointercancel",this.onPointerCancel),ownerWindow.addEventListener("lostpointercapture",this.onPointerCancel)},this.onPointerMove=e=>{const drag=this.drag;if(!drag||e.pointerId!==drag.pointerId)return;if(!this.dragSnapshotIsCurrent(drag)){this.endDrag();return}const pos=drag.axis==="inline"?e.clientX:e.clientY,delta=drag.growSign*(pos-drag.startPos),extent=this.commitSize(drag.startSizePx+delta);extent!==void 0&&(drag.expectedExtent=extent,drag.finalExtent=extent,drag.acceptedResize=!0,this.emitResize("lr-resize-input",extent))},this.onPointerUp=e=>{const drag=this.drag;if(!drag||e.pointerId!==drag.pointerId)return;const shouldCommit=drag.acceptedResize&&this.dragSnapshotIsCurrent(drag),finalExtent=drag.finalExtent,startSizePx=drag.startSizePx;if(this.endDrag(),!shouldCommit)return;if(this.emit("lr-resize-request",Object.freeze({extent:finalExtent}),{cancelable:!0}).defaultPrevented){this.applyProposal(this.resolveBoundsPx(),`${Math.round(startSizePx)}px`);return}this.emitResize("lr-resize-change",finalExtent)},this.onPointerCancel=e=>{!this.drag||e.pointerId!==this.drag.pointerId||this.endDrag()},this.onHandleKeyDown=e=>{if(this.withoutResize||this.collapsed)return;const forwardKey=this.axis==="inline"?"ArrowRight":"ArrowDown",backwardKey=this.axis==="inline"?"ArrowLeft":"ArrowUp";let proposal;e.key===forwardKey?(e.preventDefault(),proposal=this.resolveProposal(this.currentSizePx()+this.growSign*KEYBOARD_STEP_PX)):e.key===backwardKey&&(e.preventDefault(),proposal=this.resolveProposal(this.currentSizePx()-this.growSign*KEYBOARD_STEP_PX)),proposal&&this.requestResize(proposal.bounds,proposal.nextExtent)&&(this.emitResize("lr-resize-input",proposal.nextExtent),this.emitResize("lr-resize-change",proposal.nextExtent))},this.toggleCollapsed=()=>{const next=!this.collapsed;this.emit("lr-collapse-request",Object.freeze({collapsed:next,expanded:!next}),{cancelable:!0}).defaultPrevented||(this.collapsed=next,this.emit("lr-collapse-change",Object.freeze({collapsed:next,expanded:!next})))}}static{this.defaultStrings={...super.defaultStrings,dockPanelCollapse:LYRA_DEFAULT_dockPanelCollapse,dockPanelExpand:LYRA_DEFAULT_dockPanelExpand,dockPanelResize:LYRA_DEFAULT_dockPanelResize,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels}}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.applyHostSize(),this.armContainerResizeObserver()}disconnectedCallback(){super.disconnectedCallback(),this.endDrag(),this.containerResizeObserver?.disconnect(),this.containerResizeObserver=void 0}adoptedCallback(){super.adoptedCallback(),this.endDrag(),this.containerResizeObserver?.disconnect(),this.containerResizeObserver=void 0}armContainerResizeObserver(){const ResizeObserverCtor=this.ownerDocument.defaultView?.ResizeObserver;!this.parentElement||!ResizeObserverCtor||(this.containerResizeObserver??=new ResizeObserverCtor(()=>{this.isConnected&&(this.drag&&!this.dragSnapshotIsCurrent(this.drag)&&this.endDrag(),this.reconcileLiveExtent(),this.requestUpdate())}),this.containerResizeObserver.observe(this.parentElement),this.containerResizeObserver.observe(this))}willUpdate(changed){super.willUpdate(changed),changed.has("extent")||changed.has("minExtent")||changed.has("maxExtent")||changed.has("collapsed")||changed.has("placement")?(this.drag&&!this.dragSnapshotIsCurrent(this.drag)&&this.endDrag(),this.reconcileLiveExtent()):this.drag&&(changed.has("withoutResize")&&this.withoutResize||changed.has("collapsed")&&this.collapsed)&&this.endDrag()}get axis(){return this.placement==="start"||this.placement==="end"?"inline":"block"}get growSign(){if(this.placement==="top")return 1;if(this.placement==="bottom")return-1;const rtl=isRtl(this);return this.placement==="start"?rtl?-1:1:rtl?1:-1}applyHostSize(bounds=this.resolveBoundsPx()){const value=this.collapsed?"var(--lr-dock-panel-collapsed-size, var(--_lr-dock-panel-collapsed-size))":this.extent;this.axis==="inline"?(this.style.inlineSize=value,this.style.blockSize="",this.style.minBlockSize="",this.style.maxBlockSize="",this.style.minInlineSize=this.collapsed?"":`${bounds.minPx}px`,this.style.maxInlineSize=this.collapsed?"":`${bounds.maxPx}px`):(this.style.blockSize=value,this.style.inlineSize="",this.style.minInlineSize="",this.style.maxInlineSize="",this.style.minBlockSize=this.collapsed?"":`${bounds.minPx}px`,this.style.maxBlockSize=this.collapsed?"":`${bounds.maxPx}px`)}containerPx(){const rect=this.parentElement?.getBoundingClientRect(),ownerWindow=this.ownerDocument.defaultView;return this.axis==="inline"?rect?.width??ownerWindow?.innerWidth??0:rect?.height??ownerWindow?.innerHeight??0}resolveBoundsPx(){const containerPx=Math.max(0,this.containerPx()),lengthContext={host:this,percentBase:containerPx,viewportBasis:this.ownerDocument.defaultView??void 0},authoredMax=Math.max(0,resolveCssLength(this.maxExtent,lengthContext)??containerPx),maxPx=Math.min(containerPx,authoredMax),authoredMin=Math.max(0,resolveCssLength(this.minExtent,lengthContext)??0);return{minPx:Math.min(authoredMin,maxPx),maxPx}}currentSizePx(){const rect=this.getBoundingClientRect();return this.axis==="inline"?rect.width:rect.height}resizeValueText(sizePx){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(sizePx))})}reconcileLiveExtent(){const bounds=this.resolveBoundsPx();if(this.applyHostSize(bounds),this.collapsed)return;const containerPx=this.containerPx(),authoredPx=resolveCssLength(this.extent,{host:this,percentBase:containerPx,viewportBasis:this.ownerDocument.defaultView??void 0}),renderedPx=this.currentSizePx(),candidate=authoredPx??renderedPx;if(!Number.isFinite(candidate))return;const clamped=Math.min(Math.max(candidate,bounds.minPx),bounds.maxPx),renderedOutsideBounds=Number.isFinite(renderedPx)&&(renderedPx<bounds.minPx-.5||renderedPx>bounds.maxPx+.5);if(Math.abs(candidate-clamped)<=.5&&!renderedOutsideBounds)return;const nextExtent=`${Math.round(clamped)}px`;this.extent!==nextExtent&&(this.extent=nextExtent),this.applyHostSize(bounds)}resolveProposal(px){const bounds=this.resolveBoundsPx(),clamped=Math.min(Math.max(px,bounds.minPx),bounds.maxPx),nextExtent=`${Math.round(clamped)}px`,currentExtent=`${Math.round(this.currentSizePx())}px`;if(nextExtent!==currentExtent)return{bounds,nextExtent}}applyProposal(bounds,nextExtent){this.extent=nextExtent,this.applyHostSize(bounds)}commitSize(px){const proposal=this.resolveProposal(px);if(proposal)return this.applyProposal(proposal.bounds,proposal.nextExtent),proposal.nextExtent}requestResize(bounds,extent){return this.emit("lr-resize-request",Object.freeze({extent}),{cancelable:!0}).defaultPrevented?!1:(this.applyProposal(bounds,extent),!0)}emitResize(type,extent){this.emit(type,Object.freeze({extent}))}dragSnapshotIsCurrent(drag){return!this.withoutResize&&!this.collapsed&&this.placement===drag.placement&&this.axis===drag.axis&&this.growSign===drag.growSign&&this.extent===drag.expectedExtent&&this.minExtent===drag.minExtent&&this.maxExtent===drag.maxExtent&&Math.abs(this.containerPx()-drag.containerPx)<=.5}endDrag(){const ownerWindow=this.dragOwnerWindow;this.drag=null,this.dragOwnerWindow=void 0,ownerWindow?.removeEventListener("pointermove",this.onPointerMove),ownerWindow?.removeEventListener("pointerup",this.onPointerUp),ownerWindow?.removeEventListener("pointercancel",this.onPointerCancel),ownerWindow?.removeEventListener("lostpointercapture",this.onPointerCancel)}get topBottomChevronDeg(){if(this.placement==="top")return this.collapsed?90:-90;if(this.placement==="bottom")return this.collapsed?-90:90}handleTemplate(){if(this.withoutResize||this.collapsed)return nothing;const{minPx,maxPx}=this.resolveBoundsPx(),nowPx=Math.min(Math.max(this.currentSizePx(),minPx),maxPx);return html`<div
1
+ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isRtl}from"../../../internal/rtl.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{styles}from"./dock-panel.styles.js";import{resolveCssLength}from"../../../internal/css-length.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{LYRA_DEFAULT_dockPanelCollapse,LYRA_DEFAULT_dockPanelExpand,LYRA_DEFAULT_dockPanelResize,LYRA_DEFAULT_resizeValuePixels}from"../../../internal/default-strings.generated.js";const KEYBOARD_STEP_PX=16;class LyraDockPanel extends LyraElement{constructor(){super(...arguments),this.placement="end",this.extent="280px",this.minExtent="160px",this.maxExtent="",this.collapsible=!1,this.collapsed=!1,this.withoutResize=!1,this.drag=null,this.contentId=nextId("dock-panel-content"),this.onPointerDown=e=>{if(!e.isPrimary||e.button!==0||this.withoutResize||this.collapsed||this.drag)return;const handle=e.currentTarget,ownerWindow=handle.ownerDocument.defaultView;if(!ownerWindow)return;const axis=this.axis,growSign=this.growSign;this.drag={pointerId:e.pointerId,startPos:axis==="inline"?e.clientX:e.clientY,startSizePx:this.currentSizePx(),axis,growSign,placement:this.placement,minExtent:this.minExtent,maxExtent:this.maxExtent,containerPx:this.containerPx(),expectedExtent:this.extent,finalExtent:this.extent,acceptedResize:!1},this.dragOwnerWindow=ownerWindow,handle.setPointerCapture(e.pointerId),ownerWindow.addEventListener("pointermove",this.onPointerMove),ownerWindow.addEventListener("pointerup",this.onPointerUp),ownerWindow.addEventListener("pointercancel",this.onPointerCancel),ownerWindow.addEventListener("lostpointercapture",this.onPointerCancel)},this.onPointerMove=e=>{const drag=this.drag;if(!drag||e.pointerId!==drag.pointerId)return;if(!this.dragSnapshotIsCurrent(drag)){this.endDrag();return}const pos=drag.axis==="inline"?e.clientX:e.clientY,delta=drag.growSign*(pos-drag.startPos),extent=this.commitSize(drag.startSizePx+delta);extent!==void 0&&(drag.expectedExtent=extent,drag.finalExtent=extent,drag.acceptedResize=!0,this.emitResize("lr-resize-input",extent))},this.onPointerUp=e=>{const drag=this.drag;if(!drag||e.pointerId!==drag.pointerId)return;const shouldCommit=drag.acceptedResize&&this.dragSnapshotIsCurrent(drag),finalExtent=drag.finalExtent,startSizePx=drag.startSizePx;if(this.endDrag(),!shouldCommit)return;if(this.emit("lr-resize-request",Object.freeze({extent:finalExtent}),{cancelable:!0}).defaultPrevented){this.applyProposal(this.resolveBoundsPx(),`${Math.round(startSizePx)}px`);return}this.emitResize("lr-resize-change",finalExtent)},this.onPointerCancel=e=>{!this.drag||e.pointerId!==this.drag.pointerId||this.endDrag()},this.onHandleKeyDown=e=>{if(this.withoutResize||this.collapsed)return;const forwardKey=this.axis==="inline"?"ArrowRight":"ArrowDown",backwardKey=this.axis==="inline"?"ArrowLeft":"ArrowUp";let proposal;e.key===forwardKey?(e.preventDefault(),proposal=this.resolveProposal(this.currentSizePx()+this.growSign*KEYBOARD_STEP_PX)):e.key===backwardKey&&(e.preventDefault(),proposal=this.resolveProposal(this.currentSizePx()-this.growSign*KEYBOARD_STEP_PX)),proposal&&this.requestResize(proposal.bounds,proposal.nextExtent)&&(this.emitResize("lr-resize-input",proposal.nextExtent),this.emitResize("lr-resize-change",proposal.nextExtent))},this.toggleCollapsed=()=>{const next=!this.collapsed;this.emit("lr-collapse-request",Object.freeze({expanded:!next}),{cancelable:!0}).defaultPrevented||(this.collapsed=next,this.emit("lr-collapse-change",Object.freeze({expanded:!next})))}}static{this.defaultStrings={...super.defaultStrings,dockPanelCollapse:LYRA_DEFAULT_dockPanelCollapse,dockPanelExpand:LYRA_DEFAULT_dockPanelExpand,dockPanelResize:LYRA_DEFAULT_dockPanelResize,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels}}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.applyHostSize(),this.armContainerResizeObserver()}disconnectedCallback(){super.disconnectedCallback(),this.endDrag(),this.containerResizeObserver?.disconnect(),this.containerResizeObserver=void 0}adoptedCallback(){super.adoptedCallback(),this.endDrag(),this.containerResizeObserver?.disconnect(),this.containerResizeObserver=void 0}armContainerResizeObserver(){const ResizeObserverCtor=this.ownerDocument.defaultView?.ResizeObserver;!this.parentElement||!ResizeObserverCtor||(this.containerResizeObserver??=new ResizeObserverCtor(()=>{this.isConnected&&(this.drag&&!this.dragSnapshotIsCurrent(this.drag)&&this.endDrag(),this.reconcileLiveExtent(),this.requestUpdate())}),this.containerResizeObserver.observe(this.parentElement),this.containerResizeObserver.observe(this))}willUpdate(changed){super.willUpdate(changed),changed.has("extent")||changed.has("minExtent")||changed.has("maxExtent")||changed.has("collapsed")||changed.has("placement")?(this.drag&&!this.dragSnapshotIsCurrent(this.drag)&&this.endDrag(),this.reconcileLiveExtent()):this.drag&&(changed.has("withoutResize")&&this.withoutResize||changed.has("collapsed")&&this.collapsed)&&this.endDrag()}get axis(){return this.placement==="start"||this.placement==="end"?"inline":"block"}get growSign(){if(this.placement==="top")return 1;if(this.placement==="bottom")return-1;const rtl=isRtl(this);return this.placement==="start"?rtl?-1:1:rtl?1:-1}applyHostSize(bounds=this.resolveBoundsPx()){const value=this.collapsed?"var(--lr-dock-panel-collapsed-size, var(--_lr-dock-panel-collapsed-size))":this.extent;this.axis==="inline"?(this.style.inlineSize=value,this.style.blockSize="",this.style.minBlockSize="",this.style.maxBlockSize="",this.style.minInlineSize=this.collapsed?"":`${bounds.minPx}px`,this.style.maxInlineSize=this.collapsed?"":`${bounds.maxPx}px`):(this.style.blockSize=value,this.style.inlineSize="",this.style.minInlineSize="",this.style.maxInlineSize="",this.style.minBlockSize=this.collapsed?"":`${bounds.minPx}px`,this.style.maxBlockSize=this.collapsed?"":`${bounds.maxPx}px`)}containerPx(){const rect=this.parentElement?.getBoundingClientRect(),ownerWindow=this.ownerDocument.defaultView;return this.axis==="inline"?rect?.width??ownerWindow?.innerWidth??0:rect?.height??ownerWindow?.innerHeight??0}resolveBoundsPx(){const containerPx=Math.max(0,this.containerPx()),lengthContext={host:this,percentBase:containerPx,viewportBasis:this.ownerDocument.defaultView??void 0},authoredMax=Math.max(0,resolveCssLength(this.maxExtent,lengthContext)??containerPx),maxPx=Math.min(containerPx,authoredMax),authoredMin=Math.max(0,resolveCssLength(this.minExtent,lengthContext)??0);return{minPx:Math.min(authoredMin,maxPx),maxPx}}currentSizePx(){const rect=this.getBoundingClientRect();return this.axis==="inline"?rect.width:rect.height}resizeValueText(sizePx){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(sizePx))})}reconcileLiveExtent(){const bounds=this.resolveBoundsPx();if(this.applyHostSize(bounds),this.collapsed)return;const containerPx=this.containerPx(),authoredPx=resolveCssLength(this.extent,{host:this,percentBase:containerPx,viewportBasis:this.ownerDocument.defaultView??void 0}),renderedPx=this.currentSizePx(),candidate=authoredPx??renderedPx;if(!Number.isFinite(candidate))return;const clamped=Math.min(Math.max(candidate,bounds.minPx),bounds.maxPx),renderedOutsideBounds=Number.isFinite(renderedPx)&&(renderedPx<bounds.minPx-.5||renderedPx>bounds.maxPx+.5);if(Math.abs(candidate-clamped)<=.5&&!renderedOutsideBounds)return;const nextExtent=`${Math.round(clamped)}px`;this.extent!==nextExtent&&(this.extent=nextExtent),this.applyHostSize(bounds)}resolveProposal(px){const bounds=this.resolveBoundsPx(),clamped=Math.min(Math.max(px,bounds.minPx),bounds.maxPx),nextExtent=`${Math.round(clamped)}px`,currentExtent=`${Math.round(this.currentSizePx())}px`;if(nextExtent!==currentExtent)return{bounds,nextExtent}}applyProposal(bounds,nextExtent){this.extent=nextExtent,this.applyHostSize(bounds)}commitSize(px){const proposal=this.resolveProposal(px);if(proposal)return this.applyProposal(proposal.bounds,proposal.nextExtent),proposal.nextExtent}requestResize(bounds,extent){return this.emit("lr-resize-request",Object.freeze({extent}),{cancelable:!0}).defaultPrevented?!1:(this.applyProposal(bounds,extent),!0)}emitResize(type,extent){this.emit(type,Object.freeze({extent}))}dragSnapshotIsCurrent(drag){return!this.withoutResize&&!this.collapsed&&this.placement===drag.placement&&this.axis===drag.axis&&this.growSign===drag.growSign&&this.extent===drag.expectedExtent&&this.minExtent===drag.minExtent&&this.maxExtent===drag.maxExtent&&Math.abs(this.containerPx()-drag.containerPx)<=.5}endDrag(){const ownerWindow=this.dragOwnerWindow;this.drag=null,this.dragOwnerWindow=void 0,ownerWindow?.removeEventListener("pointermove",this.onPointerMove),ownerWindow?.removeEventListener("pointerup",this.onPointerUp),ownerWindow?.removeEventListener("pointercancel",this.onPointerCancel),ownerWindow?.removeEventListener("lostpointercapture",this.onPointerCancel)}get topBottomChevronDeg(){if(this.placement==="top")return this.collapsed?90:-90;if(this.placement==="bottom")return this.collapsed?-90:90}handleTemplate(){if(this.withoutResize||this.collapsed)return nothing;const{minPx,maxPx}=this.resolveBoundsPx(),nowPx=Math.min(Math.max(this.currentSizePx(),minPx),maxPx);return html`<div
2
2
  part="handle"
3
3
  role="separator"
4
4
  aria-label=${this.localize("dockPanelResize")}
@@ -1,4 +1,4 @@
1
- var _a;import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlaceReady as place,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{DebounceController}from"../../../internal/debounce-controller.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,resolveAccessibleTrigger}from"../../../internal/a11y.js";import{collectFocusableElements,composedContains}from"../../../internal/overlay-manager.js";import{styles}from"./menu.styles.js";import{menuItemOwner,submenuPanelController}from"./menu-shared.js";import{composedAccessibilityText}from"../../../internal/accessibility-visibility.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{activeElementIn}from"../../../internal/active-element.js";import{syncAriaDescribedByElements}from"../../../internal/aria-reflection.js";import"./menu-item.class.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings.generated.js";const SUBMENU_PLACEMENT="right-start",MENUBAR_PLACEMENT="bottom-start",SUBMENU_OPEN_DELAY=150,SUBMENU_CLOSE_DELAY=300,TYPE_AHEAD_RESET_MS=500;function parseCssTime(value){const trimmed=value.trim();return trimmed.endsWith("ms")?Number.parseFloat(trimmed):trimmed.endsWith("s")?Number.parseFloat(trimmed)*1e3:0}function maxCssTime(value){return Math.max(0,...value.split(",").map(parseCssTime).filter(Number.isFinite))}function isLyraMenuItemElement(value){return isHtmlElement(value)?value.localName===tag("menu-item")||value.localName===tag("dropdown-item"):!1}function isLyraMenuElement(value){return isHtmlElement(value)&&value.localName===tag("menu")}function isUsableActiveElement(value){if(typeof value!="object"&&typeof value!="function"||value===null)return!1;try{const candidate=value;if(candidate.nodeType!==1)return!1;const NodeConstructor=candidate.ownerDocument?.defaultView?.Node??(typeof Node>"u"?void 0:Node);return NodeConstructor?(NodeConstructor.prototype.getRootNode.call(candidate),!0):!1}catch{return!1}}function safeDeepActiveElement(root){const initial=activeElementIn(root);if(!isUsableActiveElement(initial))return null;let active=initial;for(;;){let shadowRoot;try{shadowRoot=active.shadowRoot}catch{return null}if(!shadowRoot)return active;const nested=activeElementIn(shadowRoot);if(nested===null)return active;if(!isUsableActiveElement(nested))return null;active=nested}}let menuWidthScaleRegistered=!1;function registerMenuWidthScale(){if(!menuWidthScaleRegistered&&(menuWidthScaleRegistered=!0,!(typeof CSS>"u"||typeof CSS.registerProperty!="function")))try{CSS.registerProperty({name:"--_lr-menu-max-inline-size",syntax:"<length-percentage>",inherits:!1,initialValue:"100%"})}catch{}}class LyraMenu extends LyraElement{constructor(){super(...arguments),this.presentationOpen=!1,this.presentationHidden=!0,this.submenuAnchor=null,this.submenuStateChange=null,this.dropdownContained=!1,this.dropdownOwner=null,this._dropdownOpen=!1,this.dropdownRendersMenuRole=!1,this.dropdownStayOpenOnSelect=!1,this.items=[],this.activeIndex=-1,this.presentationPositioned=!1,this.menubarAnchored=!1,this.pendingFocus="first",this.listId=nextId("menu-list"),this.owningMenu={activate:item=>this.onOwnedItemSelect(item),uncheckRadioGroup:(item,group)=>this.uncheckRadioGroupSiblings(item,group)},this.typeAheadBuffer="",this.typeAheadReset=new DebounceController(TYPE_AHEAD_RESET_MS,()=>{this.typeAheadBuffer=""},()=>this.ownerDocument.defaultView),this[_a]=this.createSubmenuController(),this.onRegionSlotChange=()=>{this.syncRegionState()},this.onDocPointer=e=>{const path=e.composedPath();path.includes(this)||this.submenuAnchor&&path.includes(this.submenuAnchor)||this.closePresentation()},this.onItemsSlotChange=e=>{this.syncItemsFromSlot(e.target)},this.itemStateChangeReconciliationPending=!1,this.onItemStateChangeEvent=event=>{event.stopPropagation(),!this.itemStateChangeReconciliationPending&&(this.itemStateChangeReconciliationPending=!0,queueMicrotask(()=>{this.itemStateChangeReconciliationPending=!1,this.onItemStateChange()}))},this.onItemStateChange=()=>{const navigable=this.items.filter(item=>this.isNavigable(item));if(this.activeIndex>=0&&!this.isNavigable(this.items[this.activeIndex])){const current=this.activeIndex,displaced=this.items[current],focused=safeDeepActiveElement(this.ownerDocument),displacedHadFocus=focused===null||focused===this.ownerDocument.body||focused===displaced||composedContains(displaced,focused),next=navigable.find(item=>this.items.indexOf(item)>current)??navigable.find(item=>this.items.indexOf(item)<current);next?this.setActiveItem(next,displacedHadFocus):(this.activeIndex=-1,this.applyRovingTabIndex(),displacedHadFocus&&this.rehomeZeroSurvivorFocus());return}this.applyRovingTabIndex()},this.onListFocusIn=e=>{const target=e.target;if(!isLyraMenuItemElement(target))return;const index=this.items.indexOf(target);index===-1||index===this.activeIndex||(this.activeIndex=index,this.applyRovingTabIndex(),this.closeSubmenus(target))},this.onListKeyDown=e=>{if(this.isForeignEvent(e))return;const isItemTarget=isLyraMenuItemElement(e.target);if(e.key==="Escape"&&isItemTarget&&!this.hasStandalonePresentation){e.preventDefault(),this.closePresentation({focusTrigger:!0});return}if(!isItemTarget)return;const navigable=this.items.filter(i=>this.isNavigable(i)),current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentNavIndex=current?navigable.indexOf(current):-1,intoSubmenuKey=this.effectiveDirection==="rtl"?"ArrowLeft":"ArrowRight";switch(e.key){case"ArrowRight":case"ArrowLeft":e.key===intoSubmenuKey?current?.hasSubmenu&&this.isNavigable(current)&&(e.preventDefault(),this.closeSubmenus(current),current.openSubmenu("first")):this.submenuAnchor&&!this.menubarAnchored&&(e.preventDefault(),this.closePresentation({focusTrigger:!0}));break;case"ArrowDown":if(e.preventDefault(),navigable.length){const next=navigable[(currentNavIndex+1+navigable.length)%navigable.length];next&&this.setActiveItem(next)}break;case"ArrowUp":if(e.preventDefault(),navigable.length){const prevIndex=currentNavIndex<=0?navigable.length-1:currentNavIndex-1,prev=navigable[prevIndex];prev&&this.setActiveItem(prev)}break;case"Home":e.preventDefault(),navigable.length&&this.setActiveItem(navigable[0]);break;case"End":e.preventDefault(),navigable.length&&this.setActiveItem(navigable[navigable.length-1]);break;case"Enter":case" ":e.preventDefault(),current?.hasSubmenu?(this.closeSubmenus(current),current.openSubmenu("first")):current?.isLinkItem?current.click():current?.select();break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);return}},this.onPopupPointerOver=e=>{if(!this.interactionOpen)return;const hovered=this.ownItemFromEvent(e);this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&opened===hovered?(this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuCloseTimer=void 0):opened&&this.scheduleSubmenuClose(opened),!(!hovered||hovered===opened||!hovered.hasSubmenu||!this.isNavigable(hovered))&&(this.submenuOpenTimer=this.scheduleOwnedTimeout(()=>{this.submenuOpenTimer=void 0,!(!this.interactionOpen||!this.items.includes(hovered))&&(this.closeSubmenus(hovered),hovered.openSubmenu("none"))},SUBMENU_OPEN_DELAY))},this.onPopupPointerLeave=()=>{this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&this.scheduleSubmenuClose(opened)},this.onNestedSelect=e=>{if(e.target===this)return;const event=e;this.dropdownStayOpenOnSelect&&event.preventDefault(),queueMicrotask(()=>{event.defaultPrevented||this.dismissAfterSelection(!0)})},this.onPopupKeyDown=e=>{const listEl=this.popupPart("list");if(e.key==="Escape"){if(listEl&&e.composedPath().includes(listEl)||this.hasStandalonePresentation)return;e.preventDefault(),this.closePresentation({focusTrigger:!0});return}e.key==="Tab"&&this.tabWouldLeavePopup(e)&&this.closePresentation()}}static{_a=submenuPanelController}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-select"])}static{this.identityEventDetailProperties=Object.freeze({"lr-select":Object.freeze(["item"])})}static{this.styles=[LyraElement.styles,styles]}get dropdownOpen(){return this._dropdownOpen}set dropdownOpen(next){const normalized=!!next;if(normalized===this._dropdownOpen)return;const old=this._dropdownOpen;this._dropdownOpen=normalized,this.presentationOpen=normalized,this.requestUpdate("dropdownOpen",old)}createSubmenuController(){const menu=this;return{get open(){return menu.submenuAnchor!==null&&menu.presentationOpen},attach(anchor,onStateChange,options){menu.submenuAnchor&&menu.submenuAnchor!==anchor&&menu.closePresentation(),menu.menubarAnchored=options?.menubar===!0,menu.submenuAnchor=anchor,menu.submenuStateChange=onStateChange,menu.syncPresentationState(),menu.requestUpdate()},detach(anchor){menu.submenuAnchor===anchor&&(menu.closePresentation(),menu.submenuAnchor=null,menu.menubarAnchored=!1,menu.submenuStateChange=null,menu.cleanup?.(),menu.cleanup=void 0,menu.syncPresentationState(),menu.requestUpdate())},async show(focus="first"){menu.submenuAnchor&&(menu.openPresentation(focus),await menu.updateComplete,await menu.focusAfterPlacement(focus))},async hide(options){menu.closePresentation(options),await menu.updateComplete}}}connectedCallback(){if(super.connectedCallback(),registerMenuWidthScale(),this.hasUpdated){const slot=this.renderRoot.querySelector("slot:not([name])");slot&&this.syncItemsFromSlot(slot)}}firstUpdated(changed){super.firstUpdated(changed),this.syncRegionState(),this.syncPresentationState();const slot=this.itemsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.syncItemsFromSlot(s))})}get hasStandalonePresentation(){return!this.dropdownContained&&!this.submenuAnchor}get interactionOpen(){return this.hasStandalonePresentation||this.presentationOpen}syncPresentationState(){const standalone=this.hasStandalonePresentation;if(this.toggleAttribute("data-inline",standalone),this.toggleAttribute("data-submenu",this.submenuAnchor!==null),this.toggleAttribute("data-contained",this.dropdownContained),standalone){const active=this.activeIndex>=0?this.items[this.activeIndex]:void 0;if(!active||!this.isNavigable(active)){const first=this.items.find(item=>this.isNavigable(item));this.activeIndex=first?this.items.indexOf(first):-1}}else this.presentationOpen||(this.activeIndex=-1);this.applyRovingTabIndex()}syncRegionState(){const assigned=selector=>this.renderRoot.querySelector(selector)?.assignedElements({flatten:!0}).length??0;this.toggleAttribute("data-has-header",assigned('slot[name="header"]')>0),this.toggleAttribute("data-has-footer",assigned('slot[name="footer"]')>0),this.toggleAttribute("data-list-empty",assigned("slot:not([name])")===0)}willUpdate(changed){super.willUpdate(changed),this.presentationOpen&&this.submenuAnchor&&(this.cancelPresentationHideWatch(),this.presentationHidden=!1)}updated(changed){super.updated(changed);const list=this.renderRoot.querySelector('[part~="list"]')??void 0;syncAriaDescribedByElements(this,list,this.getAttribute("aria-describedby")),(changed.has("presentationOpen")||changed.has("dropdownOpen")||changed.has("dropdownContained"))&&(this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.presentationOpen?this.submenuAnchor?(this.bindDocumentPointer(),this.reposition()):(this.unbindDocumentPointer(),this.presentationPositioned=!0,this.focusRoving(this.pendingFocus)):(this.unbindDocumentPointer(),this.resetTypeAhead(),this.activeIndex=-1,this.applyRovingTabIndex(),this.clearSubmenuTimers(),this.closeSubmenus(),this.submenuAnchor&&this.schedulePresentationHide())),changed.has("dropdownContained")&&this.syncPresentationState(),changed.has("dropdownSize")&&this.applyDropdownSize()}reposition(){this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1;const popup=this.renderRoot.querySelector(".submenu-surface");if(this.submenuAnchor&&popup){const placement=this.menubarAnchored?MENUBAR_PLACEMENT:rtlAwarePlacement(SUBMENU_PLACEMENT,this);this.cleanup=place(this.submenuAnchor,popup,{placement,strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")})}}cancelPresentationHideWatch(){this.presentationHideWatcher?.(),this.presentationHideWatcher=void 0}schedulePresentationHide(){this.cancelPresentationHideWatch();const surface=this.renderRoot.querySelector(".submenu-surface"),view=this.ownerDocument.defaultView,transitionMs=surface&&view?maxCssTime(view.getComputedStyle(surface).transitionDuration)+maxCssTime(view.getComputedStyle(surface).transitionDelay):0,waitForEvent=!!(surface&&view&&transitionMs>0&&!prefersReducedMotion(this));let settled=!1,timeout;const finish=()=>{settled||(settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd),this.presentationHideWatcher===cancel&&(this.presentationHideWatcher=void 0),this.presentationHidden=!0)},onEnd=event=>{event.target===surface&&finish()},cancel=()=>{settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd)};this.presentationHideWatcher=cancel,waitForEvent&&surface&&view?(surface.addEventListener("transitionend",onEnd),timeout=view.setTimeout(finish,transitionMs+50)):queueMicrotask(finish)}async focusAfterPlacement(focus){if(!this.presentationOpen||!this.submenuAnchor)return;const positioned=this.cleanup!==void 0&&(this.presentationPositioned||await waitForDeferredPlacement(()=>this.cleanup));if(!(!this.presentationOpen||!this.submenuAnchor)){if(!positioned){this.closePresentation(),await this.updateComplete;return}this.presentationPositioned=!0,this.focusRoving(focus)}}disconnectedCallback(){super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.resetTypeAhead(),this.clearSubmenuTimers(),this.itemStateObserver?.disconnect(),this.itemStateObserver=void 0,this.unbindDocumentPointer();for(const item of this.items)this.releaseItemOwner(item);this._dropdownOpen=!1,this.presentationOpen=!1,this.cancelPresentationHideWatch(),this.presentationHidden=!0,this.submenuStateChange?.(!1)}bindDocumentPointer(){const owner=this.ownerDocument;this.pointerDocument!==owner&&(this.unbindDocumentPointer(),owner.addEventListener("pointerdown",this.onDocPointer),this.pointerDocument=owner)}unbindDocumentPointer(){this.pointerDocument?.removeEventListener("pointerdown",this.onDocPointer),this.pointerDocument=void 0}scheduleOwnedTimeout(callback,delay){const owner=this.ownerDocument.defaultView;if(owner)return{owner,handle:owner.setTimeout(callback,delay)}}clearOwnedTimeout(timer){timer&&timer.owner.clearTimeout(timer.handle)}focusContained(focus="first"){if(this.dropdownContained&&this.dropdownOwner)if(this.dropdownOwner.open)this.pendingFocus=focus,this.focusRoving(focus);else{const transition=this.dropdownOwner.show();this.dropdownOwner.open&&(this.pendingFocus=focus)}}openPresentation(focus="first"){if(this.dropdownContained&&this.dropdownOwner){this.focusContained(focus);return}this.pendingFocus=focus,this.presentationOpen?(!this.submenuAnchor||this.presentationPositioned)&&this.focusRoving(focus):(this.presentationOpen=!0,this.submenuStateChange?.(!0))}closePresentation(options){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide(options);return}this.presentationOpen&&(this.presentationOpen=!1,this.submenuStateChange?.(!1),options?.focusTrigger&&this.submenuAnchor&&resolveAccessibleTrigger(this.submenuAnchor).focus())}syncItemsFromSlot(slot){const assigned=slot.assignedElements({flatten:!0}).filter(isLyraMenuItemElement);if(assigned.length===this.items.length&&assigned.every((item,index)=>item===this.items[index]))return;this.itemStateObserver?.disconnect();const previousItems=this.items,previouslyActive=this.activeIndex>=0?this.items[this.activeIndex]:void 0,focusedBefore=safeDeepActiveElement(this.ownerDocument),activeItemLostFocus=!!previouslyActive&&(focusedBefore===null||focusedBefore===this.ownerDocument.body||focusedBefore===previouslyActive||composedContains(previouslyActive,focusedBefore));this.items=assigned;for(const item of previousItems)this.items.includes(item)||this.releaseItemOwner(item);for(const item of this.items)this.acquireItemOwner(item);this.applyDropdownSize();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;if(MutationObserverCtor){const owner=this.ownerDocument;let observer;observer=new MutationObserverCtor(()=>{this.itemStateObserver!==observer||this.ownerDocument!==owner||this.onItemStateChange()}),this.itemStateObserver=observer;for(const item of this.items)this.itemStateObserver.observe(item,{attributes:!0,attributeFilter:["disabled","hidden","aria-hidden","inert"]})}if(this.activeIndex=previouslyActive?this.items.indexOf(previouslyActive):-1,this.syncPresentationState(),this.syncRegionState(),this.interactionOpen)if(this.activeIndex===-1){const successor=this.items.find(item=>this.isNavigable(item));previouslyActive&&successor?this.setActiveItem(successor,activeItemLostFocus):this.focusRoving(this.pendingFocus),activeItemLostFocus&&!this.items.some(item=>this.isNavigable(item))&&this.rehomeZeroSurvivorFocus()}else{const active=activeElementIn(this.ownerDocument);!(isUsableActiveElement(active)&&this.contains(active))&&activeItemLostFocus&&this.items[this.activeIndex].focus()}}acquireItemOwner(item){item[menuItemOwner]?.(this.owningMenu)}releaseItemOwner(item){item[menuItemOwner]?.(null,this.owningMenu)}uncheckRadioGroupSiblings(item,group){for(const sibling of this.items)sibling!==item&&sibling.type==="radio"&&sibling.group===group&&sibling.checked&&(sibling.checked=!1)}isNavigable(item){return!item.interactionDisabled&&!item.hidden&&item.getAttribute("aria-hidden")!=="true"&&!item.inert&&!item.closest("[inert]")}applyDropdownSize(){if(this.dropdownSize)for(const item of this.items)item.size=this.dropdownSize}rehomeZeroSurvivorFocus(){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide({focusTrigger:!0});return}if(this.submenuAnchor){this.closePresentation({focusTrigger:!0});return}const list=this.renderRoot.querySelector('[part~="list"]');list&&(list.tabIndex=-1,list.focus({preventScroll:!0}))}onOwnedItemSelect(item){if(!isLyraMenuItemElement(item)||!this.items.includes(item))return;!this.emit("lr-select",{item},{cancelable:!0}).defaultPrevented&&!this.dropdownStayOpenOnSelect&&this.dismissAfterSelection(!0)}dismissAfterSelection(focusTrigger){this.closeSubmenus(),this.dropdownContained?this.dropdownOwner&&this.dropdownOwner.hide({focusTrigger}):this.submenuAnchor&&this.closePresentation({focusTrigger})}applyRovingTabIndex(){this.items.forEach((item,i)=>{item.tabIndex=i===this.activeIndex?0:-1})}focusRoving(which){if(which==="none")return;const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const item=which==="first"?navigable[0]:navigable[navigable.length-1];item&&this.setActiveItem(item)}setActiveItem(item,moveFocus=!0){this.activeIndex=this.items.indexOf(item),this.applyRovingTabIndex(),this.closeSubmenus(item),moveFocus&&item.focus()}closeSubmenus(keep){for(const item of this.items)item!==keep&&item.submenuOpen&&item.closeSubmenu()}openSubmenuItem(){return this.items.find(item=>item.submenuOpen)}clearSubmenuTimers(){this.clearOwnedTimeout(this.submenuOpenTimer),this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuOpenTimer=void 0,this.submenuCloseTimer=void 0}ownItemFromEvent(e){let owner;for(const node of e.composedPath()){if(node===this)break;isLyraMenuItemElement(node)&&(owner=node)}return owner}isForeignEvent(e){for(const node of e.composedPath()){if(node===this)return!1;if(isLyraMenuElement(node))return!0}return!1}scheduleSubmenuClose(item){this.submenuCloseTimer||(this.submenuCloseTimer=this.scheduleOwnedTimeout(()=>{this.submenuCloseTimer=void 0,item.submenuOpen&&(composedContains(item,safeDeepActiveElement(this.ownerDocument))||item.closeSubmenu())},SUBMENU_CLOSE_DELAY))}popupPart(name){return this.renderRoot.querySelector(`[part="${name}"]`)}tabWouldLeavePopup(e){const header=this.popupPart("header"),footer=this.popupPart("footer"),listEl=this.popupPart("list"),backwards=e.shiftKey,active=safeDeepActiveElement(this.ownerDocument),headerStops=header?collectFocusableElements(header):[],footerStops=footer?collectFocusableElements(footer):[],listStops=listEl?collectFocusableElements(listEl):[],hasNeighbor=stops=>{const index=active?stops.indexOf(active):-1;return index===-1?!1:backwards?index>0:index<stops.length-1},path=e.composedPath();return footer&&path.includes(footer)?hasNeighbor(footerStops)?!1:backwards?listStops.length===0&&headerStops.length===0:!0:header&&path.includes(header)?hasNeighbor(headerStops)?!1:backwards?!0:listStops.length===0&&footerStops.length===0:!isLyraMenuItemElement(e.target)&&hasNeighbor(listStops)?!1:backwards?headerStops.length===0:footerStops.length===0}typeAhead(char){this.typeAheadReset.cancel(),this.typeAheadBuffer+=char.toLocaleLowerCase(this.effectiveLocale),this.ownerDocument.defaultView&&this.typeAheadReset.push(void 0);const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentIndex=current?navigable.indexOf(current):-1,n=navigable.length;for(let step=1;step<=n;step++){const candidate=navigable[(currentIndex+step+n)%n];if(candidate&&this.itemText(candidate).toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){this.setActiveItem(candidate);return}}}resetTypeAhead(){this.typeAheadReset.cancel(),this.typeAheadBuffer=""}itemText(item){return composedAccessibilityText(item).trim()}get effectiveLabel(){const hostLabel=this.getAttribute("aria-label");return hostLabel!==null?hostLabel:this.label!==void 0?this.label:this.dropdownLabel!==void 0?this.dropdownLabel:this.localize("menuLabel")}renderContents(){return html`
1
+ var _a;import{__decorate}from"tslib";import{maxCssTime}from"../../../internal/css-motion-time.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlaceReady as place,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{DebounceController}from"../../../internal/debounce-controller.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,resolveAccessibleTrigger}from"../../../internal/a11y.js";import{collectFocusableElements,composedContains}from"../../../internal/overlay-manager.js";import{styles}from"./menu.styles.js";import{menuItemOwner,submenuPanelController}from"./menu-shared.js";import{composedAccessibilityText}from"../../../internal/accessibility-visibility.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{activeElementIn}from"../../../internal/active-element.js";import{syncAriaDescribedByElements}from"../../../internal/aria-reflection.js";import"./menu-item.class.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings.generated.js";const SUBMENU_PLACEMENT="right-start",MENUBAR_PLACEMENT="bottom-start",SUBMENU_OPEN_DELAY=150,SUBMENU_CLOSE_DELAY=300,TYPE_AHEAD_RESET_MS=500;function isLyraMenuItemElement(value){return isHtmlElement(value)?value.localName===tag("menu-item")||value.localName===tag("dropdown-item"):!1}function isLyraMenuElement(value){return isHtmlElement(value)&&value.localName===tag("menu")}function isUsableActiveElement(value){if(typeof value!="object"&&typeof value!="function"||value===null)return!1;try{const candidate=value;if(candidate.nodeType!==1)return!1;const NodeConstructor=candidate.ownerDocument?.defaultView?.Node??(typeof Node>"u"?void 0:Node);return NodeConstructor?(NodeConstructor.prototype.getRootNode.call(candidate),!0):!1}catch{return!1}}function safeDeepActiveElement(root){const initial=activeElementIn(root);if(!isUsableActiveElement(initial))return null;let active=initial;for(;;){let shadowRoot;try{shadowRoot=active.shadowRoot}catch{return null}if(!shadowRoot)return active;const nested=activeElementIn(shadowRoot);if(nested===null)return active;if(!isUsableActiveElement(nested))return null;active=nested}}let menuWidthScaleRegistered=!1;function registerMenuWidthScale(){if(!menuWidthScaleRegistered&&(menuWidthScaleRegistered=!0,!(typeof CSS>"u"||typeof CSS.registerProperty!="function")))try{CSS.registerProperty({name:"--_lr-menu-max-inline-size",syntax:"<length-percentage>",inherits:!1,initialValue:"100%"})}catch{}}class LyraMenu extends LyraElement{constructor(){super(...arguments),this.presentationOpen=!1,this.presentationHidden=!0,this.submenuAnchor=null,this.submenuStateChange=null,this.dropdownContained=!1,this.dropdownOwner=null,this._dropdownOpen=!1,this.dropdownRendersMenuRole=!1,this.dropdownStayOpenOnSelect=!1,this.items=[],this.activeIndex=-1,this.presentationPositioned=!1,this.menubarAnchored=!1,this.pendingFocus="first",this.listId=nextId("menu-list"),this.owningMenu={activate:item=>this.onOwnedItemSelect(item),uncheckRadioGroup:(item,group)=>this.uncheckRadioGroupSiblings(item,group)},this.typeAheadBuffer="",this.typeAheadReset=new DebounceController(TYPE_AHEAD_RESET_MS,()=>{this.typeAheadBuffer=""},()=>this.ownerDocument.defaultView),this[_a]=this.createSubmenuController(),this.onRegionSlotChange=()=>{this.syncRegionState()},this.onDocPointer=e=>{const path=e.composedPath();path.includes(this)||this.submenuAnchor&&path.includes(this.submenuAnchor)||this.closePresentation()},this.onItemsSlotChange=e=>{this.syncItemsFromSlot(e.target)},this.itemStateChangeReconciliationPending=!1,this.onItemStateChangeEvent=event=>{event.stopPropagation(),!this.itemStateChangeReconciliationPending&&(this.itemStateChangeReconciliationPending=!0,queueMicrotask(()=>{this.itemStateChangeReconciliationPending=!1,this.onItemStateChange()}))},this.onItemStateChange=()=>{const navigable=this.items.filter(item=>this.isNavigable(item));if(this.activeIndex>=0&&!this.isNavigable(this.items[this.activeIndex])){const current=this.activeIndex,displaced=this.items[current],focused=safeDeepActiveElement(this.ownerDocument),displacedHadFocus=focused===null||focused===this.ownerDocument.body||focused===displaced||composedContains(displaced,focused),next=navigable.find(item=>this.items.indexOf(item)>current)??navigable.find(item=>this.items.indexOf(item)<current);next?this.setActiveItem(next,displacedHadFocus):(this.activeIndex=-1,this.applyRovingTabIndex(),displacedHadFocus&&this.rehomeZeroSurvivorFocus());return}this.applyRovingTabIndex()},this.onListFocusIn=e=>{const target=e.target;if(!isLyraMenuItemElement(target))return;const index=this.items.indexOf(target);index===-1||index===this.activeIndex||(this.activeIndex=index,this.applyRovingTabIndex(),this.closeSubmenus(target))},this.onListKeyDown=e=>{if(this.isForeignEvent(e))return;const isItemTarget=isLyraMenuItemElement(e.target);if(e.key==="Escape"&&isItemTarget&&!this.hasStandalonePresentation){e.preventDefault(),this.closePresentation({focusTrigger:!0});return}if(!isItemTarget)return;const navigable=this.items.filter(i=>this.isNavigable(i)),current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentNavIndex=current?navigable.indexOf(current):-1,intoSubmenuKey=this.effectiveDirection==="rtl"?"ArrowLeft":"ArrowRight";switch(e.key){case"ArrowRight":case"ArrowLeft":e.key===intoSubmenuKey?current?.hasSubmenu&&this.isNavigable(current)&&(e.preventDefault(),this.closeSubmenus(current),current.openSubmenu("first")):this.submenuAnchor&&!this.menubarAnchored&&(e.preventDefault(),this.closePresentation({focusTrigger:!0}));break;case"ArrowDown":if(e.preventDefault(),navigable.length){const next=navigable[(currentNavIndex+1+navigable.length)%navigable.length];next&&this.setActiveItem(next)}break;case"ArrowUp":if(e.preventDefault(),navigable.length){const prevIndex=currentNavIndex<=0?navigable.length-1:currentNavIndex-1,prev=navigable[prevIndex];prev&&this.setActiveItem(prev)}break;case"Home":e.preventDefault(),navigable.length&&this.setActiveItem(navigable[0]);break;case"End":e.preventDefault(),navigable.length&&this.setActiveItem(navigable[navigable.length-1]);break;case"Enter":case" ":e.preventDefault(),current?.hasSubmenu?(this.closeSubmenus(current),current.openSubmenu("first")):current?.isLinkItem?current.click():current?.select();break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);return}},this.onPopupPointerOver=e=>{if(!this.interactionOpen)return;const hovered=this.ownItemFromEvent(e);this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&opened===hovered?(this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuCloseTimer=void 0):opened&&this.scheduleSubmenuClose(opened),!(!hovered||hovered===opened||!hovered.hasSubmenu||!this.isNavigable(hovered))&&(this.submenuOpenTimer=this.scheduleOwnedTimeout(()=>{this.submenuOpenTimer=void 0,!(!this.interactionOpen||!this.items.includes(hovered))&&(this.closeSubmenus(hovered),hovered.openSubmenu("none"))},SUBMENU_OPEN_DELAY))},this.onPopupPointerLeave=()=>{this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&this.scheduleSubmenuClose(opened)},this.onNestedSelect=e=>{if(e.target===this)return;const event=e;this.dropdownStayOpenOnSelect&&event.preventDefault(),queueMicrotask(()=>{event.defaultPrevented||this.dismissAfterSelection(!0)})},this.onPopupKeyDown=e=>{const listEl=this.popupPart("list");if(e.key==="Escape"){if(listEl&&e.composedPath().includes(listEl)||this.hasStandalonePresentation)return;e.preventDefault(),this.closePresentation({focusTrigger:!0});return}e.key==="Tab"&&this.tabWouldLeavePopup(e)&&this.closePresentation()}}static{_a=submenuPanelController}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-select"])}static{this.identityEventDetailProperties=Object.freeze({"lr-select":Object.freeze(["item"])})}static{this.styles=[LyraElement.styles,styles]}get dropdownOpen(){return this._dropdownOpen}set dropdownOpen(next){const normalized=!!next;if(normalized===this._dropdownOpen)return;const old=this._dropdownOpen;this._dropdownOpen=normalized,this.presentationOpen=normalized,this.requestUpdate("dropdownOpen",old)}createSubmenuController(){const menu=this;return{get open(){return menu.submenuAnchor!==null&&menu.presentationOpen},attach(anchor,onStateChange,options){menu.submenuAnchor&&menu.submenuAnchor!==anchor&&menu.closePresentation(),menu.menubarAnchored=options?.menubar===!0,menu.submenuAnchor=anchor,menu.submenuStateChange=onStateChange,menu.syncPresentationState(),menu.requestUpdate()},detach(anchor){menu.submenuAnchor===anchor&&(menu.closePresentation(),menu.submenuAnchor=null,menu.menubarAnchored=!1,menu.submenuStateChange=null,menu.cleanup?.(),menu.cleanup=void 0,menu.syncPresentationState(),menu.requestUpdate())},async show(focus="first"){menu.submenuAnchor&&(menu.openPresentation(focus),await menu.updateComplete,await menu.focusAfterPlacement(focus))},async hide(options){menu.closePresentation(options),await menu.updateComplete}}}connectedCallback(){if(super.connectedCallback(),registerMenuWidthScale(),this.hasUpdated){const slot=this.renderRoot.querySelector("slot:not([name])");slot&&this.syncItemsFromSlot(slot)}}firstUpdated(changed){super.firstUpdated(changed),this.syncRegionState(),this.syncPresentationState();const slot=this.itemsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.syncItemsFromSlot(s))})}get hasStandalonePresentation(){return!this.dropdownContained&&!this.submenuAnchor}get interactionOpen(){return this.hasStandalonePresentation||this.presentationOpen}syncPresentationState(){const standalone=this.hasStandalonePresentation;if(this.toggleAttribute("data-inline",standalone),this.toggleAttribute("data-submenu",this.submenuAnchor!==null),this.toggleAttribute("data-contained",this.dropdownContained),standalone){const active=this.activeIndex>=0?this.items[this.activeIndex]:void 0;if(!active||!this.isNavigable(active)){const first=this.items.find(item=>this.isNavigable(item));this.activeIndex=first?this.items.indexOf(first):-1}}else this.presentationOpen||(this.activeIndex=-1);this.applyRovingTabIndex()}syncRegionState(){const assigned=selector=>this.renderRoot.querySelector(selector)?.assignedElements({flatten:!0}).length??0;this.toggleAttribute("data-has-header",assigned('slot[name="header"]')>0),this.toggleAttribute("data-has-footer",assigned('slot[name="footer"]')>0),this.toggleAttribute("data-list-empty",assigned("slot:not([name])")===0)}willUpdate(changed){super.willUpdate(changed),this.presentationOpen&&this.submenuAnchor&&(this.cancelPresentationHideWatch(),this.presentationHidden=!1)}updated(changed){super.updated(changed);const list=this.renderRoot.querySelector('[part~="list"]')??void 0;syncAriaDescribedByElements(this,list,this.getAttribute("aria-describedby")),(changed.has("presentationOpen")||changed.has("dropdownOpen")||changed.has("dropdownContained"))&&(this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.presentationOpen?this.submenuAnchor?(this.bindDocumentPointer(),this.reposition()):(this.unbindDocumentPointer(),this.presentationPositioned=!0,this.focusRoving(this.pendingFocus)):(this.unbindDocumentPointer(),this.resetTypeAhead(),this.activeIndex=-1,this.applyRovingTabIndex(),this.clearSubmenuTimers(),this.closeSubmenus(),this.submenuAnchor&&this.schedulePresentationHide())),changed.has("dropdownContained")&&this.syncPresentationState(),changed.has("dropdownSize")&&this.applyDropdownSize()}reposition(){this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1;const popup=this.renderRoot.querySelector(".submenu-surface");if(this.submenuAnchor&&popup){const placement=this.menubarAnchored?MENUBAR_PLACEMENT:rtlAwarePlacement(SUBMENU_PLACEMENT,this);this.cleanup=place(this.submenuAnchor,popup,{placement,strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")})}}cancelPresentationHideWatch(){this.presentationHideWatcher?.(),this.presentationHideWatcher=void 0}schedulePresentationHide(){this.cancelPresentationHideWatch();const surface=this.renderRoot.querySelector(".submenu-surface"),view=this.ownerDocument.defaultView,transitionMs=surface&&view?maxCssTime(view.getComputedStyle(surface).transitionDuration)+maxCssTime(view.getComputedStyle(surface).transitionDelay):0,waitForEvent=!!(surface&&view&&transitionMs>0&&!prefersReducedMotion(this));let settled=!1,timeout;const finish=()=>{settled||(settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd),this.presentationHideWatcher===cancel&&(this.presentationHideWatcher=void 0),this.presentationHidden=!0)},onEnd=event=>{event.target===surface&&finish()},cancel=()=>{settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd)};this.presentationHideWatcher=cancel,waitForEvent&&surface&&view?(surface.addEventListener("transitionend",onEnd),timeout=view.setTimeout(finish,transitionMs+50)):queueMicrotask(finish)}async focusAfterPlacement(focus){if(!this.presentationOpen||!this.submenuAnchor)return;const positioned=this.cleanup!==void 0&&(this.presentationPositioned||await waitForDeferredPlacement(()=>this.cleanup));if(!(!this.presentationOpen||!this.submenuAnchor)){if(!positioned){this.closePresentation(),await this.updateComplete;return}this.presentationPositioned=!0,this.focusRoving(focus)}}disconnectedCallback(){super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.resetTypeAhead(),this.clearSubmenuTimers(),this.itemStateObserver?.disconnect(),this.itemStateObserver=void 0,this.unbindDocumentPointer();for(const item of this.items)this.releaseItemOwner(item);this._dropdownOpen=!1,this.presentationOpen=!1,this.cancelPresentationHideWatch(),this.presentationHidden=!0,this.submenuStateChange?.(!1)}bindDocumentPointer(){const owner=this.ownerDocument;this.pointerDocument!==owner&&(this.unbindDocumentPointer(),owner.addEventListener("pointerdown",this.onDocPointer),this.pointerDocument=owner)}unbindDocumentPointer(){this.pointerDocument?.removeEventListener("pointerdown",this.onDocPointer),this.pointerDocument=void 0}scheduleOwnedTimeout(callback,delay){const owner=this.ownerDocument.defaultView;if(owner)return{owner,handle:owner.setTimeout(callback,delay)}}clearOwnedTimeout(timer){timer&&timer.owner.clearTimeout(timer.handle)}focusContained(focus="first"){if(this.dropdownContained&&this.dropdownOwner)if(this.dropdownOwner.open)this.pendingFocus=focus,this.focusRoving(focus);else{const transition=this.dropdownOwner.show();this.dropdownOwner.open&&(this.pendingFocus=focus)}}openPresentation(focus="first"){if(this.dropdownContained&&this.dropdownOwner){this.focusContained(focus);return}this.pendingFocus=focus,this.presentationOpen?(!this.submenuAnchor||this.presentationPositioned)&&this.focusRoving(focus):(this.presentationOpen=!0,this.submenuStateChange?.(!0))}closePresentation(options){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide(options);return}this.presentationOpen&&(this.presentationOpen=!1,this.submenuStateChange?.(!1),options?.focusTrigger&&this.submenuAnchor&&resolveAccessibleTrigger(this.submenuAnchor).focus())}syncItemsFromSlot(slot){const assigned=slot.assignedElements({flatten:!0}).filter(isLyraMenuItemElement);if(assigned.length===this.items.length&&assigned.every((item,index)=>item===this.items[index]))return;this.itemStateObserver?.disconnect();const previousItems=this.items,previouslyActive=this.activeIndex>=0?this.items[this.activeIndex]:void 0,focusedBefore=safeDeepActiveElement(this.ownerDocument),activeItemLostFocus=!!previouslyActive&&(focusedBefore===null||focusedBefore===this.ownerDocument.body||focusedBefore===previouslyActive||composedContains(previouslyActive,focusedBefore));this.items=assigned;for(const item of previousItems)this.items.includes(item)||this.releaseItemOwner(item);for(const item of this.items)this.acquireItemOwner(item);this.applyDropdownSize();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;if(MutationObserverCtor){const owner=this.ownerDocument;let observer;observer=new MutationObserverCtor(()=>{this.itemStateObserver!==observer||this.ownerDocument!==owner||this.onItemStateChange()}),this.itemStateObserver=observer;for(const item of this.items)this.itemStateObserver.observe(item,{attributes:!0,attributeFilter:["disabled","hidden","aria-hidden","inert"]})}if(this.activeIndex=previouslyActive?this.items.indexOf(previouslyActive):-1,this.syncPresentationState(),this.syncRegionState(),this.interactionOpen)if(this.activeIndex===-1){const successor=this.items.find(item=>this.isNavigable(item));previouslyActive&&successor?this.setActiveItem(successor,activeItemLostFocus):this.focusRoving(this.pendingFocus),activeItemLostFocus&&!this.items.some(item=>this.isNavigable(item))&&this.rehomeZeroSurvivorFocus()}else{const active=activeElementIn(this.ownerDocument);!(isUsableActiveElement(active)&&this.contains(active))&&activeItemLostFocus&&this.items[this.activeIndex].focus()}}acquireItemOwner(item){item[menuItemOwner]?.(this.owningMenu)}releaseItemOwner(item){item[menuItemOwner]?.(null,this.owningMenu)}uncheckRadioGroupSiblings(item,group){for(const sibling of this.items)sibling!==item&&sibling.type==="radio"&&sibling.group===group&&sibling.checked&&(sibling.checked=!1)}isNavigable(item){return!item.interactionDisabled&&!item.hidden&&item.getAttribute("aria-hidden")!=="true"&&!item.inert&&!item.closest("[inert]")}applyDropdownSize(){if(this.dropdownSize)for(const item of this.items)item.size=this.dropdownSize}rehomeZeroSurvivorFocus(){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide({focusTrigger:!0});return}if(this.submenuAnchor){this.closePresentation({focusTrigger:!0});return}const list=this.renderRoot.querySelector('[part~="list"]');list&&(list.tabIndex=-1,list.focus({preventScroll:!0}))}onOwnedItemSelect(item){if(!isLyraMenuItemElement(item)||!this.items.includes(item))return;!this.emit("lr-select",{item},{cancelable:!0}).defaultPrevented&&!this.dropdownStayOpenOnSelect&&this.dismissAfterSelection(!0)}dismissAfterSelection(focusTrigger){this.closeSubmenus(),this.dropdownContained?this.dropdownOwner&&this.dropdownOwner.hide({focusTrigger}):this.submenuAnchor&&this.closePresentation({focusTrigger})}applyRovingTabIndex(){this.items.forEach((item,i)=>{item.tabIndex=i===this.activeIndex?0:-1})}focusRoving(which){if(which==="none")return;const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const item=which==="first"?navigable[0]:navigable[navigable.length-1];item&&this.setActiveItem(item)}setActiveItem(item,moveFocus=!0){this.activeIndex=this.items.indexOf(item),this.applyRovingTabIndex(),this.closeSubmenus(item),moveFocus&&item.focus()}closeSubmenus(keep){for(const item of this.items)item!==keep&&item.submenuOpen&&item.closeSubmenu()}openSubmenuItem(){return this.items.find(item=>item.submenuOpen)}clearSubmenuTimers(){this.clearOwnedTimeout(this.submenuOpenTimer),this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuOpenTimer=void 0,this.submenuCloseTimer=void 0}ownItemFromEvent(e){let owner;for(const node of e.composedPath()){if(node===this)break;isLyraMenuItemElement(node)&&(owner=node)}return owner}isForeignEvent(e){for(const node of e.composedPath()){if(node===this)return!1;if(isLyraMenuElement(node))return!0}return!1}scheduleSubmenuClose(item){this.submenuCloseTimer||(this.submenuCloseTimer=this.scheduleOwnedTimeout(()=>{this.submenuCloseTimer=void 0,item.submenuOpen&&(composedContains(item,safeDeepActiveElement(this.ownerDocument))||item.closeSubmenu())},SUBMENU_CLOSE_DELAY))}popupPart(name){return this.renderRoot.querySelector(`[part="${name}"]`)}tabWouldLeavePopup(e){const header=this.popupPart("header"),footer=this.popupPart("footer"),listEl=this.popupPart("list"),backwards=e.shiftKey,active=safeDeepActiveElement(this.ownerDocument),headerStops=header?collectFocusableElements(header):[],footerStops=footer?collectFocusableElements(footer):[],listStops=listEl?collectFocusableElements(listEl):[],hasNeighbor=stops=>{const index=active?stops.indexOf(active):-1;return index===-1?!1:backwards?index>0:index<stops.length-1},path=e.composedPath();return footer&&path.includes(footer)?hasNeighbor(footerStops)?!1:backwards?listStops.length===0&&headerStops.length===0:!0:header&&path.includes(header)?hasNeighbor(headerStops)?!1:backwards?!0:listStops.length===0&&footerStops.length===0:!isLyraMenuItemElement(e.target)&&hasNeighbor(listStops)?!1:backwards?headerStops.length===0:footerStops.length===0}typeAhead(char){this.typeAheadReset.cancel(),this.typeAheadBuffer+=char.toLocaleLowerCase(this.effectiveLocale),this.ownerDocument.defaultView&&this.typeAheadReset.push(void 0);const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentIndex=current?navigable.indexOf(current):-1,n=navigable.length;for(let step=1;step<=n;step++){const candidate=navigable[(currentIndex+step+n)%n];if(candidate&&this.itemText(candidate).toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){this.setActiveItem(candidate);return}}}resetTypeAhead(){this.typeAheadReset.cancel(),this.typeAheadBuffer=""}itemText(item){return composedAccessibilityText(item).trim()}get effectiveLabel(){const hostLabel=this.getAttribute("aria-label");return hostLabel!==null?hostLabel:this.label!==void 0?this.label:this.dropdownLabel!==void 0?this.dropdownLabel:this.localize("menuLabel")}renderContents(){return html`
2
2
  <div part="header">
3
3
  <slot name="header" @slotchange=${this.onRegionSlotChange}></slot>
4
4
  </div>
@@ -13,8 +13,6 @@ export type LyraMultiSplitCollapseState='wide'|'rail'|'floating';
13
13
  /** What can be *assigned* to `collapseState` -- `'auto'` is a write-only
14
14
  * sentinel; see the `collapseState` accessor doc. */
15
15
  export type LyraMultiSplitCollapseStateInput=LyraMultiSplitCollapseState|'auto';export interface LyraMultiSplitCollapseChangeDetail{readonly state:LyraMultiSplitCollapseState;}export interface LyraMultiSplitToggleDetail{
16
- /** @deprecated Use `expanded`, which carries the same value; removal not before 23.0.0. */
17
- readonly open:boolean;
18
16
  /** Whether the floating drawer is (or, on a cancelable proposal, would be) open. */
19
17
  readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly sizes:readonly number[];}export interface LyraMultiSplitOrientationChangeDetail{readonly orientation:LyraOrientation;}export interface LyraMultiSplitEventMap{'lr-resize-request':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-resize':CustomEvent<LyraEventDetailSnapshot<LyraMultiSplitResizeDetail>>;'lr-multi-split-collapse-change':CustomEvent<LyraMultiSplitCollapseChangeDetail>;'lr-toggle-request':CustomEvent<LyraMultiSplitToggleDetail>;'lr-toggle':CustomEvent<LyraMultiSplitToggleDetail>;'lr-multi-split-constraints-invalid':CustomEvent<LyraMultiSplitConstraintIssueDetail>;'lr-multi-split-orientation-change':CustomEvent<LyraMultiSplitOrientationChangeDetail>;}
20
18
  /**
@@ -106,10 +104,10 @@ readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly
106
104
  * not fire. Not fired for a redundant reassignment to the state already in
107
105
  * effect.
108
106
  * @event lr-toggle-request - Cancelable proposal before an interactive overlay state change.
109
- * Detail includes `expanded` and the compatibility `open` key. Direct property writes and
107
+ * Detail carries the proposed `expanded` state. Direct property writes and
110
108
  * forced responsive closes do not propose an interactive change.
111
109
  * @event lr-toggle - Non-cancelable notification after an accepted or forced overlay change.
112
- * Detail includes the resulting `expanded` state and the compatibility `open` key.
110
+ * Detail carries the resulting `expanded` state.
113
111
  * @event lr-multi-split-constraints-invalid - `detail: LyraMultiSplitConstraintIssueDetail`,
114
112
  * fired once when the configured panel minimums/maximums cannot describe a
115
113
  * layout that fits the track. The splitter rejects that infeasible set for
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{resolveIdReferencesIn}from"../../../internal/aria-reflection.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{activateOverlay,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{isRtl}from"../../../internal/rtl.js";import{repairComposedFocus}from"../../../internal/focus-navigation.js";import{DeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{nextId}from"../../../internal/a11y.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{CollapseBreakpointController,OrientationBreakpointController}from"../../../internal/orientation-breakpoint.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{resolveCssLength}from"../../../internal/css-length.js";import{styles}from"./multi-split.styles.js";import{LYRA_DEFAULT_resizeDivider,LYRA_DEFAULT_resizeValuePercent}from"../../../internal/default-strings.generated.js";const KEYBOARD_STEP=2;function isPersistedPanelLayout(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return candidate.version!==1||!Array.isArray(candidate.panels)?!1:candidate.panels.every(panel=>{if(typeof panel!="object"||panel===null)return!1;const record=panel;return typeof record.panelId=="string"&&record.panelId!==""&&record.panelId.trim()===record.panelId&&typeof record.size=="number"&&Number.isFinite(record.size)&&record.size>=0})}const NO_MIN_PX=0,NO_MAX_PX=1e6,OWNED_PANEL_STYLE_PROPERTIES=["flex","order","inline-size","--_lr-multi-split-panel-min"];class LyraMultiSplit extends LyraElement{constructor(){super(...arguments),this.toggleProposalDepth=0,this.toggleProposalMutationVersion=0,this.forcedCloseVersion=0,this.sizes=[],this.defaultSizes=[],this.min=10,this.orientation="horizontal",this.orientationBreakpointBasis="container",this.narrowOrientation="vertical",this.panelConstraints=[],this.collapse="none",this.railWidth="3.5rem",this.railBreakpoint=640,this.floatBreakpoint=400,this.collapseBreakpointBasis="container",this.releasePinOnBreakpoint=!1,this.open=!1,this.trigger=null,this.for="",this.panelCount=0,this.sizesReconciledForMembership=!1,this._collapseState="wide",this._forced=!1,this.overlayActive=!1,this.justOpened=!1,this.nativeModal=new NativeModalCarrier(this,{onCancel:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1)},onUnexpectedClose:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1),this.overlayActive&&this.nativeModal.show()}}),this.syncNativeModalGeometry=()=>{if(!this.nativeModal.requested||!this.isConnected)return;if(!this.nativeModalView){this.nativeModalView=this.ownerDocument.defaultView??void 0,this.nativeModalView?.addEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.addEventListener("resize",this.syncNativeModalGeometry);const Observer=this.nativeModalView?.ResizeObserver;if(Observer){const observer=new Observer(this.syncNativeModalGeometry);this.nativeModalResizeObserver=observer,observer.observe(this)}}const frame=this.shadowRoot?.querySelector("[data-native-modal-carrier]");if(!frame)return;const rect=this.getBoundingClientRect();Object.assign(frame.style,{top:`${rect.top}px`,left:`${rect.left}px`,right:"auto",bottom:"auto",width:`${rect.width}px`,height:`${rect.height}px`,padding:"0"})},this.overlayReturnTarget=null,this.overlayOpener=null,this.deferredFocusReturn=new DeferredFocusReturn,this.floatingDialogPanel=null,this.floatingDialogPreviousRole=null,this.floatingDialogPreviousAriaModal=null,this.drags=new Map,this.ownedPanels=[],this.panelOwnership=new Map,this.panelOwnershipObserverGeneration=0,this.constraintIssueKey="",this.initializedSizes=!1,this.measuredInlineSize=Number.POSITIVE_INFINITY,this._effectiveOrientation="horizontal",this.collapseObserverGeneration=0,this.gutterObservedDividers=[],this.gutterObservedContainerSize=0,this.orientationBreakpoints=new OrientationBreakpointController(this,()=>this.updateEffectiveOrientation(this.measuredInlineSize,!0)),this.collapseBreakpoints=new CollapseBreakpointController(this,()=>this.updateCollapseState(this.measuredInlineSize,!0)),this.onSlotChange=()=>{this.updateBrowserDerivedState(()=>this.syncPanelMembership())},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()},this.onModalLayerClick=event=>{event.target===this.baseEl&&this.overlayHandle?.dismissBackdrop()},this.onPointerDown=(e,index)=>{if(e.button!==0||this.isDividerDisabled(index))return;const divider=e.currentTarget,ownerWindow=divider.ownerDocument.defaultView;ownerWindow&&(this.drags.size>0&&this.dragOwnerWindow!==ownerWindow||(this.drags.set(e.pointerId,{index,startPos:this.effectiveOrientation==="vertical"?e.clientY:e.clientX,base:this.baseEl,appliedDelta:0,acceptedResize:!1}),divider.setPointerCapture(e.pointerId),this.drags.size===1&&(this.dragOwnerWindow=ownerWindow,ownerWindow.addEventListener("pointermove",this.onPointerMove),ownerWindow.addEventListener("pointerup",this.onPointerUp),ownerWindow.addEventListener("pointercancel",this.onPointerUp),ownerWindow.addEventListener("lostpointercapture",this.onPointerUp))))},this.onPointerMove=e=>{const drag=this.drags.get(e.pointerId);if(!drag)return;if(this.isDividerDisabled(drag.index)){this.endDragGestures();return}const total=this.effectiveOrientation==="vertical"?drag.base.clientHeight:drag.base.clientWidth;if(!Number.isFinite(total)||total<=0){this.endDragGestures();return}let cumulativeDelta=((this.effectiveOrientation==="vertical"?e.clientY:e.clientX)-drag.startPos)/total*100;this.effectiveOrientation==="horizontal"&&isRtl(this)&&(cumulativeDelta=-cumulativeDelta);const incremental=cumulativeDelta-drag.appliedDelta,priorValue=this.sizes[drag.index];if(priorValue===void 0)return;const paired=this.clampPair(this.sizes,drag.index,incremental,total),pairedA=paired[drag.index],pairedB=paired[drag.index+1];if(pairedA===void 0||pairedB===void 0)return;const next=[...this.sizes];next[drag.index]=pairedA,next[drag.index+1]=pairedB,this.requestResize(next,!1)&&(drag.appliedDelta+=pairedA-priorValue,drag.acceptedResize=!0)},this.onPointerUp=e=>{const drag=this.drags.get(e.pointerId);drag&&(this.drags.delete(e.pointerId),e.type==="pointerup"&&drag.acceptedResize&&this.persist(),this.drags.size===0&&this.removeDragListeners())},this.onDividerKeyDown=(e,index)=>{if(this.isDividerDisabled(index))return;const rtl=this.effectiveOrientation==="horizontal"&&isRtl(this),forwardKey=this.effectiveOrientation==="vertical"?"ArrowDown":rtl?"ArrowLeft":"ArrowRight",backwardKey=this.effectiveOrientation==="vertical"?"ArrowUp":rtl?"ArrowRight":"ArrowLeft";if(e.key==="Home"||e.key==="End"){const{min,max}=this.dividerValueRange(index),current=this.sizes[index];if(current!==void 0){const target=e.key==="Home"?min:max;this.applyDelta(index,target-current,!0)&&e.preventDefault()}}else e.key===forwardKey?this.applyDelta(index,KEYBOARD_STEP,!0)&&e.preventDefault():e.key===backwardKey&&this.applyDelta(index,-KEYBOARD_STEP,!0)&&e.preventDefault()}}static{this.defaultStrings={...super.defaultStrings,resizeDivider:LYRA_DEFAULT_resizeDivider,resizeValuePercent:LYRA_DEFAULT_resizeValuePercent}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["sizes","defaultSizes","panelConstraints"])}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-resize-request","lr-resize"])}static{this.properties={collapseState:{reflect:!0,attribute:"collapse-state",noAccessor:!0}}}stopNativeModalGeometry(){this.nativeModalView?.removeEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.removeEventListener("resize",this.syncNativeModalGeometry),this.nativeModalView=void 0,this.nativeModalResizeObserver?.disconnect(),this.nativeModalResizeObserver=void 0}nativeModalLabel(){const panel=this.floatingPanelEl;return panel?panel.hasAttribute("aria-label")?panel.getAttribute("aria-label"):resolveIdReferencesIn(panel.getRootNode(),panel.getAttribute("aria-labelledby")).map(element=>element.textContent?.trim()).filter(Boolean).join(" ")||this.getAttribute("aria-label"):this.getAttribute("aria-label")}connectedCallback(){super.connectedCallback();const hostWidth=this.getBoundingClientRect().width;hostWidth>0&&(this.measuredInlineSize=hostWidth),this.seedFirstRenderState(()=>this.syncPanelMembership(!1)),this.hasUpdated&&this.syncPanelMembership(!1),this.initializedSizes&&this.ensureSizes(),this.responsiveObservationEnabled&&this.armCollapseObserver(),this.hasUpdated&&this.overlayActive&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateFloatingOverlay(),queueMicrotask(()=>{this.syncNativeModalGeometry(),this.nativeModal.show(),this.overlayHandle?.focusInitial()})),this.hasUpdated&&this.syncExternalTriggerA11y()}disconnectedCallback(){this.stopNativeModalGeometry(),this.nativeModal.hide(),super.disconnectedCallback(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.overlayHandle?.suspend(),this.deferredFocusReturn.cancel(),this.releaseExternalTriggerA11y(),this.releaseOwnedPanels()}adoptedCallback(){super.adoptedCallback(),this.deferredFocusReturn.cancel(),this.releaseExternalTriggerA11y(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.releaseOwnedPanels()}firstUpdated(changed){super.firstUpdated(changed),this.responsiveObservationEnabled&&this.armCollapseObserver()}willUpdate(changed){if(super.willUpdate(changed),!this.ownerDocument&&this.panelCount===0&&(this.panelCount=Math.max(this.sizes.length,this.defaultSizes.length,this.panelConstraints.length)),!this.initializedSizes)this.initializeSizes(),this.initializedSizes=!0;else if(changed.has("sizes")){const previous=changed.get("sizes");this.sizesReconciledForMembership?this.sizesReconciledForMembership=!1:this.validLiveSizes(this.sizes)||(Array.isArray(previous)&&this.validLiveSizes(previous)?this.sizes=[...previous]:(this.sizes=[],this.ensureSizes()))}else this.sizes.length===0&&this.ensureSizes();if((changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.orientationBreakpoints.configure(this.orientationBreakpoint,this.orientationBreakpointBasis),(changed.has("orientation")||changed.has("narrowOrientation")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.updateEffectiveOrientation(this.measuredInlineSize,this.hasUpdated&&this.orientationBreakpointBasis==="viewport"),changed.has("collapse")||changed.has("railBreakpoint")||changed.has("floatBreakpoint")||changed.has("collapseBreakpointBasis")){const previousEffective=changed.has("collapse")?this.effectiveCollapseStateFor(changed.get("collapse")??"none"):this.collapseState;changed.has("collapse")&&previousEffective!=="wide"&&this.endDragGestures(),this.collapseBreakpoints.configure(this.railBreakpoint,this.floatBreakpoint,this.collapseBreakpointBasis),this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.measuredInlineSize)),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated)}if(changed.has("open")||changed.has("collapseState")||changed.has("collapse")||changed.has("panelCount")){const next=this.collapseState==="floating"&&this.open;next!==this.overlayActive&&(this.overlayActive=next,next?(this.justOpened=!0,this.activateFloatingOverlay()):this.deactivateFloatingOverlay())}}get collapseState(){return this.effectiveCollapseStateFor(this.collapse)}set collapseState(next){if(next==="auto"){this.releaseCollapsePin(),this.updateCollapseState(this.currentMeasuredWidth());return}this._forced=!0,this.pinnedBand=this.collapseBreakpoints.classify(this.pinMeasurementWidth()),this.setRequestedCollapseState(next)}expandPane(){this.applyPaneIntent(!0)}collapsePane(){this.applyPaneIntent(!1)}togglePane(){this.applyPaneIntent(!this.paneExpanded)}get paneExpanded(){const state=this.collapseState;return state==="floating"?this.open:state==="wide"}applyPaneIntent(expanded){if(this.collapsingIndex===-1)return;const band=this.collapseBreakpoints.classify(this.pinMeasurementWidth());if(band==="floating"){this.collapseState!=="floating"&&(this.releaseCollapsePin(),this.setRequestedCollapseState("floating")),this.open=expanded;return}const target=expanded?"wide":"rail";if(this.collapseState!==target){if(target===band){this.releaseCollapsePin(),this.setRequestedCollapseState(target);return}this.collapseState=target}}releaseCollapsePin(){this._forced=!1,this.pinnedBand=void 0}pinMeasurementWidth(){const live=this.currentMeasuredWidth();return live>0?live:this.measuredInlineSize}get effectiveOrientation(){return this._effectiveOrientation}get responsiveObservationEnabled(){return this.collapse!=="none"||this.orientationBreakpoints.containerObservationEnabled}updateEffectiveOrientation(width,shouldEmit){const next=this.orientationBreakpoints.isBelow(width)?this.narrowOrientation:this.orientation;next!==this._effectiveOrientation&&(this.endDragGestures(),this._effectiveOrientation=next,this.requestUpdate(),shouldEmit&&this.emit("lr-multi-split-orientation-change",{orientation:next}),this._forced&&this.releasePinOnBreakpoint&&(this.releaseCollapsePin(),this.updateCollapseState(width,this.hasUpdated)))}currentMeasuredWidth(){return this.baseEl?.clientWidth??0}effectiveCollapseStateFor(collapse){return collapse!=="none"&&this.panelCount>=2?this._collapseState:"wide"}applyEffectiveCollapseTransition(previous,next,shouldEmit=!0){if(previous===next)return;this.endDragGestures(),this.requestUpdate("collapseState",previous);const forceClose=previous==="floating"&&next!=="floating"&&this.open,forcedCloseVersion=this.forcedCloseVersion;shouldEmit&&(this.relocateFocusOutOfCollapsingPanel(next),this.decorateOwnedPanels(),this.emit("lr-multi-split-collapse-change",{state:next})),forceClose&&this.forcedCloseVersion===forcedCloseVersion&&this.collapseState!=="floating"&&this.setOpen(!1,{force:!0})}relocateFocusOutOfCollapsingPanel(next){if(next==="wide"||next==="floating"&&this.open)return;const index=this.collapsingIndex;if(index===-1)return;const panel=this.ownedPanels[index];panel&&repairComposedFocus(panel,()=>this.collapseFocusFallbacks(panel))}collapseFocusFallbacks(collapsing){const dividers=[...this.shadowRoot?.querySelectorAll('[part="divider"]')??[]];return[...new Set([...this.ownedPanels.filter(panel=>panel!==collapsing),...dividers.filter((_,index)=>!this.isDividerDisabled(index)),...dividers])]}setOpen(next,options){if(options?.force){this.open=next,this.forcedCloseVersion+=1,this.emit("lr-toggle",{open:next,expanded:next});return}if(this.open===next)return;const collapseState=this.collapseState,open=this.open,mutationVersion=this.toggleProposalMutationVersion;this.toggleProposalDepth+=1;try{if(this.emit("lr-toggle-request",{open:next,expanded:next},{cancelable:!0}).defaultPrevented||this.toggleProposalMutationVersion!==mutationVersion||this.collapseState!==collapseState||this.open!==open)return}finally{this.toggleProposalDepth-=1}this.open=next,this.emit("lr-toggle",{open:next,expanded:next})}requestUpdate(name,oldValue,options){this.toggleProposalDepth>0&&(name==="open"&&oldValue!==this.open||name==="collapse"&&oldValue!==this.collapse||name==="collapseState"&&oldValue!==this.collapseState)&&(this.toggleProposalMutationVersion+=1),super.requestUpdate(name,oldValue,options)}setRequestedCollapseState(next,shouldEmit=!0){const previousEffective=this.collapseState;if(next===this._collapseState)return;this._collapseState=next;const nextEffective=this.collapseState;this.applyEffectiveCollapseTransition(previousEffective,nextEffective,shouldEmit),previousEffective===nextEffective&&next!==nextEffective&&this.requestUpdate("collapseState",next)}get storageFullKey(){return this.storageKey?`lr-multi-split:${this.storageKey}:panels`:void 0}panelIdsFor(panels){const ids=[],seen=new Set;for(const panel of panels){const panelId=panel.getAttribute("panel-id")??"";if(!panelId||panelId.trim()!==panelId||seen.has(panelId))return null;seen.add(panelId),ids.push(panelId)}return ids}reconcileIdentitySizes(previousIds,previousValues,nextIds){if(previousIds.length!==previousValues.length||nextIds.length===0)return null;const previousSizes=new Map;previousIds.forEach((panelId,index)=>{previousSizes.set(panelId,previousValues[index])});const retainedTotal=nextIds.reduce((total,panelId)=>total+(previousSizes.get(panelId)??0),0),missingCount=nextIds.filter(panelId=>!previousSizes.has(panelId)).length;if(!(retainedTotal>0)){const equal=100/nextIds.length;return nextIds.map(()=>equal)}const newShare=100/nextIds.length,retainedScale=(100-newShare*missingCount)/retainedTotal;return nextIds.map(panelId=>{const previous=previousSizes.get(panelId);return previous===void 0?newShare:previous*retainedScale})}reconcileSizesByPanelId(previousPanels,nextPanels){if(previousPanels.length!==this.sizes.length||nextPanels.length===0)return null;const previousIds=this.panelIdsFor(previousPanels),nextIds=this.panelIdsFor(nextPanels);return!previousIds||!nextIds?null:this.reconcileIdentitySizes(previousIds,this.sizes,nextIds)}validInitialSizes(value){return!Array.isArray(value)||value.length!==this.panelCount||!value.every(size=>Number.isFinite(size)&&size>=this.safeMin)?!1:Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01}validLiveSizes(value){if(!Array.isArray(value)||value.length!==this.panelCount)return!1;const floor=this.normalizedDefaultMin();return value.every(size=>Number.isFinite(size)&&size>=floor)?Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01:!1}resolveDefaultSizes(){if(this.defaultSizes.length===0)return null;if(!this.defaultSizes.some(entry=>typeof entry=="string")){const numbers=this.defaultSizes;return this.validInitialSizes(numbers)?[...numbers]:null}const containerSize=this.currentMeasuredWidth()||this.getBoundingClientRect().width;if(!(containerSize>0))return null;const resolvedPx=[];for(const entry of this.defaultSizes){if(typeof entry=="number"){if(!Number.isFinite(entry))return null;resolvedPx.push(entry/100*containerSize);continue}const px=resolveCssLength(entry,{host:this,percentBase:containerSize,viewportBasis:this.ownerDocument.defaultView??void 0});if(px==null||!(px>=0))return null;resolvedPx.push(px)}const sum=resolvedPx.reduce((total,size)=>total+size,0);if(!(sum>0))return null;const normalized=resolvedPx.map(size=>size/sum*100);return this.validInitialSizes(normalized)?normalized:null}initializeSizes(){if(this.validInitialSizes(this.sizes)||this.loadPersisted())return;const resolved=this.resolveDefaultSizes();if(resolved){this.sizes=resolved;return}this.sizes=[],this.ensureSizes()}loadPersisted(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds)return!1;const parsed=readPersistedState(this.storageFullKey,isPersistedPanelLayout);if(!parsed||parsed.panels.length===0)return!1;const persistedIds=[],persistedSizes=[],seen=new Set;for(const panel of parsed.panels){if(seen.has(panel.panelId))return!1;seen.add(panel.panelId),persistedIds.push(panel.panelId),persistedSizes.push(panel.size)}if(Math.abs(persistedSizes.reduce((sum,size)=>sum+size,0)-100)>=.01)return!1;const normalized=this.reconcileIdentitySizes(persistedIds,persistedSizes,panelIds);return normalized&&this.validInitialSizes(normalized)?(this.sizes=normalized,!0):!1}persist(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds||panelIds.length!==this.sizes.length)return;const layout={version:1,panels:panelIds.map((panelId,index)=>({panelId,size:this.sizes[index]}))};writePersistedState(this.storageFullKey,layout)}ensureSizes(){if(this.panelCount===this.sizes.length)return;if(this.panelCount<=0){this.sizes=[];return}if(this.sizes.length===0){const equal=100/this.panelCount;this.sizes=Array.from({length:this.panelCount},()=>equal);return}const diff=this.panelCount-this.sizes.length;if(diff>0){const newShare=100/this.panelCount,scale=(100-newShare*diff)/100;this.sizes=[...this.sizes.map(s=>s*scale),...Array.from({length:diff},()=>newShare)]}else{const kept=this.sizes.slice(0,this.panelCount),removedTotal=this.sizes.slice(this.panelCount).reduce((sum,s)=>sum+s,0),keptTotal=kept.reduce((sum,s)=>sum+s,0)||1;this.sizes=kept.map(s=>s+s/keptTotal*removedTotal)}}readPanelStyle(panel,property2){return{value:panel.style.getPropertyValue(property2),priority:panel.style.getPropertyPriority(property2)}}samePanelStyle(left,right){return left.value===right.value&&left.priority===right.priority}snapshotPanelOwnership(panel){const styles2=new Map;for(const property2 of OWNED_PANEL_STYLE_PROPERTIES)styles2.set(property2,this.readPanelStyle(panel,property2));return{styles:styles2,appliedStyles:new Map,hidden:panel.hidden,collapseState:panel.getAttribute("data-collapse-state")}}adoptPanelOwnership(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),applied=snapshot.appliedStyles.get(property2);(applied&&!this.samePanelStyle(current,applied)||!applied&&!this.samePanelStyle(current,snapshot.styles.get(property2)))&&snapshot.styles.set(property2,current)}(snapshot.appliedHidden!==void 0&&panel.hidden!==snapshot.appliedHidden||snapshot.appliedHidden===void 0&&panel.hidden!==snapshot.hidden)&&(snapshot.hidden=panel.hidden);const collapseState=panel.getAttribute("data-collapse-state");(snapshot.appliedCollapseState!==void 0&&collapseState!==snapshot.appliedCollapseState||snapshot.appliedCollapseState===void 0&&collapseState!==snapshot.collapseState)&&(snapshot.collapseState=collapseState)}applyOwnedPanelStyle(panel,snapshot,property2,value){value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority),snapshot.appliedStyles.set(property2,this.readPanelStyle(panel,property2))}applyOwnedPanelStyleValue(panel,snapshot,property2,value){this.applyOwnedPanelStyle(panel,snapshot,property2,{value,priority:""})}applyOwnedPanelHidden(panel,snapshot,hidden){panel.hidden=hidden,snapshot.appliedHidden=panel.hidden}applyOwnedPanelCollapseState(panel,snapshot,state){state===null?panel.removeAttribute("data-collapse-state"):panel.setAttribute("data-collapse-state",state),snapshot.appliedCollapseState=panel.getAttribute("data-collapse-state")}restorePanelOwnership(panel,snapshot){this.adoptPanelOwnership(panel,snapshot);for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const value=snapshot.styles.get(property2);value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority)}panel.hidden=snapshot.hidden,snapshot.collapseState===null?panel.removeAttribute("data-collapse-state"):panel.setAttribute("data-collapse-state",snapshot.collapseState)}panelProjectionDiverged(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),expected=snapshot.appliedStyles.get(property2)??snapshot.styles.get(property2);if(!this.samePanelStyle(current,expected))return!0}if(panel.hidden!==(snapshot.appliedHidden??snapshot.hidden))return!0;const expectedCollapseState=snapshot.appliedCollapseState!==void 0?snapshot.appliedCollapseState:snapshot.collapseState;return panel.getAttribute("data-collapse-state")!==expectedCollapseState}resetPanelOwnershipObserver(){this.panelOwnershipObserverGeneration+=1,this.panelOwnershipObserver?.disconnect(),this.panelOwnershipObserver=void 0,this.panelOwnershipObserverDocument=void 0}observeOwnedPanels(){this.resetPanelOwnershipObserver();const ownerDocument=this.ownerDocument,MutationObserverConstructor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverConstructor||!this.isConnected||this.ownedPanels.length===0)return;const generation=this.panelOwnershipObserverGeneration,observer=new MutationObserverConstructor(records=>{if(this.panelOwnershipObserver!==observer||this.panelOwnershipObserverDocument!==this.ownerDocument||this.panelOwnershipObserverGeneration!==generation||!this.isConnected)return;records.some(record=>{const panel=record.target,snapshot=this.panelOwnership.get(panel);return snapshot?this.panelProjectionDiverged(panel,snapshot):!1})&&this.requestUpdate()});this.panelOwnershipObserver=observer,this.panelOwnershipObserverDocument=ownerDocument;for(const panel of this.ownedPanels)observer.observe(panel,{attributes:!0,attributeFilter:["style","hidden","data-collapse-state"]})}samePanelSequence(next){return next.length===this.ownedPanels.length&&next.every((panel,index)=>panel===this.ownedPanels[index])}syncPanelMembership(reconcileSizes=!0){const next=[...this.children].filter(child=>child!==this.nativeModal.helperMount);if(this.samePanelSequence(next))return;const previousPanels=this.ownedPanels,identitySizes=reconcileSizes?this.reconcileSizesByPanelId(previousPanels,next):null,previousEffective=this.collapseState,nextSet=new Set(next);for(const panel of this.ownedPanels){if(nextSet.has(panel))continue;const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot),this.panelOwnership.delete(panel)}for(const panel of next)this.panelOwnership.has(panel)||this.panelOwnership.set(panel,this.snapshotPanelOwnership(panel));const countChanged=next.length!==this.panelCount;this.ownedPanels=next,this.panelCount=next.length,this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.currentMeasuredWidth())),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated),identitySizes?(this.sizesReconciledForMembership=!0,this.sizes=identitySizes):countChanged&&reconcileSizes&&(this.sizesReconciledForMembership=!0,this.ensureSizes()),this.observeOwnedPanels(),this.hasUpdated&&this.requestUpdate()}releaseOwnedPanels(){this.resetPanelOwnershipObserver();for(const panel of this.ownedPanels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot)}this.ownedPanels=[],this.panelOwnership.clear()}getContainerSize(){return this.baseEl?this.effectiveOrientation==="vertical"?this.baseEl.clientHeight:this.baseEl.clientWidth:0}resetGutterObserver(){this.gutterObserverFrame!==void 0&&(this.gutterObserverDocument?.defaultView?.cancelAnimationFrame(this.gutterObserverFrame),this.gutterObserverFrame=void 0),this.gutterResizeObserver?.disconnect(),this.gutterResizeObserver=void 0,this.gutterObserverDocument=void 0,this.gutterObservedDividers=[],this.baseEl?.style.removeProperty("--_lr-multi-split-gutters")}updateGutterBudget(){const view=this.ownerDocument.defaultView,base=this.baseEl;if(!view||!base)return;const vertical=this.effectiveOrientation==="vertical",value=`${this.gutterObservedDividers.reduce((total,divider)=>{const style=view.getComputedStyle(divider),properties=vertical?["height","padding-top","padding-bottom","border-top-width","border-bottom-width"]:["width","padding-left","padding-right","border-left-width","border-right-width"],boxProperties=style.boxSizing==="border-box"?properties.slice(0,1):properties;return total+boxProperties.reduce((size,property2)=>size+finiteRange(parseFloat(style.getPropertyValue(property2)),0,0),0)},0)}px`;base.style.getPropertyValue("--_lr-multi-split-gutters")!==value&&base.style.setProperty("--_lr-multi-split-gutters",value)}syncGutterObserver(enabled){const base=this.baseEl;if(!enabled||!this.isConnected||!base){this.resetGutterObserver();return}const ownerDocument=this.ownerDocument,dividers=[...base.querySelectorAll('[part="divider"]')];if(this.gutterResizeObserver&&this.gutterObserverDocument===ownerDocument&&dividers.length===this.gutterObservedDividers.length&&dividers.every((divider,index)=>divider===this.gutterObservedDividers[index])){this.updateGutterBudget();return}this.resetGutterObserver(),this.gutterObservedDividers=dividers,this.gutterObserverDocument=ownerDocument,this.gutterObservedContainerSize=this.getContainerSize(),this.updateGutterBudget();const ownerWindow=ownerDocument.defaultView,ResizeObserverConstructor=ownerWindow?.ResizeObserver;if(!ownerWindow||!ResizeObserverConstructor)return;const observer=new ResizeObserverConstructor(()=>{if(this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument)return;this.updateGutterBudget();const size=this.getContainerSize();size!==this.gutterObservedContainerSize&&(this.gutterObservedContainerSize=size,this.requestUpdate())});this.gutterResizeObserver=observer;const frame=ownerWindow.requestAnimationFrame(()=>{if(!(this.gutterObserverFrame!==frame||this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==base)){this.gutterObserverFrame=void 0,observer.observe(base,{box:"border-box"});for(const divider of dividers)observer.observe(divider,{box:"border-box"})}});this.gutterObserverFrame=frame}get collapsingIndex(){return this.collapse==="none"||this.panelCount<2?-1:this.collapse==="start"?0:this.panelCount-1}get collapseActive(){return this.collapsingIndex!==-1&&this.collapseState!=="wide"}isDividerDisabled(index){if(!this.collapseActive)return!1;const adjacent=this.collapsingIndex===0?0:this.panelCount-2;return index===adjacent}updateCollapseState(width,shouldEmit=!0){if(this.collapse==="none")return;const classified=this.collapseBreakpoints.classify(width);if(this._forced){if(!this.releasePinOnBreakpoint||classified===this.pinnedBand)return;this.releaseCollapsePin()}this.setRequestedCollapseState(classified,shouldEmit)}armCollapseObserver(){const observedElement=this.baseEl;if(!this.isConnected||!observedElement)return;const ownerDocument=this.ownerDocument;if(this.collapseResizeObserver&&this.collapseObservedElement===observedElement&&this.collapseObserverOwnerDocument===ownerDocument)return;this.resetCollapseObserver();const ResizeObserverConstructor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverConstructor)return;const generation=this.collapseObserverGeneration,observer=new ResizeObserverConstructor(entries=>{if(this.collapseResizeObserver!==observer||this.collapseObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==observedElement)return;const box=entries[0]?.contentBoxSize?.[0],width=box?box.inlineSize:observedElement.getBoundingClientRect().width;this.measuredInlineSize=width,this.updateCollapseState(width),this.updateEffectiveOrientation(width,!0)});this.collapseResizeObserver=observer,this.collapseObservedElement=observedElement,this.collapseObserverOwnerDocument=ownerDocument,observer.observe(observedElement)}resetCollapseObserver(){this.collapseObserverGeneration+=1,this.collapseResizeObserver?.disconnect(),this.collapseResizeObserver=void 0,this.collapseObservedElement=void 0,this.collapseObserverOwnerDocument=void 0}syncCollapseObserver(){if(!this.responsiveObservationEnabled){this.resetCollapseObserver();return}this.armCollapseObserver()}get safeMin(){return finiteRange(this.min,10,0)}normalizedDefaultMin(){if(this.panelCount<=0)return 0;const requested=this.safeMin,available=Math.max(0,100-KEYBOARD_STEP);return Math.min(requested,available/this.panelCount)}resolveConstraintBounds(containerSize){const fallbackMin=this.normalizedDefaultMin(),fallback=Array.from({length:this.panelCount},()=>({min:fallbackMin,max:1/0}));if(this.panelCount<=0)return{bounds:[],usePanelConstraints:!0};const bounds=[];let minimumTotal=0,maximumTotal=0,hasUnboundedMaximum=!1,issueReason;for(let index=0;index<this.panelCount;index++){const constraint=this.panelConstraints[index];let min=this.safeMin,max=1/0,minSet=!1,maxSet=!1;constraint&&(constraint.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&containerSize>0&&(min=constraint.minPx/containerSize*100,minSet=!0),constraint.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&(min=minSet?Math.max(min,constraint.minPercent):constraint.minPercent,minSet=!0),constraint.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&containerSize>0&&(max=constraint.maxPx/containerSize*100,maxSet=!0),constraint.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&(max=maxSet?Math.min(max,constraint.maxPercent):constraint.maxPercent,maxSet=!0),(constraint.minPx!=null&&(!Number.isFinite(constraint.minPx)||constraint.minPx<0)||constraint.maxPx!=null&&(!Number.isFinite(constraint.maxPx)||constraint.maxPx<0)||constraint.minPercent!=null&&(!Number.isFinite(constraint.minPercent)||constraint.minPercent<0)||constraint.maxPercent!=null&&(!Number.isFinite(constraint.maxPercent)||constraint.maxPercent<0))&&(issueReason??="minimum-exceeds-maximum")),min>max&&(issueReason??="minimum-exceeds-maximum"),bounds.push({min,max}),minimumTotal+=min,Number.isFinite(max)?maximumTotal+=max:hasUnboundedMaximum=!0}return issueReason==null&&minimumTotal>100+1e-9&&(issueReason="minimum-total"),issueReason==null&&!hasUnboundedMaximum&&maximumTotal<100-1e-9&&(issueReason="maximum-total"),issueReason==null?{bounds,usePanelConstraints:!0}:{bounds:fallback,usePanelConstraints:!1,issue:{reason:issueReason,panelCount:this.panelCount,minimumTotal,maximumTotal:hasUnboundedMaximum?null:maximumTotal,containerSize}}}percentBounds(index,containerSize){return this.resolveConstraintBounds(containerSize).bounds[index]??{min:0,max:1/0}}hasClampConstraint(constraint){return!!constraint&&(constraint.minPx!=null||constraint.maxPx!=null||constraint.minPercent!=null||constraint.maxPercent!=null)}minSideExpr(constraint){const terms=[];return constraint?.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&terms.push(`${constraint.minPx}px`),constraint?.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&terms.push(`${constraint.minPercent}%`),terms.length===0?`${NO_MIN_PX}px`:terms.length===1?terms[0]:`max(${this.safeMin}%, ${terms.join(", ")})`}maxSideExpr(constraint){const terms=[];return constraint?.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&terms.push(`${constraint.maxPx}px`),constraint?.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&terms.push(`${constraint.maxPercent}%`),terms.length===0?`${NO_MAX_PX}px`:terms.length===1?terms[0]:`min(${terms.join(", ")})`}clampPair(sizes,i,delta,containerSize=0){const next=[...sizes],currentA=next[i],currentB=next[i+1];if(currentA===void 0||currentB===void 0)return next;const pairTotal=currentA+currentB,a=this.percentBounds(i,containerSize),b=this.percentBounds(i+1,containerSize),loRaw=Math.max(a.min,pairTotal-b.max),hiRaw=Math.min(a.max,pairTotal-b.min),lo=Math.min(loRaw,pairTotal),hi=Math.max(hiRaw,lo),clampedA=Math.min(Math.max(currentA+delta,lo),hi);return next[i]=clampedA,next[i+1]=pairTotal-clampedA,next}requestResize(next,commit){return next.length===this.sizes.length&&next.every((size,index)=>Math.abs(size-this.sizes[index])<=1e-9)||this.emit("lr-resize-request",{sizes:[...next]},{cancelable:!0}).defaultPrevented?!1:(this.sizes=next,this.emit("lr-resize",{sizes:[...this.sizes]}),commit&&this.persist(),!0)}applyDelta(index,delta,commit){const next=this.clampPair(this.sizes,index,delta,this.getContainerSize());return next.length!==this.sizes.length||next.some((size,currentIndex)=>Math.abs(size-this.sizes[currentIndex])>1e-9)?(this.requestResize(next,commit),!0):!1}get floatingPanelEl(){const index=this.collapsingIndex;return index===-1?null:this.ownedPanels[index]??null}activateFloatingOverlay(){this.nativeModal.prepare(),this.deferredFocusReturn.cancel();const opener=deepActiveElement(this.ownerDocument);this.overlayOpener=isHtmlElement(opener)?opener:null;const trigger=this.resolveExternalTrigger();this.overlayReturnTarget=trigger??this.overlayOpener;const panel=this.floatingPanelEl;panel&&(this.floatingDialogPanel=panel,this.floatingDialogPreviousRole=panel.getAttribute("role"),this.floatingDialogPreviousAriaModal=panel.getAttribute("aria-modal"),this.nativeModal.requested||(panel.setAttribute("role","dialog"),panel.setAttribute("aria-modal","true"))),this.overlayHandle=activateOverlay({host:this,panel:()=>this.floatingPanelEl,modalRoot:()=>this.floatingPanelEl,auxiliaryRoots:()=>{const root=this.nativeModal.helperMount;return root?[root]:[]},restoreFocusTo:trigger??void 0,onEscape:()=>this.setOpen(!1),onBackdrop:()=>this.setOpen(!1),lockScroll:!0,suspendWhenUnrendered:!0})}deactivateFloatingOverlay(){this.stopNativeModalGeometry(),this.nativeModal.hide(),this.nativeModal.prepare(!1);const trigger=this.resolveExternalTrigger(),panel=this.floatingDialogPanel;this.floatingDialogPanel=null,trigger&&this.overlayHandle?.updateRestoreFocusTo(trigger),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,(trigger||this.trigger||this.for)&&this.deferredFocusReturn.schedule({host:this,candidates:()=>[this.resolveExternalTrigger(),this.overlayReturnTarget,this.overlayOpener],stranded:active=>panel!==null&&composedContains(panel,active),isCurrent:()=>!this.overlayActive}),panel&&(this.floatingDialogPreviousRole===null?panel.removeAttribute("role"):panel.setAttribute("role",this.floatingDialogPreviousRole),this.floatingDialogPreviousAriaModal===null?panel.removeAttribute("aria-modal"):panel.setAttribute("aria-modal",this.floatingDialogPreviousAriaModal))}removeDragListeners(){const ownerWindow=this.dragOwnerWindow;this.dragOwnerWindow=void 0,ownerWindow?.removeEventListener("pointermove",this.onPointerMove),ownerWindow?.removeEventListener("pointerup",this.onPointerUp),ownerWindow?.removeEventListener("pointercancel",this.onPointerUp),ownerWindow?.removeEventListener("lostpointercapture",this.onPointerUp)}endDragGestures(){this.drags.clear(),this.removeDragListeners()}dividerValueRange(index,bounds=this.resolveConstraintBounds(this.getContainerSize()).bounds){const pairTotal=(this.sizes[index]??0)+(this.sizes[index+1]??0),leading=bounds[index],trailing=bounds[index+1],min=Math.max(leading.min,pairTotal-trailing.max);return{min,max:Math.max(min,Math.min(leading.max,pairTotal-trailing.min))}}updated(changed){super.updated(changed),this.overlayActive&&(this.syncNativeModalGeometry(),this.nativeModal.show()),(changed.has("collapse")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.syncCollapseObserver(),this.orientationBreakpoints.active?this.setAttribute("data-effective-orientation",this._effectiveOrientation):this.removeAttribute("data-effective-orientation");const constraintResolution=this.resolveConstraintBounds(this.getContainerSize()),issue=constraintResolution.issue,issueKey=issue?`${issue.reason}:${issue.panelCount}:${issue.minimumTotal}:${issue.maximumTotal??"unbounded"}`:"";issueKey!==this.constraintIssueKey&&(this.constraintIssueKey=issueKey,issue&&this.emit("lr-multi-split-constraints-invalid",issue));const collapsingIndex=this.collapseActive?this.collapsingIndex:-1;this.syncGutterObserver(collapsingIndex===-1&&this.panelConstraints.some(constraint=>finiteRange(constraint?.minPx??0,0,0)>0)),this.decorateOwnedPanels(constraintResolution),this.syncExternalTriggerA11y(),this.justOpened&&(this.justOpened=!1,this.overlayHandle?.focusInitial())}resolveExternalTrigger(){if(this.trigger)return this.trigger;if(!this.for)return null;const found=this.getRootNode().getElementById?.(this.for);return isHtmlElement(found)?found:null}syncExternalTriggerA11y(){const panel=this.ownedPanels[this.collapsingIndex],trigger=panel&&this.panelCount>1?this.resolveExternalTrigger():null;if(!this.isConnected||!panel||!trigger){this.releaseExternalTriggerA11y();return}this.triggerPanel!==panel&&(this.releaseExternalTriggerA11y(),this.triggerPanel=panel),panel.id||(this.generatedTriggerPanelId=nextId("multi-split-panel"),panel.id=this.generatedTriggerPanelId);const contribution={attributes:{"aria-expanded":this.paneExpanded?"true":"false"},controls:[panel]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution)}releaseExternalTriggerA11y(){this.triggerAria?.release(),this.triggerAria=void 0,this.triggerPanel&&this.generatedTriggerPanelId&&this.triggerPanel.id===this.generatedTriggerPanelId&&this.triggerPanel.removeAttribute("id"),this.triggerPanel=void 0,this.generatedTriggerPanelId=void 0}decorateOwnedPanels(constraintResolution=this.resolveConstraintBounds(this.getContainerSize())){const panels=this.ownedPanels;for(const panel of panels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.adoptPanelOwnership(panel,snapshot)}const collapsingIndex=this.collapseActive?this.collapsingIndex:-1,pixelMinimumTotal=constraintResolution.usePanelConstraints?this.panelConstraints.slice(0,this.panelCount).reduce((total,constraint)=>total+finiteRange(constraint?.minPx??0,0,0),0):0,redistributedShare=new Array(panels.length).fill(0);if(collapsingIndex===-1){let freedPercent=0;const growableIndexes=[];let growableTotal=0;for(let i=0;i<panels.length;i++){const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0;if(this.hasClampConstraint(constraint)){const bounds=constraintResolution.bounds[i],clamped=bounds?Math.min(Math.max(percent,bounds.min),bounds.max):percent;clamped<percent&&(freedPercent+=percent-clamped)}else growableIndexes.push(i),growableTotal+=percent}if(freedPercent>0&&growableTotal>0)for(const i of growableIndexes)redistributedShare[i]=freedPercent*((this.sizes[i]??0)/growableTotal)}panels.forEach((panel,i)=>{const snapshot=this.panelOwnership.get(panel);if(!snapshot)return;const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0,pixelMinimum=finiteRange(constraint?.minPx??0,0,0);if(collapsingIndex===-1&&pixelMinimum>0&&pixelMinimumTotal>0?this.applyOwnedPanelStyleValue(panel,snapshot,"--_lr-multi-split-panel-min",`min(${pixelMinimum}px, max(0px, calc((100% - var(--_lr-multi-split-gutters, 0px)) * ${pixelMinimum/pixelMinimumTotal})))`):this.applyOwnedPanelStyle(panel,snapshot,"--_lr-multi-split-panel-min",snapshot.styles.get("--_lr-multi-split-panel-min")),this.applyOwnedPanelStyle(panel,snapshot,"inline-size",snapshot.styles.get("inline-size")),this.applyOwnedPanelHidden(panel,snapshot,snapshot.hidden),collapsingIndex===i&&this.collapseState==="rail")this.applyOwnedPanelStyleValue(panel,snapshot,"flex",`0 0 ${this.railWidth}`);else if(collapsingIndex===i&&this.collapseState==="floating"&&!this.open)this.applyOwnedPanelStyleValue(panel,snapshot,"flex","none"),this.applyOwnedPanelHidden(panel,snapshot,!0);else if(collapsingIndex===i&&this.collapseState==="floating")this.applyOwnedPanelStyleValue(panel,snapshot,"inline-size",`var(--lr-multi-split-floating-panel-inline-size, ${percent}%)`);else if(collapsingIndex!==-1&&i!==collapsingIndex)this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`${percent} 1 0%`);else{const adjustedPercent=percent+(redistributedShare[i]??0);this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`0 1 ${adjustedPercent}%`)}this.applyOwnedPanelStyleValue(panel,snapshot,"order",String(i*2)),collapsingIndex===i?this.applyOwnedPanelCollapseState(panel,snapshot,this.collapseState):this.applyOwnedPanelCollapseState(panel,snapshot,null)}),collapsingIndex!==-1?this.setAttribute("data-collapse-state",this.collapseState):this.removeAttribute("data-collapse-state")}render(){const dividers=[],bounds=this.resolveConstraintBounds(this.getContainerSize()).bounds;for(let i=0;i<this.panelCount-1;i++){const{min:valueMin,max:valueMax}=this.dividerValueRange(i,bounds),disabled=this.isDividerDisabled(i);dividers.push(html`<div
1
+ import{__decorate}from"tslib";import{resolveIdReferencesIn}from"../../../internal/aria-reflection.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{activateOverlay,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{isRtl}from"../../../internal/rtl.js";import{repairComposedFocus}from"../../../internal/focus-navigation.js";import{DeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{nextId}from"../../../internal/a11y.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{CollapseBreakpointController,OrientationBreakpointController}from"../../../internal/orientation-breakpoint.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{resolveCssLength}from"../../../internal/css-length.js";import{styles}from"./multi-split.styles.js";import{LYRA_DEFAULT_resizeDivider,LYRA_DEFAULT_resizeValuePercent}from"../../../internal/default-strings.generated.js";const KEYBOARD_STEP=2;function isPersistedPanelLayout(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return candidate.version!==1||!Array.isArray(candidate.panels)?!1:candidate.panels.every(panel=>{if(typeof panel!="object"||panel===null)return!1;const record=panel;return typeof record.panelId=="string"&&record.panelId!==""&&record.panelId.trim()===record.panelId&&typeof record.size=="number"&&Number.isFinite(record.size)&&record.size>=0})}const NO_MIN_PX=0,NO_MAX_PX=1e6,OWNED_PANEL_STYLE_PROPERTIES=["flex","order","inline-size","--_lr-multi-split-panel-min"];class LyraMultiSplit extends LyraElement{constructor(){super(...arguments),this.toggleProposalDepth=0,this.toggleProposalMutationVersion=0,this.forcedCloseVersion=0,this.sizes=[],this.defaultSizes=[],this.min=10,this.orientation="horizontal",this.orientationBreakpointBasis="container",this.narrowOrientation="vertical",this.panelConstraints=[],this.collapse="none",this.railWidth="3.5rem",this.railBreakpoint=640,this.floatBreakpoint=400,this.collapseBreakpointBasis="container",this.releasePinOnBreakpoint=!1,this.open=!1,this.trigger=null,this.for="",this.panelCount=0,this.sizesReconciledForMembership=!1,this._collapseState="wide",this._forced=!1,this.overlayActive=!1,this.justOpened=!1,this.nativeModal=new NativeModalCarrier(this,{onCancel:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1)},onUnexpectedClose:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1),this.overlayActive&&this.nativeModal.show()}}),this.syncNativeModalGeometry=()=>{if(!this.nativeModal.requested||!this.isConnected)return;if(!this.nativeModalView){this.nativeModalView=this.ownerDocument.defaultView??void 0,this.nativeModalView?.addEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.addEventListener("resize",this.syncNativeModalGeometry);const Observer=this.nativeModalView?.ResizeObserver;if(Observer){const observer=new Observer(this.syncNativeModalGeometry);this.nativeModalResizeObserver=observer,observer.observe(this)}}const frame=this.shadowRoot?.querySelector("[data-native-modal-carrier]");if(!frame)return;const rect=this.getBoundingClientRect();Object.assign(frame.style,{top:`${rect.top}px`,left:`${rect.left}px`,right:"auto",bottom:"auto",width:`${rect.width}px`,height:`${rect.height}px`,padding:"0"})},this.overlayReturnTarget=null,this.overlayOpener=null,this.deferredFocusReturn=new DeferredFocusReturn,this.floatingDialogPanel=null,this.floatingDialogPreviousRole=null,this.floatingDialogPreviousAriaModal=null,this.drags=new Map,this.ownedPanels=[],this.panelOwnership=new Map,this.panelOwnershipObserverGeneration=0,this.constraintIssueKey="",this.initializedSizes=!1,this.measuredInlineSize=Number.POSITIVE_INFINITY,this._effectiveOrientation="horizontal",this.collapseObserverGeneration=0,this.gutterObservedDividers=[],this.gutterObservedContainerSize=0,this.orientationBreakpoints=new OrientationBreakpointController(this,()=>this.updateEffectiveOrientation(this.measuredInlineSize,!0)),this.collapseBreakpoints=new CollapseBreakpointController(this,()=>this.updateCollapseState(this.measuredInlineSize,!0)),this.onSlotChange=()=>{this.updateBrowserDerivedState(()=>this.syncPanelMembership())},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()},this.onModalLayerClick=event=>{event.target===this.baseEl&&this.overlayHandle?.dismissBackdrop()},this.onPointerDown=(e,index)=>{if(e.button!==0||this.isDividerDisabled(index))return;const divider=e.currentTarget,ownerWindow=divider.ownerDocument.defaultView;ownerWindow&&(this.drags.size>0&&this.dragOwnerWindow!==ownerWindow||(this.drags.set(e.pointerId,{index,startPos:this.effectiveOrientation==="vertical"?e.clientY:e.clientX,base:this.baseEl,appliedDelta:0,acceptedResize:!1}),divider.setPointerCapture(e.pointerId),this.drags.size===1&&(this.dragOwnerWindow=ownerWindow,ownerWindow.addEventListener("pointermove",this.onPointerMove),ownerWindow.addEventListener("pointerup",this.onPointerUp),ownerWindow.addEventListener("pointercancel",this.onPointerUp),ownerWindow.addEventListener("lostpointercapture",this.onPointerUp))))},this.onPointerMove=e=>{const drag=this.drags.get(e.pointerId);if(!drag)return;if(this.isDividerDisabled(drag.index)){this.endDragGestures();return}const total=this.effectiveOrientation==="vertical"?drag.base.clientHeight:drag.base.clientWidth;if(!Number.isFinite(total)||total<=0){this.endDragGestures();return}let cumulativeDelta=((this.effectiveOrientation==="vertical"?e.clientY:e.clientX)-drag.startPos)/total*100;this.effectiveOrientation==="horizontal"&&isRtl(this)&&(cumulativeDelta=-cumulativeDelta);const incremental=cumulativeDelta-drag.appliedDelta,priorValue=this.sizes[drag.index];if(priorValue===void 0)return;const paired=this.clampPair(this.sizes,drag.index,incremental,total),pairedA=paired[drag.index],pairedB=paired[drag.index+1];if(pairedA===void 0||pairedB===void 0)return;const next=[...this.sizes];next[drag.index]=pairedA,next[drag.index+1]=pairedB,this.requestResize(next,!1)&&(drag.appliedDelta+=pairedA-priorValue,drag.acceptedResize=!0)},this.onPointerUp=e=>{const drag=this.drags.get(e.pointerId);drag&&(this.drags.delete(e.pointerId),e.type==="pointerup"&&drag.acceptedResize&&this.persist(),this.drags.size===0&&this.removeDragListeners())},this.onDividerKeyDown=(e,index)=>{if(this.isDividerDisabled(index))return;const rtl=this.effectiveOrientation==="horizontal"&&isRtl(this),forwardKey=this.effectiveOrientation==="vertical"?"ArrowDown":rtl?"ArrowLeft":"ArrowRight",backwardKey=this.effectiveOrientation==="vertical"?"ArrowUp":rtl?"ArrowRight":"ArrowLeft";if(e.key==="Home"||e.key==="End"){const{min,max}=this.dividerValueRange(index),current=this.sizes[index];if(current!==void 0){const target=e.key==="Home"?min:max;this.applyDelta(index,target-current,!0)&&e.preventDefault()}}else e.key===forwardKey?this.applyDelta(index,KEYBOARD_STEP,!0)&&e.preventDefault():e.key===backwardKey&&this.applyDelta(index,-KEYBOARD_STEP,!0)&&e.preventDefault()}}static{this.defaultStrings={...super.defaultStrings,resizeDivider:LYRA_DEFAULT_resizeDivider,resizeValuePercent:LYRA_DEFAULT_resizeValuePercent}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["sizes","defaultSizes","panelConstraints"])}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-resize-request","lr-resize"])}static{this.properties={collapseState:{reflect:!0,attribute:"collapse-state",noAccessor:!0}}}stopNativeModalGeometry(){this.nativeModalView?.removeEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.removeEventListener("resize",this.syncNativeModalGeometry),this.nativeModalView=void 0,this.nativeModalResizeObserver?.disconnect(),this.nativeModalResizeObserver=void 0}nativeModalLabel(){const panel=this.floatingPanelEl;return panel?panel.hasAttribute("aria-label")?panel.getAttribute("aria-label"):resolveIdReferencesIn(panel.getRootNode(),panel.getAttribute("aria-labelledby")).map(element=>element.textContent?.trim()).filter(Boolean).join(" ")||this.getAttribute("aria-label"):this.getAttribute("aria-label")}connectedCallback(){super.connectedCallback();const hostWidth=this.getBoundingClientRect().width;hostWidth>0&&(this.measuredInlineSize=hostWidth),this.seedFirstRenderState(()=>this.syncPanelMembership(!1)),this.hasUpdated&&this.syncPanelMembership(!1),this.initializedSizes&&this.ensureSizes(),this.responsiveObservationEnabled&&this.armCollapseObserver(),this.hasUpdated&&this.overlayActive&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateFloatingOverlay(),queueMicrotask(()=>{this.syncNativeModalGeometry(),this.nativeModal.show(),this.overlayHandle?.focusInitial()})),this.hasUpdated&&this.syncExternalTriggerA11y()}disconnectedCallback(){this.stopNativeModalGeometry(),this.nativeModal.hide(),super.disconnectedCallback(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.overlayHandle?.suspend(),this.deferredFocusReturn.cancel(),this.releaseExternalTriggerA11y(),this.releaseOwnedPanels()}adoptedCallback(){super.adoptedCallback(),this.deferredFocusReturn.cancel(),this.releaseExternalTriggerA11y(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.releaseOwnedPanels()}firstUpdated(changed){super.firstUpdated(changed),this.responsiveObservationEnabled&&this.armCollapseObserver()}willUpdate(changed){if(super.willUpdate(changed),!this.ownerDocument&&this.panelCount===0&&(this.panelCount=Math.max(this.sizes.length,this.defaultSizes.length,this.panelConstraints.length)),!this.initializedSizes)this.initializeSizes(),this.initializedSizes=!0;else if(changed.has("sizes")){const previous=changed.get("sizes");this.sizesReconciledForMembership?this.sizesReconciledForMembership=!1:this.validLiveSizes(this.sizes)||(Array.isArray(previous)&&this.validLiveSizes(previous)?this.sizes=[...previous]:(this.sizes=[],this.ensureSizes()))}else this.sizes.length===0&&this.ensureSizes();if((changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.orientationBreakpoints.configure(this.orientationBreakpoint,this.orientationBreakpointBasis),(changed.has("orientation")||changed.has("narrowOrientation")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.updateEffectiveOrientation(this.measuredInlineSize,this.hasUpdated&&this.orientationBreakpointBasis==="viewport"),changed.has("collapse")||changed.has("railBreakpoint")||changed.has("floatBreakpoint")||changed.has("collapseBreakpointBasis")){const previousEffective=changed.has("collapse")?this.effectiveCollapseStateFor(changed.get("collapse")??"none"):this.collapseState;changed.has("collapse")&&previousEffective!=="wide"&&this.endDragGestures(),this.collapseBreakpoints.configure(this.railBreakpoint,this.floatBreakpoint,this.collapseBreakpointBasis),this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.measuredInlineSize)),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated)}if(changed.has("open")||changed.has("collapseState")||changed.has("collapse")||changed.has("panelCount")){const next=this.collapseState==="floating"&&this.open;next!==this.overlayActive&&(this.overlayActive=next,next?(this.justOpened=!0,this.activateFloatingOverlay()):this.deactivateFloatingOverlay())}}get collapseState(){return this.effectiveCollapseStateFor(this.collapse)}set collapseState(next){if(next==="auto"){this.releaseCollapsePin(),this.updateCollapseState(this.currentMeasuredWidth());return}this._forced=!0,this.pinnedBand=this.collapseBreakpoints.classify(this.pinMeasurementWidth()),this.setRequestedCollapseState(next)}expandPane(){this.applyPaneIntent(!0)}collapsePane(){this.applyPaneIntent(!1)}togglePane(){this.applyPaneIntent(!this.paneExpanded)}get paneExpanded(){const state=this.collapseState;return state==="floating"?this.open:state==="wide"}applyPaneIntent(expanded){if(this.collapsingIndex===-1)return;const band=this.collapseBreakpoints.classify(this.pinMeasurementWidth());if(band==="floating"){this.collapseState!=="floating"&&(this.releaseCollapsePin(),this.setRequestedCollapseState("floating")),this.open=expanded;return}const target=expanded?"wide":"rail";if(this.collapseState!==target){if(target===band){this.releaseCollapsePin(),this.setRequestedCollapseState(target);return}this.collapseState=target}}releaseCollapsePin(){this._forced=!1,this.pinnedBand=void 0}pinMeasurementWidth(){const live=this.currentMeasuredWidth();return live>0?live:this.measuredInlineSize}get effectiveOrientation(){return this._effectiveOrientation}get responsiveObservationEnabled(){return this.collapse!=="none"||this.orientationBreakpoints.containerObservationEnabled}updateEffectiveOrientation(width,shouldEmit){const next=this.orientationBreakpoints.isBelow(width)?this.narrowOrientation:this.orientation;next!==this._effectiveOrientation&&(this.endDragGestures(),this._effectiveOrientation=next,this.requestUpdate(),shouldEmit&&this.emit("lr-multi-split-orientation-change",{orientation:next}),this._forced&&this.releasePinOnBreakpoint&&(this.releaseCollapsePin(),this.updateCollapseState(width,this.hasUpdated)))}currentMeasuredWidth(){return this.baseEl?.clientWidth??0}effectiveCollapseStateFor(collapse){return collapse!=="none"&&this.panelCount>=2?this._collapseState:"wide"}applyEffectiveCollapseTransition(previous,next,shouldEmit=!0){if(previous===next)return;this.endDragGestures(),this.requestUpdate("collapseState",previous);const forceClose=previous==="floating"&&next!=="floating"&&this.open,forcedCloseVersion=this.forcedCloseVersion;shouldEmit&&(this.relocateFocusOutOfCollapsingPanel(next),this.decorateOwnedPanels(),this.emit("lr-multi-split-collapse-change",{state:next})),forceClose&&this.forcedCloseVersion===forcedCloseVersion&&this.collapseState!=="floating"&&this.setOpen(!1,{force:!0})}relocateFocusOutOfCollapsingPanel(next){if(next==="wide"||next==="floating"&&this.open)return;const index=this.collapsingIndex;if(index===-1)return;const panel=this.ownedPanels[index];panel&&repairComposedFocus(panel,()=>this.collapseFocusFallbacks(panel))}collapseFocusFallbacks(collapsing){const dividers=[...this.shadowRoot?.querySelectorAll('[part="divider"]')??[]];return[...new Set([...this.ownedPanels.filter(panel=>panel!==collapsing),...dividers.filter((_,index)=>!this.isDividerDisabled(index)),...dividers])]}setOpen(next,options){if(options?.force){this.open=next,this.forcedCloseVersion+=1,this.emit("lr-toggle",{expanded:next});return}if(this.open===next)return;const collapseState=this.collapseState,open=this.open,mutationVersion=this.toggleProposalMutationVersion;this.toggleProposalDepth+=1;try{if(this.emit("lr-toggle-request",{expanded:next},{cancelable:!0}).defaultPrevented||this.toggleProposalMutationVersion!==mutationVersion||this.collapseState!==collapseState||this.open!==open)return}finally{this.toggleProposalDepth-=1}this.open=next,this.emit("lr-toggle",{expanded:next})}requestUpdate(name,oldValue,options){this.toggleProposalDepth>0&&(name==="open"&&oldValue!==this.open||name==="collapse"&&oldValue!==this.collapse||name==="collapseState"&&oldValue!==this.collapseState)&&(this.toggleProposalMutationVersion+=1),super.requestUpdate(name,oldValue,options)}setRequestedCollapseState(next,shouldEmit=!0){const previousEffective=this.collapseState;if(next===this._collapseState)return;this._collapseState=next;const nextEffective=this.collapseState;this.applyEffectiveCollapseTransition(previousEffective,nextEffective,shouldEmit),previousEffective===nextEffective&&next!==nextEffective&&this.requestUpdate("collapseState",next)}get storageFullKey(){return this.storageKey?`lr-multi-split:${this.storageKey}:panels`:void 0}panelIdsFor(panels){const ids=[],seen=new Set;for(const panel of panels){const panelId=panel.getAttribute("panel-id")??"";if(!panelId||panelId.trim()!==panelId||seen.has(panelId))return null;seen.add(panelId),ids.push(panelId)}return ids}reconcileIdentitySizes(previousIds,previousValues,nextIds){if(previousIds.length!==previousValues.length||nextIds.length===0)return null;const previousSizes=new Map;previousIds.forEach((panelId,index)=>{previousSizes.set(panelId,previousValues[index])});const retainedTotal=nextIds.reduce((total,panelId)=>total+(previousSizes.get(panelId)??0),0),missingCount=nextIds.filter(panelId=>!previousSizes.has(panelId)).length;if(!(retainedTotal>0)){const equal=100/nextIds.length;return nextIds.map(()=>equal)}const newShare=100/nextIds.length,retainedScale=(100-newShare*missingCount)/retainedTotal;return nextIds.map(panelId=>{const previous=previousSizes.get(panelId);return previous===void 0?newShare:previous*retainedScale})}reconcileSizesByPanelId(previousPanels,nextPanels){if(previousPanels.length!==this.sizes.length||nextPanels.length===0)return null;const previousIds=this.panelIdsFor(previousPanels),nextIds=this.panelIdsFor(nextPanels);return!previousIds||!nextIds?null:this.reconcileIdentitySizes(previousIds,this.sizes,nextIds)}validInitialSizes(value){return!Array.isArray(value)||value.length!==this.panelCount||!value.every(size=>Number.isFinite(size)&&size>=this.safeMin)?!1:Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01}validLiveSizes(value){if(!Array.isArray(value)||value.length!==this.panelCount)return!1;const floor=this.normalizedDefaultMin();return value.every(size=>Number.isFinite(size)&&size>=floor)?Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01:!1}resolveDefaultSizes(){if(this.defaultSizes.length===0)return null;if(!this.defaultSizes.some(entry=>typeof entry=="string")){const numbers=this.defaultSizes;return this.validInitialSizes(numbers)?[...numbers]:null}const containerSize=this.currentMeasuredWidth()||this.getBoundingClientRect().width;if(!(containerSize>0))return null;const resolvedPx=[];for(const entry of this.defaultSizes){if(typeof entry=="number"){if(!Number.isFinite(entry))return null;resolvedPx.push(entry/100*containerSize);continue}const px=resolveCssLength(entry,{host:this,percentBase:containerSize,viewportBasis:this.ownerDocument.defaultView??void 0});if(px==null||!(px>=0))return null;resolvedPx.push(px)}const sum=resolvedPx.reduce((total,size)=>total+size,0);if(!(sum>0))return null;const normalized=resolvedPx.map(size=>size/sum*100);return this.validInitialSizes(normalized)?normalized:null}initializeSizes(){if(this.validInitialSizes(this.sizes)||this.loadPersisted())return;const resolved=this.resolveDefaultSizes();if(resolved){this.sizes=resolved;return}this.sizes=[],this.ensureSizes()}loadPersisted(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds)return!1;const parsed=readPersistedState(this.storageFullKey,isPersistedPanelLayout);if(!parsed||parsed.panels.length===0)return!1;const persistedIds=[],persistedSizes=[],seen=new Set;for(const panel of parsed.panels){if(seen.has(panel.panelId))return!1;seen.add(panel.panelId),persistedIds.push(panel.panelId),persistedSizes.push(panel.size)}if(Math.abs(persistedSizes.reduce((sum,size)=>sum+size,0)-100)>=.01)return!1;const normalized=this.reconcileIdentitySizes(persistedIds,persistedSizes,panelIds);return normalized&&this.validInitialSizes(normalized)?(this.sizes=normalized,!0):!1}persist(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds||panelIds.length!==this.sizes.length)return;const layout={version:1,panels:panelIds.map((panelId,index)=>({panelId,size:this.sizes[index]}))};writePersistedState(this.storageFullKey,layout)}ensureSizes(){if(this.panelCount===this.sizes.length)return;if(this.panelCount<=0){this.sizes=[];return}if(this.sizes.length===0){const equal=100/this.panelCount;this.sizes=Array.from({length:this.panelCount},()=>equal);return}const diff=this.panelCount-this.sizes.length;if(diff>0){const newShare=100/this.panelCount,scale=(100-newShare*diff)/100;this.sizes=[...this.sizes.map(s=>s*scale),...Array.from({length:diff},()=>newShare)]}else{const kept=this.sizes.slice(0,this.panelCount),removedTotal=this.sizes.slice(this.panelCount).reduce((sum,s)=>sum+s,0),keptTotal=kept.reduce((sum,s)=>sum+s,0)||1;this.sizes=kept.map(s=>s+s/keptTotal*removedTotal)}}readPanelStyle(panel,property2){return{value:panel.style.getPropertyValue(property2),priority:panel.style.getPropertyPriority(property2)}}samePanelStyle(left,right){return left.value===right.value&&left.priority===right.priority}snapshotPanelOwnership(panel){const styles2=new Map;for(const property2 of OWNED_PANEL_STYLE_PROPERTIES)styles2.set(property2,this.readPanelStyle(panel,property2));return{styles:styles2,appliedStyles:new Map,hidden:panel.hidden,collapseState:panel.getAttribute("data-collapse-state")}}adoptPanelOwnership(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),applied=snapshot.appliedStyles.get(property2);(applied&&!this.samePanelStyle(current,applied)||!applied&&!this.samePanelStyle(current,snapshot.styles.get(property2)))&&snapshot.styles.set(property2,current)}(snapshot.appliedHidden!==void 0&&panel.hidden!==snapshot.appliedHidden||snapshot.appliedHidden===void 0&&panel.hidden!==snapshot.hidden)&&(snapshot.hidden=panel.hidden);const collapseState=panel.getAttribute("data-collapse-state");(snapshot.appliedCollapseState!==void 0&&collapseState!==snapshot.appliedCollapseState||snapshot.appliedCollapseState===void 0&&collapseState!==snapshot.collapseState)&&(snapshot.collapseState=collapseState)}applyOwnedPanelStyle(panel,snapshot,property2,value){value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority),snapshot.appliedStyles.set(property2,this.readPanelStyle(panel,property2))}applyOwnedPanelStyleValue(panel,snapshot,property2,value){this.applyOwnedPanelStyle(panel,snapshot,property2,{value,priority:""})}applyOwnedPanelHidden(panel,snapshot,hidden){panel.hidden=hidden,snapshot.appliedHidden=panel.hidden}applyOwnedPanelCollapseState(panel,snapshot,state){state===null?panel.removeAttribute("data-collapse-state"):panel.setAttribute("data-collapse-state",state),snapshot.appliedCollapseState=panel.getAttribute("data-collapse-state")}restorePanelOwnership(panel,snapshot){this.adoptPanelOwnership(panel,snapshot);for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const value=snapshot.styles.get(property2);value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority)}panel.hidden=snapshot.hidden,snapshot.collapseState===null?panel.removeAttribute("data-collapse-state"):panel.setAttribute("data-collapse-state",snapshot.collapseState)}panelProjectionDiverged(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),expected=snapshot.appliedStyles.get(property2)??snapshot.styles.get(property2);if(!this.samePanelStyle(current,expected))return!0}if(panel.hidden!==(snapshot.appliedHidden??snapshot.hidden))return!0;const expectedCollapseState=snapshot.appliedCollapseState!==void 0?snapshot.appliedCollapseState:snapshot.collapseState;return panel.getAttribute("data-collapse-state")!==expectedCollapseState}resetPanelOwnershipObserver(){this.panelOwnershipObserverGeneration+=1,this.panelOwnershipObserver?.disconnect(),this.panelOwnershipObserver=void 0,this.panelOwnershipObserverDocument=void 0}observeOwnedPanels(){this.resetPanelOwnershipObserver();const ownerDocument=this.ownerDocument,MutationObserverConstructor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverConstructor||!this.isConnected||this.ownedPanels.length===0)return;const generation=this.panelOwnershipObserverGeneration,observer=new MutationObserverConstructor(records=>{if(this.panelOwnershipObserver!==observer||this.panelOwnershipObserverDocument!==this.ownerDocument||this.panelOwnershipObserverGeneration!==generation||!this.isConnected)return;records.some(record=>{const panel=record.target,snapshot=this.panelOwnership.get(panel);return snapshot?this.panelProjectionDiverged(panel,snapshot):!1})&&this.requestUpdate()});this.panelOwnershipObserver=observer,this.panelOwnershipObserverDocument=ownerDocument;for(const panel of this.ownedPanels)observer.observe(panel,{attributes:!0,attributeFilter:["style","hidden","data-collapse-state"]})}samePanelSequence(next){return next.length===this.ownedPanels.length&&next.every((panel,index)=>panel===this.ownedPanels[index])}syncPanelMembership(reconcileSizes=!0){const next=[...this.children].filter(child=>child!==this.nativeModal.helperMount);if(this.samePanelSequence(next))return;const previousPanels=this.ownedPanels,identitySizes=reconcileSizes?this.reconcileSizesByPanelId(previousPanels,next):null,previousEffective=this.collapseState,nextSet=new Set(next);for(const panel of this.ownedPanels){if(nextSet.has(panel))continue;const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot),this.panelOwnership.delete(panel)}for(const panel of next)this.panelOwnership.has(panel)||this.panelOwnership.set(panel,this.snapshotPanelOwnership(panel));const countChanged=next.length!==this.panelCount;this.ownedPanels=next,this.panelCount=next.length,this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.currentMeasuredWidth())),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated),identitySizes?(this.sizesReconciledForMembership=!0,this.sizes=identitySizes):countChanged&&reconcileSizes&&(this.sizesReconciledForMembership=!0,this.ensureSizes()),this.observeOwnedPanels(),this.hasUpdated&&this.requestUpdate()}releaseOwnedPanels(){this.resetPanelOwnershipObserver();for(const panel of this.ownedPanels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot)}this.ownedPanels=[],this.panelOwnership.clear()}getContainerSize(){return this.baseEl?this.effectiveOrientation==="vertical"?this.baseEl.clientHeight:this.baseEl.clientWidth:0}resetGutterObserver(){this.gutterObserverFrame!==void 0&&(this.gutterObserverDocument?.defaultView?.cancelAnimationFrame(this.gutterObserverFrame),this.gutterObserverFrame=void 0),this.gutterResizeObserver?.disconnect(),this.gutterResizeObserver=void 0,this.gutterObserverDocument=void 0,this.gutterObservedDividers=[],this.baseEl?.style.removeProperty("--_lr-multi-split-gutters")}updateGutterBudget(){const view=this.ownerDocument.defaultView,base=this.baseEl;if(!view||!base)return;const vertical=this.effectiveOrientation==="vertical",value=`${this.gutterObservedDividers.reduce((total,divider)=>{const style=view.getComputedStyle(divider),properties=vertical?["height","padding-top","padding-bottom","border-top-width","border-bottom-width"]:["width","padding-left","padding-right","border-left-width","border-right-width"],boxProperties=style.boxSizing==="border-box"?properties.slice(0,1):properties;return total+boxProperties.reduce((size,property2)=>size+finiteRange(parseFloat(style.getPropertyValue(property2)),0,0),0)},0)}px`;base.style.getPropertyValue("--_lr-multi-split-gutters")!==value&&base.style.setProperty("--_lr-multi-split-gutters",value)}syncGutterObserver(enabled){const base=this.baseEl;if(!enabled||!this.isConnected||!base){this.resetGutterObserver();return}const ownerDocument=this.ownerDocument,dividers=[...base.querySelectorAll('[part="divider"]')];if(this.gutterResizeObserver&&this.gutterObserverDocument===ownerDocument&&dividers.length===this.gutterObservedDividers.length&&dividers.every((divider,index)=>divider===this.gutterObservedDividers[index])){this.updateGutterBudget();return}this.resetGutterObserver(),this.gutterObservedDividers=dividers,this.gutterObserverDocument=ownerDocument,this.gutterObservedContainerSize=this.getContainerSize(),this.updateGutterBudget();const ownerWindow=ownerDocument.defaultView,ResizeObserverConstructor=ownerWindow?.ResizeObserver;if(!ownerWindow||!ResizeObserverConstructor)return;const observer=new ResizeObserverConstructor(()=>{if(this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument)return;this.updateGutterBudget();const size=this.getContainerSize();size!==this.gutterObservedContainerSize&&(this.gutterObservedContainerSize=size,this.requestUpdate())});this.gutterResizeObserver=observer;const frame=ownerWindow.requestAnimationFrame(()=>{if(!(this.gutterObserverFrame!==frame||this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==base)){this.gutterObserverFrame=void 0,observer.observe(base,{box:"border-box"});for(const divider of dividers)observer.observe(divider,{box:"border-box"})}});this.gutterObserverFrame=frame}get collapsingIndex(){return this.collapse==="none"||this.panelCount<2?-1:this.collapse==="start"?0:this.panelCount-1}get collapseActive(){return this.collapsingIndex!==-1&&this.collapseState!=="wide"}isDividerDisabled(index){if(!this.collapseActive)return!1;const adjacent=this.collapsingIndex===0?0:this.panelCount-2;return index===adjacent}updateCollapseState(width,shouldEmit=!0){if(this.collapse==="none")return;const classified=this.collapseBreakpoints.classify(width);if(this._forced){if(!this.releasePinOnBreakpoint||classified===this.pinnedBand)return;this.releaseCollapsePin()}this.setRequestedCollapseState(classified,shouldEmit)}armCollapseObserver(){const observedElement=this.baseEl;if(!this.isConnected||!observedElement)return;const ownerDocument=this.ownerDocument;if(this.collapseResizeObserver&&this.collapseObservedElement===observedElement&&this.collapseObserverOwnerDocument===ownerDocument)return;this.resetCollapseObserver();const ResizeObserverConstructor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverConstructor)return;const generation=this.collapseObserverGeneration,observer=new ResizeObserverConstructor(entries=>{if(this.collapseResizeObserver!==observer||this.collapseObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==observedElement)return;const box=entries[0]?.contentBoxSize?.[0],width=box?box.inlineSize:observedElement.getBoundingClientRect().width;this.measuredInlineSize=width,this.updateCollapseState(width),this.updateEffectiveOrientation(width,!0)});this.collapseResizeObserver=observer,this.collapseObservedElement=observedElement,this.collapseObserverOwnerDocument=ownerDocument,observer.observe(observedElement)}resetCollapseObserver(){this.collapseObserverGeneration+=1,this.collapseResizeObserver?.disconnect(),this.collapseResizeObserver=void 0,this.collapseObservedElement=void 0,this.collapseObserverOwnerDocument=void 0}syncCollapseObserver(){if(!this.responsiveObservationEnabled){this.resetCollapseObserver();return}this.armCollapseObserver()}get safeMin(){return finiteRange(this.min,10,0)}normalizedDefaultMin(){if(this.panelCount<=0)return 0;const requested=this.safeMin,available=Math.max(0,100-KEYBOARD_STEP);return Math.min(requested,available/this.panelCount)}resolveConstraintBounds(containerSize){const fallbackMin=this.normalizedDefaultMin(),fallback=Array.from({length:this.panelCount},()=>({min:fallbackMin,max:1/0}));if(this.panelCount<=0)return{bounds:[],usePanelConstraints:!0};const bounds=[];let minimumTotal=0,maximumTotal=0,hasUnboundedMaximum=!1,issueReason;for(let index=0;index<this.panelCount;index++){const constraint=this.panelConstraints[index];let min=this.safeMin,max=1/0,minSet=!1,maxSet=!1;constraint&&(constraint.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&containerSize>0&&(min=constraint.minPx/containerSize*100,minSet=!0),constraint.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&(min=minSet?Math.max(min,constraint.minPercent):constraint.minPercent,minSet=!0),constraint.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&containerSize>0&&(max=constraint.maxPx/containerSize*100,maxSet=!0),constraint.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&(max=maxSet?Math.min(max,constraint.maxPercent):constraint.maxPercent,maxSet=!0),(constraint.minPx!=null&&(!Number.isFinite(constraint.minPx)||constraint.minPx<0)||constraint.maxPx!=null&&(!Number.isFinite(constraint.maxPx)||constraint.maxPx<0)||constraint.minPercent!=null&&(!Number.isFinite(constraint.minPercent)||constraint.minPercent<0)||constraint.maxPercent!=null&&(!Number.isFinite(constraint.maxPercent)||constraint.maxPercent<0))&&(issueReason??="minimum-exceeds-maximum")),min>max&&(issueReason??="minimum-exceeds-maximum"),bounds.push({min,max}),minimumTotal+=min,Number.isFinite(max)?maximumTotal+=max:hasUnboundedMaximum=!0}return issueReason==null&&minimumTotal>100+1e-9&&(issueReason="minimum-total"),issueReason==null&&!hasUnboundedMaximum&&maximumTotal<100-1e-9&&(issueReason="maximum-total"),issueReason==null?{bounds,usePanelConstraints:!0}:{bounds:fallback,usePanelConstraints:!1,issue:{reason:issueReason,panelCount:this.panelCount,minimumTotal,maximumTotal:hasUnboundedMaximum?null:maximumTotal,containerSize}}}percentBounds(index,containerSize){return this.resolveConstraintBounds(containerSize).bounds[index]??{min:0,max:1/0}}hasClampConstraint(constraint){return!!constraint&&(constraint.minPx!=null||constraint.maxPx!=null||constraint.minPercent!=null||constraint.maxPercent!=null)}minSideExpr(constraint){const terms=[];return constraint?.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&terms.push(`${constraint.minPx}px`),constraint?.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&terms.push(`${constraint.minPercent}%`),terms.length===0?`${NO_MIN_PX}px`:terms.length===1?terms[0]:`max(${this.safeMin}%, ${terms.join(", ")})`}maxSideExpr(constraint){const terms=[];return constraint?.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&terms.push(`${constraint.maxPx}px`),constraint?.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&terms.push(`${constraint.maxPercent}%`),terms.length===0?`${NO_MAX_PX}px`:terms.length===1?terms[0]:`min(${terms.join(", ")})`}clampPair(sizes,i,delta,containerSize=0){const next=[...sizes],currentA=next[i],currentB=next[i+1];if(currentA===void 0||currentB===void 0)return next;const pairTotal=currentA+currentB,a=this.percentBounds(i,containerSize),b=this.percentBounds(i+1,containerSize),loRaw=Math.max(a.min,pairTotal-b.max),hiRaw=Math.min(a.max,pairTotal-b.min),lo=Math.min(loRaw,pairTotal),hi=Math.max(hiRaw,lo),clampedA=Math.min(Math.max(currentA+delta,lo),hi);return next[i]=clampedA,next[i+1]=pairTotal-clampedA,next}requestResize(next,commit){return next.length===this.sizes.length&&next.every((size,index)=>Math.abs(size-this.sizes[index])<=1e-9)||this.emit("lr-resize-request",{sizes:[...next]},{cancelable:!0}).defaultPrevented?!1:(this.sizes=next,this.emit("lr-resize",{sizes:[...this.sizes]}),commit&&this.persist(),!0)}applyDelta(index,delta,commit){const next=this.clampPair(this.sizes,index,delta,this.getContainerSize());return next.length!==this.sizes.length||next.some((size,currentIndex)=>Math.abs(size-this.sizes[currentIndex])>1e-9)?(this.requestResize(next,commit),!0):!1}get floatingPanelEl(){const index=this.collapsingIndex;return index===-1?null:this.ownedPanels[index]??null}activateFloatingOverlay(){this.nativeModal.prepare(),this.deferredFocusReturn.cancel();const opener=deepActiveElement(this.ownerDocument);this.overlayOpener=isHtmlElement(opener)?opener:null;const trigger=this.resolveExternalTrigger();this.overlayReturnTarget=trigger??this.overlayOpener;const panel=this.floatingPanelEl;panel&&(this.floatingDialogPanel=panel,this.floatingDialogPreviousRole=panel.getAttribute("role"),this.floatingDialogPreviousAriaModal=panel.getAttribute("aria-modal"),this.nativeModal.requested||(panel.setAttribute("role","dialog"),panel.setAttribute("aria-modal","true"))),this.overlayHandle=activateOverlay({host:this,panel:()=>this.floatingPanelEl,modalRoot:()=>this.floatingPanelEl,auxiliaryRoots:()=>{const root=this.nativeModal.helperMount;return root?[root]:[]},restoreFocusTo:trigger??void 0,onEscape:()=>this.setOpen(!1),onBackdrop:()=>this.setOpen(!1),lockScroll:!0,suspendWhenUnrendered:!0})}deactivateFloatingOverlay(){this.stopNativeModalGeometry(),this.nativeModal.hide(),this.nativeModal.prepare(!1);const trigger=this.resolveExternalTrigger(),panel=this.floatingDialogPanel;this.floatingDialogPanel=null,trigger&&this.overlayHandle?.updateRestoreFocusTo(trigger),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,(trigger||this.trigger||this.for)&&this.deferredFocusReturn.schedule({host:this,candidates:()=>[this.resolveExternalTrigger(),this.overlayReturnTarget,this.overlayOpener],stranded:active=>panel!==null&&composedContains(panel,active),isCurrent:()=>!this.overlayActive}),panel&&(this.floatingDialogPreviousRole===null?panel.removeAttribute("role"):panel.setAttribute("role",this.floatingDialogPreviousRole),this.floatingDialogPreviousAriaModal===null?panel.removeAttribute("aria-modal"):panel.setAttribute("aria-modal",this.floatingDialogPreviousAriaModal))}removeDragListeners(){const ownerWindow=this.dragOwnerWindow;this.dragOwnerWindow=void 0,ownerWindow?.removeEventListener("pointermove",this.onPointerMove),ownerWindow?.removeEventListener("pointerup",this.onPointerUp),ownerWindow?.removeEventListener("pointercancel",this.onPointerUp),ownerWindow?.removeEventListener("lostpointercapture",this.onPointerUp)}endDragGestures(){this.drags.clear(),this.removeDragListeners()}dividerValueRange(index,bounds=this.resolveConstraintBounds(this.getContainerSize()).bounds){const pairTotal=(this.sizes[index]??0)+(this.sizes[index+1]??0),leading=bounds[index],trailing=bounds[index+1],min=Math.max(leading.min,pairTotal-trailing.max);return{min,max:Math.max(min,Math.min(leading.max,pairTotal-trailing.min))}}updated(changed){super.updated(changed),this.overlayActive&&(this.syncNativeModalGeometry(),this.nativeModal.show()),(changed.has("collapse")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.syncCollapseObserver(),this.orientationBreakpoints.active?this.setAttribute("data-effective-orientation",this._effectiveOrientation):this.removeAttribute("data-effective-orientation");const constraintResolution=this.resolveConstraintBounds(this.getContainerSize()),issue=constraintResolution.issue,issueKey=issue?`${issue.reason}:${issue.panelCount}:${issue.minimumTotal}:${issue.maximumTotal??"unbounded"}`:"";issueKey!==this.constraintIssueKey&&(this.constraintIssueKey=issueKey,issue&&this.emit("lr-multi-split-constraints-invalid",issue));const collapsingIndex=this.collapseActive?this.collapsingIndex:-1;this.syncGutterObserver(collapsingIndex===-1&&this.panelConstraints.some(constraint=>finiteRange(constraint?.minPx??0,0,0)>0)),this.decorateOwnedPanels(constraintResolution),this.syncExternalTriggerA11y(),this.justOpened&&(this.justOpened=!1,this.overlayHandle?.focusInitial())}resolveExternalTrigger(){if(this.trigger)return this.trigger;if(!this.for)return null;const found=this.getRootNode().getElementById?.(this.for);return isHtmlElement(found)?found:null}syncExternalTriggerA11y(){const panel=this.ownedPanels[this.collapsingIndex],trigger=panel&&this.panelCount>1?this.resolveExternalTrigger():null;if(!this.isConnected||!panel||!trigger){this.releaseExternalTriggerA11y();return}this.triggerPanel!==panel&&(this.releaseExternalTriggerA11y(),this.triggerPanel=panel),panel.id||(this.generatedTriggerPanelId=nextId("multi-split-panel"),panel.id=this.generatedTriggerPanelId);const contribution={attributes:{"aria-expanded":this.paneExpanded?"true":"false"},controls:[panel]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution)}releaseExternalTriggerA11y(){this.triggerAria?.release(),this.triggerAria=void 0,this.triggerPanel&&this.generatedTriggerPanelId&&this.triggerPanel.id===this.generatedTriggerPanelId&&this.triggerPanel.removeAttribute("id"),this.triggerPanel=void 0,this.generatedTriggerPanelId=void 0}decorateOwnedPanels(constraintResolution=this.resolveConstraintBounds(this.getContainerSize())){const panels=this.ownedPanels;for(const panel of panels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.adoptPanelOwnership(panel,snapshot)}const collapsingIndex=this.collapseActive?this.collapsingIndex:-1,pixelMinimumTotal=constraintResolution.usePanelConstraints?this.panelConstraints.slice(0,this.panelCount).reduce((total,constraint)=>total+finiteRange(constraint?.minPx??0,0,0),0):0,redistributedShare=new Array(panels.length).fill(0);if(collapsingIndex===-1){let freedPercent=0;const growableIndexes=[];let growableTotal=0;for(let i=0;i<panels.length;i++){const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0;if(this.hasClampConstraint(constraint)){const bounds=constraintResolution.bounds[i],clamped=bounds?Math.min(Math.max(percent,bounds.min),bounds.max):percent;clamped<percent&&(freedPercent+=percent-clamped)}else growableIndexes.push(i),growableTotal+=percent}if(freedPercent>0&&growableTotal>0)for(const i of growableIndexes)redistributedShare[i]=freedPercent*((this.sizes[i]??0)/growableTotal)}panels.forEach((panel,i)=>{const snapshot=this.panelOwnership.get(panel);if(!snapshot)return;const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0,pixelMinimum=finiteRange(constraint?.minPx??0,0,0);if(collapsingIndex===-1&&pixelMinimum>0&&pixelMinimumTotal>0?this.applyOwnedPanelStyleValue(panel,snapshot,"--_lr-multi-split-panel-min",`min(${pixelMinimum}px, max(0px, calc((100% - var(--_lr-multi-split-gutters, 0px)) * ${pixelMinimum/pixelMinimumTotal})))`):this.applyOwnedPanelStyle(panel,snapshot,"--_lr-multi-split-panel-min",snapshot.styles.get("--_lr-multi-split-panel-min")),this.applyOwnedPanelStyle(panel,snapshot,"inline-size",snapshot.styles.get("inline-size")),this.applyOwnedPanelHidden(panel,snapshot,snapshot.hidden),collapsingIndex===i&&this.collapseState==="rail")this.applyOwnedPanelStyleValue(panel,snapshot,"flex",`0 0 ${this.railWidth}`);else if(collapsingIndex===i&&this.collapseState==="floating"&&!this.open)this.applyOwnedPanelStyleValue(panel,snapshot,"flex","none"),this.applyOwnedPanelHidden(panel,snapshot,!0);else if(collapsingIndex===i&&this.collapseState==="floating")this.applyOwnedPanelStyleValue(panel,snapshot,"inline-size",`var(--lr-multi-split-floating-panel-inline-size, ${percent}%)`);else if(collapsingIndex!==-1&&i!==collapsingIndex)this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`${percent} 1 0%`);else{const adjustedPercent=percent+(redistributedShare[i]??0);this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`0 1 ${adjustedPercent}%`)}this.applyOwnedPanelStyleValue(panel,snapshot,"order",String(i*2)),collapsingIndex===i?this.applyOwnedPanelCollapseState(panel,snapshot,this.collapseState):this.applyOwnedPanelCollapseState(panel,snapshot,null)}),collapsingIndex!==-1?this.setAttribute("data-collapse-state",this.collapseState):this.removeAttribute("data-collapse-state")}render(){const dividers=[],bounds=this.resolveConstraintBounds(this.getContainerSize()).bounds;for(let i=0;i<this.panelCount-1;i++){const{min:valueMin,max:valueMax}=this.dividerValueRange(i,bounds),disabled=this.isDividerDisabled(i);dividers.push(html`<div
2
2
  part="divider"
3
3
  role="separator"
4
4
  aria-label=${this.dividerLabel?this.dividerLabel(i,this.panelCount):this.localize("resizeDivider",void 0,{a:getNumberFormat(this.effectiveLocale).format(i+1),b:getNumberFormat(this.effectiveLocale).format(i+2)})}
@@ -1,8 +1,6 @@
1
1
  import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraDetailsToggleSource}from'../details/details.class.js';
2
2
  /** Payload emitted with `lr-toggle` after an accepted disclosure change renders. */
3
3
  export interface LyraNavigationMenuToggleDetail{
4
- /** @deprecated Use `expanded`, which carries the same value; removal not before 23.0.0. */
5
- open:boolean;
6
4
  /** Whether the item's panel is now open. */
7
5
  expanded:boolean;source:LyraDetailsToggleSource;}export interface LyraNavigationMenuItemEventMap{'lr-toggle':CustomEvent<LyraNavigationMenuToggleDetail>;}
8
6
  /**
@@ -33,8 +31,8 @@ expanded:boolean;source:LyraDetailsToggleSource;}export interface LyraNavigation
33
31
  * link item.
34
32
  * @slot expand-icon - Replaces the caret glyph. The wrapper is inert and `aria-hidden`.
35
33
  * @event lr-toggle - An accepted open-state change rendered. Not cancelable.
36
- * `detail: { expanded: boolean, open: boolean, source: 'user' | 'programmatic' | 'peer' }`;
37
- * `expanded` is the new state (the deprecated `open` key carries the same value) and `peer`
34
+ * `detail: { expanded: boolean, source: 'user' | 'programmatic' | 'peer' }`;
35
+ * `expanded` is the new state and `peer`
38
36
  * means a sibling opened. Never emitted for initial markup. Panel content such as `lr-details`
39
37
  * also bubbles `lr-toggle`, so a delegated listener filters on `event.target.localName`.
40
38
  * @csspart base - The native link or button. Also carries `base-current` while `current` is set
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.js";import{deferredPlaceReady,loadAnchoredOverlayRuntime,syncTopLayerRelease,topLayerPlacement,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{chevronIcon}from"../../../internal/icons.js";import{resolveGuardedRel}from"../../../internal/link-rel.js";import{LyraElement}from"../../../internal/lyra-element.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{navigationMenuOwner,registerNavigationMenuItemController}from"../navigation-menu/navigation-menu-owner.js";import{styles}from"./navigation-menu-item.styles.js";const PLACEMENT_STYLE_PROPERTIES=["position","margin","left","top","--lr-positioner-available-inline-size","--lr-positioner-available-block-size"],SHOW_OFFSET="translateY(var(--lr-size-neg-0-25rem))";function parseTimeList(value){return value.split(",").map(entry=>{const match=/^\s*(-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(ms|s)\s*$/i.exec(entry);if(!match)return 0;const amount=Number(match[1]);return Number.isFinite(amount)?match[2]?.toLowerCase()==="s"?amount*1e3:amount:0})}class LyraNavigationMenuItem extends LyraElement{static{this.styles=[LyraElement.styles,styles]}get open(){return this._open}set open(next){const value=!!next;if(value===this._open)return;const source=this.hasUpdated?"programmatic":null;value?this.openPanel("programmatic",source):this.closePanel(source)}constructor(){super(),this.href="",this.target="",this.rel="",this.current=!1,this._open=!1,this.browserResolved=!1,this.closing=!1,this.slotPresence=new SlotPresenceController(this),this.panelId=nextId("navigation-menu-panel"),this.liveOpen=!1,this.placementKey="",this.pendingShow=!1,this.hideAnimationStarted=!1,this.transitionToken=0,this.focusInPanel=!1,this.onFocusIn=event=>{const panel=this.panelElement,target=event.composedPath()[0];this.focusInPanel=panel!==null&&target!==void 0&&composedContains(panel,target)},this.onFocusOut=event=>{const next=event.relatedTarget;if(next===null)return;const panel=this.panelElement;(!panel||!composedContains(panel,next))&&(this.focusInPanel=!1)},this.onBaseClick=()=>{if(this.isLink)return;const context=this.ownerContext;if(context){context.activate(this);return}this.isTrigger&&(this._open?this.closePanel("user"):this.openPanel("programmatic","user"))},this.onHostKeyDown=event=>{event.key!=="Escape"||event.defaultPrevented||!this._open||this.ownerContext||(event.preventDefault(),this.onOverlayEscape())},registerNavigationMenuItemController(this,{isTrigger:()=>this.isTrigger,isLink:()=>this.isLink,isOpen:()=>this._open,mode:()=>this._open?this.interactionMode:void 0,pin:()=>{this._open&&(this.interactionMode="pinned")},base:()=>this.baseElement,panel:()=>this.panelElement,open:(mode,source)=>this.openPanel(mode,source),close:(source,options)=>this.closePanel(source,options),isTopmost:()=>this.overlayHandle?.isTopmost()??!1,placementReady:()=>this.placementReady(),reposition:()=>{this.placementKey="",this.requestUpdate()}})}get ownerContext(){return navigationMenuOwner(this)}get isLink(){return!!safeLinkHref(this.href)}get isTrigger(){return!this.isLink&&this.slotPresence.has("panel")}get floatingLayout(){return this.ownerContext?.layout()==="bar"}get baseElement(){return this.renderRoot?.querySelector('[part~="base"]')??null}get panelElement(){return this.renderRoot?.querySelector('[part~="panel"]')??null}get canDisclose(){return this.isLink?!1:!this.browserResolved||this.slotPresence.has("panel")}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.addEventListener("keydown",this.onHostKeyDown),this.updateBrowserDerivedState(()=>{this.browserResolved=!0}),this.hasUpdated&&this._open&&(this.interactionMode="programmatic",this.requestUpdate())}disconnectedCallback(){this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut),this.removeEventListener("keydown",this.onHostKeyDown),this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(!1),this.cancelHideAnimation(),this.closing=!1,this.focusInPanel=!1,this.semanticFocusOrigin=void 0,this._open&&this.interactionMode==="hover"?(this._open=!1,this.liveOpen=!1,this.interactionMode=void 0,this.requestUpdate("open",!0)):this._open&&(this.interactionMode="programmatic"),super.disconnectedCallback()}focus(options){const base=this.baseElement;base?base.focus(options):super.focus(options)}click(){this.baseElement?.click()}willUpdate(changed){if(super.willUpdate(changed),this._open&&!this.canDisclose&&(this.liveOpen?this.closePanel("programmatic",{repairFocus:!0,instant:!0}):(this._open=!1,this.interactionMode=void 0,this.pendingShow=!1,this.pendingMorph=void 0,this.requestUpdate("open",!0))),changed.has("href")){const previous=this.baseElement,nextKind=this.isLink?"a":"button";this.semanticFocusOrigin=previous&&previous.localName!==nextKind&&activeElementIn(this.shadowRoot)===previous?previous:void 0}}updated(changed){super.updated(changed),this.isConnected&&this.hasAttribute("open")!==this._open&&this.toggleAttribute("open",this._open),this.syncFloating(),this.syncHideAnimation();const focusOrigin=this.semanticFocusOrigin;if(this.semanticFocusOrigin=void 0,focusOrigin){const internalActive=activeElementIn(this.shadowRoot),documentActive=activeElementIn(this.ownerDocument);(internalActive===null||internalActive===focusOrigin)&&(documentActive===null||documentActive===this||documentActive===this.ownerDocument.body)&&this.baseElement?.focus()}}openPanel(mode,source){if(this._open)return mode==="pinned"&&this.interactionMode==="hover"&&(this.interactionMode="pinned"),!0;if(!this.canDisclose)return this.requestUpdate("open",!0),!1;const context=this.ownerContext,morph=context?.willOpen(this);return this.cancelHideAnimation(),this.closing=!1,this.interactionMode=mode,this.pendingMorph=morph,this.pendingShow=source!==null&&!morph,this._open=!0,this.requestUpdate("open",!1),this.queueToggle(!0,source),context?.changed(this,!0,source),!0}closePanel(source,options={}){if(!this._open)return;options.repairFocus!==!1&&this.panelHoldsFocus()&&(options.focusTarget??this.baseElement)?.focus({preventScroll:!0});const wasFloating=this.placement!==void 0||this.overlayHandle!==void 0;this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(options.restoreFocus===!0);const animate=!options.instant&&wasFloating&&this.liveOpen&&this.isConnected&&this.floatingLayout;this.cancelHideAnimation(),this.closing=animate,this.pendingMorph=void 0,this.pendingShow=!1,this.interactionMode=void 0,this.liveOpen=!1,this.focusInPanel=!1,this._open=!1,this.requestUpdate("open",!0),this.queueToggle(!1,source),this.ownerContext?.changed(this,!1,source)}queueToggle(open,source){source!==null&&this.updateComplete.then(()=>{this.emit("lr-toggle",{open,expanded:open,source})})}panelHoldsFocus(){const panel=this.panelElement;if(!panel)return!1;const active=deepActiveElement(this.ownerDocument);return active&&composedContains(panel,active)?!0:this.focusInPanel&&(active===null||active===this.ownerDocument.body)}syncFloating(){const panel=this.panelElement,visible=this.isTrigger&&this.browserResolved&&this._open;if(visible&&(this.liveOpen=!0),!(visible&&this.isConnected&&this.floatingLayout)){this.stopPlacement(),this.overlayHandle&&this.releaseOverlay(!1),panel&&!this.closing&&(this.clearPlacementStyles(panel),visible&&panel.hasAttribute("data-lr-top-layer")&&loadAnchoredOverlayRuntime().then(runtime=>runtime.releaseTopLayer?.(panel),()=>{})),visible&&(this.pendingShow=!1,this.pendingMorph=void 0);return}if(!panel)return;const context=this.ownerContext,anchor=context.anchor(this);if(!anchor)return;const key=[anchor===this.baseElement?"item":"menu",context.distance(),context.topLayer(),this.effectiveDirection].join("|");(!this.placement||key!==this.placementKey)&&this.startPlacement(anchor,panel,key),this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.panelElement,onEscape:()=>this.onOverlayEscape(),restoreFocusTo:()=>this.baseElement}));const morph=this.pendingMorph,show=this.pendingShow;if(this.pendingMorph=void 0,this.pendingShow=!1,!morph&&!show)return;const handle=this.placement;handle?.ready.then(placed=>{!placed||handle!==this.placement||!this._open||(morph?this.runMorph(morph):this.runShowAnimation())})}startPlacement(anchor,panel,key){this.stopPlacement();const context=this.ownerContext,bridge=this.renderRoot.querySelector(".hover-bridge");this.placementKey=key;const topLayer=context.topLayer();this.placedTopLayer=syncTopLayerRelease(panel,this.placedTopLayer,topLayer),this.placement=deferredPlaceReady(anchor,panel,{placement:rtlAwarePlacement("bottom-start",this),...topLayerPlacement(topLayer,resolveEffectivePositioningStrategy(this,void 0,"fixed")),offset:context.distance(),hoverBridge:bridge??void 0})}stopPlacement(){const handle=this.placement;this.placement=void 0,this.placementKey="",handle?.()}releaseOverlay(restoreFocus){const handle=this.overlayHandle;this.overlayHandle=void 0,handle?.deactivate({restoreFocus})}clearPlacementStyles(panel){for(const property2 of PLACEMENT_STYLE_PROPERTIES)panel.style.removeProperty(property2)}onOverlayEscape(){const context=this.ownerContext;if(context){context.escape(this);return}const within=composedContains(this,deepActiveElement(this.ownerDocument));this.closePanel("user",{restoreFocus:within})}async placementReady(){return await this.updateComplete,this.placement?waitForDeferredPlacement(()=>this.placement):this._open}get registryHost(){return this.ownerContext?.owner??this}runShowAnimation(){const panel=this.panelElement;panel&&animateRegistered(this.registryHost,panel,"navigation-menu.show",this.effectiveDirection,{keyframes:[{opacity:0,transform:SHOW_OFFSET},{opacity:1,transform:"translateY(0)"}],durationProperties:["--lr-navigation-menu-show-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]})}syncHideAnimation(){if(!this.closing||this.hideAnimationStarted)return;this.hideAnimationStarted=!0;const token=this.transitionToken,panel=this.panelElement,animation=panel?animateRegistered(this.registryHost,panel,"navigation-menu.hide",this.effectiveDirection,{keyframes:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:SHOW_OFFSET}],durationProperties:["--lr-navigation-menu-hide-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}):void 0;this.hideAnimation=animation;const settle=()=>{token===this.transitionToken&&(this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1,this.closing=!1)};animation?animation.finished.then(settle,settle):queueMicrotask(settle)}cancelHideAnimation(){this.transitionToken++,this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1}runMorph(morph){const panel=this.panelElement,content=panel?.querySelector(".panel-content");if(!panel||!content)return;const travel="var(--lr-size-1rem)",reversed=`calc(-1 * ${travel})`,from=morph.direction==="end"?travel:reversed,mirrored=morph.direction==="end"?reversed:travel;animateRegistered(this.registryHost,content,`navigation-menu.enter-from-${morph.direction}`,this.effectiveDirection,{keyframes:[{opacity:0,transform:`translateX(${from})`},{opacity:1,transform:"translateX(0)"}],rtlKeyframes:[{opacity:0,transform:`translateX(${mirrored})`},{opacity:1,transform:"translateX(0)"}],durationProperties:["--lr-navigation-menu-switch-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]});const view=this.ownerDocument.defaultView;if(!view||prefersReducedMotion(this))return;const to=panel.getBoundingClientRect();if(Math.abs(to.width-morph.from.width)<1&&Math.abs(to.height-morph.from.height)<1)return;this.cancelMorph();const natural=content.getBoundingClientRect().width;panel.setAttribute("data-morphing",""),panel.style.inlineSize=`${morph.from.width}px`,panel.style.blockSize=`${morph.from.height}px`,content.style.inlineSize=`${natural}px`;const style=view.getComputedStyle(panel),durations=parseTimeList(style.transitionDuration),delays=parseTimeList(style.transitionDelay),total=Math.max(0,...durations.map((duration,index)=>duration+(delays[index%Math.max(1,delays.length)]??0)));let frame,timer;const onEnd=event=>{event.target===panel&&["inline-size","block-size","width","height"].includes(event.propertyName)&&cleanup()},cleanup=()=>{this.morphCleanup===cleanup&&(this.morphCleanup=void 0,frame!==void 0&&view.cancelAnimationFrame(frame),timer!==void 0&&view.clearTimeout(timer),panel.removeEventListener("transitionend",onEnd),panel.removeAttribute("data-morphing"),panel.style.removeProperty("inline-size"),panel.style.removeProperty("block-size"),content.style.removeProperty("inline-size"))};this.morphCleanup=cleanup,panel.addEventListener("transitionend",onEnd),frame=view.requestAnimationFrame(()=>{frame=void 0,this.morphCleanup===cleanup&&(panel.style.inlineSize=`${to.width}px`,panel.style.blockSize=`${to.height}px`,timer=view.setTimeout(cleanup,total+50))})}cancelMorph(){this.morphCleanup?.()}render(){const isLink=this.isLink,isTrigger=this.isTrigger,floating=this.floatingLayout,stacked=this.ownerContext?.layout()==="stacked",expanded=this._open&&this.browserResolved,panelVisible=isTrigger&&this.browserResolved&&(this._open||this.closing),ariaLabel=hostAriaLabel(this),parts=["base"];this.current&&parts.push("base-current"),isTrigger&&expanded&&parts.push("base-open");const label=html`<span part="start" ?hidden=${!this.slotPresence.has("start")}
1
+ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.js";import{deferredPlaceReady,loadAnchoredOverlayRuntime,syncTopLayerRelease,topLayerPlacement,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{chevronIcon}from"../../../internal/icons.js";import{resolveGuardedRel}from"../../../internal/link-rel.js";import{LyraElement}from"../../../internal/lyra-element.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{navigationMenuOwner,registerNavigationMenuItemController}from"../navigation-menu/navigation-menu-owner.js";import{styles}from"./navigation-menu-item.styles.js";const PLACEMENT_STYLE_PROPERTIES=["position","margin","left","top","--lr-positioner-available-inline-size","--lr-positioner-available-block-size"],SHOW_OFFSET="translateY(var(--lr-size-neg-0-25rem))";function parseTimeList(value){return value.split(",").map(entry=>{const match=/^\s*(-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(ms|s)\s*$/i.exec(entry);if(!match)return 0;const amount=Number(match[1]);return Number.isFinite(amount)?match[2]?.toLowerCase()==="s"?amount*1e3:amount:0})}class LyraNavigationMenuItem extends LyraElement{static{this.styles=[LyraElement.styles,styles]}get open(){return this._open}set open(next){const value=!!next;if(value===this._open)return;const source=this.hasUpdated?"programmatic":null;value?this.openPanel("programmatic",source):this.closePanel(source)}constructor(){super(),this.href="",this.target="",this.rel="",this.current=!1,this._open=!1,this.browserResolved=!1,this.closing=!1,this.slotPresence=new SlotPresenceController(this),this.panelId=nextId("navigation-menu-panel"),this.liveOpen=!1,this.placementKey="",this.pendingShow=!1,this.hideAnimationStarted=!1,this.transitionToken=0,this.focusInPanel=!1,this.onFocusIn=event=>{const panel=this.panelElement,target=event.composedPath()[0];this.focusInPanel=panel!==null&&target!==void 0&&composedContains(panel,target)},this.onFocusOut=event=>{const next=event.relatedTarget;if(next===null)return;const panel=this.panelElement;(!panel||!composedContains(panel,next))&&(this.focusInPanel=!1)},this.onBaseClick=()=>{if(this.isLink)return;const context=this.ownerContext;if(context){context.activate(this);return}this.isTrigger&&(this._open?this.closePanel("user"):this.openPanel("programmatic","user"))},this.onHostKeyDown=event=>{event.key!=="Escape"||event.defaultPrevented||!this._open||this.ownerContext||(event.preventDefault(),this.onOverlayEscape())},registerNavigationMenuItemController(this,{isTrigger:()=>this.isTrigger,isLink:()=>this.isLink,isOpen:()=>this._open,mode:()=>this._open?this.interactionMode:void 0,pin:()=>{this._open&&(this.interactionMode="pinned")},base:()=>this.baseElement,panel:()=>this.panelElement,open:(mode,source)=>this.openPanel(mode,source),close:(source,options)=>this.closePanel(source,options),isTopmost:()=>this.overlayHandle?.isTopmost()??!1,placementReady:()=>this.placementReady(),reposition:()=>{this.placementKey="",this.requestUpdate()}})}get ownerContext(){return navigationMenuOwner(this)}get isLink(){return!!safeLinkHref(this.href)}get isTrigger(){return!this.isLink&&this.slotPresence.has("panel")}get floatingLayout(){return this.ownerContext?.layout()==="bar"}get baseElement(){return this.renderRoot?.querySelector('[part~="base"]')??null}get panelElement(){return this.renderRoot?.querySelector('[part~="panel"]')??null}get canDisclose(){return this.isLink?!1:!this.browserResolved||this.slotPresence.has("panel")}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.addEventListener("keydown",this.onHostKeyDown),this.updateBrowserDerivedState(()=>{this.browserResolved=!0}),this.hasUpdated&&this._open&&(this.interactionMode="programmatic",this.requestUpdate())}disconnectedCallback(){this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut),this.removeEventListener("keydown",this.onHostKeyDown),this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(!1),this.cancelHideAnimation(),this.closing=!1,this.focusInPanel=!1,this.semanticFocusOrigin=void 0,this._open&&this.interactionMode==="hover"?(this._open=!1,this.liveOpen=!1,this.interactionMode=void 0,this.requestUpdate("open",!0)):this._open&&(this.interactionMode="programmatic"),super.disconnectedCallback()}focus(options){const base=this.baseElement;base?base.focus(options):super.focus(options)}click(){this.baseElement?.click()}willUpdate(changed){if(super.willUpdate(changed),this._open&&!this.canDisclose&&(this.liveOpen?this.closePanel("programmatic",{repairFocus:!0,instant:!0}):(this._open=!1,this.interactionMode=void 0,this.pendingShow=!1,this.pendingMorph=void 0,this.requestUpdate("open",!0))),changed.has("href")){const previous=this.baseElement,nextKind=this.isLink?"a":"button";this.semanticFocusOrigin=previous&&previous.localName!==nextKind&&activeElementIn(this.shadowRoot)===previous?previous:void 0}}updated(changed){super.updated(changed),this.isConnected&&this.hasAttribute("open")!==this._open&&this.toggleAttribute("open",this._open),this.syncFloating(),this.syncHideAnimation();const focusOrigin=this.semanticFocusOrigin;if(this.semanticFocusOrigin=void 0,focusOrigin){const internalActive=activeElementIn(this.shadowRoot),documentActive=activeElementIn(this.ownerDocument);(internalActive===null||internalActive===focusOrigin)&&(documentActive===null||documentActive===this||documentActive===this.ownerDocument.body)&&this.baseElement?.focus()}}openPanel(mode,source){if(this._open)return mode==="pinned"&&this.interactionMode==="hover"&&(this.interactionMode="pinned"),!0;if(!this.canDisclose)return this.requestUpdate("open",!0),!1;const context=this.ownerContext,morph=context?.willOpen(this);return this.cancelHideAnimation(),this.closing=!1,this.interactionMode=mode,this.pendingMorph=morph,this.pendingShow=source!==null&&!morph,this._open=!0,this.requestUpdate("open",!1),this.queueToggle(!0,source),context?.changed(this,!0,source),!0}closePanel(source,options={}){if(!this._open)return;options.repairFocus!==!1&&this.panelHoldsFocus()&&(options.focusTarget??this.baseElement)?.focus({preventScroll:!0});const wasFloating=this.placement!==void 0||this.overlayHandle!==void 0;this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(options.restoreFocus===!0);const animate=!options.instant&&wasFloating&&this.liveOpen&&this.isConnected&&this.floatingLayout;this.cancelHideAnimation(),this.closing=animate,this.pendingMorph=void 0,this.pendingShow=!1,this.interactionMode=void 0,this.liveOpen=!1,this.focusInPanel=!1,this._open=!1,this.requestUpdate("open",!0),this.queueToggle(!1,source),this.ownerContext?.changed(this,!1,source)}queueToggle(open,source){source!==null&&this.updateComplete.then(()=>{this.emit("lr-toggle",{expanded:open,source})})}panelHoldsFocus(){const panel=this.panelElement;if(!panel)return!1;const active=deepActiveElement(this.ownerDocument);return active&&composedContains(panel,active)?!0:this.focusInPanel&&(active===null||active===this.ownerDocument.body)}syncFloating(){const panel=this.panelElement,visible=this.isTrigger&&this.browserResolved&&this._open;if(visible&&(this.liveOpen=!0),!(visible&&this.isConnected&&this.floatingLayout)){this.stopPlacement(),this.overlayHandle&&this.releaseOverlay(!1),panel&&!this.closing&&(this.clearPlacementStyles(panel),visible&&panel.hasAttribute("data-lr-top-layer")&&loadAnchoredOverlayRuntime().then(runtime=>runtime.releaseTopLayer?.(panel),()=>{})),visible&&(this.pendingShow=!1,this.pendingMorph=void 0);return}if(!panel)return;const context=this.ownerContext,anchor=context.anchor(this);if(!anchor)return;const key=[anchor===this.baseElement?"item":"menu",context.distance(),context.topLayer(),this.effectiveDirection].join("|");(!this.placement||key!==this.placementKey)&&this.startPlacement(anchor,panel,key),this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.panelElement,onEscape:()=>this.onOverlayEscape(),restoreFocusTo:()=>this.baseElement}));const morph=this.pendingMorph,show=this.pendingShow;if(this.pendingMorph=void 0,this.pendingShow=!1,!morph&&!show)return;const handle=this.placement;handle?.ready.then(placed=>{!placed||handle!==this.placement||!this._open||(morph?this.runMorph(morph):this.runShowAnimation())})}startPlacement(anchor,panel,key){this.stopPlacement();const context=this.ownerContext,bridge=this.renderRoot.querySelector(".hover-bridge");this.placementKey=key;const topLayer=context.topLayer();this.placedTopLayer=syncTopLayerRelease(panel,this.placedTopLayer,topLayer),this.placement=deferredPlaceReady(anchor,panel,{placement:rtlAwarePlacement("bottom-start",this),...topLayerPlacement(topLayer,resolveEffectivePositioningStrategy(this,void 0,"fixed")),offset:context.distance(),hoverBridge:bridge??void 0})}stopPlacement(){const handle=this.placement;this.placement=void 0,this.placementKey="",handle?.()}releaseOverlay(restoreFocus){const handle=this.overlayHandle;this.overlayHandle=void 0,handle?.deactivate({restoreFocus})}clearPlacementStyles(panel){for(const property2 of PLACEMENT_STYLE_PROPERTIES)panel.style.removeProperty(property2)}onOverlayEscape(){const context=this.ownerContext;if(context){context.escape(this);return}const within=composedContains(this,deepActiveElement(this.ownerDocument));this.closePanel("user",{restoreFocus:within})}async placementReady(){return await this.updateComplete,this.placement?waitForDeferredPlacement(()=>this.placement):this._open}get registryHost(){return this.ownerContext?.owner??this}runShowAnimation(){const panel=this.panelElement;panel&&animateRegistered(this.registryHost,panel,"navigation-menu.show",this.effectiveDirection,{keyframes:[{opacity:0,transform:SHOW_OFFSET},{opacity:1,transform:"translateY(0)"}],durationProperties:["--lr-navigation-menu-show-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]})}syncHideAnimation(){if(!this.closing||this.hideAnimationStarted)return;this.hideAnimationStarted=!0;const token=this.transitionToken,panel=this.panelElement,animation=panel?animateRegistered(this.registryHost,panel,"navigation-menu.hide",this.effectiveDirection,{keyframes:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:SHOW_OFFSET}],durationProperties:["--lr-navigation-menu-hide-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}):void 0;this.hideAnimation=animation;const settle=()=>{token===this.transitionToken&&(this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1,this.closing=!1)};animation?animation.finished.then(settle,settle):queueMicrotask(settle)}cancelHideAnimation(){this.transitionToken++,this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1}runMorph(morph){const panel=this.panelElement,content=panel?.querySelector(".panel-content");if(!panel||!content)return;const travel="var(--lr-size-1rem)",reversed=`calc(-1 * ${travel})`,from=morph.direction==="end"?travel:reversed,mirrored=morph.direction==="end"?reversed:travel;animateRegistered(this.registryHost,content,`navigation-menu.enter-from-${morph.direction}`,this.effectiveDirection,{keyframes:[{opacity:0,transform:`translateX(${from})`},{opacity:1,transform:"translateX(0)"}],rtlKeyframes:[{opacity:0,transform:`translateX(${mirrored})`},{opacity:1,transform:"translateX(0)"}],durationProperties:["--lr-navigation-menu-switch-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]});const view=this.ownerDocument.defaultView;if(!view||prefersReducedMotion(this))return;const to=panel.getBoundingClientRect();if(Math.abs(to.width-morph.from.width)<1&&Math.abs(to.height-morph.from.height)<1)return;this.cancelMorph();const natural=content.getBoundingClientRect().width;panel.setAttribute("data-morphing",""),panel.style.inlineSize=`${morph.from.width}px`,panel.style.blockSize=`${morph.from.height}px`,content.style.inlineSize=`${natural}px`;const style=view.getComputedStyle(panel),durations=parseTimeList(style.transitionDuration),delays=parseTimeList(style.transitionDelay),total=Math.max(0,...durations.map((duration,index)=>duration+(delays[index%Math.max(1,delays.length)]??0)));let frame,timer;const onEnd=event=>{event.target===panel&&["inline-size","block-size","width","height"].includes(event.propertyName)&&cleanup()},cleanup=()=>{this.morphCleanup===cleanup&&(this.morphCleanup=void 0,frame!==void 0&&view.cancelAnimationFrame(frame),timer!==void 0&&view.clearTimeout(timer),panel.removeEventListener("transitionend",onEnd),panel.removeAttribute("data-morphing"),panel.style.removeProperty("inline-size"),panel.style.removeProperty("block-size"),content.style.removeProperty("inline-size"))};this.morphCleanup=cleanup,panel.addEventListener("transitionend",onEnd),frame=view.requestAnimationFrame(()=>{frame=void 0,this.morphCleanup===cleanup&&(panel.style.inlineSize=`${to.width}px`,panel.style.blockSize=`${to.height}px`,timer=view.setTimeout(cleanup,total+50))})}cancelMorph(){this.morphCleanup?.()}render(){const isLink=this.isLink,isTrigger=this.isTrigger,floating=this.floatingLayout,stacked=this.ownerContext?.layout()==="stacked",expanded=this._open&&this.browserResolved,panelVisible=isTrigger&&this.browserResolved&&(this._open||this.closing),ariaLabel=hostAriaLabel(this),parts=["base"];this.current&&parts.push("base-current"),isTrigger&&expanded&&parts.push("base-open");const label=html`<span part="start" ?hidden=${!this.slotPresence.has("start")}
2
2
  ><slot name="start"></slot></span
3
3
  ><span part="label"><slot></slot></span
4
4
  ><span part="end" ?hidden=${!this.slotPresence.has("end")}><slot name="end"></slot></span
@@ -48,10 +48,7 @@ export declare class LyraReorderItem extends LyraElement<LyraReorderItemEventMap
48
48
  * whitespace-only, or duplicate value from movement until its identity becomes valid. Direct
49
49
  * property or attribute edits refresh the owner's movement boundaries. Removed standalone values
50
50
  * render as absent. */
51
- value:string;private legacyAccessibleLabel;
52
- /** Compatibility fallback below the host aria-label, including an explicitly empty host value.
53
- * @deprecated Use the host aria-label attribute or the native ariaLabel property. */
54
- get accessibleLabel():string|undefined;set accessibleLabel(value:string|undefined);
51
+ value:string;
55
52
  /** The host `aria-label`: names the row and, in place of its content, both move actions. */
56
53
  private hostAccessibleLabel;
57
54
  /** Disables this row's own move-up/move-down buttons without removing it or its slotted content
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityTextResult}from"../../../internal/accessibility-visibility.js";import{chevronIcon}from"../../../internal/icons.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{warnDeprecatedUsage}from"../../../internal/dev-mode-attribute-warning.js";import{styles}from"./reorder-item.styles.js";import{reorderIdentityChange,reorderOwnerUpdate}from"./reorder-owner.js";import{LYRA_DEFAULT_moveDown,LYRA_DEFAULT_moveUp}from"../../../internal/default-strings.generated.js";function isReorderOwnerState(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return typeof candidate.atStart=="boolean"&&typeof candidate.atEnd=="boolean"&&typeof candidate.listDisabled=="boolean"&&typeof candidate.pending=="boolean"&&typeof candidate.busy=="boolean"&&typeof candidate.validIdentity=="boolean"}class LyraReorderItem extends LyraElement{constructor(){super(...arguments),this.reorderInternals=attachInternalsSafely(this),this.moveUpLabelId=nextId("reorder-move-up"),this.moveDownLabelId=nextId("reorder-move-down"),this.itemLabelId=nextId("reorder-item-label"),this.owner=null,this.ownerState={atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1},this.value="",this.legacyAccessibleLabel=void 0,this.hostAccessibleLabel=null,this.disabled=!1,this.onMoveUpClick=()=>{this.moveUpDisabled||this.emit("lr-move-request",{direction:"up"})},this.onMoveDownClick=()=>{this.moveDownDisabled||this.emit("lr-move-request",{direction:"down"})}}static{this.defaultStrings={...super.defaultStrings,moveDown:LYRA_DEFAULT_moveDown,moveUp:LYRA_DEFAULT_moveUp}}static{this.styles=[LyraElement.styles,styles]}attributeChangedCallback(name,oldValue,newValue){super.attributeChangedCallback(name,oldValue,newValue)}get accessibleLabel(){return this.legacyAccessibleLabel}set accessibleLabel(value){warnDeprecatedUsage(this,"property","accessibleLabel","aria-label"),this.legacyAccessibleLabel=value}get atStart(){return this.ownerState.atStart}get atEnd(){return this.ownerState.atEnd}get listDisabled(){return this.ownerState.listDisabled}get pending(){return this.ownerState.pending}[reorderOwnerUpdate](owner,state){if(!isReorderOwnerState(state)){this.owner===owner&&(this.owner=null,this.setOwnerState({atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1}));return}this.owner=owner,this.setOwnerState(state)}setOwnerState(state){const previous=this.ownerState;previous.atStart===state.atStart&&previous.atEnd===state.atEnd&&previous.listDisabled===state.listDisabled&&previous.pending===state.pending&&previous.busy===state.busy&&previous.validIdentity===state.validIdentity||(this.ownerState=state,setCustomState(this.reorderInternals,"at-start",state.atStart),setCustomState(this.reorderInternals,"at-end",state.atEnd),setCustomState(this.reorderInternals,"list-disabled",state.listDisabled),setCustomState(this.reorderInternals,"pending",state.pending),setCustomState(this.reorderInternals,"busy",state.busy),setCustomState(this.reorderInternals,"invalid-identity",!state.validIdentity),this.requestUpdate())}get moveUpDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atStart}get moveDownDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atEnd}focusMoveButton(direction){if(direction==="up"?this.moveUpDisabled:this.moveDownDisabled)return!1;const part=direction==="up"?"move-up-button":"move-down-button",button=this.shadowRoot?.querySelector(`[part='${part}']`);return!button||button.disabled?!1:(button.focus(),!0)}get resolvedItemLabel(){return this.hostAccessibleLabel!==null?this.hostAccessibleLabel:this.accessibleLabel!==void 0?this.accessibleLabel:composedAccessibilityTextResult(this.childNodes,{ancestorBoundary:this,maxCharacters:256,maxDepth:16,maxNodes:128,requireRendered:!1,skipRootAncestorValidation:!0}).text}refreshContentObserver(){this.contentObserver?.disconnect();const Observer=this.ownerDocument.defaultView?.MutationObserver;!Observer||!this.isConnected||(this.contentObserver=new Observer(()=>this.requestUpdate()),this.contentObserver.observe(this,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:["alt","aria-label","aria-labelledby","hidden","inert","title"]}))}connectedCallback(){super.connectedCallback(),this.refreshContentObserver()}disconnectedCallback(){this.contentObserver?.disconnect(),this.contentObserver=void 0,super.disconnectedCallback()}willUpdate(changed){super.willUpdate(changed),changed.has("value")&&this.owner?.[reorderIdentityChange]?.(this),this.setAttribute("role","listitem")}render(){const itemLabel=this.resolvedItemLabel;return html`
1
+ import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityTextResult}from"../../../internal/accessibility-visibility.js";import{chevronIcon}from"../../../internal/icons.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{styles}from"./reorder-item.styles.js";import{reorderIdentityChange,reorderOwnerUpdate}from"./reorder-owner.js";import{LYRA_DEFAULT_moveDown,LYRA_DEFAULT_moveUp}from"../../../internal/default-strings.generated.js";function isReorderOwnerState(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return typeof candidate.atStart=="boolean"&&typeof candidate.atEnd=="boolean"&&typeof candidate.listDisabled=="boolean"&&typeof candidate.pending=="boolean"&&typeof candidate.busy=="boolean"&&typeof candidate.validIdentity=="boolean"}class LyraReorderItem extends LyraElement{constructor(){super(...arguments),this.reorderInternals=attachInternalsSafely(this),this.moveUpLabelId=nextId("reorder-move-up"),this.moveDownLabelId=nextId("reorder-move-down"),this.itemLabelId=nextId("reorder-item-label"),this.owner=null,this.ownerState={atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1},this.value="",this.hostAccessibleLabel=null,this.disabled=!1,this.onMoveUpClick=()=>{this.moveUpDisabled||this.emit("lr-move-request",{direction:"up"})},this.onMoveDownClick=()=>{this.moveDownDisabled||this.emit("lr-move-request",{direction:"down"})}}static{this.defaultStrings={...super.defaultStrings,moveDown:LYRA_DEFAULT_moveDown,moveUp:LYRA_DEFAULT_moveUp}}static{this.styles=[LyraElement.styles,styles]}attributeChangedCallback(name,oldValue,newValue){super.attributeChangedCallback(name,oldValue,newValue)}get atStart(){return this.ownerState.atStart}get atEnd(){return this.ownerState.atEnd}get listDisabled(){return this.ownerState.listDisabled}get pending(){return this.ownerState.pending}[reorderOwnerUpdate](owner,state){if(!isReorderOwnerState(state)){this.owner===owner&&(this.owner=null,this.setOwnerState({atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1}));return}this.owner=owner,this.setOwnerState(state)}setOwnerState(state){const previous=this.ownerState;previous.atStart===state.atStart&&previous.atEnd===state.atEnd&&previous.listDisabled===state.listDisabled&&previous.pending===state.pending&&previous.busy===state.busy&&previous.validIdentity===state.validIdentity||(this.ownerState=state,setCustomState(this.reorderInternals,"at-start",state.atStart),setCustomState(this.reorderInternals,"at-end",state.atEnd),setCustomState(this.reorderInternals,"list-disabled",state.listDisabled),setCustomState(this.reorderInternals,"pending",state.pending),setCustomState(this.reorderInternals,"busy",state.busy),setCustomState(this.reorderInternals,"invalid-identity",!state.validIdentity),this.requestUpdate())}get moveUpDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atStart}get moveDownDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atEnd}focusMoveButton(direction){if(direction==="up"?this.moveUpDisabled:this.moveDownDisabled)return!1;const part=direction==="up"?"move-up-button":"move-down-button",button=this.shadowRoot?.querySelector(`[part='${part}']`);return!button||button.disabled?!1:(button.focus(),!0)}get resolvedItemLabel(){return this.hostAccessibleLabel!==null?this.hostAccessibleLabel:composedAccessibilityTextResult(this.childNodes,{ancestorBoundary:this,maxCharacters:256,maxDepth:16,maxNodes:128,requireRendered:!1,skipRootAncestorValidation:!0}).text}refreshContentObserver(){this.contentObserver?.disconnect();const Observer=this.ownerDocument.defaultView?.MutationObserver;!Observer||!this.isConnected||(this.contentObserver=new Observer(()=>this.requestUpdate()),this.contentObserver.observe(this,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:["alt","aria-label","aria-labelledby","hidden","inert","title"]}))}connectedCallback(){super.connectedCallback(),this.refreshContentObserver()}disconnectedCallback(){this.contentObserver?.disconnect(),this.contentObserver=void 0,super.disconnectedCallback()}willUpdate(changed){super.willUpdate(changed),changed.has("value")&&this.owner?.[reorderIdentityChange]?.(this),this.setAttribute("role","listitem")}render(){const itemLabel=this.resolvedItemLabel;return html`
2
2
  <div part="base">
3
3
  <span id=${this.moveUpLabelId} hidden>${this.localize("moveUp")}</span>
4
4
  <span id=${this.moveDownLabelId} hidden
@@ -27,4 +27,4 @@ import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/dec
27
27
  ><slot @slotchange=${this.refreshContentObserver}></slot
28
28
  ></span>
29
29
  </div>
30
- `}}__decorate([property()],LyraReorderItem.prototype,"value",void 0),__decorate([property({attribute:!1})],LyraReorderItem.prototype,"accessibleLabel",null),__decorate([property({attribute:"aria-label"})],LyraReorderItem.prototype,"hostAccessibleLabel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraReorderItem.prototype,"disabled",void 0);export{LyraReorderItem};
30
+ `}}__decorate([property()],LyraReorderItem.prototype,"value",void 0),__decorate([property({attribute:"aria-label"})],LyraReorderItem.prototype,"hostAccessibleLabel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraReorderItem.prototype,"disabled",void 0);export{LyraReorderItem};