{"version":3,"sources":["jsdelivr-header.js","/npm/gulp-image-handler@2.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,KAAO,QAAQ,QAEf,QAAU,QAAQ,YAClB,YAAc,QAAQ,gBAEtB,OAAS,QAAQ,gBAEvB,OAAO,YAAc,qBAErB,OAAO,QAAU,CAAC,EAAS,CAAC,IAAM,QAAQ,KAAI,eAAgB,EAAM,EAAK,GACrE,IACI,GAAI,EAAK,WAEL,OADA,KAAK,KAAK,QAAS,IAAI,YAAY,YAAa,+BACzC,IAGX,GAAI,EAAK,WAAY,CACjB,IAAI,EAAgB,CAAC,OAAQ,QAAS,OAAQ,QAC1C,EAAgB,GAEhB,EAAa,EAAK,SAAS,WAC3B,EAAM,wDACV,EAAW,QAAQ,GAAK,CAAC,EAAO,KACxB,EAAc,SAAS,KAAK,QAAQ,KACpC,EAAc,KAAK,CACf,aACA,aAAc,KAAK,QAAQ,KAAK,QAAQ,EAAK,MAAO,IAE5D,IAGJ,IAAI,EAAc,MAAM,KAAK,IAAI,IAAI,EAAc,KAAI,GAAQ,EAAK,iBAChE,QAAkB,QAAQ,IAAI,EAAY,KAAK,GAAS,OAAO,EAAM,MACzE,EAAU,QAAO,GAAY,GAAY,EAAS,eAC7C,SAAS,IACN,EAAa,EACR,QAAQ,GAAS,EAAK,eAAiB,EAAS,eAChD,QAAO,CAAC,EAAY,IACV,EAAS,QACZ,EAAW,QAAQ,EAAK,WAAY,EAAS,SAC7C,GACL,EAAU,IAEzB,EAAK,SAAW,OAAO,KAAK,EAChC,CACJ,CAAE,MAAO,GACL,QAAQ,MAAM,EAAE,SAAW,EAC/B,CAAE,QACE,KAAK,KAAK,GAEV,GACJ,CAEJ","file":"/npm/gulp-image-handler@2.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/gulp-image-handler@2.0.1/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","const path = require('path');\n\nconst through = require('through2');\nconst PluginError = require('plugin-error');\n\nconst handle = require('./lib/handle');\n\nglobal.PLUGIN_NAME = 'gulp-image-handler';\n\nmodule.exports = (option = {}) => through.obj(async function (file, enc, callback) {\n    try {\n        if (file.isStream()) {\n            this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported.'));\n            return callback();\n        }\n\n        if (file.isBuffer()) {\n            let acceptSuffixs = ['.png', '.jpeg', '.gif', '.jpg'];\n            let acceptedFiles = [];\n\n            let contentStr = file.contents.toString();\n            let reg = /url\\((?![\\'\\\"]?http[s]?:\\/\\/)[\\'\\\"]?(.*?)[\\'\\\"]?\\)/img;\n            contentStr.replace(reg, (match, originPath) => {\n                if (acceptSuffixs.includes(path.extname(originPath))) {\n                    acceptedFiles.push({\n                        originPath,\n                        absolutePath: path.resolve(path.dirname(file.path), originPath)\n                    });\n                }\n            });\n\n            let uploadFiles = Array.from(new Set(acceptedFiles.map(file => file.absolutePath)));\n            let responses = await Promise.all(uploadFiles.map((file) => handle(file, option)));\n            responses.filter(response => response && response.absolutePath)\n                .forEach((response) => {\n                    contentStr = acceptedFiles\n                        .filter((file) => file.absolutePath === response.absolutePath)\n                        .reduce((contentStr, file) => {\n                            return response.content ?\n                                contentStr.replace(file.originPath, response.content) :\n                                contentStr;\n                        }, contentStr)\n                });\n            file.contents = Buffer.from(contentStr);\n        }\n    } catch (e) {\n        console.error(e.message || e)\n    } finally {\n        this.push(file);\n\n        callback();\n    }\n\n});"]}