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/plus/saasDevice/devicePlanning/modules/deviceConnections/components/ConnectionDeviceCard.tsx
var ConnectionDeviceCard_exports = {};
__export(ConnectionDeviceCard_exports, {
  default: () => ConnectionDeviceCard_default
});
module.exports = __toCommonJS(ConnectionDeviceCard_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_icons = require("@ant-design/icons");
var import_materials = require("@pisell/materials");
var ConnectionDeviceCard = ({
  title,
  description,
  deviceInfo,
  connectionInfo,
  deviceStatuses,
  connectionStatuses,
  profiles,
  lastSeen,
  actions,
  showPreview,
  onPreview
}) => {
  var _a;
  const showFooter = profiles.length > 0 || Boolean(lastSeen);
  const extra = /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-actions" }, showPreview ? /* @__PURE__ */ import_react.default.createElement(
    import_materials.Button,
    {
      type: "text",
      icon: /* @__PURE__ */ import_react.default.createElement(import_icons.EyeOutlined, null),
      className: "device-detail-drawer__connection-card-action",
      onClick: onPreview
    }
  ) : null, (actions == null ? void 0 : actions.length) ? /* @__PURE__ */ import_react.default.createElement(
    import_antd.Dropdown,
    {
      menu: { items: actions },
      trigger: ["click"],
      placement: "bottomRight"
    },
    /* @__PURE__ */ import_react.default.createElement(
      import_materials.Button,
      {
        type: "text",
        icon: /* @__PURE__ */ import_react.default.createElement(import_icons.MoreOutlined, null),
        className: "device-detail-drawer__connection-card-action"
      }
    )
  ) : null);
  return /* @__PURE__ */ import_react.default.createElement(
    import_antd.Card,
    {
      size: "small",
      className: "device-detail-drawer__connection-card",
      title: /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-heading" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-title" }, title), description ? /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-desc" }, description) : null),
      extra
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-device" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-icon" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: deviceInfo.icon || "SettingOutlined" })), /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-device-main" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-model" }, deviceInfo.modelName), /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-meta" }, /* @__PURE__ */ import_react.default.createElement("span", null, deviceInfo.brandName), /* @__PURE__ */ import_react.default.createElement("span", null, "·"), /* @__PURE__ */ import_react.default.createElement("span", null, deviceInfo.typeName)), ((_a = deviceInfo.statusLines) == null ? void 0 : _a.length) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-lines" }, deviceInfo.statusLines.map((line, index) => /* @__PURE__ */ import_react.default.createElement("span", { key: index }, line))) : null, deviceStatuses.length ? /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-statuses" }, deviceStatuses.map((status) => /* @__PURE__ */ import_react.default.createElement(
      "span",
      {
        key: status.key,
        className: `device-detail-drawer__connection-card-status is-${status.tone || "default"}`
      },
      /* @__PURE__ */ import_react.default.createElement("span", { className: "device-detail-drawer__connection-card-status-dot" }),
      status.label
    ))) : null)),
    /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-connection" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-connection-icon" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "LinkOutlined" })), /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-connection-main" }, connectionInfo.lines.length ? /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-lines" }, connectionInfo.lines.map((line, index) => /* @__PURE__ */ import_react.default.createElement("span", { key: index }, line))) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-statuses" }, connectionStatuses.map((status) => /* @__PURE__ */ import_react.default.createElement(
      "span",
      {
        key: status.key,
        className: `device-detail-drawer__connection-card-status is-${status.tone || "default"}`
      },
      /* @__PURE__ */ import_react.default.createElement("span", { className: "device-detail-drawer__connection-card-status-dot" }),
      status.label
    ))))),
    showFooter ? /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-footer" }, profiles.length > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-profiles" }, profiles.map((profile) => /* @__PURE__ */ import_react.default.createElement(
      "span",
      {
        key: profile.key,
        className: "device-detail-drawer__connection-card-profile"
      },
      /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "FileTextOutlined" }),
      profile.label
    ))) : /* @__PURE__ */ import_react.default.createElement("div", null), lastSeen ? /* @__PURE__ */ import_react.default.createElement("div", { className: "device-detail-drawer__connection-card-last-seen" }, lastSeen) : /* @__PURE__ */ import_react.default.createElement("div", null)) : null
  );
};
var ConnectionDeviceCard_default = ConnectionDeviceCard;
