@aceshooting/lyra-ui 30.3.0 → 30.4.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 (52) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/conversation/message-actions/message-actions.class.d.ts +3 -3
  3. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +1 -1
  4. package/dist/components/data/flow-minimap/flow-minimap.class.d.ts +1 -1
  5. package/dist/components/layout/app-rail/app-rail.class.d.ts +1 -1
  6. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  7. package/dist/components/layout/multi-split/multi-split.class.d.ts +4 -1
  8. package/dist/components/layout/multi-split/multi-split.class.js +6 -3
  9. package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
  10. package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
  11. package/dist/components/layout/page/page.class.d.ts +3 -1
  12. package/dist/components/layout/page/page.class.js +1 -1
  13. package/dist/components/layout/responsive-panel/responsive-panel.class.d.ts +6 -4
  14. package/dist/components/layout/responsive-panel/responsive-panel.class.js +1 -1
  15. package/dist/components/layout/scroller/scroller.class.d.ts +1 -1
  16. package/dist/components/layout/scroller/scroller.class.js +1 -1
  17. package/dist/components/layout/split-panel/split-panel.class.d.ts +1 -1
  18. package/dist/components/layout/split-panel/split-panel.class.js +1 -1
  19. package/dist/components/layout/stepper/stepper.class.d.ts +1 -1
  20. package/dist/components/layout/stepper/stepper.class.js +1 -1
  21. package/dist/components/layout/widget/widget.class.d.ts +1 -1
  22. package/dist/components/layout/widget/widget.class.js +1 -1
  23. package/dist/components/overlays/dialog/dialog.class.d.ts +2 -2
  24. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  25. package/dist/components/utility/copy-button/copy-button.class.d.ts +13 -15
  26. package/dist/components/utility/copy-button/copy-button.class.js +3 -3
  27. package/dist/components/utility/copy-button/copy-button.styles.js +1 -1
  28. package/dist/components/utility/tour/tour.class.d.ts +2 -2
  29. package/dist/components/utility/tour/tour.class.js +1 -1
  30. package/dist/framework-types.d.ts +1 -1
  31. package/dist/internal/modal-host.styles.js +1 -0
  32. package/dist/internal/modal-surface-controller.js +1 -1
  33. package/dist/internal/overlay-stack.d.ts +1 -1
  34. package/dist/internal/overlay-stack.js +1 -1
  35. package/dist/internal/package-metadata.js +1 -1
  36. package/dist/internal/style-property-lease.js +1 -1
  37. package/llms/components/lr-app-rail.md +4 -0
  38. package/llms/components/lr-badge.md +3 -0
  39. package/llms/components/lr-copy-button.md +15 -7
  40. package/llms/components/lr-multi-split.md +4 -0
  41. package/llms/components/lr-page.md +5 -1
  42. package/llms/components/lr-responsive-panel.md +5 -1
  43. package/llms/components/lr-token-input.md +4 -3
  44. package/llms/components/lr-tooltip.md +4 -4
  45. package/llms/peers.md +1 -1
  46. package/llms/shared/ai-and-peers.md +11 -0
  47. package/llms/shared/styles-and-tokens.md +75 -14
  48. package/llms/shared.md +86 -14
  49. package/package.json +2 -2
  50. package/skills/compose-lyra-interfaces/references/composition-patterns.md +1 -1
  51. package/skills/lyra-ui/SKILL.md +3 -2
  52. package/skills/lyra-ui/lyra-gen.md +10 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 30.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fea5203: Add the shared optional size ladder to copy buttons. Keep viewport modals above ancestor stacking contexts and preserve their visual order across reconnects. Avoid redundant layout measurements and stale navigation-menu resize callbacks, and correct tooltip, sizing, and theme-contrast documentation.
8
+
9
+ Shared modal ordering and exit handling, allocation-preserving drawers, and copy-button sizing add runtime code; their required guides and generated editor data increase archive sizes. Only exceeded bundle and archive ceilings advance to the next 64-byte boundary after composition review; passing limits, measurement inputs and the UI download cap remain unchanged.
10
+
11
+ Make panorama pause-ownership qualification handle native callback delivery before the queued pause event, with deterministic coverage of both event orders.
12
+
13
+ Two compatible seven-sample Chromium quick comparisons against 30.3.0, run in opposite orders, retained 21 and 12 timing threshold exceedances. The second pair measured 10,000-row assignment median total time at 27.2 to 40.0 ms and chart-assignment p95 at 110.5 to 178.5 ms. All semantic checks and recorded work counts matched. Causes remain unresolved; neither pair is a performance pass. These advisory findings remain separate from passing preliminary hosted A/B qualification.
14
+
15
+ ### Patch Changes
16
+
17
+ - @aceshooting/lyra-translations@30.4.0
18
+
3
19
  ## 30.3.0
4
20
 
5
21
  ### Minor Changes
@@ -28,9 +28,9 @@ import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';impo
28
28
  *
29
29
  * The toolbar has no `size`/`compact` property of its own: every built-in action composes
30
30
  * `<lr-icon-button>` (the embedded `lr-copy-button` does the same one level deeper), so each one's
31
- * hit area is that component's shared `--lr-icon-button-size` floor (2.5rem/40px), same as
32
- * everywhere else in the library. For a dense action row where 40px per action is more than the
33
- * layout can afford, lower `--lr-icon-button-size-scope` (the subtree-scoped input) or
31
+ * hit area follows that component's shared `--lr-icon-button-size` floor, same as
32
+ * everywhere else in the library. For a denser action row, lower
33
+ * `--lr-icon-button-size-scope` (the subtree-scoped input) or
34
34
  * `--lr-theme-icon-button-size` (the application-wide one) -- NOT `--lr-icon-button-size` itself,
35
35
  * which every `LyraElement` re-declares on its own `:host` and so never reaches a composed child
36
36
  * (`internal/tokens.test.ts` proves this) -- on this element or any ancestor of it;
@@ -206,7 +206,7 @@ get autocorrect():boolean;set autocorrect(next:boolean|string);autocomplete:stri
206
206
  * attempts, including a synchronous fieldset cascade. */
207
207
  get open():boolean;set open(next:boolean);
208
208
  /** Visual size on the shared six-tier control ladder. `small`/`medium`/`large` alias
209
- * `s`/`m`/`l`; the preview action keeps the library-wide 40px minimum hit area. */
209
+ * `s`/`m`/`l`; the preview action keeps the shared --lr-icon-button-size minimum hit area. */
210
210
  size:LyraSize;private get activeIndex();private get query();private readonly slotPresence;private previewingId;private listId;private controlId;private audioEl?;private pendingPreviewId;private previewGeneration;protected get catalogEditing():CatalogPickerController<LyraVoiceCatalogEntry>;private readonly catalogPicker;connectedCallback():void;protected willUpdate(changed:PropertyValues<this>):void;disconnectedCallback():void;adoptedCallback():void;
211
211
  /** The current voice id (empty string when nothing is selected).*/
212
212
  get value():string;set value(next:string);
@@ -46,7 +46,7 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
46
46
  * node bounds dwarf the visible viewport the raw rectangle collapses to a few pixels, which
47
47
  * leaves the only pointer-drag handle for panning effectively unclickable; the floor grows it
48
48
  * symmetrically about its own centre so it still points at what the viewport shows. The visible
49
- * `viewport` stays exact. Defaults to Lyra's 40px interaction floor; set `0` to opt out.
49
+ * `viewport` stays exact. Defaults to the shared `--lr-icon-button-size` floor; set `0` to opt out.
50
50
  * @status stable
51
51
  * @since 4.0.0
52
52
  */
@@ -505,7 +505,7 @@ get dragging():boolean;private _dragging;private setDragging;
505
505
  * attribute for styling, and announced through `lr-peek-change`. `mode` stays `'icon-only'`
506
506
  * while this is `true` -- peeking presents the strip expanded, it does not change the mode.
507
507
  * Always `false` while `auto-hide` is unset or the rail is `'full'` (pinned) or `'mobile'`. */
