import{r as e,h as s,H as a,g as t}from"./p-4afc0173.js";import{c as o}from"./p-c5b591fd.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:"9ed3bd4c972558ad23875a1ccf3fd6491e683006",class:o({"collapse-expanded":this.expanded})},s("div",{key:"0b5781b9394ca980fe37d5d60fa7ef4d69cc3d91",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:"f331b0fb71b476c7dd1a196577c9b6d930245719",class:"collapse-action"},s("x-icon",{key:"263e701340a1149f3b0c85bd440a5071281596b8",name:this.expanded?"minus":"dropdown"}))),s("div",{key:"33cac6ebf7f23451d7e9ef24622f387023568325",class:"collapse-container"},s("slot",{key:"ba3dfe9f1a5237ffb93d5bc6596d4c5d5ca26406"})))}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}