import{aO as c,r as f,i as Z,c4 as N,c5 as O,k as v,c6 as $,c7 as ee,c8 as u,c9 as V,m,c as re,j as te}from"./index-BQOx4Ar7.js";var ne=function(a){return a===document||a===document.documentElement||a===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):a.scrollTop},k=function(a){return a.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)},ae=function(a){return a.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight)},ce=function(a,n){n===void 0&&(n={});var g=n.target,A=n.isNoMore,p=n.threshold,F=p===void 0?100:p,w=n.direction,q=w===void 0?"bottom":w,L=n.reloadDeps,P=L===void 0?[]:L,Y=n.manual,h=n.onBefore,_=n.onSuccess,D=n.onError,M=n.onFinally,j=c(f.useState(),2),i=j[0],y=j[1],B=c(f.useState(!1),2),E=B[0],s=B[1],S=q==="top",T=f.useRef(void 0),R=f.useRef(0),H=f.useMemo(function(){return A?A(i):!1},[i]),d=Z(function(e){return N(void 0,void 0,void 0,function(){var r;return O(this,function(t){switch(t.label){case 0:return[4,a(e)];case 1:return r=t.sent(),[2,{currentData:r,lastData:e}]}})})},{manual:Y,onFinally:function(e,r,t){s(!1),M?.(r?.currentData,t)},onBefore:function(){return h?.()},onSuccess:function(e){var r,t,l;e.lastData?y(m(m({},e.currentData),{list:S?u(u([],c(e.currentData.list),!1),c((t=e.lastData.list)!==null&&t!==void 0?t:[]),!1):u(u([],c((l=e.lastData.list)!==null&&l!==void 0?l:[]),!1),c(e.currentData.list),!1)})):y(m(m({},e.currentData),{list:u([],c((r=e.currentData.list)!==null&&r!==void 0?r:[]),!1)})),setTimeout(function(){if(S){var o=V(g);if(o=o===document?document.documentElement:o,o){var X=k(o);o.scrollTo(0,X-R.current)}}else C()}),_?.(e.currentData)},onError:function(e){return D?.(e)}}),z=d.loading,G=d.error,b=d.run,J=d.runAsync,K=d.cancel,x=v(function(){H||(s(!0),b(i))}),I=function(e){return N(void 0,void 0,void 0,function(){var r;return O(this,function(t){switch(t.label){case 0:return[4,J(e)];case 1:return r=t.sent(),[2,r.currentData]}})})},Q=v(function(){return H?Promise.reject():(s(!0),I(i))}),U=function(){return s(!1),b()},W=function(){return s(!1),I()},C=function(){var e=V(g);if(e){var r=e===document?document.documentElement:e,t=ne(r),l=k(r),o=ae(r);S?(T.current!==void 0&&T.current>t&&t<=F&&x(),T.current=t,R.current=l-t):l-t<=o+F&&x()}};return $("scroll",function(){z||E||C()},{target:g}),ee(function(){b()},u([],c(P),!1)),{data:i,loading:!E&&z,error:G,loadingMore:E,noMore:H,loadMore:x,loadMoreAsync:Q,reload:v(U),reloadAsync:v(W),mutate:y,cancel:K}};const le=re(te.jsx("path",{d:"m23 12-2.44-2.79.34-3.69-3.61-.82-1.89-3.2L12 2.96 8.6 1.5 6.71 4.69 3.1 5.5l.34 3.7L1 12l2.44 2.79-.34 3.7 3.61.82L8.6 22.5l3.4-1.47 3.4 1.46 1.89-3.19 3.61-.82-.34-3.69zm-12.91 4.72-3.8-3.81 1.48-1.48 2.32 2.33 5.85-5.87 1.48 1.48z"}));export{le as V,ce as u};
