"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _layoutSearch = _interopRequireDefault(require("../../../../assets/images/layout-icon/layout-search.svg"));

var _ImageConfig = _interopRequireDefault(require("../../../../meta-comp/config-panels/ImageConfig"));

var _common = require("../../../../common");

var _BackgroundConfig = _interopRequireDefault(require("../../../common/config-panels/BackgroundConfig"));

var _CustomizeConfig = _interopRequireDefault(require("../../../common/config-panels/CustomizeConfig"));

var _coreUtil = require("../../../../utils/coreUtil");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var __extends = void 0 && (void 0).__extends || function () {
  var _extendStatics = function extendStatics(d, b) {
    _extendStatics = Object.setPrototypeOf || {
      __proto__: []
    } instanceof Array && function (d, b) {
      d.__proto__ = b;
    } || function (d, b) {
      for (var p in b) {
        if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
      }
    };

    return _extendStatics(d, b);
  };

  return function (d, b) {
    if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");

    _extendStatics(d, b);

    function __() {
      this.constructor = d;
    }

    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();

var SearchBarConfig =
/** @class */
function (_super) {
  __extends(SearchBarConfig, _super);

  function SearchBarConfig() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this.selfRender = function () {
      (0, _coreUtil.renderPreview)();

      _this.setState({});
    };

    _this.getContentPanel = function () {
      var data = _this.props.data;
      var source = [{
        key: 'search1',
        name: 'Logo',
        value: /*#__PURE__*/_react["default"].createElement(_ImageConfig["default"], {
          data: data.logo
        }),
        metaOption: data.logo,
        toggleType: 'switch'
      }, {
        key: 'search2',
        name: 'Icon',
        value: /*#__PURE__*/_react["default"].createElement(_common.Field, {
          title: "Color"
        }, /*#__PURE__*/_react["default"].createElement(_common.ColorPickerInput, {
          onChange: function onChange(v) {
            data.icon.color = v;

            _this.selfRender();
          },
          value: data.icon.color
        })),
        metaOption: data.icon,
        toggleType: 'switch'
      }];
      return /*#__PURE__*/_react["default"].createElement(_common.Collapse, {
        headerSize: "middle",
        onRefresh: function onRefresh() {
          return (0, _coreUtil.renderPreview)();
        },
        showActiveColor: true,
        source: source,
        type: "switch"
      });
    };

    return _this;
  }

  SearchBarConfig.prototype.render = function () {
    var data = this.props.data;
    return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_common.Collapse, {
      divider: "bold",
      headerSize: "large",
      source: [{
        key: 'searchBar1',
        name: 'Content',
        value: this.getContentPanel()
      }, {
        key: 'searchBar2',
        name: 'Customize',
        value: /*#__PURE__*/_react["default"].createElement(_CustomizeConfig["default"], {
          data: data.customize,
          isHideAlign: true,
          layoutSource: [{
            id: 'layout1',
            name: 'left',
            image: _layoutSearch["default"]
          }]
        })
      }, {
        key: 'searchBar3',
        name: 'Background',
        value: /*#__PURE__*/_react["default"].createElement(_BackgroundConfig["default"], {
          data: data.background
        })
      }]
    }));
  };

  SearchBarConfig.defaultProps = {
    data: {}
  };
  return SearchBarConfig;
}(_react["default"].Component);

var _default = SearchBarConfig;
exports["default"] = _default;