'use strict';

var React = require('react');
var CaretRightFilled = require('./CaretRightFilled.svg');
var AddAwardLight = require('./addawardlight.svg');
var ThreeDotVertical = require('./ThreeDotVertical-dda0e747.js');
var UserProfilePicture = require('./UserProfilePicture-d69fe4f0.js');
var index = require('./index-5488badc.js');
var index$1 = require('./index-ba659c28.js');
var CircleCheckButton = require('./CircleCheckButton-f76e5b5d.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var CaretRightFilled__default = /*#__PURE__*/_interopDefaultLegacy(CaretRightFilled);
var AddAwardLight__default = /*#__PURE__*/_interopDefaultLegacy(AddAwardLight);

const getDarkBGColor = (type) => {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
  if (!type) return "";
  if (type === ((_a = index.WalletCategoryTypes) == null ? void 0 : _a.achievements)) {
    return "bg-orange-500";
  } else if (type === ((_b = index.WalletCategoryTypes) == null ? void 0 : _b.learningHistory)) {
    return "bg-emerald-500";
  } else if (type === ((_c = index.WalletCategoryTypes) == null ? void 0 : _c.skills)) {
    return "bg-violet-500";
  } else if (type === ((_d = index.WalletCategoryTypes) == null ? void 0 : _d.jobHistory)) {
    return "bg-blue-500";
  } else if (type === ((_e = index.WalletCategoryTypes) == null ? void 0 : _e.socialBadge)) {
    return "bg-cyan-500";
  } else if (type === ((_f = index.WalletCategoryTypes) == null ? void 0 : _f.relationships)) {
    return "bg-pink-500";
  } else if (type === ((_g = index.WalletCategoryTypes) == null ? void 0 : _g.accommodations)) {
    return "bg-amber-500";
  } else if (type === ((_h = index.WalletCategoryTypes) == null ? void 0 : _h.accomplishments)) {
    return "bg-lime-500";
  } else if (type === ((_i = index.WalletCategoryTypes) == null ? void 0 : _i.events)) {
    return "bg-fuchsia-500";
  } else if (type === ((_j = index.WalletCategoryTypes) == null ? void 0 : _j.membership)) {
    return "bg-teal-500";
  } else if (type === ((_k = index.WalletCategoryTypes) == null ? void 0 : _k.goals)) {
    return "bg-rose-500";
  } else if (type === ((_l = index.WalletCategoryTypes) == null ? void 0 : _l.ids)) {
    return "bg-yellow-500";
  } else if (type === ((_m = index.WalletCategoryTypes) == null ? void 0 : _m.currency)) {
    return "bg-cyan-500";
  }
  return "bg-grayscale-900";
};

const BoostSmallCard = ({
  title = "Title Lorem Ipsum",
  customTitle,
  thumbImgSrc,
  customThumbClass = "",
  customHeaderClass = "",
  type = index.WalletCategoryTypes.achievements,
  className,
  onCheckClick,
  showChecked,
  checkStatus,
  arrowOnClick,
  buttonOnClick,
  customButtonComponent,
  customBodyClass,
  customBodyComponent,
  customThumbComponent,
  customDraftComponent,
  innerOnClick,
  issueHistory,
  bgImgSrc,
  optionsTriggerOnClick
}) => {
  var _a;
  const thumbClass = index$1.TYPE_TO_WALLET_DARK_COLOR[type] ? `bg-${index$1.TYPE_TO_WALLET_DARK_COLOR[type]}` : "bg-grayscale-50";
  const defaultThumbClass = `small-boost-card-thumb flex h-[110px] w-[110px] my-[10px] mx-auto ${thumbClass} overflow-hidden flex-col justify-center items-center rounded-full ${customThumbClass}`;
  const imgSrc = (thumbImgSrc == null ? void 0 : thumbImgSrc.trim()) !== "" ? thumbImgSrc : index$1.TYPE_TO_IMG_SRC[type];
  const headerBgColor = getDarkBGColor(type);
  const checkBtnClass = checkStatus ? "generic-vc-card checked" : "generic-vc-card unchecked";
  const defaultHeaderClass = `flex generic-card-title w-full justify-center ${customHeaderClass}`;
  const defaultBodyClass = ` boost-small-card-body flex justify-center items-center text-center text-[14px] overflow-hidden text-grayscale-500 py-[5px] px-[10px] ${customBodyClass}`;
  const defaultButtonClass = `cursor-pointer small-boost-boost-btn flex boost-btn-click rounded-[40px] w-[140px] h-[48px] text-white flex justify-center items-center ${headerBgColor}`;
  const innerClickContainerClass = `relative cursor-pointer boost-small-card inner-click-container z-10`;
  const issueHistoryDisplay = issueHistory && (issueHistory == null ? void 0 : issueHistory.length) > 3 ? issueHistory == null ? void 0 : issueHistory.slice(0, 3) : issueHistory;
  const renderIssueHistory = issueHistoryDisplay == null ? void 0 : issueHistoryDisplay.map((issueItem) => {
    return /* @__PURE__ */ React__default["default"].createElement(
      "div",
      {
        key: issueItem == null ? void 0 : issueItem.id,
        className: "profile-thumb-img border-[1px] border-white border-solid  vc-issuee-image h-[35px] w-[35px] rounded-full overflow-hidden mx-[-5px]"
      },
      /* @__PURE__ */ React__default["default"].createElement(
        UserProfilePicture.UserProfilePicture,
        {
          customContainerClass: `h-full w-full object-cover ${!(issueItem == null ? void 0 : issueItem.thumb) ? "pt-[8px]" : ""}`,
          user: { image: issueItem == null ? void 0 : issueItem.thumb, name: issueItem == null ? void 0 : issueItem.name },
          alt: "profile"
        }
      )
    );
  });
  const handleInnerClick = () => {
    innerOnClick == null ? void 0 : innerOnClick();
  };
  const handleOptionsClick = () => {
    optionsTriggerOnClick == null ? void 0 : optionsTriggerOnClick();
  };
  return /* @__PURE__ */ React__default["default"].createElement(
    "div",
    {
      className: `flex generic-display-card-simple bg-white flex-col shadow-bottom relative $ py-[0px] px-[0px] w-[160px] h-[280px] rounded-[20px] overflow-hidden ${className}`
    },
    optionsTriggerOnClick && /* @__PURE__ */ React__default["default"].createElement(
      "section",
      {
        className: "absolute cursor-pointer shadow-bottom h-[30px] w-[30px] top-[5px] right-[5px] rounded-full overflow-hidden z-20 bg-white/70 flex items-center justify-center",
        onClick: handleOptionsClick
      },
      /* @__PURE__ */ React__default["default"].createElement(ThreeDotVertical.ThreeDotVertical, { className: "h-[20px] w-[20px] z-50 text-grayscale-900" })
    ),
    bgImgSrc && /* @__PURE__ */ React__default["default"].createElement("section", { className: "absolute top-[-50px]  shadow-bottom left-[0px] rounded-b-full overflow-hidden z-0 mt-3" }, /* @__PURE__ */ React__default["default"].createElement("img", { className: "h-full w-full object-cover overflow-hidden", src: bgImgSrc })),
    /* @__PURE__ */ React__default["default"].createElement("div", { className: innerClickContainerClass, onClick: handleInnerClick }, customThumbComponent, !customThumbComponent && /* @__PURE__ */ React__default["default"].createElement("section", { className: defaultThumbClass }, thumbImgSrc && (thumbImgSrc == null ? void 0 : thumbImgSrc.trim()) !== "" && /* @__PURE__ */ React__default["default"].createElement(
      "img",
      {
        className: "generic-display-card-img h-full w-full  w-[110px] h-[110px] rounded-full object-cover overflow-hidden",
        src: thumbImgSrc != null ? thumbImgSrc : "",
        alt: "Credential Achievement Image"
      }
    ), (!thumbImgSrc || (thumbImgSrc == null ? void 0 : thumbImgSrc.trim()) === "") && /* @__PURE__ */ React__default["default"].createElement(
      "img",
      {
        className: "max-w-[110px] w-full h-full p-[0px] object-cover  rounded-full",
        src: imgSrc
      }
    )), customTitle && customTitle, !customTitle && /* @__PURE__ */ React__default["default"].createElement("section", { className: defaultHeaderClass }, /* @__PURE__ */ React__default["default"].createElement("p", { className: "relative z-[100] small-boost-title text-[16px] leading-[130%] p-[0px] font-medium text-center line-clamp-2" }, title)), /* @__PURE__ */ React__default["default"].createElement("section", { className: defaultBodyClass }, customBodyComponent && customBodyComponent, !customBodyComponent && issueHistory && (issueHistory == null ? void 0 : issueHistory.length) > 0 && renderIssueHistory, !customBodyComponent && issueHistory && (issueHistory == null ? void 0 : issueHistory.length) > 3 && /* @__PURE__ */ React__default["default"].createElement("span", { className: "small-boost-issue-count ml-[10px] font-semibold" }, "+", (issueHistory == null ? void 0 : issueHistory.length) - 3))),
    /* @__PURE__ */ React__default["default"].createElement("section", { className: "small-boost-card-footer flex justify-center items-center absolute bottom-[15px] w-full" }, customButtonComponent && customButtonComponent, !customButtonComponent && /* @__PURE__ */ React__default["default"].createElement("div", { className: "flex w-full flex-col items-center justify-center" }, customDraftComponent && customDraftComponent, /* @__PURE__ */ React__default["default"].createElement("div", { onClick: buttonOnClick, className: defaultButtonClass }, /* @__PURE__ */ React__default["default"].createElement("img", { className: "h-[25px] mr-[7px] text-", src: AddAwardLight__default["default"] }), /* @__PURE__ */ React__default["default"].createElement("span", { className: "font-mouse text-[25px] tracking-wider" }, "BOOST")))),
    showChecked && /* @__PURE__ */ React__default["default"].createElement("div", { className: "check-btn-overlay absolute top-[5px] left-[5px]" }, /* @__PURE__ */ React__default["default"].createElement(
      CircleCheckButton.CircleCheckButton,
      {
        checked: checkStatus,
        onClick: onCheckClick,
        className: checkBtnClass
      }
    )),
    arrowOnClick && /* @__PURE__ */ React__default["default"].createElement(
      "button",
      {
        type: "button",
        onClick: arrowOnClick,
        className: "arrow-btn-overlay absolute top-[52px] right-[2px]"
      },
      /* @__PURE__ */ React__default["default"].createElement(
        "img",
        {
          className: "h-full w-full object-contai",
          src: (_a = CaretRightFilled__default["default"]) != null ? _a : "",
          alt: "Right Caret"
        }
      )
    )
  );
};

exports.BoostSmallCard = BoostSmallCard;
//# sourceMappingURL=BoostSmallCard-2141fdd9.js.map
