mudlet-map-renderer 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, L as l, M as u, N as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, W as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as ee, h as E, i as te, j as D, k as ne, l as re, m as ie, n as ae, o as oe, p as se, r as O, s as ce, u as le, v as ue, w as de, x as fe, y as pe, z as me } from "./flushSceneShapes-c7ttw7D-.js";
2
- import { n as he, r as ge, t as _e } from "./MapReader-Brzg-X7T.js";
2
+ import { r as he, t as ge } from "./Area-MLM4Xe0E.js";
3
+ import { t as _e } from "./MapReader-BeVNpm6y.js";
3
4
  import k from "konva";
4
5
  //#region \0rolldown/runtime.js
5
6
  var ve = Object.create, ye = Object.defineProperty, be = Object.getOwnPropertyDescriptor, xe = Object.getOwnPropertyNames, Se = Object.getPrototypeOf, Ce = Object.prototype.hasOwnProperty, A = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), we = (e, t, n, r) => {
@@ -11,7 +12,7 @@ var ve = Object.create, ye = Object.defineProperty, be = Object.getOwnPropertyDe
11
12
  }, Te = (e, t, n) => (n = e == null ? {} : ve(Se(e)), we(t || !e || !e.__esModule ? ye(n, "default", {
12
13
  value: e,
13
14
  enumerable: !0
14
- }) : n, e)), Ee = .6, De = .025, Oe = "rgb(225, 255, 225)";
15
+ }) : n, e)), Ee = .6, De = .025, Oe = "rgb(225, 225, 225)";
15
16
  function ke() {
16
17
  return {
17
18
  roomSize: Ee,
@@ -63,7 +64,11 @@ function ke() {
63
64
  areaExitLabels: !1,
64
65
  areaExitLabelFontSize: .3,
65
66
  neighborSpill: !1,
66
- neighborSpillDistance: 20
67
+ neighborSpillDistance: 20,
68
+ lodEnabled: !1,
69
+ lodRoomBudget: 16e3,
70
+ lodHitTestBudget: 1e4,
71
+ lodExitBudget: 12e3
67
72
  };
68
73
  }
69
74
  //#endregion
@@ -281,13 +286,97 @@ function Pe(e, t, n, r) {
281
286
  };
282
287
  }
283
288
  //#endregion
289
+ //#region src/render/CullIndex.ts
290
+ var Fe = 256, Ie = 2, Le = 32, Re = 1 << 20, ze = class {
291
+ constructor() {
292
+ this.entries = [], this.allShapes = /* @__PURE__ */ new Set(), this.linear = !0, this.originX = 0, this.originY = 0, this.cellSize = 1, this.cols = 0, this.rows = 0, this.cells = [], this.oversized = [], this.stamp = new Int32Array(), this.queryGen = 0;
293
+ }
294
+ build(e) {
295
+ this.entries = e, this.allShapes = new Set(e.map((e) => e.shape));
296
+ let t = e.length;
297
+ if (t < Fe) {
298
+ this.linear = !0;
299
+ return;
300
+ }
301
+ this.linear = !1;
302
+ let n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
303
+ for (let t of e) t.minX < n && (n = t.minX), t.minY < r && (r = t.minY), t.maxX > i && (i = t.maxX), t.maxY > a && (a = t.maxY);
304
+ let o = Math.max(i - n, 1e-6), s = Math.max(a - r, 1e-6), c = Math.sqrt(o * s / Math.max(t / Ie, 1));
305
+ (!isFinite(c) || c <= 0) && (c = Math.max(o, s));
306
+ let l = Math.max(1, Math.ceil(o / c)), u = Math.max(1, Math.ceil(s / c));
307
+ for (; l * u > Re;) c *= 2, l = Math.max(1, Math.ceil(o / c)), u = Math.max(1, Math.ceil(s / c));
308
+ this.originX = n, this.originY = r, this.cellSize = c, this.cols = l, this.rows = u, this.cells = Array.from({ length: l * u }, () => []), this.oversized = [], this.stamp = new Int32Array(t), this.queryGen = 0;
309
+ for (let i = 0; i < t; i++) {
310
+ let t = e[i], a = this.clampCol(Math.floor((t.minX - n) / c)), o = this.clampCol(Math.floor((t.maxX - n) / c)), s = this.clampRow(Math.floor((t.minY - r) / c)), u = this.clampRow(Math.floor((t.maxY - r) / c));
311
+ if ((o - a + 1) * (u - s + 1) > Le) {
312
+ this.oversized.push(i);
313
+ continue;
314
+ }
315
+ for (let e = s; e <= u; e++) {
316
+ let t = e * l;
317
+ for (let e = a; e <= o; e++) this.cells[t + e].push(i);
318
+ }
319
+ }
320
+ }
321
+ getAllShapes() {
322
+ return this.allShapes;
323
+ }
324
+ queryVisible(e) {
325
+ let t = /* @__PURE__ */ new Set(), { minX: n, maxX: r, minY: i, maxY: a } = e;
326
+ if (this.linear) {
327
+ for (let e of this.entries) e.maxX >= n && e.minX <= r && e.maxY >= i && e.minY <= a && t.add(e.shape);
328
+ return t;
329
+ }
330
+ let o = ++this.queryGen, s = this.stamp, c = this.entries, l = this.cols, u = this.clampCol(Math.floor((n - this.originX) / this.cellSize)), d = this.clampCol(Math.floor((r - this.originX) / this.cellSize)), f = this.clampRow(Math.floor((i - this.originY) / this.cellSize)), p = this.clampRow(Math.floor((a - this.originY) / this.cellSize));
331
+ for (let e = f; e <= p; e++) {
332
+ let f = e * l;
333
+ for (let e = u; e <= d; e++) {
334
+ let l = this.cells[f + e];
335
+ for (let e = 0; e < l.length; e++) {
336
+ let u = l[e];
337
+ if (s[u] === o) continue;
338
+ s[u] = o;
339
+ let d = c[u];
340
+ d.maxX >= n && d.minX <= r && d.maxY >= i && d.minY <= a && t.add(d.shape);
341
+ }
342
+ }
343
+ }
344
+ for (let e = 0; e < this.oversized.length; e++) {
345
+ let o = c[this.oversized[e]];
346
+ o.maxX >= n && o.minX <= r && o.maxY >= i && o.minY <= a && t.add(o.shape);
347
+ }
348
+ return t;
349
+ }
350
+ clampCol(e) {
351
+ return e < 0 ? 0 : e >= this.cols ? this.cols - 1 : e;
352
+ }
353
+ clampRow(e) {
354
+ return e < 0 ? 0 : e >= this.rows ? this.rows - 1 : e;
355
+ }
356
+ };
357
+ function Be(t, n, r, i, a) {
358
+ if (a === e) return {
359
+ minX: t,
360
+ minY: n,
361
+ maxX: r,
362
+ maxY: i
363
+ };
364
+ let o = a(t, n), s = a(r, n), c = a(r, i), l = a(t, i);
365
+ return {
366
+ minX: Math.min(o.x, s.x, c.x, l.x),
367
+ minY: Math.min(o.y, s.y, c.y, l.y),
368
+ maxX: Math.max(o.x, s.x, c.x, l.x),
369
+ maxY: Math.max(o.y, s.y, c.y, l.y)
370
+ };
371
+ }
372
+ //#endregion
284
373
  //#region src/rendering/SceneManager.ts
