import{aW as de,aX as J,aY as ue,aZ as Oe,c as C,a_ as He,K as Le,a$ as Ne,b0 as Ee,b1 as fe,J as Z,d as D,al as ve,r as he,C as I,aF as be,ab as me,a8 as We,M as $,an as ge,ao as Q,V as A,T as H,O as we,b2 as Me,g,a6 as z,R as ye,a7 as L,q as p,au as K,o as Ze,Q as ee,X as De,a0 as Fe,ax as Ve,b3 as Ue,a1 as M,av as ie,ay as G,a9 as Xe,aO as Ye,b4 as oe,aa as qe,b5 as Ke,ag as je,ac as Je,at as Qe,af as Ge,aC as pe,b6 as et,aR as tt,Y as nt,v as at,x as lt,aq as it,b7 as ot,b8 as st,ah as rt,aw as se,ae as ct}from"./index-b3d5c748.js";import{u as xe}from"./use-id-d2a65d0a.js";import{T as dt}from"./use-tab-status-7b888048.js";function ut(e,a,o){let l,r=0;const t=e.scrollLeft,s=o===0?1:Math.round(o*1e3/16);let c=t;function h(){de(l)}function m(){c+=(a-t)/s,e.scrollLeft=c,++ra||!s&&ta?r=J(y):l&&(r=J(l))}return y(),m}function vt(){const e=C([]),a=[];return He(()=>{e.value=[]}),[e,l=>(a[l]||(a[l]=r=>{e.value[l]=r}),a[l])]}function Te(e,a){if(!Le||!window.IntersectionObserver)return;const o=new IntersectionObserver(t=>{a(t[0].intersectionRatio>0)},{root:document.body}),l=()=>{e.value&&o.observe(e.value)},r=()=>{e.value&&o.unobserve(e.value)};Ne(r),Ee(r),fe(l)}const[ht,bt]=Z("sticky"),mt={zIndex:z,position:ye("top"),container:Object,offsetTop:L(0),offsetBottom:L(0)};var gt=D({name:ht,props:mt,emits:["scroll","change"],setup(e,{emit:a,slots:o}){const l=C(),r=ve(l),t=he({fixed:!1,width:0,height:0,transform:0}),s=C(!1),c=I(()=>be(e.position==="top"?e.offsetTop:e.offsetBottom)),h=I(()=>{if(s.value)return;const{fixed:f,height:S,width:u}=t;if(f)return{width:`${u}px`,height:`${S}px`}}),m=I(()=>{if(!t.fixed||s.value)return;const f=me(We(e.zIndex),{width:`${t.width}px`,height:`${t.height}px`,[e.position]:`${c.value}px`});return t.transform&&(f.transform=`translate3d(0, ${t.transform}px, 0)`),f}),y=f=>a("scroll",{scrollTop:f,isFixed:t.fixed}),k=()=>{if(!l.value||Q(l))return;const{container:f,position:S}=e,u=H(l),T=ue(window);if(t.width=u.width,t.height=u.height,S==="top")if(f){const d=H(f),B=d.bottom-c.value-t.height;t.fixed=c.value>u.top&&d.bottom>0,t.transform=B<0?B:0}else t.fixed=c.value>u.top;else{const{clientHeight:d}=document.documentElement;if(f){const B=H(f),b=d-B.top-c.value-t.height;t.fixed=d-c.valueB.top,t.transform=b<0?-b:0}else t.fixed=d-c.valuet.fixed,f=>a("change",f)),ge("scroll",k,{target:r,passive:!0}),Te(l,k),$([we,Me],()=>{!l.value||Q(l)||!t.fixed||(s.value=!0,A(()=>{const f=H(l);t.width=f.width,t.height=f.height,s.value=!1}))}),()=>{var f;return g("div",{ref:l,style:h.value},[g("div",{class:bt({fixed:t.fixed&&!s.value}),style:m.value},[(f=o.default)==null?void 0:f.call(o)])])}}});const wt=p(gt),[yt,re]=Z("tabs");var xt=D({name:yt,props:{count:K(Number),inited:Boolean,animated:Boolean,duration:K(z),swipeable:Boolean,lazyRender:Boolean,currentIndex:K(Number)},emits:["change"],setup(e,{emit:a,slots:o}){const l=C(),r=c=>a("change",c),t=()=>{var c;const h=(c=o.default)==null?void 0:c.call(o);return e.animated||e.swipeable?g(De,{ref:l,loop:!1,class:re("track"),duration:+e.duration*1e3,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:r},{default:()=>[h]}):h},s=c=>{const h=l.value;h&&h.state.active!==c&&h.swipeTo(c,{immediate:!e.inited})};return $(()=>e.currentIndex,s),Ze(()=>{s(e.currentIndex)}),ee({swipeRef:l}),()=>g("div",{class:re("content",{animated:e.animated||e.swipeable})},[t()])}});const[Se,q]=Z("tabs"),Tt={type:ye("line"),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:L(0),duration:L(.3),animated:Boolean,ellipsis:M,swipeable:Boolean,scrollspy:Boolean,offsetTop:L(0),background:String,lazyRender:M,showHeader:M,lineWidth:z,lineHeight:z,beforeChange:Function,swipeThreshold:L(5),titleActiveColor:String,titleInactiveColor:String},Ce=Symbol(Se);var St=D({name:Se,props:Tt,emits:["change","scroll","rendered","clickTab","update:active"],setup(e,{emit:a,slots:o}){let l,r,t,s,c;const h=C(),m=C(),y=C(),k=C(),f=xe(),S=ve(h),[u,T]=vt(),{children:d,linkChildren:B}=Fe(Ce),b=he({inited:!1,position:"",lineStyle:{},currentIndex:-1}),N=I(()=>d.length>+e.swipeThreshold||!e.ellipsis||e.shrink),F=I(()=>({borderColor:e.color,background:e.background})),E=(n,i)=>{var v;return(v=n.name)!=null?v:i},V=I(()=>{const n=d[b.currentIndex];if(n)return E(n,b.currentIndex)}),O=I(()=>be(e.offsetTop)),te=I(()=>e.sticky?O.value+l:0),W=n=>{const i=m.value,v=u.value;if(!N.value||!i||!v||!v[b.currentIndex])return;const x=v[b.currentIndex].$el,w=x.offsetLeft-(i.offsetWidth-x.offsetWidth)/2;s&&s(),s=ut(i,w,n?0:+e.duration)},_=()=>{const n=b.inited;A(()=>{const i=u.value;if(!i||!i[b.currentIndex]||e.type!=="line"||Q(h.value))return;const v=i[b.currentIndex].$el,{lineWidth:x,lineHeight:w}=e,R=v.offsetLeft+v.offsetWidth/2,P={width:ie(x),backgroundColor:e.color,transform:`translateX(${R}px) translateX(-50%)`};if(n&&(P.transitionDuration=`${e.duration}s`),G(w)){const Y=ie(w);P.height=Y,P.borderRadius=Y}b.lineStyle=P})},Re=n=>{const i=n=0&&n{const v=Re(n);if(!G(v))return;const x=d[v],w=E(x,v),R=b.currentIndex!==null;b.currentIndex!==v&&(b.currentIndex=v,i||W(),_()),w!==e.active&&(a("update:active",w),R&&a("change",w,x.title)),t&&!e.scrollspy&&Ye(Math.ceil(oe(h.value)-O.value))},X=(n,i)=>{const v=d.find((w,R)=>E(w,R)===n),x=v?d.indexOf(v):0;U(x,i)},ne=(n=!1)=>{if(e.scrollspy){const i=d[b.currentIndex].$el;if(i&&S.value){const v=oe(i,S.value)-te.value;r=!0,c&&c(),c=ft(S.value,v,n?0:+e.duration,()=>{r=!1})}}},Ie=(n,i,v)=>{const{title:x,disabled:w}=d[i],R=E(d[i],i);w||(qe(e.beforeChange,{args:[R],done:()=>{U(i),ne()}}),Ke(n)),a("clickTab",{name:R,title:x,event:v,disabled:w})},ke=n=>{t=n.isFixed,a("scroll",n)},Be=n=>{A(()=>{X(n),ne(!0)})},$e=()=>{for(let n=0;nte.value)return n===0?0:n-1}return d.length-1},_e=()=>{if(e.scrollspy&&!r){const n=$e();U(n)}},Pe=()=>{if(e.type==="line"&&d.length)return g("div",{class:q("line"),style:b.lineStyle},null)},ae=()=>{var n,i,v;const{type:x,border:w,sticky:R}=e,P=[g("div",{ref:R?void 0:y,class:[q("wrap"),{[Xe]:x==="line"&&w}]},[g("div",{ref:m,role:"tablist",class:q("nav",[x,{shrink:e.shrink,complete:N.value}]),style:F.value,"aria-orientation":"horizontal"},[(n=o["nav-left"])==null?void 0:n.call(o),d.map(Y=>Y.renderTitle(Ie)),Pe(),(i=o["nav-right"])==null?void 0:i.call(o)])]),(v=o["nav-bottom"])==null?void 0:v.call(o)];return R?g("div",{ref:y},[P]):P},le=()=>{_(),A(()=>{var n,i;W(!0),(i=(n=k.value)==null?void 0:n.swipeRef.value)==null||i.resize()})};$(()=>[e.color,e.duration,e.lineWidth,e.lineHeight],_),$(we,le),$(()=>e.active,n=>{n!==V.value&&X(n)}),$(()=>d.length,()=>{b.inited&&(X(e.active),_(),A(()=>{W(!0)}))});const Ae=()=>{X(e.active,!0),A(()=>{b.inited=!0,y.value&&(l=H(y.value).height),W(!0)})},ze=(n,i)=>a("rendered",n,i);return ee({resize:le,scrollTo:Be}),Ve(_),Ue(_),fe(Ae),Te(h,_),ge("scroll",_e,{target:S,passive:!0}),B({id:f,props:e,setLine:_,scrollable:N,onRendered:ze,currentName:V,setTitleRefs:T,scrollIntoView:W}),()=>g("div",{ref:h,class:q([e.type])},[e.showHeader?e.sticky?g(wt,{container:h.value,offsetTop:O.value,onScroll:ke},{default:()=>[ae()]}):ae():null,g(xt,{ref:k,count:d.length,inited:b.inited,animated:e.animated,duration:e.duration,swipeable:e.swipeable,lazyRender:e.lazyRender,currentIndex:b.currentIndex,onChange:U},{default:()=>{var n;return[(n=o.default)==null?void 0:n.call(o)]}})])}});const[Ct,ce]=Z("tab"),Rt=D({name:Ct,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:z,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:M},setup(e,{slots:a}){const o=I(()=>{const r={},{type:t,color:s,disabled:c,isActive:h,activeColor:m,inactiveColor:y}=e;s&&t==="card"&&(r.borderColor=s,c||(h?r.backgroundColor=s:r.color=s));const f=h?m:y;return f&&(r.color=f),r}),l=()=>{const r=g("span",{class:ce("text",{ellipsis:!e.scrollable})},[a.title?a.title():e.title]);return e.dot||G(e.badge)&&e.badge!==""?g(je,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:()=>[r]}):r};return()=>g("div",{id:e.id,role:"tab",class:[ce([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:o.value,tabindex:e.disabled?void 0:e.isActive?0:-1,"aria-selected":e.isActive,"aria-disabled":e.disabled||void 0,"aria-controls":e.controls,"data-allow-mismatch":"attribute"},[l()])}}),[It,j]=Z("tab"),kt=me({},Je,{dot:Boolean,name:z,badge:z,title:String,disabled:Boolean,titleClass:Qe,titleStyle:[String,Object],showZeroBadge:M});var Bt=D({name:It,props:kt,setup(e,{slots:a}){const o=xe(),l=C(!1),r=ct(),{parent:t,index:s}=Ge(Ce);if(!t)return;const c=()=>{var u;return(u=e.name)!=null?u:s.value},h=()=>{l.value=!0,t.props.lazyRender&&A(()=>{t.onRendered(c(),e.title)})},m=I(()=>{const u=c()===t.currentName.value;return u&&!l.value&&h(),u}),y=C(""),k=C("");pe(()=>{const{titleClass:u,titleStyle:T}=e;y.value=u?it(u):"",k.value=T&&typeof T!="string"?ot(st(T)):T});const f=u=>g(Rt,rt({key:o,id:`${t.id}-${s.value}`,ref:t.setTitleRefs(s.value),style:k.value,class:y.value,isActive:m.value,controls:o,scrollable:t.scrollable.value,activeColor:t.props.titleActiveColor,inactiveColor:t.props.titleInactiveColor,onClick:T=>u(r.proxy,s.value,T)},se(t.props,["type","color","shrink"]),se(e,["dot","badge","title","disabled","showZeroBadge"])),{title:a.title}),S=C(!m.value);return $(m,u=>{u?S.value=!1:et(()=>{S.value=!0})}),$(()=>e.title,()=>{t.setLine(),t.scrollIntoView()}),tt(dt,m),ee({id:o,renderTitle:f}),()=>{var u;const T=`${t.id}-${s.value}`,{animated:d,swipeable:B,scrollspy:b,lazyRender:N}=t.props;if(!a.default&&!d)return;const F=b||m.value;if(d||B)return g(nt,{id:o,role:"tabpanel",class:j("panel-wrapper",{inactive:S.value}),tabindex:m.value?0:-1,"aria-hidden":!m.value,"aria-labelledby":T,"data-allow-mismatch":"attribute"},{default:()=>{var O;return[g("div",{class:j("panel")},[(O=a.default)==null?void 0:O.call(a)])]}});const V=l.value||b||!N?(u=a.default)==null?void 0:u.call(a):null;return at(g("div",{id:o,role:"tabpanel",class:j("panel"),tabindex:F?0:-1,"aria-labelledby":T,"data-allow-mismatch":"attribute"},[V]),[[lt,F]])}}});const At=p(Bt),zt=p(St);export{zt as T,At as a};