'use strict'
var _extends =
  Object.assign ||
  function(a) {
    for (var b, c = 1; c < arguments.length; c++)
      for (var d in ((b = arguments[c]), b))
        Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d])
    return a
  }
!(function(require, directRequire) {
  function a() {
    i = { main: {} }
  }
  function b(b, c) {
    let d = e.extname(c)
    '.json' === d && a()
  }
  async function c(c) {
    let d = await f(c)
    ;(h && h.srcPath == d.srcPath) ||
      (a(), h && h.unWatch(b), (h = d), h.watch(b))
  }
  async function d(a, b, d) {
    await c(a)
    let f = d ? `sub_${d.root}` : 'main'
    if ((i[f] || (i[f] = {}), i[f].files)) return i[f].files
    let k = h.getAllJSONFiles(),
      l = []
    for (let c, f = 0, h = k.length; f < h; f++) {
      if (
        ((c = k[f].replace(/\.json$/, '')),
        e.normalize(c) == e.normalize('app'))
      )
        continue
      if (j(c, b, d)) continue
      let h = await g(a, c)
      ;(h.usingComponents || h.componentGenerics || !0 === h.component) &&
        l.push(c)
    }
    return (i[f].files = l), i[f].files
  }
  const e = require('path'),
    f = require('./162bf2ee28b76d3b3d95b685cede4146.js'),
    g = require('./d260ebf687a29f24aed49f66b233ab7d.js')
  var h,
    i = { main: {} }
  const j = (a, b, c) => {
    if (!c) {
      let c = !1
      if (
        (b.subPackages &&
          b.subPackages.forEach(b => {
            0 == a.indexOf(b.root) && (c = !0)
          }),
        c)
      )
        return !0
    } else if (0 != a.indexOf(c.root)) return !0
    return !1
  }
  module.exports = {
    getFileList: d,
    getFileListWithMainPack: async function(a, b, e) {
      await c(a)
      let f = await d(a, b)
      if (e) {
        let c = await d(a, b, e)
        f = f.concat(c)
      }
      return f
    },
    getCompileConfig: async function(a, b, d) {
      await c(a)
      let f = d ? `sub_${d.root}` : 'main'
      if ((i[f] || (i[f] = {}), i[f].config)) return i[f].config
      var k = [],
        l = 0,
        m = h.getAllJSONFiles()
      for (let c = 0, f = m.length; c < f; c++) {
        let f = m[c].replace(/\.json$/, ''),
          h = e.posix.dirname(f)
        if (e.normalize(f) == e.normalize('app')) continue
        if (j(f, b, d)) continue
        let i = await g(a, f)
        if (i.usingComponents || i.componentGenerics) {
          k.push(`./${f}.wxml`)
          let a = _extends({}, i.usingComponents, i.componentGenerics),
            b = {},
            c = {}
          for (let d in a) {
            let f = a[d] || '',
              g = d.split('*'),
              i = f.split('*')
            1 < g.length
              ? ((f = e.posix.normalize(f)),
                (f = e.posix.isAbsolute(f) ? f : `/${e.posix.join(h, f)}`),
                (b[d] = f))
              : (c[d] = f)
          }
          if (0 < Object.keys(b).length)
            for (let a in b) {
              let d = b[a],
                e = new RegExp(d.replace(/\*/g, '([^/]*)'))
              m.forEach(b => {
                b = '/' + b
                let d = b.match(e)
                if (!d) return
                let f = 1,
                  g = a.replace(/\*/g, function() {
                    return d[f++]
                  })
                c[g] = b
              })
            }
          k.push(Object.keys(c).length), (k = k.concat(Object.keys(c))), l++
        }
      }
      return k.unshift(l), (i[f].config = k), i[f].config
    }
  }
})(require('lazyload'), require)
