'use strict'
!(function(require, directRequire) {
  const a = require('react'),
    b = require('redux'),
    c = require('./a8c87029da0fa06e986298d447ab0fe2.js'),
    d = require('./cc2c2970ff81ae4a83123e81ee123da2.js'),
    e = require('./25d0beb4120ce2acafb4e03b95444fda.js'),
    f = require('./1fcc6bd55b687d154a4247e57fe3011d.js'),
    g = require('./0794878a22a26634e42df858bbaca543.js'),
    h = require('./56c390e04c10e91a4aa2a2c19d9a885d.js'),
    i = require('./72410b6d4968336cd8b2fc1d41f52cdf.js'),
    j = require('./3b5f8e2469c474c8d433c1c6926d8999.js'),
    k = require('moment'),
    l = require('./common/locales/index.js'),
    m = require('./875171e7b864aa58d026d4fa0999fbd1.js'),
    { connect: n } = require('react-redux'),
    { selectLanguageEnv: o } = require('./0794878a22a26634e42df858bbaca543.js'),
    p = require('./d3976cc01aeebc5b09e11c4135b6bd8d.js')
  class q extends a.Component {
    constructor(a) {
      super(a), (this.state = { env: 'nodejs', show: a.show, showLoading: !1 })
    }
    componentWillReceiveProps(a) {
      a.show != this.props.show && this.setState({ show: a.show })
    }
    toggleEnvSelect(a) {
      this.setState({ env: a })
    }
    onClose() {
      this.setState({ show: !1 })
    }
    async onConfirm() {
      try {
        this.setState({ showLoading: !0 })
        const a = await o(this.state.env)
        console.log(a), await this.props.requestProjectAttr()
      } catch (a) {
        this.setState({ showLoading: !1, show: !1 }), this.props.notifyFail(a)
      }
      this.setState({ show: !1 })
    }
    onAnimationOut() {
      this.props.close(), this.setState({ showLoading: !1 })
    }
    render() {
      const b = this.props
      return a.createElement(
        m,
        {
          show: this.state.show,
          style: { width: 420, marginLeft: -210 },
          inClassName: 'ui-animate-pull-down ui-dialog',
          outClassName: 'ui-animate-pull-up ui-dialog',
          onAnimationOut: this.onAnimationOut.bind(this)
        },
        a.createElement(
          'div',
          { className: 'ui-dialog-hd' },
          a.createElement(
            'h3',
            { className: 'ui-dialog-title' },
            '\u9009\u62E9\u5F00\u53D1\u73AF\u5883'
          )
        ),
        a.createElement(
          'div',
          { className: 'ui-dialog-bd', style: { position: 'relative' } },
          a.createElement(
            'div',
            {
              style: {
                textAlign: 'center',
                position: 'absolute',
                width: '100%',
                height: '100%',
                left: '0',
                top: '0',
                margin: '0',
                padding: '0',
                zIndex: 9,
                display: this.state.showLoading ? 'block' : 'none'
              }
            },
            a.createElement('i', {
              className: 'weui-loading weui-icon_toast',
              style: {
                margin: '0',
                position: 'relative',
                top: '50%',
                marginTop: '-20px'
              }
            })
          ),
          a.createElement(
            'div',
            {
              style: {
                visibility: this.state.showLoading ? 'hidden' : 'visible'
              }
            },
            a.createElement(
              'div',
              { className: 'ui-form' },
              a.createElement(
                'div',
                { className: 'ui-form-item ui-form-item-inline' },
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'label',
                    {
                      className: 'ui-radio ui-radio-vt',
                      onClick: this.toggleEnvSelect.bind(this, 'nodejs')
                    },
                    a.createElement('i', {
                      className:
                        'nodejs' === this.state.env
                          ? 'ui-icon-radio-o'
                          : 'ui-icon-radio'
                    }),
                    a.createElement(
                      'div',
                      { className: 'ui-radio-text' },
                      a.createElement(
                        'p',
                        null,
                        'Node.js \u5F00\u53D1\u73AF\u5883'
                      ),
                      a.createElement(
                        'p',
                        { className: 'ui-desc' },
                        '\u5305\u62EC Node.js 8.2.1'
                      )
                    )
                  )
                )
              ),
              a.createElement(
                'div',
                { className: 'ui-form-item ui-form-item-inline' },
                a.createElement(
                  'div',
                  { className: 'ui-form-controls' },
                  a.createElement(
                    'label',
                    {
                      className: 'ui-radio ui-radio-vt',
                      onClick: this.toggleEnvSelect.bind(this, 'php')
                    },
                    a.createElement('i', {
                      className:
                        'php' === this.state.env
                          ? 'ui-icon-radio-o'
                          : 'ui-icon-radio'
                    }),
                    a.createElement(
                      'div',
                      { className: 'ui-radio-text' },
                      a.createElement(
                        'p',
                        null,
                        'PHP \u5F00\u53D1\u73AF\u5883'
                      ),
                      a.createElement(
                        'p',
                        { className: 'ui-desc' },
                        '\u5305\u62EC PHP 5.6.30'
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        a.createElement(
          'div',
          { className: 'ui-dialog-ft' },
          a.createElement(
            'div',
            { className: 'ui-dialog-action' },
            a.createElement(
              'button',
              {
                className: 'ui-button ui-button-default',
                onClick: this.onClose.bind(this)
              },
              '\u53D6\u6D88'
            ),
            a.createElement(
              'button',
              {
                disabled: this.state.showLoading,
                className: 'ui-button ui-button-primary',
                onClick: this.onConfirm.bind(this)
              },
              '\u786E\u5B9A'
            )
          )
        )
      )
    }
  }
  module.exports = n(
    a => {
      const b = a.project.current
      return {
        qcloud: b && b.qcloud,
        show: a.window.qcloud.deployShow,
        project: b
      }
    },
    a => {
      return {
        close: () => {
          a(c.setQCloud({ deployShow: !1 }))
        },
        requestProjectAttr: p.bindActionCreators(d.requestProjectAttr, a),
        notifyFail: b =>
          a(
            f.setConfirmInfo({
              show: !0,
              showCancel: !1,
              title: '\u9009\u62E9\u73AF\u5883\u9519\u8BEF',
              content: b,
              callback: async () => {
                a(f.setConfirmInfo({ show: !1 }))
              }
            })
          )
      }
    }
  )(q)
})(require('lazyload'), require)
