mudlet-map-editor 0.6.2 → 0.7.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.
package/dist-lib/index.js CHANGED
@@ -105,7 +105,7 @@ function O(e) {
105
105
  //#endregion
106
106
  //#region node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js
107
107
  var k = {}, A = {};
108
- A.byteLength = R, A.toByteArray = z, A.fromByteArray = te;
108
+ A.byteLength = R, A.toByteArray = B, A.fromByteArray = ee;
109
109
  for (var j = [], M = [], N = typeof Uint8Array < "u" ? Uint8Array : Array, P = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", F = 0, I = P.length; F < I; ++F) j[F] = P[F], M[P.charCodeAt(F)] = F;
110
110
  M[45] = 62, M[95] = 63;
111
111
  function L(e) {
@@ -120,27 +120,27 @@ function R(e) {
120
120
  var t = L(e), n = t[0], r = t[1];
121
121
  return (n + r) * 3 / 4 - r;
122
122
  }
123
- function ee(e, t, n) {
123
+ function z(e, t, n) {
124
124
  return (t + n) * 3 / 4 - n;
125
125
  }
126
- function z(e) {
127
- var t, n = L(e), r = n[0], i = n[1], a = new N(ee(e, r, i)), o = 0, s = i > 0 ? r - 4 : r, c;
126
+ function B(e) {
127
+ var t, n = L(e), r = n[0], i = n[1], a = new N(z(e, r, i)), o = 0, s = i > 0 ? r - 4 : r, c;
128
128
  for (c = 0; c < s; c += 4) t = M[e.charCodeAt(c)] << 18 | M[e.charCodeAt(c + 1)] << 12 | M[e.charCodeAt(c + 2)] << 6 | M[e.charCodeAt(c + 3)], a[o++] = t >> 16 & 255, a[o++] = t >> 8 & 255, a[o++] = t & 255;
129
129
  return i === 2 && (t = M[e.charCodeAt(c)] << 2 | M[e.charCodeAt(c + 1)] >> 4, a[o++] = t & 255), i === 1 && (t = M[e.charCodeAt(c)] << 10 | M[e.charCodeAt(c + 1)] << 4 | M[e.charCodeAt(c + 2)] >> 2, a[o++] = t >> 8 & 255, a[o++] = t & 255), a;
130
130
  }
131
- function B(e) {
131
+ function V(e) {
132
132
  return j[e >> 18 & 63] + j[e >> 12 & 63] + j[e >> 6 & 63] + j[e & 63];
133
133
  }
134
- function V(e, t, n) {
135
- for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(B(r));
134
+ function H(e, t, n) {
135
+ for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(V(r));
136
136
  return i.join("");
137
137
  }
138
- function te(e) {
139
- for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(V(e, o, o + a > s ? s : o + a));
138
+ function ee(e) {
139
+ for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(H(e, o, o + a > s ? s : o + a));
140
140
  return r === 1 ? (t = e[n - 1], i.push(j[t >> 2] + j[t << 4 & 63] + "==")) : r === 2 && (t = (e[n - 2] << 8) + e[n - 1], i.push(j[t >> 10] + j[t >> 4 & 63] + j[t << 2 & 63] + "=")), i.join("");
141
141
  }
142
- var ne = {};
143
- ne.read = function(e, t, n, r, i) {
142
+ var te = {};
143
+ te.read = function(e, t, n, r, i) {
144
144
  var a, o, s = i * 8 - r - 1, c = (1 << s) - 1, l = c >> 1, u = -7, d = n ? i - 1 : 0, f = n ? -1 : 1, p = e[t + d];
145
145
  for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
146
146
  for (o = a & (1 << -u) - 1, a >>= -u, u += r; u > 0; o = o * 256 + e[t + d], d += f, u -= 8);
@@ -148,13 +148,13 @@ ne.read = function(e, t, n, r, i) {
148
148
  else if (a === c) return o ? NaN : (p ? -1 : 1) * Infinity;
149
149
  else o += 2 ** r, a -= l;
150
150
  return (p ? -1 : 1) * o * 2 ** (a - r);
151
- }, ne.write = function(e, t, n, r, i, a) {
151
+ }, te.write = function(e, t, n, r, i, a) {
152
152
  var o, s, c, l = a * 8 - i - 1, u = (1 << l) - 1, d = u >> 1, f = i === 23 ? 2 ** -24 - 2 ** -77 : 0, p = r ? 0 : a - 1, m = r ? 1 : -1, h = +(t < 0 || t === 0 && 1 / t < 0);
153
153
  for (t = Math.abs(t), isNaN(t) || t === Infinity ? (s = +!!isNaN(t), o = u) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = 2 ** -o) < 1 && (o--, c *= 2), o + d >= 1 ? t += f / c : t += f * 2 ** (1 - d), t * c >= 2 && (o++, c /= 2), o + d >= u ? (s = 0, o = u) : o + d >= 1 ? (s = (t * c - 1) * 2 ** i, o += d) : (s = t * 2 ** (d - 1) * 2 ** i, o = 0)); i >= 8; e[n + p] = s & 255, p += m, s /= 256, i -= 8);
154
154
  for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
155
155
  e[n + p - m] |= h * 128;
156
156
  }, (function(e) {
157
- let t = A, n = ne, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
157
+ let t = A, n = te, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
158
158
  e.Buffer = u, e.SlowBuffer = x, e.INSPECT_MAX_BYTES = 50;
159
159
  let i = 2147483647;
160
160
  e.kMaxLength = i;
@@ -198,7 +198,7 @@ ne.read = function(e, t, n, r, i) {
198
198
  if (typeof e == "string") return h(e, t);
199
199
  if (o.isView(e)) return _(e);
200
200
  if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
201
- if (q(e, o) || e && q(e.buffer, o) || s !== void 0 && (q(e, s) || e && q(e.buffer, s))) return v(e, t, n);
201
+ if (J(e, o) || e && J(e.buffer, o) || s !== void 0 && (J(e, s) || e && J(e.buffer, s))) return v(e, t, n);
202
202
  if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
203
203
  let r = e.valueOf && e.valueOf();
204
204
  if (r != null && r !== e) return u.from(r, t, n);
@@ -239,7 +239,7 @@ ne.read = function(e, t, n, r, i) {
239
239
  return n;
240
240
  }
241
241
  function _(e) {
242
- if (q(e, a)) {
242
+ if (J(e, a)) {
243
243
  let t = new a(e);
244
244
  return v(t.buffer, t.byteOffset, t.byteLength);
245
245
  }
@@ -256,7 +256,7 @@ ne.read = function(e, t, n, r, i) {
256
256
  let t = b(e.length) | 0, n = l(t);
257
257
  return n.length === 0 || e.copy(n, 0, 0, t), n;
258
258
  }
259
- if (e.length !== void 0) return typeof e.length != "number" || ge(e.length) ? l(0) : g(e);
259
+ if (e.length !== void 0) return typeof e.length != "number" || he(e.length) ? l(0) : g(e);
260
260
  if (e.type === "Buffer" && Array.isArray(e.data)) return g(e.data);
261
261
  }
262
262
  function b(e) {
@@ -269,7 +269,7 @@ ne.read = function(e, t, n, r, i) {
269
269
  u.isBuffer = function(e) {
270
270
  return e != null && e._isBuffer === !0 && e !== u.prototype;
271
271
  }, u.compare = function(e, t) {
272
- if (q(e, a) && (e = u.from(e, e.offset, e.byteLength)), q(t, a) && (t = u.from(t, t.offset, t.byteLength)), !u.isBuffer(e) || !u.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
272
+ if (J(e, a) && (e = u.from(e, e.offset, e.byteLength)), J(t, a) && (t = u.from(t, t.offset, t.byteLength)), !u.isBuffer(e) || !u.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
273
273
  if (e === t) return 0;
274
274
  let n = e.length, r = t.length;
275
275
  for (let i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
@@ -300,7 +300,7 @@ ne.read = function(e, t, n, r, i) {
300
300
  let r = u.allocUnsafe(t), i = 0;
301
301
  for (n = 0; n < e.length; ++n) {
302
302
  let t = e[n];
303
- if (q(t, a)) i + t.length > r.length ? (u.isBuffer(t) || (t = u.from(t)), t.copy(r, i)) : a.prototype.set.call(r, t, i);
303
+ if (J(t, a)) i + t.length > r.length ? (u.isBuffer(t) || (t = u.from(t)), t.copy(r, i)) : a.prototype.set.call(r, t, i);
304
304
  else if (u.isBuffer(t)) t.copy(r, i);
305
305
  else throw TypeError("\"list\" argument must be an Array of Buffers");
306
306
  i += t.length;
@@ -309,7 +309,7 @@ ne.read = function(e, t, n, r, i) {
309
309
  };
310
310
  function S(e, t) {
311
311
  if (u.isBuffer(e)) return e.length;
312
- if (o.isView(e) || q(e, o)) return e.byteLength;
312
+ if (o.isView(e) || J(e, o)) return e.byteLength;
313
313
  if (typeof e != "string") throw TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof e);
314
314
  let n = e.length, r = arguments.length > 2 && arguments[2] === !0;
315
315
  if (!r && n === 0) return 0;
@@ -319,15 +319,15 @@ ne.read = function(e, t, n, r, i) {
319
319
  case "latin1":
320
320
  case "binary": return n;
321
321
  case "utf8":
322
- case "utf-8": return fe(e).length;
322
+ case "utf-8": return de(e).length;
323
323
  case "ucs2":
324
324
  case "ucs-2":
325
325
  case "utf16le":
326
326
  case "utf-16le": return n * 2;
327
327
  case "hex": return n >>> 1;
328
- case "base64": return K(e).length;
328
+ case "base64": return q(e).length;
329
329
  default:
330
- if (i) return r ? -1 : fe(e).length;
330
+ if (i) return r ? -1 : de(e).length;
331
331
  t = ("" + t).toLowerCase(), i = !0;
332
332
  }
333
333
  }
@@ -336,7 +336,7 @@ ne.read = function(e, t, n, r, i) {
336
336
  let r = !1;
337
337
  if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((n === void 0 || n > this.length) && (n = this.length), n <= 0) || (n >>>= 0, t >>>= 0, n <= t)) return "";
338
338
  for (e ||= "utf8";;) switch (e) {
339
- case "hex": return ee(this, t, n);
339
+ case "hex": return z(this, t, n);
340
340
  case "utf8":
341
341
  case "utf-8": return P(this, t, n);
342
342
  case "ascii": return L(this, t, n);
@@ -346,7 +346,7 @@ ne.read = function(e, t, n, r, i) {
346
346
  case "ucs2":
347
347
  case "ucs-2":
348
348
  case "utf16le":
349
- case "utf-16le": return z(this, t, n);
349
+ case "utf-16le": return B(this, t, n);
350
350
  default:
351
351
  if (r) throw TypeError("Unknown encoding: " + e);
352
352
  e = (e + "").toLowerCase(), r = !0;
@@ -382,7 +382,7 @@ ne.read = function(e, t, n, r, i) {
382
382
  let t = "", n = e.INSPECT_MAX_BYTES;
383
383
  return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
384
384
  }, r && (u.prototype[r] = u.prototype.inspect), u.prototype.compare = function(e, t, n, r, i) {
385
- if (q(e, a) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
385
+ if (J(e, a) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
386
386
  if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
387
387
  if (r >= i && t >= n) return 0;
388
388
  if (r >= i) return -1;
@@ -397,7 +397,7 @@ ne.read = function(e, t, n, r, i) {
397
397
  };
398
398
  function T(e, t, n, r, i) {
399
399
  if (e.length === 0) return -1;
400
- if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, ge(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
400
+ if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, he(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
401
401
  if (i) return -1;
402
402
  n = e.length - 1;
403
403
  } else if (n < 0) if (i) n = 0;
@@ -447,22 +447,22 @@ ne.read = function(e, t, n, r, i) {
447
447
  let o;
448
448
  for (o = 0; o < r; ++o) {
449
449
  let r = parseInt(t.substr(o * 2, 2), 16);
450
- if (ge(r)) return o;
450
+ if (he(r)) return o;
451
451
  e[n + o] = r;
452
452
  }
453
453
  return o;
454
454
  }
455
455
  function O(e, t, n, r) {
456
- return he(fe(t, e.length - n), e, n, r);
456
+ return me(de(t, e.length - n), e, n, r);
457
457
  }
458
458
  function k(e, t, n, r) {
459
- return he(pe(t), e, n, r);
459
+ return me(fe(t), e, n, r);
460
460
  }
461
461
  function j(e, t, n, r) {
462
- return he(K(t), e, n, r);
462
+ return me(q(t), e, n, r);
463
463
  }
464
464
  function M(e, t, n, r) {
465
- return he(me(t, e.length - n), e, n, r);
465
+ return me(pe(t, e.length - n), e, n, r);
466
466
  }
467
467
  u.prototype.write = function(e, t, n, r) {
468
468
  if (t === void 0) r = "utf8", n = this.length, t = 0;
@@ -542,14 +542,14 @@ ne.read = function(e, t, n, r, i) {
542
542
  for (let i = t; i < n; ++i) r += String.fromCharCode(e[i]);
543
543
  return r;
544
544
  }
545
- function ee(e, t, n) {
545
+ function z(e, t, n) {
546
546
  let r = e.length;
547
547
  (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
548
548
  let i = "";
549
- for (let r = t; r < n; ++r) i += _e[e[r]];
549
+ for (let r = t; r < n; ++r) i += ge[e[r]];
550
550
  return i;
551
551
  }
552
- function z(e, t, n) {
552
+ function B(e, t, n) {
553
553
  let r = e.slice(t, n), i = "";
554
554
  for (let e = 0; e < r.length - 1; e += 2) i += String.fromCharCode(r[e] + r[e + 1] * 256);
555
555
  return i;
@@ -560,88 +560,88 @@ ne.read = function(e, t, n, r, i) {
560
560
  let r = this.subarray(e, t);
561
561
  return Object.setPrototypeOf(r, u.prototype), r;
562
562
  };
563
- function B(e, t, n) {
563
+ function V(e, t, n) {
564
564
  if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
565
565
  if (e + t > n) throw RangeError("Trying to access beyond buffer length");
566
566
  }
567
567
  u.prototype.readUintLE = u.prototype.readUIntLE = function(e, t, n) {
568
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
568
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
569
569
  let r = this[e], i = 1, a = 0;
570
570
  for (; ++a < t && (i *= 256);) r += this[e + a] * i;
571
571
  return r;
572
572
  }, u.prototype.readUintBE = u.prototype.readUIntBE = function(e, t, n) {
573
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
573
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
574
574
  let r = this[e + --t], i = 1;
575
575
  for (; t > 0 && (i *= 256);) r += this[e + --t] * i;
576
576
  return r;
577
577
  }, u.prototype.readUint8 = u.prototype.readUInt8 = function(e, t) {
578
- return e >>>= 0, t || B(e, 1, this.length), this[e];
578
+ return e >>>= 0, t || V(e, 1, this.length), this[e];
579
579
  }, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(e, t) {
580
- return e >>>= 0, t || B(e, 2, this.length), this[e] | this[e + 1] << 8;
580
+ return e >>>= 0, t || V(e, 2, this.length), this[e] | this[e + 1] << 8;
581
581
  }, u.prototype.readUint16BE = u.prototype.readUInt16BE = function(e, t) {
582
- return e >>>= 0, t || B(e, 2, this.length), this[e] << 8 | this[e + 1];
582
+ return e >>>= 0, t || V(e, 2, this.length), this[e] << 8 | this[e + 1];
583
583
  }, u.prototype.readUint32LE = u.prototype.readUInt32LE = function(e, t) {
584
- return e >>>= 0, t || B(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
584
+ return e >>>= 0, t || V(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
585
585
  }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
586
- return e >>>= 0, t || B(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
587
- }, u.prototype.readBigUInt64LE = ve(function(e) {
588
- e >>>= 0, ce(e, "offset");
586
+ return e >>>= 0, t || V(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
587
+ }, u.prototype.readBigUInt64LE = _e(function(e) {
588
+ e >>>= 0, se(e, "offset");
589
589
  let t = this[e], n = this[e + 7];
590
- (t === void 0 || n === void 0) && le(e, this.length - 8);
590
+ (t === void 0 || n === void 0) && ce(e, this.length - 8);
591
591
  let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
592
592
  return BigInt(r) + (BigInt(i) << BigInt(32));
593
- }), u.prototype.readBigUInt64BE = ve(function(e) {
594
- e >>>= 0, ce(e, "offset");
593
+ }), u.prototype.readBigUInt64BE = _e(function(e) {
594
+ e >>>= 0, se(e, "offset");
595
595
  let t = this[e], n = this[e + 7];
596
- (t === void 0 || n === void 0) && le(e, this.length - 8);
596
+ (t === void 0 || n === void 0) && ce(e, this.length - 8);
597
597
  let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
598
598
  return (BigInt(r) << BigInt(32)) + BigInt(i);
599
599
  }), u.prototype.readIntLE = function(e, t, n) {
600
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
600
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
601
601
  let r = this[e], i = 1, a = 0;
602
602
  for (; ++a < t && (i *= 256);) r += this[e + a] * i;
603
603
  return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
604
604
  }, u.prototype.readIntBE = function(e, t, n) {
605
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
605
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
606
606
  let r = t, i = 1, a = this[e + --r];
607
607
  for (; r > 0 && (i *= 256);) a += this[e + --r] * i;
608
608
  return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
609
609
  }, u.prototype.readInt8 = function(e, t) {
610
- return e >>>= 0, t || B(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
610
+ return e >>>= 0, t || V(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
611
611
  }, u.prototype.readInt16LE = function(e, t) {
612
- e >>>= 0, t || B(e, 2, this.length);
612
+ e >>>= 0, t || V(e, 2, this.length);
613
613
  let n = this[e] | this[e + 1] << 8;
614
614
  return n & 32768 ? n | 4294901760 : n;
615
615
  }, u.prototype.readInt16BE = function(e, t) {
616
- e >>>= 0, t || B(e, 2, this.length);
616
+ e >>>= 0, t || V(e, 2, this.length);
617
617
  let n = this[e + 1] | this[e] << 8;
618
618
  return n & 32768 ? n | 4294901760 : n;
619
619
  }, u.prototype.readInt32LE = function(e, t) {
620
- return e >>>= 0, t || B(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
620
+ return e >>>= 0, t || V(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
621
621
  }, u.prototype.readInt32BE = function(e, t) {
622
- return e >>>= 0, t || B(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
623
- }, u.prototype.readBigInt64LE = ve(function(e) {
624
- e >>>= 0, ce(e, "offset");
622
+ return e >>>= 0, t || V(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
623
+ }, u.prototype.readBigInt64LE = _e(function(e) {
624
+ e >>>= 0, se(e, "offset");
625
625
  let t = this[e], n = this[e + 7];
626
- (t === void 0 || n === void 0) && le(e, this.length - 8);
626
+ (t === void 0 || n === void 0) && ce(e, this.length - 8);
627
627
  let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
628
628
  return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
629
- }), u.prototype.readBigInt64BE = ve(function(e) {
630
- e >>>= 0, ce(e, "offset");
629
+ }), u.prototype.readBigInt64BE = _e(function(e) {
630
+ e >>>= 0, se(e, "offset");
631
631
  let t = this[e], n = this[e + 7];
632
- (t === void 0 || n === void 0) && le(e, this.length - 8);
632
+ (t === void 0 || n === void 0) && ce(e, this.length - 8);
633
633
  let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
634
634
  return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
635
635
  }), u.prototype.readFloatLE = function(e, t) {
636
- return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !0, 23, 4);
636
+ return e >>>= 0, t || V(e, 4, this.length), n.read(this, e, !0, 23, 4);
637
637
  }, u.prototype.readFloatBE = function(e, t) {
638
- return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !1, 23, 4);
638
+ return e >>>= 0, t || V(e, 4, this.length), n.read(this, e, !1, 23, 4);
639
639
  }, u.prototype.readDoubleLE = function(e, t) {
640
- return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !0, 52, 8);
640
+ return e >>>= 0, t || V(e, 8, this.length), n.read(this, e, !0, 52, 8);
641
641
  }, u.prototype.readDoubleBE = function(e, t) {
642
- return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !1, 52, 8);
642
+ return e >>>= 0, t || V(e, 8, this.length), n.read(this, e, !1, 52, 8);
643
643
  };
644
- function V(e, t, n, r, i, a) {
644
+ function H(e, t, n, r, i, a) {
645
645
  if (!u.isBuffer(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
646
646
  if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
647
647
  if (n + r > e.length) throw RangeError("Index out of range");
@@ -649,7 +649,7 @@ ne.read = function(e, t, n, r, i) {
649
649
  u.prototype.writeUintLE = u.prototype.writeUIntLE = function(e, t, n, r) {
650
650
  if (e = +e, t >>>= 0, n >>>= 0, !r) {
651
651
  let r = 2 ** (8 * n) - 1;
652
- V(this, e, t, n, r, 0);
652
+ H(this, e, t, n, r, 0);
653
653
  }
654
654
  let i = 1, a = 0;
655
655
  for (this[t] = e & 255; ++a < n && (i *= 256);) this[t + a] = e / i & 255;
@@ -657,44 +657,44 @@ ne.read = function(e, t, n, r, i) {
657
657
  }, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(e, t, n, r) {
658
658
  if (e = +e, t >>>= 0, n >>>= 0, !r) {
659
659
  let r = 2 ** (8 * n) - 1;
660
- V(this, e, t, n, r, 0);
660
+ H(this, e, t, n, r, 0);
661
661
  }
662
662
  let i = n - 1, a = 1;
663
663
  for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) this[t + i] = e / a & 255;
664
664
  return t + n;
665
665
  }, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(e, t, n) {
666
- return e = +e, t >>>= 0, n || V(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
666
+ return e = +e, t >>>= 0, n || H(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
667
667
  }, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(e, t, n) {
668
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
668
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
669
669
  }, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(e, t, n) {
670
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
670
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
671
671
  }, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(e, t, n) {
672
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
672
+ return e = +e, t >>>= 0, n || H(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
673
673
  }, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(e, t, n) {
674
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
674
+ return e = +e, t >>>= 0, n || H(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
675
675
  };
676
- function te(e, t, n, r, i) {
677
- se(t, r, i, e, n, 7);
676
+ function ee(e, t, n, r, i) {
677
+ oe(t, r, i, e, n, 7);
678
678
  let a = Number(t & BigInt(4294967295));
679
679
  e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
680
680
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
681
681
  return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
682
682
  }
683
- function re(e, t, n, r, i) {
684
- se(t, r, i, e, n, 7);
683
+ function ne(e, t, n, r, i) {
684
+ oe(t, r, i, e, n, 7);
685
685
  let a = Number(t & BigInt(4294967295));
686
686
  e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
687
687
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
688
688
  return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
689
689
  }
690
- u.prototype.writeBigUInt64LE = ve(function(e, t = 0) {
691
- return te(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
692
- }), u.prototype.writeBigUInt64BE = ve(function(e, t = 0) {
693
- return re(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
690
+ u.prototype.writeBigUInt64LE = _e(function(e, t = 0) {
691
+ return ee(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
692
+ }), u.prototype.writeBigUInt64BE = _e(function(e, t = 0) {
693
+ return ne(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
694
694
  }), u.prototype.writeIntLE = function(e, t, n, r) {
695
695
  if (e = +e, t >>>= 0, !r) {
696
696
  let r = 2 ** (8 * n - 1);
697
- V(this, e, t, n, r - 1, -r);
697
+ H(this, e, t, n, r - 1, -r);
698
698
  }
699
699
  let i = 0, a = 1, o = 0;
700
700
  for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
@@ -702,44 +702,44 @@ ne.read = function(e, t, n, r, i) {
702
702
  }, u.prototype.writeIntBE = function(e, t, n, r) {
703
703
  if (e = +e, t >>>= 0, !r) {
704
704
  let r = 2 ** (8 * n - 1);
705
- V(this, e, t, n, r - 1, -r);
705
+ H(this, e, t, n, r - 1, -r);
706
706
  }
707
707
  let i = n - 1, a = 1, o = 0;
708
708
  for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
709
709
  return t + n;
710
710
  }, u.prototype.writeInt8 = function(e, t, n) {
711
- return e = +e, t >>>= 0, n || V(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
711
+ return e = +e, t >>>= 0, n || H(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
712
712
  }, u.prototype.writeInt16LE = function(e, t, n) {
713
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
713
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
714
714
  }, u.prototype.writeInt16BE = function(e, t, n) {
715
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
715
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
716
716
  }, u.prototype.writeInt32LE = function(e, t, n) {
717
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
717
+ return e = +e, t >>>= 0, n || H(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
718
718
  }, u.prototype.writeInt32BE = function(e, t, n) {
719
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
720
- }, u.prototype.writeBigInt64LE = ve(function(e, t = 0) {
721
- return te(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
722
- }), u.prototype.writeBigInt64BE = ve(function(e, t = 0) {
723
- return re(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
719
+ return e = +e, t >>>= 0, n || H(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
720
+ }, u.prototype.writeBigInt64LE = _e(function(e, t = 0) {
721
+ return ee(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
722
+ }), u.prototype.writeBigInt64BE = _e(function(e, t = 0) {
723
+ return ne(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
724
724
  });
725
- function ie(e, t, n, r, i, a) {
725
+ function re(e, t, n, r, i, a) {
726
726
  if (n + r > e.length || n < 0) throw RangeError("Index out of range");
727
727
  }
728
- function H(e, t, r, i, a) {
729
- return t = +t, r >>>= 0, a || ie(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
728
+ function U(e, t, r, i, a) {
729
+ return t = +t, r >>>= 0, a || re(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
730
730
  }
731
731
  u.prototype.writeFloatLE = function(e, t, n) {
732
- return H(this, e, t, !0, n);
732
+ return U(this, e, t, !0, n);
733
733
  }, u.prototype.writeFloatBE = function(e, t, n) {
734
- return H(this, e, t, !1, n);
734
+ return U(this, e, t, !1, n);
735
735
  };
736
- function U(e, t, r, i, a) {
737
- return t = +t, r >>>= 0, a || ie(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
736
+ function W(e, t, r, i, a) {
737
+ return t = +t, r >>>= 0, a || re(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
738
738
  }
739
739
  u.prototype.writeDoubleLE = function(e, t, n) {
740
- return U(this, e, t, !0, n);
740
+ return W(this, e, t, !0, n);
741
741
  }, u.prototype.writeDoubleBE = function(e, t, n) {
742
- return U(this, e, t, !1, n);
742
+ return W(this, e, t, !1, n);
743
743
  }, u.prototype.copy = function(e, t, n, r) {
744
744
  if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
745
745
  if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
@@ -770,9 +770,9 @@ ne.read = function(e, t, n, r, i) {
770
770
  }
771
771
  return this;
772
772
  };
773
- let W = {};
774
- function G(e, t, n) {
775
- W[e] = class extends n {
773
+ let G = {};
774
+ function K(e, t, n) {
775
+ G[e] = class extends n {
776
776
  constructor() {
777
777
  super(), Object.defineProperty(this, "message", {
778
778
  value: t.apply(this, arguments),
@@ -796,42 +796,42 @@ ne.read = function(e, t, n, r, i) {
796
796
  }
797
797
  };
798
798
  }
799
- G("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
799
+ K("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
800
800
  return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
801
- }, RangeError), G("ERR_INVALID_ARG_TYPE", function(e, t) {
801
+ }, RangeError), K("ERR_INVALID_ARG_TYPE", function(e, t) {
802
802
  return `The "${e}" argument must be of type number. Received type ${typeof t}`;
803
- }, TypeError), G("ERR_OUT_OF_RANGE", function(e, t, n) {
803
+ }, TypeError), K("ERR_OUT_OF_RANGE", function(e, t, n) {
804
804
  let r = `The value of "${e}" is out of range.`, i = n;
805
- return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = ae(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = ae(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
805
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = ie(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = ie(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
806
806
  }, RangeError);
807
- function ae(e) {
807
+ function ie(e) {
808
808
  let t = "", n = e.length, r = +(e[0] === "-");
809
809
  for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
810
810
  return `${e.slice(0, n)}${t}`;
811
811
  }
812
- function oe(e, t, n) {
813
- ce(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && le(t, e.length - (n + 1));
812
+ function ae(e, t, n) {
813
+ se(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && ce(t, e.length - (n + 1));
814
814
  }
815
- function se(e, t, n, r, i, a) {
815
+ function oe(e, t, n, r, i, a) {
816
816
  if (e > n || e < t) {
817
817
  let r = typeof t == "bigint" ? "n" : "", i;
818
- throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new W.ERR_OUT_OF_RANGE("value", i, e);
818
+ throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new G.ERR_OUT_OF_RANGE("value", i, e);
819
819
  }
820
- oe(r, i, a);
820
+ ae(r, i, a);
821
821
  }
822
- function ce(e, t) {
823
- if (typeof e != "number") throw new W.ERR_INVALID_ARG_TYPE(t, "number", e);
822
+ function se(e, t) {
823
+ if (typeof e != "number") throw new G.ERR_INVALID_ARG_TYPE(t, "number", e);
824
824
  }
825
- function le(e, t, n) {
826
- throw Math.floor(e) === e ? t < 0 ? new W.ERR_BUFFER_OUT_OF_BOUNDS() : new W.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (ce(e, n), new W.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
825
+ function ce(e, t, n) {
826
+ throw Math.floor(e) === e ? t < 0 ? new G.ERR_BUFFER_OUT_OF_BOUNDS() : new G.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (se(e, n), new G.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
827
827
  }
828
- let ue = /[^+/0-9A-Za-z-_]/g;
829
- function de(e) {
830
- if (e = e.split("=")[0], e = e.trim().replace(ue, ""), e.length < 2) return "";
828
+ let le = /[^+/0-9A-Za-z-_]/g;
829
+ function ue(e) {
830
+ if (e = e.split("=")[0], e = e.trim().replace(le, ""), e.length < 2) return "";
831
831
  for (; e.length % 4 != 0;) e += "=";
832
832
  return e;
833
833
  }
834
- function fe(e, t) {
834
+ function de(e, t) {
835
835
  t ||= Infinity;
836
836
  let n, r = e.length, i = null, a = [];
837
837
  for (let o = 0; o < r; ++o) {
@@ -869,31 +869,31 @@ ne.read = function(e, t, n, r, i) {
869
869
  }
870
870
  return a;
871
871
  }
872
- function pe(e) {
872
+ function fe(e) {
873
873
  let t = [];
874
874
  for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
875
875
  return t;
876
876
  }
877
- function me(e, t) {
877
+ function pe(e, t) {
878
878
  let n, r, i, a = [];
879
879
  for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
880
880
  return a;
881
881
  }
882
- function K(e) {
883
- return t.toByteArray(de(e));
882
+ function q(e) {
883
+ return t.toByteArray(ue(e));
884
884
  }
885
- function he(e, t, n, r) {
885
+ function me(e, t, n, r) {
886
886
  let i;
887
887
  for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
888
888
  return i;
889
889
  }
890
- function q(e, t) {
890
+ function J(e, t) {
891
891
  return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
892
892
  }
893
- function ge(e) {
893
+ function he(e) {
894
894
  return e !== e;
895
895
  }
896
- let _e = (function() {
896
+ let ge = (function() {
897
897
  let e = "0123456789abcdef", t = Array(256);
898
898
  for (let n = 0; n < 16; ++n) {
899
899
  let r = n * 16;
@@ -901,27 +901,27 @@ ne.read = function(e, t, n, r, i) {
901
901
  }
902
902
  return t;
903
903
  })();
904
- function ve(e) {
905
- return typeof BigInt > "u" ? ye : e;
904
+ function _e(e) {
905
+ return typeof BigInt > "u" ? ve : e;
906
906
  }
907
- function ye() {
907
+ function ve() {
908
908
  throw Error("BigInt not supported");
909
909
  }
910
910
  })(k), k.Buffer, k.Blob, k.BlobOptions;
911
- var re = k.Buffer;
911
+ var ne = k.Buffer;
912
912
  k.File, k.FileOptions, k.INSPECT_MAX_BYTES, k.SlowBuffer, k.TranscodeEncoding, k.atob, k.btoa, k.constants, k.isAscii, k.isUtf8, k.kMaxLength, k.kStringMaxLength, k.resolveObjectURL, k.transcode;
913
913
  //#endregion
914
914
  //#region src/mapIO.ts
915
- function ie(e) {
916
- return o(re.from(e));
915
+ function re(e) {
916
+ return o(ne.from(e));
917
917
  }
918
- function H(e) {
918
+ function U(e) {
919
919
  return new Uint8Array(c(e));
920
920
  }
921
- function U(e) {
921
+ function W(e) {
922
922
  return s(e);
923
923
  }
924
- function W() {
924
+ function G() {
925
925
  return {
926
926
  version: 20,
927
927
  rooms: {},
@@ -971,7 +971,7 @@ function W() {
971
971
  }
972
972
  //#endregion
973
973
  //#region src/editor/loadFile.ts
974
- async function G(e, t) {
974
+ async function K(e, t) {
975
975
  try {
976
976
  D.setState({ status: "Fetching…" });
977
977
  let n = await fetch(e);
@@ -989,7 +989,7 @@ async function G(e, t) {
989
989
  }
990
990
  let s = new Uint8Array(o), c = 0;
991
991
  for (let e of a) s.set(e, c), c += e.length;
992
- let l = e.split("/").pop()?.split("?")[0] || "map.dat", u = ie(s.buffer), d = Number(Object.keys(u.areaNames)[0] ?? -1), f = Number.isNaN(d) ? null : d;
992
+ let l = e.split("/").pop()?.split("?")[0] || "map.dat", u = re(s.buffer), d = Number(Object.keys(u.areaNames)[0] ?? -1), f = Number.isNaN(d) ? null : d;
993
993
  D.setState({
994
994
  map: u,
995
995
  loaded: { fileName: l },
@@ -1008,10 +1008,10 @@ async function G(e, t) {
1008
1008
  D.setState({ status: `Failed to load URL: ${e.message}` });
1009
1009
  }
1010
1010
  }
1011
- async function ae(e) {
1011
+ async function ie(e) {
1012
1012
  try {
1013
1013
  D.setState({ status: `Reading ${e.name}…` });
1014
- let t = ie(await e.arrayBuffer()), n = Number(Object.keys(t.areaNames)[0] ?? -1), r = Number.isNaN(n) ? null : n;
1014
+ let t = re(await e.arrayBuffer()), n = Number(Object.keys(t.areaNames)[0] ?? -1), r = Number.isNaN(n) ? null : n;
1015
1015
  D.setState({
1016
1016
  map: t,
1017
1017
  loaded: { fileName: e.name },
@@ -1032,7 +1032,7 @@ async function ae(e) {
1032
1032
  }
1033
1033
  //#endregion
1034
1034
  //#region src/components/DropdownSelect.tsx
1035
- function oe({ label: e, value: n, options: a, onChange: o, searchable: s, emptyText: c = "—", width: p }) {
1035
+ function ae({ label: e, value: n, options: a, onChange: o, searchable: s, emptyText: c = "—", width: p }) {
1036
1036
  let [m, h] = i(!1), [g, _] = i(""), [v, y] = i(-1), [b, x] = i({}), S = r(null), C = r(null), w = r(null), T = a.find((e) => e.value === n), E = s && g.trim() ? a.filter((e) => e.label.toLowerCase().includes(g.toLowerCase())) : a;
1037
1037
  t(() => {
1038
1038
  let e = E.findIndex((e) => e.value === n);
@@ -1133,7 +1133,7 @@ function oe({ label: e, value: n, options: a, onChange: o, searchable: s, emptyT
1133
1133
  }
1134
1134
  //#endregion
1135
1135
  //#region src/components/HelpModal.tsx
1136
- var se = [
1136
+ var oe = [
1137
1137
  {
1138
1138
  id: "select",
1139
1139
  label: "Select",
@@ -1182,7 +1182,7 @@ var se = [
1182
1182
  hint: "Click or drag rooms to apply the active room swatch (symbol + environment). Select a swatch in the Swatches palette first.",
1183
1183
  key: "8"
1184
1184
  }
1185
- ], ce = [
1185
+ ], se = [
1186
1186
  {
1187
1187
  keys: ["1–7"],
1188
1188
  desc: "Switch tool"
@@ -1232,7 +1232,7 @@ var se = [
1232
1232
  desc: "Cancel / deselect"
1233
1233
  }
1234
1234
  ];
1235
- function le({ onClose: e }) {
1235
+ function ce({ onClose: e }) {
1236
1236
  return /* @__PURE__ */ d("div", {
1237
1237
  className: "modal-overlay",
1238
1238
  onClick: e,
@@ -1264,7 +1264,7 @@ function le({ onClose: e }) {
1264
1264
  }),
1265
1265
  /* @__PURE__ */ d("table", {
1266
1266
  className: "help-table",
1267
- children: /* @__PURE__ */ d("tbody", { children: se.map((e) => /* @__PURE__ */ f("tr", { children: [
1267
+ children: /* @__PURE__ */ d("tbody", { children: oe.map((e) => /* @__PURE__ */ f("tr", { children: [
1268
1268
  /* @__PURE__ */ d("td", { children: /* @__PURE__ */ d("kbd", { children: e.key }) }),
1269
1269
  /* @__PURE__ */ d("td", {
1270
1270
  className: "help-tool-name",
@@ -1282,7 +1282,7 @@ function le({ onClose: e }) {
1282
1282
  }),
1283
1283
  /* @__PURE__ */ d("table", {
1284
1284
  className: "help-table",
1285
- children: /* @__PURE__ */ d("tbody", { children: ce.map((e, t) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("td", { children: e.keys.map((e) => /* @__PURE__ */ d("kbd", { children: e }, e)) }), /* @__PURE__ */ d("td", {
1285
+ children: /* @__PURE__ */ d("tbody", { children: se.map((e, t) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("td", { children: e.keys.map((e) => /* @__PURE__ */ d("kbd", { children: e }, e)) }), /* @__PURE__ */ d("td", {
1286
1286
  colSpan: 2,
1287
1287
  className: "help-tool-hint",
1288
1288
  children: e.desc
@@ -1295,7 +1295,7 @@ function le({ onClose: e }) {
1295
1295
  }
1296
1296
  //#endregion
1297
1297
  //#region src/components/Toolbar.tsx
1298
- function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a, onSave: o, onSearchClick: s }) {
1298
+ function le({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a, onSave: o, onSearchClick: s }) {
1299
1299
  let c = O((e) => e.activeTool), l = O((e) => e.map), p = l != null, m = O((e) => e.loaded), h = O((e) => e.currentAreaId), _ = O((e) => e.currentZ), v = O((e) => e.snapToGrid), y = O((e) => e.status), b = O((e) => e.pending), x = O((e) => e.undo.length), C = O((e) => e.redo.length), w = O((e) => e.savedUndoLength), T = O((e) => e.swatchPaletteOpen), E = O((e) => e.activeSwatchId), k = O((e) => e.activeSwatchSetId), A = O((e) => e.swatchSets), j = O((e) => e.pluginSwatchSets), M = [...A, ...j].find((e) => e.id === k)?.swatches.find((e) => e.id === E) ?? null, N = x !== w, P = O((e) => e.structureVersion), F = n(() => l ? Object.entries(l.areaNames).map(([e, t]) => ({
1300
1300
  id: Number(e),
1301
1301
  name: t
@@ -1307,7 +1307,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1307
1307
  l,
1308
1308
  h,
1309
1309
  P
1310
- ]), L = r(null), [R, ee] = i(""), z = () => {
1310
+ ]), L = r(null), [R, z] = i(""), B = () => {
1311
1311
  let e = parseInt(R, 10);
1312
1312
  if (Number.isNaN(e)) return;
1313
1313
  let t = D.getState();
@@ -1329,9 +1329,9 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1329
1329
  ids: [e]
1330
1330
  },
1331
1331
  pending: null
1332
- }), D.bumpStructure(), ee("");
1333
- }, B = () => {
1334
- let e = W();
1332
+ }), D.bumpStructure(), z("");
1333
+ }, V = () => {
1334
+ let e = G();
1335
1335
  D.setState({
1336
1336
  map: e,
1337
1337
  loaded: { fileName: "new-map.dat" },
@@ -1346,7 +1346,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1346
1346
  status: "New map created · 0 rooms · 1 area",
1347
1347
  sessionId: null
1348
1348
  }), D.bumpStructure();
1349
- }, V = ae;
1349
+ }, H = ie;
1350
1350
  return /* @__PURE__ */ f("div", {
1351
1351
  className: "toolbar",
1352
1352
  children: [/* @__PURE__ */ f("div", {
@@ -1361,7 +1361,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1361
1361
  /* @__PURE__ */ d("button", {
1362
1362
  type: "button",
1363
1363
  title: "New Map",
1364
- onClick: B,
1364
+ onClick: V,
1365
1365
  children: /* @__PURE__ */ f("svg", {
1366
1366
  width: "16",
1367
1367
  height: "16",
@@ -1429,7 +1429,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1429
1429
  style: { display: "none" },
1430
1430
  onChange: (e) => {
1431
1431
  let t = e.target.files?.[0];
1432
- t && V(t), e.target.value = "";
1432
+ t && H(t), e.target.value = "";
1433
1433
  }
1434
1434
  })]
1435
1435
  }),
@@ -1484,7 +1484,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1484
1484
  onClick: () => {
1485
1485
  let e = D.getState();
1486
1486
  if (!(!e.map || !e.loaded)) try {
1487
- let t = H(e.map), n = t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength), r = new Blob([n], { type: "application/octet-stream" }), i = URL.createObjectURL(r), a = document.createElement("a");
1487
+ let t = U(e.map), n = t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength), r = new Blob([n], { type: "application/octet-stream" }), i = URL.createObjectURL(r), a = document.createElement("a");
1488
1488
  a.href = i, a.download = e.loaded.fileName.replace(/\.dat$/i, "") + "-edited.dat", document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i), D.setState((e) => ({
1489
1489
  savedUndoLength: e.undo.length,
1490
1490
  status: `Saved ${a.download}`
@@ -1545,7 +1545,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1545
1545
  }),
1546
1546
  p && /* @__PURE__ */ f(u, { children: [
1547
1547
  /* @__PURE__ */ d("div", { className: "toolbar-sep" }),
1548
- /* @__PURE__ */ d(oe, {
1548
+ /* @__PURE__ */ d(ae, {
1549
1549
  label: "Area",
1550
1550
  value: h,
1551
1551
  options: F.map((e) => ({
@@ -1563,7 +1563,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1563
1563
  searchable: !0,
1564
1564
  width: 300
1565
1565
  }),
1566
- /* @__PURE__ */ d(oe, {
1566
+ /* @__PURE__ */ d(ae, {
1567
1567
  label: "Level",
1568
1568
  value: _,
1569
1569
  options: I.map((e) => ({
@@ -1595,15 +1595,15 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1595
1595
  min: 1,
1596
1596
  placeholder: "ID",
1597
1597
  value: R,
1598
- onChange: (e) => ee(e.target.value),
1598
+ onChange: (e) => z(e.target.value),
1599
1599
  onKeyDown: (e) => {
1600
- e.key === "Enter" && z();
1600
+ e.key === "Enter" && B();
1601
1601
  }
1602
1602
  }),
1603
1603
  /* @__PURE__ */ d("button", {
1604
1604
  type: "button",
1605
1605
  className: "toolbar-goto-btn",
1606
- onClick: z,
1606
+ onClick: B,
1607
1607
  disabled: R === "",
1608
1608
  children: "Go"
1609
1609
  })
@@ -1657,7 +1657,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1657
1657
  children: [
1658
1658
  /* @__PURE__ */ d("div", {
1659
1659
  className: "tool-group",
1660
- children: se.map((e) => /* @__PURE__ */ f("button", {
1660
+ children: oe.map((e) => /* @__PURE__ */ f("button", {
1661
1661
  type: "button",
1662
1662
  className: `tool-btn${c === e.id ? " active" : ""}`,
1663
1663
  title: `${e.label} (${e.key}) — ${e.hint}`,
@@ -1761,9 +1761,9 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1761
1761
  }
1762
1762
  //#endregion
1763
1763
  //#region src/components/UrlLoadModal.tsx
1764
- function de({ onClose: e, initialUrl: n }) {
1764
+ function ue({ onClose: e, initialUrl: n }) {
1765
1765
  let [r, a] = i(n ?? ""), [o, s] = i(!1), [c, l] = i(null), u = async (t = r.trim()) => {
1766
- t && (a(t), s(!0), l(0), await G(t, l), s(!1), l(null), D.getState().map && e());
1766
+ t && (a(t), s(!0), l(0), await K(t, l), s(!1), l(null), D.getState().map && e());
1767
1767
  };
1768
1768
  return t(() => {
1769
1769
  n && u(n);
@@ -1849,14 +1849,14 @@ function de({ onClose: e, initialUrl: n }) {
1849
1849
  }
1850
1850
  //#endregion
1851
1851
  //#region src/editor/types.ts
1852
- var fe = {
1852
+ var de = {
1853
1853
  family: "Arial",
1854
1854
  size: 30,
1855
1855
  bold: !1,
1856
1856
  italic: !1,
1857
1857
  underline: !1,
1858
1858
  strikeout: !1
1859
- }, pe = [
1859
+ }, fe = [
1860
1860
  "north",
1861
1861
  "northeast",
1862
1862
  "east",
@@ -1869,7 +1869,7 @@ var fe = {
1869
1869
  "down",
1870
1870
  "in",
1871
1871
  "out"
1872
- ], me = {
1872
+ ], pe = {
1873
1873
  north: "south",
1874
1874
  south: "north",
1875
1875
  east: "west",
@@ -1882,7 +1882,7 @@ var fe = {
1882
1882
  down: "up",
1883
1883
  in: "out",
1884
1884
  out: "in"
1885
- }, K = {
1885
+ }, q = {
1886
1886
  north: "n",
1887
1887
  south: "s",
1888
1888
  east: "e",
@@ -1895,7 +1895,7 @@ var fe = {
1895
1895
  down: "down",
1896
1896
  in: "in",
1897
1897
  out: "out"
1898
- }, he = Object.entries(K).reduce((e, [t, n]) => (e[n] = t, e), {}), q = {
1898
+ }, me = Object.entries(q).reduce((e, [t, n]) => (e[n] = t, e), {}), J = {
1899
1899
  north: 1,
1900
1900
  northeast: 2,
1901
1901
  northwest: 3,
@@ -1908,18 +1908,18 @@ var fe = {
1908
1908
  down: 10,
1909
1909
  in: 11,
1910
1910
  out: 12
1911
- }, ge = new Set(Object.values(K)), _e = Object.entries(K).reduce((e, [t, n]) => (e[n] = t, e), {});
1912
- function ve(e) {
1911
+ }, he = new Set(Object.values(q)), ge = Object.entries(q).reduce((e, [t, n]) => (e[n] = t, e), {});
1912
+ function _e(e) {
1913
1913
  let t = e.trim(), n = t.toLowerCase();
1914
- return n in K ? K[n] : ge.has(n) ? n : t;
1914
+ return n in q ? q[n] : he.has(n) ? n : t;
1915
1915
  }
1916
1916
  //#endregion
1917
1917
  //#region src/editor/mapHelpers.ts
1918
- function ye(e) {
1918
+ function ve(e) {
1919
1919
  let t = Object.keys(e.areas).map(Number);
1920
1920
  return t.length === 0 ? 1 : Math.max(...t) + 1;
1921
1921
  }
1922
- function be(e) {
1922
+ function ye(e) {
1923
1923
  let t = 0;
1924
1924
  for (let n of Object.keys(e.rooms)) {
1925
1925
  let e = Number(n);
@@ -1927,7 +1927,7 @@ function be(e) {
1927
1927
  }
1928
1928
  return t + 1;
1929
1929
  }
1930
- function xe(e, t, n, r, i) {
1930
+ function be(e, t, n, r, i) {
1931
1931
  return {
1932
1932
  area: t,
1933
1933
  x: n,
@@ -1963,34 +1963,34 @@ function xe(e, t, n, r, i) {
1963
1963
  doors: {}
1964
1964
  };
1965
1965
  }
1966
- function Se(e, t, n, r) {
1966
+ function xe(e, t, n, r) {
1967
1967
  let i = n - e, a = r - t;
1968
1968
  if (Math.abs(i) < .001 && Math.abs(a) < .001) return "north";
1969
1969
  let o = (Math.atan2(a, i) * 180 / Math.PI + 360) % 360;
1970
1970
  return o < 22.5 || o >= 337.5 ? "east" : o < 67.5 ? "southeast" : o < 112.5 ? "south" : o < 157.5 ? "southwest" : o < 202.5 ? "west" : o < 247.5 ? "northwest" : o < 292.5 ? "north" : "northeast";
1971
1971
  }
1972
- function J(e, t) {
1972
+ function Y(e, t) {
1973
1973
  return e[t] ?? e.mSpecialExits[t] ?? void 0;
1974
1974
  }
1975
- function Ce(e, t) {
1975
+ function Se(e, t) {
1976
1976
  let n = [];
1977
1977
  for (let r of Object.keys(e.rooms)) {
1978
1978
  let i = Number(r);
1979
1979
  if (i === t) continue;
1980
1980
  let a = e.rooms[i];
1981
- for (let e of pe) J(a, e) === t && n.push({
1981
+ for (let e of fe) Y(a, e) === t && n.push({
1982
1982
  roomId: i,
1983
1983
  dir: e
1984
1984
  });
1985
1985
  }
1986
1986
  return n;
1987
1987
  }
1988
- function we(e) {
1988
+ function Ce(e) {
1989
1989
  return e !== "up" && e !== "down" && e !== "in" && e !== "out";
1990
1990
  }
1991
1991
  //#endregion
1992
1992
  //#region src/editor/commands.ts
1993
- function Te(e, t, n) {
1993
+ function we(e, t, n) {
1994
1994
  let r = n?.reader;
1995
1995
  switch (t.kind) {
1996
1996
  case "moveRoom":
@@ -2160,7 +2160,7 @@ function Te(e, t, n) {
2160
2160
  }
2161
2161
  return { structural: !1 };
2162
2162
  case "setDoor": {
2163
- let n = K[t.dir];
2163
+ let n = q[t.dir];
2164
2164
  if (r) r.setDoor(t.roomId, t.dir, t.to);
2165
2165
  else {
2166
2166
  let r = e.rooms[t.roomId];
@@ -2169,7 +2169,7 @@ function Te(e, t, n) {
2169
2169
  return { structural: !1 };
2170
2170
  }
2171
2171
  case "setExitWeight": {
2172
- let n = K[t.dir];
2172
+ let n = q[t.dir];
2173
2173
  if (r) r.setExitWeight(t.roomId, t.dir, t.to);
2174
2174
  else {
2175
2175
  let r = e.rooms[t.roomId];
@@ -2178,7 +2178,7 @@ function Te(e, t, n) {
2178
2178
  return { structural: !1 };
2179
2179
  }
2180
2180
  case "setExitLock": {
2181
- let n = q[t.dir];
2181
+ let n = J[t.dir];
2182
2182
  if (r) r.setExitLock(t.roomId, t.dir, t.lock);
2183
2183
  else {
2184
2184
  let r = e.rooms[t.roomId];
@@ -2191,7 +2191,7 @@ function Te(e, t, n) {
2191
2191
  return { structural: !1 };
2192
2192
  }
2193
2193
  case "setStub": {
2194
- let n = q[t.dir];
2194
+ let n = J[t.dir];
2195
2195
  if (r) r.setStub(t.roomId, t.dir, t.stub);
2196
2196
  else {
2197
2197
  let r = e.rooms[t.roomId];
@@ -2329,12 +2329,12 @@ function Te(e, t, n) {
2329
2329
  return n.reader.removeRooms(r), { structural: !0 };
2330
2330
  }
2331
2331
  let r = !1;
2332
- for (let i of t.cmds) Te(e, i, n).structural && (r = !0);
2332
+ for (let i of t.cmds) we(e, i, n).structural && (r = !0);
2333
2333
  return { structural: r };
2334
2334
  }
2335
2335
  }
2336
2336
  }
2337
- function Ee(e, t, n) {
2337
+ function Te(e, t, n) {
2338
2338
  let r = n?.reader;
2339
2339
  switch (t.kind) {
2340
2340
  case "moveRoom":
@@ -2524,7 +2524,7 @@ function Ee(e, t, n) {
2524
2524
  }
2525
2525
  return { structural: !1 };
2526
2526
  case "setDoor": {
2527
- let n = K[t.dir];
2527
+ let n = q[t.dir];
2528
2528
  if (r) r.setDoor(t.roomId, t.dir, t.from);
2529
2529
  else {
2530
2530
  let r = e.rooms[t.roomId];
@@ -2533,7 +2533,7 @@ function Ee(e, t, n) {
2533
2533
  return { structural: !1 };
2534
2534
  }
2535
2535
  case "setExitWeight": {
2536
- let n = K[t.dir];
2536
+ let n = q[t.dir];
2537
2537
  if (r) r.setExitWeight(t.roomId, t.dir, t.from);
2538
2538
  else {
2539
2539
  let r = e.rooms[t.roomId];
@@ -2542,7 +2542,7 @@ function Ee(e, t, n) {
2542
2542
  return { structural: !1 };
2543
2543
  }
2544
2544
  case "setExitLock": {
2545
- let n = q[t.dir];
2545
+ let n = J[t.dir];
2546
2546
  if (r) r.setExitLock(t.roomId, t.dir, !t.lock);
2547
2547
  else {
2548
2548
  let r = e.rooms[t.roomId];
@@ -2555,7 +2555,7 @@ function Ee(e, t, n) {
2555
2555
  return { structural: !1 };
2556
2556
  }
2557
2557
  case "setStub": {
2558
- let n = q[t.dir];
2558
+ let n = J[t.dir];
2559
2559
  if (r) r.setStub(t.roomId, t.dir, !t.stub);
2560
2560
  else {
2561
2561
  let r = e.rooms[t.roomId];
@@ -2701,27 +2701,27 @@ function Ee(e, t, n) {
2701
2701
  }))), { structural: !0 };
2702
2702
  }
2703
2703
  let r = !1;
2704
- for (let i of [...t.cmds].reverse()) Ee(e, i, n).structural && (r = !0);
2704
+ for (let i of [...t.cmds].reverse()) Te(e, i, n).structural && (r = !0);
2705
2705
  return { structural: r };
2706
2706
  }
2707
2707
  }
2708
2708
  }
2709
- function Y(e, t) {
2709
+ function X(e, t) {
2710
2710
  let n = D.getState();
2711
2711
  if (!n.map) return !1;
2712
- let { structural: r } = Te(n.map, e, t);
2712
+ let { structural: r } = we(n.map, e, t);
2713
2713
  return D.setState((t) => ({
2714
2714
  undo: [...t.undo, e],
2715
2715
  redo: []
2716
2716
  })), r;
2717
2717
  }
2718
- function X(e, t) {
2718
+ function Ee(e, t) {
2719
2719
  if (e.length === 0) return !1;
2720
- if (e.length === 1) return Y(e[0], t);
2720
+ if (e.length === 1) return X(e[0], t);
2721
2721
  let n = D.getState();
2722
2722
  if (!n.map) return !1;
2723
2723
  let r = !1;
2724
- for (let i of e) Te(n.map, i, t).structural && (r = !0);
2724
+ for (let i of e) we(n.map, i, t).structural && (r = !0);
2725
2725
  let i = {
2726
2726
  kind: "batch",
2727
2727
  cmds: e
@@ -2737,7 +2737,7 @@ function De(e) {
2737
2737
  changed: !1,
2738
2738
  structural: !1
2739
2739
  };
2740
- let n = t.undo[t.undo.length - 1], { structural: r } = Ee(t.map, n, e);
2740
+ let n = t.undo[t.undo.length - 1], { structural: r } = Te(t.map, n, e);
2741
2741
  return D.setState((e) => ({
2742
2742
  undo: e.undo.slice(0, -1),
2743
2743
  redo: [...e.redo, n]
@@ -2752,7 +2752,7 @@ function Oe(e) {
2752
2752
  changed: !1,
2753
2753
  structural: !1
2754
2754
  };
2755
- let n = t.redo[t.redo.length - 1], { structural: r } = Te(t.map, n, e);
2755
+ let n = t.redo[t.redo.length - 1], { structural: r } = we(t.map, n, e);
2756
2756
  return D.setState((e) => ({
2757
2757
  undo: [...e.undo, n],
2758
2758
  redo: e.redo.slice(0, -1)
@@ -2797,10 +2797,10 @@ function ke(e, t, n, r) {
2797
2797
  return a;
2798
2798
  }
2799
2799
  function Ae(e, t) {
2800
- return Ce(e, t).map((t) => ({
2800
+ return Se(e, t).map((t) => ({
2801
2801
  roomId: t.roomId,
2802
2802
  dir: t.dir,
2803
- was: J(e.rooms[t.roomId], t.dir)
2803
+ was: Y(e.rooms[t.roomId], t.dir)
2804
2804
  }));
2805
2805
  }
2806
2806
  function je(e, t) {
@@ -2809,8 +2809,8 @@ function je(e, t) {
2809
2809
  let i = Number(t);
2810
2810
  if (n.has(i)) continue;
2811
2811
  let a = e.rooms[i];
2812
- for (let e of pe) {
2813
- let t = J(a, e);
2812
+ for (let e of fe) {
2813
+ let t = Y(a, e);
2814
2814
  n.has(t) && r.get(t).push({
2815
2815
  roomId: i,
2816
2816
  dir: e,
@@ -3004,8 +3004,8 @@ function Re({ sceneRef: e }) {
3004
3004
  })).sort((e, t) => e.name.localeCompare(t.name)), g = () => {
3005
3005
  let i = n.trim();
3006
3006
  if (!i) return;
3007
- let a = ye(t);
3008
- Y({
3007
+ let a = ve(t);
3008
+ X({
3009
3009
  kind: "addArea",
3010
3010
  id: a,
3011
3011
  name: i
@@ -3038,7 +3038,7 @@ function Re({ sceneRef: e }) {
3038
3038
  let n = Number(e);
3039
3039
  if (a.has(n)) continue;
3040
3040
  let r = t.rooms[n];
3041
- for (let e of pe) {
3041
+ for (let e of fe) {
3042
3042
  let t = r[e];
3043
3043
  typeof t == "number" && a.has(t) && (s.push({
3044
3044
  roomId: n,
@@ -3047,7 +3047,7 @@ function Re({ sceneRef: e }) {
3047
3047
  }), c.add(r.area));
3048
3048
  }
3049
3049
  }
3050
- if (Y({
3050
+ if (X({
3051
3051
  kind: "deleteAreaWithRooms",
3052
3052
  areaId: n,
3053
3053
  areaName: r,
@@ -3063,7 +3063,7 @@ function Re({ sceneRef: e }) {
3063
3063
  }, y = () => {
3064
3064
  if (!l || l.moveTarget === "") return;
3065
3065
  let t = Number(l.moveTarget);
3066
- X([{
3066
+ Ee([{
3067
3067
  kind: "moveRoomsToArea",
3068
3068
  roomIds: [...l.rooms],
3069
3069
  fromAreaId: l.id,
@@ -3075,7 +3075,7 @@ function Re({ sceneRef: e }) {
3075
3075
  }], e.current), D.getState().currentAreaId === l.id ? D.setState({ currentAreaId: t }) : e.current?.refresh(), D.bumpStructure(), D.setState({ status: `Moved ${l.rooms.length} rooms to area #${t}, deleted '${l.name}'` }), u(null);
3076
3076
  }, b = (t, n) => {
3077
3077
  let r = s.trim();
3078
- r && r !== n && (Y({
3078
+ r && r !== n && (X({
3079
3079
  kind: "renameArea",
3080
3080
  id: t,
3081
3081
  from: n,
@@ -3165,7 +3165,7 @@ function Re({ sceneRef: e }) {
3165
3165
  children: /* @__PURE__ */ d(Fe, {
3166
3166
  data: t.areas[n]?.userData ?? {},
3167
3167
  onCommit: (t, r, i) => {
3168
- Y({
3168
+ X({
3169
3169
  kind: "setAreaUserDataEntry",
3170
3170
  areaId: n,
3171
3171
  key: t,
@@ -3273,7 +3273,7 @@ function Ve({ sceneRef: e }) {
3273
3273
  s(null), p(String(x())), l(!0);
3274
3274
  }, C = (n, r) => {
3275
3275
  let i = Be(r);
3276
- Y({
3276
+ X({
3277
3277
  kind: "setCustomEnvColor",
3278
3278
  envId: n,
3279
3279
  from: t.mCustomEnvColors[n] ?? null,
@@ -3281,7 +3281,7 @@ function Ve({ sceneRef: e }) {
3281
3281
  }, e.current), e.current?.refresh(), D.bumpData(), D.setState({ status: `Env ${n} color updated` });
3282
3282
  }, w = (n) => {
3283
3283
  let r = t.mCustomEnvColors[n];
3284
- r && (Y({
3284
+ r && (X({
3285
3285
  kind: "setCustomEnvColor",
3286
3286
  envId: n,
3287
3287
  from: r,
@@ -3294,7 +3294,7 @@ function Ve({ sceneRef: e }) {
3294
3294
  return;
3295
3295
  }
3296
3296
  let r = Be(m);
3297
- Y({
3297
+ X({
3298
3298
  kind: "setCustomEnvColor",
3299
3299
  envId: n,
3300
3300
  from: t.mCustomEnvColors[n] ?? null,
@@ -3697,7 +3697,7 @@ function Je({ sceneRef: e }) {
3697
3697
  /* @__PURE__ */ d(Fe, {
3698
3698
  data: t.mUserData ?? {},
3699
3699
  onCommit: (t, n, r) => {
3700
- Y({
3700
+ X({
3701
3701
  kind: "setMapUserDataEntry",
3702
3702
  key: t,
3703
3703
  from: n,
@@ -3792,7 +3792,7 @@ function Ye({ selection: e, map: t, sceneRef: n }) {
3792
3792
  dir: s,
3793
3793
  was: e.fromId
3794
3794
  } : null;
3795
- Y(t === "reverse" ? {
3795
+ X(t === "reverse" ? {
3796
3796
  kind: "removeExit",
3797
3797
  fromId: e.toId,
3798
3798
  dir: s,
@@ -4205,8 +4205,8 @@ var ht = .15, gt = {
4205
4205
  if (r && n.map) {
4206
4206
  let { fromId: e, dir: i } = n.pending, a = n.map.rooms[e];
4207
4207
  if (a) {
4208
- let n = J(a, i);
4209
- Y({
4208
+ let n = Y(a, i);
4209
+ X({
4210
4210
  kind: "addExit",
4211
4211
  fromId: e,
4212
4212
  dir: i,
@@ -4763,7 +4763,7 @@ function vt(e, t, n, r, i, a) {
4763
4763
  style: u,
4764
4764
  arrow: d
4765
4765
  };
4766
- Y({
4766
+ X({
4767
4767
  kind: "setCustomLine",
4768
4768
  roomId: t,
4769
4769
  exitName: n,
@@ -4850,16 +4850,16 @@ var yt = {
4850
4850
  function bt(e, t, n, r, i, a) {
4851
4851
  let o = e.scene.getRenderRoom(t), s = e.scene.getRenderRoom(n);
4852
4852
  if (!o || !s) return;
4853
- let c = r ?? Se(o.x, o.y, s.x, s.y);
4854
- if (!we(c)) return;
4853
+ let c = r ?? xe(o.x, o.y, s.x, s.y);
4854
+ if (!Ce(c)) return;
4855
4855
  let l = D.getState().map?.rooms[t], u = D.getState().map?.rooms[n];
4856
4856
  if (!l || !u) return;
4857
- let d = J(l, c), f = i ?? me[c], p = we(f), m = p ? J(u, f) : -1, h = a || !p ? null : m === -1 || m === t ? {
4857
+ let d = Y(l, c), f = i ?? pe[c], p = Ce(f), m = p ? Y(u, f) : -1, h = a || !p ? null : m === -1 || m === t ? {
4858
4858
  fromId: n,
4859
4859
  dir: f,
4860
4860
  previous: m
4861
4861
  } : null;
4862
- Y({
4862
+ X({
4863
4863
  kind: "addExit",
4864
4864
  fromId: t,
4865
4865
  dir: c,
@@ -4888,7 +4888,7 @@ var xt = {
4888
4888
  g: 255,
4889
4889
  b: 255
4890
4890
  }, o = r?.customLinesStyle?.[e.exitName] ?? 1, s = r?.customLinesArrow?.[e.exitName] ?? !1;
4891
- Y({
4891
+ X({
4892
4892
  kind: "removeCustomLine",
4893
4893
  roomId: e.roomId,
4894
4894
  exitName: e.exitName,
@@ -4905,12 +4905,12 @@ var xt = {
4905
4905
  let i = st(t.renderer, r.x, r.y, t.settings.roomSize);
4906
4906
  if (i) {
4907
4907
  if (!n.map.rooms[i.fromId]) return !0;
4908
- let e = me[i.dir], r = n.map.rooms[i.toId], a = r && we(e) && J(r, e) === i.fromId ? {
4908
+ let e = pe[i.dir], r = n.map.rooms[i.toId], a = r && Ce(e) && Y(r, e) === i.fromId ? {
4909
4909
  fromId: i.toId,
4910
4910
  dir: e,
4911
4911
  was: i.fromId
4912
4912
  } : null;
4913
- Y({
4913
+ X({
4914
4914
  kind: "removeExit",
4915
4915
  fromId: i.fromId,
4916
4916
  dir: i.dir,
@@ -4925,10 +4925,10 @@ var xt = {
4925
4925
  let o = n.map.rooms[i.id];
4926
4926
  if (!o) return !0;
4927
4927
  let s = [];
4928
- for (let e of pe) {
4929
- let t = J(o, e);
4928
+ for (let e of fe) {
4929
+ let t = Y(o, e);
4930
4930
  if (t === -1) continue;
4931
- let r = n.map.rooms[t], a = me[e], c = r && J(r, a) === i.id ? {
4931
+ let r = n.map.rooms[t], a = pe[e], c = r && Y(r, a) === i.id ? {
4932
4932
  fromId: t,
4933
4933
  dir: a,
4934
4934
  was: i.id
@@ -4943,7 +4943,7 @@ var xt = {
4943
4943
  name: e,
4944
4944
  toId: t
4945
4945
  }));
4946
- return s.length === 0 && c.length === 0 ? (D.setState({ status: `Room ${i.id} has no exits.` }), !0) : (Y({
4946
+ return s.length === 0 && c.length === 0 ? (D.setState({ status: `Room ${i.id} has no exits.` }), !0) : (X({
4947
4947
  kind: "removeAllExits",
4948
4948
  roomId: i.id,
4949
4949
  exits: s,
@@ -4962,11 +4962,11 @@ var xt = {
4962
4962
  if (!n) return !1;
4963
4963
  let { x: r, y: i } = pt(t, e), a = r, o = -i;
4964
4964
  if (nt(n.map, n.areaId, a, o, n.z)) return D.setState({ status: "Cell is already occupied." }), !0;
4965
- let s = be(n.map);
4966
- return Y({
4965
+ let s = ye(n.map);
4966
+ return X({
4967
4967
  kind: "addRoom",
4968
4968
  id: s,
4969
- room: xe(s, n.areaId, a, o, n.z),
4969
+ room: be(s, n.areaId, a, o, n.z),
4970
4970
  areaId: n.areaId
4971
4971
  }, t.scene), t.refresh(), D.bumpStructure(), e.ctrlKey || e.metaKey ? D.setState({ status: `Added room ${s} at (${a}, ${o}, ${n.z})` }) : D.setState({
4972
4972
  activeTool: "select",
@@ -4992,7 +4992,7 @@ var xt = {
4992
4992
  if (i) {
4993
4993
  let e = t.scene.reader.getLabelSnapshot(i.areaId, i.id);
4994
4994
  if (e) {
4995
- Y({
4995
+ X({
4996
4996
  kind: "deleteLabel",
4997
4997
  areaId: i.areaId,
4998
4998
  label: e
@@ -5013,7 +5013,7 @@ var xt = {
5013
5013
  g: 255,
5014
5014
  b: 255
5015
5015
  }, o = r?.customLinesStyle?.[e.exitName] ?? 1, s = r?.customLinesArrow?.[e.exitName] ?? !1;
5016
- Y({
5016
+ X({
5017
5017
  kind: "removeCustomLine",
5018
5018
  roomId: e.roomId,
5019
5019
  exitName: e.exitName,
@@ -5030,12 +5030,12 @@ var xt = {
5030
5030
  let i = st(t.renderer, r.x, r.y, t.settings.roomSize);
5031
5031
  if (i) {
5032
5032
  if (!n.map.rooms[i.fromId]) return !0;
5033
- let e = me[i.dir], r = n.map.rooms[i.toId], a = r && we(e) && J(r, e) === i.fromId ? {
5033
+ let e = pe[i.dir], r = n.map.rooms[i.toId], a = r && Ce(e) && Y(r, e) === i.fromId ? {
5034
5034
  fromId: i.toId,
5035
5035
  dir: e,
5036
5036
  was: i.fromId
5037
5037
  } : null;
5038
- Y({
5038
+ X({
5039
5039
  kind: "removeExit",
5040
5040
  fromId: i.fromId,
5041
5041
  dir: i.dir,
@@ -5050,7 +5050,7 @@ var xt = {
5050
5050
  let s = n.map.rooms[a.id];
5051
5051
  if (!s) return !0;
5052
5052
  let c = { ...s }, l = Ae(n.map, a.id);
5053
- Y({
5053
+ X({
5054
5054
  kind: "deleteRoom",
5055
5055
  id: a.id,
5056
5056
  room: c,
@@ -5309,10 +5309,10 @@ var Mt = {
5309
5309
  },
5310
5310
  noScaling: !1,
5311
5311
  showOnTop: !1,
5312
- font: { ...fe },
5312
+ font: { ...de },
5313
5313
  pixMap: ""
5314
5314
  };
5315
- return Y({
5315
+ return X({
5316
5316
  kind: "addLabel",
5317
5317
  areaId: r.areaId,
5318
5318
  label: f
@@ -5644,7 +5644,7 @@ function Bt({ pending: e, sceneRef: t }) {
5644
5644
  });
5645
5645
  }
5646
5646
  function Vt({ selection: e, map: t, sceneRef: n }) {
5647
- let r = t.rooms[e.roomId], a = r?.customLines?.[e.exitName], o = r?.customLinesColor?.[e.exitName], s = r?.customLinesStyle?.[e.exitName] ?? 1, c = r?.customLinesArrow?.[e.exitName] ?? !1, l = r?.mSpecialExits?.[e.exitName], p = J(r, he[e.exitName] ?? e.exitName), m = l ?? (p != null && p > 0 ? p : void 0), h = m == null ? null : t.rooms[m], [g, _] = i(o ? Ie(o) : "#ffffff"), [v, y] = i(s), [b, x] = i(c), [S, C] = i(null);
5647
+ let r = t.rooms[e.roomId], a = r?.customLines?.[e.exitName], o = r?.customLinesColor?.[e.exitName], s = r?.customLinesStyle?.[e.exitName] ?? 1, c = r?.customLinesArrow?.[e.exitName] ?? !1, l = r?.mSpecialExits?.[e.exitName], p = Y(r, me[e.exitName] ?? e.exitName), m = l ?? (p != null && p > 0 ? p : void 0), h = m == null ? null : t.rooms[m], [g, _] = i(o ? Ie(o) : "#ffffff"), [v, y] = i(s), [b, x] = i(c), [S, C] = i(null);
5648
5648
  if (!r || !a) return /* @__PURE__ */ d("h3", { children: "Custom line not found" });
5649
5649
  let w = (e) => ({
5650
5650
  points: a,
@@ -5669,7 +5669,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5669
5669
  style: s,
5670
5670
  arrow: c
5671
5671
  }, E = (t) => {
5672
- Y({
5672
+ X({
5673
5673
  kind: "setCustomLine",
5674
5674
  roomId: e.roomId,
5675
5675
  exitName: e.exitName,
@@ -5677,7 +5677,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5677
5677
  previous: T
5678
5678
  }, n.current), n.current?.refresh(), D.bumpData();
5679
5679
  }, O = () => {
5680
- Y({
5680
+ X({
5681
5681
  kind: "removeCustomLine",
5682
5682
  roomId: e.roomId,
5683
5683
  exitName: e.exitName,
@@ -5714,7 +5714,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5714
5714
  g: 255,
5715
5715
  b: 255
5716
5716
  }, m = a.map((e, n) => n === t ? [d, f] : [e[0], e[1]]);
5717
- Y({
5717
+ X({
5718
5718
  kind: "setCustomLine",
5719
5719
  roomId: e.roomId,
5720
5720
  exitName: e.exitName,
@@ -5912,7 +5912,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5912
5912
  D.setState({ status: `Custom line '${e.exitName}' already on grid.` });
5913
5913
  return;
5914
5914
  }
5915
- Y({
5915
+ X({
5916
5916
  kind: "setCustomLine",
5917
5917
  roomId: e.roomId,
5918
5918
  exitName: e.exitName,
@@ -5977,7 +5977,7 @@ function Wt(e) {
5977
5977
  }
5978
5978
  function Gt(e) {
5979
5979
  let t = e.includes(",") ? e.split(",")[1] : e;
5980
- return t ? re.from(t, "base64") : re.alloc(0);
5980
+ return t ? ne.from(t, "base64") : ne.alloc(0);
5981
5981
  }
5982
5982
  //#endregion
5983
5983
  //#region src/components/FontPicker.tsx
@@ -6145,7 +6145,7 @@ function Zt({ selection: e, sceneRef: n }) {
6145
6145
  ...r,
6146
6146
  text: E.current
6147
6147
  };
6148
- X([{
6148
+ Ee([{
6149
6149
  kind: "setLabelText",
6150
6150
  areaId: e.areaId,
6151
6151
  id: e.id,
@@ -6163,7 +6163,7 @@ function Zt({ selection: e, sceneRef: n }) {
6163
6163
  ...r,
6164
6164
  size: [i, a]
6165
6165
  };
6166
- X([{
6166
+ Ee([{
6167
6167
  kind: "setLabelSize",
6168
6168
  areaId: e.areaId,
6169
6169
  id: e.id,
@@ -6188,7 +6188,7 @@ function Zt({ selection: e, sceneRef: n }) {
6188
6188
  fgColor: t,
6189
6189
  bgColor: r
6190
6190
  };
6191
- X([{
6191
+ Ee([{
6192
6192
  kind: "setLabelColors",
6193
6193
  areaId: e.areaId,
6194
6194
  id: e.id,
@@ -6201,25 +6201,25 @@ function Zt({ selection: e, sceneRef: n }) {
6201
6201
  let r = n.current;
6202
6202
  if (!r) return;
6203
6203
  let i = r.reader.getLabelSnapshot(e.areaId, e.id);
6204
- !i || i.noScaling === t || (Y({
6204
+ !i || i.noScaling === t || (X({
6205
6205
  kind: "setLabelNoScaling",
6206
6206
  areaId: e.areaId,
6207
6207
  id: e.id,
6208
6208
  from: i.noScaling,
6209
6209
  to: t
6210
6210
  }, r), r.refresh(), D.bumpData());
6211
- }, ee = (t) => {
6211
+ }, z = (t) => {
6212
6212
  let r = n.current;
6213
6213
  if (!r) return;
6214
6214
  let i = r.reader.getLabelSnapshot(e.areaId, e.id);
6215
- !i || i.showOnTop === t || (Y({
6215
+ !i || i.showOnTop === t || (X({
6216
6216
  kind: "setLabelShowOnTop",
6217
6217
  areaId: e.areaId,
6218
6218
  id: e.id,
6219
6219
  from: i.showOnTop,
6220
6220
  to: t
6221
6221
  }, r), r.refresh(), D.bumpData());
6222
- }, z = (t) => {
6222
+ }, B = (t) => {
6223
6223
  let r = n.current;
6224
6224
  if (!r) return;
6225
6225
  let i = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6228,7 +6228,7 @@ function Zt({ selection: e, sceneRef: n }) {
6228
6228
  ...i.font,
6229
6229
  ...t
6230
6230
  };
6231
- X([{
6231
+ Ee([{
6232
6232
  kind: "setLabelFont",
6233
6233
  areaId: e.areaId,
6234
6234
  id: e.id,
@@ -6238,9 +6238,9 @@ function Zt({ selection: e, sceneRef: n }) {
6238
6238
  ...i,
6239
6239
  font: a
6240
6240
  })], r), r.refresh(), D.bumpData();
6241
- }, B = () => {
6241
+ }, V = () => {
6242
6242
  M.current ||= { color: s.outlineColor };
6243
- }, V = (t) => {
6243
+ }, H = (t) => {
6244
6244
  let r = n.current, i = M.current ?? { color: s.outlineColor };
6245
6245
  if (M.current = null, !r || Yt(i.color, t)) return;
6246
6246
  let a = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6249,14 +6249,14 @@ function Zt({ selection: e, sceneRef: n }) {
6249
6249
  ...a,
6250
6250
  outlineColor: t
6251
6251
  };
6252
- X([{
6252
+ Ee([{
6253
6253
  kind: "setLabelOutlineColor",
6254
6254
  areaId: e.areaId,
6255
6255
  id: e.id,
6256
6256
  from: i.color,
6257
6257
  to: t
6258
6258
  }, ...N(o)], r), r.refresh(), D.bumpData();
6259
- }, te = () => {
6259
+ }, ee = () => {
6260
6260
  let t = n.current;
6261
6261
  if (!t) return;
6262
6262
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6275,21 +6275,21 @@ function Zt({ selection: e, sceneRef: n }) {
6275
6275
  `"${u.family}", sans-serif`
6276
6276
  ].filter(Boolean).join(" "), Math.max(...l.map((e) => i.measureText(e).width)) <= s ? (m = e, f = e + 1) : p = e - 1;
6277
6277
  }
6278
- m !== r.font.size && z({ size: m });
6279
- }, ne = () => {
6278
+ m !== r.font.size && B({ size: m });
6279
+ }, te = () => {
6280
6280
  let t = n.current;
6281
6281
  if (!t) return;
6282
6282
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
6283
6283
  if (!r) return;
6284
6284
  let i = Wt(r);
6285
- i !== r.pixMap && (Y({
6285
+ i !== r.pixMap && (X({
6286
6286
  kind: "setLabelPixmap",
6287
6287
  areaId: e.areaId,
6288
6288
  id: e.id,
6289
6289
  from: r.pixMap,
6290
6290
  to: i
6291
6291
  }, t), t.refresh(), D.bumpData());
6292
- }, re = () => {
6292
+ }, ne = () => {
6293
6293
  let t = document.createElement("input");
6294
6294
  t.type = "file", t.accept = "image/*", t.onchange = () => {
6295
6295
  let r = t.files?.[0];
@@ -6303,7 +6303,7 @@ function Zt({ selection: e, sceneRef: n }) {
6303
6303
  let a = i.reader.getLabelSnapshot(e.areaId, e.id);
6304
6304
  if (!a) return;
6305
6305
  let o = Math.max(.1, Math.round(r.naturalWidth / Xt * 100) / 100), s = Math.max(.1, Math.round(r.naturalHeight / Xt * 100) / 100);
6306
- X([
6306
+ Ee([
6307
6307
  {
6308
6308
  kind: "setLabelImageSrc",
6309
6309
  areaId: e.areaId,
@@ -6329,13 +6329,13 @@ function Zt({ selection: e, sceneRef: n }) {
6329
6329
  }, r.src = t;
6330
6330
  }, i.readAsDataURL(r);
6331
6331
  }, t.click();
6332
- }, ie = () => {
6332
+ }, re = () => {
6333
6333
  let t = n.current;
6334
6334
  if (!t) return;
6335
6335
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
6336
6336
  if (!r || !r.imageSrc) return;
6337
6337
  let i = Wt(r);
6338
- X([{
6338
+ Ee([{
6339
6339
  kind: "setLabelImageSrc",
6340
6340
  areaId: e.areaId,
6341
6341
  id: e.id,
@@ -6348,14 +6348,14 @@ function Zt({ selection: e, sceneRef: n }) {
6348
6348
  from: r.pixMap,
6349
6349
  to: i
6350
6350
  }], t), t.refresh(), D.setState({ labelAspectRatioLocked: !1 }), D.bumpData();
6351
- }, H = !!s.imageSrc, U = Ie(s.fgColor), W = Ie(s.bgColor), G = s.outlineColor ?? {
6351
+ }, U = !!s.imageSrc, W = Ie(s.fgColor), G = Ie(s.bgColor), K = s.outlineColor ?? {
6352
6352
  spec: 1,
6353
6353
  r: 0,
6354
6354
  g: 0,
6355
6355
  b: 0,
6356
6356
  alpha: 0,
6357
6357
  pad: 0
6358
- }, ae = Ie(G), oe = (e) => ({
6358
+ }, ie = Ie(K), ae = (e) => ({
6359
6359
  flex: 1,
6360
6360
  padding: "4px 0",
6361
6361
  fontSize: 12,
@@ -6390,18 +6390,18 @@ function Zt({ selection: e, sceneRef: n }) {
6390
6390
  overflow: "hidden"
6391
6391
  },
6392
6392
  children: [/* @__PURE__ */ d("button", {
6393
- style: oe(!H),
6393
+ style: ae(!U),
6394
6394
  onClick: () => {
6395
- H && ie();
6395
+ U && re();
6396
6396
  },
6397
6397
  children: "Text"
6398
6398
  }), /* @__PURE__ */ d("button", {
6399
6399
  style: {
6400
- ...oe(H),
6400
+ ...ae(U),
6401
6401
  borderLeft: "1px solid var(--border, #444)"
6402
6402
  },
6403
6403
  onClick: () => {
6404
- H || re();
6404
+ U || ne();
6405
6405
  },
6406
6406
  children: "Image"
6407
6407
  })]
@@ -6458,7 +6458,7 @@ function Zt({ selection: e, sceneRef: n }) {
6458
6458
  }),
6459
6459
  /* @__PURE__ */ d(Ne, {
6460
6460
  checked: s.showOnTop,
6461
- onChange: ee,
6461
+ onChange: z,
6462
6462
  description: "Show on top (foreground)"
6463
6463
  }),
6464
6464
  /* @__PURE__ */ d(Ne, {
@@ -6466,7 +6466,7 @@ function Zt({ selection: e, sceneRef: n }) {
6466
6466
  onChange: (e) => R(!e),
6467
6467
  description: "Scale with zoom"
6468
6468
  }),
6469
- H && /* @__PURE__ */ d(Z, {
6469
+ U && /* @__PURE__ */ d(Z, {
6470
6470
  label: "Image",
6471
6471
  children: /* @__PURE__ */ f("div", {
6472
6472
  style: {
@@ -6484,13 +6484,13 @@ function Zt({ selection: e, sceneRef: n }) {
6484
6484
  borderRadius: 3
6485
6485
  }
6486
6486
  }), /* @__PURE__ */ d("button", {
6487
- onClick: re,
6487
+ onClick: ne,
6488
6488
  style: { alignSelf: "flex-start" },
6489
6489
  children: "Replace image..."
6490
6490
  })]
6491
6491
  })
6492
6492
  }),
6493
- !H && /* @__PURE__ */ f(u, { children: [
6493
+ !U && /* @__PURE__ */ f(u, { children: [
6494
6494
  /* @__PURE__ */ d(Z, {
6495
6495
  label: "Text",
6496
6496
  children: /* @__PURE__ */ d("textarea", {
@@ -6516,22 +6516,22 @@ function Zt({ selection: e, sceneRef: n }) {
6516
6516
  as: "div",
6517
6517
  children: /* @__PURE__ */ d("input", {
6518
6518
  type: "color",
6519
- defaultValue: U,
6519
+ defaultValue: W,
6520
6520
  onMouseDown: I,
6521
6521
  onBlur: (e) => L(Le(e.target.value), s.bgColor)
6522
- }, `fg-${e.id}-${U}`)
6522
+ }, `fg-${e.id}-${W}`)
6523
6523
  }), /* @__PURE__ */ d(Z, {
6524
6524
  label: "BG color",
6525
6525
  as: "div",
6526
6526
  children: /* @__PURE__ */ d("input", {
6527
6527
  type: "color",
6528
- defaultValue: W,
6528
+ defaultValue: G,
6529
6529
  onMouseDown: I,
6530
6530
  onBlur: (e) => L(s.fgColor, {
6531
6531
  ...Le(e.target.value),
6532
6532
  alpha: s.bgColor.alpha
6533
6533
  })
6534
- }, `bg-${e.id}-${W}`)
6534
+ }, `bg-${e.id}-${G}`)
6535
6535
  })]
6536
6536
  }),
6537
6537
  /* @__PURE__ */ d(Z, {
@@ -6577,7 +6577,7 @@ function Zt({ selection: e, sceneRef: n }) {
6577
6577
  children: /* @__PURE__ */ d(Kt, {
6578
6578
  value: s.font.family,
6579
6579
  options: x,
6580
- onChange: (e) => z({ family: e })
6580
+ onChange: (e) => B({ family: e })
6581
6581
  })
6582
6582
  }),
6583
6583
  /* @__PURE__ */ d(Z, {
@@ -6596,14 +6596,14 @@ function Zt({ selection: e, sceneRef: n }) {
6596
6596
  defaultValue: s.font.size,
6597
6597
  onBlur: (e) => {
6598
6598
  let t = parseInt(e.target.value, 10);
6599
- t > 0 && z({ size: t });
6599
+ t > 0 && B({ size: t });
6600
6600
  },
6601
6601
  onKeyDown: (e) => e.key === "Enter" && e.target.blur(),
6602
6602
  style: { width: 60 }
6603
6603
  }, `font-size-${e.id}-${s.font.size}`),
6604
6604
  /* @__PURE__ */ d("button", {
6605
6605
  title: "Auto-fit font size to fill label area",
6606
- onClick: te,
6606
+ onClick: ee,
6607
6607
  style: {
6608
6608
  height: 24,
6609
6609
  padding: "0 6px",
@@ -6644,7 +6644,7 @@ function Zt({ selection: e, sceneRef: n }) {
6644
6644
  ]
6645
6645
  ].map(([e, t, n]) => /* @__PURE__ */ d("button", {
6646
6646
  title: t,
6647
- onClick: () => z({ [t]: !s.font[t] }),
6647
+ onClick: () => B({ [t]: !s.font[t] }),
6648
6648
  style: {
6649
6649
  width: 24,
6650
6650
  height: 24,
@@ -6668,13 +6668,13 @@ function Zt({ selection: e, sceneRef: n }) {
6668
6668
  as: "div",
6669
6669
  children: /* @__PURE__ */ d("input", {
6670
6670
  type: "color",
6671
- defaultValue: ae,
6672
- onMouseDown: B,
6673
- onBlur: (e) => V({
6674
- ...G,
6671
+ defaultValue: ie,
6672
+ onMouseDown: V,
6673
+ onBlur: (e) => H({
6674
+ ...K,
6675
6675
  ...Le(e.target.value)
6676
6676
  })
6677
- }, `outline-${e.id}-${ae}`)
6677
+ }, `outline-${e.id}-${ie}`)
6678
6678
  }),
6679
6679
  /* @__PURE__ */ d(Z, {
6680
6680
  label: "Outline alpha",
@@ -6692,19 +6692,19 @@ function Zt({ selection: e, sceneRef: n }) {
6692
6692
  step: 1,
6693
6693
  value: y,
6694
6694
  style: { flex: 1 },
6695
- onPointerDown: B,
6695
+ onPointerDown: V,
6696
6696
  onChange: (e) => b(parseInt(e.target.value, 10)),
6697
6697
  onPointerUp: (e) => {
6698
6698
  let t = parseInt(e.target.value, 10);
6699
- V(t === 0 ? void 0 : {
6700
- ...G,
6699
+ H(t === 0 ? void 0 : {
6700
+ ...K,
6701
6701
  alpha: t
6702
6702
  });
6703
6703
  },
6704
6704
  onBlur: (e) => {
6705
6705
  let t = parseInt(e.target.value, 10);
6706
- V(t === 0 ? void 0 : {
6707
- ...G,
6706
+ H(t === 0 ? void 0 : {
6707
+ ...K,
6708
6708
  alpha: t
6709
6709
  });
6710
6710
  }
@@ -6740,7 +6740,7 @@ function Zt({ selection: e, sceneRef: n }) {
6740
6740
  className: "hint",
6741
6741
  children: "No pixmap stored"
6742
6742
  }), /* @__PURE__ */ d("button", {
6743
- onClick: ne,
6743
+ onClick: te,
6744
6744
  style: { alignSelf: "flex-start" },
6745
6745
  children: "Regenerate pixmap"
6746
6746
  })]
@@ -7059,34 +7059,34 @@ var an = [
7059
7059
  "door-locked"
7060
7060
  ];
7061
7061
  function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = [] }) {
7062
- let l = n.ids[0], p = O((e) => e.pending), [m, h] = i(a.name ?? ""), [g, _] = i(String(a.weight ?? 1)), [v, y] = i(a.symbol ?? ""), [b, x] = i(a.userData?.["system.fallback_symbol_color"] ?? null), [S, C] = i(!1), [w, T] = i(""), [E, k] = i(""), [A, j] = i({}), [M, N] = i(null), [P, F] = i("#ffffff"), [I, L] = i(1), [R, ee] = i(!1), [z, B] = i(!1), V = r(k);
7063
- V.current = k, t(() => (ft((e) => V.current(String(e))), () => ft(null)), []);
7064
- let te = r(m);
7065
- te.current = m;
7066
- let ne = r(g);
7067
- ne.current = g;
7068
- let re = r(v);
7069
- re.current = v, t(() => {
7062
+ let l = n.ids[0], p = O((e) => e.pending), [m, h] = i(a.name ?? ""), [g, _] = i(String(a.weight ?? 1)), [v, y] = i(a.symbol ?? ""), [b, x] = i(a.userData?.["system.fallback_symbol_color"] ?? null), [S, C] = i(!1), [w, T] = i(""), [E, k] = i(""), [A, j] = i({}), [M, N] = i(null), [P, F] = i("#ffffff"), [I, L] = i(1), [R, z] = i(!1), [B, V] = i(!1), H = r(k);
7063
+ H.current = k, t(() => (ft((e) => H.current(String(e))), () => ft(null)), []);
7064
+ let ee = r(m);
7065
+ ee.current = m;
7066
+ let te = r(g);
7067
+ te.current = g;
7068
+ let ne = r(v);
7069
+ ne.current = v, t(() => {
7070
7070
  let e = a, t = l;
7071
7071
  return () => {
7072
- let n = !1, r = re.current;
7073
- r !== e.symbol && (Y({
7072
+ let n = !1, r = ne.current;
7073
+ r !== e.symbol && (X({
7074
7074
  kind: "setRoomField",
7075
7075
  id: t,
7076
7076
  field: "symbol",
7077
7077
  from: e.symbol,
7078
7078
  to: r
7079
7079
  }, s.current), n = !0);
7080
- let i = te.current;
7081
- i !== e.name && (Y({
7080
+ let i = ee.current;
7081
+ i !== e.name && (X({
7082
7082
  kind: "setRoomField",
7083
7083
  id: t,
7084
7084
  field: "name",
7085
7085
  from: e.name,
7086
7086
  to: i
7087
7087
  }, s.current), n = !0);
7088
- let a = Number(ne.current);
7089
- !Number.isNaN(a) && a !== e.weight && (Y({
7088
+ let a = Number(te.current);
7089
+ !Number.isNaN(a) && a !== e.weight && (X({
7090
7090
  kind: "setRoomField",
7091
7091
  id: t,
7092
7092
  field: "weight",
@@ -7095,45 +7095,45 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7095
7095
  }, s.current), n = !0), n && (s.current?.refresh(), D.bumpData());
7096
7096
  };
7097
7097
  }, [a]), t(() => {
7098
- h(a.name ?? ""), _(String(a.weight ?? 1)), y(a.symbol ?? ""), x(a.userData?.["system.fallback_symbol_color"] ?? null), C(!1), T(""), k(""), j({}), N(null), B(!1);
7098
+ h(a.name ?? ""), _(String(a.weight ?? 1)), y(a.symbol ?? ""), x(a.userData?.["system.fallback_symbol_color"] ?? null), C(!1), T(""), k(""), j({}), N(null), V(!1);
7099
7099
  let e = D.getState().pending;
7100
7100
  (e?.kind === "pickExit" || e?.kind === "pickSpecialExit") && D.setState({ pending: null });
7101
7101
  }, [a]);
7102
- let ie = (e, t) => {
7102
+ let re = (e, t) => {
7103
7103
  let n = a[e], r = t;
7104
7104
  if (e === "weight" || e === "environment") {
7105
7105
  let e = Number(t);
7106
7106
  if (Number.isNaN(e)) return;
7107
7107
  r = e;
7108
7108
  }
7109
- r !== n && (Y({
7109
+ r !== n && (X({
7110
7110
  kind: "setRoomField",
7111
7111
  id: l,
7112
7112
  field: e,
7113
7113
  from: n,
7114
7114
  to: r
7115
7115
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Updated ${e} on room ${l}` }));
7116
- }, H = (e) => {
7117
- e !== a.environment && (Y({
7116
+ }, U = (e) => {
7117
+ e !== a.environment && (X({
7118
7118
  kind: "setRoomField",
7119
7119
  id: l,
7120
7120
  field: "environment",
7121
7121
  from: a.environment,
7122
7122
  to: e
7123
7123
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Room ${l} environment → ${e}` }));
7124
- }, U = (e) => {
7124
+ }, W = (e) => {
7125
7125
  let t = "system.fallback_symbol_color", n = a.userData?.[t] ?? null, r = e;
7126
- n !== r && (Y({
7126
+ n !== r && (X({
7127
7127
  kind: "setUserDataEntry",
7128
7128
  roomId: l,
7129
7129
  key: t,
7130
7130
  from: n,
7131
7131
  to: r
7132
7132
  }, s.current), s.current?.refresh(), D.bumpData());
7133
- }, W = (e, t) => {
7133
+ }, G = (e, t) => {
7134
7134
  if (!o.rooms[t]) return;
7135
7135
  let n = a[e];
7136
- Y({
7136
+ X({
7137
7137
  kind: "addExit",
7138
7138
  fromId: l,
7139
7139
  dir: e,
@@ -7141,54 +7141,54 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7141
7141
  previous: n,
7142
7142
  reverse: null
7143
7143
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Exit ${e} → room ${t} added.` });
7144
- }, G = (e, t, n) => {
7145
- Y({
7144
+ }, K = (e, t, n) => {
7145
+ X({
7146
7146
  kind: "setDoor",
7147
7147
  roomId: l,
7148
7148
  dir: e,
7149
7149
  from: t,
7150
7150
  to: n
7151
7151
  }, s.current), s.current?.refresh(), D.bumpData();
7152
- }, ae = (e, t, n) => {
7153
- t !== n && (Y({
7152
+ }, ie = (e, t, n) => {
7153
+ t !== n && (X({
7154
7154
  kind: "setExitWeight",
7155
7155
  roomId: l,
7156
7156
  dir: e,
7157
7157
  from: t,
7158
7158
  to: n
7159
7159
  }, s.current), s.current?.refresh(), D.bumpData());
7160
- }, oe = (e, t) => {
7161
- Y({
7160
+ }, ae = (e, t) => {
7161
+ X({
7162
7162
  kind: "setExitLock",
7163
7163
  roomId: l,
7164
7164
  dir: e,
7165
7165
  lock: !t
7166
7166
  }, s.current), s.current?.refresh(), D.bumpData();
7167
- }, se = (e, t, n, r) => {
7168
- t ? Y({
7167
+ }, oe = (e, t, n, r) => {
7168
+ t ? X({
7169
7169
  kind: "removeExit",
7170
7170
  fromId: l,
7171
7171
  dir: e,
7172
7172
  was: n,
7173
7173
  reverse: null
7174
- }, s.current) : r && Y({
7174
+ }, s.current) : r && X({
7175
7175
  kind: "setStub",
7176
7176
  roomId: l,
7177
7177
  dir: e,
7178
7178
  stub: !1
7179
7179
  }, s.current), s.current?.refresh(), D.bumpData();
7180
- }, ce = (e, t, n) => {
7181
- t ? Y({
7180
+ }, se = (e, t, n) => {
7181
+ t ? X({
7182
7182
  kind: "setStub",
7183
7183
  roomId: l,
7184
7184
  dir: e,
7185
7185
  stub: !1
7186
- }, s.current) : n === -1 ? Y({
7186
+ }, s.current) : n === -1 ? X({
7187
7187
  kind: "setStub",
7188
7188
  roomId: l,
7189
7189
  dir: e,
7190
7190
  stub: !0
7191
- }, s.current) : X([{
7191
+ }, s.current) : Ee([{
7192
7192
  kind: "removeExit",
7193
7193
  fromId: l,
7194
7194
  dir: e,
@@ -7200,40 +7200,40 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7200
7200
  dir: e,
7201
7201
  stub: !0
7202
7202
  }], s.current), s.current?.refresh(), D.bumpData();
7203
- }, le = () => {
7203
+ }, ce = () => {
7204
7204
  let e = w.trim(), t = parseInt(E, 10);
7205
- !e || Number.isNaN(t) || t <= 0 || (Y({
7205
+ !e || Number.isNaN(t) || t <= 0 || (X({
7206
7206
  kind: "addSpecialExit",
7207
7207
  roomId: l,
7208
7208
  name: e,
7209
7209
  toId: t
7210
7210
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Special exit '${e}' → ${t} added` }), T(""), k(""));
7211
- }, ue = (e, t) => {
7212
- Y({
7211
+ }, le = (e, t) => {
7212
+ X({
7213
7213
  kind: "removeSpecialExit",
7214
7214
  roomId: l,
7215
7215
  name: e,
7216
7216
  toId: t
7217
7217
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Special exit '${e}' removed` });
7218
- }, de = (e, t, n) => {
7219
- Y({
7218
+ }, ue = (e, t, n) => {
7219
+ X({
7220
7220
  kind: "setSpecialExitDoor",
7221
7221
  roomId: l,
7222
7222
  name: e,
7223
7223
  from: t,
7224
7224
  to: n
7225
7225
  }, s.current), s.current?.refresh(), D.bumpData();
7226
- }, fe = (e, t, n) => {
7227
- t !== n && (Y({
7226
+ }, de = (e, t, n) => {
7227
+ t !== n && (X({
7228
7228
  kind: "setSpecialExitWeight",
7229
7229
  roomId: l,
7230
7230
  name: e,
7231
7231
  from: t,
7232
7232
  to: n
7233
7233
  }, s.current), s.current?.refresh(), D.bumpData());
7234
- }, pe = (e) => {
7234
+ }, fe = (e) => {
7235
7235
  let t = o.rooms[l];
7236
- t?.customLines?.[e] && (Y({
7236
+ t?.customLines?.[e] && (X({
7237
7237
  kind: "removeCustomLine",
7238
7238
  roomId: l,
7239
7239
  exitName: e,
@@ -7250,7 +7250,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7250
7250
  arrow: t.customLinesArrow?.[e] ?? !1
7251
7251
  }
7252
7252
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Custom line '${e}' removed` }));
7253
- }, he = (e) => {
7253
+ }, me = (e) => {
7254
7254
  let t = e.trim();
7255
7255
  if (!t) {
7256
7256
  D.setState({ status: "Enter exit name first." });
@@ -7258,7 +7258,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7258
7258
  }
7259
7259
  let n = s.current, r = n?.reader.getRoom(l);
7260
7260
  if (!n || !r) return;
7261
- let i = ve(t), a = o.rooms[l], c = a?.customLines?.[i] ? {
7261
+ let i = _e(t), a = o.rooms[l], c = a?.customLines?.[i] ? {
7262
7262
  points: a.customLines[i],
7263
7263
  color: a.customLinesColor?.[i] ?? {
7264
7264
  spec: 1,
@@ -7269,13 +7269,13 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7269
7269
  },
7270
7270
  style: a.customLinesStyle?.[i] ?? 1,
7271
7271
  arrow: a.customLinesArrow?.[i] ?? !1
7272
- } : null, u = Le(P), d = null, f = _e[i];
7273
- if (z && f) {
7272
+ } : null, u = Le(P), d = null, f = ge[i];
7273
+ if (B && f) {
7274
7274
  let e = a?.[f];
7275
7275
  if (e !== void 0 && e !== -1) {
7276
- let t = o.rooms[e], r = me[f];
7276
+ let t = o.rooms[e], r = pe[f];
7277
7277
  if (t && t[r] === l) {
7278
- let i = K[r];
7278
+ let i = q[r];
7279
7279
  d = {
7280
7280
  roomId: e,
7281
7281
  exitName: i,
@@ -7311,14 +7311,14 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7311
7311
  },
7312
7312
  status: "Click canvas to add waypoints · double-click or Enter to finish · Esc cancels"
7313
7313
  }), D.bumpData(), N(null);
7314
- }, ge = (e) => {
7315
- let t = ve(e);
7314
+ }, he = (e) => {
7315
+ let t = _e(e);
7316
7316
  return a.customLines?.[t] ? {
7317
7317
  key: t,
7318
7318
  color: a.customLinesColor?.[t]
7319
7319
  } : null;
7320
- }, ye = (e) => {
7321
- let t = ge(e);
7320
+ }, ve = (e) => {
7321
+ let t = he(e);
7322
7322
  if (t) {
7323
7323
  D.setState({ selection: {
7324
7324
  kind: "customLine",
@@ -7327,8 +7327,8 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7327
7327
  } });
7328
7328
  return;
7329
7329
  }
7330
- F("#ffffff"), L(1), ee(!1), B(!1), N(e);
7331
- }, be = (e) => /* @__PURE__ */ f("div", {
7330
+ F("#ffffff"), L(1), z(!1), V(!1), N(e);
7331
+ }, ye = (e) => /* @__PURE__ */ f("div", {
7332
7332
  className: "cl-form cl-form-inline",
7333
7333
  children: [
7334
7334
  /* @__PURE__ */ f("div", {
@@ -7382,7 +7382,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7382
7382
  }), /* @__PURE__ */ d("input", {
7383
7383
  type: "checkbox",
7384
7384
  checked: R,
7385
- onChange: (e) => ee(e.target.checked)
7385
+ onChange: (e) => z(e.target.checked)
7386
7386
  })]
7387
7387
  }),
7388
7388
  /* @__PURE__ */ f("div", {
@@ -7393,8 +7393,8 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7393
7393
  children: "Both ways"
7394
7394
  }), /* @__PURE__ */ d("input", {
7395
7395
  type: "checkbox",
7396
- checked: z,
7397
- onChange: (e) => B(e.target.checked)
7396
+ checked: B,
7397
+ onChange: (e) => V(e.target.checked)
7398
7398
  })]
7399
7399
  }),
7400
7400
  /* @__PURE__ */ f("div", {
@@ -7405,7 +7405,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7405
7405
  },
7406
7406
  children: [/* @__PURE__ */ d("button", {
7407
7407
  type: "button",
7408
- onClick: () => he(e),
7408
+ onClick: () => me(e),
7409
7409
  style: { flex: 1 },
7410
7410
  children: "Start Drawing"
7411
7411
  }), /* @__PURE__ */ d("button", {
@@ -7415,8 +7415,8 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7415
7415
  })]
7416
7416
  })
7417
7417
  ]
7418
- }), xe = (e) => {
7419
- let t = e, n = a[e], r = n !== -1, i = K[t], o = q[t], s = a.stubs?.includes(o) ?? !1, c = r || s, u = a.doors?.[i] ?? 0, m = a.exitWeights?.[i] ?? 1, h = a.exitLocks?.includes(o) ?? !1, g = !!a.customLines?.[i], _ = p?.kind === "pickExit" && p.fromId === l && p.dir === t;
7418
+ }), be = (e) => {
7419
+ let t = e, n = a[e], r = n !== -1, i = q[t], o = J[t], s = a.stubs?.includes(o) ?? !1, c = r || s, u = a.doors?.[i] ?? 0, m = a.exitWeights?.[i] ?? 1, h = a.exitLocks?.includes(o) ?? !1, g = !!a.customLines?.[i], _ = p?.kind === "pickExit" && p.fromId === l && p.dir === t;
7420
7420
  return /* @__PURE__ */ f("div", {
7421
7421
  className: `compass-cell${c ? " has-exit" : ""}${M === e ? " active" : ""}${_ ? " picking-exit" : ""}`,
7422
7422
  children: [
@@ -7431,7 +7431,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7431
7431
  c && /* @__PURE__ */ d("button", {
7432
7432
  type: "button",
7433
7433
  className: `exit-line-btn${g ? " has-line" : ""}`,
7434
- onClick: () => ye(e),
7434
+ onClick: () => ve(e),
7435
7435
  title: g ? "Edit custom line" : "Draw custom line",
7436
7436
  children: g ? (() => {
7437
7437
  let e = a.customLinesColor?.[i];
@@ -7448,14 +7448,14 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7448
7448
  type: "button",
7449
7449
  className: `cc-icon-btn cc-stub-btn${s ? " stub-active" : ""}`,
7450
7450
  title: s ? "Remove stub" : r ? "Convert to stub" : "Add stub",
7451
- onClick: () => ce(t, s, n),
7451
+ onClick: () => se(t, s, n),
7452
7452
  children: "S"
7453
7453
  }),
7454
7454
  c && /* @__PURE__ */ d("button", {
7455
7455
  type: "button",
7456
7456
  className: "cc-icon-btn cc-delete-btn",
7457
7457
  title: r ? "Remove exit" : "Remove stub",
7458
- onClick: () => se(t, r, n, s),
7458
+ onClick: () => oe(t, r, n, s),
7459
7459
  children: "×"
7460
7460
  })
7461
7461
  ]
@@ -7485,7 +7485,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7485
7485
  })),
7486
7486
  onBlur: (n) => {
7487
7487
  let r = parseInt(n.target.value, 10);
7488
- isNaN(r) || (W(t, r), j((t) => ({
7488
+ isNaN(r) || (G(t, r), j((t) => ({
7489
7489
  ...t,
7490
7490
  [e]: ""
7491
7491
  })));
@@ -7515,7 +7515,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7515
7515
  className: `cc-door-btn ${un[u]}${c ? "" : " cc-dim"}`,
7516
7516
  title: c ? ln[u] : void 0,
7517
7517
  disabled: !c,
7518
- onClick: c ? () => G(t, u, (u + 1) % 4) : void 0,
7518
+ onClick: c ? () => K(t, u, (u + 1) % 4) : void 0,
7519
7519
  children: /* @__PURE__ */ d($t, {})
7520
7520
  }),
7521
7521
  /* @__PURE__ */ d("button", {
@@ -7523,7 +7523,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7523
7523
  className: `cc-icon-btn${h ? " lock-active" : ""}${c ? "" : " cc-dim"}`,
7524
7524
  title: c ? h ? "Locked — click to unlock" : "Unlocked — click to lock" : void 0,
7525
7525
  disabled: !c,
7526
- onClick: c ? () => oe(t, h) : void 0,
7526
+ onClick: c ? () => ae(t, h) : void 0,
7527
7527
  children: /* @__PURE__ */ d(en, { locked: h })
7528
7528
  }),
7529
7529
  /* @__PURE__ */ f("span", {
@@ -7535,7 +7535,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7535
7535
  defaultValue: m,
7536
7536
  disabled: !c,
7537
7537
  title: "Exit weight",
7538
- onBlur: (e) => ae(t, m, Math.max(1, parseInt(e.target.value, 10) || 1)),
7538
+ onBlur: (e) => ie(t, m, Math.max(1, parseInt(e.target.value, 10) || 1)),
7539
7539
  onKeyDown: (e) => e.key === "Enter" && e.target.blur()
7540
7540
  }, `${l}-${e}-${m}`)]
7541
7541
  })
@@ -7543,7 +7543,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7543
7543
  })
7544
7544
  ]
7545
7545
  }, e);
7546
- }, Se = s.current?.reader.getColorValue(a.environment) ?? "rgb(114,1,0)", J = Object.entries(a.mSpecialExits ?? {}), Ce = Object.entries(a.customLines ?? {});
7546
+ }, xe = s.current?.reader.getColorValue(a.environment) ?? "rgb(114,1,0)", Y = Object.entries(a.mSpecialExits ?? {}), Se = Object.entries(a.customLines ?? {});
7547
7547
  return /* @__PURE__ */ f("div", {
7548
7548
  className: "panel-content",
7549
7549
  children: [
@@ -7579,7 +7579,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7579
7579
  children: /* @__PURE__ */ d("input", {
7580
7580
  value: m,
7581
7581
  onChange: (e) => h(e.target.value),
7582
- onBlur: () => ie("name", m),
7582
+ onBlur: () => re("name", m),
7583
7583
  onKeyDown: (e) => {
7584
7584
  e.key === "Enter" && e.target.blur();
7585
7585
  }
@@ -7598,7 +7598,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7598
7598
  /* @__PURE__ */ d("button", {
7599
7599
  type: "button",
7600
7600
  className: "env-pick-btn",
7601
- style: { background: Se },
7601
+ style: { background: xe },
7602
7602
  onClick: () => C((e) => !e),
7603
7603
  title: `Env ${a.environment} — click to change`
7604
7604
  }),
@@ -7610,7 +7610,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7610
7610
  map: o,
7611
7611
  sceneRef: s,
7612
7612
  currentEnvId: a.environment,
7613
- onSelect: H,
7613
+ onSelect: U,
7614
7614
  onClose: () => C(!1)
7615
7615
  })
7616
7616
  ]
@@ -7624,7 +7624,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7624
7624
  value: v,
7625
7625
  maxLength: 4,
7626
7626
  onChange: (e) => y(e.target.value),
7627
- onBlur: () => ie("symbol", v)
7627
+ onBlur: () => re("symbol", v)
7628
7628
  }),
7629
7629
  /* @__PURE__ */ d("input", {
7630
7630
  type: "color",
@@ -7633,7 +7633,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7633
7633
  title: "Symbol color (stored in userData as system.fallback_symbol_color)",
7634
7634
  onChange: (e) => x(e.target.value),
7635
7635
  onBlur: () => {
7636
- b !== null && U(b);
7636
+ b !== null && W(b);
7637
7637
  }
7638
7638
  }),
7639
7639
  /* @__PURE__ */ d("button", {
@@ -7642,7 +7642,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7642
7642
  style: { visibility: b === null ? "hidden" : "visible" },
7643
7643
  title: "Clear symbol color",
7644
7644
  onClick: () => {
7645
- x(null), U(null);
7645
+ x(null), W(null);
7646
7646
  },
7647
7647
  children: "×"
7648
7648
  })
@@ -7660,7 +7660,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7660
7660
  className: `cc-room-lock-btn${a.isLocked ? " lock-active" : ""}`,
7661
7661
  title: a.isLocked ? "Room locked — click to unlock" : "Room unlocked — click to lock",
7662
7662
  onClick: () => {
7663
- Y({
7663
+ X({
7664
7664
  kind: "setRoomLock",
7665
7665
  id: l,
7666
7666
  lock: !a.isLocked
@@ -7674,20 +7674,20 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7674
7674
  value: g,
7675
7675
  title: "Room weight",
7676
7676
  onChange: (e) => _(e.target.value),
7677
- onBlur: () => ie("weight", g),
7677
+ onBlur: () => re("weight", g),
7678
7678
  onKeyDown: (e) => e.key === "Enter" && e.target.blur()
7679
7679
  }, `${l}-w`)]
7680
- }, t) : xe(e))
7680
+ }, t) : be(e))
7681
7681
  }),
7682
7682
  /* @__PURE__ */ d("div", {
7683
7683
  className: "compass-extra",
7684
- children: sn.flat().map((e, t) => e === null ? /* @__PURE__ */ d("div", { className: "compass-vert-spacer" }, t) : xe(e))
7684
+ children: sn.flat().map((e, t) => e === null ? /* @__PURE__ */ d("div", { className: "compass-vert-spacer" }, t) : be(e))
7685
7685
  }),
7686
- M !== null && an.includes(M) && be(M),
7686
+ M !== null && an.includes(M) && ye(M),
7687
7687
  /* @__PURE__ */ d("h4", { children: "Special Exits" }),
7688
7688
  /* @__PURE__ */ f("div", {
7689
7689
  className: "special-exits-list",
7690
- children: [J.map(([t, n]) => {
7690
+ children: [Y.map(([t, n]) => {
7691
7691
  let r = a.doors?.[t] ?? 0, i = a.exitWeights?.[t] ?? 1, o = !!a.customLines?.[t];
7692
7692
  return /* @__PURE__ */ f(e, { children: [/* @__PURE__ */ f("div", {
7693
7693
  className: `compass-cell has-exit${M === t ? " active" : ""}`,
@@ -7703,7 +7703,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7703
7703
  children: /* @__PURE__ */ d("button", {
7704
7704
  type: "button",
7705
7705
  className: `exit-line-btn${o ? " has-line" : ""}`,
7706
- onClick: () => ye(t),
7706
+ onClick: () => ve(t),
7707
7707
  title: o ? "Edit custom line" : "Draw custom line",
7708
7708
  children: o ? (() => {
7709
7709
  let e = a.customLinesColor?.[t];
@@ -7732,7 +7732,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7732
7732
  type: "button",
7733
7733
  className: `cc-door-btn ${un[r]}`,
7734
7734
  title: ln[r],
7735
- onClick: () => de(t, r, (r + 1) % 4),
7735
+ onClick: () => ue(t, r, (r + 1) % 4),
7736
7736
  children: /* @__PURE__ */ d($t, {})
7737
7737
  }),
7738
7738
  /* @__PURE__ */ f("span", {
@@ -7743,7 +7743,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7743
7743
  min: 1,
7744
7744
  defaultValue: i,
7745
7745
  title: "Exit weight",
7746
- onBlur: (e) => fe(t, i, Math.max(1, parseInt(e.target.value, 10) || 1)),
7746
+ onBlur: (e) => de(t, i, Math.max(1, parseInt(e.target.value, 10) || 1)),
7747
7747
  onKeyDown: (e) => e.key === "Enter" && e.target.blur()
7748
7748
  }, `${l}-${t}-${i}`)]
7749
7749
  }),
@@ -7751,13 +7751,13 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7751
7751
  type: "button",
7752
7752
  className: "cc-icon-btn",
7753
7753
  title: "Remove special exit",
7754
- onClick: () => ue(t, n),
7754
+ onClick: () => le(t, n),
7755
7755
  children: "✕"
7756
7756
  })
7757
7757
  ]
7758
7758
  })
7759
7759
  ]
7760
- }), M === t && be(t)] }, t);
7760
+ }), M === t && ye(t)] }, t);
7761
7761
  }), /* @__PURE__ */ f("div", {
7762
7762
  className: "special-exit-add",
7763
7763
  children: [
@@ -7765,7 +7765,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7765
7765
  placeholder: "exit name",
7766
7766
  value: w,
7767
7767
  onChange: (e) => T(e.target.value),
7768
- onKeyDown: (e) => e.key === "Enter" && E && le()
7768
+ onKeyDown: (e) => e.key === "Enter" && E && ce()
7769
7769
  }),
7770
7770
  /* @__PURE__ */ f("div", {
7771
7771
  className: "cc-exit-add",
@@ -7775,7 +7775,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7775
7775
  placeholder: "#",
7776
7776
  value: E,
7777
7777
  onChange: (e) => k(e.target.value),
7778
- onKeyDown: (e) => e.key === "Enter" && w && le()
7778
+ onKeyDown: (e) => e.key === "Enter" && w && ce()
7779
7779
  }), /* @__PURE__ */ d("button", {
7780
7780
  type: "button",
7781
7781
  className: `cc-pick-btn${p?.kind === "pickSpecialExit" && p.fromId === l ? " picking" : ""}`,
@@ -7792,16 +7792,16 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7792
7792
  }),
7793
7793
  /* @__PURE__ */ d("button", {
7794
7794
  type: "button",
7795
- onClick: le,
7795
+ onClick: ce,
7796
7796
  disabled: !w.trim() || !E,
7797
7797
  children: "Add"
7798
7798
  })
7799
7799
  ]
7800
7800
  })]
7801
7801
  }),
7802
- Ce.length > 0 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("h4", { children: "Custom Lines" }), /* @__PURE__ */ d("div", {
7802
+ Se.length > 0 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("h4", { children: "Custom Lines" }), /* @__PURE__ */ d("div", {
7803
7803
  className: "exit-list",
7804
- children: Ce.map(([e, t]) => {
7804
+ children: Se.map(([e, t]) => {
7805
7805
  let n = a.customLinesColor?.[e];
7806
7806
  return /* @__PURE__ */ f("div", {
7807
7807
  className: "customline-row",
@@ -7829,7 +7829,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7829
7829
  /* @__PURE__ */ d("button", {
7830
7830
  type: "button",
7831
7831
  className: "customline-remove",
7832
- onClick: () => pe(e),
7832
+ onClick: () => fe(e),
7833
7833
  title: "Remove",
7834
7834
  children: "✕"
7835
7835
  })
@@ -7847,7 +7847,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7847
7847
  /* @__PURE__ */ d(Fe, {
7848
7848
  data: a.userData,
7849
7849
  onCommit: (e, t, n) => {
7850
- Y({
7850
+ X({
7851
7851
  kind: "setUserDataEntry",
7852
7852
  roomId: l,
7853
7853
  key: e,
@@ -7860,8 +7860,305 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7860
7860
  });
7861
7861
  }
7862
7862
  //#endregion
7863
+ //#region src/components/MultiRoomPanel.tsx
7864
+ function fn(e) {
7865
+ if (e.length === 0) return { same: !1 };
7866
+ let t = e[0];
7867
+ return e.every((e) => e === t) ? {
7868
+ same: !0,
7869
+ value: t
7870
+ } : { same: !1 };
7871
+ }
7872
+ var pn = "system.fallback_symbol_color";
7873
+ function mn({ selection: e, map: t, sceneRef: n }) {
7874
+ let r = e.ids, a = r.map((e) => t.rooms[e]).filter((e) => e != null), o = fn(a.map((e) => e.name ?? "")), s = fn(a.map((e) => e.symbol ?? "")), c = fn(a.map((e) => e.userData?.[pn] ?? null)), l = fn(a.map((e) => e.environment)), u = fn(a.map((e) => e.isLocked ?? !1)), p = fn(a.map((e) => e.weight ?? 1)), [m, h] = i(!1), [g, _] = i(() => o.same ? o.value : ""), [v, y] = i(!1), [b, x] = i(() => s.same ? s.value : ""), [S, C] = i(!1), [w, T] = i(() => c.same && c.value !== null ? c.value : "#ffffff"), [E, O] = i(!1), [k, A] = i(() => l.same ? l.value : -1), [j, M] = i(!1), [N, P] = i(!1), [F, I] = i(() => u.same ? u.value : !1), [L, R] = i(!1), [z, B] = i(() => String(p.same ? p.value : 1)), V = m || v || S || E || N || L, H = () => {
7875
+ let e = [];
7876
+ for (let n of r) {
7877
+ let r = t.rooms[n];
7878
+ if (r) {
7879
+ if (m && g !== r.name && e.push({
7880
+ kind: "setRoomField",
7881
+ id: n,
7882
+ field: "name",
7883
+ from: r.name,
7884
+ to: g
7885
+ }), v && b !== r.symbol && e.push({
7886
+ kind: "setRoomField",
7887
+ id: n,
7888
+ field: "symbol",
7889
+ from: r.symbol,
7890
+ to: b
7891
+ }), S) {
7892
+ let t = r.userData?.[pn] ?? null, i = w;
7893
+ t !== i && e.push({
7894
+ kind: "setUserDataEntry",
7895
+ roomId: n,
7896
+ key: pn,
7897
+ from: t,
7898
+ to: i
7899
+ });
7900
+ }
7901
+ if (E && k !== r.environment && e.push({
7902
+ kind: "setRoomField",
7903
+ id: n,
7904
+ field: "environment",
7905
+ from: r.environment,
7906
+ to: k
7907
+ }), N && F !== r.isLocked && e.push({
7908
+ kind: "setRoomLock",
7909
+ id: n,
7910
+ lock: F
7911
+ }), L) {
7912
+ let t = Math.max(1, parseInt(z, 10) || 1);
7913
+ t !== (r.weight ?? 1) && e.push({
7914
+ kind: "setRoomField",
7915
+ id: n,
7916
+ field: "weight",
7917
+ from: r.weight ?? 1,
7918
+ to: t
7919
+ });
7920
+ }
7921
+ }
7922
+ }
7923
+ e.length !== 0 && (X({
7924
+ kind: "batch",
7925
+ cmds: e
7926
+ }, n.current), n.current?.refresh(), D.bumpData(), D.setState({ status: `Applied bulk edit to ${r.length} rooms` }));
7927
+ }, ee = n.current?.reader.getColorValue(k) ?? "rgb(114,1,0)";
7928
+ return /* @__PURE__ */ f("div", {
7929
+ className: "panel-content",
7930
+ children: [
7931
+ /* @__PURE__ */ f("h3", { children: [r.length, " rooms selected"] }),
7932
+ /* @__PURE__ */ d("p", {
7933
+ className: "hint",
7934
+ children: "Drag to move all. Delete to remove all. Shift+click/drag to add more. Ctrl+click/drag to toggle. Ctrl+A selects all."
7935
+ }),
7936
+ /* @__PURE__ */ d("h4", { children: "Bulk Edit" }),
7937
+ /* @__PURE__ */ f("div", {
7938
+ className: "multi-room-fields",
7939
+ children: [
7940
+ /* @__PURE__ */ f("div", {
7941
+ className: "multi-field-row",
7942
+ children: [
7943
+ /* @__PURE__ */ d("input", {
7944
+ type: "checkbox",
7945
+ className: "multi-field-check",
7946
+ checked: m,
7947
+ onChange: (e) => h(e.target.checked),
7948
+ title: "Enable name override"
7949
+ }),
7950
+ /* @__PURE__ */ f("span", {
7951
+ className: "multi-field-label",
7952
+ children: ["Name", !o.same && /* @__PURE__ */ d("span", {
7953
+ className: "multi-field-mixed",
7954
+ title: "Rooms have different values",
7955
+ children: "~"
7956
+ })]
7957
+ }),
7958
+ /* @__PURE__ */ d("input", {
7959
+ className: "multi-field-input",
7960
+ disabled: !m,
7961
+ value: g,
7962
+ onChange: (e) => _(e.target.value),
7963
+ placeholder: o.same ? "" : "mixed"
7964
+ })
7965
+ ]
7966
+ }),
7967
+ /* @__PURE__ */ f("div", {
7968
+ className: "multi-field-row",
7969
+ children: [
7970
+ /* @__PURE__ */ d("input", {
7971
+ type: "checkbox",
7972
+ className: "multi-field-check",
7973
+ checked: v,
7974
+ onChange: (e) => y(e.target.checked),
7975
+ title: "Enable symbol override"
7976
+ }),
7977
+ /* @__PURE__ */ f("span", {
7978
+ className: "multi-field-label",
7979
+ children: ["Symbol", !s.same && /* @__PURE__ */ d("span", {
7980
+ className: "multi-field-mixed",
7981
+ title: "Rooms have different values",
7982
+ children: "~"
7983
+ })]
7984
+ }),
7985
+ /* @__PURE__ */ d("input", {
7986
+ className: "multi-field-input multi-field-symbol",
7987
+ disabled: !v,
7988
+ value: b,
7989
+ maxLength: 4,
7990
+ onChange: (e) => x(e.target.value),
7991
+ placeholder: s.same ? "" : "mixed"
7992
+ })
7993
+ ]
7994
+ }),
7995
+ /* @__PURE__ */ f("div", {
7996
+ className: "multi-field-row",
7997
+ children: [
7998
+ /* @__PURE__ */ d("input", {
7999
+ type: "checkbox",
8000
+ className: "multi-field-check",
8001
+ checked: S,
8002
+ onChange: (e) => C(e.target.checked),
8003
+ title: "Enable symbol color override"
8004
+ }),
8005
+ /* @__PURE__ */ f("span", {
8006
+ className: "multi-field-label",
8007
+ children: ["Symbol color", !c.same && /* @__PURE__ */ d("span", {
8008
+ className: "multi-field-mixed",
8009
+ title: "Rooms have different values",
8010
+ children: "~"
8011
+ })]
8012
+ }),
8013
+ /* @__PURE__ */ d("input", {
8014
+ type: "color",
8015
+ className: "symbol-color-input",
8016
+ disabled: !S || w === null,
8017
+ value: w ?? "#ffffff",
8018
+ onChange: (e) => T(e.target.value)
8019
+ }),
8020
+ /* @__PURE__ */ d("button", {
8021
+ type: "button",
8022
+ className: "symbol-color-clear",
8023
+ disabled: !S,
8024
+ title: w === null ? "Restore: set a color instead of clearing" : "Clear: remove symbol color from all rooms",
8025
+ onClick: () => T((e) => e === null ? "#ffffff" : null),
8026
+ children: w === null ? "+" : "×"
8027
+ })
8028
+ ]
8029
+ }),
8030
+ /* @__PURE__ */ f("div", {
8031
+ className: "multi-field-row",
8032
+ children: [
8033
+ /* @__PURE__ */ d("input", {
8034
+ type: "checkbox",
8035
+ className: "multi-field-check",
8036
+ checked: E,
8037
+ onChange: (e) => O(e.target.checked),
8038
+ title: "Enable environment override"
8039
+ }),
8040
+ /* @__PURE__ */ f("span", {
8041
+ className: "multi-field-label",
8042
+ children: ["Env", !l.same && /* @__PURE__ */ d("span", {
8043
+ className: "multi-field-mixed",
8044
+ title: "Rooms have different values",
8045
+ children: "~"
8046
+ })]
8047
+ }),
8048
+ /* @__PURE__ */ f("div", {
8049
+ className: "env-field-row",
8050
+ style: { position: "relative" },
8051
+ children: [
8052
+ /* @__PURE__ */ d("button", {
8053
+ type: "button",
8054
+ className: "env-pick-btn",
8055
+ style: { background: E ? ee : "rgba(80,80,90,0.5)" },
8056
+ disabled: !E,
8057
+ onClick: () => M((e) => !e),
8058
+ title: E ? `Env ${k} — click to change` : "Enable to set"
8059
+ }),
8060
+ /* @__PURE__ */ f("span", {
8061
+ className: "env-id-label",
8062
+ children: ["#", k]
8063
+ }),
8064
+ j && E && /* @__PURE__ */ d(Qt, {
8065
+ map: t,
8066
+ sceneRef: n,
8067
+ currentEnvId: k,
8068
+ onSelect: (e) => A(e),
8069
+ onClose: () => M(!1)
8070
+ })
8071
+ ]
8072
+ })
8073
+ ]
8074
+ }),
8075
+ /* @__PURE__ */ f("div", {
8076
+ className: "multi-field-row",
8077
+ children: [
8078
+ /* @__PURE__ */ d("input", {
8079
+ type: "checkbox",
8080
+ className: "multi-field-check",
8081
+ checked: L,
8082
+ onChange: (e) => R(e.target.checked),
8083
+ title: "Enable weight override"
8084
+ }),
8085
+ /* @__PURE__ */ f("span", {
8086
+ className: "multi-field-label",
8087
+ children: ["Weight", !p.same && /* @__PURE__ */ d("span", {
8088
+ className: "multi-field-mixed",
8089
+ title: "Rooms have different values",
8090
+ children: "~"
8091
+ })]
8092
+ }),
8093
+ /* @__PURE__ */ d("input", {
8094
+ type: "number",
8095
+ className: "multi-field-input multi-field-weight",
8096
+ disabled: !L,
8097
+ min: 1,
8098
+ value: z,
8099
+ onChange: (e) => B(e.target.value),
8100
+ onKeyDown: (e) => e.key === "Enter" && e.target.blur(),
8101
+ placeholder: p.same ? "" : "mixed"
8102
+ })
8103
+ ]
8104
+ }),
8105
+ /* @__PURE__ */ f("div", {
8106
+ className: "multi-field-row",
8107
+ children: [
8108
+ /* @__PURE__ */ d("input", {
8109
+ type: "checkbox",
8110
+ className: "multi-field-check",
8111
+ checked: N,
8112
+ onChange: (e) => P(e.target.checked),
8113
+ title: "Enable lock override"
8114
+ }),
8115
+ /* @__PURE__ */ f("span", {
8116
+ className: "multi-field-label",
8117
+ children: ["Lock", !u.same && /* @__PURE__ */ d("span", {
8118
+ className: "multi-field-mixed",
8119
+ title: "Rooms have different values",
8120
+ children: "~"
8121
+ })]
8122
+ }),
8123
+ /* @__PURE__ */ d("button", {
8124
+ type: "button",
8125
+ className: `multi-lock-btn${F ? " lock-active" : ""}`,
8126
+ disabled: !N,
8127
+ title: F ? "Locked — click to set unlocked" : "Unlocked — click to set locked",
8128
+ onClick: () => I((e) => !e),
8129
+ children: /* @__PURE__ */ d(en, { locked: F })
8130
+ })
8131
+ ]
8132
+ })
8133
+ ]
8134
+ }),
8135
+ /* @__PURE__ */ f("div", {
8136
+ className: "multi-room-actions",
8137
+ children: [/* @__PURE__ */ f("button", {
8138
+ type: "button",
8139
+ className: "multi-room-apply-btn",
8140
+ disabled: !V,
8141
+ onClick: H,
8142
+ children: [
8143
+ "Apply to ",
8144
+ r.length,
8145
+ " rooms"
8146
+ ]
8147
+ }), V && /* @__PURE__ */ f("p", {
8148
+ className: "multi-room-warning",
8149
+ children: [
8150
+ "This will overwrite the checked properties on all ",
8151
+ r.length,
8152
+ " selected rooms."
8153
+ ]
8154
+ })]
8155
+ })
8156
+ ]
8157
+ });
8158
+ }
8159
+ //#endregion
7863
8160
  //#region src/components/SidePanel.tsx
7864
- var fn = [
8161
+ var hn = [
7865
8162
  {
7866
8163
  id: "selection",
7867
8164
  label: "Sel"
@@ -7883,7 +8180,7 @@ var fn = [
7883
8180
  label: "Map"
7884
8181
  }
7885
8182
  ];
7886
- function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
8183
+ function gn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7887
8184
  let r = O((e) => e.selection), i = O((e) => e.map), a = O((e) => e.activeTool), o = O((e) => e.pending), s = O((e) => e.sidebarTab), c = O((e) => e.panelCollapsed), l = O((e) => e.undo.length);
7888
8185
  O((e) => e.dataVersion);
7889
8186
  let u = i ? Object.keys(i.mCustomEnvColors).length : 0, p = i ? Object.keys(i.areaNames).length : 0;
@@ -7901,7 +8198,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7901
8198
  children: "◀"
7902
8199
  }), /* @__PURE__ */ d("div", {
7903
8200
  className: "side-panel-tabs side-panel-tabs--vert",
7904
- children: [...fn, ...t].map((e) => /* @__PURE__ */ d("button", {
8201
+ children: [...hn, ...t].map((e) => /* @__PURE__ */ d("button", {
7905
8202
  type: "button",
7906
8203
  className: `side-panel-tab${s === e.id ? " active" : ""}`,
7907
8204
  onClick: () => D.setState({
@@ -8022,14 +8319,12 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
8022
8319
  })
8023
8320
  })]
8024
8321
  });
8025
- if (r?.kind === "room" && r.ids.length > 1) return /* @__PURE__ */ f("div", {
8322
+ if (r?.kind === "room" && r.ids.length > 1 && i) return /* @__PURE__ */ f("div", {
8026
8323
  className: "side-panel",
8027
- children: [m, /* @__PURE__ */ f("div", {
8028
- className: "panel-content",
8029
- children: [/* @__PURE__ */ f("h3", { children: [r.ids.length, " rooms selected"] }), /* @__PURE__ */ d("p", {
8030
- className: "hint",
8031
- children: "Drag to move all. Delete to remove all. Shift+click/drag to add more. Ctrl+click/drag to toggle. Ctrl+A selects all."
8032
- })]
8324
+ children: [m, /* @__PURE__ */ d(mn, {
8325
+ selection: r,
8326
+ map: i,
8327
+ sceneRef: e
8033
8328
  })]
8034
8329
  });
8035
8330
  let g = r?.kind === "room" && i ? i.rooms[r.ids[0]] : null;
@@ -8059,7 +8354,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
8059
8354
  }
8060
8355
  //#endregion
8061
8356
  //#region src/components/ContextMenu.tsx
8062
- function mn({ sceneRef: e }) {
8357
+ function _n({ sceneRef: e }) {
8063
8358
  let n = O((e) => e.contextMenu), a = r(null), [o, s] = i(null), [c, l] = i(null);
8064
8359
  if (t(() => {
8065
8360
  if (!n) {
@@ -8088,7 +8383,7 @@ function mn({ sceneRef: e }) {
8088
8383
  g: 255,
8089
8384
  b: 255
8090
8385
  }, o = r.customLinesStyle?.[n.exitName] ?? 1, s = r.customLinesArrow?.[n.exitName] ?? !1, c = i.filter((e, t) => t !== n.pointIndex);
8091
- Y({
8386
+ X({
8092
8387
  kind: "setCustomLine",
8093
8388
  roomId: n.roomId,
8094
8389
  exitName: n.exitName,
@@ -8256,7 +8551,7 @@ function mn({ sceneRef: e }) {
8256
8551
  onClick: () => {
8257
8552
  if (!c || !t) return;
8258
8553
  let r = parseInt(c.x, 10), i = parseInt(c.y, 10), a = parseInt(c.z, 10);
8259
- isNaN(r) || isNaN(i) || isNaN(a) || ((r !== t.pos[0] || i !== t.pos[1] || a !== t.pos[2]) && (Y({
8554
+ isNaN(r) || isNaN(i) || isNaN(a) || ((r !== t.pos[0] || i !== t.pos[1] || a !== t.pos[2]) && (X({
8260
8555
  kind: "moveLabel",
8261
8556
  areaId: n.areaId,
8262
8557
  id: n.labelId,
@@ -8306,7 +8601,7 @@ function mn({ sceneRef: e }) {
8306
8601
  className: "context-menu-item danger",
8307
8602
  onClick: () => {
8308
8603
  if (!t) return p();
8309
- Y({
8604
+ X({
8310
8605
  kind: "deleteLabel",
8311
8606
  areaId: n.areaId,
8312
8607
  label: t
@@ -8335,7 +8630,7 @@ function mn({ sceneRef: e }) {
8335
8630
  if (!t.map) return p();
8336
8631
  if (y) {
8337
8632
  let n = je(t.map, y);
8338
- Y({
8633
+ X({
8339
8634
  kind: "batch",
8340
8635
  cmds: y.map((e) => {
8341
8636
  let r = t.map.rooms[e];
@@ -8357,7 +8652,7 @@ function mn({ sceneRef: e }) {
8357
8652
  let r = t.map.rooms[n.roomId];
8358
8653
  if (!r) return p();
8359
8654
  let i = { ...r }, a = Ae(t.map, n.roomId);
8360
- Y({
8655
+ X({
8361
8656
  kind: "deleteRoom",
8362
8657
  id: n.roomId,
8363
8658
  room: i,
@@ -8424,7 +8719,7 @@ function mn({ sceneRef: e }) {
8424
8719
  }
8425
8720
  }), a.push(...ke(h.map, n.roomId, e, s));
8426
8721
  }
8427
- a.length > 0 && (X(a, e.current), e.current?.refresh(), D.bumpStructure(), D.setState({ status: y ? `Moved ${y.length} rooms to area ${o.areaId} (${t}, ${r}, ${i})` : `Moved room ${n.roomId} to area ${o.areaId} (${t}, ${r}, ${i})` }));
8722
+ a.length > 0 && (Ee(a, e.current), e.current?.refresh(), D.bumpStructure(), D.setState({ status: y ? `Moved ${y.length} rooms to area ${o.areaId} (${t}, ${r}, ${i})` : `Moved room ${n.roomId} to area ${o.areaId} (${t}, ${r}, ${i})` }));
8428
8723
  let s = o.areaId !== (h.currentAreaId ?? g.area), c = i !== h.currentZ;
8429
8724
  D.setState({
8430
8725
  contextMenu: null,
@@ -8576,46 +8871,46 @@ function mn({ sceneRef: e }) {
8576
8871
  }
8577
8872
  //#endregion
8578
8873
  //#region src/editor/session.ts
8579
- var hn = "mudlet-map-editor", gn = "sessions", _n = 2;
8580
- function vn() {
8874
+ var vn = "mudlet-map-editor", yn = "sessions", bn = 2;
8875
+ function xn() {
8581
8876
  return new Promise((e, t) => {
8582
- let n = indexedDB.open(hn, _n);
8877
+ let n = indexedDB.open(vn, bn);
8583
8878
  n.onupgradeneeded = (e) => {
8584
8879
  let t = n.result;
8585
- e.oldVersion < 2 && t.objectStoreNames.contains(gn) && t.deleteObjectStore(gn), t.createObjectStore(gn, { keyPath: "id" });
8880
+ e.oldVersion < 2 && t.objectStoreNames.contains(yn) && t.deleteObjectStore(yn), t.createObjectStore(yn, { keyPath: "id" });
8586
8881
  }, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
8587
8882
  });
8588
8883
  }
8589
- function yn(e) {
8884
+ function Sn(e) {
8590
8885
  let t = {};
8591
8886
  for (let n of Object.values(e.labels)) for (let e of n) e.imageSrc && (t[String(e.id)] = e.imageSrc);
8592
8887
  return t;
8593
8888
  }
8594
- async function bn(e, t, n, r, i, a) {
8595
- let o = H(t), s = o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength), c = a ?? crypto.randomUUID(), l = {
8889
+ async function Cn(e, t, n, r, i, a) {
8890
+ let o = U(t), s = o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength), c = a ?? crypto.randomUUID(), l = {
8596
8891
  id: c,
8597
8892
  fileName: e,
8598
8893
  mapBytes: s,
8599
- imageSrcs: yn(t),
8894
+ imageSrcs: Sn(t),
8600
8895
  undoStack: n,
8601
8896
  currentAreaId: r,
8602
8897
  currentZ: i,
8603
8898
  savedAt: Date.now(),
8604
8899
  roomCount: Object.keys(t.rooms).length
8605
- }, u = await vn();
8900
+ }, u = await xn();
8606
8901
  return new Promise((e, t) => {
8607
- let n = u.transaction(gn, "readwrite");
8608
- n.objectStore(gn).put(l), n.oncomplete = () => {
8902
+ let n = u.transaction(yn, "readwrite");
8903
+ n.objectStore(yn).put(l), n.oncomplete = () => {
8609
8904
  u.close(), e(c);
8610
8905
  }, n.onerror = () => {
8611
8906
  u.close(), t(n.error);
8612
8907
  };
8613
8908
  });
8614
8909
  }
8615
- async function xn() {
8616
- let e = await vn();
8910
+ async function wn() {
8911
+ let e = await xn();
8617
8912
  return new Promise((t, n) => {
8618
- let r = e.transaction(gn, "readonly").objectStore(gn).getAll();
8913
+ let r = e.transaction(yn, "readonly").objectStore(yn).getAll();
8619
8914
  r.onsuccess = () => {
8620
8915
  e.close(), t(r.result.sort((e, t) => t.savedAt - e.savedAt));
8621
8916
  }, r.onerror = () => {
@@ -8623,30 +8918,30 @@ async function xn() {
8623
8918
  };
8624
8919
  });
8625
8920
  }
8626
- async function Sn() {
8627
- let e = await vn();
8921
+ async function Tn() {
8922
+ let e = await xn();
8628
8923
  return new Promise((t, n) => {
8629
- let r = e.transaction(gn, "readwrite");
8630
- r.objectStore(gn).clear(), r.oncomplete = () => {
8924
+ let r = e.transaction(yn, "readwrite");
8925
+ r.objectStore(yn).clear(), r.oncomplete = () => {
8631
8926
  e.close(), t();
8632
8927
  }, r.onerror = () => {
8633
8928
  e.close(), n(r.error);
8634
8929
  };
8635
8930
  });
8636
8931
  }
8637
- async function Cn(e) {
8638
- let t = await vn();
8932
+ async function En(e) {
8933
+ let t = await xn();
8639
8934
  return new Promise((n, r) => {
8640
- let i = t.transaction(gn, "readwrite");
8641
- i.objectStore(gn).delete(e), i.oncomplete = () => {
8935
+ let i = t.transaction(yn, "readwrite");
8936
+ i.objectStore(yn).delete(e), i.oncomplete = () => {
8642
8937
  t.close(), n();
8643
8938
  }, i.onerror = () => {
8644
8939
  t.close(), r(i.error);
8645
8940
  };
8646
8941
  });
8647
8942
  }
8648
- function wn(e) {
8649
- let t = ie(e.mapBytes);
8943
+ function Dn(e) {
8944
+ let t = re(e.mapBytes);
8650
8945
  if (Object.keys(e.imageSrcs).length > 0) for (let n of Object.values(t.labels)) for (let t of n) {
8651
8946
  let n = e.imageSrcs[String(t.id)];
8652
8947
  n && (t.imageSrc = n);
@@ -8655,10 +8950,10 @@ function wn(e) {
8655
8950
  }
8656
8951
  //#endregion
8657
8952
  //#region src/components/SessionsPanel.tsx
8658
- var Tn = "mudlet-session-autodelete";
8659
- function En() {
8953
+ var On = "mudlet-session-autodelete";
8954
+ function kn() {
8660
8955
  try {
8661
- let e = localStorage.getItem(Tn);
8956
+ let e = localStorage.getItem(On);
8662
8957
  if (e) return JSON.parse(e);
8663
8958
  } catch {}
8664
8959
  return {
@@ -8666,24 +8961,24 @@ function En() {
8666
8961
  days: 30
8667
8962
  };
8668
8963
  }
8669
- function Dn(e) {
8670
- localStorage.setItem(Tn, JSON.stringify(e));
8964
+ function An(e) {
8965
+ localStorage.setItem(On, JSON.stringify(e));
8671
8966
  }
8672
- function On(e, t) {
8967
+ function jn(e, t) {
8673
8968
  let n = Date.now() - t * 24 * 60 * 60 * 1e3, r = [];
8674
- for (let t of e) t.savedAt < n ? Cn(t.id).catch(console.error) : r.push(t);
8969
+ for (let t of e) t.savedAt < n ? En(t.id).catch(console.error) : r.push(t);
8675
8970
  return r;
8676
8971
  }
8677
- function kn() {
8678
- let [e, n] = i([]), [r, a] = i(!1), [o, s] = i(En);
8972
+ function Mn() {
8973
+ let [e, n] = i([]), [r, a] = i(!1), [o, s] = i(kn);
8679
8974
  t(() => {
8680
- let e = En();
8681
- xn().then((t) => {
8682
- n(e.enabled ? On(t, e.days) : t), a(!0);
8975
+ let e = kn();
8976
+ wn().then((t) => {
8977
+ n(e.enabled ? jn(t, e.days) : t), a(!0);
8683
8978
  }).catch(() => a(!0));
8684
8979
  }, []);
8685
8980
  let c = (e) => {
8686
- let t = wn(e);
8981
+ let t = Dn(e);
8687
8982
  D.setState({
8688
8983
  map: t,
8689
8984
  loaded: { fileName: e.fileName },
@@ -8699,21 +8994,21 @@ function kn() {
8699
8994
  sessionId: e.id
8700
8995
  }), D.bumpStructure();
8701
8996
  }, l = (e) => {
8702
- Cn(e.id).catch(console.error), n((t) => t.filter((t) => t.id !== e.id));
8997
+ En(e.id).catch(console.error), n((t) => t.filter((t) => t.id !== e.id));
8703
8998
  }, u = () => {
8704
- Sn().catch(console.error), n([]);
8999
+ Tn().catch(console.error), n([]);
8705
9000
  }, p = (e) => {
8706
9001
  let t = {
8707
9002
  ...o,
8708
9003
  enabled: e
8709
9004
  };
8710
- s(t), Dn(t), e && n((e) => On(e, t.days));
9005
+ s(t), An(t), e && n((e) => jn(e, t.days));
8711
9006
  }, m = (e) => {
8712
9007
  let t = {
8713
9008
  ...o,
8714
9009
  days: e
8715
9010
  };
8716
- s(t), Dn(t), t.enabled && n((t) => On(t, e));
9011
+ s(t), An(t), t.enabled && n((t) => jn(t, e));
8717
9012
  };
8718
9013
  return r ? e.length === 0 ? /* @__PURE__ */ f("div", {
8719
9014
  className: "empty-state",
@@ -8810,7 +9105,7 @@ function kn() {
8810
9105
  }
8811
9106
  //#endregion
8812
9107
  //#region src/components/SwatchPalette.tsx
8813
- function An({ sceneRef: e }) {
9108
+ function Nn({ sceneRef: e }) {
8814
9109
  let n = O((e) => e.swatchSets), a = O((e) => e.pluginSwatchSets), o = O((e) => e.activeSwatchSetId), s = O((e) => e.activeSwatchId), c = O((e) => e.map), l = O((e) => e.pending?.kind === "pickSwatch"), [p, m] = i({
8815
9110
  x: 12,
8816
9111
  y: 120
@@ -8839,46 +9134,46 @@ function An({ sceneRef: e }) {
8839
9134
  };
8840
9135
  return window.addEventListener("editor:swatchRoomPicked", e), () => window.removeEventListener("editor:swatchRoomPicked", e);
8841
9136
  }, []);
8842
- let ee = (t) => {
9137
+ let z = (t) => {
8843
9138
  let n = e.current?.reader;
8844
9139
  return n ? n.getColorValue(t) : "rgb(114,1,0)";
8845
- }, z = (e, t, n) => {
9140
+ }, B = (e, t, n) => {
8846
9141
  let r = t === void 0 ? o : t, i = n === void 0 ? s : n;
8847
9142
  D.setState({
8848
9143
  swatchSets: e,
8849
9144
  activeSwatchSetId: r,
8850
9145
  activeSwatchId: i
8851
9146
  }), w(e, r, i);
8852
- }, B = () => {
9147
+ }, V = () => {
8853
9148
  let e = v.trim() || "New Set", t = crypto.randomUUID();
8854
- z([...n, {
9149
+ B([...n, {
8855
9150
  id: t,
8856
9151
  name: e,
8857
9152
  swatches: []
8858
9153
  }], t, null), y(""), _(!1);
8859
- }, V = (e) => {
8860
- R && z(n.map((t) => t.id === R.id ? {
9154
+ }, H = (e) => {
9155
+ R && B(n.map((t) => t.id === R.id ? {
8861
9156
  ...t,
8862
9157
  name: e
8863
9158
  } : t));
8864
- }, te = () => {
9159
+ }, ee = () => {
8865
9160
  if (!R || n.length <= 1 || !window.confirm(`Delete set "${R.name}"?`)) return;
8866
9161
  let e = n.filter((e) => e.id !== R.id);
8867
- z(e, e[0]?.id ?? null, null);
8868
- }, ne = (e) => {
9162
+ B(e, e[0]?.id ?? null, null);
9163
+ }, te = (e) => {
8869
9164
  D.setState({
8870
9165
  activeSwatchSetId: e,
8871
9166
  activeSwatchId: null
8872
9167
  }), w(n, e, null);
8873
- }, re = (e) => {
9168
+ }, ne = (e) => {
8874
9169
  D.setState({ activeSwatchId: e }), w(n, o, e);
8875
- }, ie = (e) => {
9170
+ }, re = (e) => {
8876
9171
  E(e.id), A(e.name), M(e.symbol), P(e.environment), I(!1);
8877
- }, H = () => {
8878
- E("new"), A(""), M(""), P(-1), I(!1);
8879
9172
  }, U = () => {
8880
- E(null), I(!1);
9173
+ E("new"), A(""), M(""), P(-1), I(!1);
8881
9174
  }, W = () => {
9175
+ E(null), I(!1);
9176
+ }, G = () => {
8882
9177
  if (!R || !T) return;
8883
9178
  let e = k.trim() || "Swatch", t = j.slice(0, 4);
8884
9179
  if (T === "new") {
@@ -8888,11 +9183,11 @@ function An({ sceneRef: e }) {
8888
9183
  symbol: t,
8889
9184
  environment: N
8890
9185
  };
8891
- z(n.map((e) => e.id === R.id ? {
9186
+ B(n.map((e) => e.id === R.id ? {
8892
9187
  ...e,
8893
9188
  swatches: [...e.swatches, i]
8894
9189
  } : e), o, r);
8895
- } else z(n.map((n) => n.id === R.id ? {
9190
+ } else B(n.map((n) => n.id === R.id ? {
8896
9191
  ...n,
8897
9192
  swatches: n.swatches.map((n) => n.id === T ? {
8898
9193
  ...n,
@@ -8902,8 +9197,8 @@ function An({ sceneRef: e }) {
8902
9197
  } : n)
8903
9198
  } : n));
8904
9199
  E(null), I(!1);
8905
- }, G = (e) => {
8906
- R && z(n.map((t) => t.id === R.id ? {
9200
+ }, K = (e) => {
9201
+ R && B(n.map((t) => t.id === R.id ? {
8907
9202
  ...t,
8908
9203
  swatches: t.swatches.filter((t) => t.id !== e)
8909
9204
  } : t), void 0, s === e ? null : void 0);
@@ -8946,7 +9241,7 @@ function An({ sceneRef: e }) {
8946
9241
  value: S,
8947
9242
  onChange: (e) => C(e.target.value),
8948
9243
  onKeyDown: (e) => {
8949
- e.key === "Enter" && (V(S), x(!1)), e.key === "Escape" && x(!1);
9244
+ e.key === "Enter" && (H(S), x(!1)), e.key === "Escape" && x(!1);
8950
9245
  },
8951
9246
  autoFocus: !0
8952
9247
  }),
@@ -8954,7 +9249,7 @@ function An({ sceneRef: e }) {
8954
9249
  type: "button",
8955
9250
  className: "swatch-icon-btn",
8956
9251
  onClick: () => {
8957
- V(S), x(!1);
9252
+ H(S), x(!1);
8958
9253
  },
8959
9254
  children: "✓"
8960
9255
  }),
@@ -8967,7 +9262,7 @@ function An({ sceneRef: e }) {
8967
9262
  ] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("select", {
8968
9263
  className: "swatch-set-select",
8969
9264
  value: R?.id ?? "",
8970
- onChange: (e) => ne(e.target.value),
9265
+ onChange: (e) => te(e.target.value),
8971
9266
  children: L.map((e) => /* @__PURE__ */ d("option", {
8972
9267
  value: e.id,
8973
9268
  children: e.name
@@ -8985,7 +9280,7 @@ function An({ sceneRef: e }) {
8985
9280
  className: "swatch-icon-btn swatch-icon-btn-danger",
8986
9281
  title: "Delete set",
8987
9282
  disabled: n.length <= 1,
8988
- onClick: te,
9283
+ onClick: ee,
8989
9284
  children: "🗑"
8990
9285
  })] })] }), g ? /* @__PURE__ */ f(u, { children: [
8991
9286
  /* @__PURE__ */ d("input", {
@@ -8994,14 +9289,14 @@ function An({ sceneRef: e }) {
8994
9289
  value: v,
8995
9290
  onChange: (e) => y(e.target.value),
8996
9291
  onKeyDown: (e) => {
8997
- e.key === "Enter" && B(), e.key === "Escape" && (_(!1), y(""));
9292
+ e.key === "Enter" && V(), e.key === "Escape" && (_(!1), y(""));
8998
9293
  },
8999
9294
  autoFocus: !0
9000
9295
  }),
9001
9296
  /* @__PURE__ */ d("button", {
9002
9297
  type: "button",
9003
9298
  className: "swatch-icon-btn",
9004
- onClick: B,
9299
+ onClick: V,
9005
9300
  children: "✓"
9006
9301
  }),
9007
9302
  /* @__PURE__ */ d("button", {
@@ -9024,12 +9319,12 @@ function An({ sceneRef: e }) {
9024
9319
  className: "swatch-grid",
9025
9320
  children: [R.swatches.map((e) => /* @__PURE__ */ f("div", {
9026
9321
  className: `swatch-chip${s === e.id ? " active" : ""}${T === e.id ? " editing" : ""}`,
9027
- onClick: () => re(e.id),
9322
+ onClick: () => ne(e.id),
9028
9323
  title: `${e.name} · env ${e.environment}${e.symbol ? ` · "${e.symbol}"` : ""}`,
9029
9324
  children: [
9030
9325
  /* @__PURE__ */ d("span", {
9031
9326
  className: "swatch-chip-env",
9032
- style: { background: ee(e.environment) }
9327
+ style: { background: z(e.environment) }
9033
9328
  }),
9034
9329
  e.symbol && /* @__PURE__ */ d("span", {
9035
9330
  className: "swatch-chip-symbol",
@@ -9044,7 +9339,7 @@ function An({ sceneRef: e }) {
9044
9339
  className: "swatch-chip-edit",
9045
9340
  title: "Edit",
9046
9341
  onClick: (t) => {
9047
- t.stopPropagation(), ie(e);
9342
+ t.stopPropagation(), re(e);
9048
9343
  },
9049
9344
  children: "✏"
9050
9345
  }), /* @__PURE__ */ d("button", {
@@ -9052,7 +9347,7 @@ function An({ sceneRef: e }) {
9052
9347
  className: "swatch-chip-del",
9053
9348
  title: "Delete",
9054
9349
  onClick: (t) => {
9055
- t.stopPropagation(), G(e.id);
9350
+ t.stopPropagation(), K(e.id);
9056
9351
  },
9057
9352
  children: "×"
9058
9353
  })] })
@@ -9061,7 +9356,7 @@ function An({ sceneRef: e }) {
9061
9356
  type: "button",
9062
9357
  className: "swatch-add-btn",
9063
9358
  title: "Add swatch",
9064
- onClick: H,
9359
+ onClick: U,
9065
9360
  children: "+"
9066
9361
  })]
9067
9362
  }),
@@ -9082,7 +9377,7 @@ function An({ sceneRef: e }) {
9082
9377
  value: k,
9083
9378
  onChange: (e) => A(e.target.value),
9084
9379
  onKeyDown: (e) => {
9085
- e.key === "Enter" && W(), e.key === "Escape" && U();
9380
+ e.key === "Enter" && G(), e.key === "Escape" && W();
9086
9381
  },
9087
9382
  autoFocus: !0
9088
9383
  }),
@@ -9093,7 +9388,7 @@ function An({ sceneRef: e }) {
9093
9388
  value: j,
9094
9389
  onChange: (e) => M(e.target.value),
9095
9390
  onKeyDown: (e) => {
9096
- e.key === "Enter" && W(), e.key === "Escape" && U();
9391
+ e.key === "Enter" && G(), e.key === "Escape" && W();
9097
9392
  }
9098
9393
  }),
9099
9394
  /* @__PURE__ */ f("div", {
@@ -9101,7 +9396,7 @@ function An({ sceneRef: e }) {
9101
9396
  children: [/* @__PURE__ */ d("button", {
9102
9397
  type: "button",
9103
9398
  className: "swatch-env-btn",
9104
- style: { background: ee(N) },
9399
+ style: { background: z(N) },
9105
9400
  title: `Env ${N === -1 ? "none" : N} — click to change`,
9106
9401
  onClick: () => I((e) => !e),
9107
9402
  children: /* @__PURE__ */ d("span", {
@@ -9129,14 +9424,14 @@ function An({ sceneRef: e }) {
9129
9424
  type: "button",
9130
9425
  className: "swatch-edit-ok",
9131
9426
  title: "Save",
9132
- onClick: W,
9427
+ onClick: G,
9133
9428
  children: "✓"
9134
9429
  }),
9135
9430
  /* @__PURE__ */ d("button", {
9136
9431
  type: "button",
9137
9432
  className: "swatch-edit-cancel",
9138
9433
  title: "Cancel",
9139
- onClick: U,
9434
+ onClick: W,
9140
9435
  children: "✕"
9141
9436
  })
9142
9437
  ]
@@ -9150,10 +9445,10 @@ function An({ sceneRef: e }) {
9150
9445
  }
9151
9446
  //#endregion
9152
9447
  //#region src/components/SearchPanel.tsx
9153
- function jn(e, t = 40) {
9448
+ function Pn(e, t = 40) {
9154
9449
  return e.length > t ? e.slice(0, t) + "…" : e;
9155
9450
  }
9156
- function Mn({ onClose: e }) {
9451
+ function Fn({ onClose: e }) {
9157
9452
  let a = O((e) => e.map), [o, s] = i(""), [c, l] = i("rooms"), [p, m] = i(0), h = r(null), g = r(null);
9158
9453
  t(() => {
9159
9454
  h.current?.focus();
@@ -9170,7 +9465,7 @@ function Mn({ onClose: e }) {
9170
9465
  else if (n.includes(e)) o = "id";
9171
9466
  else if (r.userData) {
9172
9467
  for (let [t, n] of Object.entries(r.userData)) if (t.toLowerCase().includes(e) || String(n).toLowerCase().includes(e)) {
9173
- o = `${t}: ${jn(String(n))}`;
9468
+ o = `${t}: ${Pn(String(n))}`;
9174
9469
  break;
9175
9470
  }
9176
9471
  }
@@ -9392,7 +9687,7 @@ function Mn({ onClose: e }) {
9392
9687
  }
9393
9688
  //#endregion
9394
9689
  //#region src/components/SpreadShrinkPopup.tsx
9395
- function Nn({ sceneRef: e }) {
9690
+ function In({ sceneRef: e }) {
9396
9691
  let n = O((e) => e.spreadShrink), i = O((e) => e.selection), a = r(null);
9397
9692
  if (t(() => {
9398
9693
  if (!n) return;
@@ -9540,7 +9835,7 @@ function Nn({ sceneRef: e }) {
9540
9835
  }
9541
9836
  }), d.push(...ke(t.map, e, f - o.x, p - o.y)));
9542
9837
  }
9543
- d.length > 0 && (X(d, r), r.refresh(), D.bumpStructure(), D.setState({ status: `${o === "spread" ? "Spread" : "Shrunk"} ${i.length} rooms (×${s.toFixed(2)})` })), D.setState({ spreadShrink: null });
9838
+ d.length > 0 && (Ee(d, r), r.refresh(), D.bumpStructure(), D.setState({ status: `${o === "spread" ? "Spread" : "Shrunk"} ${i.length} rooms (×${s.toFixed(2)})` })), D.setState({ spreadShrink: null });
9544
9839
  },
9545
9840
  children: "Apply"
9546
9841
  })]
@@ -9550,14 +9845,14 @@ function Nn({ sceneRef: e }) {
9550
9845
  }
9551
9846
  //#endregion
9552
9847
  //#region src/editor/reader/EditorMapReader.ts
9553
- var Pn = {
9848
+ var Ln = {
9554
9849
  1: "solid line",
9555
9850
  2: "dash line",
9556
9851
  3: "dot line",
9557
9852
  4: "dash dot line",
9558
9853
  5: "dash dot dot line"
9559
9854
  };
9560
- function Fn(e, t) {
9855
+ function Rn(e, t) {
9561
9856
  let n = {
9562
9857
  id: e,
9563
9858
  __raw: t
@@ -9612,7 +9907,7 @@ function Fn(e, t) {
9612
9907
  }), Object.defineProperty(n, "exits", {
9613
9908
  get() {
9614
9909
  let e = {};
9615
- for (let n of pe) {
9910
+ for (let n of fe) {
9616
9911
  let r = t[n];
9617
9912
  r !== void 0 && r !== -1 && (e[n] = r);
9618
9913
  }
@@ -9646,7 +9941,7 @@ function Fn(e, t) {
9646
9941
  g: 255,
9647
9942
  b: 255
9648
9943
  },
9649
- style: Pn[t.customLinesStyle?.[r]] ?? "solid line",
9944
+ style: Ln[t.customLinesStyle?.[r]] ?? "solid line",
9650
9945
  arrow: t.customLinesArrow?.[r] ?? !1
9651
9946
  }
9652
9947
  };
@@ -9657,7 +9952,7 @@ function Fn(e, t) {
9657
9952
  configurable: !0
9658
9953
  }), n;
9659
9954
  }
9660
- function In(e) {
9955
+ function zn(e) {
9661
9956
  let t = {
9662
9957
  north: "south",
9663
9958
  south: "north",
@@ -9723,7 +10018,7 @@ function In(e) {
9723
10018
  }
9724
10019
  return r;
9725
10020
  }
9726
- function Ln(e) {
10021
+ function Bn(e) {
9727
10022
  if (!e || e.length === 0) return "";
9728
10023
  if (typeof e == "string") return e.includes(",") ? e.split(",")[1] : e;
9729
10024
  try {
@@ -9732,10 +10027,10 @@ function Ln(e) {
9732
10027
  return "";
9733
10028
  }
9734
10029
  }
9735
- function Rn(e) {
9736
- e.pixMapBase64 === void 0 && (e.pixMapBase64 = Ln(e.pixMap));
10030
+ function Vn(e) {
10031
+ e.pixMapBase64 === void 0 && (e.pixMapBase64 = Bn(e.pixMap));
9737
10032
  }
9738
- function zn(e, t) {
10033
+ function Hn(e, t) {
9739
10034
  let n = e.id;
9740
10035
  if (!e.font) {
9741
10036
  let r = t[`system.labelFont_${n}`];
@@ -9744,8 +10039,8 @@ function zn(e, t) {
9744
10039
  if (t.length >= 4) {
9745
10040
  let n = parseInt(t[1], 10), r = parseInt(t[2], 10), i = r < 100 ? r >= 63 : r >= 600;
9746
10041
  e.font = {
9747
- family: t[0] || fe.family,
9748
- size: isNaN(n) || n <= 0 ? fe.size : n,
10042
+ family: t[0] || de.family,
10043
+ size: isNaN(n) || n <= 0 ? de.size : n,
9749
10044
  bold: i,
9750
10045
  italic: t[3] === "1",
9751
10046
  underline: !1,
@@ -9765,7 +10060,7 @@ function zn(e, t) {
9765
10060
  });
9766
10061
  }
9767
10062
  }
9768
- function Bn(e, t) {
10063
+ function Un(e, t) {
9769
10064
  let n = e.id, r = e.font;
9770
10065
  if (r?.family) {
9771
10066
  let e = r.bold ? 75 : 50;
@@ -9776,7 +10071,7 @@ function Bn(e, t) {
9776
10071
  t[`system.labelOutlineColor_${n}`] = `${r}|${i}|${a}|${o}`;
9777
10072
  } else t[`system.labelOutlineColor_${n}`] = "0|0|0|0";
9778
10073
  }
9779
- function Vn(e) {
10074
+ function Wn(e) {
9780
10075
  return {
9781
10076
  id: e.id,
9782
10077
  pos: [...e.pos],
@@ -9786,13 +10081,13 @@ function Vn(e) {
9786
10081
  bgColor: { ...e.bgColor },
9787
10082
  noScaling: e.noScaling ?? !1,
9788
10083
  showOnTop: e.showOnTop ?? !1,
9789
- font: e.font ? { ...e.font } : { ...fe },
10084
+ font: e.font ? { ...e.font } : { ...de },
9790
10085
  outlineColor: e.outlineColor ? { ...e.outlineColor } : void 0,
9791
10086
  pixMap: e.pixMapBase64 ? `data:image/png;base64,${e.pixMapBase64}` : "",
9792
10087
  imageSrc: e.imageSrc
9793
10088
  };
9794
10089
  }
9795
- var Hn = class {
10090
+ var Gn = class {
9796
10091
  constructor(e, t) {
9797
10092
  this.rooms = e, this.labels = t;
9798
10093
  }
@@ -9822,7 +10117,7 @@ var Hn = class {
9822
10117
  setLabels(e) {
9823
10118
  this.labels = e;
9824
10119
  }
9825
- }, Un = class {
10120
+ }, Kn = class {
9826
10121
  planes = {};
9827
10122
  exits = /* @__PURE__ */ new Map();
9828
10123
  version = 0;
@@ -9893,19 +10188,19 @@ var Hn = class {
9893
10188
  let t = {};
9894
10189
  for (let [n, r] of Object.entries(e)) {
9895
10190
  let e = Number(n);
9896
- t[e] = new Hn(r, this.labels.filter((t) => t.Z === e));
10191
+ t[e] = new Gn(r, this.labels.filter((t) => t.Z === e));
9897
10192
  }
9898
10193
  this.planes = t;
9899
10194
  }
9900
10195
  rebuildExits() {
9901
- this.exits = In(this.rooms);
10196
+ this.exits = zn(this.rooms);
9902
10197
  }
9903
10198
  };
9904
- function Wn(e) {
10199
+ function qn(e) {
9905
10200
  let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
9906
10201
  return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
9907
10202
  }
9908
- var Gn = {
10203
+ var Jn = {
9909
10204
  rgb: [
9910
10205
  114,
9911
10206
  1,
@@ -9918,17 +10213,17 @@ var Gn = {
9918
10213
  225
9919
10214
  ],
9920
10215
  symbolColorValue: "rgb(225,225,225)"
9921
- }, Kn = class {
10216
+ }, Yn = class {
9922
10217
  rooms = {};
9923
10218
  areas = {};
9924
10219
  colors = {};
9925
10220
  constructor(e) {
9926
10221
  this.raw = e;
9927
- let { colors: t } = U(e);
10222
+ let { colors: t } = W(e);
9928
10223
  for (let e of t) this.colors[e.envId] = {
9929
10224
  rgb: e.colors,
9930
10225
  rgbValue: `rgb(${e.colors.join(",")})`,
9931
- symbolColor: Wn(e.colors) > .41 ? [
10226
+ symbolColor: qn(e.colors) > .41 ? [
9932
10227
  25,
9933
10228
  25,
9934
10229
  25
@@ -9937,19 +10232,19 @@ var Gn = {
9937
10232
  255,
9938
10233
  255
9939
10234
  ],
9940
- symbolColorValue: Wn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
10235
+ symbolColorValue: qn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9941
10236
  };
9942
10237
  for (let [t, n] of Object.entries(e.areas)) {
9943
10238
  let r = Number(t), i = [];
9944
10239
  for (let t of n.rooms) {
9945
10240
  let n = e.rooms[t];
9946
10241
  if (!n) continue;
9947
- let r = Fn(t, n);
10242
+ let r = Rn(t, n);
9948
10243
  this.rooms[t] = r, i.push(r);
9949
10244
  }
9950
10245
  let a = e.labels?.[r] ?? [], o = e.areas[r]?.userData ?? {};
9951
- for (let e of a) Rn(e), zn(e, o);
9952
- this.areas[r] = new Un(r, e.areaNames[r] ?? `Area ${r}`, i, a.map((e) => this.toRendererLabel(e, r)));
10246
+ for (let e of a) Vn(e), Hn(e, o);
10247
+ this.areas[r] = new Kn(r, e.areaNames[r] ?? `Area ${r}`, i, a.map((e) => this.toRendererLabel(e, r)));
9953
10248
  }
9954
10249
  }
9955
10250
  toRendererLabel(e, t) {
@@ -10006,10 +10301,10 @@ var Gn = {
10006
10301
  return !1;
10007
10302
  }
10008
10303
  getColorValue(e) {
10009
- return this.colors[e]?.rgbValue ?? Gn.rgbValue;
10304
+ return this.colors[e]?.rgbValue ?? Jn.rgbValue;
10010
10305
  }
10011
10306
  getSymbolColor(e, t) {
10012
- let n = this.colors[e] ?? Gn, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.symbolColor.join(",");
10307
+ let n = this.colors[e] ?? Jn, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.symbolColor.join(",");
10013
10308
  return r === 1 ? `rgba(${i})` : `rgba(${i}, ${r})`;
10014
10309
  }
10015
10310
  moveRoom(e, t, n, r) {
@@ -10043,7 +10338,7 @@ var Gn = {
10043
10338
  this.raw.rooms[e] = t;
10044
10339
  let n = this.raw.areas[t.area];
10045
10340
  n && !n.rooms.includes(e) && n.rooms.push(e);
10046
- let r = Fn(e, t);
10341
+ let r = Rn(e, t);
10047
10342
  this.rooms[e] = r, this.areas[t.area]?.addRoomLive(r);
10048
10343
  }
10049
10344
  addRooms(e) {
@@ -10052,7 +10347,7 @@ var Gn = {
10052
10347
  this.raw.rooms[n] = r;
10053
10348
  let e = this.raw.areas[r.area];
10054
10349
  e && !e.rooms.includes(n) && e.rooms.push(n);
10055
- let i = Fn(n, r);
10350
+ let i = Rn(n, r);
10056
10351
  this.rooms[n] = i;
10057
10352
  let a = t.get(r.area);
10058
10353
  a || (a = [], t.set(r.area, a)), a.push(i);
@@ -10072,7 +10367,7 @@ var Gn = {
10072
10367
  setDoor(e, t, n) {
10073
10368
  let r = this.raw.rooms[e];
10074
10369
  if (!r) return;
10075
- let i = K[t];
10370
+ let i = q[t];
10076
10371
  n === 0 ? delete r.doors[i] : r.doors[i] = n, this.areas[r.area]?.markDirty();
10077
10372
  }
10078
10373
  setSpecialExitDoor(e, t, n) {
@@ -10082,7 +10377,7 @@ var Gn = {
10082
10377
  setExitWeight(e, t, n) {
10083
10378
  let r = this.raw.rooms[e];
10084
10379
  if (!r) return;
10085
- let i = K[t];
10380
+ let i = q[t];
10086
10381
  n <= 1 ? delete r.exitWeights[i] : r.exitWeights[i] = n, this.areas[r.area]?.markDirty();
10087
10382
  }
10088
10383
  setSpecialExitWeight(e, t, n) {
@@ -10092,7 +10387,7 @@ var Gn = {
10092
10387
  setExitLock(e, t, n) {
10093
10388
  let r = this.raw.rooms[e];
10094
10389
  if (!r) return;
10095
- let i = q[t];
10390
+ let i = J[t];
10096
10391
  if (n) r.exitLocks.includes(i) || r.exitLocks.push(i);
10097
10392
  else {
10098
10393
  let e = r.exitLocks.indexOf(i);
@@ -10103,7 +10398,7 @@ var Gn = {
10103
10398
  setStub(e, t, n) {
10104
10399
  let r = this.raw.rooms[e];
10105
10400
  if (!r) return;
10106
- let i = q[t];
10401
+ let i = J[t];
10107
10402
  if (n) r.stubs.includes(i) || r.stubs.push(i);
10108
10403
  else {
10109
10404
  let e = r.stubs.indexOf(i);
@@ -10154,7 +10449,7 @@ var Gn = {
10154
10449
  isZone: !1,
10155
10450
  zoneAreaRef: -1,
10156
10451
  userData: {}
10157
- }, this.raw.areaNames[e] = t, this.areas[e] = new Un(e, t, [], []);
10452
+ }, this.raw.areaNames[e] = t, this.areas[e] = new Kn(e, t, [], []);
10158
10453
  }
10159
10454
  removeArea(e) {
10160
10455
  delete this.raw.areas[e], delete this.raw.areaNames[e], delete this.areas[e];
@@ -10178,11 +10473,11 @@ var Gn = {
10178
10473
  }
10179
10474
  setCustomEnvColor(e, t) {
10180
10475
  t === null ? delete this.raw.mCustomEnvColors[e] : this.raw.mCustomEnvColors[e] = t;
10181
- let { colors: n } = U(this.raw);
10476
+ let { colors: n } = W(this.raw);
10182
10477
  for (let e of n) this.colors[e.envId] = {
10183
10478
  rgb: e.colors,
10184
10479
  rgbValue: `rgb(${e.colors.join(",")})`,
10185
- symbolColor: Wn(e.colors) > .41 ? [
10480
+ symbolColor: qn(e.colors) > .41 ? [
10186
10481
  25,
10187
10482
  25,
10188
10483
  25
@@ -10191,13 +10486,13 @@ var Gn = {
10191
10486
  255,
10192
10487
  255
10193
10488
  ],
10194
- symbolColorValue: Wn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
10489
+ symbolColorValue: qn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
10195
10490
  };
10196
10491
  t === null && delete this.colors[e];
10197
10492
  }
10198
10493
  getLabelSnapshot(e, t) {
10199
10494
  let n = this.raw.labels[e]?.find((e) => e.id === t);
10200
- return n ? Vn(n) : null;
10495
+ return n ? Wn(n) : null;
10201
10496
  }
10202
10497
  addLabel(e, t) {
10203
10498
  this.raw.labels[e] || (this.raw.labels[e] = []);
@@ -10219,7 +10514,7 @@ var Gn = {
10219
10514
  };
10220
10515
  this.raw.labels[e].push(r);
10221
10516
  let i = this.raw.areas[e]?.userData;
10222
- i && Bn(r, i), this.syncRendererLabels(e);
10517
+ i && Un(r, i), this.syncRendererLabels(e);
10223
10518
  }
10224
10519
  removeLabel(e, t) {
10225
10520
  if (!this.raw.labels[e]) return;
@@ -10252,14 +10547,14 @@ var Gn = {
10252
10547
  if (!r) return;
10253
10548
  r.font = { ...n };
10254
10549
  let i = this.raw.areas[e]?.userData;
10255
- i && Bn(r, i), this.syncRendererLabels(e);
10550
+ i && Un(r, i), this.syncRendererLabels(e);
10256
10551
  }
10257
10552
  setLabelOutlineColor(e, t, n) {
10258
10553
  let r = this.raw.labels[e]?.find((e) => e.id === t);
10259
10554
  if (!r) return;
10260
10555
  r.outlineColor = n ? { ...n } : void 0;
10261
10556
  let i = this.raw.areas[e]?.userData;
10262
- i && Bn(r, i), this.syncRendererLabels(e);
10557
+ i && Un(r, i), this.syncRendererLabels(e);
10263
10558
  }
10264
10559
  setLabelNoScaling(e, t, n) {
10265
10560
  let r = this.raw.labels[e]?.find((e) => e.id === t);
@@ -10290,10 +10585,10 @@ var Gn = {
10290
10585
  restoreAreaWithRooms(e, t, n, r) {
10291
10586
  let i = [];
10292
10587
  for (let { id: e, room: t } of n) {
10293
- let n = Fn(e, t);
10588
+ let n = Rn(e, t);
10294
10589
  this.rooms[e] = n, i.push(n);
10295
10590
  }
10296
- this.areas[e] = new Un(e, t, i, []);
10591
+ this.areas[e] = new Kn(e, t, i, []);
10297
10592
  for (let e of r) {
10298
10593
  let t = this.areas[e];
10299
10594
  t && (t.rebuildExits(), t.markDirty());
@@ -10304,7 +10599,7 @@ var Gn = {
10304
10599
  if (!t) return;
10305
10600
  for (let t of Object.keys(this.raw.rooms)) {
10306
10601
  let n = this.raw.rooms[Number(t)];
10307
- if (n) for (let t of pe) n[t] === e && (n[t] = -1);
10602
+ if (n) for (let t of fe) n[t] === e && (n[t] = -1);
10308
10603
  }
10309
10604
  let n = t.area;
10310
10605
  delete this.raw.rooms[e];
@@ -10332,7 +10627,7 @@ var Gn = {
10332
10627
  }
10333
10628
  for (let e of this.getAreas()) n.has(e.getAreaId()) || e.rebuildExits();
10334
10629
  }
10335
- }, qn = class {
10630
+ }, Xn = class {
10336
10631
  rects = /* @__PURE__ */ new Map();
10337
10632
  layer;
10338
10633
  unsubscribe;
@@ -10376,7 +10671,7 @@ var Gn = {
10376
10671
  }
10377
10672
  this.layer.batchDraw();
10378
10673
  }
10379
- }, Jn = "#ffcc00", Yn = .9, Xn = .3, Zn = .2, Qn = class {
10674
+ }, Zn = "#ffcc00", Qn = .9, $n = .3, er = .2, tr = class {
10380
10675
  roomRect;
10381
10676
  linkGroup;
10382
10677
  layer;
@@ -10387,7 +10682,7 @@ var Gn = {
10387
10682
  }
10388
10683
  attach(e) {
10389
10684
  this.layer = e, this.roomRect = new h.Rect({
10390
- stroke: Jn,
10685
+ stroke: Zn,
10391
10686
  strokeWidth: .06,
10392
10687
  listening: !1,
10393
10688
  visible: !1,
@@ -10435,23 +10730,23 @@ var Gn = {
10435
10730
  }
10436
10731
  for (let t of e.data.lines) this.linkGroup.add(new h.Line({
10437
10732
  points: [...t.points],
10438
- stroke: Jn,
10733
+ stroke: Zn,
10439
10734
  strokeWidth: r,
10440
10735
  dash: t.dash ? [...t.dash] : void 0,
10441
10736
  listening: !1,
10442
10737
  lineCap: "round",
10443
- opacity: Yn
10738
+ opacity: Qn
10444
10739
  }));
10445
10740
  for (let t of e.data.arrows) this.linkGroup.add(new h.Arrow({
10446
10741
  points: [...t.points],
10447
- stroke: Jn,
10448
- fill: Jn,
10742
+ stroke: Zn,
10743
+ fill: Zn,
10449
10744
  strokeWidth: r,
10450
10745
  dash: t.dash ? [...t.dash] : void 0,
10451
10746
  pointerLength: t.pointerLength,
10452
10747
  pointerWidth: t.pointerWidth,
10453
10748
  listening: !1,
10454
- opacity: Yn
10749
+ opacity: Qn
10455
10750
  }));
10456
10751
  this.linkGroup.visible(!0);
10457
10752
  } else if (t.kind === "customLine") {
@@ -10462,32 +10757,32 @@ var Gn = {
10462
10757
  }
10463
10758
  let i = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
10464
10759
  points: [...e.points],
10465
- stroke: Jn,
10466
- fill: Jn,
10760
+ stroke: Zn,
10761
+ fill: Zn,
10467
10762
  strokeWidth: r,
10468
10763
  dash: e.dash ? [...e.dash] : void 0,
10469
- pointerLength: Xn,
10470
- pointerWidth: Zn,
10764
+ pointerLength: $n,
10765
+ pointerWidth: er,
10471
10766
  listening: !1,
10472
10767
  lineCap: "round",
10473
10768
  lineJoin: "round",
10474
- opacity: Yn
10769
+ opacity: Qn
10475
10770
  }) : new h.Line({
10476
10771
  points: [...e.points],
10477
- stroke: Jn,
10772
+ stroke: Zn,
10478
10773
  strokeWidth: r,
10479
10774
  dash: e.dash ? [...e.dash] : void 0,
10480
10775
  listening: !1,
10481
10776
  lineCap: "round",
10482
10777
  lineJoin: "round",
10483
- opacity: Yn
10778
+ opacity: Qn
10484
10779
  });
10485
10780
  this.linkGroup.add(i), this.linkGroup.visible(!0);
10486
10781
  }
10487
10782
  this.layer.batchDraw();
10488
10783
  }
10489
- }, $n = .6;
10490
- function er(e) {
10784
+ }, nr = .6;
10785
+ function rr(e) {
10491
10786
  for (let [t, n, r] of at) if (r === e) return {
10492
10787
  ox: t,
10493
10788
  oy: n
@@ -10497,7 +10792,7 @@ function er(e) {
10497
10792
  oy: 0
10498
10793
  };
10499
10794
  }
10500
- var tr = class {
10795
+ var ir = class {
10501
10796
  line;
10502
10797
  dirLabel;
10503
10798
  layer;
@@ -10544,23 +10839,23 @@ var tr = class {
10544
10839
  }
10545
10840
  let r = n.getRenderRoom(t.sourceId);
10546
10841
  if (!r) return;
10547
- let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ?? $n) / 2, o = r.x, s = r.y;
10842
+ let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ?? nr) / 2, o = r.x, s = r.y;
10548
10843
  if (t.sourceDir) {
10549
- let { ox: e, oy: n } = er(t.sourceDir);
10844
+ let { ox: e, oy: n } = rr(t.sourceDir);
10550
10845
  o = r.x + e * a, s = r.y + n * a;
10551
10846
  }
10552
10847
  let c, l;
10553
10848
  if (i && t.targetDir) {
10554
- let { ox: e, oy: n } = er(t.targetDir);
10849
+ let { ox: e, oy: n } = rr(t.targetDir);
10555
10850
  c = i.x + e * a, l = i.y + n * a;
10556
10851
  } else i ? (c = i.x, l = i.y) : (c = t.cursorMap?.x ?? r.x, l = t.cursorMap?.y ?? r.y);
10557
10852
  let u = !0, d = "";
10558
10853
  if (i && i !== r) {
10559
- let n = t.sourceDir ?? Se(r.x, r.y, i.x, i.y);
10560
- if (!we(n)) u = !1, d = `${n}?`;
10854
+ let n = t.sourceDir ?? xe(r.x, r.y, i.x, i.y);
10855
+ if (!Ce(n)) u = !1, d = `${n}?`;
10561
10856
  else {
10562
- d = `${n} / ${t.targetDir ?? me[n]}`;
10563
- let r = e.map.rooms[t.sourceId], i = r ? J(r, n) : -1;
10857
+ d = `${n} / ${t.targetDir ?? pe[n]}`;
10858
+ let r = e.map.rooms[t.sourceId], i = r ? Y(r, n) : -1;
10564
10859
  i !== -1 && i !== t.hoverTargetId && (u = !1);
10565
10860
  }
10566
10861
  }
@@ -10572,7 +10867,7 @@ var tr = class {
10572
10867
  l
10573
10868
  ]), this.line.stroke(f), this.line.fill(f), this.line.visible(!0), d ? (this.dirLabel.text(d), this.dirLabel.fill(f), this.dirLabel.x((o + c) / 2 + .2), this.dirLabel.y((s + l) / 2 + .2), this.dirLabel.visible(!0)) : this.dirLabel.visible(!1), this.layer.batchDraw();
10574
10869
  }
10575
- }, nr = class {
10870
+ }, ar = class {
10576
10871
  rect;
10577
10872
  layer;
10578
10873
  unsubscribe;
@@ -10608,7 +10903,7 @@ var tr = class {
10608
10903
  }
10609
10904
  this.rect.x(t.x), this.rect.y(t.y), this.rect.visible(!0), this.layer.batchDraw();
10610
10905
  }
10611
- }, rr = class {
10906
+ }, or = class {
10612
10907
  source;
10613
10908
  target;
10614
10909
  layer;
@@ -10686,7 +10981,7 @@ var tr = class {
10686
10981
  }
10687
10982
  this.layer.batchDraw();
10688
10983
  }
10689
- }, ir = "rgba(255, 220, 60, 0.9)", ar = .55, or = class {
10984
+ }, sr = "rgba(255, 220, 60, 0.9)", cr = .55, lr = class {
10690
10985
  group;
10691
10986
  layer;
10692
10987
  unsubscribe;
@@ -10759,14 +11054,14 @@ var tr = class {
10759
11054
  if (o) {
10760
11055
  let t = this.resolveTargetRoom(e, o.roomId, o.exitName);
10761
11056
  if (t) {
10762
- let { x: e, y: n } = t, r = ar, i = new h.Line({
11057
+ let { x: e, y: n } = t, r = cr, i = new h.Line({
10763
11058
  points: [
10764
11059
  e - r,
10765
11060
  n,
10766
11061
  e + r,
10767
11062
  n
10768
11063
  ],
10769
- stroke: ir,
11064
+ stroke: sr,
10770
11065
  strokeWidth: a,
10771
11066
  listening: !1,
10772
11067
  lineCap: "round"
@@ -10777,7 +11072,7 @@ var tr = class {
10777
11072
  e,
10778
11073
  n + r
10779
11074
  ],
10780
- stroke: ir,
11075
+ stroke: sr,
10781
11076
  strokeWidth: a,
10782
11077
  listening: !1,
10783
11078
  lineCap: "round"
@@ -10792,9 +11087,9 @@ var tr = class {
10792
11087
  if (!r || !i) return null;
10793
11088
  let a = i.rooms[t];
10794
11089
  if (!a) return null;
10795
- let o, s = _e[n];
11090
+ let o, s = ge[n];
10796
11091
  if (s) {
10797
- let e = J(a, s);
11092
+ let e = Y(a, s);
10798
11093
  e > 0 && (o = e);
10799
11094
  } else {
10800
11095
  let e = a.mSpecialExits?.[n];
@@ -10807,11 +11102,11 @@ var tr = class {
10807
11102
  y: c.y
10808
11103
  };
10809
11104
  }
10810
- }, sr = "#00e5ff", cr = {
10811
- shadowColor: sr,
11105
+ }, ur = "#00e5ff", dr = {
11106
+ shadowColor: ur,
10812
11107
  shadowBlur: 4,
10813
11108
  shadowOpacity: .8
10814
- }, lr = .3, ur = .2, dr = class {
11109
+ }, fr = .3, pr = .2, mr = class {
10815
11110
  group;
10816
11111
  layer;
10817
11112
  unsubscribe;
@@ -10849,22 +11144,22 @@ var tr = class {
10849
11144
  }
10850
11145
  for (let t of e.data.lines) this.group.add(new h.Line({
10851
11146
  points: [...t.points],
10852
- stroke: sr,
11147
+ stroke: ur,
10853
11148
  strokeWidth: .08,
10854
11149
  dash: t.dash ? [...t.dash] : void 0,
10855
11150
  listening: !1,
10856
- ...cr
11151
+ ...dr
10857
11152
  }));
10858
11153
  for (let t of e.data.arrows) this.group.add(new h.Arrow({
10859
11154
  points: [...t.points],
10860
- stroke: sr,
10861
- fill: sr,
11155
+ stroke: ur,
11156
+ fill: ur,
10862
11157
  strokeWidth: .08,
10863
11158
  dash: t.dash ? [...t.dash] : void 0,
10864
11159
  pointerLength: t.pointerLength,
10865
11160
  pointerWidth: t.pointerWidth,
10866
11161
  listening: !1,
10867
- ...cr
11162
+ ...dr
10868
11163
  }));
10869
11164
  this.group.visible(!0), this.layer.batchDraw();
10870
11165
  return;
@@ -10877,28 +11172,28 @@ var tr = class {
10877
11172
  }
10878
11173
  let r = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
10879
11174
  points: [...e.points],
10880
- stroke: sr,
10881
- fill: sr,
11175
+ stroke: ur,
11176
+ fill: ur,
10882
11177
  strokeWidth: .08,
10883
11178
  dash: e.dash ? [...e.dash] : void 0,
10884
- pointerLength: lr,
10885
- pointerWidth: ur,
11179
+ pointerLength: fr,
11180
+ pointerWidth: pr,
10886
11181
  listening: !1,
10887
- ...cr
11182
+ ...dr
10888
11183
  }) : new h.Line({
10889
11184
  points: [...e.points],
10890
- stroke: sr,
11185
+ stroke: ur,
10891
11186
  strokeWidth: .08,
10892
11187
  dash: e.dash ? [...e.dash] : void 0,
10893
11188
  listening: !1,
10894
- ...cr
11189
+ ...dr
10895
11190
  });
10896
11191
  this.group.add(r), this.group.add(new h.Circle({
10897
11192
  x: e.points[0],
10898
11193
  y: e.points[1],
10899
11194
  radius: .1,
10900
11195
  fill: "#1a2030",
10901
- stroke: sr,
11196
+ stroke: ur,
10902
11197
  strokeWidth: .04,
10903
11198
  listening: !1
10904
11199
  }));
@@ -10909,8 +11204,8 @@ var tr = class {
10909
11204
  x: e.points[t],
10910
11205
  y: e.points[t + 1],
10911
11206
  radius: r ? .14 : .1,
10912
- fill: r ? "#ffffff" : sr,
10913
- stroke: r ? sr : "#ffffff",
11207
+ fill: r ? "#ffffff" : ur,
11208
+ stroke: r ? ur : "#ffffff",
10914
11209
  strokeWidth: r ? .06 : .04,
10915
11210
  listening: !1
10916
11211
  }));
@@ -10923,13 +11218,13 @@ var tr = class {
10923
11218
  };
10924
11219
  //#endregion
10925
11220
  //#region src/editor/effects/GridOverlayEffect.ts
10926
- function fr(e, t) {
11221
+ function hr(e, t) {
10927
11222
  let n = e.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);
10928
11223
  if (!n) return e;
10929
11224
  let r = n[4] === void 0 ? 1 : parseFloat(n[4]);
10930
11225
  return `rgba(${n[1]}, ${n[2]}, ${n[3]}, ${Math.min(1, r * t)})`;
10931
11226
  }
10932
- var pr = class {
11227
+ var gr = class {
10933
11228
  gridShape;
10934
11229
  axisShape;
10935
11230
  labelShape;
@@ -10961,7 +11256,7 @@ var pr = class {
10961
11256
  }), this.axisShape = new h.Shape({
10962
11257
  listening: !1,
10963
11258
  visible: !1,
10964
- stroke: fr(this.gridColor, 2),
11259
+ stroke: hr(this.gridColor, 2),
10965
11260
  strokeWidth: this.gridLineWidth * 2,
10966
11261
  sceneFunc: (e, t) => {
10967
11262
  let { minX: n, maxX: r, minY: i, maxY: a } = this.bounds;
@@ -10975,7 +11270,7 @@ var pr = class {
10975
11270
  text: "(0,0)",
10976
11271
  fontSize: this.gridSize,
10977
11272
  fontFamily: "monospace",
10978
- fill: fr(this.gridColor, 2)
11273
+ fill: hr(this.gridColor, 2)
10979
11274
  }), e.add(this.gridShape), e.add(this.axisShape), e.add(this.labelShape), this.unsubscribe = D.subscribe(() => this.syncVisibility());
10980
11275
  }
10981
11276
  updateViewport(e, t, n) {
@@ -10989,7 +11284,7 @@ var pr = class {
10989
11284
  let e = this.getIsEmpty();
10990
11285
  e && (this.bounds = this.getViewportBounds()), this.gridShape.visible() !== e && (this.gridShape.visible(e), this.axisShape.visible(e), this.labelShape.visible(e), this.layer.batchDraw());
10991
11286
  }
10992
- }, mr = class {
11287
+ }, _r = class {
10993
11288
  rect;
10994
11289
  layer;
10995
11290
  unsubscribe;
@@ -11023,7 +11318,7 @@ var pr = class {
11023
11318
  };
11024
11319
  //#endregion
11025
11320
  //#region src/editor/effects/LabelHaloEffect.ts
11026
- function hr(e, t, n, r) {
11321
+ function vr(e, t, n, r) {
11027
11322
  return [
11028
11323
  {
11029
11324
  id: "nw",
@@ -11067,7 +11362,7 @@ function hr(e, t, n, r) {
11067
11362
  }
11068
11363
  ];
11069
11364
  }
11070
- var gr = class {
11365
+ var yr = class {
11071
11366
  selRect;
11072
11367
  hoverRect;
11073
11368
  previewRect;
@@ -11157,7 +11452,7 @@ var gr = class {
11157
11452
  for (let e of this.handles) e.visible(!1);
11158
11453
  return;
11159
11454
  }
11160
- let t = .05, n = e.x - t, r = e.y - t, i = e.w + t * 2, a = e.h + t * 2, o = this.handleSize, s = hr(n, r, i, a);
11455
+ let t = .05, n = e.x - t, r = e.y - t, i = e.w + t * 2, a = e.h + t * 2, o = this.handleSize, s = vr(n, r, i, a);
11161
11456
  for (let e = 0; e < this.handles.length; e++) {
11162
11457
  let t = this.handles[e], n = s[e];
11163
11458
  t.x(n.x - o / 2), t.y(n.y - o / 2), t.width(o), t.height(o), t.visible(!0);
@@ -11176,7 +11471,7 @@ var gr = class {
11176
11471
  } else this.previewRect.visible(!1);
11177
11472
  this.layer.batchDraw();
11178
11473
  }
11179
- }, _r = class {
11474
+ }, br = class {
11180
11475
  hLine;
11181
11476
  vLine;
11182
11477
  dot;
@@ -11265,11 +11560,11 @@ var gr = class {
11265
11560
  };
11266
11561
  //#endregion
11267
11562
  //#region src/editor/effects/GhostRoomsEffect.ts
11268
- function vr(e, t) {
11563
+ function xr(e, t) {
11269
11564
  let n = e.match(/\d+/g);
11270
11565
  return !n || n.length < 3 ? `rgba(128, 128, 128, ${t})` : `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${t})`;
11271
11566
  }
11272
- var yr = class {
11567
+ var Sr = class {
11273
11568
  rects = /* @__PURE__ */ new Map();
11274
11569
  layer;
11275
11570
  unsubscribe;
@@ -11323,7 +11618,7 @@ var yr = class {
11323
11618
  for (let [e, t] of this.rects) n.has(e) || (t.destroy(), this.rects.delete(e));
11324
11619
  let r = .05, i = this.roomSize + r * 2;
11325
11620
  for (let [e, a] of n) {
11326
- let n = t?.getRenderRoom(e), o = t?.reader.getColorValue(n?.env ?? 1) ?? "rgb(128,128,128)", s = vr(o, .2), c = vr(o, .65), l = this.rects.get(e);
11621
+ let n = t?.getRenderRoom(e), o = t?.reader.getColorValue(n?.env ?? 1) ?? "rgb(128,128,128)", s = xr(o, .2), c = xr(o, .65), l = this.rects.get(e);
11327
11622
  l || (l = new h.Rect({
11328
11623
  strokeWidth: this.strokeWidth,
11329
11624
  dash: [...this.dash],
@@ -11336,7 +11631,7 @@ var yr = class {
11336
11631
  };
11337
11632
  //#endregion
11338
11633
  //#region src/editor/pointerController.ts
11339
- function br(e) {
11634
+ function Cr(e) {
11340
11635
  let { container: t } = e, n = null, r = null, i = D.getState().spaceHeld, a = D.subscribe((r) => {
11341
11636
  if (!i && r.spaceHeld && n !== null) {
11342
11637
  Ft[r.activeTool].onCancel?.(e);
@@ -11402,10 +11697,10 @@ function br(e) {
11402
11697
  }
11403
11698
  //#endregion
11404
11699
  //#region src/editor/scene.ts
11405
- function xr(e, t) {
11700
+ function wr(e, t) {
11406
11701
  let n = m();
11407
11702
  n.gridEnabled = !0, n.highlightCurrentRoom = !1, n.areaName = !1, n.labelRenderMode = "image", t.dataset.editorCursor = "true";
11408
- let r = new Kn(e), i = new p(r, n, t), a = { current: null }, o = new mr(), s = new qn(n.roomSize, a), c = new Qn(n.roomSize, a), l = new tr(a), u = new nr(n.roomSize), d = new rr(n.roomSize, a), f = new or(a), h = new dr(a, n.roomSize), g = new gr(a), _ = new _r(a), v = new yr(n.roomSize, a), y = new pr(n.gridColor, n.gridLineWidth, n.gridSize, () => {
11703
+ let r = new Yn(e), i = new p(r, n, t), a = { current: null }, o = new _r(), s = new Xn(n.roomSize, a), c = new tr(n.roomSize, a), l = new ir(a), u = new ar(n.roomSize), d = new or(n.roomSize, a), f = new lr(a), h = new mr(a, n.roomSize), g = new yr(a), _ = new br(a), v = new Sr(n.roomSize, a), y = new gr(n.gridColor, n.gridLineWidth, n.gridSize, () => {
11409
11704
  let e = D.getState();
11410
11705
  if (e.currentAreaId == null) return !1;
11411
11706
  let t = r.getArea(e.currentAreaId);
@@ -11435,7 +11730,7 @@ function xr(e, t) {
11435
11730
  }
11436
11731
  };
11437
11732
  a.current = b;
11438
- let x = br({
11733
+ let x = Cr({
11439
11734
  renderer: i,
11440
11735
  container: t,
11441
11736
  settings: n,
@@ -11446,12 +11741,12 @@ function xr(e, t) {
11446
11741
  }
11447
11742
  //#endregion
11448
11743
  //#region src/App.tsx
11449
- var Sr = {
11744
+ var Tr = {
11450
11745
  top: 104,
11451
11746
  right: 464,
11452
11747
  bottom: 24,
11453
11748
  left: 24
11454
- }, Cr = {
11749
+ }, Er = {
11455
11750
  1: "select",
11456
11751
  2: "connect",
11457
11752
  3: "unlink",
@@ -11460,7 +11755,7 @@ var Sr = {
11460
11755
  6: "delete",
11461
11756
  7: "pan",
11462
11757
  8: "paint"
11463
- }, wr = {
11758
+ }, Dr = {
11464
11759
  ArrowLeft: {
11465
11760
  dx: -1,
11466
11761
  dy: 0
@@ -11478,7 +11773,7 @@ var Sr = {
11478
11773
  dy: -1
11479
11774
  }
11480
11775
  };
11481
- function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11776
+ function Or({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11482
11777
  let s = r(null), c = r(null), l = O((e) => e.map), p = O((e) => e.swatchPaletteOpen), m = l != null, h = O((e) => e.currentAreaId), g = O((e) => e.currentZ), _ = O((e) => e.activeTool), v = O((e) => e.pending), y = O((e) => e.hover), b = O((e) => e.spaceHeld), x = O((e) => e.panelCollapsed), C = O((e) => e.dataVersion), w = O((e) => e.panRequest), [T, E] = i(!1), [k, A] = i(!1), [j, M] = i(!1), [N, P] = i(() => new URLSearchParams(window.location.search).get("map")), F = n(() => a.flatMap((e) => e.swatchSets?.() ?? []), [a]), I = n(() => a.flatMap((e) => e.sidebarTabs?.() ?? []), [a]), L = n(() => a.flatMap((e) => e.roomPanelSections?.() ?? []), [a]);
11483
11778
  t(() => {
11484
11779
  D.setState({ pluginSwatchSets: F });
@@ -11494,17 +11789,17 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11494
11789
  else if (e && !l) for (let e of a) e.onMapClosed?.();
11495
11790
  }, [l]), t(() => {
11496
11791
  if (!l || !s.current) return;
11497
- let e = xr(l, s.current);
11792
+ let e = wr(l, s.current);
11498
11793
  c.current = e;
11499
11794
  let { currentAreaId: t, currentZ: n } = D.getState();
11500
- return t != null && e.setArea(t, n, Sr), () => {
11795
+ return t != null && e.setArea(t, n, Tr), () => {
11501
11796
  e.destroy(), c.current = null;
11502
11797
  };
11503
11798
  }, [l]), t(() => {
11504
11799
  let e = c.current;
11505
11800
  if (!e || !m || h == null) return;
11506
11801
  let t = D.getState().navigateTo;
11507
- t ? (D.setState({ navigateTo: null }), e.setAreaAt(h, g, t.mapX, t.mapY)) : e.setArea(h, g, Sr);
11802
+ t ? (D.setState({ navigateTo: null }), e.setAreaAt(h, g, t.mapX, t.mapY)) : e.setArea(h, g, Tr);
11508
11803
  }, [
11509
11804
  h,
11510
11805
  g,
@@ -11549,7 +11844,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11549
11844
  let { map: e, loaded: t, undo: n, currentAreaId: r, currentZ: i, sessionId: a } = D.getState();
11550
11845
  if (!e || !t) return;
11551
11846
  let o = setTimeout(() => {
11552
- bn(t.fileName, e, n, r, i, a ?? void 0).then((e) => {
11847
+ Cn(t.fileName, e, n, r, i, a ?? void 0).then((e) => {
11553
11848
  a || D.setState({ sessionId: e });
11554
11849
  }).catch(console.error);
11555
11850
  }, 1500);
@@ -11573,11 +11868,11 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11573
11868
  return;
11574
11869
  }
11575
11870
  if ((t.ctrlKey || t.metaKey) && !t.shiftKey && t.key.toLowerCase() === "z") {
11576
- t.preventDefault(), z();
11871
+ t.preventDefault(), B();
11577
11872
  return;
11578
11873
  }
11579
11874
  if ((t.ctrlKey || t.metaKey) && (t.shiftKey && t.key.toLowerCase() === "z" || t.key.toLowerCase() === "y")) {
11580
- t.preventDefault(), B();
11875
+ t.preventDefault(), V();
11581
11876
  return;
11582
11877
  }
11583
11878
  if (t.key === "Enter") {
@@ -11595,7 +11890,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11595
11890
  return;
11596
11891
  }
11597
11892
  if (t.key === "Delete" || t.key === "Backspace") {
11598
- ee();
11893
+ z();
11599
11894
  return;
11600
11895
  }
11601
11896
  if (t.key === "g" || t.key === "G") {
@@ -11603,13 +11898,13 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11603
11898
  return;
11604
11899
  }
11605
11900
  if (t.key === "f" || t.key === "F") {
11606
- c.current?.renderer.fitArea(Sr);
11901
+ c.current?.renderer.fitArea(Tr);
11607
11902
  return;
11608
11903
  }
11609
- if (Cr[t.key]) {
11904
+ if (Er[t.key]) {
11610
11905
  let e = D.getState();
11611
11906
  e.pending?.kind === "customLine" && c.current && (Ot(e.pending, c.current), D.bumpData()), D.setState({
11612
- activeTool: Cr[t.key],
11907
+ activeTool: Er[t.key],
11613
11908
  pending: null
11614
11909
  });
11615
11910
  return;
@@ -11625,14 +11920,14 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11625
11920
  } });
11626
11921
  return;
11627
11922
  }
11628
- if (wr[t.key]) {
11923
+ if (Dr[t.key]) {
11629
11924
  let e = D.getState();
11630
11925
  if (e.activeTool !== "select" || !e.selection || !e.map) return;
11631
11926
  if (e.selection.kind === "label") {
11632
11927
  let { id: n, areaId: r } = e.selection, i = c.current?.reader.getLabelSnapshot(r, n);
11633
11928
  if (!i) return;
11634
11929
  t.preventDefault();
11635
- let a = (t.shiftKey ? 5 : 1) * e.gridStep, o = wr[t.key], s = o.dx * a, l = o.dy * a, u = [...i.pos], d = [
11930
+ let a = (t.shiftKey ? 5 : 1) * e.gridStep, o = Dr[t.key], s = o.dx * a, l = o.dy * a, u = [...i.pos], d = [
11636
11931
  i.pos[0] + s,
11637
11932
  i.pos[1] + l,
11638
11933
  i.pos[2]
@@ -11651,7 +11946,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11651
11946
  }
11652
11947
  if (e.selection.kind !== "room") return;
11653
11948
  t.preventDefault();
11654
- let n = (t.shiftKey ? 5 : 1) * e.gridStep, r = wr[t.key], i = r.dx * n, a = r.dy * n, o = [];
11949
+ let n = (t.shiftKey ? 5 : 1) * e.gridStep, r = Dr[t.key], i = r.dx * n, a = r.dy * n, o = [];
11655
11950
  for (let t of e.selection.ids) {
11656
11951
  let n = e.map.rooms[t];
11657
11952
  if (!n) continue;
@@ -11689,9 +11984,9 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11689
11984
  }
11690
11985
  };
11691
11986
  window.addEventListener("keydown", r), window.addEventListener("keyup", t), window.addEventListener("blur", n);
11692
- let i = () => c.current?.renderer.fitArea(Sr);
11693
- return window.addEventListener("editor:undo", z), window.addEventListener("editor:redo", B), window.addEventListener("editor:fit", i), () => {
11694
- window.removeEventListener("keydown", r), window.removeEventListener("keyup", t), window.removeEventListener("blur", n), window.removeEventListener("editor:undo", z), window.removeEventListener("editor:redo", B), window.removeEventListener("editor:fit", i);
11987
+ let i = () => c.current?.renderer.fitArea(Tr);
11988
+ return window.addEventListener("editor:undo", B), window.addEventListener("editor:redo", V), window.addEventListener("editor:fit", i), () => {
11989
+ window.removeEventListener("keydown", r), window.removeEventListener("keyup", t), window.removeEventListener("blur", n), window.removeEventListener("editor:undo", B), window.removeEventListener("editor:redo", V), window.removeEventListener("editor:fit", i);
11695
11990
  };
11696
11991
  }, []), t(() => {
11697
11992
  let e = (e) => {
@@ -11699,13 +11994,13 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11699
11994
  }, t = (e) => {
11700
11995
  e.preventDefault();
11701
11996
  let t = Array.from(e.dataTransfer?.files ?? []).find((e) => e.name.endsWith(".dat"));
11702
- t && ae(t);
11997
+ t && ie(t);
11703
11998
  };
11704
11999
  return window.addEventListener("dragover", e), window.addEventListener("drop", t), () => {
11705
12000
  window.removeEventListener("dragover", e), window.removeEventListener("drop", t);
11706
12001
  };
11707
12002
  }, []);
11708
- let ee = () => {
12003
+ let z = () => {
11709
12004
  let e = D.getState();
11710
12005
  if (!e.map) return;
11711
12006
  let t = e.selection;
@@ -11725,7 +12020,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11725
12020
  });
11726
12021
  }
11727
12022
  if (r.length === 0) return;
11728
- Y({
12023
+ X({
11729
12024
  kind: "batch",
11730
12025
  cmds: r
11731
12026
  }, c.current), c.current?.refresh(), D.setState({
@@ -11737,7 +12032,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11737
12032
  let n = t.ids[0], r = e.map.rooms[n];
11738
12033
  if (!r) return;
11739
12034
  let i = { ...r }, a = Ae(e.map, n);
11740
- Y({
12035
+ X({
11741
12036
  kind: "deleteRoom",
11742
12037
  id: n,
11743
12038
  room: i,
@@ -11766,7 +12061,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11766
12061
  in: "out",
11767
12062
  out: "in"
11768
12063
  }[t.dir], a = r[i] === t.fromId;
11769
- Y({
12064
+ X({
11770
12065
  kind: "removeExit",
11771
12066
  fromId: t.fromId,
11772
12067
  dir: t.dir,
@@ -11794,7 +12089,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11794
12089
  }, a = n.customLinesStyle?.[t.exitName] ?? 1, o = n.customLinesArrow?.[t.exitName] ?? !1;
11795
12090
  if (t.pointIndex != null && t.pointIndex >= 0 && t.pointIndex < r.length) {
11796
12091
  let e = r.filter((e, n) => n !== t.pointIndex);
11797
- Y({
12092
+ X({
11798
12093
  kind: "setCustomLine",
11799
12094
  roomId: t.roomId,
11800
12095
  exitName: t.exitName,
@@ -11820,7 +12115,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11820
12115
  });
11821
12116
  return;
11822
12117
  }
11823
- Y({
12118
+ X({
11824
12119
  kind: "removeCustomLine",
11825
12120
  roomId: t.roomId,
11826
12121
  exitName: t.exitName,
@@ -11839,7 +12134,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11839
12134
  if (t.kind === "label") {
11840
12135
  let e = c.current?.reader.getLabelSnapshot(t.areaId, t.id);
11841
12136
  if (!e) return;
11842
- Y({
12137
+ X({
11843
12138
  kind: "deleteLabel",
11844
12139
  areaId: t.areaId,
11845
12140
  label: e
@@ -11850,10 +12145,10 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11850
12145
  return;
11851
12146
  }
11852
12147
  }
11853
- }, z = () => {
12148
+ }, B = () => {
11854
12149
  let { changed: e, structural: t } = De(c.current);
11855
12150
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Undone" }));
11856
- }, B = () => {
12151
+ }, V = () => {
11857
12152
  let { changed: e, structural: t } = Oe(c.current);
11858
12153
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Redone" }));
11859
12154
  };
@@ -11867,8 +12162,8 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11867
12162
  ref: s,
11868
12163
  className: "map-container"
11869
12164
  }),
11870
- !m && /* @__PURE__ */ d(kn, {}),
11871
- /* @__PURE__ */ d(ue, {
12165
+ !m && /* @__PURE__ */ d(Mn, {}),
12166
+ /* @__PURE__ */ d(le, {
11872
12167
  title: o,
11873
12168
  onHelpClick: () => E(!0),
11874
12169
  onLoadFromUrl: () => A(!0),
@@ -11877,15 +12172,15 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11877
12172
  },
11878
12173
  onSearchClick: () => M((e) => !e)
11879
12174
  }),
11880
- /* @__PURE__ */ d(pn, {
12175
+ /* @__PURE__ */ d(gn, {
11881
12176
  sceneRef: c,
11882
12177
  extraTabs: I,
11883
12178
  pluginRoomSections: L
11884
12179
  })
11885
12180
  ]
11886
12181
  }),
11887
- /* @__PURE__ */ d(mn, { sceneRef: c }),
11888
- p && /* @__PURE__ */ d(An, { sceneRef: c }),
12182
+ /* @__PURE__ */ d(_n, { sceneRef: c }),
12183
+ p && /* @__PURE__ */ d(Nn, { sceneRef: c }),
11889
12184
  a.map((t, n) => /* @__PURE__ */ d(e, { children: t.renderOverlay?.() }, n)),
11890
12185
  j && m && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
11891
12186
  style: {
@@ -11894,10 +12189,10 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11894
12189
  zIndex: 399
11895
12190
  },
11896
12191
  onMouseDown: () => M(!1)
11897
- }), /* @__PURE__ */ d(Mn, { onClose: () => M(!1) })] }),
11898
- /* @__PURE__ */ d(Nn, { sceneRef: c }),
11899
- T && /* @__PURE__ */ d(le, { onClose: () => E(!1) }),
11900
- (k || N) && /* @__PURE__ */ d(de, {
12192
+ }), /* @__PURE__ */ d(Fn, { onClose: () => M(!1) })] }),
12193
+ /* @__PURE__ */ d(In, { sceneRef: c }),
12194
+ T && /* @__PURE__ */ d(ce, { onClose: () => E(!1) }),
12195
+ (k || N) && /* @__PURE__ */ d(ue, {
11901
12196
  initialUrl: N ?? void 0,
11902
12197
  onClose: () => {
11903
12198
  A(!1), P(null);
@@ -11908,9 +12203,9 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11908
12203
  }
11909
12204
  //#endregion
11910
12205
  //#region src/editor/mapBytes.ts
11911
- function Er() {
12206
+ function kr() {
11912
12207
  let { map: e } = D.getState();
11913
- return e ? H(e) : null;
12208
+ return e ? U(e) : null;
11914
12209
  }
11915
12210
  //#endregion
11916
- export { Tr as App, Er as getMapBytes, G as loadUrlIntoStore, Y as pushCommand, D as store, O as useEditorState };
12211
+ export { Or as App, kr as getMapBytes, K as loadUrlIntoStore, X as pushCommand, D as store, O as useEditorState };