import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import { u as useViewHandler } from './index-bbdfb97a.js';
import { useState, useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import { useTranslation } from '@crystaldesign/diva-core';
import ConceptGallery from './index-78c5a71c.js';
import { jsx } from 'react/jsx-runtime';
import 'react-dynamic-multi-render';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/regenerator';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '@babel/runtime/helpers/toConsumableArray';
import '@crystaldesign/diva-utils';
import 'mobx';
import '@crystaldesign/web-planner-logic';
import 'classnames';
import 'qrcode.react';
import '@babel/runtime/helpers/typeof';
import 'flat';
import 'react-switch';
import 'react-countup';
import 'swiper/react';
import 'swiper/modules';
import './index-45c8ccc9.js';
import './index-04a7a9b4.js';
import 'react-collapsible';
import './index-f0b54128.js';
import './index-e4a92710.js';

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var ConceptFilter = function ConceptFilter(_ref) {
  var additionalGroupFilter = _ref.additionalGroupFilter,
    paletteId = _ref.paletteId;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var viewHandler = useViewHandler();
  var _useState = useState([]),
    _useState2 = _slicedToArray(_useState, 2),
    genericConceptItems = _useState2[0],
    setGenericConceptItems = _useState2[1];
  var palette = viewHandler.settingsState.itemPalettes.get(paletteId);
  useEffect(function () {
    var _palette$conceptFilte;
    var selected = (_palette$conceptFilte = palette === null || palette === void 0 ? void 0 : palette.conceptFilterValue) !== null && _palette$conceptFilte !== void 0 ? _palette$conceptFilte : '';
    var newGenericConceptItems = additionalGroupFilter.map(function (item) {
      return _objectSpread(_objectSpread({}, item), {}, {
        onClick: function onClick() {
          viewHandler.paletteViewHandler.onSelectFilter(paletteId, selected == item.key ? '' : item.key, 'CONCEPT');
        },
        selected: selected === item.key
      });
    });
    setGenericConceptItems(newGenericConceptItems);
  }, [additionalGroupFilter, palette]);
  var bannerTitle = t('configurator.conceptFilter.infoTitle');
  var bannerText = t('configurator.conceptFilter.infoText');
  return /*#__PURE__*/jsx(ConceptGallery, {
    genericConceptItems: genericConceptItems,
    onClose: function onClose() {
      return viewHandler.paletteViewHandler.onSelectFilter(paletteId, '', 'CONCEPT');
    },
    bannerTitle: bannerTitle,
    bannerText: bannerText
  });
};
var index = observer(ConceptFilter);

export { index as default };
