1 |
- import{j as Te,g as ze,h as Re,d as G,r as O,x as se,e as k,w as R,n as Z,f as C,b as fe,l as _e,b5 as dt,ac as vt,bC as ft,aG as pt,p as ht,k as gt,v as bt,m as mt,__tla as wt}from"./index-1f518666.js";import{O as Me,M as pe,N as Oe,J as yt,E as xt,k as Ae,c as J,n as E,m as Le,z as j,Q as We,R as He,e as Xe,s as Ct,q as he,S as K,u as Q,w as ge,a as Ze,d as ee,t as N,j as kt,T as Ee,x as te,U as It,o as je,V as ae,p as St,W as be,G as me,L as $t,b as Ne,v as we,X as Bt,Y as Tt,Z as Fe,y as zt,_ as Rt,B as _t,$ as Ye,r as Mt,i as Ot,C as De,__tla as At}from"./index-db300042.js";let Pe,Ge,Lt=Promise.all([(()=>{try{return wt}catch{}})(),(()=>{try{return At}catch{}})()]).then(async()=>{let Je=0;function ye(){const e=Te(),{name:p="unknown"}=(e==null?void 0:e.type)||{};return`${p}-${++Je}`}function xe(e,p){if(!xt||!window.IntersectionObserver)return;const u=new IntersectionObserver(h=>{p(h[0].intersectionRatio>0)},{root:document.body}),r=()=>{e.value&&u.unobserve(e.value)};ze(r),Re(r),Ae(()=>{e.value&&u.observe(e.value)})}const[Ve,qe]=J("sticky"),Qe=ee(G({name:Ve,props:{zIndex:E,position:Le("top"),container:Object,offsetTop:j(0),offsetBottom:j(0)},emits:["scroll","change"],setup(e,{emit:p,slots:u}){const r=O(),h=We(r),t=se({fixed:!1,width:0,height:0,transform:0}),b=O(!1),s=k(()=>He(e.position==="top"?e.offsetTop:e.offsetBottom)),l=k(()=>{if(b.value)return;const{fixed:o,height:d,width:g}=t;return o?{width:`${g}px`,height:`${d}px`}:void 0}),T=k(()=>{if(!t.fixed||b.value)return;const o=Xe(Ct(e.zIndex),{width:`${t.width}px`,height:`${t.height}px`,[e.position]:`${s.value}px`});return t.transform&&(o.transform=`translate3d(0, ${t.transform}px, 0)`),o}),n=()=>{if(!r.value||K(r))return;const{container:o,position:d}=e,g=Q(r),W=Oe(window);if(t.width=g.width,t.height=g.height,d==="top")if(o){const S=Q(o),v=S.bottom-s.value-t.height;t.fixed=s.value>g.top&&S.bottom>0,t.transform=v<0?v:0}else t.fixed=s.value>g.top;else{const{clientHeight:S}=document.documentElement;if(o){const v=Q(o),H=S-v.top-s.value-t.height;t.fixed=S-s.value<g.bottom&&S>v.top,t.transform=H<0?-H:0}else t.fixed=S-s.value<g.bottom}(S=>{p("scroll",{scrollTop:S,isFixed:t.fixed})})(W)};return R(()=>t.fixed,o=>p("change",o)),he("scroll",n,{target:h,passive:!0}),xe(r,n),R([ge,Ze],()=>{r.value&&!K(r)&&t.fixed&&(b.value=!0,Z(()=>{const o=Q(r);t.width=o.width,t.height=o.height,b.value=!1}))}),()=>{var o;return C("div",{ref:r,style:l.value},[C("div",{class:qe({fixed:t.fixed&&!b.value}),style:T.value},[(o=u.default)==null?void 0:o.call(u)])])}}})),[Ce,le]=J("swipe"),Ue={loop:N,width:E,height:E,vertical:Boolean,autoplay:j(0),duration:j(500),touchable:N,lazyRender:Boolean,initialSwipe:j(0),indicatorColor:String,showIndicators:N,stopPropagation:N},ke=Symbol(Ce),Ke=ee(G({name:Ce,props:Ue,emits:["change","dragStart","dragEnd"],setup(e,{emit:p,slots:u}){const r=O(),h=O(),t=se({rect:null,width:0,height:0,offset:0,active:0,swiping:!1});let b=!1;const s=kt(),{children:l,linkChildren:T}=Ee(ke),n=k(()=>l.length),o=k(()=>t[e.vertical?"height":"width"]),d=k(()=>e.vertical?s.deltaY.value:s.deltaX.value),g=k(()=>t.rect?(e.vertical?t.rect.height:t.rect.width)-o.value*n.value:0),W=k(()=>o.value?Math.ceil(Math.abs(g.value)/o.value):n.value),S=k(()=>n.value*o.value),v=k(()=>(t.active+n.value)%n.value),H=k(()=>{const c=e.vertical?"vertical":"horizontal";return s.direction.value===c}),y=k(()=>{const c={transitionDuration:`${t.swiping?0:e.duration}ms`,transform:`translate${e.vertical?"Y":"X"}(${+t.offset.toFixed(2)}px)`};if(o.value){const $=e.vertical?"height":"width",x=e.vertical?"width":"height";c[$]=`${S.value}px`,c[x]=e[x]?`${e[x]}px`:""}return c}),F=(c,$=0)=>{let x=c*o.value;e.loop||(x=Math.min(x,-g.value));let a=$-x;return e.loop||(a=be(a,g.value,0)),a},_=({pace:c=0,offset:$=0,emitChange:x})=>{if(n.value<=1)return;const{active:a}=t,i=(w=>{const{active:m}=t;return w?e.loop?be(m+w,-1,n.value):be(m+w,0,W.value):m})(c),f=F(i,$);if(e.loop){if(l[0]&&f!==g.value){const w=f<g.value;l[0].setOffset(w?S.value:0)}if(l[n.value-1]&&f!==0){const w=f>0;l[n.value-1].setOffset(w?-S.value:0)}}t.active=i,t.offset=f,x&&i!==a&&p("change",v.value)},X=()=>{t.swiping=!0,t.active<=-1?_({pace:n.value}):t.active>=n.value&&_({pace:-n.value})},U=()=>{X(),s.reset(),ae(()=>{t.swiping=!1,_({pace:1,emitChange:!0})})};let V;const Y=()=>clearTimeout(V),L=()=>{Y(),+e.autoplay>0&&n.value>1&&(V=setTimeout(()=>{U(),L()},+e.autoplay))},z=(c=+e.initialSwipe)=>{if(!r.value)return;const $=()=>{var x,a;if(!K(r)){const i={width:r.value.offsetWidth,height:r.value.offsetHeight};t.rect=i,t.width=+((x=e.width)!=null?x:i.width),t.height=+((a=e.height)!=null?a:i.height)}n.value&&(c=Math.min(n.value-1,c))===-1&&(c=n.value-1),t.active=c,t.swiping=!0,t.offset=F(c),l.forEach(i=>{i.setOffset(0)}),L()};K(r)?Z().then($):$()},D=()=>z(t.active);let P;const ne=c=>{!e.touchable||c.touches.length>1||(s.start(c),b=!1,P=Date.now(),Y(),X())},oe=()=>{if(!e.touchable||!t.swiping)return;const c=Date.now()-P,$=d.value/c;if((Math.abs($)>.25||Math.abs(d.value)>o.value/2)&&H.value){const x=e.vertical?s.offsetY.value:s.offsetX.value;let a=0;a=e.loop?x>0?d.value>0?-1:1:0:-Math[d.value>0?"ceil":"floor"](d.value/o.value),_({pace:a,emitChange:!0})}else d.value&&_({pace:0});b=!1,t.swiping=!1,p("dragEnd",{index:v.value}),L()},ue=(c,$)=>{const x=$===v.value,a=x?{backgroundColor:e.indicatorColor}:void 0;return C("i",{style:a,class:le("indicator",{active:x})},null)};return te({prev:()=>{X(),s.reset(),ae(()=>{t.swiping=!1,_({pace:-1,emitChange:!0})})},next:U,state:t,resize:D,swipeTo:(c,$={})=>{X(),s.reset(),ae(()=>{let x;x=e.loop&&c===n.value?t.active===0?0:c:c%n.value,$.immediate?ae(()=>{t.swiping=!1}):t.swiping=!1,_({pace:x-t.active,emitChange:!0})})}}),T({size:o,props:e,count:n,activeIndicator:v}),R(()=>e.initialSwipe,c=>z(+c)),R(n,()=>z(t.active)),R(()=>e.autoplay,L),R([ge,Ze,()=>e.width,()=>e.height],D),R(It(),c=>{c==="visible"?L():Y()}),fe(z),_e(()=>z(t.active)),je(()=>z(t.active)),ze(Y),Re(Y),he("touchmove",c=>{e.touchable&&t.swiping&&(s.move(c),H.value)&&(!e.loop&&(t.active===0&&d.value>0||t.active===n.value-1&&d.value<0)||(St(c,e.stopPropagation),_({offset:d.value}),b||(p("dragStart",{index:v.value}),b=!0)))},{target:h}),()=>{var c;return C("div",{ref:r,class:le()},[C("div",{ref:h,style:y.value,class:le("track",{vertical:e.vertical}),onTouchstartPassive:ne,onTouchend:oe,onTouchcancel:oe},[(c=u.default)==null?void 0:c.call(u)]),u.indicator?u.indicator({active:v.value,total:n.value}):e.showIndicators&&n.value>1?C("div",{class:le("indicators",{vertical:e.vertical})},[Array(n.value).fill("").map(ue)]):void 0])}}})),[et,Ie]=J("tabs");var tt=G({name:et,props:{count:me(Number),inited:Boolean,animated:Boolean,duration:me(E),swipeable:Boolean,lazyRender:Boolean,currentIndex:me(Number)},emits:["change"],setup(e,{emit:p,slots:u}){const r=O(),h=s=>p("change",s),t=()=>{var s;const l=(s=u.default)==null?void 0:s.call(u);return e.animated||e.swipeable?C(Ke,{ref:r,loop:!1,class:Ie("track"),duration:1e3*+e.duration,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:h},{default:()=>[l]}):l},b=s=>{const l=r.value;l&&l.state.active!==s&&l.swipeTo(s,{immediate:!e.inited})};return R(()=>e.currentIndex,b),fe(()=>{b(e.currentIndex)}),te({swipeRef:r}),()=>C("div",{class:Ie("content",{animated:e.animated||e.swipeable})},[t()])}});const[Se,ie]=J("tabs"),at={type:Le("line"),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:j(0),duration:j(.3),animated:Boolean,ellipsis:N,swipeable:Boolean,scrollspy:Boolean,offsetTop:j(0),background:String,lazyRender:N,showHeader:N,lineWidth:E,lineHeight:E,beforeChange:Function,swipeThreshold:j(5),titleActiveColor:String,titleInactiveColor:String},$e=Symbol(Se);var lt=G({name:Se,props:at,emits:["change","scroll","rendered","clickTab","update:active"],setup(e,{emit:p,slots:u}){let r,h,t,b,s;const l=O(),T=O(),n=O(),o=O(),d=ye(),g=We(l),[W,S]=$t(),{children:v,linkChildren:H}=Ee($e),y=se({inited:!1,position:"",lineStyle:{},currentIndex:-1}),F=k(()=>v.length>+e.swipeThreshold||!e.ellipsis||e.shrink),_=k(()=>({borderColor:e.color,background:e.background})),X=(a,i)=>{var f;return(f=a.name)!=null?f:i},U=k(()=>{const a=v[y.currentIndex];if(a)return X(a,y.currentIndex)}),V=k(()=>He(e.offsetTop)),Y=k(()=>e.sticky?V.value+r:0),L=a=>{const i=T.value,f=W.value;if(!(F.value&&i&&f&&f[y.currentIndex]))return;const w=f[y.currentIndex].$el,m=w.offsetLeft-(i.offsetWidth-w.offsetWidth)/2;b&&b(),b=function(B,I,M){let A,q=0;const de=B.scrollLeft,re=M===0?1:Math.round(1e3*M/16);return function ve(){B.scrollLeft+=(I-de)/re,++q<re&&(A=pe(ve))}(),function(){Me(A)}}(i,m,a?0:+e.duration)},z=()=>{const a=y.inited;Z(()=>{const i=W.value;if(!i||!i[y.currentIndex]||e.type!=="line"||K(l.value))return;const f=i[y.currentIndex].$el,{lineWidth:w,lineHeight:m}=e,B=f.offsetLeft+f.offsetWidth/2,I={width:Ne(w),backgroundColor:e.color,transform:`translateX(${B}px) translateX(-50%)`};if(a&&(I.transitionDuration=`${e.duration}s`),we(m)){const M=Ne(m);I.height=M,I.borderRadius=M}y.lineStyle=I})},D=(a,i)=>{const f=(I=>{const M=I<y.currentIndex?-1:1;for(;I>=0&&I<v.length;){if(!v[I].disabled)return I;I+=M}})(a);if(!we(f))return;const w=v[f],m=X(w,f),B=y.currentIndex!==null;y.currentIndex!==f&&(y.currentIndex=f,i||L(),z()),m!==e.active&&(p("update:active",m),B&&p("change",m,w.title)),t&&!e.scrollspy&&Tt(Math.ceil(Fe(l.value)-V.value))},P=(a,i)=>{const f=v.find((m,B)=>X(m,B)===a),w=f?v.indexOf(f):0;D(w,i)},ne=(a=!1)=>{if(e.scrollspy){const i=v[y.currentIndex].$el;if(i&&g.value){const f=Fe(i,g.value)-Y.value;h=!0,s&&s(),s=function(w,m,B,I){let M,A=Oe(w);const q=A<m,de=B===0?1:Math.round(1e3*B/16),re=(m-A)/de;return function ve(){A+=re,(q&&A>m||!q&&A<m)&&(A=m),yt(w,A),q&&A<m||!q&&A>m?M=pe(ve):I&&(M=pe(I))}(),function(){Me(M)}}(g.value,f,a?0:+e.duration,()=>{h=!1})}}},oe=(a,i,f)=>{const{title:w,disabled:m}=v[i],B=X(v[i],i);m||(zt(e.beforeChange,{args:[B],done:()=>{D(i),ne()}}),Rt(a)),p("clickTab",{name:B,title:w,event:f,disabled:m})},ue=a=>{t=a.isFixed,p("scroll",a)},c=()=>{if(e.type==="line"&&v.length)return C("div",{class:ie("line"),style:y.lineStyle},null)},$=()=>{var a,i,f;const{type:w,border:m,sticky:B}=e,I=[C("div",{ref:B?void 0:n,class:[ie("wrap"),{[Bt]:w==="line"&&m}]},[C("div",{ref:T,role:"tablist",class:ie("nav",[w,{shrink:e.shrink,complete:F.value}]),style:_.value,"aria-orientation":"horizontal"},[(a=u["nav-left"])==null?void 0:a.call(u),v.map(M=>M.renderTitle(oe)),c(),(i=u["nav-right"])==null?void 0:i.call(u)])]),(f=u["nav-bottom"])==null?void 0:f.call(u)];return B?C("div",{ref:n},[I]):I},x=()=>{z(),Z(()=>{var a,i;L(!0),(i=(a=o.value)==null?void 0:a.swipeRef.value)==null||i.resize()})};return R(()=>[e.color,e.duration,e.lineWidth,e.lineHeight],z),R(ge,x),R(()=>e.active,a=>{a!==U.value&&P(a)}),R(()=>v.length,()=>{y.inited&&(P(e.active),z(),Z(()=>{L(!0)}))}),te({resize:x,scrollTo:a=>{Z(()=>{P(a),ne(!0)})}}),_e(z),je(z),Ae(()=>{P(e.active,!0),Z(()=>{y.inited=!0,n.value&&(r=Q(n.value).height),L(!0)})}),xe(l,z),he("scroll",()=>{if(e.scrollspy&&!h){const a=(()=>{for(let i=0;i<v.length;i++){const{top:f}=Q(v[i].$el);if(f>Y.value)return i===0?0:i-1}return v.length-1})();D(a)}},{target:g,passive:!0}),H({id:d,props:e,setLine:z,scrollable:F,onRendered:(a,i)=>p("rendered",a,i),currentName:U,setTitleRefs:S,scrollIntoView:L}),()=>C("div",{ref:l,class:ie([e.type])},[e.showHeader?e.sticky?C(Qe,{container:l.value,offsetTop:V.value,onScroll:ue},{default:()=>[$()]}):$():null,C(tt,{ref:o,count:v.length,inited:y.inited,animated:e.animated,duration:e.duration,swipeable:e.swipeable,lazyRender:e.lazyRender,currentIndex:y.currentIndex,onChange:D},{default:()=>{var a;return[(a=u.default)==null?void 0:a.call(u)]}})])}});const it=Symbol(),[nt,Be]=J("tab"),ot=G({name:nt,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:E,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:N},setup(e,{slots:p}){const u=k(()=>{const h={},{type:t,color:b,disabled:s,isActive:l,activeColor:T,inactiveColor:n}=e;b&&t==="card"&&(h.borderColor=b,s||(l?h.backgroundColor=b:h.color=b));const o=l?T:n;return o&&(h.color=o),h}),r=()=>{const h=C("span",{class:Be("text",{ellipsis:!e.scrollable})},[p.title?p.title():e.title]);return e.dot||we(e.badge)&&e.badge!==""?C(_t,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:()=>[h]}):h};return()=>C("div",{id:e.id,role:"tab",class:[Be([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:u.value,tabindex:e.disabled?void 0:e.isActive?0:-1,"aria-selected":e.isActive,"aria-disabled":e.disabled||void 0,"aria-controls":e.controls},[r()])}}),[rt,st]=J("swipe-item"),ct=ee(G({name:rt,setup(e,{slots:p}){let u;const r=se({offset:0,inited:!1,mounted:!1}),{parent:h,index:t}=Ye(ke);if(!h)return;const b=k(()=>{const l={},{vertical:T}=h.props;return h.size.value&&(l[T?"height":"width"]=`${h.size.value}px`),r.offset&&(l.transform=`translate${T?"Y":"X"}(${r.offset}px)`),l}),s=k(()=>{const{loop:l,lazyRender:T}=h.props;if(!T||u)return!0;if(!r.mounted)return!1;const n=h.activeIndicator.value,o=h.count.value-1,d=n===0&&l?o:n-1,g=n===o&&l?0:n+1;return u=t.value===n||t.value===d||t.value===g,u});return fe(()=>{Z(()=>{r.mounted=!0})}),te({setOffset:l=>{r.offset=l}}),()=>{var l;return C("div",{class:st(),style:b.value},[s.value?(l=p.default)==null?void 0:l.call(p):null])}}})),[ut,ce]=J("tab");Pe=ee(G({name:ut,props:Xe({},Mt,{dot:Boolean,name:E,badge:E,title:String,disabled:Boolean,titleClass:Ot,titleStyle:[String,Object],showZeroBadge:N}),setup(e,{slots:p}){const u=ye(),r=O(!1),h=Te(),{parent:t,index:b}=Ye($e);if(!t)return;const s=()=>{var d;return(d=e.name)!=null?d:b.value},l=k(()=>{const d=s()===t.currentName.value;return d&&!r.value&&(r.value=!0,t.props.lazyRender&&Z(()=>{t.onRendered(s(),e.title)})),d}),T=O(""),n=O("");dt(()=>{const{titleClass:d,titleStyle:g}=e;T.value=d?vt(d):"",n.value=g&&typeof g!="string"?ft(pt(g)):g});const o=O(!l.value);return R(l,d=>{d?o.value=!1:ae(()=>{o.value=!0})}),R(()=>e.title,()=>{t.setLine(),t.scrollIntoView()}),ht(it,l),te({id:u,renderTitle:d=>C(ot,mt({key:u,id:`${t.id}-${b.value}`,ref:t.setTitleRefs(b.value),style:n.value,class:T.value,isActive:l.value,controls:u,scrollable:t.scrollable.value,activeColor:t.props.titleActiveColor,inactiveColor:t.props.titleInactiveColor,onClick:g=>d(h.proxy,b.value,g)},De(t.props,["type","color","shrink"]),De(e,["dot","badge","title","disabled","showZeroBadge"])),{title:p.title})}),()=>{var d;const g=`${t.id}-${b.value}`,{animated:W,swipeable:S,scrollspy:v,lazyRender:H}=t.props;if(!p.default&&!W)return;const y=v||l.value;if(W||S)return C(ct,{id:u,role:"tabpanel",class:ce("panel-wrapper",{inactive:o.value}),tabindex:l.value?0:-1,"aria-hidden":!l.value,"aria-labelledby":g},{default:()=>{var _;return[C("div",{class:ce("panel")},[(_=p.default)==null?void 0:_.call(p)])]}});const F=r.value||v||!H?(d=p.default)==null?void 0:d.call(p):null;return gt(C("div",{id:u,role:"tabpanel",class:ce("panel"),tabindex:y?0:-1,"aria-labelledby":g},[F]),[[bt,y]])}}})),Ge=ee(lt)});export{Pe as T,Lt as __tla,Ge as a};
|