'use strict'
!(function(require, directRequire) {
  function a(a, b) {
    return Math.floor(Math.random() * (b - a + 1)) + a
  }
  const b = require('path'),
    c = require('react'),
    d = require('lodash'),
    e = require('./a1dd553cc059d528bb0ef56afed53968.js'),
    f = require('./a15851ca252a104aad8b3fd3fc114574.js'),
    g = require('./dd93307b3045531926d5a6645f6f3455.js'),
    h = require('./51a8f674caffc4c2fa2358314af90837.js'),
    i = require('./9a24eb4fb7a49d4dd24531943fc3c899.js'),
    j = require('./2dfc6a3df6d6fc51266b293c8420e88b.js'),
    k = require('./logger.js'),
    l = require('./99fff845d6c7bff564f99e38e435f827.js'),
    m = require('./6fc66cd42da3e8c155b22db441702cda.js'),
    n = require('./6620a0cf7dad1b400d60f0fdae40f524.js'),
    o = require('./3b5f8e2469c474c8d433c1c6926d8999.js'),
    p = require('./92320c1386e6db6a6f2556736a9bc280.js'),
    q = require('./ea653f45dc25181ca4f1b108175009b7.js'),
    r = require('./2a36cc34e5f44e62f9188b9fc0871d70.js'),
    s = require('classnames'),
    t = require('./0794878a22a26634e42df858bbaca543.js'),
    u = require('./ff946754202ecf377034d29daac7c8d9.js'),
    v = require('./56c390e04c10e91a4aa2a2c19d9a885d.js'),
    w = require('./common/locales/index.js'),
    x = require('./3bfffbe88b3d923921f851c0697974fe.js'),
    y = require('./71734cad2a6081d396ea668ffa405627.js'),
    z = require('./d3976cc01aeebc5b09e11c4135b6bd8d.js'),
    A = require('./tools.js'),
    B = require('moment'),
    {
      resetBackgroundStatus: C
    } = require('./a3959bb900db9f65ed2e9c5dfa6977b7.js'),
    D = require('./949d8235c744ced2a80121e4dba34c28.js'),
    E = require('./8bf10a96e005fd88d01d949c3d2f8d46.js'),
    F = 'about:blank',
    G = require('./bc78839ccca8df9e5ceeb7fae11b7be2.js'),
    H = require('./a78e6d6a87de1708226375ca4c320d76.js')
  let I
  chrome.webRequest.onBeforeSendHeaders.addListener(
    a => {
      let { type: b, url: c } = a
      if (
        'websocket' === b &&
        0 !== c.indexOf(`ws://127.0.0.1:${global.messageCenterPort}`)
      ) {
        let b = a.requestHeaders || []
        const c = G.getState(),
          d =
            (c.toolbar && c.toolbar.deviceInfo && c.toolbar.deviceInfo.ua) || ''
        for (let a = 0; a < b.length; ++a)
          'User-Agent' === b[a].name &&
            (b[a].value = d.replace('{{webviewID}}', ''))
        let e = x.getProjectAppID()
        if (
          (b.push({
            name: 'Referer',
            value: `https://servicewechat.com/${e}/devtools/page-frame.html`
          }),
          I)
        ) {
          for (let a in I) b.push({ name: a, value: I[a] })
          I = void 0
        }
        return { requestHeaders: b }
      }
    },
    { urls: ['<all_urls>'] },
    ['blocking', 'requestHeaders']
  )
  class J extends c.Component {
    constructor(a) {
      super(a),
        (this.onResizeStop = (a, b, c) => {
          this.props.windowActions.setDebuggerWindow({ height: c })
        }),
        (this.syncDialogMap = {}),
        (this.restartTimer = null),
        (this.subPackageLoading = {}),
        (this.taskMap = {}),
        (this.session = +new Date()),
        (this.bbsLogConfig = d.cloneDeep(this.props.bbsLogConfig || []))
    }
    componentDidMount() {
      ;(this._onAppServiceMessage = this.onAppServiceMessage.bind(this)),
        e.register(this._onAppServiceMessage),
        (this._onAppDataMessage = this.onAppDataMessage.bind(this)),
        g.register(this._onAppDataMessage),
        (this._onStorageMessage = this.onStorageMessage.bind(this)),
        h.register(this._onStorageMessage),
        (this._onDevtoolsMessage = this.onDevtoolsMessage.bind(this)),
        i.register(this._onDevtoolsMessage),
        j.initHelper({
          setDebuggerWindow: this.props.setDebuggerWindow.bind(this)
        }),
        this.setupBBSLogWorkerListener(),
        this.initWebview()
    }
    componentWillUnmount() {
      this.devtoolsview && this.devtoolsview.detach(),
        this.webview && this.webview.detach(),
        e.unRegister(this._onAppServiceMessage),
        g.unRegister(this._onAppDataMessage),
        h.unRegister(this._onStorageMessage),
        i.unRegister(this._onDevtoolsMessage)
      try {
        global.worker.bbsLogWorker &&
          (global.worker.bbsLogWorker.onmessage = null)
      } catch (a) {
        k.error(a)
      }
    }
    componentWillReceiveProps(a) {
      if (a.assdkCallbackInfo != this.props.assdkCallbackInfo) {
        let { callbackID: b, res: c } = a.assdkCallbackInfo
        this.syncDialogMap[b]
          ? (this.syncDialogMap[b].ok(JSON.stringify(c)),
            delete this.syncDialogMap[b])
          : e.invokeCallback(b, c)
      }
      if (
        ((a.compileCommand != this.props.compileCommand ||
          a.device != this.props.device) &&
          ((e.ready = !1), this.restart()),
        a.appLaunched != this.props.appLaunched &&
          a.appLaunched &&
          this.taskMap.appLaunched &&
          (this.taskMap.appLaunched.forEach(a => {
            a()
          }),
          delete this.taskMap.appLaunched),
        a.appRoute != this.props.appRoute &&
          ('ready' == a.appRoute.status
            ? 'appLaunch' == a.appRoute.openType
              ? setTimeout(() => {
                  this.triggerLaunch()
                })
              : this.triggerAppRoute(a)
            : 'done' == a.appRoute.status && this.triggerAppRouteDone(a)),
        a.networkType != this.props.networkType &&
          e.triggerOnEvent({
            eventName: 'onNetworkStatusChange',
            data: {
              isConnected: 'none' !== a.networkType,
              networkType: a.networkType
            }
          }),
        a.storage != this.props.storage &&
          h.send({ command: 'UPDATE_STORAGE', data: a.storage }),
        a.subPackageLoaded != this.props.subPackageLoaded &&
          setTimeout(() => {
            this.checkSubPackages()
          }),
        a.debugInfo != this.props.debugInfo &&
          a.debugInfo &&
          i.send({ command: 'DISPATCH_MESSAGE', data: a.debugInfo }),
        a.console != this.props.console && this.webview)
      ) {
        const b = a.console.type
        let c
        'clear' == b
          ? (c = 'console.clear()')
          : 'error' == b
            ? (c = `console.error(\`${a.console.msg}\`)`)
            : 'log' == b && (c = `console.log(\`${a.console.msg}\`)`),
          c && this.webview.executeScript({ code: c })
      }
      a.networkType != this.props.networkType &&
        this.webview &&
        this.webview.executeScript({
          code: `
        var event = new CustomEvent("networkChange", {
          detail: {
            networkStatus: '${a.networkType}'
          }
        })
        window.dispatchEvent(event)
        `
        })
    }
    setupBBSLogWorkerListener() {
      this._bbsLogWorkerListener = a => {
        if (a.data) {
          if (a.data.error) return void k.error(a.data.error)
          try {
            if (a.data.ext.session !== this.session) return
            const b = a.data.result.config,
              c = a.data.ext
            j.display({
              command: v.DISPLAY_INFO,
              type: v.DISPLAY_TYPES.BBS_LOG_LINK,
              data: {
                messageLevel: c.level,
                message: c.message,
                explanation: b.explanation,
                link: b.link,
                linkType: b.linkType
              }
            })
          } catch (a) {
            k.error(a)
          }
        }
      }
      try {
        global.worker.bbsLogWorker.onmessage = this._bbsLogWorkerListener
      } catch (a) {
        k.error(a)
      }
    }
    triggerAppRouteDone(a) {
      let b = a.currentWebview,
        c = b.pathName
      const d = () => {
        let d = {}
        for (let a in b.query) d[a] = encodeURIComponent(b.query[a])
        e.triggerOnEvent({
          eventName: 'onAppRouteDone',
          data: {
            webviewId: b.id,
            path: c + '.html',
            query: d,
            openType: a.appRoute.openType
          }
        })
      }
      let f = z.checkIsInSubPackage(a.appConfig, c)
      !f || a.subPackageLoaded[f.root]
        ? d()
        : (!this.taskMap[f.root] && (this.taskMap[f.root] = []),
          this.taskMap[f.root].push(d))
    }
    triggerAppRoute(a) {
      let b = a.currentWebview,
        c = b.pathName
      const d = () => {
        let d = {}
        for (let a in b.query) d[a] = encodeURIComponent(b.query[a])
        e.triggerOnEvent({
          eventName: 'onAppRoute',
          data: {
            webviewId: b.id,
            path: c + '.html',
            query: d,
            openType: a.appRoute.openType
          }
        })
      }
      let f = z.checkIsInSubPackage(a.appConfig, c)
      !f || a.subPackageLoaded[f.root]
        ? d()
        : (!this.taskMap[f.root] && (this.taskMap[f.root] = []),
          this.taskMap[f.root].push(d))
    }
    triggerLaunch() {
      let b = this.props.currentWebview,
        c = b.pathName
      const d = this.props.simulateUpdate,
        f = () => {
          e.triggerOnEvent({
            eventName: 'onAppRoute',
            data: {
              webviewId: b.id,
              path: c + '.html',
              query: b.query,
              scene: this.props.scene,
              openType: 'appLaunch'
            }
          }),
            d
              ? (this.props.simulatorActions.setSimulateUpdate(!1),
                setTimeout(() => {
                  e.triggerOnEvent({
                    eventName: 'onUpdateStatusChange',
                    data: { state: 'updating' }
                  }),
                    setTimeout(() => {
                      e.triggerOnEvent({
                        eventName: 'onUpdateStatusChange',
                        data: { state: 'updateReady' }
                      })
                    }, a(1e3, 5e3))
                }, a(1e3, 5e3)))
              : setTimeout(() => {
                  e.triggerOnEvent({
                    eventName: 'onUpdateStatusChange',
                    data: { state: 'noUpdate' }
                  })
                }, a(1e3, 5e3))
        }
      let g = z.checkIsInSubPackage(this.props.appConfig, c)
      g
        ? this.props.subPackageLoaded[g.root]
          ? f()
          : (!this.taskMap[g.root] && (this.taskMap[g.root] = []),
            this.taskMap[g.root].push(f))
        : this.props.appLaunched
          ? f()
          : (!this.taskMap.appLaunched && (this.taskMap.appLaunched = []),
            this.taskMap.appLaunched.push(f))
    }
    initWebview() {
      let a = H.get('devtools', {}),
        b = H.get('appservice', {})
      this.devtoolsview && this.devtoolsview.detach(),
        this.webview && this.webview.detach(),
        (this.devtoolsview = a),
        (this.webview = b),
        b.setUserAgentOverride(
          `wechatdevtools appservice port/${global.messageCenterPort} ${
            this.props.popup ? 'popup' : ''
          }`
        ),
        b.setAttribute('tabIndex', '-1'),
        b.on('exit', a => {
          ;('abnormal' === a.reason ||
            'crash' === a.reason ||
            'killed' === a.reason) &&
            this.initWebview()
        }),
        b.on('consolemessage', a => {
          if (
            (!a.sourceId ||
              a.sourceId.match(
                /http:\/\/127\.0\.0\.1:\d+\/appservice\/__dev__\//
              )) &&
            !(1 > a.level)
          ) {
            const b = a.message
            if (b)
              try {
                this.bbsLogConfig &&
                  global.worker.bbsLogWorker.postMessage({
                    msgType: 'evaluate',
                    msgData: {
                      message: a.message,
                      context: {
                        libVersion:
                          this.props.project && this.props.project.libVersion
                      },
                      ext: {
                        session: this.session,
                        level: a.level,
                        message: a.message
                      }
                    }
                  })
              } catch (a) {
                k.error(a)
              }
          }
        }),
        this.initWebviewEvent(b)
      let c = `${a.originUserAgent} appservicedevtools port/${
        global.messageCenterPort
      } proxy/${global.proxyPort} ${this.props.popup ? 'popup' : ''}`
      a.setUserAgentOverride(c),
        a.setAttribute(
          'style',
          'height:100%;width:100%;position:relative;display:block;'
        ),
        a.on('exit', a => {
          ;('abnormal' === a.reason ||
            'crash' === a.reason ||
            'killed' === a.reason) &&
            this.initWebview()
        }),
        b.attach(this.appservicecontainer),
        this.showDevTools()
    }
    initWebviewEvent(a) {
      a.on('dialog', a => {
        let b = a.messageType || '',
          c = a.messageText
        if ('prompt' === b) {
          if ((a.preventDefault(), /^____sdk____/.test(c))) {
            let b = JSON.parse(c.replace(/^____sdk____/, '')),
              d = b.command
            'APPSERVICE_INVOKE' === d &&
              ((this.syncDialogMap[b.data.callbackID] = a.dialog),
              this.props.assdkActions.exec(b.data))
          } else a.dialog.ok('')
        } else if ('alert' == b)
          if ('DOCUMENT_READY' == c)
            (e.ready = !0), this.props.simulatorActions.setAppLaunched(!0)
          else if (0 == c.indexOf('SUBPACKAGE_READY_')) {
            let a = c.replace(/^SUBPACKAGE_READY_/, '')
            this.props.simulatorActions.setSubPackage(a, !0)
          } else if (0 === c.indexOf('SET_SOCKET_HEADER:'))
            try {
              let a = JSON.parse(c.replace('SET_SOCKET_HEADER:', ''))
              I = a
            } catch (a) {}
      }),
        (a.onRequestErrorOccurred = a => {
          let { type: b } = a
          if (
            'main_frame' === b &&
            0 === a.error.indexOf('net::') &&
            'net::ERR_BLOCKED_BY_CLIENT' !== a.error
          )
            return void j.display({
              command: v.DISPLAY_ERROR,
              data: { code: D.APPSERVICE_NETWORK_ERROR, error: { details: a } }
            })
        }),
        (a.onRequestBeforeSendHeaders = a => {
          let b = this.props.project
          if (b) {
            let b = a.url
            if ('main_frame' === a.type && b.match(/\?load$/))
              return this.restart(), { cancel: !0 }
            if (
              0 !=
                b.indexOf(`http://127.0.0.1:${global.proxyPort}/appservice`) &&
              0 !=
                b.indexOf(
                  `http://127.0.0.1:${global.proxyPort}/calibration/`
                ) &&
              !/favicon\.ico$/.test(b) &&
              'none' == this.props.networkType
            )
              return (
                j.display({
                  command: v.DISPLAY_ERROR,
                  data: {
                    title: w.config.NO_NETWORK_TIPS_TITLE,
                    error: {
                      message: w.config.NO_NETWORK_TIPS_CONTENT.format(b)
                    }
                  }
                }),
                { cancel: !0 }
              )
            let d = a.requestHeaders || [],
              e = d.findIndex(a => {
                return 'cookie' === a.name.toLowerCase()
              })
            d.splice(e, 1)
            for (var c = 0; c < d.length; ++c) {
              if (
                ('_Cookie' === d[c].name && (d[c].name = 'Cookie'),
                'Referer' === d[c].name)
              ) {
                let a = x.getProjectAppID()
                d[
                  c
                ].value = `https://servicewechat.com/${a}/devtools/page-frame.html`
              }
              'User-Agent' === d[c].name &&
                (d[c].value = this.props.ua.replace('{{webviewID}}', ''))
            }
            return { requestHeaders: a.requestHeaders }
          }
        }),
        (a.onRequestHeadersReceived = a => {
          let { type: b } = a
          if ('xmlhttprequest' === b) {
            let b = a.responseHeaders || [],
              c = {}
            return (
              b.forEach(a => {
                let { name: b, value: d } = a
                c[b] || (c[b] = []), c[b].push(d)
              }),
              b.push({ name: 'for-weapp-devtools', value: JSON.stringify(c) }),
              { responseHeaders: b }
            )
          }
          return {}
        })
    }
    _newwindow(a) {
      function b(a) {
        nw.Window.open(a, { width: 799, height: 799 })
      }
      a.preventDefault()
      let c = a.targetUrl
      if (
        0 !==
          c.indexOf(
            `http://127.0.0.1:${global.proxyPort}/appservice/appservice`
          ) &&
        `http://127.0.0.1:${global.proxyPort}/favicon.ico` !== c &&
        0 !== c.indexOf('ws://') &&
        0 !== c.indexOf('wss://') &&
        c
      ) {
        if (0 === c.indexOf('https://developers.weixin.qq.com'))
          return void this.props.BBS(c, v.IDE_SCENE.DEBUGGER)
        'https://developers.google.com/web/tools/chrome-devtools/' === c &&
          (c = 'https://mp.weixin.qq.com/debug/wxadoc/dev/index.html'),
          'https://developers.google.com/web/updates/2017/05/devtools-release-notes' ===
            c &&
            (c = 'https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/new.html'),
          0 == c.indexOf('wxfile://') &&
            (c = c.replace('wxfile://', 'http://wxfile.open.weixin.qq.com/')),
          b(c)
      }
    }
    hackNewWindow(a) {
      a.on('newwindow', this._newwindow.bind(this))
    }
    showDevTools() {
      let a = this.devtoolsview,
        b = this.webview
      a.attach(this.container), this.hackNewWindow(a)
      const c = () => {
        a.off('loadstop', c)
        const d = () => {
          b.off('loadstop', d),
            b.showDevTools(!0, a._webview),
            (this.loaded = !0),
            this.onWebviewLoadCommit(),
            this.props.simulatorActions.compile()
        }
        b.on('loadstop', d), this.resetStatus(), (b.src = F)
      }
      a.on('loadstop', c), (a.src = F)
    }
    resetStatus() {
      ;(this.loaded = !1),
        (this.taskMap = {}),
        (this.subPackageLoading = {}),
        (this.syncDialogMap = {}),
        (this.bbsLogConfig = d.cloneDeep(this.props.bbsLogConfig || [])),
        C()
    }
    restart() {
      ;(this.session = +new Date()),
        clearTimeout(this.restartTimer),
        (this.restartTimer = setTimeout(() => {
          if (!this.loaded || !this.webview || !this.props.appConfig) return
          j.cleanQueue(), this.props.simulatorActions.launch()
          let a = () => {
              this.webview.off('loadcommit', a),
                (this.loaded = !0),
                (e.ready = !0),
                clearTimeout(this.restartLoadCommitTimer)
            },
            b = `http://127.0.0.1:${
              global.proxyPort
            }/appservice/appservice?t=${Date.now()}`
          this.resetStatus(),
            this.webview.on('loadcommit', a),
            (this.webview.src = b),
            this.addOnAppLaunchedTask(this.checkPluginInfo.bind(this)),
            (this.bbsLogConfig = d.cloneDeep(this.props.bbsLogConfig || []))
          try {
            global.worker.bbsLogWorker.postMessage({
              msgType: 'updateConfig',
              msgData: this.bbsLogConfig
            })
          } catch (a) {}
          this.restartLoadCommitTimer = setTimeout(() => {
            this.props.infoActions.showError(
              '\u5C0F\u7A0B\u5E8F\u91CD\u542F\u8017\u65F6\u8FC7\u4E45\uFF0C\u8BF7\u786E\u8BA4\u4E1A\u52A1\u903B\u8F91\u4E2D\u662F\u5426\u6709\u590D\u6742\u8FD0\u7B97\uFF0C\u6216\u8005\u6B7B\u5FAA\u73AF'
            ),
              this.initWebview()
          }, 1e4)
        }))
    }
    onWebviewLoadCommit() {
      j.initWebview(this.webview)
    }
    onDevtoolsMessage(a) {
      if ('CLICK' === a.command) {
        if (this.devtoolsview) {
          const a = new UIEvent('click', { bubbles: !0 })
          this.devtoolsview._webview.dispatchEvent(a)
        }
      } else if ('RESET_NETWORK_CACHE' == a.command) E.clean()
      else if ('Network.getResponseBody' == a.command) {
        var b = E.get(a.data.params.requestId)
        i.send({
          command: 'DISPATCH_MESSAGE',
          data: {
            id: a.data.id,
            result: { body: b.toString('base64'), base64Encoded: !0 }
          }
        })
      } else
        'Button.popup' === a.command &&
          this.props.windowActions.setDebuggerWindow({
            popup: !this.props.popup
          })
    }
    onAppServiceMessage(a) {
      let { command: b, data: c } = a
      'APPSERVICE_PUBLISH' == b
        ? e.publish(a)
        : 'APPSERVICE_INVOKE' == b
          ? setTimeout(() => {
              this.props.assdkActions.exec(c)
            })
          : 'SEND_APP_DATA' == b
            ? g.ready && g.send({ command: 'SEND_APP_DATA', data: c })
            : 'SYSTEM' == b && this.onSystemCommand(c.api, c.data)
    }
    addOnAppLaunchedTask(a) {
      this.taskMap.appLaunched
        ? this.taskMap.appLaunched.push(a)
        : (this.taskMap.appLaunched = [a])
    }
    checkSubPackages() {
      for (let a in this.props.subPackageLoaded)
        if (!this.props.subPackageLoaded[a] && !this.subPackageLoading[a]) {
          this.subPackageLoading[a] = !0
          let b = async () => {
            let b = await y(this.props.project, a)
            this.webview.executeScript({ code: b }, () => {})
          }
          this.props.appLaunched
            ? b()
            : (!this.taskMap.appLaunched && (this.taskMap.appLaunched = []),
              this.taskMap.appLaunched.push(b))
        } else
          this.taskMap[a] &&
            0 < this.taskMap[a].length &&
            (this.taskMap[a].forEach(a => {
              a()
            }),
            delete this.taskMap[a])
    }
    checkPluginInfo() {
      try {
        const a = this.props.project
        if (a && a.pluginInfo && a.pluginInfo.length)
          for (const b of a.pluginInfo)
            if (
              b.current &&
              (b.latest &&
                'dev' !== b.current.version &&
                b.current.version !== b.latest.version &&
                j.display({
                  command: v.DISPLAY_INFO,
                  type: v.DISPLAY_TYPES.PLUGIN_UPDATE_INFO,
                  data: {
                    name: b.name,
                    currentVersion: b.current.version,
                    latestVersion: b.latest.version
                  }
                }),
              b.onlineVersion &&
                b.onlineVersion !== b.current.version &&
                0 > A.compareSemVer(b.current.version, b.onlineVersion))
            ) {
              j.display({
                command: v.DISPLAY_ERROR,
                type: 'none',
                data: {
                  title: w.config.PROJECT_PLUGIN_VERSION_WARNING,
                  msg: w.config.PROJECT_PLUGIN_VERSION_UNMATCHED_WITH_VERSION_USED_IN_ONLINE_MINI_PROGRAM.format(
                    [b.name, b.current.version, b.onlineVersion]
                  )
                }
              })
              continue
            }
      } catch (a) {
        k.error(
          `appservice.js checkPluginInfo fail with error: ${a.toString()}`
        )
      }
    }
    onSystemCommand(a, b) {
      switch (a) {
        case 'checkProxy': {
          try {
            let a = nw.App.getProxyForURL(b)
            e.send({
              command: 'SYSTEM_CALLBACK',
              data: { api: 'checkProxy', data: [{ url: b, proxy: a }] }
            })
          } catch (a) {}
          break
        }
        case 'showDecryptedInfo': {
          e.send({
            command: 'SYSTEM_CALLBACK',
            data: { api: 'showDecryptedInfo', data: this.props.decryptedInfo }
          })
          break
        }
        case 'showSystemInfo': {
          chrome.processes.getProcessInfo([], !0, a => {
            let b = 0,
              c = '',
              d = []
            for (let e in a) {
              let f = a[e]
              f.privateMemory && (b += f.privateMemory)
              let { tasks: g, type: h } = f
              'extension' === h &&
                ((h = ''),
                g.forEach(a => {
                  a.tabId ||
                    ((c = a.title
                      .replace(/.*open\.weixin\.qq\.com\//g, '')
                      .replace(/\?.*/, '')),
                    (h += `${c};`))
                }),
                (h = h.replace(/网页视图：/g, ''))),
                (h = h.replace('\u7F51\u9875', '')),
                d.push({
                  type: h,
                  osProcessId: f.osProcessId,
                  privateMemory: (f.privateMemory / 1024 / 1024).toFixed(2)
                })
            }
            ;(b = b / 1024 / 1024),
              e.send({
                command: 'SYSTEM_CALLBACK',
                data: {
                  api: 'showSystemInfo',
                  data: {
                    restartInfo: {
                      restartTimes: this.props.restartTimes,
                      beginTime: B(global.beginTime).calendar()
                    },
                    memory: b,
                    info: d
                  }
                }
              })
          })
          break
        }
        case 'openToolsLog': {
          nw.Shell.openItem(p.WeappLog)
          break
        }
        case 'openVendor': {
          nw.Shell.openItem(p.WeappVendor)
          break
        }
        case 'syncMessage': {
          r.sync()
          break
        }
        case 'qcloudup': {
          ;(async (a = {}) => {
            let b = await t.operate(this.props.project, a)
            e.send({
              command: 'SYSTEM_CALLBACK',
              data: { api: 'qcloudup', data: b }
            })
          })(b)
          break
        }
        case 'build': {
          this.props.simulatorActions.compile({
            origin: v.COMPILE_ORIGIN.CONSOLE
          })
          break
        }
        case 'preview': {
          this.props.toolbarActions.togglePreviewCode()
          break
        }
        case 'upload': {
          this.props.infoActions.setUploadInfo({ show: !0 })
          break
        }
        default:
      }
    }
    onAppDataMessage(a) {
      let { command: b, data: c } = a
      'GET_APP_DATA' == b
        ? ((g.ready = !0), e.send({ command: 'GET_APP_DATA' }))
        : 'WRITE_APP_DATA' == b
          ? e.send({ command: 'WRITE_APP_DATA', data: c })
          : 'ON_PANEL_HIDE' == b && (g.ready = !1)
    }
    onStorageMessage(a) {
      let { command: b, data: c } = a
      'EXEC_STORAGE_SDK' == b
        ? this.props.assdkActions.exec(c)
        : 'STORAGE_PANNEL_SHOW' == b
          ? ((h.ready = !0),
            this.props.assdkActions.exec({
              api: 'getStorage',
              args: {},
              callbackID: -1
            }))
          : 'STORAGE_PANNEL_HIDE' == b && (h.ready = !1)
    }
    render() {
      let a = this.props,
        b = { height: a.height }
      a.show && !a.editorShow && (b.flex = '1')
      let d = s('devtools', { 'ui-invisible': !a.show })
      return a.windowStatus.mini
        ? c.createElement(
            'div',
            {
              ref: a => (this.container = a),
              style: { width: '100%', height: '100%' }
            },
            c.createElement(l, null),
            c.createElement(m, null),
            c.createElement('div', {
              className: 'ui-divider ui-divider-horizontal',
              style: { pointerEvents: 'none' }
            }),
            c.createElement('div', {
              ref: a => (this.appservicecontainer = a),
              style: { width: 0, height: 0 },
              tabIndex: -1
            })
          )
        : a.popup
          ? ((b.width = '100%'),
            (b.height = '100%'),
            c.createElement(
              'div',
              { ref: a => (this.container = a), className: d, style: b },
              c.createElement(l, null),
              c.createElement(m, null),
              c.createElement('div', {
                className: 'ui-divider ui-divider-horizontal',
                style: { pointerEvents: 'none' }
              }),
              c.createElement('div', {
                ref: a => (this.appservicecontainer = a),
                style: { width: 0, height: 0 },
                tabIndex: -1
              })
            ))
          : c.createElement(
              q,
              {
                innerRef: a => (this.container = a),
                width: '100%',
                height: a.popup ? '100%' : a.height,
                className: d,
                style: b,
                topResizable: !0,
                onResizeStop: this.onResizeStop
              },
              c.createElement(l, null),
              c.createElement(m, null),
              c.createElement('div', {
                className: 'ui-divider ui-divider-horizontal',
                style: { pointerEvents: 'none' }
              }),
              c.createElement('div', {
                ref: a => (this.appservicecontainer = a),
                style: { width: 0, height: 0 },
                tabIndex: -1
              })
            )
    }
  }
  module.exports = J
})(require('lazyload'), require)
