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0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC7F,CAAC;IACD,MAAM,IAAA,mBAAI,EAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,SAAS,EAAE,EAAE,YAAY,YAAY,EAAE,EAAE,SAAS,UAAU,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AACzI,CAAC","sourcesContent":["import { exec, exists, InvalidConfigurationError, resolveEnvToolsetPath, sanitizeDirPath } from \"builder-util\"\nimport * as path from \"path\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\n\nconst iconsToolsChecksums = {\n  \"icons-bundle.tar.gz\": \"2241c9501aa5ddd19317956449f50a1bc311df2c34058aae9bf8bfe62081eaec\",\n} as const\n\nexport async function getIconsToolsetPath(): Promise<string> {\n  const envPath = await resolveEnvToolsetPath(\"ELECTRON_BUILDER_ICONS_TOOLSET_DIR\", \"directory\")\n  if (envPath != null) {\n    return envPath\n  }\n  return downloadBuilderToolset({\n    releaseName: \"icons@1.1.0\",\n    filenameWithExt: \"icons-bundle.tar.gz\",\n    checksums: iconsToolsChecksums,\n    githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n  })\n}\n\ntype IconConversionOptions = {\n  inputFile: string\n  outputFormat: \"icns\" | \"ico\" | \"set\"\n  outDir: string\n}\n\nconst VALID_OUTPUT_FORMATS = [\"icns\", \"ico\", \"set\"] as const\n\nexport async function runIconsTool({ inputFile, outputFormat, outDir }: IconConversionOptions): Promise<void> {\n  if (!(VALID_OUTPUT_FORMATS as readonly string[]).includes(outputFormat)) {\n    throw new InvalidConfigurationError(`Invalid icon output format: ${outputFormat}`)\n  }\n  const safeInput = sanitizeDirPath(inputFile)\n  const safeOutDir = sanitizeDirPath(outDir)\n\n  const toolsetPath = await getIconsToolsetPath()\n  const scriptPath = path.resolve(toolsetPath, \"icon-tool.js\")\n  if (!(await exists(scriptPath))) {\n    throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`)\n  }\n  await exec(process.execPath, [scriptPath, `--input=${safeInput}`, `--format=${outputFormat}`, `--out=${safeOutDir}`], { shell: false })\n}\n"]}