mudlet-map-renderer 2.5.1 → 2.6.1

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.
Files changed (37) hide show
  1. package/README.md +68 -0
  2. package/dist/Area-MLM4Xe0E.js +157 -0
  3. package/dist/Area-MLM4Xe0E.js.map +1 -0
  4. package/dist/MapReader-BeVNpm6y.js +77 -0
  5. package/dist/MapReader-BeVNpm6y.js.map +1 -0
  6. package/dist/SkeletonMapReader-ZPwsqemZ.js +351 -0
  7. package/dist/SkeletonMapReader-ZPwsqemZ.js.map +1 -0
  8. package/dist/bigmap/PlaneIndex.d.ts +42 -0
  9. package/dist/bigmap/Skeleton.d.ts +60 -0
  10. package/dist/bigmap/SkeletonMapReader.d.ts +65 -0
  11. package/dist/bigmap/buildSkeleton.d.ts +23 -0
  12. package/dist/bigmap/index.d.ts +24 -0
  13. package/dist/bigmap.mjs +61 -0
  14. package/dist/bigmap.mjs.map +1 -0
  15. package/dist/binary/convert.d.ts +19 -0
  16. package/dist/binary/index.d.ts +2 -0
  17. package/dist/binary/loadMudletMap.d.ts +62 -0
  18. package/dist/binary.mjs +195 -8
  19. package/dist/binary.mjs.map +1 -1
  20. package/dist/export/exportViewport.d.ts +25 -0
  21. package/dist/index.d.ts +7 -1
  22. package/dist/index.mjs +978 -601
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/reader/Area.d.ts +8 -2
  25. package/dist/reader/HashLookup.d.ts +17 -0
  26. package/dist/reader/ViewportDataSource.d.ts +33 -0
  27. package/dist/render/CullIndex.d.ts +54 -0
  28. package/dist/rendering/KonvaRenderBackend.d.ts +68 -0
  29. package/dist/rendering/SceneManager.d.ts +28 -5
  30. package/dist/rendering/lod/LodController.d.ts +45 -0
  31. package/dist/rendering/lod/RasterOverview.d.ts +46 -0
  32. package/dist/rendering/lod/lodDecision.d.ts +45 -0
  33. package/dist/rendering/lod/roomsOnlyArea.d.ts +16 -0
  34. package/dist/types/Settings.d.ts +63 -0
  35. package/package.json +9 -4
  36. package/dist/MapReader-Brzg-X7T.js +0 -224
  37. package/dist/MapReader-Brzg-X7T.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,22 +1,23 @@
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";
3
- import k from "konva";
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 ee, f as te, g as ne, h as w, i as re, j as T, k as ie, l as ae, m as oe, n as se, o as ce, p as le, r as E, s as ue, u as de, v as fe, w as pe, x as me, y as he, z as ge } from "./flushSceneShapes-c7ttw7D-.js";
2
+ import { r as _e, t as ve } from "./Area-MLM4Xe0E.js";
3
+ import { t as ye } from "./MapReader-BeVNpm6y.js";
4
+ import D from "konva";
4
5
  //#region \0rolldown/runtime.js
