1let idbModule = null; 2let isLoading = false; 3let loadPromise = null; 4export async function getOpenDB() { 5 await ensureIdbLoaded(); 6 return idbModule.openDB; 7} 8export async function getDeleteDB() { 9 await ensureIdbLoaded(); 10 return idbModule.deleteDB; 11} 12async function ensureIdbLoaded() { 13 if (idbModule) 14 return; 15 if (isLoading && loadPromise) { 16 await loadPromise; 17 return; 18 } 19 isLoading = true; 20 loadPromise = loadIdbWithFallback(); 21 try { 22 idbModule = await loadPromise; 23 } 24 finally { 25 isLoading = false; 26 loadPromise = null; 27 } 28} 29async function loadIdbWithFallback() { 30 try { 31 // Try online CDN first for latest version 32 // @ts-ignore - Dynamic import from CDN 33 const onlineModule = await import('https://cdn.skypack.dev/idb'); 34 console.log('Loaded idb from online CDN'); 35 return onlineModule; 36 } 37 catch (onlineError) { 38 console.warn('Failed to load idb from CDN, falling back to bundled version:', onlineError); 39 try { 40 // Fallback to bundled version (will be available as static asset) 41 // In Blazor, this would be loaded via JS interop or as a module 42 const bundledModule = await import('../wwwroot/lib/index.js'); 43 console.log('Loaded idb from bundled version'); 44 return bundledModule; 45 } 46 catch (localError) { 47 console.error('Failed to load idb from bundled version:', localError); 48 throw new Error('Unable to load idb library from any source'); 49 } 50 } 51} 52//# sourceMappingURL=idb-loader.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.