'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) {
  'use strict'
  const a = require('lodash'),
    { REHYDRATE: b } = require('redux-persist/lib/constants'),
    c = require('./0634ee2ebd3e560d9d4804ecc960160f.js'),
    d = require('./6242f55dbdfe53c2f07b7a51568311f2.js'),
    e = require('./5dc59f418d85e854c1a12d402d29e2d7.js'),
    f = require('./8bf10a96e005fd88d01d949c3d2f8d46.js')
  let g = 0
  const h = () => {
      return {
        subPackageLoaded: {},
        gameSubPackageLoaded: {},
        compileCommand: { ts: Date.now() },
        scene: 1001,
        restartTimes: 0,
        beginTime: Date.now(),
        currentWebviewID: -1,
        webviewInfos: {},
        tabbar: { show: !0, animation: !1 },
        widget: { errmsg: '', ready: !1, tapCallback: {} },
        game: { ready: !1, webview: null },
        backgroundShow: !1,
        toastInfo: {
          show: !1,
          icon: 'success',
          title: '',
          image: '',
          mask: !1,
          showOnWebviewID: -1
        },
        modalInfo: {
          show: !1,
          title: '',
          content: '',
          showCancel: !0,
          cancelText: '\u53D6\u6D88',
          confirmText: '\u786E\u5B9A',
          cancelColor: '#000000',
          confirmColor: '#3CC51F',
          callbackID: null,
          showOnWebviewID: -1
        },
        actionsheetInfo: {
          show: !1,
          itemList: [],
          cancelColor: '#000000',
          cancelText: '\u53D6\u6D88',
          itemColor: '#000000',
          callbackID: null,
          showOnWebviewID: -1
        },
        pickerInfo: { show: !1, mode: 'none' },
        groupInfo: { show: !1, list: [] },
        assdkCallbackInfo: { callbackID: null, res: {} },
        assdkOnEventInfo: { event: '', data: {} },
        jssdkCallbackInfo: { callbackID: null, res: {} },
        interfaceCallbackInfo: { callbackID: null, method: '', data: {} },
        previewImage: { show: !1, urls: [], current: '' },
        cardInfo: {
          show: 'none',
          args: {},
          callbackID: null,
          cardInfo: [],
          errData: []
        },
        shareInfo: {
          show: !1,
          imageUrl: '',
          title: '',
          desc: '',
          api: '',
          group: null,
          callbackID: null
        },
        rightBtnActionSheet: { show: !1 },
        appConfig: {},
        debuggeeMap: {},
        appLaunched: !1,
        confirm: {
          show: !1,
          content: '',
          showCancel: !0,
          confirmColor: '#3CC51F',
          cancelColor: '#000000',
          contentColor: '#888',
          confirmText: '\u786E\u5B9A',
          cancelText: '\u53D6\u6D88',
          subList: []
        },
        setting: { show: !1, api: '', scopeList: [], callbackID: -1 },
        appLaunchInfo: {},
        appRoute: { openType: '', status: 'none' },
        authorize: { show: !1, callback: null, options: {} },
        payment: { show: !1, uuid: '', qrcode: '', qrcodeState: '' },
        location: { show: !1 },
        accelerometer: !1,
        compass: !1,
        music: {
          type: '',
          src: '',
          title: '',
          singer: '',
          epname: '',
          webUrl: '',
          startTime: 0,
          coverImgUrl: '',
          status: e.MUSIC_STATE_INIT
        },
        wxmlInspected: !1,
        addPhoneContact: { show: !1, callbackID: -1, api: '', contactData: {} },
        chooseAddress: { show: !1, callbackID: -1, api: '' },
        chooseInvoiceTitle: { show: !1, callbackID: -1, api: '' },
        decryptedInfo: {},
        captureScreen: { callbackID: -1, webviewID: -1 },
        orientation: { value: '', callbackID: -1 },
        statusbar: { color: 'white' },
        keyboard: { show: !1 },
        menu: { style: 'dark' },
        debugInfo: null,
        simulateUpdate: !1,
        coverViewTree: { 0: { sons: [], id: '0' } }
      }
    },
    i = (a, b = '') => {
      let c = {}
      b && (c = n(b, a))
      let e = 'black' === c.navigationBarTextStyle ? 'black' : 'white'
      return {
        home: !1,
        title: c.navigationBarTitleText || '',
        titleStyle: e,
        showLoading: !1,
        showLeftBtn: !1,
        showRightBtn: !0,
        showRecordWording: !1,
        rightBtnIconPath: '',
        rightBtnText: '',
        backgroundColor:
          c.navigationBarBackgroundColor || d.DEFAULT_NAVIGATIONBAR_BGCOLOR,
        frontColor:
          'white' == e
            ? d.DEFAULT_NAVIGATIONBAR_WHITE_TEXTCOLOR
            : d.DEFAULT_NAVIGATIONBAR_BLACK_TEXTCOLOR,
        alpha: c.hasOwnProperty('navigationBarBackgroundAlpha')
          ? c.navigationBarBackgroundAlpha
          : 1,
        transition: 'none',
        disableScroll: c.disableScroll
      }
    },
    j = (a, b = '') => {
      let c = -1
      try {
        if (b) {
          c = a.tabBar.list.findIndex(a => {
            return a.pagePath && a.pagePath == b + '.html'
          })
        }
      } catch (a) {
        c = -1
      }
      return {
        id: g++,
        parent: -1,
        child: -1,
        pathName: b,
        query: {},
        backgroundColor: '#ffffff',
        shareDataURI: '',
        tabbarIndex: c,
        navigationBar: i(a, b),
        shareBtnState: { show: !1, isDynamic: !1, withShareTicket: !1 },
        ready: !1
      }
    },
    k = (a, b = '') => {
      if (a.standbyWebview) {
        let c = -1
        try {
          c = a.appConfig.tabBar.list.findIndex(a => {
            return a.pagePath && a.pagePath == b + '.html'
          })
        } catch (a) {
          c = -1
        }
        let d = _extends({}, a.standbyWebview, {
          navigationBar: i(a.appConfig, b),
          tabbarIndex: c,
          pathName: b
        })
        return d
      }
      return j(a.appConfig, b)
    },
    l = a => {
      let b = {}
      for (let c in a) {
        let d = a[c]
        if (-1 == d.parent) {
          b[c] = d
          for (let c = a[d.child]; c && !b[c.id]; )
            (b[c.id] = c), (c = a[c.child])
        }
      }
      return b
    },
    m = a => {
      let b = a.currentWebviewID,
        c = a.webviewInfos[b]
      if (c.pageNotFound || 'prepare' != a.appRoute.status) return !0
    },
    n = (a, b) => {
      let c = a + '.html',
        d = (b.global && b.global.window) || {},
        e = (b.page && b.page[c] && b.page[c].window) || {}
      return (e = _extends({}, d, e)), e
    }
  module.exports = function(d = h(), e = {}) {
    switch (e.type) {
      case c.SIMULATOR_SET_ADDPHONECONTACT:
        return _extends({}, d, {
          addPhoneContact: _extends({}, e.data, {
            contactData: _extends({}, e.data.contactData)
          })
        })
      case c.SIMULATOR_SET_CHOOSEADDRESS:
        return _extends({}, d, { chooseAddress: _extends({}, e.data) })
      case c.SIMULATOR_SET_CHOOSEINVOICETITLE:
        return _extends({}, d, { chooseInvoiceTitle: _extends({}, e.data) })
      case c.TOOLBAR_SELECT_DEVICE:
        return _extends({}, d, { standbyWebview: void 0 })
      case c.SIMULATOR_LOAD_SUBPACKAGE:
        return d.subPackageLoaded[e.data.root]
          ? d
          : _extends({}, d, {
              subPackageLoaded: _extends({}, d.subPackageLoaded, {
                [e.data.root]: e.data.loaded
              })
            })
      case c.SIMULATOR_LOAD_GAME_SUBPACKAGE:
        return d.gameSubPackageLoaded[e.data.root] &&
          d.gameSubPackageLoaded[e.data.root].loaded
          ? d
          : _extends({}, d, {
              gameSubPackageLoaded: _extends({}, d.gameSubPackageLoaded, {
                [e.data.root]: { taskId: e.data.taskId, loaded: e.data.loaded }
              })
            })
      case c.SIMULATOR_LAUNCH: {
        f.clean()
        let a = e.appConfig,
          b = j(a, e.data.appLaunchInfo.path),
          c = b.id
        ;(b.navigationBar.home = -1 == b.tabbarIndex && !!e.data.home),
          (b.pageNotFound = e.data.pageNotFound),
          (b.isEntryPath = e.data.isEntryPath),
          Object.assign(b, e.data)
        let g = h()
        return _extends({}, g, {
          tabbar: _extends({}, a.tabBar, { show: !0, animation: !1 }),
          appConfig: a,
          restartTimes: d.restartTimes + 1,
          scene: e.data.appLaunchInfo.scene,
          currentWebviewID: c,
          webviewInfos: { [c]: b },
          appRoute: { openType: 'appLaunch', status: 'prepare' },
          standbyWebview: void 0,
          simulateUpdate: d.simulateUpdate,
          appLaunchInfo: e.data.appLaunchInfo
        })
      }
      case c.SIMULATOR_SET_WEBVIEW_READY: {
        let a = e.webviewID,
          b = d.webviewInfos[a]
        return _extends({}, d, {
          webviewInfos: _extends({}, d.webviewInfos, {
            [a]: _extends({}, b, { ready: e.ready })
          }),
          appRoute: _extends({}, d.appRoute, { status: 'ready' })
        })
      }
      case c.SIMULATOR_SET_APP_LAUNCHED:
        return _extends({}, d, { appLaunched: e.flag })
      case c.SIMULATOR_SET_SIMULATE_UPDATE:
        return _extends({}, d, { simulateUpdate: e.simulateUpdate })
      case c.SIMULATOR_COMPILE:
        return _extends({}, d, {
          appLaunched: !1,
          compileCommand: _extends({}, e.data, { ts: Date.now() })
        })
      case c.SIMULATOR_NAVIGATE: {
        if (!m(d)) return d
        let a = d.currentWebviewID,
          b = d.webviewInfos[a],
          c = k(d, e.data.pathName),
          f = c.id
        Object.assign(c, e.data),
          b.pageNotFound || ((b.child = f), (c.parent = a)),
          (c.navigationBar.showLeftBtn = -1 != c.parent)
        let g = l(d.webviewInfos)
        return _extends({}, d, {
          currentWebviewID: f,
          webviewInfos: _extends({}, g, { [f]: c }),
          appRoute: { openType: 'navigateTo', status: 'prepare' },
          standbyWebview: j(d.appConfig, '')
        })
      }
      case c.SIMULATOR_REDIRECT: {
        if (!m(d)) return d
        let a = d.currentWebviewID,
          b = d.webviewInfos[a],
          c = k(d, e.data.pathName),
          f = c.id
        Object.assign(c, e.data),
          (c.parent = b.parent),
          d.webviewInfos[c.parent] && (d.webviewInfos[c.parent].child = f),
          (c.navigationBar.showLeftBtn = -1 != c.parent),
          delete d.webviewInfos[a]
        let g = l(d.webviewInfos)
        return _extends({}, d, {
          currentWebviewID: f,
          webviewInfos: _extends({}, g, { [f]: c }),
          appRoute: { openType: 'redirectTo', status: 'prepare' },
          standbyWebview: j(d.appConfig, '')
        })
      }
      case c.SIMULATOR_OPEN_TABBAR: {
        if (!m(d)) return d
        let a,
          b,
          c = d.webviewInfos,
          f = {}
        for (let d in c) {
          let g = c[d]
          ;-1 !== g.tabbarIndex &&
            ((f[d] = g),
            g.pathName === e.data.pathName &&
              g.tabbarIndex == e.data.tabbarIndex &&
              ((a = d), (b = g)))
        }
        let g = d.standbyWebview
        return (
          a ||
            ((b = k(d, e.data.pathName)),
            (a = b.id),
            Object.assign(b, e.data),
            (f[a] = b),
            (g = j(d.appConfig, ''))),
          _extends({}, d, {
            currentWebviewID: a,
            webviewInfos: f,
            appRoute: {
              openType: 'switchTab',
              status: b.ready ? 'ready' : 'prepare'
            },
            standbyWebview: g
          })
        )
      }
      case c.SIMULATOR_NAVIGATE_BACK: {
        if (d.anyHtmlWebviewInfo)
          return _extends({}, d, { anyHtmlWebviewInfo: null })
        let a = e.delta,
          b = d.currentWebviewID,
          c = d.webviewInfos[b]
        for (; 0 < a && c && -1 != c.parent; )
          delete d.webviewInfos[b],
            (b = c.parent),
            (c = d.webviewInfos[b]),
            (c.child = -1),
            a--
        return _extends({}, d, {
          currentWebviewID: b,
          webviewInfos: d.webviewInfos,
          appRoute: { openType: 'navigateBack', status: 'ready' }
        })
      }
      case c.SIMULATOR_SHOW_SPECIFIC_WEBVIEW:
        return _extends({}, d, { currentWebviewID: e.webviewID })
      case c.SIMULATOR_CLEAN_ALL_WEBVIEW:
        return _extends({}, d, { webviewInfos: {} })
      case c.SIMULATOR_RELAUNCH: {
        let a = k(d, e.data.pathName),
          b = a.id
        return (
          Object.assign(a, e.data),
          _extends({}, d, {
            currentWebviewID: b,
            webviewInfos: { [b]: a },
            appRoute: { openType: 'reLaunch', status: 'prepare' },
            standbyWebview: j(d.appConfig, '')
          })
        )
      }
      case c.SIMULATOR_RELAUNCH_TO_INDEX: {
        let a = (d.appConfig.pages && d.appConfig.pages[0]) || '',
          b = k(d, a),
          c = b.id
        return _extends({}, d, {
          currentWebviewID: c,
          webviewInfos: { [c]: b },
          appRoute: { openType: 'reLaunch', status: 'prepare' },
          standbyWebview: j(d.appConfig, '')
        })
      }
      case c.SIMULATOR_SET_NAVIGATION_BAR: {
        let a = d.webviewInfos[d.currentWebviewID]
        if (!a || !a.navigationBar) return d
        return (
          (a.navigationBar = _extends({}, a.navigationBar, e.data)),
          _extends({}, d, {
            webviewInfos: _extends({}, d.webviewInfos, {
              [d.currentWebviewID]: a
            })
          })
        )
      }
      case c.SIMULATOR_SET_TOAST:
        return _extends({}, d, {
          toastInfo: _extends({}, e.data, {
            showOnWebviewID: e.data.show ? d.currentWebviewID : -1
          })
        })
      case c.SIMULATOR_SET_MODAL:
        return _extends({}, d, {
          modalInfo: _extends({}, e.data, {
            showOnWebviewID: e.data.show ? d.currentWebviewID : -1
          })
        })
      case c.SIMULATOR_SET_ACTIONSHEET:
        return _extends({}, d, {
          actionsheetInfo: _extends({}, e.data, {
            showOnWebviewID: e.data.show ? d.currentWebviewID : -1
          })
        })
      case c.SIMULATOR_SET_PICKER:
        return _extends({}, d, { pickerInfo: _extends({}, e.data) })
      case c.SIMULATOR_UPDATE_MULTI_PICKER: {
        let a = e.data.column || 0,
          b = d.pickerInfo.array || [],
          c = d.pickerInfo.current || []
        return (
          (b[a] = e.data.array),
          (c[a] = e.data.current),
          _extends({}, d, {
            pickerInfo: _extends({}, d.pickerInfo, {
              array: [].concat(b),
              current: c
            })
          })
        )
      }
      case c.SIMULATOR_SET_SHARE_BTN: {
        let a = d.webviewInfos[d.currentWebviewID] || {}
        return (
          (a.shareBtnState = _extends({}, a.shareBtnState, e.data)),
          _extends({}, d, {
            webviewInfos: _extends({}, d.webviewInfos, {
              [d.currentWebviewID]: a
            })
          })
        )
      }
      case c.SIMULATOR_UPDATE_SHARE_GROUP_INFO:
        return _extends({}, d, { groupInfo: _extends({}, d.groupInfo, e.data) })
      case c.ASSDK_CALLBACK:
        return _extends({}, d, {
          assdkCallbackInfo: { callbackID: e.callbackID, res: e.res }
        })
      case c.JSSDK_CALLBACK:
        return _extends({}, d, {
          jssdkCallbackInfo: {
            callbackID: e.callbackID,
            webviewID: e.webviewID,
            res: e.res
          }
        })
      case c.SIMULATOR_SET_PREVIEW_IMAGE:
        return _extends({}, d, {
          previewImage: _extends({}, d.previewImage, e.data)
        })
      case c.SIMULATOR_SET_CARD_VIEW:
        return _extends({}, d, { cardInfo: _extends({}, e.data) })
      case c.SIMULATOR_SHARE_APP_MSG: {
        let a = d.currentWebviewID,
          b = d.webviewInfos[a],
          c = b.shareBtnState
        return c.withShareTicket && e.shareInfo.length
          ? _extends({}, d, {
              shareInfo: _extends({ show: !1, group: null }, e.data),
              groupInfo: { list: e.shareInfo, show: !0 }
            })
          : _extends({}, d, {
              shareInfo: _extends({ show: !0, group: null }, e.data)
            })
      }
      case c.SIMULATOR_SET_SHARE:
        return _extends({}, d, { shareInfo: _extends({}, d.shareInfo, e.data) })
      case c.SIMULATOR_SET_GROUP_INFO:
        return _extends({}, d, { groupInfo: _extends({}, d.groupInfo, e.data) })
      case c.SIMULATOR_SET_APP_CONFIG:
        return _extends({}, d, { appConfig: e.data })
      case c.SIMULATOR_SET_DEBUGGEE: {
        let a = _extends({}, d.debuggeeMap)
        return (
          e.flag ? (a[e.webviewID] = e.debuggee) : delete a[e.webviewID],
          _extends({}, d, { debuggeeMap: a })
        )
      }
      case c.SIMULATOR_SET_CONFIRM: {
        let a = e.data
        return _extends({}, d, {
          confirm: _extends({}, d.confirm, {
            show: a.show,
            title: a.title,
            showCancel: !1 != a.showCancel,
            content: a.content || '',
            confirmText: a.confirmText || '\u786E\u5B9A',
            cancelText: a.cancelText || '\u53D6\u6D88',
            callback: a.callback,
            subList: a.subList || []
          })
        })
      }
      case c.SIMULATOR_SET_SETTING:
        return _extends({}, d, { setting: _extends({}, d.setting, e.data) })
      case c.SIMULATOR_SET_APP_ROUTE:
        return _extends({}, d, { appRoute: _extends({}, d.appRoute, e.data) })
      case c.USER_LOGIN_SUCCESS:
        return h()
      case c.SIMULATOR_SET_AUTHORIZE_CONFIRM:
        return _extends({}, d, { authorize: _extends({}, d.authorize, e.data) })
      case c.SIMULATOR_SET_SHARE_DATAURI: {
        let a = e.data.webviewID,
          b = d.webviewInfos[a]
        if (!b) return d
        return (
          (b.shareDataURI = e.data.dataURI),
          _extends({}, d, {
            webviewInfos: _extends({}, d.webviewInfos, { [a]: b })
          })
        )
      }
      case c.SIMULATOR_SET_RIGHTBTN_ACTIONSHEET:
        return _extends({}, d, {
          rightBtnActionSheet: _extends({}, d.rightBtnActionSheet, e.data)
        })
      case c.SIMULATOR_SET_PAYMENT_QRWND:
        return _extends({}, d, { payment: _extends({}, d.payment, e.data) })
      case c.SIMULATOR_SET_LOCATION:
        return _extends({}, d, { location: _extends({}, d.location, e.data) })
      case c.SIMULATOR_SET_ACCELEROMETER:
        return _extends({}, d, { accelerometer: e.data.accelerometer })
      case c.SIMULATOR_SET_COMPASS:
        return _extends({}, d, { compass: e.data.compass })
      case c.SIMULATOR_SET_BACKGROUND_AUDIO:
        return _extends({}, d, { music: _extends({}, d.music, e.data) })
      case c.SIMULATOR_SET_BACKGROUND:
        return _extends({}, d, {
          scene: e.data.scene || d.scene,
          backgroundShow: e.data.show
        })
      case c.SIMULATOR_TOGGLE_BACKGROUND:
        return _extends({}, d, { backgroundShow: !d.backgroundShow })
      case c.SIMULATOR_SET_WIDGET:
        return _extends({}, d, { widget: _extends({}, d.widget, e.data) })
      case c.SIMULATOR_SET_GAME:
        return _extends({}, d, { game: _extends({}, d.game, e.data) })
      case c.SIMULATOR_GAME_LAUNCH: {
        f.clean()
        let a = e.appConfig || {},
          b = g++,
          c = h()
        return _extends({}, c, {
          game: d.game,
          compileCommand: d.compileCommand,
          currentWebviewID: b,
          webviewInfos: {
            [b]: {
              shareDataURI: '',
              shareBtnState: { show: !1, isDynamic: !1, withShareTicket: !1 }
            }
          },
          appConfig: a,
          orientation: { value: a.deviceOrientation || 'portrait' },
          simulateUpdate: d.simulateUpdate
        })
      }
      case c.SIMULATOR_SET_WXMLINSPECT:
        return _extends({}, d, { wxmlInspected: e.data })
      case c.SIMULATOR_SET_VIBRATE:
        return _extends({}, d, { vibrate: e.data.type })
      case c.PROJECT_OPEN_TEMP_PROJECT:
      case c.PROJECT_OPEN_PROJECT:
        return h()
      case c.SIMULATOR_INSERT_HTMLWEBVIEW: {
        const a = e.data.webviewID,
          b = d.webviewInfos[a]
        return _extends({}, d, {
          webviewInfos: _extends({}, d.webviewInfos, {
            [a]: _extends({}, d.webviewInfos[a], {
              htmlwebviewInfo: _extends({}, e.data)
            })
          })
        })
      }
      case c.SIMULATOR_UPDATE_HTMLWEBVIEW: {
        const a = e.data.webviewID,
          b = d.webviewInfos[a]
        return b
          ? _extends({}, d, {
              webviewInfos: _extends({}, d.webviewInfos, {
                [a]: _extends({}, d.webviewInfos[a], {
                  htmlwebviewInfo: _extends({}, b.htmlwebviewInfo, e.data)
                })
              })
            })
          : d.anyHtmlWebviewInfo && d.anyHtmlWebviewInfo.webviewID === a
            ? _extends({}, d, {
                anyHtmlWebviewInfo: _extends({}, d.anyHtmlWebviewInfo, e.data)
              })
            : d
      }
      case c.SIMULATOR_REMOVE_HTMLWEBVIEW: {
        const a = e.data.webviewID,
          b = d.webviewInfos[a]
        return (
          delete b.htmlwebviewInfo,
          _extends({}, d, {
            webviewInfos: _extends({}, d.webviewInfos, { [a]: _extends({}, b) })
          })
        )
      }
      case c.SIMULATOR_SET_ANY_HTMLWEBVIEW:
        return e.data
          ? _extends({}, d, {
              anyHtmlWebviewInfo: _extends({}, d.anyHtmlWebviewInfo, e.data)
            })
          : _extends({}, d, { anyHtmlWebviewInfo: {} })
      case c.SIMULATOR_UPDATE_DECRYPTED_INFO:
        return _extends({}, d, {
          decryptedInfo: _extends({}, d.decryptedInfo, { [e.api]: e.data })
        })
      case c.SIMULATOR_CAPTURE_SCREEN:
        return _extends({}, d, {
          captureScreen: {
            callbackID: e.data.callbackID,
            webviewID: d.currentWebviewID
          }
        })
      case c.SIMULATOR_SET_ORIENTATION:
        return _extends({}, d, { orientation: _extends({}, e.data) })
      case c.SIMULATOR_SET_KEYBOARD:
        return e.data.show
          ? _extends({}, d, { keyboard: _extends({}, d.keyboard, e.data) })
          : _extends({}, d, { keyboard: { show: !1 } })
      case c.SIMULATOR_INSERT_NATIVEVIEW: {
        let a = d.coverViewTree,
          b = a[e.parentId]
        return (
          b || (b = a[0]),
          b && b.sons.push(e.id),
          _extends({}, d, {
            coverViewTree: _extends({}, a, {
              [e.id]: {
                type: 'native',
                sons: [],
                action: 'insert',
                id: e.id,
                parentId: b.id,
                name: e.name,
                api: e.api,
                args: e.args,
                callbackID: e.callbackID,
                position: e.position,
                data: e.data
              },
              [e.parentId]: b
            })
          })
        )
      }
      case c.SIMULATOR_UPDATE_NATIVEVIEW: {
        let a = d.coverViewTree[e.id]
        return (
          (a = _extends({}, a, {
            action: 'update',
            id: e.id,
            name: e.name,
            api: e.api,
            callbackID: e.callbackID,
            data: e.data
          })),
          e.position && (a.position = e.position),
          _extends({}, d, {
            coverViewTree: _extends({}, d.coverViewTree, {
              [e.id]: _extends({}, a)
            })
          })
        )
      }
      case c.SIMULATOR_REMOVE_NATIVEVIEW: {
        let a = _extends({}, d.coverViewTree),
          b = a[e.id]
        delete a[e.id]
        let c = a[b.parentId]
        return (
          (c.sons = c.sons.filter(a => {
            return a != e.id
          })),
          _extends({}, d, { coverViewTree: _extends({}, a) })
        )
      }
      case c.SIMULATOR_OPERATE_NATIVEVIEW:
        return _extends({}, d, {
          operateNativeView: {
            action: 'operate',
            id: e.id,
            name: e.name,
            api: e.api,
            callbackID: e.callbackID,
            data: e.data
          }
        })
      case c.SIMULATOR_SET_MENU:
        return _extends({}, d, { menu: _extends({}, d.menu, e.data) })
      case c.SIMULATOR_SET_TABBAR: {
        let a = _extends({}, d.tabbar, { list: [...d.tabbar.list] }),
          { api: b, args: c } = e.data
        return (
          'setTabBarBadge' == b
            ? (a.list[c.index] = _extends({}, a.list[c.index], {
                badge: {
                  type: c.type,
                  text: c.badgeValue,
                  backgroundColor: c.badgeColor
                }
              }))
            : 'showTabBar' == b || 'hideTabBar' == b
              ? ((a.show = 'showTabBar' == b), (a.animation = !!c.animation))
              : 'setTabBarItem' == b
                ? ['text', 'iconPath', 'selectedIconPath'].forEach(b => {
                    c[b] && (a.list[c.index][b] = c[b])
                  })
                : 'setTabBarStyle' == b &&
                  [
                    'color',
                    'selectedColor',
                    'backgroundColor',
                    'borderStyle'
                  ].forEach(b => {
                    c[b] && (a[b] = c[b])
                  }),
          _extends({}, d, { tabbar: a })
        )
      }
      case c.SIMULATOR_SET_STATUSBAR_STYLE:
        return _extends({}, d, { statusbar: _extends({}, d.statusbar, e.data) })
      case c.SIMULATOR_CALL_INTERFACE:
        return _extends({}, d, {
          interfaceCallbackInfo: {
            callbackID: e.callbackID,
            method: e.method,
            data: e.data
          }
        })
      case c.SIMULATOR_DEBUG_INFO:
        return _extends({}, d, { debugInfo: _extends({ custom: !0 }, e.data) })
      case c.SIMUALTOR_INSERT_COVERVIEW: {
        const a = e.data
        let b = _extends({}, d.coverViewTree[a.parentId])
        return (
          b.sons.push(a.viewId),
          _extends({}, d, {
            coverViewTree: _extends({}, d.coverViewTree, {
              [a.parentId]: b,
              [a.viewId]: _extends({}, e.data, { sons: [] })
            })
          })
        )
      }
      case c.SIMULATOR_UPDATE_COVERVIEW: {
        const a = e.data,
          b = d.coverViewTree[a.viewId]
        return _extends({}, d, {
          coverViewTree: _extends({}, d.coverViewTree, {
            [a.viewId]: _extends({}, b, e.data)
          })
        })
      }
      case c.SIMULATOR_ANIMATE_COVERVIEW: {
        const a = e.data,
          b = d.coverViewTree[a.viewId]
        return (
          (b.animation = e.data.animation),
          _extends({}, d, {
            coverViewTree: _extends({}, d.coverViewTree, {
              [a.viewId]: _extends({}, b)
            })
          })
        )
      }
      case c.SIMULATOR_REMOVE_COVERVIEW: {
        const a = e.data
        let b = _extends({}, d.coverViewTree),
          c = b[a.viewId],
          f = _extends({}, b[c.parentId])
        return (
          (f.sons = f.sons.filter(b => {
            return b != a.viewId
          })),
          delete b[a.viewId],
          _extends({}, d, { coverViewTree: _extends({}, b) })
        )
      }
      case c.SIMULATOR_PAGENOTFOUND_CALLBACK: {
        let a = d.currentWebviewID,
          b = d.webviewInfos[a]
        if (b.pageNotFound)
          return _extends({}, d, {
            webviewInfos: _extends({}, d.webviewInfos, {
              [a]: _extends({}, b, { forceLoad: !0 })
            })
          })
        let c = []
        for (let a in d.webviewInfos)
          d.webviewInfos[a].pageNotFound || (c[a] = d.webviewInfos[a])
        return _extends({}, d, { webviewInfos: c })
      }
      case b:
        return a.merge(a.cloneDeep(d), e.payload.simulator || {})
      default:
        return d
    }
  }
})(require('lazyload'), require)
