import"./jwt-decode.esm-CX61wVx3.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="d3092c9e-afce-4e17-8eb8-92cfba703169",n._sentryDebugIdIdentifier="sentry-dbid-d3092c9e-afce-4e17-8eb8-92cfba703169")}catch{}})();const u=1e3,g=n=>{let e=null,t=null,o=0;const d=()=>document.hidden&&n.backgroundInterval!==void 0?n.backgroundInterval:n.interval??u,c=()=>!document.hidden||n.keepPollingOnOutOfFocus===!0||n.backgroundInterval!==void 0,l=async i=>{try{c()&&await n.task()}finally{i===o&&(e=setTimeout(()=>l(i),d()))}},s=()=>{const i=++o;e&&clearTimeout(e),document.hidden?e=setTimeout(()=>l(i),d()):l(i)};return{startPolling:()=>{const i=++o;e&&clearTimeout(e),t&&document.removeEventListener("visibilitychange",t),t=s,document.addEventListener("visibilitychange",t),l(i)},endPolling:()=>{o+=1,e&&clearTimeout(e),e=null,t&&(document.removeEventListener("visibilitychange",t),t=null)}}};export{g as u};
//# sourceMappingURL=polling-DKdJFQQ3.js.map
