import{E as e,Tt as t,pt as n}from"./vue-vendor-DMUmTARL.js";import{l as r}from"./index-kSn5YXd0.js";var i=t(!1),a=t(!1),o=t(!1),s=t(0),c=r(),l=null,u=null,d=0,f=(e,t)=>{let n=Number(e);return Number.isNaN(n)||n<0?t:Math.min(n,5e3)},p=()=>{l!==null&&(clearTimeout(l),l=null)},m=()=>{u!==null&&(clearTimeout(u),u=null)},h=()=>{let e=c.zfileConfig?.skeleton||{};return e.enable===!1?!1:a.value?e.show===`always`?e.showAfterFirst!==!1:!1:!0},g=e=>{!i.value||e!==d||(o.value=!0,s.value=Date.now())};n(i,e=>{d+=1;let t=d;if(p(),m(),e){if(!h()){o.value=!1,s.value=0;return}if(o.value)return;let e=f((c.zfileConfig?.skeleton||{}).delayMs,120);if(e===0){g(t);return}l=setTimeout(()=>{g(t)},e);return}if(!o.value){s.value=0;return}let n=f((c.zfileConfig?.skeleton||{}).minDurationMs,180)-(Date.now()-s.value);if(n<=0){o.value=!1,s.value=0;return}u=setTimeout(()=>{t===d&&(o.value=!1,s.value=0)},n)});var _=e(()=>o.value),v=e(()=>(c.zfileConfig?.skeleton||{}).showBasicLoading===!0?i.value&&!_.value:!1);function y(){return{loading:i,firstLoading:a,skeletonLoading:_,basicLoading:v}}export{y as t};