'use strict'
!(function(require, directRequire) {
  function a(a = !0) {
    return b => {
      i({
        url: `${j.clearSession}`,
        method: 'post',
        needToken: 1,
        needAppID: 1
      })
        .then(() => {
          a &&
            b({
              type: h.INFO_SHOW_SUCCESS,
              data: n.config.CLEAN_USER_SESSION_SUCCESS
            }),
            b({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' })
        })
        .catch(() => {
          b({
            type: h.INFO_SHOW_ERROR,
            data: {
              message: n.config.CLEAN_USER_SESSION_ERROR.format(
                errorList.join(',')
              )
            }
          }),
            b({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' })
        })
    }
  }
  function b(a = !0) {
    return b => {
      let c = 2,
        d = [],
        e = e => {
          c--,
            e && d.push(e),
            0 == c &&
              (0 == d.length
                ? a &&
                  b({
                    type: h.INFO_SHOW_SUCCESS,
                    data: n.config.CLEAN_USER_AUTH_SUCCESS
                  })
                : b({
                    type: h.INFO_SHOW_ERROR,
                    data: {
                      message: n.config.CLEAN_USER_AUTH_ERROR.format(
                        d.join(',')
                      )
                    }
                  }),
              b({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' }))
        }
      i({
        method: 'post',
        url: `${j.cleanUserAuth}`,
        needToken: 1,
        needAppID: 1
      })
        .then(() => {
          e()
        })
        .catch(a => {
          e(a)
        }),
        i({
          method: 'post',
          url: `${j.clearUserAutoFillInfo}`,
          needToken: 1,
          needAppID: 1
        })
          .then(() => {
            e()
          })
          .catch(a => {
            e(a)
          })
    }
  }
  function c(a = !0) {
    let b = k.getUserInfo(),
      c = b && b.openid ? b.openid : 'unknow',
      d = l.getCurrent(),
      e = d.hash,
      i = m.WeappFileCache
    return b => {
      o('*', { cwd: i }, (c, e) => {
        e.forEach(a => {
          let b = f.join(i, a)
          g.unlink(b, () => {})
        }),
          p(f.join(i, d.appid), () => {}),
          r.clearFileSystem(d),
          a &&
            b({
              type: h.INFO_SHOW_SUCCESS,
              data: n.config.CLEAN_FILE_CACHE_SUCCESS
            }),
          b({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' })
      })
    }
  }
  function d(a = !0) {
    return b => {
      const c = c => {
        c
          ? c.clearData(
              { since: 0 },
              {
                cookies: !0,
                appcache: !0,
                sessionCookies: !0,
                persistentCookies: !0,
                cache: !0,
                fileSystems: !0,
                indexedDB: !0,
                localStorage: !0,
                webSQL: !0
              },
              () => {
                a &&
                  b({
                    type: h.INFO_SHOW_SUCCESS,
                    data: '\u6E05\u9664\u7F51\u7EDC\u7F13\u5B58\u6210\u529F'
                  }),
                  b({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' })
              }
            )
          : b({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' })
      }
      let d = q.getAnyAttached('simulator')
      c(d, a), (d = q.getAnyAttached('htmlwebview')), c(d, !1)
    }
  }
  function e(a = !0) {
    let b = k.getUserInfo(),
      c = b && b.openid ? b.openid : 'unknow',
      d = m.WeappStorage,
      e = l.getCurrent(),
      i = f.join(d, `${e.hash}_${c}.json`)
    return b => {
      g.unlink(i, () => {
        a &&
          b({
            type: h.INFO_SHOW_SUCCESS,
            data: n.config.CLEAN_DATA_CACHE_SUCCESS
          }),
          b({ type: h.PROJECT_SET_STORAGE, data: { cache: {}, openid: c } }),
          b({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' })
      })
    }
  }
  const f = require('path'),
    g = require('fs'),
    h = require('./0634ee2ebd3e560d9d4804ecc960160f.js'),
    i = require('./15ba1827c7f6564a45df6bd44da3a977.js'),
    j = require('./f171257bbcaef547a3cf27266ccb0db2.js'),
    k = require('./89ba85d67a88f7636d657c22b5d3e038.js'),
    l = require('./3bfffbe88b3d923921f851c0697974fe.js'),
    m = require('./92320c1386e6db6a6f2556736a9bc280.js'),
    n = require('./common/locales/index.js'),
    o = require('glob'),
    p = require('rmdir'),
    q = require('./a78e6d6a87de1708226375ca4c320d76.js'),
    r = require('./f6cbcecf6ed9f533f6a506310d8f07b6.js')
  module.exports = {
    toggleNetworkToobar: function() {
      return { type: h.TOOLBAR_TOGGLE_NETWORK }
    },
    toggleDeviceToolbar: function() {
      return { type: h.TOOLBAR_TOGGLE_DEVICE }
    },
    toggleCompactToolbar: function() {
      return { type: h.TOOLBAR_TOGGLE_COMPACT }
    },
    toggleInfoToolbar: function() {
      return { type: h.TOOLBAR_TOGGLE_INFO }
    },
    toggleCompileTypeToolbar: function() {
      return { type: h.TOOLBAR_TOGGLE_COMPILETYPE }
    },
    selectDevice: function(a) {
      return { type: h.TOOLBAR_SELECT_DEVICE, data: a }
    },
    selectNetwork: function(a) {
      return { type: h.TOOLBAR_SELECT_NETWORK, data: a }
    },
    selectCompileType: function(a) {
      return { type: h.TOOLBAR_SELECT_COMPILETYPE, data: a }
    },
    toggleClickKey: function(a) {
      return { type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: a }
    },
    togglePreviewCode: function(a) {
      return { type: h.TOOLBAR_PREVIEW_CODE, data: a }
    },
    toggleRemoteDebugCode: function(a) {
      return { type: h.TOOLBAR_REMOTE_DEBUG_CODE, data: a }
    },
    setDeviceStatus: function(a) {
      return { type: h.TOOLBAR_SET_DEVICE_STATUS, data: a }
    },
    clearAuth: b,
    cleanFileCache: c,
    cleanStorageCache: e,
    setDeviceScale: function(a) {
      return { type: h.TOOLBAR_SET_DEVICESCALE, data: a }
    },
    addDevice: function(a) {
      return { type: h.TOOLBAR_ADD_DEVICE, data: a }
    },
    removeDevice: function(a) {
      return { type: h.TOOLBAR_REMOVE_DEVICE, data: a }
    },
    cleanWebViewCache: d,
    clearSession: a,
    cleanAll: function() {
      return f => {
        f(e(!1)),
          f(c(!1)),
          f(d(!1)),
          f(b(!1)),
          f(a(!1)),
          f({
            type: h.INFO_SHOW_SUCCESS,
            data: '\u6E05\u9664\u5168\u90E8\u6210\u529F'
          }),
          f({ type: h.TOOLBAR_TOGGLE_CLICKKEY, clickKey: 'NONE' })
      }
    },
    setToolbarConfig: function(a) {
      return { type: h.TOOLBAR_CONFIG, data: a }
    }
  }
})(require('lazyload'), require)
