import{e as N,b as c,g as x,o as r,c as o,a as l,r as j,n as i,F as h,i as B,d as p,q as A,t as f,u as D,w as F,N as w,O as $,W as T}from"./app-583c7dce.js";import{o as O}from"./QueryHelper-1a55ee8b.js";import{u as V}from"./CoreLibrary-a73ce456.js";import{u as W}from"./useEmitter-7699a4d3.js";const E={class:"profile-page-wrapper"},H={class:"user-info-column rounded-default overflow-hidden p-0"},M={class:"user-tab-menu rounded-default overflow-hidden"},P=["aria-orientation"],R=["onClick","id","data-bs-target","aria-controls"],z={class:"user-details-column shadow-sm"},I={class:"tab-content",id:"v-pills-tabContent"},L=["id","aria-labelledby"],Q={key:0,class:"tab-pane-header d-flex align-items-center justify-content-between"},U={class:"mb-0 fs-6"},Y={__name:"Tab",props:{tabs:{type:Array,required:!0},id:{type:String,required:!0},type:{type:String,default:"vertical"},borderWidth:{type:[String,Number],default:"1"},showBorder:Boolean,componentProps:{type:[String,Object,Array],required:!1}},setup(v){const d=v,C=W(),{isUndefined:k}=V(),u=N(()=>d.tabs.filter(t=>k(t.permission)||t.permission!==!1)),s=c(""),y=c(""),b=c(0),q=()=>{let t={},a={};a=u.value.find((e,n)=>{if(e.title)return b.value=n,e}),t=a||u.value[b.value],g(t)},_=c(0),g=t=>{y.value=t.props;let a=`tab-${d.id}`,e={};_.value?(e[a]=t.key,s.value=t.key):(e[a]=T.currentRoute.value.query["tab-setting-tab"]||t.key,s.value=T.currentRoute.value.query["tab-setting-tab"]||t.key,_.value++);let n=O(e),m=document.title;history.replaceState({...history.state},m,`?${n}`)},S=t=>{C.emit("headerButtonTiger-"+t)};return x(()=>{q()}),(t,a)=>(r(),o("div",E,[l("div",H,[j(t.$slots,"default"),l("div",M,[l("div",{class:i(["nav nav-pills border-top-0 border-start-0 border-end-0",{"flex-column":v.type==="vertical",border:d.showBorder},`border-${d.borderWidth}`]),id:"v-pills-tab",role:"tablist","aria-orientation":v.type},[(r(!0),o(h,null,B(u.value,(e,n)=>(r(),o("button",{key:n,class:i(["nav-link",{active:e.key===s.value}]),onClick:m=>g(e),id:`v-pills-${e.key}-tab`,"data-bs-toggle":"pill","data-bs-target":`#v-pills-${e.key}`,type:"button",role:"tab","aria-controls":`v-pills-${e.key}`,"aria-selected":"true"},[e.icon?(r(),o("i",{key:0,class:i(e.icon)},null,2)):p("",!0),A(" "+f(e.title.replace("_"," ")),1)],10,R))),128))],10,P)])]),l("div",z,[l("div",I,[(r(!0),o(h,null,B(u.value,(e,n)=>(r(),o(h,{key:n},[e.key===s.value?(r(),o("div",{key:0,class:i(["tab-pane fade",{"show active":e.key===s.value}]),id:`v-pills-${e.key}`,role:"tabpanel","aria-labelledby":`v-pills-${e.key}-tab`},[e.showHeader?(r(),o("div",Q,[l("h5",U,f(e.title),1),!D(k)(e.headerButton&&e.headerButton.label&&e.headerButton.permission)&&e.headerButton.permission?(r(),o("button",{key:0,class:i(e.headerButton.class?e.headerButton.class:"btn btn-primary"),onClick:a[0]||(a[0]=F(m=>S(s.value),["prevent"]))},f(e.headerButton.label),3)):p("",!0)])):p("",!0),l("div",{class:i(["tab-pane-content",{"pt-20":e.showHeader}])},[y.value?(r(),w($(e.component),{key:0,componentData:y.value,id:s.value},null,8,["componentData","id"])):(r(),w($(e.component),{key:1,id:s.value},null,8,["id"]))],2)],10,L)):p("",!0)],64))),128))])])]))}};export{Y as default};
