'use strict'
!(function(require, directRequire) {
  const a = require('react'),
    b = require('prop-types'),
    c = require('classnames'),
    d = require('./d3976cc01aeebc5b09e11c4135b6bd8d.js'),
    e = require('./ea653f45dc25181ca4f1b108175009b7.js'),
    f = require('./a8c87029da0fa06e986298d447ab0fe2.js'),
    g = require('./ba23d8b47b1f4ea08b9fd49939b9443f.js'),
    h = require('./1ca0b7713664710bff99ca9c6d29c43c.js'),
    i = require('./071409e377770b723074b0f04fd4a50c.js'),
    j = require('./9fdd4ac31a05c27355910f0d74accd4c.js'),
    k = require('./6242f55dbdfe53c2f07b7a51568311f2.js'),
    l = require('./137588fc97010af6b33c2be1d533447b.js'),
    m = require('./ModalConnected.js'),
    n = require('./50adb3111cbfde1bf7b612cfcb0d1a49.js'),
    o = require('./84eac15ddafa077aa832c98b6c2290bd.js'),
    p = require('./514a851d54b7c3c137c5121a2a8a1174.js'),
    q = require('./42821d634e3cc6335ce2160046e31ec3.js'),
    r = require('./8b753033006e4d2e96ea5f3bc1d3433a.js'),
    s = require('./7af1f62bca29efc6a5378890b665dee8.js'),
    t = require('./840e56f8d48eb77cb843e8c459b3ccc1.js'),
    u = require('./245e991bfa34036d0454bd1d61b4a3b2.js'),
    { connect: v } = require('react-redux')
  global.appConfig.isminganci = !0
  class w extends a.Component {
    componentDidMount() {
      chrome.fontSettings.setMinimumFontSize({ pixelSize: 12 }),
        this.props.isPopup
          ? this.adjustWindowSize()
          : this.props.appLaunched && this.props.simulatorActions.compile(),
        this.adjustWindowSize()
    }
    componentWillReceiveProps(a) {
      this.props.isPopup &&
        (a.screenWidth !== this.props.screenWidth ||
          a.screenHeight !== this.props.screenHeight) &&
        this.adjustWindowSize()
    }
    onResizeStop(a, b) {
      this.props.windowActions.setSimulator({ width: b })
    }
    adjustWindowSize() {
      setTimeout(() => {
        const a = this.props.win
        if (a) {
          let b = this.props.screenWidth
          isMac || (b -= 10), (a.width = b)
          let c = this.props.screenHeight
          const d = document.getElementsByClassName('simulator-toolbar')
          ;(c += d[0] ? d[0].offsetHeight : 27),
            isMac || (c -= 10),
            (a.height = c)
        }
      })
    }
    getChildContext() {
      return {
        isPopup: this.props.isPopup,
        window: this.props.win ? this.props.win : null
      }
    }
    render() {
      let b,
        d = this.props
      return (
        global.onlySimulator
          ? ((b = {
              top: 0,
              left: 0,
              width: d.screenWidth,
              height: d.screenHeight,
              transform: `scale(${d.deviceScale})`,
              transformOrigin: '50% 0'
            }),
            global.Win.width !== b.width && (global.Win.width = b.width),
            global.Win.height !== b.height &&
              (global.Win.height =
                b.height + ('darwin' === process.platform ? 0 : 26)))
          : (b = {
              width: d.screenWidth,
              height: d.screenHeight,
              transform: `translate3d(-50%,0,0) scale(${d.deviceScale})`,
              transformOrigin: '50% 0'
            }),
        'popup' === d.position
          ? ((b.top = '0'),
            (b.left = 'unset'),
            (b.transform = 'inherit'),
            (b.transformOrigin = 'inherit'),
            a.createElement(
              'div',
              {
                style: { width: '100%', height: '100%' },
                className: c('simulator-container', { 'ui-invisible': !1 })
              },
              a.createElement(h, null),
              a.createElement(
                'div',
                { className: 'simulator-shell' },
                a.createElement(
                  'div',
                  { className: 'simulator', style: b },
                  d.showStatusBar ? a.createElement(n, null) : null,
                  a.createElement(u, null),
                  a.createElement(r, null),
                  a.createElement(i, null),
                  a.createElement(s, null),
                  a.createElement(t, null),
                  a.createElement(q, null)
                ),
                a.createElement(p, null)
              ),
              a.createElement(l, null)
            ))
          : a.createElement(
              e,
              {
                width: d.width,
                height: '100%',
                className: c('simulator-container', {
                  'ui-invisible': !d.show
                }),
                style: {
                  minWidth: global.onlySimulator
                    ? d.screenWidth * d.deviceScale
                    : (d.screenWidth + 100) * d.deviceScale
                },
                leftResizable: 'right' === d.position,
                rightResizable: 'left' === d.position,
                onResizeStop: this.onResizeStop.bind(this)
              },
              a.createElement(h, null),
              a.createElement(
                'div',
                { className: 'simulator-shell' },
                a.createElement(
                  'div',
                  { className: 'simulator', style: b },
                  d.showStatusBar ? a.createElement(n, null) : null,
                  a.createElement(u, null),
                  a.createElement(r, null),
                  a.createElement(i, null),
                  a.createElement(s, null),
                  a.createElement(t, null),
                  a.createElement(q, null)
                ),
                a.createElement(p, null)
              ),
              a.createElement(l, null),
              a.createElement('div', {
                className: 'ui-divider-vertical',
                style: { pointerEvents: 'none' }
              })
            )
      )
    }
  }
  ;(w.childContextTypes = { isPopup: b.bool, window: b.object }),
    (module.exports = v(
      a => {
        let b = a.window.simulator || {},
          c = a.toolbar.deviceInfo,
          d = a.project.current,
          e = d.compileType,
          f =
            a.simulator.orientation &&
            'landscape' == a.simulator.orientation.value,
          g = a.simulator.appConfig && a.simulator.appConfig.showStatusBar
        return {
          showStatusBar: !f && g,
          show: b.show,
          isPopup: 'popup' === b.position,
          position: b.position,
          screenWidth: f ? c.screenHeight : c.screenWidth,
          screenHeight: f ? c.screenWidth : c.screenHeight,
          deviceScale: a.toolbar.deviceScale,
          appLaunched: a.simulator.appLaunched
        }
      },
      a => {
        return {
          windowActions: d.bindActionCreators(f, a),
          simulatorActions: d.bindActionCreators(g, a)
        }
      }
    )(w))
})(require('lazyload'), require)
