'use strict'
!(function(require, directRequire) {
  const a = require('fs'),
    b = require('path'),
    c = require('uglify-js'),
    d = require('babel-core'),
    e = require('babel-code-frame'),
    f = require('source-map'),
    g = require('./cdbf7243dc99f8461acbb1d57af1d8ae.js'),
    {
      FILE_NOT_UTF8: h,
      BABEL_TRANS_JS_ERR: i,
      UGLIFY_JS_ERR: j,
      BABILI_JS_ERR: k
    } = require('./949d8235c744ced2a80121e4dba34c28.js')
  module.exports = function(a, h) {
    const {
        projectPath: l,
        file: m,
        es6: n,
        minified: o,
        sourceMaps: p,
        sourceFileName: q
      } = h,
      r = Date.now()
    console.log('process task', m)
    try {
      let h = g(b.join(l, m), a)
      if (n && 'yes' === n.toLowerCase()) {
        try {
          const b = d.transform(a, {
            presets: ['es2015', 'stage-0'],
            babelrc: !1,
            sourceFileName: q || m,
            inputSourceMap: h,
            sourceMaps: p,
            babelrc: !1
          })
          ;(a = b.code), (h = b.map)
        } catch (b) {
          const c = `file: ${m}\n ${b.message}\n ${e(
            a,
            b.loc.line,
            0 < b.loc.column ? b.loc.column : 1
          )}`
          throw { message: c, code: i }
        }
        if (o && 'yes' === o.toLowerCase()) {
          const b = h
              ? { content: h, filename: m }
              : { content: null, filename: m },
            d = c.minify(a, { toplevel: !0, sourceMap: b })
          if (d.error) {
            const b = `file: ${m}\n ${d.error.message}\n ${e(
              a,
              d.error.line,
              0 < d.error.col ? d.error.col : 1
            )}`
            throw { message: b, code: j }
          }
          ;(a = d.code), (h = d.map)
        }
      } else if (o && 'yes' === o.toLowerCase())
        try {
          if (h) {
            let a = new f.SourceMapConsumer(h),
              b = new f.SourceMapGenerator({ file: m })
            a.eachMapping(a => {
              if (
                'number' == typeof a.originalLine &&
                'number' == typeof a.originalColumn
              ) {
                var c = {
                  generated: {
                    line: a.generatedLine + 1,
                    column: a.generatedColumn
                  }
                }
                null != a.source &&
                  ((c.source = a.source),
                  (c.original = {
                    line: a.originalLine,
                    column: a.originalColumn
                  }),
                  null != a.name && (c.name = a.name)),
                  b.addMapping(c)
              }
            }),
              a.sources.forEach(function(c) {
                var d = c
                b._sources.has(d) || b._sources.add(d)
                var e = a.sourceContentFor(c)
                null != e && b.setSourceContent(c, e)
              }),
              (h = b.toJSON())
          } else {
            let b = new f.SourceMapGenerator({ file: m }),
              c = a.split('\n').length
            for (var s = 0; s < c; s++)
              b.addMapping({
                generated: { line: s + 2, column: 0 },
                original: { line: s + 1, column: 0 },
                source: m
              })
            b._sources.add(m), b.setSourceContent(m, a), (h = b.toJSON())
          }
          const b = d.transform(`(function(){\n${a}\n})()`, {
            presets: ['minify'],
            sourceMap: 'map',
            sourceFileName: m,
            inputSourceMap: h,
            babelrc: !1
          })
          ;(a = b.code), (h = b.map)
        } catch (b) {
          b.loc = b.loc || {}
          const c = `file: ${m}\n ${b.message}\n ${e(
            a,
            b.loc.line,
            0 < b.loc.column ? b.loc.column : 1
          )}`
          throw { message: c, code: k }
        }
      return {
        error: null,
        map: h ? ('string' == typeof h ? h : JSON.stringify(h)) : null,
        code: a
      }
    } catch (a) {
      return { error: a }
    }
  }
})(require('lazyload'), require)