285
- var Fe = {
374
+ var Ve = {
286
375
  grid: [],
287
376
  link: [],
288
377
  room: [],
289
378
  topLabel: []
290
- }, Ie = class {
379
+ }, He = class {
291
380
  constructor(e, t, n) {
292
381
  this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new E(n, t);
293
382
  }
@@ -313,25 +402,54 @@ var Fe = {
313
402
  return this.lastBuildResult?.hitShapes ?? [];
314
403
  }
315
404
  rebuild(e, t, n, r, i) {
316
- return this.lastBuildResult = this.pipeline.buildScene(e, t, n, r, i), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.lastBuildResult;
405
+ return this.lastBuildResult = this.pipeline.buildScene(e, t, n, r, i), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.cullIndex = void 0, this.cullIndexTransform = void 0, this.lastBuildResult;
317
406
  }
318
407
  buildExitShape(e) {
319
408
  return this.pipeline.buildExitShape(e);
320
409
  }
321
410
  reset() {
322
- this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
411
+ this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.cullIndex = void 0, this.cullIndexTransform = void 0;
323
412
  }
324
413
  resetPipeline(e) {
325
414
  this.pipeline = new E(e, this.settings), this.reset();
326
415
  }
327
416
  cullInteractive(t = e) {
328
- if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
329
- let n = this.camera.getCullingViewport(this.settings.cullingBounds), r = t === e ? void 0 : { forward: t };
330
- return Me(this.lastBuildResult, n, this.settings, r);
417
+ if (!this.lastBuildResult) return /* @__PURE__ */ new Set();
418
+ let n = this.ensureCullIndex(t);
419
+ if (!this.settings.cullingEnabled) return new Set(n.getAllShapes());
420
+ let r = this.camera.getCullingViewport(this.settings.cullingBounds);
421
+ return n.queryVisible(r);
422
+ }
423
+ managedShapes(t = e) {
424
+ return this.lastBuildResult ? new Set(this.ensureCullIndex(t).getAllShapes()) : /* @__PURE__ */ new Set();
425
+ }
426
+ ensureCullIndex(e) {
427
+ if (this.cullIndex && this.cullIndexTransform === e) return this.cullIndex;
428
+ let t = new ze();
429
+ return t.build(this.buildCullEntries(e)), this.cullIndex = t, this.cullIndexTransform = e, t;
430
+ }
431
+ buildCullEntries(e) {
432
+ let t = this.lastBuildResult, n = this.settings.roomSize / 2, r = [], i = (t, n, i, a, o) => {
433
+ let s = Be(n, i, a, o, e);
434
+ r.push({
435
+ shape: t,
436
+ minX: s.minX,
437
+ minY: s.minY,
438
+ maxX: s.maxX,
439
+ maxY: s.maxY
440
+ });
441
+ };
442
+ for (let { room: e, shape: r } of t.roomShapeRefs.values()) i(r, e.x - n, e.y - n, e.x + n, e.y + n);
443
+ for (let { shape: e, bounds: n } of t.standaloneExitShapeRefs) i(e, n.x, n.y, n.x + n.width, n.y + n.height);
444
+ for (let { shape: e, bounds: n } of t.labelShapeRefs) i(e, n.x, n.y, n.x + n.width, n.y + n.height);
445
+ for (let { shape: e, bounds: n } of t.specialExitShapeRefs) i(e, n.x, n.y, n.x + n.width, n.y + n.height);
446
+ for (let { shape: e, bounds: n } of t.stubShapeRefs) i(e, n.x, n.y, n.x + n.width, n.y + n.height);
447
+ for (let { shape: e, bounds: n } of t.areaExitLabelShapeRefs) i(e, n.x, n.y, n.x + n.width, n.y + n.height);
448
+ return r;
331
449
  }
332
450
  cull(t = e) {
333
451
  if (!this.lastBuildResult) return {
334
- shapes: Fe,
452
+ shapes: Ve,
335
453
  stats: {
336
454
  visibleRooms: 0,
337
455
  totalRooms: 0,
@@ -421,7 +539,7 @@ function M(e, t) {
421
539
  break;
422
540
  }
423
541
  }
424
- var Le = class {
542
+ var Ue = class {
425
543
  constructor(e, t) {
426
544
  this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
427
545
  }
@@ -467,12 +585,12 @@ var Le = class {
467
585
  })), this._konvaGroup = e, e;
468
586
  }
469
587
  };
470
- function Re(e) {
588
+ function We(e) {
471
589
  if (e.noScaling || e.commands.length !== 1) return null;
472
590
  let t = e.commands[0];
473
591
  return t.type === "rect" ? typeof t.fill != "string" && t.fill !== void 0 || t.dash ? null : `r|${t.fill ?? ""}|${t.stroke ?? ""}|${t.sw}|${t.cr}` : t.type === "circle" ? typeof t.fill != "string" && t.fill !== void 0 || t.dash ? null : `c|${t.fill ?? ""}|${t.stroke ?? ""}|${t.sw}|${t.r}` : t.type === "line" ? t.dash || t.alpha !== void 0 ? null : `l|${t.stroke ?? ""}|${t.sw}|${t.lineCap ?? ""}|${t.lineJoin ?? ""}` : null;
474
592
  }
475
- var ze = class {
593
+ var Ge = class {
476
594
  constructor(e, t = () => !1) {
477
595
  this.coalesce = t, this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.buckets = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
478
596
  let n = this;
@@ -504,7 +622,7 @@ var ze = class {
504
622
  l.clear();
505
623
  for (let t of this.entries) {
506
624
  if (!t.visible || !n(t)) continue;
507
- let u = Re(t);
625
+ let u = We(t);
508
626
  if (u === null) {
509
627
  let n = r * t.x + a * t.y + s, l = i * t.x + o * t.y + c;
510
628
  t.noScaling ? e.setTransform(75, 0, 0, 75, n, l) : e.setTransform(r, i, a, o, n, l);
@@ -595,7 +713,7 @@ var ze = class {
595
713
  ensureShape() {
596
714
  this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
597
715
  }
598
- }, Be = class {
716
+ }, Ke = class {
599
717
  constructor(e) {
600
718
  this.konvaLayer = e;
601
719
  }
@@ -611,14 +729,14 @@ var ze = class {
611
729
  };
612
730
  //#endregion
613
731
  //#region src/scene/Shape.ts
614
- function Ve(e) {
732
+ function qe(e) {
615
733
  return typeof e == "object" && !!e;
616
734
  }
617
- function He(e, t) {
735
+ function Je(e, t) {
618
736
  return t !== !1 && e ? e : void 0;
619
737
  }
620
738
  function P(e, t, n, r, i, a) {
621
- return Ve(e) ? e.type === "linear" ? {
739
+ return qe(e) ? e.type === "linear" ? {
622
740
  type: "linear",
623
741
  x0: (t + e.x0) * r + i,
624
742
  y0: (n + e.y0) * r + a,
@@ -638,14 +756,14 @@ function P(e, t, n, r, i, a) {
638
756
  }
639
757
  //#endregion
640
758
  //#region src/render/shapeToRecording.ts
641
- function Ue(e) {
642
- let t = new Le(e.x, e.y);
643
- return e.noScale && (t.noScaling = !0), t.layer = e.layer, We(t, e.children, 0, 0), t;
759
+ function Ye(e) {
760
+ let t = new Ue(e.x, e.y);
761
+ return e.noScale && (t.noScaling = !0), t.layer = e.layer, Xe(t, e.children, 0, 0), t;
644
762
  }
645
- function We(e, t, n, r) {
646
- for (let i of t) Ge(e, i, n, r);
763
+ function Xe(e, t, n, r) {
764
+ for (let i of t) Ze(e, i, n, r);
647
765
  }
648
- function Ge(e, t, n, r) {
766
+ function Ze(e, t, n, r) {
649
767
  switch (t.type) {
650
768
  case "rect":
651
769
  e.commands.push({
@@ -658,7 +776,7 @@ function Ge(e, t, n, r) {
658
776
  stroke: t.paint.stroke,
659
777
  sw: t.paint.strokeWidth ?? 0,
660
778
  cr: t.cornerRadius ?? 0,
661
- dash: He(t.paint.dash, t.paint.dashEnabled)
779
+ dash: Je(t.paint.dash, t.paint.dashEnabled)
662
780
  });
663
781
  return;
664
782
  case "circle":
@@ -670,17 +788,17 @@ function Ge(e, t, n, r) {
670
788
  fill: P(t.paint.fill, n, r, 1, 0, 0),
671
789
  stroke: t.paint.stroke,
672
790
  sw: t.paint.strokeWidth ?? 0,
673
- dash: He(t.paint.dash, t.paint.dashEnabled)
791
+ dash: Je(t.paint.dash, t.paint.dashEnabled)
674
792
  });
675
793
  return;
676
794
  case "line": {
677
- let i = n === 0 && r === 0 ? t.points : Ke(t.points, n, r);
795
+ let i = n === 0 && r === 0 ? t.points : Qe(t.points, n, r);
678
796
  e.commands.push({
679
797
  type: "line",
680
798
  points: i,
681
799
  stroke: t.paint.stroke,
682
800
  sw: t.paint.strokeWidth ?? 0,
683
- dash: He(t.paint.dash, t.paint.dashEnabled),
801
+ dash: Je(t.paint.dash, t.paint.dashEnabled),
684
802
  lineCap: t.lineCap,
685
803
  lineJoin: t.lineJoin,
686
804
  alpha: t.paint.alpha
@@ -690,7 +808,7 @@ function Ge(e, t, n, r) {
690
808
  case "polygon":
691
809
  e.commands.push({
692
810
  type: "polygon",
693
- vertices: n === 0 && r === 0 ? t.vertices : Ke(t.vertices, n, r),
811
+ vertices: n === 0 && r === 0 ? t.vertices : Qe(t.vertices, n, r),
694
812
  fill: P(t.paint.fill, n, r, 1, 0, 0),
695
813
  stroke: t.paint.stroke,
696
814
  sw: t.paint.strokeWidth ?? 0
@@ -717,7 +835,7 @@ function Ge(e, t, n, r) {
717
835
  });
718
836
  return;
719
837
  case "image": {
720
- let i = qe(t.src);
838
+ let i = $e(t.src);
721
839
  e.commands.push({
722
840
  type: "image",
723
841
  x: t.x + n,
@@ -730,27 +848,151 @@ function Ge(e, t, n, r) {
730
848
  return;
731
849
  }
732
850
  case "group":
733
- We(e, t.children, n + t.x, r + t.y);
851
+ Xe(e, t.children, n + t.x, r + t.y);
734
852
  return;
735
853
  }
736
854
  }
737
- function Ke(e, t, n) {
855
+ function Qe(e, t, n) {
738
856
  let r = Array(e.length);
739
857
  for (let i = 0; i < e.length; i += 2) r[i] = e[i] + t, r[i + 1] = e[i + 1] + n;
740
858
  return r;
741
859
  }
742
- function qe(e) {
860
+ function $e(e) {
743
861
  let t = k === void 0 ? typeof Image < "u" ? new Image() : null : k.Util.createImageElement();
744
862
  return t && (t.src = e), t;
745
863
  }
746
864
  //#endregion
865
+ //#region src/reader/ViewportDataSource.ts
866
+ function F(e) {
867
+ return !!e && e.viewportAware === !0;
868
+ }
869
+ //#endregion
870
+ //#region src/rendering/lod/RasterOverview.ts
871
+ function et(e, t = 1) {
872
+ let n = Math.ceil(e) + 1, r = Math.ceil(e * t) + 1;
873
+ return Math.max(1, Math.min(48, Math.max(n, r)));
874
+ }
875
+ function tt(e, t, n) {
876
+ let r = e.width, i = e.height, a = new Uint32Array(e.data.buffer), o = et(n.scale, n.roomSize), s = o >> 1;
877
+ t((e, t, c) => {
878
+ let l = Math.round(e * n.scale + n.offsetX) - s, u = Math.round(t * n.scale + n.offsetY) - s, d = n.colorOf(c);
879
+ for (let e = 0; e < o; e++) {
880
+ let t = u + e;
881
+ if (t < 0 || t >= i) continue;
882
+ let n = t * r;
883
+ for (let e = 0; e < o; e++) {
884
+ let t = l + e;
885
+ t >= 0 && t < r && (a[n + t] = d);
886
+ }
887
+ }
888
+ });
889
+ }
890
+ function nt(e) {
891
+ let t = e.trim(), n = 0, r = 0, i = 0;
892
+ if (t[0] === "#") t.length === 4 ? (n = parseInt(t[1] + t[1], 16), r = parseInt(t[2] + t[2], 16), i = parseInt(t[3] + t[3], 16)) : (n = parseInt(t.slice(1, 3), 16), r = parseInt(t.slice(3, 5), 16), i = parseInt(t.slice(5, 7), 16));
893
+ else {
894
+ let e = t.match(/(\d+)[,\s]+(\d+)[,\s]+(\d+)/);
895
+ e && (n = +e[1], r = +e[2], i = +e[3]);
896
+ }
897
+ return (255 << 24 | i << 16 | r << 8 | n) >>> 0;
898
+ }
899
+ //#endregion
900
+ //#region src/rendering/lod/LodController.ts
901
+ var rt = .25, it = 8192, at = class {
902
+ constructor(e, t, n, r) {
903
+ this.layer = e, this.camera = t, this.colorCss = n, this.roomSizeOf = r, this.visit = null, this.paintedRegion = null, this.paintedScale = 0, this.repaintScheduled = !1, this.destroyed = !1, this.packedCache = /* @__PURE__ */ new Map(), this.colorOf = (e) => {
904
+ let t = this.packedCache.get(e);
905
+ return t === void 0 && (t = nt(this.colorCss(e)), this.packedCache.set(e, t)), t;
906
+ }, this.canvas = k.Util.createCanvasElement(), this.layer.visible(!1);
907
+ }
908
+ setSource(e) {
909
+ this.visit = e, this.packedCache.clear(), this.paint();
910
+ }
911
+ clear() {
912
+ this.visit === null && !this.layer.visible() || (this.visit = null, this.paintedRegion = null, this.layer.visible(!1), this.layer.batchDraw());
913
+ }
914
+ onViewportChange() {
915
+ if (!this.visit || this.repaintScheduled) return;
916
+ let e = this.paintedRegion;
917
+ if (e && this.camera.getScale() === this.paintedScale) {
918
+ let t = this.camera.getViewportBounds();
919
+ if (t.minX >= e.minX && t.maxX <= e.maxX && t.minY >= e.minY && t.maxY <= e.maxY) return;
920
+ }
921
+ this.repaintScheduled = !0;
922
+ let t = () => {
923
+ this.repaintScheduled = !1, !this.destroyed && this.visit && this.paint();
924
+ };
925
+ typeof requestAnimationFrame < "u" ? requestAnimationFrame(t) : queueMicrotask(t);
926
+ }
927
+ destroy() {
928
+ this.destroyed = !0, this.visit = null;
929
+ }
930
+ paint() {
931
+ let e = this.visit;
932
+ if (!e) return;
933
+ let t = this.camera.getViewportBounds(), n = this.camera.getScale(), r = (t.maxX - t.minX) * rt, i = (t.maxY - t.minY) * rt, a = {
934
+ minX: t.minX - r,
935
+ maxX: t.maxX + r,
936
+ minY: t.minY - i,
937
+ maxY: t.maxY + i
938
+ }, o = Math.min(it, Math.max(1, Math.ceil((a.maxX - a.minX) * n))), s = Math.min(it, Math.max(1, Math.ceil((a.maxY - a.minY) * n)));
939
+ this.canvas.width = o, this.canvas.height = s;
940
+ let c = this.canvas.getContext("2d"), l = c.createImageData(o, s);
941
+ tt(l, (t) => e(a, t), {
942
+ scale: n,
943
+ offsetX: -a.minX * n,
944
+ offsetY: -a.minY * n,
945
+ colorOf: this.colorOf,
946
+ roomSize: this.roomSizeOf()
947
+ }), c.putImageData(l, 0, 0), this.image ? this.image.image(this.canvas) : (this.image = new k.Image({
948
+ image: this.canvas,
949
+ listening: !1
950
+ }), this.layer.add(this.image)), this.image.position({
951
+ x: a.minX,
952
+ y: a.minY
953
+ }), this.image.size({
954
+ width: a.maxX - a.minX,
955
+ height: a.maxY - a.minY
956
+ }), this.paintedRegion = a, this.paintedScale = n, this.layer.visible(!0), this.layer.batchDraw();
957
+ }
958
+ };
959
+ //#endregion
960
+ //#region src/rendering/lod/lodDecision.ts
961
+ function ot(e) {
962
+ return e.planeRoomCount > e.roomBudget && e.scale * e.scale < e.stageWidth * e.stageHeight / e.roomBudget;
963
+ }
964
+ function st(e) {
965
+ return ot({
966
+ ...e,
967
+ roomBudget: e.roomBudget
968
+ }) ? "raster" : e.exitBudget !== void 0 && ot({
969
+ ...e,
970
+ roomBudget: e.exitBudget
971
+ }) ? "roomsOnly" : "vector";
972
+ }
973
+ //#endregion
974
+ //#region src/rendering/lod/roomsOnlyArea.ts
975
+ function ct(e) {
976
+ return {
977
+ getAreaName: () => e.getAreaName(),
978
+ getAreaId: () => e.getAreaId(),
979
+ getVersion: () => e.getVersion(),
980
+ getPlane: (t) => e.getPlane(t),
981
+ getPlanes: () => e.getPlanes(),
982
+ getZLevels: () => e.getZLevels(),
983
+ getRooms: () => e.getRooms(),
984
+ getFullBounds: () => e.getFullBounds(),
985
+ getLinkExits: () => []
986
+ };
987
+ }
988
+ //#endregion
747
989
  //#region src/rendering/KonvaRenderBackend.ts
748
- var F = "rgb(120, 72, 0)", Je = class {
990
+ var I = "rgb(120, 72, 0)", lt = .5, ut = (1 + 2 * lt) ** 2, dt = class {
749
991
  get coordinateTransform() {
750
992
  return this._coordinateTransform;
751
993
  }
752
994
  constructor(t, n) {
753
- this.gridCachedBounds = null, this.currentStyle = x, this.hitTester = new oe(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.spilledRoomPositions = /* @__PURE__ */ new Map(), this.currentRoomOverlay = [], this.destroyed = !1, this._coordinateTransform = e, this.coordinateInverse = e, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.state = t, this.container = n, n ? (this.stage = new k.Stage({
995
+ this.gridCachedBounds = null, this.currentStyle = x, this.hitTester = new oe(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.lastVisibleShapes = /* @__PURE__ */ new Set(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.spilledRoomPositions = /* @__PURE__ */ new Map(), this.currentRoomOverlay = [], this.destroyed = !1, this._coordinateTransform = e, this.coordinateInverse = e, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.lodMode = "vector", this.lastAppliedViewport = null, this.lastAppliedScale = null, this.refreshScheduled = !1, this.state = t, this.container = n, n ? (this.stage = new k.Stage({
754
996
  container: n,
755
997
  width: n.clientWidth,
756
998
  height: n.clientHeight,
@@ -758,9 +1000,9 @@ var F = "rgb(120, 72, 0)", Je = class {
758
1000
  }), n.style.backgroundColor = t.settings.backgroundColor, this.camera = new D(n.clientWidth, n.clientHeight)) : (this.stage = new k.Stage({
759
1001
  width: 1,
760
1002
  height: 1
761
- }), this.camera = new D(1, 1)), this.gridLayer = new k.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
1003
+ }), this.camera = new D(1, 1)), this.lodLayer = new k.Layer({ listening: !1 }), this.stage.add(this.lodLayer), this.gridLayer = new k.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
762
1004
  let r = new k.Layer({ listening: !1 });
763
- if (this.linkLayer = r, this.roomLayer = r, this.stage.add(r), this.positionLayer = new k.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new k.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new k.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Be(this.positionLayer), this.overlayLayerNode = new Be(this.overlayLayer), this.sceneNode = new ze(r, () => t.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(this.topLabelLayer), this.sceneManager = new Ie(this.camera, t.settings, t.mapReader), this.events = new p(n), this.culling = new ne(t.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), n) {
1005
+ if (this.linkLayer = r, this.roomLayer = r, this.stage.add(r), this.positionLayer = new k.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new k.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new k.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Ke(this.positionLayer), this.overlayLayerNode = new Ke(this.overlayLayer), this.sceneNode = new Ge(r, () => t.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(this.topLabelLayer), this.sceneManager = new He(this.camera, t.settings, t.mapReader), this.lodController = new at(this.lodLayer, this.camera, (e) => this.state.mapReader.getColorValue(e), () => this.state.settings.roomSize), this.events = new p(n), this.culling = new ne(t.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), n) {
764
1006
  this.origSetSize = this.camera.setSize.bind(this.camera);
765
1007
  let e = this.origSetSize;
766
1008
  this.camera.setSize = (t, n) => {
@@ -773,11 +1015,11 @@ var F = "rgb(120, 72, 0)", Je = class {
773
1015
  this.applyStyleTransforms(), this.subscribeToState(t);
774
1016
  }
775
1017
  setStyle(e) {
776
- this.currentStyle = e, this.sceneNode = new ze(this.linkLayer, () => this.state.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
1018
+ this.currentStyle = e, this.sceneNode = new Ge(this.linkLayer, () => this.state.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
777
1019
  }
778
1020
  applyStyleTransforms() {
779
1021
  let t = this.currentStyle, n = t.worldToScene ? (e, n) => t.worldToScene(e, n) : e, r = t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : e, i = this.coordinateInverse, a = t.sceneLayerOffset ? (e) => t.sceneLayerOffset(e) : void 0;
780
- this._coordinateTransform = n, this.coordinateInverse = r, this.coordinateLayerOffset = a, this.culling.setCoordinateTransform(n), this.gridCachedBounds = null, this.lastHitShapes.length > 0 && this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, n, a);
1022
+ this._coordinateTransform = n, this.coordinateInverse = r, this.coordinateLayerOffset = a, this.culling.setCoordinateTransform(n), this.gridCachedBounds = null, this.lastHitShapes.length > 0 && (this.hitTestBudgetExceeded() ? this.hitTester.clear() : this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, n, a));
781
1023
  let o = this.camera.getScale(), s = this.camera.width / 2, c = this.camera.height / 2, l = i((s - this.camera.position.x) / o, (c - this.camera.position.y) / o), u = n(l.x, l.y);
782
1024
  this.camera.position = {
783
1025
  x: s - u.x * o,
@@ -813,7 +1055,7 @@ var F = "rgb(120, 72, 0)", Je = class {
813
1055
  for (let e of this.sceneOverlays.values()) e.detach?.();
814
1056
  this.sceneOverlays.clear();
815
1057
  for (let e of this.sceneOverlayNodes.values()) for (let t of e) t.destroy();
816
- this.sceneOverlayNodes.clear(), this.viewportSubscribers.clear(), this.camera.cancelAnimation(), this.origSetSize && (this.camera.setSize = this.origSetSize), this.cameraChangeHandler &&= (this.camera.off("change", this.cameraChangeHandler), void 0), this.clearOverlayShapes(), this.clearCurrentRoomOverlay(), this.positionMarker &&= (this.positionMarker.destroy(), void 0), this.stage.destroy(), this.events.removeAllListeners();
1058
+ this.sceneOverlayNodes.clear(), this.viewportSubscribers.clear(), this.camera.cancelAnimation(), this.lodController.destroy(), this.origSetSize && (this.camera.setSize = this.origSetSize), this.cameraChangeHandler &&= (this.camera.off("change", this.cameraChangeHandler), void 0), this.clearOverlayShapes(), this.clearCurrentRoomOverlay(), this.positionMarker &&= (this.positionMarker.destroy(), void 0), this.stage.destroy(), this.events.removeAllListeners();
817
1059
  }
818
1060
  }
819
1061
  updateBackground() {
@@ -833,20 +1075,115 @@ var F = "rgb(120, 72, 0)", Je = class {
833
1075
  y: e
834
1076
  }), this.stage.position(this.camera.position), this.stage.batchDraw();
835
1077
  let t = this.camera.getViewportBounds();
836
- this.refreshGrid(t), this.culling.scheduleCulling(), this.events.emit("pan", t);
1078
+ this.refreshGrid(t), this.culling.scheduleCulling(), this.onCameraViewportChanged(t), this.events.emit("pan", t);
837
1079
  for (let e of this.viewportSubscribers) e();
838
1080
  for (let n of this.liveEffects.values()) n.updateViewport(t, e, this.coordinateTransform);
839
1081
  }
1082
+ onCameraViewportChanged(e) {
1083
+ let { currentAreaInstance: t, currentZIndex: n } = this.state;
1084
+ if (t && n !== void 0 && this.hasRealViewport()) {
1085
+ let t = this.state.settings.lodEnabled && this.computeLodMode() !== this.lodMode;
1086
+ if (!t && F(this.state.mapReader)) {
1087
+ let n = this.lastAppliedViewport, r = this.lastAppliedScale, i = this.camera.getScale();
1088
+ t = !n || r === null || e.minX < n.minX || e.maxX > n.maxX || e.minY < n.minY || e.maxY > n.maxY || i > r * 1.2 || i < r / 1.2;
1089
+ }
1090
+ t && this.scheduleRefresh();
1091
+ }
1092
+ this.lodController.onViewportChange();
1093
+ }
1094
+ scheduleRefresh() {
1095
+ if (this.refreshScheduled) return;
1096
+ this.refreshScheduled = !0;
1097
+ let e = () => {
1098
+ this.refreshScheduled = !1, this.destroyed || this.refresh();
1099
+ };
1100
+ typeof requestAnimationFrame < "u" ? requestAnimationFrame(e) : queueMicrotask(e);
1101
+ }
840
1102
  refresh() {
841
1103
  let { currentAreaInstance: e, currentZIndex: t, positionRoomId: n } = this.state;
842
1104
  if (!e || t === void 0) return;
843
1105
  let r = e.getPlane(t);
844
1106
  if (!r) {
845
- this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.sceneManager.reset(), this.hitTester.clear(), this.lastHitShapes = [], this.gridLayer.destroyChildren(), this.linkLayer.destroyChildren(), this.positionLayer.destroyChildren(), this.positionMarker = void 0, this.clearOverlayShapes(), this.currentRoomOverlay = [], this.stage.batchDraw();
1107
+ this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.sceneManager.reset(), this.hitTester.clear(), this.lastHitShapes = [], this.gridLayer.destroyChildren(), this.linkLayer.destroyChildren(), this.positionLayer.destroyChildren(), this.positionMarker = void 0, this.clearOverlayShapes(), this.currentRoomOverlay = [], this.lodController.clear(), this.lodMode = "vector", this.stage.batchDraw();
846
1108
  return;
847
1109
  }
848
- this.updateBackground(), this.buildScene(e, r, t), this.onSceneBuilt(), this.syncHighlights(), this.syncPaths(), n !== void 0 && this.onPositionChanged(n, !1, !1);
1110
+ this.updateBackground();
1111
+ let i = this.state.mapReader;
1112
+ if (F(i) && this.hasRealViewport()) {
1113
+ let e = this.padViewport(this.camera.getViewportBounds()), t = Be(e.minX, e.minY, e.maxX, e.maxY, this.coordinateInverse);
1114
+ i.setViewport(t), this.lastAppliedViewport = e, this.lastAppliedScale = this.camera.getScale();
1115
+ }
1116
+ let a = this.computeLodMode();
1117
+ if (this.lodMode = a, a === "raster") this.clearVectorScene(), this.lodController.setSource(this.rasterVisit(e, r, t));
1118
+ else {
1119
+ this.lodController.clear();
1120
+ let n = a === "roomsOnly" ? ct(e) : e;
1121
+ this.buildScene(n, r, t), this.onSceneBuilt();
1122
+ }
1123
+ this.syncHighlights(), this.syncPaths(), n !== void 0 && this.onPositionChanged(n, !1, !1);
849
1124
  for (let [e, t] of this.sceneOverlays) this.renderSceneOverlay(e, t);
1125
+ this.emitLodEvent(a, e, r, t);
1126
+ }
1127
+ hasRealViewport() {
1128
+ return this.camera.width > 1 || this.camera.height > 1;
1129
+ }
1130
+ padViewport(e) {
1131
+ let t = (e.maxX - e.minX) * lt + 1, n = (e.maxY - e.minY) * lt + 1;
1132
+ return {
1133
+ minX: e.minX - t,
1134
+ maxX: e.maxX + t,
1135
+ minY: e.minY - n,
1136
+ maxY: e.maxY + n
1137
+ };
1138
+ }
1139
+ planeRoomCount(e, t, n) {
1140
+ let r = this.state.mapReader;
1141
+ return F(r) ? r.getPlaneRoomCount(e.getAreaId(), n) : t.getRooms().length;
1142
+ }
1143
+ computeLodMode() {
1144
+ let e = this.state.settings;
1145
+ if (!e.lodEnabled || !this.hasRealViewport()) return "vector";
1146
+ let { currentAreaInstance: t, currentZIndex: n } = this.state;
1147
+ if (!t || n === void 0) return "vector";
1148
+ let r = t.getPlane(n);
1149
+ return r ? st({
1150
+ planeRoomCount: this.planeRoomCount(t, r, n),
1151
+ scale: this.camera.getScale(),
1152
+ stageWidth: this.camera.width,
1153
+ stageHeight: this.camera.height,
1154
+ roomBudget: e.lodRoomBudget / ut,
1155
+ exitBudget: e.lodExitBudget / ut
1156
+ }) : "vector";
1157
+ }
1158
+ rasterVisit(e, t, n) {
1159
+ let r = this.state.mapReader;
1160
+ if (F(r)) {
1161
+ let t = e.getAreaId();
1162
+ return (e, i) => r.forEachInBounds(t, n, e, i);
1163
+ }
1164
+ return (e, n) => {
1165
+ for (let r of t.getRooms()) r.x >= e.minX && r.x <= e.maxX && r.y >= e.minY && r.y <= e.maxY && n(r.x, r.y, r.env);
1166
+ };
1167
+ }
1168
+ clearVectorScene() {
1169
+ this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.sceneManager.reset(), this.hitTester.clear(), this.lastHitShapes = [], this.lastVisibleShapes = /* @__PURE__ */ new Set(), this.spilledRoomPositions = /* @__PURE__ */ new Map(), this.sceneNode.destroyChildren(), this.topLabelLayerNode.destroyChildren(), this.stage.batchDraw();
1170
+ }
1171
+ hitTestBudgetExceeded() {
1172
+ if (!this.state.settings.lodEnabled) return !1;
1173
+ let { currentAreaInstance: e, currentZIndex: t } = this.state;
1174
+ if (!e || t === void 0) return !1;
1175
+ let n = e.getPlane(t);
1176
+ return n ? n.getRooms().length > this.state.settings.lodHitTestBudget : !1;
1177
+ }
1178
+ emitLodEvent(e, t, n, r) {
1179
+ if (!this.state.settings.lodEnabled) return;
1180
+ let i = this.state.mapReader, a = this.planeRoomCount(t, n, r), o = this.lastAppliedViewport ?? this.camera.getViewportBounds(), s = F(i) ? i.estimateVisibleCount(t.getAreaId(), r, o) : a, c = e === "raster" ? !1 : !this.hitTestBudgetExceeded();
1181
+ this.events.emit("lod", {
1182
+ mode: e,
1183
+ planeRoomCount: a,
1184
+ visibleEstimate: s,
1185
+ hitTestActive: c
1186
+ });
850
1187
  }
851
1188
  addLiveEffect(e, t) {
852
1189
  this.removeLiveEffect(e), t.attach(this.overlayLayer), this.liveEffects.set(e, t), t.updateViewport(this.camera.getViewportBounds(), this.camera.getScale(), this.coordinateTransform);
@@ -957,7 +1294,7 @@ var F = "rgb(120, 72, 0)", Je = class {
957
1294
  layer: e.layer,
958
1295
  noScale: e.noScale
959
1296
  };
960
- let a = Ue(i);
1297
+ let a = Ye(i);
961
1298
  return t.addNode(a), a;
962
1299
  }
963
1300
  refreshGrid(e) {
@@ -979,7 +1316,7 @@ var F = "rgb(120, 72, 0)", Je = class {
979
1316
  }, this.gridLayerNode.batchDraw();
980
1317
  }
981
1318
  onSceneBuilt() {
982
- this.lastHitShapes = this.sceneManager.hitShapes, this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, this._coordinateTransform, this.coordinateLayerOffset);
1319
+ this.lastHitShapes = this.sceneManager.hitShapes, this.hitTestBudgetExceeded() ? this.hitTester.clear() : this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, this._coordinateTransform, this.coordinateLayerOffset);
983
1320
  let e = this.camera.getScale();
984
1321
  this.stage.scale({
985
1322
  x: e,
@@ -989,16 +1326,22 @@ var F = "rgb(120, 72, 0)", Je = class {
989
1326
  let n = this.sceneNode.getEntry(t);
990
1327
  n && this.shapeToDrawEntry.set(e, n);
991
1328
  }
992
- this.applyClipping(), this.stage.batchDraw();
1329
+ this.lastVisibleShapes = this.sceneManager.managedShapes(this._coordinateTransform), this.applyClipping(), this.stage.batchDraw();
993
1330
  }
994
1331
  applyClipping() {
995
1332
  if (!this.sceneManager.lastResult) return;
996
- let e = this.sceneManager.cullInteractive(this._coordinateTransform), t = !1;
997
- for (let [n, r] of this.shapeToDrawEntry) {
998
- let i = e.get(n) ?? !0;
999
- r.visible !== i && (r.visible = i, t = !0);
1333
+ let e = this.sceneManager.cullInteractive(this._coordinateTransform), t = this.lastVisibleShapes, n = !1;
1334
+ for (let r of t) {
1335
+ if (e.has(r)) continue;
1336
+ let t = this.shapeToDrawEntry.get(r);
1337
+ t && t.visible && (t.visible = !1, n = !0);
1000
1338
  }
1001
- t && this.sceneNode.batchDraw();
1339
+ for (let r of e) {
1340
+ if (t.has(r)) continue;
1341
+ let e = this.shapeToDrawEntry.get(r);
1342
+ e && !e.visible && (e.visible = !0, n = !0);
1343
+ }
1344
+ this.lastVisibleShapes = e, n && this.sceneNode.batchDraw();
1002
1345
  }
1003
1346
  onPositionChanged(e, t, n) {
1004
1347
  if (e === void 0) {
@@ -1031,6 +1374,10 @@ var F = "rgb(120, 72, 0)", Je = class {
1031
1374
  return;
1032
1375
  }
1033
1376
  let r = this.state.settings;
1377
+ if (this.lodMode === "raster") {
1378
+ this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
1379
+ return;
1380
+ }
1034
1381
  if (!r.highlightCurrentRoom) {
1035
1382
  this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
1036
1383
  return;
@@ -1041,14 +1388,14 @@ var F = "rgb(120, 72, 0)", Je = class {
1041
1388
  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) => {
1042
1389
  let t = this.state.mapReader.getRoom(e.a), n = this.state.mapReader.getRoom(e.b);
1043
1390
  if (!t || !n || (c.getExitTreatment ? c.getExitTreatment(e, t, n) : d(c, e, t, n)) !== "full") return;
1044
- let r = s.renderDataWithColor(e, F, this.state.currentZIndex);
1391
+ let r = s.renderDataWithColor(e, I, this.state.currentZIndex);
1045
1392
  if (r) {
1046
1393
  if (r.targetRoomId !== void 0 && this.spilledRoomPositions.has(r.targetRoomId)) return;
1047
1394
  o.push(this.sceneManager.buildExitShape(r));
1048
1395
  }
1049
1396
  });
1050
- for (let t of g(e, r, F)) o.push(h(t, e.id));
1051
- for (let t of i(e, r, F)) o.push(fe(t));
1397
+ for (let t of g(e, r, I)) o.push(h(t, e.id));
1398
+ for (let t of i(e, r, I)) o.push(fe(t));
1052
1399
  [...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
1053
1400
  let t = this.state.mapReader.getRoom(e);
1054
1401
  t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && c.isVisible(t) && a.set(e, t);
@@ -1057,7 +1404,7 @@ var F = "rgb(120, 72, 0)", Je = class {
1057
1404
  t && this.currentRoomOverlay.push(t);
1058
1405
  }), a.forEach((i, a) => {
1059
1406
  let o = a === e.id, s = de(i, this.state.mapReader, r, {
1060
- strokeOverride: o ? F : r.lineColor,
1407
+ strokeOverride: o ? I : r.lineColor,
1061
1408
  flatPipeline: !0,
1062
1409
  ...t(i, r.hiddenRooms)
1063
1410
  });
@@ -1114,7 +1461,7 @@ var F = "rgb(120, 72, 0)", Je = class {
1114
1461
  };
1115
1462
  //#endregion
1116
1463
  //#region src/style/shape/paintMap.ts
1117
- function I(e, t) {
1464
+ function L(e, t) {
1118
1465
  if (e !== void 0) return typeof e == "string" ? t(e) : {
1119
1466
  ...e,
1120
1467
  stops: e.stops.map((e) => ({
@@ -1123,7 +1470,7 @@ function I(e, t) {
1123
1470
  }))
1124
1471
  };
1125
1472
  }
1126
- function L(e) {
1473
+ function R(e) {
1127
1474
  let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
1128
1475
  return t ? {
1129
1476
  r: parseInt(t[1]),
@@ -1137,13 +1484,13 @@ function L(e) {
1137
1484
  a: 1
1138
1485
  } : null;
1139
1486
  }
1140
- function R(e, t, n, r = 1) {
1487
+ function z(e, t, n, r = 1) {
1141
1488
  return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
1142
1489
  }
1143
- function z(e) {
1490
+ function B(e) {
1144
1491
  return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
1145
1492
  }
1146
- function Ye(e, t, n) {
1493
+ function ft(e, t, n) {
1147
1494
  e /= 255, t /= 255, n /= 255;
1148
1495
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
1149
1496
  if (r === i) return [
@@ -1158,99 +1505,99 @@ function Ye(e, t, n) {
1158
1505
  a
1159
1506
  ];
1160
1507
  }
1161
- function Xe(e, t, n, r = 1) {
1508
+ function pt(e, t, n, r = 1) {
1162
1509
  e = (e % 360 + 360) % 360;
1163
1510
  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;
1164
- return 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), R(Math.round((s + o) * 255), Math.round((c + o) * 255), Math.round((l + o) * 255), r);
1511
+ return 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), z(Math.round((s + o) * 255), Math.round((c + o) * 255), Math.round((l + o) * 255), r);
1165
1512
  }
1166
1513
  //#endregion
1167
1514
  //#region src/style/shape/ParchmentStyle.ts
1168
- var Ze = "#4a3728", Qe = "#3b2a1a", $e = 139, et = 115, tt = 85, nt = 244, rt = 228, it = 193;
1169
- function at(e) {
1170
- let t = L(e);
1171
- if (!t) return R(nt, rt, it);
1172
- let n = z(t);
1173
- return R(Math.round($e + (nt - $e) * n), Math.round(et + (rt - et) * n), Math.round(tt + (it - tt) * n), t.a);
1515
+ var mt = "#4a3728", ht = "#3b2a1a", gt = 139, _t = 115, vt = 85, yt = 244, bt = 228, xt = 193;
1516
+ function St(e) {
1517
+ let t = R(e);
1518
+ if (!t) return z(yt, bt, xt);
1519
+ let n = B(t);
1520
+ return z(Math.round(gt + (yt - gt) * n), Math.round(_t + (bt - _t) * n), Math.round(vt + (xt - vt) * n), t.a);
1174
1521
  }
1175
- function ot(e) {
1176
- let t = L(e);
1177
- if (!t || t.a >= 1) return Ze;
1178
- let n = L(Ze);
1179
- return R(n.r, n.g, n.b, t.a);
1522
+ function Ct(e) {
1523
+ let t = R(e);
1524
+ if (!t || t.a >= 1) return mt;
1525
+ let n = R(mt);
1526
+ return z(n.r, n.g, n.b, t.a);
1180
1527
  }
1181
- function st(e) {
1528
+ function wt(e) {
1182
1529
  return {
1183
1530
  ...e,
1184
- fill: I(e.fill, at),
1185
- stroke: e.stroke ? ot(e.stroke) : e.stroke
1531
+ fill: L(e.fill, St),
1532
+ stroke: e.stroke ? Ct(e.stroke) : e.stroke
1186
1533
  };
1187
1534
  }
1188
- var ct = { transform(e) {
1535
+ var Tt = { transform(e) {
1189
1536
  switch (e.type) {
1190
1537
  case "rect":
1191
1538
  case "circle":
1192
1539
  case "polygon": return {
1193
1540
  ...e,
1194
- paint: st(e.paint)
1541
+ paint: wt(e.paint)
1195
1542
  };
1196
1543
  case "line": return {
1197
1544
  ...e,
1198
1545
  paint: e.paint.stroke ? {
1199
1546
  ...e.paint,
1200
- stroke: ot(e.paint.stroke)
1547
+ stroke: Ct(e.paint.stroke)
1201
1548
  } : e.paint
1202
1549
  };
1203
1550
  case "text": return {
1204
1551
  ...e,
1205
- fill: Qe
1552
+ fill: ht
1206
1553
  };
1207
1554
  case "image":
1208
1555
  case "group": return e;
1209
1556
  }
1210
- } }, lt = "#c0deff", ut = "#e0f0ff", dt = 20, ft = 40, pt = 80, mt = 60, ht = 100, gt = 160;
1211
- function _t(e) {
1212
- let t = L(e);
1213
- if (!t) return R(mt, ht, gt);
1214
- let n = z(t);
1215
- return R(Math.round(dt + (mt - dt) * n), Math.round(ft + (ht - ft) * n), Math.round(pt + (gt - pt) * n), t.a);
1557
+ } }, Et = "#c0deff", Dt = "#e0f0ff", Ot = 20, kt = 40, At = 80, jt = 60, Mt = 100, Nt = 160;
1558
+ function Pt(e) {
1559
+ let t = R(e);
1560
+ if (!t) return z(jt, Mt, Nt);
1561
+ let n = B(t);
1562
+ return z(Math.round(Ot + (jt - Ot) * n), Math.round(kt + (Mt - kt) * n), Math.round(At + (Nt - At) * n), t.a);
1216
1563
  }
1217
- function vt(e) {
1218
- let t = L(e);
1219
- if (!t || t.a >= 1) return lt;
1220
- let n = L(lt);
1221
- return R(n.r, n.g, n.b, t.a);
1564
+ function Ft(e) {
1565
+ let t = R(e);
1566
+ if (!t || t.a >= 1) return Et;
1567
+ let n = R(Et);
1568
+ return z(n.r, n.g, n.b, t.a);
1222
1569
  }
1223
- function yt(e) {
1570
+ function It(e) {
1224
1571
  return {
1225
1572
  ...e,
1226
- fill: I(e.fill, _t),
1227
- stroke: e.stroke ? vt(e.stroke) : e.stroke
1573
+ fill: L(e.fill, Pt),
1574
+ stroke: e.stroke ? Ft(e.stroke) : e.stroke
1228
1575
  };
1229
1576
  }
1230
- var bt = { transform(e) {
1577
+ var Lt = { transform(e) {
1231
1578
  switch (e.type) {
1232
1579
  case "rect":
1233
1580
  case "circle":
1234
1581
  case "polygon": return {
1235
1582
  ...e,
1236
- paint: yt(e.paint)
1583
+ paint: It(e.paint)
1237
1584
  };
1238
1585
  case "line": return {
1239
1586
  ...e,
1240
1587
  paint: e.paint.stroke ? {
1241
1588
  ...e.paint,
1242
- stroke: vt(e.paint.stroke)
1589
+ stroke: Ft(e.paint.stroke)
1243
1590
  } : e.paint
1244
1591
  };
1245
1592
  case "text": return {
1246
1593
  ...e,
1247
- fill: ut
1594
+ fill: Dt
1248
1595
  };
1249
1596
  case "image":
1250
1597
  case "group": return e;
1251
1598
  }
1252
- } }, xt = "#00ffd0", St = .3, Ct = 3;
1253
- function wt(e, t, n) {
1599
+ } }, Rt = "#00ffd0", zt = .3, Bt = 3;
1600
+ function Vt(e, t, n) {
1254
1601
  e /= 255, t /= 255, n /= 255;
1255
1602
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
1256
1603
  if (r === i) return [
@@ -1265,68 +1612,68 @@ function wt(e, t, n) {
1265
1612
  a
1266
1613
  ];
1267
1614
  }
1268
- function Tt(e, t, n, r = 1) {
1615
+ function Ht(e, t, n, r = 1) {
1269
1616
  e = (e % 360 + 360) % 360;
1270
1617
  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;
1271
1618
  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);
1272
1619
  let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
1273
1620
  return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
1274
1621
  }
1275
- function Et(e) {
1276
- let t = L(e);
1622
+ function Ut(e) {
1623
+ let t = R(e);
1277
1624
  if (!t) return {
1278
1625
  h: 150,
1279
1626
  a: 1
1280
1627
  };
1281
- let [n] = wt(t.r, t.g, t.b);
1628
+ let [n] = Vt(t.r, t.g, t.b);
1282
1629
  return {
1283
1630
  h: n,
1284
1631
  a: t.a
1285
1632
  };
1286
1633
  }
1287
- function Dt(e) {
1288
- let { h: t, a: n } = Et(e);
1289
- return Tt(t, .95, .65, n);
1634
+ function Wt(e) {
1635
+ let { h: t, a: n } = Ut(e);
1636
+ return Ht(t, .95, .65, n);
1290
1637
  }
1291
- function Ot(e) {
1292
- let t = L(e);
1638
+ function Gt(e) {
1639
+ let t = R(e);
1293
1640
  if (!t) return "rgb(8, 12, 10)";
1294
- let [n] = wt(t.r, t.g, t.b);
1295
- return Tt(n, .4, .1, t.a);
1641
+ let [n] = Vt(t.r, t.g, t.b);
1642
+ return Ht(n, .4, .1, t.a);
1296
1643
  }
1297
- function kt(e) {
1298
- let { h: t, a: n } = Et(e);
1299
- return Tt(t, .95, .65, Math.min(n, St));
1644
+ function Kt(e) {
1645
+ let { h: t, a: n } = Ut(e);
1646
+ return Ht(t, .95, .65, Math.min(n, zt));
1300
1647
  }
1301
- function At(e) {
1648
+ function qt(e) {
1302
1649
  return {
1303
1650
  ...e,
1304
- fill: I(e.fill, Ot),
1305
- stroke: e.stroke ? Dt(e.stroke) : e.stroke
1651
+ fill: L(e.fill, Gt),
1652
+ stroke: e.stroke ? Wt(e.stroke) : e.stroke
1306
1653
  };
1307
1654
  }
1308
- function jt(e, t = !1) {
1655
+ function Jt(e, t = !1) {
1309
1656
  if (!e.stroke) return e;
1310
- let n = (e.strokeWidth ?? 1) * Ct;
1657
+ let n = (e.strokeWidth ?? 1) * Bt;
1311
1658
  return {
1312
- stroke: kt(e.stroke),
1659
+ stroke: Kt(e.stroke),
1313
1660
  strokeWidth: n,
1314
1661
  dash: e.dash,
1315
1662
  dashEnabled: e.dashEnabled,
1316
- alpha: t ? St : e.alpha
1663
+ alpha: t ? zt : e.alpha
1317
1664
  };
1318
1665
  }
1319
- var Mt = { transform(e) {
1666
+ var Yt = { transform(e) {
1320
1667
  switch (e.type) {
1321
1668
  case "rect": {
1322
1669
  let t = {
1323
1670
  ...e,
1324
- paint: At(e.paint)
1671
+ paint: qt(e.paint)
1325
1672
  };
1326
1673
  return e.paint.stroke ? [{
1327
1674
  ...e,
1328
1675
  paint: {
1329
- ...jt(e.paint),
1676
+ ...Jt(e.paint),
1330
1677
  fill: void 0
1331
1678
  }
1332
1679
  }, t] : t;
@@ -1334,12 +1681,12 @@ var Mt = { transform(e) {
1334
1681
  case "circle": {
1335
1682
  let t = {
1336
1683
  ...e,
1337
- paint: At(e.paint)
1684
+ paint: qt(e.paint)
1338
1685
  };
1339
1686
  return e.paint.stroke ? [{
1340
1687
  ...e,
1341
1688
  paint: {
1342
- ...jt(e.paint),
1689
+ ...Jt(e.paint),
1343
1690
  fill: void 0
1344
1691
  }
1345
1692
  }, t] : t;
@@ -1349,21 +1696,21 @@ var Mt = { transform(e) {
1349
1696
  ...e,
1350
1697
  paint: e.paint.stroke ? {
1351
1698
  ...e.paint,
1352
- stroke: Dt(e.paint.stroke)
1699
+ stroke: Wt(e.paint.stroke)
1353
1700
  } : e.paint
1354
1701
  };
1355
1702
  return e.paint.stroke ? [{
1356
1703
  ...e,
1357
- paint: jt(e.paint, !0)
1704
+ paint: Jt(e.paint, !0)
1358
1705
  }, t] : t;
1359
1706
  }
1360
1707
  case "polygon": return {
1361
1708
  ...e,
1362
- paint: At(e.paint)
1709
+ paint: qt(e.paint)
1363
1710
  };
1364
1711
  case "text": return {
1365
1712
  ...e,
1366
- fill: xt
1713
+ fill: Rt
1367
1714
  };
1368
1715
  case "image":
1369
1716
  case "group": return e;
@@ -1371,16 +1718,16 @@ var Mt = { transform(e) {
1371
1718
  } };
1372
1719
  //#endregion
1373
1720
  //#region src/style/shape/wobble.ts
1374
- function B(e) {
1721
+ function V(e) {
1375
1722
  let t = e | 0 || 1;
1376
1723
  return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
1377
1724
  }
1378
- function V(...e) {
1725
+ function H(...e) {
1379
1726
  let t = 2654435769;
1380
1727
  for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
1381
1728
  return t;
1382
1729
  }
1383
- function H(e, t, n, r, i, a) {
1730
+ function Xt(e, t, n, r, i, a) {
1384
1731
  let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
1385
1732
  if (c < .001) return [
1386
1733
  e,
@@ -1395,11 +1742,11 @@ function H(e, t, n, r, i, a) {
1395
1742
  }
1396
1743
  return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
1397
1744
  }
1398
- function Nt(e, t, n) {
1745
+ function Zt(e, t, n) {
1399
1746
  if (e.length < 4) return e;
1400
1747
  let r = [];
1401
1748
  for (let i = 0; i < e.length - 2; i += 2) {
1402
- let a = H(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
1749
+ let a = Xt(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
1403
1750
  if (i === 0) r.push(...a);
1404
1751
  else for (let e = 2; e < a.length; e++) r.push(a[e]);
1405
1752
  }
@@ -1417,12 +1764,12 @@ function U(e, t, n, r, i, a) {
1417
1764
  t + r
1418
1765
  ], s = [];
1419
1766
  for (let e = 0; e < 4; e++) {
1420
- let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = H(t, n, c, l, i, a);
1767
+ let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = Xt(t, n, c, l, i, a);
1421
1768
  for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
1422
1769
  }
1423
1770
  return s;
1424
1771
  }
1425
- function Pt(e, t, n, r, i) {
1772
+ function Qt(e, t, n, r, i) {
1426
1773
  let a = [];
1427
1774
  for (let o = 0; o < 24; o++) {
1428
1775
  let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
@@ -1430,31 +1777,31 @@ function Pt(e, t, n, r, i) {
1430
1777
  }
1431
1778
  return a;
1432
1779
  }
1433
- function Ft(e, t, n) {
1780
+ function $t(e, t, n) {
1434
1781
  let r = e.length / 2;
1435
1782
  if (r < 2) return e;
1436
1783
  let i = [];
1437
1784
  for (let a = 0; a < r; a++) {
1438
- let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = H(o, s, l, u, t, n);
1785
+ let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = Xt(o, s, l, u, t, n);
1439
1786
  for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
1440
1787
  }
1441
1788
  return i;
1442
1789
  }
1443
1790
  //#endregion
1444
1791
  //#region src/style/shape/SketchyStyle.ts
1445
- function It(e, t) {
1792
+ function en(e, t) {
1446
1793
  if (!t) return e;
1447
1794
  let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
1448
1795
  if (!n) return e;
1449
1796
  let r = parseFloat(n[1]);
1450
1797
  return r >= 1 ? e : `rgba(${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}, ${r})`;
1451
1798
  }
1452
- function Lt(e) {
1799
+ function tn(e) {
1453
1800
  let { jitter: t, color: n } = e;
1454
1801
  return { transform(e) {
1455
1802
  switch (e.type) {
1456
1803
  case "rect": {
1457
- let r = B(V(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
1804
+ let r = V(H(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
1458
1805
  if (e.cornerRadius && e.cornerRadius > 0) {
1459
1806
  let n = [];
1460
1807
  if (i && n.push({
@@ -1494,10 +1841,10 @@ function Lt(e) {
1494
1841
  };
1495
1842
  }
1496
1843
  case "circle": {
1497
- let r = B(V(e.cx, e.cy, e.radius));
1844
+ let r = V(H(e.cx, e.cy, e.radius));
1498
1845
  return {
1499
1846
  type: "polygon",
1500
- vertices: Pt(e.cx, e.cy, e.radius, t, r),
1847
+ vertices: Qt(e.cx, e.cy, e.radius, t, r),
1501
1848
  paint: {
1502
1849
  fill: e.paint.fill ? "#ffffff" : void 0,
1503
1850
  stroke: e.paint.stroke ? n : void 0,
@@ -1509,7 +1856,7 @@ function Lt(e) {
1509
1856
  };
1510
1857
  }
1511
1858
  case "line": {
1512
- let r = B(V(...e.points.slice(0, 4))), i = Nt(e.points, t, r), a = It(n, e.paint.stroke), o = {
1859
+ let r = V(H(...e.points.slice(0, 4))), i = Zt(e.points, t, r), a = en(n, e.paint.stroke), o = {
1513
1860
  ...e.paint,
1514
1861
  stroke: a
1515
1862
  };
@@ -1520,7 +1867,7 @@ function Lt(e) {
1520
1867
  };
1521
1868
  }
1522
1869
  case "polygon": {
1523
- let r = B(V(...e.vertices.slice(0, 4))), i = Ft(e.vertices, t, r);
1870
+ let r = V(H(...e.vertices.slice(0, 4))), i = $t(e.vertices, t, r);
1524
1871
  return {
1525
1872
  ...e,
1526
1873
  vertices: i,
@@ -1543,7 +1890,7 @@ function Lt(e) {
1543
1890
  //#endregion
1544
1891
  //#region src/style/shape/IsometricStyle.ts
1545
1892
  function W(e, t) {
1546
- return I(e, (e) => _(e, t));
1893
+ return L(e, (e) => _(e, t));
1547
1894
  }
1548
1895
  function G(e, t) {
1549
1896
  if (!t || typeof t == "string") return t;
@@ -1568,16 +1915,16 @@ function G(e, t) {
1568
1915
  }
1569
1916
  return i;
1570
1917
  }
1571
- function Rt(e) {
1918
+ function nn(e) {
1572
1919
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
1573
1920
  return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
1574
1921
  }
1575
- function zt(e) {
1922
+ function rn(e) {
1576
1923
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
1577
1924
  return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
1578
1925
  }
1579
1926
  var K = 32;
1580
- function Bt(e, t) {
1927
+ function an(e, t) {
1581
1928
  let n = Array(t.length);
1582
1929
  for (let r = 0; r < t.length; r += 2) {
1583
1930
  let [i, a] = e(t[r], t[r + 1]);
@@ -1585,7 +1932,7 @@ function Bt(e, t) {
1585
1932
  }
1586
1933
  return n;
1587
1934
  }
1588
- function Vt(e, t, n, r, i) {
1935
+ function on(e, t, n, r, i) {
1589
1936
  let [a, o] = e(t, n), [s, c] = e(t + r, n), [l, u] = e(t + r, n + i), [d, f] = e(t, n + i);
1590
1937
  return [
1591
1938
  a,
@@ -1598,8 +1945,8 @@ function Vt(e, t, n, r, i) {
1598
1945
  f
1599
1946
  ];
1600
1947
  }
1601
- function Ht(e = {}) {
1602
- let t = e.rotation ?? 0, n = e.depth ?? .18, r = Rt(t), i = zt(t);
1948
+ function sn(e = {}) {
1949
+ let t = e.rotation ?? 0, n = e.depth ?? .18, r = nn(t), i = rn(t);
1603
1950
  function a(e, t, n, i) {
1604
1951
  let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
1605
1952
  return [
@@ -1612,7 +1959,7 @@ function Ht(e = {}) {
1612
1959
  ];
1613
1960
  }
1614
1961
  function o(e) {
1615
- let { x: t, y: i, width: a, height: o, paint: s } = e, c = Vt(r, t, i, a, o);
1962
+ let { x: t, y: i, width: a, height: o, paint: s } = e, c = on(r, t, i, a, o);
1616
1963
  if (s.dash || s.dashEnabled) {
1617
1964
  let t = [];
1618
1965
  for (let n = 0; n < 8; n += 2) {
@@ -1811,11 +2158,11 @@ function Ht(e = {}) {
1811
2158
  case "circle": return s(e);
1812
2159
  case "line": return {
1813
2160
  ...e,
1814
- points: Bt(r, e.points)
2161
+ points: an(r, e.points)
1815
2162
  };
1816
2163
  case "polygon": return {
1817
2164
  ...e,
1818
- vertices: Bt(r, e.vertices),
2165
+ vertices: an(r, e.vertices),
1819
2166
  paint: {
1820
2167
  ...e.paint,
1821
2168
  fill: G(r, e.paint.fill)
@@ -1883,21 +2230,21 @@ function Ht(e = {}) {
1883
2230
  }
1884
2231
  //#endregion
1885
2232
  //#region src/style/shape/ConstructionStyle.ts
1886
- var q = "#1a1a1a", Ut = "#ffc200", Wt = "#ff6600", Gt = 26, Kt = 26, qt = 26, Jt = 255, Yt = 194, Xt = 0;
1887
- function Zt(e) {
1888
- let t = L(e);
1889
- if (!t) return R(Jt, Yt, Xt);
1890
- let n = z(t);
1891
- return R(Math.round(Gt + (Jt - Gt) * n), Math.round(Kt + (Yt - Kt) * n), Math.round(qt + (Xt - qt) * n), t.a);
1892
- }
1893
- function Qt(e) {
2233
+ var q = "#1a1a1a", cn = "#ffc200", ln = "#ff6600", un = 26, dn = 26, fn = 26, pn = 255, mn = 194, hn = 0;
2234
+ function gn(e) {
2235
+ let t = R(e);
2236
+ if (!t) return z(pn, mn, hn);
2237
+ let n = B(t);
2238
+ return z(Math.round(un + (pn - un) * n), Math.round(dn + (mn - dn) * n), Math.round(fn + (hn - fn) * n), t.a);
2239
+ }
2240
+ function _n(e) {
1894
2241
  return {
1895
2242
  ...e,
1896
- fill: I(e.fill, Zt),
2243
+ fill: L(e.fill, gn),
1897
2244
  stroke: e.stroke ? q : e.stroke
1898
2245
  };
1899
2246
  }
1900
- function $t(e, t, n, r) {
2247
+ function vn(e, t, n, r) {
1901
2248
  let i = [], a = e.length;
1902
2249
  for (let o = 0; o < a; o++) {
1903
2250
  let s = e[o], c = e[(o + 1) % a], l = t * s[0] + n * s[1] - r, u = t * c[0] + n * c[1] - r;
@@ -1908,7 +2255,7 @@ function $t(e, t, n, r) {
1908
2255
  }
1909
2256
  return i;
1910
2257
  }
1911
- function en(e, t, n, r, i) {
2258
+ function yn(e, t, n, r, i) {
1912
2259
  let a = [
1913
2260
  [e, t],
1914
2261
  [e + n, t],
@@ -1916,17 +2263,17 @@ function en(e, t, n, r, i) {
1916
2263
  [e, t + r]
1917
2264
  ], o = i * .4, s = o * .35, c = e + t, l = e + n + t + r, u = Math.floor(c / o) - 1, d = Math.ceil(l / o) + 1, f = [];
1918
2265
  for (let e = u; e <= d; e++) {
1919
- let t = e * o, n = t + s, r = $t(a, 1, 1, t);
1920
- r = $t(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
2266
+ let t = e * o, n = t + s, r = vn(a, 1, 1, t);
2267
+ r = vn(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
1921
2268
  }
1922
2269
  return f;
1923
2270
  }
1924
- var tn = { transform(e, t) {
2271
+ var bn = { transform(e, t) {
1925
2272
  switch (e.type) {
1926
2273
  case "rect": {
1927
2274
  if (!e.paint.fill) return {
1928
2275
  ...e,
1929
- paint: Qt(e.paint)
2276
+ paint: _n(e.paint)
1930
2277
  };
1931
2278
  let n = {
1932
2279
  ...e,
@@ -1934,12 +2281,12 @@ var tn = { transform(e, t) {
1934
2281
  fill: q,
1935
2282
  strokeWidth: e.paint.strokeWidth
1936
2283
  }
1937
- }, r = en(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
2284
+ }, r = yn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
1938
2285
  type: "polygon",
1939
2286
  vertices: t,
1940
2287
  layer: e.layer,
1941
2288
  paint: {
1942
- fill: Ut,
2289
+ fill: cn,
1943
2290
  alpha: .65
1944
2291
  }
1945
2292
  })), i = {
@@ -1958,13 +2305,13 @@ var tn = { transform(e, t) {
1958
2305
  }
1959
2306
  case "circle": return {
1960
2307
  ...e,
1961
- paint: Qt(e.paint)
2308
+ paint: _n(e.paint)
1962
2309
  };
1963
2310
  case "polygon": return {
1964
2311
  ...e,
1965
2312
  paint: {
1966
2313
  ...e.paint,
1967
- fill: e.paint.fill ? Wt : e.paint.fill,
2314
+ fill: e.paint.fill ? ln : e.paint.fill,
1968
2315
  stroke: e.paint.stroke ? q : e.paint.stroke
1969
2316
  }
1970
2317
  };
@@ -1972,24 +2319,24 @@ var tn = { transform(e, t) {
1972
2319
  ...e,
1973
2320
  paint: e.paint.stroke ? {
1974
2321
  ...e.paint,
1975
- stroke: Wt
2322
+ stroke: ln
1976
2323
  } : e.paint
1977
2324
  };
1978
2325
  case "text": return {
1979
2326
  ...e,
1980
- fill: Wt,
2327
+ fill: ln,
1981
2328
  stroke: q,
1982
2329
  strokeWidth: t.roomSize * .25
1983
2330
  };
1984
2331
  case "image":
1985
2332
  case "group": return e;
1986
2333
  }
1987
- } }, nn = "#c8eeff", rn = "#00c8ff", an = "#00ffaa", on = .2, sn = 5, cn = 190;
1988
- function ln(e, t, n) {
2334
+ } }, xn = "#c8eeff", Sn = "#00c8ff", Cn = "#00ffaa", wn = .2, Tn = 5, En = 190;
2335
+ function Dn(e, t, n) {
1989
2336
  e /= 255, t /= 255, n /= 255;
1990
2337
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
1991
2338
  if (r === i) return [
1992
- cn,
2339
+ En,
1993
2340
  0,
1994
2341
  a
1995
2342
  ];
@@ -2000,54 +2347,54 @@ function ln(e, t, n) {
2000
2347
  a
2001
2348
  ];
2002
2349
  }
2003
- function un(e, t, n, r = 1) {
2350
+ function On(e, t, n, r = 1) {
2004
2351
  e = (e % 360 + 360) % 360;
2005
2352
  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;
2006
2353
  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);
2007
2354
  let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
2008
2355
  return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
2009
2356
  }
2010
- function dn(e) {
2011
- let t = L(e);
2012
- if (!t) return un(cn, .55, .18);
2013
- let [n, r] = ln(t.r, t.g, t.b);
2014
- return un(r < .08 ? cn : n, .55, .18, t.a);
2357
+ function kn(e) {
2358
+ let t = R(e);
2359
+ if (!t) return On(En, .55, .18);
2360
+ let [n, r] = Dn(t.r, t.g, t.b);
2361
+ return On(r < .08 ? En : n, .55, .18, t.a);
2015
2362
  }
2016
- function fn(e) {
2363
+ function An(e) {
2017
2364
  return {
2018
2365
  ...e,
2019
- fill: I(e.fill, dn),
2020
- stroke: e.stroke ? rn : e.stroke
2366
+ fill: L(e.fill, kn),
2367
+ stroke: e.stroke ? Sn : e.stroke
2021
2368
  };
2022
2369
  }
2023
- function pn(e) {
2370
+ function jn(e) {
2024
2371
  return {
2025
- stroke: rn,
2026
- strokeWidth: (e.strokeWidth ?? 1) * sn,
2027
- alpha: on
2372
+ stroke: Sn,
2373
+ strokeWidth: (e.strokeWidth ?? 1) * Tn,
2374
+ alpha: wn
2028
2375
  };
2029
2376
  }
2030
- function mn(e) {
2377
+ function Mn(e) {
2031
2378
  return {
2032
- stroke: an,
2033
- strokeWidth: (e.strokeWidth ?? 1) * sn,
2034
- alpha: on,
2379
+ stroke: Cn,
2380
+ strokeWidth: (e.strokeWidth ?? 1) * Tn,
2381
+ alpha: wn,
2035
2382
  dash: e.dash,
2036
2383
  dashEnabled: e.dashEnabled
2037
2384
  };
2038
2385
  }
2039
- var hn = { transform(e) {
2386
+ var Nn = { transform(e) {
2040
2387
  switch (e.type) {
2041
2388
  case "rect": {
2042
2389
  let t = {
2043
2390
  ...e,
2044
- paint: fn(e.paint)
2391
+ paint: An(e.paint)
2045
2392
  };
2046
2393
  return e.paint.stroke ? [{
2047
2394
  ...e,
2048
2395
  hit: void 0,
2049
2396
  paint: {
2050
- ...pn(e.paint),
2397
+ ...jn(e.paint),
2051
2398
  fill: void 0
2052
2399
  }
2053
2400
  }, t] : t;
@@ -2055,13 +2402,13 @@ var hn = { transform(e) {
2055
2402
  case "circle": {
2056
2403
  let t = {
2057
2404
  ...e,
2058
- paint: fn(e.paint)
2405
+ paint: An(e.paint)
2059
2406
  };
2060
2407
  return e.paint.stroke ? [{
2061
2408
  ...e,
2062
2409
  hit: void 0,
2063
2410
  paint: {
2064
- ...pn(e.paint),
2411
+ ...jn(e.paint),
2065
2412
  fill: void 0
2066
2413
  }
2067
2414
  }, t] : t;
@@ -2078,36 +2425,36 @@ var hn = { transform(e) {
2078
2425
  ...e,
2079
2426
  paint: e.paint.stroke ? {
2080
2427
  ...e.paint,
2081
- stroke: an
2428
+ stroke: Cn
2082
2429
  } : e.paint
2083
2430
  };
2084
2431
  return e.paint.stroke ? [{
2085
2432
  ...e,
2086
2433
  hit: void 0,
2087
- paint: mn(e.paint)
2434
+ paint: Mn(e.paint)
2088
2435
  }, t] : t;
2089
2436
  }
2090
2437
  case "polygon": return {
2091
2438
  ...e,
2092
2439
  paint: {
2093
2440
  ...e.paint,
2094
- fill: e.paint.fill ? an : e.paint.fill,
2441
+ fill: e.paint.fill ? Cn : e.paint.fill,
2095
2442
  stroke: void 0
2096
2443
  }
2097
2444
  };
2098
2445
  case "text": return {
2099
2446
  ...e,
2100
- fill: nn
2447
+ fill: xn
2101
2448
  };
2102
2449
  case "image":
2103
2450
  case "group": return e;
2104
2451
  }
2105
- } }, gn = {
2452
+ } }, Pn = {
2106
2453
  lighten: .35,
2107
2454
  darken: .25
2108
2455
  };
2109
- function _n(e = {}) {
2110
- let t = e.lighten ?? gn.lighten, n = e.darken ?? gn.darken;
2456
+ function Fn(e = {}) {
2457
+ let t = e.lighten ?? Pn.lighten, n = e.darken ?? Pn.darken;
2111
2458
  function r(e, r, i, a, s) {
2112
2459
  let c = e.fill;
2113
2460
  if (typeof c != "string") return e;
@@ -2158,124 +2505,124 @@ function _n(e = {}) {
2158
2505
  }
2159
2506
  //#endregion
2160
2507
  //#region src/style/shape/StainedGlassStyle.ts
2161
- var vn = "#0a0a0a", yn = "#f4f0e0", bn = .6, xn = .4, Sn = .62, Cn = 2.2, wn = .06;
2162
- function Tn(e) {
2163
- let t = L(e);
2508
+ var In = "#0a0a0a", Ln = "#f4f0e0", Rn = .6, zn = .4, Bn = .62, Vn = 2.2, Hn = .06;
2509
+ function Un(e) {
2510
+ let t = R(e);
2164
2511
  if (!t) return e;
2165
- let [n, r, i] = Ye(t.r, t.g, t.b);
2166
- return Xe(n, r < .08 ? r : Math.max(r, bn), Math.min(Sn, Math.max(xn, i)), t.a);
2512
+ let [n, r, i] = ft(t.r, t.g, t.b);
2513
+ return pt(n, r < .08 ? r : Math.max(r, Rn), Math.min(Bn, Math.max(zn, i)), t.a);
2167
2514
  }
2168
- function En(e) {
2169
- return Math.max((e ?? .04) * Cn, wn);
2515
+ function Wn(e) {
2516
+ return Math.max((e ?? .04) * Vn, Hn);
2170
2517
  }
2171
- function Dn(e) {
2172
- let t = I(e.fill, Tn), n = t !== void 0 || e.stroke !== void 0;
2518
+ function Gn(e) {
2519
+ let t = L(e.fill, Un), n = t !== void 0 || e.stroke !== void 0;
2173
2520
  return {
2174
2521
  ...e,
2175
2522
  fill: t,
2176
- stroke: n ? vn : void 0,
2177
- strokeWidth: n ? En(e.strokeWidth) : e.strokeWidth,
2523
+ stroke: n ? In : void 0,
2524
+ strokeWidth: n ? Wn(e.strokeWidth) : e.strokeWidth,
2178
2525
  dash: void 0,
2179
2526
  dashEnabled: void 0
2180
2527
  };
2181
2528
  }
2182
- var On = { transform(e) {
2529
+ var Kn = { transform(e) {
2183
2530
  switch (e.type) {
2184
2531
  case "rect":
2185
2532
  case "circle":
2186
2533
  case "polygon": return {
2187
2534
  ...e,
2188
- paint: Dn(e.paint)
2535
+ paint: Gn(e.paint)
2189
2536
  };
2190
2537
  case "line": return {
2191
2538
  ...e,
2192
2539
  paint: e.paint.stroke ? {
2193
2540
  ...e.paint,
2194
- stroke: vn,
2195
- strokeWidth: En(e.paint.strokeWidth)
2541
+ stroke: In,
2542
+ strokeWidth: Wn(e.paint.strokeWidth)
2196
2543
  } : e.paint
2197
2544
  };
2198
2545
  case "text": return {
2199
2546
  ...e,
2200
- fill: yn
2547
+ fill: Ln
2201
2548
  };
2202
2549
  case "image":
2203
2550
  case "group": return e;
2204
2551
  }
2205
- } }, kn = "#1c3f6e", An = 1.4, jn = .05, Mn = 198, Nn = 212, Pn = 230, Fn = 248, In = 250, Ln = 255;
2206
- function Rn(e) {
2207
- let t = L(e);
2208
- if (!t) return R(Fn, In, Ln);
2209
- let n = z(t);
2210
- return R(Math.round(Mn + (Fn - Mn) * n), Math.round(Nn + (In - Nn) * n), Math.round(Pn + (Ln - Pn) * n), t.a);
2552
+ } }, qn = "#1c3f6e", Jn = 1.4, Yn = .05, Xn = 198, Zn = 212, Qn = 230, $n = 248, er = 250, tr = 255;
2553
+ function nr(e) {
2554
+ let t = R(e);
2555
+ if (!t) return z($n, er, tr);
2556
+ let n = B(t);
2557
+ return z(Math.round(Xn + ($n - Xn) * n), Math.round(Zn + (er - Zn) * n), Math.round(Qn + (tr - Qn) * n), t.a);
2211
2558
  }
2212
- function zn(e) {
2213
- let t = L(e);
2214
- if (!t || t.a >= 1) return kn;
2215
- let n = L(kn);
2216
- return R(n.r, n.g, n.b, t.a);
2559
+ function rr(e) {
2560
+ let t = R(e);
2561
+ if (!t || t.a >= 1) return qn;
2562
+ let n = R(qn);
2563
+ return z(n.r, n.g, n.b, t.a);
2217
2564
  }
2218
- function Bn(e) {
2219
- return Math.max((e ?? .04) * An, jn);
2565
+ function ir(e) {
2566
+ return Math.max((e ?? .04) * Jn, Yn);
2220
2567
  }
2221
- function Vn(e) {
2568
+ function ar(e) {
2222
2569
  return {
2223
2570
  ...e,
2224
- fill: I(e.fill, Rn),
2225
- stroke: e.stroke ? zn(e.stroke) : e.stroke,
2226
- strokeWidth: e.stroke ? Bn(e.strokeWidth) : e.strokeWidth
2571
+ fill: L(e.fill, nr),
2572
+ stroke: e.stroke ? rr(e.stroke) : e.stroke,
2573
+ strokeWidth: e.stroke ? ir(e.strokeWidth) : e.strokeWidth
2227
2574
  };
2228
2575
  }
2229
- var Hn = { transform(e) {
2576
+ var or = { transform(e) {
2230
2577
  switch (e.type) {
2231
2578
  case "rect":
2232
2579
  case "circle":
2233
2580
  case "polygon": return {
2234
2581
  ...e,
2235
- paint: Vn(e.paint)
2582
+ paint: ar(e.paint)
2236
2583
  };
2237
2584
  case "line": return e.paint.stroke ? {
2238
2585
  ...e,
2239
2586
  paint: {
2240
2587
  ...e.paint,
2241
- stroke: zn(e.paint.stroke),
2242
- strokeWidth: e.grid ? e.paint.strokeWidth : Bn(e.paint.strokeWidth)
2588
+ stroke: rr(e.paint.stroke),
2589
+ strokeWidth: e.grid ? e.paint.strokeWidth : ir(e.paint.strokeWidth)
2243
2590
  }
2244
2591
  } : e;
2245
2592
  case "text": return {
2246
2593
  ...e,
2247
- fill: kn
2594
+ fill: qn
2248
2595
  };
2249
2596
  case "image":
2250
2597
  case "group": return e;
2251
2598
  }
2252
- } }, Un = "#7a6a48", Wn = "#8a7a55", Gn = "#4a3f28", Kn = 78, qn = 93, Jn = 52, Yn = 221, Xn = 207, Zn = 166, Qn = 2, $n = .26, er = .02;
2253
- function tr(e) {
2254
- let t = L(e);
2255
- if (!t) return R(Yn, Xn, Zn);
2256
- let n = z(t);
2257
- return R(Math.round(Kn + (Yn - Kn) * n), Math.round(qn + (Xn - qn) * n), Math.round(Jn + (Zn - Jn) * n), t.a);
2599
+ } }, sr = "#7a6a48", cr = "#8a7a55", lr = "#4a3f28", ur = 78, dr = 93, fr = 52, pr = 221, mr = 207, hr = 166, gr = 2, _r = .26, vr = .02;
2600
+ function yr(e) {
2601
+ let t = R(e);
2602
+ if (!t) return z(pr, mr, hr);
2603
+ let n = B(t);
2604
+ return z(Math.round(ur + (pr - ur) * n), Math.round(dr + (mr - dr) * n), Math.round(fr + (hr - fr) * n), t.a);
2258
2605
  }
2259
- function nr(e) {
2606
+ function br(e) {
2260
2607
  return {
2261
2608
  ...e,
2262
- fill: I(e.fill, tr),
2263
- stroke: e.stroke ? Un : e.stroke
2609
+ fill: L(e.fill, yr),
2610
+ stroke: e.stroke ? sr : e.stroke
2264
2611
  };
2265
2612
  }
2266
- var rr = {
2267
- stroke: Un,
2268
- strokeWidth: er
2269
- }, ir = { transform(e) {
2613
+ var xr = {
2614
+ stroke: sr,
2615
+ strokeWidth: vr
2616
+ }, Sr = { transform(e) {
2270
2617
  switch (e.type) {
2271
2618
  case "rect": {
2272
2619
  let t = {
2273
2620
  ...e,
2274
- paint: nr(e.paint)
2621
+ paint: br(e.paint)
2275
2622
  };
2276
2623
  if (!e.paint.fill) return t;
2277
- let n = [t], r = Math.min(e.width, e.height) / 2 * $n, i = Math.min(e.width, e.height) * .12;
2278
- for (let t = 1; t <= Qn; t++) {
2624
+ let n = [t], r = Math.min(e.width, e.height) / 2 * _r, i = Math.min(e.width, e.height) * .12;
2625
+ for (let t = 1; t <= gr; t++) {
2279
2626
  let a = r * t, o = e.width - a * 2, s = e.height - a * 2;
2280
2627
  if (o <= i || s <= i) break;
2281
2628
  n.push({
@@ -2285,7 +2632,7 @@ var rr = {
2285
2632
  width: o,
2286
2633
  height: s,
2287
2634
  cornerRadius: e.cornerRadius,
2288
- paint: rr,
2635
+ paint: xr,
2289
2636
  layer: e.layer,
2290
2637
  noScale: e.noScale
2291
2638
  });
@@ -2295,11 +2642,11 @@ var rr = {
2295
2642
  case "circle": {
2296
2643
  let t = {
2297
2644
  ...e,
2298
- paint: nr(e.paint)
2645
+ paint: br(e.paint)
2299
2646
  };
2300
2647
  if (!e.paint.fill) return t;
2301
- let n = [t], r = e.radius * $n;
2302
- for (let t = 1; t <= Qn; t++) {
2648
+ let n = [t], r = e.radius * _r;
2649
+ for (let t = 1; t <= gr; t++) {
2303
2650
  let i = e.radius - r * t;
2304
2651
  if (i <= e.radius * .12) break;
2305
2652
  n.push({
@@ -2307,7 +2654,7 @@ var rr = {
2307
2654
  cx: e.cx,
2308
2655
  cy: e.cy,
2309
2656
  radius: i,
2310
- paint: rr,
2657
+ paint: xr,
2311
2658
  layer: e.layer,
2312
2659
  noScale: e.noScale
2313
2660
  });
@@ -2317,21 +2664,21 @@ var rr = {
2317
2664
  case "polygon": {
2318
2665
  let t = {
2319
2666
  ...e,
2320
- paint: nr(e.paint)
2667
+ paint: br(e.paint)
2321
2668
  };
2322
2669
  if (!e.paint.fill) return t;
2323
2670
  let n = [t], r = e.vertices.length / 2, i = 0, a = 0;
2324
2671
  for (let t = 0; t < r; t++) i += e.vertices[t * 2], a += e.vertices[t * 2 + 1];
2325
2672
  i /= r, a /= r;
2326
- for (let t = 1; t <= Qn; t++) {
2327
- let o = 1 - $n * t;
2673
+ for (let t = 1; t <= gr; t++) {
2674
+ let o = 1 - _r * t;
2328
2675
  if (o <= .15) break;
2329
2676
  let s = [];
2330
2677
  for (let t = 0; t < r; t++) s.push(i + (e.vertices[t * 2] - i) * o, a + (e.vertices[t * 2 + 1] - a) * o);
2331
2678
  n.push({
2332
2679
  type: "polygon",
2333
2680
  vertices: s,
2334
- paint: rr,
2681
+ paint: xr,
2335
2682
  layer: e.layer,
2336
2683
  noScale: e.noScale
2337
2684
  });
@@ -2342,29 +2689,29 @@ var rr = {
2342
2689
  ...e,
2343
2690
  paint: {
2344
2691
  ...e.paint,
2345
- stroke: Wn
2692
+ stroke: cr
2346
2693
  }
2347
2694
  } : e;
2348
2695
  case "text": return {
2349
2696
  ...e,
2350
- fill: Gn
2697
+ fill: lr
2351
2698
  };
2352
2699
  case "image":
2353
2700
  case "group": return e;
2354
2701
  }
2355
- } }, ar = "#3a3a44";
2356
- function or(e, t) {
2357
- return I(e, (e) => {
2358
- let n = L(e);
2702
+ } }, Cr = "#3a3a44";
2703
+ function wr(e, t) {
2704
+ return L(e, (e) => {
2705
+ let n = R(e);
2359
2706
  return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${(n.a * t).toFixed(3)})` : e;
2360
2707
  });
2361
2708
  }
2362
- function sr(e = {}) {
2709
+ function Tr(e = {}) {
2363
2710
  let t = e.bleed ?? .05, n = Math.max(1, Math.min(4, e.layers ?? 2)), r = e.alpha ?? .4;
2364
2711
  function i(e, t, i, a, o, s) {
2365
- let c = or(t.fill, r), l = [];
2712
+ let c = wr(t.fill, r), l = [];
2366
2713
  for (let t = 0; t < n; t++) {
2367
- let n = B(i + t * 2654435769);
2714
+ let n = V(i + t * 2654435769);
2368
2715
  l.push({
2369
2716
  type: "polygon",
2370
2717
  vertices: e(n),
@@ -2383,7 +2730,7 @@ function sr(e = {}) {
2383
2730
  switch (e.type) {
2384
2731
  case "rect":
2385
2732
  if (!e.paint.fill) {
2386
- let n = B(V(e.x, e.y, e.width, e.height));
2733
+ let n = V(H(e.x, e.y, e.width, e.height));
2387
2734
  return {
2388
2735
  type: "polygon",
2389
2736
  vertices: U(e.x, e.y, e.width, e.height, t, n),
@@ -2397,13 +2744,13 @@ function sr(e = {}) {
2397
2744
  noScale: e.noScale
2398
2745
  };
2399
2746
  }
2400
- return i((n) => U(e.x, e.y, e.width, e.height, t, n), e.paint, V(e.x, e.y, e.width, e.height), e.layer, e.hit, e.noScale);
2747
+ return i((n) => U(e.x, e.y, e.width, e.height, t, n), e.paint, H(e.x, e.y, e.width, e.height), e.layer, e.hit, e.noScale);
2401
2748
  case "circle":
2402
2749
  if (!e.paint.fill) {
2403
- let n = B(V(e.cx, e.cy, e.radius));
2750
+ let n = V(H(e.cx, e.cy, e.radius));
2404
2751
  return {
2405
2752
  type: "polygon",
2406
- vertices: Pt(e.cx, e.cy, e.radius, t, n),
2753
+ vertices: Qt(e.cx, e.cy, e.radius, t, n),
2407
2754
  paint: {
2408
2755
  stroke: e.paint.stroke,
2409
2756
  strokeWidth: e.paint.strokeWidth ?? 0,
@@ -2414,20 +2761,20 @@ function sr(e = {}) {
2414
2761
  noScale: e.noScale
2415
2762
  };
2416
2763
  }
2417
- return i((n) => Pt(e.cx, e.cy, e.radius, t, n), e.paint, V(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
2764
+ return i((n) => Qt(e.cx, e.cy, e.radius, t, n), e.paint, H(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
2418
2765
  case "polygon":
2419
2766
  if (!e.paint.fill) {
2420
- let n = B(V(...e.vertices.slice(0, 4)));
2767
+ let n = V(H(...e.vertices.slice(0, 4)));
2421
2768
  return {
2422
2769
  ...e,
2423
- vertices: Ft(e.vertices, t, n),
2770
+ vertices: $t(e.vertices, t, n),
2424
2771
  paint: {
2425
2772
  ...e.paint,
2426
2773
  alpha: .5
2427
2774
  }
2428
2775
  };
2429
2776
  }
2430
- return i((n) => Ft(e.vertices, t, n), e.paint, V(...e.vertices.slice(0, 4)), e.layer, e.hit, e.noScale);
2777
+ return i((n) => $t(e.vertices, t, n), e.paint, H(...e.vertices.slice(0, 4)), e.layer, e.hit, e.noScale);
2431
2778
  case "line": return {
2432
2779
  ...e,
2433
2780
  paint: {
@@ -2437,7 +2784,7 @@ function sr(e = {}) {
2437
2784
  };
2438
2785
  case "text": return {
2439
2786
  ...e,
2440
- fill: ar
2787
+ fill: Cr
2441
2788
  };
2442
2789
  case "image":
2443
2790
  case "group": return e;
@@ -2446,32 +2793,32 @@ function sr(e = {}) {
2446
2793
  }
2447
2794
  //#endregion
2448
2795
  //#region src/style/shape/DarkModernStyle.ts
2449
- var cr = "rgba(255, 255, 255, 0.14)", lr = "#5b6573", ur = "#e6e8ec", dr = "rgba(0, 0, 0, 0.38)", fr = .08, pr = .34;
2450
- function mr(e) {
2451
- let t = L(e);
2796
+ var Er = "rgba(255, 255, 255, 0.14)", Dr = "#5b6573", Or = "#e6e8ec", kr = "rgba(0, 0, 0, 0.38)", Ar = .08, jr = .34;
2797
+ function Mr(e) {
2798
+ let t = R(e);
2452
2799
  if (!t) return "rgb(38, 42, 48)";
2453
- let [n, r, i] = Ye(t.r, t.g, t.b);
2454
- return Xe(n, Math.min(r, pr), .22 + i * .18, t.a);
2800
+ let [n, r, i] = ft(t.r, t.g, t.b);
2801
+ return pt(n, Math.min(r, jr), .22 + i * .18, t.a);
2455
2802
  }
2456
- function hr(e) {
2803
+ function Nr(e) {
2457
2804
  return {
2458
2805
  ...e,
2459
- fill: I(e.fill, mr),
2460
- stroke: e.stroke ? cr : e.stroke
2806
+ fill: L(e.fill, Mr),
2807
+ stroke: e.stroke ? Er : e.stroke
2461
2808
  };
2462
2809
  }
2463
- function gr(e) {
2810
+ function Pr(e) {
2464
2811
  return e.hit?.kind === "room" && e.paint.fill !== void 0;
2465
2812
  }
2466
- var _r = { transform(e, t) {
2813
+ var Fr = { transform(e, t) {
2467
2814
  switch (e.type) {
2468
2815
  case "rect": {
2469
2816
  let n = {
2470
2817
  ...e,
2471
- paint: hr(e.paint)
2818
+ paint: Nr(e.paint)
2472
2819
  };
2473
- if (!gr(e)) return n;
2474
- let r = t.roomSize * fr;
2820
+ if (!Pr(e)) return n;
2821
+ let r = t.roomSize * Ar;
2475
2822
  return [{
2476
2823
  type: "rect",
2477
2824
  x: e.x + r,
@@ -2479,7 +2826,7 @@ var _r = { transform(e, t) {
2479
2826
  width: e.width,
2480
2827
  height: e.height,
2481
2828
  cornerRadius: e.cornerRadius,
2482
- paint: { fill: dr },
2829
+ paint: { fill: kr },
2483
2830
  layer: e.layer,
2484
2831
  noScale: e.noScale
2485
2832
  }, n];
@@ -2487,82 +2834,82 @@ var _r = { transform(e, t) {
2487
2834
  case "circle": {
2488
2835
  let n = {
2489
2836
  ...e,
2490
- paint: hr(e.paint)
2837
+ paint: Nr(e.paint)
2491
2838
  };
2492
- if (!gr(e)) return n;
2493
- let r = t.roomSize * fr;
2839
+ if (!Pr(e)) return n;
2840
+ let r = t.roomSize * Ar;
2494
2841
  return [{
2495
2842
  type: "circle",
2496
2843
  cx: e.cx + r,
2497
2844
  cy: e.cy + r,
2498
2845
  radius: e.radius,
2499
- paint: { fill: dr },
2846
+ paint: { fill: kr },
2500
2847
  layer: e.layer,
2501
2848
  noScale: e.noScale
2502
2849
  }, n];
2503
2850
  }
2504
2851
  case "polygon": return {
2505
2852
  ...e,
2506
- paint: hr(e.paint)
2853
+ paint: Nr(e.paint)
2507
2854
  };
2508
2855
  case "line": return {
2509
2856
  ...e,
2510
2857
  paint: e.paint.stroke ? {
2511
2858
  ...e.paint,
2512
- stroke: lr
2859
+ stroke: Dr
2513
2860
  } : e.paint
2514
2861
  };
2515
2862
  case "text": return {
2516
2863
  ...e,
2517
- fill: ur
2864
+ fill: Or
2518
2865
  };
2519
2866
  case "image":
2520
2867
  case "group": return e;
2521
2868
  }
2522
- } }, J = "#5a3a22", vr = "#43301c", yr = 120, br = 86, xr = 50, Sr = 232, Cr = 205, wr = 158;
2523
- function Tr(e) {
2524
- let t = L(e);
2525
- if (!t) return R(Sr, Cr, wr);
2526
- let n = z(t);
2527
- return R(Math.round(yr + (Sr - yr) * n), Math.round(br + (Cr - br) * n), Math.round(xr + (wr - xr) * n), t.a);
2869
+ } }, J = "#5a3a22", Ir = "#43301c", Lr = 120, Rr = 86, zr = 50, Br = 232, Vr = 205, Hr = 158;
2870
+ function Ur(e) {
2871
+ let t = R(e);
2872
+ if (!t) return z(Br, Vr, Hr);
2873
+ let n = B(t);
2874
+ return z(Math.round(Lr + (Br - Lr) * n), Math.round(Rr + (Vr - Rr) * n), Math.round(zr + (Hr - zr) * n), t.a);
2528
2875
  }
2529
- function Er(e) {
2530
- let t = L(e);
2876
+ function Wr(e) {
2877
+ let t = R(e);
2531
2878
  if (!t || t.a >= 1) return J;
2532
- let n = L(J);
2533
- return R(n.r, n.g, n.b, t.a);
2879
+ let n = R(J);
2880
+ return z(n.r, n.g, n.b, t.a);
2534
2881
  }
2535
- function Dr(e) {
2882
+ function Gr(e) {
2536
2883
  return {
2537
2884
  ...e,
2538
- fill: I(e.fill, Tr),
2539
- stroke: e.stroke ? Er(e.stroke) : e.stroke
2885
+ fill: L(e.fill, Ur),
2886
+ stroke: e.stroke ? Wr(e.stroke) : e.stroke
2540
2887
  };
2541
2888
  }
2542
- var Or = { transform(e) {
2889
+ var Kr = { transform(e) {
2543
2890
  switch (e.type) {
2544
2891
  case "rect":
2545
2892
  case "circle":
2546
2893
  case "polygon": return {
2547
2894
  ...e,
2548
- paint: Dr(e.paint)
2895
+ paint: Gr(e.paint)
2549
2896
  };
2550
2897
  case "line": return {
2551
2898
  ...e,
2552
2899
  paint: e.paint.stroke ? {
2553
2900
  ...e.paint,
2554
- stroke: Er(e.paint.stroke)
2901
+ stroke: Wr(e.paint.stroke)
2555
2902
  } : e.paint
2556
2903
  };
2557
2904
  case "text": return {
2558
2905
  ...e,
2559
- fill: vr
2906
+ fill: Ir
2560
2907
  };
2561
2908
  case "image":
2562
2909
  case "group": return e;
2563
2910
  }
2564
2911
  } };
2565
- function kr(e, t, n) {
2912
+ function qr(e, t, n) {
2566
2913
  let r = [], i = n * .42;
2567
2914
  for (let a = 0; a < 8; a++) {
2568
2915
  let o = (-90 + a * 45) * (Math.PI / 180), s = a % 2 == 0 ? n : i;
@@ -2570,7 +2917,7 @@ function kr(e, t, n) {
2570
2917
  }
2571
2918
  return r;
2572
2919
  }
2573
- function Ar() {
2920
+ function Jr() {
2574
2921
  let e;
2575
2922
  return {
2576
2923
  attach(t) {
@@ -2608,9 +2955,9 @@ function Ar() {
2608
2955
  layer: "top"
2609
2956
  }), c.push({
2610
2957
  type: "polygon",
2611
- vertices: kr(u, d, l),
2958
+ vertices: qr(u, d, l),
2612
2959
  paint: {
2613
- fill: R(Sr, Cr, wr, .85),
2960
+ fill: z(Br, Vr, Hr, .85),
2614
2961
  stroke: J,
2615
2962
  strokeWidth: s
2616
2963
  },
@@ -2629,7 +2976,7 @@ function Ar() {
2629
2976
  text: "N",
2630
2977
  fontSize: l * .5,
2631
2978
  fontStyle: "bold",
2632
- fill: vr,
2979
+ fill: Ir,
2633
2980
  align: "center",
2634
2981
  verticalAlign: "middle",
2635
2982
  layer: "top"
@@ -2639,22 +2986,22 @@ function Ar() {
2639
2986
  }
2640
2987
  //#endregion
2641
2988
  //#region src/style/index.ts
2642
- var jr = ct, Mr = bt, Nr = Mt;
2643
- function Pr(e) {
2644
- return Lt(e);
2989
+ var Yr = Tt, Xr = Lt, Zr = Yt;
2990
+ function Qr(e) {
2991
+ return tn(e);
2645
2992
  }
2646
- function Fr(e = {}) {
2647
- return Ht(e);
2993
+ function $r(e = {}) {
2994
+ return sn(e);
2648
2995
  }
2649
- var Ir = tn, Lr = hn;
2650
- function Rr(e = {}) {
2651
- return _n(e);
2996
+ var ei = bn, ti = Nn;
2997
+ function ni(e = {}) {
2998
+ return Fn(e);
2652
2999
  }
2653
- var zr = On, Br = Hn, Vr = ir;
2654
- function Hr(e = {}) {
2655
- return sr(e);
3000
+ var ri = Kn, ii = or, ai = Sr;
3001
+ function oi(e = {}) {
3002
+ return Tr(e);
2656
3003
  }
2657
- var Ur = _r, Wr = Or, Gr = class {
3004
+ var si = Fr, ci = Kr, li = class {
2658
3005
  get settings() {
2659
3006
  return this.state.settings;
2660
3007
  }
@@ -2671,7 +3018,7 @@ var Ur = _r, Wr = Or, Gr = class {
2671
3018
  return this.backend.events;
2672
3019
  }
2673
3020
  constructor(e, t, n, r) {
2674
- this.currentStyle = x, this.state = new Ae(e, t ?? ke()), this.backend = r ? r(this.state) : new Je(this.state, n);
3021
+ this.currentStyle = x, this.state = new Ae(e, t ?? ke()), this.backend = r ? r(this.state) : new dt(this.state, n);
2675
3022
  }
2676
3023
  destroy() {
2677
3024
  this.backend.destroy();
@@ -2827,15 +3174,15 @@ var Ur = _r, Wr = Or, Gr = class {
2827
3174
  getCullingMode() {
2828
3175
  return this.state.settings.cullingMode;
2829
3176
  }
2830
- }, Kr = "room";
2831
- function qr(e, t) {
3177
+ }, ui = "room";
3178
+ function di(e, t) {
2832
3179
  let n = /* @__PURE__ */ new Map();
2833
3180
  function r(e) {
2834
3181
  let t = n.get(e);
2835
3182
  return t || (t = [], n.set(e, t)), t;
2836
3183
  }
2837
3184
  function i(e, t, n, i, o, s, c) {
2838
- let l = e.layer ?? c ?? Kr;
3185
+ let l = e.layer ?? c ?? ui;
2839
3186
  switch (e.type) {
2840
3187
  case "rect": {
2841
3188
  let a = {
@@ -2848,7 +3195,7 @@ function qr(e, t) {
2848
3195
  stroke: e.paint.stroke,
2849
3196
  sw: (e.paint.strokeWidth ?? 0) * i,
2850
3197
  cr: (e.cornerRadius ?? 0) * i,
2851
- dash: Yr(e.paint.dash, i, e.paint.dashEnabled)
3198
+ dash: pi(e.paint.dash, i, e.paint.dashEnabled)
2852
3199
  };
2853
3200
  r(l).push(a);
2854
3201
  return;
@@ -2862,16 +3209,16 @@ function qr(e, t) {
2862
3209
  fill: P(e.paint.fill, t, n, i, o, s),
2863
3210
  stroke: e.paint.stroke,
2864
3211
  sw: (e.paint.strokeWidth ?? 0) * i,
2865
- dash: Yr(e.paint.dash, i, e.paint.dashEnabled)
3212
+ dash: pi(e.paint.dash, i, e.paint.dashEnabled)
2866
3213
  });
2867
3214
  return;
2868
3215
  case "line": {
2869
3216
  let a = {
2870
3217
  type: "line",
2871
- points: Jr(e.points, t, n, i, o, s),
3218
+ points: fi(e.points, t, n, i, o, s),
2872
3219
  stroke: e.paint.stroke,
2873
3220
  sw: (e.paint.strokeWidth ?? 0) * i,
2874
- dash: Yr(e.paint.dash, i, e.paint.dashEnabled),
3221
+ dash: pi(e.paint.dash, i, e.paint.dashEnabled),
2875
3222
  lineCap: e.lineCap,
2876
3223
  lineJoin: e.lineJoin,
2877
3224
  alpha: e.paint.alpha
@@ -2882,7 +3229,7 @@ function qr(e, t) {
2882
3229
  case "polygon": {
2883
3230
  let a = {
2884
3231
  type: "polygon",
2885
- vertices: Jr(e.vertices, t, n, i, o, s),
3232
+ vertices: fi(e.vertices, t, n, i, o, s),
2886
3233
  fill: P(e.paint.fill, t, n, i, o, s),
2887
3234
  stroke: e.paint.stroke,
2888
3235
  sw: (e.paint.strokeWidth ?? 0) * i
@@ -2891,7 +3238,7 @@ function qr(e, t) {
2891
3238
  return;
2892
3239
  }
2893
3240
  case "text": {
2894
- let a = Xr(e.transform, t, n, i, o, s), c = {
3241
+ let a = mi(e.transform, t, n, i, o, s), c = {
2895
3242
  type: "text",
2896
3243
  x: a ? 0 : (t + e.x) * i + o,
2897
3244
  y: a ? 0 : (n + e.y) * i + s,
@@ -2914,7 +3261,7 @@ function qr(e, t) {
2914
3261
  return;
2915
3262
  }
2916
3263
  case "image": {
2917
- let a = Xr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
3264
+ let a = mi(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
2918
3265
  r(l).push({
2919
3266
  type: "image",
2920
3267
  x: c,
@@ -2934,7 +3281,7 @@ function qr(e, t) {
2934
3281
  function a(e, t, n, a, o, s, c) {
2935
3282
  let l = e.layer ?? c;
2936
3283
  if (e.noScale) {
2937
- let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? Kr);
3284
+ let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? ui);
2938
3285
  d.push({
2939
3286
  type: "pushTransform",
2940
3287
  matrix: [
@@ -2961,19 +3308,19 @@ function qr(e, t) {
2961
3308
  });
2962
3309
  return o;
2963
3310
  }
2964
- function Jr(e, t, n, r, i, a) {
3311
+ function fi(e, t, n, r, i, a) {
2965
3312
  let o = Array(e.length);
2966
3313
  for (let s = 0; s < e.length; s += 2) o[s] = (t + e[s]) * r + i, o[s + 1] = (n + e[s + 1]) * r + a;
2967
3314
  return o;
2968
3315
  }
2969
- function Yr(e, t, n) {
3316
+ function pi(e, t, n) {
2970
3317
  if (n === !1) return;
2971
3318
  if (!e || e.length === 0) return e;
2972
3319
  let r = Array(e.length);
2973
3320
  for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
2974
3321
  return r;
2975
3322
  }
2976
- function Xr(e, t, n, r, i, a) {
3323
+ function mi(e, t, n, r, i, a) {
2977
3324
  if (!e) return;
2978
3325
  let [o, s, c, l, u, d] = e;
2979
3326
  return [
@@ -2993,33 +3340,33 @@ function Y(e) {
2993
3340
  function X(e, t) {
2994
3341
  return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? Y(t) : t}"`;
2995
3342
  }
2996
- function Zr(e) {
3343
+ function hi(e) {
2997
3344
  return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
2998
3345
  }
2999
- var Qr = 0;
3000
- function $r() {
3001
- return `mmr-grad-${++Qr}`;
3346
+ var gi = 0;
3347
+ function _i() {
3348
+ return `mmr-grad-${++gi}`;
3002
3349
  }
3003
- function ei(e, t) {
3350
+ function vi(e, t) {
3004
3351
  let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Y(e.color)}"/>`).join("");
3005
3352
  return `<defs><linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${t.x0}" y1="${t.y0}" x2="${t.x1}" y2="${t.y1}">${n}</linearGradient></defs>`;
3006
3353
  }
3007
- function ti(e, t) {
3354
+ function yi(e, t) {
3008
3355
  let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Y(e.color)}"/>`).join(""), r = (t.fx === void 0 ? "" : ` fx="${t.fx}"`) + (t.fy === void 0 ? "" : ` fy="${t.fy}"`) + (t.fr === void 0 ? "" : ` fr="${t.fr}"`);
3009
3356
  return `<defs><radialGradient id="${e}" gradientUnits="userSpaceOnUse" cx="${t.cx}" cy="${t.cy}" r="${t.r}"${r}>${n}</radialGradient></defs>`;
3010
3357
  }
3011
- function ni(e, t) {
3358
+ function bi(e, t) {
3012
3359
  if (e === void 0) return;
3013
3360
  if (typeof e == "string") return e;
3014
- let n = $r();
3015
- return t.push(e.type === "linear" ? ei(n, e) : ti(n, e)), `url(#${n})`;
3361
+ let n = _i();
3362
+ return t.push(e.type === "linear" ? vi(n, e) : yi(n, e)), `url(#${n})`;
3016
3363
  }
3017
- function ri(e) {
3364
+ function xi(e) {
3018
3365
  let t = [];
3019
- for (let n of e) ii(n.commands, t);
3366
+ for (let n of e) Si(n.commands, t);
3020
3367
  return t;
3021
3368
  }
3022
- function ii(e, t) {
3369
+ function Si(e, t) {
3023
3370
  let n = [];
3024
3371
  for (let r of e) switch (r.type) {
3025
3372
  case "pushTransform": {
@@ -3037,21 +3384,21 @@ function ii(e, t) {
3037
3384
  break;
3038
3385
  }
3039
3386
  default:
3040
- ai(r, t);
3387
+ Ci(r, t);
3041
3388
  break;
3042
3389
  }
3043
3390
  for (; n.length > 0;) t.push(n.pop());
3044
3391
  }
3045
- function ai(e, t) {
3392
+ function Ci(e, t) {
3046
3393
  switch (e.type) {
3047
3394
  case "rect": {
3048
- let n = ni(e.fill, t) ?? "none", r = e.cr > 0 ? `${X("rx", e.cr)}${X("ry", e.cr)}` : "";
3049
- t.push(`<rect${X("x", e.x)}${X("y", e.y)}${X("width", e.w)}${X("height", e.h)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${r}${Zr(e.dash)}/>`);
3395
+ let n = bi(e.fill, t) ?? "none", r = e.cr > 0 ? `${X("rx", e.cr)}${X("ry", e.cr)}` : "";
3396
+ t.push(`<rect${X("x", e.x)}${X("y", e.y)}${X("width", e.w)}${X("height", e.h)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${r}${hi(e.dash)}/>`);
3050
3397
  return;
3051
3398
  }
3052
3399
  case "circle": {
3053
- let n = ni(e.fill, t) ?? "none";
3054
- t.push(`<circle${X("cx", e.cx)}${X("cy", e.cy)}${X("r", e.r)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Zr(e.dash)}/>`);
3400
+ let n = bi(e.fill, t) ?? "none";
3401
+ t.push(`<circle${X("cx", e.cx)}${X("cy", e.cy)}${X("r", e.r)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${hi(e.dash)}/>`);
3055
3402
  return;
3056
3403
  }
3057
3404
  case "line": {
@@ -3059,7 +3406,7 @@ function ai(e, t) {
3059
3406
  if (n.length < 2) return;
3060
3407
  let r = [];
3061
3408
  for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
3062
- t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Zr(e.dash)}${X("stroke-linecap", e.lineCap)}${X("stroke-linejoin", e.lineJoin)}${X("opacity", e.alpha)} fill="none"/>`);
3409
+ t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${hi(e.dash)}${X("stroke-linecap", e.lineCap)}${X("stroke-linejoin", e.lineJoin)}${X("opacity", e.alpha)} fill="none"/>`);
3063
3410
  return;
3064
3411
  }
3065
3412
  case "polygon": {
@@ -3067,7 +3414,7 @@ function ai(e, t) {
3067
3414
  if (n.length < 4) return;
3068
3415
  let r = [];
3069
3416
  for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
3070
- let i = ni(e.fill, t);
3417
+ let i = bi(e.fill, t);
3071
3418
  t.push(`<polygon points="${r.join(" ")}"${X("fill", i)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}/>`);
3072
3419
  return;
3073
3420
  }
@@ -3090,18 +3437,18 @@ function ai(e, t) {
3090
3437
  }
3091
3438
  //#endregion
3092
3439
  //#region src/render/CanvasRenderer.ts
3093
- var oi = (e) => {
3440
+ var wi = (e) => {
3094
3441
  if (typeof Image < "u") {
3095
3442
  let t = new Image();
3096
3443
  return t.src = e, t;
3097
3444
  }
3098
3445
  return null;
3099
3446
  };
3100
- function si(e, t, n = {}) {
3101
- let r = n.imageFactory ?? oi;
3102
- for (let n of t) ci(e, n.commands, r);
3447
+ function Ti(e, t, n = {}) {
3448
+ let r = n.imageFactory ?? wi;
3449
+ for (let n of t) Ei(e, n.commands, r);
3103
3450
  }
3104
- function ci(e, t, n) {
3451
+ function Ei(e, t, n) {
3105
3452
  let r = 0;
3106
3453
  for (let i of t) switch (i.type) {
3107
3454
  case "pushTransform":
@@ -3115,12 +3462,12 @@ function ci(e, t, n) {
3115
3462
  r > 0 && (e.restore(), r--);
3116
3463
  break;
3117
3464
  default:
3118
- li(e, i, n);
3465
+ Di(e, i, n);
3119
3466
  break;
3120
3467
  }
3121
3468
  for (; r > 0;) e.restore(), r--;
3122
3469
  }
3123
- function li(e, t, n) {
3470
+ function Di(e, t, n) {
3124
3471
  switch (t.type) {
3125
3472
  case "rect":
3126
3473
  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 = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
@@ -3181,7 +3528,7 @@ function li(e, t, n) {
3181
3528
  }
3182
3529
  //#endregion
3183
3530
  //#region src/export/sceneBounds.ts
3184
- function ui(e, t, n = 0) {
3531
+ function Oi(e, t, n = 0) {
3185
3532
  if (!t.worldToScene) return e;
3186
3533
  let r = [
3187
3534
  t.worldToScene(e.x, e.y),
@@ -3199,15 +3546,15 @@ function ui(e, t, n = 0) {
3199
3546
  }
3200
3547
  //#endregion
3201
3548
  //#region src/export/SvgExporter.ts
3202
- var di = {
3549
+ var ki = {
3203
3550
  scale: 1,
3204
3551
  offsetX: 0,
3205
3552
  offsetY: 0
3206
3553
  };
3207
- function fi(e) {
3554
+ function Ai(e) {
3208
3555
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3209
3556
  }
3210
- var pi = class {
3557
+ var ji = class {
3211
3558
  constructor(e = {}) {
3212
3559
  this.options = e;
3213
3560
  }
@@ -3222,24 +3569,24 @@ var pi = class {
3222
3569
  }), p = {
3223
3570
  scale: 1,
3224
3571
  roomSize: c.roomSize
3225
- }, m = (e) => t === x ? e : O(e, t, p), h = ui(u, t, c.roomSize * .5), g = [];
3226
- return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${fi(c.backgroundColor)}"/>`), ae(f, {
3572
+ }, m = (e) => t === x ? e : O(e, t, p), h = Oi(u, t, c.roomSize * .5), g = [];
3573
+ return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${Ai(c.backgroundColor)}"/>`), ae(f, {
3227
3574
  state: e,
3228
3575
  viewportBounds: d,
3229
3576
  sceneOverlays: n,
3230
3577
  overlays: this.options.overlays
3231
3578
  }, (e, t) => {
3232
- e.length !== 0 && g.push(...ri(qr(t ? e : m(e), di)));
3579
+ e.length !== 0 && g.push(...xi(di(t ? e : m(e), ki)));
3233
3580
  }), g.push("</svg>"), g.join("\n");
3234
3581
  }
3235
- }, mi = class {
3582
+ }, Mi = class {
3236
3583
  constructor(e = {}) {
3237
3584
  this.options = e;
3238
3585
  }
3239
3586
  render({ backend: e }) {
3240
3587
  return e.exportCanvas(this.options)?.toDataURL("image/png");
3241
3588
  }
3242
- }, hi = class {
3589
+ }, Ni = class {
3243
3590
  constructor(e = {}) {
3244
3591
  this.options = e;
3245
3592
  }
@@ -3256,14 +3603,14 @@ var pi = class {
3256
3603
  };
3257
3604
  //#endregion
3258
3605
  //#region src/export/canvasToBytes.ts
3259
- function gi(e, t = "image/png", n) {
3606
+ function Pi(e, t = "image/png", n) {
3260
3607
  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);
3261
3608
  for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
3262
3609
  return s;
3263
3610
  }
3264
3611
  //#endregion
3265
3612
  //#region src/export/CanvasExporter.ts
3266
- var _i = class {
3613
+ var Fi = class {
3267
3614
  constructor(e) {
3268
3615
  this.options = e;
3269
3616
  }
@@ -3272,7 +3619,7 @@ var _i = class {
3272
3619
  if (r === void 0 || i === void 0 || !a) return;
3273
3620
  let o = a, s = o.getPlane(i);
3274
3621
  if (!s) return;
3275
- let c = e.settings, { width: l, height: u } = this.options, d = this.options.padding ?? 3, f = e.computeExportBounds(o, s, this.options.roomId, d), p = ui(f, t, c.roomSize * .5), m = Math.min(l / p.w, u / p.h), h = p.w * m, g = p.h * m, _ = (l - h) / 2 - p.x * m, v = (u - g) / 2 - p.y * m, y = {
3622
+ let c = e.settings, { width: l, height: u } = this.options, d = this.options.padding ?? 3, f = e.computeExportBounds(o, s, this.options.roomId, d), p = Oi(f, t, c.roomSize * .5), m = Math.min(l / p.w, u / p.h), h = p.w * m, g = p.h * m, _ = (l - h) / 2 - p.x * m, v = (u - g) / 2 - p.y * m, y = {
3276
3623
  scale: m,
3277
3624
  offsetX: _,
3278
3625
  offsetY: v
@@ -3294,49 +3641,49 @@ var _i = class {
3294
3641
  sceneOverlays: n,
3295
3642
  overlays: this.options.overlays
3296
3643
  }, (e, t) => {
3297
- e.length !== 0 && si(T, qr(t ? e : te(e), y));
3644
+ e.length !== 0 && Ti(T, di(t ? e : te(e), y));
3298
3645
  }), w;
3299
3646
  }
3300
- }, vi = class {
3647
+ }, Ii = class {
3301
3648
  constructor(e) {
3302
- this.options = e, this.canvasExporter = new _i(e);
3649
+ this.options = e, this.canvasExporter = new Fi(e);
3303
3650
  }
3304
3651
  render(e) {
3305
3652
  let t = this.canvasExporter.render(e);
3306
- if (t) return gi(t, this.options.mimeType, this.options.quality);
3653
+ if (t) return Pi(t, this.options.mimeType, this.options.quality);
3307
3654
  }
3308
- }, Z, yi, bi = 256;
3309
- function xi(e, t, n) {
3655
+ }, Z, Li, Ri = 256;
3656
+ function zi(e, t, n) {
3310
3657
  let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
3311
- if (yi === r && Z) return Z;
3312
- let i = bi, a = i / 2, o = document.createElement("canvas");
3658
+ if (Li === r && Z) return Z;
3659
+ let i = Ri, a = i / 2, o = document.createElement("canvas");
3313
3660
  o.width = i, o.height = i;
3314
3661
  let s = o.getContext("2d");
3315
3662
  s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
3316
3663
  let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
3317
3664
  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";
3318
3665
  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);
3319
- 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), Z = o.toDataURL(), yi = r, Z;
3666
+ 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), Z = o.toDataURL(), Li = r, Z;
3320
3667
  }
3321
- function Si(e, t, n, r) {
3668
+ function Bi(e, t, n, r) {
3322
3669
  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);
3323
3670
  return {
3324
3671
  cx: e,
3325
3672
  cy: t,
3326
3673
  displaySize: u,
3327
- src: xi(a, o, Math.round(i / (u / 2) * 50) / 50)
3674
+ src: zi(a, o, Math.round(i / (u / 2) * 50) / 50)
3328
3675
  };
3329
3676
  }
3330
3677
  //#endregion
3331
3678
  //#region src/overlay/AmbientLightOverlay.ts
3332
- var Ci = {
3679
+ var Vi = {
3333
3680
  color: "#ffcc44",
3334
3681
  radius: 12,
3335
3682
  intensity: .7
3336
- }, wi = class {
3683
+ }, Hi = class {
3337
3684
  constructor(e) {
3338
3685
  this.onPosition = () => this.ctx?.invalidate(), this.params = {
3339
- ...Ci,
3686
+ ...Vi,
3340
3687
  ...e
3341
3688
  };
3342
3689
  }
@@ -3359,7 +3706,7 @@ var Ci = {
3359
3706
  if (e.positionRoomId === void 0) return;
3360
3707
  let n = e.mapReader.getRoom(e.positionRoomId);
3361
3708
  if (!n) return;
3362
- let r = Si(n.x, n.y, t, this.params);
3709
+ let r = Bi(n.x, n.y, t, this.params);
3363
3710
  return {
3364
3711
  type: "image",
3365
3712
  x: r.cx - r.displaySize / 2,
@@ -3370,7 +3717,7 @@ var Ci = {
3370
3717
  layer: "overlay"
3371
3718
  };
3372
3719
  }
3373
- }, Ti = () => typeof performance < "u" ? performance.now() : Date.now(), Ei = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(Ti()), 16), Di = typeof cancelAnimationFrame < "u" ? cancelAnimationFrame : (e) => clearTimeout(e), Oi = class {
3720
+ }, Ui = () => typeof performance < "u" ? performance.now() : Date.now(), Wi = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(Ui()), 16), Gi = typeof cancelAnimationFrame < "u" ? cancelAnimationFrame : (e) => clearTimeout(e), Ki = class {
3374
3721
  constructor(e, t, n = {}) {
3375
3722
  this.worldX = e, this.worldY = t, this.cancelled = !1, this.transform = (e, t) => ({
3376
3723
  x: e,
@@ -3394,12 +3741,12 @@ var Ci = {
3394
3741
  n(1), this.onComplete?.();
3395
3742
  return;
3396
3743
  }
3397
- let r = Ti(), i = (e) => {
3744
+ let r = Ui(), i = (e) => {
3398
3745
  if (this.cancelled) return;
3399
3746
  let t = Math.min((e - r) / this.duration, 1);
3400
- n(t), t < 1 ? this.rafId = Ei(i) : (this.rafId = void 0, this.onComplete?.());
3747
+ n(t), t < 1 ? this.rafId = Wi(i) : (this.rafId = void 0, this.onComplete?.());
3401
3748
  };
3402
- this.rafId = Ei(i);
3749
+ this.rafId = Wi(i);
3403
3750
  }
3404
3751
  updateViewport(e, t, n) {
3405
3752
  if (this.transform = n, this.ring) {
@@ -3411,9 +3758,9 @@ var Ci = {
3411
3758
  }
3412
3759
  }
3413
3760
  destroy() {
3414
- this.cancelled = !0, this.rafId !== void 0 && (Di(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
3761
+ this.cancelled = !0, this.rafId !== void 0 && (Gi(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
3415
3762
  }
3416
- }, ki = {
3763
+ }, qi = {
3417
3764
  n: {
3418
3765
  x: 0,
3419
3766
  y: -1
@@ -3446,7 +3793,7 @@ var Ci = {
3446
3793
  x: -Math.SQRT1_2,
3447
3794
  y: Math.SQRT1_2
3448
3795
  }
3449
- }, Ai = [
3796
+ }, Ji = [
3450
3797
  "n",
3451
3798
  "s",
3452
3799
  "e",
@@ -3455,22 +3802,22 @@ var Ci = {
3455
3802
  "nw",
3456
3803
  "se",
3457
3804
  "sw"
3458
- ], ji = new Set([
3805
+ ], Yi = new Set([
3459
3806
  "ne",
3460
3807
  "nw",
3461
3808
  "se",
3462
3809
  "sw"
3463
- ]), Mi = {
3810
+ ]), Xi = {
3464
3811
  clear: 10,
3465
3812
  diagonal: .3,
3466
3813
  preferred: 1,
3467
3814
  distance: .05
3468
- }, Ni = [
3815
+ }, Zi = [
3469
3816
  "n",
3470
3817
  "s",
3471
3818
  "e",
3472
3819
  "w"
3473
- ], Pi = [
3820
+ ], Qi = [
3474
3821
  "n",
3475
3822
  "s",
3476
3823
  "e",
@@ -3480,16 +3827,16 @@ var Ci = {
3480
3827
  "se",
3481
3828
  "sw"
3482
3829
  ];
3483
- function Fi(e, t) {
3830
+ function $i(e, t) {
3484
3831
  return Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y));
3485
3832
  }
3486
- function Ii(e, t) {
3833
+ function ea(e, t) {
3487
3834
  let n = Math.max(e.x - (t.x + t.width), t.x - (e.x + e.width), 0), r = Math.max(e.y - (t.y + t.height), t.y - (e.y + e.height), 0);
3488
3835
  return Math.hypot(n, r);
3489
3836
  }
3490
3837
  function Q(e, t, n) {
3491
- let r = ki[t];
3492
- if (ji.has(t)) {
3838
+ let r = qi[t];
3839
+ if (Yi.has(t)) {
3493
3840
  let t = e.x + r.x * n, i = e.y + r.y * n;
3494
3841
  return {
3495
3842
  x: r.x < 0 ? t - e.width : t,
@@ -3506,9 +3853,9 @@ function Q(e, t, n) {
3506
3853
  height: e.height
3507
3854
  };
3508
3855
  }
3509
- function Li(e, t, n = {}) {
3510
- let r = n.offset ?? .6, i = n.slots === 4 ? Ni : Ai, a = {
3511
- ...Mi,
3856
+ function ta(e, t, n = {}) {
3857
+ let r = n.offset ?? .6, i = n.slots === 4 ? Zi : Ji, a = {
3858
+ ...Xi,
3512
3859
  ...n.weights
3513
3860
  }, o = [], s = [];
3514
3861
  for (let c of e) {
@@ -3518,11 +3865,11 @@ function Li(e, t, n = {}) {
3518
3865
  for (let n = r; n <= r + e + 1e-9; n += u) {
3519
3866
  let e = Q(c, t, n), r = !1, o = Infinity;
3520
3867
  for (let t of p) {
3521
- if (t.kind !== "exit" && Fi(e, t) > 0) {
3868
+ if (t.kind !== "exit" && $i(e, t) > 0) {
3522
3869
  r = !0;
3523
3870
  break;
3524
3871
  }
3525
- let n = Ii(e, t);
3872
+ let n = ea(e, t);
3526
3873
  n < o && (o = n);
3527
3874
  }
3528
3875
  if (r) {
@@ -3549,7 +3896,7 @@ function Li(e, t, n = {}) {
3549
3896
  continue;
3550
3897
  }
3551
3898
  let o = 0;
3552
- c.preferred ? t === c.preferred && (o -= a.preferred) : ji.has(t) && (o += a.diagonal);
3899
+ c.preferred ? t === c.preferred && (o -= a.preferred) : Yi.has(t) && (o += a.diagonal);
3553
3900
  let s = -i.value * a.clear + o;
3554
3901
  n.onScored && h.push({
3555
3902
  dir: t,
@@ -3572,9 +3919,9 @@ function Li(e, t, n = {}) {
3572
3919
  off: r,
3573
3920
  cost: 0,
3574
3921
  clearance: 0
3575
- }, m.clearance < (n.minClearance ?? 0)) for (let e of Pi) {
3922
+ }, m.clearance < (n.minClearance ?? 0)) for (let e of Qi) {
3576
3923
  let t = Q(c, e, r);
3577
- if (!p.some((e) => e.kind !== "exit" && Fi(t, e) > 0)) {
3924
+ if (!p.some((e) => e.kind !== "exit" && $i(t, e) > 0)) {
3578
3925
  m = {
3579
3926
  box: t,
3580
3927
  dir: e,
@@ -3586,7 +3933,7 @@ function Li(e, t, n = {}) {
3586
3933
  }
3587
3934
  }
3588
3935
  n.onScored?.(c, h, m.dir);
3589
- let g = ki[m.dir];
3936
+ let g = qi[m.dir];
3590
3937
  s.push({
3591
3938
  id: c.id,
3592
3939
  x: m.box.x,
@@ -3607,7 +3954,7 @@ function Li(e, t, n = {}) {
3607
3954
  }
3608
3955
  //#endregion
3609
3956
  //#region src/overlay/WaypointOverlay.ts
3610
- var Ri = class {
3957
+ var na = class {
3611
3958
  constructor() {
3612
3959
  this.waypoints = [], this.placed = [];
3613
3960
  }
@@ -3679,7 +4026,7 @@ var Ri = class {
3679
4026
  });
3680
4027
  }
3681
4028
  if (f.length === 0) return [];
3682
- let m = "rgba(20, 20, 24, 0.82)", h = Li(f, u, {
4029
+ let m = "rgba(20, 20, 24, 0.82)", h = ta(f, u, {
3683
4030
  offset: a * .7,
3684
4031
  extend: a * 4,
3685
4032
  clearCap: a * 1.5,
@@ -3755,7 +4102,7 @@ var Ri = class {
3755
4102
  }
3756
4103
  return g;
3757
4104
  }
3758
- }, zi = /* @__PURE__ */ A(((e, t) => {
4105
+ }, ra = /* @__PURE__ */ A(((e, t) => {
3759
4106
  t.exports = class {
3760
4107
  constructor() {
3761
4108
  this.keys = /* @__PURE__ */ new Set(), this.queue = [];
@@ -3785,14 +4132,14 @@ var Ri = class {
3785
4132
  return this.queue.find((t) => t.key === e);
3786
4133
  }
3787
4134
  };
3788
- })), Bi = /* @__PURE__ */ A(((e, t) => {
4135
+ })), ia = /* @__PURE__ */ A(((e, t) => {
3789
4136
  function n(e, t) {
3790
4137
  let r = /* @__PURE__ */ new Map();
3791
4138
  for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
3792
4139
  return r;
3793
4140
  }
3794
4141
  t.exports = n;
3795
- })), Vi = /* @__PURE__ */ A(((e, t) => {
4142
+ })), aa = /* @__PURE__ */ A(((e, t) => {
3796
4143
  function n(e) {
3797
4144
  let t = Number(e);
3798
4145
  return !(isNaN(t) || t <= 0);
@@ -3807,7 +4154,7 @@ var Ri = class {
3807
4154
  }), t;
3808
4155
  }
3809
4156
  t.exports = r;
3810
- })), Hi = /* @__PURE__ */ A(((e, t) => {
4157
+ })), oa = /* @__PURE__ */ A(((e, t) => {
3811
4158
  function n(e) {
3812
4159
  if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
3813
4160
  e.forEach((e, t) => {
@@ -3819,8 +4166,8 @@ var Ri = class {
3819
4166
  });
3820
4167
  }
3821
4168
  t.exports = n;
3822
- })), Ui = /* @__PURE__ */ Te((/* @__PURE__ */ A(((e, t) => {
3823
- var n = zi(), r = Bi(), i = Vi(), a = Hi();
4169
+ })), sa = /* @__PURE__ */ Te((/* @__PURE__ */ A(((e, t) => {
4170
+ var n = ra(), r = ia(), i = aa(), a = oa();
3824
4171
  t.exports = class {
3825
4172
  constructor(e) {
3826
4173
  e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
@@ -3870,7 +4217,7 @@ var Ri = class {
3870
4217
  return this.path(...e);
3871
4218
  }
3872
4219
  };
3873
- })))(), 1), Wi = {
4220
+ })))(), 1), ca = {
3874
4221
  1: "north",
3875
4222
  2: "northeast",
3876
4223
  3: "northwest",
@@ -3883,7 +4230,7 @@ var Ri = class {
3883
4230
  10: "down",
3884
4231
  11: "in",
3885
4232
  12: "out"
3886
- }, Gi = {
4233
+ }, la = {
3887
4234
  north: "n",
3888
4235
  northeast: "ne",
3889
4236
  northwest: "nw",
@@ -3896,7 +4243,7 @@ var Ri = class {
3896
4243
  down: "down",
3897
4244
  in: "in",
3898
4245
  out: "out"
3899
- }, Ki = class {
4246
+ }, ua = class {
3900
4247
  constructor(e) {
3901
4248
  this.mapReader = e, this.data = this.buildGraph();
3902
4249
  }
@@ -3922,12 +4269,12 @@ var Ri = class {
3922
4269
  buildGraph() {
3923
4270
  let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
3924
4271
  return this.mapReader.getRooms().forEach((i) => {
3925
- let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Wi[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
4272
+ let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => ca[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
3926
4273
  Object.entries(i.exits ?? {}).forEach(([e, t]) => {
3927
4274
  if (s.has(e)) return;
3928
4275
  let c = this.mapReader.getRoom(t);
3929
4276
  if (c) {
3930
- let s = Gi[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
4277
+ let s = la[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
3931
4278
  a.push({
3932
4279
  id: t,
3933
4280
  weight: l
@@ -3958,7 +4305,7 @@ var Ri = class {
3958
4305
  };
3959
4306
  //#endregion
3960
4307
  //#region src/PathFinder.ts
3961
- function qi(e, t) {
4308
+ function da(e, t) {
3962
4309
  e.push(t);
3963
4310
  let n = e.length - 1;
3964
4311
  for (; n > 0;) {
@@ -3967,7 +4314,7 @@ function qi(e, t) {
3967
4314
  [e[t], e[n]] = [e[n], e[t]], n = t;
3968
4315
  }
3969
4316
  }
3970
- function Ji(e) {
4317
+ function fa(e) {
3971
4318
  if (e.length === 0) return;
3972
4319
  let t = e[0], n = e.pop();
3973
4320
  if (e.length > 0) {
@@ -3981,16 +4328,16 @@ function Ji(e) {
3981
4328
  }
3982
4329
  return t;
3983
4330
  }
3984
- function Yi(e, t, n) {
4331
+ function pa(e, t, n) {
3985
4332
  let r = [n], i = n;
3986
4333
  for (; i !== t;) i = e.get(i), r.push(i);
3987
4334
  return r.reverse(), r;
3988
4335
  }
3989
- function Xi(e, t, n) {
4336
+ function ma(e, t, n) {
3990
4337
  let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
3991
4338
  return i ? i.map((e) => Number(e)) : null;
3992
4339
  }
3993
- function Zi(e, t, n, r) {
4340
+ function ha(e, t, n, r) {
3994
4341
  let i = r.getRoom(n);
3995
4342
  if (!i) return null;
3996
4343
  let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
@@ -3999,16 +4346,16 @@ function Zi(e, t, n, r) {
3999
4346
  let n = t.x - a, i = t.y - o, u = t.z - s;
4000
4347
  return Math.sqrt(n * n + i * i + u * u) / c * l;
4001
4348
  }, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
4002
- for (d.set(t, 0), qi(p, {
4349
+ for (d.set(t, 0), da(p, {
4003
4350
  id: t,
4004
4351
  priority: u(t)
4005
4352
  }); p.length > 0;) {
4006
- let { id: r } = Ji(p);
4007
- if (r === n) return Yi(f, t, n);
4353
+ let { id: r } = fa(p);
4354
+ if (r === n) return pa(f, t, n);
4008
4355
  let i = d.get(r) ?? Infinity, a = e.get(r);
4009
4356
  if (a) for (let e of a) {
4010
4357
  let t = i + e.weight;
4011
- t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), qi(p, {
4358
+ t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), da(p, {
4012
4359
  id: e.id,
4013
4360
  priority: t + u(e.id)
4014
4361
  }));
@@ -4016,9 +4363,9 @@ function Zi(e, t, n, r) {
4016
4363
  }
4017
4364
  return null;
4018
4365
  }
4019
- var Qi = class {
4366
+ var ga = class {
4020
4367
  constructor(e, t = "dijkstra") {
4021
- this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Ki(e), this.dijkstraGraph = new Ui.default(this.mapGraph.getGraphDefinition());
4368
+ this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new ua(e), this.dijkstraGraph = new sa.default(this.mapGraph.getGraphDefinition());
4022
4369
  }
4023
4370
  get algorithm() {
4024
4371
  return this._algorithm;
@@ -4037,10 +4384,10 @@ var Qi = class {
4037
4384
  let r;
4038
4385
  switch (this._algorithm) {
4039
4386
  case "dijkstra":
4040
- r = Xi(this.dijkstraGraph, e, t);
4387
+ r = ma(this.dijkstraGraph, e, t);
4041
4388
  break;
4042
4389
  case "astar":
4043
- r = Zi(this.mapGraph.getAdj(), e, t, this.mapGraph);
4390
+ r = ha(this.mapGraph.getAdj(), e, t, this.mapGraph);
4044
4391
  break;
4045
4392
  }
4046
4393
  return this.cache.set(n, r), r;
@@ -4050,10 +4397,10 @@ var Qi = class {
4050
4397
  stub: 1,
4051
4398
  full: 0
4052
4399
  };
4053
- function $i(e, t, n) {
4400
+ function _a(e, t, n) {
4054
4401
  return n === "first" ? e : n === "least-restrictive" ? $[e] < $[t] ? e : t : $[e] > $[t] ? e : t;
4055
4402
  }
4056
- function ea(e, ...t) {
4403
+ function va(e, ...t) {
4057
4404
  let n = {}, r;
4058
4405
  e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
4059
4406
  let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
@@ -4069,7 +4416,7 @@ function ea(e, ...t) {
4069
4416
  for (let o of r) {
4070
4417
  let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : d(o, e, t, n);
4071
4418
  if (a === void 0) a = r;
4072
- else if (a = $i(a, r, i), i === "first") break;
4419
+ else if (a = _a(a, r, i), i === "first") break;
4073
4420
  }
4074
4421
  return a ?? "full";
4075
4422
  },
@@ -4082,7 +4429,7 @@ function ea(e, ...t) {
4082
4429
  }
4083
4430
  //#endregion
4084
4431
  //#region src/lens/ExplorationLens.ts
4085
- var ta = class {
4432
+ var ya = class {
4086
4433
  constructor(e) {
4087
4434
  this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
4088
4435
  }
@@ -4117,7 +4464,7 @@ var ta = class {
4117
4464
  clear() {
4118
4465
  this.visited.size !== 0 && (this.visited.clear(), this.version++);
4119
4466
  }
4120
- }, na = {
4467
+ }, ba = {
4121
4468
  1: "north",
4122
4469
  2: "northeast",
4123
4470
  3: "northwest",
@@ -4131,7 +4478,7 @@ var ta = class {
4131
4478
  11: "in",
4132
4479
  12: "out"
4133
4480
  };
4134
- function ra() {
4481
+ function xa() {
4135
4482
  return {
4136
4483
  areaWidth: 150,
4137
4484
  areaHeight: 80,
@@ -4145,9 +4492,9 @@ function ra() {
4145
4492
  highlightColor: "#ff9900"
4146
4493
  };
4147
4494
  }
4148
- var ia = class {
4495
+ var Sa = class {
4149
4496
  constructor(e, t, n) {
4150
- this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? ra(), this.stage = new k.Stage({
4497
+ this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? xa(), this.stage = new k.Stage({
4151
4498
  container: e,
4152
4499
  width: e.clientWidth,
4153
4500
  height: e.clientHeight,
@@ -4337,7 +4684,7 @@ var ia = class {
4337
4684
  }
4338
4685
  }
4339
4686
  getLockedDirections(e) {
4340
- return new Set((e.exitLocks ?? []).map((e) => na[e]).filter((e) => !!e));
4687
+ return new Set((e.exitLocks ?? []).map((e) => ba[e]).filter((e) => !!e));
4341
4688
  }
4342
4689
  createConnection(e, t, n) {
4343
4690
  let r = this.toPlanarDirection(n);
@@ -4949,6 +5296,6 @@ var ia = class {
4949
5296
  }
4950
5297
  };
4951
5298
  //#endregion
4952
- export { u as ALL_VISIBLE, wi as AmbientLightOverlay, he as Area, ia as AreaMapRenderer, Mr as Blueprint, D as Camera, _i as CanvasExporter, Ir as Construction, ne as CullingManager, Ur as DarkModern, ze as DrawCommandLayerNode, ta as ExplorationLens, Rr as GradientRooms, Br as GraphPaper, oe as HitTester, e as IDENTITY_TRANSFORM, Fr as Isometric, Ki as MapGraph, _e as MapReader, Gr as MapRenderer, Ae as MapState, Be as MaterializingLayerNode, Nr as Neon, jr as Parchment, Qi as PathFinder, ge as Plane, hi as PngBlobExporter, vi as PngBytesExporter, mi as PngExporter, ee as ProjectedMapReader, a as ROOM_UI_BORDER_COLOR, c as ROOM_UI_BORDER_THICKNESS, l as ROOM_UI_HIDDEN, Le as RecordingGroupNode, N as RecordingLayerNode, Oi as RippleEffect, Lr as SciFi, Pr as Sketchy, zr as StainedGlass, pi as SvgExporter, Vr as Topographic, Wr as TreasureMap, Hr as Watercolor, Ri as WaypointOverlay, O as applyStyleToShapes, qr as buildDrawCommands, gi as canvasToBytes, s as colorLightness, te as compose, ea as composeLenses, b as computeNeighborSpill, se as computePathData, ra as createAreaMapSettings, ke as createSettings, _ as darkenColor, d as defaultExitTreatment, m as getRoomBorderColor, me as getRoomBorderThickness, y as hexToRgba, x as identityStyle, Ve as isGradientFill, v as isRoomHidden, Li as placeLabels, ue as projectRoom, si as renderToCanvas, Ue as shapeToRecording, pe as spillPositionMap, ri as svgFromBatches, P as transformFill, Ar as treasureMapDecorations };
5299
+ export { u as ALL_VISIBLE, Hi as AmbientLightOverlay, ge as Area, Sa as AreaMapRenderer, Xr as Blueprint, D as Camera, Fi as CanvasExporter, ei as Construction, ne as CullingManager, si as DarkModern, Ge as DrawCommandLayerNode, ya as ExplorationLens, ni as GradientRooms, ii as GraphPaper, oe as HitTester, e as IDENTITY_TRANSFORM, $r as Isometric, ua as MapGraph, _e as MapReader, li as MapRenderer, Ae as MapState, Ke as MaterializingLayerNode, Zr as Neon, Yr as Parchment, ga as PathFinder, he as Plane, Ni as PngBlobExporter, Ii as PngBytesExporter, Mi as PngExporter, ee as ProjectedMapReader, a as ROOM_UI_BORDER_COLOR, c as ROOM_UI_BORDER_THICKNESS, l as ROOM_UI_HIDDEN, Ue as RecordingGroupNode, N as RecordingLayerNode, Ki as RippleEffect, ti as SciFi, Qr as Sketchy, ri as StainedGlass, ji as SvgExporter, ai as Topographic, ci as TreasureMap, oi as Watercolor, na as WaypointOverlay, O as applyStyleToShapes, di as buildDrawCommands, Pi as canvasToBytes, s as colorLightness, te as compose, va as composeLenses, st as computeLodMode, b as computeNeighborSpill, se as computePathData, xa as createAreaMapSettings, ke as createSettings, _ as darkenColor, d as defaultExitTreatment, m as getRoomBorderColor, me as getRoomBorderThickness, y as hexToRgba, x as identityStyle, qe as isGradientFill, v as isRoomHidden, F as isViewportDataSource, ta as placeLabels, ue as projectRoom, Ti as renderToCanvas, Ye as shapeToRecording, ot as shouldUseRaster, pe as spillPositionMap, xi as svgFromBatches, P as transformFill, Jr as treasureMapDecorations };
4953
5300
 
4954
5301
  //# sourceMappingURL=index.mjs.map