import{r as i,d as t,B as o,h as s}from"./p-9b6cc562.js";const r=class{constructor(o){i(this,o),this.fireenjinTabChange=t(this,"fireenjinTabChange",7),this.hash=void 0,this.selected=void 0,this.tabs=[]}componentDidLoad(){(null==o?void 0:o.isBrowser)&&(this.tabs=this.setSelectedTab(),this.hash&&(window.onhashchange=()=>{const i=this.tabsWrapperEl.querySelectorAll("fireenjin-tab");this.tabs=this.setSelectedTab();for(let t=0;t<i.length;++t)i[t].selected=this.selected===i[t].tab}))}setSelectedTab(){const i=this.tabsWrapperEl.querySelectorAll("fireenjin-tab"),t=[];for(let o=0;o<i.length;++o)!i[o].selected||""!==window.location.hash&&this.hash?this.hash&&window.location.hash==="#"+i[o].tab.toLowerCase()&&(this.selected=i[o].tab):this.selected=i[o].tab,t.push({name:i[o].tab});return t}tabClick(i){const t=this.tabsWrapperEl.querySelectorAll("fireenjin-tab");this.selected=i.name;for(let i=0;i<t.length;++i)t[i].selected=this.selected===t[i].tab;this.hash&&(window.location.hash=`#${i.name}`),this.fireenjinTabChange.emit({tab:i})}render(){return s("div",{ref:i=>this.tabsWrapperEl=i,class:"tabs-wrapper"},s("ion-grid",{class:"tabs-bar"},s("ion-row",null,this.tabs.map((i=>s("ion-col",{class:this.selected===i.name?"selected":"",onClick:()=>this.tabClick(i)},i.name))))),s("div",{class:"tabs-content"},s("slot",null)))}};r.style="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)}";export{r as fireenjin_tabs}