"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

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

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

var _modal = _interopRequireDefault(require("antd/lib/modal"));

var _tabs = _interopRequireDefault(require("antd/lib/tabs"));

var _icons = require("@fishx/icons");

var _css = require("@emotion/css");

var _IconList = _interopRequireDefault(require("./IconList"));

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

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

var TabPane = _tabs.default.TabPane;
var titleStyle = (0, _css.css)({
  marginTop: '10px'
});

var ModalIconTabs = function ModalIconTabs(_ref) {
  var visible = _ref.visible,
      handleVisible = _ref.handleVisible,
      setCurrentIcon = _ref.setCurrentIcon,
      currentIcon = _ref.currentIcon,
      title = _ref.title,
      typeText = _ref.typeText,
      sortText = _ref.sortText;

  var _useState = (0, _react.useState)(currentIcon),
      _useState2 = _slicedToArray(_useState, 2),
      selectedIcon = _useState2[0],
      setSelectedIcon = _useState2[1];

  var handleOk = function handleOk() {
    setCurrentIcon(selectedIcon);
    handleVisible(false);
  };

  var dataSourceFirstDirection = [/*#__PURE__*/_react.default.createElement(_icons.DownOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.UpOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.LeftOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.RightOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ArrowUpOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ArrowDownOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ArrowLeftOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ArrowRightOutlined, null)];
  var dataSourceFirstTips = [/*#__PURE__*/_react.default.createElement(_icons.QuestionCircleOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.InfoCircleOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ExclamationCircleOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CloseOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CheckOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.MinusOutlined, null)];
  var dataSourceFirstEditor = [/*#__PURE__*/_react.default.createElement(_icons.EditOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FormOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CopyOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.DeleteOutlined, null)];
  var dataSourceFirstNormal = [/*#__PURE__*/_react.default.createElement(_icons.SearchOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FileOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FilterOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FolderOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FolderOpenOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.DownloadOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.UploadOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FileSearchOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.UserOutlined, null)];
  var dataSourceSecondDirection = [/*#__PURE__*/_react.default.createElement(_icons.StepBackwardOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.StepForwardOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FastBackwardOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FastForwardOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ShrinkOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ArrowsAltOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CaretUpOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CaretDownOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CaretLeftOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CaretRightOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.DoubleRightOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.DoubleLeftOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.RollbackOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.RetweetOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.SwapOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.PlayCircleOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.LoginOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.LogoutOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.MenuFoldOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.MenuUnfoldOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FullscreenOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.FullscreenExitOutlined, null)];
  var dataSourceSecondTips = [/*#__PURE__*/_react.default.createElement(_icons.PauseOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ClockCircleOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.WarningOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.StopOutlined, null)];
  var dataSourceSecondEditor = [/*#__PURE__*/_react.default.createElement(_icons.RedoOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.UndoOutlined, null)];
  var dataSourceSecondNormal = [/*#__PURE__*/_react.default.createElement(_icons.ExportOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ImportOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.StarOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.SyncOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.StarOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.MailOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ReloadOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.PoweroffOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.SaveOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.HomeOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.ScanOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.LikeOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.DislikeOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.MessageOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.PayCircleOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.CalculatorOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.BulbOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.KeyOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.LinkOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.DisconnectOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.SelectOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.MoreOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.SettingOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.BellOutlined, null), /*#__PURE__*/_react.default.createElement(_icons.SafetyOutlined, null)];
  var dataSourceThirdDirection = [/*#__PURE__*/_react.default.createElement(_icons.UpCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.DownCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.LeftCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.RightCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.PlayCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.UpSquareFilled, null), /*#__PURE__*/_react.default.createElement(_icons.DownSquareFilled, null), /*#__PURE__*/_react.default.createElement(_icons.LeftSquareFilled, null), /*#__PURE__*/_react.default.createElement(_icons.RightSquareFilled, null)];
  var dataSourceThirdTips = [/*#__PURE__*/_react.default.createElement(_icons.QuestionCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.InfoCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.ExclamationCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.CloseCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.CheckCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.ClockCircleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.WarningFilled, null), /*#__PURE__*/_react.default.createElement(_icons.StopFilled, null)];
  var dataSourceThirdEditor = [/*#__PURE__*/_react.default.createElement(_icons.EditFilled, null), /*#__PURE__*/_react.default.createElement(_icons.CopyFilled, null), /*#__PURE__*/_react.default.createElement(_icons.DeleteFilled, null)];
  var dataSourceThirdNormal = [/*#__PURE__*/_react.default.createElement(_icons.EyeFilled, null), /*#__PURE__*/_react.default.createElement(_icons.EyeInvisibleFilled, null), /*#__PURE__*/_react.default.createElement(_icons.FolderFilled, null), /*#__PURE__*/_react.default.createElement(_icons.FolderOpenFilled, null), /*#__PURE__*/_react.default.createElement(_icons.HomeFilled, null), /*#__PURE__*/_react.default.createElement(_icons.FilterFilled, null), /*#__PURE__*/_react.default.createElement(_icons.UnlockFilled, null), /*#__PURE__*/_react.default.createElement(_icons.SkinFilled, null), /*#__PURE__*/_react.default.createElement(_icons.TagFilled, null), /*#__PURE__*/_react.default.createElement(_icons.TagsFilled, null), /*#__PURE__*/_react.default.createElement(_icons.StarFilled, null)];
  var dataSourceFourthDirection = [/*#__PURE__*/_react.default.createElement(_icons.UpCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.DownCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.LeftCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.RightCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.PlayCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.UpSquareTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.DownSquareTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.LeftSquareTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.RightSquareTwoTone, null)];
  var dataSourceFourthTips = [/*#__PURE__*/_react.default.createElement(_icons.QuestionCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.PlusCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.PauseCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.MinusCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.PlusSquareTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.MinusSquareTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.InfoCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.ExclamationCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.CloseCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.CloseSquareTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.CheckCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.CheckSquareTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.ClockCircleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.WarningTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.StopTwoTone, null)];
  var dataSourceFourthEditor = [/*#__PURE__*/_react.default.createElement(_icons.EditTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.CopyTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.DeleteTwoTone, null)];
  var dataSourceFourthNormal = [/*#__PURE__*/_react.default.createElement(_icons.FilterTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.EyeTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.EyeInvisibleTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.FolderTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.FolderOpenTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.TagTwoTone, null), /*#__PURE__*/_react.default.createElement(_icons.StarTwoTone, null)];
  var titleArr = {
    direction: 'Direction Icons',
    tips: 'Tips Icons',
    editor: 'Edit Icons',
    normal: 'Normal Icons'
  };
  Object.keys(titleArr).map(function (v, index) {
    if (sortText && Array.isArray(sortText) && sortText.length > 0 && sortText[index]) {
      titleArr[v] = sortText[index];
    }
  });
  var iconObject = [{
    title: 'Normal',
    dataSource: {
      direction: dataSourceFirstDirection,
      tips: dataSourceFirstTips,
      editor: dataSourceFirstEditor,
      normal: dataSourceFirstNormal
    }
  }, {
    title: 'Outlined',
    dataSource: {
      direction: dataSourceSecondDirection,
      tips: dataSourceSecondTips,
      editor: dataSourceSecondEditor,
      normal: dataSourceSecondNormal
    }
  }, {
    title: 'Filled',
    dataSource: {
      direction: dataSourceThirdDirection,
      tips: dataSourceThirdTips,
      editor: dataSourceThirdEditor,
      normal: dataSourceThirdNormal
    }
  }, {
    title: 'TwoTone',
    dataSource: {
      direction: dataSourceFourthDirection,
      tips: dataSourceFourthTips,
      editor: dataSourceFourthEditor,
      normal: dataSourceFourthNormal
    }
  }];
  iconObject.map(function (v, index) {
    if (typeText && Array.isArray(typeText) && typeText.length > 0 && typeText[index]) {
      v.title = typeText[index];
    }
  });
  return /*#__PURE__*/_react.default.createElement(_modal.default, {
    title: title || "Please Select Icon",
    width: 800,
    visible: visible,
    onCancel: function onCancel() {
      return handleVisible(false);
    },
    onOk: function onOk() {
      return handleOk();
    }
  }, /*#__PURE__*/_react.default.createElement(_tabs.default, {
    defaultActiveKey: "0",
    tabPosition: "left"
  }, iconObject.map(function (vl, index) {
    return /*#__PURE__*/_react.default.createElement(TabPane, {
      tab: vl.title,
      key: String(index)
    }, Object.keys(vl.dataSource).map(function (item) {
      return /*#__PURE__*/_react.default.createElement("div", {
        key: item
      }, vl.dataSource[item].length > 0 && /*#__PURE__*/_react.default.createElement("h4", {
        className: titleStyle
      }, titleArr[item]), /*#__PURE__*/_react.default.createElement(_IconList.default, {
        dataSource: vl.dataSource[item],
        currentIcon: selectedIcon,
        iconChange: function iconChange(v) {
          return setSelectedIcon(v);
        }
      }));
    }));
  })));
};

var _default = ModalIconTabs;
exports.default = _default;