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