'use strict'
!(function(require, directRequire) {
  const a = require('react'),
    b = require('./875171e7b864aa58d026d4fa0999fbd1.js'),
    { connect: c } = require('react-redux')
  class d extends a.Component {
    constructor(a) {
      super(a),
        (this.state = {
          lazyLoaded: a.show,
          show: a.show,
          hiddenIndexes: [],
          filterWord: ''
        })
    }
    componentWillReceiveProps(a) {
      a.show !== this.props.show &&
        this.setState({ show: a.show, lazyLoaded: !0 }),
        a.list !== this.props.list &&
          this.setState({
            list: a.list,
            hiddenIndexes: this.getHiddenIndexes(a.list, this.state.filterWord)
          })
    }
    onSelectClick(a, b) {
      b.stopPropagation(),
        'function' == typeof this.props.onSelectClick &&
          this.props.onSelectClick(a, b)
    }
    handleFilterInputChange(a) {
      const b = a.target.value
      this.setState({
        filterWord: b,
        hiddenIndexes: this.getHiddenIndexes(this.props.list, b)
      })
    }
    getHiddenIndexes(a, b) {
      const c = []
      for (let d = 0; d < a.length; d++)
        c[d] = 0 > a[d].toLowerCase().indexOf(b.trim().toLowerCase())
      return c
    }
    render() {
      if (!this.state.lazyLoaded) return null
      const c = []
      this.props.list &&
        this.props.list.forEach((b, d) => {
          this.state.hiddenIndexes[d] ||
            c.push(
              a.createElement(
                'div',
                {
                  className: 'spotlight-result-item',
                  key: d,
                  onClick: this.onSelectClick.bind(this, d)
                },
                a.createElement(
                  'div',
                  { className: 'spotlight-result-item-bd' },
                  a.createElement(
                    'p',
                    { className: 'spotlight-result-name' },
                    b
                  )
                )
              )
            )
        })
      let d = {
        width: this.props.width || 'auto',
        marginLeft: -this.props.width / 2,
        left: '50%',
        top: this.props.top || 0,
        transform: 'none'
      }
      return (
        this.props.isSimulatorPopup &&
          ((d.width = this.props.width || '100%'),
          (d.left = 0),
          (d.marginLeft = 0)),
        a.createElement(
          b,
          {
            show: this.state.show,
            style: d,
            inClassName: 'spotlight',
            outClassName: 'ui-animate-fadeOut spotlight'
          },
          a.createElement(
            'div',
            { className: 'spotlight-hd' },
            a.createElement(
              'div',
              { className: 'spotlight-hd-icon' },
              a.createElement('i', { className: 'ui-icon-magnifier' })
            ),
            a.createElement(
              'div',
              { className: 'spotlight-hd-input-box' },
              a.createElement('input', {
                type: 'text',
                value: this.state.filterWord,
                onChange: this.handleFilterInputChange.bind(this),
                placeholder: '\u67E5\u627E\u573A\u666F\u503C',
                className: 'spotlight-hd-input'
              })
            )
          ),
          a.createElement(
            'div',
            {
              className: 'spotlight-bd',
              style: { height: this.props.height || 'auto' }
            },
            c
          )
        )
      )
    }
  }
  module.exports = c(a => {
    let b = a.window.simulator || {}
    return { isSimulatorPopup: 'popup' === b.position }
  }, null)(d)
})(require('lazyload'), require)
