import{P as d,_,S as w,o as f,f as m,n as g,a9 as k,aa as y,j as v,F as P,i as l,a as C,z as E}from"./vendor.7e4e5e39.js";import{_ as b}from"./plugin-vue_export-helper.21dcd24c.js";const j={props:{nodeElement:Object,loadText:{type:String,default:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 ..."},nextCursor:{type:String,default:""}},emits:["fromPagination"],setup(t,{emit:i}){const s=d(t.nextCursor),n=d(!1);let a=!1,e=null;const p=()=>(n.value=!0,s.value?new Promise(o=>{C.get(E().url.value,{params:{cursor:s.value}}).then(({data:r})=>{r.collections.length&&(s.value=r.next,i("fromPagination",r.collections),o(!0)),o(!1)})}):Promise.resolve(null)),c=()=>{if(t.nodeElement){const o=r=>{r.forEach(u=>{u.isIntersecting&&(console.log("isIntersecting"),console.log(t.nodeElement),h(u.target),p().then(x=>{n.value=!1,x&&c()}))})};e=new IntersectionObserver(o,{}),e.observe(t.nodeElement)}},h=o=>{e.unobserve(o),e==null||e.disconnect()};return _(()=>{a||(c(),a=!0)}),w(()=>{e==null||e.disconnect()}),{loading:n}}},I={key:0,class:"col-span-full flex justify-center"},O=l("svg",{class:"flex-shrink-0 animate-spin h-6 w-6 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[l("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),l("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1),S=[O];function z(t,i,s,n,a,e){return f(),m(P,null,[g(t.$slots,"default",k(y(t.$attrs))),n.loading?g(t.$slots,"loading",{key:0,text:s.loadText},()=>[n.loading?(f(),m("div",I,S)):v("",!0)]):v("",!0)],64)}var V=b(j,[["render",z]]);export{V as I};