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S,2BACd,YAAA,EACqB;AACrB,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,OAAO,4BAA4B,YAAY,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,cAAA,CAAe,MAAA,CAAO,QAAA,CAAS,QAAQ,CAAA,EAAG;AAC5C,IAAA,MAAM,IAAA,GAAO,iBAAiB,YAAY,CAAA,eAAA,CAAA;AAC1C,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,MACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,KACvC;AAAA,EACF;AAEA,EAAA,OAAO,yBAAA,EAA0B;AACnC;;;AC5EO,SAAS,oBAAoB,IAAA,EAA6B;AAC/D,EAAA,IAAI,SAAS,MAAA,EAAW;AACtB,IAAA,OAAO,4BAA4B,IAAI,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,UAAU,0BAAA,EAA2B;AAC3C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,2PAAe,CAAA,CAAE,IAAA;AAAA,IAC7D,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,2PAAe,CAAA,CAAE;AAAA,GAC/D;AACF","file":"paths.cjs","sourcesContent":["{\n  \"name\": \"arc-sdk-test\",\n  \"version\": \"0.0.56\",\n  \"description\": \"Arcane Privacy SDK\",\n  \"type\": \"module\",\n  \"main\": \"./dist/index.cjs\",\n  \"module\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"sideEffects\": false,\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/index.d.ts\",\n        \"default\": \"./dist/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/index.d.cts\",\n        \"default\": \"./dist/index.cjs\"\n      }\n    },\n    \"./circuits/paths\": {\n      \"import\": \"./dist/circuits/paths.js\",\n      \"require\": \"./dist/circuits/paths.cjs\",\n      \"default\": \"./dist/circuits/paths.js\"\n    },\n    \"./circuits/*\": \"./dist/circuits/*\",\n    \"./vite\": {\n      \"import\": {\n        \"types\": \"./dist/vite/index.d.ts\",\n        \"default\": \"./dist/vite/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/vite/index.d.cts\",\n        \"default\": \"./dist/vite/index.cjs\"\n      }\n    },\n    \"./react\": {\n      \"import\": {\n        \"types\": \"./dist/react/index.d.ts\",\n        \"default\": \"./dist/react/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/react/index.d.cts\",\n        \"default\": \"./dist/react/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"peerDependencies\": {\n    \"@solana/wallet-adapter-react\": \">=0.15.0\",\n    \"react\": \">=18\"\n  },\n  \"peerDependenciesMeta\": {\n    \"@solana/wallet-adapter-react\": {\n      \"optional\": true\n    },\n    \"react\": {\n      \"optional\": true\n    }\n  },\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"prepare:snarkjs\": \"node scripts/prepare-snarkjs.mjs\",\n    \"build\": \"npm run prepare:snarkjs && tsup\",\n    \"dev\": \"npm run prepare:snarkjs && tsup --watch\",\n    \"typecheck\": \"npm run prepare:snarkjs && tsc --noEmit\",\n    \"prepublishOnly\": \"npm run build\"\n  },\n  \"keywords\": [\n    \"arc-sdk-test\",\n    \"sdk\"\n  ],\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"@solana/wallet-adapter-react\": \"^0.15.39\",\n    \"@types/node\": \"^26.0.0\",\n    \"@types/react\": \"^19.1.8\",\n    \"react\": \"^19.1.0\",\n    \"tsup\": \"^8.5.0\",\n    \"typescript\": \"^5.8.3\"\n  },\n  \"engines\": {\n    \"node\": \">=18\"\n  },\n  \"dependencies\": {\n    \"@coral-xyz/anchor\": \"^0.31.1\",\n    \"@solana/spl-token\": \"^0.4.14\",\n    \"@solana/web3.js\": \"^1.98.4\",\n    \"@switchboard-xyz/common\": \"^5.8.1\",\n    \"@switchboard-xyz/on-demand\": \"^3.10.1\",\n    \"buffer\": \"^6.0.3\",\n    \"ffjavascript\": \"^0.3.1\",\n    \"fixed-merkle-tree\": \"^0.7.3\",\n    \"poseidon-hash\": \"^1.0.1\",\n    \"tweetnacl\": \"^1.0.3\"\n  }\n}\n","import packageJson from \"../../package.json\";\n\n/** npm package name (used to load the standalone circuits module). */\nexport const PACKAGE_NAME = packageJson.name;\n\n/** Published npm version (pins CDN circuit URLs in production). */\nexport const PACKAGE_VERSION = packageJson.version;\n\n/** Withdraw circuit artifact filenames (published under `arcane-sdk/circuits/`). */\nexport const WITHDRAW_CIRCUIT_WASM = \"withdraw.wasm\";\nexport const WITHDRAW_CIRCUIT_ZKEY = \"withdraw.zkey\";\n/**\n * Pinned SHA-256 hashes for the published withdraw circuit artifacts.\n * These are verified in-browser before passing artifacts to snarkjs.\n */\nexport const WITHDRAW_CIRCUIT_SHA256 = {\n  wasm: \"2565a8dd94b0b3cb9ec6d415933ab05ed5d32ac07165b71be6bcf31615fc0330\",\n  zkey: \"64a4d915099f6fe6bfa06e151c254843be8773c7991c742260019dc5184e5d82\",\n} as const;\n\n/** Optional self-hosted path convention (opt-in via `circuitPathsBase`). */\nexport const SELF_HOSTED_CIRCUIT_BASE = \"/circuits/\";\n\n/**\n * Stable published source for the pinned circuit artifacts.\n *\n * Decoupled from {@link PACKAGE_VERSION} on purpose: the withdraw circuit is a\n * fixed cryptographic artifact, so SDK code releases must not change where the\n * verified circuits are fetched from. Bump these together with\n * {@link WITHDRAW_CIRCUIT_SHA256} only when the circuit itself changes.\n */\nexport const CIRCUIT_CDN_PACKAGE = \"arcane-privacy-sdk\";\nexport const CIRCUIT_CDN_VERSION = \"0.0.2\";\n\nexport type CircuitPaths = {\n  wasm: string;\n  zkey: string;\n};\n\n/** Resolve circuit URLs when the caller knows the package `dist/` root. */\nexport function resolveCircuitPathsFromBase(base: string): CircuitPaths {\n  const root = base.endsWith(\"/\") ? base : `${base}/`;\n  return {\n    wasm: `${root}circuits/${WITHDRAW_CIRCUIT_WASM}`,\n    zkey: `${root}circuits/${WITHDRAW_CIRCUIT_ZKEY}`,\n  };\n}\n\n/**\n * Base URL for circuit files on jsDelivr.\n *\n * Pinned to {@link CIRCUIT_CDN_PACKAGE}@{@link CIRCUIT_CDN_VERSION} (not the\n * current SDK version) so the bytes always match {@link WITHDRAW_CIRCUIT_SHA256}.\n * This URL is independent of the consuming app's origin/domain.\n */\nexport function resolveNpmCdnCircuitBase(): string {\n  return `https://cdn.jsdelivr.net/npm/${CIRCUIT_CDN_PACKAGE}@${CIRCUIT_CDN_VERSION}/dist/circuits/`;\n}\n\n/** Trusted jsDelivr fallback paths for pinned withdraw circuit artifacts. */\nexport function resolveNpmCdnCircuitPaths(): CircuitPaths {\n  const base = resolveNpmCdnCircuitBase();\n  return {\n    wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n    zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n  };\n}\n\nfunction isLocalDevHost(hostname: string): boolean {\n  return (\n    hostname === \"localhost\" ||\n    hostname === \"127.0.0.1\" ||\n    hostname === \"[::1]\"\n  );\n}\n\n/**\n * Browser circuit URLs.\n *\n * - Local dev (Vite): `/node_modules/<pkg>/dist/circuits/` — Vite serves node_modules.\n * - Production: pinned, domain-independent jsDelivr CDN (verified by SHA-256 before use).\n *\n * The production default does not depend on the app's own origin/domain, so it\n * works on any deployed host with no copy step. Artifacts are always integrity\n * checked before proving (see {@link WITHDRAW_CIRCUIT_SHA256}). To self-host\n * instead, pass {@link ArcaneSdkInitOptions.circuitPathsBase} (e.g. `\"/circuits/\"`);\n * it is verified too and falls back to the CDN if unavailable.\n */\nexport function resolveBrowserCircuitPaths(\n  baseOverride?: string\n): CircuitPaths | null {\n  if (typeof window === \"undefined\") {\n    return null;\n  }\n\n  if (baseOverride !== undefined) {\n    return resolveCircuitPathsFromBase(baseOverride);\n  }\n\n  if (isLocalDevHost(window.location.hostname)) {\n    const base = `/node_modules/${PACKAGE_NAME}/dist/circuits/`;\n    return {\n      wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n      zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n    };\n  }\n\n  return resolveNpmCdnCircuitPaths();\n}\n","import {\n  WITHDRAW_CIRCUIT_WASM,\n  WITHDRAW_CIRCUIT_ZKEY,\n  resolveBrowserCircuitPaths,\n  resolveCircuitPathsFromBase,\n  type CircuitPaths,\n} from \"./constants\";\n\nexport {\n  PACKAGE_NAME,\n  SELF_HOSTED_CIRCUIT_BASE,\n  WITHDRAW_CIRCUIT_SHA256,\n  WITHDRAW_CIRCUIT_WASM,\n  WITHDRAW_CIRCUIT_ZKEY,\n  resolveBrowserCircuitPaths,\n  resolveCircuitPathsFromBase,\n  resolveNpmCdnCircuitPaths,\n  resolveNpmCdnCircuitBase,\n  type CircuitPaths,\n} from \"./constants\";\n\n/**\n * Resolve default Groth16 circuit URLs.\n *\n * Published as `arcane-sdk/circuits/paths` so `import.meta.url` stays next to\n * `withdraw.wasm` and `withdraw.zkey` in `dist/circuits/` (Node / unbundled ESM).\n *\n * In the browser, defaults to `/node_modules/<pkg>/dist/circuits/` on localhost\n * and the pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).\n * Override via {@link ArcaneSdkInitOptions.circuitPathsBase},\n * {@link resolveCircuitPathsFromBase}, or {@link GenerateWithdrawProofOptions}.\n */\nexport function resolveCircuitPaths(base?: string): CircuitPaths {\n  if (base !== undefined) {\n    return resolveCircuitPathsFromBase(base);\n  }\n\n  const browser = resolveBrowserCircuitPaths();\n  if (browser) {\n    return browser;\n  }\n\n  return {\n    wasm: new URL(`./${WITHDRAW_CIRCUIT_WASM}`, import.meta.url).href,\n    zkey: new URL(`./${WITHDRAW_CIRCUIT_ZKEY}`, import.meta.url).href,\n  };\n}\n"]}