'use strict';

var React = require('react');
var classNames = require('classnames');
var styled = require('@emotion/styled');
var core = require('@mantine/core');
var utils = require('./utils-b92a8b1c.js');
var miscTheme = require('./miscTheme.js');
var index = require('./index-3643ff1b.js');
var index$1 = require('./index-a31ed3e1.js');

function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n["default"] = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
var styled__default = /*#__PURE__*/_interopDefault(styled);

/* eslint-disable prettier/prettier */
const ShoppingCartCare = (props) => (React__namespace.createElement("svg", Object.assign({ width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "none" }, props),
    React__namespace.createElement("path", { d: "M1.94434 1.94434L3.44545 2.31989C3.88211 2.42878 4.20989 2.791 4.27545 3.23656L5.55656 11.9454", stroke: "currentColor", strokeWidth: 1.2, strokeLinecap: "round", strokeLinejoin: "round" }),
    React__namespace.createElement("path", { d: "M16.9444 14.7218H4.99997C4.23331 14.7218 3.61108 14.0996 3.61108 13.3329C3.61108 12.5662 4.23331 11.944 4.99997 11.944H14.4766C14.9544 11.944 15.38 11.6385 15.5311 11.184L17.0122 6.73957C17.2522 6.01957 16.7166 5.27734 15.9578 5.27734H4.57553", stroke: "currentColor", strokeWidth: 1.2, strokeLinecap: "round", strokeLinejoin: "round" }),
    React__namespace.createElement("path", { d: "M4.16648 18.8891C4.93354 18.8891 5.55537 18.2673 5.55537 17.5002C5.55537 16.7332 4.93354 16.1113 4.16648 16.1113C3.39941 16.1113 2.77759 16.7332 2.77759 17.5002C2.77759 18.2673 3.39941 18.8891 4.16648 18.8891Z", fill: "currentColor" }),
    React__namespace.createElement("path", { d: "M15.8332 18.8891C16.6003 18.8891 17.2221 18.2673 17.2221 17.5002C17.2221 16.7332 16.6003 16.1113 15.8332 16.1113C15.0662 16.1113 14.4443 16.7332 14.4443 17.5002C14.4443 18.2673 15.0662 18.8891 15.8332 18.8891Z", fill: "currentColor" })));

const StyledCartCareBox = styled__default["default"](core.Box) `
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #ffffff33;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;

  /* Desktop: Square layout */
  border-radius: 28px;
  max-height: 40px;
  padding: 9px 1rem;
  background-color: inherit;
  white-space: nowrap;

  .cart-care-icon {
    width: 20px;
    height: 20px;
    color: ${miscTheme.theme.colors.white};
    flex-shrink: 0;
  }

  .cart-care-button-text {
    display: block;
    font-size: 14px;
    font-weight: 500;
    line-height: 22px;
  }

  /* Mobile: Circle layout */
  ${utils.MediaQueries.mbDown} {
    border-radius: 100%;
    aspect-ratio: 1/1;
    width: 32px;
    height: 32px;
    padding: auto;
    background-color: ${miscTheme.theme.colors.white};
    max-height: none;
    padding: 0;

    .cart-care-icon {
      width: 20px;
      height: 20px;
      color: ${miscTheme.theme.colors.blue900};
      flex-shrink: 0;
    }

    .cart-care-button-text {
      display: none;
    }
  }
`;
const StyledCartCareButtonCount = styled__default["default"](core.Box) `
  min-width: 20px;
  min-height: 20px;
  aspect-ratio: 1/1;
  border-radius: 100%;
  background-color: ${miscTheme.theme.colors.red500};
  color: ${miscTheme.theme.colors.white};
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: absolute;
  top: -4px;
  right: -4px;
  ${utils.MediaQueries.mbDown} {
    top: -8px;
    right: -8px;
  }
`;

const CartCareButton = (props) => {
    const { count = 0, href, classes, boxProps, anchorProps, tracking } = props;
    const { t } = index.useTranslations();
    return (React__namespace["default"].createElement("a", Object.assign({ className: classNames__default["default"]('cart-care-button'), href: href, "data-testid": "cart-care-button", "data-event-category": "Hamburger Navigation", "data-event-action": "Cart Click", "data-event-label": href }, tracking, anchorProps),
        React__namespace["default"].createElement(StyledCartCareBox, Object.assign({ className: classNames__default["default"]('cart-care-button-box', classes === null || classes === void 0 ? void 0 : classes.box) }, boxProps),
            React__namespace["default"].createElement(ShoppingCartCare, { className: "cart-care-icon" }),
            React__namespace["default"].createElement(index$1.Text, { size: "label1", color: miscTheme.theme.colors.white, fw: 500, className: "cart-care-button-text" }, t('navigation.button.cartCareService')),
            count > 0 && (React__namespace["default"].createElement(StyledCartCareButtonCount, { className: classNames__default["default"]('cart-care-button-count-box', classes === null || classes === void 0 ? void 0 : classes.count) },
                React__namespace["default"].createElement(index$1.Text, { size: count > 99 ? 'label2' : 'c1', color: miscTheme.theme.colors.white, fw: 600, className: "cart-care-button-count-text" }, count > 99 ? '99+' : count))))));
};

exports.CartCareButton = CartCareButton;
exports.ShoppingCartCare = ShoppingCartCare;