5
- 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) => {
6
- if (t && typeof t == "object" || typeof t == "function") for (var i = xe(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ce.call(e, s) && s !== n && ye(e, s, {
6
+ var be = Object.create, xe = Object.defineProperty, Se = Object.getOwnPropertyDescriptor, Ce = Object.getOwnPropertyNames, we = Object.getPrototypeOf, Te = Object.prototype.hasOwnProperty, O = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Ee = (e, t, n, r) => {
7
+ if (t && typeof t == "object" || typeof t == "function") for (var i = Ce(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Te.call(e, s) && s !== n && xe(e, s, {
7
8
  get: ((e) => t[e]).bind(null, s),
8
- enumerable: !(r = be(t, s)) || r.enumerable
9
+ enumerable: !(r = Se(t, s)) || r.enumerable
9
10
  });
10
11
  return e;
11
- }, Te = (e, t, n) => (n = e == null ? {} : ve(Se(e)), we(t || !e || !e.__esModule ? ye(n, "default", {
12
+ }, De = (e, t, n) => (n = e == null ? {} : be(we(e)), Ee(t || !e || !e.__esModule ? xe(n, "default", {
12
13
  value: e,
13
14
  enumerable: !0
14
- }) : n, e)), Ee = .6, De = .025, Oe = "rgb(225, 225, 225)";
15
- function ke() {
15
+ }) : n, e)), Oe = .6, ke = .025, Ae = "rgb(225, 225, 225)";
16
+ function je() {
16
17
  return {
17
- roomSize: Ee,
18
- lineWidth: De,
19
- lineColor: Oe,
18
+ roomSize: Oe,
19
+ lineWidth: ke,
20
+ lineColor: Ae,
20
21
  backgroundColor: "#000000",
21
22
  instantMapMove: !1,
22
23
  highlightCurrentRoom: !0,
@@ -63,12 +64,16 @@ 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
70
75
  //#region src/MapState.ts
71
- var Ae = class {
76
+ var Me = class {
72
77
  constructor(e, t) {
73
78
  this.events = new p(), this.highlights = /* @__PURE__ */ new Map(), this.paths = [], this.lens = u, this.mapReader = e, this.settings = t;
74
79
  }
@@ -203,7 +208,7 @@ var Ae = class {
203
208
  };
204
209
  //#endregion
205
210
  //#region src/scene/elements/GridLayout.ts
206
- function je(e, t, n = {}) {
211
+ function Ne(e, t, n = {}) {
207
212
  if (!t.gridEnabled) return [];
208
213
  let r = n.inverseTransform ?? ((e, t) => ({
209
214
  x: e,
@@ -240,11 +245,11 @@ function je(e, t, n = {}) {
240
245
  }
241
246
  //#endregion
242
247
  //#region src/export/clipSceneToViewport.ts
243
- function Me(e, t, n, r) {
248
+ function Pe(e, t, n, r) {
244
249
  if (!n.cullingEnabled) return /* @__PURE__ */ new Map();
245
250
  let { minX: i, maxX: a, minY: o, maxY: s } = t, c = n.roomSize / 2, l = r?.forward, u = (e, t, n, r) => {
246
251
  if (l) {
247
- let c = Ne(e, t, n, r, l);
252
+ let c = Fe(e, t, n, r, l);
248
253
  return c.maxX >= i && c.minX <= a && c.maxY >= o && c.minY <= s;
249
254
  }
250
255
  return n >= i && e <= a && r >= o && t <= s;
@@ -257,7 +262,7 @@ function Me(e, t, n, r) {
257
262
  for (let { shape: t, bounds: n } of e.areaExitLabelShapeRefs) d.set(t, u(n.x, n.y, n.x + n.width, n.y + n.height));
258
263
  return d;
259
264
  }
260
- function Ne(e, t, n, r, i) {
265
+ function Fe(e, t, n, r, i) {
261
266
  let a = i(e, t), o = i(n, t), s = i(n, r), c = i(e, r);
262
267
  return {
263
268
  minX: Math.min(a.x, o.x, s.x, c.x),
@@ -266,13 +271,13 @@ function Ne(e, t, n, r, i) {
266
271
  maxY: Math.max(a.y, o.y, s.y, c.y)
267
272
  };
268
273
  }
269
- function Pe(e, t, n, r) {
270
- let i = je(t, n, { inverseTransform: r?.inverse });
274
+ function Ie(e, t, n, r) {
275
+ let i = Ne(t, n, { inverseTransform: r?.inverse });
271
276
  if (!n.cullingEnabled) return {
272
277
  ...e.sceneShapes,
273
278
  grid: i
274
279
  };
275
- let a = Me(e, t, n, r);
280
+ let a = Pe(e, t, n, r);
276
281
  return {
277
282
  grid: i,
278
283
  link: e.sceneShapes.link.filter((e) => a.get(e) ?? !0),
@@ -281,15 +286,99 @@ function Pe(e, t, n, r) {
281
286
  };
282
287
  }
283
288
  //#endregion
289
+ //#region src/render/CullIndex.ts
290
+ var Le = 256, Re = 2, ze = 32, Be = 1 << 20, Ve = 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 < Le) {
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 / Re, 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 > Be;) 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) > ze) {
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 He(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 Ue = {
286
375
  grid: [],
287
376
  link: [],
288
377
  room: [],
289
378
  topLabel: []
290
- }, Ie = class {
379
+ }, We = class {
291
380
  constructor(e, t, n) {
292
- this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new E(n, t);
381
+ this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new w(n, t);
293
382
  }
294
383
  get exitRenderer() {
295
384
  return this.pipeline.exitRenderer;
@@ -313,32 +402,61 @@ 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
- this.pipeline = new E(e, this.settings), this.reset();
414
+ this.pipeline = new w(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 Ve();
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 = He(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: Ue,
335
453
  stats: {
336
454
  visibleRooms: 0,
337
455
  totalRooms: 0,
338
456
  visibleExits: 0
339
457
  }
340
458
  };
341
- let n = this.camera.getCullingViewport(this.settings.cullingBounds), r = t === e ? void 0 : { forward: t }, i = Pe(this.lastBuildResult, n, this.settings, r);
459
+ let n = this.camera.getCullingViewport(this.settings.cullingBounds), r = t === e ? void 0 : { forward: t }, i = Ie(this.lastBuildResult, n, this.settings, r);
342
460
  return {
343
461
  shapes: i,
344
462
  stats: {
@@ -351,7 +469,7 @@ var Fe = {
351
469
  };
352
470
  //#endregion
353
471
  //#region src/render/canvasGradient.ts
354
- function j(e, t) {
472
+ function k(e, t) {
355
473
  if (typeof t == "string") return t;
356
474
  if (t.type === "linear") {
357
475
  let n = e.createLinearGradient(t.x0, t.y0, t.x1, t.y1);
@@ -364,13 +482,13 @@ function j(e, t) {
364
482
  }
365
483
  //#endregion
366
484
  //#region src/render/RecordingLayer.ts
367
- function M(e, t) {
485
+ function A(e, t) {
368
486
  switch (t.type) {
369
487
  case "rect":
370
- 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, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
488
+ 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 = k(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
371
489
  break;
372
490
  case "circle":
373
- e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
491
+ e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = k(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
374
492
  break;
375
493
  case "line": {
376
494
  if (t.points.length < 4) break;
@@ -384,7 +502,7 @@ function M(e, t) {
384
502
  if (t.vertices.length < 4) break;
385
503
  e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
386
504
  for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
387
- e.closePath(), 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([]), e.stroke());
505
+ e.closePath(), t.fill && (e.fillStyle = k(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
388
506
  break;
389
507
  case "text": {
390
508
  let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
@@ -421,7 +539,7 @@ function M(e, t) {
421
539
  break;
422
540
  }
423
541
  }
424
- var Le = class {
542
+ var Ge = class {
425
543
  constructor(e, t) {
426
544
  this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
427
545
  }
@@ -451,32 +569,32 @@ var Le = class {
451
569
  }
452
570
  materialize() {
453
571
  if (this._konvaGroup) return this._konvaGroup;
454
- let e = new k.Group({
572
+ let e = new D.Group({
455
573
  x: this.x,
456
574
  y: this.y,
457
575
  listening: !1,
458
576
  visible: this._visible
459
577
  }), t = this.commands;
460
- return e.add(new k.Shape({
578
+ return e.add(new D.Shape({
461
579
  listening: !1,
462
580
  perfectDrawEnabled: !1,
463
581
  sceneFunc: (e) => {
464
582
  let n = e._context;
465
- for (let e of t) M(n, e);
583
+ for (let e of t) A(n, e);
466
584
  }
467
585
  })), this._konvaGroup = e, e;
468
586
  }
469
587
  };
470
- function Re(e) {
588
+ function Ke(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 qe = 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;
479
- this.konvaShape = new k.Shape({
597
+ this.konvaShape = new D.Shape({
480
598
  listening: !1,
481
599
  perfectDrawEnabled: !1,
482
600
  sceneFunc: (e) => {
@@ -491,7 +609,7 @@ var ze = class {
491
609
  if (!o.visible) continue;
492
610
  let s = n * o.x + i * o.y + t.e, c = r * o.x + a * o.y + t.f;
493
611
  o.noScaling ? e.setTransform(75, 0, 0, 75, s, c) : e.setTransform(n, r, i, a, s, c);
494
- for (let t of o.commands) M(e, t);
612
+ for (let t of o.commands) A(e, t);
495
613
  }
496
614
  e.setTransform(t);
497
615
  }
@@ -504,11 +622,11 @@ 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 = Ke(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);
511
- for (let n of t.commands) M(e, n);
629
+ for (let n of t.commands) A(e, n);
512
630
  } else {
513
631
  let e = l.get(u);
514
632
  e || l.set(u, e = []), e.push(t);
@@ -564,11 +682,11 @@ var ze = class {
564
682
  ensureShape() {
565
683
  this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
566
684
  }
567
- }, N = class {
685
+ }, j = class {
568
686
  constructor(e) {
569
687
  this.groups = [], this.konvaLayer = e, e.destroyChildren();
570
688
  let t = this;
571
- this.konvaShape = new k.Shape({
689
+ this.konvaShape = new D.Shape({
572
690
  listening: !1,
573
691
  perfectDrawEnabled: !1,
574
692
  sceneFunc: (e) => {
@@ -577,7 +695,7 @@ var ze = class {
577
695
  if (!e._visible) continue;
578
696
  let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
579
697
  e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
580
- for (let t of e.commands) M(n, t);
698
+ for (let t of e.commands) A(n, t);
581
699
  }
582
700
  n.setTransform(r);
583
701
  }
@@ -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
+ }, Je = 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 Ye(e) {
615
733
  return typeof e == "object" && !!e;
616
734
  }
617
- function He(e, t) {
735
+ function Xe(e, t) {
618
736
  return t !== !1 && e ? e : void 0;
619
737
  }
620
- function P(e, t, n, r, i, a) {
621
- return Ve(e) ? e.type === "linear" ? {
738
+ function M(e, t, n, r, i, a) {
739
+ return Ye(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 Ze(e) {
760
+ let t = new Ge(e.x, e.y);
761
+ return e.noScale && (t.noScaling = !0), t.layer = e.layer, Qe(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 Qe(e, t, n, r) {
764
+ for (let i of t) $e(e, i, n, r);
647
765
  }
648
- function Ge(e, t, n, r) {
766
+ function $e(e, t, n, r) {
649
767
  switch (t.type) {
650
768
  case "rect":
651
769
  e.commands.push({
@@ -654,11 +772,11 @@ function Ge(e, t, n, r) {
654
772
  y: t.y + r,
655
773
  w: t.width,
656
774
  h: t.height,
657
- fill: P(t.paint.fill, n, r, 1, 0, 0),
775
+ fill: M(t.paint.fill, n, r, 1, 0, 0),
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: Xe(t.paint.dash, t.paint.dashEnabled)
662
780
  });
663
781
  return;
664
782
  case "circle":
@@ -667,20 +785,20 @@ function Ge(e, t, n, r) {
667
785
  cx: t.cx + n,
668
786
  cy: t.cy + r,
669
787
  r: t.radius,
670
- fill: P(t.paint.fill, n, r, 1, 0, 0),
788
+ fill: M(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: Xe(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 : et(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: Xe(t.paint.dash, t.paint.dashEnabled),
684
802
  lineCap: t.lineCap,
685
803
  lineJoin: t.lineJoin,
686
804
  alpha: t.paint.alpha
@@ -690,8 +808,8 @@ 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),
694
- fill: P(t.paint.fill, n, r, 1, 0, 0),
811
+ vertices: n === 0 && r === 0 ? t.vertices : et(t.vertices, n, r),
812
+ fill: M(t.paint.fill, n, r, 1, 0, 0),
695
813
  stroke: t.paint.stroke,
696
814
  sw: t.paint.strokeWidth ?? 0
697
815
  });
@@ -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 = tt(t.src);
721
839
  e.commands.push({
722
840
  type: "image",
723
841
  x: t.x + n,
@@ -730,42 +848,166 @@ 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
+ Qe(e, t.children, n + t.x, r + t.y);
734
852
  return;
735
853
  }
736
854
  }
737
- function Ke(e, t, n) {
855
+ function et(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) {
743
- let t = k === void 0 ? typeof Image < "u" ? new Image() : null : k.Util.createImageElement();
860
+ function tt(e) {
861
+ let t = D === void 0 ? typeof Image < "u" ? new Image() : null : D.Util.createImageElement();
744
862
  return t && (t.src = e), t;
745
863
  }
746
864
  //#endregion
865
+ //#region src/reader/ViewportDataSource.ts
866
+ function N(e) {
867
+ return !!e && e.viewportAware === !0;
868
+ }
869
+ //#endregion
870
+ //#region src/rendering/lod/RasterOverview.ts
871
+ function nt(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 rt(e, t, n) {
876
+ let r = e.width, i = e.height, a = new Uint32Array(e.data.buffer), o = nt(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 it(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 at = .25, ot = 8192, st = 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 = it(this.colorCss(e)), this.packedCache.set(e, t)), t;
906
+ }, this.canvas = D.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) * at, i = (t.maxY - t.minY) * at, 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(ot, Math.max(1, Math.ceil((a.maxX - a.minX) * n))), s = Math.min(ot, 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
+ rt(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 D.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 ct(e) {
962
+ return e.planeRoomCount > e.roomBudget && e.scale * e.scale < e.stageWidth * e.stageHeight / e.roomBudget;
963
+ }
964
+ function lt(e) {
965
+ return ct({
966
+ ...e,
967
+ roomBudget: e.roomBudget
968
+ }) ? "raster" : e.exitBudget !== void 0 && ct({
969
+ ...e,
970
+ roomBudget: e.exitBudget
971
+ }) ? "roomsOnly" : "vector";
972
+ }
973
+ //#endregion
974
+ //#region src/rendering/lod/roomsOnlyArea.ts
975
+ function ut(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 P = "rgb(120, 72, 0)", dt = .5, ft = (1 + 2 * dt) ** 2, pt = 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 ce(), 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 D.Stage({
754
996
  container: n,
755
997
  width: n.clientWidth,
756
998
  height: n.clientHeight,
757
999
  draggable: !1
758
- }), n.style.backgroundColor = t.settings.backgroundColor, this.camera = new D(n.clientWidth, n.clientHeight)) : (this.stage = new k.Stage({
1000
+ }), n.style.backgroundColor = t.settings.backgroundColor, this.camera = new T(n.clientWidth, n.clientHeight)) : (this.stage = new D.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);
762
- 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) {
1003
+ }), this.camera = new T(1, 1)), this.lodLayer = new D.Layer({ listening: !1 }), this.stage.add(this.lodLayer), this.gridLayer = new D.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
1004
+ let r = new D.Layer({ listening: !1 });
1005
+ if (this.linkLayer = r, this.roomLayer = r, this.stage.add(r), this.positionLayer = new D.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new D.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new D.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Je(this.positionLayer), this.overlayLayerNode = new Je(this.overlayLayer), this.sceneNode = new qe(r, () => t.settings.coalesceRooms), this.gridLayerNode = new j(this.gridLayer), this.topLabelLayerNode = new j(this.topLabelLayer), this.sceneManager = new We(this.camera, t.settings, t.mapReader), this.lodController = new st(this.lodLayer, this.camera, (e) => this.state.mapReader.getColorValue(e), () => this.state.settings.roomSize), this.events = new p(n), this.culling = new ie(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) => {
767
1009
  e(t, n), this.stage.width(t), this.stage.height(n);
768
- }, this.interactionHandler = new ie(n, this.camera, t, {
1010
+ }, this.interactionHandler = new oe(n, this.camera, t, {
769
1011
  clientToMapPoint: (e, t) => this.camera.clientToMapPoint(e, t, n.getBoundingClientRect()),
770
1012
  pickAtPoint: (e, t) => this.hitTester.pick(e, t)
771
1013
  }, this.events);
@@ -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 qe(this.linkLayer, () => this.state.settings.coalesceRooms), this.gridLayerNode = new j(this.gridLayer), this.topLabelLayerNode = new j(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 && N(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 (N(i) && this.hasRealViewport()) {
1113
+ let e = this.padViewport(this.camera.getViewportBounds()), t = He(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" ? ut(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) * dt + 1, n = (e.maxY - e.minY) * dt + 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 N(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 ? lt({
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 / ft,
1155
+ exitBudget: e.lodExitBudget / ft
1156
+ }) : "vector";
1157
+ }
1158
+ rasterVisit(e, t, n) {
1159
+ let r = this.state.mapReader;
1160
+ if (N(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 = N(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);
@@ -919,7 +1256,7 @@ var F = "rgb(120, 72, 0)", Je = class {
919
1256
  buildScene(e, t, n) {
920
1257
  this.positionLayer.destroyChildren(), this.positionMarker = void 0, this.clearOverlayShapes(), this.currentRoomOverlay = [], this.sceneNode.destroyChildren(), this.gridLayerNode.destroyChildren(), this.gridCachedBounds = null, this.topLabelLayerNode.destroyChildren();
921
1258
  let r = this.computeNeighborSpill(e, n);
922
- this.spilledRoomPositions = r ? pe(r) : /* @__PURE__ */ new Map();
1259
+ this.spilledRoomPositions = r ? he(r) : /* @__PURE__ */ new Map();
923
1260
  let i = this.sceneManager.rebuild(e, t, n, this.state.lens, r);
924
1261
  this.shapeToGroup = /* @__PURE__ */ new Map(), this.refreshGrid(this.camera.getViewportBounds());
925
1262
  for (let e of i.sceneShapes.link) {
@@ -943,10 +1280,10 @@ var F = "rgb(120, 72, 0)", Je = class {
943
1280
  return b(this.state.mapReader, e.getAreaId(), t, r, n.neighborSpillDistance, (e) => a.isVisible(e));
944
1281
  }
945
1282
  overlayReader() {
946
- return this.spilledRoomPositions.size === 0 || this.state.currentArea === void 0 || this.state.currentZIndex === void 0 ? this.state.mapReader : new ee(this.state.mapReader, this.state.currentArea, this.state.currentZIndex, this.spilledRoomPositions);
1283
+ return this.spilledRoomPositions.size === 0 || this.state.currentArea === void 0 || this.state.currentZIndex === void 0 ? this.state.mapReader : new ne(this.state.mapReader, this.state.currentArea, this.state.currentZIndex, this.spilledRoomPositions);
947
1284
  }
948
1285
  addStyledShape(e, t, n = !1) {
949
- let r = n || this.currentStyle === x ? [e] : O([e], this.currentStyle, this.styleContext());
1286
+ let r = n || this.currentStyle === x ? [e] : E([e], this.currentStyle, this.styleContext());
950
1287
  if (r.length === 0) return;
951
1288
  let i;
952
1289
  i = r.length === 1 && r[0].type === "group" ? r[0] : {
@@ -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 = Ze(i);
961
1298
  return t.addNode(a), a;
962
1299
  }
963
1300
  refreshGrid(e) {
@@ -969,7 +1306,7 @@ var F = "rgb(120, 72, 0)", Je = class {
969
1306
  let n = this.coordinateInverse, r = n(e.minX, e.minY), i = n(e.maxX, e.minY), a = n(e.maxX, e.maxY), o = n(e.minX, e.maxY), s = Math.min(r.x, i.x, a.x, o.x), c = Math.max(r.x, i.x, a.x, o.x), l = Math.min(r.y, i.y, a.y, o.y), u = Math.max(r.y, i.y, a.y, o.y), d = t.gridSize * 2, f = Math.floor((s - d) / t.gridSize) * t.gridSize, p = Math.ceil((c + d) / t.gridSize) * t.gridSize, m = Math.floor((l - d) / t.gridSize) * t.gridSize, h = Math.ceil((u + d) / t.gridSize) * t.gridSize, g = this.gridCachedBounds;
970
1307
  if (g && g.left === f && g.right === p && g.top === m && g.bottom === h) return;
971
1308
  this.gridLayerNode.destroyChildren();
972
- let _ = je(e, t, { inverseTransform: this.coordinateInverse });
1309
+ let _ = Ne(e, t, { inverseTransform: this.coordinateInverse });
973
1310
  for (let e of _) this.addStyledShape(e, this.gridLayerNode);
974
1311
  this.gridCachedBounds = {
975
1312
  left: f,
@@ -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) {
@@ -1019,8 +1362,8 @@ var F = "rgb(120, 72, 0)", Je = class {
1019
1362
  this.positionLayerNode.batchDraw();
1020
1363
  return;
1021
1364
  }
1022
- let t = T(e, this.state.settings);
1023
- this.positionMarker = this.addStyledShape(re(t), this.positionLayerNode);
1365
+ let t = te(e, this.state.settings);
1366
+ this.positionMarker = this.addStyledShape(ae(t), this.positionLayerNode);
1024
1367
  }
1025
1368
  clearCurrentRoomOverlay() {
1026
1369
  this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
@@ -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, P, 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, P)) o.push(h(t, e.id));
1398
+ for (let t of i(e, r, P)) o.push(me(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);
@@ -1056,8 +1403,8 @@ var F = "rgb(120, 72, 0)", Je = class {
1056
1403
  let t = this.addStyledShape(e, this.positionLayerNode);
1057
1404
  t && this.currentRoomOverlay.push(t);
1058
1405
  }), a.forEach((i, a) => {
1059
- let o = a === e.id, s = de(i, this.state.mapReader, r, {
1060
- strokeOverride: o ? F : r.lineColor,
1406
+ let o = a === e.id, s = pe(i, this.state.mapReader, r, {
1407
+ strokeOverride: o ? P : r.lineColor,
1061
1408
  flatPipeline: !0,
1062
1409
  ...t(i, r.hiddenRooms)
1063
1410
  });
@@ -1071,7 +1418,7 @@ var F = "rgb(120, 72, 0)", Je = class {
1071
1418
  if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
1072
1419
  let n = this.overlayReader().getRoom(e);
1073
1420
  if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
1074
- let r = le(n, t, this.state.settings), i = this.addStyledShape(ce(r), this.overlayLayerNode);
1421
+ let r = de(n, t, this.state.settings), i = this.addStyledShape(ue(r), this.overlayLayerNode);
1075
1422
  i && this.highlightShapes.set(e, i);
1076
1423
  }
1077
1424
  }
@@ -1084,7 +1431,7 @@ var F = "rgb(120, 72, 0)", Je = class {
1084
1431
  for (let [t] of this.state.highlights) {
1085
1432
  let n = e.getRoom(t);
1086
1433
  if (!n || n.area !== this.state.currentArea || n.z !== this.state.currentZIndex) continue;
1087
- let r = le(n, this.state.highlights.get(t).colors, this.state.settings), i = this.addStyledShape(ce(r), this.overlayLayerNode);
1434
+ let r = de(n, this.state.highlights.get(t).colors, this.state.settings), i = this.addStyledShape(ue(r), this.overlayLayerNode);
1088
1435
  i && this.highlightShapes.set(t, i);
1089
1436
  }
1090
1437
  this.overlayLayerNode.batchDraw();
@@ -1095,7 +1442,7 @@ var F = "rgb(120, 72, 0)", Je = class {
1095
1442
  if (e === void 0 || t === void 0) return;
1096
1443
  let n = this.overlayReader();
1097
1444
  for (let r of this.state.paths) {
1098
- let i = w(n, this.state.settings, r.locations, r.color, e, t);
1445
+ let i = ee(n, this.state.settings, r.locations, r.color, e, t);
1099
1446
  for (let e of C(i)) {
1100
1447
  let t = this.addStyledShape(e, this.overlayLayerNode);
1101
1448
  t && this.pathShapes.push(t);
@@ -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 F(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 I(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 L(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 R(e) {
1144
1491
  return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
1145
1492
  }
1146
- function Ye(e, t, n) {
1493
+ function mt(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 ht(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), L(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);
1174
- }
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);
1180
- }
1181
- function st(e) {
1515
+ var gt = "#4a3728", _t = "#3b2a1a", vt = 139, yt = 115, bt = 85, xt = 244, St = 228, Ct = 193;
1516
+ function wt(e) {
1517
+ let t = I(e);
1518
+ if (!t) return L(xt, St, Ct);
1519
+ let n = R(t);
1520
+ return L(Math.round(vt + (xt - vt) * n), Math.round(yt + (St - yt) * n), Math.round(bt + (Ct - bt) * n), t.a);
1521
+ }
1522
+ function Tt(e) {
1523
+ let t = I(e);
1524
+ if (!t || t.a >= 1) return gt;
1525
+ let n = I(gt);
1526
+ return L(n.r, n.g, n.b, t.a);
1527
+ }
1528
+ function Et(e) {
1182
1529
  return {
1183
1530
  ...e,
1184
- fill: I(e.fill, at),
1185
- stroke: e.stroke ? ot(e.stroke) : e.stroke
1531
+ fill: F(e.fill, wt),
1532
+ stroke: e.stroke ? Tt(e.stroke) : e.stroke
1186
1533
  };
1187
1534
  }
1188
- var ct = { transform(e) {
1535
+ var Dt = { 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: Et(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: Tt(e.paint.stroke)
1201
1548
  } : e.paint
1202
1549
  };
1203
1550
  case "text": return {
1204
1551
  ...e,
1205
- fill: Qe
1552
+ fill: _t
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
+ } }, Ot = "#c0deff", kt = "#e0f0ff", At = 20, jt = 40, Mt = 80, Nt = 60, Pt = 100, Ft = 160;
1558
+ function It(e) {
1559
+ let t = I(e);
1560
+ if (!t) return L(Nt, Pt, Ft);
1561
+ let n = R(t);
1562
+ return L(Math.round(At + (Nt - At) * n), Math.round(jt + (Pt - jt) * n), Math.round(Mt + (Ft - Mt) * 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 Lt(e) {
1565
+ let t = I(e);
1566
+ if (!t || t.a >= 1) return Ot;
1567
+ let n = I(Ot);
1568
+ return L(n.r, n.g, n.b, t.a);
1222
1569
  }
1223
- function yt(e) {
1570
+ function Rt(e) {
1224
1571
  return {
1225
1572
  ...e,
1226
- fill: I(e.fill, _t),
1227
- stroke: e.stroke ? vt(e.stroke) : e.stroke
1573
+ fill: F(e.fill, It),
1574
+ stroke: e.stroke ? Lt(e.stroke) : e.stroke
1228
1575
  };
1229
1576
  }
1230
- var bt = { transform(e) {
1577
+ var zt = { 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: Rt(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: Lt(e.paint.stroke)
1243
1590
  } : e.paint
1244
1591
  };
1245
1592
  case "text": return {
1246
1593
  ...e,
1247
- fill: ut
1594
+ fill: kt
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
+ } }, Bt = "#00ffd0", Vt = .3, Ht = 3;
1600
+ function Ut(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 z(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 Wt(e) {
1623
+ let t = I(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] = Ut(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 Gt(e) {
1635
+ let { h: t, a: n } = Wt(e);
1636
+ return z(t, .95, .65, n);
1290
1637
  }
1291
- function Ot(e) {
1292
- let t = L(e);
1638
+ function Kt(e) {
1639
+ let t = I(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] = Ut(t.r, t.g, t.b);
1642
+ return z(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 qt(e) {
1645
+ let { h: t, a: n } = Wt(e);
1646
+ return z(t, .95, .65, Math.min(n, Vt));
1300
1647
  }
1301
- function At(e) {
1648
+ function Jt(e) {
1302
1649
  return {
1303
1650
  ...e,
1304
- fill: I(e.fill, Ot),
1305
- stroke: e.stroke ? Dt(e.stroke) : e.stroke
1651
+ fill: F(e.fill, Kt),
1652
+ stroke: e.stroke ? Gt(e.stroke) : e.stroke
1306
1653
  };
1307
1654
  }
1308
- function jt(e, t = !1) {
1655
+ function Yt(e, t = !1) {
1309
1656
  if (!e.stroke) return e;
1310
- let n = (e.strokeWidth ?? 1) * Ct;
1657
+ let n = (e.strokeWidth ?? 1) * Ht;
1311
1658
  return {
1312
- stroke: kt(e.stroke),
1659
+ stroke: qt(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 ? Vt : e.alpha
1317
1664
  };
1318
1665
  }
1319
- var Mt = { transform(e) {
1666
+ var Xt = { 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: Jt(e.paint)
1325
1672
  };
1326
1673
  return e.paint.stroke ? [{
1327
1674
  ...e,
1328
1675
  paint: {
1329
- ...jt(e.paint),
1676
+ ...Yt(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: Jt(e.paint)
1338
1685
  };
1339
1686
  return e.paint.stroke ? [{
1340
1687
  ...e,
1341
1688
  paint: {
1342
- ...jt(e.paint),
1689
+ ...Yt(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: Gt(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: Yt(e.paint, !0)
1358
1705
  }, t] : t;
1359
1706
  }
1360
1707
  case "polygon": return {
1361
1708
  ...e,
1362
- paint: At(e.paint)
1709
+ paint: Jt(e.paint)
1363
1710
  };
1364
1711
  case "text": return {
1365
1712
  ...e,
1366
- fill: xt
1713
+ fill: Bt
1367
1714
  };
1368
1715
  case "image":
1369
1716
  case "group": return e;
@@ -1380,7 +1727,7 @@ function V(...e) {
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 Zt(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,17 +1742,17 @@ 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 Qt(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 = Zt(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
  }
1406
1753
  return r;
1407
1754
  }
1408
- function U(e, t, n, r, i, a) {
1755
+ function H(e, t, n, r, i, a) {
1409
1756
  let o = [
1410
1757
  e,
1411
1758
  t,
@@ -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 = Zt(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 $t(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,26 +1777,26 @@ function Pt(e, t, n, r, i) {
1430
1777
  }
1431
1778
  return a;
1432
1779
  }
1433
- function Ft(e, t, n) {
1780
+ function en(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 = Zt(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 tn(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 nn(e) {
1453
1800
  let { jitter: t, color: n } = e;
1454
1801
  return { transform(e) {
1455
1802
  switch (e.type) {
@@ -1467,7 +1814,7 @@ function Lt(e) {
1467
1814
  }), a && e.paint.strokeWidth) {
1468
1815
  let i = {
1469
1816
  type: "polygon",
1470
- vertices: U(e.x, e.y, e.width, e.height, t, r),
1817
+ vertices: H(e.x, e.y, e.width, e.height, t, r),
1471
1818
  paint: {
1472
1819
  stroke: a,
1473
1820
  strokeWidth: e.paint.strokeWidth
@@ -1482,7 +1829,7 @@ function Lt(e) {
1482
1829
  }
1483
1830
  return {
1484
1831
  type: "polygon",
1485
- vertices: U(e.x, e.y, e.width, e.height, t, r),
1832
+ vertices: H(e.x, e.y, e.width, e.height, t, r),
1486
1833
  paint: {
1487
1834
  fill: i,
1488
1835
  stroke: a,
@@ -1497,7 +1844,7 @@ function Lt(e) {
1497
1844
  let r = B(V(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: $t(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 = B(V(...e.points.slice(0, 4))), i = Qt(e.points, t, r), a = tn(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 = B(V(...e.vertices.slice(0, 4))), i = en(e.vertices, t, r);
1524
1871
  return {
1525
1872
  ...e,
1526
1873
  vertices: i,
@@ -1542,10 +1889,10 @@ function Lt(e) {
1542
1889
  }
1543
1890
  //#endregion
1544
1891
  //#region src/style/shape/IsometricStyle.ts
1545
- function W(e, t) {
1546
- return I(e, (e) => _(e, t));
1892
+ function U(e, t) {
1893
+ return F(e, (e) => _(e, t));
1547
1894
  }
1548
- function G(e, t) {
1895
+ function W(e, t) {
1549
1896
  if (!t || typeof t == "string") return t;
1550
1897
  if (t.type === "linear") {
1551
1898
  let [n, r] = e(t.x0, t.y0), [i, a] = e(t.x1, t.y1);
@@ -1568,16 +1915,16 @@ function G(e, t) {
1568
1915
  }
1569
1916
  return i;
1570
1917
  }
1571
- function Rt(e) {
1918
+ function rn(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 an(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
- var K = 32;
1580
- function Bt(e, t) {
1926
+ var G = 32;
1927
+ function on(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 sn(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 cn(e = {}) {
1949
+ let t = e.rotation ?? 0, n = e.depth ?? .18, r = rn(t), i = an(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 = sn(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) {
@@ -1638,7 +1985,7 @@ function Ht(e = {}) {
1638
1985
  if (n > 0 && s.fill) {
1639
1986
  let t = [], i = 0;
1640
1987
  for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[i * 2 + 1] && (i = e);
1641
- let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v = G(r, s.fill);
1988
+ let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v = W(r, s.fill);
1642
1989
  if (t.push({
1643
1990
  type: "polygon",
1644
1991
  vertices: [
@@ -1651,7 +1998,7 @@ function Ht(e = {}) {
1651
1998
  u,
1652
1999
  d + n
1653
2000
  ],
1654
- paint: { fill: W(v, .2) },
2001
+ paint: { fill: U(v, .2) },
1655
2002
  layer: e.layer
1656
2003
  }), t.push({
1657
2004
  type: "polygon",
@@ -1665,7 +2012,7 @@ function Ht(e = {}) {
1665
2012
  a,
1666
2013
  o + n
1667
2014
  ],
1668
- paint: { fill: W(v, .4) },
2015
+ paint: { fill: U(v, .4) },
1669
2016
  layer: e.layer
1670
2017
  }), t.push({
1671
2018
  type: "polygon",
@@ -1721,7 +2068,7 @@ function Ht(e = {}) {
1721
2068
  type: "polygon",
1722
2069
  vertices: c,
1723
2070
  paint: {
1724
- fill: G(r, s.fill),
2071
+ fill: W(r, s.fill),
1725
2072
  stroke: s.stroke,
1726
2073
  strokeWidth: s.strokeWidth
1727
2074
  },
@@ -1731,15 +2078,15 @@ function Ht(e = {}) {
1731
2078
  };
1732
2079
  }
1733
2080
  function s(e) {
1734
- let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(K * 2);
1735
- for (let e = 0; e < K; e++) {
1736
- let n = e / K * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
2081
+ let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(G * 2);
2082
+ for (let e = 0; e < G; e++) {
2083
+ let n = e / G * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
1737
2084
  s[e * 2] = o, s[e * 2 + 1] = c;
1738
2085
  }
1739
2086
  if (o.dash || o.dashEnabled) {
1740
2087
  let t = [];
1741
- for (let n = 0; n < K; n++) {
1742
- let r = (n + 1) % K;
2088
+ for (let n = 0; n < G; n++) {
2089
+ let r = (n + 1) % G;
1743
2090
  t.push({
1744
2091
  type: "line",
1745
2092
  points: [
@@ -1758,18 +2105,18 @@ function Ht(e = {}) {
1758
2105
  }
1759
2106
  return t;
1760
2107
  }
1761
- let c = [], l = G(r, o.fill);
2108
+ let c = [], l = W(r, o.fill);
1762
2109
  if (n > 0 && o.fill) {
1763
2110
  let t = 0, r = 0, i = 0, a = -Infinity, u = Infinity, d = -Infinity;
1764
- for (let e = 0; e < K; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < u && (u = s[e * 2], r = e), s[e * 2 + 1] > d && (d = s[e * 2 + 1], i = e);
2111
+ for (let e = 0; e < G; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < u && (u = s[e * 2], r = e), s[e * 2 + 1] > d && (d = s[e * 2 + 1], i = e);
1765
2112
  let f = [], p = t;
1766
- for (let e = 0; e <= K && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % K;
2113
+ for (let e = 0; e <= G && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % G;
1767
2114
  for (let e = f.length - 2; e >= 0; e -= 2) f.push(f[e], f[e + 1] + n);
1768
2115
  c.push({
1769
2116
  type: "polygon",
1770
2117
  vertices: f,
1771
2118
  paint: {
1772
- fill: W(l, .2),
2119
+ fill: U(l, .2),
1773
2120
  stroke: o.stroke,
1774
2121
  strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
1775
2122
  },
@@ -1777,13 +2124,13 @@ function Ht(e = {}) {
1777
2124
  });
1778
2125
  let m = [];
1779
2126
  p = i;
1780
- for (let e = 0; e <= K && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % K;
2127
+ for (let e = 0; e <= G && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % G;
1781
2128
  for (let e = m.length - 2; e >= 0; e -= 2) m.push(m[e], m[e + 1] + n);
1782
2129
  c.push({
1783
2130
  type: "polygon",
1784
2131
  vertices: m,
1785
2132
  paint: {
1786
- fill: W(l, .4),
2133
+ fill: U(l, .4),
1787
2134
  stroke: o.stroke,
1788
2135
  strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
1789
2136
  },
@@ -1811,14 +2158,14 @@ 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: on(r, e.points)
1815
2162
  };
1816
2163
  case "polygon": return {
1817
2164
  ...e,
1818
- vertices: Bt(r, e.vertices),
2165
+ vertices: on(r, e.vertices),
1819
2166
  paint: {
1820
2167
  ...e.paint,
1821
- fill: G(r, e.paint.fill)
2168
+ fill: W(r, e.paint.fill)
1822
2169
  }
1823
2170
  };
1824
2171
  case "text": {
@@ -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 K = "#1a1a1a", ln = "#ffc200", un = "#ff6600", dn = 26, fn = 26, pn = 26, mn = 255, hn = 194, gn = 0;
2234
+ function _n(e) {
2235
+ let t = I(e);
2236
+ if (!t) return L(mn, hn, gn);
2237
+ let n = R(t);
2238
+ return L(Math.round(dn + (mn - dn) * n), Math.round(fn + (hn - fn) * n), Math.round(pn + (gn - pn) * n), t.a);
2239
+ }
2240
+ function vn(e) {
1894
2241
  return {
1895
2242
  ...e,
1896
- fill: I(e.fill, Zt),
1897
- stroke: e.stroke ? q : e.stroke
2243
+ fill: F(e.fill, _n),
2244
+ stroke: e.stroke ? K : e.stroke
1898
2245
  };
1899
2246
  }
1900
- function $t(e, t, n, r) {
2247
+ function yn(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 bn(e, t, n, r, i) {
1912
2259
  let a = [
1913
2260
  [e, t],
1914
2261
  [e + n, t],
@@ -1916,37 +2263,37 @@ 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 = yn(a, 1, 1, t);
2267
+ r = yn(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 xn = { 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: vn(e.paint)
1930
2277
  };
1931
2278
  let n = {
1932
2279
  ...e,
1933
2280
  paint: {
1934
- fill: q,
2281
+ fill: K,
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 = bn(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: ln,
1943
2290
  alpha: .65
1944
2291
  }
1945
2292
  })), i = {
1946
2293
  ...e,
1947
2294
  hit: void 0,
1948
2295
  paint: {
1949
- stroke: q,
2296
+ stroke: K,
1950
2297
  strokeWidth: e.paint.strokeWidth
1951
2298
  }
1952
2299
  };
@@ -1958,38 +2305,38 @@ var tn = { transform(e, t) {
1958
2305
  }
1959
2306
  case "circle": return {
1960
2307
  ...e,
1961
- paint: Qt(e.paint)
2308
+ paint: vn(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,
1968
- stroke: e.paint.stroke ? q : e.paint.stroke
2314
+ fill: e.paint.fill ? un : e.paint.fill,
2315
+ stroke: e.paint.stroke ? K : e.paint.stroke
1969
2316
  }
1970
2317
  };
1971
2318
  case "line": return {
1972
2319
  ...e,
1973
2320
  paint: e.paint.stroke ? {
1974
2321
  ...e.paint,
1975
- stroke: Wt
2322
+ stroke: un
1976
2323
  } : e.paint
1977
2324
  };
1978
2325
  case "text": return {
1979
2326
  ...e,
1980
- fill: Wt,
1981
- stroke: q,
2327
+ fill: un,
2328
+ stroke: K,
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
+ } }, Sn = "#c8eeff", Cn = "#00c8ff", wn = "#00ffaa", Tn = .2, En = 5, q = 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
+ q,
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 = I(e);
2359
+ if (!t) return On(q, .55, .18);
2360
+ let [n, r] = Dn(t.r, t.g, t.b);
2361
+ return On(r < .08 ? q : 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: F(e.fill, kn),
2367
+ stroke: e.stroke ? Cn : 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: Cn,
2373
+ strokeWidth: (e.strokeWidth ?? 1) * En,
2374
+ alpha: Tn
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: wn,
2380
+ strokeWidth: (e.strokeWidth ?? 1) * En,
2381
+ alpha: Tn,
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: wn
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 ? wn : 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: Sn
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 = I(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] = mt(t.r, t.g, t.b);
2513
+ return ht(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 = F(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 = I(e);
2555
+ if (!t) return L($n, er, tr);
2556
+ let n = R(t);
2557
+ return L(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 = I(e);
2561
+ if (!t || t.a >= 1) return qn;
2562
+ let n = I(qn);
2563
+ return L(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: F(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 = I(e);
2602
+ if (!t) return L(pr, mr, hr);
2603
+ let n = R(t);
2604
+ return L(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: F(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,27 +2689,27 @@ 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 F(e, (e) => {
2705
+ let n = I(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
2714
  let n = B(i + t * 2654435769);
2368
2715
  l.push({
@@ -2386,7 +2733,7 @@ function sr(e = {}) {
2386
2733
  let n = B(V(e.x, e.y, e.width, e.height));
2387
2734
  return {
2388
2735
  type: "polygon",
2389
- vertices: U(e.x, e.y, e.width, e.height, t, n),
2736
+ vertices: H(e.x, e.y, e.width, e.height, t, n),
2390
2737
  paint: {
2391
2738
  stroke: e.paint.stroke,
2392
2739
  strokeWidth: e.paint.strokeWidth ?? 0,
@@ -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) => H(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);
2401
2748
  case "circle":
2402
2749
  if (!e.paint.fill) {
2403
2750
  let n = B(V(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: $t(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) => $t(e.cx, e.cy, e.radius, t, n), e.paint, V(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
2418
2765
  case "polygon":
2419
2766
  if (!e.paint.fill) {
2420
2767
  let n = B(V(...e.vertices.slice(0, 4)));
2421
2768
  return {
2422
2769
  ...e,
2423
- vertices: Ft(e.vertices, t, n),
2770
+ vertices: en(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) => en(e.vertices, t, n), e.paint, V(...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 = I(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] = mt(t.r, t.g, t.b);
2801
+ return ht(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: F(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 = I(e);
2872
+ if (!t) return L(Br, Vr, Hr);
2873
+ let n = R(t);
2874
+ return L(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 = I(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 = I(J);
2880
+ return L(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: F(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: L(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 = Dt, Xr = zt, Zr = Xt;
2990
+ function Qr(e) {
2991
+ return nn(e);
2645
2992
  }
2646
- function Fr(e = {}) {
2647
- return Ht(e);
2993
+ function $r(e = {}) {
2994
+ return cn(e);
2648
2995
  }
2649
- var Ir = tn, Lr = hn;
2650
- function Rr(e = {}) {
2651
- return _n(e);
2996
+ var ei = xn, 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 Me(e, t ?? je()), this.backend = r ? r(this.state) : new pt(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 = {
@@ -2844,11 +3191,11 @@ function qr(e, t) {
2844
3191
  y: (n + e.y) * i + s,
2845
3192
  w: e.width * i,
2846
3193
  h: e.height * i,
2847
- fill: P(e.paint.fill, t, n, i, o, s),
3194
+ fill: M(e.paint.fill, t, n, i, o, s),
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;
@@ -2859,19 +3206,19 @@ function qr(e, t) {
2859
3206
  cx: (t + e.cx) * i + o,
2860
3207
  cy: (n + e.cy) * i + s,
2861
3208
  r: e.radius * i,
2862
- fill: P(e.paint.fill, t, n, i, o, s),
3209
+ fill: M(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,8 +3229,8 @@ 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),
2886
- fill: P(e.paint.fill, t, n, i, o, s),
3232
+ vertices: fi(e.vertices, t, n, i, o, s),
3233
+ fill: M(e.paint.fill, t, n, i, o, s),
2887
3234
  stroke: e.paint.stroke,
2888
3235
  sw: (e.paint.strokeWidth ?? 0) * i
2889
3236
  };
@@ -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,18 +3462,18 @@ 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
- 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());
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 = k(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
3127
3474
  break;
3128
3475
  case "circle":
3129
- e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), 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());
3476
+ e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = k(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
3130
3477
  break;
3131
3478
  case "line": {
3132
3479
  if (t.points.length < 4) break;
@@ -3140,7 +3487,7 @@ function li(e, t, n) {
3140
3487
  if (t.vertices.length < 4) break;
3141
3488
  e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
3142
3489
  for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
3143
- e.closePath(), 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([]), e.stroke());
3490
+ e.closePath(), t.fill && (e.fillStyle = k(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
3144
3491
  break;
3145
3492
  case "text": {
3146
3493
  let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
@@ -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),
@@ -3198,16 +3545,28 @@ function ui(e, t, n = 0) {
3198
3545
  };
3199
3546
  }
3200
3547
  //#endregion
3548
+ //#region src/export/exportViewport.ts
3549
+ function ki(e, t) {
3550
+ if (!N(e)) return () => {};
3551
+ let n = e.getViewport();
3552
+ return e.setViewport({
3553
+ minX: t.x,
3554
+ maxX: t.x + t.w,
3555
+ minY: t.y,
3556
+ maxY: t.y + t.h
3557
+ }), () => e.setViewport(n);
3558
+ }
3559
+ //#endregion
3201
3560
  //#region src/export/SvgExporter.ts
3202
- var di = {
3561
+ var Ai = {
3203
3562
  scale: 1,
3204
3563
  offsetX: 0,
3205
3564
  offsetY: 0
3206
3565
  };
3207
- function fi(e) {
3566
+ function ji(e) {
3208
3567
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3209
3568
  }
3210
- var pi = class {
3569
+ var Mi = class {
3211
3570
  constructor(e = {}) {
3212
3571
  this.options = e;
3213
3572
  }
@@ -3216,30 +3575,35 @@ var pi = class {
3216
3575
  if (r === void 0 || i === void 0 || !a) return;
3217
3576
  let o = a, s = o.getPlane(i);
3218
3577
  if (!s) return;
3219
- let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = D.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = Pe(new E(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
3220
- forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
3221
- inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
3222
- }), p = {
3223
- scale: 1,
3224
- 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, {
3227
- state: e,
3228
- viewportBounds: d,
3229
- sceneOverlays: n,
3230
- overlays: this.options.overlays
3231
- }, (e, t) => {
3232
- e.length !== 0 && g.push(...ri(qr(t ? e : m(e), di)));
3233
- }), g.push("</svg>"), g.join("\n");
3234
- }
3235
- }, mi = class {
3578
+ let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = T.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = ki(e.mapReader, u);
3579
+ try {
3580
+ let r = Ie(new w(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
3581
+ forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
3582
+ inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
3583
+ }), a = {
3584
+ scale: 1,
3585
+ roomSize: c.roomSize
3586
+ }, l = (e) => t === x ? e : E(e, t, a), f = Oi(u, t, c.roomSize * .5), p = [];
3587
+ return p.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${f.x} ${f.y} ${f.w} ${f.h}">`), p.push(`<rect x="${f.x}" y="${f.y}" width="${f.w}" height="${f.h}" fill="${ji(c.backgroundColor)}"/>`), se(r, {
3588
+ state: e,
3589
+ viewportBounds: d,
3590
+ sceneOverlays: n,
3591
+ overlays: this.options.overlays
3592
+ }, (e, t) => {
3593
+ e.length !== 0 && p.push(...xi(di(t ? e : l(e), Ai)));
3594
+ }), p.push("</svg>"), p.join("\n");
3595
+ } finally {
3596
+ f();
3597
+ }
3598
+ }
3599
+ }, Ni = class {
3236
3600
  constructor(e = {}) {
3237
3601
  this.options = e;
3238
3602
  }
3239
3603
  render({ backend: e }) {
3240
3604
  return e.exportCanvas(this.options)?.toDataURL("image/png");
3241
3605
  }
3242
- }, hi = class {
3606
+ }, Pi = class {
3243
3607
  constructor(e = {}) {
3244
3608
  this.options = e;
3245
3609
  }
@@ -3256,14 +3620,14 @@ var pi = class {
3256
3620
  };
3257
3621
  //#endregion
3258
3622
  //#region src/export/canvasToBytes.ts
3259
- function gi(e, t = "image/png", n) {
3623
+ function Fi(e, t = "image/png", n) {
3260
3624
  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
3625
  for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
3262
3626
  return s;
3263
3627
  }
3264
3628
  //#endregion
3265
3629
  //#region src/export/CanvasExporter.ts
3266
- var _i = class {
3630
+ var Ii = class {
3267
3631
  constructor(e) {
3268
3632
  this.options = e;
3269
3633
  }
@@ -3272,71 +3636,76 @@ var _i = class {
3272
3636
  if (r === void 0 || i === void 0 || !a) return;
3273
3637
  let o = a, s = o.getPlane(i);
3274
3638
  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 = {
3639
+ 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
3640
  scale: m,
3277
3641
  offsetX: _,
3278
3642
  offsetY: v
3279
- }, b = D.forRenderCamera(l, u, m, _, v), S = {
3643
+ }, b = T.forRenderCamera(l, u, m, _, v), S = {
3280
3644
  forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
3281
3645
  inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
3282
- }, C = Pe(new E(e.mapReader, c).buildScene(o, s, i, e.lens), b.getViewportBounds(), c, S), w = k.Util.createCanvasElement();
3283
- w.width = l, w.height = u;
3284
- let T = w.getContext("2d");
3285
- if (!T) return;
3286
- T.fillStyle = c.backgroundColor, T.fillRect(0, 0, l, u);
3287
- let ee = {
3288
- scale: m,
3289
- roomSize: c.roomSize
3290
- }, te = (e) => t === x ? e : O(e, t, ee);
3291
- return ae(C, {
3292
- state: e,
3293
- viewportBounds: D.forMapBounds(f.x, f.x + f.w, f.y, f.y + f.h).getViewportBounds(),
3294
- sceneOverlays: n,
3295
- overlays: this.options.overlays
3296
- }, (e, t) => {
3297
- e.length !== 0 && si(T, qr(t ? e : te(e), y));
3298
- }), w;
3299
- }
3300
- }, vi = class {
3646
+ }, C = ki(e.mapReader, f);
3647
+ try {
3648
+ let r = Ie(new w(e.mapReader, c).buildScene(o, s, i, e.lens), b.getViewportBounds(), c, S), a = D.Util.createCanvasElement();
3649
+ a.width = l, a.height = u;
3650
+ let d = a.getContext("2d");
3651
+ if (!d) return;
3652
+ d.fillStyle = c.backgroundColor, d.fillRect(0, 0, l, u);
3653
+ let p = {
3654
+ scale: m,
3655
+ roomSize: c.roomSize
3656
+ }, h = (e) => t === x ? e : E(e, t, p);
3657
+ return se(r, {
3658
+ state: e,
3659
+ viewportBounds: T.forMapBounds(f.x, f.x + f.w, f.y, f.y + f.h).getViewportBounds(),
3660
+ sceneOverlays: n,
3661
+ overlays: this.options.overlays
3662
+ }, (e, t) => {
3663
+ e.length !== 0 && Ti(d, di(t ? e : h(e), y));
3664
+ }), a;
3665
+ } finally {
3666
+ C();
3667
+ }
3668
+ }
3669
+ }, Li = class {
3301
3670
  constructor(e) {
3302
- this.options = e, this.canvasExporter = new _i(e);
3671
+ this.options = e, this.canvasExporter = new Ii(e);
3303
3672
  }
3304
3673
  render(e) {
3305
3674
  let t = this.canvasExporter.render(e);
3306
- if (t) return gi(t, this.options.mimeType, this.options.quality);
3675
+ if (t) return Fi(t, this.options.mimeType, this.options.quality);
3307
3676
  }
3308
- }, Z, yi, bi = 256;
3309
- function xi(e, t, n) {
3677
+ }, Z, Ri, zi = 256;
3678
+ function Bi(e, t, n) {
3310
3679
  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");
3680
+ if (Ri === r && Z) return Z;
3681
+ let i = zi, a = i / 2, o = document.createElement("canvas");
3313
3682
  o.width = i, o.height = i;
3314
3683
  let s = o.getContext("2d");
3315
3684
  s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
3316
3685
  let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
3317
3686
  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
3687
  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;
3688
+ 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(), Ri = r, Z;
3320
3689
  }
3321
- function Si(e, t, n, r) {
3690
+ function Vi(e, t, n, r) {
3322
3691
  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
3692
  return {
3324
3693
  cx: e,
3325
3694
  cy: t,
3326
3695
  displaySize: u,
3327
- src: xi(a, o, Math.round(i / (u / 2) * 50) / 50)
3696
+ src: Bi(a, o, Math.round(i / (u / 2) * 50) / 50)
3328
3697
  };
3329
3698
  }
3330
3699
  //#endregion
3331
3700
  //#region src/overlay/AmbientLightOverlay.ts
3332
- var Ci = {
3701
+ var Hi = {
3333
3702
  color: "#ffcc44",
3334
3703
  radius: 12,
3335
3704
  intensity: .7
3336
- }, wi = class {
3705
+ }, Ui = class {
3337
3706
  constructor(e) {
3338
3707
  this.onPosition = () => this.ctx?.invalidate(), this.params = {
3339
- ...Ci,
3708
+ ...Hi,
3340
3709
  ...e
3341
3710
  };
3342
3711
  }
@@ -3359,7 +3728,7 @@ var Ci = {
3359
3728
  if (e.positionRoomId === void 0) return;
3360
3729
  let n = e.mapReader.getRoom(e.positionRoomId);
3361
3730
  if (!n) return;
3362
- let r = Si(n.x, n.y, t, this.params);
3731
+ let r = Vi(n.x, n.y, t, this.params);
3363
3732
  return {
3364
3733
  type: "image",
3365
3734
  x: r.cx - r.displaySize / 2,
@@ -3370,7 +3739,7 @@ var Ci = {
3370
3739
  layer: "overlay"
3371
3740
  };
3372
3741
  }
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 {
3742
+ }, Wi = () => typeof performance < "u" ? performance.now() : Date.now(), Gi = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(Wi()), 16), Ki = typeof cancelAnimationFrame < "u" ? cancelAnimationFrame : (e) => clearTimeout(e), qi = class {
3374
3743
  constructor(e, t, n = {}) {
3375
3744
  this.worldX = e, this.worldY = t, this.cancelled = !1, this.transform = (e, t) => ({
3376
3745
  x: e,
@@ -3379,7 +3748,7 @@ var Ci = {
3379
3748
  }
3380
3749
  attach(e) {
3381
3750
  let t = this.transform(this.worldX, this.worldY);
3382
- this.ring = new k.Circle({
3751
+ this.ring = new D.Circle({
3383
3752
  x: t.x,
3384
3753
  y: t.y,
3385
3754
  radius: this.startRadius,
@@ -3394,12 +3763,12 @@ var Ci = {
3394
3763
  n(1), this.onComplete?.();
3395
3764
  return;
3396
3765
  }
3397
- let r = Ti(), i = (e) => {
3766
+ let r = Wi(), i = (e) => {
3398
3767
  if (this.cancelled) return;
3399
3768
  let t = Math.min((e - r) / this.duration, 1);
3400
- n(t), t < 1 ? this.rafId = Ei(i) : (this.rafId = void 0, this.onComplete?.());
3769
+ n(t), t < 1 ? this.rafId = Gi(i) : (this.rafId = void 0, this.onComplete?.());
3401
3770
  };
3402
- this.rafId = Ei(i);
3771
+ this.rafId = Gi(i);
3403
3772
  }
3404
3773
  updateViewport(e, t, n) {
3405
3774
  if (this.transform = n, this.ring) {
@@ -3411,9 +3780,9 @@ var Ci = {
3411
3780
  }
3412
3781
  }
3413
3782
  destroy() {
3414
- this.cancelled = !0, this.rafId !== void 0 && (Di(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
3783
+ this.cancelled = !0, this.rafId !== void 0 && (Ki(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
3415
3784
  }
3416
- }, ki = {
3785
+ }, Ji = {
3417
3786
  n: {
3418
3787
  x: 0,
3419
3788
  y: -1
@@ -3446,7 +3815,7 @@ var Ci = {
3446
3815
  x: -Math.SQRT1_2,
3447
3816
  y: Math.SQRT1_2
3448
3817
  }
3449
- }, Ai = [
3818
+ }, Yi = [
3450
3819
  "n",
3451
3820
  "s",
3452
3821
  "e",
@@ -3455,22 +3824,22 @@ var Ci = {
3455
3824
  "nw",
3456
3825
  "se",
3457
3826
  "sw"
3458
- ], ji = new Set([
3827
+ ], Xi = new Set([
3459
3828
  "ne",
3460
3829
  "nw",
3461
3830
  "se",
3462
3831
  "sw"
3463
- ]), Mi = {
3832
+ ]), Zi = {
3464
3833
  clear: 10,
3465
3834
  diagonal: .3,
3466
3835
  preferred: 1,
3467
3836
  distance: .05
3468
- }, Ni = [
3837
+ }, Qi = [
3469
3838
  "n",
3470
3839
  "s",
3471
3840
  "e",
3472
3841
  "w"
3473
- ], Pi = [
3842
+ ], $i = [
3474
3843
  "n",
3475
3844
  "s",
3476
3845
  "e",
@@ -3480,16 +3849,16 @@ var Ci = {
3480
3849
  "se",
3481
3850
  "sw"
3482
3851
  ];
3483
- function Fi(e, t) {
3852
+ function ea(e, t) {
3484
3853
  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
3854
  }
3486
- function Ii(e, t) {
3855
+ function ta(e, t) {
3487
3856
  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
3857
  return Math.hypot(n, r);
3489
3858
  }
3490
3859
  function Q(e, t, n) {
3491
- let r = ki[t];
3492
- if (ji.has(t)) {
3860
+ let r = Ji[t];
3861
+ if (Xi.has(t)) {
3493
3862
  let t = e.x + r.x * n, i = e.y + r.y * n;
3494
3863
  return {
3495
3864
  x: r.x < 0 ? t - e.width : t,
@@ -3506,9 +3875,9 @@ function Q(e, t, n) {
3506
3875
  height: e.height
3507
3876
  };
3508
3877
  }
3509
- function Li(e, t, n = {}) {
3510
- let r = n.offset ?? .6, i = n.slots === 4 ? Ni : Ai, a = {
3511
- ...Mi,
3878
+ function na(e, t, n = {}) {
3879
+ let r = n.offset ?? .6, i = n.slots === 4 ? Qi : Yi, a = {
3880
+ ...Zi,
3512
3881
  ...n.weights
3513
3882
  }, o = [], s = [];
3514
3883
  for (let c of e) {
@@ -3518,11 +3887,11 @@ function Li(e, t, n = {}) {
3518
3887
  for (let n = r; n <= r + e + 1e-9; n += u) {
3519
3888
  let e = Q(c, t, n), r = !1, o = Infinity;
3520
3889
  for (let t of p) {
3521
- if (t.kind !== "exit" && Fi(e, t) > 0) {
3890
+ if (t.kind !== "exit" && ea(e, t) > 0) {
3522
3891
  r = !0;
3523
3892
  break;
3524
3893
  }
3525
- let n = Ii(e, t);
3894
+ let n = ta(e, t);
3526
3895
  n < o && (o = n);
3527
3896
  }
3528
3897
  if (r) {
@@ -3549,7 +3918,7 @@ function Li(e, t, n = {}) {
3549
3918
  continue;
3550
3919
  }
3551
3920
  let o = 0;
3552
- c.preferred ? t === c.preferred && (o -= a.preferred) : ji.has(t) && (o += a.diagonal);
3921
+ c.preferred ? t === c.preferred && (o -= a.preferred) : Xi.has(t) && (o += a.diagonal);
3553
3922
  let s = -i.value * a.clear + o;
3554
3923
  n.onScored && h.push({
3555
3924
  dir: t,
@@ -3572,9 +3941,9 @@ function Li(e, t, n = {}) {
3572
3941
  off: r,
3573
3942
  cost: 0,
3574
3943
  clearance: 0
3575
- }, m.clearance < (n.minClearance ?? 0)) for (let e of Pi) {
3944
+ }, m.clearance < (n.minClearance ?? 0)) for (let e of $i) {
3576
3945
  let t = Q(c, e, r);
3577
- if (!p.some((e) => e.kind !== "exit" && Fi(t, e) > 0)) {
3946
+ if (!p.some((e) => e.kind !== "exit" && ea(t, e) > 0)) {
3578
3947
  m = {
3579
3948
  box: t,
3580
3949
  dir: e,
@@ -3586,7 +3955,7 @@ function Li(e, t, n = {}) {
3586
3955
  }
3587
3956
  }
3588
3957
  n.onScored?.(c, h, m.dir);
3589
- let g = ki[m.dir];
3958
+ let g = Ji[m.dir];
3590
3959
  s.push({
3591
3960
  id: c.id,
3592
3961
  x: m.box.x,
@@ -3607,7 +3976,7 @@ function Li(e, t, n = {}) {
3607
3976
  }
3608
3977
  //#endregion
3609
3978
  //#region src/overlay/WaypointOverlay.ts
3610
- var Ri = class {
3979
+ var ra = class {
3611
3980
  constructor() {
3612
3981
  this.waypoints = [], this.placed = [];
3613
3982
  }
@@ -3679,7 +4048,7 @@ var Ri = class {
3679
4048
  });
3680
4049
  }
3681
4050
  if (f.length === 0) return [];
3682
- let m = "rgba(20, 20, 24, 0.82)", h = Li(f, u, {
4051
+ let m = "rgba(20, 20, 24, 0.82)", h = na(f, u, {
3683
4052
  offset: a * .7,
3684
4053
  extend: a * 4,
3685
4054
  clearCap: a * 1.5,
@@ -3737,11 +4106,11 @@ var Ri = class {
3737
4106
  width: n.width,
3738
4107
  height: n.height
3739
4108
  });
3740
- let C = p[t].lines, w = (n.height - C.length * c) / 2;
4109
+ let C = p[t].lines, ee = (n.height - C.length * c) / 2;
3741
4110
  for (let t = 0; t < C.length; t++) g.push({
3742
4111
  type: "text",
3743
4112
  x: n.x,
3744
- y: n.y + w + t * c,
4113
+ y: n.y + ee + t * c,
3745
4114
  width: n.width,
3746
4115
  height: c,
3747
4116
  text: C[t],
@@ -3755,7 +4124,7 @@ var Ri = class {
3755
4124
  }
3756
4125
  return g;
3757
4126
  }
3758
- }, zi = /* @__PURE__ */ A(((e, t) => {
4127
+ }, ia = /* @__PURE__ */ O(((e, t) => {
3759
4128
  t.exports = class {
3760
4129
  constructor() {
3761
4130
  this.keys = /* @__PURE__ */ new Set(), this.queue = [];
@@ -3785,14 +4154,14 @@ var Ri = class {
3785
4154
  return this.queue.find((t) => t.key === e);
3786
4155
  }
3787
4156
  };
3788
- })), Bi = /* @__PURE__ */ A(((e, t) => {
4157
+ })), aa = /* @__PURE__ */ O(((e, t) => {
3789
4158
  function n(e, t) {
3790
4159
  let r = /* @__PURE__ */ new Map();
3791
4160
  for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
3792
4161
  return r;
3793
4162
  }
3794
4163
  t.exports = n;
3795
- })), Vi = /* @__PURE__ */ A(((e, t) => {
4164
+ })), oa = /* @__PURE__ */ O(((e, t) => {
3796
4165
  function n(e) {
3797
4166
  let t = Number(e);
3798
4167
  return !(isNaN(t) || t <= 0);
@@ -3807,7 +4176,7 @@ var Ri = class {
3807
4176
  }), t;
3808
4177
  }
3809
4178
  t.exports = r;
3810
- })), Hi = /* @__PURE__ */ A(((e, t) => {
4179
+ })), sa = /* @__PURE__ */ O(((e, t) => {
3811
4180
  function n(e) {
3812
4181
  if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
3813
4182
  e.forEach((e, t) => {
@@ -3819,8 +4188,8 @@ var Ri = class {
3819
4188
  });
3820
4189
  }
3821
4190
  t.exports = n;
3822
- })), Ui = /* @__PURE__ */ Te((/* @__PURE__ */ A(((e, t) => {
3823
- var n = zi(), r = Bi(), i = Vi(), a = Hi();
4191
+ })), ca = /* @__PURE__ */ De((/* @__PURE__ */ O(((e, t) => {
4192
+ var n = ia(), r = aa(), i = oa(), a = sa();
3824
4193
  t.exports = class {
3825
4194
  constructor(e) {
3826
4195
  e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
@@ -3870,7 +4239,7 @@ var Ri = class {
3870
4239
  return this.path(...e);
3871
4240
  }
3872
4241
  };
3873
- })))(), 1), Wi = {
4242
+ })))(), 1), la = {
3874
4243
  1: "north",
3875
4244
  2: "northeast",
3876
4245
  3: "northwest",
@@ -3883,7 +4252,7 @@ var Ri = class {
3883
4252
  10: "down",
3884
4253
  11: "in",
3885
4254
  12: "out"
3886
- }, Gi = {
4255
+ }, ua = {
3887
4256
  north: "n",
3888
4257
  northeast: "ne",
3889
4258
  northwest: "nw",
@@ -3896,7 +4265,7 @@ var Ri = class {
3896
4265
  down: "down",
3897
4266
  in: "in",
3898
4267
  out: "out"
3899
- }, Ki = class {
4268
+ }, da = class {
3900
4269
  constructor(e) {
3901
4270
  this.mapReader = e, this.data = this.buildGraph();
3902
4271
  }
@@ -3922,12 +4291,12 @@ var Ri = class {
3922
4291
  buildGraph() {
3923
4292
  let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
3924
4293
  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 ?? []);
4294
+ let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => la[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
3926
4295
  Object.entries(i.exits ?? {}).forEach(([e, t]) => {
3927
4296
  if (s.has(e)) return;
3928
4297
  let c = this.mapReader.getRoom(t);
3929
4298
  if (c) {
3930
- let s = Gi[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
4299
+ let s = ua[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
3931
4300
  a.push({
3932
4301
  id: t,
3933
4302
  weight: l
@@ -3958,7 +4327,7 @@ var Ri = class {
3958
4327
  };
3959
4328
  //#endregion
3960
4329
  //#region src/PathFinder.ts
3961
- function qi(e, t) {
4330
+ function fa(e, t) {
3962
4331
  e.push(t);
3963
4332
  let n = e.length - 1;
3964
4333
  for (; n > 0;) {
@@ -3967,7 +4336,7 @@ function qi(e, t) {
3967
4336
  [e[t], e[n]] = [e[n], e[t]], n = t;
3968
4337
  }
3969
4338
  }
3970
- function Ji(e) {
4339
+ function pa(e) {
3971
4340
  if (e.length === 0) return;
3972
4341
  let t = e[0], n = e.pop();
3973
4342
  if (e.length > 0) {
@@ -3981,16 +4350,16 @@ function Ji(e) {
3981
4350
  }
3982
4351
  return t;
3983
4352
  }
3984
- function Yi(e, t, n) {
4353
+ function ma(e, t, n) {
3985
4354
  let r = [n], i = n;
3986
4355
  for (; i !== t;) i = e.get(i), r.push(i);
3987
4356
  return r.reverse(), r;
3988
4357
  }
3989
- function Xi(e, t, n) {
4358
+ function ha(e, t, n) {
3990
4359
  let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
3991
4360
  return i ? i.map((e) => Number(e)) : null;
3992
4361
  }
3993
- function Zi(e, t, n, r) {
4362
+ function ga(e, t, n, r) {
3994
4363
  let i = r.getRoom(n);
3995
4364
  if (!i) return null;
3996
4365
  let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
@@ -3999,16 +4368,16 @@ function Zi(e, t, n, r) {
3999
4368
  let n = t.x - a, i = t.y - o, u = t.z - s;
4000
4369
  return Math.sqrt(n * n + i * i + u * u) / c * l;
4001
4370
  }, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
4002
- for (d.set(t, 0), qi(p, {
4371
+ for (d.set(t, 0), fa(p, {
4003
4372
  id: t,
4004
4373
  priority: u(t)
4005
4374
  }); p.length > 0;) {
4006
- let { id: r } = Ji(p);
4007
- if (r === n) return Yi(f, t, n);
4375
+ let { id: r } = pa(p);
4376
+ if (r === n) return ma(f, t, n);
4008
4377
  let i = d.get(r) ?? Infinity, a = e.get(r);
4009
4378
  if (a) for (let e of a) {
4010
4379
  let t = i + e.weight;
4011
- t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), qi(p, {
4380
+ t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), fa(p, {
4012
4381
  id: e.id,
4013
4382
  priority: t + u(e.id)
4014
4383
  }));
@@ -4016,9 +4385,9 @@ function Zi(e, t, n, r) {
4016
4385
  }
4017
4386
  return null;
4018
4387
  }
4019
- var Qi = class {
4388
+ var _a = class {
4020
4389
  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());
4390
+ this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new da(e), this.dijkstraGraph = new ca.default(this.mapGraph.getGraphDefinition());
4022
4391
  }
4023
4392
  get algorithm() {
4024
4393
  return this._algorithm;
@@ -4037,23 +4406,31 @@ var Qi = class {
4037
4406
  let r;
4038
4407
  switch (this._algorithm) {
4039
4408
  case "dijkstra":
4040
- r = Xi(this.dijkstraGraph, e, t);
4409
+ r = ha(this.dijkstraGraph, e, t);
4041
4410
  break;
4042
4411
  case "astar":
4043
- r = Zi(this.mapGraph.getAdj(), e, t, this.mapGraph);
4412
+ r = ga(this.mapGraph.getAdj(), e, t, this.mapGraph);
4044
4413
  break;
4045
4414
  }
4046
4415
  return this.cache.set(n, r), r;
4047
4416
  }
4048
- }, $ = {
4417
+ };
4418
+ //#endregion
4419
+ //#region src/reader/HashLookup.ts
4420
+ function va(e) {
4421
+ return !!e && e.hashLookupCapable === !0;
4422
+ }
4423
+ //#endregion
4424
+ //#region src/lens/composeLenses.ts
4425
+ var $ = {
4049
4426
  hidden: 2,
4050
4427
  stub: 1,
4051
4428
  full: 0
4052
4429
  };
4053
- function $i(e, t, n) {
4430
+ function ya(e, t, n) {
4054
4431
  return n === "first" ? e : n === "least-restrictive" ? $[e] < $[t] ? e : t : $[e] > $[t] ? e : t;
4055
4432
  }
4056
- function ea(e, ...t) {
4433
+ function ba(e, ...t) {
4057
4434
  let n = {}, r;
4058
4435
  e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
4059
4436
  let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
@@ -4069,7 +4446,7 @@ function ea(e, ...t) {
4069
4446
  for (let o of r) {
4070
4447
  let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : d(o, e, t, n);
4071
4448
  if (a === void 0) a = r;
4072
- else if (a = $i(a, r, i), i === "first") break;
4449
+ else if (a = ya(a, r, i), i === "first") break;
4073
4450
  }
4074
4451
  return a ?? "full";
4075
4452
  },
@@ -4082,7 +4459,7 @@ function ea(e, ...t) {
4082
4459
  }
4083
4460
  //#endregion
4084
4461
  //#region src/lens/ExplorationLens.ts
4085
- var ta = class {
4462
+ var xa = class {
4086
4463
  constructor(e) {
4087
4464
  this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
4088
4465
  }
@@ -4117,7 +4494,7 @@ var ta = class {
4117
4494
  clear() {
4118
4495
  this.visited.size !== 0 && (this.visited.clear(), this.version++);
4119
4496
  }
4120
- }, na = {
4497
+ }, Sa = {
4121
4498
  1: "north",
4122
4499
  2: "northeast",
4123
4500
  3: "northwest",
@@ -4131,7 +4508,7 @@ var ta = class {
4131
4508
  11: "in",
4132
4509
  12: "out"
4133
4510
  };
4134
- function ra() {
4511
+ function Ca() {
4135
4512
  return {
4136
4513
  areaWidth: 150,
4137
4514
  areaHeight: 80,
@@ -4145,14 +4522,14 @@ function ra() {
4145
4522
  highlightColor: "#ff9900"
4146
4523
  };
4147
4524
  }
4148
- var ia = class {
4525
+ var wa = class {
4149
4526
  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({
4527
+ this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? Ca(), this.stage = new D.Stage({
4151
4528
  container: e,
4152
4529
  width: e.clientWidth,
4153
4530
  height: e.clientHeight,
4154
4531
  draggable: !0
4155
- }), this.backgroundLayer = new k.Layer({ listening: !1 }), this.stage.add(this.backgroundLayer), this.connectionLayer = new k.Layer({ listening: !1 }), this.stage.add(this.connectionLayer), this.areaLayer = new k.Layer(), this.stage.add(this.areaLayer), this.mapReader = t, this.initScaling(), this.initResize(e);
4532
+ }), this.backgroundLayer = new D.Layer({ listening: !1 }), this.stage.add(this.backgroundLayer), this.connectionLayer = new D.Layer({ listening: !1 }), this.stage.add(this.connectionLayer), this.areaLayer = new D.Layer(), this.stage.add(this.areaLayer), this.mapReader = t, this.initScaling(), this.initResize(e);
4156
4533
  }
4157
4534
  initResize(e) {
4158
4535
  new ResizeObserver(() => {
@@ -4244,7 +4621,7 @@ var ia = class {
4244
4621
  if (this.backgroundLayer.destroyChildren(), !this.backgroundConfig) return;
4245
4622
  let e = new Image();
4246
4623
  e.crossOrigin = "anonymous", e.onload = () => {
4247
- this.backgroundImage = new k.Image({
4624
+ this.backgroundImage = new D.Image({
4248
4625
  x: this.backgroundConfig.x,
4249
4626
  y: this.backgroundConfig.y,
4250
4627
  image: e,
@@ -4337,7 +4714,7 @@ var ia = class {
4337
4714
  }
4338
4715
  }
4339
4716
  getLockedDirections(e) {
4340
- return new Set((e.exitLocks ?? []).map((e) => na[e]).filter((e) => !!e));
4717
+ return new Set((e.exitLocks ?? []).map((e) => Sa[e]).filter((e) => !!e));
4341
4718
  }
4342
4719
  createConnection(e, t, n) {
4343
4720
  let r = this.toPlanarDirection(n);
@@ -4799,7 +5176,7 @@ var ia = class {
4799
5176
  y: n.y + n.height / 2
4800
5177
  }, a, o;
4801
5178
  if (this.dotsMode ? (a = r, o = i) : (a = this.getEdgePoint(t, i), o = this.getEdgePoint(n, r)), !isFinite(a.x) || !isFinite(a.y) || !isFinite(o.x) || !isFinite(o.y)) continue;
4802
- let s = this.dotsMode ? "#ffffff" : this.settings.connectionColor, c = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), l = new k.Line({
5179
+ let s = this.dotsMode ? "#ffffff" : this.settings.connectionColor, c = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), l = new D.Line({
4803
5180
  points: [
4804
5181
  a.x,
4805
5182
  a.y,
@@ -4832,16 +5209,16 @@ var ia = class {
4832
5209
  if (!isFinite(e.x) || !isFinite(e.y)) continue;
4833
5210
  let t = e.areaId === this.highlightedArea;
4834
5211
  if (this.dotsMode) {
4835
- let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new k.Group({
5212
+ let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new D.Group({
4836
5213
  x: n,
4837
5214
  y: r,
4838
5215
  draggable: !0
4839
- }), a = new k.Circle({
5216
+ }), a = new D.Circle({
4840
5217
  radius: 6,
4841
5218
  fill: t ? this.settings.highlightColor : "#ffffff",
4842
5219
  stroke: t ? this.settings.highlightColor : "#ffffff",
4843
5220
  strokeWidth: 1
4844
- }), o = new k.Text({
5221
+ }), o = new D.Text({
4845
5222
  text: e.name,
4846
5223
  fontSize: 10,
4847
5224
  fill: "#ffffff",
@@ -4862,18 +5239,18 @@ var ia = class {
4862
5239
  this.stage.container().style.cursor = "pointer";
4863
5240
  }), this.areaLayer.add(i);
4864
5241
  } else {
4865
- let n = new k.Group({
5242
+ let n = new D.Group({
4866
5243
  x: e.x,
4867
5244
  y: e.y,
4868
5245
  draggable: !0
4869
- }), r = new k.Rect({
5246
+ }), r = new D.Rect({
4870
5247
  width: e.width,
4871
5248
  height: e.height,
4872
5249
  fill: this.settings.areaFillColor,
4873
5250
  stroke: t ? this.settings.highlightColor : this.settings.areaStrokeColor,
4874
5251
  strokeWidth: t ? 3 : 2,
4875
5252
  cornerRadius: 8
4876
- }), i = new k.Text({
5253
+ }), i = new D.Text({
4877
5254
  text: e.name,
4878
5255
  fontSize: this.settings.fontSize,
4879
5256
  fill: this.settings.textColor,
@@ -4885,7 +5262,7 @@ var ia = class {
4885
5262
  verticalAlign: "middle",
4886
5263
  ellipsis: !0,
4887
5264
  wrap: "word"
4888
- }), a = new k.Text({
5265
+ }), a = new D.Text({
4889
5266
  text: `${e.roomCount} rooms`,
4890
5267
  fontSize: 10,
4891
5268
  fill: this.settings.connectionColor,
@@ -4949,6 +5326,6 @@ var ia = class {
4949
5326
  }
4950
5327
  };
4951
5328
  //#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 };
5329
+ export { u as ALL_VISIBLE, Ui as AmbientLightOverlay, ve as Area, wa as AreaMapRenderer, Xr as Blueprint, T as Camera, Ii as CanvasExporter, ei as Construction, ie as CullingManager, si as DarkModern, qe as DrawCommandLayerNode, xa as ExplorationLens, ni as GradientRooms, ii as GraphPaper, ce as HitTester, e as IDENTITY_TRANSFORM, $r as Isometric, da as MapGraph, ye as MapReader, li as MapRenderer, Me as MapState, Je as MaterializingLayerNode, Zr as Neon, Yr as Parchment, _a as PathFinder, _e as Plane, Pi as PngBlobExporter, Li as PngBytesExporter, Ni as PngExporter, ne as ProjectedMapReader, a as ROOM_UI_BORDER_COLOR, c as ROOM_UI_BORDER_THICKNESS, l as ROOM_UI_HIDDEN, Ge as RecordingGroupNode, j as RecordingLayerNode, qi as RippleEffect, ti as SciFi, Qr as Sketchy, ri as StainedGlass, Mi as SvgExporter, ai as Topographic, ci as TreasureMap, oi as Watercolor, ra as WaypointOverlay, E as applyStyleToShapes, di as buildDrawCommands, Fi as canvasToBytes, s as colorLightness, re as compose, ba as composeLenses, lt as computeLodMode, b as computeNeighborSpill, le as computePathData, Ca as createAreaMapSettings, je as createSettings, _ as darkenColor, d as defaultExitTreatment, m as getRoomBorderColor, ge as getRoomBorderThickness, y as hexToRgba, x as identityStyle, Ye as isGradientFill, va as isHashLookupCapable, v as isRoomHidden, N as isViewportDataSource, na as placeLabels, fe as projectRoom, Ti as renderToCanvas, Ze as shapeToRecording, ct as shouldUseRaster, he as spillPositionMap, xi as svgFromBatches, M as transformFill, Jr as treasureMapDecorations };
4953
5330
 
4954
5331
  //# sourceMappingURL=index.mjs.map