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,KAAM,EAEjB,CAEI,GAAW,EAAQ,WACrB,eAAe,OAAO,GAAI,EAAK,UAAU,SAAU,EAAK,GACtD,OAAI,EACK,EAAS,EAAK,GAGlB,OAGH,IAFO,EAAS,KAAM,EAI1B,IAGA,GAGJ,GAGF","file":"/npm/gulp-replace-path@0.4.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/gulp-replace-path@0.4.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var es = require('event-stream');\nvar rs = require('replacestream');\nvar stream = require('stream');\nvar istextorbinary = require('istextorbinary');\n\nmodule.exports = function replace(search, replacement, options) {\n\n  var doReplace = function (file, callback) {\n\n    var origReplacement = replacement;\n\n    if (typeof replacement === 'function') {\n\n      // If second parameter is __absolutePath__, inject the files absolute path as second parameter\n      // TODO: Get index of __absolutePath__ and inject it dynamically\n      if (/function[\\s]*\\([\\w]+\\,[\\s]*__absolutePath__[\\s]*\\)*/.test(replacement.toString())) {\n        replacement = function (file) {\n          return origReplacement.apply(null, [arguments[0], file.path]);\n        }\n      }\n      else {\n        replacement = function () {\n          return origReplacement.apply(null, arguments);\n        }\n      }\n    }\n    else {\n      replacement = function () {\n        return origReplacement;\n      }\n    }\n\n    var isRegExp = search instanceof RegExp;\n    var isStream = file.contents && typeof file.contents.on === 'function' && typeof file.contents.pipe === 'function';\n    var isBuffer = file.contents instanceof Buffer;\n\n    if (isRegExp && isStream) {\n      return callback(new Error('gulp-replace-path: Cannot do regexp replace on a stream'), file);\n    }\n\n    function doReplace() {\n\n      if (isStream) {\n        file.contents = file.contents.pipe(rs(search, replacement(file)));\n        return callback(null, file);\n      }\n\n      if (isBuffer) {\n        if (isRegExp) {\n          file.contents = new Buffer(String(file.contents).replace(search, replacement(file)));\n        }\n        else {\n          var chunks = String(file.contents).split(search);\n\n          var result;\n          if (typeof replacement(file) === 'function') {\n            // Start with the first chunk already in the result\n            // Replacements will be added thereafter\n            // This is done to avoid checking the value of i in the loop\n            result = [chunks[0]];\n\n            // The replacement function should be called once for each match\n            for (var i = 1; i < chunks.length; i++) {\n              // Add the replacement value\n              result.push(replacement(file)(search));\n\n              // Add the next chunk\n              result.push(chunks[i]);\n            }\n\n            result = result.join('');\n          }\n          else {\n            result = chunks.join(replacement(file));\n          }\n\n          file.contents = new Buffer(result);\n        }\n        return callback(null, file);\n      }\n\n      callback(null, file);\n\n    }\n\n    if (options && options.skipBinary) {\n      istextorbinary.isText('', file.contents, function (err, result) {\n        if (err) {\n          return callback(err, file);\n        }\n\n        if (!result) {\n          return callback(null, file);\n        } else {\n          doReplace();\n        }\n      });\n    }\n    else {\n      doReplace();\n    }\n\n  };\n\n  return es.map(doReplace);\n};\n"]}