import"./router-iclNQ3sb.js";import{r as u}from"./jwt-decode.esm-CQm3LY6y.js";import{T as c}from"./tables-D9fKw_fk.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="e82ed85b-bb7c-40f8-abba-32aedb0b6143",e._sentryDebugIdIdentifier="sentry-dbid-e82ed85b-bb7c-40f8-abba-32aedb0b6143")}catch{}})();const s=new Map,n=new Set,y=e=>{const a=u([]),t=u(!1),r=u(null),b=async(i=!1)=>{if(!i&&s.has(e))return a.value=s.get(e),a.value;if(n.has(e)){for(;n.has(e);)await new Promise(l=>setTimeout(l,100));return a.value=s.get(e)||[],a.value}try{t.value=!0,n.add(e),r.value=null;const l=await c.list(e);return a.value=l,s.set(e,l),l}catch(l){throw r.value=l,console.error("Error fetching tables:",l),l}finally{t.value=!1,n.delete(e)}},f=i=>a.value.find(l=>l.id===i)||null,o=()=>{s.delete(e)},d=()=>{s.clear()};return!s.has(e)&&!n.has(e)?b():s.has(e)&&(a.value=s.get(e)),{tables:a,loading:t,error:r,fetchTables:b,getTableById:f,invalidateCache:o,invalidateAllCache:d}};export{y as u};
//# sourceMappingURL=useTables-RDVYjAt_.js.map
