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,GAAO,wBAGlB,GAAO,YACP,EAAS,KAAK,CACV,QAAS,iBAAiB,WAC1B,MAAO,GAAG,GAAO,eAGzB,MAAM,GAAsB,EAAI,QAAQ,aAAa,GA5E5B,IAAC,EAmF1B,OANI,GAAO,YACP,EAAS,iBAAiB,GA9EJ,EA+EQ,EAA9B,GA9EG,EAAI,iBAAiB,kBAAkB,GAAG,MAAO,GACpD,QAAe,EAAI,QAAQ,qCAAqC,MA+EpE,GAAS,EAAI,QAAQ,uBAAuB,EAAQ,GACpD,GAAS,EAAI,QAAQ,2BAA2B,EAAQ,EAC3C,EAEjB,QAAQ,QAAU","file":"/npm/@zamplyy/react-native-vector-image-plugin@0.1.2/build/withVectorImage.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/@zamplyy/react-native-vector-image-plugin@0.1.2/build/withVectorImage.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.withGenerateAndroidAssets = exports.withGenerateIosAssets = exports.getCommands = exports.setPBXShellScriptBuildPhaseStripSvg = exports.addStripSvgsImplementation = exports.GenerateCommands = void 0;\nconst config_plugins_1 = require(\"expo/config-plugins\");\nconst path_1 = __importDefault(require(\"path\"));\nvar GenerateCommands;\n(function (GenerateCommands) {\n    GenerateCommands[\"EntryFile\"] = \"--entry-file\";\n    GenerateCommands[\"Config\"] = \"--config\";\n    GenerateCommands[\"ResetCache\"] = \"--reset-cache\";\n})(GenerateCommands = exports.GenerateCommands || (exports.GenerateCommands = {}));\nconst DefaultCommands = [\n    {\n        command: GenerateCommands.EntryFile,\n        input: \"index.js\",\n    },\n    {\n        command: GenerateCommands.Config,\n        input: \"metro.config.js\",\n    },\n    {\n        command: GenerateCommands.ResetCache,\n        input: \"false\",\n    },\n];\nconst addStripSvgsImplementation = (projectBuildGradle) => {\n    const addString = `apply from: new File([\"node\", \"--print\", \"require.resolve('react-native/package.json')\"].execute(null, rootDir).text.trim(), \"../../react-native-vector-image/strip_svgs.gradle\")`;\n    const searchString = /\"..\\/react.gradle\"\\)\\n/gm;\n    if (projectBuildGradle.includes(addString)) {\n        return projectBuildGradle;\n    }\n    return projectBuildGradle.replace(searchString, `\"../react.gradle\")\\n${addString}`);\n};\nexports.addStripSvgsImplementation = addStripSvgsImplementation;\nconst withStripSvgsIos = (config) => {\n    return (0, config_plugins_1.withAppBuildGradle)(config, ({ modResults, ...config }) => {\n        modResults.contents = (0, exports.addStripSvgsImplementation)(modResults.contents);\n        return { modResults, ...config };\n    });\n};\nconst addSlashes = (str) => {\n    return str.replace(/[\\\\\"]/g, \"\\\\$&\").replace(/\\u0000/g, \"\\\\0\");\n};\nconst setPBXShellScriptBuildPhaseStripSvg = async (config) => {\n    const xcodeProject = config.modResults;\n    const pbxShellScriptBuildPhases = xcodeProject.hash.project.objects.PBXShellScriptBuildPhase;\n    for (const buildPhase of Object.values(pbxShellScriptBuildPhases)) {\n        if (buildPhase?.name === '\"Bundle React Native code and images\"' &&\n            !buildPhase?.shellScript.includes('\"react-native-vector-image\"')) {\n            const parts = [\n                'export NODE_BINARY=node\\\\n\\\\n# The project root by default is one level up from the ios directory\\\\nexport PROJECT_ROOT=\\\\\"$PROJECT_DIR\\\\\"/..\\\\n\\\\n',\n                addSlashes(`\\`node --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\``),\n                addSlashes(`\\`node --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/../react-native-vector-image/strip_svgs.sh'\"\\``),\n            ];\n            // eslint-disable-next-line no-useless-escape\n            buildPhase.shellScript = `\\\"${parts.join(\"\\\\n\")}\\\"`;\n        }\n    }\n    return config;\n};\nexports.setPBXShellScriptBuildPhaseStripSvg = setPBXShellScriptBuildPhaseStripSvg;\nconst withStripSvgsAndroid = (c) => {\n    return (0, config_plugins_1.withXcodeProject)(c, async (config) => {\n        config = await (0, exports.setPBXShellScriptBuildPhaseStripSvg)(config);\n        return config;\n    });\n};\nconst getCliPath = () => {\n    const packageLocation = path_1.default.dirname(require.resolve(\"react-native-vector-image/package.json\"));\n    return path_1.default.join(packageLocation, \"src/cli/index\");\n};\nconst getCommands = (commands = DefaultCommands) => {\n    const commandsMap = new Map();\n    commands.forEach((c) => commandsMap.set(c.command, c.input));\n    DefaultCommands.forEach((c) => {\n        const exists = commandsMap.has(c.command);\n        if (!exists) {\n            commandsMap.set(c.command, c.input);\n        }\n    });\n    return Array.from(commandsMap)\n        .map((arr) => `${arr[0]} ${arr[1]}`)\n        .join(\" \");\n};\nexports.getCommands = getCommands;\nconst runCli = (cliCommand) => {\n    const cliPath = getCliPath();\n    const cli = require(cliPath);\n    if (!cli) {\n        throw new Error(\"Could not find react-native-vector-image cli\");\n    }\n    cli(cliCommand);\n};\nconst withGenerateIosAssets = (config, commands) => {\n    return (0, config_plugins_1.withDangerousMod)(config, [\n        \"ios\",\n        (config) => {\n            const appName = config.modRequest.projectName;\n            runCli(`generate --no-android-output --ios-output ios/${appName}/Images.xcassets ${commands}`);\n            return config;\n        },\n    ]);\n};\nexports.withGenerateIosAssets = withGenerateIosAssets;\nconst withGenerateAndroidAssets = (config, commands) => {\n    return (0, config_plugins_1.withDangerousMod)(config, [\n        \"android\",\n        (config) => {\n            runCli(`generate --no-ios-output ${commands}`);\n            return config;\n        },\n    ]);\n};\nexports.withGenerateAndroidAssets = withGenerateAndroidAssets;\n/**\n * Apply VectorImage configuration for Expo projects.\n */\nconst withVectorImage = (config, props = {}) => {\n    const commands = [];\n    if (props?.customEntryFile) {\n        commands.push({\n            command: GenerateCommands.EntryFile,\n            input: props?.customEntryFile,\n        });\n    }\n    if (props?.customMetroConfigFile) {\n        commands.push({\n            command: GenerateCommands.Config,\n            input: props?.customMetroConfigFile,\n        });\n    }\n    if (props?.resetCache) {\n        commands.push({\n            command: GenerateCommands.ResetCache,\n            input: `${props?.resetCache}`,\n        });\n    }\n    const commandsWithDefault = (0, exports.getCommands)(commands);\n    if (props?.stripSvgs) {\n        config = withStripSvgsIos(config);\n        config = withStripSvgsAndroid(config);\n    }\n    config = (0, exports.withGenerateIosAssets)(config, commandsWithDefault);\n    config = (0, exports.withGenerateAndroidAssets)(config, commandsWithDefault);\n    return config;\n};\nexports.default = withVectorImage;\n"]}