import{r as t,h as i,d as e,B as o}from"./p-03169580.js";const r="fireenjin-tab .tab-wrapper{opacity:0;pointer-events:none;height:0;display:block;transition:0.3s ease opacity;overflow:hidden}fireenjin-tab .tab-wrapper.tab-selected{opacity:1;pointer-events:all;height:auto;overflow:auto}";let s=class{constructor(i){t(this,i);this.selected=false}render(){return i("div",{class:{"tab-selected":this.selected,"tab-deselected":!this.selected,"tab-wrapper":true}},i("slot",null))}};s.style=r;const n="fireenjin-tabs .tabs-bar{display:block;background-color:var(--ion-color-light-tint);text-align:center;font-family:var(--ion-font-family);font-weight:bold;color:var(--ion-color-dark);text-transform:capitalize;font-size:18px;padding:0}fireenjin-tabs .tabs-bar ion-col{padding:15px 0}fireenjin-tabs .tabs-bar ion-col:hover{cursor:pointer;color:var(--ion-color-primary)}fireenjin-tabs .tabs-bar ion-col.selected{background-color:var(--ion-color-primary-contrast);color:var(--ion-color-primary)}";let a=class{constructor(i){t(this,i);this.fireenjinTabChange=e(this,"fireenjinTabChange",7);this.tabs=[]}componentDidLoad(){if(!(o===null||o===void 0?void 0:o.isBrowser))return;this.tabs=this.setSelectedTab();if(this.hash){window.onhashchange=()=>{const t=this.tabsWrapperEl.querySelectorAll("fireenjin-tab");this.tabs=this.setSelectedTab();for(let i=0;i<t.length;++i){t[i].selected=this.selected===t[i].tab}}}}setSelectedTab(){const t=this.tabsWrapperEl.querySelectorAll("fireenjin-tab");const i=[];for(let e=0;e<t.length;++e){if(t[e].selected&&(window.location.hash===""||!this.hash)){this.selected=t[e].tab}else if(this.hash&&window.location.hash==="#"+t[e].tab.toLowerCase()){this.selected=t[e].tab}i.push({name:t[e].tab})}return i}tabClick(t){const i=this.tabsWrapperEl.querySelectorAll("fireenjin-tab");this.selected=t.name;for(let t=0;t<i.length;++t){i[t].selected=this.selected===i[t].tab}if(this.hash){window.location.hash=`#${t.name}`}this.fireenjinTabChange.emit({tab:t})}render(){return i("div",{ref:t=>this.tabsWrapperEl=t,class:"tabs-wrapper"},i("ion-grid",{class:"tabs-bar"},i("ion-row",null,this.tabs.map((t=>i("ion-col",{class:this.selected===t.name?"selected":"",onClick:()=>this.tabClick(t)},t.name))))),i("div",{class:"tabs-content"},i("slot",null)))}};a.style=n;export{s as fireenjin_tab,a as fireenjin_tabs};
//# sourceMappingURL=p-760f082c.entry.js.map