508
- get peeking():boolean;private _peeking;private peekOpenTimer?;private peekCloseTimer?;private peekPointerInside;private peekKeyboardFocusInside;private peekPointerSeen?;private peekDismissed;private peekAfterUnpin;private peekHandle?;private get peekEligible();private get modePreference();private clearPeekOpen;private clearPeekClose;private setPeeking;private resetPeek;private dismissPeek;private startPeekOpen;private startPeekClose;private onPeekPointerEnter;private onPeekPointerMove;private onPeekPointerLeave;private onPeekFocusIn;private onPeekFocusOut;private onPinClick;private hasHeaderSlot;private hasFooterSlot;private persistReady;private _mode;private _lastReflectedMode?;private pendingInitialModeAnnouncement?;private forced;private hotkeyWindow?;private iconOnlyMatches;private mobileMatches;private mqIconOnly?;private mqMobile?;private mqIconOnlyListener?;private mqMobileListener?;private overlayActive;private justOpened;private overlayHandle?;private readonly nativeModal;private explicitTrigger?;private overlayReturnTarget;private overlayOpener;private overlayReturnIsExplicit;private restoreFallbackTabIndex?;private triggerAria?;private recoverInlineFocusAfterResponsiveClose;private readonly navId;private readonly navRegionId;private baseEl?;private toggleEl?;private resizePointerId?;private readonly resizeController;private resizeStartX;private resizeRtl;private resizeStartWidth;private resizeGestureChanged;private managedItems;private syncSlottedItems;
508
+ get peeking():boolean;private _peeking;private peekOpenTimer?;private peekCloseTimer?;private peekPointerInside;private peekKeyboardFocusInside;private peekPointerSeen?;private peekDismissed;private peekAfterUnpin;private peekHandle?;private get peekEligible();private get modePreference();private clearPeekOpen;private clearPeekClose;private setPeeking;private resetPeek;private dismissPeek;private startPeekOpen;private startPeekClose;private onPeekPointerEnter;private onPeekPointerMove;private onPeekPointerLeave;private onPeekFocusIn;private onPeekFocusOut;private onPinClick;private hasHeaderSlot;private hasFooterSlot;private persistReady;private _mode;private _lastReflectedMode?;private pendingInitialModeAnnouncement?;private forced;private hotkeyWindow?;private iconOnlyMatches;private mobileMatches;private mqIconOnly?;private mqMobile?;private mqIconOnlyListener?;private mqMobileListener?;private overlayActive;private justOpened;private overlayHandle?;private readonly nativeModal;private readonly modalSurface;private explicitTrigger?;private overlayReturnTarget;private overlayOpener;private overlayReturnIsExplicit;private restoreFallbackTabIndex?;private triggerAria?;private recoverInlineFocusAfterResponsiveClose;private readonly navId;private readonly navRegionId;private baseEl?;private toggleEl?;private resizePointerId?;private readonly resizeController;private resizeStartX;private resizeRtl;private resizeStartWidth;private resizeGestureChanged;private managedItems;private syncSlottedItems;
509
509
  /**
510
510
  * The rail's current effective presentation. Always one of the three real
511
511
  * modes — never `'auto'` — reflecting either the live breakpoint match or,
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{activateOverlay,collectFocusableElements,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{optionalLiteralSetConverter}from"../../../internal/converters.js";import{cancelDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{resolveCssLength}from"../../../internal/css-length.js";import{focusFirstAvailable}from"../../../internal/focus-navigation.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{detectPlatform}from"../../../internal/platform.js";import{parseHotkey,hasNonShiftModifier,matchesHotkey,hotkeyAriaKeyShortcuts,isIgnorableKeyEvent,isEditableKeyEventTarget,registerHotkeyOwner,unregisterHotkeyOwner,resolveHotkeyOwner}from"../../../internal/hotkey.js";import{nextId,isAccessibilityVisible}from"../../../internal/a11y.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{chevronIcon,closeIcon,menuIcon,pinIcon}from"../../../internal/icons.js";import{tag}from"../../../internal/prefix.js";import{isRtl}from"../../../internal/rtl.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{finiteDuration,finiteRange}from"../../../internal/numbers.js";import{isKeyboardFocusEvent}from"../../../internal/focus-modality.js";import{SeparatorDragController,separatorArrowDirection,separatorDelta}from"../../../internal/separator-drag.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{computeAppRailMode}from"./app-rail-mode.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{styles}from"./app-rail.styles.js";import"./app-rail-item.class.js";import{LYRA_DEFAULT_appRailCollapse,LYRA_DEFAULT_appRailExpand,LYRA_DEFAULT_appRailPin,LYRA_DEFAULT_appRailUnpin,LYRA_DEFAULT_closeNavigation,LYRA_DEFAULT_openNavigation,LYRA_DEFAULT_resizeNavigation}from"../../../internal/default-strings/layout.generated.js";import{LYRA_DEFAULT_navigation,LYRA_DEFAULT_resizeValuePixels}from"../../../internal/default-strings/shared.generated.js";const NON_NAVIGATION_CLICK='[part~="toggle"], [part~="header-actions"], [part~="meta"], [part~="end"]',APP_RAIL_FRAME=optionalLiteralSetConverter(["card","plain"]),RAIL_WIDTH_CONVERTER={fromAttribute:value=>{if(value===null)return value;const number=Number(value);return Number.isNaN(number)?value:number}},APP_RAIL_PERSIST_FIELDS=new Set(["open","width","preferred-mode"]);import{computeAppRailMode as computeAppRailMode2}from"./app-rail-mode.js";class LyraAppRail extends LyraElement{static{this.defaultStrings={...super.defaultStrings,appRailCollapse:LYRA_DEFAULT_appRailCollapse,appRailExpand:LYRA_DEFAULT_appRailExpand,appRailPin:LYRA_DEFAULT_appRailPin,appRailUnpin:LYRA_DEFAULT_appRailUnpin,closeNavigation:LYRA_DEFAULT_closeNavigation,navigation:LYRA_DEFAULT_navigation,openNavigation:LYRA_DEFAULT_openNavigation,resizeNavigation:LYRA_DEFAULT_resizeNavigation,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels}}constructor(){super(),this.iconOnlyBreakpoint="960px",this.mobileBreakpoint="600px",this.triggerCollapses=!1,this.hotkey="",this.accessibleLabel=null,this.withoutToggle=!1,this.autoHide=!1,this.peekOpenDelay=150,this.peekCloseDelay=300,this.collapsible=!1,this.topLayer=!1,this.trigger=null,this.for="",this.focusFallback=null,this.resizable=!1,this.persist="open width",this.minRailWidth=190,this.maxRailWidth=440,this._dragging=!1,this._peeking=!1,this.peekPointerInside=!1,this.peekKeyboardFocusInside=!1,this.peekDismissed=!1,this.peekAfterUnpin=!1,this.onPeekPointerEnter=event=>{event.pointerType!=="touch"&&(this.peekPointerInside=!0,this.peekPointerSeen={x:event.clientX,y:event.clientY},this.clearPeekClose())},this.onPeekPointerMove=event=>{if(event.pointerType==="touch")return;const seen=this.peekPointerSeen,moved=(event.movementX||0)!==0||(event.movementY||0)!==0||seen!==void 0&&(seen.x!==event.clientX||seen.y!==event.clientY);this.peekPointerSeen={x:event.clientX,y:event.clientY},this.peekPointerInside=!0,this.clearPeekClose(),moved&&this.startPeekOpen()},this.onPeekPointerLeave=event=>{event.pointerType!=="touch"&&(this.peekPointerInside=!1,this.peekPointerSeen=void 0,this.clearPeekOpen(),this.peekKeyboardFocusInside||(this.peekDismissed=!1),this.startPeekClose())},this.onPeekFocusIn=event=>{const keyboard=isKeyboardFocusEvent(event);this.peekKeyboardFocusInside=keyboard,keyboard&&(this.clearPeekClose(),this.startPeekOpen(!0))},this.onPeekFocusOut=event=>{const next=event.relatedTarget;isHtmlElement(next)&&composedContains(this,next)||(this.peekKeyboardFocusInside=!1,this.peekPointerInside||(this.peekDismissed=!1),this.startPeekClose())},this.onPinClick=()=>{this.peekAfterUnpin=this._mode==="full"&&(this.peekPointerInside||this.peekKeyboardFocusInside),this.toggleCollapse()},this.hasHeaderSlot=!1,this.hasFooterSlot=!1,this.persistReady=!1,this._mode="full",this.forced=!1,this.iconOnlyMatches=!1,this.mobileMatches=!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.overlayReturnTarget=null,this.overlayOpener=null,this.overlayReturnIsExplicit=!1,this.recoverInlineFocusAfterResponsiveClose=!1,this.navId=nextId("app-rail-nav"),this.navRegionId=nextId("app-rail-nav-region"),this.resizeController=new SeparatorDragController(this,event=>this.onResizerPointerMove(event),event=>this.onResizerPointerUp(event)),this.resizeStartX=0,this.resizeRtl=!1,this.resizeStartWidth=0,this.resizeGestureChanged=!1,this.managedItems=new Set,this.deferredReturnPass=()=>{const candidates=[this.overlayReturnTarget,this.overlayOpener];return{candidates:()=>[...candidates,this.toggleEl],isCurrent:()=>!this.overlayActive,fallback:()=>{this.focusHostFallback()||focusFirstAvailable([this.resolveFocusFallback()])}}},this.onIconOnlyChange=e=>{this.iconOnlyMatches=e.matches,this.forced||this.applyComputedMode()},this.onMobileChange=e=>{this.mobileMatches=e.matches,this.forced||this.applyComputedMode()},this.onToggleClick=e=>{this.open||(this.explicitTrigger=e.currentTarget),this.setOpen(!this.open)},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()},this.acceptsHotkey=event=>{const parsed=this.parsedHotkey;return this.isConnected&&!this.forced&&parsed!==null&&hasNonShiftModifier(parsed)&&matchesHotkey(parsed,event,this.hotkeyIsMac)&&!isEditableKeyEventTarget(event)&&isAccessibilityVisible(this)},this.onHotkeyKeyDown=event=>{if(event.defaultPrevented||isIgnorableKeyEvent(event)||!this.hotkeyWindow)return;const keyboard=event;!this.acceptsHotkey(keyboard)||resolveHotkeyOwner(this.hotkeyWindow,keyboard)!==this||(event.preventDefault(),this.toggle())},this.onPanelTransition=event=>{event.target===event.currentTarget&&event.propertyName==="transform"&&this.baseEl?.removeAttribute("data-sliding")},this.onCollapseToggleClick=()=>{this.toggleCollapse()},this.onNavItemClick=event=>{this.overlayActive&&(event.composedPath().some(node=>isHtmlElement(node)&&node.matches(NON_NAVIGATION_CLICK))||this.setOpen(!1))},this.onHeaderSlotChange=()=>{this.hasHeaderSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="header")},this.onFooterSlotChange=()=>{this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer")},this.onNavSlotChange=()=>{this.syncSlottedItems()},this.onResizerPointerDown=e=>{if(!e.isPrimary||e.button!==0||!this.resizable||this._mode!=="full"||this.resizePointerId!==void 0)return;const resizer=e.currentTarget;this.resizeController.start(e,resizer)&&(this.resizePointerId=e.pointerId,this.resizeStartX=e.clientX,this.resizeRtl=isRtl(this),this.resizeStartWidth=this.effectiveRailWidthPx,this.resizeGestureChanged=!1,this.setDragging(!0))},this.onResizerPointerMove=e=>{if(e.pointerId!==this.resizePointerId)return;if(!this.resizable||this._mode!=="full"||isRtl(this)!==this.resizeRtl){this.endResizerGesture();return}const delta=separatorDelta(this.resizeStartX,e,"inline",this.resizeRtl),next=Math.min(this.safeMaxRailWidthPx,Math.max(this.safeMinRailWidthPx,this.resizeStartWidth+delta));this.requestRailResize(next,!1)},this.onResizerPointerUp=e=>{e.pointerId===this.resizePointerId&&this.endResizerGesture(e.type==="pointerup")},this.onResizerKeyDown=e=>{if(e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const rtl=this.getAttribute("dir")==="rtl"||isRtl(this),direction=separatorArrowDirection(e,"inline",rtl),step=8,width=this.effectiveRailWidthPx,next=direction===1?Math.min(this.safeMaxRailWidthPx,width+step):direction===-1?Math.max(this.safeMinRailWidthPx,width-step):e.key==="Home"?this.safeMinRailWidthPx:e.key==="End"?this.safeMaxRailWidthPx:width;next!==width&&(e.preventDefault(),this.requestRailResize(next))},new GlassScrollLayer(this,'[part="base"], [part="panel"]')}static{this.knownUnobservedAttributes=["mode","dragging","peeking"]}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,styles]}get frame(){return this._frame}set frame(next){const value=APP_RAIL_FRAME.normalizeReflected(this,"frame",next),old=this._frame;value!==old&&(this._frame=value,this.requestUpdate("frame",old))}get forceMode(){return this._forceMode}set forceMode(next){if(next!=null&&next!=="auto"&&next!=="full"&&next!=="icon-only")return;const old=this._forceMode;if(this._forceMode=next??void 0,this.requestUpdate("forceMode",old),next==null||next==="auto"){if(!this.forced)return;this.forced=!1,this.applyComputedMode();return}this.forced=!0,this.setEffectiveMode(next)}static{definePersistedProperty(this.prototype,"open",{initial:!1,attribute:!0,type:Boolean,reflect:!0}),definePersistedProperty(this.prototype,"preferredMode",{initial:void 0,attribute:"preferred-mode"}),definePersistedProperty(this.prototype,"railWidth",{initial:void 0,attribute:"rail-width",converter:RAIL_WIDTH_CONVERTER})}pixelsOf(value){return typeof value=="number"?value:typeof value=="string"?resolveCssLength(value,{host:this}):void 0}get railWidthInPixels(){const width=this.railWidth;return typeof width=="string"?this.pixelsOf(width):width}get dragging(){return this._dragging}setDragging(next){this._dragging=next,this.toggleAttribute("dragging",next)}get peeking(){return this._peeking}get peekEligible(){return this.autoHide&&this._mode==="icon-only"&&this.isConnected}get modePreference(){return this.autoHide?this.preferredMode??"icon-only":this.preferredMode}clearPeekOpen(){this.peekOpenTimer!==void 0&&(clearTimeout(this.peekOpenTimer),this.peekOpenTimer=void 0)}clearPeekClose(){this.peekCloseTimer!==void 0&&(clearTimeout(this.peekCloseTimer),this.peekCloseTimer=void 0)}setPeeking(next,options){this._peeking===next||next&&!this.peekEligible||(this._peeking=next,this.toggleAttribute("peeking",next),next?this.peekHandle=activateOverlay({host:this,panel:()=>this.baseEl??null,modal:!1,trapFocus:!1,onEscape:()=>this.dismissPeek()}):(this.peekHandle?.deactivate({restoreFocus:!1}),this.peekHandle=void 0),options?.silent||this.emit("lr-peek-change",{peeking:next}))}resetPeek(options){this.clearPeekOpen(),this.clearPeekClose(),this.peekPointerInside=!1,this.peekKeyboardFocusInside=!1,this.peekPointerSeen=void 0,this.peekDismissed=!1,this.peekAfterUnpin=!1,this.setPeeking(!1,options)}dismissPeek(){this.peekDismissed=!0,this.clearPeekOpen(),this.clearPeekClose(),this.setPeeking(!1)}startPeekOpen(immediate=!1){if(this.clearPeekClose(),this._peeking||this.peekOpenTimer!==void 0||this.peekDismissed||!this.peekEligible)return;const delay=immediate?0:finiteDuration(this.peekOpenDelay,150),open=()=>{(this.peekPointerInside||this.peekKeyboardFocusInside)&&this.setPeeking(!0)};if(delay===0){open();return}this.peekOpenTimer=setTimeout(()=>{this.peekOpenTimer=void 0,open()},delay)}startPeekClose(){this.clearPeekOpen(),!(!this._peeking||this.peekCloseTimer!==void 0)&&(this.peekPointerInside||this.peekKeyboardFocusInside||(this.peekCloseTimer=setTimeout(()=>{this.peekCloseTimer=void 0,!this.peekPointerInside&&!this.peekKeyboardFocusInside&&this.setPeeking(!1)},finiteDuration(this.peekCloseDelay,300))))}syncSlottedItems(){const slot=this.shadowRoot?.querySelector('[part="nav"] > slot'),itemTag=tag("app-rail-item"),groupTag=tag("app-rail-group"),railTag=tag("app-rail"),next=new Set((slot?.assignedElements({flatten:!0})??[]).filter(item=>item.localName===itemTag||item.localName===groupTag));for(const item of this.managedItems){if(next.has(item))continue;const newOwner=item.closest(railTag);newOwner&&newOwner!==this&&item.parentElement===newOwner&&!item.hasAttribute("slot")?item.toggleAttribute("icon-only",newOwner.mode==="icon-only"):item.removeAttribute("icon-only")}for(const item of next)item.toggleAttribute("icon-only",this._mode==="icon-only"&&!this._peeking);this.managedItems=next}get mode(){return this._mode}get safeMinRailWidthPx(){return finiteRange(this.pixelsOf(this.minRailWidth)??Number.NaN,190,0)}get safeMaxRailWidthPx(){return Math.max(this.safeMinRailWidthPx,finiteRange(this.pixelsOf(this.maxRailWidth)??Number.NaN,440,0))}get effectiveRailWidthPx(){return this.railWidth!=null?finiteRange(this.railWidthInPixels??Number.NaN,this.safeMinRailWidthPx,this.safeMinRailWidthPx,this.safeMaxRailWidthPx):this.baseEl?.getBoundingClientRect().width??240}resizeValueText(widthPx){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(widthPx))})}get storageFullKey(){return this.storageKey?`lr-app-rail:${this.storageKey}`:void 0}get persistFields(){const persist=typeof this.persist=="string"?this.persist:"";return new Set(persist.split(/\s+/).filter(field=>APP_RAIL_PERSIST_FIELDS.has(field)))}loadPersisted(){const restored={open:!1,preferredMode:!1},parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);if(!parsed)return restored;const fields=this.persistFields;return fields.has("open")&&!isPersistedPropertyExplicitlySet(this,"open")&&typeof parsed.open=="boolean"&&(this.open=parsed.open,restored.open=!0),fields.has("width")&&!isPersistedPropertyExplicitlySet(this,"railWidth")&&typeof parsed.railWidthPx=="number"&&Number.isFinite(parsed.railWidthPx)&&(this.railWidth=parsed.railWidthPx),fields.has("preferred-mode")&&!isPersistedPropertyExplicitlySet(this,"preferredMode")&&(parsed.preferredMode==="full"||parsed.preferredMode==="icon-only")&&(this.preferredMode=parsed.preferredMode,restored.preferredMode=!0),restored}persistState(){const fields=this.persistFields;if(fields.size===0)return;const state2={};fields.has("open")&&(state2.open=this.open),fields.has("width")&&(state2.railWidthPx=this.railWidthInPixels),fields.has("preferred-mode")&&(state2.preferredMode=this.preferredMode??null),writePersistedState(this.storageFullKey,state2)}willUpdate(changed){if(super.willUpdate(changed),(changed.has("resizable")||changed.has("mode"))&&(!this.resizable||this._mode!=="full")&&this.endResizerGesture(),!this.hasUpdated){this.hasHeaderSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="header"),this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer");const restored=this.loadPersisted();if(restored.preferredMode&&!this.forced){const restoredMode=computeAppRailMode(this.iconOnlyMatches,this.mobileMatches,this.modePreference);restoredMode!==this._mode&&(this._mode=restoredMode,this.pendingInitialModeAnnouncement=restoredMode)}restored.open&&this.open&&this._mode!=="mobile"&&(this.open=!1)}if(this.hasUpdated&&(changed.has("iconOnlyBreakpoint")||changed.has("mobileBreakpoint"))&&(this.teardownMediaQueries(),this.setupMediaQueries()),changed.has("autoHide")&&!this.forced&&(this.hasUpdated||this.autoHide)&&this.applyComputedMode(this.hasUpdated?void 0:{silent:!0}),this.hasUpdated&&changed.has("preferredMode")&&!this.forced&&this.applyComputedMode(),changed.has("autoHide")&&!this.autoHide&&this.resetPeek(),this.peekAfterUnpin&&(this.peekAfterUnpin=!1,changed.has("preferredMode")&&this.setPeeking(!0)),changed.has("open")||changed.has("mode")){const next=this._mode==="mobile"&&this.open;next!==this.overlayActive&&(this.hasUpdated&&this._mode==="mobile"&&!prefersReducedMotion(this)&&this.baseEl?.toggleAttribute("data-sliding",!0),this.overlayActive=next,this.placeToggle(next),next?(this.justOpened=!0,this.activateMobileOverlay()):this.deactivateMobileOverlay(this._mode==="mobile"))}}updated(changed){if(super.updated(changed),this.overlayActive&&this.nativeModal.show(),changed.has("topLayer"))for(const item of this.querySelectorAll(tag("app-rail-item")))item.syncRailTopLayer?.();if(this._lastReflectedMode!==this._mode&&(this._lastReflectedMode=this._mode,this.setAttribute("mode",this._mode)),this.pendingInitialModeAnnouncement!==void 0){const mode=this.pendingInitialModeAnnouncement;this.pendingInitialModeAnnouncement=void 0,this.emit("lr-mode-change",{mode})}if(this.syncSlottedItems(),this.placeToggle(this.overlayActive),this.syncExternalTriggerA11y(),this.syncBuiltInKeyShortcuts(),this.baseEl&&(this._mode!=="mobile"||!this.baseEl.getAnimations().some(animation=>"transitionProperty"in animation&&animation.transitionProperty==="transform"))&&this.baseEl.removeAttribute("data-sliding"),this.recoverInlineFocusAfterResponsiveClose){this.recoverInlineFocusAfterResponsiveClose=!1;const active=deepActiveElement(this.ownerDocument);this.baseEl&&!composedContains(this.baseEl,active)&&this.baseEl.focus()}this.justOpened&&(this.justOpened=!1,this.overlayHandle?.focusInitial()),this.persistReady&&(changed.has("open")||changed.has("railWidth")&&!this.dragging||changed.has("preferredMode")||changed.has("persist"))&&this.persistState(),this.persistReady=!0,this.baseEl&&(this.resizable&&this.railWidth!=null&&this._mode==="full"?this.baseEl.style.setProperty("inline-size",`${this.effectiveRailWidthPx}px`):this.baseEl.style.removeProperty("inline-size"),this._peeking&&this.resizable&&this.railWidth!=null?this.baseEl.style.setProperty("--_lr-app-rail-peek-width",`${this.effectiveRailWidthPx}px`):this.baseEl.style.removeProperty("--_lr-app-rail-peek-width")),this.observeResizerPosition(),this.syncResizerPosition()}connectedCallback(){super.connectedCallback(),this.hotkeyPlatform=void 0,this.hotkeyWindow=this.ownerDocument.defaultView??void 0,this.hotkeyWindow&&(registerHotkeyOwner(this.hotkeyWindow,this,this.acceptsHotkey),this.hotkeyWindow.addEventListener("keydown",this.onHotkeyKeyDown)),this.setupMediaQueries(),this.hasUpdated&&this._mode==="mobile"&&this.open&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateMobileOverlay(),queueMicrotask(()=>{this.nativeModal.show(),this.overlayHandle?.focusInitial()})),this.hasUpdated&&queueMicrotask(()=>{this.isConnected&&(this.syncSlottedItems(),this.observeResizerPosition(),this.syncResizerPosition(),this.syncExternalTriggerA11y())})}disconnectedCallback(){this.resetPeek({silent:!0}),this.disconnectResizerPosition(),this.nativeModal.hide(),this.hotkeyWindow&&(this.hotkeyWindow.removeEventListener("keydown",this.onHotkeyKeyDown),unregisterHotkeyOwner(this.hotkeyWindow,this),this.hotkeyWindow=void 0),this.baseEl?.removeAttribute("data-sliding"),cancelDeferredFocusReturn(this),super.disconnectedCallback(),this.restoreFallbackTabIndex?.(),this.teardownMediaQueries(),this.overlayHandle?.suspend(),this.endResizerGesture(),this.releaseExternalTriggerA11y()}adoptedCallback(){this.resetPeek({silent:!0}),this.disconnectResizerPosition(),super.adoptedCallback(),this.teardownMediaQueries(),this.endResizerGesture()}resolveExternalTrigger(){if(this.trigger)return this.trigger;if(!this.for)return null;const found=this.getRootNode().getElementById?.(this.for);return found instanceof HTMLElement?found:null}resolveFocusFallback(){const value=this.focusFallback;if(!value)return null;const target=typeof value=="string"?this.getRootNode().getElementById?.(value)??null:value;return isHtmlElement(target)&&target.ownerDocument===this.ownerDocument?target:null}activateMobileOverlay(){this.nativeModal.prepare();const explicitTrigger=this.explicitTrigger;this.explicitTrigger=void 0;const restoreFocusTo=explicitTrigger??this.resolveExternalTrigger()??void 0;this.overlayReturnIsExplicit=explicitTrigger!==void 0;const active=deepActiveElement(this.ownerDocument);this.overlayOpener=active&&typeof active.focus=="function"&&!composedContains(this,active)?active:null,this.overlayReturnTarget=restoreFocusTo??this.overlayOpener,this.overlayHandle=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part="panel"]')??null,onEscape:()=>this.setOpen(!1),onBackdrop:()=>this.setOpen(!1),restoreFocusTo,preferredInitialFocus:()=>{const panel=this.shadowRoot?.querySelector('[part="panel"]')??null;if(!panel)return null;const toggle=this.toggleEl??null;return collectFocusableElements(panel).filter(stop=>stop!==toggle)[0]??panel},lockScroll:!0,suspendWhenUnrendered:!0,deferredReturn:this.deferredReturnPass})}deactivateMobileOverlay(restoreFocus=!0){this.nativeModal.hide(),this.nativeModal.prepare(!1);const handle=this.overlayHandle;if(this.overlayHandle=void 0,handle&&restoreFocus&&!this.overlayReturnIsExplicit){const external=this.resolveExternalTrigger();external&&external!==this.overlayReturnTarget&&(this.overlayReturnTarget=external,handle.updateRestoreFocusTo(external))}handle?.deactivate({restoreFocus})}focusHostFallback(){if(!this.hasAttribute("tabindex")){this.setAttribute("tabindex","-1");const view=this.ownerDocument.defaultView,onFocusChange=()=>{deepActiveElement(this.ownerDocument)!==this&&restore()},restore=()=>{this.removeEventListener("blur",onFocusChange),view?.removeEventListener("focus",onFocusChange),this.getAttribute("tabindex")==="-1"&&this.removeAttribute("tabindex"),this.restoreFallbackTabIndex=void 0};this.restoreFallbackTabIndex=restore,this.addEventListener("blur",onFocusChange),view?.addEventListener("focus",onFocusChange)}return focusFirstAvailable(this)?!0:(this.restoreFallbackTabIndex?.(),!1)}placeToggle(insidePanel){const toggle=this.toggleEl,panel=this.baseEl;if(!(!toggle||!panel)){if(insidePanel){panel.firstChild!==toggle&&panel.insertBefore(toggle,panel.firstChild);return}toggle.nextSibling!==panel&&panel.parentNode?.insertBefore(toggle,panel)}}setupMediaQueries(){if(!this.isConnected)return;const view=this.ownerDocument.defaultView;if(!view?.matchMedia)return;const iconOnlyQuery=view.matchMedia(`(max-width: ${this.iconOnlyBreakpoint})`),mobileQuery=view.matchMedia(`(max-width: ${this.mobileBreakpoint})`),iconOnlyListener=event=>{this.mqIconOnly!==iconOnlyQuery||!this.isConnected||this.ownerDocument.defaultView!==view||this.onIconOnlyChange(event)},mobileListener=event=>{this.mqMobile!==mobileQuery||!this.isConnected||this.ownerDocument.defaultView!==view||this.onMobileChange(event)};this.mqIconOnly=iconOnlyQuery,this.mqMobile=mobileQuery,this.mqIconOnlyListener=iconOnlyListener,this.mqMobileListener=mobileListener,iconOnlyQuery.addEventListener("change",iconOnlyListener),mobileQuery.addEventListener("change",mobileListener),this.iconOnlyMatches=iconOnlyQuery.matches,this.mobileMatches=mobileQuery.matches,!this.forced&&this.applyComputedMode(this.hasUpdated?void 0:{silent:!0})}teardownMediaQueries(){this.mqIconOnly&&this.mqIconOnlyListener&&this.mqIconOnly.removeEventListener("change",this.mqIconOnlyListener),this.mqMobile&&this.mqMobileListener&&this.mqMobile.removeEventListener("change",this.mqMobileListener),this.mqIconOnly=void 0,this.mqMobile=void 0,this.mqIconOnlyListener=void 0,this.mqMobileListener=void 0}applyComputedMode(options){this.setEffectiveMode(computeAppRailMode(this.iconOnlyMatches,this.mobileMatches,this.modePreference),options)}setEffectiveMode(next,options){if(this._mode===next)return;const old=this._mode,resizer=this.renderRoot?.querySelector('[part="resizer"]');old==="full"&&next==="icon-only"&&resizer&&composedContains(resizer,deepActiveElement(this.ownerDocument))&&(this.recoverInlineFocusAfterResponsiveClose=!0),next!=="mobile"&&this.baseEl?.removeAttribute("data-sliding"),old==="mobile"&&next!=="mobile"&&this.open&&(this.recoverInlineFocusAfterResponsiveClose=!0),this._mode=next,next!=="icon-only"&&(this.clearPeekOpen(),this.clearPeekClose(),this.setPeeking(!1)),this.baseEl&&(this.resizable&&this.railWidth!=null&&next==="full"||this.baseEl.style.removeProperty("inline-size")),this.requestUpdate("mode",old),options?.silent?this.pendingInitialModeAnnouncement=next:this.emit("lr-mode-change",{mode:next}),next!=="mobile"&&this.open&&this.setOpen(!1,{force:!0})}setOpen(next,options){if(this.open===next)return;if(options?.force){this.open=next,this.emit("lr-toggle",{expanded:next});return}const mode=this._mode,open=this.open;this.emit("lr-toggle-request",{expanded:next},{cancelable:!0}).defaultPrevented||this._mode!==mode||this.open!==open||(this.open=next,this.emit("lr-toggle",{expanded:next}))}toggleCollapse(){this._mode!=="mobile"&&(this.preferredMode=(this.preferredMode??this._mode)==="icon-only"?"full":"icon-only")}toggle(){this.isConnected&&(this._mode==="mobile"?this.setOpen(!this.open):this.toggleCollapse())}get parsedHotkey(){const value=this.hotkey;if(this.hotkeyMemo&&this.hotkeyMemo.value===value)return this.hotkeyMemo.parsed;const parsed=parseHotkey(value);return this.hotkeyMemo={value,parsed},parsed}get hotkeyIsMac(){const view=this.ownerDocument.defaultView;if(this.hotkeyPlatform&&this.hotkeyPlatform.view===view)return this.hotkeyPlatform.mac;const mac=detectPlatform(view?.navigator)==="mac";return this.hotkeyPlatform={view,mac},mac}get resolvedHotkeyShortcuts(){const parsed=this.parsedHotkey;return hotkeyAriaKeyShortcuts(parsed&&hasNonShiftModifier(parsed)?parsed:null,this.hotkeyIsMac)}syncBuiltInKeyShortcuts(){const value=this.resolvedHotkeyShortcuts;for(const control of[this.toggleEl,this.renderRoot.querySelector('[part="collapse-toggle"]'),this.renderRoot.querySelector('[part="pin-button"]')])!control||control.getAttribute("aria-keyshortcuts")===value||(value===null?control.removeAttribute("aria-keyshortcuts"):control.setAttribute("aria-keyshortcuts",value))}syncExternalTriggerA11y(){if(!this.isConnected){this.releaseExternalTriggerA11y();return}const mobile=this._mode==="mobile",trigger=mobile||this.triggerCollapses?this.resolveExternalTrigger():null;if(!trigger){this.releaseExternalTriggerA11y();return}const panel=this.baseEl??null,contribution={attributes:{"aria-expanded":(mobile?this.open:this._mode==="full")?"true":"false","aria-keyshortcuts":this.resolvedHotkeyShortcuts},controls:panel?[panel]:[]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution)}releaseExternalTriggerA11y(){this.triggerAria?.release(),this.triggerAria=void 0}endResizerGesture(commit=!1){const pointerId=this.resizePointerId,changed=this.resizeGestureChanged,widthPx=this.effectiveRailWidthPx;this.resizePointerId=void 0,this.resizeGestureChanged=!1,this.setDragging(!1),pointerId!==void 0&&this.resizeController.end(pointerId),commit&&changed&&(this.emit("lr-rail-resize",{widthPx}),this.persistReady&&this.persistState())}requestRailResize(next,commit=!0){if(!this.resizable||this._mode!=="full"||!this.isConnected||next===this.effectiveRailWidthPx)return!1;const event=this.emit("lr-rail-resize-request",{widthPx:next},{cancelable:!0});return!this.resizable||this._mode!=="full"||!this.isConnected?(this.endResizerGesture(),!1):event.defaultPrevented?!1:(this.railWidth=next,commit?this.emit("lr-rail-resize",{widthPx:next}):this.resizeGestureChanged=!0,!0)}observeResizerPosition(){const resizer=this.renderRoot.querySelector('[part="resizer"]');if(!this.isConnected||!resizer||!this.baseEl||this._mode!=="full"||!this.resizable){this.disconnectResizerPosition();return}if(this.observedResizer===resizer)return;this.disconnectResizerPosition();const ResizeObserverConstructor=this.ownerDocument.defaultView?.ResizeObserver;ResizeObserverConstructor&&(this.resizerPositionObserver=new ResizeObserverConstructor(()=>this.syncResizerPosition()),this.resizerPositionObserver.observe(this,{box:"border-box"}),this.resizerPositionObserver.observe(this.baseEl,{box:"border-box"}),this.resizerPositionObserver.observe(resizer,{box:"border-box"}),this.observedResizer=resizer)}disconnectResizerPosition(){this.resizerPositionObserver?.disconnect(),this.resizerPositionObserver=void 0,this.observedResizer=void 0}syncResizerPosition(){const resizer=this.renderRoot.querySelector('[part="resizer"]');if(!resizer||!this.baseEl||this._mode!=="full"||!this.resizable)return;const hostRect=this.getBoundingClientRect(),baseRect=this.baseEl.getBoundingClientRect(),half=resizer.getBoundingClientRect().width/2,offset=this.getAttribute("dir")==="rtl"||isRtl(this)?hostRect.right-baseRect.left:baseRect.right-hostRect.left;resizer.style.setProperty("inset-inline-start",`${offset-half}px`),resizer.style.setProperty("inset-inline-end","auto")}renderResizer(){const railWidthPx=this.effectiveRailWidthPx;return html`<div
1
+ import{__decorate}from"tslib";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{modalHostStyles}from"../../../internal/modal-host.styles.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{activateOverlay,collectFocusableElements,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{optionalLiteralSetConverter}from"../../../internal/converters.js";import{cancelDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{resolveCssLength}from"../../../internal/css-length.js";import{focusFirstAvailable}from"../../../internal/focus-navigation.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{detectPlatform}from"../../../internal/platform.js";import{parseHotkey,hasNonShiftModifier,matchesHotkey,hotkeyAriaKeyShortcuts,isIgnorableKeyEvent,isEditableKeyEventTarget,registerHotkeyOwner,unregisterHotkeyOwner,resolveHotkeyOwner}from"../../../internal/hotkey.js";import{nextId,isAccessibilityVisible}from"../../../internal/a11y.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{chevronIcon,closeIcon,menuIcon,pinIcon}from"../../../internal/icons.js";import{tag}from"../../../internal/prefix.js";import{isRtl}from"../../../internal/rtl.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{finiteDuration,finiteRange}from"../../../internal/numbers.js";import{isKeyboardFocusEvent}from"../../../internal/focus-modality.js";import{SeparatorDragController,separatorArrowDirection,separatorDelta}from"../../../internal/separator-drag.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{computeAppRailMode}from"./app-rail-mode.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{styles}from"./app-rail.styles.js";import"./app-rail-item.class.js";import{LYRA_DEFAULT_appRailCollapse,LYRA_DEFAULT_appRailExpand,LYRA_DEFAULT_appRailPin,LYRA_DEFAULT_appRailUnpin,LYRA_DEFAULT_closeNavigation,LYRA_DEFAULT_openNavigation,LYRA_DEFAULT_resizeNavigation}from"../../../internal/default-strings/layout.generated.js";import{LYRA_DEFAULT_navigation,LYRA_DEFAULT_resizeValuePixels}from"../../../internal/default-strings/shared.generated.js";const NON_NAVIGATION_CLICK='[part~="toggle"], [part~="header-actions"], [part~="meta"], [part~="end"]',APP_RAIL_FRAME=optionalLiteralSetConverter(["card","plain"]),RAIL_WIDTH_CONVERTER={fromAttribute:value=>{if(value===null)return value;const number=Number(value);return Number.isNaN(number)?value:number}},APP_RAIL_PERSIST_FIELDS=new Set(["open","width","preferred-mode"]);import{computeAppRailMode as computeAppRailMode2}from"./app-rail-mode.js";class LyraAppRail extends LyraElement{static{this.defaultStrings={...super.defaultStrings,appRailCollapse:LYRA_DEFAULT_appRailCollapse,appRailExpand:LYRA_DEFAULT_appRailExpand,appRailPin:LYRA_DEFAULT_appRailPin,appRailUnpin:LYRA_DEFAULT_appRailUnpin,closeNavigation:LYRA_DEFAULT_closeNavigation,navigation:LYRA_DEFAULT_navigation,openNavigation:LYRA_DEFAULT_openNavigation,resizeNavigation:LYRA_DEFAULT_resizeNavigation,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels}}constructor(){super(),this.iconOnlyBreakpoint="960px",this.mobileBreakpoint="600px",this.triggerCollapses=!1,this.hotkey="",this.accessibleLabel=null,this.withoutToggle=!1,this.autoHide=!1,this.peekOpenDelay=150,this.peekCloseDelay=300,this.collapsible=!1,this.topLayer=!1,this.trigger=null,this.for="",this.focusFallback=null,this.resizable=!1,this.persist="open width",this.minRailWidth=190,this.maxRailWidth=440,this._dragging=!1,this._peeking=!1,this.peekPointerInside=!1,this.peekKeyboardFocusInside=!1,this.peekDismissed=!1,this.peekAfterUnpin=!1,this.onPeekPointerEnter=event=>{event.pointerType!=="touch"&&(this.peekPointerInside=!0,this.peekPointerSeen={x:event.clientX,y:event.clientY},this.clearPeekClose())},this.onPeekPointerMove=event=>{if(event.pointerType==="touch")return;const seen=this.peekPointerSeen,moved=(event.movementX||0)!==0||(event.movementY||0)!==0||seen!==void 0&&(seen.x!==event.clientX||seen.y!==event.clientY);this.peekPointerSeen={x:event.clientX,y:event.clientY},this.peekPointerInside=!0,this.clearPeekClose(),moved&&this.startPeekOpen()},this.onPeekPointerLeave=event=>{event.pointerType!=="touch"&&(this.peekPointerInside=!1,this.peekPointerSeen=void 0,this.clearPeekOpen(),this.peekKeyboardFocusInside||(this.peekDismissed=!1),this.startPeekClose())},this.onPeekFocusIn=event=>{const keyboard=isKeyboardFocusEvent(event);this.peekKeyboardFocusInside=keyboard,keyboard&&(this.clearPeekClose(),this.startPeekOpen(!0))},this.onPeekFocusOut=event=>{const next=event.relatedTarget;isHtmlElement(next)&&composedContains(this,next)||(this.peekKeyboardFocusInside=!1,this.peekPointerInside||(this.peekDismissed=!1),this.startPeekClose())},this.onPinClick=()=>{this.peekAfterUnpin=this._mode==="full"&&(this.peekPointerInside||this.peekKeyboardFocusInside),this.toggleCollapse()},this.hasHeaderSlot=!1,this.hasFooterSlot=!1,this.persistReady=!1,this._mode="full",this.forced=!1,this.iconOnlyMatches=!1,this.mobileMatches=!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.modalSurface.show()}}),this.modalSurface=new ModalSurfaceController(this,this.nativeModal),this.overlayReturnTarget=null,this.overlayOpener=null,this.overlayReturnIsExplicit=!1,this.recoverInlineFocusAfterResponsiveClose=!1,this.navId=nextId("app-rail-nav"),this.navRegionId=nextId("app-rail-nav-region"),this.resizeController=new SeparatorDragController(this,event=>this.onResizerPointerMove(event),event=>this.onResizerPointerUp(event)),this.resizeStartX=0,this.resizeRtl=!1,this.resizeStartWidth=0,this.resizeGestureChanged=!1,this.managedItems=new Set,this.deferredReturnPass=()=>{const candidates=[this.overlayReturnTarget,this.overlayOpener];return{candidates:()=>[...candidates,this.toggleEl],isCurrent:()=>!this.overlayActive,fallback:()=>{this.focusHostFallback()||focusFirstAvailable([this.resolveFocusFallback()])}}},this.onIconOnlyChange=e=>{this.iconOnlyMatches=e.matches,this.forced||this.applyComputedMode()},this.onMobileChange=e=>{this.mobileMatches=e.matches,this.forced||this.applyComputedMode()},this.onToggleClick=e=>{this.open||(this.explicitTrigger=e.currentTarget),this.setOpen(!this.open)},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()},this.acceptsHotkey=event=>{const parsed=this.parsedHotkey;return this.isConnected&&!this.forced&&parsed!==null&&hasNonShiftModifier(parsed)&&matchesHotkey(parsed,event,this.hotkeyIsMac)&&!isEditableKeyEventTarget(event)&&isAccessibilityVisible(this)},this.onHotkeyKeyDown=event=>{if(event.defaultPrevented||isIgnorableKeyEvent(event)||!this.hotkeyWindow)return;const keyboard=event;!this.acceptsHotkey(keyboard)||resolveHotkeyOwner(this.hotkeyWindow,keyboard)!==this||(event.preventDefault(),this.toggle())},this.onPanelTransition=event=>{event.target===event.currentTarget&&event.propertyName==="transform"&&this.baseEl?.removeAttribute("data-sliding")},this.onCollapseToggleClick=()=>{this.toggleCollapse()},this.onNavItemClick=event=>{this.overlayActive&&(event.composedPath().some(node=>isHtmlElement(node)&&node.matches(NON_NAVIGATION_CLICK))||this.setOpen(!1))},this.onHeaderSlotChange=()=>{this.hasHeaderSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="header")},this.onFooterSlotChange=()=>{this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer")},this.onNavSlotChange=()=>{this.syncSlottedItems()},this.onResizerPointerDown=e=>{if(!e.isPrimary||e.button!==0||!this.resizable||this._mode!=="full"||this.resizePointerId!==void 0)return;const resizer=e.currentTarget;this.resizeController.start(e,resizer)&&(this.resizePointerId=e.pointerId,this.resizeStartX=e.clientX,this.resizeRtl=isRtl(this),this.resizeStartWidth=this.effectiveRailWidthPx,this.resizeGestureChanged=!1,this.setDragging(!0))},this.onResizerPointerMove=e=>{if(e.pointerId!==this.resizePointerId)return;if(!this.resizable||this._mode!=="full"||isRtl(this)!==this.resizeRtl){this.endResizerGesture();return}const delta=separatorDelta(this.resizeStartX,e,"inline",this.resizeRtl),next=Math.min(this.safeMaxRailWidthPx,Math.max(this.safeMinRailWidthPx,this.resizeStartWidth+delta));this.requestRailResize(next,!1)},this.onResizerPointerUp=e=>{e.pointerId===this.resizePointerId&&this.endResizerGesture(e.type==="pointerup")},this.onResizerKeyDown=e=>{if(e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const rtl=this.getAttribute("dir")==="rtl"||isRtl(this),direction=separatorArrowDirection(e,"inline",rtl),step=8,width=this.effectiveRailWidthPx,next=direction===1?Math.min(this.safeMaxRailWidthPx,width+step):direction===-1?Math.max(this.safeMinRailWidthPx,width-step):e.key==="Home"?this.safeMinRailWidthPx:e.key==="End"?this.safeMaxRailWidthPx:width;next!==width&&(e.preventDefault(),this.requestRailResize(next))},new GlassScrollLayer(this,'[part="base"], [part="panel"]')}static{this.knownUnobservedAttributes=["mode","dragging","peeking"]}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,modalHostStyles,styles]}get frame(){return this._frame}set frame(next){const value=APP_RAIL_FRAME.normalizeReflected(this,"frame",next),old=this._frame;value!==old&&(this._frame=value,this.requestUpdate("frame",old))}get forceMode(){return this._forceMode}set forceMode(next){if(next!=null&&next!=="auto"&&next!=="full"&&next!=="icon-only")return;const old=this._forceMode;if(this._forceMode=next??void 0,this.requestUpdate("forceMode",old),next==null||next==="auto"){if(!this.forced)return;this.forced=!1,this.applyComputedMode();return}this.forced=!0,this.setEffectiveMode(next)}static{definePersistedProperty(this.prototype,"open",{initial:!1,attribute:!0,type:Boolean,reflect:!0}),definePersistedProperty(this.prototype,"preferredMode",{initial:void 0,attribute:"preferred-mode"}),definePersistedProperty(this.prototype,"railWidth",{initial:void 0,attribute:"rail-width",converter:RAIL_WIDTH_CONVERTER})}pixelsOf(value){return typeof value=="number"?value:typeof value=="string"?resolveCssLength(value,{host:this}):void 0}get railWidthInPixels(){const width=this.railWidth;return typeof width=="string"?this.pixelsOf(width):width}get dragging(){return this._dragging}setDragging(next){this._dragging=next,this.toggleAttribute("dragging",next)}get peeking(){return this._peeking}get peekEligible(){return this.autoHide&&this._mode==="icon-only"&&this.isConnected}get modePreference(){return this.autoHide?this.preferredMode??"icon-only":this.preferredMode}clearPeekOpen(){this.peekOpenTimer!==void 0&&(clearTimeout(this.peekOpenTimer),this.peekOpenTimer=void 0)}clearPeekClose(){this.peekCloseTimer!==void 0&&(clearTimeout(this.peekCloseTimer),this.peekCloseTimer=void 0)}setPeeking(next,options){this._peeking===next||next&&!this.peekEligible||(this._peeking=next,this.toggleAttribute("peeking",next),next?this.peekHandle=activateOverlay({host:this,panel:()=>this.baseEl??null,modal:!1,trapFocus:!1,onEscape:()=>this.dismissPeek()}):(this.peekHandle?.deactivate({restoreFocus:!1}),this.peekHandle=void 0),options?.silent||this.emit("lr-peek-change",{peeking:next}))}resetPeek(options){this.clearPeekOpen(),this.clearPeekClose(),this.peekPointerInside=!1,this.peekKeyboardFocusInside=!1,this.peekPointerSeen=void 0,this.peekDismissed=!1,this.peekAfterUnpin=!1,this.setPeeking(!1,options)}dismissPeek(){this.peekDismissed=!0,this.clearPeekOpen(),this.clearPeekClose(),this.setPeeking(!1)}startPeekOpen(immediate=!1){if(this.clearPeekClose(),this._peeking||this.peekOpenTimer!==void 0||this.peekDismissed||!this.peekEligible)return;const delay=immediate?0:finiteDuration(this.peekOpenDelay,150),open=()=>{(this.peekPointerInside||this.peekKeyboardFocusInside)&&this.setPeeking(!0)};if(delay===0){open();return}this.peekOpenTimer=setTimeout(()=>{this.peekOpenTimer=void 0,open()},delay)}startPeekClose(){this.clearPeekOpen(),!(!this._peeking||this.peekCloseTimer!==void 0)&&(this.peekPointerInside||this.peekKeyboardFocusInside||(this.peekCloseTimer=setTimeout(()=>{this.peekCloseTimer=void 0,!this.peekPointerInside&&!this.peekKeyboardFocusInside&&this.setPeeking(!1)},finiteDuration(this.peekCloseDelay,300))))}syncSlottedItems(){const slot=this.shadowRoot?.querySelector('[part="nav"] > slot'),itemTag=tag("app-rail-item"),groupTag=tag("app-rail-group"),railTag=tag("app-rail"),next=new Set((slot?.assignedElements({flatten:!0})??[]).filter(item=>item.localName===itemTag||item.localName===groupTag));for(const item of this.managedItems){if(next.has(item))continue;const newOwner=item.closest(railTag);newOwner&&newOwner!==this&&item.parentElement===newOwner&&!item.hasAttribute("slot")?item.toggleAttribute("icon-only",newOwner.mode==="icon-only"):item.removeAttribute("icon-only")}for(const item of next)item.toggleAttribute("icon-only",this._mode==="icon-only"&&!this._peeking);this.managedItems=next}get mode(){return this._mode}get safeMinRailWidthPx(){return finiteRange(this.pixelsOf(this.minRailWidth)??Number.NaN,190,0)}get safeMaxRailWidthPx(){return Math.max(this.safeMinRailWidthPx,finiteRange(this.pixelsOf(this.maxRailWidth)??Number.NaN,440,0))}get effectiveRailWidthPx(){return this.railWidth!=null?finiteRange(this.railWidthInPixels??Number.NaN,this.safeMinRailWidthPx,this.safeMinRailWidthPx,this.safeMaxRailWidthPx):this.baseEl?.getBoundingClientRect().width??240}resizeValueText(widthPx){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(widthPx))})}get storageFullKey(){return this.storageKey?`lr-app-rail:${this.storageKey}`:void 0}get persistFields(){const persist=typeof this.persist=="string"?this.persist:"";return new Set(persist.split(/\s+/).filter(field=>APP_RAIL_PERSIST_FIELDS.has(field)))}loadPersisted(){const restored={open:!1,preferredMode:!1},parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);if(!parsed)return restored;const fields=this.persistFields;return fields.has("open")&&!isPersistedPropertyExplicitlySet(this,"open")&&typeof parsed.open=="boolean"&&(this.open=parsed.open,restored.open=!0),fields.has("width")&&!isPersistedPropertyExplicitlySet(this,"railWidth")&&typeof parsed.railWidthPx=="number"&&Number.isFinite(parsed.railWidthPx)&&(this.railWidth=parsed.railWidthPx),fields.has("preferred-mode")&&!isPersistedPropertyExplicitlySet(this,"preferredMode")&&(parsed.preferredMode==="full"||parsed.preferredMode==="icon-only")&&(this.preferredMode=parsed.preferredMode,restored.preferredMode=!0),restored}persistState(){const fields=this.persistFields;if(fields.size===0)return;const state2={};fields.has("open")&&(state2.open=this.open),fields.has("width")&&(state2.railWidthPx=this.railWidthInPixels),fields.has("preferred-mode")&&(state2.preferredMode=this.preferredMode??null),writePersistedState(this.storageFullKey,state2)}willUpdate(changed){if(super.willUpdate(changed),(changed.has("resizable")||changed.has("mode"))&&(!this.resizable||this._mode!=="full")&&this.endResizerGesture(),!this.hasUpdated){this.hasHeaderSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="header"),this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer");const restored=this.loadPersisted();if(restored.preferredMode&&!this.forced){const restoredMode=computeAppRailMode(this.iconOnlyMatches,this.mobileMatches,this.modePreference);restoredMode!==this._mode&&(this._mode=restoredMode,this.pendingInitialModeAnnouncement=restoredMode)}restored.open&&this.open&&this._mode!=="mobile"&&(this.open=!1)}if(this.hasUpdated&&(changed.has("iconOnlyBreakpoint")||changed.has("mobileBreakpoint"))&&(this.teardownMediaQueries(),this.setupMediaQueries()),changed.has("autoHide")&&!this.forced&&(this.hasUpdated||this.autoHide)&&this.applyComputedMode(this.hasUpdated?void 0:{silent:!0}),this.hasUpdated&&changed.has("preferredMode")&&!this.forced&&this.applyComputedMode(),changed.has("autoHide")&&!this.autoHide&&this.resetPeek(),this.peekAfterUnpin&&(this.peekAfterUnpin=!1,changed.has("preferredMode")&&this.setPeeking(!0)),changed.has("open")||changed.has("mode")){const next=this._mode==="mobile"&&this.open;next!==this.overlayActive&&(this.hasUpdated&&this._mode==="mobile"&&!prefersReducedMotion(this)&&this.baseEl?.toggleAttribute("data-sliding",!0),this.overlayActive=next,this.placeToggle(next),next?(this.justOpened=!0,this.activateMobileOverlay()):this.deactivateMobileOverlay(this._mode==="mobile"))}}updated(changed){if(super.updated(changed),this.overlayActive&&(this.overlayHandle?.resume(),this.modalSurface.show()),changed.has("topLayer"))for(const item of this.querySelectorAll(tag("app-rail-item")))item.syncRailTopLayer?.();if(this._lastReflectedMode!==this._mode&&(this._lastReflectedMode=this._mode,this.setAttribute("mode",this._mode)),this.pendingInitialModeAnnouncement!==void 0){const mode=this.pendingInitialModeAnnouncement;this.pendingInitialModeAnnouncement=void 0,this.emit("lr-mode-change",{mode})}if(this.syncSlottedItems(),this.placeToggle(this.overlayActive),this.syncExternalTriggerA11y(),this.syncBuiltInKeyShortcuts(),this.baseEl&&(this._mode!=="mobile"||!this.baseEl.getAnimations().some(animation=>"transitionProperty"in animation&&animation.transitionProperty==="transform"))&&this.baseEl.removeAttribute("data-sliding"),this.recoverInlineFocusAfterResponsiveClose){this.recoverInlineFocusAfterResponsiveClose=!1;const active=deepActiveElement(this.ownerDocument);this.baseEl&&!composedContains(this.baseEl,active)&&this.baseEl.focus()}this.justOpened&&(this.justOpened=!1,this.overlayHandle?.focusInitial()),this.persistReady&&(changed.has("open")||changed.has("railWidth")&&!this.dragging||changed.has("preferredMode")||changed.has("persist"))&&this.persistState(),this.persistReady=!0,this.baseEl&&(this.resizable&&this.railWidth!=null&&this._mode==="full"?this.baseEl.style.setProperty("inline-size",`${this.effectiveRailWidthPx}px`):this.baseEl.style.removeProperty("inline-size"),this._peeking&&this.resizable&&this.railWidth!=null?this.baseEl.style.setProperty("--_lr-app-rail-peek-width",`${this.effectiveRailWidthPx}px`):this.baseEl.style.removeProperty("--_lr-app-rail-peek-width")),this.observeResizerPosition(),this.syncResizerPosition()}connectedCallback(){if(super.connectedCallback(),this.hotkeyPlatform=void 0,this.hotkeyWindow=this.ownerDocument.defaultView??void 0,this.hotkeyWindow&&(registerHotkeyOwner(this.hotkeyWindow,this,this.acceptsHotkey),this.hotkeyWindow.addEventListener("keydown",this.onHotkeyKeyDown)),this.setupMediaQueries(),this.hasUpdated&&this._mode==="mobile"&&this.open){this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateMobileOverlay();const document=this.ownerDocument;queueMicrotask(()=>{!this.isConnected||this.ownerDocument!==document||this._mode!=="mobile"||!this.open||(this.modalSurface.show(),this.overlayHandle?.focusInitial())})}this.hasUpdated&&queueMicrotask(()=>{this.isConnected&&(this.syncSlottedItems(),this.observeResizerPosition(),this.syncResizerPosition(),this.syncExternalTriggerA11y())})}disconnectedCallback(){this.resetPeek({silent:!0}),this.disconnectResizerPosition(),this.modalSurface.disconnect(),this.hotkeyWindow&&(this.hotkeyWindow.removeEventListener("keydown",this.onHotkeyKeyDown),unregisterHotkeyOwner(this.hotkeyWindow,this),this.hotkeyWindow=void 0),this.baseEl?.removeAttribute("data-sliding"),cancelDeferredFocusReturn(this),super.disconnectedCallback(),this.restoreFallbackTabIndex?.(),this.teardownMediaQueries(),this.overlayHandle?.suspend(),this.endResizerGesture(),this.releaseExternalTriggerA11y()}adoptedCallback(){this.resetPeek({silent:!0}),this.disconnectResizerPosition(),super.adoptedCallback(),this.teardownMediaQueries(),this.endResizerGesture()}resolveExternalTrigger(){if(this.trigger)return this.trigger;if(!this.for)return null;const found=this.getRootNode().getElementById?.(this.for);return found instanceof HTMLElement?found:null}resolveFocusFallback(){const value=this.focusFallback;if(!value)return null;const target=typeof value=="string"?this.getRootNode().getElementById?.(value)??null:value;return isHtmlElement(target)&&target.ownerDocument===this.ownerDocument?target:null}activateMobileOverlay(){this.modalSurface.prepare();const explicitTrigger=this.explicitTrigger;this.explicitTrigger=void 0;const restoreFocusTo=explicitTrigger??this.resolveExternalTrigger()??void 0;this.overlayReturnIsExplicit=explicitTrigger!==void 0;const active=deepActiveElement(this.ownerDocument);this.overlayOpener=active&&typeof active.focus=="function"&&!composedContains(this,active)?active:null,this.overlayReturnTarget=restoreFocusTo??this.overlayOpener,this.overlayHandle=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part="panel"]')??null,onEscape:()=>this.setOpen(!1),onBackdrop:()=>this.setOpen(!1),restoreFocusTo,preferredInitialFocus:()=>{const panel=this.shadowRoot?.querySelector('[part="panel"]')??null;if(!panel)return null;const toggle=this.toggleEl??null;return collectFocusableElements(panel).filter(stop=>stop!==toggle)[0]??panel},lockScroll:!0,suspendWhenUnrendered:!0,deferredReturn:this.deferredReturnPass})}deactivateMobileOverlay(restoreFocus=!0){this.modalSurface.hide(),this.nativeModal.prepare(!1);const handle=this.overlayHandle;if(this.overlayHandle=void 0,handle&&restoreFocus&&!this.overlayReturnIsExplicit){const external=this.resolveExternalTrigger();external&&external!==this.overlayReturnTarget&&(this.overlayReturnTarget=external,handle.updateRestoreFocusTo(external))}handle?.deactivate({restoreFocus})}focusHostFallback(){if(!this.hasAttribute("tabindex")){this.setAttribute("tabindex","-1");const view=this.ownerDocument.defaultView,onFocusChange=()=>{deepActiveElement(this.ownerDocument)!==this&&restore()},restore=()=>{this.removeEventListener("blur",onFocusChange),view?.removeEventListener("focus",onFocusChange),this.getAttribute("tabindex")==="-1"&&this.removeAttribute("tabindex"),this.restoreFallbackTabIndex=void 0};this.restoreFallbackTabIndex=restore,this.addEventListener("blur",onFocusChange),view?.addEventListener("focus",onFocusChange)}return focusFirstAvailable(this)?!0:(this.restoreFallbackTabIndex?.(),!1)}placeToggle(insidePanel){const toggle=this.toggleEl,panel=this.baseEl;if(!(!toggle||!panel)){if(insidePanel){panel.firstChild!==toggle&&panel.insertBefore(toggle,panel.firstChild);return}toggle.nextSibling!==panel&&panel.parentNode?.insertBefore(toggle,panel)}}setupMediaQueries(){if(!this.isConnected)return;const view=this.ownerDocument.defaultView;if(!view?.matchMedia)return;const iconOnlyQuery=view.matchMedia(`(max-width: ${this.iconOnlyBreakpoint})`),mobileQuery=view.matchMedia(`(max-width: ${this.mobileBreakpoint})`),iconOnlyListener=event=>{this.mqIconOnly!==iconOnlyQuery||!this.isConnected||this.ownerDocument.defaultView!==view||this.onIconOnlyChange(event)},mobileListener=event=>{this.mqMobile!==mobileQuery||!this.isConnected||this.ownerDocument.defaultView!==view||this.onMobileChange(event)};this.mqIconOnly=iconOnlyQuery,this.mqMobile=mobileQuery,this.mqIconOnlyListener=iconOnlyListener,this.mqMobileListener=mobileListener,iconOnlyQuery.addEventListener("change",iconOnlyListener),mobileQuery.addEventListener("change",mobileListener),this.iconOnlyMatches=iconOnlyQuery.matches,this.mobileMatches=mobileQuery.matches,!this.forced&&this.applyComputedMode(this.hasUpdated?void 0:{silent:!0})}teardownMediaQueries(){this.mqIconOnly&&this.mqIconOnlyListener&&this.mqIconOnly.removeEventListener("change",this.mqIconOnlyListener),this.mqMobile&&this.mqMobileListener&&this.mqMobile.removeEventListener("change",this.mqMobileListener),this.mqIconOnly=void 0,this.mqMobile=void 0,this.mqIconOnlyListener=void 0,this.mqMobileListener=void 0}applyComputedMode(options){this.setEffectiveMode(computeAppRailMode(this.iconOnlyMatches,this.mobileMatches,this.modePreference),options)}setEffectiveMode(next,options){if(this._mode===next)return;const old=this._mode,resizer=this.renderRoot?.querySelector('[part="resizer"]');old==="full"&&next==="icon-only"&&resizer&&composedContains(resizer,deepActiveElement(this.ownerDocument))&&(this.recoverInlineFocusAfterResponsiveClose=!0),next!=="mobile"&&this.baseEl?.removeAttribute("data-sliding"),old==="mobile"&&next!=="mobile"&&this.open&&(this.recoverInlineFocusAfterResponsiveClose=!0),this._mode=next,next!=="icon-only"&&(this.clearPeekOpen(),this.clearPeekClose(),this.setPeeking(!1)),this.baseEl&&(this.resizable&&this.railWidth!=null&&next==="full"||this.baseEl.style.removeProperty("inline-size")),this.requestUpdate("mode",old),options?.silent?this.pendingInitialModeAnnouncement=next:this.emit("lr-mode-change",{mode:next}),next!=="mobile"&&this.open&&this.setOpen(!1,{force:!0})}setOpen(next,options){if(this.open===next)return;if(options?.force){this.open=next,this.emit("lr-toggle",{expanded:next});return}const mode=this._mode,open=this.open;this.emit("lr-toggle-request",{expanded:next},{cancelable:!0}).defaultPrevented||this._mode!==mode||this.open!==open||(this.open=next,this.emit("lr-toggle",{expanded:next}))}toggleCollapse(){this._mode!=="mobile"&&(this.preferredMode=(this.preferredMode??this._mode)==="icon-only"?"full":"icon-only")}toggle(){this.isConnected&&(this._mode==="mobile"?this.setOpen(!this.open):this.toggleCollapse())}get parsedHotkey(){const value=this.hotkey;if(this.hotkeyMemo&&this.hotkeyMemo.value===value)return this.hotkeyMemo.parsed;const parsed=parseHotkey(value);return this.hotkeyMemo={value,parsed},parsed}get hotkeyIsMac(){const view=this.ownerDocument.defaultView;if(this.hotkeyPlatform&&this.hotkeyPlatform.view===view)return this.hotkeyPlatform.mac;const mac=detectPlatform(view?.navigator)==="mac";return this.hotkeyPlatform={view,mac},mac}get resolvedHotkeyShortcuts(){const parsed=this.parsedHotkey;return hotkeyAriaKeyShortcuts(parsed&&hasNonShiftModifier(parsed)?parsed:null,this.hotkeyIsMac)}syncBuiltInKeyShortcuts(){const value=this.resolvedHotkeyShortcuts;for(const control of[this.toggleEl,this.renderRoot.querySelector('[part="collapse-toggle"]'),this.renderRoot.querySelector('[part="pin-button"]')])!control||control.getAttribute("aria-keyshortcuts")===value||(value===null?control.removeAttribute("aria-keyshortcuts"):control.setAttribute("aria-keyshortcuts",value))}syncExternalTriggerA11y(){if(!this.isConnected){this.releaseExternalTriggerA11y();return}const mobile=this._mode==="mobile",trigger=mobile||this.triggerCollapses?this.resolveExternalTrigger():null;if(!trigger){this.releaseExternalTriggerA11y();return}const panel=this.baseEl??null,contribution={attributes:{"aria-expanded":(mobile?this.open:this._mode==="full")?"true":"false","aria-keyshortcuts":this.resolvedHotkeyShortcuts},controls:panel?[panel]:[]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution)}releaseExternalTriggerA11y(){this.triggerAria?.release(),this.triggerAria=void 0}endResizerGesture(commit=!1){const pointerId=this.resizePointerId,changed=this.resizeGestureChanged,widthPx=this.effectiveRailWidthPx;this.resizePointerId=void 0,this.resizeGestureChanged=!1,this.setDragging(!1),pointerId!==void 0&&this.resizeController.end(pointerId),commit&&changed&&(this.emit("lr-rail-resize",{widthPx}),this.persistReady&&this.persistState())}requestRailResize(next,commit=!0){if(!this.resizable||this._mode!=="full"||!this.isConnected||next===this.effectiveRailWidthPx)return!1;const event=this.emit("lr-rail-resize-request",{widthPx:next},{cancelable:!0});return!this.resizable||this._mode!=="full"||!this.isConnected?(this.endResizerGesture(),!1):event.defaultPrevented?!1:(this.railWidth=next,commit?this.emit("lr-rail-resize",{widthPx:next}):this.resizeGestureChanged=!0,!0)}observeResizerPosition(){const resizer=this.renderRoot.querySelector('[part="resizer"]');if(!this.isConnected||!resizer||!this.baseEl||this._mode!=="full"||!this.resizable){this.disconnectResizerPosition();return}if(this.observedResizer===resizer)return;this.disconnectResizerPosition();const ResizeObserverConstructor=this.ownerDocument.defaultView?.ResizeObserver;ResizeObserverConstructor&&(this.resizerPositionObserver=new ResizeObserverConstructor(()=>this.syncResizerPosition()),this.resizerPositionObserver.observe(this,{box:"border-box"}),this.resizerPositionObserver.observe(this.baseEl,{box:"border-box"}),this.resizerPositionObserver.observe(resizer,{box:"border-box"}),this.observedResizer=resizer)}disconnectResizerPosition(){this.resizerPositionObserver?.disconnect(),this.resizerPositionObserver=void 0,this.observedResizer=void 0}syncResizerPosition(){const resizer=this.renderRoot.querySelector('[part="resizer"]');if(!resizer||!this.baseEl||this._mode!=="full"||!this.resizable)return;const hostRect=this.getBoundingClientRect(),baseRect=this.baseEl.getBoundingClientRect(),half=resizer.getBoundingClientRect().width/2,offset=this.getAttribute("dir")==="rtl"||isRtl(this)?hostRect.right-baseRect.left:baseRect.right-hostRect.left;resizer.style.setProperty("inset-inline-start",`${offset-half}px`),resizer.style.setProperty("inset-inline-end","auto")}renderResizer(){const railWidthPx=this.effectiveRailWidthPx;return html`<div
2
2
  part="resizer"
3
3
  role="separator"
4
4
  aria-orientation="vertical"
@@ -26,6 +26,9 @@ readonly expanded:boolean;}export interface LyraMultiSplitResizeDetail{readonly
26
26
  * (`min-block-size: 0; overflow: auto`) so long content stays within the
27
27
  * split instead of escaping into following content. Set an individual
28
28
  * panel's own `overflow` when it needs a different scrolling surface.
29
+ * The floating drawer enters the browser top layer while retaining this split's allocation.
30
+ * An intrinsically sized split reserves its opening block-size footprint until the drawer closes;
31
+ * definite parent allocations, scrolling, and resizing continue to position the same pane tree.
29
32
  *
30
33
  * Optionally, one pane can opt in to responsive collapse via `collapse`
31
34
  * (`"start"`/`"end"`, default `"none"` — no behavior change when unset): as
@@ -317,7 +320,7 @@ for:string;
317
320
  * and the total panel count (`lr-multi-split` supports N panels, so a single fixed string can't
318
321
  * express every divider's label; a function can). Unset (the default) keeps today's exact
319
322
  * localized `Resize divider between panel {a} and panel {b}` template (see `this.localize()`). */
