import{b as L,d as j,_ as P,a as g,u as B,c as m,o as p,m as O,e as $,g as u,b_ as z,n as S,U as T,z as R,I as M,F as q,aQ as K,C as Q,a1 as Y,r as w,P as k,ap as N,ab as G,q as I,b3 as J,w as W,l as X,$ as C,ac as Z}from"./index-DpP8vbvu.js";import{t as x}from"./index-BMdPKuCq.js";import{g as ee}from"./vnode-DPqF99Zc.js";import{g as te}from"./position-5hNBDW7r.js";import{t as H}from"./throttle-BCwYugI2.js";const ne=L({animated:Boolean,count:{type:Number,default:1},rows:{type:Number,default:3},loading:{type:Boolean,default:!0},throttle:{type:j([Number,Object])}}),se=L({variant:{type:String,values:["circle","rect","h1","h3","text","caption","p","image","button"],default:"text"}}),oe=g({name:"ElSkeletonItem"}),ae=g({...oe,props:se,setup(e){const t=B("skeleton");return(s,n)=>(p(),m("div",{class:S([u(t).e("item"),u(t).e(s.variant)])},[s.variant==="image"?(p(),O(u(z),{key:0})):$("v-if",!0)],2))}});var v=P(ae,[["__file","skeleton-item.vue"]]);const le=(e,t=0)=>{if(t===0)return e;const s=T(t)&&!!t.initVal,n=R(s);let a=null;const o=l=>{if(Q(l)){n.value=e.value;return}a&&clearTimeout(a),a=setTimeout(()=>{n.value=e.value},l)},r=l=>{l==="leading"?K(t)?o(t):o(t.leading):T(t)?o(t.trailing):n.value=!1};return M(()=>r("leading")),q(()=>e.value,l=>{r(l?"leading":"trailing")}),n},re=g({name:"ElSkeleton"}),ie=g({...re,props:ne,setup(e,{expose:t}){const s=e,n=B("skeleton"),a=le(Y(s,"loading"),s.throttle);return t({uiLoading:a}),(o,r)=>u(a)?(p(),m("div",I({key:0,class:[u(n).b(),u(n).is("animated",o.animated)]},o.$attrs),[(p(!0),m(k,null,N(o.count,l=>(p(),m(k,{key:l},[u(a)?w(o.$slots,"template",{key:l},()=>[G(v,{class:S(u(n).is("first")),variant:"p"},null,8,["class"]),(p(!0),m(k,null,N(o.rows,c=>(p(),O(v,{key:c,class:S([u(n).e("paragraph"),u(n).is("last",c===o.rows&&o.rows>1)]),variant:"p"},null,8,["class"]))),128))]):$("v-if",!0)],64))),128))],16)):w(o.$slots,"default",J(I({key:1},o.$attrs)))}});var ce=P(ie,[["__file","skeleton.vue"]]);const Se=W(ce,{SkeletonItem:v}),_e=X(v),i="ElInfiniteScroll",ue=50,de=200,fe=0,pe={delay:{type:Number,default:de},distance:{type:Number,default:fe},disabled:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0}},y=(e,t)=>Object.entries(pe).reduce((s,[n,a])=>{var o,r;const{type:l,default:c}=a,f=e.getAttribute(`infinite-scroll-${n}`);let d=(r=(o=t[f])!=null?o:f)!=null?r:c;return d=d==="false"?!1:d,d=l(d),s[n]=Number.isNaN(d)?c:d,s},{}),V=e=>{const{observer:t}=e[i];t&&(t.disconnect(),delete e[i].observer)},me=(e,t)=>{const{container:s,containerEl:n,instance:a,observer:o,lastScrollTop:r}=e[i],{disabled:l,distance:c}=y(e,a),{clientHeight:f,scrollHeight:d,scrollTop:b}=n,A=b-r;if(e[i].lastScrollTop=b,o||l||A<0)return;let h=!1;if(s===e)h=d-(f+b)<=c;else{const{clientTop:F,scrollHeight:D}=e,U=te(e,n);h=b+f>=U+F+D-c}h&&t.call(a)};function E(e,t){const{containerEl:s,instance:n}=e[i],{disabled:a}=y(e,n);a||s.clientHeight===0||(s.scrollHeight<=s.clientHeight?t.call(n):V(e))}const be={async mounted(e,t){const{instance:s,value:n}=t;Z(n)||x(i,"'v-infinite-scroll' binding value must be a function"),await C();const{delay:a,immediate:o}=y(e,s),r=ee(e,!0),l=r===window?document.documentElement:r,c=H(me.bind(null,e,n),a);if(r){if(e[i]={instance:s,container:r,containerEl:l,delay:a,cb:n,onScroll:c,lastScrollTop:l.scrollTop},o){const f=new MutationObserver(H(E.bind(null,e,n),ue));e[i].observer=f,f.observe(e,{childList:!0,subtree:!0}),E(e,n)}r.addEventListener("scroll",c)}},unmounted(e){if(!e[i])return;const{container:t,onScroll:s}=e[i];t?.removeEventListener("scroll",s),V(e)},async updated(e){if(!e[i])await C();else{const{containerEl:t,cb:s,observer:n}=e[i];t.clientHeight&&n&&E(e,s)}}},_=be;_.install=e=>{e.directive("InfiniteScroll",_)};const ye=_;function Te(e){return new Promise(t=>setTimeout(t,e))}export{Se as E,_e as a,ye as b,Te as s};
