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/components/pisellFloorMapLayout/components/NodePortMarkers.tsx
var NodePortMarkers_exports = {};
__export(NodePortMarkers_exports, {
  NodePortMarkers: () => NodePortMarkers
});
module.exports = __toCommonJS(NodePortMarkers_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_edgeRouting = require("../utils/edgeRouting");
var import_NodePortMarkers = require("./NodePortMarkers.less");
var MARKER_VISUAL_SIZE = 10;
var PREFIX = "pisell-floor-map-layout";
var MARKER_ANCHORS = [
  "top",
  "right",
  "bottom",
  "left"
];
function NodePortMarkers(props) {
  const {
    rect,
    contentOffsetX = 0,
    contentOffsetY = 0,
    previewOnly = false,
    onAnchorPointerDown,
    highlightAnchors = [],
    className,
    viewportScale = 1
  } = props;
  const safeScale = Math.max(viewportScale, 0.01);
  const markerSize = MARKER_VISUAL_SIZE / safeScale;
  const markerHalf = markerSize / 2;
  const markerOutset = import_edgeRouting.EDGE_PORT_MARKER_OUTSET / safeScale;
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)(`${PREFIX}-port-markers`, className),
      style: {
        position: "absolute",
        left: contentOffsetX + rect.left,
        top: contentOffsetY + rect.top,
        width: rect.width,
        height: rect.height,
        pointerEvents: "none",
        zIndex: 5
      }
    },
    MARKER_ANCHORS.map((anchor) => {
      const localRect = {
        left: 0,
        top: 0,
        width: rect.width,
        height: rect.height
      };
      const pt = (0, import_edgeRouting.getPortMarkerDisplayPoint)(localRect, anchor, markerOutset);
      const highlighted = highlightAnchors.includes(anchor);
      const Tag = previewOnly ? "span" : "button";
      return /* @__PURE__ */ import_react.default.createElement(
        Tag,
        {
          key: anchor,
          type: previewOnly ? void 0 : "button",
          className: (0, import_classnames.default)(`${PREFIX}-port-marker`, {
            [`${PREFIX}-port-marker--highlight`]: highlighted,
            [`${PREFIX}-port-marker--preview`]: previewOnly
          }),
          style: {
            left: pt.x,
            top: pt.y,
            width: markerSize,
            height: markerSize,
            marginLeft: -markerHalf,
            marginTop: -markerHalf,
            pointerEvents: previewOnly ? "none" : "auto"
          },
          "aria-label": anchor,
          onPointerDown: previewOnly || !onAnchorPointerDown ? void 0 : (ev) => {
            ev.stopPropagation();
            ev.preventDefault();
            onAnchorPointerDown(anchor, ev);
          }
        }
      );
    })
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  NodePortMarkers
});