320
- dividerLabel?:(index:number,panelCount:number)=>string;private panelCount;private sizesReconciledForMembership;private _collapseState;private _forced;private pinnedBand?;private overlayActive;private justOpened;private overlayHandle?;private readonly nativeModal;private nativeModalView?;private nativeModalResizeObserver?;private stopNativeModalGeometry;private nativeModalLabel;private readonly syncNativeModalGeometry;private triggerAria?;private triggerPanel?;private generatedTriggerPanelId?;private overlayReturnTarget;private overlayOpener;private floatingDialogPanel;private floatingDialogPreviousRole;private floatingDialogPreviousAriaModal;private drags;private readonly dragController;private ownedPanels;private readonly panelOwnership;private panelOwnershipObserver?;private constraintIssueKey;private constraintConfigVersion;private renderConstraintBounds;private initializedSizes;private measuredInlineSize;private _effectiveOrientation;private baseEl?;private collapseResizeObserver?;private collapseObservedElement?;private collapseObserverOwnerDocument?;private collapseObserverGeneration;private gutterResizeObserver?;private gutterObserverFrame?;private gutterObserverDocument?;private gutterObservedDividers;private gutterObservedContainerSize;private orientationBreakpoints;private collapseBreakpoints;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected firstUpdated(changed:PropertyValues):void;
323
+ dividerLabel?:(index:number,panelCount:number)=>string;private panelCount;private sizesReconciledForMembership;private _collapseState;private _forced;private pinnedBand?;private overlayActive;private justOpened;private overlayHandle?;private readonly nativeModal;private readonly modalSurface;private nativeModalView?;private nativeModalResizeObserver?;private floatingFrame?;private readonly floatingGeometry;private openingBlockSize;private stopNativeModalGeometry;private nativeModalLabel;private readonly syncNativeModalGeometry;private triggerAria?;private triggerPanel?;private generatedTriggerPanelId?;private overlayReturnTarget;private overlayOpener;private floatingDialogPanel;private floatingDialogPreviousRole;private floatingDialogPreviousAriaModal;private drags;private readonly dragController;private ownedPanels;private readonly panelOwnership;private panelOwnershipObserver?;private constraintIssueKey;private constraintConfigVersion;private renderConstraintBounds;private initializedSizes;private measuredInlineSize;private _effectiveOrientation;private baseEl?;private collapseResizeObserver?;private collapseObservedElement?;private collapseObserverOwnerDocument?;private collapseObserverGeneration;private gutterResizeObserver?;private gutterObserverFrame?;private gutterObserverDocument?;private gutterObservedDividers;private gutterObservedContainerSize;private orientationBreakpoints;private collapseBreakpoints;connectedCallback():void;private seedInlineSize;disconnectedCallback():void;adoptedCallback():void;protected firstUpdated(changed:PropertyValues):void;
321
324
  /** Both branches here derive one reactive property from another with no
322
325
  * DOM measurement involved, so they belong in `willUpdate()` rather than
323
326
  * `updated()`: setting a reactive property from `updated()`/
@@ -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{cancelDeferredFocusReturn}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{SeparatorDragController,separatorArrowDirection,separatorCoordinate,separatorDelta}from"../../../internal/separator-drag.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/layout.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.floatingDialogPanel=null,this.floatingDialogPreviousRole=null,this.floatingDialogPreviousAriaModal=null,this.drags=new Map,this.dragController=new SeparatorDragController(this,event=>this.onPointerMove(event),event=>this.onPointerUp(event)),this.ownedPanels=[],this.panelOwnership=new Map,this.constraintIssueKey="",this.constraintConfigVersion=0,this.renderConstraintBounds=[],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;this.dragController.start(e,divider)&&this.drags.set(e.pointerId,{index,startPos:separatorCoordinate(e,this.effectiveOrientation==="vertical"?"block":"inline"),base:this.baseEl,rtl:this.effectiveOrientation==="horizontal"&&isRtl(this),appliedDelta:0,acceptedResize:!1})},this.onPointerMove=e=>{const drag=this.drags.get(e.pointerId);if(!drag)return;if(this.isDividerDisabled(drag.index)){this.endDragGestures();return}if(this.effectiveOrientation==="horizontal"&&isRtl(this)!==drag.rtl){this.endDragGestures();return}const total=this.effectiveOrientation==="vertical"?drag.base.clientHeight:drag.base.clientWidth;if(!Number.isFinite(total)||total<=0){this.endDragGestures();return}const incremental=separatorDelta(drag.startPos,e,this.effectiveOrientation==="vertical"?"block":"inline",drag.rtl)/total*100-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.settle(),this.dragController.end(e.pointerId))},this.onDividerKeyDown=(e,index)=>{if(this.isDividerDisabled(index)||e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const direction=separatorArrowDirection(e,this.effectiveOrientation==="vertical"?"block":"inline",this.effectiveOrientation==="horizontal"&&isRtl(this));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 direction===1?this.applyDelta(index,KEYBOARD_STEP,!0)&&e.preventDefault():direction===-1&&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","lr-resize-change"])}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(),cancelDeferredFocusReturn(this),this.releaseExternalTriggerA11y(),this.releaseOwnedPanels()}adoptedCallback(){super.adoptedCallback(),cancelDeferredFocusReturn(this),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())}this.renderConstraintBounds=this.resolveConstraintBounds(this.getContainerSize()).bounds}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.renderRoot.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.panelOwnershipObserver?.disconnect(),this.panelOwnershipObserver=void 0}observeOwnedPanels(){this.resetPanelOwnershipObserver();const MutationObserverConstructor=this.ownerDocument.defaultView?.MutationObserver;if(!MutationObserverConstructor||!this.isConnected||this.ownedPanels.length===0)return;const observer=new MutationObserverConstructor(records=>{records.some(record=>{const panel=record.target,snapshot=this.panelOwnership.get(panel);return snapshot?this.panelProjectionDiverged(panel,snapshot):!1})&&this.requestUpdate()});this.panelOwnershipObserver=observer;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}}}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,bounds=this.resolveConstraintBounds(containerSize).bounds,a=bounds[i]??{min:0,max:1/0},b=bounds[i+1]??{min:0,max:1/0},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.settle(),!0)}settle(){this.persist(),this.emit("lr-resize-change",{sizes:[...this.sizes]})}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();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,deferredReturn:()=>{if(!(this.resolveExternalTrigger()||this.trigger||this.for))return;const panel2=this.floatingDialogPanel;return{candidates:()=>[this.resolveExternalTrigger(),this.overlayReturnTarget,this.overlayOpener],stranded:active=>panel2!==null&&composedContains(panel2,active),isCurrent:()=>!this.overlayActive}}})}deactivateFloatingOverlay(){this.stopNativeModalGeometry(),this.nativeModal.hide(),this.nativeModal.prepare(!1);const trigger=this.resolveExternalTrigger(),panel=this.floatingDialogPanel;trigger&&this.overlayHandle?.updateRestoreFocusTo(trigger),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,this.floatingDialogPanel=null,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))}endDragGestures(){this.drags.clear(),this.dragController.cancelAll()}dividerName(index){let label;try{label=this.dividerLabel?.(index,this.panelCount)}catch{}return typeof label=="string"&&label.trim()?label:this.localize("resizeDivider",void 0,{a:getNumberFormat(this.effectiveLocale).format(index+1),b:getNumberFormat(this.effectiveLocale).format(index+2)})}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"),(changed.has("panelConstraints")||changed.has("min"))&&(this.constraintConfigVersion+=1);const constraintResolution=this.resolveConstraintBounds(this.getContainerSize()),issue=constraintResolution.issue,issueKey=issue?`${issue.reason}:${issue.panelCount}:${this.constraintConfigVersion}`:"";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.renderConstraintBounds;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{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{leaseInlineStyleProperty}from"../../../internal/style-property-lease.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{cancelDeferredFocusReturn}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{SeparatorDragController,separatorArrowDirection,separatorCoordinate,separatorDelta}from"../../../internal/separator-drag.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/layout.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.modalSurface.show()}}),this.modalSurface=new ModalSurfaceController(this,this.nativeModal,()=>this.baseEl??null),this.floatingGeometry=new Map,this.openingBlockSize=0,this.syncNativeModalGeometry=()=>{if(!this.overlayActive||!this.isConnected)return;const allocation=this.shadowRoot?.querySelector(".allocation"),reservation=this.shadowRoot?.querySelector(".allocation-reservation"),frame=this.nativeModal.requested?this.shadowRoot?.querySelector("[data-native-modal-carrier]"):this.baseEl;if(!allocation||!reservation||!frame)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(allocation)}}if(this.floatingFrame!==frame){for(const lease of this.floatingGeometry.values())lease.release();this.floatingGeometry.clear(),this.floatingFrame=frame}const set=(property2,value)=>{const lease=this.floatingGeometry.get(property2);lease?(frame.style.getPropertyValue(property2)!==value||frame.style.getPropertyPriority(property2))&&lease.set(value):this.floatingGeometry.set(property2,leaseInlineStyleProperty(frame,property2,value))};if(reservation.hidden){const height=this.baseEl?.getBoundingClientRect().height??0;this.openingBlockSize=height||this.openingBlockSize||allocation.getBoundingClientRect().height,set("position","fixed"),reservation.style.blockSize=`${this.openingBlockSize}px`,reservation.hidden=!1}const rect=allocation.getBoundingClientRect();for(const[property2,value]of Object.entries({position:"fixed",top:`${rect.top}px`,left:`${rect.left}px`,right:"auto",bottom:"auto",width:`${rect.width}px`,height:`${rect.height}px`,padding:"0","box-sizing":"border-box","max-inline-size":"none"}))set(property2,value)},this.overlayReturnTarget=null,this.overlayOpener=null,this.floatingDialogPanel=null,this.floatingDialogPreviousRole=null,this.floatingDialogPreviousAriaModal=null,this.drags=new Map,this.dragController=new SeparatorDragController(this,event=>this.onPointerMove(event),event=>this.onPointerUp(event)),this.ownedPanels=[],this.panelOwnership=new Map,this.constraintIssueKey="",this.constraintConfigVersion=0,this.renderConstraintBounds=[],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;this.dragController.start(e,divider)&&this.drags.set(e.pointerId,{index,startPos:separatorCoordinate(e,this.effectiveOrientation==="vertical"?"block":"inline"),base:this.baseEl,rtl:this.effectiveOrientation==="horizontal"&&isRtl(this),appliedDelta:0,acceptedResize:!1})},this.onPointerMove=e=>{const drag=this.drags.get(e.pointerId);if(!drag)return;if(this.isDividerDisabled(drag.index)){this.endDragGestures();return}if(this.effectiveOrientation==="horizontal"&&isRtl(this)!==drag.rtl){this.endDragGestures();return}const total=this.effectiveOrientation==="vertical"?drag.base.clientHeight:drag.base.clientWidth;if(!Number.isFinite(total)||total<=0){this.endDragGestures();return}const incremental=separatorDelta(drag.startPos,e,this.effectiveOrientation==="vertical"?"block":"inline",drag.rtl)/total*100-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.settle(),this.dragController.end(e.pointerId))},this.onDividerKeyDown=(e,index)=>{if(this.isDividerDisabled(index)||e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const direction=separatorArrowDirection(e,this.effectiveOrientation==="vertical"?"block":"inline",this.effectiveOrientation==="horizontal"&&isRtl(this));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 direction===1?this.applyDelta(index,KEYBOARD_STEP,!0)&&e.preventDefault():direction===-1&&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","lr-resize-change"])}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;for(const lease of this.floatingGeometry.values())lease.release();this.floatingGeometry.clear(),this.floatingFrame=void 0,this.openingBlockSize=0;const reservation=this.shadowRoot?.querySelector(".allocation-reservation");reservation&&(reservation.hidden=!0,reservation.style.removeProperty("block-size"))}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(),this.hasUpdated&&this.responsiveObservationEnabled&&this.seedInlineSize(),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.isConnected||!this.overlayActive||(this.syncNativeModalGeometry(),this.modalSurface.show(),this.overlayHandle?.focusInitial())})),this.hasUpdated&&this.syncExternalTriggerA11y()}seedInlineSize(){const hostWidth=this.getBoundingClientRect().width;hostWidth>0&&(this.measuredInlineSize=hostWidth)}disconnectedCallback(){this.modalSurface.disconnect(),this.stopNativeModalGeometry(),super.disconnectedCallback(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.overlayHandle?.suspend(),cancelDeferredFocusReturn(this),this.releaseExternalTriggerA11y(),this.releaseOwnedPanels()}adoptedCallback(){super.adoptedCallback(),cancelDeferredFocusReturn(this),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),!this.hasUpdated&&this.isConnected&&this.responsiveObservationEnabled&&this.seedInlineSize(),(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())}this.renderConstraintBounds=this.resolveConstraintBounds(this.getContainerSize()).bounds}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.renderRoot.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.panelOwnershipObserver?.disconnect(),this.panelOwnershipObserver=void 0}observeOwnedPanels(){this.resetPanelOwnershipObserver();const MutationObserverConstructor=this.ownerDocument.defaultView?.MutationObserver;if(!MutationObserverConstructor||!this.isConnected||this.ownedPanels.length===0)return;const observer=new MutationObserverConstructor(records=>{records.some(record=>{const panel=record.target,snapshot=this.panelOwnership.get(panel);return snapshot?this.panelProjectionDiverged(panel,snapshot):!1})&&this.requestUpdate()});this.panelOwnershipObserver=observer;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}}}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,bounds=this.resolveConstraintBounds(containerSize).bounds,a=bounds[i]??{min:0,max:1/0},b=bounds[i+1]??{min:0,max:1/0},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.settle(),!0)}settle(){this.persist(),this.emit("lr-resize-change",{sizes:[...this.sizes]})}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.openingBlockSize=this.baseEl?.getBoundingClientRect().height??0,this.modalSurface.prepare();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,deferredReturn:()=>{if(!(this.resolveExternalTrigger()||this.trigger||this.for))return;const panel2=this.floatingDialogPanel;return{candidates:()=>[this.resolveExternalTrigger(),this.overlayReturnTarget,this.overlayOpener],stranded:active=>panel2!==null&&composedContains(panel2,active),isCurrent:()=>!this.overlayActive}}})}deactivateFloatingOverlay(){this.modalSurface.hide(),this.stopNativeModalGeometry(),this.nativeModal.prepare(!1);const trigger=this.resolveExternalTrigger(),panel=this.floatingDialogPanel;trigger&&this.overlayHandle?.updateRestoreFocusTo(trigger),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,this.floatingDialogPanel=null,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))}endDragGestures(){this.drags.clear(),this.dragController.cancelAll()}dividerName(index){let label;try{label=this.dividerLabel?.(index,this.panelCount)}catch{}return typeof label=="string"&&label.trim()?label:this.localize("resizeDivider",void 0,{a:getNumberFormat(this.effectiveLocale).format(index+1),b:getNumberFormat(this.effectiveLocale).format(index+2)})}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.modalSurface.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"),(changed.has("panelConstraints")||changed.has("min"))&&(this.constraintConfigVersion+=1);const constraintResolution=this.resolveConstraintBounds(this.getContainerSize()),issue=constraintResolution.issue,issueKey=issue?`${issue.reason}:${issue.panelCount}:${this.constraintConfigVersion}`:"";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.renderConstraintBounds;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.dividerName(i)}
@@ -12,9 +12,12 @@ import{__decorate}from"tslib";import{resolveIdReferencesIn}from"../../../interna
12
12
  style=${`order:${i*2+1}`}
13
13
  @pointerdown=${e=>this.onPointerDown(e,i)}
14
14
  @keydown=${e=>this.onDividerKeyDown(e,i)}
15
- ></div>`)}const showBackdrop=this.collapseState==="floating"&&this.open;return this.nativeModal.render(html`<div part="base" @click=${this.onModalLayerClick}>
15
+ ></div>`)}const showBackdrop=this.collapseState==="floating"&&this.open;return html`<div class="allocation">
16
+ <div class="allocation-reservation" aria-hidden="true" inert hidden></div>
17
+ ${this.nativeModal.render(html`<div part="base" @click=${this.onModalLayerClick}>
16
18
  <slot @slotchange=${this.onSlotChange}></slot>
17
19
  ${this.nativeModal.renderHelperSlot()}
18
20
  ${dividers}
19
21
  ${showBackdrop?html`<div part="backdrop" @click=${this.onBackdropClick}></div>`:nothing}
20
- </div>`,{label:this.nativeModalLabel()})}}__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"sizes",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"defaultSizes",void 0),__decorate([property({type:Number})],LyraMultiSplit.prototype,"min",void 0),__decorate([property({reflect:!0})],LyraMultiSplit.prototype,"orientation",void 0),__decorate([property({attribute:"orientation-breakpoint"})],LyraMultiSplit.prototype,"orientationBreakpoint",void 0),__decorate([property({reflect:!0,attribute:"orientation-breakpoint-basis"})],LyraMultiSplit.prototype,"orientationBreakpointBasis",void 0),__decorate([property({reflect:!0,attribute:"narrow-orientation"})],LyraMultiSplit.prototype,"narrowOrientation",void 0),__decorate([property({attribute:"storage-key"})],LyraMultiSplit.prototype,"storageKey",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"panelConstraints",void 0),__decorate([property({reflect:!0})],LyraMultiSplit.prototype,"collapse",void 0),__decorate([property({attribute:"rail-width"})],LyraMultiSplit.prototype,"railWidth",void 0),__decorate([property({attribute:"rail-breakpoint"})],LyraMultiSplit.prototype,"railBreakpoint",void 0),__decorate([property({attribute:"float-breakpoint"})],LyraMultiSplit.prototype,"floatBreakpoint",void 0),__decorate([property({reflect:!0,attribute:"collapse-breakpoint-basis"})],LyraMultiSplit.prototype,"collapseBreakpointBasis",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"release-pin-on-breakpoint"})],LyraMultiSplit.prototype,"releasePinOnBreakpoint",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMultiSplit.prototype,"open",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"trigger",void 0),__decorate([property()],LyraMultiSplit.prototype,"for",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"dividerLabel",void 0),__decorate([property({type:Number,attribute:"data-lr-panel-count",reflect:!0})],LyraMultiSplit.prototype,"panelCount",void 0),__decorate([query('[part="base"]')],LyraMultiSplit.prototype,"baseEl",void 0);export{LyraMultiSplit};
22
+ </div>`,{label:this.nativeModalLabel()})}
23
+ </div>`}}__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"sizes",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"defaultSizes",void 0),__decorate([property({type:Number})],LyraMultiSplit.prototype,"min",void 0),__decorate([property({reflect:!0})],LyraMultiSplit.prototype,"orientation",void 0),__decorate([property({attribute:"orientation-breakpoint"})],LyraMultiSplit.prototype,"orientationBreakpoint",void 0),__decorate([property({reflect:!0,attribute:"orientation-breakpoint-basis"})],LyraMultiSplit.prototype,"orientationBreakpointBasis",void 0),__decorate([property({reflect:!0,attribute:"narrow-orientation"})],LyraMultiSplit.prototype,"narrowOrientation",void 0),__decorate([property({attribute:"storage-key"})],LyraMultiSplit.prototype,"storageKey",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"panelConstraints",void 0),__decorate([property({reflect:!0})],LyraMultiSplit.prototype,"collapse",void 0),__decorate([property({attribute:"rail-width"})],LyraMultiSplit.prototype,"railWidth",void 0),__decorate([property({attribute:"rail-breakpoint"})],LyraMultiSplit.prototype,"railBreakpoint",void 0),__decorate([property({attribute:"float-breakpoint"})],LyraMultiSplit.prototype,"floatBreakpoint",void 0),__decorate([property({reflect:!0,attribute:"collapse-breakpoint-basis"})],LyraMultiSplit.prototype,"collapseBreakpointBasis",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"release-pin-on-breakpoint"})],LyraMultiSplit.prototype,"releasePinOnBreakpoint",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMultiSplit.prototype,"open",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"trigger",void 0),__decorate([property()],LyraMultiSplit.prototype,"for",void 0),__decorate([property({attribute:!1})],LyraMultiSplit.prototype,"dividerLabel",void 0),__decorate([property({type:Number,attribute:"data-lr-panel-count",reflect:!0})],LyraMultiSplit.prototype,"panelCount",void 0),__decorate([query('[part="base"]')],LyraMultiSplit.prototype,"baseEl",void 0);export{LyraMultiSplit};
@@ -1 +1 @@
1
- import{focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; block-size: 100%; --_lr-multi-split-overlay-color: var(--lr-color-overlay); --_lr-multi-split-divider-target-size: max( var(--lr-icon-button-size), var(--lr-size-3px) ); --_lr-multi-split-divider-thickness: var(--lr-size-3px); --_lr-multi-split-divider-color: var(--lr-color-border); --_lr-multi-split-divider-hover-color: var(--lr-color-brand); --_lr-multi-split-divider-active-color: color-mix( in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="base"] { --_lr-multi-split-panel-min: 0; --_lr-multi-split-gutters: 0; display: flex; position: relative; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; block-size: 100%; } ::slotted(*) { flex: 1 1 0; min-inline-size: var(--_lr-multi-split-panel-min, 0); max-inline-size: 100%; min-block-size: 0; max-block-size: 100%; overflow: auto; overflow-wrap: anywhere; box-sizing: border-box; } ::slotted([hidden]:not([hidden="until-found" i])) { display: none !important; } :host([orientation="vertical"]) [part="base"] { flex-direction: column; } :host([orientation="vertical"]) ::slotted(*), :host([data-effective-orientation="vertical"]) ::slotted(*) { min-inline-size: 0; min-block-size: var(--_lr-multi-split-panel-min, 0); } :host([data-effective-orientation="horizontal"]) ::slotted(*) { min-inline-size: var(--_lr-multi-split-panel-min, 0); min-block-size: 0; } [part="divider"] { position: relative; flex: 0 0 auto; inline-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); min-block-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-block-size: 100%; background: transparent; cursor: col-resize; touch-action: none; } [part="divider"]::before { content: ""; position: absolute; inset-block: 0; inset-inline: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); background: var( --lr-multi-split-divider-color, var(--_lr-multi-split-divider-color) ); pointer-events: none; transition: background-color var(--lr-transition-fast); } :host(:where([orientation="vertical"])) [part="divider"] { inline-size: 100%; min-inline-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-inline-size: 100%; min-block-size: 0; block-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); cursor: row-resize; } :host(:where([orientation="vertical"])) [part="divider"]::before { inset-block: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); inset-inline: 0; } :host([data-effective-orientation="vertical"]) [part="base"] { flex-direction: column; } :host([data-effective-orientation="horizontal"]) [part="base"] { flex-direction: row; } :host(:where([data-effective-orientation="vertical"])) [part="divider"] { inline-size: 100%; min-inline-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-inline-size: 100%; min-block-size: 0; block-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); cursor: row-resize; } :host(:where([data-effective-orientation="vertical"])) [part="divider"]::before { inset-block: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); inset-inline: 0; } :host(:where([data-effective-orientation="horizontal"])) [part="divider"] { inline-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); min-block-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-block-size: 100%; block-size: auto; cursor: col-resize; } :host(:where([data-effective-orientation="horizontal"])) [part="divider"]::before { inset-block: 0; inset-inline: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); } [part="divider"]:hover::before { background: var( --lr-multi-split-divider-hover-color, var(--_lr-multi-split-divider-hover-color) ); } [part="divider"]:active::before { background: var( --lr-multi-split-divider-active-color, var(--_lr-multi-split-divider-active-color) ); } [part="divider"]:focus-visible { ${focusRing} } [part="divider"][aria-disabled="true"] { cursor: default; pointer-events: none; } :host([data-collapse-state="floating"]) [part="divider"][aria-disabled="true"] { flex: 0 0 0; min-inline-size: 0; min-block-size: 0; } :host([data-collapse-state="floating"]) [part="divider"][aria-disabled="true"]::before { content: none; } ::slotted([data-collapse-state="floating"]) { position: absolute; inset-block: var(--lr-multi-split-floating-panel-inset, 0); z-index: var(--lr-layer-content); background: var(--lr-color-surface); border-radius: var(--lr-radius); box-shadow: var(--lr-shadow-l); } :host([collapse="start"]) ::slotted([data-collapse-state="floating"]) { inset-inline-start: var(--lr-multi-split-floating-panel-inset, 0); } :host([collapse="end"]) ::slotted([data-collapse-state="floating"]) { inset-inline-end: var(--lr-multi-split-floating-panel-inset, 0); } [part="backdrop"] { position: absolute; inset: 0; z-index: var(--lr-layer-base); background: var( --lr-multi-split-overlay-color, var(--_lr-multi-split-overlay-color) ); } ::slotted([data-collapse-state="rail"]) { overflow: hidden; } `;export{styles};
1
+ import{focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; block-size: 100%; --_lr-multi-split-overlay-color: var(--lr-color-overlay); --_lr-multi-split-divider-target-size: max( var(--lr-icon-button-size), var(--lr-size-3px) ); --_lr-multi-split-divider-thickness: var(--lr-size-3px); --_lr-multi-split-divider-color: var(--lr-color-border); --_lr-multi-split-divider-hover-color: var(--lr-color-brand); --_lr-multi-split-divider-active-color: color-mix( in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } .allocation { inline-size: 100%; block-size: 100%; min-inline-size: 0; min-block-size: 0; } .allocation-reservation { max-block-size: 100%; pointer-events: none; } .allocation-reservation[hidden] { display: none; } [part="base"] { --_lr-multi-split-panel-min: 0; --_lr-multi-split-gutters: 0; display: flex; position: relative; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; block-size: 100%; } ::slotted(*) { flex: 1 1 0; min-inline-size: var(--_lr-multi-split-panel-min, 0); max-inline-size: 100%; min-block-size: 0; max-block-size: 100%; overflow: auto; overflow-wrap: anywhere; box-sizing: border-box; } ::slotted([hidden]:not([hidden="until-found" i])) { display: none !important; } :host([orientation="vertical"]) [part="base"] { flex-direction: column; } :host([orientation="vertical"]) ::slotted(*), :host([data-effective-orientation="vertical"]) ::slotted(*) { min-inline-size: 0; min-block-size: var(--_lr-multi-split-panel-min, 0); } :host([data-effective-orientation="horizontal"]) ::slotted(*) { min-inline-size: var(--_lr-multi-split-panel-min, 0); min-block-size: 0; } [part="divider"] { position: relative; flex: 0 0 auto; inline-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); min-block-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-block-size: 100%; background: transparent; cursor: col-resize; touch-action: none; } [part="divider"]::before { content: ""; position: absolute; inset-block: 0; inset-inline: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); background: var( --lr-multi-split-divider-color, var(--_lr-multi-split-divider-color) ); pointer-events: none; transition: background-color var(--lr-transition-fast); } :host(:where([orientation="vertical"])) [part="divider"] { inline-size: 100%; min-inline-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-inline-size: 100%; min-block-size: 0; block-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); cursor: row-resize; } :host(:where([orientation="vertical"])) [part="divider"]::before { inset-block: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); inset-inline: 0; } :host([data-effective-orientation="vertical"]) [part="base"] { flex-direction: column; } :host([data-effective-orientation="horizontal"]) [part="base"] { flex-direction: row; } :host(:where([data-effective-orientation="vertical"])) [part="divider"] { inline-size: 100%; min-inline-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-inline-size: 100%; min-block-size: 0; block-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); cursor: row-resize; } :host(:where([data-effective-orientation="vertical"])) [part="divider"]::before { inset-block: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); inset-inline: 0; } :host(:where([data-effective-orientation="horizontal"])) [part="divider"] { inline-size: var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ); min-block-size: min( 100%, var( --lr-multi-split-divider-target-size, var(--_lr-multi-split-divider-target-size) ) ); max-block-size: 100%; block-size: auto; cursor: col-resize; } :host(:where([data-effective-orientation="horizontal"])) [part="divider"]::before { inset-block: 0; inset-inline: calc( ( 100% - var( --lr-multi-split-divider-thickness, var(--_lr-multi-split-divider-thickness) ) ) / 2 ); } [part="divider"]:hover::before { background: var( --lr-multi-split-divider-hover-color, var(--_lr-multi-split-divider-hover-color) ); } [part="divider"]:active::before { background: var( --lr-multi-split-divider-active-color, var(--_lr-multi-split-divider-active-color) ); } [part="divider"]:focus-visible { ${focusRing} } [part="divider"][aria-disabled="true"] { cursor: default; pointer-events: none; } :host([data-collapse-state="floating"]) [part="divider"][aria-disabled="true"] { flex: 0 0 0; min-inline-size: 0; min-block-size: 0; } :host([data-collapse-state="floating"]) [part="divider"][aria-disabled="true"]::before { content: none; } ::slotted([data-collapse-state="floating"]) { position: absolute; inset-block: var(--lr-multi-split-floating-panel-inset, 0); z-index: var(--lr-layer-content); background: var(--lr-color-surface); border-radius: var(--lr-radius); box-shadow: var(--lr-shadow-l); } :host([collapse="start"]) ::slotted([data-collapse-state="floating"]) { inset-inline-start: var(--lr-multi-split-floating-panel-inset, 0); } :host([collapse="end"]) ::slotted([data-collapse-state="floating"]) { inset-inline-end: var(--lr-multi-split-floating-panel-inset, 0); } [part="backdrop"] { position: absolute; inset: 0; z-index: var(--lr-layer-base); background: var( --lr-multi-split-overlay-color, var(--_lr-multi-split-overlay-color) ); } ::slotted([data-collapse-state="rail"]) { overflow: hidden; } `;export{styles};