{"version":3,"sources":["../lib/stable/legacy.ts","../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.26_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","../lib/stable/native.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\nimport { findPackageRoot } from \"./native\";\n\nconst localRequire = createRequire(path.join(findPackageRoot(), \"package.json\"));\nconst BetaLibRaw = localRequire(path.join(findPackageRoot(), \"lib\", \"index.js\")) as {\n  new (): {\n    close(): Promise<unknown>;\n    [name: string]: unknown;\n  };\n};\n\nconst warningKey = Symbol.for(\"lightdrift-libraw.legacy-warning-emitted\");\nconst warningState = globalThis as typeof globalThis & {\n  [warningKey]?: boolean;\n};\n\nclass LegacyLibRaw extends BetaLibRaw {\n  constructor() {\n    if (!warningState[warningKey]) {\n      warningState[warningKey] = true;\n      process.emitWarning(\n        \"lightdrift-libraw/legacy is deprecated and will be removed in v2; migrate to the stable root API.\",\n        { code: \"LIGHTDRIFT_LIBRAW_LEGACY\", type: \"DeprecationWarning\" },\n      );\n    }\n    super();\n  }\n}\n\nexport { LegacyLibRaw };\nexport default LegacyLibRaw;\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n  typeof document === \"undefined\" \n    ? new URL(`file:${__filename}`).href \n    : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n      ? document.currentScript.src \n      : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport nodeGypBuild from \"node-gyp-build\";\n\nexport interface NativeWrapper {\n  [name: string]: any;\n}\n\nexport interface NativeWrapperConstructor {\n  new (flags?: number): NativeWrapper;\n  getVersion(): string;\n  getCapabilities(): number;\n  getCameraList(): string[];\n  getCameraCount(): number;\n  cameraMakerIndexToMaker(index: number): string | null;\n  simplifyMakeModel(index: number, make: string, model: string): {\n    makerIndex: number;\n    make: string;\n    model: string;\n  };\n  strProgress(progress: number): string;\n}\n\nexport interface NativeAddon {\n  LibRawWrapper: NativeWrapperConstructor;\n}\n\nfunction moduleDirectory(): string {\n  return typeof __dirname === \"string\"\n    ? __dirname\n    : path.dirname(fileURLToPath(import.meta.url));\n}\n\nexport function findPackageRoot(start = moduleDirectory()): string {\n  let current = start;\n  for (;;) {\n    const manifest = path.join(current, \"package.json\");\n    if (existsSync(manifest)) {\n      try {\n        const parsed = JSON.parse(readFileSync(manifest, \"utf8\")) as {\n          name?: string;\n        };\n        if (parsed.name === \"lightdrift-libraw\") return current;\n      } catch {\n        // Keep walking; a parent package may own the bundled file.\n      }\n    }\n    const parent = path.dirname(current);\n    if (parent === current) break;\n    current = parent;\n  }\n  throw new Error(\"Cannot locate the lightdrift-libraw package root\");\n}\n\nlet cachedAddon: NativeAddon | undefined;\n\nexport function loadNativeAddon(): NativeAddon {\n  cachedAddon ??= nodeGypBuild(findPackageRoot()) as NativeAddon;\n  return cachedAddon;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADZ9D,yBAA8B;AAC9B,IAAAA,oBAAiB;;;AEDjB,qBAAyC;AACzC,uBAAiB;AACjB,sBAA8B;AAC9B,4BAAyB;AAyBzB,SAAS,kBAA0B;AACjC,SAAO,OAAO,cAAc,WACxB,YACA,iBAAAC,QAAK,YAAQ,+BAAc,aAAe,CAA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