portograph 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42266,15 +42266,18 @@ function dJ(e, t, n) {
42266
42266
  var fJ = (e, t) => ({
42267
42267
  ...e,
42268
42268
  ...Object.fromEntries(Object.keys(t ?? {}).sort().map((e) => [e, String(t[e])]))
42269
- }), pJ = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), mJ = (e, t) => {
42269
+ }), pJ = (e) => {
42270
+ let t = AK(um(e));
42271
+ return t ? { "pg-class": t } : {};
42272
+ }, mJ = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), hJ = (e, t) => {
42270
42273
  if (t === void 0 || t === "") return e;
42271
- let n = pJ(t);
42274
+ let n = mJ(t);
42272
42275
  return {
42273
42276
  ...e,
42274
42277
  tooltip: e.tooltip === void 0 ? n : `${e.tooltip}\n${n}`
42275
42278
  };
42276
- }, hJ = (e) => e.fontFamily?.replace(/;/g, "").trim() || "Verdana, DejaVu Sans, sans-serif";
42277
- function gJ(e, t, n) {
42279
+ }, gJ = (e) => e.fontFamily?.replace(/;/g, "").trim() || "Verdana, DejaVu Sans, sans-serif";
42280
+ function _J(e, t, n) {
42278
42281
  if (n === void 0) return $("mxCell", e, t);
42279
42282
  let { id: r, value: i, ...a } = e;
42280
42283
  return $("object", {
@@ -42283,58 +42286,58 @@ function gJ(e, t, n) {
42283
42286
  ...n
42284
42287
  }, $("mxCell", a, t));
42285
42288
  }
42286
- function _J(e, t) {
42289
+ function vJ(e, t) {
42287
42290
  let n = e.filter((e) => e !== "");
42288
42291
  for (let [e, r] of Object.entries(t)) r !== void 0 && n.push(`${e}=${typeof r == "number" ? OK(r) : r}`);
42289
42292
  return n.length ? `${n.join(";")};` : "";
42290
42293
  }
42291
- var vJ = (e) => e.join("\n"), yJ = (e) => e.lines ?? (e.text === "" ? [] : [e.text]), bJ = (e) => Number.isFinite(e) ? e : 0, xJ = (e) => bJ(e.fontSize ?? 9), SJ = (e) => Math.round(e * 1.2), CJ = 1e3;
42292
- function wJ(e, t) {
42293
- let n = yJ(e), r = e.textRotation ?? 0, i = e.bounds, a = Ct("", {
42294
- fontSize: CJ,
42294
+ var yJ = (e) => e.join("\n"), bJ = (e) => e.lines ?? (e.text === "" ? [] : [e.text]), xJ = (e) => Number.isFinite(e) ? e : 0, SJ = (e) => xJ(e.fontSize ?? 9), CJ = (e) => Math.round(e * 1.2), wJ = 1e3;
42295
+ function TJ(e, t) {
42296
+ let n = bJ(e), r = e.textRotation ?? 0, i = e.bounds, a = Ct("", {
42297
+ fontSize: wJ,
42295
42298
  weight: e.fontWeight === 700 ? 700 : 400
42296
- }), o = e.lineHeight ?? bJ(Math.ceil(a.lineHeight / CJ * t));
42297
- return bJ(-(r === -90 || r === 90 ? i.width : r === 0 ? i.height : o * n.length) / 2 + bJ(a.ascent / CJ * t));
42299
+ }), o = e.lineHeight ?? xJ(Math.ceil(a.lineHeight / wJ * t));
42300
+ return xJ(-(r === -90 || r === 90 ? i.width : r === 0 ? i.height : o * n.length) / 2 + xJ(a.ascent / wJ * t));
42298
42301
  }
42299
- function TJ(e, t, n = 0) {
42302
+ function EJ(e, t, n = 0) {
42300
42303
  if (!e.bounds) return;
42301
- let r = Math.max(1, yJ(e).length), i = t - 1 - (t + (r - 1) * SJ(t)) / 2;
42302
- return bJ(2 * (wJ(e, t) - n - i));
42304
+ let r = Math.max(1, bJ(e).length), i = t - 1 - (t + (r - 1) * CJ(t)) / 2;
42305
+ return xJ(2 * (TJ(e, t) - n - i));
42303
42306
  }
42304
- var EJ = (e) => `data:image/svg+xml,${encodeURIComponent(e)}`, DJ = (e) => e === 1 ? void 0 : Math.round(e * 100), OJ = (e) => e === "fill" ? "#000000" : "none", kJ = (e) => ({
42307
+ var DJ = (e) => `data:image/svg+xml,${encodeURIComponent(e)}`, OJ = (e) => e === 1 ? void 0 : Math.round(e * 100), kJ = (e) => e === "fill" ? "#000000" : "none", AJ = (e) => ({
42305
42308
  x: e.x + e.width / 2,
42306
42309
  y: e.y + e.height / 2
42307
- }), AJ = (e, t) => {
42310
+ }), jJ = (e, t) => {
42308
42311
  if (e.turnedSize === void 0) return t;
42309
- let n = kJ(t);
42312
+ let n = AJ(t);
42310
42313
  return {
42311
42314
  ...t,
42312
42315
  x: n.x - e.turnedSize.width / 2,
42313
42316
  y: n.y - e.turnedSize.height / 2,
42314
42317
  ...e.turnedSize
42315
42318
  };
42316
- }, jJ = (e, t) => Math.abs(e.x - t.x) <= Bq && Math.abs(e.y - t.y) <= Bq, MJ = (e, t) => ({
42319
+ }, MJ = (e, t) => Math.abs(e.x - t.x) <= Bq && Math.abs(e.y - t.y) <= Bq, NJ = (e, t) => ({
42317
42320
  x: e.x - t.x,
42318
42321
  y: e.y - t.y,
42319
42322
  width: e.width,
42320
42323
  height: e.height
42321
- }), NJ = (e, t, n) => {
42324
+ }), PJ = (e, t, n) => {
42322
42325
  let r = e + t / 2 - n / 2;
42323
42326
  return Math.abs(r) <= Bq ? .5 : +(r > 0);
42324
- }, PJ = (e, t, n) => ({
42327
+ }, FJ = (e, t, n) => ({
42325
42328
  ...e,
42326
42329
  node: t,
42327
42330
  fraction: {
42328
- x: n === "left" ? 0 : n === "right" ? 1 : NJ(e.x, e.width, t.width),
42329
- y: n === "top" ? 0 : n === "bottom" ? 1 : NJ(e.y, e.height, t.height)
42331
+ x: n === "left" ? 0 : n === "right" ? 1 : PJ(e.x, e.width, t.width),
42332
+ y: n === "top" ? 0 : n === "bottom" ? 1 : PJ(e.y, e.height, t.height)
42330
42333
  }
42331
- }), FJ = (e, t, n, r) => {
42334
+ }), IJ = (e, t, n, r) => {
42332
42335
  let i = e.x + e.width / 2, a = e.y + e.height / 2, o = [
42333
42336
  ["top", Math.abs(a)],
42334
42337
  ["bottom", Math.abs(a - t.height)],
42335
42338
  ["left", Math.abs(i)],
42336
42339
  ["right", Math.abs(i - t.width)]
42337
- ], s = n ?? (a < -1e-6 ? "top" : a > t.height + Bq ? "bottom" : i < -1e-6 ? "left" : i > t.width + Bq ? "right" : o.reduce((e, t) => t[1] < e[1] ? t : e)[0]), c = PJ(e, t, s);
42340
+ ], s = n ?? (a < -1e-6 ? "top" : a > t.height + Bq ? "bottom" : i < -1e-6 ? "left" : i > t.width + Bq ? "right" : o.reduce((e, t) => t[1] < e[1] ? t : e)[0]), c = FJ(e, t, s);
42338
42341
  return r === void 0 ? c : s === "top" || s === "bottom" ? {
42339
42342
  ...c,
42340
42343
  fraction: {
@@ -42348,21 +42351,21 @@ var EJ = (e) => `data:image/svg+xml,${encodeURIComponent(e)}`, DJ = (e) => e ===
42348
42351
  y: r
42349
42352
  }
42350
42353
  };
42351
- }, IJ = (e, t) => ({
42354
+ }, LJ = (e, t) => ({
42352
42355
  [`${e}X`]: t.fraction.x,
42353
42356
  [`${e}Y`]: t.fraction.y,
42354
42357
  [`${e}Dx`]: t.x + t.width / 2 - t.fraction.x * t.node.width,
42355
42358
  [`${e}Dy`]: t.y + t.height / 2 - t.fraction.y * t.node.height,
42356
42359
  [`${e}Perimeter`]: 0
42357
- }), LJ = (e, t, n) => ({
42360
+ }), RJ = (e, t, n) => ({
42358
42361
  ...e,
42359
42362
  node: t,
42360
42363
  fraction: {
42361
42364
  x: n ? 0 : .5,
42362
42365
  y: 0
42363
42366
  }
42364
- }), RJ = (e) => "fraction" in e, zJ = (e) => {
42365
- if (!RJ(e)) return $("mxGeometry", {
42367
+ }), zJ = (e) => "fraction" in e, BJ = (e) => {
42368
+ if (!zJ(e)) return $("mxGeometry", {
42366
42369
  x: e.x,
42367
42370
  y: e.y,
42368
42371
  width: e.width,
@@ -42382,15 +42385,15 @@ var EJ = (e) => `data:image/svg+xml,${encodeURIComponent(e)}`, DJ = (e) => e ===
42382
42385
  y: e.y - t.y * n.height,
42383
42386
  as: "offset"
42384
42387
  }));
42385
- }, BJ = (e) => e.replace(/[%~]/g, (e) => `%${e.charCodeAt(0).toString(16)}`), VJ = (e, ...t) => t.length ? `pg-${e}~${t.map(BJ).join("~")}` : `pg-${e}`, HJ = {
42388
+ }, VJ = (e) => e.replace(/[%~]/g, (e) => `%${e.charCodeAt(0).toString(16)}`), HJ = (e, ...t) => t.length ? `pg-${e}~${t.map(VJ).join("~")}` : `pg-${e}`, UJ = {
42386
42389
  movable: 0,
42387
42390
  resizable: 0,
42388
42391
  rotatable: 0,
42389
42392
  editable: 0,
42390
42393
  connectable: 0,
42391
42394
  pointerEvents: 0
42392
- }, UJ = { deletable: 0 };
42393
- function WJ(e, t = {}) {
42395
+ }, WJ = { deletable: 0 };
42396
+ function GJ(e, t = {}) {
42394
42397
  u(t), ML(e);
42395
42398
  let n = e.canvas;
42396
42399
  if (!n) throw Error("A draw.io export requires a final canvas");
@@ -42406,28 +42409,29 @@ function WJ(e, t = {}) {
42406
42409
  return b.add(e), e;
42407
42410
  }, S = (e, t, n, r, i, a = {}, o) => {
42408
42411
  let s = x(e);
42409
- v.add(t), _.push(() => gJ({
42412
+ v.add(t), _.push(() => _J({
42410
42413
  id: s,
42411
42414
  value: i,
42412
42415
  style: y(s, n),
42413
42416
  vertex: 1,
42414
42417
  parent: t,
42415
42418
  ...a
42416
- }, zJ(r), o));
42419
+ }, BJ(r), o));
42417
42420
  }, C = Cn(d), w = (e) => C[e.sourceIndex] ?? e.id, T = (t, n, r) => {
42418
42421
  let i = d.links[t.sourceIndex], a = [...fq(e, t), ...r ? [dq(r)] : []].filter((e) => e !== void 0).join("\n");
42419
- return mJ(fJ({
42422
+ return hJ(fJ({
42420
42423
  "pg-kind": "link",
42421
42424
  "pg-id": w(t),
42422
42425
  "pg-from": Sn(i?.from ?? t.from),
42423
42426
  "pg-to": Sn(i?.to ?? t.to),
42427
+ ...pJ(i?.class),
42424
42428
  ...n ? {
42425
42429
  "pg-run": String(n.index),
42426
42430
  "pg-runs": String(n.count)
42427
42431
  } : {}
42428
42432
  }, i?.meta), a);
42429
- }, E = (e, t, n, r, i, a = xJ(n), o, s) => {
42430
- let c = _J(["text"], {
42433
+ }, E = (e, t, n, r, i, a = SJ(n), o, s) => {
42434
+ let c = vJ(["text"], {
42431
42435
  strokeColor: "none",
42432
42436
  fillColor: "none",
42433
42437
  align: n.textAlign === "start" ? "left" : "center",
@@ -42437,17 +42441,17 @@ function WJ(e, t = {}) {
42437
42441
  overflow: "visible",
42438
42442
  points: "[]",
42439
42443
  resizable: 0,
42440
- spacingTop: TJ(n, a),
42441
- fontFamily: hJ(n),
42444
+ spacingTop: EJ(n, a),
42445
+ fontFamily: gJ(n),
42442
42446
  fontSize: a,
42443
42447
  ...i,
42444
42448
  fontStyle: n.fontWeight === 700 ? 1 : void 0,
42445
42449
  rotation: n.textRotation ? n.textRotation : void 0,
42446
42450
  labelBackgroundColor: o
42447
- }), l = dq(n) === void 0 ? void 0 : mJ({}, dq(n));
42448
- s === void 0 ? S(e, t, c, AJ(n, r), vJ(yJ(n)), {}, l) : _.push(gJ({
42451
+ }), l = dq(n) === void 0 ? void 0 : hJ({}, dq(n));
42452
+ s === void 0 ? S(e, t, c, jJ(n, r), yJ(bJ(n)), {}, l) : _.push(_J({
42449
42453
  id: x(e),
42450
- value: vJ(yJ(n)),
42454
+ value: yJ(bJ(n)),
42451
42455
  style: c,
42452
42456
  vertex: 1,
42453
42457
  parent: t,
@@ -42458,21 +42462,21 @@ function WJ(e, t = {}) {
42458
42462
  relative: 1,
42459
42463
  as: "geometry"
42460
42464
  }, $q(s) || void 0), l));
42461
- }, D = new uq(l, f, d.css), O = tq.root(d.profile), k = (e, t) => c((n) => D.at(n, e).get(t) ?? OJ(t)), A = (e, t) => {
42465
+ }, D = new uq(l, f, d.css), O = tq.root(d.profile), k = (e, t) => c((n) => D.at(n, e).get(t) ?? kJ(t)), A = (e, t) => {
42462
42466
  let n = t(D.at(a, e));
42463
42467
  return i && (t(D.peek("dark", e)) === n ? t(D.at("dark", e)) : D.at("dark", e)), n;
42464
42468
  }, j = (e, t) => A(e, (e) => e.opacity() * Number(t === void 0 ? 1 : e.get(t) ?? 1)), ee = (e) => nq.inNode(O, e, tq.nodeBody(e, Me(e, p))), te = (e, t) => c((n) => {
42465
- let r = D.at(n, e).get("fill") ?? OJ("fill");
42466
- return r === "none" ? D.at(n, ee(t)).get("fill") ?? OJ("fill") : r;
42469
+ let r = D.at(n, e).get("fill") ?? kJ("fill");
42470
+ return r === "none" ? D.at(n, ee(t)).get("fill") ?? kJ("fill") : r;
42467
42471
  }), ne = (e) => ({
42468
42472
  fontColor: k(e, "fill"),
42469
- textOpacity: DJ(j(e, "fill-opacity"))
42473
+ textOpacity: OJ(j(e, "fill-opacity"))
42470
42474
  }), re = (e) => ({
42471
42475
  fillColor: k(e, "fill"),
42472
42476
  strokeColor: k(e, "stroke"),
42473
- fillOpacity: DJ(A(e, (e) => Number(e.get("fill-opacity") ?? 1))),
42474
- strokeOpacity: DJ(A(e, (e) => Number(e.get("stroke-opacity") ?? 1))),
42475
- opacity: DJ(j(e)),
42477
+ fillOpacity: OJ(A(e, (e) => Number(e.get("fill-opacity") ?? 1))),
42478
+ strokeOpacity: OJ(A(e, (e) => Number(e.get("stroke-opacity") ?? 1))),
42479
+ opacity: OJ(j(e)),
42476
42480
  ...M(A(e, (e) => e.get("stroke-dasharray")))
42477
42481
  }), ie = (e, t) => ({
42478
42482
  tile: {
@@ -42480,14 +42484,14 @@ function WJ(e, t = {}) {
42480
42484
  stroke: k(e, "stroke")
42481
42485
  },
42482
42486
  glyph: k(t, "stroke"),
42483
- image: D.at(a, t).get("stroke") ?? OJ("stroke"),
42484
- tileOpacity: DJ(j(e)),
42485
- glyphOpacity: DJ(j(t))
42487
+ image: D.at(a, t).get("stroke") ?? kJ("stroke"),
42488
+ tileOpacity: OJ(j(e)),
42489
+ glyphOpacity: OJ(j(t))
42486
42490
  }), ae = (e) => ({
42487
42491
  fillColor: k(e, "fill"),
42488
42492
  strokeColor: k(e, "stroke"),
42489
- opacity: DJ(j(e))
42490
- }), oe = (e, t) => nq.inNode(O, e, AK(t, e)), se = (e, t, n) => nq.label(O, AK(e, tq.halo(rK(fe, kJ(t))), n)), M = (e) => e === void 0 || e === "none" ? {} : {
42493
+ opacity: OJ(j(e))
42494
+ }), oe = (e, t) => nq.inNode(O, e, AK(t, e)), se = (e, t, n) => nq.label(O, AK(e, tq.halo(rK(fe, AJ(t))), n)), M = (e) => e === void 0 || e === "none" ? {} : {
42491
42495
  dashed: 1,
42492
42496
  fixDash: 1,
42493
42497
  dashPattern: e
@@ -42505,8 +42509,8 @@ function WJ(e, t = {}) {
42505
42509
  links: "Links",
42506
42510
  labels: "Labels",
42507
42511
  legend: "Legend"
42508
- }, ue = (e) => VJ("layer", e), de = k(nq.canvas(O), "fill");
42509
- S(VJ("canvas"), ue("canvas"), _J([], {
42512
+ }, ue = (e) => HJ("layer", e), de = k(nq.canvas(O), "fill");
42513
+ S(HJ("canvas"), ue("canvas"), vJ([], {
42510
42514
  fillColor: de,
42511
42515
  strokeColor: "none",
42512
42516
  points: "[]",
@@ -42525,7 +42529,7 @@ function WJ(e, t = {}) {
42525
42529
  });
42526
42530
  let fe = sK(e), P = (e) => c((t) => Te(l.paint[t], rK(fe, e))), F = new Map((e.frames ?? []).map((e) => [e.id, g(e.box)])), pe = new Map((e.frames ?? []).filter((e) => e.parent !== void 0 && F.has(e.parent)).map((e) => [e.id, e.parent])), me = (t) => e.labels.find((e) => e.role === "group" && !e.omitted && e.owner.kind === "group" && e.owner.id === t);
42527
42531
  for (let t of fe) {
42528
- let { id: n, bounds: r, frame: i } = t, a = g(r), { authored: o, uniform: s } = ZK(e, t), c = nq.groupBox(O, o, s), { fillColor: u, strokeColor: d, ...f } = re(c), p = Math.round(A(c, (e) => Number(e.get("fill-opacity") ?? 1)) * 100), m = e.labelBands.find((e) => e.group === n), h = me(m?.host ?? n), _ = m !== void 0 && h !== void 0 && Math.abs(kJ(h.bounds).x - kJ(m.bounds).x) <= .5 && Math.abs(kJ(h.bounds).y - kJ(m.bounds).y) <= .5 && (!i || Math.abs(m.bounds.x - r.x) <= .5 && Math.abs(m.bounds.width - r.width) <= .5 && Math.abs(m.side === "top" ? m.bounds.y - r.y : m.bounds.y + m.bounds.height - r.y - r.height) <= .5) ? m : void 0, v = h === void 0 ? {} : ne(se("group-label", h.bounds, $K(e, h))), y = _ ? _J(["swimlane"], {
42532
+ let { id: n, bounds: r, frame: i } = t, a = g(r), { authored: o, uniform: s } = ZK(e, t), c = nq.groupBox(O, o, s), { fillColor: u, strokeColor: d, ...f } = re(c), p = Math.round(A(c, (e) => Number(e.get("fill-opacity") ?? 1)) * 100), m = e.labelBands.find((e) => e.group === n), h = me(m?.host ?? n), _ = m !== void 0 && h !== void 0 && Math.abs(AJ(h.bounds).x - AJ(m.bounds).x) <= .5 && Math.abs(AJ(h.bounds).y - AJ(m.bounds).y) <= .5 && (!i || Math.abs(m.bounds.x - r.x) <= .5 && Math.abs(m.bounds.width - r.width) <= .5 && Math.abs(m.side === "top" ? m.bounds.y - r.y : m.bounds.y + m.bounds.height - r.y - r.height) <= .5) ? m : void 0, v = h === void 0 ? {} : ne(se("group-label", h.bounds, $K(e, h))), y = _ ? vJ(["swimlane"], {
42529
42533
  whiteSpace: "nowrap",
42530
42534
  container: 1,
42531
42535
  collapsible: 0,
@@ -42537,9 +42541,9 @@ function WJ(e, t = {}) {
42537
42541
  flipV: _.side === "bottom" ? 1 : void 0,
42538
42542
  align: "center",
42539
42543
  verticalAlign: "middle",
42540
- spacingTop: TJ(h, xJ(h), kJ(_.bounds).y - kJ(h.bounds).y),
42541
- fontFamily: hJ(h),
42542
- fontSize: xJ(h),
42544
+ spacingTop: EJ(h, SJ(h), AJ(_.bounds).y - AJ(h.bounds).y),
42545
+ fontFamily: gJ(h),
42546
+ fontSize: SJ(h),
42543
42547
  ...v,
42544
42548
  fontStyle: h.fontWeight === 700 ? 1 : void 0,
42545
42549
  swimlaneLine: 0,
@@ -42548,7 +42552,7 @@ function WJ(e, t = {}) {
42548
42552
  strokeColor: d,
42549
42553
  ...f,
42550
42554
  fillOpacity: p
42551
- }) : _J([], {
42555
+ }) : vJ([], {
42552
42556
  container: 1,
42553
42557
  collapsible: 0,
42554
42558
  rounded: 1,
@@ -42561,11 +42565,11 @@ function WJ(e, t = {}) {
42561
42565
  verticalAlign: "top",
42562
42566
  align: "center"
42563
42567
  }), b = i ? pe.get(n) : void 0;
42564
- S(VJ("group", n), b === void 0 ? ue("diagram") : VJ("group", b), y, b === void 0 ? a : MJ(a, F.get(b)), _ ? vJ(yJ(h)) : void 0), h && !_ && E(VJ("groupTitle", n), VJ("group", n), h, MJ(g(h.bounds), a), v);
42568
+ S(HJ("group", n), b === void 0 ? ue("diagram") : HJ("group", b), y, b === void 0 ? a : NJ(a, F.get(b)), _ ? yJ(bJ(h)) : void 0), h && !_ && E(HJ("groupTitle", n), HJ("group", n), h, NJ(g(h.bounds), a), v);
42565
42569
  }
42566
42570
  let he = xm(e);
42567
42571
  for (let t of N(d)) {
42568
- let n = e.nodes[t], r = e.groups[d.nodes[t].group], i = r.frame === void 0 ? void 0 : e.frames?.find((e) => e.id === r.frame), a = VJ("group", i?.id ?? r.id), o = g(n.bounds), c = h(i?.box ?? r.bounds), u = um(d.nodes[t]?.class), f = new Set(n.ports.filter((e) => e.anchor !== void 0).map((e) => {
42572
+ let n = e.nodes[t], r = e.groups[d.nodes[t].group], i = r.frame === void 0 ? void 0 : e.frames?.find((e) => e.id === r.frame), a = HJ("group", i?.id ?? r.id), o = g(n.bounds), c = h(i?.box ?? r.bounds), u = um(d.nodes[t]?.class), f = new Set(n.ports.filter((e) => e.anchor !== void 0).map((e) => {
42569
42573
  let t = e.anchor;
42570
42574
  return `[${OK((t.x - n.bounds.x) / n.bounds.width)},${OK((t.y - n.bounds.y) / n.bounds.height)},0]`;
42571
42575
  }));
@@ -42583,11 +42587,11 @@ function WJ(e, t = {}) {
42583
42587
  f.add(r ? `[${OK(t)},${OK(o)},0]` : `[${OK(o)},${OK(t)},0]`);
42584
42588
  }
42585
42589
  }
42586
- let p = e.labels.find((e) => e.owner.kind === "node" && e.owner.id === t && e.role === "node" && !e.omitted && yJ(e).length > 0), m = e.labels.find((e) => e.owner.kind === "node" && e.owner.id === t && e.role === "description" && !e.omitted && yJ(e).length > 0), _ = p === void 0 ? Wq : bJ(p.fontSize ?? Wq), v = p === void 0 ? void 0 : bJ(kJ(p.bounds).y + wJ(p, _) - n.bounds.y - Hq - Uq - (_ - 1)), y = (p ?? m)?.textAlign === "start", b = {
42590
+ let p = e.labels.find((e) => e.owner.kind === "node" && e.owner.id === t && e.role === "node" && !e.omitted && bJ(e).length > 0), m = e.labels.find((e) => e.owner.kind === "node" && e.owner.id === t && e.role === "description" && !e.omitted && bJ(e).length > 0), _ = p === void 0 ? Wq : xJ(p.fontSize ?? Wq), v = p === void 0 ? void 0 : xJ(AJ(p.bounds).y + TJ(p, _) - n.bounds.y - Hq - Uq - (_ - 1)), y = (p ?? m)?.textAlign === "start", b = {
42587
42591
  width: n.bounds.width,
42588
42592
  height: n.bounds.height
42589
- }, x = p === void 0 ? 0 : bJ(kJ(p.bounds).x - kJ(n.bounds).x);
42590
- if (S(VJ("node", t), a, _J([], {
42593
+ }, x = p === void 0 ? 0 : xJ(AJ(p.bounds).x - AJ(n.bounds).x);
42594
+ if (S(HJ("node", t), a, vJ([], {
42591
42595
  container: 1,
42592
42596
  collapsible: 0,
42593
42597
  rounded: 1,
@@ -42602,66 +42606,67 @@ function WJ(e, t = {}) {
42602
42606
  verticalAlign: "top",
42603
42607
  overflow: "visible",
42604
42608
  spacingTop: v,
42605
- ...y ? { spacingLeft: bJ(p.bounds.x - n.bounds.x - Hq) } : x > 0 ? { spacingLeft: bJ(2 * x) } : x < 0 ? { spacingRight: bJ(-2 * x) } : {},
42606
- fontFamily: hJ(p),
42609
+ ...y ? { spacingLeft: xJ(p.bounds.x - n.bounds.x - Hq) } : x > 0 ? { spacingLeft: xJ(2 * x) } : x < 0 ? { spacingRight: xJ(-2 * x) } : {},
42610
+ fontFamily: gJ(p),
42607
42611
  fontSize: _,
42608
42612
  ...ne(oe(u, "node-label")),
42609
42613
  fontStyle: (p.fontWeight ?? 700) === 700 ? 1 : void 0
42610
42614
  }
42611
- }), MJ(o, c), p === void 0 ? void 0 : vJ(yJ(p)), {}, fJ({
42615
+ }), NJ(o, c), p === void 0 ? void 0 : yJ(bJ(p)), {}, fJ({
42612
42616
  "pg-kind": "node",
42613
42617
  "pg-id": t,
42614
- ...he.has(t) ? { "pg-symbol": BJ(he.get(t).slice(7)) } : {}
42615
- }, d.nodes[t]?.meta)), m !== void 0 && E(VJ("nodeDescription", t), VJ("node", t), m, LJ(MJ(g(m.bounds), h(n.bounds)), b, y), ne(oe(u, "node-description")), bJ(m.fontSize ?? Gq)), n.icon) {
42616
- let e = MJ(g(n.icon.bounds), h(n.bounds)), r = n.icon.inset, i = n.icon.radius ?? l.radii.tile, a = ie(nq.inNode(O, u, AK("icon-tile", u)), nq.inNode(O, u, AK("node-icon", u))), o = s === "cisco19" ? Yq[Vi(n.icon.icon)] : void 0, c = {
42618
+ ...pJ(d.nodes[t]?.class),
42619
+ ...he.has(t) ? { "pg-symbol": VJ(he.get(t).slice(7)) } : {}
42620
+ }, d.nodes[t]?.meta)), m !== void 0 && E(HJ("nodeDescription", t), HJ("node", t), m, RJ(NJ(g(m.bounds), h(n.bounds)), b, y), ne(oe(u, "node-description")), xJ(m.fontSize ?? Gq)), n.icon) {
42621
+ let e = NJ(g(n.icon.bounds), h(n.bounds)), r = n.icon.inset, i = n.icon.radius ?? l.radii.tile, a = ie(nq.inNode(O, u, AK("icon-tile", u)), nq.inNode(O, u, AK("node-icon", u))), o = s === "cisco19" ? Yq[Vi(n.icon.icon)] : void 0, c = {
42617
42622
  "pg-kind": "node-icon",
42618
42623
  "pg-of": t
42619
42624
  };
42620
42625
  if (o) {
42621
- o.kind === "silhouette" && eJ(e) && S(VJ("iconTile", t), VJ("node", t), _J([], {
42626
+ o.kind === "silhouette" && eJ(e) && S(HJ("iconTile", t), HJ("node", t), vJ([], {
42622
42627
  rounded: 1,
42623
42628
  absoluteArcSize: 1,
42624
42629
  arcSize: i * 2,
42625
42630
  fillColor: a.tile.fill,
42626
42631
  strokeColor: a.tile.stroke,
42627
42632
  points: "[]",
42628
- ...HJ,
42633
+ ...UJ,
42629
42634
  opacity: a.tileOpacity
42630
- }), LJ(e, b, y));
42635
+ }), RJ(e, b, y));
42631
42636
  let n = nJ(e, o, r);
42632
- n && S(VJ("icon", t), VJ("node", t), _J([], {
42637
+ n && S(HJ("icon", t), HJ("node", t), vJ([], {
42633
42638
  sketch: 0,
42634
42639
  aspect: "fixed",
42635
42640
  points: "[]",
42636
- ...HJ,
42641
+ ...UJ,
42637
42642
  shape: Xq(o),
42638
42643
  ...o.kind === "badge" ? { prIcon: o.shape } : {},
42639
42644
  fillColor: o.kind === "badge" ? a.tile.fill : a.glyph,
42640
42645
  strokeColor: o.kind === "badge" ? a.glyph : "none",
42641
42646
  opacity: o.kind === "badge" ? a.tileOpacity : a.glyphOpacity
42642
- }), LJ(n, b, y), void 0, {}, c);
42647
+ }), RJ(n, b, y), void 0, {}, c);
42643
42648
  } else {
42644
- eJ(e) && S(VJ("iconTile", t), VJ("node", t), _J([], {
42649
+ eJ(e) && S(HJ("iconTile", t), HJ("node", t), vJ([], {
42645
42650
  rounded: 1,
42646
42651
  absoluteArcSize: 1,
42647
42652
  arcSize: i * 2,
42648
42653
  fillColor: a.tile.fill,
42649
42654
  strokeColor: a.tile.stroke,
42650
42655
  points: "[]",
42651
- ...HJ,
42656
+ ...UJ,
42652
42657
  opacity: a.tileOpacity
42653
- }), LJ(e, b, y));
42658
+ }), RJ(e, b, y));
42654
42659
  let o = tJ(e, r);
42655
42660
  if (o) {
42656
42661
  let e = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${Bi(n.icon.icon)}" fill="none" stroke="${a.image}" stroke-width="${OK(zq)}" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
42657
- S(VJ("icon", t), VJ("node", t), _J([], {
42662
+ S(HJ("icon", t), HJ("node", t), vJ([], {
42658
42663
  shape: "image",
42659
42664
  imageAspect: 0,
42660
42665
  points: "[]",
42661
- ...HJ,
42662
- image: EJ(e),
42666
+ ...UJ,
42667
+ image: DJ(e),
42663
42668
  opacity: a.glyphOpacity
42664
- }), LJ(o, b, y), void 0, {}, c);
42669
+ }), RJ(o, b, y), void 0, {}, c);
42665
42670
  }
42666
42671
  }
42667
42672
  }
@@ -42672,7 +42677,7 @@ function WJ(e, t = {}) {
42672
42677
  r.ref.name,
42673
42678
  String(r.ref.ordinal)
42674
42679
  ], a = AK(u, um(r.class)) || void 0, o = nq.inPort(O, u, a, tq.pill(a)), s = re(o), c = r.side ? rJ[r.side] : void 0, l = e.labels.find((e) => e.role === "pill" && e.port !== void 0 && e.port.node === t && e.port.name === r.ref.name && e.port.ordinal === r.ref.ordinal), f = l && !l.omitted ? l : void 0;
42675
- S(VJ("port", ...i), VJ("node", t), _J([], {
42680
+ S(HJ("port", ...i), HJ("node", t), vJ([], {
42676
42681
  rounded: 1,
42677
42682
  absoluteArcSize: 1,
42678
42683
  arcSize: r.pill.radius * 2,
@@ -42690,23 +42695,27 @@ function WJ(e, t = {}) {
42690
42695
  align: "center",
42691
42696
  whiteSpace: "nowrap",
42692
42697
  overflow: "visible",
42693
- spacingTop: f.bounds && TJ(f, xJ(f), r.pill.textRotation === -90 ? kJ(r.pill.bounds).x - kJ(f.bounds).x : kJ(r.pill.bounds).y - kJ(f.bounds).y),
42694
- fontFamily: hJ(f),
42695
- fontSize: xJ(f),
42698
+ spacingTop: f.bounds && EJ(f, SJ(f), r.pill.textRotation === -90 ? AJ(r.pill.bounds).x - AJ(f.bounds).x : AJ(r.pill.bounds).y - AJ(f.bounds).y),
42699
+ fontFamily: gJ(f),
42700
+ fontSize: SJ(f),
42696
42701
  ...ne(nq.inPort(O, u, a, AK("pill-label", a))),
42697
42702
  fontStyle: f.fontWeight === 700 ? 1 : void 0,
42698
42703
  horizontal: r.pill.textRotation === -90 ? 0 : void 0
42699
42704
  } : {}
42700
- }), PJ(MJ(g(r.pill.bounds), h(n.bounds)), b, r.side), f ? vJ(yJ(f)) : void 0, {}, fJ({
42701
- "pg-kind": "port",
42702
- "pg-id": Sn({
42703
- node: t,
42704
- name: r.ref.name,
42705
- ordinal: r.ref.ordinal
42706
- }),
42707
- "pg-node": t,
42708
- "pg-port": r.ref.name
42709
- }, d.nodes[t]?.ports.find((e) => e.name === r.ref.name && e.ordinal === r.ref.ordinal)?.meta));
42705
+ }), FJ(NJ(g(r.pill.bounds), h(n.bounds)), b, r.side), f ? yJ(bJ(f)) : void 0, {}, (() => {
42706
+ let e = d.nodes[t]?.ports.find((e) => e.name === r.ref.name && e.ordinal === r.ref.ordinal);
42707
+ return fJ({
42708
+ "pg-kind": "port",
42709
+ "pg-id": Sn({
42710
+ node: t,
42711
+ name: r.ref.name,
42712
+ ordinal: r.ref.ordinal
42713
+ }),
42714
+ "pg-node": t,
42715
+ "pg-port": r.ref.name,
42716
+ ...pJ(e?.class)
42717
+ }, e?.meta);
42718
+ })());
42710
42719
  }
42711
42720
  }
42712
42721
  let ge = new Map(e.links.map((e) => [e.id, e])), _e = (t) => YK(e, t);
@@ -42728,11 +42737,11 @@ function WJ(e, t = {}) {
42728
42737
  [`${t}Perimeter`]: 0
42729
42738
  });
42730
42739
  return a.pill && a.ref.anonymous !== !0 && a.side ? {
42731
- cell: VJ("port", n.node, n.name, String(n.ordinal)),
42740
+ cell: HJ("port", n.node, n.name, String(n.ordinal)),
42732
42741
  style: s(iJ(a.pill.bounds, o)),
42733
42742
  at: h(o)
42734
42743
  } : {
42735
- cell: VJ("node", n.node),
42744
+ cell: HJ("node", n.node),
42736
42745
  style: s(iJ(i.bounds, o)),
42737
42746
  at: h(o),
42738
42747
  ...a.ref.anonymous === !0 ? { anonymous: !0 } : {}
@@ -42748,7 +42757,7 @@ function WJ(e, t = {}) {
42748
42757
  }, xe = (t) => {
42749
42758
  let n = e.nodes[t.node]?.ports.find((e) => e.ref.node === t.node && e.ref.name === t.name && e.ref.ordinal === t.ordinal);
42750
42759
  if (n?.pill && n.ref.anonymous !== !0 && n.side) return {
42751
- cell: VJ("port", t.node, t.name, String(t.ordinal)),
42760
+ cell: HJ("port", t.node, t.name, String(t.ordinal)),
42752
42761
  box: g(n.pill.bounds),
42753
42762
  out: aJ[n.side]
42754
42763
  };
@@ -42757,7 +42766,7 @@ function WJ(e, t = {}) {
42757
42766
  if (n) return n;
42758
42767
  let r = e.nodes[t.node]?.bounds;
42759
42768
  return r ? {
42760
- cell: VJ("node", t.node),
42769
+ cell: HJ("node", t.node),
42761
42770
  box: g(r)
42762
42771
  } : void 0;
42763
42772
  }, Ce = (e, t, n, r, i, a, o) => {
@@ -42773,7 +42782,7 @@ function WJ(e, t = {}) {
42773
42782
  y: i.targetPoint.y,
42774
42783
  as: "targetPoint"
42775
42784
  }) : "");
42776
- _.push(gJ({
42785
+ _.push(_J({
42777
42786
  id: x(e),
42778
42787
  value: a?.value,
42779
42788
  style: n,
@@ -42790,7 +42799,7 @@ function WJ(e, t = {}) {
42790
42799
  as: "geometry"
42791
42800
  }, s + c + $q(a?.at)), o));
42792
42801
  }, we = e.links.filter((e) => e.technique !== "stub" && e.path && e.meshBus === void 0 && m(e)), Ee = /* @__PURE__ */ new Map(), De = (e, t) => {
42793
- let r = kJ(g(e.bounds));
42802
+ let r = AJ(g(e.bounds));
42794
42803
  if (o !== "on-run" || e.support?.kind !== "link-segment") return r;
42795
42804
  let i = t.path.segments[e.support.segment], a = t.path.segments[e.support.through ?? e.support.segment];
42796
42805
  if (i === void 0 || a === void 0) return r;
@@ -42812,16 +42821,16 @@ function WJ(e, t = {}) {
42812
42821
  ...s ? { spacing: Vq } : {},
42813
42822
  align: "center",
42814
42823
  verticalAlign: "middle",
42815
- fontFamily: hJ(e),
42816
- fontSize: xJ(e),
42824
+ fontFamily: gJ(e),
42825
+ fontSize: SJ(e),
42817
42826
  ...ne(Oe(e, c, i)),
42818
42827
  fontStyle: e.fontWeight === 700 ? 1 : void 0,
42819
42828
  ...r === "edge" ? e.textRotation === -90 ? {
42820
42829
  horizontal: 0,
42821
- spacingLeft: TJ(e, xJ(e))
42822
- } : { spacingTop: TJ(e, xJ(e)) } : {
42830
+ spacingLeft: EJ(e, SJ(e))
42831
+ } : { spacingTop: EJ(e, SJ(e)) } : {
42823
42832
  rotation: e.textRotation ? e.textRotation : void 0,
42824
- spacingTop: TJ(e, xJ(e))
42833
+ spacingTop: EJ(e, SJ(e))
42825
42834
  }
42826
42835
  };
42827
42836
  }, je = /* @__PURE__ */ new Map();
@@ -42857,12 +42866,12 @@ function WJ(e, t = {}) {
42857
42866
  let n = kL(t) === "overlay" ? ue("overlay") : ue("links"), r = _e(t), i = kL(t) === "overlay", o = ve(t.path.segments), s = nq.linkLine(O, r, i), l = k(s, "stroke");
42858
42867
  if (nK(e.document, t).length) {
42859
42868
  let e = nq.linkDot(O, r, i);
42860
- c((t) => D.peek(t, e).get("stroke") ?? OJ("stroke")) === l ? k(e, "stroke") : D.at(a, e);
42869
+ c((t) => D.peek(t, e).get("stroke") ?? kJ("stroke")) === l ? k(e, "stroke") : D.at(a, e);
42861
42870
  }
42862
42871
  let u = t.attachments?.from, d = t.attachments?.to, f = Gv(e, t, "from"), p = Gv(e, t, "to"), m = u ? ye("exit", u, f) : void 0, g = d ? ye("entry", d, p) : void 0, _ = i && u ? Se(u) : void 0, v = i && d ? Se(d) : void 0, y = o.map((e, n) => {
42863
42872
  let r = [...e.points];
42864
42873
  return n === 0 && m && (r[0] = m.at), n === o.length - 1 && g && (r[r.length - 1] = g.at), {
42865
- id: o.length === 1 ? VJ("link", w(t)) : VJ("link", w(t), String(n)),
42874
+ id: o.length === 1 ? HJ("link", w(t)) : HJ("link", w(t), String(n)),
42866
42875
  points: r,
42867
42876
  first: e.first,
42868
42877
  last: e.last
@@ -42871,10 +42880,10 @@ function WJ(e, t = {}) {
42871
42880
  if (o.forEach((e, r) => {
42872
42881
  let a = r === 0, c = r === o.length - 1, u = a ? m : void 0, d = c ? g : void 0, f = y[r].id, p = b && r === x ? {
42873
42882
  label: b,
42874
- at: JJ(y[r].points, De(b, t), Pe(b, t, y[r]))
42883
+ at: YJ(y[r].points, De(b, t), Pe(b, t, y[r]))
42875
42884
  } : void 0;
42876
42885
  p && Fe.add(p.label.id);
42877
- let h = e.points, _ = !(sJ(h) && sJ(y[r].points)) && oJ(h) && oJ(y[r].points), v = _J([], {
42886
+ let h = e.points, _ = !(sJ(h) && sJ(y[r].points)) && oJ(h) && oJ(y[r].points), v = vJ([], {
42878
42887
  edgeStyle: _ ? "orthogonalEdgeStyle" : "none",
42879
42888
  jettySize: _ ? 0 : void 0,
42880
42889
  rounded: 0,
@@ -42882,7 +42891,7 @@ function WJ(e, t = {}) {
42882
42891
  startArrow: "none",
42883
42892
  strokeColor: l,
42884
42893
  strokeWidth: L(t),
42885
- opacity: i ? Math.round(j(s, "stroke-opacity") * 100) : DJ(j(s, "stroke-opacity")),
42894
+ opacity: i ? Math.round(j(s, "stroke-opacity") * 100) : OJ(j(s, "stroke-opacity")),
42886
42895
  ...M(A(s, (e) => e.get("stroke-dasharray"))),
42887
42896
  ...u ? be(t, "from") : {},
42888
42897
  ...d ? be(t, "to") : {},
@@ -42896,7 +42905,7 @@ function WJ(e, t = {}) {
42896
42905
  sourcePoint: u ? void 0 : h[0],
42897
42906
  targetPoint: d ? void 0 : h[h.length - 1]
42898
42907
  }, p ? {
42899
- value: vJ(yJ(p.label)),
42908
+ value: yJ(bJ(p.label)),
42900
42909
  at: p.at
42901
42910
  } : void 0, T(t, o.length === 1 ? void 0 : {
42902
42911
  index: r,
@@ -42920,12 +42929,12 @@ function WJ(e, t = {}) {
42920
42929
  width: 4,
42921
42930
  height: 4
42922
42931
  };
42923
- S(VJ("overlayMark", w(t), e.end), e.host?.cell ?? ue("overlay"), _J(["ellipse"], {
42932
+ S(HJ("overlayMark", w(t), e.end), e.host?.cell ?? ue("overlay"), vJ(["ellipse"], {
42924
42933
  ...ae(nq.overlayEndpoint(O, r)),
42925
42934
  points: "[]",
42926
- ...HJ,
42927
- ...UJ
42928
- }), e.host ? MJ(i, e.host.box) : i);
42935
+ ...UJ,
42936
+ ...WJ
42937
+ }), e.host ? NJ(i, e.host.box) : i);
42929
42938
  }
42930
42939
  }
42931
42940
  }
@@ -42961,7 +42970,7 @@ function WJ(e, t = {}) {
42961
42970
  if (r === void 0) continue;
42962
42971
  let i = _e(ge.get(t.members[0]) ?? r), a = (e, t = {}, n) => {
42963
42972
  let a = nq.busLine(O, i, n);
42964
- return _J([], {
42973
+ return vJ([], {
42965
42974
  edgeStyle: e ? "orthogonalEdgeStyle" : "none",
42966
42975
  jettySize: e ? 0 : void 0,
42967
42976
  rounded: 0,
@@ -42976,13 +42985,13 @@ function WJ(e, t = {}) {
42976
42985
  }, o = (t) => {
42977
42986
  if (t.bar === void 0 || t.stubs === void 0) return [];
42978
42987
  let r = [], i = e.meshBuses?.find((e) => e.trunk?.buses.includes(t.id)), a = (a, o, s) => {
42979
- if (r.some((e) => jJ(e.at, a))) return;
42988
+ if (r.some((e) => MJ(e.at, a))) return;
42980
42989
  let c = o, l = Infinity;
42981
42990
  if (c === void 0) for (let r of t.ports) {
42982
42991
  let t = e.nodes[r.node]?.bounds, i = t ? Math.abs(t.x + t.width / 2 - n.x - a.x) : Infinity;
42983
42992
  i < l && (l = i, c = r);
42984
42993
  }
42985
- let u = (i?.trunk?.joins?.some((e) => jJ(h(e), a)) ? i.trunk.side : void 0) ?? t.side;
42994
+ let u = (i?.trunk?.joins?.some((e) => MJ(h(e), a)) ? i.trunk.side : void 0) ?? t.side;
42986
42995
  c !== void 0 && Se(c) !== void 0 && r.push({
42987
42996
  at: a,
42988
42997
  ref: c,
@@ -42995,9 +43004,9 @@ function WJ(e, t = {}) {
42995
43004
  let o = e.meshBuses?.find((e) => e.joined === t.id && e.riser?.to !== void 0);
42996
43005
  return o?.riser?.to !== void 0 && a(h(o.riser.to)), r.sort((e, t) => e.at.x - t.at.x || e.at.y - t.at.y), r.map((e, n) => ({
42997
43006
  ...e,
42998
- id: VJ("busJoint", t.id, String(n))
43007
+ id: HJ("busJoint", t.id, String(n))
42999
43008
  }));
43000
- }, s = o(t), c = (e, t, n, r) => e.cell.startsWith("pg-node~") ? FJ(t, e.box, n, r) : t, l = (e, n) => {
43009
+ }, s = o(t), c = (e, t, n, r) => e.cell.startsWith("pg-node~") ? IJ(t, e.box, n, r) : t, l = (e, n) => {
43001
43010
  let r = Se(t.ports.find((t) => t.node === e.node)), i = h(e.from), a = {
43002
43011
  x: i.x - 2,
43003
43012
  y: i.y - 2,
@@ -43007,9 +43016,9 @@ function WJ(e, t = {}) {
43007
43016
  return {
43008
43017
  pill: r,
43009
43018
  box: a,
43010
- mark: r ? c(r, MJ(a, r.box), n) : a
43019
+ mark: r ? c(r, NJ(a, r.box), n) : a
43011
43020
  };
43012
- }, u = mJ({}, pq(e, t)), d = (e, t) => e.find((e) => jJ(e.at, t))?.id;
43021
+ }, u = hJ({}, pq(e, t)), d = (e, t) => e.find((e) => MJ(e.at, t))?.id;
43013
43022
  for (let e of s) {
43014
43023
  let n = Se(e.ref), r = {
43015
43024
  x: e.at.x - 1,
@@ -43017,15 +43026,15 @@ function WJ(e, t = {}) {
43017
43026
  width: 2,
43018
43027
  height: 2
43019
43028
  };
43020
- S(e.id, n.cell, _J(["ellipse"], {
43029
+ S(e.id, n.cell, vJ(["ellipse"], {
43021
43030
  fillColor: "none",
43022
43031
  strokeColor: "none",
43023
43032
  points: "[]",
43024
- ...HJ,
43025
- ...UJ
43026
- }), c(n, MJ(r, n.box), e.side, (() => {
43033
+ ...UJ,
43034
+ ...WJ
43035
+ }), c(n, NJ(r, n.box), e.side, (() => {
43027
43036
  let r = t.stubs?.find((t) => t.node === e.stub), i = r === void 0 ? void 0 : l(r, t.side).mark;
43028
- return i !== void 0 && RJ(i) && n.cell.startsWith("pg-node~") ? e.side === "left" || e.side === "right" ? i.fraction.y : i.fraction.x : void 0;
43037
+ return i !== void 0 && zJ(i) && n.cell.startsWith("pg-node~") ? e.side === "left" || e.side === "right" ? i.fraction.y : i.fraction.x : void 0;
43029
43038
  })()));
43030
43039
  }
43031
43040
  let f = (e) => ({
@@ -43039,8 +43048,8 @@ function WJ(e, t = {}) {
43039
43048
  ...t ? f("entry") : {}
43040
43049
  });
43041
43050
  for (let e of t.stubs) {
43042
- let n = t.ports.find((t) => t.node === e.node), r = ye("exit", n, e.from), i = Se(n), o = h(e.to), { mark: c } = l(e, t.side), p = r && i && r.cell === i.cell && RJ(c) ? IJ("exit", c) : void 0, m = [r?.at ?? h(e.from), o], g = d(s, o);
43043
- Ce(VJ("busStub", t.id, e.node), ue("overlay"), a(!1, {
43051
+ let n = t.ports.find((t) => t.node === e.node), r = ye("exit", n, e.from), i = Se(n), o = h(e.to), { mark: c } = l(e, t.side), p = r && i && r.cell === i.cell && zJ(c) ? LJ("exit", c) : void 0, m = [r?.at ?? h(e.from), o], g = d(s, o);
43052
+ Ce(HJ("busStub", t.id, e.node), ue("overlay"), a(!1, {
43044
43053
  ...r?.style ?? {},
43045
43054
  ...p,
43046
43055
  ...g ? f("entry") : {}
@@ -43049,18 +43058,18 @@ function WJ(e, t = {}) {
43049
43058
  target: g,
43050
43059
  sourcePoint: r ? void 0 : m[0],
43051
43060
  targetPoint: g ? void 0 : m[1]
43052
- }, void 0, u), S(VJ("busMark", t.id, e.node), i?.cell ?? ue("overlay"), _J(["ellipse"], {
43061
+ }, void 0, u), S(HJ("busMark", t.id, e.node), i?.cell ?? ue("overlay"), vJ(["ellipse"], {
43053
43062
  ...ae(nq.overlayEndpoint(O, um(t.class))),
43054
43063
  points: "[]",
43055
- ...HJ,
43056
- ...UJ
43064
+ ...UJ,
43065
+ ...WJ
43057
43066
  }), c);
43058
43067
  }
43059
43068
  let _ = [];
43060
43069
  for (let e = 0; e + 1 < s.length; e++) {
43061
43070
  let n = s[e], r = s[e + 1];
43062
43071
  _.push({
43063
- id: VJ("bus", t.id, String(e)),
43072
+ id: HJ("bus", t.id, String(e)),
43064
43073
  points: [n.at, r.at]
43065
43074
  }), Ce(_[e].id, ue("overlay"), a(!1, p(n.id, r.id)), [n.at, r.at], {
43066
43075
  source: n.id,
@@ -43069,7 +43078,7 @@ function WJ(e, t = {}) {
43069
43078
  }
43070
43079
  if (t.riser?.from !== void 0 && t.riser.to !== void 0) {
43071
43080
  let n = [h(t.riser.from), h(t.riser.to)], r = e.meshBuses?.find((e) => e.id === t.joined), i = d(s, n[0]), c = r ? d(o(r), n[1]) : void 0;
43072
- Ce(VJ("busRiser", t.id), ue("overlay"), a(!1, p(i, c), "riser"), n, {
43081
+ Ce(HJ("busRiser", t.id), ue("overlay"), a(!1, p(i, c), "riser"), n, {
43073
43082
  source: i,
43074
43083
  target: c,
43075
43084
  sourcePoint: i ? void 0 : n[0],
@@ -43084,7 +43093,7 @@ function WJ(e, t = {}) {
43084
43093
  });
43085
43094
  for (let e = 0; e + 1 < v.length; e++) {
43086
43095
  let n = [h(v[e]), h(v[e + 1])], i = r[e], o = r[e + 1];
43087
- Ce(VJ("busTrunk", t.id, String(e)), ue("overlay"), a(!1, p(i, o), "trunk"), n, {
43096
+ Ce(HJ("busTrunk", t.id, String(e)), ue("overlay"), a(!1, p(i, o), "trunk"), n, {
43088
43097
  source: i,
43089
43098
  target: o,
43090
43099
  sourcePoint: i ? void 0 : n[0],
@@ -43094,14 +43103,14 @@ function WJ(e, t = {}) {
43094
43103
  }
43095
43104
  let y = e.labels.find((e) => e.id === t.label);
43096
43105
  if (y !== void 0 && !y.omitted && y.bounds !== void 0) {
43097
- let e = kJ(g(y.bounds)), n = (t) => {
43106
+ let e = AJ(g(y.bounds)), n = (t) => {
43098
43107
  let n = Kq(e, {
43099
43108
  from: t.points[0],
43100
43109
  to: t.points[1]
43101
43110
  });
43102
43111
  return Math.hypot(e.x - n.x, e.y - n.y);
43103
43112
  }, r = _.reduce((e, t) => e === void 0 || n(t) < n(e) ? t : e, void 0);
43104
- E(VJ("busLabel", t.id), r?.id ?? ue("labels"), y, g(y.bounds), ne(se(AK("link-label", "mesh-bus-label"), y.bounds, um(t.class))), void 0, P(kJ(y.bounds)), r === void 0 ? void 0 : JJ(r.points, e));
43113
+ E(HJ("busLabel", t.id), r?.id ?? ue("labels"), y, g(y.bounds), ne(se(AK("link-label", "mesh-bus-label"), y.bounds, um(t.class))), void 0, P(AJ(y.bounds)), r === void 0 ? void 0 : YJ(r.points, e));
43105
43114
  }
43106
43115
  }
43107
43116
  for (let t of e.labels) {
@@ -43111,14 +43120,14 @@ function WJ(e, t = {}) {
43111
43120
  if (t.owner.kind !== "bundle") continue;
43112
43121
  let e = t.owner.id;
43113
43122
  if (!we.some((t) => t.bundle === e)) continue;
43114
- E(VJ("linkLabel", t.id), ue("labels"), t, g(t.bounds), ne(Oe(t, !0, void 0)), void 0, P(kJ(t.bounds)));
43123
+ E(HJ("linkLabel", t.id), ue("labels"), t, g(t.bounds), ne(Oe(t, !0, void 0)), void 0, P(AJ(t.bounds)));
43115
43124
  continue;
43116
43125
  }
43117
- let i = r[Ne(t, n, r)], a = De(t, n), o = JJ(i.points, a, Pe(t, n, i)), s = t.owner.kind === "barCross" ? VJ("linkLabel", w(n), t.owner.node) : VJ("linkLabel", w(n));
43118
- _.push(gJ({
43126
+ let i = r[Ne(t, n, r)], a = De(t, n), o = YJ(i.points, a, Pe(t, n, i)), s = t.owner.kind === "barCross" ? HJ("linkLabel", w(n), t.owner.node) : HJ("linkLabel", w(n));
43127
+ _.push(_J({
43119
43128
  id: x(s),
43120
- value: vJ(yJ(t)),
43121
- style: _J(["edgeLabel"], {
43129
+ value: yJ(bJ(t)),
43130
+ style: vJ(["edgeLabel"], {
43122
43131
  resizable: 0,
43123
43132
  points: "[]",
43124
43133
  ...ke(t, a, "child", n)
@@ -43131,17 +43140,17 @@ function WJ(e, t = {}) {
43131
43140
  y: o.y,
43132
43141
  relative: 1,
43133
43142
  as: "geometry"
43134
- }, $q(o) || void 0), mJ({
43143
+ }, $q(o) || void 0), hJ({
43135
43144
  "pg-kind": "link-label",
43136
43145
  "pg-of": w(n)
43137
43146
  }, dq(t))));
43138
43147
  }
43139
43148
  if (e.legend) {
43140
43149
  let t = g(e.legend.bounds);
43141
- S(VJ("legend"), ue("legend"), _J(["group"], { points: "[]" }), t);
43150
+ S(HJ("legend"), ue("legend"), vJ(["group"], { points: "[]" }), t);
43142
43151
  for (let t of e.legend.entries) {
43143
- let n = e.labels.find((e) => e.id === t.label), r = n && !n.omitted && n.bounds ? n : void 0, i = r ? Zq(g(t.swatch), g(r.bounds)) : g(t.swatch), a = MJ(i, h(e.legend.bounds));
43144
- S(VJ("legendRow", t.id), VJ("legend"), _J([], {
43152
+ let n = e.labels.find((e) => e.id === t.label), r = n && !n.omitted && n.bounds ? n : void 0, i = r ? Zq(g(t.swatch), g(r.bounds)) : g(t.swatch), a = NJ(i, h(e.legend.bounds));
43153
+ S(HJ("legendRow", t.id), HJ("legend"), vJ([], {
43145
43154
  fillColor: "none",
43146
43155
  strokeColor: "none",
43147
43156
  points: "[]",
@@ -43151,28 +43160,28 @@ function WJ(e, t = {}) {
43151
43160
  whiteSpace: "nowrap",
43152
43161
  overflow: "visible",
43153
43162
  spacingLeft: g(r.bounds).x - i.x - Hq,
43154
- spacingTop: TJ(r, xJ(r), kJ(i).y - kJ(g(r.bounds)).y),
43155
- fontFamily: hJ(r),
43156
- fontSize: xJ(r),
43157
- ...ne(nq.inLegend(O, t.kind, t.key, AK("legend-label", tq.halo(rK(fe, kJ(r.bounds)))))),
43163
+ spacingTop: EJ(r, SJ(r), AJ(i).y - AJ(g(r.bounds)).y),
43164
+ fontFamily: gJ(r),
43165
+ fontSize: SJ(r),
43166
+ ...ne(nq.inLegend(O, t.kind, t.key, AK("legend-label", tq.halo(rK(fe, AJ(r.bounds)))))),
43158
43167
  fontStyle: r.fontWeight === 700 ? 1 : void 0
43159
43168
  } : {}
43160
- }), a, r ? vJ(yJ(r)) : void 0);
43161
- let o = MJ(g(t.swatch), i), c = eq(t.kind, t.key), u = (e) => nq.inLegend(O, t.kind, t.key, e);
43169
+ }), a, r ? yJ(bJ(r)) : void 0);
43170
+ let o = NJ(g(t.swatch), i), c = eq(t.kind, t.key), u = (e) => nq.inLegend(O, t.kind, t.key, e);
43162
43171
  if (t.kind === "line") {
43163
43172
  let n = u(tq.linkLine(c, Tm(e, t.key)));
43164
- S(VJ("legendSwatch", t.id), VJ("legendRow", t.id), _J([], {
43173
+ S(HJ("legendSwatch", t.id), HJ("legendRow", t.id), vJ([], {
43165
43174
  shape: "line",
43166
43175
  points: "[]",
43167
- ...HJ,
43176
+ ...UJ,
43168
43177
  strokeColor: k(n, "stroke"),
43169
43178
  strokeWidth: t.strokeWidth ?? I.path,
43170
- opacity: DJ(j(n, "stroke-opacity")),
43179
+ opacity: OJ(j(n, "stroke-opacity")),
43171
43180
  ...M(A(n, (e) => e.get("stroke-dasharray")))
43172
43181
  }), o);
43173
43182
  } else if (t.kind === "port") {
43174
43183
  let e = u(tq.pill(c)), n = re(e);
43175
- S(VJ("legendSwatch", t.id), VJ("legendRow", t.id), _J([], {
43184
+ S(HJ("legendSwatch", t.id), HJ("legendRow", t.id), vJ([], {
43176
43185
  rounded: 1,
43177
43186
  absoluteArcSize: 1,
43178
43187
  arcSize: (t.radius ?? Ze.pill) * 2,
@@ -43180,20 +43189,20 @@ function WJ(e, t = {}) {
43180
43189
  strokeColor: n.strokeColor,
43181
43190
  strokeWidth: I.pill,
43182
43191
  points: "[]",
43183
- ...HJ,
43192
+ ...UJ,
43184
43193
  opacity: n.opacity,
43185
43194
  ...M(A(e, (e) => e.get("stroke-dasharray")))
43186
43195
  }), o);
43187
43196
  } else if (t.icon) {
43188
43197
  let e = o;
43189
- S(VJ("legendBody", t.id), VJ("legendRow", t.id), _J([], {
43198
+ S(HJ("legendBody", t.id), HJ("legendRow", t.id), vJ([], {
43190
43199
  rounded: 1,
43191
43200
  absoluteArcSize: 1,
43192
43201
  arcSize: eV(l, 2) * 2,
43193
43202
  ...re(u(tq.nodeBody(c, Me(c, p)))),
43194
43203
  strokeWidth: I.pill,
43195
43204
  points: "[]",
43196
- ...HJ
43205
+ ...UJ
43197
43206
  }), {
43198
43207
  x: e.x - 2,
43199
43208
  y: e.y - 2,
@@ -43202,22 +43211,22 @@ function WJ(e, t = {}) {
43202
43211
  });
43203
43212
  let n = ie(u(AK("icon-tile", c)), u(AK("node-icon", c))), r = s === "cisco19" ? Yq[Vi(t.icon)] : void 0;
43204
43213
  if (r) {
43205
- r.kind === "silhouette" && eJ(o) && S(VJ("legendTile", t.id), VJ("legendRow", t.id), _J([], {
43214
+ r.kind === "silhouette" && eJ(o) && S(HJ("legendTile", t.id), HJ("legendRow", t.id), vJ([], {
43206
43215
  rounded: 1,
43207
43216
  absoluteArcSize: 1,
43208
43217
  arcSize: l.radii.tile * 2,
43209
43218
  fillColor: n.tile.fill,
43210
43219
  strokeColor: n.tile.stroke,
43211
43220
  points: "[]",
43212
- ...HJ,
43221
+ ...UJ,
43213
43222
  opacity: n.tileOpacity
43214
43223
  }), o);
43215
43224
  let e = nJ(o, r);
43216
- e && S(VJ("legendSwatch", t.id), VJ("legendRow", t.id), _J([], {
43225
+ e && S(HJ("legendSwatch", t.id), HJ("legendRow", t.id), vJ([], {
43217
43226
  sketch: 0,
43218
43227
  aspect: "fixed",
43219
43228
  points: "[]",
43220
- ...HJ,
43229
+ ...UJ,
43221
43230
  shape: Xq(r),
43222
43231
  ...r.kind === "badge" ? { prIcon: r.shape } : {},
43223
43232
  fillColor: r.kind === "badge" ? n.tile.fill : n.glyph,
@@ -43225,25 +43234,25 @@ function WJ(e, t = {}) {
43225
43234
  opacity: r.kind === "badge" ? n.tileOpacity : n.glyphOpacity
43226
43235
  }), e);
43227
43236
  } else {
43228
- eJ(o) && S(VJ("legendTile", t.id), VJ("legendRow", t.id), _J([], {
43237
+ eJ(o) && S(HJ("legendTile", t.id), HJ("legendRow", t.id), vJ([], {
43229
43238
  rounded: 1,
43230
43239
  absoluteArcSize: 1,
43231
43240
  arcSize: l.radii.tile * 2,
43232
43241
  fillColor: n.tile.fill,
43233
43242
  strokeColor: n.tile.stroke,
43234
43243
  points: "[]",
43235
- ...HJ,
43244
+ ...UJ,
43236
43245
  opacity: n.tileOpacity
43237
43246
  }), o);
43238
43247
  let e = tJ(o);
43239
43248
  if (e) {
43240
43249
  let r = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${Bi(t.icon)}" fill="none" stroke="${n.image}" stroke-width="${OK(zq)}" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
43241
- S(VJ("legendSwatch", t.id), VJ("legendRow", t.id), _J([], {
43250
+ S(HJ("legendSwatch", t.id), HJ("legendRow", t.id), vJ([], {
43242
43251
  shape: "image",
43243
43252
  imageAspect: 0,
43244
43253
  points: "[]",
43245
- ...HJ,
43246
- image: EJ(r),
43254
+ ...UJ,
43255
+ image: DJ(r),
43247
43256
  opacity: n.glyphOpacity
43248
43257
  }), e);
43249
43258
  }
@@ -43272,14 +43281,14 @@ function WJ(e, t = {}) {
43272
43281
  math: 0,
43273
43282
  shadow: 0,
43274
43283
  background: de
43275
- }, $("root", {}, gJ({ id: x("0") }, void 0, fJ({ "pg-schema": "1" }, d.meta)) + Le + _.map((e) => typeof e == "string" ? e : e()).join(""))), ze = d.title ?? "portograph", Be = D.unmapped();
43284
+ }, $("root", {}, _J({ id: x("0") }, void 0, fJ({ "pg-schema": "1" }, d.meta)) + Le + _.map((e) => typeof e == "string" ? e : e()).join(""))), ze = d.title ?? "portograph", Be = D.unmapped();
43276
43285
  Be.length && t.onDiagnostic?.({
43277
43286
  stage: "render",
43278
43287
  severity: "warning",
43279
43288
  code: "DRAWIO_CSS_UNMAPPED",
43280
43289
  message: `draw.io cannot carry ${Be.length} part(s) of css:, which the SVG applies: ${Be.join("; ")}`
43281
43290
  });
43282
- let Ve = e.labels.filter((e) => !e.omitted && e.bounds !== void 0 && yJ(e).length > 1 && e.lineHeight !== void 0 && Math.abs(e.lineHeight - SJ(xJ(e))) > Bq);
43291
+ let Ve = e.labels.filter((e) => !e.omitted && e.bounds !== void 0 && bJ(e).length > 1 && e.lineHeight !== void 0 && Math.abs(e.lineHeight - CJ(SJ(e))) > Bq);
43283
43292
  return Ve.length && t.onDiagnostic?.({
43284
43293
  stage: "render",
43285
43294
  severity: "warning",
@@ -43290,8 +43299,8 @@ function WJ(e, t = {}) {
43290
43299
  name: ze
43291
43300
  }, Re)) + "\n";
43292
43301
  }
43293
- var GJ = (e) => e.slice(1).map((t, n) => Math.hypot(t.x - e[n].x, t.y - e[n].y));
43294
- function KJ(e, t, n) {
43302
+ var KJ = (e) => e.slice(1).map((t, n) => Math.hypot(t.x - e[n].x, t.y - e[n].y));
43303
+ function qJ(e, t, n) {
43295
43304
  let r = t[0] ?? 0, i = 0, a = 1;
43296
43305
  for (; n >= Math.round(i + r) && a < e.length - 1;) i += r, r = t[a], a += 1;
43297
43306
  return {
@@ -43300,15 +43309,15 @@ function KJ(e, t, n) {
43300
43309
  span: r
43301
43310
  };
43302
43311
  }
43303
- function qJ(e, t) {
43304
- let n = GJ(e), r = n.reduce((e, t) => e + t, 0), i = Math.round((t.x / 2 + .5) * r), { index: a, walked: o, span: s } = KJ(e, n, i), c = e[a - 1], l = e[a], u = l.x - c.x, d = l.y - c.y, f = s === 0 ? 0 : (i - o) / s, p = s === 0 ? 0 : d / s, m = s === 0 ? 0 : u / s;
43312
+ function JJ(e, t) {
43313
+ let n = KJ(e), r = n.reduce((e, t) => e + t, 0), i = Math.round((t.x / 2 + .5) * r), { index: a, walked: o, span: s } = qJ(e, n, i), c = e[a - 1], l = e[a], u = l.x - c.x, d = l.y - c.y, f = s === 0 ? 0 : (i - o) / s, p = s === 0 ? 0 : d / s, m = s === 0 ? 0 : u / s;
43305
43314
  return {
43306
43315
  x: c.x + u * f + p * t.y + (t.offset?.x ?? 0),
43307
43316
  y: c.y + d * f - m * t.y + (t.offset?.y ?? 0)
43308
43317
  };
43309
43318
  }
43310
- function JJ(e, t, n) {
43311
- let r = GJ(e), i = r.reduce((e, t) => e + t, 0), a = e[0] ?? t;
43319
+ function YJ(e, t, n) {
43320
+ let r = KJ(e), i = r.reduce((e, t) => e + t, 0), a = e[0] ?? t;
43312
43321
  if (i === 0) return {
43313
43322
  x: 0,
43314
43323
  y: 0,
@@ -43348,7 +43357,7 @@ function JJ(e, t, n) {
43348
43357
  }
43349
43358
  let g = h ?? m;
43350
43359
  if (g.left <= Bq) return g.label;
43351
- let _ = qJ(e, g.label);
43360
+ let _ = JJ(e, g.label);
43352
43361
  return {
43353
43362
  ...g.label,
43354
43363
  offset: {
@@ -43357,4 +43366,4 @@ function JJ(e, t, n) {
43357
43366
  }
43358
43367
  };
43359
43368
  }
43360
- export { oa as ALIGNMENT_MAX_GROWTH, IC as ALL_DIRECTIONS, Ki as BAR_PADDING, lC as BundleFeasibilityError, rt as CANVAS_MARGIN, Gi as CARD_CONTENT_GEOMETRY, p as COMMAND_DEADLINE_MS, AV as CommandDeadlineError, I as DEFAULT_STROKE_WIDTHS, qB as DEFAULT_THEME_ID, FC as DIRECTION_BITS, f as EXIT, DV as ElkDeadlineError, UE as FINAL_STAGES, bt as FONT_FAMILY, ZA as GROUP_LABEL_GEOMETRY, Fe as LEGEND_DEFAULT_CLASS, fm as LEGEND_GEOMETRY, Ah as LINK_LABEL_CODES, W as LINK_LABEL_GEOMETRY, zi as NETWORK_ICON_PATHS, Le as NETWORK_LINK_CLASSES, Se as NETWORK_NODE_CLASSES, Ri as NETWORK_NODE_ICONS, Be as NETWORK_PORT_LOOPBACK, ze as NETWORK_PORT_ROLES, He as NETWORK_PORT_STATUS, We as NETWORK_THEME, Wi as NODE_CONTENT_GEOMETRY, iV as OVERLAY_CLASSES, et as OVERLAY_ENDPOINT_RADIUS, ah as OVERLAY_LABEL_DENSITY, sF as OVERLAY_PILL_CLEARANCE, Vd as ParseError, JH as ROUTE_BUDGET_MS, HC as ROUTE_PARAMETERS, KH as ROUTE_REQUEST, qH as ROUTE_RESPONSE, tV as ResolveError, YH as RouteDeadlineError, XH as RouteSession, RC as SHAPE_BUFFER_DISTANCE, FN as SIDE_TIE_ORDER, qL as STRAIGHT_PATH_CLEARANCE, RH as SkeletonError, Vf as TERMINAL_TRIM, GB as THEMES, KB as THEME_IDS, MV as UNBOUNDED_BUDGET, h as UsageError, d as VERBS, af as alignFlanks, ca as alignmentAllowance, lm as allocateGapRuns, bO as allocateLanes, QM as bands, nv as barLink, kv as bars, hw as batchRequest, VH as bundles, TS as centre, Gx as centreDraft, xw as checkpointsHonoured, qe as classDisplayLabel, Je as classOrder, la as contentInsets, TV as createBrowserElkFactory, QH as createBrowserRouteFactory, jV as createBudget, Zb as createCentreBudget, ue as createLayoutModel, $H as createRouteFactory, wV as createWorkerElkAttempt, Fw as crossedTiers, bm as diagramBounds, WJ as drawio, ym as drawnBoxes, EV as elkDeadlineMs, Sn as endpointId, ef as expectedFlankPath, nR as expectedRowPath, QL as facingPair, JB as findTheme, Qd as flankPair, $d as flankPathCandidate, of as flanks, te as formatDiagnostic, ne as formatDiagnosticJson, re as formatStatus, ce as frameSubtreeCells, VE as freezePortTopology, le as groupNodeIds, y as helpText, Ui as iconClass, Vi as iconKey, Bi as iconPath, m as isVerb, uD as laneWidth, HO as lanes, EG as layout, jm as legendBoxes, eV as legendKeyRadius, Dm as legendRequired, Em as legendVariants, Cn as linkIds, tg as linkLabels, xq as linkVisible, Uw as lostPlannedRun, ra as measureNodeContent, Tt as measurePortPill, Ct as measureText, tK as migrate, eK as migrateWithDiagnostics, Ce as nodeClassPaint, Ge as nodeClassStyle, Wf as nodeClearance, DR as optimizeBundleOrder, M as orderedGroupIds, N as orderedNodeIds, lF as overlayBlockers, oh as overlayDensity, sh as overlayLabelsSuppressed, NF as overlayPath, sa as ownSideWidth, Am as paintedSwatch, ZG as parse, k as parseCommand, XG as parseWithDiagnostics, aa as placeNodeContent, Pi as placePortPill, KC as placementRuns, QC as planRoute, JC as plannedRunsOf, Ni as portAnchor, q as portKey, Fi as portPitch, Ve as portRolePaint, gm as portRoles, Bw as preRoute, lz as prepareBundleGeometry, km as produceLegend, Xh as produceLinkLabels, Dn as readCacheCounts, Ov as rebuildBarDrops, DC as rebuildBundlePaths, tf as rebuildFlankPaths, XD as rebuildLaneExtents, U as rebuildNodeGeometry, jC as rebuildRegionGeometry, JP as rebuildRegions, aR as rebuildRowPaths, Rq as render, zw as reservationConflicts, Lw as reservedRuns, bV as resolve, yV as resolveBeforeExpansion, Hi as resolveNodeIcon, WE as restoreFinalLayout, HE as restoreLayoutModel, rU as route, ep as routeObstacles, eU as routeRemainders, $L as rowPathCandidate, ER as rows, OV as runElkAttempt, SU as score, cD as selectAnchorTier, de as serializeLayoutModel, fe as serializeLayoutSnapshot, mv as shapeBars, j as sidecarPaths, BN as sidesOne, qA as sidesTwo, ww as simplify, ua as sizeNodes, BH as skeleton, zS as solveTierGaps, XC as stemCheckpoint, kw as stitchPath, Pw as stitchPaths, tR as straightCorridorClear, Iw as stubCandidate, GH as systemRouteClock, YB as themeById, QB as themeLinkClass, $B as themePortRole, ZB as themeWashFill, zN as tiedPortComponents, Yf as trimChain, ie as unsupportedMessage, VO as validateLanes, eg as validateLinkLabels, Zw as validateRoutedPaths, XE as withLayoutMutation, ZH as withRouteSession };
43369
+ export { oa as ALIGNMENT_MAX_GROWTH, IC as ALL_DIRECTIONS, Ki as BAR_PADDING, lC as BundleFeasibilityError, rt as CANVAS_MARGIN, Gi as CARD_CONTENT_GEOMETRY, p as COMMAND_DEADLINE_MS, AV as CommandDeadlineError, I as DEFAULT_STROKE_WIDTHS, qB as DEFAULT_THEME_ID, FC as DIRECTION_BITS, f as EXIT, DV as ElkDeadlineError, UE as FINAL_STAGES, bt as FONT_FAMILY, ZA as GROUP_LABEL_GEOMETRY, Fe as LEGEND_DEFAULT_CLASS, fm as LEGEND_GEOMETRY, Ah as LINK_LABEL_CODES, W as LINK_LABEL_GEOMETRY, zi as NETWORK_ICON_PATHS, Le as NETWORK_LINK_CLASSES, Se as NETWORK_NODE_CLASSES, Ri as NETWORK_NODE_ICONS, Be as NETWORK_PORT_LOOPBACK, ze as NETWORK_PORT_ROLES, He as NETWORK_PORT_STATUS, We as NETWORK_THEME, Wi as NODE_CONTENT_GEOMETRY, iV as OVERLAY_CLASSES, et as OVERLAY_ENDPOINT_RADIUS, ah as OVERLAY_LABEL_DENSITY, sF as OVERLAY_PILL_CLEARANCE, Vd as ParseError, JH as ROUTE_BUDGET_MS, HC as ROUTE_PARAMETERS, KH as ROUTE_REQUEST, qH as ROUTE_RESPONSE, tV as ResolveError, YH as RouteDeadlineError, XH as RouteSession, RC as SHAPE_BUFFER_DISTANCE, FN as SIDE_TIE_ORDER, qL as STRAIGHT_PATH_CLEARANCE, RH as SkeletonError, Vf as TERMINAL_TRIM, GB as THEMES, KB as THEME_IDS, MV as UNBOUNDED_BUDGET, h as UsageError, d as VERBS, af as alignFlanks, ca as alignmentAllowance, lm as allocateGapRuns, bO as allocateLanes, QM as bands, nv as barLink, kv as bars, hw as batchRequest, VH as bundles, TS as centre, Gx as centreDraft, xw as checkpointsHonoured, qe as classDisplayLabel, Je as classOrder, la as contentInsets, TV as createBrowserElkFactory, QH as createBrowserRouteFactory, jV as createBudget, Zb as createCentreBudget, ue as createLayoutModel, $H as createRouteFactory, wV as createWorkerElkAttempt, Fw as crossedTiers, bm as diagramBounds, GJ as drawio, ym as drawnBoxes, EV as elkDeadlineMs, Sn as endpointId, ef as expectedFlankPath, nR as expectedRowPath, QL as facingPair, JB as findTheme, Qd as flankPair, $d as flankPathCandidate, of as flanks, te as formatDiagnostic, ne as formatDiagnosticJson, re as formatStatus, ce as frameSubtreeCells, VE as freezePortTopology, le as groupNodeIds, y as helpText, Ui as iconClass, Vi as iconKey, Bi as iconPath, m as isVerb, uD as laneWidth, HO as lanes, EG as layout, jm as legendBoxes, eV as legendKeyRadius, Dm as legendRequired, Em as legendVariants, Cn as linkIds, tg as linkLabels, xq as linkVisible, Uw as lostPlannedRun, ra as measureNodeContent, Tt as measurePortPill, Ct as measureText, tK as migrate, eK as migrateWithDiagnostics, Ce as nodeClassPaint, Ge as nodeClassStyle, Wf as nodeClearance, DR as optimizeBundleOrder, M as orderedGroupIds, N as orderedNodeIds, lF as overlayBlockers, oh as overlayDensity, sh as overlayLabelsSuppressed, NF as overlayPath, sa as ownSideWidth, Am as paintedSwatch, ZG as parse, k as parseCommand, XG as parseWithDiagnostics, aa as placeNodeContent, Pi as placePortPill, KC as placementRuns, QC as planRoute, JC as plannedRunsOf, Ni as portAnchor, q as portKey, Fi as portPitch, Ve as portRolePaint, gm as portRoles, Bw as preRoute, lz as prepareBundleGeometry, km as produceLegend, Xh as produceLinkLabels, Dn as readCacheCounts, Ov as rebuildBarDrops, DC as rebuildBundlePaths, tf as rebuildFlankPaths, XD as rebuildLaneExtents, U as rebuildNodeGeometry, jC as rebuildRegionGeometry, JP as rebuildRegions, aR as rebuildRowPaths, Rq as render, zw as reservationConflicts, Lw as reservedRuns, bV as resolve, yV as resolveBeforeExpansion, Hi as resolveNodeIcon, WE as restoreFinalLayout, HE as restoreLayoutModel, rU as route, ep as routeObstacles, eU as routeRemainders, $L as rowPathCandidate, ER as rows, OV as runElkAttempt, SU as score, cD as selectAnchorTier, de as serializeLayoutModel, fe as serializeLayoutSnapshot, mv as shapeBars, j as sidecarPaths, BN as sidesOne, qA as sidesTwo, ww as simplify, ua as sizeNodes, BH as skeleton, zS as solveTierGaps, XC as stemCheckpoint, kw as stitchPath, Pw as stitchPaths, tR as straightCorridorClear, Iw as stubCandidate, GH as systemRouteClock, YB as themeById, QB as themeLinkClass, $B as themePortRole, ZB as themeWashFill, zN as tiedPortComponents, Yf as trimChain, ie as unsupportedMessage, VO as validateLanes, eg as validateLinkLabels, Zw as validateRoutedPaths, XE as withLayoutMutation, ZH as withRouteSession };
@@ -147,8 +147,8 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
147
147
  `)}var gq=`pg-overlay-mask`,_q=`pg-line-mask`;function vq(e,t){let n=2166136261;for(let e=0;e<t.length;e++)n=Math.imul(n^t.charCodeAt(e),16777619)>>>0;return`${e}-${n.toString(16).padStart(8,`0`)}`}var yq=e=>e.strokeWidth??F.node,bq=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),xq=(e,t,n)=>`${e}.${t}#${n}`;function Sq(e,t){let n=e.document.links[t.sourceIndex]?.class;return n===``?void 0:n}function Cq(e,t,n){let r=jL(t);if(n.layers)return n.layers.includes(r);if(r!==`overlay`)return!0;let i=Sq(e,t);return i===void 0||e.document.overlays?.[i]!==`hidden`}function wq(e){let t=[];for(let n of XK(e)){t.push(`M${AK(e[n.first].from.x)} ${AK(e[n.first].from.y)}`);for(let r of e.slice(n.first,n.last+1))t.push(`L${AK(r.to.x)} ${AK(r.to.y)}`)}return t.join(` `)}function Tq(e,t){return e?.mergeRuns?e.mergeRuns.filter(e=>e.members.includes(t.id)).flatMap(e=>e.path.segments):[]}function Eq(e,t){if(!t.length)return[...e.path?.segments??[]];let n=[];for(let r of e.path?.segments??[]){let e=Math.abs(r.to.x-r.from.x)<=R,i=Math.abs(r.to.y-r.from.y)<=R,a=t=>e?t.y:t.x,o=t=>e?t.x:t.y,s=!e&&!i?[]:t.filter(t=>(e?Math.abs(t.to.x-t.from.x)<=1e-7:Math.abs(t.to.y-t.from.y)<=1e-7)&&Math.abs(o(t.from)-o(r.from))<=1e-7).map(e=>[Math.min(a(e.from),a(e.to)),Math.max(a(e.from),a(e.to))]).sort((e,t)=>e[0]-t[0]);if(!s.length){n.push(r);continue}let c=a(r.to)>=a(r.from),l=Math.min(a(r.from),a(r.to)),u=Math.max(a(r.from),a(r.to)),d=t=>e?{x:o(r.from),y:t}:{x:t,y:o(r.from)},f=l,p=[];for(let[e,t]of s)if(e>f+1e-7&&p.push([f,Math.min(e,u)]),f=Math.max(f,t),f>=u-1e-7)break;f<u-1e-7&&p.push([f,u]);for(let[e,t]of p)t-e<=1e-7||n.push({...r,from:d(c?e:t),to:d(c?t:e)})}return n}function Dq(e){return Tt(``,{fontSize:e.fontSize??9,weight:e.fontWeight??400})}function Oq(e,t,n,r,i){let a=e.lines??(e.text?[e.text]:[]);if(!a.length||!e.bounds)return``;let o=e.textRotation??0,s=o!==0,c=e.bounds,l=bq(c),u=Dq(e),d=o===-90||o===90,f=d?c.width:s?(e.lineHeight??u.lineHeight)*a.length:c.height,p=e.lineHeight??(s&&!d?u.lineHeight:f/a.length),m=l.y-f/2+u.ascent,h=e.textAlign===`start`,g=a.map((e,t)=>Q(`tspan`,{x:h?c.x:l.x,y:m+t*p},OK(e))).join(``),_=pq(e),v=_===void 0?``:Q(`title`,{},OK(_));return Q(`text`,{class:MK(n,i,t.font(e.fontFamily??`Verdana, DejaVu Sans, sans-serif`,e.fontSize??9,e.fontWeight??400)),"data-owner":r,"text-anchor":h?`start`:`middle`,...s?{transform:`rotate(${AK(o)} ${AK(l.x)} ${AK(l.y)})`}:{}},v+g)}function kq(e,t,n,r){let i=e.bounds,a=e.radius??r,o=YK(i,e.inset);return Q(`rect`,{class:MK(`icon-tile`,n,t.stroke(F.pill)),x:i.x,y:i.y,width:i.width,height:i.height,rx:a,ry:a})+Q(`use`,{class:MK(`node-icon`,n,t.stroke(F.glyph)),href:`#pg-icon-${Ui(e.icon)}`,x:o.x,y:o.y,width:o.width,height:o.height})}function Aq(e,t,n){if(t.omitted||!t.bounds)return!1;let r=t.owner;if(r.kind===`barCross`){let t=e.links.find(e=>e.id===r.link);return t===void 0||n(t)}if(t.support?.kind===`merge-run`||r.kind===`bundle`)return e.links.some(e=>e.bundle===r.id&&n(e));let i=e.links.find(e=>e.id===r.id);return i===void 0||n(i)}var jq=`fill-opacity:1!important;opacity:1!important;stroke:none!important;outline:none!important;display:inline!important;visibility:visible!important;mix-blend-mode:normal!important;mask:none!important;clip-path:none!important;filter:none!important;mask-border:none!important;-webkit-mask-box-image:none!important`;function Mq(e,t,n){let r=e?`#ffffff`:`#000000`,i=bq(t);return Q(`rect`,{class:e?`pg-mask-show`:`pg-mask-hide`,fill:r,style:`fill:${r}!important;${jq}`,x:t.x,y:t.y,width:t.width,height:t.height,...n?{transform:`rotate(${AK(n)} ${AK(i.x)} ${AK(i.y)})`}:{}})}function Nq(e){if(!e.bounds||e.turnedSize===void 0)return;let t=yL(e);if(ln(t))return{box:{x:t.centre.x-t.width/2,y:t.centre.y-t.height/2,width:t.width,height:t.height},turn:t.degrees}}function Pq(e,t){if(t.role!==`link`||t.onLine!==!0||t.support?.kind!==`link-segment`||!t.bounds||!t.lines?.length)return;let n=t.support,r=e.links.find(e=>e.id===n.link)?.path?.segments[n.segment];if(r!==void 0&&Oh(r))return Nq(t)}var Fq=e=>e.owner.kind===`link`?e.owner.id:e.owner.kind===`barCross`?e.owner.link:void 0;function Iq(e,t,n){let r=jL(t)===`routed`;return e.labels.flatMap(i=>{if(i.role!==`link`||Fq(i)!==t.id||!gh(i)||!Aq(e,i,n))return[];let a=Pq(e,i);return r?a&&i.layer!==`overlay`?[a]:[]:[a??Nq(i)??{box:i.bounds}]})}function Lq(e,t,n,r,i){let a=t.filter(e=>!ph(e)).map(e=>({x:Math.min(e.from.x,e.to.x)-n,y:Math.min(e.from.y,e.to.y)-n,width:Math.abs(e.to.x-e.from.x)+2*n,height:Math.abs(e.to.y-e.from.y)+2*n}));return a.length?e.labels.flatMap(t=>(t.role===`group`?!t.omitted&&t.bounds!==void 0:t.role===`link`&&gh(t)&&Fq(t)!==r&&Aq(e,t,i))?a.flatMap(e=>{let n=Rq(e,t.bounds);return n?[{box:n}]:[]}):[]):[]}function Rq(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=Math.min(e.x+e.width,t.x+t.width)-n,a=Math.min(e.y+e.height,t.y+t.height)-r;return i>0&&a>0?{x:n,y:r,width:i,height:a}:void 0}function zq(e,t){let n=[];for(let t of Object.values(e.nodes)){t.bounds&&n.push({box:t.bounds});for(let e of t.ports)e.pill&&n.push({box:e.pill.bounds})}for(let r of e.labels)!r.omitted&&r.bounds&&(r.role===`link`&&!gh(r)&&Aq(e,r,t)&&n.push(Nq(r)??{box:r.bounds}),r.role===`mesh-bus`&&(e.meshBuses?.find(e=>e.label===r.id))?.members.some(n=>{let r=e.links.find(e=>e.id===n);return r!==void 0&&t(r)})&&n.push({box:r.bounds}));return n}function Bq(e,t={}){d(t),PL(e);let n=e.canvas;if(!n)throw Error(`Render requires a final canvas`);let r=new uK,i=ZB(e.document.theme),a=n=>Cq(e,n,t),o=new Set,s=lK(e),c=[],l=e=>{let t=aK(s,bq(e.bounds));return c.push(t),rq.halo(t)},u=s.map(t=>{let{authored:n,uniform:a}=$K(e,t);return Q(`g`,{class:rq.group(n),"data-id":t.id,...a?{"data-node-class":a}:{}},Q(`rect`,{class:MK(rq.groupBox(n,a),r.stroke(F.group)),x:t.bounds.x,y:t.bounds.y,width:t.bounds.width,height:t.bounds.height,rx:i.radii.group,ry:i.radii.group}))}).join(``),f=t=>{let n=mq(e,t);return n.length?Q(`title`,{},OK(n.join(`
148
148
  `))):``},p=new Set,m=e=>{for(let t of e)for(let e of t.barCross??[])p.add(e)},h=(e,t)=>Q(`mask`,{id:e,maskUnits:`userSpaceOnUse`,style:`mask-type:luminance!important`,x:n.x,y:n.y,width:n.width,height:n.height},t),g=new Map,_=e=>{if(!e.length)return;let t=Mq(!0,n)+e.map(e=>Mq(!1,e.box,e.turn)).join(``),r=vq(_q,t);return g.set(r,h(r,t)),{mask:`url(#${r})`}},v=(t,n)=>{let i=ZK(e,t),o=jL(t),s=Eq(t,Tq(n,t)),c=wq(s);if(!c)return``;m(s);let l=[...Iq(e,t,a),...o===`overlay`?Lq(e,s,I(t)/2,t.id,a):[]];return Q(`g`,{class:rq.link(i,o===`overlay`),"data-id":t.id,..._(l)},f(t)+Q(`path`,{class:MK(rq.linkLine(i,o===`overlay`),r.stroke(I(t))),d:c}))},y=e.links.filter(e=>e.technique!==`stub`&&e.path&&e.meshBus===void 0&&a(e)),b=t=>e.links.find(e=>e.id===t),x=(e.meshBuses??[]).filter(e=>e.bar!==void 0&&e.stubs!==void 0&&e.members.some(e=>{let t=b(e);return t!==void 0&&a(t)})),S=x.map(t=>{let n=b(t.members[0]),i=ZK(e,n),o=(e,a,o)=>Q(`path`,{class:MK(rq.linkLine(i,!0,o),r.stroke(I(n))),d:wq([{from:e,to:a,owner:{...t.owner}}])}),s=t.riser?.from!==void 0&&t.riser.to!==void 0?o(t.riser.from,t.riser.to,`riser`):``,c=t.trunk?.joins??[],l=c.slice(1).map((e,t)=>o(c[t],e,`trunk`)).join(``),u=[t.bar,...t.stubs,...t.riser?.from!==void 0&&t.riser.to!==void 0?[{from:t.riser.from,to:t.riser.to}]:[],...c.slice(1).map((e,t)=>({from:c[t],to:e}))];return Q(`g`,{class:rq.meshBus(i),"data-id":t.id,"data-members":t.members.join(` `),...t.joined===void 0?{}:{"data-joined":t.joined},...t.mesh===void 0?{}:{"data-mesh":t.mesh},..._(Lq(e,u,I(n)/2,void 0,a))},Q(`title`,{},OK(hq(e,t)))+o(t.bar.from,t.bar.to)+t.stubs.map(e=>o(e.from,e.to)).join(``)+s+l)}).join(``),C=new Map(e.links.map(e=>[e.id,e])),w=new Map(e.bundles.map(e=>[e.id,e])),T=y.filter(e=>jL(e)===`overlay`).map(e=>v(e,void 0)).join(``)+S,E=y.filter(e=>jL(e)===`routed`).map(e=>v(e,e.bundle?w.get(e.bundle):void 0)).join(``),D=e.bundles.flatMap(t=>(t.mergeRuns??[]).flatMap(n=>{let i=n.members.map(e=>C.get(e)).filter(e=>e!==void 0);if(!i.length||!i.some(a))return[];m(n.path.segments);let o=new Set(i.map(t=>ZK(e,t))),s=o.size===1?[...o][0]:void 0;return[Q(`g`,{class:MK(`merge-run`,s),"data-id":n.id,"data-owner":t.id},Q(`path`,{class:MK(`link-line`,s,r.stroke(n.path.strokeWidth??F.path)),d:wq(n.path.segments)}))]})).join(``),O=[],k=N(e.document).map(t=>fm(e.document.nodes[t].class)),A=Me(k),j=N(e.document).map(t=>{let n=e.nodes[t],a=fm(e.document.nodes[t].class),s=p.has(t),c=Q(`rect`,{class:MK(rq.nodeBody(a,Pe(a,A)),r.stroke(yq(n))),x:n.bounds.x,y:n.bounds.y,width:n.bounds.width,height:n.bounds.height,rx:i.radii.node,ry:i.radii.node});s&&O.push(Q(`g`,{class:rq.node(a),"data-owner":t},c)),n.icon&&o.add(Ui(n.icon.icon));let l=n.icon?kq(n.icon,r,a,i.radii.tile):``,u=e.labels.filter(e=>e.owner.kind===`node`&&e.owner.id===t&&(e.role===`node`||e.role===`description`)).map(e=>Oq(e,r,e.role===`node`?`node-label`:`node-description`,t,a)).join(``),d=n.ports.filter(e=>e.pill&&e.ref.anonymous!==!0).map(n=>{let i=n.pill,o=xq(t,n.ref.name,n.ref.ordinal),s=e.labels.find(e=>e.role===`pill`&&e.port!==void 0&&e.port.node===t&&e.port.name===n.ref.name&&e.port.ordinal===n.ref.ordinal),c=MK(a,fm(n.class))||void 0;return Q(`g`,{class:rq.port(c),"data-id":o},Q(`rect`,{class:MK(rq.pill(c),r.stroke(F.pill)),x:i.bounds.x,y:i.bounds.y,width:i.bounds.width,height:i.bounds.height,rx:i.radius,ry:i.radius})+(s?Oq(s,r,`pill-label`,o,c):``))}).join(``);return Q(`g`,{class:rq.node(a),"data-id":t},(s?``:c)+l+u+d)}).join(``),ee=e.labels.filter(e=>e.role===`group`&&!e.omitted).map(t=>{let n=t.owner.kind===`group`?eq(e,t):void 0;return Oq(t,r,MK(`group-label`,l(t)),t.owner.kind===`barCross`?t.owner.node:n?.id??t.owner.id,tq(e,t))}).join(``),te=e.labels.filter(t=>t.role===`link`&&Aq(e,t,a)).map(t=>{let n=t.owner.kind===`barCross`?t.owner.link:t.owner.id,i=C.get(n),a=t.support?.kind===`merge-run`;return Oq(t,r,MK(`link-label`,a?`multiplicity-label`:void 0,l(t)),n,i?ZK(e,i):void 0)}).join(``),ne=x.flatMap(t=>{let n=e.labels.find(e=>e.id===t.label);return n===void 0||n.omitted||n.bounds===void 0?[]:[Oq(n,r,MK(`link-label`,`mesh-bus-label`,l(n)),t.id,fm(t.class))]}),re=(t,n)=>{let i=iK(e.document,t),a=t.path?.segments??[];if(!i.length||!a.length)return``;let o=tt(I(t));return i.map(i=>{let s=qv(e,t,i)??(i===`from`?a[0].from:a.at(-1).to);return Q(`circle`,{class:MK(rq.linkDot(ZK(e,t),n),r.stroke(o)),style:`stroke-dasharray:none`,"data-owner":t.id,"data-end":i,cx:s.x,cy:s.y,r:o/2})}).join(``)},ie=y.filter(e=>jL(e)===`routed`).map(e=>re(e,!1)).join(``),ae=y.filter(e=>jL(e)===`overlay`).map(e=>re(e,!0)).join(``),oe=x.flatMap(e=>e.stubs.map(t=>Q(`circle`,{class:rq.overlayEndpoint(fm(e.class)),"data-owner":e.id,"data-end":t.node,cx:t.from.x,cy:t.from.y,r:2}))).join(``)+y.filter(e=>jL(e)===`overlay`).flatMap(t=>{let n=t.path.segments;if(!n.length)return[];let r=iK(e.document,t);return[[`from`,qv(e,t,`from`)??n[0].from],[`to`,qv(e,t,`to`)??n.at(-1).to]].filter(([e])=>!r.includes(e)).map(([n,r])=>Q(`circle`,{class:rq.overlayEndpoint(ZK(e,t)),"data-owner":t.id,"data-end":n,cx:r.x,cy:r.y,r:2}))}).join(``)+ae,se=t=>{if(t.kind===`line`){let n=bq(t.swatch).y;return Q(`line`,{class:MK(rq.linkLine(nq(`line`,t.key),Dm(e,t.key)),r.stroke(t.strokeWidth??F.path)),x1:t.swatch.x,y1:n,x2:z(t.swatch),y2:n})}if(t.kind===`port`)return Q(`rect`,{class:MK(rq.pill(nq(`port`,t.key)),r.stroke(F.pill)),x:t.swatch.x,y:t.swatch.y,width:t.swatch.width,height:t.swatch.height,...t.radius===void 0?{}:{rx:t.radius,ry:t.radius}});if(!t.icon)return``;o.add(Ui(t.icon));let n=t.swatch,a=nq(`symbol`,t.key);return Q(`rect`,{class:MK(rq.nodeBody(a,Pe(a,A)),r.stroke(F.pill)),x:n.x-2,y:n.y-2,width:n.width+4,height:n.height+4,rx:nV(i,2),ry:nV(i,2)})+kq({icon:t.icon,bounds:t.swatch},r,a,i.radii.tile)},ce=e.legend?Q(`g`,{class:`legend`,"data-id":e.legend.id},e.legend.entries.map(t=>{let n=e.labels.find(e=>e.id===t.label);return Q(`g`,{class:rq.legendEntry(t.kind,t.key),"data-id":t.id},se(t)+(n&&n.bounds?Oq(n,r,MK(`legend-label`,l(n)),t.id):``))}).join(``)):``,M=y.some(e=>jL(e)===`overlay`)||x.length>0,le=M?Mq(!0,n)+zq(e,a).map(e=>Mq(!1,e.box,e.turn)).join(``):``,ue=vq(gq,le),de=M?h(ue,le):``,fe=[...o].sort().map(e=>Q(`symbol`,{id:`pg-icon-${e}`,viewBox:`0 0 24 24`},Q(`path`,{d:Hi(e)}))).join(``),pe=e.document.css??``,P=Q(`style`,{type:`text/css`},NK([gK(i),_K(k,i),xK(c,i),r.css(),pe].filter(e=>e.trim()).join(`
149
149
  `))),me=Q(`rect`,{class:`pg-canvas`,x:n.x,y:n.y,width:n.width,height:n.height})+Q(`g`,{class:`groups`},u)+(T?Q(`g`,{class:`overlay-links`,mask:`url(#${ue})`},T):``)+(O.length?Q(`g`,{class:`nodes crossed-bars`},O.join(``)):``)+Q(`g`,{class:`links`},E+D)+Q(`g`,{class:`nodes`},j)+(ie?Q(`g`,{class:`link-dots`},ie):``)+Q(`g`,{class:`labels`},ee+te+ne.join(``))+(oe?Q(`g`,{class:`overlay-marks`},oe):``)+ce,he=e.document.title!==void 0&&e.document.title!==``?Q(`title`,{},OK(e.document.title)):``;return Q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,class:rq.root(e.document.profile),viewBox:`${AK(n.x)} ${AK(n.y)} ${AK(n.width)} ${AK(n.height)}`,width:n.width,height:n.height},he+Q(`defs`,{},P+fe+de+[...g.values()].join(``))+me)+`
150
- `}var Vq=F.glyph,Hq=1e-6,Uq=5,Wq=2,Gq=5,Kq=9,qq=9;function Jq(e,t){let n=t.to.x-t.from.x,r=t.to.y-t.from.y,i=n*n+r*r;if(i===0)return{...t.from};let a=Math.min(1,Math.max(0,((e.x-t.from.x)*n+(e.y-t.from.y)*r)/i));return{x:t.from.x+n*a,y:t.from.y+r*a}}var Yq=e=>/^#[0-9a-fA-F]{3,8}$/.test(e);function Xq(e,t){if(typeof e==`string`&&typeof t==`string`)return!Yq(e)||!Yq(t)?e:`light-dark(${e},${t})`;if(typeof e==`object`&&e&&typeof t==`object`&&t){let n={};for(let r of Object.keys(e))n[r]=Xq(e[r],t[r]);return n}return e}var Zq={router:{kind:`badge`,shape:`router`,width:50,height:50},switch:{kind:`badge`,shape:`l2_switch`,width:50,height:50},server:{kind:`badge`,shape:`server`,width:64,height:50},cloud:{kind:`silhouette`,shape:`cloud`,stencil:!1,width:50,height:30}},Qq=e=>e.kind===`badge`?`mxgraph.cisco19.rect`:e.stencil===!1?e.shape:`mxgraph.cisco19.${e.shape}`;function $q(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function eJ(e,t){let n=Math.min(e.width/t.width,e.height/t.height),r=t.width*n,i=t.height*n;return{x:e.x+(e.width-r)/2,y:e.y+(e.height-i)/2,width:r,height:i}}var tJ=e=>e?.offset?Q(`mxPoint`,{x:e.offset.x,y:e.offset.y,as:`offset`}):``,nJ=e=>e.width>0&&e.height>0&&Number.isFinite(e.x)&&Number.isFinite(e.y);function rJ(e,t){let n=YK(e,t);return nJ(n)?n:void 0}function iJ(e,t,n){let r=t.kind===`badge`?nJ(e)?e:void 0:rJ(e,n);return r===void 0?void 0:eJ(r,t)}var aJ={top:{x:.5,y:0},bottom:{x:.5,y:1},left:{x:0,y:.5},right:{x:1,y:.5}},oJ=(e,t)=>{let n=(e,t,n)=>[0,.5,1].find(r=>Math.abs(t+r*n-e)<=Hq)??(e-t)/n;return{x:n(t.x,e.x,e.width),y:n(t.y,e.y,e.height)}},sJ={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},cJ=(e,t=Hq)=>e.slice(1).every((n,r)=>Math.abs(n.x-e[r].x)<=t||Math.abs(n.y-e[r].y)<=t),lJ=(e,t=Hq)=>{let n=e[0],r=e[e.length-1];if(n===void 0||r===void 0)return!0;let i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a);if(o<=t)return e.every(e=>Math.hypot(e.x-n.x,e.y-n.y)<=t);let s=0;return e.every(e=>{let r=((e.x-n.x)*i+(e.y-n.y)*a)/o,c=Math.abs((e.x-n.x)*a-(e.y-n.y)*i)/o<=t&&r>=s-t;return s=Math.max(s,r),c})},uJ=512,dJ=1e-4;function fJ(e,t){let n=e.map(e=>{let n=e%t;return{offset:e,residue:n<0?n+t:n}}).sort((e,t)=>e.residue-t.residue||e.offset-t.offset),r=[];for(let e of n){let t=r[r.length-1];t!==void 0&&e.residue-t.high<=dJ?(t.count+=1,t.phase=Math.min(t.phase,e.offset),t.high=e.residue):r.push({phase:e.offset,count:1,low:e.residue,high:e.residue})}let i=r[0],a=r[r.length-1];r.length>1&&t-a.high+i.low<=dJ&&(i.count+=a.count,i.phase=Math.min(i.phase,a.phase),r.pop());let o=r[0];for(let e of r)(e.count>o.count||e.count===o.count&&e.phase<o.phase)&&(o=e);return o.phase}function pJ(e,t,n){if(!(t>0)||!(n>0)||!Number.isFinite(t)||!Number.isFinite(n))return[];let r=e.filter(e=>e>=-1e-6&&e<=t+Hq),i=r.length>0?fJ(r,n):t/2;if(!Number.isFinite(i))return[];let a=Math.ceil(-i/n-Hq),o=Math.floor((t-i)/n+Hq)-a+1;if(!(o>=1)||o>uJ)return[];let s=[];for(let e=0;e<o;e+=1){let o=i+(a+e)*n;if(!Number.isFinite(o)||o<-1e-6||o>t+Hq)continue;let c=o<Hq?0:o>t-Hq?t:o;r.some(e=>Math.abs(e-c)<=Hq)||s.push(c)}return s}var mJ=(e,t)=>({...e,...Object.fromEntries(Object.keys(t??{}).sort().map(e=>[e,String(t[e])]))}),hJ=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),gJ=(e,t)=>{if(t===void 0||t===``)return e;let n=hJ(t);return{...e,tooltip:e.tooltip===void 0?n:`${e.tooltip}\n${n}`}},_J=e=>e.fontFamily?.replace(/;/g,``).trim()||`Verdana, DejaVu Sans, sans-serif`;function vJ(e,t,n){if(n===void 0)return Q(`mxCell`,e,t);let{id:r,value:i,...a}=e;return Q(`object`,{id:r,label:i??``,...n},Q(`mxCell`,a,t))}function yJ(e,t){let n=e.filter(e=>e!==``);for(let[e,r]of Object.entries(t))r!==void 0&&n.push(`${e}=${typeof r==`number`?AK(r):r}`);return n.length?`${n.join(`;`)};`:``}var bJ=e=>e.join(`
151
- `),xJ=e=>e.lines??(e.text===``?[]:[e.text]),SJ=e=>Number.isFinite(e)?e:0,CJ=e=>SJ(e.fontSize??9),wJ=e=>Math.round(e*1.2),TJ=1e3;function EJ(e,t){let n=xJ(e),r=e.textRotation??0,i=e.bounds,a=Tt(``,{fontSize:TJ,weight:e.fontWeight===700?700:400}),o=e.lineHeight??SJ(Math.ceil(a.lineHeight/TJ*t));return SJ(-(r===-90||r===90?i.width:r===0?i.height:o*n.length)/2+SJ(a.ascent/TJ*t))}function DJ(e,t,n=0){if(!e.bounds)return;let r=Math.max(1,xJ(e).length),i=t-1-(t+(r-1)*wJ(t))/2;return SJ(2*(EJ(e,t)-n-i))}var OJ=e=>`data:image/svg+xml,${encodeURIComponent(e)}`,kJ=e=>e===1?void 0:Math.round(e*100),AJ=e=>e===`fill`?`#000000`:`none`,jJ=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),MJ=(e,t)=>{if(e.turnedSize===void 0)return t;let n=jJ(t);return{...t,x:n.x-e.turnedSize.width/2,y:n.y-e.turnedSize.height/2,...e.turnedSize}},NJ=(e,t)=>Math.abs(e.x-t.x)<=Hq&&Math.abs(e.y-t.y)<=Hq,PJ=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),FJ=(e,t,n)=>{let r=e+t/2-n/2;return Math.abs(r)<=Hq?.5:+(r>0)},IJ=(e,t,n)=>({...e,node:t,fraction:{x:n===`left`?0:n===`right`?1:FJ(e.x,e.width,t.width),y:n===`top`?0:n===`bottom`?1:FJ(e.y,e.height,t.height)}}),LJ=(e,t,n,r)=>{let i=e.x+e.width/2,a=e.y+e.height/2,o=[[`top`,Math.abs(a)],[`bottom`,Math.abs(a-t.height)],[`left`,Math.abs(i)],[`right`,Math.abs(i-t.width)]],s=n??(a<-1e-6?`top`:a>t.height+Hq?`bottom`:i<-1e-6?`left`:i>t.width+Hq?`right`:o.reduce((e,t)=>t[1]<e[1]?t:e)[0]),c=IJ(e,t,s);return r===void 0?c:s===`top`||s===`bottom`?{...c,fraction:{...c.fraction,x:r}}:{...c,fraction:{...c.fraction,y:r}}},RJ=(e,t)=>({[`${e}X`]:t.fraction.x,[`${e}Y`]:t.fraction.y,[`${e}Dx`]:t.x+t.width/2-t.fraction.x*t.node.width,[`${e}Dy`]:t.y+t.height/2-t.fraction.y*t.node.height,[`${e}Perimeter`]:0}),zJ=(e,t,n)=>({...e,node:t,fraction:{x:n?0:.5,y:0}}),BJ=e=>`fraction`in e,VJ=e=>{if(!BJ(e))return Q(`mxGeometry`,{x:e.x,y:e.y,width:e.width,height:e.height,as:`geometry`});let{fraction:t,node:n}=e;return Q(`mxGeometry`,{x:t.x,y:t.y,width:e.width,height:e.height,relative:1,as:`geometry`},Q(`mxPoint`,{x:e.x-t.x*n.width,y:e.y-t.y*n.height,as:`offset`}))},HJ=e=>e.replace(/[%~]/g,e=>`%${e.charCodeAt(0).toString(16)}`),$=(e,...t)=>t.length?`pg-${e}~${t.map(HJ).join(`~`)}`:`pg-${e}`,UJ={movable:0,resizable:0,rotatable:0,editable:0,connectable:0,pointerEvents:0},WJ={deletable:0};function GJ(e,t={}){d(t),PL(e);let n=e.canvas;if(!n)throw Error(`A draw.io export requires a final canvas`);let r=t.theme??`auto`,i=r===`auto`,a=i?`light`:r,o=t.labels??`on-run`,s=t.icons??`cisco19`,c=e=>i?Xq(e(`light`),e(`dark`)):e(a),l=ZB(e.document.theme),u=e.document,f=N(u).map(e=>fm(u.nodes[e].class)),p=Me(f),m=n=>Cq(e,n,t.layers?{layers:t.layers}:{}),h=e=>({x:e.x-n.x,y:e.y-n.y}),g=e=>({...h(e),width:e.width,height:e.height}),_=[],v=new Set,y=(e,t)=>!(v.has(e)||/(^|;)container=1(;|$)/.test(t))||/(^|;)recursiveResize=/.test(t)?t:t.includes(`collapsible=0;`)?t.replace(`collapsible=0;`,`collapsible=0;recursiveResize=0;`):`${t}recursiveResize=0;`,b=new Set,x=e=>{if(b.has(e))throw Error(`A draw.io export cannot reuse the cell id ${e}`);return b.add(e),e},S=(e,t,n,r,i,a={},o)=>{let s=x(e);v.add(t),_.push(()=>vJ({id:s,value:i,style:y(s,n),vertex:1,parent:t,...a},VJ(r),o))},C=Tn(u),w=e=>C[e.sourceIndex]??e.id,T=(t,n,r)=>{let i=u.links[t.sourceIndex],a=[...mq(e,t),...r?[pq(r)]:[]].filter(e=>e!==void 0).join(`
152
- `);return gJ(mJ({"pg-kind":`link`,"pg-id":w(t),"pg-from":wn(i?.from??t.from),"pg-to":wn(i?.to??t.to),...n?{"pg-run":String(n.index),"pg-runs":String(n.count)}:{}},i?.meta),a)},E=(e,t,n,r,i,a=CJ(n),o,s)=>{let c=yJ([`text`],{strokeColor:`none`,fillColor:`none`,align:n.textAlign===`start`?`left`:`center`,verticalAlign:`middle`,spacingLeft:n.textAlign===`start`?-2:void 0,whiteSpace:`nowrap`,overflow:`visible`,points:`[]`,resizable:0,spacingTop:DJ(n,a),fontFamily:_J(n),fontSize:a,...i,fontStyle:n.fontWeight===700?1:void 0,rotation:n.textRotation?n.textRotation:void 0,labelBackgroundColor:o}),l=pq(n)===void 0?void 0:gJ({},pq(n));s===void 0?S(e,t,c,MJ(n,r),bJ(xJ(n)),{},l):_.push(vJ({id:x(e),value:bJ(xJ(n)),style:c,vertex:1,parent:t,connectable:0},Q(`mxGeometry`,{x:s.x,y:s.y,relative:1,as:`geometry`},tJ(s)||void 0),l))},D=new fq(l,f,u.css),O=rq.root(u.profile),k=(e,t)=>c(n=>D.at(n,e).get(t)??AJ(t)),A=(e,t)=>{let n=t(D.at(a,e));return i&&(t(D.peek(`dark`,e))===n?t(D.at(`dark`,e)):D.at(`dark`,e)),n},j=(e,t)=>A(e,e=>e.opacity()*Number(t===void 0?1:e.get(t)??1)),ee=e=>iq.inNode(O,e,rq.nodeBody(e,Pe(e,p))),te=(e,t)=>c(n=>{let r=D.at(n,e).get(`fill`)??AJ(`fill`);return r===`none`?D.at(n,ee(t)).get(`fill`)??AJ(`fill`):r}),ne=e=>({fontColor:k(e,`fill`),textOpacity:kJ(j(e,`fill-opacity`))}),re=e=>({fillColor:k(e,`fill`),strokeColor:k(e,`stroke`),fillOpacity:kJ(A(e,e=>Number(e.get(`fill-opacity`)??1))),strokeOpacity:kJ(A(e,e=>Number(e.get(`stroke-opacity`)??1))),opacity:kJ(j(e)),...ce(A(e,e=>e.get(`stroke-dasharray`)))}),ie=(e,t)=>({tile:{fill:k(e,`fill`),stroke:k(e,`stroke`)},glyph:k(t,`stroke`),image:D.at(a,t).get(`stroke`)??AJ(`stroke`),tileOpacity:kJ(j(e)),glyphOpacity:kJ(j(t))}),ae=e=>({fillColor:k(e,`fill`),strokeColor:k(e,`stroke`),opacity:kJ(j(e))}),oe=(e,t)=>iq.inNode(O,e,MK(t,e)),se=(e,t,n)=>iq.label(O,MK(e,rq.halo(aK(fe,jJ(t))),n)),ce=e=>e===void 0||e===`none`?{}:{dashed:1,fixDash:1,dashPattern:e},M=[`canvas`,`diagram`,`overlay`,`links`,`labels`,`legend`],le={canvas:`Canvas`,overlay:`Overlay`,diagram:`Diagram`,links:`Links`,labels:`Labels`,legend:`Legend`},ue=e=>$(`layer`,e),de=k(iq.canvas(O),`fill`);S($(`canvas`),ue(`canvas`),yJ([],{fillColor:de,strokeColor:`none`,points:`[]`,pointerEvents:0,locked:1,movable:0,resizable:0,deletable:0,editable:0,connectable:0}),{x:0,y:0,width:n.width,height:n.height});let fe=lK(e),pe=e=>c(t=>De(l.paint[t],aK(fe,e))),P=new Map((e.frames??[]).map(e=>[e.id,g(e.box)])),me=new Map((e.frames??[]).filter(e=>e.parent!==void 0&&P.has(e.parent)).map(e=>[e.id,e.parent])),he=t=>e.labels.find(e=>e.role===`group`&&!e.omitted&&e.owner.kind===`group`&&e.owner.id===t);for(let t of fe){let{id:n,bounds:r,frame:i}=t,a=g(r),{authored:o,uniform:s}=$K(e,t),c=iq.groupBox(O,o,s),{fillColor:u,strokeColor:d,...f}=re(c),p=Math.round(A(c,e=>Number(e.get(`fill-opacity`)??1))*100),m=e.labelBands.find(e=>e.group===n),h=he(m?.host??n),_=m!==void 0&&h!==void 0&&Math.abs(jJ(h.bounds).x-jJ(m.bounds).x)<=.5&&Math.abs(jJ(h.bounds).y-jJ(m.bounds).y)<=.5&&(!i||Math.abs(m.bounds.x-r.x)<=.5&&Math.abs(m.bounds.width-r.width)<=.5&&Math.abs(m.side===`top`?m.bounds.y-r.y:m.bounds.y+m.bounds.height-r.y-r.height)<=.5)?m:void 0,v=h===void 0?{}:ne(se(`group-label`,h.bounds,tq(e,h))),y=_?yJ([`swimlane`],{whiteSpace:`nowrap`,container:1,collapsible:0,rounded:1,absoluteArcSize:1,arcSize:l.radii.group*2,horizontal:1,startSize:_.bounds.height,flipV:_.side===`bottom`?1:void 0,align:`center`,verticalAlign:`middle`,spacingTop:DJ(h,CJ(h),jJ(_.bounds).y-jJ(h.bounds).y),fontFamily:_J(h),fontSize:CJ(h),...v,fontStyle:h.fontWeight===700?1:void 0,swimlaneLine:0,fillColor:u,swimlaneFillColor:u,strokeColor:d,...f,fillOpacity:p}):yJ([],{container:1,collapsible:0,rounded:1,absoluteArcSize:1,arcSize:l.radii.group*2,fillColor:u,strokeColor:d,...f,fillOpacity:p,verticalAlign:`top`,align:`center`}),b=i?me.get(n):void 0;S($(`group`,n),b===void 0?ue(`diagram`):$(`group`,b),y,b===void 0?a:PJ(a,P.get(b)),_?bJ(xJ(h)):void 0),h&&!_&&E($(`groupTitle`,n),$(`group`,n),h,PJ(g(h.bounds),a),v)}let ge=Cm(e);for(let t of N(u)){let n=e.nodes[t],r=e.groups[u.nodes[t].group],i=r.frame===void 0?void 0:e.frames?.find(e=>e.id===r.frame),a=$(`group`,i?.id??r.id),o=g(n.bounds),c=h(i?.box??r.bounds),d=fm(u.nodes[t]?.class),f=new Set(n.ports.filter(e=>e.anchor!==void 0).map(e=>{let t=e.anchor;return`[${AK((t.x-n.bounds.x)/n.bounds.width)},${AK((t.y-n.bounds.y)/n.bounds.height)},0]`}));for(let e of[`top`,`bottom`,`left`,`right`]){let t=n.sidePitch?.[e];if(t===void 0)continue;let r=e===`top`||e===`bottom`,i=r?n.bounds.width:n.bounds.height,a=r?n.bounds.x:n.bounds.y,o=e===`left`||e===`top`?0:1,s=n.ports.filter(t=>t.side===e&&t.anchor!==void 0).map(e=>(r?e.anchor.x:e.anchor.y)-a);for(let e of pJ(s,i,t)){let t=e/i;f.add(r?`[${AK(t)},${AK(o)},0]`:`[${AK(o)},${AK(t)},0]`)}}let p=e.labels.find(e=>e.owner.kind===`node`&&e.owner.id===t&&e.role===`node`&&!e.omitted&&xJ(e).length>0),m=e.labels.find(e=>e.owner.kind===`node`&&e.owner.id===t&&e.role===`description`&&!e.omitted&&xJ(e).length>0),_=p===void 0?Kq:SJ(p.fontSize??Kq),v=p===void 0?void 0:SJ(jJ(p.bounds).y+EJ(p,_)-n.bounds.y-Wq-Gq-(_-1)),y=(p??m)?.textAlign===`start`,b={width:n.bounds.width,height:n.bounds.height},x=p===void 0?0:SJ(jJ(p.bounds).x-jJ(n.bounds).x);if(S($(`node`,t),a,yJ([],{container:1,collapsible:0,rounded:1,absoluteArcSize:1,arcSize:l.radii.node*2,whiteSpace:`nowrap`,...re(ee(d)),strokeWidth:n.strokeWidth??F.node,points:`[${[...f].join(`,`)}]`,...p===void 0?{}:{align:y?`left`:`center`,verticalAlign:`top`,overflow:`visible`,spacingTop:v,...y?{spacingLeft:SJ(p.bounds.x-n.bounds.x-Wq)}:x>0?{spacingLeft:SJ(2*x)}:x<0?{spacingRight:SJ(-2*x)}:{},fontFamily:_J(p),fontSize:_,...ne(oe(d,`node-label`)),fontStyle:(p.fontWeight??700)===700?1:void 0}}),PJ(o,c),p===void 0?void 0:bJ(xJ(p)),{},mJ({"pg-kind":`node`,"pg-id":t,...ge.has(t)?{"pg-symbol":HJ(ge.get(t).slice(7))}:{}},u.nodes[t]?.meta)),m!==void 0&&E($(`nodeDescription`,t),$(`node`,t),m,zJ(PJ(g(m.bounds),h(n.bounds)),b,y),ne(oe(d,`node-description`)),SJ(m.fontSize??qq)),n.icon){let e=PJ(g(n.icon.bounds),h(n.bounds)),r=n.icon.inset,i=n.icon.radius??l.radii.tile,a=ie(iq.inNode(O,d,MK(`icon-tile`,d)),iq.inNode(O,d,MK(`node-icon`,d))),o=s===`cisco19`?Zq[Ui(n.icon.icon)]:void 0,c={"pg-kind":`node-icon`,"pg-of":t};if(o){o.kind===`silhouette`&&nJ(e)&&S($(`iconTile`,t),$(`node`,t),yJ([],{rounded:1,absoluteArcSize:1,arcSize:i*2,fillColor:a.tile.fill,strokeColor:a.tile.stroke,points:`[]`,...UJ,opacity:a.tileOpacity}),zJ(e,b,y));let n=iJ(e,o,r);n&&S($(`icon`,t),$(`node`,t),yJ([],{sketch:0,aspect:`fixed`,points:`[]`,...UJ,shape:Qq(o),...o.kind===`badge`?{prIcon:o.shape}:{},fillColor:o.kind===`badge`?a.tile.fill:a.glyph,strokeColor:o.kind===`badge`?a.glyph:`none`,opacity:o.kind===`badge`?a.tileOpacity:a.glyphOpacity}),zJ(n,b,y),void 0,{},c)}else{nJ(e)&&S($(`iconTile`,t),$(`node`,t),yJ([],{rounded:1,absoluteArcSize:1,arcSize:i*2,fillColor:a.tile.fill,strokeColor:a.tile.stroke,points:`[]`,...UJ,opacity:a.tileOpacity}),zJ(e,b,y));let o=rJ(e,r);if(o){let e=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${Hi(n.icon.icon)}" fill="none" stroke="${a.image}" stroke-width="${AK(Vq)}" stroke-linecap="round" stroke-linejoin="round"/></svg>`;S($(`icon`,t),$(`node`,t),yJ([],{shape:`image`,imageAspect:0,points:`[]`,...UJ,image:OJ(e),opacity:a.glyphOpacity}),zJ(o,b,y),void 0,{},c)}}}for(let r of n.ports){if(!r.pill||r.ref.anonymous===!0)continue;let i=[t,r.ref.name,String(r.ref.ordinal)],a=MK(d,fm(r.class))||void 0,o=iq.inPort(O,d,a,rq.pill(a)),s=re(o),c=r.side?aJ[r.side]:void 0,l=e.labels.find(e=>e.role===`pill`&&e.port!==void 0&&e.port.node===t&&e.port.name===r.ref.name&&e.port.ordinal===r.ref.ordinal),f=l&&!l.omitted?l:void 0;S($(`port`,...i),$(`node`,t),yJ([],{rounded:1,absoluteArcSize:1,arcSize:r.pill.radius*2,fillColor:te(o,d),strokeColor:s.strokeColor,fillOpacity:s.fillOpacity,strokeOpacity:s.strokeOpacity,strokeWidth:F.pill,points:c?`[[${AK(c.x)},${AK(c.y)},0]]`:`[]`,snapToPoint:1,opacity:s.opacity,...ce(A(o,e=>e.get(`stroke-dasharray`))),...f?{verticalAlign:`middle`,align:`center`,whiteSpace:`nowrap`,overflow:`visible`,spacingTop:f.bounds&&DJ(f,CJ(f),r.pill.textRotation===-90?jJ(r.pill.bounds).x-jJ(f.bounds).x:jJ(r.pill.bounds).y-jJ(f.bounds).y),fontFamily:_J(f),fontSize:CJ(f),...ne(iq.inPort(O,d,a,MK(`pill-label`,a))),fontStyle:f.fontWeight===700?1:void 0,horizontal:r.pill.textRotation===-90?0:void 0}:{}}),IJ(PJ(g(r.pill.bounds),h(n.bounds)),b,r.side),f?bJ(xJ(f)):void 0,{},mJ({"pg-kind":`port`,"pg-id":wn({node:t,name:r.ref.name,ordinal:r.ref.ordinal}),"pg-node":t,"pg-port":r.ref.name},u.nodes[t]?.ports.find(e=>e.name===r.ref.name&&e.ordinal===r.ref.ordinal)?.meta))}}let _e=new Map(e.links.map(e=>[e.id,e])),ve=t=>ZK(e,t);function ye(e){return XK(e).map(({first:t,last:n})=>({first:t,last:n,points:[e[t].from,...e.slice(t,n+1).map(e=>e.to)].map(h)}))}let be=(t,n,r)=>{let i=e.nodes[n.node],a=i?.ports.find(e=>e.ref.node===n.node&&e.ref.name===n.name&&e.ref.ordinal===n.ordinal);if(!i?.bounds||!a?.anchor)return;let o=r??a.anchor,s=e=>({[`${t}X`]:e.x,[`${t}Y`]:e.y,[`${t}Dx`]:0,[`${t}Dy`]:0,[`${t}Perimeter`]:0});return a.pill&&a.ref.anonymous!==!0&&a.side?{cell:$(`port`,n.node,n.name,String(n.ordinal)),style:s(oJ(a.pill.bounds,o)),at:h(o)}:{cell:$(`node`,n.node),style:s(oJ(i.bounds,o)),at:h(o),...a.ref.anonymous===!0?{anonymous:!0}:{}}},xe=(t,n)=>{if(!iK(e.document,t).includes(n))return{};let r=n===`from`?`start`:`end`;return{[`${r}Arrow`]:`oval`,[`${r}Fill`]:1,[`${r}Size`]:6}},Se=t=>{let n=e.nodes[t.node]?.ports.find(e=>e.ref.node===t.node&&e.ref.name===t.name&&e.ref.ordinal===t.ordinal);if(n?.pill&&n.ref.anonymous!==!0&&n.side)return{cell:$(`port`,t.node,t.name,String(t.ordinal)),box:g(n.pill.bounds),out:sJ[n.side]}},Ce=t=>{let n=Se(t);if(n)return n;let r=e.nodes[t.node]?.bounds;return r?{cell:$(`node`,t.node),box:g(r)}:void 0},we=(e,t,n,r,i,a,o)=>{let s=r.length>2?Q(`Array`,{as:`points`},r.slice(1,-1).map(e=>Q(`mxPoint`,{x:e.x,y:e.y})).join(``)):``,c=(i.sourcePoint?Q(`mxPoint`,{x:i.sourcePoint.x,y:i.sourcePoint.y,as:`sourcePoint`}):``)+(i.targetPoint?Q(`mxPoint`,{x:i.targetPoint.x,y:i.targetPoint.y,as:`targetPoint`}):``);_.push(vJ({id:x(e),value:a?.value,style:n,edge:1,parent:t,source:i.source,target:i.target},Q(`mxGeometry`,{...a?{x:a.at.x,y:a.at.y}:{},relative:1,as:`geometry`},s+c+tJ(a?.at)),o))},Te=e.links.filter(e=>e.technique!==`stub`&&e.path&&e.meshBus===void 0&&m(e)),Ee=new Map,Oe=(e,t)=>{let r=jJ(g(e.bounds));if(o!==`on-run`||e.support?.kind!==`link-segment`)return r;let i=t.path.segments[e.support.segment],a=t.path.segments[e.support.through??e.support.segment];if(i===void 0||a===void 0)return r;let s={from:i.from,to:a.to};return h(Jq({x:r.x+n.x,y:r.y+n.y},s))},ke=(e,t,n)=>se(MK(`link-label`,t?`multiplicity-label`:void 0),e.bounds,n&&ve(n)),Ae=(e,t,r,i)=>{let a=e.support?.kind===`link-segment`?i.path?.segments[e.support.segment]:void 0,s=e.support?.kind===`link-segment`&&(o===`on-run`||e.onLine===!0&&a!==void 0&&Oh(a)),c=e.support?.kind===`merge-run`;return{labelBackgroundColor:pe({x:t.x+n.x,y:t.y+n.y}),...s?{spacing:Uq}:{},align:`center`,verticalAlign:`middle`,fontFamily:_J(e),fontSize:CJ(e),...ne(ke(e,c,i)),fontStyle:e.fontWeight===700?1:void 0,...r===`edge`?e.textRotation===-90?{horizontal:0,spacingLeft:DJ(e,CJ(e))}:{spacingTop:DJ(e,CJ(e))}:{rotation:e.textRotation?e.textRotation:void 0,spacingTop:DJ(e,CJ(e))}}},je=new Map;for(let t of e.labels){if(t.role!==`link`||t.omitted||!t.bounds)continue;let e=t.owner.kind===`barCross`?t.owner.link:t.owner.kind===`link`?t.owner.id:void 0;if(e===void 0)continue;let n=t.textRotation??0;(n===0||n===-90)&&(je.has(e)?je.delete(e):je.set(e,t))}let Ne=(e,t,n)=>{let r=e.support?.kind===`link-segment`?e.support.segment:void 0;if(r!==void 0){let e=n.findIndex(e=>r>=e.first&&r<=e.last);if(e>=0)return e}let i=Oe(e,t),a=0,o=1/0;return n.forEach((e,t)=>{for(let[n,r]of e.points.slice(1).entries()){let s=Jq(i,{from:e.points[n],to:r}),c=Math.hypot(i.x-s.x,i.y-s.y);c<o&&(o=c,a=t)}}),a},Fe=(e,t,n)=>{if(e.support?.kind!==`link-segment`)return;let r=Math.max(e.support.segment,n.first),i=Math.min(e.support.through??e.support.segment,n.last);return r<=i?[r-n.first,i-n.first]:void 0},Ie=new Set;for(let t of Te){let n=jL(t)===`overlay`?ue(`overlay`):ue(`links`),r=ve(t),i=jL(t)===`overlay`,o=ye(t.path.segments),s=iq.linkLine(O,r,i),l=k(s,`stroke`);if(iK(e.document,t).length){let e=iq.linkDot(O,r,i);c(t=>D.peek(t,e).get(`stroke`)??AJ(`stroke`))===l?k(e,`stroke`):D.at(a,e)}let u=t.attachments?.from,d=t.attachments?.to,f=qv(e,t,`from`),p=qv(e,t,`to`),m=u?be(`exit`,u,f):void 0,g=d?be(`entry`,d,p):void 0,_=i&&u?Ce(u):void 0,v=i&&d?Ce(d):void 0,y=o.map((e,n)=>{let r=[...e.points];return n===0&&m&&(r[0]=m.at),n===o.length-1&&g&&(r[r.length-1]=g.at),{id:o.length===1?$(`link`,w(t)):$(`link`,w(t),String(n)),points:r,first:e.first,last:e.last}}),b=je.get(t.id),x=b?Ne(b,t,y):-1;if(o.forEach((e,r)=>{let a=r===0,c=r===o.length-1,u=a?m:void 0,d=c?g:void 0,f=y[r].id,p=b&&r===x?{label:b,at:YJ(y[r].points,Oe(b,t),Fe(b,t,y[r]))}:void 0;p&&Ie.add(p.label.id);let h=e.points,_=!(lJ(h)&&lJ(y[r].points))&&cJ(h)&&cJ(y[r].points),v=yJ([],{edgeStyle:_?`orthogonalEdgeStyle`:`none`,jettySize:_?0:void 0,rounded:0,endArrow:`none`,startArrow:`none`,strokeColor:l,strokeWidth:I(t),opacity:i?Math.round(j(s,`stroke-opacity`)*100):kJ(j(s,`stroke-opacity`)),...ce(A(s,e=>e.get(`stroke-dasharray`))),...u?xe(t,`from`):{},...d?xe(t,`to`):{},...u?.style??{},...d?.style??{},...p?Ae(p.label,Oe(p.label,t),`edge`,t):{}});we(f,n,v,h,{source:u?.cell,target:d?.cell,sourcePoint:u?void 0:h[0],targetPoint:d?void 0:h[h.length-1]},p?{value:bJ(xJ(p.label)),at:p.at}:void 0,T(t,o.length===1?void 0:{index:r,count:o.length},p?.label))}),Ee.set(t.id,y),i){let n=t.path.segments,i=[{end:`from`,at:f??n[0].from,host:_},{end:`to`,at:p??n[n.length-1].to,host:v}],a=iK(e.document,t);for(let e of i){if(a.includes(e.end)&&(e.end===`from`?m:g))continue;let n=h(e.at),i={x:n.x-2,y:n.y-2,width:4,height:4};S($(`overlayMark`,w(t),e.end),e.host?.cell??ue(`overlay`),yJ([`ellipse`],{...ae(iq.overlayEndpoint(O,r)),points:`[]`,...UJ,...WJ}),e.host?PJ(i,e.host.box):i)}}}let Le=e=>JSON.stringify([...(i?[`light`,`dark`]:[a]).map(t=>D.peek(t,e).get(`stroke`)),D.peek(a,e).get(`stroke-dasharray`),D.peek(a,e).opacity()*Number(D.peek(a,e).get(`stroke-opacity`)??1)]);for(let t of e.bundles)for(let e of t.mergeRuns??[]){let t=e.members.map(e=>_e.get(e)).filter(e=>e!==void 0);if(!t.some(m))continue;let n=new Set(t.map(e=>ve(e))),r=n.size===1?[...n][0]:void 0,o=[O,`links`,MK(`merge-run`,r),rq.linkLine(r,!1)],s=t.filter(m).map(e=>iq.linkLine(O,ve(e),jL(e)===`overlay`));if(s.every(e=>Le(e)===Le(o))){k(o,`stroke`),A(o,e=>e.get(`stroke-dasharray`)),j(o,`stroke-opacity`);continue}let c=[`stroke`,`stroke-dasharray`,`stroke-opacity`,`opacity`];for(let e of i?[`light`,`dark`]:[a])for(let t of[o,...s])D.notCarried(e,t,c,`a merge trunk painted unlike its members`)}for(let t of e.meshBuses??[]){if(t.bar===void 0||t.stubs===void 0)continue;let r=t.members.map(e=>_e.get(e)).find(e=>e!==void 0&&m(e));if(r===void 0)continue;let i=ve(_e.get(t.members[0])??r),a=(e,t={},n)=>{let a=iq.busLine(O,i,n);return yJ([],{edgeStyle:e?`orthogonalEdgeStyle`:`none`,jettySize:e?0:void 0,rounded:0,endArrow:`none`,startArrow:`none`,strokeColor:k(a,`stroke`),strokeWidth:I(r),opacity:Math.round(j(a,`stroke-opacity`)*100),...ce(A(a,e=>e.get(`stroke-dasharray`))),...t})},o=t=>{if(t.bar===void 0||t.stubs===void 0)return[];let r=[],i=e.meshBuses?.find(e=>e.trunk?.buses.includes(t.id)),a=(a,o,s)=>{if(r.some(e=>NJ(e.at,a)))return;let c=o,l=1/0;if(c===void 0)for(let r of t.ports){let t=e.nodes[r.node]?.bounds,i=t?Math.abs(t.x+t.width/2-n.x-a.x):1/0;i<l&&(l=i,c=r)}let u=(i?.trunk?.joins?.some(e=>NJ(h(e),a))?i.trunk.side:void 0)??t.side;c!==void 0&&Ce(c)!==void 0&&r.push({at:a,ref:c,...s===void 0?{}:{stub:s},...u===void 0?{}:{side:u}})};for(let e of t.stubs)a(h(e.to),t.ports.find(t=>t.node===e.node),e.node);a(h(t.bar.from)),a(h(t.bar.to)),t.riser?.from!==void 0&&a(h(t.riser.from));let o=e.meshBuses?.find(e=>e.joined===t.id&&e.riser?.to!==void 0);return o?.riser?.to!==void 0&&a(h(o.riser.to)),r.sort((e,t)=>e.at.x-t.at.x||e.at.y-t.at.y),r.map((e,n)=>({...e,id:$(`busJoint`,t.id,String(n))}))},s=o(t),c=(e,t,n,r)=>e.cell.startsWith(`pg-node~`)?LJ(t,e.box,n,r):t,l=(e,n)=>{let r=Ce(t.ports.find(t=>t.node===e.node)),i=h(e.from),a={x:i.x-2,y:i.y-2,width:4,height:4};return{pill:r,box:a,mark:r?c(r,PJ(a,r.box),n):a}},u=gJ({},hq(e,t)),d=(e,t)=>e.find(e=>NJ(e.at,t))?.id;for(let e of s){let n=Ce(e.ref),r={x:e.at.x-1,y:e.at.y-1,width:2,height:2};S(e.id,n.cell,yJ([`ellipse`],{fillColor:`none`,strokeColor:`none`,points:`[]`,...UJ,...WJ}),c(n,PJ(r,n.box),e.side,(()=>{let r=t.stubs?.find(t=>t.node===e.stub),i=r===void 0?void 0:l(r,t.side).mark;return i!==void 0&&BJ(i)&&n.cell.startsWith(`pg-node~`)?e.side===`left`||e.side===`right`?i.fraction.y:i.fraction.x:void 0})()))}let f=e=>({[`${e}X`]:.5,[`${e}Y`]:.5,[`${e}Dx`]:0,[`${e}Dy`]:0,[`${e}Perimeter`]:0}),p=(e,t)=>({...e?f(`exit`):{},...t?f(`entry`):{}});for(let e of t.stubs){let n=t.ports.find(t=>t.node===e.node),r=be(`exit`,n,e.from),i=Ce(n),o=h(e.to),{mark:c}=l(e,t.side),p=r&&i&&r.cell===i.cell&&BJ(c)?RJ(`exit`,c):void 0,m=[r?.at??h(e.from),o],g=d(s,o);we($(`busStub`,t.id,e.node),ue(`overlay`),a(!1,{...r?.style??{},...p,...g?f(`entry`):{}}),m,{source:r?.cell,target:g,sourcePoint:r?void 0:m[0],targetPoint:g?void 0:m[1]},void 0,u),S($(`busMark`,t.id,e.node),i?.cell??ue(`overlay`),yJ([`ellipse`],{...ae(iq.overlayEndpoint(O,fm(t.class))),points:`[]`,...UJ,...WJ}),c)}let _=[];for(let e=0;e+1<s.length;e++){let n=s[e],r=s[e+1];_.push({id:$(`bus`,t.id,String(e)),points:[n.at,r.at]}),we(_[e].id,ue(`overlay`),a(!1,p(n.id,r.id)),[n.at,r.at],{source:n.id,target:r.id},void 0,u)}if(t.riser?.from!==void 0&&t.riser.to!==void 0){let n=[h(t.riser.from),h(t.riser.to)],r=e.meshBuses?.find(e=>e.id===t.joined),i=d(s,n[0]),c=r?d(o(r),n[1]):void 0;we($(`busRiser`,t.id),ue(`overlay`),a(!1,p(i,c),`riser`),n,{source:i,target:c,sourcePoint:i?void 0:n[0],targetPoint:c?void 0:n[1]},void 0,u)}let v=t.trunk?.joins;if(t.trunk!==void 0&&v!==void 0){let n=t.trunk.buses.map(t=>e.meshBuses?.find(e=>e.id===t)),r=v.map((e,t)=>{let r=n[t];return r===void 0?void 0:d(o(r),h(e))});for(let e=0;e+1<v.length;e++){let n=[h(v[e]),h(v[e+1])],i=r[e],o=r[e+1];we($(`busTrunk`,t.id,String(e)),ue(`overlay`),a(!1,p(i,o),`trunk`),n,{source:i,target:o,sourcePoint:i?void 0:n[0],targetPoint:o?void 0:n[1]},void 0,u)}}let y=e.labels.find(e=>e.id===t.label);if(y!==void 0&&!y.omitted&&y.bounds!==void 0){let e=jJ(g(y.bounds)),n=t=>{let n=Jq(e,{from:t.points[0],to:t.points[1]});return Math.hypot(e.x-n.x,e.y-n.y)},r=_.reduce((e,t)=>e===void 0||n(t)<n(e)?t:e,void 0);E($(`busLabel`,t.id),r?.id??ue(`labels`),y,g(y.bounds),ne(se(MK(`link-label`,`mesh-bus-label`),y.bounds,fm(t.class))),void 0,pe(jJ(y.bounds)),r===void 0?void 0:YJ(r.points,e))}}for(let t of e.labels){if(t.role!==`link`||t.omitted||!t.bounds||Ie.has(t.id))continue;let e=t.owner.kind===`barCross`?t.owner.link:t.owner.kind===`link`?t.owner.id:void 0,n=e===void 0?void 0:_e.get(e),r=e===void 0?void 0:Ee.get(e);if(!n||!r?.length){if(t.owner.kind!==`bundle`)continue;let e=t.owner.id;if(!Te.some(t=>t.bundle===e))continue;E($(`linkLabel`,t.id),ue(`labels`),t,g(t.bounds),ne(ke(t,!0,void 0)),void 0,pe(jJ(t.bounds)));continue}let i=r[Ne(t,n,r)],a=Oe(t,n),o=YJ(i.points,a,Fe(t,n,i)),s=t.owner.kind===`barCross`?$(`linkLabel`,w(n),t.owner.node):$(`linkLabel`,w(n));_.push(vJ({id:x(s),value:bJ(xJ(t)),style:yJ([`edgeLabel`],{resizable:0,points:`[]`,...Ae(t,a,`child`,n)}),vertex:1,connectable:0,parent:i.id},Q(`mxGeometry`,{x:o.x,y:o.y,relative:1,as:`geometry`},tJ(o)||void 0),gJ({"pg-kind":`link-label`,"pg-of":w(n)},pq(t))))}if(e.legend){let t=g(e.legend.bounds);S($(`legend`),ue(`legend`),yJ([`group`],{points:`[]`}),t);for(let t of e.legend.entries){let n=e.labels.find(e=>e.id===t.label),r=n&&!n.omitted&&n.bounds?n:void 0,i=r?$q(g(t.swatch),g(r.bounds)):g(t.swatch),a=PJ(i,h(e.legend.bounds));S($(`legendRow`,t.id),$(`legend`),yJ([],{fillColor:`none`,strokeColor:`none`,points:`[]`,...r?{align:`left`,verticalAlign:`middle`,whiteSpace:`nowrap`,overflow:`visible`,spacingLeft:g(r.bounds).x-i.x-Wq,spacingTop:DJ(r,CJ(r),jJ(i).y-jJ(g(r.bounds)).y),fontFamily:_J(r),fontSize:CJ(r),...ne(iq.inLegend(O,t.kind,t.key,MK(`legend-label`,rq.halo(aK(fe,jJ(r.bounds)))))),fontStyle:r.fontWeight===700?1:void 0}:{}}),a,r?bJ(xJ(r)):void 0);let o=PJ(g(t.swatch),i),c=nq(t.kind,t.key),u=e=>iq.inLegend(O,t.kind,t.key,e);if(t.kind===`line`){let n=u(rq.linkLine(c,Dm(e,t.key)));S($(`legendSwatch`,t.id),$(`legendRow`,t.id),yJ([],{shape:`line`,points:`[]`,...UJ,strokeColor:k(n,`stroke`),strokeWidth:t.strokeWidth??F.path,opacity:kJ(j(n,`stroke-opacity`)),...ce(A(n,e=>e.get(`stroke-dasharray`)))}),o)}else if(t.kind===`port`){let e=u(rq.pill(c)),n=re(e);S($(`legendSwatch`,t.id),$(`legendRow`,t.id),yJ([],{rounded:1,absoluteArcSize:1,arcSize:(t.radius??$e.pill)*2,fillColor:te(e,void 0),strokeColor:n.strokeColor,strokeWidth:F.pill,points:`[]`,...UJ,opacity:n.opacity,...ce(A(e,e=>e.get(`stroke-dasharray`)))}),o)}else if(t.icon){let e=o;S($(`legendBody`,t.id),$(`legendRow`,t.id),yJ([],{rounded:1,absoluteArcSize:1,arcSize:nV(l,2)*2,...re(u(rq.nodeBody(c,Pe(c,p)))),strokeWidth:F.pill,points:`[]`,...UJ}),{x:e.x-2,y:e.y-2,width:e.width+4,height:e.height+4});let n=ie(u(MK(`icon-tile`,c)),u(MK(`node-icon`,c))),r=s===`cisco19`?Zq[Ui(t.icon)]:void 0;if(r){r.kind===`silhouette`&&nJ(o)&&S($(`legendTile`,t.id),$(`legendRow`,t.id),yJ([],{rounded:1,absoluteArcSize:1,arcSize:l.radii.tile*2,fillColor:n.tile.fill,strokeColor:n.tile.stroke,points:`[]`,...UJ,opacity:n.tileOpacity}),o);let e=iJ(o,r);e&&S($(`legendSwatch`,t.id),$(`legendRow`,t.id),yJ([],{sketch:0,aspect:`fixed`,points:`[]`,...UJ,shape:Qq(r),...r.kind===`badge`?{prIcon:r.shape}:{},fillColor:r.kind===`badge`?n.tile.fill:n.glyph,strokeColor:r.kind===`badge`?n.glyph:`none`,opacity:r.kind===`badge`?n.tileOpacity:n.glyphOpacity}),e)}else{nJ(o)&&S($(`legendTile`,t.id),$(`legendRow`,t.id),yJ([],{rounded:1,absoluteArcSize:1,arcSize:l.radii.tile*2,fillColor:n.tile.fill,strokeColor:n.tile.stroke,points:`[]`,...UJ,opacity:n.tileOpacity}),o);let e=rJ(o);if(e){let r=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${Hi(t.icon)}" fill="none" stroke="${n.image}" stroke-width="${AK(Vq)}" stroke-linecap="round" stroke-linejoin="round"/></svg>`;S($(`legendSwatch`,t.id),$(`legendRow`,t.id),yJ([],{shape:`image`,imageAspect:0,points:`[]`,...UJ,image:OJ(r),opacity:n.glyphOpacity}),e)}}}}}let Re=M.map(e=>Q(`mxCell`,{id:x(ue(e)),value:le[e],parent:`0`})).join(``),ze=Q(`mxGraphModel`,{dx:0,dy:0,grid:0,gridSize:10,guides:1,tooltips:1,connect:1,arrows:0,fold:1,page:1,pageScale:1,pageWidth:Math.ceil(n.width),pageHeight:Math.ceil(n.height),math:0,shadow:0,background:de},Q(`root`,{},vJ({id:x(`0`)},void 0,mJ({"pg-schema":`1`},u.meta))+Re+_.map(e=>typeof e==`string`?e:e()).join(``))),Be=u.title??`portograph`,Ve=D.unmapped();Ve.length&&t.onDiagnostic?.({stage:`render`,severity:`warning`,code:`DRAWIO_CSS_UNMAPPED`,message:`draw.io cannot carry ${Ve.length} part(s) of css:, which the SVG applies: ${Ve.join(`; `)}`});let He=e.labels.filter(e=>!e.omitted&&e.bounds!==void 0&&xJ(e).length>1&&e.lineHeight!==void 0&&Math.abs(e.lineHeight-wJ(CJ(e)))>Hq);return He.length&&t.onDiagnostic?.({stage:`render`,severity:`warning`,code:`DRAWIO_LINE_PITCH`,message:`draw.io draws plain text at its own line pitch, so ${He.length} multi-line label(s) differ from the SVG in their further lines: ${He.map(e=>e.id).join(`; `)}`}),`<?xml version="1.0" encoding="UTF-8"?>
150
+ `}var Vq=F.glyph,Hq=1e-6,Uq=5,Wq=2,Gq=5,Kq=9,qq=9;function Jq(e,t){let n=t.to.x-t.from.x,r=t.to.y-t.from.y,i=n*n+r*r;if(i===0)return{...t.from};let a=Math.min(1,Math.max(0,((e.x-t.from.x)*n+(e.y-t.from.y)*r)/i));return{x:t.from.x+n*a,y:t.from.y+r*a}}var Yq=e=>/^#[0-9a-fA-F]{3,8}$/.test(e);function Xq(e,t){if(typeof e==`string`&&typeof t==`string`)return!Yq(e)||!Yq(t)?e:`light-dark(${e},${t})`;if(typeof e==`object`&&e&&typeof t==`object`&&t){let n={};for(let r of Object.keys(e))n[r]=Xq(e[r],t[r]);return n}return e}var Zq={router:{kind:`badge`,shape:`router`,width:50,height:50},switch:{kind:`badge`,shape:`l2_switch`,width:50,height:50},server:{kind:`badge`,shape:`server`,width:64,height:50},cloud:{kind:`silhouette`,shape:`cloud`,stencil:!1,width:50,height:30}},Qq=e=>e.kind===`badge`?`mxgraph.cisco19.rect`:e.stencil===!1?e.shape:`mxgraph.cisco19.${e.shape}`;function $q(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function eJ(e,t){let n=Math.min(e.width/t.width,e.height/t.height),r=t.width*n,i=t.height*n;return{x:e.x+(e.width-r)/2,y:e.y+(e.height-i)/2,width:r,height:i}}var tJ=e=>e?.offset?Q(`mxPoint`,{x:e.offset.x,y:e.offset.y,as:`offset`}):``,nJ=e=>e.width>0&&e.height>0&&Number.isFinite(e.x)&&Number.isFinite(e.y);function rJ(e,t){let n=YK(e,t);return nJ(n)?n:void 0}function iJ(e,t,n){let r=t.kind===`badge`?nJ(e)?e:void 0:rJ(e,n);return r===void 0?void 0:eJ(r,t)}var aJ={top:{x:.5,y:0},bottom:{x:.5,y:1},left:{x:0,y:.5},right:{x:1,y:.5}},oJ=(e,t)=>{let n=(e,t,n)=>[0,.5,1].find(r=>Math.abs(t+r*n-e)<=Hq)??(e-t)/n;return{x:n(t.x,e.x,e.width),y:n(t.y,e.y,e.height)}},sJ={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},cJ=(e,t=Hq)=>e.slice(1).every((n,r)=>Math.abs(n.x-e[r].x)<=t||Math.abs(n.y-e[r].y)<=t),lJ=(e,t=Hq)=>{let n=e[0],r=e[e.length-1];if(n===void 0||r===void 0)return!0;let i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a);if(o<=t)return e.every(e=>Math.hypot(e.x-n.x,e.y-n.y)<=t);let s=0;return e.every(e=>{let r=((e.x-n.x)*i+(e.y-n.y)*a)/o,c=Math.abs((e.x-n.x)*a-(e.y-n.y)*i)/o<=t&&r>=s-t;return s=Math.max(s,r),c})},uJ=512,dJ=1e-4;function fJ(e,t){let n=e.map(e=>{let n=e%t;return{offset:e,residue:n<0?n+t:n}}).sort((e,t)=>e.residue-t.residue||e.offset-t.offset),r=[];for(let e of n){let t=r[r.length-1];t!==void 0&&e.residue-t.high<=dJ?(t.count+=1,t.phase=Math.min(t.phase,e.offset),t.high=e.residue):r.push({phase:e.offset,count:1,low:e.residue,high:e.residue})}let i=r[0],a=r[r.length-1];r.length>1&&t-a.high+i.low<=dJ&&(i.count+=a.count,i.phase=Math.min(i.phase,a.phase),r.pop());let o=r[0];for(let e of r)(e.count>o.count||e.count===o.count&&e.phase<o.phase)&&(o=e);return o.phase}function pJ(e,t,n){if(!(t>0)||!(n>0)||!Number.isFinite(t)||!Number.isFinite(n))return[];let r=e.filter(e=>e>=-1e-6&&e<=t+Hq),i=r.length>0?fJ(r,n):t/2;if(!Number.isFinite(i))return[];let a=Math.ceil(-i/n-Hq),o=Math.floor((t-i)/n+Hq)-a+1;if(!(o>=1)||o>uJ)return[];let s=[];for(let e=0;e<o;e+=1){let o=i+(a+e)*n;if(!Number.isFinite(o)||o<-1e-6||o>t+Hq)continue;let c=o<Hq?0:o>t-Hq?t:o;r.some(e=>Math.abs(e-c)<=Hq)||s.push(c)}return s}var mJ=(e,t)=>({...e,...Object.fromEntries(Object.keys(t??{}).sort().map(e=>[e,String(t[e])]))}),hJ=e=>{let t=MK(fm(e));return t?{"pg-class":t}:{}},gJ=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),_J=(e,t)=>{if(t===void 0||t===``)return e;let n=gJ(t);return{...e,tooltip:e.tooltip===void 0?n:`${e.tooltip}\n${n}`}},vJ=e=>e.fontFamily?.replace(/;/g,``).trim()||`Verdana, DejaVu Sans, sans-serif`;function yJ(e,t,n){if(n===void 0)return Q(`mxCell`,e,t);let{id:r,value:i,...a}=e;return Q(`object`,{id:r,label:i??``,...n},Q(`mxCell`,a,t))}function bJ(e,t){let n=e.filter(e=>e!==``);for(let[e,r]of Object.entries(t))r!==void 0&&n.push(`${e}=${typeof r==`number`?AK(r):r}`);return n.length?`${n.join(`;`)};`:``}var xJ=e=>e.join(`
151
+ `),SJ=e=>e.lines??(e.text===``?[]:[e.text]),CJ=e=>Number.isFinite(e)?e:0,wJ=e=>CJ(e.fontSize??9),TJ=e=>Math.round(e*1.2),EJ=1e3;function DJ(e,t){let n=SJ(e),r=e.textRotation??0,i=e.bounds,a=Tt(``,{fontSize:EJ,weight:e.fontWeight===700?700:400}),o=e.lineHeight??CJ(Math.ceil(a.lineHeight/EJ*t));return CJ(-(r===-90||r===90?i.width:r===0?i.height:o*n.length)/2+CJ(a.ascent/EJ*t))}function OJ(e,t,n=0){if(!e.bounds)return;let r=Math.max(1,SJ(e).length),i=t-1-(t+(r-1)*TJ(t))/2;return CJ(2*(DJ(e,t)-n-i))}var kJ=e=>`data:image/svg+xml,${encodeURIComponent(e)}`,AJ=e=>e===1?void 0:Math.round(e*100),jJ=e=>e===`fill`?`#000000`:`none`,MJ=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),NJ=(e,t)=>{if(e.turnedSize===void 0)return t;let n=MJ(t);return{...t,x:n.x-e.turnedSize.width/2,y:n.y-e.turnedSize.height/2,...e.turnedSize}},PJ=(e,t)=>Math.abs(e.x-t.x)<=Hq&&Math.abs(e.y-t.y)<=Hq,FJ=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),IJ=(e,t,n)=>{let r=e+t/2-n/2;return Math.abs(r)<=Hq?.5:+(r>0)},LJ=(e,t,n)=>({...e,node:t,fraction:{x:n===`left`?0:n===`right`?1:IJ(e.x,e.width,t.width),y:n===`top`?0:n===`bottom`?1:IJ(e.y,e.height,t.height)}}),RJ=(e,t,n,r)=>{let i=e.x+e.width/2,a=e.y+e.height/2,o=[[`top`,Math.abs(a)],[`bottom`,Math.abs(a-t.height)],[`left`,Math.abs(i)],[`right`,Math.abs(i-t.width)]],s=n??(a<-1e-6?`top`:a>t.height+Hq?`bottom`:i<-1e-6?`left`:i>t.width+Hq?`right`:o.reduce((e,t)=>t[1]<e[1]?t:e)[0]),c=LJ(e,t,s);return r===void 0?c:s===`top`||s===`bottom`?{...c,fraction:{...c.fraction,x:r}}:{...c,fraction:{...c.fraction,y:r}}},zJ=(e,t)=>({[`${e}X`]:t.fraction.x,[`${e}Y`]:t.fraction.y,[`${e}Dx`]:t.x+t.width/2-t.fraction.x*t.node.width,[`${e}Dy`]:t.y+t.height/2-t.fraction.y*t.node.height,[`${e}Perimeter`]:0}),BJ=(e,t,n)=>({...e,node:t,fraction:{x:n?0:.5,y:0}}),VJ=e=>`fraction`in e,HJ=e=>{if(!VJ(e))return Q(`mxGeometry`,{x:e.x,y:e.y,width:e.width,height:e.height,as:`geometry`});let{fraction:t,node:n}=e;return Q(`mxGeometry`,{x:t.x,y:t.y,width:e.width,height:e.height,relative:1,as:`geometry`},Q(`mxPoint`,{x:e.x-t.x*n.width,y:e.y-t.y*n.height,as:`offset`}))},UJ=e=>e.replace(/[%~]/g,e=>`%${e.charCodeAt(0).toString(16)}`),$=(e,...t)=>t.length?`pg-${e}~${t.map(UJ).join(`~`)}`:`pg-${e}`,WJ={movable:0,resizable:0,rotatable:0,editable:0,connectable:0,pointerEvents:0},GJ={deletable:0};function KJ(e,t={}){d(t),PL(e);let n=e.canvas;if(!n)throw Error(`A draw.io export requires a final canvas`);let r=t.theme??`auto`,i=r===`auto`,a=i?`light`:r,o=t.labels??`on-run`,s=t.icons??`cisco19`,c=e=>i?Xq(e(`light`),e(`dark`)):e(a),l=ZB(e.document.theme),u=e.document,f=N(u).map(e=>fm(u.nodes[e].class)),p=Me(f),m=n=>Cq(e,n,t.layers?{layers:t.layers}:{}),h=e=>({x:e.x-n.x,y:e.y-n.y}),g=e=>({...h(e),width:e.width,height:e.height}),_=[],v=new Set,y=(e,t)=>!(v.has(e)||/(^|;)container=1(;|$)/.test(t))||/(^|;)recursiveResize=/.test(t)?t:t.includes(`collapsible=0;`)?t.replace(`collapsible=0;`,`collapsible=0;recursiveResize=0;`):`${t}recursiveResize=0;`,b=new Set,x=e=>{if(b.has(e))throw Error(`A draw.io export cannot reuse the cell id ${e}`);return b.add(e),e},S=(e,t,n,r,i,a={},o)=>{let s=x(e);v.add(t),_.push(()=>yJ({id:s,value:i,style:y(s,n),vertex:1,parent:t,...a},HJ(r),o))},C=Tn(u),w=e=>C[e.sourceIndex]??e.id,T=(t,n,r)=>{let i=u.links[t.sourceIndex],a=[...mq(e,t),...r?[pq(r)]:[]].filter(e=>e!==void 0).join(`
152
+ `);return _J(mJ({"pg-kind":`link`,"pg-id":w(t),"pg-from":wn(i?.from??t.from),"pg-to":wn(i?.to??t.to),...hJ(i?.class),...n?{"pg-run":String(n.index),"pg-runs":String(n.count)}:{}},i?.meta),a)},E=(e,t,n,r,i,a=wJ(n),o,s)=>{let c=bJ([`text`],{strokeColor:`none`,fillColor:`none`,align:n.textAlign===`start`?`left`:`center`,verticalAlign:`middle`,spacingLeft:n.textAlign===`start`?-2:void 0,whiteSpace:`nowrap`,overflow:`visible`,points:`[]`,resizable:0,spacingTop:OJ(n,a),fontFamily:vJ(n),fontSize:a,...i,fontStyle:n.fontWeight===700?1:void 0,rotation:n.textRotation?n.textRotation:void 0,labelBackgroundColor:o}),l=pq(n)===void 0?void 0:_J({},pq(n));s===void 0?S(e,t,c,NJ(n,r),xJ(SJ(n)),{},l):_.push(yJ({id:x(e),value:xJ(SJ(n)),style:c,vertex:1,parent:t,connectable:0},Q(`mxGeometry`,{x:s.x,y:s.y,relative:1,as:`geometry`},tJ(s)||void 0),l))},D=new fq(l,f,u.css),O=rq.root(u.profile),k=(e,t)=>c(n=>D.at(n,e).get(t)??jJ(t)),A=(e,t)=>{let n=t(D.at(a,e));return i&&(t(D.peek(`dark`,e))===n?t(D.at(`dark`,e)):D.at(`dark`,e)),n},j=(e,t)=>A(e,e=>e.opacity()*Number(t===void 0?1:e.get(t)??1)),ee=e=>iq.inNode(O,e,rq.nodeBody(e,Pe(e,p))),te=(e,t)=>c(n=>{let r=D.at(n,e).get(`fill`)??jJ(`fill`);return r===`none`?D.at(n,ee(t)).get(`fill`)??jJ(`fill`):r}),ne=e=>({fontColor:k(e,`fill`),textOpacity:AJ(j(e,`fill-opacity`))}),re=e=>({fillColor:k(e,`fill`),strokeColor:k(e,`stroke`),fillOpacity:AJ(A(e,e=>Number(e.get(`fill-opacity`)??1))),strokeOpacity:AJ(A(e,e=>Number(e.get(`stroke-opacity`)??1))),opacity:AJ(j(e)),...ce(A(e,e=>e.get(`stroke-dasharray`)))}),ie=(e,t)=>({tile:{fill:k(e,`fill`),stroke:k(e,`stroke`)},glyph:k(t,`stroke`),image:D.at(a,t).get(`stroke`)??jJ(`stroke`),tileOpacity:AJ(j(e)),glyphOpacity:AJ(j(t))}),ae=e=>({fillColor:k(e,`fill`),strokeColor:k(e,`stroke`),opacity:AJ(j(e))}),oe=(e,t)=>iq.inNode(O,e,MK(t,e)),se=(e,t,n)=>iq.label(O,MK(e,rq.halo(aK(fe,MJ(t))),n)),ce=e=>e===void 0||e===`none`?{}:{dashed:1,fixDash:1,dashPattern:e},M=[`canvas`,`diagram`,`overlay`,`links`,`labels`,`legend`],le={canvas:`Canvas`,overlay:`Overlay`,diagram:`Diagram`,links:`Links`,labels:`Labels`,legend:`Legend`},ue=e=>$(`layer`,e),de=k(iq.canvas(O),`fill`);S($(`canvas`),ue(`canvas`),bJ([],{fillColor:de,strokeColor:`none`,points:`[]`,pointerEvents:0,locked:1,movable:0,resizable:0,deletable:0,editable:0,connectable:0}),{x:0,y:0,width:n.width,height:n.height});let fe=lK(e),pe=e=>c(t=>De(l.paint[t],aK(fe,e))),P=new Map((e.frames??[]).map(e=>[e.id,g(e.box)])),me=new Map((e.frames??[]).filter(e=>e.parent!==void 0&&P.has(e.parent)).map(e=>[e.id,e.parent])),he=t=>e.labels.find(e=>e.role===`group`&&!e.omitted&&e.owner.kind===`group`&&e.owner.id===t);for(let t of fe){let{id:n,bounds:r,frame:i}=t,a=g(r),{authored:o,uniform:s}=$K(e,t),c=iq.groupBox(O,o,s),{fillColor:u,strokeColor:d,...f}=re(c),p=Math.round(A(c,e=>Number(e.get(`fill-opacity`)??1))*100),m=e.labelBands.find(e=>e.group===n),h=he(m?.host??n),_=m!==void 0&&h!==void 0&&Math.abs(MJ(h.bounds).x-MJ(m.bounds).x)<=.5&&Math.abs(MJ(h.bounds).y-MJ(m.bounds).y)<=.5&&(!i||Math.abs(m.bounds.x-r.x)<=.5&&Math.abs(m.bounds.width-r.width)<=.5&&Math.abs(m.side===`top`?m.bounds.y-r.y:m.bounds.y+m.bounds.height-r.y-r.height)<=.5)?m:void 0,v=h===void 0?{}:ne(se(`group-label`,h.bounds,tq(e,h))),y=_?bJ([`swimlane`],{whiteSpace:`nowrap`,container:1,collapsible:0,rounded:1,absoluteArcSize:1,arcSize:l.radii.group*2,horizontal:1,startSize:_.bounds.height,flipV:_.side===`bottom`?1:void 0,align:`center`,verticalAlign:`middle`,spacingTop:OJ(h,wJ(h),MJ(_.bounds).y-MJ(h.bounds).y),fontFamily:vJ(h),fontSize:wJ(h),...v,fontStyle:h.fontWeight===700?1:void 0,swimlaneLine:0,fillColor:u,swimlaneFillColor:u,strokeColor:d,...f,fillOpacity:p}):bJ([],{container:1,collapsible:0,rounded:1,absoluteArcSize:1,arcSize:l.radii.group*2,fillColor:u,strokeColor:d,...f,fillOpacity:p,verticalAlign:`top`,align:`center`}),b=i?me.get(n):void 0;S($(`group`,n),b===void 0?ue(`diagram`):$(`group`,b),y,b===void 0?a:FJ(a,P.get(b)),_?xJ(SJ(h)):void 0),h&&!_&&E($(`groupTitle`,n),$(`group`,n),h,FJ(g(h.bounds),a),v)}let ge=Cm(e);for(let t of N(u)){let n=e.nodes[t],r=e.groups[u.nodes[t].group],i=r.frame===void 0?void 0:e.frames?.find(e=>e.id===r.frame),a=$(`group`,i?.id??r.id),o=g(n.bounds),c=h(i?.box??r.bounds),d=fm(u.nodes[t]?.class),f=new Set(n.ports.filter(e=>e.anchor!==void 0).map(e=>{let t=e.anchor;return`[${AK((t.x-n.bounds.x)/n.bounds.width)},${AK((t.y-n.bounds.y)/n.bounds.height)},0]`}));for(let e of[`top`,`bottom`,`left`,`right`]){let t=n.sidePitch?.[e];if(t===void 0)continue;let r=e===`top`||e===`bottom`,i=r?n.bounds.width:n.bounds.height,a=r?n.bounds.x:n.bounds.y,o=e===`left`||e===`top`?0:1,s=n.ports.filter(t=>t.side===e&&t.anchor!==void 0).map(e=>(r?e.anchor.x:e.anchor.y)-a);for(let e of pJ(s,i,t)){let t=e/i;f.add(r?`[${AK(t)},${AK(o)},0]`:`[${AK(o)},${AK(t)},0]`)}}let p=e.labels.find(e=>e.owner.kind===`node`&&e.owner.id===t&&e.role===`node`&&!e.omitted&&SJ(e).length>0),m=e.labels.find(e=>e.owner.kind===`node`&&e.owner.id===t&&e.role===`description`&&!e.omitted&&SJ(e).length>0),_=p===void 0?Kq:CJ(p.fontSize??Kq),v=p===void 0?void 0:CJ(MJ(p.bounds).y+DJ(p,_)-n.bounds.y-Wq-Gq-(_-1)),y=(p??m)?.textAlign===`start`,b={width:n.bounds.width,height:n.bounds.height},x=p===void 0?0:CJ(MJ(p.bounds).x-MJ(n.bounds).x);if(S($(`node`,t),a,bJ([],{container:1,collapsible:0,rounded:1,absoluteArcSize:1,arcSize:l.radii.node*2,whiteSpace:`nowrap`,...re(ee(d)),strokeWidth:n.strokeWidth??F.node,points:`[${[...f].join(`,`)}]`,...p===void 0?{}:{align:y?`left`:`center`,verticalAlign:`top`,overflow:`visible`,spacingTop:v,...y?{spacingLeft:CJ(p.bounds.x-n.bounds.x-Wq)}:x>0?{spacingLeft:CJ(2*x)}:x<0?{spacingRight:CJ(-2*x)}:{},fontFamily:vJ(p),fontSize:_,...ne(oe(d,`node-label`)),fontStyle:(p.fontWeight??700)===700?1:void 0}}),FJ(o,c),p===void 0?void 0:xJ(SJ(p)),{},mJ({"pg-kind":`node`,"pg-id":t,...hJ(u.nodes[t]?.class),...ge.has(t)?{"pg-symbol":UJ(ge.get(t).slice(7))}:{}},u.nodes[t]?.meta)),m!==void 0&&E($(`nodeDescription`,t),$(`node`,t),m,BJ(FJ(g(m.bounds),h(n.bounds)),b,y),ne(oe(d,`node-description`)),CJ(m.fontSize??qq)),n.icon){let e=FJ(g(n.icon.bounds),h(n.bounds)),r=n.icon.inset,i=n.icon.radius??l.radii.tile,a=ie(iq.inNode(O,d,MK(`icon-tile`,d)),iq.inNode(O,d,MK(`node-icon`,d))),o=s===`cisco19`?Zq[Ui(n.icon.icon)]:void 0,c={"pg-kind":`node-icon`,"pg-of":t};if(o){o.kind===`silhouette`&&nJ(e)&&S($(`iconTile`,t),$(`node`,t),bJ([],{rounded:1,absoluteArcSize:1,arcSize:i*2,fillColor:a.tile.fill,strokeColor:a.tile.stroke,points:`[]`,...WJ,opacity:a.tileOpacity}),BJ(e,b,y));let n=iJ(e,o,r);n&&S($(`icon`,t),$(`node`,t),bJ([],{sketch:0,aspect:`fixed`,points:`[]`,...WJ,shape:Qq(o),...o.kind===`badge`?{prIcon:o.shape}:{},fillColor:o.kind===`badge`?a.tile.fill:a.glyph,strokeColor:o.kind===`badge`?a.glyph:`none`,opacity:o.kind===`badge`?a.tileOpacity:a.glyphOpacity}),BJ(n,b,y),void 0,{},c)}else{nJ(e)&&S($(`iconTile`,t),$(`node`,t),bJ([],{rounded:1,absoluteArcSize:1,arcSize:i*2,fillColor:a.tile.fill,strokeColor:a.tile.stroke,points:`[]`,...WJ,opacity:a.tileOpacity}),BJ(e,b,y));let o=rJ(e,r);if(o){let e=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${Hi(n.icon.icon)}" fill="none" stroke="${a.image}" stroke-width="${AK(Vq)}" stroke-linecap="round" stroke-linejoin="round"/></svg>`;S($(`icon`,t),$(`node`,t),bJ([],{shape:`image`,imageAspect:0,points:`[]`,...WJ,image:kJ(e),opacity:a.glyphOpacity}),BJ(o,b,y),void 0,{},c)}}}for(let r of n.ports){if(!r.pill||r.ref.anonymous===!0)continue;let i=[t,r.ref.name,String(r.ref.ordinal)],a=MK(d,fm(r.class))||void 0,o=iq.inPort(O,d,a,rq.pill(a)),s=re(o),c=r.side?aJ[r.side]:void 0,l=e.labels.find(e=>e.role===`pill`&&e.port!==void 0&&e.port.node===t&&e.port.name===r.ref.name&&e.port.ordinal===r.ref.ordinal),f=l&&!l.omitted?l:void 0;S($(`port`,...i),$(`node`,t),bJ([],{rounded:1,absoluteArcSize:1,arcSize:r.pill.radius*2,fillColor:te(o,d),strokeColor:s.strokeColor,fillOpacity:s.fillOpacity,strokeOpacity:s.strokeOpacity,strokeWidth:F.pill,points:c?`[[${AK(c.x)},${AK(c.y)},0]]`:`[]`,snapToPoint:1,opacity:s.opacity,...ce(A(o,e=>e.get(`stroke-dasharray`))),...f?{verticalAlign:`middle`,align:`center`,whiteSpace:`nowrap`,overflow:`visible`,spacingTop:f.bounds&&OJ(f,wJ(f),r.pill.textRotation===-90?MJ(r.pill.bounds).x-MJ(f.bounds).x:MJ(r.pill.bounds).y-MJ(f.bounds).y),fontFamily:vJ(f),fontSize:wJ(f),...ne(iq.inPort(O,d,a,MK(`pill-label`,a))),fontStyle:f.fontWeight===700?1:void 0,horizontal:r.pill.textRotation===-90?0:void 0}:{}}),LJ(FJ(g(r.pill.bounds),h(n.bounds)),b,r.side),f?xJ(SJ(f)):void 0,{},(()=>{let e=u.nodes[t]?.ports.find(e=>e.name===r.ref.name&&e.ordinal===r.ref.ordinal);return mJ({"pg-kind":`port`,"pg-id":wn({node:t,name:r.ref.name,ordinal:r.ref.ordinal}),"pg-node":t,"pg-port":r.ref.name,...hJ(e?.class)},e?.meta)})())}}let _e=new Map(e.links.map(e=>[e.id,e])),ve=t=>ZK(e,t);function ye(e){return XK(e).map(({first:t,last:n})=>({first:t,last:n,points:[e[t].from,...e.slice(t,n+1).map(e=>e.to)].map(h)}))}let be=(t,n,r)=>{let i=e.nodes[n.node],a=i?.ports.find(e=>e.ref.node===n.node&&e.ref.name===n.name&&e.ref.ordinal===n.ordinal);if(!i?.bounds||!a?.anchor)return;let o=r??a.anchor,s=e=>({[`${t}X`]:e.x,[`${t}Y`]:e.y,[`${t}Dx`]:0,[`${t}Dy`]:0,[`${t}Perimeter`]:0});return a.pill&&a.ref.anonymous!==!0&&a.side?{cell:$(`port`,n.node,n.name,String(n.ordinal)),style:s(oJ(a.pill.bounds,o)),at:h(o)}:{cell:$(`node`,n.node),style:s(oJ(i.bounds,o)),at:h(o),...a.ref.anonymous===!0?{anonymous:!0}:{}}},xe=(t,n)=>{if(!iK(e.document,t).includes(n))return{};let r=n===`from`?`start`:`end`;return{[`${r}Arrow`]:`oval`,[`${r}Fill`]:1,[`${r}Size`]:6}},Se=t=>{let n=e.nodes[t.node]?.ports.find(e=>e.ref.node===t.node&&e.ref.name===t.name&&e.ref.ordinal===t.ordinal);if(n?.pill&&n.ref.anonymous!==!0&&n.side)return{cell:$(`port`,t.node,t.name,String(t.ordinal)),box:g(n.pill.bounds),out:sJ[n.side]}},Ce=t=>{let n=Se(t);if(n)return n;let r=e.nodes[t.node]?.bounds;return r?{cell:$(`node`,t.node),box:g(r)}:void 0},we=(e,t,n,r,i,a,o)=>{let s=r.length>2?Q(`Array`,{as:`points`},r.slice(1,-1).map(e=>Q(`mxPoint`,{x:e.x,y:e.y})).join(``)):``,c=(i.sourcePoint?Q(`mxPoint`,{x:i.sourcePoint.x,y:i.sourcePoint.y,as:`sourcePoint`}):``)+(i.targetPoint?Q(`mxPoint`,{x:i.targetPoint.x,y:i.targetPoint.y,as:`targetPoint`}):``);_.push(yJ({id:x(e),value:a?.value,style:n,edge:1,parent:t,source:i.source,target:i.target},Q(`mxGeometry`,{...a?{x:a.at.x,y:a.at.y}:{},relative:1,as:`geometry`},s+c+tJ(a?.at)),o))},Te=e.links.filter(e=>e.technique!==`stub`&&e.path&&e.meshBus===void 0&&m(e)),Ee=new Map,Oe=(e,t)=>{let r=MJ(g(e.bounds));if(o!==`on-run`||e.support?.kind!==`link-segment`)return r;let i=t.path.segments[e.support.segment],a=t.path.segments[e.support.through??e.support.segment];if(i===void 0||a===void 0)return r;let s={from:i.from,to:a.to};return h(Jq({x:r.x+n.x,y:r.y+n.y},s))},ke=(e,t,n)=>se(MK(`link-label`,t?`multiplicity-label`:void 0),e.bounds,n&&ve(n)),Ae=(e,t,r,i)=>{let a=e.support?.kind===`link-segment`?i.path?.segments[e.support.segment]:void 0,s=e.support?.kind===`link-segment`&&(o===`on-run`||e.onLine===!0&&a!==void 0&&Oh(a)),c=e.support?.kind===`merge-run`;return{labelBackgroundColor:pe({x:t.x+n.x,y:t.y+n.y}),...s?{spacing:Uq}:{},align:`center`,verticalAlign:`middle`,fontFamily:vJ(e),fontSize:wJ(e),...ne(ke(e,c,i)),fontStyle:e.fontWeight===700?1:void 0,...r===`edge`?e.textRotation===-90?{horizontal:0,spacingLeft:OJ(e,wJ(e))}:{spacingTop:OJ(e,wJ(e))}:{rotation:e.textRotation?e.textRotation:void 0,spacingTop:OJ(e,wJ(e))}}},je=new Map;for(let t of e.labels){if(t.role!==`link`||t.omitted||!t.bounds)continue;let e=t.owner.kind===`barCross`?t.owner.link:t.owner.kind===`link`?t.owner.id:void 0;if(e===void 0)continue;let n=t.textRotation??0;(n===0||n===-90)&&(je.has(e)?je.delete(e):je.set(e,t))}let Ne=(e,t,n)=>{let r=e.support?.kind===`link-segment`?e.support.segment:void 0;if(r!==void 0){let e=n.findIndex(e=>r>=e.first&&r<=e.last);if(e>=0)return e}let i=Oe(e,t),a=0,o=1/0;return n.forEach((e,t)=>{for(let[n,r]of e.points.slice(1).entries()){let s=Jq(i,{from:e.points[n],to:r}),c=Math.hypot(i.x-s.x,i.y-s.y);c<o&&(o=c,a=t)}}),a},Fe=(e,t,n)=>{if(e.support?.kind!==`link-segment`)return;let r=Math.max(e.support.segment,n.first),i=Math.min(e.support.through??e.support.segment,n.last);return r<=i?[r-n.first,i-n.first]:void 0},Ie=new Set;for(let t of Te){let n=jL(t)===`overlay`?ue(`overlay`):ue(`links`),r=ve(t),i=jL(t)===`overlay`,o=ye(t.path.segments),s=iq.linkLine(O,r,i),l=k(s,`stroke`);if(iK(e.document,t).length){let e=iq.linkDot(O,r,i);c(t=>D.peek(t,e).get(`stroke`)??jJ(`stroke`))===l?k(e,`stroke`):D.at(a,e)}let u=t.attachments?.from,d=t.attachments?.to,f=qv(e,t,`from`),p=qv(e,t,`to`),m=u?be(`exit`,u,f):void 0,g=d?be(`entry`,d,p):void 0,_=i&&u?Ce(u):void 0,v=i&&d?Ce(d):void 0,y=o.map((e,n)=>{let r=[...e.points];return n===0&&m&&(r[0]=m.at),n===o.length-1&&g&&(r[r.length-1]=g.at),{id:o.length===1?$(`link`,w(t)):$(`link`,w(t),String(n)),points:r,first:e.first,last:e.last}}),b=je.get(t.id),x=b?Ne(b,t,y):-1;if(o.forEach((e,r)=>{let a=r===0,c=r===o.length-1,u=a?m:void 0,d=c?g:void 0,f=y[r].id,p=b&&r===x?{label:b,at:XJ(y[r].points,Oe(b,t),Fe(b,t,y[r]))}:void 0;p&&Ie.add(p.label.id);let h=e.points,_=!(lJ(h)&&lJ(y[r].points))&&cJ(h)&&cJ(y[r].points),v=bJ([],{edgeStyle:_?`orthogonalEdgeStyle`:`none`,jettySize:_?0:void 0,rounded:0,endArrow:`none`,startArrow:`none`,strokeColor:l,strokeWidth:I(t),opacity:i?Math.round(j(s,`stroke-opacity`)*100):AJ(j(s,`stroke-opacity`)),...ce(A(s,e=>e.get(`stroke-dasharray`))),...u?xe(t,`from`):{},...d?xe(t,`to`):{},...u?.style??{},...d?.style??{},...p?Ae(p.label,Oe(p.label,t),`edge`,t):{}});we(f,n,v,h,{source:u?.cell,target:d?.cell,sourcePoint:u?void 0:h[0],targetPoint:d?void 0:h[h.length-1]},p?{value:xJ(SJ(p.label)),at:p.at}:void 0,T(t,o.length===1?void 0:{index:r,count:o.length},p?.label))}),Ee.set(t.id,y),i){let n=t.path.segments,i=[{end:`from`,at:f??n[0].from,host:_},{end:`to`,at:p??n[n.length-1].to,host:v}],a=iK(e.document,t);for(let e of i){if(a.includes(e.end)&&(e.end===`from`?m:g))continue;let n=h(e.at),i={x:n.x-2,y:n.y-2,width:4,height:4};S($(`overlayMark`,w(t),e.end),e.host?.cell??ue(`overlay`),bJ([`ellipse`],{...ae(iq.overlayEndpoint(O,r)),points:`[]`,...WJ,...GJ}),e.host?FJ(i,e.host.box):i)}}}let Le=e=>JSON.stringify([...(i?[`light`,`dark`]:[a]).map(t=>D.peek(t,e).get(`stroke`)),D.peek(a,e).get(`stroke-dasharray`),D.peek(a,e).opacity()*Number(D.peek(a,e).get(`stroke-opacity`)??1)]);for(let t of e.bundles)for(let e of t.mergeRuns??[]){let t=e.members.map(e=>_e.get(e)).filter(e=>e!==void 0);if(!t.some(m))continue;let n=new Set(t.map(e=>ve(e))),r=n.size===1?[...n][0]:void 0,o=[O,`links`,MK(`merge-run`,r),rq.linkLine(r,!1)],s=t.filter(m).map(e=>iq.linkLine(O,ve(e),jL(e)===`overlay`));if(s.every(e=>Le(e)===Le(o))){k(o,`stroke`),A(o,e=>e.get(`stroke-dasharray`)),j(o,`stroke-opacity`);continue}let c=[`stroke`,`stroke-dasharray`,`stroke-opacity`,`opacity`];for(let e of i?[`light`,`dark`]:[a])for(let t of[o,...s])D.notCarried(e,t,c,`a merge trunk painted unlike its members`)}for(let t of e.meshBuses??[]){if(t.bar===void 0||t.stubs===void 0)continue;let r=t.members.map(e=>_e.get(e)).find(e=>e!==void 0&&m(e));if(r===void 0)continue;let i=ve(_e.get(t.members[0])??r),a=(e,t={},n)=>{let a=iq.busLine(O,i,n);return bJ([],{edgeStyle:e?`orthogonalEdgeStyle`:`none`,jettySize:e?0:void 0,rounded:0,endArrow:`none`,startArrow:`none`,strokeColor:k(a,`stroke`),strokeWidth:I(r),opacity:Math.round(j(a,`stroke-opacity`)*100),...ce(A(a,e=>e.get(`stroke-dasharray`))),...t})},o=t=>{if(t.bar===void 0||t.stubs===void 0)return[];let r=[],i=e.meshBuses?.find(e=>e.trunk?.buses.includes(t.id)),a=(a,o,s)=>{if(r.some(e=>PJ(e.at,a)))return;let c=o,l=1/0;if(c===void 0)for(let r of t.ports){let t=e.nodes[r.node]?.bounds,i=t?Math.abs(t.x+t.width/2-n.x-a.x):1/0;i<l&&(l=i,c=r)}let u=(i?.trunk?.joins?.some(e=>PJ(h(e),a))?i.trunk.side:void 0)??t.side;c!==void 0&&Ce(c)!==void 0&&r.push({at:a,ref:c,...s===void 0?{}:{stub:s},...u===void 0?{}:{side:u}})};for(let e of t.stubs)a(h(e.to),t.ports.find(t=>t.node===e.node),e.node);a(h(t.bar.from)),a(h(t.bar.to)),t.riser?.from!==void 0&&a(h(t.riser.from));let o=e.meshBuses?.find(e=>e.joined===t.id&&e.riser?.to!==void 0);return o?.riser?.to!==void 0&&a(h(o.riser.to)),r.sort((e,t)=>e.at.x-t.at.x||e.at.y-t.at.y),r.map((e,n)=>({...e,id:$(`busJoint`,t.id,String(n))}))},s=o(t),c=(e,t,n,r)=>e.cell.startsWith(`pg-node~`)?RJ(t,e.box,n,r):t,l=(e,n)=>{let r=Ce(t.ports.find(t=>t.node===e.node)),i=h(e.from),a={x:i.x-2,y:i.y-2,width:4,height:4};return{pill:r,box:a,mark:r?c(r,FJ(a,r.box),n):a}},u=_J({},hq(e,t)),d=(e,t)=>e.find(e=>PJ(e.at,t))?.id;for(let e of s){let n=Ce(e.ref),r={x:e.at.x-1,y:e.at.y-1,width:2,height:2};S(e.id,n.cell,bJ([`ellipse`],{fillColor:`none`,strokeColor:`none`,points:`[]`,...WJ,...GJ}),c(n,FJ(r,n.box),e.side,(()=>{let r=t.stubs?.find(t=>t.node===e.stub),i=r===void 0?void 0:l(r,t.side).mark;return i!==void 0&&VJ(i)&&n.cell.startsWith(`pg-node~`)?e.side===`left`||e.side===`right`?i.fraction.y:i.fraction.x:void 0})()))}let f=e=>({[`${e}X`]:.5,[`${e}Y`]:.5,[`${e}Dx`]:0,[`${e}Dy`]:0,[`${e}Perimeter`]:0}),p=(e,t)=>({...e?f(`exit`):{},...t?f(`entry`):{}});for(let e of t.stubs){let n=t.ports.find(t=>t.node===e.node),r=be(`exit`,n,e.from),i=Ce(n),o=h(e.to),{mark:c}=l(e,t.side),p=r&&i&&r.cell===i.cell&&VJ(c)?zJ(`exit`,c):void 0,m=[r?.at??h(e.from),o],g=d(s,o);we($(`busStub`,t.id,e.node),ue(`overlay`),a(!1,{...r?.style??{},...p,...g?f(`entry`):{}}),m,{source:r?.cell,target:g,sourcePoint:r?void 0:m[0],targetPoint:g?void 0:m[1]},void 0,u),S($(`busMark`,t.id,e.node),i?.cell??ue(`overlay`),bJ([`ellipse`],{...ae(iq.overlayEndpoint(O,fm(t.class))),points:`[]`,...WJ,...GJ}),c)}let _=[];for(let e=0;e+1<s.length;e++){let n=s[e],r=s[e+1];_.push({id:$(`bus`,t.id,String(e)),points:[n.at,r.at]}),we(_[e].id,ue(`overlay`),a(!1,p(n.id,r.id)),[n.at,r.at],{source:n.id,target:r.id},void 0,u)}if(t.riser?.from!==void 0&&t.riser.to!==void 0){let n=[h(t.riser.from),h(t.riser.to)],r=e.meshBuses?.find(e=>e.id===t.joined),i=d(s,n[0]),c=r?d(o(r),n[1]):void 0;we($(`busRiser`,t.id),ue(`overlay`),a(!1,p(i,c),`riser`),n,{source:i,target:c,sourcePoint:i?void 0:n[0],targetPoint:c?void 0:n[1]},void 0,u)}let v=t.trunk?.joins;if(t.trunk!==void 0&&v!==void 0){let n=t.trunk.buses.map(t=>e.meshBuses?.find(e=>e.id===t)),r=v.map((e,t)=>{let r=n[t];return r===void 0?void 0:d(o(r),h(e))});for(let e=0;e+1<v.length;e++){let n=[h(v[e]),h(v[e+1])],i=r[e],o=r[e+1];we($(`busTrunk`,t.id,String(e)),ue(`overlay`),a(!1,p(i,o),`trunk`),n,{source:i,target:o,sourcePoint:i?void 0:n[0],targetPoint:o?void 0:n[1]},void 0,u)}}let y=e.labels.find(e=>e.id===t.label);if(y!==void 0&&!y.omitted&&y.bounds!==void 0){let e=MJ(g(y.bounds)),n=t=>{let n=Jq(e,{from:t.points[0],to:t.points[1]});return Math.hypot(e.x-n.x,e.y-n.y)},r=_.reduce((e,t)=>e===void 0||n(t)<n(e)?t:e,void 0);E($(`busLabel`,t.id),r?.id??ue(`labels`),y,g(y.bounds),ne(se(MK(`link-label`,`mesh-bus-label`),y.bounds,fm(t.class))),void 0,pe(MJ(y.bounds)),r===void 0?void 0:XJ(r.points,e))}}for(let t of e.labels){if(t.role!==`link`||t.omitted||!t.bounds||Ie.has(t.id))continue;let e=t.owner.kind===`barCross`?t.owner.link:t.owner.kind===`link`?t.owner.id:void 0,n=e===void 0?void 0:_e.get(e),r=e===void 0?void 0:Ee.get(e);if(!n||!r?.length){if(t.owner.kind!==`bundle`)continue;let e=t.owner.id;if(!Te.some(t=>t.bundle===e))continue;E($(`linkLabel`,t.id),ue(`labels`),t,g(t.bounds),ne(ke(t,!0,void 0)),void 0,pe(MJ(t.bounds)));continue}let i=r[Ne(t,n,r)],a=Oe(t,n),o=XJ(i.points,a,Fe(t,n,i)),s=t.owner.kind===`barCross`?$(`linkLabel`,w(n),t.owner.node):$(`linkLabel`,w(n));_.push(yJ({id:x(s),value:xJ(SJ(t)),style:bJ([`edgeLabel`],{resizable:0,points:`[]`,...Ae(t,a,`child`,n)}),vertex:1,connectable:0,parent:i.id},Q(`mxGeometry`,{x:o.x,y:o.y,relative:1,as:`geometry`},tJ(o)||void 0),_J({"pg-kind":`link-label`,"pg-of":w(n)},pq(t))))}if(e.legend){let t=g(e.legend.bounds);S($(`legend`),ue(`legend`),bJ([`group`],{points:`[]`}),t);for(let t of e.legend.entries){let n=e.labels.find(e=>e.id===t.label),r=n&&!n.omitted&&n.bounds?n:void 0,i=r?$q(g(t.swatch),g(r.bounds)):g(t.swatch),a=FJ(i,h(e.legend.bounds));S($(`legendRow`,t.id),$(`legend`),bJ([],{fillColor:`none`,strokeColor:`none`,points:`[]`,...r?{align:`left`,verticalAlign:`middle`,whiteSpace:`nowrap`,overflow:`visible`,spacingLeft:g(r.bounds).x-i.x-Wq,spacingTop:OJ(r,wJ(r),MJ(i).y-MJ(g(r.bounds)).y),fontFamily:vJ(r),fontSize:wJ(r),...ne(iq.inLegend(O,t.kind,t.key,MK(`legend-label`,rq.halo(aK(fe,MJ(r.bounds)))))),fontStyle:r.fontWeight===700?1:void 0}:{}}),a,r?xJ(SJ(r)):void 0);let o=FJ(g(t.swatch),i),c=nq(t.kind,t.key),u=e=>iq.inLegend(O,t.kind,t.key,e);if(t.kind===`line`){let n=u(rq.linkLine(c,Dm(e,t.key)));S($(`legendSwatch`,t.id),$(`legendRow`,t.id),bJ([],{shape:`line`,points:`[]`,...WJ,strokeColor:k(n,`stroke`),strokeWidth:t.strokeWidth??F.path,opacity:AJ(j(n,`stroke-opacity`)),...ce(A(n,e=>e.get(`stroke-dasharray`)))}),o)}else if(t.kind===`port`){let e=u(rq.pill(c)),n=re(e);S($(`legendSwatch`,t.id),$(`legendRow`,t.id),bJ([],{rounded:1,absoluteArcSize:1,arcSize:(t.radius??$e.pill)*2,fillColor:te(e,void 0),strokeColor:n.strokeColor,strokeWidth:F.pill,points:`[]`,...WJ,opacity:n.opacity,...ce(A(e,e=>e.get(`stroke-dasharray`)))}),o)}else if(t.icon){let e=o;S($(`legendBody`,t.id),$(`legendRow`,t.id),bJ([],{rounded:1,absoluteArcSize:1,arcSize:nV(l,2)*2,...re(u(rq.nodeBody(c,Pe(c,p)))),strokeWidth:F.pill,points:`[]`,...WJ}),{x:e.x-2,y:e.y-2,width:e.width+4,height:e.height+4});let n=ie(u(MK(`icon-tile`,c)),u(MK(`node-icon`,c))),r=s===`cisco19`?Zq[Ui(t.icon)]:void 0;if(r){r.kind===`silhouette`&&nJ(o)&&S($(`legendTile`,t.id),$(`legendRow`,t.id),bJ([],{rounded:1,absoluteArcSize:1,arcSize:l.radii.tile*2,fillColor:n.tile.fill,strokeColor:n.tile.stroke,points:`[]`,...WJ,opacity:n.tileOpacity}),o);let e=iJ(o,r);e&&S($(`legendSwatch`,t.id),$(`legendRow`,t.id),bJ([],{sketch:0,aspect:`fixed`,points:`[]`,...WJ,shape:Qq(r),...r.kind===`badge`?{prIcon:r.shape}:{},fillColor:r.kind===`badge`?n.tile.fill:n.glyph,strokeColor:r.kind===`badge`?n.glyph:`none`,opacity:r.kind===`badge`?n.tileOpacity:n.glyphOpacity}),e)}else{nJ(o)&&S($(`legendTile`,t.id),$(`legendRow`,t.id),bJ([],{rounded:1,absoluteArcSize:1,arcSize:l.radii.tile*2,fillColor:n.tile.fill,strokeColor:n.tile.stroke,points:`[]`,...WJ,opacity:n.tileOpacity}),o);let e=rJ(o);if(e){let r=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${Hi(t.icon)}" fill="none" stroke="${n.image}" stroke-width="${AK(Vq)}" stroke-linecap="round" stroke-linejoin="round"/></svg>`;S($(`legendSwatch`,t.id),$(`legendRow`,t.id),bJ([],{shape:`image`,imageAspect:0,points:`[]`,...WJ,image:kJ(r),opacity:n.glyphOpacity}),e)}}}}}let Re=M.map(e=>Q(`mxCell`,{id:x(ue(e)),value:le[e],parent:`0`})).join(``),ze=Q(`mxGraphModel`,{dx:0,dy:0,grid:0,gridSize:10,guides:1,tooltips:1,connect:1,arrows:0,fold:1,page:1,pageScale:1,pageWidth:Math.ceil(n.width),pageHeight:Math.ceil(n.height),math:0,shadow:0,background:de},Q(`root`,{},yJ({id:x(`0`)},void 0,mJ({"pg-schema":`1`},u.meta))+Re+_.map(e=>typeof e==`string`?e:e()).join(``))),Be=u.title??`portograph`,Ve=D.unmapped();Ve.length&&t.onDiagnostic?.({stage:`render`,severity:`warning`,code:`DRAWIO_CSS_UNMAPPED`,message:`draw.io cannot carry ${Ve.length} part(s) of css:, which the SVG applies: ${Ve.join(`; `)}`});let He=e.labels.filter(e=>!e.omitted&&e.bounds!==void 0&&SJ(e).length>1&&e.lineHeight!==void 0&&Math.abs(e.lineHeight-TJ(wJ(e)))>Hq);return He.length&&t.onDiagnostic?.({stage:`render`,severity:`warning`,code:`DRAWIO_LINE_PITCH`,message:`draw.io draws plain text at its own line pitch, so ${He.length} multi-line label(s) differ from the SVG in their further lines: ${He.map(e=>e.id).join(`; `)}`}),`<?xml version="1.0" encoding="UTF-8"?>
153
153
  `+Q(`mxfile`,{host:`portograph`},Q(`diagram`,{id:`pg-diagram`,name:Be},ze))+`
154
- `}var KJ=e=>e.slice(1).map((t,n)=>Math.hypot(t.x-e[n].x,t.y-e[n].y));function qJ(e,t,n){let r=t[0]??0,i=0,a=1;for(;n>=Math.round(i+r)&&a<e.length-1;)i+=r,r=t[a],a+=1;return{index:a,walked:i,span:r}}function JJ(e,t){let n=KJ(e),r=n.reduce((e,t)=>e+t,0),i=Math.round((t.x/2+.5)*r),{index:a,walked:o,span:s}=qJ(e,n,i),c=e[a-1],l=e[a],u=l.x-c.x,d=l.y-c.y,f=s===0?0:(i-o)/s,p=s===0?0:d/s,m=s===0?0:u/s;return{x:c.x+u*f+p*t.y+(t.offset?.x??0),y:c.y+d*f-m*t.y+(t.offset?.y??0)}}function YJ(e,t,n){let r=KJ(e),i=r.reduce((e,t)=>e+t,0),a=e[0]??t;if(i===0)return{x:0,y:0,offset:{x:t.x-a.x,y:t.y-a.y}};let o=Math.round(i),s=e=>Math.min(1,Math.max(-1,e/i*2-1)),c=new Set([s(0),s(o)]),l=0;for(let[n,i]of r.entries()){if(i>0){let r=e[n],a=e[n+1],u=((t.x-r.x)*(a.x-r.x)+(t.y-r.y)*(a.y-r.y))/(i*i),d=l+Math.min(1,Math.max(0,u))*i;for(let e of[-1,0,1])c.add(s(Math.min(o,Math.max(0,Math.floor(d)+e)))),c.add(s(Math.min(o,Math.max(0,Math.ceil(d)+e))))}l+=i}let u=(e,t)=>t===void 0||e.left<t.left-Hq||Math.abs(e.left-t.left)<=Hq&&e.beside<t.beside-Hq,d=r[0]??0,f=0,p=1,m,h;for(let a of[...c].sort((e,t)=>e-t)){let o=Math.round((a/2+.5)*i);for(;o>=Math.round(f+d)&&p<e.length-1;)f+=d,d=r[p],p+=1;let s=e[p-1],c=e[p],l=c.x-s.x,g=c.y-s.y,_=d===0?0:(o-f)/d,v={x:s.x+l*_,y:s.y+g*_},y=d===0?0:((t.x-v.x)*g-(t.y-v.y)*l)/d,b=d===0?Math.hypot(t.x-v.x,t.y-v.y):Math.abs(((t.x-v.x)*l+(t.y-v.y)*g)/d),x={label:{x:a,y},left:b,beside:Math.abs(y)};u(x,m)&&(m=x),n!==void 0&&p-1>=n[0]&&p-1<=n[1]&&d>0&&u(x,h)&&(h=x)}let g=h??m;if(g.left<=Hq)return g.label;let _=JJ(e,g.label);return{...g.label,offset:{x:t.x-_.x,y:t.y-_.y}}}e.ALIGNMENT_MAX_GROWTH=ca,e.ALL_DIRECTIONS=RC,e.BAR_PADDING=Ji,e.BundleFeasibilityError=dC,e.CANVAS_MARGIN=at,e.CARD_CONTENT_GEOMETRY=qi,e.COMMAND_DEADLINE_MS=m,e.CommandDeadlineError=MV,e.DEFAULT_STROKE_WIDTHS=F,e.DEFAULT_THEME_ID=YB,e.DIRECTION_BITS=LC,e.EXIT=p,e.ElkDeadlineError=kV,e.FINAL_STAGES=GE,e.FONT_FAMILY=St,e.GROUP_LABEL_GEOMETRY=$A,e.LEGEND_DEFAULT_CLASS=Le,e.LEGEND_GEOMETRY=mm,e.LINK_LABEL_CODES=Mh,e.LINK_LABEL_GEOMETRY=U,e.NETWORK_ICON_PATHS=Vi,e.NETWORK_LINK_CLASSES=ze,e.NETWORK_NODE_CLASSES=we,e.NETWORK_NODE_ICONS=Bi,e.NETWORK_PORT_LOOPBACK=He,e.NETWORK_PORT_ROLES=Ve,e.NETWORK_PORT_STATUS=We,e.NETWORK_THEME=Ke,e.NODE_CONTENT_GEOMETRY=Ki,e.OVERLAY_CLASSES=oV,e.OVERLAY_ENDPOINT_RADIUS=nt,e.OVERLAY_LABEL_DENSITY=sh,e.OVERLAY_PILL_CLEARANCE=lF,e.ParseError=Ud,e.ROUTE_BUDGET_MS=XH,e.ROUTE_PARAMETERS=WC,e.ROUTE_REQUEST=JH,e.ROUTE_RESPONSE=YH,e.ResolveError=rV,e.RouteDeadlineError=ZH,e.RouteSession=QH,e.SHAPE_BUFFER_DISTANCE=BC,e.SIDE_TIE_ORDER=LN,e.STRAIGHT_PATH_CLEARANCE=YL,e.SkeletonError=BH,e.TERMINAL_TRIM=Uf,e.THEMES=qB,e.THEME_IDS=JB,e.UNBOUNDED_BUDGET=PV,e.UsageError=g,e.VERBS=f,e.alignFlanks=sf,e.alignmentAllowance=ua,e.allocateGapRuns=dm,e.allocateLanes=SO,e.bands=eN,e.barLink=iv,e.bars=jv,e.batchRequest=_w,e.bundles=UH,e.centre=DS,e.centreDraft=qx,e.checkpointsHonoured=Cw,e.classDisplayLabel=Ye,e.classOrder=Xe,e.contentInsets=da,e.createBrowserElkFactory=DV,e.createBrowserRouteFactory=eU,e.createBudget=NV,e.createCentreBudget=$b,e.createLayoutModel=de,e.createRouteFactory=tU,e.createWorkerElkAttempt=EV,e.crossedTiers=Lw,e.diagramBounds=Sm,e.drawio=GJ,e.drawnBoxes=xm,e.elkDeadlineMs=OV,e.endpointId=wn,e.expectedFlankPath=nf,e.expectedRowPath=iR,e.facingPair=eR,e.findTheme=XB,e.flankPair=ef,e.flankPathCandidate=tf,e.flanks=cf,e.formatDiagnostic=ne,e.formatDiagnosticJson=re,e.formatStatus=ie,e.frameSubtreeCells=le,e.freezePortTopology=UE,e.groupNodeIds=ue,e.helpText=b,e.iconClass=Gi,e.iconKey=Ui,e.iconPath=Hi,e.isVerb=h,e.laneWidth=fD,e.lanes=WO,e.layout=OG,e.legendBoxes=Nm,e.legendKeyRadius=nV,e.legendRequired=km,e.legendVariants=Om,e.linkIds=Tn,e.linkLabels=rg,e.linkVisible=Cq,e.lostPlannedRun=Gw,e.measureNodeContent=aa,e.measurePortPill=Dt,e.measureText=Tt,e.migrate=rK,e.migrateWithDiagnostics=nK,e.nodeClassPaint=Te,e.nodeClassStyle=qe,e.nodeClearance=Kf,e.optimizeBundleOrder=kR,e.orderedGroupIds=M,e.orderedNodeIds=N,e.overlayBlockers=dF,e.overlayDensity=ch,e.overlayLabelsSuppressed=lh,e.overlayPath=FF,e.ownSideWidth=la,e.paintedSwatch=Mm,e.parse=$G,e.parseCommand=A,e.parseWithDiagnostics=QG,e.placeNodeContent=sa,e.placePortPill=Ii,e.placementRuns=JC,e.planRoute=ew,e.plannedRunsOf=XC,e.portAnchor=Fi,e.portKey=K,e.portPitch=Li,e.portRolePaint=Ue,e.portRoles=vm,e.preRoute=Hw,e.prepareBundleGeometry=dz,e.produceLegend=jm,e.produceLinkLabels=Qh,e.readCacheCounts=kn,e.rebuildBarDrops=Av,e.rebuildBundlePaths=kC,e.rebuildFlankPaths=rf,e.rebuildLaneExtents=QD,e.rebuildNodeGeometry=H,e.rebuildRegionGeometry=NC,e.rebuildRegions=XP,e.rebuildRowPaths=sR,e.render=Bq,e.reservationConflicts=Vw,e.reservedRuns=zw,e.resolve=SV,e.resolveBeforeExpansion=xV,e.resolveNodeIcon=Wi,e.restoreFinalLayout=KE,e.restoreLayoutModel=WE,e.route=aU,e.routeObstacles=np,e.routeRemainders=nU,e.rowPathCandidate=tR,e.rows=OR,e.runElkAttempt=AV,e.score=wU,e.selectAnchorTier=uD,e.serializeLayoutModel=fe,e.serializeLayoutSnapshot=pe,e.shapeBars=gv,e.sidecarPaths=ee,e.sidesOne=HN,e.sidesTwo=YA,e.simplify=Ew,e.sizeNodes=fa,e.skeleton=HH,e.solveTierGaps=VS,e.stemCheckpoint=QC,e.stitchPath=jw,e.stitchPaths=Iw,e.straightCorridorClear=rR,e.stubCandidate=Rw,e.systemRouteClock=qH,e.themeById=ZB,e.themeLinkClass=eV,e.themePortRole=tV,e.themeWashFill=$B,e.tiedPortComponents=VN,e.trimChain=Zf,e.unsupportedMessage=ae,e.validateLanes=UO,e.validateLinkLabels=ng,e.validateRoutedPaths=$w,e.withLayoutMutation=QE,e.withRouteSession=$H});
154
+ `}var qJ=e=>e.slice(1).map((t,n)=>Math.hypot(t.x-e[n].x,t.y-e[n].y));function JJ(e,t,n){let r=t[0]??0,i=0,a=1;for(;n>=Math.round(i+r)&&a<e.length-1;)i+=r,r=t[a],a+=1;return{index:a,walked:i,span:r}}function YJ(e,t){let n=qJ(e),r=n.reduce((e,t)=>e+t,0),i=Math.round((t.x/2+.5)*r),{index:a,walked:o,span:s}=JJ(e,n,i),c=e[a-1],l=e[a],u=l.x-c.x,d=l.y-c.y,f=s===0?0:(i-o)/s,p=s===0?0:d/s,m=s===0?0:u/s;return{x:c.x+u*f+p*t.y+(t.offset?.x??0),y:c.y+d*f-m*t.y+(t.offset?.y??0)}}function XJ(e,t,n){let r=qJ(e),i=r.reduce((e,t)=>e+t,0),a=e[0]??t;if(i===0)return{x:0,y:0,offset:{x:t.x-a.x,y:t.y-a.y}};let o=Math.round(i),s=e=>Math.min(1,Math.max(-1,e/i*2-1)),c=new Set([s(0),s(o)]),l=0;for(let[n,i]of r.entries()){if(i>0){let r=e[n],a=e[n+1],u=((t.x-r.x)*(a.x-r.x)+(t.y-r.y)*(a.y-r.y))/(i*i),d=l+Math.min(1,Math.max(0,u))*i;for(let e of[-1,0,1])c.add(s(Math.min(o,Math.max(0,Math.floor(d)+e)))),c.add(s(Math.min(o,Math.max(0,Math.ceil(d)+e))))}l+=i}let u=(e,t)=>t===void 0||e.left<t.left-Hq||Math.abs(e.left-t.left)<=Hq&&e.beside<t.beside-Hq,d=r[0]??0,f=0,p=1,m,h;for(let a of[...c].sort((e,t)=>e-t)){let o=Math.round((a/2+.5)*i);for(;o>=Math.round(f+d)&&p<e.length-1;)f+=d,d=r[p],p+=1;let s=e[p-1],c=e[p],l=c.x-s.x,g=c.y-s.y,_=d===0?0:(o-f)/d,v={x:s.x+l*_,y:s.y+g*_},y=d===0?0:((t.x-v.x)*g-(t.y-v.y)*l)/d,b=d===0?Math.hypot(t.x-v.x,t.y-v.y):Math.abs(((t.x-v.x)*l+(t.y-v.y)*g)/d),x={label:{x:a,y},left:b,beside:Math.abs(y)};u(x,m)&&(m=x),n!==void 0&&p-1>=n[0]&&p-1<=n[1]&&d>0&&u(x,h)&&(h=x)}let g=h??m;if(g.left<=Hq)return g.label;let _=YJ(e,g.label);return{...g.label,offset:{x:t.x-_.x,y:t.y-_.y}}}e.ALIGNMENT_MAX_GROWTH=ca,e.ALL_DIRECTIONS=RC,e.BAR_PADDING=Ji,e.BundleFeasibilityError=dC,e.CANVAS_MARGIN=at,e.CARD_CONTENT_GEOMETRY=qi,e.COMMAND_DEADLINE_MS=m,e.CommandDeadlineError=MV,e.DEFAULT_STROKE_WIDTHS=F,e.DEFAULT_THEME_ID=YB,e.DIRECTION_BITS=LC,e.EXIT=p,e.ElkDeadlineError=kV,e.FINAL_STAGES=GE,e.FONT_FAMILY=St,e.GROUP_LABEL_GEOMETRY=$A,e.LEGEND_DEFAULT_CLASS=Le,e.LEGEND_GEOMETRY=mm,e.LINK_LABEL_CODES=Mh,e.LINK_LABEL_GEOMETRY=U,e.NETWORK_ICON_PATHS=Vi,e.NETWORK_LINK_CLASSES=ze,e.NETWORK_NODE_CLASSES=we,e.NETWORK_NODE_ICONS=Bi,e.NETWORK_PORT_LOOPBACK=He,e.NETWORK_PORT_ROLES=Ve,e.NETWORK_PORT_STATUS=We,e.NETWORK_THEME=Ke,e.NODE_CONTENT_GEOMETRY=Ki,e.OVERLAY_CLASSES=oV,e.OVERLAY_ENDPOINT_RADIUS=nt,e.OVERLAY_LABEL_DENSITY=sh,e.OVERLAY_PILL_CLEARANCE=lF,e.ParseError=Ud,e.ROUTE_BUDGET_MS=XH,e.ROUTE_PARAMETERS=WC,e.ROUTE_REQUEST=JH,e.ROUTE_RESPONSE=YH,e.ResolveError=rV,e.RouteDeadlineError=ZH,e.RouteSession=QH,e.SHAPE_BUFFER_DISTANCE=BC,e.SIDE_TIE_ORDER=LN,e.STRAIGHT_PATH_CLEARANCE=YL,e.SkeletonError=BH,e.TERMINAL_TRIM=Uf,e.THEMES=qB,e.THEME_IDS=JB,e.UNBOUNDED_BUDGET=PV,e.UsageError=g,e.VERBS=f,e.alignFlanks=sf,e.alignmentAllowance=ua,e.allocateGapRuns=dm,e.allocateLanes=SO,e.bands=eN,e.barLink=iv,e.bars=jv,e.batchRequest=_w,e.bundles=UH,e.centre=DS,e.centreDraft=qx,e.checkpointsHonoured=Cw,e.classDisplayLabel=Ye,e.classOrder=Xe,e.contentInsets=da,e.createBrowserElkFactory=DV,e.createBrowserRouteFactory=eU,e.createBudget=NV,e.createCentreBudget=$b,e.createLayoutModel=de,e.createRouteFactory=tU,e.createWorkerElkAttempt=EV,e.crossedTiers=Lw,e.diagramBounds=Sm,e.drawio=KJ,e.drawnBoxes=xm,e.elkDeadlineMs=OV,e.endpointId=wn,e.expectedFlankPath=nf,e.expectedRowPath=iR,e.facingPair=eR,e.findTheme=XB,e.flankPair=ef,e.flankPathCandidate=tf,e.flanks=cf,e.formatDiagnostic=ne,e.formatDiagnosticJson=re,e.formatStatus=ie,e.frameSubtreeCells=le,e.freezePortTopology=UE,e.groupNodeIds=ue,e.helpText=b,e.iconClass=Gi,e.iconKey=Ui,e.iconPath=Hi,e.isVerb=h,e.laneWidth=fD,e.lanes=WO,e.layout=OG,e.legendBoxes=Nm,e.legendKeyRadius=nV,e.legendRequired=km,e.legendVariants=Om,e.linkIds=Tn,e.linkLabels=rg,e.linkVisible=Cq,e.lostPlannedRun=Gw,e.measureNodeContent=aa,e.measurePortPill=Dt,e.measureText=Tt,e.migrate=rK,e.migrateWithDiagnostics=nK,e.nodeClassPaint=Te,e.nodeClassStyle=qe,e.nodeClearance=Kf,e.optimizeBundleOrder=kR,e.orderedGroupIds=M,e.orderedNodeIds=N,e.overlayBlockers=dF,e.overlayDensity=ch,e.overlayLabelsSuppressed=lh,e.overlayPath=FF,e.ownSideWidth=la,e.paintedSwatch=Mm,e.parse=$G,e.parseCommand=A,e.parseWithDiagnostics=QG,e.placeNodeContent=sa,e.placePortPill=Ii,e.placementRuns=JC,e.planRoute=ew,e.plannedRunsOf=XC,e.portAnchor=Fi,e.portKey=K,e.portPitch=Li,e.portRolePaint=Ue,e.portRoles=vm,e.preRoute=Hw,e.prepareBundleGeometry=dz,e.produceLegend=jm,e.produceLinkLabels=Qh,e.readCacheCounts=kn,e.rebuildBarDrops=Av,e.rebuildBundlePaths=kC,e.rebuildFlankPaths=rf,e.rebuildLaneExtents=QD,e.rebuildNodeGeometry=H,e.rebuildRegionGeometry=NC,e.rebuildRegions=XP,e.rebuildRowPaths=sR,e.render=Bq,e.reservationConflicts=Vw,e.reservedRuns=zw,e.resolve=SV,e.resolveBeforeExpansion=xV,e.resolveNodeIcon=Wi,e.restoreFinalLayout=KE,e.restoreLayoutModel=WE,e.route=aU,e.routeObstacles=np,e.routeRemainders=nU,e.rowPathCandidate=tR,e.rows=OR,e.runElkAttempt=AV,e.score=wU,e.selectAnchorTier=uD,e.serializeLayoutModel=fe,e.serializeLayoutSnapshot=pe,e.shapeBars=gv,e.sidecarPaths=ee,e.sidesOne=HN,e.sidesTwo=YA,e.simplify=Ew,e.sizeNodes=fa,e.skeleton=HH,e.solveTierGaps=VS,e.stemCheckpoint=QC,e.stitchPath=jw,e.stitchPaths=Iw,e.straightCorridorClear=rR,e.stubCandidate=Rw,e.systemRouteClock=qH,e.themeById=ZB,e.themeLinkClass=eV,e.themePortRole=tV,e.themeWashFill=$B,e.tiedPortComponents=VN,e.trimChain=Zf,e.unsupportedMessage=ae,e.validateLanes=UO,e.validateLinkLabels=ng,e.validateRoutedPaths=$w,e.withLayoutMutation=QE,e.withRouteSession=$H});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portograph",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "YAML in, a laid-out diagram (SVG) out: nodes with ports, grouped into tiers, links routed per region.",
5
5
  "keywords": [
6
6
  "diagram",