{"version":3,"sources":["../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.26_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","../lib/stable/legacy.ts","../lib/stable/native.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","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","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":";AACA,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAE9B,IAAM,cAAc,MAAM,cAAc,YAAY,GAAG;AACvD,IAAM,aAAa,MAAM,KAAK,QAAQ,YAAY,CAAC;AAE5C,IAAM,YAA4B,2BAAW;;;ACPpD,SAAS,qBAAqB;AAC9B,OAAOA,WAAU;;;ACDjB,SAAS,YAAY,oBAAoB;AACzC,OAAOC,WAAU;AACjB,SAAS,iBAAAC,sBAAqB;AAC9B,OAAO,kBAAkB;AAyBzB,SAAS,kBAA0B;AACjC,SAAO,OAAO,cAAc,WACxB,YACAD,MAAK,QAAQC,eAAc,YAAY,GAAG,CAAC;AACjD;AAEO,SAAS,gBAAgB,QAAQ,gBAAgB,GAAW;AACjE,MAAI,UAAU;AACd,aAAS;AACP,UAAM,WAAWD,MAAK,KAAK,SAAS,cAAc;AAClD,QAAI,WAAW,QAAQ,GAAG;AACxB,UAAI;AACF,cAAM,SAAS,KAAK,MAAM,aAAa,UAAU,MAAM,CAAC;AAGxD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