{"version":3,"file":"GraphPort.js","names":[],"sources":["jsx/nodes/GraphPort.js"],"sourcesContent":["import { isTouchSurface, useResolvedKnobs } from \"@multiplatform.one/theme\";\nimport { Handle, Position } from \"../react-flow/xy\";\nimport { paintedPortSize, portHitSize, portRegionInset } from \"./handleGeometry\";\nimport { graphNodeSize } from \"./nodeMeasure\";\nimport { jsx } from \"react/jsx-runtime\";\nconst positionForSide = {\n  left: Position.Left,\n  right: Position.Right,\n  top: Position.Top,\n  bottom: Position.Bottom\n};\nfunction GraphPort({\n  id,\n  side,\n  direction,\n  intent,\n  coarsePointer = isTouchSurface(),\n  portSpacingPx,\n  isConnectable = true\n}) {\n  const { knobProps } = useResolvedKnobs({ component: \"GraphPort\", intent });\n  const size = graphNodeSize(knobProps.sizeToken);\n  const painted = paintedPortSize(size);\n  const hit = portHitSize({ size, coarsePointer, portSpacingPx });\n  const borderWidthPx = knobProps.surface.borderWidth;\n  const inset = portRegionInset({ size, coarsePointer, portSpacingPx, borderWidthPx });\n  const style = {\n    backgroundColor: knobProps.surface.backgroundColor,\n    borderColor: knobProps.surface.borderColor,\n    borderWidth: borderWidthPx,\n    borderStyle: \"solid\",\n    // The custom properties `css/graph.css` reads. Three INPUTS, not an\n    // answer: the sheet computes the inset itself, because milestone 6's H7\n    // makes it depend on the live viewport zoom — which this component cannot\n    // see without subscribing to the store on every pinch frame, and would then\n    // have to re-render every port to publish.\n    //\n    // `--mpo-graph-handle-inset` used to be published here as the answer. It is\n    // gone rather than kept beside the calc: a var nothing reads is the kind of\n    // drift that survives three refactors and then gets believed.\n    [\"--mpo-graph-handle-size\"]: `${painted}px`,\n    [\"--mpo-graph-handle-hit\"]: `${hit}px`,\n    [\"--mpo-graph-handle-border\"]: `${borderWidthPx}px`,\n    // §11: the circle is identity. Declared here as well as in the sheet so a\n    // consumer who forgets to import the CSS still gets a round port rather\n    // than a square one that reads as a resize grip.\n    borderRadius: \"50%\",\n    width: painted,\n    height: painted,\n    boxShadow: \"none\"\n  };\n  return /* @__PURE__ */ jsx(\n    Handle,\n    {\n      id,\n      type: direction === \"in\" ? \"target\" : \"source\",\n      position: positionForSide[side],\n      className: \"mp-graph-port\",\n      isConnectable,\n      style,\n      \"data-graph-port\": id,\n      \"data-graph-port-painted\": String(painted),\n      \"data-graph-port-hit\": String(hit),\n      \"data-graph-port-inset\": String(inset)\n    }\n  );\n}\nexport {\n  GraphPort\n};\n//# sourceMappingURL=GraphPort.js.map\n"],"mappings":";;;;;;;AAKA,MAAM,kBAAkB;CACtB,MAAM,SAAS;CACf,OAAO,SAAS;CAChB,KAAK,SAAS;CACd,QAAQ,SAAS;AACnB;AACA,SAAS,UAAU,EACjB,IACA,MACA,WACA,QACA,gBAAgB,eAAe,GAC/B,eACA,gBAAgB,QACf;CACD,MAAM,EAAE,cAAc,iBAAiB;EAAE,WAAW;EAAa;CAAO,CAAC;CACzE,MAAM,OAAO,cAAc,UAAU,SAAS;CAC9C,MAAM,UAAU,gBAAgB,IAAI;CACpC,MAAM,MAAM,YAAY;EAAE;EAAM;EAAe;CAAc,CAAC;CAC9D,MAAM,gBAAgB,UAAU,QAAQ;CACxC,MAAM,QAAQ,gBAAgB;EAAE;EAAM;EAAe;EAAe;CAAc,CAAC;CACnF,MAAM,QAAQ;EACZ,iBAAiB,UAAU,QAAQ;EACnC,aAAa,UAAU,QAAQ;EAC/B,aAAa;EACb,aAAa;GAUZ,4BAA4B,GAAG,QAAQ;GACvC,2BAA2B,GAAG,IAAI;GAClC,8BAA8B,GAAG,cAAc;EAIhD,cAAc;EACd,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA,OAAuB,oBACrB,QACA;EACE;EACA,MAAM,cAAc,OAAO,WAAW;EACtC,UAAU,gBAAgB;EAC1B,WAAW;EACX;EACA;EACA,mBAAmB;EACnB,2BAA2B,OAAO,OAAO;EACzC,uBAAuB,OAAO,GAAG;EACjC,yBAAyB,OAAO,KAAK;CACvC,CACF;AACF"}