import{r as e,h as s,H as a,g as t}from"./p-444192d7.js";import{c as i}from"./p-9c6e275c.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:"1e32b54d6dc9bad193526096c1738cde9873525c",class:i({"collapse-expanded":this.expanded})},s("div",{key:"a5c7c3b966b683029a6faca073a1126cf06e19c5",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:"cf2da6ce35ac6a749d11935e7fbe90cf1fb05b1a",class:"collapse-action"},s("x-icon",{key:"706b0c169f3eb4c3c637567a088fe64a877142d9",name:this.expanded?"minus":"dropdown"}))),s("div",{key:"60999c33b22d88ced7ca46668051f54fc30cec53",class:"collapse-container",ref:e=>this.container=e},s("slot",{key:"9dd2e245a7b613a2fae9e3f4b5c2214c8d2d7d74"})))}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}