/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{b as r}from"./HVT2WBVC.js";import{G as i,h as a,i as p}from"./FFF5HUPM.js";import"./EXBEKVP5.js";export default $arcgis.t(([l])=>{var d=a`:host{display:block}`,m="floating",h="instant-apps-control-panel",x="border-bottom: 1px solid var(--calcite-color-border-3)",s=class extends i{constructor(){super(...arguments),this.components=[]}static{this.properties={components:0,view:0}}static{this.styles=d}async load(){await this._handleComponents()}async _handleComponents(){let t=this._getComponentsNode();t&&(this._resetUI(t),this._attachComponents(t))}_attachComponents(t){this.components.forEach(this._attachmentComponent(t))}_attachmentComponent(t){return(o,e)=>{let n=o.content;o.isExpand&&(n=this._getExpand(o),o.expandIcon&&(n.expandIcon=o.expandIcon),o.collapseTooltip&&(n.collapseTooltip=o.collapseTooltip),o.expandTooltip&&(n.expandTooltip=o.expandTooltip)),n.container||(n.container=document.createElement("div")),t?.appendChild(n.container),e!==this.components.length-1&&(n.container.style=x)}}_getExpand(t){let{view:o}=this,{content:e,focusTrapDisabled:n}=t,c=t?.expanded??!1;return new l({content:e,view:o,expanded:c,mode:m,group:h,focusTrapDisabled:!!n})}_getComponentsNode(){return this.el.querySelector('[slot="components"]')}_resetUI(t){if(t.children.length>0)for(;t.firstChild;)t.removeChild(t.firstChild)}render(){return p`<slot name=components></slot>`}};r("instant-apps-control-panel",s);return s},"widgets/Expand")