mudlet-map-renderer 0.37.2-konva → 0.38.0-konva

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.
package/dist/index.mjs CHANGED
@@ -47,7 +47,8 @@ function p() {
47
47
  areaName: !0,
48
48
  fontFamily: "sans-serif",
49
49
  uniformLevelSize: !1,
50
- areaExitLabels: !1
50
+ areaExitLabels: !1,
51
+ areaExitLabelFontSize: .3
51
52
  };
52
53
  }
53
54
  //#endregion
@@ -263,7 +264,7 @@ var v = class {
263
264
  return this.inner.getInverseTransform();
264
265
  }
265
266
  }, S = (e) => e;
266
- function ee(...e) {
267
+ function C(...e) {
267
268
  return e.length === 0 ? S : e.length === 1 ? e[0] : (t) => {
268
269
  let n = t;
269
270
  for (let t of e) n = t(n);
@@ -272,33 +273,33 @@ function ee(...e) {
272
273
  }
273
274
  //#endregion
274
275
  //#region src/utils/textMeasure.ts
275
- var C = 72, w = 200, T = 120, E = /* @__PURE__ */ new Map(), D = null;
276
- function O() {
277
- return D || (D = e.Util.createCanvasElement(), D.width = w, D.height = w), D;
276
+ var w = 72, T = 200, E = 120, D = /* @__PURE__ */ new Map(), O = null;
277
+ function k() {
278
+ return O || (O = e.Util.createCanvasElement(), O.width = T, O.height = T), O;
278
279
  }
279
- function te(e, t) {
280
- let n = `${e}::${t}`, r = E.get(n);
280
+ function A(e, t) {
281
+ let n = `${e}::${t}`, r = D.get(n);
281
282
  if (r !== void 0) return r;
282
- let i = O().getContext("2d", { willReadFrequently: !0 }), a = `bold ${C}px ${t}`;
283
- i.clearRect(0, 0, w, w), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, w / 2, T);
284
- let { data: o } = i.getImageData(0, 0, w, w), s = w, c = -1;
285
- for (let e = 0; e < w; e++) for (let t = 0; t < w; t++) o[(e * w + t) * 4 + 3] > 16 && (e < s && (s = e), e > c && (c = e));
283
+ let i = k().getContext("2d", { willReadFrequently: !0 }), a = `bold ${w}px ${t}`;
284
+ i.clearRect(0, 0, T, T), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, T / 2, E);
285
+ let { data: o } = i.getImageData(0, 0, T, T), s = T, c = -1;
286
+ for (let e = 0; e < T; e++) for (let t = 0; t < T; t++) o[(e * T + t) * 4 + 3] > 16 && (e < s && (s = e), e > c && (c = e));
286
287
  if (c === -1) {
287
288
  let e = {
288
289
  baselineRatio: .35,
289
290
  konvaCorrectionRatio: 0
290
291
  };
291
- return E.set(n, e), e;
292
+ return D.set(n, e), e;
292
293
  }
293
- let l = (T - s - Math.max(0, c - T)) / 2 / C, u = i.measureText("M"), d = {
294
+ let l = (E - s - Math.max(0, c - E)) / 2 / w, u = i.measureText("M"), d = {
294
295
  baselineRatio: l,
295
- konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / C - l
296
+ konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / w - l
296
297
  };
297
- return E.set(n, d), d;
298
+ return D.set(n, d), d;
298
299
  }
299
300
  //#endregion
300
301
  //#region src/scene/RoomStyle.ts
301
- function ne(e, t, n, r) {
302
+ function j(e, t, n, r) {
302
303
  let i = t.getColorValue(e.env), a = n.coloredMode ? h(i, .5) : n.frameMode ? n.backgroundColor : i, o = n.coloredMode ? g(i, .1) : i;
303
304
  return {
304
305
  fillColor: a,
@@ -308,7 +309,7 @@ function ne(e, t, n, r) {
308
309
  envColor: i
309
310
  };
310
311
  }
311
- function re(e, t) {
312
+ function M(e, t) {
312
313
  if (!t.emboss) return null;
313
314
  let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, i = t.lineWidth, a = g(e, .35), o = h(e, .45);
314
315
  if (t.roomShape === "circle") {
@@ -412,12 +413,12 @@ function re(e, t) {
412
413
  }
413
414
  //#endregion
414
415
  //#region src/RoomShapeRenderer.ts
415
- var ie = class {
416
+ var N = class {
416
417
  constructor(e, t, n) {
417
418
  this.mapReader = e, this.settings = t, this.backend = n;
418
419
  }
419
420
  createRoomGroup(e, t) {
420
- let { fillColor: n, strokeColor: r, borderWidth: i, symbolColor: a } = ne(e, this.mapReader, this.settings, t?.strokeOverride), o = this.settings.roomSize, s = this.backend.createGroup(e.x - o / 2, e.y - o / 2), c = i / 2, l = re(n, this.settings), u = l ? 0 : i, d = this.backend.getTransform() === b, f = this.settings.coloredMode && u > 0 && d, p = (e) => this.settings.roomShape === "roundedRectangle" ? Math.max(0, (o - 2 * e) * .2) : 0;
421
+ let { fillColor: n, strokeColor: r, borderWidth: i, symbolColor: a } = j(e, this.mapReader, this.settings, t?.strokeOverride), o = this.settings.roomSize, s = this.backend.createGroup(e.x - o / 2, e.y - o / 2), c = i / 2, l = M(n, this.settings), u = l ? 0 : i, d = this.backend.getTransform() === b, f = this.settings.coloredMode && u > 0 && d, p = (e) => this.settings.roomShape === "roundedRectangle" ? Math.max(0, (o - 2 * e) * .2) : 0;
421
422
  if (f) {
422
423
  let e = [h(r, .5), r], t = i * 2;
423
424
  this.settings.roomShape === "circle" ? this.backend.addCircle(s, {
@@ -481,7 +482,7 @@ var ie = class {
481
482
  lineCap: l.highlight.lineCap,
482
483
  lineJoin: l.shadow.lineJoin
483
484
  })), e.roomChar) {
484
- let t = o * .75, { baselineRatio: n, konvaCorrectionRatio: r } = te(e.roomChar, this.settings.fontFamily), i = Math.max(o, e.roomChar.length * t * .8), c = (i - o) / 2;
485
+ let t = o * .75, { baselineRatio: n, konvaCorrectionRatio: r } = A(e.roomChar, this.settings.fontFamily), i = Math.max(o, e.roomChar.length * t * .8), c = (i - o) / 2;
485
486
  this.backend.addText(s, {
486
487
  x: -c,
487
488
  y: 0,
@@ -500,7 +501,7 @@ var ie = class {
500
501
  }
501
502
  return s;
502
503
  }
503
- }, ae = class {
504
+ }, P = class {
504
505
  constructor(e, t, n) {
505
506
  this.cachedBounds = null, this.inverseTransform = (e, t) => ({
506
507
  x: e,
@@ -549,7 +550,7 @@ var ie = class {
549
550
  bottom: v
550
551
  }, this.layer.batchDraw();
551
552
  }
552
- }, k = [
553
+ }, F = [
553
554
  "north",
554
555
  "south",
555
556
  "east",
@@ -558,7 +559,7 @@ var ie = class {
558
559
  "northwest",
559
560
  "southeast",
560
561
  "southwest"
561
- ], oe = {
562
+ ], I = {
562
563
  n: "north",
563
564
  s: "south",
564
565
  e: "east",
@@ -567,7 +568,7 @@ var ie = class {
567
568
  nw: "northwest",
568
569
  se: "southeast",
569
570
  sw: "southwest"
570
- }, A = {
571
+ }, L = {
571
572
  north: "n",
572
573
  south: "s",
573
574
  east: "e",
@@ -580,7 +581,7 @@ var ie = class {
580
581
  down: "d",
581
582
  in: "i",
582
583
  out: "o"
583
- }, j = {
584
+ }, R = {
584
585
  north: {
585
586
  x: 0,
586
587
  y: -1
@@ -613,7 +614,7 @@ var ie = class {
613
614
  x: -1,
614
615
  y: 1
615
616
  }
616
- }, se = [
617
+ }, ee = [
617
618
  "north",
618
619
  "south",
619
620
  "east",
@@ -622,7 +623,7 @@ var ie = class {
622
623
  "northwest",
623
624
  "southeast",
624
625
  "southwest"
625
- ], ce = {
626
+ ], te = {
626
627
  north: "south",
627
628
  south: "north",
628
629
  east: "west",
@@ -632,39 +633,39 @@ var ie = class {
632
633
  southeast: "northwest",
633
634
  southwest: "northeast"
634
635
  };
635
- function le(e) {
636
- return e ? Object.prototype.hasOwnProperty.call(j, e) : !1;
636
+ function ne(e) {
637
+ return e ? Object.prototype.hasOwnProperty.call(R, e) : !1;
637
638
  }
638
- function M(e, t, n, r = 1) {
639
- if (!le(n)) return {
639
+ function z(e, t, n, r = 1) {
640
+ if (!ne(n)) return {
640
641
  x: e,
641
642
  y: t
642
643
  };
643
- let i = j[n];
644
+ let i = R[n];
644
645
  return {
645
646
  x: e + i.x * r,
646
647
  y: t + i.y * r
647
648
  };
648
649
  }
649
- function ue(e, t, n, r = 1, i = 0) {
650
- if (!le(n)) return {
650
+ function re(e, t, n, r = 1, i = 0) {
651
+ if (!ne(n)) return {
651
652
  x: e,
652
653
  y: t
653
654
  };
654
- let a = j[n];
655
- if (!(a.x !== 0 && a.y !== 0) || i <= 0) return M(e, t, n, r);
655
+ let a = R[n];
656
+ if (!(a.x !== 0 && a.y !== 0) || i <= 0) return z(e, t, n, r);
656
657
  let o = r - i + i / Math.SQRT2;
657
658
  return {
658
659
  x: e + a.x * o,
659
660
  y: t + a.y * o
660
661
  };
661
662
  }
662
- function de(e, t, n, r = 1) {
663
- if (!le(n)) return {
663
+ function ie(e, t, n, r = 1) {
664
+ if (!ne(n)) return {
664
665
  x: e,
665
666
  y: t
666
667
  };
667
- let i = j[n], a = Math.atan2(i.y, i.x);
668
+ let i = R[n], a = Math.atan2(i.y, i.x);
668
669
  return {
669
670
  x: e + Math.cos(a) * r,
670
671
  y: t + Math.sin(a) * r
@@ -672,32 +673,32 @@ function de(e, t, n, r = 1) {
672
673
  }
673
674
  //#endregion
674
675
  //#region src/ExitRenderer.ts
675
- var N = {
676
+ var B = {
676
677
  OPEN_DOOR: "rgb(10, 155, 10)",
677
678
  CLOSED_DOOR: "rgb(226, 205, 59)",
678
679
  LOCKED_DOOR: "rgb(155, 10, 10)",
679
680
  ONE_WAY_FILL: "rgb(155, 10, 10)"
680
681
  };
681
- function fe(e) {
682
+ function ae(e) {
682
683
  switch (e) {
683
- case 1: return N.OPEN_DOOR;
684
- case 2: return N.CLOSED_DOOR;
685
- default: return N.LOCKED_DOOR;
684
+ case 1: return B.OPEN_DOOR;
685
+ case 2: return B.CLOSED_DOOR;
686
+ default: return B.LOCKED_DOOR;
686
687
  }
687
688
  }
688
- var pe = class {
689
+ var oe = class {
689
690
  constructor(e, t) {
690
691
  this.mapReader = e, this.settings = t;
691
692
  }
692
693
  getRoomEdgePoint(e, t, n, r) {
693
694
  let i = r - (this.settings.borders ? this.settings.lineWidth / 2 : 0);
694
- return this.settings.roomShape === "circle" ? de(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? ue(e, t, n, i, this.settings.roomSize * .2) : M(e, t, n, i);
695
+ return this.settings.roomShape === "circle" ? ie(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? re(e, t, n, i, this.settings.roomSize * .2) : z(e, t, n, i);
695
696
  }
696
697
  renderData(e, t) {
697
698
  return this.renderDataWithColor(e, this.settings.lineColor, t);
698
699
  }
699
700
  renderDataWithColor(e, t, n) {
700
- let r = e.aDir && k.includes(e.aDir), i = e.bDir && k.includes(e.bDir);
701
+ let r = e.aDir && F.includes(e.aDir), i = e.bDir && F.includes(e.bDir);
701
702
  if (r && i) return this.renderTwoWayExitData(e, t, n);
702
703
  if (r || i) {
703
704
  let n = r ? "a" : "b";
@@ -706,7 +707,7 @@ var pe = class {
706
707
  }
707
708
  renderTwoWayExitData(e, t, n) {
708
709
  let r = this.mapReader.getRoom(e.a), i = this.mapReader.getRoom(e.b);
709
- if (!r || !i || !e.aDir || !e.bDir || r.customLines[A[e.aDir]] && i.customLines[A[e.bDir]] || r.z !== i.z && (n !== i.z && r.customLines[A[e.aDir]] || n !== r.z && i.customLines[A[e.bDir]])) return;
710
+ if (!r || !i || !e.aDir || !e.bDir || r.customLines[L[e.aDir]] && i.customLines[L[e.bDir]] || r.z !== i.z && (n !== i.z && r.customLines[L[e.aDir]] || n !== r.z && i.customLines[L[e.bDir]])) return;
710
711
  let a = this.getRoomEdgePoint(r.x, r.y, e.aDir, this.settings.roomSize / 2), o = this.getRoomEdgePoint(i.x, i.y, e.bDir, this.settings.roomSize / 2), s = [
711
712
  a.x,
712
713
  a.y,
@@ -716,7 +717,7 @@ var pe = class {
716
717
  points: s,
717
718
  stroke: t,
718
719
  strokeWidth: this.settings.lineWidth
719
- }], l = [], u = r.doors[A[e.aDir]] ?? i.doors[A[e.bDir]];
720
+ }], l = [], u = r.doors[L[e.aDir]] ?? i.doors[L[e.bDir]];
720
721
  if (u) {
721
722
  let e = s[0] + (s[2] - s[0]) / 2, t = s[1] + (s[3] - s[1]) / 2;
722
723
  l.push({
@@ -724,7 +725,7 @@ var pe = class {
724
725
  y: t - this.settings.roomSize / 4,
725
726
  width: this.settings.roomSize / 2,
726
727
  height: this.settings.roomSize / 2,
727
- stroke: fe(u),
728
+ stroke: ae(u),
728
729
  strokeWidth: this.settings.lineWidth
729
730
  });
730
731
  }
@@ -755,9 +756,9 @@ var pe = class {
755
756
  }
756
757
  renderOneWayExitData(e, t, n) {
757
758
  let r = n === "a" || !n && e.aDir, i = r ? this.mapReader.getRoom(e.a) : this.mapReader.getRoom(e.b), a = r ? this.mapReader.getRoom(e.b) : this.mapReader.getRoom(e.a), o = r ? e.aDir : e.bDir;
758
- if (!o || !i || !a || !k.includes(o) || i.customLines[A[o] || o]) return;
759
+ if (!o || !i || !a || !F.includes(o) || i.customLines[L[o] || o]) return;
759
760
  if (i.area != a.area && o) {
760
- let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = M(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
761
+ let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = z(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
761
762
  return {
762
763
  lines: [],
763
764
  arrows: [{
@@ -796,8 +797,8 @@ var pe = class {
796
797
  x: a.x,
797
798
  y: a.y
798
799
  };
799
- s && (c = M(i.x, i.y, o, this.settings.roomSize / 2));
800
- let l = M(i.x, i.y, o, .3), u = l.x - (l.x - c.x) / 2, d = l.y - (l.y - c.y) / 2, f = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), p = [
800
+ s && (c = z(i.x, i.y, o, this.settings.roomSize / 2));
801
+ let l = z(i.x, i.y, o, .3), u = l.x - (l.x - c.x) / 2, d = l.y - (l.y - c.y) / 2, f = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), p = [
801
802
  f.x,
802
803
  f.y,
803
804
  c.x,
@@ -829,7 +830,7 @@ var pe = class {
829
830
  pointerWidth: .35,
830
831
  strokeWidth: this.settings.lineWidth * 1.4,
831
832
  stroke: t,
832
- fill: N.ONE_WAY_FILL,
833
+ fill: B.ONE_WAY_FILL,
833
834
  dash: [.1, .05]
834
835
  }],
835
836
  doors: [],
@@ -884,7 +885,7 @@ var pe = class {
884
885
  for (let [r, i] of Object.entries(e.customLines)) {
885
886
  let a = e.specialExits[r];
886
887
  if (a === void 0) {
887
- let t = oe[r] ?? n[r];
888
+ let t = I[r] ?? n[r];
888
889
  t && (a = e.exits[t] ?? e.specialExits[t]);
889
890
  }
890
891
  if (a === void 0 && (a = e.exits[r] ?? e.specialExits[r]), a === void 0) continue;
@@ -916,7 +917,7 @@ var pe = class {
916
917
  }
917
918
  return t;
918
919
  }
919
- }, me = {
920
+ }, se = {
920
921
  1: "north",
921
922
  2: "northeast",
922
923
  3: "northwest",
@@ -930,15 +931,15 @@ var pe = class {
930
931
  11: "in",
931
932
  12: "out"
932
933
  };
933
- function he(e, t, n, r, i) {
934
- return e.roomShape === "circle" ? de(t, n, r, i) : e.roomShape === "roundedRectangle" ? ue(t, n, r, i, e.roomSize * .2) : M(t, n, r, i);
934
+ function ce(e, t, n, r, i) {
935
+ return e.roomShape === "circle" ? ie(t, n, r, i) : e.roomShape === "roundedRectangle" ? re(t, n, r, i, e.roomSize * .2) : z(t, n, r, i);
935
936
  }
936
- function ge(e, t, n) {
937
+ function le(e, t, n) {
937
938
  let r = [];
938
939
  for (let i of e.stubs) {
939
- let a = me[i];
940
+ let a = se[i];
940
941
  if (!a) continue;
941
- let o = he(t, e.x, e.y, a, t.roomSize / 2), s = M(e.x, e.y, a, t.roomSize / 2 + .5);
942
+ let o = ce(t, e.x, e.y, a, t.roomSize / 2), s = z(e.x, e.y, a, t.roomSize / 2 + .5);
942
943
  r.push({
943
944
  x1: o.x,
944
945
  y1: o.y,
@@ -952,12 +953,12 @@ function ge(e, t, n) {
952
953
  }
953
954
  //#endregion
954
955
  //#region src/scene/SpecialExitStyle.ts
955
- var _e = {
956
+ var ue = {
956
957
  1: "rgb(10, 155, 10)",
957
958
  2: "rgb(226, 205, 59)",
958
959
  3: "rgb(155, 10, 10)"
959
960
  };
960
- function ve(e, t, n) {
961
+ function de(e, t, n) {
961
962
  let r = [];
962
963
  for (let [i, a] of Object.entries(e.customLines)) {
963
964
  let o = [e.x, e.y];
@@ -992,7 +993,7 @@ function ve(e, t, n) {
992
993
  y: n - r / 2,
993
994
  width: r,
994
995
  height: r,
995
- stroke: _e[f] ?? _e[3],
996
+ stroke: ue[f] ?? ue[3],
996
997
  strokeWidth: t.lineWidth
997
998
  };
998
999
  }
@@ -1006,13 +1007,13 @@ function ve(e, t, n) {
1006
1007
  }
1007
1008
  //#endregion
1008
1009
  //#region src/scene/InnerExitStyle.ts
1009
- var ye = [
1010
+ var fe = [
1010
1011
  "up",
1011
1012
  "down",
1012
1013
  "in",
1013
1014
  "out"
1014
1015
  ];
1015
- function P(e, t, n, r) {
1016
+ function V(e, t, n, r) {
1016
1017
  let i = r * Math.PI / 180, a = [];
1017
1018
  for (let r = 0; r < 3; r++) {
1018
1019
  let o = 2 * Math.PI * r / 3 - Math.PI / 2, s = Math.cos(o) * n * 1.4, c = Math.sin(o) * n * .8, l = s * Math.cos(i) - c * Math.sin(i), u = s * Math.sin(i) + c * Math.cos(i);
@@ -1020,29 +1021,29 @@ function P(e, t, n, r) {
1020
1021
  }
1021
1022
  return a;
1022
1023
  }
1023
- function be(e, t, n) {
1024
+ function pe(e, t, n) {
1024
1025
  return {
1025
1026
  symbolColor: n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env),
1026
1027
  symbolFill: n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env, .6)
1027
1028
  };
1028
1029
  }
1029
- var xe = {
1030
+ var me = {
1030
1031
  1: "rgb(10, 155, 10)",
1031
1032
  2: "rgb(226, 205, 59)",
1032
1033
  3: "rgb(155, 10, 10)"
1033
1034
  };
1034
- function Se(e, t, n) {
1035
- let r = [], i = n.roomSize, a = i / 5, { symbolColor: o, symbolFill: s } = be(e, t, n);
1036
- for (let t of ye) {
1035
+ function he(e, t, n) {
1036
+ let r = [], i = n.roomSize, a = i / 5, { symbolColor: o, symbolFill: s } = pe(e, t, n);
1037
+ for (let t of fe) {
1037
1038
  if (!e.exits[t]) continue;
1038
- let c = e.doors[t], l = c === void 0 ? o : xe[c] ?? xe[3];
1039
+ let c = e.doors[t], l = c === void 0 ? o : me[c] ?? me[3];
1039
1040
  switch (t) {
1040
1041
  case "up": {
1041
- let t = M(e.x, e.y, "south", i / 4);
1042
+ let t = z(e.x, e.y, "south", i / 4);
1042
1043
  r.push({
1043
1044
  cx: t.x,
1044
1045
  cy: t.y,
1045
- vertices: P(t.x, t.y, a, 0),
1046
+ vertices: V(t.x, t.y, a, 0),
1046
1047
  fill: s,
1047
1048
  stroke: l,
1048
1049
  strokeWidth: n.lineWidth
@@ -1050,11 +1051,11 @@ function Se(e, t, n) {
1050
1051
  break;
1051
1052
  }
1052
1053
  case "down": {
1053
- let t = M(e.x, e.y, "north", i / 4);
1054
+ let t = z(e.x, e.y, "north", i / 4);
1054
1055
  r.push({
1055
1056
  cx: t.x,
1056
1057
  cy: t.y,
1057
- vertices: P(t.x, t.y, a, 180),
1058
+ vertices: V(t.x, t.y, a, 180),
1058
1059
  fill: s,
1059
1060
  stroke: l,
1060
1061
  strokeWidth: n.lineWidth
@@ -1062,18 +1063,18 @@ function Se(e, t, n) {
1062
1063
  break;
1063
1064
  }
1064
1065
  case "in": {
1065
- let t = M(e.x, e.y, "west", i / 4), o = M(e.x, e.y, "east", i / 4);
1066
+ let t = z(e.x, e.y, "west", i / 4), o = z(e.x, e.y, "east", i / 4);
1066
1067
  r.push({
1067
1068
  cx: t.x,
1068
1069
  cy: t.y,
1069
- vertices: P(t.x, t.y, a, 90),
1070
+ vertices: V(t.x, t.y, a, 90),
1070
1071
  fill: s,
1071
1072
  stroke: l,
1072
1073
  strokeWidth: n.lineWidth
1073
1074
  }), r.push({
1074
1075
  cx: o.x,
1075
1076
  cy: o.y,
1076
- vertices: P(o.x, o.y, a, -90),
1077
+ vertices: V(o.x, o.y, a, -90),
1077
1078
  fill: s,
1078
1079
  stroke: l,
1079
1080
  strokeWidth: n.lineWidth
@@ -1081,18 +1082,18 @@ function Se(e, t, n) {
1081
1082
  break;
1082
1083
  }
1083
1084
  case "out": {
1084
- let t = M(e.x, e.y, "west", i / 4), o = M(e.x, e.y, "east", i / 4);
1085
+ let t = z(e.x, e.y, "west", i / 4), o = z(e.x, e.y, "east", i / 4);
1085
1086
  r.push({
1086
1087
  cx: t.x,
1087
1088
  cy: t.y,
1088
- vertices: P(t.x, t.y, a, -90),
1089
+ vertices: V(t.x, t.y, a, -90),
1089
1090
  fill: s,
1090
1091
  stroke: l,
1091
1092
  strokeWidth: n.lineWidth
1092
1093
  }), r.push({
1093
1094
  cx: o.x,
1094
1095
  cy: o.y,
1095
- vertices: P(o.x, o.y, a, 90),
1096
+ vertices: V(o.x, o.y, a, 90),
1096
1097
  fill: s,
1097
1098
  stroke: l,
1098
1099
  strokeWidth: n.lineWidth
@@ -1105,15 +1106,15 @@ function Se(e, t, n) {
1105
1106
  }
1106
1107
  //#endregion
1107
1108
  //#region src/ScenePipeline.ts
1108
- function Ce(e) {
1109
+ function ge(e) {
1109
1110
  let t = (e?.alpha ?? 255) / 255, n = (e) => Math.min(255, Math.max(0, e ?? 0));
1110
1111
  return `rgba(${n(e?.r)}, ${n(e?.g)}, ${n(e?.b)}, ${t})`;
1111
1112
  }
1112
- function we(e, t) {
1113
- let n = Te(e);
1113
+ function _e(e, t) {
1114
+ let n = ve(e);
1114
1115
  return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${t})` : e;
1115
1116
  }
1116
- function Te(e) {
1117
+ function ve(e) {
1117
1118
  let t = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
1118
1119
  if (t) return {
1119
1120
  r: +t[1],
@@ -1126,11 +1127,11 @@ function Te(e) {
1126
1127
  b: parseInt(e.slice(5, 7), 16)
1127
1128
  };
1128
1129
  }
1129
- function Ee(e, t, n) {
1130
- let r = Te(e), i = Te(t);
1130
+ function ye(e, t, n) {
1131
+ let r = ve(e), i = ve(t);
1131
1132
  return !r || !i ? e : `rgb(${Math.round(r.r * n + i.r * (1 - n))}, ${Math.round(r.g * n + i.g * (1 - n))}, ${Math.round(r.b * n + i.b * (1 - n))})`;
1132
1133
  }
1133
- function De(e, t) {
1134
+ function be(e, t) {
1134
1135
  let n = t * t, r = [];
1135
1136
  outer: for (let t of e) {
1136
1137
  for (let e of r) for (let r of e) {
@@ -1144,9 +1145,9 @@ function De(e, t) {
1144
1145
  }
1145
1146
  return r;
1146
1147
  }
1147
- var Oe = class {
1148
+ var xe = class {
1148
1149
  constructor(e, t, n, r) {
1149
- this.mapReader = e, this.settings = t, this.backend = n, this.gridLayer = r.gridLayer, this.linkLayer = r.linkLayer, this.roomLayer = r.roomLayer, this.roomShapeRenderer = new ie(e, t, n), this.gridRenderer = new ae(r.gridLayer, t, n), this.exitRenderer = new pe(e, t);
1150
+ this.mapReader = e, this.settings = t, this.backend = n, this.gridLayer = r.gridLayer, this.linkLayer = r.linkLayer, this.roomLayer = r.roomLayer, this.roomShapeRenderer = new N(e, t, n), this.gridRenderer = new P(r.gridLayer, t, n), this.exitRenderer = new oe(e, t);
1150
1151
  }
1151
1152
  buildScene(e, t, n, r) {
1152
1153
  this.gridLayer.destroyChildren(), this.gridRenderer.invalidateCache(), this.linkLayer.destroyChildren(), this.roomLayer.destroyChildren(), r && this.gridRenderer.render(r), this.renderLabels(t.getLabels());
@@ -1166,7 +1167,7 @@ var Oe = class {
1166
1167
  let t = /* @__PURE__ */ new Map(), n = [], r = this.settings.roomSize, i = this.backend.getExitDepthOffset();
1167
1168
  return e.forEach((e) => {
1168
1169
  let a = this.roomShapeRenderer.createRoomGroup(e);
1169
- for (let t of ve(e, this.settings)) {
1170
+ for (let t of de(e, this.settings)) {
1170
1171
  let e = this.backend.createGroup(i.x, i.y);
1171
1172
  if (this.backend.addLine(e, {
1172
1173
  points: t.line.points,
@@ -1219,7 +1220,7 @@ var Oe = class {
1219
1220
  arrowColor: e.arrowColor
1220
1221
  });
1221
1222
  });
1222
- for (let t of ge(e, this.settings)) {
1223
+ for (let t of le(e, this.settings)) {
1223
1224
  let e = this.backend.createGroup(i.x, i.y);
1224
1225
  this.backend.addLine(e, {
1225
1226
  points: [
@@ -1232,7 +1233,7 @@ var Oe = class {
1232
1233
  strokeWidth: t.strokeWidth
1233
1234
  }), this.linkLayer.addNode(e);
1234
1235
  }
1235
- let o = e.x - r / 2, s = e.y - r / 2, { triangles: c } = Se(e, this.mapReader, this.settings);
1236
+ let o = e.x - r / 2, s = e.y - r / 2, { triangles: c } = he(e, this.mapReader, this.settings);
1236
1237
  for (let e of c) {
1237
1238
  let t = [];
1238
1239
  for (let n = 0; n < e.vertices.length; n += 2) t.push(e.vertices[n] - o, e.vertices[n + 1] - s);
@@ -1335,7 +1336,7 @@ var Oe = class {
1335
1336
  y: n,
1336
1337
  width: e.Width,
1337
1338
  height: e.Height,
1338
- fill: Ce(e.BgColor)
1339
+ fill: ge(e.BgColor)
1339
1340
  }), e.Text) {
1340
1341
  let i = Math.min(.75, e.Width / Math.max(e.Text.length / 2, 1)), a = Math.max(.1, Math.min(i, Math.max(e.Height * .9, .1)));
1341
1342
  this.backend.addText(r, {
@@ -1345,7 +1346,7 @@ var Oe = class {
1345
1346
  height: e.Height,
1346
1347
  text: e.Text,
1347
1348
  fontSize: a,
1348
- fill: Ce(e.FgColor),
1349
+ fill: ge(e.FgColor),
1349
1350
  align: "center",
1350
1351
  verticalAlign: "middle"
1351
1352
  });
@@ -1373,20 +1374,18 @@ var Oe = class {
1373
1374
  }, c = a.get(e.area);
1374
1375
  c ? c.push(s) : a.set(e.area, [s]);
1375
1376
  }
1376
- let o = .3, s = .18, c = .1;
1377
- o * .55, o * 1.1;
1378
- let l = .35, u = this.settings.roomSize, d = n.map((e) => ({
1379
- x: e.x - u / 2,
1380
- y: e.y - u / 2,
1381
- width: u,
1382
- height: u
1383
- })), f = e.map((e) => e.bounds), p = (e, t, n) => {
1377
+ let o = this.settings.areaExitLabelFontSize, s = o * .6, c = o * .333, l = o * .55, u = o * 1.1, d = o * .6, f = .35, p = o * .1, h = this.settings.roomSize, g = n.map((e) => ({
1378
+ x: e.x - h / 2,
1379
+ y: e.y - h / 2,
1380
+ width: h,
1381
+ height: h
1382
+ })), _ = e.map((e) => e.bounds), v = (e, t, n) => {
1384
1383
  let r = Math.max(0, Math.max(e.x, t.x) - Math.min(e.x + e.w, t.x + t.w)), i = Math.max(0, Math.max(e.y, t.y) - Math.min(e.y + e.h, t.y + t.h));
1385
1384
  return Math.hypot(r, i) <= n;
1386
- }, h = (e, t, n, r, i) => {
1385
+ }, y = (e, t, n, r, i) => {
1387
1386
  for (let a of i) if (e < a.x + a.width && e + n > a.x && t < a.y + a.height && t + r > a.y) return !0;
1388
1387
  return !1;
1389
- }, g = [
1388
+ }, b = [
1390
1389
  [0, 1],
1391
1390
  [0, -1],
1392
1391
  [1, 0],
@@ -1395,73 +1394,79 @@ var Oe = class {
1395
1394
  [-.707, .707],
1396
1395
  [.707, -.707],
1397
1396
  [-.707, -.707]
1398
- ], _ = (e, t) => {
1399
- let n = t.length * .165 + s * 2, i = .33 + c * 2, a = 0, o = 0, l = 0, u = 0, p = /* @__PURE__ */ new Map();
1400
- for (let t of e) a += t.tip.x, o += t.tip.y, l += t.dir.x, u += t.dir.y, p.set(t.color, (p.get(t.color) ?? 0) + 1);
1401
- let m = e.length, _ = a / m, v = o / m, y = Math.hypot(l, u), b = y > 0 ? l / y : 0, x = y > 0 ? u / y : 0, S = 0;
1397
+ ], x = (e, t, n) => {
1398
+ let i = t.length * l + s * 2, a = u + c * 2, o = 0, d = 0, f = 0, p = 0, m = Infinity, h = -Infinity, v = Infinity, x = -Infinity, S = /* @__PURE__ */ new Map();
1399
+ for (let t of e) o += t.tip.x, d += t.tip.y, f += t.dir.x, p += t.dir.y, t.tip.x < m && (m = t.tip.x), t.tip.x > h && (h = t.tip.x), t.tip.y < v && (v = t.tip.y), t.tip.y > x && (x = t.tip.y), S.set(t.color, (S.get(t.color) ?? 0) + 1);
1400
+ let C = e.length, w = Math.hypot(f, p), T = w > 0 ? f / w : 0, E = w > 0 ? p / w : 0, D = 0;
1402
1401
  for (let t = 0; t < e.length; t++) for (let n = t + 1; n < e.length; n++) {
1403
1402
  let r = e[t].tip.x - e[n].tip.x, i = e[t].tip.y - e[n].tip.y, a = Math.hypot(r, i);
1404
- a > S && (S = a);
1403
+ a > D && (D = a);
1405
1404
  }
1406
- let ee = !(S > 3) && y / m >= .4, C = "white", w = 0;
1407
- for (let [e, t] of p) t > w && (C = e, w = t);
1408
- let T = d.concat(f).concat(r), E = (e, t, r = 0) => .5 + r + Math.abs(e) * n / 2 + Math.abs(t) * i / 2, D = [];
1409
- if (ee) {
1410
- let e = E(b, x);
1411
- D.push({
1412
- x: _ + b * e,
1413
- y: v + x * e
1405
+ let O = D > 3, k = w / C >= .4, A = n?.x ?? (O ? (m + h) / 2 : o / C), j = n?.y ?? (O ? (v + x) / 2 : d / C), M = "white", N = 0;
1406
+ for (let [e, t] of S) t > N && (M = e, N = t);
1407
+ let P = g.concat(_).concat(r), F = (e, t, n = 0) => .5 + n + Math.abs(e) * i / 2 + Math.abs(t) * a / 2, I = [];
1408
+ if (k) {
1409
+ let e = F(T, E);
1410
+ I.push({
1411
+ x: A + T * e,
1412
+ y: j + E * e
1414
1413
  });
1415
1414
  }
1416
- D.push({
1417
- x: _,
1418
- y: v
1415
+ I.push({
1416
+ x: A,
1417
+ y: j
1419
1418
  });
1420
1419
  for (let e of [
1421
1420
  0,
1422
1421
  .6,
1423
1422
  1.4
1424
- ]) for (let [t, n] of g) {
1425
- let r = E(t, n, e);
1426
- D.push({
1427
- x: _ + t * r,
1428
- y: v + n * r
1423
+ ]) for (let [t, n] of b) {
1424
+ let r = F(t, n, e);
1425
+ I.push({
1426
+ x: A + t * r,
1427
+ y: j + n * r
1429
1428
  });
1430
1429
  }
1431
- for (let t of D) {
1432
- let r = t.x - n / 2, a = t.y - i / 2;
1433
- if (!h(r, a, n, i, T)) return {
1430
+ for (let t of I) {
1431
+ let n = t.x - i / 2, r = t.y - a / 2;
1432
+ if (!y(n, r, i, a, P)) return {
1434
1433
  cluster: e,
1435
- boxX: r,
1436
- boxY: a,
1437
- boxW: n,
1438
- boxH: i,
1439
- color: C
1434
+ boxX: n,
1435
+ boxY: r,
1436
+ boxW: i,
1437
+ boxH: a,
1438
+ color: M
1440
1439
  };
1441
1440
  }
1442
1441
  };
1443
1442
  for (let [e, t] of a) {
1444
- let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r = De(t, 10).map((e) => _(e, n)).filter((e) => e !== void 0), a = !0;
1443
+ let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r = be(t, 10).map((e) => x(e, n)).filter((e) => e !== void 0), a = !0;
1445
1444
  for (; a && r.length > 1;) {
1446
1445
  a = !1;
1447
- outer: for (let e = 0; e < r.length; e++) for (let t = e + 1; t < r.length; t++) if (p({
1448
- x: r[e].boxX,
1449
- y: r[e].boxY,
1450
- w: r[e].boxW,
1451
- h: r[e].boxH
1452
- }, {
1453
- x: r[t].boxX,
1454
- y: r[t].boxY,
1455
- w: r[t].boxW,
1456
- h: r[t].boxH
1457
- }, 2)) {
1458
- let i = _([...r[e].cluster, ...r[t].cluster], n);
1459
- i ? (r[e] = i, r.splice(t, 1)) : (r.splice(t, 1), r.splice(e, 1)), a = !0;
1460
- break outer;
1446
+ outer: for (let e = 0; e < r.length; e++) for (let t = e + 1; t < r.length; t++) {
1447
+ let i = {
1448
+ x: r[e].boxX,
1449
+ y: r[e].boxY,
1450
+ w: r[e].boxW,
1451
+ h: r[e].boxH
1452
+ }, o = {
1453
+ x: r[t].boxX,
1454
+ y: r[t].boxY,
1455
+ w: r[t].boxW,
1456
+ h: r[t].boxH
1457
+ };
1458
+ if (v(i, o, 2)) {
1459
+ let s = [...r[e].cluster, ...r[t].cluster], c = x(s, n, {
1460
+ x: (i.x + i.w / 2 + o.x + o.w / 2) / 2,
1461
+ y: (i.y + i.h / 2 + o.y + o.h / 2) / 2
1462
+ }) ?? x(s, n);
1463
+ c ? (r[e] = c, r.splice(t, 1)) : (r.splice(t, 1), r.splice(e, 1)), a = !0;
1464
+ break outer;
1465
+ }
1461
1466
  }
1462
1467
  }
1463
1468
  for (let e of r) {
1464
- let t = we(e.color, l), r = m(Ee(e.color, this.settings.backgroundColor, l)) > .55 ? "#000" : "#fff", a = this.backend.createGroup(0, 0);
1469
+ let t = _e(e.color, f), r = m(ye(e.color, this.settings.backgroundColor, f)) > .55 ? "#000" : "#fff", a = this.backend.createGroup(0, 0);
1465
1470
  this.backend.addRect(a, {
1466
1471
  x: e.boxX,
1467
1472
  y: e.boxY,
@@ -1469,8 +1474,8 @@ var Oe = class {
1469
1474
  height: e.boxH,
1470
1475
  fill: t,
1471
1476
  stroke: e.color,
1472
- strokeWidth: .03,
1473
- cornerRadius: .18
1477
+ strokeWidth: p,
1478
+ cornerRadius: d
1474
1479
  }), this.backend.addText(a, {
1475
1480
  x: e.boxX + s,
1476
1481
  y: e.boxY + c,
@@ -1506,14 +1511,14 @@ var Oe = class {
1506
1511
  text: n,
1507
1512
  fontSize: 2.5,
1508
1513
  fontFamily: this.settings.fontFamily,
1509
- fill: "white"
1514
+ fill: this.settings.lineColor
1510
1515
  }), this.roomLayer.addNode(i);
1511
1516
  }
1512
- }, ke = 75;
1513
- function Ae(e) {
1517
+ }, Se = 75;
1518
+ function Ce(e) {
1514
1519
  return e < .5 ? 2 * e * e : -1 + (4 - 2 * e) * e;
1515
1520
  }
1516
- var je = class {
1521
+ var we = class {
1517
1522
  constructor(e, t) {
1518
1523
  this.zoom = 1, this.minZoom = .05, this.position = {
1519
1524
  x: 0,
@@ -1527,7 +1532,7 @@ var je = class {
1527
1532
  }, this.width = e, this.height = t;
1528
1533
  }
1529
1534
  getScale() {
1530
- return ke * this.zoom;
1535
+ return Se * this.zoom;
1531
1536
  }
1532
1537
  setZoom(e) {
1533
1538
  let t = Math.max(this.minZoom, Math.min(5, e));
@@ -1602,7 +1607,7 @@ var je = class {
1602
1607
  computeFitZoom(e, t, n, r, i) {
1603
1608
  let a = t - e, o = r - n;
1604
1609
  if (a <= 0 || o <= 0) return this.zoom;
1605
- let s = i?.top ?? 0, c = i?.right ?? 0, l = i?.bottom ?? 0, u = i?.left ?? 0, d = Math.max(1, this.width - u - c), f = Math.max(1, this.height - s - l), p = d / ((a + 4) * ke), m = f / ((o + 4) * ke);
1610
+ let s = i?.top ?? 0, c = i?.right ?? 0, l = i?.bottom ?? 0, u = i?.left ?? 0, d = Math.max(1, this.width - u - c), f = Math.max(1, this.height - s - l), p = d / ((a + 4) * Se), m = f / ((o + 4) * Se);
1606
1611
  return Math.max(.05, Math.min(5, Math.min(p, m)));
1607
1612
  }
1608
1613
  fitToMapBounds(e, t, n, r, i) {
@@ -1641,7 +1646,7 @@ var je = class {
1641
1646
  this.cancelAnimation();
1642
1647
  let n = performance.now(), r = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(performance.now()), 16), i = (a) => {
1643
1648
  let o = a - n, s = Math.min(o / e, 1);
1644
- t(Ae(s)), this.notify(), s < 1 ? this.animationId = r(i) : this.animationId = void 0;
1649
+ t(Ce(s)), this.notify(), s < 1 ? this.animationId = r(i) : this.animationId = void 0;
1645
1650
  };
1646
1651
  this.animationId = r(i);
1647
1652
  }
@@ -1654,7 +1659,7 @@ var je = class {
1654
1659
  notify() {
1655
1660
  this.onChange?.();
1656
1661
  }
1657
- }, Me = class {
1662
+ }, Te = class {
1658
1663
  constructor(e = 60) {
1659
1664
  this.samples = [], this.lastCullingTime = 0, this.callback = null, this.windowSize = e;
1660
1665
  }
@@ -1682,9 +1687,9 @@ var je = class {
1682
1687
  for (let e of this.samples) t.cullingMs += e.cullingMs, t.gridMs += e.gridMs, t.visibleRooms += e.visibleRooms, t.totalRooms += e.totalRooms, t.visibleExits += e.visibleExits, t.fps += e.fps;
1683
1688
  t.cullingMs /= e, t.gridMs /= e, t.visibleRooms = Math.round(t.visibleRooms / e), t.totalRooms = Math.round(t.totalRooms / e), t.visibleExits = Math.round(t.visibleExits / e), t.fps = Math.round(t.fps), this.callback(t), this.samples = [];
1684
1689
  }
1685
- }, Ne = class {
1690
+ }, Ee = class {
1686
1691
  constructor(e, t, n, r) {
1687
- this.roomNodes = /* @__PURE__ */ new Map(), this.standaloneExitNodes = [], this.spatialBucketSize = 5, this.roomSpatialIndex = /* @__PURE__ */ new Map(), this.exitSpatialIndex = /* @__PURE__ */ new Map(), this.visibleRooms = /* @__PURE__ */ new Set(), this.visibleStandaloneExitNodes = /* @__PURE__ */ new Set(), this.bufferRoomSet = /* @__PURE__ */ new Set(), this.bufferExitSet = /* @__PURE__ */ new Set(), this.bufferRoomCandidates = /* @__PURE__ */ new Set(), this.bufferExitCandidates = /* @__PURE__ */ new Set(), this.cullingScheduled = !1, this.perfMonitor = new Me(), this.coordinateTransform = (e, t) => ({
1692
+ this.roomNodes = /* @__PURE__ */ new Map(), this.standaloneExitNodes = [], this.spatialBucketSize = 5, this.roomSpatialIndex = /* @__PURE__ */ new Map(), this.exitSpatialIndex = /* @__PURE__ */ new Map(), this.visibleRooms = /* @__PURE__ */ new Set(), this.visibleStandaloneExitNodes = /* @__PURE__ */ new Set(), this.bufferRoomSet = /* @__PURE__ */ new Set(), this.bufferExitSet = /* @__PURE__ */ new Set(), this.bufferRoomCandidates = /* @__PURE__ */ new Set(), this.bufferExitCandidates = /* @__PURE__ */ new Set(), this.cullingScheduled = !1, this.perfMonitor = new Te(), this.coordinateTransform = (e, t) => ({
1688
1693
  x: e,
1689
1694
  y: t
1690
1695
  }), this.lastGridMs = 0, this.stageInfo = e, this.roomLayer = t, this.linkLayer = n, this.settings = r;
@@ -1846,7 +1851,7 @@ var je = class {
1846
1851
  !o.has(e) && e.group.isVisible() && (e.group.setVisible(!1), s = !0);
1847
1852
  }), this.bufferExitSet = this.visibleStandaloneExitNodes, this.visibleStandaloneExitNodes = o, { changed: s };
1848
1853
  }
1849
- }, Pe = class {
1854
+ }, De = class {
1850
1855
  constructor(e, t, n, r, i, a) {
1851
1856
  this.cleanupFns = [], this.destroyed = !1, this.container = e, this.viewport = t, this.state = n, this.settings = r, this.hitTest = i, this.events = a, this.initViewportEvents(), this.initMapEvents();
1852
1857
  }
@@ -2053,7 +2058,7 @@ var je = class {
2053
2058
  };
2054
2059
  //#endregion
2055
2060
  //#region src/backend/CanvasBackend.ts
2056
- function Fe(e, t) {
2061
+ function Oe(e, t) {
2057
2062
  switch (t.type) {
2058
2063
  case "rect":
2059
2064
  e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
@@ -2106,7 +2111,7 @@ function Fe(e, t) {
2106
2111
  break;
2107
2112
  }
2108
2113
  }
2109
- var F = class {
2114
+ var H = class {
2110
2115
  constructor(e, t) {
2111
2116
  this._visible = !0, this.commands = [], this.x = e, this.y = t;
2112
2117
  }
@@ -2147,11 +2152,11 @@ var F = class {
2147
2152
  perfectDrawEnabled: !1,
2148
2153
  sceneFunc: (e) => {
2149
2154
  let t = e._context;
2150
- for (let e of n) Fe(t, e);
2155
+ for (let e of n) Oe(t, e);
2151
2156
  }
2152
2157
  })), this._konvaGroup = t, t;
2153
2158
  }
2154
- }, I = class {
2159
+ }, U = class {
2155
2160
  constructor(t) {
2156
2161
  this.groups = [], this.konvaLayer = t, t.destroyChildren();
2157
2162
  let n = this;
@@ -2164,7 +2169,7 @@ var F = class {
2164
2169
  if (!e._visible) continue;
2165
2170
  let n = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
2166
2171
  t.setTransform(i, a, o, s, n, c);
2167
- for (let n of e.commands) Fe(t, n);
2172
+ for (let n of e.commands) Oe(t, n);
2168
2173
  }
2169
2174
  t.setTransform(r);
2170
2175
  }
@@ -2174,7 +2179,7 @@ var F = class {
2174
2179
  this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
2175
2180
  }
2176
2181
  addNode(e) {
2177
- e instanceof F && (this.groups.push(e), this.ensureShape());
2182
+ e instanceof H && (this.groups.push(e), this.ensureShape());
2178
2183
  }
2179
2184
  destroyChildren() {
2180
2185
  this.groups.length = 0;
@@ -2183,16 +2188,16 @@ var F = class {
2183
2188
  this.konvaLayer.batchDraw();
2184
2189
  }
2185
2190
  };
2186
- function Ie(t) {
2191
+ function ke(t) {
2187
2192
  let n = e === void 0 ? typeof Image < "u" ? new Image() : null : e.Util.createImageElement();
2188
2193
  return n && (n.src = t), n;
2189
2194
  }
2190
- var Le = class {
2195
+ var Ae = class {
2191
2196
  createGroup(e, t) {
2192
- return new F(e, t);
2197
+ return new H(e, t);
2193
2198
  }
2194
2199
  addRect(e, t) {
2195
- e instanceof F && e.commands.push({
2200
+ e instanceof H && e.commands.push({
2196
2201
  type: "rect",
2197
2202
  x: t.x,
2198
2203
  y: t.y,
@@ -2206,7 +2211,7 @@ var Le = class {
2206
2211
  });
2207
2212
  }
2208
2213
  addCircle(e, t) {
2209
- e instanceof F && e.commands.push({
2214
+ e instanceof H && e.commands.push({
2210
2215
  type: "circle",
2211
2216
  cx: t.cx,
2212
2217
  cy: t.cy,
@@ -2218,7 +2223,7 @@ var Le = class {
2218
2223
  });
2219
2224
  }
2220
2225
  addLine(e, t) {
2221
- e instanceof F && e.commands.push({
2226
+ e instanceof H && e.commands.push({
2222
2227
  type: "line",
2223
2228
  points: t.points,
2224
2229
  stroke: t.stroke,
@@ -2233,7 +2238,7 @@ var Le = class {
2233
2238
  this.addLine(e, t);
2234
2239
  }
2235
2240
  addPolygon(e, t) {
2236
- e instanceof F && e.commands.push({
2241
+ e instanceof H && e.commands.push({
2237
2242
  type: "polygon",
2238
2243
  vertices: t.vertices,
2239
2244
  fill: t.fill,
@@ -2242,7 +2247,7 @@ var Le = class {
2242
2247
  });
2243
2248
  }
2244
2249
  addText(e, t) {
2245
- e instanceof F && e.commands.push({
2250
+ e instanceof H && e.commands.push({
2246
2251
  type: "text",
2247
2252
  x: t.x,
2248
2253
  y: t.y,
@@ -2260,13 +2265,13 @@ var Le = class {
2260
2265
  });
2261
2266
  }
2262
2267
  addImage(e, t) {
2263
- e instanceof F && e.commands.push({
2268
+ e instanceof H && e.commands.push({
2264
2269
  type: "image",
2265
2270
  x: t.x,
2266
2271
  y: t.y,
2267
2272
  w: t.width,
2268
2273
  h: t.height,
2269
- image: Ie(t.src),
2274
+ image: ke(t.src),
2270
2275
  transform: t.transform
2271
2276
  });
2272
2277
  }
@@ -2285,7 +2290,7 @@ var Le = class {
2285
2290
  getInverseTransform() {
2286
2291
  return b;
2287
2292
  }
2288
- }, Re = class {
2293
+ }, je = class {
2289
2294
  constructor(e) {
2290
2295
  this.konvaGroup = e;
2291
2296
  }
@@ -2310,12 +2315,12 @@ var Le = class {
2310
2315
  moveToTop() {
2311
2316
  this.konvaGroup.moveToTop();
2312
2317
  }
2313
- }, ze = class {
2318
+ }, Me = class {
2314
2319
  constructor(e) {
2315
2320
  this.konvaLayer = e;
2316
2321
  }
2317
2322
  addNode(e) {
2318
- e instanceof Re ? this.konvaLayer.add(e.konvaGroup) : e instanceof F && this.konvaLayer.add(e.materialize());
2323
+ e instanceof je ? this.konvaLayer.add(e.konvaGroup) : e instanceof H && this.konvaLayer.add(e.materialize());
2319
2324
  }
2320
2325
  destroyChildren() {
2321
2326
  this.konvaLayer.destroyChildren();
@@ -2323,20 +2328,20 @@ var Le = class {
2323
2328
  batchDraw() {
2324
2329
  this.konvaLayer.batchDraw();
2325
2330
  }
2326
- }, L = [
2331
+ }, W = [
2327
2332
  "up",
2328
2333
  "down",
2329
2334
  "in",
2330
2335
  "out"
2331
2336
  ];
2332
- function R(e, t, n, r, i) {
2333
- return e.roomShape === "circle" ? de(t, n, r, i) : e.roomShape === "roundedRectangle" ? ue(t, n, r, i, e.roomSize * .2) : M(t, n, r, i);
2337
+ function G(e, t, n, r, i) {
2338
+ return e.roomShape === "circle" ? ie(t, n, r, i) : e.roomShape === "roundedRectangle" ? re(t, n, r, i, e.roomSize * .2) : z(t, n, r, i);
2334
2339
  }
2335
- function Be(e, t, n) {
2340
+ function Ne(e, t, n) {
2336
2341
  for (let [e, r] of Object.entries(t.exits)) if (r === n.id) {
2337
2342
  let r = e;
2338
- if (L.includes(r)) {
2339
- let e = A[r];
2343
+ if (W.includes(r)) {
2344
+ let e = L[r];
2340
2345
  return {
2341
2346
  type: "inner",
2342
2347
  fromDir: r,
@@ -2345,7 +2350,7 @@ function Be(e, t, n) {
2345
2350
  toRoom: n
2346
2351
  };
2347
2352
  }
2348
- let i = A[r];
2353
+ let i = L[r];
2349
2354
  return t.customLines[i] ? {
2350
2355
  type: "special",
2351
2356
  fromDir: r,
@@ -2361,7 +2366,7 @@ function Be(e, t, n) {
2361
2366
  } : {
2362
2367
  type: "regular",
2363
2368
  fromDir: r,
2364
- toDir: Ve(n, t.id),
2369
+ toDir: Pe(n, t.id),
2365
2370
  fromRoom: t,
2366
2371
  toRoom: n
2367
2372
  };
@@ -2378,8 +2383,8 @@ function Be(e, t, n) {
2378
2383
  };
2379
2384
  for (let [e, r] of Object.entries(n.exits)) if (r === t.id) {
2380
2385
  let r = e;
2381
- if (L.includes(r)) {
2382
- let e = A[r];
2386
+ if (W.includes(r)) {
2387
+ let e = L[r];
2383
2388
  return {
2384
2389
  type: "inner",
2385
2390
  toDir: r,
@@ -2388,7 +2393,7 @@ function Be(e, t, n) {
2388
2393
  toRoom: n
2389
2394
  };
2390
2395
  }
2391
- let i = A[r];
2396
+ let i = L[r];
2392
2397
  return n.customLines[i] ? {
2393
2398
  type: "special",
2394
2399
  toDir: r,
@@ -2424,39 +2429,39 @@ function Be(e, t, n) {
2424
2429
  toRoom: n
2425
2430
  };
2426
2431
  }
2427
- function Ve(e, t) {
2432
+ function Pe(e, t) {
2428
2433
  for (let [n, r] of Object.entries(e.exits)) if (r === t) return n;
2429
2434
  }
2430
- function He(e, t, n) {
2435
+ function Fe(e, t, n) {
2431
2436
  return e ? e.area === t && e.z === n : !1;
2432
2437
  }
2433
- function Ue(e, t) {
2438
+ function Ie(e, t) {
2434
2439
  for (let [n, r] of Object.entries(e.exits)) if (r === t.id) return { direction: n };
2435
2440
  for (let [n, r] of Object.entries(e.specialExits)) if (r === t.id) return;
2436
2441
  }
2437
- function We(e, t) {
2438
- for (let n of se) if (e.exits[n] === t.id) return n;
2439
- for (let n of se) if (t.exits[n] === e.id) return ce[n];
2442
+ function Le(e, t) {
2443
+ for (let n of ee) if (e.exits[n] === t.id) return n;
2444
+ for (let n of ee) if (t.exits[n] === e.id) return te[n];
2440
2445
  }
2441
- function Ge(e, t, n) {
2446
+ function Re(e, t, n) {
2442
2447
  let { fromRoom: r, toRoom: i, fromDir: a, toDir: o } = t;
2443
- if (n.length === 0 && n.push(r.x, r.y), a && k.includes(a)) {
2444
- let t = R(e, r.x, r.y, a, e.roomSize / 2);
2448
+ if (n.length === 0 && n.push(r.x, r.y), a && F.includes(a)) {
2449
+ let t = G(e, r.x, r.y, a, e.roomSize / 2);
2445
2450
  n.push(t.x, t.y);
2446
2451
  }
2447
- if (o && k.includes(o)) {
2448
- let t = R(e, i.x, i.y, o, e.roomSize / 2);
2452
+ if (o && F.includes(o)) {
2453
+ let t = G(e, i.x, i.y, o, e.roomSize / 2);
2449
2454
  n.push(t.x, t.y);
2450
2455
  }
2451
2456
  n.push(i.x, i.y);
2452
2457
  }
2453
- function Ke(e, t) {
2458
+ function ze(e, t) {
2454
2459
  let { fromRoom: n, toRoom: r, customLineKey: i } = e, a = n, o;
2455
2460
  i && (o = n.customLines[i], o || (o = r.customLines[i], a = r)), t.length === 0 && t.push(a.x, a.y), o && o.points.forEach((e) => {
2456
2461
  t.push(e.x, -e.y);
2457
2462
  }), t.push(r.x, r.y);
2458
2463
  }
2459
- function qe(e, t, n, r, i) {
2464
+ function Be(e, t, n, r, i) {
2460
2465
  let a = [], o = [], s = [], c = n.map((t) => e.getRoom(t)).filter((e) => e !== void 0), l = [], u = () => {
2461
2466
  l.length >= 4 && a.push({ points: [...l] }), l = [];
2462
2467
  }, d = (e) => {
@@ -2470,28 +2475,28 @@ function qe(e, t, n, r, i) {
2470
2475
  }), s.push({ points: t });
2471
2476
  }
2472
2477
  }
2473
- r && L.includes(r) && o.push({
2478
+ r && W.includes(r) && o.push({
2474
2479
  room: t,
2475
2480
  direction: r
2476
- }), i && L.includes(i) && o.push({
2481
+ }), i && W.includes(i) && o.push({
2477
2482
  room: n,
2478
2483
  direction: i
2479
2484
  });
2480
2485
  };
2481
2486
  for (let n = 0; n < c.length - 1; n++) {
2482
- let a = c[n], s = c[n + 1], f = He(a, r, i), p = He(s, r, i);
2487
+ let a = c[n], s = c[n + 1], f = Fe(a, r, i), p = Fe(s, r, i);
2483
2488
  if (!f && !p) {
2484
2489
  u();
2485
2490
  continue;
2486
2491
  }
2487
2492
  if (f && p) {
2488
- let n = Be(e, a, s);
2493
+ let n = Ne(e, a, s);
2489
2494
  switch (n.type) {
2490
2495
  case "regular":
2491
- Ge(t, n, l);
2496
+ Re(t, n, l);
2492
2497
  break;
2493
2498
  case "special":
2494
- Ke(n, l);
2499
+ ze(n, l);
2495
2500
  break;
2496
2501
  case "inner":
2497
2502
  u(), d(n);
@@ -2501,22 +2506,22 @@ function qe(e, t, n, r, i) {
2501
2506
  break;
2502
2507
  }
2503
2508
  } else {
2504
- let e = f ? a : s, n = f ? s : a, r = Ue(e, n);
2509
+ let e = f ? a : s, n = f ? s : a, r = Ie(e, n);
2505
2510
  if (r) {
2506
- if (L.includes(r.direction)) u(), o.push({
2511
+ if (W.includes(r.direction)) u(), o.push({
2507
2512
  room: e,
2508
2513
  direction: r.direction
2509
2514
  });
2510
- else if (k.includes(r.direction)) {
2515
+ else if (F.includes(r.direction)) {
2511
2516
  l.length === 0 && l.push(e.x, e.y);
2512
- let n = R(t, e.x, e.y, r.direction, t.roomSize / 2), i = M(e.x, e.y, r.direction, t.roomSize);
2517
+ let n = G(t, e.x, e.y, r.direction, t.roomSize / 2), i = z(e.x, e.y, r.direction, t.roomSize);
2513
2518
  l.push(n.x, n.y, i.x, i.y), u();
2514
2519
  }
2515
2520
  } else {
2516
- let r = We(e, n);
2521
+ let r = Le(e, n);
2517
2522
  if (r) {
2518
2523
  l.length === 0 && l.push(e.x, e.y);
2519
- let n = R(t, e.x, e.y, r, t.roomSize / 2), i = M(e.x, e.y, r, t.roomSize);
2524
+ let n = G(t, e.x, e.y, r, t.roomSize / 2), i = z(e.x, e.y, r, t.roomSize);
2520
2525
  l.push(n.x, n.y, i.x, i.y), u();
2521
2526
  }
2522
2527
  }
@@ -2530,7 +2535,7 @@ function qe(e, t, n, r, i) {
2530
2535
  }
2531
2536
  //#endregion
2532
2537
  //#region src/scene/OverlayStyle.ts
2533
- function Je(e, t, n) {
2538
+ function Ve(e, t, n) {
2534
2539
  let r = 1.425, i = n.roomSize;
2535
2540
  return {
2536
2541
  shape: n.roomShape === "circle" ? "circle" : "rect",
@@ -2543,7 +2548,7 @@ function Je(e, t, n) {
2543
2548
  dash: [.05, .05]
2544
2549
  };
2545
2550
  }
2546
- function Ye(e, t) {
2551
+ function He(e, t) {
2547
2552
  let n = t.playerMarker, r = t.roomSize * n.sizeFactor, i = n.matchRoomShape && t.roomShape !== "circle";
2548
2553
  return {
2549
2554
  shape: i ? "rect" : "circle",
@@ -2560,14 +2565,14 @@ function Ye(e, t) {
2560
2565
  dashEnabled: n.dashEnabled
2561
2566
  };
2562
2567
  }
2563
- function Xe(e, t, n, r, i, a) {
2564
- let o = qe(e, t, n, i, a), s = t.lineWidth, c = t.roomSize / 5, l = [];
2568
+ function Ue(e, t, n, r, i, a) {
2569
+ let o = Be(e, t, n, i, a), s = t.lineWidth, c = t.roomSize / 5, l = [];
2565
2570
  for (let e of o.segments) e.points.length >= 4 && l.push({ points: e.points });
2566
2571
  for (let e of o.customLines) e.points.length >= 4 && l.push({ points: e.points });
2567
2572
  let u = [];
2568
2573
  for (let e of o.innerMarkers) {
2569
2574
  let t = e.direction === "up" ? 0 : e.direction === "down" ? 180 : e.direction === "in" ? 90 : -90;
2570
- u.push({ vertices: P(e.room.x, e.room.y, c, t) });
2575
+ u.push({ vertices: V(e.room.x, e.room.y, c, t) });
2571
2576
  }
2572
2577
  return {
2573
2578
  segments: l,
@@ -2579,7 +2584,7 @@ function Xe(e, t, n, r, i, a) {
2579
2584
  }
2580
2585
  //#endregion
2581
2586
  //#region src/scene/OverlayRenderer.ts
2582
- function Ze(e, t) {
2587
+ function We(e, t) {
2583
2588
  let n = e.createGroup(0, 0);
2584
2589
  if (t.shape === "circle") e.addCircle(n, {
2585
2590
  cx: t.cx,
@@ -2627,7 +2632,7 @@ function Ze(e, t) {
2627
2632
  }
2628
2633
  return n;
2629
2634
  }
2630
- function Qe(e, t) {
2635
+ function Ge(e, t) {
2631
2636
  let n = e.createGroup(0, 0), r = _(t.strokeColor, t.strokeAlpha), i = t.fillAlpha > 0 ? _(t.fillColor, t.fillAlpha) : void 0;
2632
2637
  return t.shape === "circle" ? e.addCircle(n, {
2633
2638
  cx: t.cx,
@@ -2651,7 +2656,7 @@ function Qe(e, t) {
2651
2656
  dashEnabled: t.dashEnabled
2652
2657
  }), n;
2653
2658
  }
2654
- function $e(e, t) {
2659
+ function Ke(e, t) {
2655
2660
  let n = e.createGroup(0, 0);
2656
2661
  for (let r of t.segments) e.addLine(n, {
2657
2662
  points: r.points,
@@ -2676,7 +2681,7 @@ function $e(e, t) {
2676
2681
  });
2677
2682
  return n;
2678
2683
  }
2679
- function et(e, t) {
2684
+ function qe(e, t) {
2680
2685
  let n = e.getExitDepthOffset(), r = e.createGroup(n.x, n.y);
2681
2686
  return e.addLine(r, {
2682
2687
  points: t.line.points,
@@ -2704,7 +2709,7 @@ function et(e, t) {
2704
2709
  strokeWidth: t.door.strokeWidth
2705
2710
  }), r;
2706
2711
  }
2707
- function tt(e, t) {
2712
+ function Je(e, t) {
2708
2713
  let n = e.getExitDepthOffset(), r = e.createGroup(n.x, n.y);
2709
2714
  for (let n of t) e.addLine(r, {
2710
2715
  points: [
@@ -2718,7 +2723,7 @@ function tt(e, t) {
2718
2723
  });
2719
2724
  return r;
2720
2725
  }
2721
- function nt(e, t) {
2726
+ function Ye(e, t) {
2722
2727
  let n = e.createGroup(0, 0);
2723
2728
  for (let r of t) e.addPolygon(n, {
2724
2729
  vertices: r.vertices,
@@ -2728,7 +2733,7 @@ function nt(e, t) {
2728
2733
  });
2729
2734
  return n;
2730
2735
  }
2731
- function rt(e, t) {
2736
+ function Xe(e, t) {
2732
2737
  let n = e.createGroup(0, 0);
2733
2738
  return e.addImage(n, {
2734
2739
  x: t.cx - t.displaySize / 2,
@@ -2740,7 +2745,7 @@ function rt(e, t) {
2740
2745
  }
2741
2746
  //#endregion
2742
2747
  //#region src/reader/Plane.ts
2743
- var it = class {
2748
+ var Ze = class {
2744
2749
  constructor(e, t) {
2745
2750
  this.rooms = [], this.labels = [], this.rooms = e, this.labels = t, this.bounds = this.createBounds();
2746
2751
  }
@@ -2771,7 +2776,7 @@ var it = class {
2771
2776
  }
2772
2777
  return e;
2773
2778
  }
2774
- }, at = class e {
2779
+ }, Qe = class e {
2775
2780
  constructor(e) {
2776
2781
  this.planes = {}, this.exits = /* @__PURE__ */ new Map(), this.version = 0, this.area = e, this.planes = this.createPlanes(), this.createExits();
2777
2782
  }
@@ -2820,7 +2825,7 @@ var it = class {
2820
2825
  }
2821
2826
  createPlanes() {
2822
2827
  let e = this.area.rooms.reduce((e, t) => (e[t.z] || (e[t.z] = []), e[t.z].push(t), e), {});
2823
- return Object.entries(e).reduce((e, [t, n]) => (e[+t] = new it(n, this.area.labels.filter((e) => e.Z === +t)), e), {});
2828
+ return Object.entries(e).reduce((e, [t, n]) => (e[+t] = new Ze(n, this.area.labels.filter((e) => e.Z === +t)), e), {});
2824
2829
  }
2825
2830
  static {
2826
2831
  this.oppositeDir = {
@@ -2891,7 +2896,7 @@ var it = class {
2891
2896
  }
2892
2897
  }
2893
2898
  }
2894
- }, ot = class extends it {
2899
+ }, $e = class extends Ze {
2895
2900
  constructor(e, t) {
2896
2901
  super(e.getRooms(), e.getLabels()), this.basePlane = e, this.visitedRooms = t;
2897
2902
  }
@@ -2915,7 +2920,7 @@ var it = class {
2915
2920
  maxY: -Infinity
2916
2921
  }) : this.basePlane.getBounds();
2917
2922
  }
2918
- }, z = class extends at {
2923
+ }, K = class extends Qe {
2919
2924
  constructor(e, t) {
2920
2925
  super(e), this.planeCache = /* @__PURE__ */ new WeakMap(), this.visitedRooms = t instanceof Set ? t : new Set(t ?? []), this.areaRoomIds = new Set(e.rooms.map((e) => e.id));
2921
2926
  }
@@ -2923,12 +2928,12 @@ var it = class {
2923
2928
  let t = super.getPlane(e);
2924
2929
  if (!t) return t;
2925
2930
  let n = this.planeCache.get(t);
2926
- return n || (n = new ot(t, this.visitedRooms), this.planeCache.set(t, n)), n;
2931
+ return n || (n = new $e(t, this.visitedRooms), this.planeCache.set(t, n)), n;
2927
2932
  }
2928
2933
  getPlanes() {
2929
2934
  return super.getPlanes().map((e) => {
2930
2935
  let t = this.planeCache.get(e);
2931
- return t || (t = new ot(e, this.visitedRooms), this.planeCache.set(e, t)), t;
2936
+ return t || (t = new $e(e, this.visitedRooms), this.planeCache.set(e, t)), t;
2932
2937
  });
2933
2938
  }
2934
2939
  getLinkExits(e) {
@@ -2960,7 +2965,7 @@ var it = class {
2960
2965
  }
2961
2966
  return t > 0 && this.markDirty(), t;
2962
2967
  }
2963
- }, B = "rgb(120, 72, 0)", st = class {
2968
+ }, q = "rgb(120, 72, 0)", et = class {
2964
2969
  get coordinateTransform() {
2965
2970
  return this._coordinateTransform;
2966
2971
  }
@@ -2970,21 +2975,21 @@ var it = class {
2970
2975
  width: n.clientWidth,
2971
2976
  height: n.clientHeight,
2972
2977
  draggable: !1
2973
- }), n.style.backgroundColor = t.settings.backgroundColor, this.viewport = new je(n.clientWidth, n.clientHeight)) : (this.stage = new e.Stage({
2978
+ }), n.style.backgroundColor = t.settings.backgroundColor, this.viewport = new we(n.clientWidth, n.clientHeight)) : (this.stage = new e.Stage({
2974
2979
  width: 1,
2975
2980
  height: 1
2976
- }), this.viewport = new je(1, 1)), this.gridLayer = new e.Layer({ listening: !1 }), this.stage.add(this.gridLayer), this.linkLayer = new e.Layer({ listening: !1 }), this.stage.add(this.linkLayer), this.roomLayer = new e.Layer({ listening: !1 }), this.stage.add(this.roomLayer), this.positionLayer = new e.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new e.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.drawingBackend = r ?? new Le(), this.positionLayerNode = new ze(this.positionLayer), this.overlayLayerNode = new ze(this.overlayLayer);
2977
- let i = new I(this.roomLayer), a = new I(this.linkLayer);
2978
- if (this.pipeline = new Oe(t.mapReader, t.settings, this.drawingBackend, {
2979
- gridLayer: new I(this.gridLayer),
2981
+ }), this.viewport = new we(1, 1)), this.gridLayer = new e.Layer({ listening: !1 }), this.stage.add(this.gridLayer), this.linkLayer = new e.Layer({ listening: !1 }), this.stage.add(this.linkLayer), this.roomLayer = new e.Layer({ listening: !1 }), this.stage.add(this.roomLayer), this.positionLayer = new e.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new e.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.drawingBackend = r ?? new Ae(), this.positionLayerNode = new Me(this.positionLayer), this.overlayLayerNode = new Me(this.overlayLayer);
2982
+ let i = new U(this.roomLayer), a = new U(this.linkLayer);
2983
+ if (this.pipeline = new xe(t.mapReader, t.settings, this.drawingBackend, {
2984
+ gridLayer: new U(this.gridLayer),
2980
2985
  linkLayer: a,
2981
2986
  roomLayer: i
2982
- }), this.events = new v(n), this.culling = new Ne(this.stage, i, a, t.settings), this.viewport.onChange = () => this.applyViewportToStage(), n) {
2987
+ }), this.events = new v(n), this.culling = new Ee(this.stage, i, a, t.settings), this.viewport.onChange = () => this.applyViewportToStage(), n) {
2983
2988
  this.origSetSize = this.viewport.setSize.bind(this.viewport);
2984
2989
  let e = this.origSetSize;
2985
2990
  this.viewport.setSize = (t, n) => {
2986
2991
  e(t, n), this.stage.width(t), this.stage.height(n);
2987
- }, this.interactionHandler = new Pe(n, this.viewport, t, t.settings, {
2992
+ }, this.interactionHandler = new De(n, this.viewport, t, t.settings, {
2988
2993
  clientToMapPoint: (e, t) => this.viewport.clientToMapPoint(e, t, n.getBoundingClientRect()),
2989
2994
  findRoomAtPoint: (e, t) => this.culling.findRoomAtMapPoint(e, t),
2990
2995
  getAreaExitHitZones: () => this.areaExitHitZones,
@@ -2994,10 +2999,10 @@ var it = class {
2994
2999
  this.applyDrawingBackendTransforms(this.drawingBackend), this.subscribeToState(t);
2995
3000
  }
2996
3001
  setDrawingBackend(e) {
2997
- this.drawingBackend = e, this.pipeline = new Oe(this.state.mapReader, this.state.settings, e, {
2998
- gridLayer: new I(this.gridLayer),
2999
- linkLayer: new I(this.linkLayer),
3000
- roomLayer: new I(this.roomLayer)
3002
+ this.drawingBackend = e, this.pipeline = new xe(this.state.mapReader, this.state.settings, e, {
3003
+ gridLayer: new U(this.gridLayer),
3004
+ linkLayer: new U(this.linkLayer),
3005
+ roomLayer: new U(this.roomLayer)
3001
3006
  }), this.applyDrawingBackendTransforms(e);
3002
3007
  }
3003
3008
  applyDrawingBackendTransforms(e) {
@@ -3061,38 +3066,38 @@ var it = class {
3061
3066
  if (!o) return;
3062
3067
  let { width: s, height: c } = t, l = t.padding ?? 3, u = this.viewport.width, d = this.viewport.height, f = this.viewport.zoom, p = this.viewport.minZoom, m = { ...this.viewport.position }, h = this.viewport.onChange;
3063
3068
  this.viewport.onChange = void 0;
3064
- let g = this.state.computeExportBounds(a, o, t.roomId, l), _ = this._coordinateTransform, v = _(g.x, g.y), y = _(g.x + g.w, g.y), b = _(g.x + g.w, g.y + g.h), x = _(g.x, g.y + g.h), S = Math.min(v.x, y.x, b.x, x.x), ee = Math.max(v.x, y.x, b.x, x.x), C = Math.min(v.y, y.y, b.y, x.y), w = Math.max(v.y, y.y, b.y, x.y), T = {
3069
+ let g = this.state.computeExportBounds(a, o, t.roomId, l), _ = this._coordinateTransform, v = _(g.x, g.y), y = _(g.x + g.w, g.y), b = _(g.x + g.w, g.y + g.h), x = _(g.x, g.y + g.h), S = Math.min(v.x, y.x, b.x, x.x), C = Math.max(v.x, y.x, b.x, x.x), w = Math.min(v.y, y.y, b.y, x.y), T = Math.max(v.y, y.y, b.y, x.y), E = {
3065
3070
  x: S,
3066
- y: C,
3067
- w: ee - S,
3068
- h: w - C
3069
- }, E = s / T.w, D = c / T.h, O = Math.min(E, D), te = T.w * O, ne = T.h * O, re = (s - te) / 2, ie = (c - ne) / 2, ae = {
3070
- x: re - T.x * O,
3071
- y: ie - T.y * O
3071
+ y: w,
3072
+ w: C - S,
3073
+ h: T - w
3074
+ }, D = s / E.w, O = c / E.h, k = Math.min(D, O), A = E.w * k, j = E.h * k, M = (s - A) / 2, N = (c - j) / 2, P = {
3075
+ x: M - E.x * k,
3076
+ y: N - E.y * k
3072
3077
  };
3073
- this.viewport.width = s, this.viewport.height = c, this.viewport.zoom = O / (this.viewport.getScale() / this.viewport.zoom), this.viewport.position = ae, this.stage.width(s), this.stage.height(c), this.stage.scale({
3074
- x: O,
3075
- y: O
3076
- }), this.stage.position(ae), this.pipeline.gridRenderer.render(this.viewport.getViewportBounds()), this.culling.updateCulling();
3077
- let k = new e.Layer({ listening: !1 });
3078
- k.scale({
3079
- x: 1 / O,
3080
- y: 1 / O
3081
- }), k.position({
3082
- x: -(re - T.x * O) / O,
3083
- y: -(ie - T.y * O) / O
3084
- }), k.add(new e.Rect({
3078
+ this.viewport.width = s, this.viewport.height = c, this.viewport.zoom = k / (this.viewport.getScale() / this.viewport.zoom), this.viewport.position = P, this.stage.width(s), this.stage.height(c), this.stage.scale({
3079
+ x: k,
3080
+ y: k
3081
+ }), this.stage.position(P), this.pipeline.gridRenderer.render(this.viewport.getViewportBounds()), this.culling.updateCulling();
3082
+ let F = new e.Layer({ listening: !1 });
3083
+ F.scale({
3084
+ x: 1 / k,
3085
+ y: 1 / k
3086
+ }), F.position({
3087
+ x: -(M - E.x * k) / k,
3088
+ y: -(N - E.y * k) / k
3089
+ }), F.add(new e.Rect({
3085
3090
  x: 0,
3086
3091
  y: 0,
3087
3092
  width: s,
3088
3093
  height: c,
3089
3094
  fill: this.state.settings.backgroundColor
3090
- })), this.stage.add(k), k.moveToBottom();
3091
- let oe = this.stage.toCanvas({
3095
+ })), this.stage.add(F), F.moveToBottom();
3096
+ let I = this.stage.toCanvas({
3092
3097
  width: s,
3093
3098
  height: c
3094
3099
  });
3095
- return k.destroy(), this.viewport.width = u, this.viewport.height = d, this.viewport.zoom = f, this.viewport.minZoom = p, this.viewport.position = m, this.viewport.onChange = h, this.stage.width(u), this.stage.height(d), this.applyViewportToStage(), this.culling.updateCulling(), oe;
3100
+ return F.destroy(), this.viewport.width = u, this.viewport.height = d, this.viewport.zoom = f, this.viewport.minZoom = p, this.viewport.position = m, this.viewport.onChange = h, this.stage.width(u), this.stage.height(d), this.applyViewportToStage(), this.culling.updateCulling(), I;
3096
3101
  }
3097
3102
  refresh() {
3098
3103
  let { currentAreaInstance: e, currentZIndex: t, positionRoomId: n } = this.state;
@@ -3199,8 +3204,8 @@ var it = class {
3199
3204
  }
3200
3205
  applyPositionMarker(e) {
3201
3206
  this.positionMarker && this.positionMarker.destroy();
3202
- let t = Ye(e, this.state.settings);
3203
- this.positionMarker = Qe(this.drawingBackend, t), this.positionLayerNode.addNode(this.positionMarker);
3207
+ let t = He(e, this.state.settings);
3208
+ this.positionMarker = Ge(this.drawingBackend, t), this.positionLayerNode.addNode(this.positionMarker);
3204
3209
  }
3205
3210
  clearCurrentRoomOverlay() {
3206
3211
  this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
@@ -3217,25 +3222,25 @@ var it = class {
3217
3222
  }
3218
3223
  let n = /* @__PURE__ */ new Map();
3219
3224
  n.set(e.id, e);
3220
- let r = [], i = this.pipeline.exitRenderer, a = this.state.currentAreaInstance instanceof z ? this.state.currentAreaInstance : void 0;
3225
+ let r = [], i = this.pipeline.exitRenderer, a = this.state.currentAreaInstance instanceof K ? this.state.currentAreaInstance : void 0;
3221
3226
  this.state.currentAreaInstance && this.state.currentZIndex !== void 0 && this.state.currentAreaInstance.getLinkExits(this.state.currentZIndex).filter((t) => t.a === e.id || t.b === e.id).forEach((e) => {
3222
- let t = i.renderDataWithColor(e, B, this.state.currentZIndex);
3227
+ let t = i.renderDataWithColor(e, q, this.state.currentZIndex);
3223
3228
  t && r.push(this.pipeline.renderExitData(t));
3224
3229
  });
3225
- for (let n of ve(e, t, B)) r.push(et(this.drawingBackend, n));
3226
- let o = ge(e, t, B);
3227
- o.length > 0 && r.push(tt(this.drawingBackend, o)), [...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
3230
+ for (let n of de(e, t, q)) r.push(qe(this.drawingBackend, n));
3231
+ let o = le(e, t, q);
3232
+ o.length > 0 && r.push(Je(this.drawingBackend, o)), [...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
3228
3233
  let t = this.state.mapReader.getRoom(e), r = !a || a.hasVisitedRoom(e);
3229
3234
  t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && r && n.set(e, t);
3230
3235
  }), r.forEach((e) => {
3231
3236
  this.positionLayerNode.addNode(e), this.currentRoomOverlay.push(e);
3232
3237
  }), n.forEach((n, r) => {
3233
- let i = r === e.id, a = this.pipeline.roomShapeRenderer.createRoomGroup(n, { strokeOverride: i ? B : t.lineColor });
3238
+ let i = r === e.id, a = this.pipeline.roomShapeRenderer.createRoomGroup(n, { strokeOverride: i ? q : t.lineColor });
3234
3239
  this.positionLayerNode.addNode(a), this.currentRoomOverlay.push(a);
3235
3240
  }), n.forEach((e) => {
3236
- let { triangles: n } = Se(e, this.state.mapReader, t);
3241
+ let { triangles: n } = he(e, this.state.mapReader, t);
3237
3242
  if (n.length > 0) {
3238
- let e = nt(this.drawingBackend, n);
3243
+ let e = Ye(this.drawingBackend, n);
3239
3244
  this.positionLayerNode.addNode(e), this.currentRoomOverlay.push(e);
3240
3245
  }
3241
3246
  }), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
@@ -3245,7 +3250,7 @@ var it = class {
3245
3250
  if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
3246
3251
  let n = this.state.mapReader.getRoom(e);
3247
3252
  if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
3248
- let r = Je(n, t, this.state.settings), i = Ze(this.drawingBackend, r);
3253
+ let r = Ve(n, t, this.state.settings), i = We(this.drawingBackend, r);
3249
3254
  this.overlayLayerNode.addNode(i), this.highlightShapes.set(e, i);
3250
3255
  }
3251
3256
  }
@@ -3258,7 +3263,7 @@ var it = class {
3258
3263
  if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
3259
3264
  let n = this.state.mapReader.getRoom(e);
3260
3265
  if (!n) continue;
3261
- let r = Je(n, t.color, this.state.settings), i = Ze(this.drawingBackend, r);
3266
+ let r = Ve(n, t.color, this.state.settings), i = We(this.drawingBackend, r);
3262
3267
  this.overlayLayerNode.addNode(i), this.highlightShapes.set(e, i);
3263
3268
  }
3264
3269
  this.overlayLayerNode.batchDraw();
@@ -3268,7 +3273,7 @@ var it = class {
3268
3273
  let { currentArea: e, currentZIndex: t } = this.state;
3269
3274
  if (!(e === void 0 || t === void 0)) {
3270
3275
  for (let n of this.state.paths) {
3271
- let r = Xe(this.state.mapReader, this.state.settings, n.locations, n.color, e, t), i = $e(this.drawingBackend, r);
3276
+ let r = Ue(this.state.mapReader, this.state.settings, n.locations, n.color, e, t), i = Ke(this.drawingBackend, r);
3272
3277
  this.overlayLayerNode.addNode(i), this.pathShapes.push(i);
3273
3278
  }
3274
3279
  this.overlayLayerNode.batchDraw();
@@ -3282,12 +3287,12 @@ var it = class {
3282
3287
  for (let e of this.pathShapes) e.destroy();
3283
3288
  this.pathShapes = [];
3284
3289
  }
3285
- }, ct = class {
3290
+ }, tt = class {
3286
3291
  get settings() {
3287
3292
  return this.state.settings;
3288
3293
  }
3289
3294
  constructor(e, t, n, r) {
3290
- this.currentStyle = S, this.state = new y(e, t ?? p()), this.backend = r ? r(this.state) : new st(this.state, n);
3295
+ this.currentStyle = S, this.state = new y(e, t ?? p()), this.backend = r ? r(this.state) : new et(this.state, n);
3291
3296
  }
3292
3297
  destroy() {
3293
3298
  this.backend.destroy();
@@ -3332,7 +3337,7 @@ var it = class {
3332
3337
  this.state.refreshPosition();
3333
3338
  }
3334
3339
  setStyle(e) {
3335
- this.currentStyle = e, this.backend.setDrawingBackend(e(new Le()));
3340
+ this.currentStyle = e, this.backend.setDrawingBackend(e(new Ae()));
3336
3341
  }
3337
3342
  clearStyle() {
3338
3343
  this.setStyle(S);
@@ -3427,16 +3432,16 @@ var it = class {
3427
3432
  };
3428
3433
  //#endregion
3429
3434
  //#region src/backend/SvgBackend.ts
3430
- function V(e) {
3435
+ function J(e) {
3431
3436
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3432
3437
  }
3433
- function H(e, t) {
3434
- return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? V(t) : t}"`;
3438
+ function Y(e, t) {
3439
+ return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? J(t) : t}"`;
3435
3440
  }
3436
- function lt(e, t) {
3441
+ function nt(e, t) {
3437
3442
  return !e || t === !1 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
3438
3443
  }
3439
- var U = class {
3444
+ var X = class {
3440
3445
  constructor(e, t) {
3441
3446
  this.elements = [], this.visible = !0, this.x = e, this.y = t;
3442
3447
  }
@@ -3460,12 +3465,12 @@ var U = class {
3460
3465
  toSvg() {
3461
3466
  return !this.visible || this.elements.length === 0 ? "" : this.x === 0 && this.y === 0 ? this.elements.join("\n") : `<g transform="translate(${this.x},${this.y})">\n${this.elements.join("\n")}\n</g>`;
3462
3467
  }
3463
- }, W = class {
3468
+ }, rt = class {
3464
3469
  constructor() {
3465
3470
  this.groups = [];
3466
3471
  }
3467
3472
  addNode(e) {
3468
- e instanceof U && this.groups.push(e);
3473
+ e instanceof X && this.groups.push(e);
3469
3474
  }
3470
3475
  destroyChildren() {
3471
3476
  this.groups = [];
@@ -3474,50 +3479,50 @@ var U = class {
3474
3479
  toSvg() {
3475
3480
  return this.groups.filter((e) => e.isVisible()).map((e) => e.toSvg()).filter((e) => e.length > 0).join("\n");
3476
3481
  }
3477
- }, ut = class {
3482
+ }, it = class {
3478
3483
  createGroup(e, t) {
3479
- return new U(e, t);
3484
+ return new X(e, t);
3480
3485
  }
3481
3486
  addRect(e, t) {
3482
- if (!(e instanceof U)) return;
3483
- let n = t.fill ?? "none", r = `<rect${H("x", t.x)}${H("y", t.y)}${H("width", t.width)}${H("height", t.height)}${H("fill", n)}${H("stroke", t.stroke)}${H("stroke-width", t.strokeWidth)}${t.cornerRadius ? `${H("rx", t.cornerRadius)}${H("ry", t.cornerRadius)}` : ""}${lt(t.dash, t.dashEnabled)}/>`;
3487
+ if (!(e instanceof X)) return;
3488
+ let n = t.fill ?? "none", r = `<rect${Y("x", t.x)}${Y("y", t.y)}${Y("width", t.width)}${Y("height", t.height)}${Y("fill", n)}${Y("stroke", t.stroke)}${Y("stroke-width", t.strokeWidth)}${t.cornerRadius ? `${Y("rx", t.cornerRadius)}${Y("ry", t.cornerRadius)}` : ""}${nt(t.dash, t.dashEnabled)}/>`;
3484
3489
  e.elements.push(r);
3485
3490
  }
3486
3491
  addCircle(e, t) {
3487
- if (!(e instanceof U)) return;
3488
- let n = t.fill ?? "none", r = `<circle${H("cx", t.cx)}${H("cy", t.cy)}${H("r", t.radius)}${H("fill", n)}${H("stroke", t.stroke)}${H("stroke-width", t.strokeWidth)}${lt(t.dash, t.dashEnabled)}/>`;
3492
+ if (!(e instanceof X)) return;
3493
+ let n = t.fill ?? "none", r = `<circle${Y("cx", t.cx)}${Y("cy", t.cy)}${Y("r", t.radius)}${Y("fill", n)}${Y("stroke", t.stroke)}${Y("stroke-width", t.strokeWidth)}${nt(t.dash, t.dashEnabled)}/>`;
3489
3494
  e.elements.push(r);
3490
3495
  }
3491
3496
  addLine(e, t) {
3492
- if (!(e instanceof U)) return;
3497
+ if (!(e instanceof X)) return;
3493
3498
  let n = t.points, r = [];
3494
3499
  for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
3495
- let i = `<polyline points="${r.join(" ")}"${H("stroke", t.stroke)}${H("stroke-width", t.strokeWidth)}${lt(t.dash)}${H("stroke-linecap", t.lineCap)}${H("stroke-linejoin", t.lineJoin)}${H("opacity", t.alpha)} fill="none"/>`;
3500
+ let i = `<polyline points="${r.join(" ")}"${Y("stroke", t.stroke)}${Y("stroke-width", t.strokeWidth)}${nt(t.dash)}${Y("stroke-linecap", t.lineCap)}${Y("stroke-linejoin", t.lineJoin)}${Y("opacity", t.alpha)} fill="none"/>`;
3496
3501
  e.elements.push(i);
3497
3502
  }
3498
3503
  addGridLine(e, t) {
3499
3504
  this.addLine(e, t);
3500
3505
  }
3501
3506
  addPolygon(e, t) {
3502
- if (!(e instanceof U)) return;
3507
+ if (!(e instanceof X)) return;
3503
3508
  let n = t.vertices, r = [];
3504
3509
  for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
3505
- let i = `<polygon points="${r.join(" ")}"${H("fill", t.fill)}${H("stroke", t.stroke)}${H("stroke-width", t.strokeWidth)}/>`;
3510
+ let i = `<polygon points="${r.join(" ")}"${Y("fill", t.fill)}${Y("stroke", t.stroke)}${Y("stroke-width", t.strokeWidth)}/>`;
3506
3511
  e.elements.push(i);
3507
3512
  }
3508
3513
  addText(e, t) {
3509
- if (!(e instanceof U)) return;
3514
+ if (!(e instanceof X)) return;
3510
3515
  let n = t.x, r = t.y, i = "start", a = "auto";
3511
3516
  t.width !== void 0 && (t.align === "center" ? (n = t.x + t.width / 2, i = "middle") : t.align === "right" && (n = t.x + t.width, i = "end")), t.height !== void 0 && t.verticalAlign === "middle" ? t.baselineRatio === void 0 ? (r = t.y + t.height / 2, a = "central") : r = t.y + t.height / 2 + t.baselineRatio * t.fontSize : t.offsetY && (r -= t.offsetY);
3512
- let o = t.transform ? ` transform="matrix(${t.transform.join(",")})"` : "", s = `<text${H("x", n)}${H("y", r)}${H("font-size", t.fontSize)}${t.fontFamily ? H("font-family", t.fontFamily) : ""}${t.fontStyle === "bold" ? " font-weight=\"bold\"" : ""}${H("fill", t.fill)} text-anchor="${i}" dominant-baseline="${a}"${o}>${V(t.text)}</text>`;
3517
+ let o = t.transform ? ` transform="matrix(${t.transform.join(",")})"` : "", s = `<text${Y("x", n)}${Y("y", r)}${Y("font-size", t.fontSize)}${t.fontFamily ? Y("font-family", t.fontFamily) : ""}${t.fontStyle === "bold" ? " font-weight=\"bold\"" : ""}${Y("fill", t.fill)} text-anchor="${i}" dominant-baseline="${a}"${o}>${J(t.text)}</text>`;
3513
3518
  e.elements.push(s);
3514
3519
  }
3515
3520
  addImage(e, t) {
3516
- if (e instanceof U) if (t.transform) {
3517
- let [n, r, i, a, o, s] = t.transform, c = `<image${H("width", t.width)}${H("height", t.height)} href="${V(t.src)}" transform="matrix(${n},${r},${i},${a},${o},${s})"/>`;
3521
+ if (e instanceof X) if (t.transform) {
3522
+ let [n, r, i, a, o, s] = t.transform, c = `<image${Y("width", t.width)}${Y("height", t.height)} href="${J(t.src)}" transform="matrix(${n},${r},${i},${a},${o},${s})"/>`;
3518
3523
  e.elements.push(c);
3519
3524
  } else {
3520
- let n = `<image${H("x", t.x)}${H("y", t.y)}${H("width", t.width)}${H("height", t.height)} href="${V(t.src)}"/>`;
3525
+ let n = `<image${Y("x", t.x)}${Y("y", t.y)}${Y("width", t.width)}${Y("height", t.height)} href="${J(t.src)}"/>`;
3521
3526
  e.elements.push(n);
3522
3527
  }
3523
3528
  }
@@ -3533,8 +3538,8 @@ var U = class {
3533
3538
  getInverseTransform() {
3534
3539
  return b;
3535
3540
  }
3536
- }, dt = "#4a3728", ft = "#3b2a1a", pt = 139, mt = 115, ht = 85, gt = 244, _t = 228, vt = 193;
3537
- function yt(e) {
3541
+ }, at = "#4a3728", ot = "#3b2a1a", st = 139, ct = 115, lt = 85, ut = 244, dt = 228, ft = 193;
3542
+ function pt(e) {
3538
3543
  let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
3539
3544
  return t ? {
3540
3545
  r: parseInt(t[1]),
@@ -3548,60 +3553,60 @@ function yt(e) {
3548
3553
  a: 1
3549
3554
  } : null;
3550
3555
  }
3551
- function bt(e) {
3552
- let t = yt(e);
3553
- if (!t) return `rgb(${gt}, ${_t}, ${vt})`;
3554
- let n = (.299 * t.r + .587 * t.g + .114 * t.b) / 255, r = Math.round(pt + (gt - pt) * n), i = Math.round(mt + (_t - mt) * n), a = Math.round(ht + (vt - ht) * n);
3556
+ function mt(e) {
3557
+ let t = pt(e);
3558
+ if (!t) return `rgb(${ut}, ${dt}, ${ft})`;
3559
+ let n = (.299 * t.r + .587 * t.g + .114 * t.b) / 255, r = Math.round(st + (ut - st) * n), i = Math.round(ct + (dt - ct) * n), a = Math.round(lt + (ft - lt) * n);
3555
3560
  return t.a < 1 ? `rgba(${r}, ${i}, ${a}, ${t.a})` : `rgb(${r}, ${i}, ${a})`;
3556
3561
  }
3557
- function G(e) {
3558
- let t = yt(e);
3559
- if (!t || t.a >= 1) return dt;
3560
- let n = yt(dt);
3562
+ function Z(e) {
3563
+ let t = pt(e);
3564
+ if (!t || t.a >= 1) return at;
3565
+ let n = pt(at);
3561
3566
  return `rgba(${n.r}, ${n.g}, ${n.b}, ${t.a})`;
3562
3567
  }
3563
- var xt = class extends x {
3568
+ var ht = class extends x {
3564
3569
  addRect(e, t) {
3565
3570
  this.inner.addRect(e, {
3566
3571
  ...t,
3567
- fill: t.fill ? bt(t.fill) : void 0,
3568
- stroke: t.stroke ? G(t.stroke) : void 0
3572
+ fill: t.fill ? mt(t.fill) : void 0,
3573
+ stroke: t.stroke ? Z(t.stroke) : void 0
3569
3574
  });
3570
3575
  }
3571
3576
  addCircle(e, t) {
3572
3577
  this.inner.addCircle(e, {
3573
3578
  ...t,
3574
- fill: t.fill ? bt(t.fill) : void 0,
3575
- stroke: t.stroke ? G(t.stroke) : void 0
3579
+ fill: t.fill ? mt(t.fill) : void 0,
3580
+ stroke: t.stroke ? Z(t.stroke) : void 0
3576
3581
  });
3577
3582
  }
3578
3583
  addLine(e, t) {
3579
3584
  this.inner.addLine(e, {
3580
3585
  ...t,
3581
- stroke: t.stroke ? G(t.stroke) : void 0
3586
+ stroke: t.stroke ? Z(t.stroke) : void 0
3582
3587
  });
3583
3588
  }
3584
3589
  addGridLine(e, t) {
3585
3590
  this.inner.addGridLine(e, {
3586
3591
  ...t,
3587
- stroke: t.stroke ? G(t.stroke) : void 0
3592
+ stroke: t.stroke ? Z(t.stroke) : void 0
3588
3593
  });
3589
3594
  }
3590
3595
  addPolygon(e, t) {
3591
3596
  this.inner.addPolygon(e, {
3592
3597
  ...t,
3593
- fill: t.fill ? bt(t.fill) : void 0,
3594
- stroke: t.stroke ? G(t.stroke) : void 0
3598
+ fill: t.fill ? mt(t.fill) : void 0,
3599
+ stroke: t.stroke ? Z(t.stroke) : void 0
3595
3600
  });
3596
3601
  }
3597
3602
  addText(e, t) {
3598
3603
  this.inner.addText(e, {
3599
3604
  ...t,
3600
- fill: ft
3605
+ fill: ot
3601
3606
  });
3602
3607
  }
3603
- }, St = "#c0deff", Ct = "#e0f0ff", wt = 20, Tt = 40, Et = 80, Dt = 60, Ot = 100, kt = 160;
3604
- function At(e) {
3608
+ }, gt = "#c0deff", _t = "#e0f0ff", vt = 20, yt = 40, bt = 80, xt = 60, St = 100, Ct = 160;
3609
+ function wt(e) {
3605
3610
  let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
3606
3611
  return t ? {
3607
3612
  r: parseInt(t[1]),
@@ -3615,54 +3620,54 @@ function At(e) {
3615
3620
  a: 1
3616
3621
  } : null;
3617
3622
  }
3618
- function jt(e) {
3619
- let t = At(e);
3620
- if (!t) return `rgb(${Dt}, ${Ot}, ${kt})`;
3621
- let n = (.299 * t.r + .587 * t.g + .114 * t.b) / 255, r = Math.round(wt + (Dt - wt) * n), i = Math.round(Tt + (Ot - Tt) * n), a = Math.round(Et + (kt - Et) * n);
3623
+ function Tt(e) {
3624
+ let t = wt(e);
3625
+ if (!t) return `rgb(${xt}, ${St}, ${Ct})`;
3626
+ let n = (.299 * t.r + .587 * t.g + .114 * t.b) / 255, r = Math.round(vt + (xt - vt) * n), i = Math.round(yt + (St - yt) * n), a = Math.round(bt + (Ct - bt) * n);
3622
3627
  return t.a < 1 ? `rgba(${r}, ${i}, ${a}, ${t.a})` : `rgb(${r}, ${i}, ${a})`;
3623
3628
  }
3624
- function K(e) {
3625
- let t = At(e);
3626
- if (!t || t.a >= 1) return St;
3627
- let n = At(St);
3629
+ function Et(e) {
3630
+ let t = wt(e);
3631
+ if (!t || t.a >= 1) return gt;
3632
+ let n = wt(gt);
3628
3633
  return `rgba(${n.r}, ${n.g}, ${n.b}, ${t.a})`;
3629
3634
  }
3630
- var Mt = class extends x {
3635
+ var Dt = class extends x {
3631
3636
  addRect(e, t) {
3632
3637
  this.inner.addRect(e, {
3633
3638
  ...t,
3634
- fill: t.fill ? jt(t.fill) : void 0,
3635
- stroke: t.stroke ? K(t.stroke) : void 0
3639
+ fill: t.fill ? Tt(t.fill) : void 0,
3640
+ stroke: t.stroke ? Et(t.stroke) : void 0
3636
3641
  });
3637
3642
  }
3638
3643
  addCircle(e, t) {
3639
3644
  this.inner.addCircle(e, {
3640
3645
  ...t,
3641
- fill: t.fill ? jt(t.fill) : void 0,
3642
- stroke: t.stroke ? K(t.stroke) : void 0
3646
+ fill: t.fill ? Tt(t.fill) : void 0,
3647
+ stroke: t.stroke ? Et(t.stroke) : void 0
3643
3648
  });
3644
3649
  }
3645
3650
  addLine(e, t) {
3646
3651
  this.inner.addLine(e, {
3647
3652
  ...t,
3648
- stroke: t.stroke ? K(t.stroke) : void 0
3653
+ stroke: t.stroke ? Et(t.stroke) : void 0
3649
3654
  });
3650
3655
  }
3651
3656
  addPolygon(e, t) {
3652
3657
  this.inner.addPolygon(e, {
3653
3658
  ...t,
3654
- fill: t.fill ? jt(t.fill) : void 0,
3655
- stroke: t.stroke ? K(t.stroke) : void 0
3659
+ fill: t.fill ? Tt(t.fill) : void 0,
3660
+ stroke: t.stroke ? Et(t.stroke) : void 0
3656
3661
  });
3657
3662
  }
3658
3663
  addText(e, t) {
3659
3664
  this.inner.addText(e, {
3660
3665
  ...t,
3661
- fill: Ct
3666
+ fill: _t
3662
3667
  });
3663
3668
  }
3664
- }, Nt = "#00ffd0", Pt = .3, q = 3;
3665
- function Ft(e) {
3669
+ }, Ot = "#00ffd0", kt = .3, At = 3;
3670
+ function jt(e) {
3666
3671
  let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
3667
3672
  return t ? {
3668
3673
  r: parseInt(t[1]),
@@ -3676,7 +3681,7 @@ function Ft(e) {
3676
3681
  a: 1
3677
3682
  } : null;
3678
3683
  }
3679
- function It(e, t, n) {
3684
+ function Mt(e, t, n) {
3680
3685
  e /= 255, t /= 255, n /= 255;
3681
3686
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
3682
3687
  if (r === i) return [
@@ -3691,132 +3696,132 @@ function It(e, t, n) {
3691
3696
  a
3692
3697
  ];
3693
3698
  }
3694
- function Lt(e, t, n, r = 1) {
3699
+ function Nt(e, t, n, r = 1) {
3695
3700
  e = (e % 360 + 360) % 360;
3696
3701
  let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
3697
3702
  e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
3698
3703
  let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
3699
3704
  return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
3700
3705
  }
3701
- function Rt(e) {
3702
- let t = Ft(e);
3706
+ function Pt(e) {
3707
+ let t = jt(e);
3703
3708
  if (!t) return {
3704
3709
  neon: "#00ff88",
3705
3710
  h: 150,
3706
3711
  s: 1,
3707
3712
  a: 1
3708
3713
  };
3709
- let [n, ,] = It(t.r, t.g, t.b);
3714
+ let [n, ,] = Mt(t.r, t.g, t.b);
3710
3715
  return {
3711
- neon: Lt(n, .95, .65, t.a),
3716
+ neon: Nt(n, .95, .65, t.a),
3712
3717
  h: n,
3713
3718
  s: .95,
3714
3719
  a: t.a
3715
3720
  };
3716
3721
  }
3717
- function zt(e) {
3718
- let t = Ft(e);
3722
+ function Ft(e) {
3723
+ let t = jt(e);
3719
3724
  if (!t) return "rgb(8, 12, 10)";
3720
- let [n, ,] = It(t.r, t.g, t.b);
3721
- return Lt(n, .4, .1, t.a);
3725
+ let [n, ,] = Mt(t.r, t.g, t.b);
3726
+ return Nt(n, .4, .1, t.a);
3722
3727
  }
3723
- function J(e) {
3724
- let { h: t, a: n } = Rt(e);
3725
- return Lt(t, .95, .65, Math.min(n, Pt));
3728
+ function It(e) {
3729
+ let { h: t, a: n } = Pt(e);
3730
+ return Nt(t, .95, .65, Math.min(n, kt));
3726
3731
  }
3727
- function Y(e) {
3728
- let { neon: t } = Rt(e);
3732
+ function Q(e) {
3733
+ let { neon: t } = Pt(e);
3729
3734
  return t;
3730
3735
  }
3731
- var Bt = class extends x {
3736
+ var Lt = class extends x {
3732
3737
  addRect(e, t) {
3733
3738
  if (t.stroke) {
3734
- let n = (t.strokeWidth ?? 1) * q;
3739
+ let n = (t.strokeWidth ?? 1) * At;
3735
3740
  this.inner.addRect(e, {
3736
3741
  ...t,
3737
3742
  fill: void 0,
3738
- stroke: J(t.stroke),
3743
+ stroke: It(t.stroke),
3739
3744
  strokeWidth: n
3740
3745
  });
3741
3746
  }
3742
3747
  this.inner.addRect(e, {
3743
3748
  ...t,
3744
- fill: t.fill ? zt(t.fill) : void 0,
3745
- stroke: t.stroke ? Y(t.stroke) : void 0
3749
+ fill: t.fill ? Ft(t.fill) : void 0,
3750
+ stroke: t.stroke ? Q(t.stroke) : void 0
3746
3751
  });
3747
3752
  }
3748
3753
  addCircle(e, t) {
3749
3754
  if (t.stroke) {
3750
- let n = (t.strokeWidth ?? 1) * q;
3755
+ let n = (t.strokeWidth ?? 1) * At;
3751
3756
  this.inner.addCircle(e, {
3752
3757
  ...t,
3753
3758
  fill: void 0,
3754
- stroke: J(t.stroke),
3759
+ stroke: It(t.stroke),
3755
3760
  strokeWidth: n
3756
3761
  });
3757
3762
  }
3758
3763
  this.inner.addCircle(e, {
3759
3764
  ...t,
3760
- fill: t.fill ? zt(t.fill) : void 0,
3761
- stroke: t.stroke ? Y(t.stroke) : void 0
3765
+ fill: t.fill ? Ft(t.fill) : void 0,
3766
+ stroke: t.stroke ? Q(t.stroke) : void 0
3762
3767
  });
3763
3768
  }
3764
3769
  addLine(e, t) {
3765
3770
  if (t.stroke) {
3766
- let n = (t.strokeWidth ?? 1) * q;
3771
+ let n = (t.strokeWidth ?? 1) * At;
3767
3772
  this.inner.addLine(e, {
3768
3773
  ...t,
3769
- stroke: J(t.stroke),
3774
+ stroke: It(t.stroke),
3770
3775
  strokeWidth: n,
3771
- alpha: Pt
3776
+ alpha: kt
3772
3777
  });
3773
3778
  }
3774
3779
  this.inner.addLine(e, {
3775
3780
  ...t,
3776
- stroke: t.stroke ? Y(t.stroke) : void 0
3781
+ stroke: t.stroke ? Q(t.stroke) : void 0
3777
3782
  });
3778
3783
  }
3779
3784
  addGridLine(e, t) {
3780
3785
  if (t.stroke) {
3781
- let n = (t.strokeWidth ?? 1) * q;
3786
+ let n = (t.strokeWidth ?? 1) * At;
3782
3787
  this.inner.addGridLine(e, {
3783
3788
  ...t,
3784
- stroke: J(t.stroke),
3789
+ stroke: It(t.stroke),
3785
3790
  strokeWidth: n,
3786
- alpha: Pt
3791
+ alpha: kt
3787
3792
  });
3788
3793
  }
3789
3794
  this.inner.addGridLine(e, {
3790
3795
  ...t,
3791
- stroke: t.stroke ? Y(t.stroke) : void 0
3796
+ stroke: t.stroke ? Q(t.stroke) : void 0
3792
3797
  });
3793
3798
  }
3794
3799
  addPolygon(e, t) {
3795
3800
  this.inner.addPolygon(e, {
3796
3801
  ...t,
3797
- fill: t.fill ? zt(t.fill) : void 0,
3798
- stroke: t.stroke ? Y(t.stroke) : void 0
3802
+ fill: t.fill ? Ft(t.fill) : void 0,
3803
+ stroke: t.stroke ? Q(t.stroke) : void 0
3799
3804
  });
3800
3805
  }
3801
3806
  addText(e, t) {
3802
3807
  this.inner.addText(e, {
3803
3808
  ...t,
3804
- fill: Nt
3809
+ fill: Ot
3805
3810
  });
3806
3811
  }
3807
3812
  };
3808
3813
  //#endregion
3809
3814
  //#region src/style/SketchyStyle.ts
3810
- function X(e) {
3815
+ function Rt(e) {
3811
3816
  let t = e | 0 || 1;
3812
3817
  return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
3813
3818
  }
3814
- function Z(...e) {
3819
+ function zt(...e) {
3815
3820
  let t = 2654435769;
3816
3821
  for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
3817
3822
  return t;
3818
3823
  }
3819
- function Vt(e, t, n, r, i, a) {
3824
+ function Bt(e, t, n, r, i, a) {
3820
3825
  let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
3821
3826
  if (c < .001) return [
3822
3827
  e,
@@ -3831,17 +3836,17 @@ function Vt(e, t, n, r, i, a) {
3831
3836
  }
3832
3837
  return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
3833
3838
  }
3834
- function Ht(e, t, n) {
3839
+ function Vt(e, t, n) {
3835
3840
  if (e.length < 4) return e;
3836
3841
  let r = [];
3837
3842
  for (let i = 0; i < e.length - 2; i += 2) {
3838
- let a = Vt(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
3843
+ let a = Bt(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
3839
3844
  if (i === 0) r.push(...a);
3840
3845
  else for (let e = 2; e < a.length; e++) r.push(a[e]);
3841
3846
  }
3842
3847
  return r;
3843
3848
  }
3844
- function Ut(e, t, n, r, i, a) {
3849
+ function Ht(e, t, n, r, i, a) {
3845
3850
  let o = [
3846
3851
  e,
3847
3852
  t,
@@ -3853,12 +3858,12 @@ function Ut(e, t, n, r, i, a) {
3853
3858
  t + r
3854
3859
  ], s = [];
3855
3860
  for (let e = 0; e < 4; e++) {
3856
- let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = Vt(t, n, c, l, i, a);
3861
+ let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = Bt(t, n, c, l, i, a);
3857
3862
  for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
3858
3863
  }
3859
3864
  return s;
3860
3865
  }
3861
- function Wt(e, t, n, r, i) {
3866
+ function Ut(e, t, n, r, i) {
3862
3867
  let a = [];
3863
3868
  for (let o = 0; o < 24; o++) {
3864
3869
  let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
@@ -3866,17 +3871,17 @@ function Wt(e, t, n, r, i) {
3866
3871
  }
3867
3872
  return a;
3868
3873
  }
3869
- function Gt(e, t, n) {
3874
+ function Wt(e, t, n) {
3870
3875
  let r = e.length / 2;
3871
3876
  if (r < 2) return e;
3872
3877
  let i = [];
3873
3878
  for (let a = 0; a < r; a++) {
3874
- let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = Vt(o, s, l, u, t, n);
3879
+ let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = Bt(o, s, l, u, t, n);
3875
3880
  for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
3876
3881
  }
3877
3882
  return i;
3878
3883
  }
3879
- var Kt = class extends x {
3884
+ var Gt = class extends x {
3880
3885
  constructor(e, t, n) {
3881
3886
  super(e), this.jitter = t, this.pencil = n;
3882
3887
  }
@@ -3888,7 +3893,7 @@ var Kt = class extends x {
3888
3893
  return n >= 1 ? this.pencil : `rgba(${parseInt(this.pencil.slice(1, 3), 16)}, ${parseInt(this.pencil.slice(3, 5), 16)}, ${parseInt(this.pencil.slice(5, 7), 16)}, ${n})`;
3889
3894
  }
3890
3895
  addRect(e, t) {
3891
- let n = this.jitter, r = this.pencil, i = X(Z(t.x, t.y, t.width, t.height)), a = t.fill ? "#ffffff" : void 0, o = t.stroke ? r : void 0;
3896
+ let n = this.jitter, r = this.pencil, i = Rt(zt(t.x, t.y, t.width, t.height)), a = t.fill ? "#ffffff" : void 0, o = t.stroke ? r : void 0;
3892
3897
  if (t.cornerRadius && t.cornerRadius > 0) {
3893
3898
  if (a && this.inner.addRect(e, {
3894
3899
  ...t,
@@ -3896,7 +3901,7 @@ var Kt = class extends x {
3896
3901
  stroke: void 0,
3897
3902
  strokeWidth: 0
3898
3903
  }), o && t.strokeWidth) {
3899
- let r = Ut(t.x, t.y, t.width, t.height, n, i);
3904
+ let r = Ht(t.x, t.y, t.width, t.height, n, i);
3900
3905
  this.inner.addPolygon(e, {
3901
3906
  vertices: r,
3902
3907
  stroke: o,
@@ -3905,7 +3910,7 @@ var Kt = class extends x {
3905
3910
  }
3906
3911
  return;
3907
3912
  }
3908
- let s = Ut(t.x, t.y, t.width, t.height, n, i);
3913
+ let s = Ht(t.x, t.y, t.width, t.height, n, i);
3909
3914
  this.inner.addPolygon(e, {
3910
3915
  vertices: s,
3911
3916
  fill: a,
@@ -3914,7 +3919,7 @@ var Kt = class extends x {
3914
3919
  });
3915
3920
  }
3916
3921
  addCircle(e, t) {
3917
- let n = this.jitter, r = this.pencil, i = X(Z(t.cx, t.cy, t.radius)), a = Wt(t.cx, t.cy, t.radius, n, i);
3922
+ let n = this.jitter, r = this.pencil, i = Rt(zt(t.cx, t.cy, t.radius)), a = Ut(t.cx, t.cy, t.radius, n, i);
3918
3923
  this.inner.addPolygon(e, {
3919
3924
  vertices: a,
3920
3925
  fill: t.fill ? "#ffffff" : void 0,
@@ -3923,7 +3928,7 @@ var Kt = class extends x {
3923
3928
  });
3924
3929
  }
3925
3930
  addLine(e, t) {
3926
- let n = this.jitter, r = X(Z(...t.points.slice(0, 4))), i = Ht(t.points, n, r), a = this.applyPencilWithAlpha(t.stroke);
3931
+ let n = this.jitter, r = Rt(zt(...t.points.slice(0, 4))), i = Vt(t.points, n, r), a = this.applyPencilWithAlpha(t.stroke);
3927
3932
  this.inner.addLine(e, {
3928
3933
  ...t,
3929
3934
  points: i,
@@ -3931,7 +3936,7 @@ var Kt = class extends x {
3931
3936
  });
3932
3937
  }
3933
3938
  addPolygon(e, t) {
3934
- let n = this.jitter, r = this.pencil, i = X(Z(...t.vertices.slice(0, 4))), a = Gt(t.vertices, n, i);
3939
+ let n = this.jitter, r = this.pencil, i = Rt(zt(...t.vertices.slice(0, 4))), a = Wt(t.vertices, n, i);
3935
3940
  this.inner.addPolygon(e, {
3936
3941
  ...t,
3937
3942
  vertices: a,
@@ -3948,20 +3953,20 @@ var Kt = class extends x {
3948
3953
  };
3949
3954
  //#endregion
3950
3955
  //#region src/style/IsometricStyle.ts
3951
- function qt(e) {
3956
+ function Kt(e) {
3952
3957
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
3953
3958
  return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
3954
3959
  }
3955
- function Jt(e) {
3960
+ function qt(e) {
3956
3961
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
3957
3962
  return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
3958
3963
  }
3959
- var Q = 32, Yt = class extends x {
3964
+ var $ = 32, Jt = class extends x {
3960
3965
  constructor(e, t) {
3961
- if (super(e), typeof t == "number") this.depth = t, this.iso = qt(0), this.isoInv = Jt(0);
3966
+ if (super(e), typeof t == "number") this.depth = t, this.iso = Kt(0), this.isoInv = qt(0);
3962
3967
  else {
3963
3968
  let e = t?.rotation ?? 0;
3964
- this.depth = t?.depth ?? .18, this.iso = qt(e), this.isoInv = Jt(e);
3969
+ this.depth = t?.depth ?? .18, this.iso = Kt(e), this.isoInv = qt(e);
3965
3970
  }
3966
3971
  }
3967
3972
  ix(e, t) {
@@ -4113,14 +4118,14 @@ var Q = 32, Yt = class extends x {
4113
4118
  });
4114
4119
  }
4115
4120
  addCircle(e, t) {
4116
- let { cx: n, cy: r, radius: i, fill: a, stroke: o, strokeWidth: s } = t, c = Array(Q * 2);
4117
- for (let e = 0; e < Q; e++) {
4118
- let t = e / Q * Math.PI * 2, a = n + Math.cos(t) * i, o = r + Math.sin(t) * i, [s, l] = this.iso(a, o);
4121
+ let { cx: n, cy: r, radius: i, fill: a, stroke: o, strokeWidth: s } = t, c = Array($ * 2);
4122
+ for (let e = 0; e < $; e++) {
4123
+ let t = e / $ * Math.PI * 2, a = n + Math.cos(t) * i, o = r + Math.sin(t) * i, [s, l] = this.iso(a, o);
4119
4124
  c[e * 2] = s, c[e * 2 + 1] = l;
4120
4125
  }
4121
4126
  if (t.dash || t.dashEnabled) {
4122
- for (let n = 0; n < Q; n++) {
4123
- let r = (n + 1) % Q;
4127
+ for (let n = 0; n < $; n++) {
4128
+ let r = (n + 1) % $;
4124
4129
  this.inner.addLine(e, {
4125
4130
  points: [
4126
4131
  c[n * 2],
@@ -4137,9 +4142,9 @@ var Q = 32, Yt = class extends x {
4137
4142
  }
4138
4143
  if (this.depth > 0 && a) {
4139
4144
  let t = this.depth, n = 0, r = 0, i = 0, l = -Infinity, u = Infinity, d = -Infinity;
4140
- for (let e = 0; e < Q; e++) c[e * 2] > l && (l = c[e * 2], n = e), c[e * 2] < u && (u = c[e * 2], r = e), c[e * 2 + 1] > d && (d = c[e * 2 + 1], i = e);
4145
+ for (let e = 0; e < $; e++) c[e * 2] > l && (l = c[e * 2], n = e), c[e * 2] < u && (u = c[e * 2], r = e), c[e * 2 + 1] > d && (d = c[e * 2 + 1], i = e);
4141
4146
  let f = [], p = n;
4142
- for (let e = 0; e <= Q && (f.push(c[p * 2], c[p * 2 + 1]), p !== i); e++) p = (p + 1) % Q;
4147
+ for (let e = 0; e <= $ && (f.push(c[p * 2], c[p * 2 + 1]), p !== i); e++) p = (p + 1) % $;
4143
4148
  for (let e = f.length - 2; e >= 0; e -= 2) f.push(f[e], f[e + 1] + t);
4144
4149
  this.inner.addPolygon(e, {
4145
4150
  vertices: f,
@@ -4149,7 +4154,7 @@ var Q = 32, Yt = class extends x {
4149
4154
  });
4150
4155
  let m = [];
4151
4156
  p = i;
4152
- for (let e = 0; e <= Q && (m.push(c[p * 2], c[p * 2 + 1]), p !== r); e++) p = (p + 1) % Q;
4157
+ for (let e = 0; e <= $ && (m.push(c[p * 2], c[p * 2 + 1]), p !== r); e++) p = (p + 1) % $;
4153
4158
  for (let e = m.length - 2; e >= 0; e -= 2) m.push(m[e], m[e + 1] + t);
4154
4159
  this.inner.addPolygon(e, {
4155
4160
  vertices: m,
@@ -4247,19 +4252,19 @@ var Q = 32, Yt = class extends x {
4247
4252
  y: t + n.y
4248
4253
  };
4249
4254
  }
4250
- }, Xt = ((e) => new xt(e)), Zt = ((e) => new Mt(e)), Qt = ((e) => new Bt(e));
4251
- function $t(e) {
4252
- return ((t) => new Kt(t, e.jitter, e.color));
4255
+ }, Yt = ((e) => new ht(e)), Xt = ((e) => new Dt(e)), Zt = ((e) => new Lt(e));
4256
+ function Qt(e) {
4257
+ return ((t) => new Gt(t, e.jitter, e.color));
4253
4258
  }
4254
- function en(e = {}) {
4255
- return ((t) => new Yt(t, e));
4259
+ function $t(e = {}) {
4260
+ return ((t) => new Jt(t, e));
4256
4261
  }
4257
4262
  //#endregion
4258
4263
  //#region src/export/SvgExporter.ts
4259
- function tn(e) {
4264
+ function en(e) {
4260
4265
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4261
4266
  }
4262
- var nn = class {
4267
+ var tn = class {
4263
4268
  constructor(e = {}) {
4264
4269
  this.options = e;
4265
4270
  }
@@ -4268,7 +4273,7 @@ var nn = class {
4268
4273
  if (r === void 0 || i === void 0 || !a) return;
4269
4274
  let o = a, s = o.getPlane(i);
4270
4275
  if (!s) return;
4271
- let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = t(new ut()), f = new W(), p = new W(), m = new W(), h = new Oe(e.mapReader, c, d, {
4276
+ let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = t(new it()), f = new rt(), p = new rt(), m = new rt(), h = new xe(e.mapReader, c, d, {
4272
4277
  gridLayer: f,
4273
4278
  linkLayer: p,
4274
4279
  roomLayer: m
@@ -4280,7 +4285,7 @@ var nn = class {
4280
4285
  };
4281
4286
  h.buildScene(o, s, i, g);
4282
4287
  let _ = [];
4283
- _.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${u.x} ${u.y} ${u.w} ${u.h}">`), _.push(`<rect x="${u.x}" y="${u.y}" width="${u.w}" height="${u.h}" fill="${tn(c.backgroundColor)}"/>`);
4288
+ _.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${u.x} ${u.y} ${u.w} ${u.h}">`), _.push(`<rect x="${u.x}" y="${u.y}" width="${u.w}" height="${u.h}" fill="${en(c.backgroundColor)}"/>`);
4284
4289
  let v = f.toSvg();
4285
4290
  v && _.push(v);
4286
4291
  let y = p.toSvg();
@@ -4291,7 +4296,7 @@ var nn = class {
4291
4296
  this.renderBuiltInOverlays(x, d, e, g, _);
4292
4297
  for (let t of n) {
4293
4298
  let n = t.render(d, e, g), r = n === void 0 ? [] : Array.isArray(n) ? n : [n];
4294
- for (let e of r) if (e instanceof U) {
4299
+ for (let e of r) if (e instanceof X) {
4295
4300
  let t = e.toSvg();
4296
4301
  t && _.push(t);
4297
4302
  }
@@ -4302,31 +4307,31 @@ var nn = class {
4302
4307
  if (!e) return;
4303
4308
  let a = n.settings;
4304
4309
  if (e.paths) for (let r of e.paths) {
4305
- let e = $e(t, Xe(n.mapReader, a, r.locations, r.color, n.currentArea, n.currentZIndex)).toSvg();
4310
+ let e = Ke(t, Ue(n.mapReader, a, r.locations, r.color, n.currentArea, n.currentZIndex)).toSvg();
4306
4311
  e && i.push(e);
4307
4312
  }
4308
4313
  if (e.highlights) for (let r of e.highlights) {
4309
4314
  let e = n.mapReader.getRoom(r.roomId);
4310
4315
  if (!e) continue;
4311
- let o = Ze(t, Je(e, r.color, a)).toSvg();
4316
+ let o = We(t, Ve(e, r.color, a)).toSvg();
4312
4317
  o && i.push(o);
4313
4318
  }
4314
4319
  if (e.position) {
4315
4320
  let r = n.mapReader.getRoom(e.position.roomId);
4316
4321
  if (r) {
4317
- let e = Qe(t, Ye(r, a)).toSvg();
4322
+ let e = Ge(t, He(r, a)).toSvg();
4318
4323
  e && i.push(e);
4319
4324
  }
4320
4325
  }
4321
4326
  }
4322
- }, rn = class {
4327
+ }, nn = class {
4323
4328
  constructor(e = {}) {
4324
4329
  this.options = e;
4325
4330
  }
4326
4331
  render({ backend: e }) {
4327
4332
  return e.exportCanvas(this.options)?.toDataURL("image/png");
4328
4333
  }
4329
- }, an = class {
4334
+ }, rn = class {
4330
4335
  constructor(e = {}) {
4331
4336
  this.options = e;
4332
4337
  }
@@ -4343,32 +4348,32 @@ var nn = class {
4343
4348
  };
4344
4349
  //#endregion
4345
4350
  //#region src/export/canvasToBytes.ts
4346
- function on(e, t = "image/png", n) {
4351
+ function an(e, t = "image/png", n) {
4347
4352
  let r = e.toDataURL(t, n), i = r.indexOf(","), a = i >= 0 ? r.slice(i + 1) : r, o = atob(a), s = new Uint8Array(o.length);
4348
4353
  for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
4349
4354
  return s;
4350
4355
  }
4351
4356
  //#endregion
4352
4357
  //#region src/export/CanvasExporter.ts
4353
- var sn = class {
4358
+ var on = class {
4354
4359
  constructor(e) {
4355
4360
  this.options = e;
4356
4361
  }
4357
4362
  render({ backend: e }) {
4358
4363
  return e.toCanvas(this.options);
4359
4364
  }
4360
- }, cn = class {
4365
+ }, sn = class {
4361
4366
  constructor(e) {
4362
4367
  this.options = e;
4363
4368
  }
4364
4369
  render(e) {
4365
4370
  let t = e.backend.toCanvas(this.options);
4366
- if (t) return on(t, this.options.mimeType, this.options.quality);
4371
+ if (t) return an(t, this.options.mimeType, this.options.quality);
4367
4372
  }
4368
- }, $, ln, un = 256;
4373
+ }, cn, ln, un = 256;
4369
4374
  function dn(e, t, n) {
4370
4375
  let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
4371
- if (ln === r && $) return $;
4376
+ if (ln === r && cn) return cn;
4372
4377
  let i = un, a = i / 2, o = document.createElement("canvas");
4373
4378
  o.width = i, o.height = i;
4374
4379
  let s = o.getContext("2d");
@@ -4376,7 +4381,7 @@ function dn(e, t, n) {
4376
4381
  let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
4377
4382
  c.addColorStop(0, "rgba(0, 0, 0, 1)"), c.addColorStop(l * .25, "rgba(0, 0, 0, 0.97)"), c.addColorStop(l * .5, "rgba(0, 0, 0, 0.82)"), c.addColorStop(l * .7, "rgba(0, 0, 0, 0.50)"), c.addColorStop(l * .85, "rgba(0, 0, 0, 0.22)"), c.addColorStop(l * .95, "rgba(0, 0, 0, 0.06)"), c.addColorStop(l, "rgba(0, 0, 0, 0)"), l < .98 && c.addColorStop(1, "rgba(0, 0, 0, 0)"), s.fillStyle = c, s.beginPath(), s.arc(a, a, a, 0, Math.PI * 2), s.fill(), s.globalCompositeOperation = "source-over";
4378
4383
  let u = parseInt(t.slice(1, 3), 16), d = parseInt(t.slice(3, 5), 16), f = parseInt(t.slice(5, 7), 16), p = s.createRadialGradient(a, a, 0, a, a, a * l);
4379
- return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i), $ = o.toDataURL(), ln = r, $;
4384
+ return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i), cn = o.toDataURL(), ln = r, cn;
4380
4385
  }
4381
4386
  function fn(e, t, n, r) {
4382
4387
  let { radius: i, intensity: a, color: o } = r, s = n.maxX - n.minX, c = n.maxY - n.minY, l = Math.sqrt(s * s + c * c), u = Math.max(l * 2.5, i * 4);
@@ -4418,7 +4423,7 @@ var pn = {
4418
4423
  render(e, t, n) {
4419
4424
  if (t.positionRoomId === void 0) return;
4420
4425
  let r = t.mapReader.getRoom(t.positionRoomId);
4421
- if (r) return rt(e, fn(r.x, r.y, n, this.params));
4426
+ if (r) return Xe(e, fn(r.x, r.y, n, this.params));
4422
4427
  }
4423
4428
  }, hn = {
4424
4429
  rgb: [
@@ -4452,7 +4457,7 @@ var _n = class {
4452
4457
  this.rooms[e.id] = e;
4453
4458
  });
4454
4459
  let n = parseInt(e.areaId);
4455
- this.areas[n] = new at(t), this.areaSources[n] = t;
4460
+ this.areas[n] = new Qe(t), this.areaSources[n] = t;
4456
4461
  }), this.colors = t.reduce((e, t) => ({
4457
4462
  ...e,
4458
4463
  [t.envId]: {
@@ -4476,7 +4481,7 @@ var _n = class {
4476
4481
  }
4477
4482
  getExplorationArea(e) {
4478
4483
  let t = this.areas[e];
4479
- if (t instanceof z) return t;
4484
+ if (t instanceof K) return t;
4480
4485
  }
4481
4486
  getAreas() {
4482
4487
  return Object.values(this.areas);
@@ -4493,7 +4498,7 @@ var _n = class {
4493
4498
  applyExplorationDecoration() {
4494
4499
  this.visitedRooms && Object.entries(this.areaSources).forEach(([e, t]) => {
4495
4500
  let n = parseInt(e, 10);
4496
- this.areas[n] = new z(t, this.visitedRooms);
4501
+ this.areas[n] = new K(t, this.visitedRooms);
4497
4502
  });
4498
4503
  }
4499
4504
  decorateWithExploration(e) {
@@ -4505,7 +4510,7 @@ var _n = class {
4505
4510
  clearExplorationDecoration() {
4506
4511
  Object.entries(this.areaSources).forEach(([e, t]) => {
4507
4512
  let n = parseInt(e, 10);
4508
- this.areas[n] = new at(t);
4513
+ this.areas[n] = new Qe(t);
4509
4514
  }), this.explorationEnabled = !1;
4510
4515
  }
4511
4516
  isExplorationEnabled() {
@@ -5056,7 +5061,7 @@ var Pn = class {
5056
5061
  toAreaId: e.fromAreaId,
5057
5062
  fromRoomId: e.toRoomId,
5058
5063
  toRoomId: e.fromRoomId,
5059
- direction: e.direction ? ce[e.direction] : null,
5064
+ direction: e.direction ? te[e.direction] : null,
5060
5065
  fromRoomPosition: e.toRoomPosition,
5061
5066
  toRoomPosition: e.fromRoomPosition
5062
5067
  });
@@ -5132,7 +5137,7 @@ var Pn = class {
5132
5137
  }[e.toLowerCase().trim()] ?? null;
5133
5138
  }
5134
5139
  toPlanarDirection(e) {
5135
- return e && se.includes(e) ? e : null;
5140
+ return e && ee.includes(e) ? e : null;
5136
5141
  }
5137
5142
  layoutAreas() {
5138
5143
  if (Array.from(this.areaNodes.values()).length === 0) return;
@@ -5675,6 +5680,6 @@ var Pn = class {
5675
5680
  }
5676
5681
  };
5677
5682
  //#endregion
5678
- export { mn as AmbientLightOverlay, Pn as AreaMapRenderer, x as BaseStyle, Zt as Blueprint, Mt as BlueprintStyle, Le as CanvasBackend, sn as CanvasExporter, z as ExplorationArea, b as IDENTITY_TRANSFORM, en as Isometric, Yt as IsometricStyle, st as KonvaRenderBackend, Tn as MapGraph, _n as MapReader, ct as MapRenderer, y as MapState, Qt as Neon, Bt as NeonStyle, Xt as Parchment, xt as ParchmentStyle, jn as PathFinder, an as PngBlobExporter, cn as PngBytesExporter, rn as PngExporter, $t as Sketchy, Kt as SketchyStyle, ut as SvgBackend, nn as SvgExporter, U as SvgGroupNode, W as SvgLayerNode, je as Viewport, on as canvasToBytes, m as colorLightness, ee as compose, qe as computePathData, Nn as createAreaMapSettings, p as createSettings, h as darkenColor, _ as hexToRgba, S as identityStyle };
5683
+ export { mn as AmbientLightOverlay, Pn as AreaMapRenderer, x as BaseStyle, Xt as Blueprint, Dt as BlueprintStyle, Ae as CanvasBackend, on as CanvasExporter, K as ExplorationArea, b as IDENTITY_TRANSFORM, $t as Isometric, Jt as IsometricStyle, et as KonvaRenderBackend, Tn as MapGraph, _n as MapReader, tt as MapRenderer, y as MapState, Zt as Neon, Lt as NeonStyle, Yt as Parchment, ht as ParchmentStyle, jn as PathFinder, rn as PngBlobExporter, sn as PngBytesExporter, nn as PngExporter, Qt as Sketchy, Gt as SketchyStyle, it as SvgBackend, tn as SvgExporter, X as SvgGroupNode, rt as SvgLayerNode, we as Viewport, an as canvasToBytes, m as colorLightness, C as compose, Be as computePathData, Nn as createAreaMapSettings, p as createSettings, h as darkenColor, _ as hexToRgba, S as identityStyle };
5679
5684
 
5680
5685
  //# sourceMappingURL=index.mjs.map