import{r as e,h as s,H as a,g as t}from"./p-40eb06b7.js";import{c as o}from"./p-b415099e.js";const i=class{constructor(s){e(this,s),this.header=void 0,this.show=!1,this.expanded=!1}async toggle(){this.toggleCollapse()}onExpandedChange(){this.updateCollapse()}componentDidLoad(){this.container=this.el.querySelector(".collapse-container"),this.show&&(this.expanded=!0)}toggleCollapse(){this.expanded=!this.expanded}updateCollapse(){this.el.querySelector(".collapse-container").style.maxHeight?this.hideCollapseContainer():this.showCollapseContainer()}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="auto"}),200)}render(){var e;return s(a,{key:"7feba7ba59c75bf8a540eaad5c245ee60a6e7dbe",class:o({"collapse-expanded":this.expanded})},s("div",{key:"bf223c645db369281efc5b860ccf8a5774434319",class:"collapse-header",onClick:()=>this.toggleCollapse()},(null===(e=this.header)||void 0===e?void 0:e.length)?s("h4",null,this.header):s("slot",{name:"header"}),s("span",{key:"7c3e2e47cd45179bb9f6acb74f7dda3c5cea2655",class:"collapse-action"},s("x-icon",{key:"9f276c390ecf465d05a5bfee93ebbe64e93a7438",name:this.expanded?"minus":"dropdown"}))),s("div",{key:"bb3045c9580a34951b148a62933907daab875465",class:"collapse-container"},s("slot",{key:"a1873f0ffd1002a7b6691ecc68f0ae65eadd4c88"})))}get el(){return t(this)}static get watchers(){return{expanded:["onExpandedChange"]}}};i.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;-webkit-transition:0.3s;transition:0.3s;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{i as x_collapse}