import{r as e,h as s,H as a,g as t}from"./p-444192d7.js";import{c as i}from"./p-933ea891.js";const o=class{constructor(s){e(this,s),this.header=void 0,this.show=!1,this.expanded=!1}async toggle(){this.toggleCollapse()}watchExpanded(){this.updateCollapse()}componentWillLoad(){this.show&&(this.expanded=!0)}componentDidLoad(){this.updateCollapse()}toggleCollapse(){this.expanded=!this.expanded}updateCollapse(){this.container&&(this.expanded?this.showCollapseContainer():this.hideCollapseContainer())}hideCollapseContainer(){this.container.style.maxHeight=null,this.container.style.overflow="hidden"}showCollapseContainer(){this.container.style.maxHeight=`${this.container.scrollHeight}px`,setTimeout((()=>{this.container.style.overflow="initial"}),200)}onCollapseKeyDown(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),this.toggleCollapse())}render(){var e;return s(a,{key:"19ed85314812bb8f7b1ab9ae498c4ad871969afe",class:i({"collapse-expanded":this.expanded})},s("div",{key:"97da921d56604e13a04899d015d88efae06e9640",role:"switch",class:"collapse-header",tabIndex:0,"aria-checked":this.expanded,onClick:()=>this.toggleCollapse(),onKeyDown:e=>this.onCollapseKeyDown(e)},(null===(e=this.header)||void 0===e?void 0:e.length)?s("h4",null,this.header):s("slot",{name:"header"}),s("span",{key:"f7a9656eda86cebadba55449332987910a1d810e",class:"collapse-action"},s("x-icon",{key:"8e6c592bf22f6f6973f3f1fe5dca549e1db08c4f",name:this.expanded?"minus":"dropdown"}))),s("div",{key:"86302a74f164e24c118d7b51e42f5228448e24cb",class:"collapse-container",ref:e=>this.container=e},s("slot",{key:"47edb1b312d7c0a15d9c82f1b4cc61664b89bba9"})))}get el(){return t(this)}static get watchers(){return{expanded:["watchExpanded"]}}};o.style="x-collapse{display:block;position:relative;-webkit-transition:0.3s;transition:0.3s}.is-dark-mode x-collapse{color:var(--color-text-light, #FEFEFE)}x-collapse .collapse-header{position:relative;padding:0.5rem 0;line-height:1em;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}x-collapse .collapse-header:hover:after{-webkit-animation:0.75s fadeBreathe infinite;animation:0.75s fadeBreathe infinite}x-collapse .collapse-header h4{margin:0}x-collapse .collapse-header .collapse-action{position:absolute;top:calc(50% - 0.5rem);right:0.75rem}x-collapse .collapse-container{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-height:0;opacity:0;-webkit-transition:max-height 0.2s ease-out, opacity 0.2s;transition:max-height 0.2s ease-out, opacity 0.2s}x-collapse.collapse-expanded .collapse-container{opacity:1}";export{o as x_collapse}