import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { s as styleInject, u as useViewHandler, e as evalVisible, _ as _onClickCheckout, I as Icon, b as PriceCounter } from './index-bbdfb97a.js';
import { observer } from 'mobx-react-lite';
import 'react';
import classnames from 'classnames';
import { useDivaCore, useTranslation } from '@crystaldesign/diva-core';
import { c as checkoutButton } from './index.module-f05b48c3.js';
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
import 'react-dynamic-multi-render';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/helpers/slicedToArray';
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 'qrcode.react';
import '@babel/runtime/helpers/typeof';
import 'flat';
import 'react-switch';
import 'react-countup';

var wcConfiguratorAction = "wcConfigurator-action-1kRvz";
var wcConfiguratorActionButton = "wcConfigurator-action-Button-uCk2M";
var wcCheckoutButtonPrice = "wcCheckoutButtonPrice-S5Uqm";
var wcCheckoutButtonText = "wcCheckoutButtonText-AKaeu";
var bruttoPrice = "brutto-price-yaDwF";
var canceled = "canceled-J6Faa";
var hidden = "hidden-sa4Pc";
var css_248z = ".wcConfigurator-action-1kRvz {\n  background: rgba(242.2, 242.2, 242.2, 0.9);\n  transition: width 0.2s ease-in-out;\n  display: flex;\n}\n\n.wcConfigurator-action-Button-uCk2M {\n  background-color: var(--primaryColor);\n  background-color: var(--saveButton, var(--primaryColor));\n  border: 1px var(--primaryColor) solid;\n  border: 1px var(--saveButton, var(--primaryColor)) solid;\n  border-radius: var(--globalBorderRadius);\n  font-family: var(--diva-typography-font-family);\n  font-weight: 100;\n  line-height: 20.8px;\n  font-weight: var(--fontWeight1);\n  height: calc(100% - 2px);\n  font-size: 14px;\n  color: white;\n  flex-grow: 1;\n  -webkit-text-stroke: 0px;\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  user-select: none;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n\n.wcConfigurator-settings-actions-isOnFirstStepDisabled-4PqCh .wcConfigurator-action-Button-uCk2M {\n  pointer-events: none;\n  background-color: #c25353;\n  border-color: #c25353;\n}\n\n.wcConfigurator-action-Button-uCk2M:hover {\n  background-color: var(--diva-theme-palette-primary-dark);\n  border-color: var(--diva-theme-palette-primary-dark);\n  cursor: pointer;\n  transition:\n    box-shadow 0.3s ease,\n    background-color 0.3s ease,\n    border-color 0.3s ease;\n\n  box-shadow: 0px 1px 4px #707070;\n}\n\n.wcCheckoutButtonPrice-S5Uqm {\n  float: right;\n  margin-right: 10%;\n}\n.wcCheckoutButtonIcon-6TJQ5 {\n  background-image: url(\"data:image/svg+xml,%3Csvg width%3D%2224%22 height%3D%2222%22 viewBox%3D%220 0 24 22%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M1 1H3.70647C4.17122 1 4.57471 1.32018 4.68031 1.77277L5.66667 6M5.66667 6L7.81969 15.2272C7.92529 15.6798 8.32878 16 8.79353 16H19.7192C20.1781 16 20.5781 15.6877 20.6894 15.2425L22.6894 7.24253C22.8472 6.61139 22.3698 6 21.7192 6H5.66667Z%22 stroke%3D%22white%22 stroke-width%3D%221.5%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%2F%3E%3Ccircle cx%3D%2210%22 cy%3D%2220%22 r%3D%221.25%22 stroke%3D%22white%22 stroke-width%3D%221.5%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%2F%3E%3Ccircle cx%3D%2218%22 cy%3D%2220%22 r%3D%221.25%22 stroke%3D%22white%22 stroke-width%3D%221.5%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\");\n  background-repeat: no-repeat;\n  background-position: center center;\n  background-size: contain;\n  width: 50%;\n  height: 50%;\n  transform: translate(-50%, -50%);\n  left: 50%;\n  top: 50%;\n  position: absolute;\n}\n\n.landscape-1LGy8 .wcConfigurator-action-1kRvz {\n  /*auser In die Zusammenfassung wird ausgeblendet*/\n  display: none;\n}\n.landscape-1LGy8 .wcConfigurator-Settings-hidden-kvVds.wcConfigurator-settings-actions-isOnLastStep-BV9rP .wcConfigurator-action-1kRvz {\n  display: none;\n}\n\n.landscape-1LGy8 .wcConfigurator-action-1kRvz .wcConfigurator-action-Button-uCk2M {\n  line-height: var(--configuratorActionHeight);\n}\n.wcConfigurator-action-Button-uCk2M .wcCheckoutButtonText-AKaeu {\n  margin-top: 0px;\n}\n\n.landscape-1LGy8 .wcConfigurator-action-Button-uCk2M .wcCheckoutButtonText-AKaeu,\n.portrait-ySRAg .wcConfigurator-action-Button-uCk2M .wcCheckoutButtonText-AKaeu {\n  margin-top: 0px;\n}\n\n.wcCheckoutButtonText-AKaeu {\n  float: left;\n  width: 100%;\n  height: 100%;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n}\n\n.brutto-price-yaDwF {\n  float: right;\n  position: relative;\n  margin-right: 20px;\n  font-size: 14px;\n  -webkit-font-smoothing: antialiased;\n  -webkit-text-stroke: 0px;\n  line-height: 36.8px;\n  min-width: 64px;\n  text-align: right;\n  font-weight: 300;\n}\n\n.brutto-price-yaDwF.canceled-J6Faa {\n  color: #eee;\n  opacity: 1;\n  transition:\n    opacity 0.3s ease-in-out,\n    max-width 0.3s ease-in-out;\n  max-width: 110px;\n}\n.brutto-price-yaDwF.canceled-J6Faa.hidden-sa4Pc {\n  opacity: 0;\n  max-width: 0px;\n}\n\n.brutto-price-yaDwF.canceled-J6Faa:before {\n  position: absolute;\n  content: '';\n  left: -6px;\n  top: 44%;\n  right: 0;\n  border-top: 2px solid;\n  border-color: grey;\n  transform: rotate(-7deg);\n}\n\n.is-mobile-Zx3zd .brutto-price-yaDwF.canceled-J6Faa:before {\n  top: 45%;\n}\n";
styleInject(css_248z);

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 BasketActionStandard = function BasketActionStandard(_ref) {
  var _viewHandler$uiState$, _viewHandler$uiState$2, _viewHandler$productS, _viewHandler$productS2;
  var _ref$buttonTextClassN = _ref.buttonTextClassName,
    buttonTextClassName = _ref$buttonTextClassN === void 0 ? wcCheckoutButtonText : _ref$buttonTextClassN,
    _ref$buttonPriceClass = _ref.buttonPriceClassName,
    buttonPriceClassName = _ref$buttonPriceClass === void 0 ? wcCheckoutButtonPrice : _ref$buttonPriceClass,
    containerClassName = _ref.containerClassName,
    price = _ref.price,
    showCheckoutButtons = _ref.showCheckoutButtons;
  var viewHandler = useViewHandler();
  var _useDivaCore = useDivaCore(),
    hidePrices = _useDivaCore.state.hidePrices;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var addToBasketButton = (_viewHandler$uiState$ = viewHandler.uiState.checkoutConfig) === null || _viewHandler$uiState$ === void 0 ? void 0 : _viewHandler$uiState$.buttons.find(function (b) {
    return b.type === 'ADD_TO_BASKET';
  });
  var onClick = function onClick() {
    if (addToBasketButton) {
      _onClickCheckout(addToBasketButton, viewHandler, addToBasketButton.index, t);
    } else {
      viewHandler.actionButtonState.onClickAddToBasket(viewHandler);
    }
  };
  return /*#__PURE__*/jsxs("div", {
    className: classnames(wcConfiguratorAction, containerClassName),
    children: [showCheckoutButtons && ((_viewHandler$uiState$2 = viewHandler.uiState.checkoutConfig) === null || _viewHandler$uiState$2 === void 0 ? void 0 : _viewHandler$uiState$2.buttons.filter(function (b) {
      return evalVisible(b, viewHandler, 'navigator');
    }).map(function (b) {
      return /*#__PURE__*/jsx("div", {
        className: checkoutButton,
        onClick: function onClick() {
          return _onClickCheckout(b, viewHandler, b.index, t);
        },
        children: /*#__PURE__*/jsx(Icon, {
          checkoutButton: _objectSpread(_objectSpread({}, b), {}, {
            isPrimary: false
          }),
          size: 32
        })
      }, b.index);
    })), /*#__PURE__*/jsxs("div", {
      className: wcConfiguratorActionButton,
      onClick: onClick,
      id: "wcConfigurator-action-tobasket",
      children: [addToBasketButton ? /*#__PURE__*/jsx(Icon, {
        checkoutButton: _objectSpread({
          isPrimary: true
        }, addToBasketButton),
        size: 40
      }) : /*#__PURE__*/jsx("div", {
        className: buttonTextClassName,
        children: t('configurator.ADD_TO_BASKET')
      }), !hidePrices && price !== undefined && viewHandler.tabGroupState.curTabGroupType == 'horizontal' && /*#__PURE__*/jsxs(Fragment, {
        children: [/*#__PURE__*/jsx("div", {
          className: classnames(bruttoPrice, canceled, !viewHandler.productState.formatedBruttoPrice ? hidden : undefined),
          children: /*#__PURE__*/jsx(PriceCounter, {
            price: (_viewHandler$productS = viewHandler.productState.formatedBruttoPrice) !== null && _viewHandler$productS !== void 0 ? _viewHandler$productS : 0
          })
        }), /*#__PURE__*/jsx("div", {
          className: buttonPriceClassName,
          children: /*#__PURE__*/jsx(PriceCounter, {
            price: (_viewHandler$productS2 = viewHandler.productState.formatedCurSetPrice) !== null && _viewHandler$productS2 !== void 0 ? _viewHandler$productS2 : 0
          })
        })]
      })]
    })]
  });
};
var BasketAction = observer(BasketActionStandard);

export { BasketAction as default };
