{"ast":null,"code":"'use strict';\n\nvar _asyncToGenerator = require(\"D:\\\\Development\\\\Work\\\\CENOS\\\\cenos-ui\\\\node_modules\\\\@angular-devkit\\\\build-angular\\\\node_modules\\\\@babel\\\\runtime\\\\helpers\\\\asyncToGenerator.js\").default;\n\nconst EventEmitter = require('events');\n\nconst path = require('path');\n\nconst os = require('os');\n\nconst pMap = require('p-map');\n\nconst arrify = require('arrify');\n\nconst globby = require('globby');\n\nconst hasGlob = require('has-glob');\n\nconst cpFile = require('cp-file');\n\nconst junk = require('junk');\n\nconst pFilter = require('p-filter');\n\nconst CpyError = require('./cpy-error');\n\nconst defaultOptions = {\n  ignoreJunk: true\n};\n\nclass SourceFile {\n  constructor(relativePath, path) {\n    this.path = path;\n    this.relativePath = relativePath;\n    Object.freeze(this);\n  }\n\n  get name() {\n    return path.basename(this.relativePath);\n  }\n\n  get nameWithoutExtension() {\n    return path.basename(this.relativePath, path.extname(this.relativePath));\n  }\n\n  get extension() {\n    return path.extname(this.relativePath).slice(1);\n  }\n\n}\n\nconst preprocessSourcePath = (source, options) => path.resolve(options.cwd ? options.cwd : process.cwd(), source);\n\nconst preprocessDestinationPath = (source, destination, options) => {\n  let basename = path.basename(source);\n\n  if (typeof options.rename === 'string') {\n    basename = options.rename;\n  } else if (typeof options.rename === 'function') {\n    basename = options.rename(basename);\n  }\n\n  if (options.cwd) {\n    destination = path.resolve(options.cwd, destination);\n  }\n\n  if (options.parents) {\n    const dirname = path.dirname(source);\n    const parsedDirectory = path.parse(dirname);\n    return path.join(destination, dirname.replace(parsedDirectory.root, path.sep), basename);\n  }\n\n  return path.join(destination, basename);\n};\n\nmodule.exports = (source, destination, {\n  concurrency = (os.cpus().length || 1) * 2,\n  ...options\n} = {}) => {\n  const progressEmitter = new EventEmitter();\n  options = { ...defaultOptions,\n    ...options\n  };\n\n  const promise = _asyncToGenerator(function* () {\n    source = arrify(source);\n\n    if (source.length === 0 || !destination) {\n      throw new CpyError('`source` and `destination` required');\n    }\n\n    const copyStatus = new Map();\n    let completedFiles = 0;\n    let completedSize = 0;\n    let files;\n\n    try {\n      files = yield globby(source, options);\n\n      if (options.ignoreJunk) {\n        files = files.filter(file => junk.not(path.basename(file)));\n      }\n    } catch (error) {\n      throw new CpyError(`Cannot glob \\`${source}\\`: ${error.message}`, error);\n    }\n\n    if (files.length === 0 && !hasGlob(source)) {\n      throw new CpyError(`Cannot copy \\`${source}\\`: the file doesn't exist`);\n    }\n\n    let sources = files.map(sourcePath => new SourceFile(sourcePath, preprocessSourcePath(sourcePath, options)));\n\n    if (options.filter !== undefined) {\n      const filteredSources = yield pFilter(sources, options.filter, {\n        concurrency: 1024\n      });\n      sources = filteredSources;\n    }\n\n    if (sources.length === 0) {\n      progressEmitter.emit('progress', {\n        totalFiles: 0,\n        percent: 1,\n        completedFiles: 0,\n        completedSize: 0\n      });\n    }\n\n    const fileProgressHandler = event => {\n      const fileStatus = copyStatus.get(event.src) || {\n        written: 0,\n        percent: 0\n      };\n\n      if (fileStatus.written !== event.written || fileStatus.percent !== event.percent) {\n        completedSize -= fileStatus.written;\n        completedSize += event.written;\n\n        if (event.percent === 1 && fileStatus.percent !== 1) {\n          completedFiles++;\n        }\n\n        copyStatus.set(event.src, {\n          written: event.written,\n          percent: event.percent\n        });\n        progressEmitter.emit('progress', {\n          totalFiles: files.length,\n          percent: completedFiles / files.length,\n          completedFiles,\n          completedSize\n        });\n      }\n    };\n\n    return pMap(sources, /*#__PURE__*/function () {\n      var _ref2 = _asyncToGenerator(function* (source) {\n        const to = preprocessDestinationPath(source.relativePath, destination, options);\n\n        try {\n          yield cpFile(source.path, to, options).on('progress', fileProgressHandler);\n        } catch (error) {\n          throw new CpyError(`Cannot copy from \\`${source.relativePath}\\` to \\`${to}\\`: ${error.message}`, error);\n        }\n\n        return to;\n      });\n\n      return function (_x) {\n        return _ref2.apply(this, arguments);\n      };\n    }(), {\n      concurrency\n    });\n  })();\n\n  promise.on = (...arguments_) => {\n    progressEmitter.on(...arguments_);\n    return promise;\n  };\n\n  return promise;\n};","map":{"version":3,"sources":["D:/Development/Work/CENOS/cenos-ui/node_modules/cpy/index.js"],"names":["EventEmitter","require","path","os","pMap","arrify","globby","hasGlob","cpFile","junk","pFilter","CpyError","defaultOptions","ignoreJunk","SourceFile","constructor","relativePath","Object","freeze","name","basename","nameWithoutExtension","extname","extension","slice","preprocessSourcePath","source","options","resolve","cwd","process","preprocessDestinationPath","destination","rename","parents","dirname","parsedDirectory","parse","join","replace","root","sep","module","exports","concurrency","cpus","length","progressEmitter","promise","copyStatus","Map","completedFiles","completedSize","files","filter","file","not","error","message","sources","map","sourcePath","undefined","filteredSources","emit","totalFiles","percent","fileProgressHandler","event","fileStatus","get","src","written","set","to","on","arguments_"],"mappings":"AAAA;;;;AACA,MAAMA,YAAY,GAAGC,OAAO,CAAC,QAAD,CAA5B;;AACA,MAAMC,IAAI,GAAGD,OAAO,CAAC,MAAD,CAApB;;AACA,MAAME,EAAE,GAAGF,OAAO,CAAC,IAAD,CAAlB;;AACA,MAAMG,IAAI,GAAGH,OAAO,CAAC,OAAD,CAApB;;AACA,MAAMI,MAAM,GAAGJ,OAAO,CAAC,QAAD,CAAtB;;AACA,MAAMK,MAAM,GAAGL,OAAO,CAAC,QAAD,CAAtB;;AACA,MAAMM,OAAO,GAAGN,OAAO,CAAC,UAAD,CAAvB;;AACA,MAAMO,MAAM,GAAGP,OAAO,CAAC,SAAD,CAAtB;;AACA,MAAMQ,IAAI,GAAGR,OAAO,CAAC,MAAD,CAApB;;AACA,MAAMS,OAAO,GAAGT,OAAO,CAAC,UAAD,CAAvB;;AACA,MAAMU,QAAQ,GAAGV,OAAO,CAAC,aAAD,CAAxB;;AAEA,MAAMW,cAAc,GAAG;AACtBC,EAAAA,UAAU,EAAE;AADU,CAAvB;;AAIA,MAAMC,UAAN,CAAiB;AAChBC,EAAAA,WAAW,CAACC,YAAD,EAAed,IAAf,EAAqB;AAC/B,SAAKA,IAAL,GAAYA,IAAZ;AACA,SAAKc,YA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,OAVU;;AAAA;AAAA;AAAA;AAAA,SAUR;AAAC9B,MAAAA;AAAD,KAVQ,CAAX;AAWA,GA9Ee,GAAhB;;AAgFAI,EAAAA,OAAO,CAAC2B,EAAR,GAAa,CAAC,GAAGC,UAAJ,KAAmB;AAC/B7B,IAAAA,eAAe,CAAC4B,EAAhB,CAAmB,GAAGC,UAAtB;AACA,WAAO5B,OAAP;AACA,GAHD;;AAKA,SAAOA,OAAP;AACA,CAjGD","sourcesContent":["'use strict';\nconst EventEmitter = require('events');\nconst path = require('path');\nconst os = require('os');\nconst pMap = require('p-map');\nconst arrify = require('arrify');\nconst globby = require('globby');\nconst hasGlob = require('has-glob');\nconst cpFile = require('cp-file');\nconst junk = require('junk');\nconst pFilter = require('p-filter');\nconst CpyError = require('./cpy-error');\n\nconst defaultOptions = {\n\tignoreJunk: true\n};\n\nclass SourceFile {\n\tconstructor(relativePath, path) {\n\t\tthis.path = path;\n\t\tthis.relativePath = relativePath;\n\t\tObject.freeze(this);\n\t}\n\n\tget name() {\n\t\treturn path.basename(this.relativePath);\n\t}\n\n\tget nameWithoutExtension() {\n\t\treturn path.basename(this.relativePath, path.extname(this.relativePath));\n\t}\n\n\tget extension() {\n\t\treturn path.extname(this.relativePath).slice(1);\n\t}\n}\n\nconst preprocessSourcePath = (source, options) => path.resolve(options.cwd ? options.cwd : process.cwd(), source);\n\nconst preprocessDestinationPath = (source, destination, options) => {\n\tlet basename = path.basename(source);\n\n\tif (typeof options.rename === 'string') {\n\t\tbasename = options.rename;\n\t} else if (typeof options.rename === 'function') {\n\t\tbasename = options.rename(basename);\n\t}\n\n\tif (options.cwd) {\n\t\tdestination = path.resolve(options.cwd, destination);\n\t}\n\n\tif (options.parents) {\n\t\tconst dirname = path.dirname(source);\n\t\tconst parsedDirectory = path.parse(dirname);\n\t\treturn path.join(destination, dirname.replace(parsedDirectory.root, path.sep), basename);\n\t}\n\n\treturn path.join(destination, basename);\n};\n\nmodule.exports = (source, destination, {\n\tconcurrency = (os.cpus().length || 1) * 2,\n\t...options\n} = {}) => {\n\tconst progressEmitter = new EventEmitter();\n\n\toptions = {\n\t\t...defaultOptions,\n\t\t...options\n\t};\n\n\tconst promise = (async () => {\n\t\tsource = arrify(source);\n\n\t\tif (source.length === 0 || !destination) {\n\t\t\tthrow new CpyError('`source` and `destination` required');\n\t\t}\n\n\t\tconst copyStatus = new Map();\n\t\tlet completedFiles = 0;\n\t\tlet completedSize = 0;\n\n\t\tlet files;\n\t\ttry {\n\t\t\tfiles = await globby(source, options);\n\n\t\t\tif (options.ignoreJunk) {\n\t\t\t\tfiles = files.filter(file => junk.not(path.basename(file)));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrow new CpyError(`Cannot glob \\`${source}\\`: ${error.message}`, error);\n\t\t}\n\n\t\tif (files.length === 0 && !hasGlob(source)) {\n\t\t\tthrow new CpyError(`Cannot copy \\`${source}\\`: the file doesn't exist`);\n\t\t}\n\n\t\tlet sources = files.map(sourcePath => new SourceFile(sourcePath, preprocessSourcePath(sourcePath, options)));\n\n\t\tif (options.filter !== undefined) {\n\t\t\tconst filteredSources = await pFilter(sources, options.filter, {concurrency: 1024});\n\t\t\tsources = filteredSources;\n\t\t}\n\n\t\tif (sources.length === 0) {\n\t\t\tprogressEmitter.emit('progress', {\n\t\t\t\ttotalFiles: 0,\n\t\t\t\tpercent: 1,\n\t\t\t\tcompletedFiles: 0,\n\t\t\t\tcompletedSize: 0\n\t\t\t});\n\t\t}\n\n\t\tconst fileProgressHandler = event => {\n\t\t\tconst fileStatus = copyStatus.get(event.src) || {written: 0, percent: 0};\n\n\t\t\tif (fileStatus.written !== event.written || fileStatus.percent !== event.percent) {\n\t\t\t\tcompletedSize -= fileStatus.written;\n\t\t\t\tcompletedSize += event.written;\n\n\t\t\t\tif (event.percent === 1 && fileStatus.percent !== 1) {\n\t\t\t\t\tcompletedFiles++;\n\t\t\t\t}\n\n\t\t\t\tcopyStatus.set(event.src, {\n\t\t\t\t\twritten: event.written,\n\t\t\t\t\tpercent: event.percent\n\t\t\t\t});\n\n\t\t\t\tprogressEmitter.emit('progress', {\n\t\t\t\t\ttotalFiles: files.length,\n\t\t\t\t\tpercent: completedFiles / files.length,\n\t\t\t\t\tcompletedFiles,\n\t\t\t\t\tcompletedSize\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\treturn pMap(sources, async source => {\n\t\t\tconst to = preprocessDestinationPath(source.relativePath, destination, options);\n\n\t\t\ttry {\n\t\t\t\tawait cpFile(source.path, to, options).on('progress', fileProgressHandler);\n\t\t\t} catch (error) {\n\t\t\t\tthrow new CpyError(`Cannot copy from \\`${source.relativePath}\\` to \\`${to}\\`: ${error.message}`, error);\n\t\t\t}\n\n\t\t\treturn to;\n\t\t}, {concurrency});\n\t})();\n\n\tpromise.on = (...arguments_) => {\n\t\tprogressEmitter.on(...arguments_);\n\t\treturn promise;\n\t};\n\n\treturn promise;\n};\n"]},"metadata":{},"sourceType":"script"}