var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/pro/Selector/components/Card/index.tsx
var Card_exports = {};
__export(Card_exports, {
  default: () => Card_default
});
module.exports = __toCommonJS(Card_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_index = require("./index.less");
var stopPropagation = (e) => {
  e.stopPropagation();
};
var Card = ({
  variant = "outlined",
  layout = "horizontal",
  actions,
  actionsPosition = "right",
  corner,
  children,
  selected = false,
  disabled = false,
  hoverable = false,
  onClick,
  styles,
  selectedType = "outlined",
  className,
  style
}) => {
  const styleProps = (0, import_react.useMemo)(
    () => ({
      selected,
      disabled,
      hoverable,
      variant,
      layout
    }),
    [selected, disabled, hoverable, variant, layout]
  );
  const containerStyle = (0, import_react.useMemo)(() => {
    if (!(styles == null ? void 0 : styles.container)) return style;
    const customStyle = typeof styles.container === "function" ? styles.container(styleProps) : styles.container;
    return { ...customStyle, ...style };
  }, [styles == null ? void 0 : styles.container, style, styleProps]);
  const contentStyle = (0, import_react.useMemo)(() => {
    if (!(styles == null ? void 0 : styles.content)) return void 0;
    return typeof styles.content === "function" ? styles.content(styleProps) : styles.content;
  }, [styles == null ? void 0 : styles.content, styleProps]);
  const actionsStyle = (0, import_react.useMemo)(() => {
    if (!(styles == null ? void 0 : styles.actions)) return void 0;
    return typeof styles.actions === "function" ? styles.actions(styleProps) : styles.actions;
  }, [styles == null ? void 0 : styles.actions, styleProps]);
  const cornerStyle = (0, import_react.useMemo)(() => {
    if (!(styles == null ? void 0 : styles.corner)) return void 0;
    return typeof styles.corner === "function" ? styles.corner(styleProps) : styles.corner;
  }, [styles == null ? void 0 : styles.corner, styleProps]);
  const renderActions = () => {
    if (!actions) return null;
    let _actions = Array.isArray(actions) ? actions.filter(Boolean) : [actions];
    if (_actions.length === 0) return null;
    return /* @__PURE__ */ import_react.default.createElement("ul", { className: "pisell-pro-card_actions", style: actionsStyle }, actions.map((action, index) => /* @__PURE__ */ import_react.default.createElement(
      "li",
      {
        key: index,
        className: "pisell-pro-card_actions-item",
        onClick: stopPropagation
      },
      action
    )));
  };
  const renderCorner = () => {
    if (!corner || layout !== "vertical") return null;
    return /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "pisell-pro-card_corner",
        style: cornerStyle,
        onClick: stopPropagation
      },
      corner
    );
  };
  const handleClick = (e) => {
    if (disabled) return;
    onClick == null ? void 0 : onClick(e);
  };
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)(
        "pisell-pro-card",
        `pisell-pro-card-${variant}`,
        `pisell-pro-card-${layout}`,
        {
          "pisell-pro-card-selected": selected,
          [`pisell-pro-card-selected-${selectedType}`]: selected && selectedType !== "none",
          "pisell-pro-card-disabled": disabled,
          "pisell-pro-card-hoverable": hoverable && !disabled,
          "pisell-pro-card-clickable": onClick && !disabled,
          [`pisell-pro-card-actions-${actionsPosition}`]: layout === "horizontal" && actions
        },
        className
      ),
      style: containerStyle,
      onClick: handleClick
    },
    layout === "horizontal" && actionsPosition === "left" && renderActions(),
    /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-card_content", style: contentStyle }, children),
    (layout === "vertical" || actionsPosition === "right") && renderActions(),
    renderCorner()
  );
};
var Card_default = Card;
