import{r as e,h as s,H as a,g as t}from"./p-d85247d2.js";import{c as o}from"./p-efbc3883.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:"7f82133dbd9c70004069c1f6e503ee4d6a788f19",class:o({"collapse-expanded":this.expanded})},s("div",{key:"1ceb013efd40159150183b40893504a264f17bf2",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:"32242dc53d6781dd69aff01377cc41304c784100",class:"collapse-action"},s("x-icon",{key:"ffd81c8f6ce3bf39a0ca1e5906bbe5b0894e6d0b",name:this.expanded?"minus":"dropdown"}))),s("div",{key:"9ac6e4dbaef9f2b84bbeaaa5fc237757dcdc9d77",class:"collapse-container"},s("slot",{key:"7e1f59ac30e5bfb50c335f5bdf1fff5bf94b3db4"})))}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}