{"version":3,"file":"safeImport.mjs","names":[],"sources":["../../src/safeImport.ts"],"sourcesContent":["import { retry } from './retry';\n\n/**\n * Safely imports a module with automatic retries on failure.\n * Useful for dynamic imports that might fail due to network issues or temporary loading problems.\n * Retries up to 3 times with exponential backoff.\n *\n * @param importFn - A function that returns a dynamic import promise\n * @returns A promise that resolves to the imported module\n *\n * @example\n * ```typescript\n * const module = await safeImport(() => import('./my-module'));\n * ```\n */\nexport const safeImport = async <T = any>(importFn: () => Promise<T>): Promise<T> => {\n  return retry(importFn, {\n    initialDelay: 100,\n    shouldRetry: (_, iterations) => iterations <= 3,\n    retryImmediately: true,\n    factor: 2,\n  });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,aAAa,OAAgB,aAA2C;AACnF,QAAO,MAAM,UAAU;EACrB,cAAc;EACd,cAAc,GAAG,eAAe,cAAc;EAC9C,kBAAkB;EAClB,QAAQ;EACT,CAAC"}