import{r as e}from"./dropdowncomponents-5264d5da.js";import{registeredComponents as t}from"./modalcomponents-b90ec245.js";import{_ as i}from"./tslib.es6-d65164b3.js";import{e as s}from"./logicaltreehelper-67db40f1.js";import{n as r}from"./property-4ec0b52d.js";import{e as a}from"./custom-element-267f9a21.js";import{s as o}from"./lit-element-462e7ad3.js";import{d as n}from"./events-interseptor-a522582a.js";import"./dropdown-91641129.js";import"./popup-e76e963a.js";import"./layouthelper-67dd777a.js";import"./point-e4ec110e.js";import"./constants-7c047c0d.js";import"./rafaction-bba7928b.js";import"./screenhelper-e9ec6e3e.js";import"./transformhelper-ebad0156.js";import"./positiontracker-754c1e75.js";import"./branch-aebd078a.js";import"./eventhelper-8bcec49f.js";import"./portal-e7c7352c.js";import"./data-qa-utils-8be7c726.js";import"./constants-38572198.js";import"./const-90026e45.js";import"./dx-html-element-pointer-events-helper-6dda355e.js";import"./dom-4684d8d6.js";import"./_commonjsHelpers-41cdd1e7.js";import"./string-2448bf95.js";import"./browser-3fc721b7.js";import"./devices-17b9ba08.js";import"./dx-ui-element-b777832b.js";import"./lit-element-base-b20b52b2.js";import"./dx-license-e00a5bc7.js";import"./capture-manager-fb670c21.js";import"./focushelper-2eea96ca.js";import"./nameof-factory-64d95f5b.js";import"./custom-events-helper-e7f279d3.js";import"./focustrap-d11cfef9.js";import"./tabbable-a2ae89a6.js";import"./key-a66127fc.js";import"./keyboard-navigation-strategy-0cccb7d5.js";import"./dom-utils-bf33c859.js";import"./css-classes-1103f305.js";import"./focus-utils-1fc0087c.js";import"./disposable-d2c2d283.js";import"./thumb-31d768d7.js";import"./query-44b9267f.js";import"./popupportal-e116a31b.js";var p;const d="dxbl-adaptive-dropdown";let c=p=class extends o{constructor(){super(...arguments),this.slotChangedHandler=this.handleSlotChanged.bind(this),this.interceptorSlotChangedHandler=this.handleInterceptorSlotChange.bind(this),this.interceptor=null,this.resizeHandler=this.handleResize.bind(this),this._adaptivityEnabled=!1,this._popupAccessor=null,this.adaptiveWidth=576}get popup(){var e;return(null===(e=this._popupAccessor)||void 0===e?void 0:e.popup)||null}get popupBase(){var e;return(null===(e=this._popupAccessor)||void 0===e?void 0:e.popupBase)||null}get adaptivityEnabled(){return this._adaptivityEnabled}set adaptivityEnabled(e){this._adaptivityEnabled!==e&&(this._adaptivityEnabled=e,this.raiseEnableAdaptivity(e))}createRenderRoot(){const e=super.createRenderRoot(),t=document.createElement("slot");e.appendChild(t),t.addEventListener("slotchange",this.slotChangedHandler);const i=document.createElement("slot");return i.name="interceptor",e.appendChild(i),i.addEventListener("slotchange",this.interceptorSlotChangedHandler),e}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeHandler,{passive:!0}),setTimeout((()=>this.updateAdaptivity()))}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.resizeHandler)}handleResize(e){this.updateAdaptivity()}updateAdaptivity(){this.adaptivityEnabled=this.getActualAdaptivityEnabled(),this.raiseEvent("adaptivityChanged",{enabled:this.adaptivityEnabled})}getActualAdaptivityEnabled(){return window.innerWidth<=this.adaptiveWidth}handleSlotChanged(e){const t=e.target.assignedNodes();this._popupAccessor=p.findPopupAccessor(t)}handleInterceptorSlotChange(e){const t=e.target.assignedNodes();this.interceptor=t[0]}raiseEvent(e,t){this.interceptor&&this.interceptor.raise&&this.interceptor.raise(e,t)}raiseEnableAdaptivity(e){this.raiseEvent("adaptivityChanged",{enabled:e})}static findPopupAccessor(e){const t=e.find((e=>s(e)));return t||null}};function l(){}i([r({type:Number,attribute:"adaptive-width"})],c.prototype,"adaptiveWidth",void 0),c=p=i([a(d)],c);const m={dropDownRegisteredComponents:e,modalRegisteredComponents:t,init:l,dxAdaptiveDropDownTagName:d,dxEventsInterceptorTagName:n};export{m as default,l as init};
