'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) {
  const a = require('react'),
    b = require('fs'),
    c = require('glob'),
    d = require('path'),
    e = require('classnames'),
    f = require('mkdir-p'),
    g = require('./logger.js'),
    h = require('./15ba1827c7f6564a45df6bd44da3a977.js'),
    i = require('./da7c31daaf542cf1796023d8e344b98a.js'),
    j = require('./f171257bbcaef547a3cf27266ccb0db2.js'),
    k = require('./d3976cc01aeebc5b09e11c4135b6bd8d.js'),
    l = require('./56c390e04c10e91a4aa2a2c19d9a885d.js'),
    m = require('./common/locales/index.js'),
    n = require('./6620a0cf7dad1b400d60f0fdae40f524.js'),
    o = require('./d28a711224425b00101635efe1034c99.js'),
    p = require('./bc04f89cf8edab62335086e0a2a5a103.js'),
    q = require('./9fdd4ac31a05c27355910f0d74accd4c.js'),
    r = require('./6242f55dbdfe53c2f07b7a51568311f2.js'),
    s = require('./92320c1386e6db6a6f2556736a9bc280.js'),
    t = require('./42191d95974f14b18961c9f2c730464e.js'),
    u = require('./da189bc919cfd050066ec695411cbcf5.js'),
    {
      DEV_INVALID_APPID: v,
      DEV_APP_NOT_BAND: w
    } = require('./df6d0ff021a69fb541c733de4dbba0fe.js'),
    {
      default_weapp_header: x,
      default_tourist_weapp_header: y
    } = require('./5498e660c05c574f739a28bd5d202cfa.js'),
    { TOURIST_APPID: z, GAME_TOURIST_APPID: A } = r,
    B = 'darwin' === process.platform,
    C = {
      network: {
        RequestDomain: [],
        WsRequestDomain: [],
        UploadDomain: [],
        DownloadDomain: []
      },
      setting: _extends({}, r.setting)
    },
    D = [
      { type: l.QUICKSTART_TYPE.WEAPP_MINI, name: '\u5C0F\u7A0B\u5E8F' },
      { type: l.QUICKSTART_TYPE.GAME_MINI, name: '\u5C0F\u6E38\u620F' },
      { type: l.QUICKSTART_TYPE.PLUGIN_MINI, name: '\u63D2\u4EF6' }
    ],
    E = { FILL_FORM: 1, PENDING: 2, SUCCESS: 3, ERROR: 4 }
  module.exports = class extends a.Component {
    constructor(a) {
      super(a),
        (this.handleMaskClick = () => {
          this.setState({ showMask: !1 })
        })
      const b = a.options || {},
        c = b.from || ''
      let d = ''
      switch (c) {
        case l.MINI_CODE_FROM.URL_SCHEME: {
          d = b.miniCodeLink
          break
        }
        default:
      }
      ;(this.state = {
        options: a.options,
        from: c,
        projectpath: '',
        appid: '',
        appname: '',
        miniCodeLink: d,
        showMiniCodeDetail: !1,
        importStatus: E.FILL_FORM,
        miniCodeInfo: null,
        saveBtnDisable: !0,
        checked: !0,
        showLoading: !1,
        errorLoc: '',
        errorMsg: '.',
        compileType: { name: '\u5C0F\u7A0B\u5E8F\u6A21\u5F0F', value: q.weapp },
        showCompileTypeSelect: !1,
        showQuickStart: !a.isImport,
        quickstartDDOpen: !1,
        quickstartItems: D,
        quickstartSelected: l.QUICKSTART_TYPE.WEAPP_MINI
      }),
        (this.compileTypeConstants = [
          { name: '\u5C0F\u7A0B\u5E8F\u6A21\u5F0F', value: q.weapp },
          { name: '\u4F1A\u8BDD\u52A8\u6001\u9875', value: q.conversation },
          { name: '\u641C\u7D22\u52A8\u6001\u9875', value: q.search }
        ]),
        this.setupDropdownController()
    }
    componentDidMount() {
      this.resize(), this.state.from && this.handleExternalInvocation()
    }
    componentWillUnmount() {
      this.props.detach && this.props.close(),
        this.props.options &&
          this.props.options.miniCodeLink &&
          this.props.clearMiniCodeOptions()
    }
    componentDidUpdate(a) {
      a.options != this.props.options &&
        this.props.options &&
        this.props.options.miniCodeLink &&
        this.handleExternalInvocation()
    }
    setupDropdownController() {
      ;(this.quickstartDDControl = {}),
        (this.quickstartDDControl.toggle = () => {
          if (!this.state.quickstartDDOpen) {
            const a = this.qsInput.getBoundingClientRect()
            ;(this.quickstartDDControl.left = a.left + 'px'),
              (this.quickstartDDControl.top = a.top + 25 + 'px'),
              this.setState({ quickstartDDOpen: !0, showMask: !0 })
          } else this.setState({ quickstartDDOpen: !1, showMask: !1 })
        }),
        (this.quickstartDDControl.onItemSelected = a => {
          this.setState({
            quickstartDDOpen: !1,
            quickstartSelected: this.state.quickstartItems[a].type
          })
        })
    }
    resize() {
      try {
        let a = this.props.win ? this.props.win : global.Win
        this.props.detach ||
          (a.show(),
          a.setResizable(!0),
          a.resizeTo(l.SIZE.CREATE_PROJECT.WIDTH, l.SIZE.CREATE_PROJECT.HEIGHT),
          a.setResizable(!1))
      } catch (a) {}
    }
    handleExternalInvocation() {
      const a = this.props.options || {},
        b = a.from
      if (b)
        switch (b) {
          case l.MINI_CODE_FROM.URL_SCHEME: {
            this.props.isImport &&
              this.setState(
                { miniCodeLink: a.miniCodeLink, errorLoc: '', errorMsg: '.' },
                () => {
                  this.fetchMiniCodeInfo()
                }
              )
            break
          }
        }
    }
    editMiniCodeLink(a) {
      let b = a.target.value
      const c = { miniCodeLink: b.trim() }
      'miniCodeLink' === this.state.errorLoc && (c.errorLoc = ''),
        this.setState(c)
    }
    onMiniCodeLinkInputKeyPress(a) {
      'Enter' === a.key && this.fetchMiniCodeInfo()
    }
    async fetchMiniCodeInfo() {
      if (!this.state.miniCodeLink)
        return void this.setState({
          errorLoc: 'miniCodeLink',
          errorMsg: '\u8BF7\u8F93\u5165\u5BFC\u5165\u94FE\u63A5'
        })
      this.setState({ importStatus: E.PENDING })
      try {
        let a = this.state.miniCodeLink.startsWith('wechat')
          ? this.state.miniCodeLink.slice(21)
          : this.state.miniCodeLink
        const { body: c } = await h({
          url: `${j.getMiniCodeInfoURL}&codeid=${encodeURIComponent(a)}`,
          needToken: 1
        })
        if (!c.code_pack || 0 === c.code_pack.length)
          return void this.setState({
            importStatus: E.ERROR,
            errorLoc: 'miniCodeLink',
            errorMsg: '\u94FE\u63A5 / ID \u4E0D\u5B58\u5728'
          })
        const e = {
            miniCodeID: a,
            projectName: decodeURIComponent(c.code_pack[0].project_name),
            projectDesc: c.code_pack[0].project_desc,
            needAppID: c.code_pack[0].need_appid,
            minLibVersion: c.code_pack[0].min_libver
          },
          { body: f } = await h({
            url: `${j.getMiniCodeURL}&codeid=${a}`,
            encoding: null,
            needToken: 1,
            needParse: -1
          })
        if (((e.code = f), this.props.isImport)) {
          try {
            const a = d.join(s.Weappdest, `${+new Date()}-minicode`)
            b.writeFileSync(a, f, { encoding: null }), (e.codePackTmpPath = a)
          } catch (a) {
            return void this.setState({
              importStatus: E.ERROR,
              errorLoc: 'miniCodeLink',
              errorMsg:
                '\u4EE3\u7801\u5305\u6587\u4EF6\u635F\u574F\uFF0C\u8BF7\u91CD\u8BD5'
            })
          }
          try {
            ;(e.projectConfigJSON = JSON.parse(
              (await u.asarExtractFile(
                e.codePackTmpPath,
                'project.config.json'
              )) || {}
            )),
              'game' === e.projectConfigJSON.compileType && (e.isGame = !0),
              e.projectConfigJSON.isGameTourist && (e.isGameTourist = !0)
          } catch (a) {}
        }
        this.setState({
          importStatus: E.SUCCESS,
          miniCodeInfo: e,
          appname: e.projectName
        })
      } catch (a) {
        a && 1 == a.errcode
          ? this.setState({
              importStatus: E.ERROR,
              errorLoc: 'miniCodeLink',
              errorMsg: '\u94FE\u63A5 / ID \u4E0D\u5B58\u5728'
            })
          : this.setState({
              importStatus: E.ERROR,
              errorLoc: 'miniCodeLink',
              errorMsg: a.toString()
            })
      }
    }
    editAppid(a) {
      let b = a.target,
        c = b.value
      const d = { appid: c.trim() }
      'appid' === this.state.errorLoc && (d.errorLoc = ''), this.setState(d)
    }
    editAppname(a) {
      let b = a.target,
        c = b.value
      const d = { appname: c }
      'projectname' === this.state.errorLoc && (d.errorLoc = ''),
        this.setState(d)
    }
    chooseDir(a) {
      let c = this.props.win
          ? this.props.win.window.document.body
          : global.contentDocumentBody,
        d = a.currentTarget.dataset.type,
        e = document.createElement('input')
      e.setAttribute('type', 'file'),
        e.setAttribute('nwdirectory', !0),
        (e.style.display = 'none'),
        c.appendChild(e),
        e.addEventListener('change', () => {
          let a
          try {
            a = b.readdirSync(e.value)
          } catch (a) {
            return void this.setState({
              errorLoc: 'projectpath',
              errorMsg: a.toString()
            })
          }
          'darwin' === process.platform &&
            (a = a.filter(a => {
              return 0 !== a.indexOf('.')
            }))
          let f = { projectpath: e.value, showQuickStart: 0 === a.length }
          if (0 !== a.length && 'import' === d)
            (f.errorLoc = 'projectpath'),
              (f.errorMsg = m.config.CREATE_PROJECT_TIP_MUST_USE_EMPTY_FOLDER)
          else {
            this.state.appname || (f.appname = '')
            const a = t.getConfigFileInfo({ projectpath: e.value })
            a.error ||
              ((f = _extends({}, f, {
                appname: `${decodeURIComponent(a.config.projectname || '')}`
              })),
              a.config.isGameTourist
                ? (f.appid = r.GAME_TOURIST_APPID)
                : a.config.appid === z ||
                  (f.appid = `${a.config.appid || ''}`)),
              'projectpath' === this.state.errorLoc && (f.errorLoc = '')
          }
          this.setState(f), c.removeChild(e)
        }),
        e.addEventListener('cancel', () => {
          c.removeChild(e)
        }),
        e.click()
    }
    onTypeSelectClick(a) {
      let b = this.compileTypeConstants[a],
        c = { showCompileTypeSelect: !1 }
      b && (c.compileType = b), this.setState(c)
    }
    onCompileTypeClick(a) {
      a.stopPropagation()
      let b = a.currentTarget.getBoundingClientRect()
      this.setState({
        compileTypeLeft: b.left,
        compileTypeTop: b.top + 24,
        showCompileTypeSelect: !this.state.showCompileTypeSelect
      })
    }
    onContainerClick() {
      this.setState({ showCompileTypeSelect: !1 })
    }
    isTourist() {
      return this.state.appid
        ? this.state.appid === z
        : !this.state.appid &&
            this.state.quickstartSelected !== l.QUICKSTART_TYPE.GAME_MINI
    }
    isGameTourist() {
      return (
        !this.state.appid &&
        this.state.quickstartSelected === l.QUICKSTART_TYPE.GAME_MINI
      )
    }
    async importCodeToDir(a, c) {
      const e = d.join(s.Weappdest, `${+new Date()}-minicode`)
      b.writeFileSync(e, a, { encoding: null }), await u.asarUnpack(e, c)
      let f = {}
      try {
        f = JSON.parse(b.readFileSync(d.join(c, 'project.config.json'), 'utf8'))
      } catch (a) {}
      return f
    }
    async addProject() {
      let a = this.state.projectpath
      if (!a)
        try {
          ;(a = d.join(
            s.WeappMiniCode,
            `${this.state.appname.trim()}-${+new Date()}`
          )),
            f.sync(a)
        } catch (a) {
          return void this.setState({
            errorLoc: 'projectpath',
            errorMsg: m.config.CREATE_PROJECT_TIP_MUST_CHOOSE_FOLDER
          })
        }
      let c = this.isTourist(),
        e = this.isGameTourist()
      this.props.isImport &&
        this.state.miniCodeInfo &&
        (this.state.miniCodeInfo.isGameTourist ||
          (this.state.miniCodeInfo.isGame && !this.state.appid)) &&
        ((c = !1), (e = !0))
      let n = this.state.appid
      c ? (n = z) : e && (n = A)
      let p = encodeURIComponent(this.state.appname.trim()),
        r = o.getVendorConfig(),
        u = this.props.isImport
          ? encodeURIComponent(this.state.miniCodeInfo.minLibVersion)
          : r.currentLibVersion
      if (
        this.state.quickstartSelected === l.QUICKSTART_TYPE.PLUGIN_MINI &&
        (!n || n === z || n === A)
      )
        return void this.setState({
          errorLoc: 'appid',
          errorMsg: m.config.CREATE_PROJECT_TIP_NO_APPID
        })
      if (!n)
        return void this.setState({
          errorLoc: 'appid',
          errorMsg: m.config.CREATE_PROJECT_TIP_NO_APPID
        })
      if (!p)
        return void this.setState({
          errorLoc: 'projectname',
          errorMsg: m.config.CREATE_PROJECT_TIP_NO_NAME
        })
      if (!a)
        return void this.setState({
          errorLoc: 'projectpath',
          errorMsg: m.config.CREATE_PROJECT_TIP_NO_DIR
        })
      let B = `${n}_${p}`,
        D = k.strToHash(B),
        E = this.props.project.list[B]
      if (E)
        return void this.setState({
          appname: '',
          saveBtnDisable: !0,
          errorLoc: 'projectname',
          errorMsg: m.config.CREATE_PROJECT_TIP_HASH_EXIST.format([
            n,
            decodeURIComponent(p)
          ])
        })
      try {
        const c = this.props.isImport
        let d = b.readdirSync(a)
        if (
          ('darwin' === process.platform &&
            (d = d.filter(a => {
              return 0 !== a.indexOf('.')
            })),
          0 !== d.length)
        ) {
          if (c)
            return void this.setState({
              errorLoc: 'projectpath',
              errorMsg: m.config.CREATE_PROJECT_TIP_MUST_USE_EMPTY_FOLDER
            })
          if (
            0 > d.indexOf('app.json') &&
            0 > d.indexOf('project.config.json') &&
            0 > d.indexOf('game.json')
          )
            return void this.setState({
              errorLoc: 'projectpath',
              errorMsg:
                m.config.CREATE_PROJECT_TIP_MUST_USE_VALID_MINI_APP_FOLDER
            })
        }
      } catch (a) {
        return void this.setState({
          errorLoc: 'projectpath',
          errorMsg: a.toString()
        })
      }
      this.setState({ showLoading: !0 })
      const F = t.getConfigFileInfo({ projectpath: a })
      let G = q.weapp
      ;(this.state.quickstartSelected == l.QUICKSTART_TYPE.PLUGIN_MINI ||
        (!F.error && F.config && F.config.compileType == q.plugin)) &&
        (G = q.plugin)
      let H = {
        projectpath: '',
        appid: '',
        appname: '',
        error: '',
        saveBtnDisable: !0,
        showLoading: !1,
        isTourist: !1
      }
      if (c) {
        let b = {
          projectid: B,
          hash: D,
          appid: n,
          projectname: p,
          projectpath: a,
          appShowImageUrl: y,
          isAdmin: !1,
          isTourist: !0,
          isMiniCode: !0,
          urlCheck: !1,
          compileType: G,
          libVersion: u,
          attr: _extends({}, C)
        }
        if (this.props.isImport) {
          b.shareInfo = {
            from: {
              codeid: this.state.miniCodeInfo.miniCodeID,
              desc: this.state.miniCodeInfo.projectDesc,
              minLib: this.state.miniCodeInfo.minLibVersion,
              needAppID: this.state.miniCodeInfo.needAppID,
              importTime: +new Date()
            }
          }
          try {
            await this.importCodeToDir(this.state.miniCodeInfo.code, a)
          } catch (a) {
            this.setState({
              errorLoc: 'miniCodeLink',
              errorMsg: `代码包解压到文件夹失败，请重试，失败原因：${a}`
            })
          }
          this.props.createProjectSuccess(b, { initQuickStart: !1 })
        } else
          this.props.createProjectSuccess(b, {
            initQuickStart:
              this.state.quickstartSelected || l.QUICKSTART_TYPE.WEAPP_MINI
          })
        this.setState(H),
          this.props.detach
            ? (this.props.win.hide(),
              this.props.setConfirmInfo({
                show: !0,
                title: m.config.CONFIRM_OPEN_IN_THIS_WINDOW_TITLE,
                content: m.config.CONFIRM_OPEN_IN_THIS_WINDOW_CONTENT.format(p),
                callback: async a => {
                  if (a)
                    try {
                      this.props.setConfirmInfo({ show: !1 }),
                        this.props.closeProject(),
                        setTimeout(() => {
                          this.props.openProject(b.projectid),
                            this.props.win.close()
                        }, 50)
                    } catch (a) {
                      this.props.win.close()
                    }
                  else this.props.win.close()
                }
              }))
            : this.props.openProject(b.projectid),
          i(`project_createsuc`, n),
          h({ url: `${j.touristCreateURL}?appid=${n}`, needToken: 1 })
            .then(() => {})
            .catch(a => {
              g.error(`create tourist project error ${a}`)
            })
      } else
        try {
          const { resp: b, body: c } = await h({
            url: `${j.createWeappURL}?appid=${n}`,
            needToken: 1,
            needCheckErrCode: 1
          })
          this.setState({ showLoading: !1 }),
            g.info(`createstep.js create  ${c}`)
          let d = c,
            f = d.baseresponse,
            k = f ? parseInt(f.errcode) : 0
          if (k === w)
            return (
              this.setState({
                errorLoc: 'appid',
                errorMsg:
                  '\u5F53\u524D\u5F00\u53D1\u8005\u672A\u7ED1\u5B9A\u6B64 AppID \uFF0C\u8BF7\u5230\u5C0F\u7A0B\u5E8F\u7BA1\u7406\u540E\u53F0\u64CD\u4F5C\u540E\u91CD\u8BD5'
              }),
              nw.Shell.openExternal('https://mp.weixin.qq.com/'),
              void g.error(`createstep.js create project error ${k}`)
            )
          if (k === v)
            return (
              this.setState({
                errorLoc: 'appid',
                errorMsg:
                  '\u4E0D\u5B58\u5728\u6B64 AppID \u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\u6216\u4F7F\u7528\u65E0 AppID \u6A21\u5F0F'
              }),
              void g.error(`createstep.js create project error ${k}`)
            )
          if (0 === k) {
            let b = d.app_head_img ? `${d.app_head_img}/0` : x,
              c = p
            if (
              (d.app_nickname && (c = encodeURIComponent(d.app_nickname)),
              (E = {
                isAdmin: d.is_admin,
                isTourist: !1,
                isGameTourist: e,
                isMiniCode: !0,
                projectid: B,
                hash: D,
                appid: n,
                projectname: p,
                projectpath: a,
                appShowImageUrl: b,
                libVersion: u,
                compileType: G,
                attr: _extends({}, C, {
                  platform: !!d.is_platform,
                  gameApp: !!d.game_app,
                  platformNickname: d.platform_nickname || '',
                  appNickName: c
                })
              }),
              !d.game_app || (E.compileType = q.game),
              (E.appShowName = p),
              c !== p && (E.appShowName = c),
              E.platform &&
                E.platformNickname &&
                (E.appShowName = E.platformNickname),
              this.props.isImport)
            ) {
              E.shareInfo = {
                from: {
                  codeid: this.state.miniCodeInfo.miniCodeID,
                  desc: this.state.miniCodeInfo.projectDesc,
                  minLib: this.state.miniCodeInfo.minLibVersion,
                  needAppID: this.state.miniCodeInfo.needAppID,
                  importTime: +new Date()
                }
              }
              try {
                await this.importCodeToDir(this.state.miniCodeInfo.code, a)
              } catch (a) {
                this.setState({
                  errorLoc: 'miniCodeLink',
                  errorMsg: `代码包解压到文件夹失败，请重试，失败原因：${a}`
                })
              }
              this.props.createProjectSuccess(E, { initQuickStart: !1 })
            } else
              this.props.createProjectSuccess(E, {
                initQuickStart:
                  this.state.quickstartSelected || l.QUICKSTART_TYPE.WEAPP_MINI
              })
            return (
              this.setState(H),
              this.props.detach
                ? (this.props.win.hide(),
                  this.props.setConfirmInfo({
                    show: !0,
                    title: m.config.CONFIRM_OPEN_IN_THIS_WINDOW_TITLE,
                    content: m.config.CONFIRM_OPEN_IN_THIS_WINDOW_CONTENT.format(
                      p
                    ),
                    callback: async a => {
                      if (a)
                        try {
                          this.props.setConfirmInfo({ show: !1 }),
                            this.props.closeProject(),
                            setTimeout(() => {
                              this.props.openProject(E.projectid),
                                this.props.win.close()
                            }, 50)
                        } catch (a) {
                          this.props.win.close()
                        }
                      else this.props.win.close()
                    }
                  }))
                : this.props.openProject(E.projectid),
              void i(`project_createsuc`, n)
            )
          }
          this.setState({
            errorMsg: (c || '\u7CFB\u7EDF\u9519\u8BEF').toString(),
            errorLoc: 'appid'
          })
        } catch (a) {
          g.error(`create project error: ${a.toString()}`),
            this.setState({
              showLoading: !1,
              errorMsg: a.toString(),
              errorLoc: 'appid'
            })
        }
    }
    render() {
      return this.props.isImport ? this.renderImport() : this.renderCreate()
    }
    renderCreate() {
      let b = this.isTourist(),
        c = this.isGameTourist(),
        d = this.props.cancel,
        e = this.state.appid
      const f = 'ui-form-item ui-form-item-inline',
        g = f + ' ui-form-item-error',
        h = { WebkitAppRegion: 'no-drag' },
        i = this.compileTypeConstants.map(a => {
          return a.name
        })
      let j = this.state.quickstartItems.findIndex(
          a => a.type === this.state.quickstartSelected
        ),
        k = ''
      ;-1 === j
        ? ((j = 0), k !== l.QUICKSTART_TYPE.WEAPP_MINI && (k = D[0].name))
        : (k = this.state.quickstartItems[j].name)
      let m = '100%'
      if (this.qsInput && this.qsInput.getBoundingClientRect) {
        const a = this.qsInput.getBoundingClientRect()
        m = a.width + 'px'
      }
      let n =
        0 < 44 * (this.state.quickstartItems.length - 1)
          ? 44 * (this.state.quickstartItems.length - 1)
          : 44
      return a.createElement(
        'div',
        {
          className: 'dashboard',
          style: { WebkitAppRegion: 'drag' },
          onClick: this.onContainerClick.bind(this)
        },
        this.state.showMask
          ? a.createElement('div', {
              className: 'ui-mask ui-mask-transparent',
              onClick: this.handleMaskClick
            })
          : null,
        a.createElement(
          'div',
          { className: 'dashboard-commands' },
          a.createElement(
            'div',
            {
              className: 'dashboard-navigator',
              style: this.props.detach ? { display: 'none' } : {}
            },
            a.createElement(
              'a',
              { onClick: d, style: h },
              a.createElement('i', { className: 'ui-icon-back' }),
              a.createElement(
                'span',
                null,
                '\xA0\u5C0F\u7A0B\u5E8F\u9879\u76EE\u7BA1\u7406'
              )
            )
          ),
          a.createElement(
            'div',
            { className: 'dashboard-brand' },
            a.createElement(
              'div',
              { className: 'dashboard-logo' },
              a.createElement('i', { className: 'ui-icon-mini-app' })
            ),
            a.createElement(
              'h3',
              { className: 'dashboard-caption' },
              '\u521B\u5EFA\u4EE3\u7801\u7247\u6BB5'
            )
          ),
          a.createElement(
            'div',
            { className: 'dashboard-content' },
            a.createElement(
              'div',
              { className: 'ui-form' },
              a.createElement(
                'div',
                { className: 'projectname' === this.state.errorLoc ? g : f },
                a.createElement(
                  'label',
                  { className: 'ui-form-label' },
                  '\u4EE3\u7801\u7247\u6BB5\u540D\u79F0'
                ),
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'div',
                    { className: 'ui-input-box' },
                    a.createElement('input', {
                      type: 'text',
                      placeholder: '',
                      className: 'ui-input',
                      style: h,
                      value: this.state.appname,
                      onChange: this.editAppname.bind(this)
                    })
                  )
                )
              ),
              a.createElement(
                'div',
                { className: 'projectpath' === this.state.errorLoc ? g : f },
                a.createElement(
                  'label',
                  { className: 'ui-form-label' },
                  '\u4EE3\u7801\u7247\u6BB5\u76EE\u5F55'
                ),
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'div',
                    {
                      className: 'ui-flex',
                      onClick: this.chooseDir.bind(this),
                      style: h
                    },
                    a.createElement(
                      'div',
                      { className: 'ui-input-box' },
                      a.createElement('input', {
                        type: 'text',
                        readOnly: !0,
                        placeholder:
                          this.state.projectpath || '\u4E34\u65F6\u76EE\u5F55',
                        className: 'ui-input'
                      })
                    ),
                    a.createElement(
                      'div',
                      { className: 'ui-selector ui-selector-default' },
                      a.createElement(
                        'div',
                        { className: 'ui-selector-dropdown' },
                        a.createElement('i', {
                          className: 'ui-icon-arrow-down-o'
                        })
                      )
                    )
                  )
                )
              ),
              a.createElement(
                'div',
                { className: 'appid' === this.state.errorLoc ? g : f },
                a.createElement(
                  'label',
                  { className: 'ui-form-label' },
                  'AppID'
                ),
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'div',
                    { className: 'ui-input-box' },
                    a.createElement('input', {
                      ref: a => (this.appidInput = a),
                      style: h,
                      className: 'ui-input',
                      value: e,
                      onChange: this.editAppid.bind(this),
                      type: 'text',
                      placeholder: ''
                    })
                  ),
                  a.createElement(
                    'p',
                    { className: 'ui-form-tips', style: h },
                    '\u9009\u586B\uFF0C\u90E8\u5206\u63A5\u53E3\u548C\u529F\u80FD\u9700\u8981 AppID \u624D\u80FD\u4F7F\u7528'
                  )
                )
              ),
              a.createElement(
                'div',
                {
                  className: 'ui-form-item ui-form-item-inline',
                  style: this.state.showQuickStart ? {} : { display: 'none' }
                },
                a.createElement('label', {
                  htmlFor: '',
                  className: 'ui-form-label'
                }),
                a.createElement(
                  'div',
                  { className: 'ui-form-controls', style: h },
                  a.createElement(
                    'div',
                    { className: 'ui-flex' },
                    a.createElement(
                      'div',
                      {
                        className: 'ui-flex-item ui-selector',
                        onClick: this.quickstartDDControl.toggle
                      },
                      a.createElement(
                        'p',
                        {
                          className: 'ui-selector-input',
                          ref: a => (this.qsInput = a)
                        },
                        k
                      ),
                      a.createElement(
                        'div',
                        { className: 'ui-selector-dropdown' },
                        a.createElement('i', {
                          className: 'ui-icon-arrow-down-o'
                        })
                      ),
                      a.createElement(p, {
                        width: m,
                        height: n + 'px',
                        open: this.state.quickstartDDOpen,
                        left: this.quickstartDDControl.left,
                        top: this.quickstartDDControl.top,
                        items: this.state.quickstartItems.map(a => a.name),
                        onItemSelected: this.quickstartDDControl.onItemSelected,
                        selectedIndex: j
                      })
                    )
                  )
                )
              ),
              a.createElement(
                'div',
                {
                  className: 'ui-form-item ui-form-item-inline',
                  style: this.state.errorLoc ? {} : { display: 'none' }
                },
                a.createElement('label', { className: 'ui-form-label' }),
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'p',
                    { className: 'dashboard-error-tips' },
                    this.state.errorMsg
                  )
                )
              )
            )
          ),
          a.createElement(
            'div',
            { className: 'dashboard-command-ft' },
            a.createElement(
              'div',
              { className: 'dashboard-command-action' },
              a.createElement(
                'button',
                {
                  className: 'ui-button ui-button-primary',
                  onClick: this.addProject.bind(this),
                  style: h
                },
                '\u521B\u5EFA'
              )
            )
          )
        )
      )
    }
    renderImport() {
      let b = this.isTourist(),
        c = this.isGameTourist(),
        d = this.props.cancel,
        e = this.state.appid,
        f = this.state.miniCodeLink
      const g = 'ui-form-item ui-form-item-inline',
        h = 'ui-form-item ui-form-item-inline import-snippet-url',
        i = g + ' ui-form-item-error',
        j = { WebkitAppRegion: 'no-drag' }
      this.state.importStatus !== E.SUCCESS &&
        ({ WebkitAppRegion: 'no-drag' }.display = 'none')
      this.compileTypeConstants.map(a => {
        return a.name
      })
      return a.createElement(
        'div',
        {
          className: 'dashboard',
          style: { WebkitAppRegion: 'drag' },
          onClick: this.onContainerClick.bind(this)
        },
        this.state.showMask
          ? a.createElement('div', {
              className: 'ui-mask ui-mask-transparent',
              onClick: this.handleMaskClick
            })
          : null,
        a.createElement(
          'div',
          { className: 'dashboard-commands' },
          a.createElement(
            'div',
            {
              className: 'dashboard-navigator',
              style: this.props.detach ? { display: 'none' } : {}
            },
            a.createElement(
              'a',
              { onClick: d, style: j },
              a.createElement('i', { className: 'ui-icon-back' }),
              a.createElement(
                'span',
                null,
                '\xA0\u5C0F\u7A0B\u5E8F\u9879\u76EE\u7BA1\u7406'
              )
            )
          ),
          a.createElement(
            'div',
            { className: 'dashboard-brand' },
            a.createElement(
              'div',
              { className: 'dashboard-logo' },
              a.createElement('i', { className: 'ui-icon-mini-app' })
            ),
            a.createElement(
              'h3',
              { className: 'dashboard-caption' },
              '\u5BFC\u5165\u4EE3\u7801\u7247\u6BB5'
            ),
            a.createElement(
              'p',
              { className: 'dashboard-subtitle' },
              '\u586B\u5199\u4EE3\u7801\u7247\u6BB5\u94FE\u63A5\u5373\u53EF\u5BFC\u5165\u4EE3\u7801\u7247\u6BB5'
            )
          ),
          a.createElement(
            'div',
            { className: 'dashboard-content' },
            a.createElement(
              'div',
              { className: 'ui-form' },
              a.createElement(
                'div',
                {
                  className:
                    'miniCodeLink' === this.state.errorLoc
                      ? h + ' ui-form-item-error'
                      : h
                },
                a.createElement(
                  'label',
                  { className: 'ui-form-label' },
                  '\u4EE3\u7801\u94FE\u63A5'
                ),
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'div',
                    { className: 'ui-input-box' },
                    a.createElement('input', {
                      type: 'text',
                      placeholder: '',
                      className: 'ui-input',
                      style: j,
                      value: f,
                      onChange: this.editMiniCodeLink.bind(this),
                      onKeyPress: this.onMiniCodeLinkInputKeyPress.bind(this)
                    }),
                    a.createElement(
                      'a',
                      {
                        className: 'ui-input-opr',
                        style: j,
                        onClick: this.fetchMiniCodeInfo.bind(this)
                      },
                      this.state.importStatus === E.PENDING
                        ? a.createElement('i', { className: 'ui-icon-spinner' })
                        : a.createElement('i', {
                            className: 'ui-icon-arrow-right-o'
                          })
                    )
                  )
                )
              ),
              this.state.importStatus === E.SUCCESS
                ? [
                    a.createElement(
                      'div',
                      {
                        className: 'ui-form-item ui-form-item-inline',
                        key: 'name_desc'
                      },
                      a.createElement(
                        'label',
                        { className: 'ui-form-label' },
                        '\u4EE3\u7801\u7247\u6BB5\u63CF\u8FF0'
                      ),
                      a.createElement(
                        'div',
                        { className: 'ui-form-controls' },
                        a.createElement(
                          'p',
                          { className: 'ui-form-tips' },
                          this.state.miniCodeInfo.projectDesc
                        )
                      )
                    ),
                    a.createElement(
                      'div',
                      {
                        className:
                          'projectname' === this.state.errorLoc ? i : g,
                        key: 'projectname'
                      },
                      a.createElement(
                        'label',
                        { className: 'ui-form-label' },
                        '\u4EE3\u7801\u7247\u6BB5\u540D\u79F0'
                      ),
                      a.createElement(
                        'div',
                        { className: 'ui-form-controls' },
                        a.createElement(
                          'div',
                          { className: 'ui-input-box' },
                          a.createElement('input', {
                            type: 'text',
                            placeholder: '',
                            className: 'ui-input',
                            style: j,
                            value: this.state.appname,
                            onChange: this.editAppname.bind(this)
                          })
                        )
                      )
                    ),
                    a.createElement(
                      'div',
                      {
                        className:
                          'projectpath' === this.state.errorLoc ? i : g,
                        key: 'dir'
                      },
                      a.createElement(
                        'label',
                        { className: 'ui-form-label' },
                        '\u5B58\u653E\u76EE\u5F55'
                      ),
                      a.createElement(
                        'div',
                        { className: 'ui-form-controls' },
                        a.createElement(
                          'div',
                          {
                            className: 'ui-flex',
                            'data-type': 'import',
                            onClick: this.chooseDir.bind(this),
                            style: j
                          },
                          a.createElement(
                            'div',
                            { className: 'ui-input-box' },
                            a.createElement('input', {
                              type: 'text',
                              readOnly: !0,
                              placeholder:
                                this.state.projectpath ||
                                '\u4E34\u65F6\u76EE\u5F55',
                              className: 'ui-input'
                            })
                          ),
                          a.createElement(
                            'div',
                            { className: 'ui-selector ui-selector-default' },
                            a.createElement(
                              'div',
                              { className: 'ui-selector-dropdown' },
                              a.createElement('i', {
                                className: 'ui-icon-arrow-down-o'
                              })
                            )
                          )
                        )
                      )
                    ),
                    a.createElement(
                      'div',
                      {
                        className: 'appid' === this.state.errorLoc ? i : g,
                        key: 'appid'
                      },
                      a.createElement(
                        'label',
                        { className: 'ui-form-label' },
                        'AppID'
                      ),
                      a.createElement(
                        'div',
                        { className: 'ui-form-controls' },
                        a.createElement(
                          'div',
                          { className: 'ui-input-box' },
                          a.createElement('input', {
                            ref: a => (this.appidInput = a),
                            style: j,
                            className: 'ui-input',
                            value: e,
                            onChange: this.editAppid.bind(this),
                            type: 'text',
                            placeholder: this.state.miniCodeInfo.needAppID
                              ? '\u9009\u586B\uFF0C\u5206\u4EAB\u8005\u5EFA\u8BAE\u586B\u5165 AppID'
                              : '\u9009\u586B\uFF0C\u90E8\u5206\u63A5\u53E3\u548C\u529F\u80FD\u9700\u8981 AppID \u624D\u80FD\u4F7F\u7528'
                          })
                        ),
                        a.createElement('p', {
                          className: 'ui-form-tips',
                          style: j
                        })
                      )
                    )
                  ]
                : null,
              a.createElement(
                'div',
                {
                  className: 'ui-form-item ui-form-item-inline',
                  style: this.state.errorLoc ? {} : { display: 'none' }
                },
                a.createElement('label', { className: 'ui-form-label' }),
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'p',
                    { className: 'dashboard-error-tips' },
                    this.state.errorMsg
                  )
                )
              )
            )
          ),
          a.createElement(
            'div',
            { className: 'dashboard-command-ft' },
            a.createElement(
              'div',
              { className: 'dashboard-command-action' },
              this.state.importStatus === E.SUCCESS
                ? a.createElement(
                    'button',
                    {
                      className: 'ui-button ui-button-primary',
                      onClick: this.addProject.bind(this),
                      style: j,
                      disabled: this.state.importStatus !== E.SUCCESS
                    },
                    '\u5BFC\u5165'
                  )
                : a.createElement('p', null, '\xA0')
            )
          )
        )
      )
    }
  }
})(require('lazyload'), require)
