mudlet-map-editor 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-lib/index.js CHANGED
@@ -104,7 +104,7 @@ function O(e) {
104
104
  //#endregion
105
105
  //#region node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js
106
106
  var k = {}, A = {};
107
- A.byteLength = R, A.toByteArray = z, A.fromByteArray = te;
107
+ A.byteLength = R, A.toByteArray = B, A.fromByteArray = ee;
108
108
  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;
109
109
  M[45] = 62, M[95] = 63;
110
110
  function L(e) {
@@ -119,27 +119,27 @@ function R(e) {
119
119
  var t = L(e), n = t[0], r = t[1];
120
120
  return (n + r) * 3 / 4 - r;
121
121
  }
122
- function ee(e, t, n) {
122
+ function z(e, t, n) {
123
123
  return (t + n) * 3 / 4 - n;
124
124
  }
125
- function z(e) {
126
- 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;
125
+ function B(e) {
126
+ 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;
127
127
  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;
128
128
  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;
129
129
  }
130
- function B(e) {
130
+ function V(e) {
131
131
  return j[e >> 18 & 63] + j[e >> 12 & 63] + j[e >> 6 & 63] + j[e & 63];
132
132
  }
133
- function V(e, t, n) {
134
- 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));
133
+ function H(e, t, n) {
134
+ 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));
135
135
  return i.join("");
136
136
  }
137
- function te(e) {
138
- 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));
137
+ function ee(e) {
138
+ 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));
139
139
  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("");
140
140
  }
141
- var ne = {};
142
- ne.read = function(e, t, n, r, i) {
141
+ var te = {};
142
+ te.read = function(e, t, n, r, i) {
143
143
  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];
144
144
  for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
145
145
  for (o = a & (1 << -u) - 1, a >>= -u, u += r; u > 0; o = o * 256 + e[t + d], d += f, u -= 8);
@@ -147,13 +147,13 @@ ne.read = function(e, t, n, r, i) {
147
147
  else if (a === c) return o ? NaN : (p ? -1 : 1) * Infinity;
148
148
  else o += 2 ** r, a -= l;
149
149
  return (p ? -1 : 1) * o * 2 ** (a - r);
150
- }, ne.write = function(e, t, n, r, i, a) {
150
+ }, te.write = function(e, t, n, r, i, a) {
151
151
  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);
152
152
  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);
153
153
  for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
154
154
  e[n + p - m] |= h * 128;
155
155
  }, (function(e) {
156
- let t = A, n = ne, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
156
+ let t = A, n = te, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
157
157
  e.Buffer = u, e.SlowBuffer = x, e.INSPECT_MAX_BYTES = 50;
158
158
  let i = 2147483647;
159
159
  e.kMaxLength = i;
@@ -335,7 +335,7 @@ ne.read = function(e, t, n, r, i) {
335
335
  let r = !1;
336
336
  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 "";
337
337
  for (e ||= "utf8";;) switch (e) {
338
- case "hex": return ee(this, t, n);
338
+ case "hex": return z(this, t, n);
339
339
  case "utf8":
340
340
  case "utf-8": return P(this, t, n);
341
341
  case "ascii": return L(this, t, n);
@@ -345,7 +345,7 @@ ne.read = function(e, t, n, r, i) {
345
345
  case "ucs2":
346
346
  case "ucs-2":
347
347
  case "utf16le":
348
- case "utf-16le": return z(this, t, n);
348
+ case "utf-16le": return B(this, t, n);
349
349
  default:
350
350
  if (r) throw TypeError("Unknown encoding: " + e);
351
351
  e = (e + "").toLowerCase(), r = !0;
@@ -541,14 +541,14 @@ ne.read = function(e, t, n, r, i) {
541
541
  for (let i = t; i < n; ++i) r += String.fromCharCode(e[i]);
542
542
  return r;
543
543
  }
544
- function ee(e, t, n) {
544
+ function z(e, t, n) {
545
545
  let r = e.length;
546
546
  (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
547
547
  let i = "";
548
548
  for (let r = t; r < n; ++r) i += _e[e[r]];
549
549
  return i;
550
550
  }
551
- function z(e, t, n) {
551
+ function B(e, t, n) {
552
552
  let r = e.slice(t, n), i = "";
553
553
  for (let e = 0; e < r.length - 1; e += 2) i += String.fromCharCode(r[e] + r[e + 1] * 256);
554
554
  return i;
@@ -559,30 +559,30 @@ ne.read = function(e, t, n, r, i) {
559
559
  let r = this.subarray(e, t);
560
560
  return Object.setPrototypeOf(r, u.prototype), r;
561
561
  };
562
- function B(e, t, n) {
562
+ function V(e, t, n) {
563
563
  if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
564
564
  if (e + t > n) throw RangeError("Trying to access beyond buffer length");
565
565
  }
566
566
  u.prototype.readUintLE = u.prototype.readUIntLE = function(e, t, n) {
567
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
567
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
568
568
  let r = this[e], i = 1, a = 0;
569
569
  for (; ++a < t && (i *= 256);) r += this[e + a] * i;
570
570
  return r;
571
571
  }, u.prototype.readUintBE = u.prototype.readUIntBE = function(e, t, n) {
572
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
572
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
573
573
  let r = this[e + --t], i = 1;
574
574
  for (; t > 0 && (i *= 256);) r += this[e + --t] * i;
575
575
  return r;
576
576
  }, u.prototype.readUint8 = u.prototype.readUInt8 = function(e, t) {
577
- return e >>>= 0, t || B(e, 1, this.length), this[e];
577
+ return e >>>= 0, t || V(e, 1, this.length), this[e];
578
578
  }, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(e, t) {
579
- return e >>>= 0, t || B(e, 2, this.length), this[e] | this[e + 1] << 8;
579
+ return e >>>= 0, t || V(e, 2, this.length), this[e] | this[e + 1] << 8;
580
580
  }, u.prototype.readUint16BE = u.prototype.readUInt16BE = function(e, t) {
581
- return e >>>= 0, t || B(e, 2, this.length), this[e] << 8 | this[e + 1];
581
+ return e >>>= 0, t || V(e, 2, this.length), this[e] << 8 | this[e + 1];
582
582
  }, u.prototype.readUint32LE = u.prototype.readUInt32LE = function(e, t) {
583
- return e >>>= 0, t || B(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
583
+ return e >>>= 0, t || V(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
584
584
  }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
585
- return e >>>= 0, t || B(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
585
+ return e >>>= 0, t || V(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
586
586
  }, u.prototype.readBigUInt64LE = ve(function(e) {
587
587
  e >>>= 0, ce(e, "offset");
588
588
  let t = this[e], n = this[e + 7];
@@ -596,29 +596,29 @@ ne.read = function(e, t, n, r, i) {
596
596
  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;
597
597
  return (BigInt(r) << BigInt(32)) + BigInt(i);
598
598
  }), u.prototype.readIntLE = function(e, t, n) {
599
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
599
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
600
600
  let r = this[e], i = 1, a = 0;
601
601
  for (; ++a < t && (i *= 256);) r += this[e + a] * i;
602
602
  return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
603
603
  }, u.prototype.readIntBE = function(e, t, n) {
604
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
604
+ e >>>= 0, t >>>= 0, n || V(e, t, this.length);
605
605
  let r = t, i = 1, a = this[e + --r];
606
606
  for (; r > 0 && (i *= 256);) a += this[e + --r] * i;
607
607
  return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
608
608
  }, u.prototype.readInt8 = function(e, t) {
609
- return e >>>= 0, t || B(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
609
+ return e >>>= 0, t || V(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
610
610
  }, u.prototype.readInt16LE = function(e, t) {
611
- e >>>= 0, t || B(e, 2, this.length);
611
+ e >>>= 0, t || V(e, 2, this.length);
612
612
  let n = this[e] | this[e + 1] << 8;
613
613
  return n & 32768 ? n | 4294901760 : n;
614
614
  }, u.prototype.readInt16BE = function(e, t) {
615
- e >>>= 0, t || B(e, 2, this.length);
615
+ e >>>= 0, t || V(e, 2, this.length);
616
616
  let n = this[e + 1] | this[e] << 8;
617
617
  return n & 32768 ? n | 4294901760 : n;
618
618
  }, u.prototype.readInt32LE = function(e, t) {
619
- return e >>>= 0, t || B(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
619
+ return e >>>= 0, t || V(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
620
620
  }, u.prototype.readInt32BE = function(e, t) {
621
- return e >>>= 0, t || B(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
621
+ return e >>>= 0, t || V(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
622
622
  }, u.prototype.readBigInt64LE = ve(function(e) {
623
623
  e >>>= 0, ce(e, "offset");
624
624
  let t = this[e], n = this[e + 7];
@@ -632,15 +632,15 @@ ne.read = function(e, t, n, r, i) {
632
632
  let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
633
633
  return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
634
634
  }), u.prototype.readFloatLE = function(e, t) {
635
- return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !0, 23, 4);
635
+ return e >>>= 0, t || V(e, 4, this.length), n.read(this, e, !0, 23, 4);
636
636
  }, u.prototype.readFloatBE = function(e, t) {
637
- return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !1, 23, 4);
637
+ return e >>>= 0, t || V(e, 4, this.length), n.read(this, e, !1, 23, 4);
638
638
  }, u.prototype.readDoubleLE = function(e, t) {
639
- return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !0, 52, 8);
639
+ return e >>>= 0, t || V(e, 8, this.length), n.read(this, e, !0, 52, 8);
640
640
  }, u.prototype.readDoubleBE = function(e, t) {
641
- return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !1, 52, 8);
641
+ return e >>>= 0, t || V(e, 8, this.length), n.read(this, e, !1, 52, 8);
642
642
  };
643
- function V(e, t, n, r, i, a) {
643
+ function H(e, t, n, r, i, a) {
644
644
  if (!u.isBuffer(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
645
645
  if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
646
646
  if (n + r > e.length) throw RangeError("Index out of range");
@@ -648,7 +648,7 @@ ne.read = function(e, t, n, r, i) {
648
648
  u.prototype.writeUintLE = u.prototype.writeUIntLE = function(e, t, n, r) {
649
649
  if (e = +e, t >>>= 0, n >>>= 0, !r) {
650
650
  let r = 2 ** (8 * n) - 1;
651
- V(this, e, t, n, r, 0);
651
+ H(this, e, t, n, r, 0);
652
652
  }
653
653
  let i = 1, a = 0;
654
654
  for (this[t] = e & 255; ++a < n && (i *= 256);) this[t + a] = e / i & 255;
@@ -656,30 +656,30 @@ ne.read = function(e, t, n, r, i) {
656
656
  }, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(e, t, n, r) {
657
657
  if (e = +e, t >>>= 0, n >>>= 0, !r) {
658
658
  let r = 2 ** (8 * n) - 1;
659
- V(this, e, t, n, r, 0);
659
+ H(this, e, t, n, r, 0);
660
660
  }
661
661
  let i = n - 1, a = 1;
662
662
  for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) this[t + i] = e / a & 255;
663
663
  return t + n;
664
664
  }, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(e, t, n) {
665
- return e = +e, t >>>= 0, n || V(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
665
+ return e = +e, t >>>= 0, n || H(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
666
666
  }, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(e, t, n) {
667
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
667
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
668
668
  }, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(e, t, n) {
669
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
669
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
670
670
  }, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(e, t, n) {
671
- 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;
671
+ 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;
672
672
  }, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(e, t, n) {
673
- 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;
673
+ 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;
674
674
  };
675
- function te(e, t, n, r, i) {
675
+ function ee(e, t, n, r, i) {
676
676
  se(t, r, i, e, n, 7);
677
677
  let a = Number(t & BigInt(4294967295));
678
678
  e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
679
679
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
680
680
  return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
681
681
  }
682
- function re(e, t, n, r, i) {
682
+ function ne(e, t, n, r, i) {
683
683
  se(t, r, i, e, n, 7);
684
684
  let a = Number(t & BigInt(4294967295));
685
685
  e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
@@ -687,13 +687,13 @@ ne.read = function(e, t, n, r, i) {
687
687
  return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
688
688
  }
689
689
  u.prototype.writeBigUInt64LE = ve(function(e, t = 0) {
690
- return te(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
690
+ return ee(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
691
691
  }), u.prototype.writeBigUInt64BE = ve(function(e, t = 0) {
692
- return re(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
692
+ return ne(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
693
693
  }), u.prototype.writeIntLE = function(e, t, n, r) {
694
694
  if (e = +e, t >>>= 0, !r) {
695
695
  let r = 2 ** (8 * n - 1);
696
- V(this, e, t, n, r - 1, -r);
696
+ H(this, e, t, n, r - 1, -r);
697
697
  }
698
698
  let i = 0, a = 1, o = 0;
699
699
  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;
@@ -701,44 +701,44 @@ ne.read = function(e, t, n, r, i) {
701
701
  }, u.prototype.writeIntBE = function(e, t, n, r) {
702
702
  if (e = +e, t >>>= 0, !r) {
703
703
  let r = 2 ** (8 * n - 1);
704
- V(this, e, t, n, r - 1, -r);
704
+ H(this, e, t, n, r - 1, -r);
705
705
  }
706
706
  let i = n - 1, a = 1, o = 0;
707
707
  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;
708
708
  return t + n;
709
709
  }, u.prototype.writeInt8 = function(e, t, n) {
710
- 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;
710
+ 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;
711
711
  }, u.prototype.writeInt16LE = function(e, t, n) {
712
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
712
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
713
713
  }, u.prototype.writeInt16BE = function(e, t, n) {
714
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
714
+ return e = +e, t >>>= 0, n || H(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
715
715
  }, u.prototype.writeInt32LE = function(e, t, n) {
716
- 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;
716
+ 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;
717
717
  }, u.prototype.writeInt32BE = function(e, t, n) {
718
- 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;
718
+ 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;
719
719
  }, u.prototype.writeBigInt64LE = ve(function(e, t = 0) {
720
- return te(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
720
+ return ee(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
721
721
  }), u.prototype.writeBigInt64BE = ve(function(e, t = 0) {
722
- return re(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
722
+ return ne(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
723
723
  });
724
- function ie(e, t, n, r, i, a) {
724
+ function re(e, t, n, r, i, a) {
725
725
  if (n + r > e.length || n < 0) throw RangeError("Index out of range");
726
726
  }
727
- function H(e, t, r, i, a) {
728
- return t = +t, r >>>= 0, a || ie(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
727
+ function U(e, t, r, i, a) {
728
+ return t = +t, r >>>= 0, a || re(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
729
729
  }
730
730
  u.prototype.writeFloatLE = function(e, t, n) {
731
- return H(this, e, t, !0, n);
731
+ return U(this, e, t, !0, n);
732
732
  }, u.prototype.writeFloatBE = function(e, t, n) {
733
- return H(this, e, t, !1, n);
733
+ return U(this, e, t, !1, n);
734
734
  };
735
- function U(e, t, r, i, a) {
736
- return t = +t, r >>>= 0, a || ie(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
735
+ function W(e, t, r, i, a) {
736
+ return t = +t, r >>>= 0, a || re(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
737
737
  }
738
738
  u.prototype.writeDoubleLE = function(e, t, n) {
739
- return U(this, e, t, !0, n);
739
+ return W(this, e, t, !0, n);
740
740
  }, u.prototype.writeDoubleBE = function(e, t, n) {
741
- return U(this, e, t, !1, n);
741
+ return W(this, e, t, !1, n);
742
742
  }, u.prototype.copy = function(e, t, n, r) {
743
743
  if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
744
744
  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;
@@ -769,9 +769,9 @@ ne.read = function(e, t, n, r, i) {
769
769
  }
770
770
  return this;
771
771
  };
772
- let W = {};
773
- function G(e, t, n) {
774
- W[e] = class extends n {
772
+ let G = {};
773
+ function ie(e, t, n) {
774
+ G[e] = class extends n {
775
775
  constructor() {
776
776
  super(), Object.defineProperty(this, "message", {
777
777
  value: t.apply(this, arguments),
@@ -795,11 +795,11 @@ ne.read = function(e, t, n, r, i) {
795
795
  }
796
796
  };
797
797
  }
798
- G("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
798
+ ie("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
799
799
  return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
800
- }, RangeError), G("ERR_INVALID_ARG_TYPE", function(e, t) {
800
+ }, RangeError), ie("ERR_INVALID_ARG_TYPE", function(e, t) {
801
801
  return `The "${e}" argument must be of type number. Received type ${typeof t}`;
802
- }, TypeError), G("ERR_OUT_OF_RANGE", function(e, t, n) {
802
+ }, TypeError), ie("ERR_OUT_OF_RANGE", function(e, t, n) {
803
803
  let r = `The value of "${e}" is out of range.`, i = n;
804
804
  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
805
  }, RangeError);
@@ -814,15 +814,15 @@ ne.read = function(e, t, n, r, i) {
814
814
  function se(e, t, n, r, i, a) {
815
815
  if (e > n || e < t) {
816
816
  let r = typeof t == "bigint" ? "n" : "", i;
817
- 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);
817
+ 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);
818
818
  }
819
819
  oe(r, i, a);
820
820
  }
821
821
  function ce(e, t) {
822
- if (typeof e != "number") throw new W.ERR_INVALID_ARG_TYPE(t, "number", e);
822
+ if (typeof e != "number") throw new G.ERR_INVALID_ARG_TYPE(t, "number", e);
823
823
  }
824
824
  function le(e, t, n) {
825
- 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
+ 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) : (ce(e, n), new G.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
826
826
  }
827
827
  let ue = /[^+/0-9A-Za-z-_]/g;
828
828
  function de(e) {
@@ -907,20 +907,20 @@ ne.read = function(e, t, n, r, i) {
907
907
  throw Error("BigInt not supported");
908
908
  }
909
909
  })(k), k.Buffer, k.Blob, k.BlobOptions;
910
- var re = k.Buffer;
910
+ var ne = k.Buffer;
911
911
  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;
912
912
  //#endregion
913
913
  //#region src/mapIO.ts
914
- function ie(e) {
915
- return o(re.from(e));
914
+ function re(e) {
915
+ return o(ne.from(e));
916
916
  }
917
- function H(e) {
917
+ function U(e) {
918
918
  return new Uint8Array(c(e));
919
919
  }
920
- function U(e) {
920
+ function W(e) {
921
921
  return s(e);
922
922
  }
923
- function W() {
923
+ function G() {
924
924
  return {
925
925
  version: 20,
926
926
  rooms: {},
@@ -970,7 +970,7 @@ function W() {
970
970
  }
971
971
  //#endregion
972
972
  //#region src/editor/loadFile.ts
973
- async function G(e, t) {
973
+ async function ie(e, t) {
974
974
  try {
975
975
  D.setState({ status: "Fetching…" });
976
976
  let n = await fetch(e);
@@ -988,7 +988,7 @@ async function G(e, t) {
988
988
  }
989
989
  let s = new Uint8Array(o), c = 0;
990
990
  for (let e of a) s.set(e, c), c += e.length;
991
- 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;
991
+ 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;
992
992
  D.setState({
993
993
  map: u,
994
994
  loaded: { fileName: l },
@@ -1010,7 +1010,7 @@ async function G(e, t) {
1010
1010
  async function ae(e) {
1011
1011
  try {
1012
1012
  D.setState({ status: `Reading ${e.name}…` });
1013
- let t = ie(await e.arrayBuffer()), n = Number(Object.keys(t.areaNames)[0] ?? -1), r = Number.isNaN(n) ? null : n;
1013
+ let t = re(await e.arrayBuffer()), n = Number(Object.keys(t.areaNames)[0] ?? -1), r = Number.isNaN(n) ? null : n;
1014
1014
  D.setState({
1015
1015
  map: t,
1016
1016
  loaded: { fileName: e.name },
@@ -1136,7 +1136,7 @@ var se = [
1136
1136
  {
1137
1137
  id: "select",
1138
1138
  label: "Select",
1139
- hint: "Click a room to select. Drag to move (snaps to grid). Arrow keys nudge.",
1139
+ hint: "Click to select · Shift+click/drag to add · Ctrl+click/drag to toggle · drag to move (snaps to grid) · arrow keys nudge · MMB or Space to pan.",
1140
1140
  key: "1"
1141
1141
  },
1142
1142
  {
@@ -1198,6 +1198,10 @@ var se = [
1198
1198
  keys: ["F"],
1199
1199
  desc: "Fit area to view"
1200
1200
  },
1201
+ {
1202
+ keys: [`${g}+F`],
1203
+ desc: "Open / close search (rooms, labels)"
1204
+ },
1201
1205
  {
1202
1206
  keys: [`${g}+A`],
1203
1207
  desc: "Select all rooms on current level"
@@ -1290,20 +1294,20 @@ function le({ onClose: e }) {
1290
1294
  }
1291
1295
  //#endregion
1292
1296
  //#region src/components/Toolbar.tsx
1293
- function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a, onSave: o }) {
1294
- let s = O((e) => e.activeTool), c = O((e) => e.map), l = c != null, p = O((e) => e.loaded), m = O((e) => e.currentAreaId), h = O((e) => e.currentZ), _ = O((e) => e.snapToGrid), v = O((e) => e.status), y = O((e) => e.pending), b = O((e) => e.undo.length), x = O((e) => e.redo.length), C = O((e) => e.savedUndoLength), w = O((e) => e.swatchPaletteOpen), T = O((e) => e.activeSwatchId), E = O((e) => e.activeSwatchSetId), k = O((e) => e.swatchSets), A = O((e) => e.pluginSwatchSets), j = [...k, ...A].find((e) => e.id === E)?.swatches.find((e) => e.id === T) ?? null, M = b !== C, N = O((e) => e.structureVersion), P = n(() => c ? Object.entries(c.areaNames).map(([e, t]) => ({
1297
+ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a, onSave: o, onSearchClick: s }) {
1298
+ 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]) => ({
1295
1299
  id: Number(e),
1296
1300
  name: t
1297
- })).sort((e, t) => e.name.localeCompare(t.name)) : [], [c, N]), F = n(() => {
1298
- if (!c || m == null) return [0];
1299
- let e = c.areas[m];
1301
+ })).sort((e, t) => e.name.localeCompare(t.name)) : [], [l, P]), I = n(() => {
1302
+ if (!l || h == null) return [0];
1303
+ let e = l.areas[h];
1300
1304
  return e?.zLevels?.length ? [...e.zLevels].sort((e, t) => e - t) : [0];
1301
1305
  }, [
1302
- c,
1303
- m,
1304
- N
1305
- ]), I = r(null), [L, R] = i(""), ee = () => {
1306
- let e = parseInt(L, 10);
1306
+ l,
1307
+ h,
1308
+ P
1309
+ ]), L = r(null), [R, z] = i(""), B = () => {
1310
+ let e = parseInt(R, 10);
1307
1311
  if (Number.isNaN(e)) return;
1308
1312
  let t = D.getState();
1309
1313
  if (!t.map) return;
@@ -1324,9 +1328,9 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1324
1328
  ids: [e]
1325
1329
  },
1326
1330
  pending: null
1327
- }), D.bumpStructure(), R("");
1328
- }, z = () => {
1329
- let e = W();
1331
+ }), D.bumpStructure(), z("");
1332
+ }, V = () => {
1333
+ let e = G();
1330
1334
  D.setState({
1331
1335
  map: e,
1332
1336
  loaded: { fileName: "new-map.dat" },
@@ -1341,7 +1345,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1341
1345
  status: "New map created · 0 rooms · 1 area",
1342
1346
  sessionId: null
1343
1347
  }), D.bumpStructure();
1344
- }, B = ae;
1348
+ }, H = ae;
1345
1349
  return /* @__PURE__ */ f("div", {
1346
1350
  className: "toolbar",
1347
1351
  children: [/* @__PURE__ */ f("div", {
@@ -1356,7 +1360,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1356
1360
  /* @__PURE__ */ d("button", {
1357
1361
  type: "button",
1358
1362
  title: "New Map",
1359
- onClick: z,
1363
+ onClick: V,
1360
1364
  children: /* @__PURE__ */ f("svg", {
1361
1365
  width: "16",
1362
1366
  height: "16",
@@ -1418,13 +1422,13 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1418
1422
  })
1419
1423
  ]
1420
1424
  }), /* @__PURE__ */ d("input", {
1421
- ref: I,
1425
+ ref: L,
1422
1426
  type: "file",
1423
1427
  accept: ".dat",
1424
1428
  style: { display: "none" },
1425
1429
  onChange: (e) => {
1426
1430
  let t = e.target.files?.[0];
1427
- t && B(t), e.target.value = "";
1431
+ t && H(t), e.target.value = "";
1428
1432
  }
1429
1433
  })]
1430
1434
  }),
@@ -1479,7 +1483,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1479
1483
  onClick: () => {
1480
1484
  let e = D.getState();
1481
1485
  if (!(!e.map || !e.loaded)) try {
1482
- 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");
1486
+ 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");
1483
1487
  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) => ({
1484
1488
  savedUndoLength: e.undo.length,
1485
1489
  status: `Saved ${a.download}`
@@ -1488,10 +1492,10 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1488
1492
  D.setState({ status: `Save failed: ${e.message}` }), console.error(e);
1489
1493
  }
1490
1494
  },
1491
- disabled: !l,
1495
+ disabled: !p,
1492
1496
  style: {
1493
1497
  position: "relative",
1494
- ...M ? { color: "#ffd080" } : {}
1498
+ ...N ? { color: "#ffd080" } : {}
1495
1499
  },
1496
1500
  children: [/* @__PURE__ */ f("svg", {
1497
1501
  width: "16",
@@ -1526,7 +1530,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1526
1530
  fill: "none"
1527
1531
  })
1528
1532
  ]
1529
- }), M && /* @__PURE__ */ d("span", {
1533
+ }), N && /* @__PURE__ */ d("span", {
1530
1534
  style: {
1531
1535
  position: "absolute",
1532
1536
  top: 6,
@@ -1538,12 +1542,12 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1538
1542
  children: "*"
1539
1543
  })]
1540
1544
  }),
1541
- l && /* @__PURE__ */ f(u, { children: [
1545
+ p && /* @__PURE__ */ f(u, { children: [
1542
1546
  /* @__PURE__ */ d("div", { className: "toolbar-sep" }),
1543
1547
  /* @__PURE__ */ d(oe, {
1544
1548
  label: "Area",
1545
- value: m,
1546
- options: P.map((e) => ({
1549
+ value: h,
1550
+ options: F.map((e) => ({
1547
1551
  value: e.id,
1548
1552
  label: `${e.name} (#${e.id})`
1549
1553
  })),
@@ -1560,8 +1564,8 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1560
1564
  }),
1561
1565
  /* @__PURE__ */ d(oe, {
1562
1566
  label: "Level",
1563
- value: h,
1564
- options: F.map((e) => ({
1567
+ value: _,
1568
+ options: I.map((e) => ({
1565
1569
  value: e,
1566
1570
  label: String(e)
1567
1571
  })),
@@ -1589,17 +1593,17 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1589
1593
  type: "number",
1590
1594
  min: 1,
1591
1595
  placeholder: "ID",
1592
- value: L,
1593
- onChange: (e) => R(e.target.value),
1596
+ value: R,
1597
+ onChange: (e) => z(e.target.value),
1594
1598
  onKeyDown: (e) => {
1595
- e.key === "Enter" && ee();
1599
+ e.key === "Enter" && B();
1596
1600
  }
1597
1601
  }),
1598
1602
  /* @__PURE__ */ d("button", {
1599
1603
  type: "button",
1600
1604
  className: "toolbar-goto-btn",
1601
- onClick: ee,
1602
- disabled: L === "",
1605
+ onClick: B,
1606
+ disabled: R === "",
1603
1607
  children: "Go"
1604
1608
  })
1605
1609
  ]
@@ -1613,20 +1617,46 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1613
1617
  className: "tool-key",
1614
1618
  children: "F"
1615
1619
  }), /* @__PURE__ */ d("span", { children: "Fit" })]
1620
+ }),
1621
+ /* @__PURE__ */ f("button", {
1622
+ type: "button",
1623
+ className: "tool-btn",
1624
+ title: "Search rooms and labels (Ctrl+F)",
1625
+ onClick: s,
1626
+ children: [/* @__PURE__ */ f("svg", {
1627
+ width: "13",
1628
+ height: "13",
1629
+ viewBox: "0 0 16 16",
1630
+ fill: "none",
1631
+ "aria-hidden": "true",
1632
+ style: { flexShrink: 0 },
1633
+ children: [/* @__PURE__ */ d("circle", {
1634
+ cx: "6.5",
1635
+ cy: "6.5",
1636
+ r: "4.5",
1637
+ stroke: "currentColor",
1638
+ strokeWidth: "1.4"
1639
+ }), /* @__PURE__ */ d("path", {
1640
+ d: "M10.5 10.5L14 14",
1641
+ stroke: "currentColor",
1642
+ strokeWidth: "1.4",
1643
+ strokeLinecap: "round"
1644
+ })]
1645
+ }), /* @__PURE__ */ d("span", { children: "Search" })]
1616
1646
  })
1617
1647
  ] }),
1618
1648
  /* @__PURE__ */ f("span", {
1619
1649
  className: "status",
1620
- children: [p && /* @__PURE__ */ f("span", {
1650
+ children: [m && /* @__PURE__ */ f("span", {
1621
1651
  className: "status-file",
1622
1652
  children: [
1623
1653
  "[",
1624
- p.fileName,
1654
+ m.fileName,
1625
1655
  "]"
1626
1656
  ]
1627
1657
  }), /* @__PURE__ */ d("span", {
1628
1658
  className: "status-action",
1629
- children: v
1659
+ children: y
1630
1660
  })]
1631
1661
  }),
1632
1662
  /* @__PURE__ */ d("button", {
@@ -1637,14 +1667,14 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1637
1667
  children: "?"
1638
1668
  })
1639
1669
  ]
1640
- }), l && /* @__PURE__ */ f("div", {
1670
+ }), p && /* @__PURE__ */ f("div", {
1641
1671
  className: "toolbar-row toolbar-row-tools",
1642
1672
  children: [
1643
1673
  /* @__PURE__ */ d("div", {
1644
1674
  className: "tool-group",
1645
1675
  children: se.map((e) => /* @__PURE__ */ f("button", {
1646
1676
  type: "button",
1647
- className: `tool-btn${s === e.id ? " active" : ""}`,
1677
+ className: `tool-btn${c === e.id ? " active" : ""}`,
1648
1678
  title: `${e.label} (${e.key}) — ${e.hint}`,
1649
1679
  onClick: () => {
1650
1680
  D.setState({
@@ -1662,24 +1692,24 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1662
1692
  /* @__PURE__ */ d("button", {
1663
1693
  type: "button",
1664
1694
  title: "Undo (Ctrl+Z)",
1665
- disabled: b === 0,
1695
+ disabled: x === 0,
1666
1696
  onClick: () => window.dispatchEvent(new CustomEvent("editor:undo")),
1667
1697
  children: "↶ Undo"
1668
1698
  }),
1669
1699
  /* @__PURE__ */ d("button", {
1670
1700
  type: "button",
1671
1701
  title: "Redo (Ctrl+Shift+Z)",
1672
- disabled: x === 0,
1702
+ disabled: C === 0,
1673
1703
  onClick: () => window.dispatchEvent(new CustomEvent("editor:redo")),
1674
1704
  children: "↷ Redo"
1675
1705
  }),
1676
1706
  /* @__PURE__ */ d("div", { className: "toolbar-sep" }),
1677
1707
  /* @__PURE__ */ f("button", {
1678
1708
  type: "button",
1679
- className: `tool-btn toolbar-snap-btn${_ ? " active" : ""}`,
1709
+ className: `tool-btn toolbar-snap-btn${v ? " active" : ""}`,
1680
1710
  title: "Snap to grid (G)",
1681
1711
  onClick: () => {
1682
- S({ snapToGrid: !_ }), D.setState({ snapToGrid: !_ });
1712
+ S({ snapToGrid: !v }), D.setState({ snapToGrid: !v });
1683
1713
  },
1684
1714
  children: [/* @__PURE__ */ d("span", {
1685
1715
  className: "tool-key",
@@ -1688,54 +1718,54 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1688
1718
  }),
1689
1719
  /* @__PURE__ */ d("button", {
1690
1720
  type: "button",
1691
- className: `tool-btn${w ? " active" : ""}`,
1721
+ className: `tool-btn${T ? " active" : ""}`,
1692
1722
  title: "Room swatches palette",
1693
- onClick: () => D.setState({ swatchPaletteOpen: !w }),
1694
- children: j ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
1723
+ onClick: () => D.setState({ swatchPaletteOpen: !T }),
1724
+ children: M ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
1695
1725
  className: "tool-key",
1696
1726
  children: "8↴"
1697
- }), /* @__PURE__ */ d("span", { children: j.name })] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
1727
+ }), /* @__PURE__ */ d("span", { children: M.name })] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
1698
1728
  className: "tool-key",
1699
1729
  children: "8↴"
1700
1730
  }), /* @__PURE__ */ d("span", { children: "Swatches" })] })
1701
1731
  }),
1702
- !y && s === "paint" && /* @__PURE__ */ d("span", {
1732
+ !b && c === "paint" && /* @__PURE__ */ d("span", {
1703
1733
  className: "toolbar-pending-hint",
1704
- children: j ? `Painting "${j.name}" (env ${j.environment}${j.symbol ? `, symbol "${j.symbol}"` : ""}) · click or drag rooms` : "No swatch selected — open Swatches palette and pick one"
1734
+ children: M ? `Painting "${M.name}" (env ${M.environment}${M.symbol ? `, symbol "${M.symbol}"` : ""}) · click or drag rooms` : "No swatch selected — open Swatches palette and pick one"
1705
1735
  }),
1706
- y?.kind === "marquee" && /* @__PURE__ */ d("span", {
1736
+ b?.kind === "marquee" && /* @__PURE__ */ d("span", {
1707
1737
  className: "toolbar-pending-hint",
1708
1738
  children: "Hold Ctrl to toggle selection"
1709
1739
  }),
1710
- y?.kind === "connect" && /* @__PURE__ */ d("span", {
1740
+ b?.kind === "connect" && /* @__PURE__ */ d("span", {
1711
1741
  className: "toolbar-pending-hint",
1712
1742
  children: "Pick target · Shift = one-way · Esc cancels"
1713
1743
  }),
1714
- y?.kind === "customLine" && /* @__PURE__ */ d("span", {
1744
+ b?.kind === "customLine" && /* @__PURE__ */ d("span", {
1715
1745
  className: "toolbar-pending-hint",
1716
1746
  children: "Click to add waypoints · right-click or Enter to finish · Esc cancels"
1717
1747
  }),
1718
- !y && s === "select" && /* @__PURE__ */ d("span", {
1748
+ !b && c === "select" && /* @__PURE__ */ d("span", {
1719
1749
  className: "toolbar-pending-hint",
1720
- children: "Hold Space to pan"
1750
+ children: "Click to select · Shift+click/drag to add · Ctrl+click/drag to toggle · drag selected rooms to move · MMB or Space to pan"
1721
1751
  }),
1722
- !y && s === "unlink" && /* @__PURE__ */ d("span", {
1752
+ !b && c === "unlink" && /* @__PURE__ */ d("span", {
1723
1753
  className: "toolbar-pending-hint",
1724
1754
  children: "Click a room to remove all its exits · click an exit or custom line to remove just that one"
1725
1755
  }),
1726
- !y && s === "addRoom" && /* @__PURE__ */ d("span", {
1756
+ !b && c === "addRoom" && /* @__PURE__ */ d("span", {
1727
1757
  className: "toolbar-pending-hint",
1728
1758
  children: `Click an empty grid cell to place a room · ${g}+click to place without selecting`
1729
1759
  }),
1730
- !y && s === "addLabel" && /* @__PURE__ */ d("span", {
1760
+ !b && c === "addLabel" && /* @__PURE__ */ d("span", {
1731
1761
  className: "toolbar-pending-hint",
1732
1762
  children: "Click to place a label · select to move/edit · Delete to remove"
1733
1763
  }),
1734
- y?.kind === "paint" && /* @__PURE__ */ d("span", {
1764
+ b?.kind === "paint" && /* @__PURE__ */ d("span", {
1735
1765
  className: "toolbar-pending-hint",
1736
1766
  children: "Drag to paint multiple rooms · release to commit"
1737
1767
  }),
1738
- y?.kind === "pickSwatch" && /* @__PURE__ */ d("span", {
1768
+ b?.kind === "pickSwatch" && /* @__PURE__ */ d("span", {
1739
1769
  className: "toolbar-pending-hint",
1740
1770
  style: { color: "#ffd080" },
1741
1771
  children: "Click a room to copy its symbol & environment · Esc to cancel"
@@ -1748,7 +1778,7 @@ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1748
1778
  //#region src/components/UrlLoadModal.tsx
1749
1779
  function de({ onClose: e, initialUrl: n }) {
1750
1780
  let [r, a] = i(n ?? ""), [o, s] = i(!1), [c, l] = i(null), u = async (t = r.trim()) => {
1751
- t && (a(t), s(!0), l(0), await G(t, l), s(!1), l(null), D.getState().map && e());
1781
+ t && (a(t), s(!0), l(0), await ie(t, l), s(!1), l(null), D.getState().map && e());
1752
1782
  };
1753
1783
  return t(() => {
1754
1784
  n && u(n);
@@ -2836,7 +2866,7 @@ function Ne({ id: e, name: t, className: n }) {
2836
2866
  children: [
2837
2867
  "#",
2838
2868
  e,
2839
- t ? ` · ${t}` : ""
2869
+ t && String(e) !== t ? ` · ${t}` : ""
2840
2870
  ]
2841
2871
  });
2842
2872
  }
@@ -3466,12 +3496,18 @@ function Ge({ sceneRef: e }) {
3466
3496
  e.structural && (i = !0);
3467
3497
  }
3468
3498
  r?.refresh(), i ? D.bumpStructure() : D.bumpData(), D.setState({ status: t > 0 ? `Undone ${t}×` : `Redone ${n}×` });
3469
- }, i = [...t].reverse(), a = [...n].reverse();
3499
+ }, i = [...t].reverse();
3470
3500
  return /* @__PURE__ */ d("div", {
3471
3501
  className: "panel-content",
3472
3502
  children: /* @__PURE__ */ f("div", {
3473
3503
  className: "history-list",
3474
3504
  children: [
3505
+ n.map((e, t) => /* @__PURE__ */ d(We, {
3506
+ cmd: e,
3507
+ className: "history-item history-undone",
3508
+ onClick: () => r(0, n.length - t),
3509
+ title: `Redo ${n.length - t} step${n.length - t === 1 ? "" : "s"}`
3510
+ }, t)),
3475
3511
  /* @__PURE__ */ f("div", {
3476
3512
  className: "history-item history-current",
3477
3513
  children: [/* @__PURE__ */ d("span", {
@@ -3492,16 +3528,7 @@ function Ge({ sceneRef: e }) {
3492
3528
  className: "hint",
3493
3529
  style: { marginTop: 8 },
3494
3530
  children: "No history yet."
3495
- }),
3496
- n.length > 0 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
3497
- className: "history-sep",
3498
- children: "— undone —"
3499
- }), a.map((e, t) => /* @__PURE__ */ d(We, {
3500
- cmd: e,
3501
- className: "history-item history-undone",
3502
- onClick: () => r(0, t + 1),
3503
- title: `Redo ${t + 1} step${t === 0 ? "" : "s"}`
3504
- }, t))] })
3531
+ })
3505
3532
  ]
3506
3533
  })
3507
3534
  });
@@ -4315,6 +4342,13 @@ var gt = .15, _t = {
4315
4342
  if (a) {
4316
4343
  let i = n.map?.rooms[a.id];
4317
4344
  if (!i) return !0;
4345
+ if (e.shiftKey) {
4346
+ let e = n.selection?.kind === "room" ? n.selection.ids : [];
4347
+ return e.includes(a.id) || D.setState({ selection: {
4348
+ kind: "room",
4349
+ ids: [...e, a.id]
4350
+ } }), !0;
4351
+ }
4318
4352
  if (e.ctrlKey || e.metaKey) {
4319
4353
  let e = n.selection?.kind === "room" ? n.selection.ids : [], t = e.indexOf(a.id) >= 0 ? e.filter((e) => e !== a.id) : [...e, a.id];
4320
4354
  return D.setState({ selection: t.length === 0 ? null : {
@@ -4390,6 +4424,7 @@ var gt = .15, _t = {
4390
4424
  currentX: o.x,
4391
4425
  currentY: o.y,
4392
4426
  ctrlHeld: e.ctrlKey || e.metaKey,
4427
+ shiftHeld: e.shiftKey,
4393
4428
  preExistingIds: n.selection?.kind === "room" ? n.selection.ids : []
4394
4429
  } }), t.container.setPointerCapture(e.pointerId), !0;
4395
4430
  },
@@ -4409,6 +4444,10 @@ var gt = .15, _t = {
4409
4444
  let e = new Set(i.preExistingIds);
4410
4445
  for (let t of a) e.has(t) ? e.delete(t) : e.add(t);
4411
4446
  o = [...e];
4447
+ } else if (i.shiftHeld) {
4448
+ let e = new Set(i.preExistingIds);
4449
+ for (let t of a) e.add(t);
4450
+ o = [...e];
4412
4451
  } else o = a;
4413
4452
  return D.setState({
4414
4453
  pending: i,
@@ -4498,7 +4537,7 @@ var gt = .15, _t = {
4498
4537
  t.container.releasePointerCapture(e.pointerId);
4499
4538
  } catch {}
4500
4539
  let r = n.pending, i = Math.abs(r.currentX - r.startX), a = Math.abs(r.currentY - r.startY);
4501
- return i <= gt && a <= gt && !r.ctrlHeld && D.setState({ selection: null }), D.setState({ pending: null }), !0;
4540
+ return i <= gt && a <= gt && !r.ctrlHeld && !r.shiftHeld && D.setState({ selection: null }), D.setState({ pending: null }), !0;
4502
4541
  }
4503
4542
  if (n.pending?.kind === "labelDrag" && n.map) {
4504
4543
  let e = n.pending, r = t.scene.reader.getLabelSnapshot(e.areaId, e.labelId);
@@ -5929,7 +5968,7 @@ function Gt(e) {
5929
5968
  }
5930
5969
  function Kt(e) {
5931
5970
  let t = e.includes(",") ? e.split(",")[1] : e;
5932
- return t ? re.from(t, "base64") : re.alloc(0);
5971
+ return t ? ne.from(t, "base64") : ne.alloc(0);
5933
5972
  }
5934
5973
  //#endregion
5935
5974
  //#region src/components/FontPicker.tsx
@@ -6160,7 +6199,7 @@ function Qt({ selection: e, sceneRef: n }) {
6160
6199
  from: i.noScaling,
6161
6200
  to: t
6162
6201
  }, r), r.refresh(), D.bumpData());
6163
- }, ee = (t) => {
6202
+ }, z = (t) => {
6164
6203
  let r = n.current;
6165
6204
  if (!r) return;
6166
6205
  let i = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6171,7 +6210,7 @@ function Qt({ selection: e, sceneRef: n }) {
6171
6210
  from: i.showOnTop,
6172
6211
  to: t
6173
6212
  }, r), r.refresh(), D.bumpData());
6174
- }, z = (t) => {
6213
+ }, B = (t) => {
6175
6214
  let r = n.current;
6176
6215
  if (!r) return;
6177
6216
  let i = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6190,9 +6229,9 @@ function Qt({ selection: e, sceneRef: n }) {
6190
6229
  ...i,
6191
6230
  font: a
6192
6231
  })], r), r.refresh(), D.bumpData();
6193
- }, B = () => {
6232
+ }, V = () => {
6194
6233
  M.current ||= { color: s.outlineColor };
6195
- }, V = (t) => {
6234
+ }, H = (t) => {
6196
6235
  let r = n.current, i = M.current ?? { color: s.outlineColor };
6197
6236
  if (M.current = null, !r || Xt(i.color, t)) return;
6198
6237
  let a = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6208,7 +6247,7 @@ function Qt({ selection: e, sceneRef: n }) {
6208
6247
  from: i.color,
6209
6248
  to: t
6210
6249
  }, ...N(o)], r), r.refresh(), D.bumpData();
6211
- }, te = () => {
6250
+ }, ee = () => {
6212
6251
  let t = n.current;
6213
6252
  if (!t) return;
6214
6253
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6227,8 +6266,8 @@ function Qt({ selection: e, sceneRef: n }) {
6227
6266
  `"${u.family}", sans-serif`
6228
6267
  ].filter(Boolean).join(" "), Math.max(...l.map((e) => i.measureText(e).width)) <= s ? (m = e, f = e + 1) : p = e - 1;
6229
6268
  }
6230
- m !== r.font.size && z({ size: m });
6231
- }, ne = () => {
6269
+ m !== r.font.size && B({ size: m });
6270
+ }, te = () => {
6232
6271
  let t = n.current;
6233
6272
  if (!t) return;
6234
6273
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6241,7 +6280,7 @@ function Qt({ selection: e, sceneRef: n }) {
6241
6280
  from: r.pixMap,
6242
6281
  to: i
6243
6282
  }, t), t.refresh(), D.bumpData());
6244
- }, re = () => {
6283
+ }, ne = () => {
6245
6284
  let t = document.createElement("input");
6246
6285
  t.type = "file", t.accept = "image/*", t.onchange = () => {
6247
6286
  let r = t.files?.[0];
@@ -6281,7 +6320,7 @@ function Qt({ selection: e, sceneRef: n }) {
6281
6320
  }, r.src = t;
6282
6321
  }, i.readAsDataURL(r);
6283
6322
  }, t.click();
6284
- }, ie = () => {
6323
+ }, re = () => {
6285
6324
  let t = n.current;
6286
6325
  if (!t) return;
6287
6326
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6300,14 +6339,14 @@ function Qt({ selection: e, sceneRef: n }) {
6300
6339
  from: r.pixMap,
6301
6340
  to: i
6302
6341
  }], t), t.refresh(), D.setState({ labelAspectRatioLocked: !1 }), D.bumpData();
6303
- }, H = !!s.imageSrc, U = Le(s.fgColor), W = Le(s.bgColor), G = s.outlineColor ?? {
6342
+ }, U = !!s.imageSrc, W = Le(s.fgColor), G = Le(s.bgColor), ie = s.outlineColor ?? {
6304
6343
  spec: 1,
6305
6344
  r: 0,
6306
6345
  g: 0,
6307
6346
  b: 0,
6308
6347
  alpha: 0,
6309
6348
  pad: 0
6310
- }, ae = Le(G), oe = (e) => ({
6349
+ }, ae = Le(ie), oe = (e) => ({
6311
6350
  flex: 1,
6312
6351
  padding: "4px 0",
6313
6352
  fontSize: 12,
@@ -6342,18 +6381,18 @@ function Qt({ selection: e, sceneRef: n }) {
6342
6381
  overflow: "hidden"
6343
6382
  },
6344
6383
  children: [/* @__PURE__ */ d("button", {
6345
- style: oe(!H),
6384
+ style: oe(!U),
6346
6385
  onClick: () => {
6347
- H && ie();
6386
+ U && re();
6348
6387
  },
6349
6388
  children: "Text"
6350
6389
  }), /* @__PURE__ */ d("button", {
6351
6390
  style: {
6352
- ...oe(H),
6391
+ ...oe(U),
6353
6392
  borderLeft: "1px solid var(--border, #444)"
6354
6393
  },
6355
6394
  onClick: () => {
6356
- H || re();
6395
+ U || ne();
6357
6396
  },
6358
6397
  children: "Image"
6359
6398
  })]
@@ -6410,7 +6449,7 @@ function Qt({ selection: e, sceneRef: n }) {
6410
6449
  }),
6411
6450
  /* @__PURE__ */ d(Pe, {
6412
6451
  checked: s.showOnTop,
6413
- onChange: ee,
6452
+ onChange: z,
6414
6453
  description: "Show on top (foreground)"
6415
6454
  }),
6416
6455
  /* @__PURE__ */ d(Pe, {
@@ -6418,7 +6457,7 @@ function Qt({ selection: e, sceneRef: n }) {
6418
6457
  onChange: (e) => R(!e),
6419
6458
  description: "Scale with zoom"
6420
6459
  }),
6421
- H && /* @__PURE__ */ d(X, {
6460
+ U && /* @__PURE__ */ d(X, {
6422
6461
  label: "Image",
6423
6462
  children: /* @__PURE__ */ f("div", {
6424
6463
  style: {
@@ -6436,13 +6475,13 @@ function Qt({ selection: e, sceneRef: n }) {
6436
6475
  borderRadius: 3
6437
6476
  }
6438
6477
  }), /* @__PURE__ */ d("button", {
6439
- onClick: re,
6478
+ onClick: ne,
6440
6479
  style: { alignSelf: "flex-start" },
6441
6480
  children: "Replace image..."
6442
6481
  })]
6443
6482
  })
6444
6483
  }),
6445
- !H && /* @__PURE__ */ f(u, { children: [
6484
+ !U && /* @__PURE__ */ f(u, { children: [
6446
6485
  /* @__PURE__ */ d(X, {
6447
6486
  label: "Text",
6448
6487
  children: /* @__PURE__ */ d("textarea", {
@@ -6468,22 +6507,22 @@ function Qt({ selection: e, sceneRef: n }) {
6468
6507
  as: "div",
6469
6508
  children: /* @__PURE__ */ d("input", {
6470
6509
  type: "color",
6471
- defaultValue: U,
6510
+ defaultValue: W,
6472
6511
  onMouseDown: I,
6473
6512
  onBlur: (e) => L(Re(e.target.value), s.bgColor)
6474
- }, `fg-${e.id}-${U}`)
6513
+ }, `fg-${e.id}-${W}`)
6475
6514
  }), /* @__PURE__ */ d(X, {
6476
6515
  label: "BG color",
6477
6516
  as: "div",
6478
6517
  children: /* @__PURE__ */ d("input", {
6479
6518
  type: "color",
6480
- defaultValue: W,
6519
+ defaultValue: G,
6481
6520
  onMouseDown: I,
6482
6521
  onBlur: (e) => L(s.fgColor, {
6483
6522
  ...Re(e.target.value),
6484
6523
  alpha: s.bgColor.alpha
6485
6524
  })
6486
- }, `bg-${e.id}-${W}`)
6525
+ }, `bg-${e.id}-${G}`)
6487
6526
  })]
6488
6527
  }),
6489
6528
  /* @__PURE__ */ d(X, {
@@ -6529,7 +6568,7 @@ function Qt({ selection: e, sceneRef: n }) {
6529
6568
  children: /* @__PURE__ */ d(qt, {
6530
6569
  value: s.font.family,
6531
6570
  options: x,
6532
- onChange: (e) => z({ family: e })
6571
+ onChange: (e) => B({ family: e })
6533
6572
  })
6534
6573
  }),
6535
6574
  /* @__PURE__ */ d(X, {
@@ -6548,14 +6587,14 @@ function Qt({ selection: e, sceneRef: n }) {
6548
6587
  defaultValue: s.font.size,
6549
6588
  onBlur: (e) => {
6550
6589
  let t = parseInt(e.target.value, 10);
6551
- t > 0 && z({ size: t });
6590
+ t > 0 && B({ size: t });
6552
6591
  },
6553
6592
  onKeyDown: (e) => e.key === "Enter" && e.target.blur(),
6554
6593
  style: { width: 60 }
6555
6594
  }, `font-size-${e.id}-${s.font.size}`),
6556
6595
  /* @__PURE__ */ d("button", {
6557
6596
  title: "Auto-fit font size to fill label area",
6558
- onClick: te,
6597
+ onClick: ee,
6559
6598
  style: {
6560
6599
  height: 24,
6561
6600
  padding: "0 6px",
@@ -6596,7 +6635,7 @@ function Qt({ selection: e, sceneRef: n }) {
6596
6635
  ]
6597
6636
  ].map(([e, t, n]) => /* @__PURE__ */ d("button", {
6598
6637
  title: t,
6599
- onClick: () => z({ [t]: !s.font[t] }),
6638
+ onClick: () => B({ [t]: !s.font[t] }),
6600
6639
  style: {
6601
6640
  width: 24,
6602
6641
  height: 24,
@@ -6621,9 +6660,9 @@ function Qt({ selection: e, sceneRef: n }) {
6621
6660
  children: /* @__PURE__ */ d("input", {
6622
6661
  type: "color",
6623
6662
  defaultValue: ae,
6624
- onMouseDown: B,
6625
- onBlur: (e) => V({
6626
- ...G,
6663
+ onMouseDown: V,
6664
+ onBlur: (e) => H({
6665
+ ...ie,
6627
6666
  ...Re(e.target.value)
6628
6667
  })
6629
6668
  }, `outline-${e.id}-${ae}`)
@@ -6644,19 +6683,19 @@ function Qt({ selection: e, sceneRef: n }) {
6644
6683
  step: 1,
6645
6684
  value: y,
6646
6685
  style: { flex: 1 },
6647
- onPointerDown: B,
6686
+ onPointerDown: V,
6648
6687
  onChange: (e) => b(parseInt(e.target.value, 10)),
6649
6688
  onPointerUp: (e) => {
6650
6689
  let t = parseInt(e.target.value, 10);
6651
- V(t === 0 ? void 0 : {
6652
- ...G,
6690
+ H(t === 0 ? void 0 : {
6691
+ ...ie,
6653
6692
  alpha: t
6654
6693
  });
6655
6694
  },
6656
6695
  onBlur: (e) => {
6657
6696
  let t = parseInt(e.target.value, 10);
6658
- V(t === 0 ? void 0 : {
6659
- ...G,
6697
+ H(t === 0 ? void 0 : {
6698
+ ...ie,
6660
6699
  alpha: t
6661
6700
  });
6662
6701
  }
@@ -6692,7 +6731,7 @@ function Qt({ selection: e, sceneRef: n }) {
6692
6731
  className: "hint",
6693
6732
  children: "No pixmap stored"
6694
6733
  }), /* @__PURE__ */ d("button", {
6695
- onClick: ne,
6734
+ onClick: te,
6696
6735
  style: { alignSelf: "flex-start" },
6697
6736
  children: "Regenerate pixmap"
6698
6737
  })]
@@ -7011,17 +7050,17 @@ var on = [
7011
7050
  "door-locked"
7012
7051
  ];
7013
7052
  function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = [] }) {
7014
- 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);
7015
- V.current = k, t(() => (pt((e) => V.current(String(e))), () => pt(null)), []);
7016
- let te = r(m);
7017
- te.current = m;
7018
- let ne = r(g);
7019
- ne.current = g;
7020
- let re = r(v);
7021
- re.current = v, t(() => {
7053
+ 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);
7054
+ H.current = k, t(() => (pt((e) => H.current(String(e))), () => pt(null)), []);
7055
+ let ee = r(m);
7056
+ ee.current = m;
7057
+ let te = r(g);
7058
+ te.current = g;
7059
+ let ne = r(v);
7060
+ ne.current = v, t(() => {
7022
7061
  let e = a, t = l;
7023
7062
  return () => {
7024
- let n = !1, r = re.current;
7063
+ let n = !1, r = ne.current;
7025
7064
  r !== e.symbol && (Y({
7026
7065
  kind: "setRoomField",
7027
7066
  id: t,
@@ -7029,7 +7068,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7029
7068
  from: e.symbol,
7030
7069
  to: r
7031
7070
  }, s.current), n = !0);
7032
- let i = te.current;
7071
+ let i = ee.current;
7033
7072
  i !== e.name && (Y({
7034
7073
  kind: "setRoomField",
7035
7074
  id: t,
@@ -7037,7 +7076,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7037
7076
  from: e.name,
7038
7077
  to: i
7039
7078
  }, s.current), n = !0);
7040
- let a = Number(ne.current);
7079
+ let a = Number(te.current);
7041
7080
  !Number.isNaN(a) && a !== e.weight && (Y({
7042
7081
  kind: "setRoomField",
7043
7082
  id: t,
@@ -7047,11 +7086,11 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7047
7086
  }, s.current), n = !0), n && (s.current?.refresh(), D.bumpData());
7048
7087
  };
7049
7088
  }, [a]), t(() => {
7050
- 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);
7089
+ 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);
7051
7090
  let e = D.getState().pending;
7052
7091
  (e?.kind === "pickExit" || e?.kind === "pickSpecialExit") && D.setState({ pending: null });
7053
7092
  }, [a]);
7054
- let ie = (e, t) => {
7093
+ let re = (e, t) => {
7055
7094
  let n = a[e], r = t;
7056
7095
  if (e === "weight" || e === "environment") {
7057
7096
  let e = Number(t);
@@ -7065,7 +7104,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7065
7104
  from: n,
7066
7105
  to: r
7067
7106
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Updated ${e} on room ${l}` }));
7068
- }, H = (e) => {
7107
+ }, U = (e) => {
7069
7108
  e !== a.environment && (Y({
7070
7109
  kind: "setRoomField",
7071
7110
  id: l,
@@ -7073,7 +7112,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7073
7112
  from: a.environment,
7074
7113
  to: e
7075
7114
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Room ${l} environment → ${e}` }));
7076
- }, U = (e) => {
7115
+ }, W = (e) => {
7077
7116
  let t = "system.fallback_symbol_color", n = a.userData?.[t] ?? null, r = e;
7078
7117
  n !== r && (Y({
7079
7118
  kind: "setUserDataEntry",
@@ -7082,7 +7121,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7082
7121
  from: n,
7083
7122
  to: r
7084
7123
  }, s.current), s.current?.refresh(), D.bumpData());
7085
- }, W = (e, t) => {
7124
+ }, G = (e, t) => {
7086
7125
  if (!o.rooms[t]) return;
7087
7126
  let n = a[e];
7088
7127
  Y({
@@ -7093,7 +7132,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7093
7132
  previous: n,
7094
7133
  reverse: null
7095
7134
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Exit ${e} → room ${t} added.` });
7096
- }, G = (e, t, n) => {
7135
+ }, ie = (e, t, n) => {
7097
7136
  Y({
7098
7137
  kind: "setDoor",
7099
7138
  roomId: l,
@@ -7222,7 +7261,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7222
7261
  style: a.customLinesStyle?.[i] ?? 1,
7223
7262
  arrow: a.customLinesArrow?.[i] ?? !1
7224
7263
  } : null, u = Re(P), d = null, f = _e[i];
7225
- if (z && f) {
7264
+ if (B && f) {
7226
7265
  let e = a?.[f];
7227
7266
  if (e !== void 0 && e !== -1) {
7228
7267
  let t = o.rooms[e], r = me[f];
@@ -7279,7 +7318,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7279
7318
  } });
7280
7319
  return;
7281
7320
  }
7282
- F("#ffffff"), L(1), ee(!1), B(!1), N(e);
7321
+ F("#ffffff"), L(1), z(!1), V(!1), N(e);
7283
7322
  }, be = (e) => /* @__PURE__ */ f("div", {
7284
7323
  className: "cl-form cl-form-inline",
7285
7324
  children: [
@@ -7334,7 +7373,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7334
7373
  }), /* @__PURE__ */ d("input", {
7335
7374
  type: "checkbox",
7336
7375
  checked: R,
7337
- onChange: (e) => ee(e.target.checked)
7376
+ onChange: (e) => z(e.target.checked)
7338
7377
  })]
7339
7378
  }),
7340
7379
  /* @__PURE__ */ f("div", {
@@ -7345,8 +7384,8 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7345
7384
  children: "Both ways"
7346
7385
  }), /* @__PURE__ */ d("input", {
7347
7386
  type: "checkbox",
7348
- checked: z,
7349
- onChange: (e) => B(e.target.checked)
7387
+ checked: B,
7388
+ onChange: (e) => V(e.target.checked)
7350
7389
  })]
7351
7390
  }),
7352
7391
  /* @__PURE__ */ f("div", {
@@ -7437,7 +7476,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7437
7476
  })),
7438
7477
  onBlur: (n) => {
7439
7478
  let r = parseInt(n.target.value, 10);
7440
- isNaN(r) || (W(t, r), j((t) => ({
7479
+ isNaN(r) || (G(t, r), j((t) => ({
7441
7480
  ...t,
7442
7481
  [e]: ""
7443
7482
  })));
@@ -7467,7 +7506,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7467
7506
  className: `cc-door-btn ${dn[u]}${c ? "" : " cc-dim"}`,
7468
7507
  title: c ? un[u] : void 0,
7469
7508
  disabled: !c,
7470
- onClick: c ? () => G(t, u, (u + 1) % 4) : void 0,
7509
+ onClick: c ? () => ie(t, u, (u + 1) % 4) : void 0,
7471
7510
  children: /* @__PURE__ */ d(en, {})
7472
7511
  }),
7473
7512
  /* @__PURE__ */ d("button", {
@@ -7531,7 +7570,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7531
7570
  children: /* @__PURE__ */ d("input", {
7532
7571
  value: m,
7533
7572
  onChange: (e) => h(e.target.value),
7534
- onBlur: () => ie("name", m),
7573
+ onBlur: () => re("name", m),
7535
7574
  onKeyDown: (e) => {
7536
7575
  e.key === "Enter" && e.target.blur();
7537
7576
  }
@@ -7562,7 +7601,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7562
7601
  map: o,
7563
7602
  sceneRef: s,
7564
7603
  currentEnvId: a.environment,
7565
- onSelect: H,
7604
+ onSelect: U,
7566
7605
  onClose: () => C(!1)
7567
7606
  })
7568
7607
  ]
@@ -7576,7 +7615,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7576
7615
  value: v,
7577
7616
  maxLength: 4,
7578
7617
  onChange: (e) => y(e.target.value),
7579
- onBlur: () => ie("symbol", v)
7618
+ onBlur: () => re("symbol", v)
7580
7619
  }),
7581
7620
  /* @__PURE__ */ d("input", {
7582
7621
  type: "color",
@@ -7585,7 +7624,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7585
7624
  title: "Symbol color (stored in userData as system.fallback_symbol_color)",
7586
7625
  onChange: (e) => x(e.target.value),
7587
7626
  onBlur: () => {
7588
- b !== null && U(b);
7627
+ b !== null && W(b);
7589
7628
  }
7590
7629
  }),
7591
7630
  /* @__PURE__ */ d("button", {
@@ -7594,7 +7633,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7594
7633
  style: { visibility: b === null ? "hidden" : "visible" },
7595
7634
  title: "Clear symbol color",
7596
7635
  onClick: () => {
7597
- x(null), U(null);
7636
+ x(null), W(null);
7598
7637
  },
7599
7638
  children: "×"
7600
7639
  })
@@ -7626,7 +7665,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7626
7665
  value: g,
7627
7666
  title: "Room weight",
7628
7667
  onChange: (e) => _(e.target.value),
7629
- onBlur: () => ie("weight", g),
7668
+ onBlur: () => re("weight", g),
7630
7669
  onKeyDown: (e) => e.key === "Enter" && e.target.blur()
7631
7670
  }, `${l}-w`)]
7632
7671
  }, t) : xe(e))
@@ -7980,7 +8019,7 @@ function mn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7980
8019
  className: "panel-content",
7981
8020
  children: [/* @__PURE__ */ f("h3", { children: [r.ids.length, " rooms selected"] }), /* @__PURE__ */ d("p", {
7982
8021
  className: "hint",
7983
- children: "Drag to move all. Delete to remove all. Ctrl+click to toggle rooms. Ctrl+A selects all."
8022
+ children: "Drag to move all. Delete to remove all. Shift+click/drag to add more. Ctrl+click/drag to toggle. Ctrl+A selects all."
7984
8023
  })]
7985
8024
  })]
7986
8025
  });
@@ -8096,7 +8135,7 @@ function hn({ sceneRef: e }) {
8096
8135
  }, i = (n) => {
8097
8136
  if (n.kind === "room") {
8098
8137
  let e = t.map?.rooms[n.id]?.name;
8099
- return e ? `Room ${n.id}: ${e}` : `Room ${n.id}`;
8138
+ return e && String(n.id) !== e ? `Room ${n.id}: ${e}` : `Room ${n.id}`;
8100
8139
  }
8101
8140
  if (n.kind === "label") {
8102
8141
  let t = (e.current?.reader.getLabelSnapshot(n.areaId, n.id))?.text?.trim();
@@ -8496,7 +8535,7 @@ function yn(e) {
8496
8535
  return t;
8497
8536
  }
8498
8537
  async function bn(e, t, n, r, i, a) {
8499
- let o = H(t), s = o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength), c = a ?? crypto.randomUUID(), l = {
8538
+ let o = U(t), s = o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength), c = a ?? crypto.randomUUID(), l = {
8500
8539
  id: c,
8501
8540
  fileName: e,
8502
8541
  mapBytes: s,
@@ -8550,7 +8589,7 @@ async function Cn(e) {
8550
8589
  });
8551
8590
  }
8552
8591
  function wn(e) {
8553
- let t = ie(e.mapBytes);
8592
+ let t = re(e.mapBytes);
8554
8593
  if (Object.keys(e.imageSrcs).length > 0) for (let n of Object.values(t.labels)) for (let t of n) {
8555
8594
  let n = e.imageSrcs[String(t.id)];
8556
8595
  n && (t.imageSrc = n);
@@ -8743,46 +8782,46 @@ function An({ sceneRef: e }) {
8743
8782
  };
8744
8783
  return window.addEventListener("editor:swatchRoomPicked", e), () => window.removeEventListener("editor:swatchRoomPicked", e);
8745
8784
  }, []);
8746
- let ee = (t) => {
8785
+ let z = (t) => {
8747
8786
  let n = e.current?.reader;
8748
8787
  return n ? n.getColorValue(t) : "rgb(114,1,0)";
8749
- }, z = (e, t, n) => {
8788
+ }, B = (e, t, n) => {
8750
8789
  let r = t === void 0 ? o : t, i = n === void 0 ? s : n;
8751
8790
  D.setState({
8752
8791
  swatchSets: e,
8753
8792
  activeSwatchSetId: r,
8754
8793
  activeSwatchId: i
8755
8794
  }), w(e, r, i);
8756
- }, B = () => {
8795
+ }, V = () => {
8757
8796
  let e = v.trim() || "New Set", t = crypto.randomUUID();
8758
- z([...n, {
8797
+ B([...n, {
8759
8798
  id: t,
8760
8799
  name: e,
8761
8800
  swatches: []
8762
8801
  }], t, null), y(""), _(!1);
8763
- }, V = (e) => {
8764
- R && z(n.map((t) => t.id === R.id ? {
8802
+ }, H = (e) => {
8803
+ R && B(n.map((t) => t.id === R.id ? {
8765
8804
  ...t,
8766
8805
  name: e
8767
8806
  } : t));
8768
- }, te = () => {
8807
+ }, ee = () => {
8769
8808
  if (!R || n.length <= 1 || !window.confirm(`Delete set "${R.name}"?`)) return;
8770
8809
  let e = n.filter((e) => e.id !== R.id);
8771
- z(e, e[0]?.id ?? null, null);
8772
- }, ne = (e) => {
8810
+ B(e, e[0]?.id ?? null, null);
8811
+ }, te = (e) => {
8773
8812
  D.setState({
8774
8813
  activeSwatchSetId: e,
8775
8814
  activeSwatchId: null
8776
8815
  }), w(n, e, null);
8777
- }, re = (e) => {
8816
+ }, ne = (e) => {
8778
8817
  D.setState({ activeSwatchId: e }), w(n, o, e);
8779
- }, ie = (e) => {
8818
+ }, re = (e) => {
8780
8819
  E(e.id), A(e.name), M(e.symbol), P(e.environment), I(!1);
8781
- }, H = () => {
8782
- E("new"), A(""), M(""), P(-1), I(!1);
8783
8820
  }, U = () => {
8784
- E(null), I(!1);
8821
+ E("new"), A(""), M(""), P(-1), I(!1);
8785
8822
  }, W = () => {
8823
+ E(null), I(!1);
8824
+ }, G = () => {
8786
8825
  if (!R || !T) return;
8787
8826
  let e = k.trim() || "Swatch", t = j.slice(0, 4);
8788
8827
  if (T === "new") {
@@ -8792,11 +8831,11 @@ function An({ sceneRef: e }) {
8792
8831
  symbol: t,
8793
8832
  environment: N
8794
8833
  };
8795
- z(n.map((e) => e.id === R.id ? {
8834
+ B(n.map((e) => e.id === R.id ? {
8796
8835
  ...e,
8797
8836
  swatches: [...e.swatches, i]
8798
8837
  } : e), o, r);
8799
- } else z(n.map((n) => n.id === R.id ? {
8838
+ } else B(n.map((n) => n.id === R.id ? {
8800
8839
  ...n,
8801
8840
  swatches: n.swatches.map((n) => n.id === T ? {
8802
8841
  ...n,
@@ -8806,8 +8845,8 @@ function An({ sceneRef: e }) {
8806
8845
  } : n)
8807
8846
  } : n));
8808
8847
  E(null), I(!1);
8809
- }, G = (e) => {
8810
- R && z(n.map((t) => t.id === R.id ? {
8848
+ }, ie = (e) => {
8849
+ R && B(n.map((t) => t.id === R.id ? {
8811
8850
  ...t,
8812
8851
  swatches: t.swatches.filter((t) => t.id !== e)
8813
8852
  } : t), void 0, s === e ? null : void 0);
@@ -8850,7 +8889,7 @@ function An({ sceneRef: e }) {
8850
8889
  value: S,
8851
8890
  onChange: (e) => C(e.target.value),
8852
8891
  onKeyDown: (e) => {
8853
- e.key === "Enter" && (V(S), x(!1)), e.key === "Escape" && x(!1);
8892
+ e.key === "Enter" && (H(S), x(!1)), e.key === "Escape" && x(!1);
8854
8893
  },
8855
8894
  autoFocus: !0
8856
8895
  }),
@@ -8858,7 +8897,7 @@ function An({ sceneRef: e }) {
8858
8897
  type: "button",
8859
8898
  className: "swatch-icon-btn",
8860
8899
  onClick: () => {
8861
- V(S), x(!1);
8900
+ H(S), x(!1);
8862
8901
  },
8863
8902
  children: "✓"
8864
8903
  }),
@@ -8871,7 +8910,7 @@ function An({ sceneRef: e }) {
8871
8910
  ] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("select", {
8872
8911
  className: "swatch-set-select",
8873
8912
  value: R?.id ?? "",
8874
- onChange: (e) => ne(e.target.value),
8913
+ onChange: (e) => te(e.target.value),
8875
8914
  children: L.map((e) => /* @__PURE__ */ d("option", {
8876
8915
  value: e.id,
8877
8916
  children: e.name
@@ -8889,7 +8928,7 @@ function An({ sceneRef: e }) {
8889
8928
  className: "swatch-icon-btn swatch-icon-btn-danger",
8890
8929
  title: "Delete set",
8891
8930
  disabled: n.length <= 1,
8892
- onClick: te,
8931
+ onClick: ee,
8893
8932
  children: "🗑"
8894
8933
  })] })] }), g ? /* @__PURE__ */ f(u, { children: [
8895
8934
  /* @__PURE__ */ d("input", {
@@ -8898,14 +8937,14 @@ function An({ sceneRef: e }) {
8898
8937
  value: v,
8899
8938
  onChange: (e) => y(e.target.value),
8900
8939
  onKeyDown: (e) => {
8901
- e.key === "Enter" && B(), e.key === "Escape" && (_(!1), y(""));
8940
+ e.key === "Enter" && V(), e.key === "Escape" && (_(!1), y(""));
8902
8941
  },
8903
8942
  autoFocus: !0
8904
8943
  }),
8905
8944
  /* @__PURE__ */ d("button", {
8906
8945
  type: "button",
8907
8946
  className: "swatch-icon-btn",
8908
- onClick: B,
8947
+ onClick: V,
8909
8948
  children: "✓"
8910
8949
  }),
8911
8950
  /* @__PURE__ */ d("button", {
@@ -8928,12 +8967,12 @@ function An({ sceneRef: e }) {
8928
8967
  className: "swatch-grid",
8929
8968
  children: [R.swatches.map((e) => /* @__PURE__ */ f("div", {
8930
8969
  className: `swatch-chip${s === e.id ? " active" : ""}${T === e.id ? " editing" : ""}`,
8931
- onClick: () => re(e.id),
8970
+ onClick: () => ne(e.id),
8932
8971
  title: `${e.name} · env ${e.environment}${e.symbol ? ` · "${e.symbol}"` : ""}`,
8933
8972
  children: [
8934
8973
  /* @__PURE__ */ d("span", {
8935
8974
  className: "swatch-chip-env",
8936
- style: { background: ee(e.environment) }
8975
+ style: { background: z(e.environment) }
8937
8976
  }),
8938
8977
  e.symbol && /* @__PURE__ */ d("span", {
8939
8978
  className: "swatch-chip-symbol",
@@ -8948,7 +8987,7 @@ function An({ sceneRef: e }) {
8948
8987
  className: "swatch-chip-edit",
8949
8988
  title: "Edit",
8950
8989
  onClick: (t) => {
8951
- t.stopPropagation(), ie(e);
8990
+ t.stopPropagation(), re(e);
8952
8991
  },
8953
8992
  children: "✏"
8954
8993
  }), /* @__PURE__ */ d("button", {
@@ -8956,7 +8995,7 @@ function An({ sceneRef: e }) {
8956
8995
  className: "swatch-chip-del",
8957
8996
  title: "Delete",
8958
8997
  onClick: (t) => {
8959
- t.stopPropagation(), G(e.id);
8998
+ t.stopPropagation(), ie(e.id);
8960
8999
  },
8961
9000
  children: "×"
8962
9001
  })] })
@@ -8965,7 +9004,7 @@ function An({ sceneRef: e }) {
8965
9004
  type: "button",
8966
9005
  className: "swatch-add-btn",
8967
9006
  title: "Add swatch",
8968
- onClick: H,
9007
+ onClick: U,
8969
9008
  children: "+"
8970
9009
  })]
8971
9010
  }),
@@ -8986,7 +9025,7 @@ function An({ sceneRef: e }) {
8986
9025
  value: k,
8987
9026
  onChange: (e) => A(e.target.value),
8988
9027
  onKeyDown: (e) => {
8989
- e.key === "Enter" && W(), e.key === "Escape" && U();
9028
+ e.key === "Enter" && G(), e.key === "Escape" && W();
8990
9029
  },
8991
9030
  autoFocus: !0
8992
9031
  }),
@@ -8997,7 +9036,7 @@ function An({ sceneRef: e }) {
8997
9036
  value: j,
8998
9037
  onChange: (e) => M(e.target.value),
8999
9038
  onKeyDown: (e) => {
9000
- e.key === "Enter" && W(), e.key === "Escape" && U();
9039
+ e.key === "Enter" && G(), e.key === "Escape" && W();
9001
9040
  }
9002
9041
  }),
9003
9042
  /* @__PURE__ */ f("div", {
@@ -9005,7 +9044,7 @@ function An({ sceneRef: e }) {
9005
9044
  children: [/* @__PURE__ */ d("button", {
9006
9045
  type: "button",
9007
9046
  className: "swatch-env-btn",
9008
- style: { background: ee(N) },
9047
+ style: { background: z(N) },
9009
9048
  title: `Env ${N === -1 ? "none" : N} — click to change`,
9010
9049
  onClick: () => I((e) => !e),
9011
9050
  children: /* @__PURE__ */ d("span", {
@@ -9033,14 +9072,14 @@ function An({ sceneRef: e }) {
9033
9072
  type: "button",
9034
9073
  className: "swatch-edit-ok",
9035
9074
  title: "Save",
9036
- onClick: W,
9075
+ onClick: G,
9037
9076
  children: "✓"
9038
9077
  }),
9039
9078
  /* @__PURE__ */ d("button", {
9040
9079
  type: "button",
9041
9080
  className: "swatch-edit-cancel",
9042
9081
  title: "Cancel",
9043
- onClick: U,
9082
+ onClick: W,
9044
9083
  children: "✕"
9045
9084
  })
9046
9085
  ]
@@ -9053,15 +9092,257 @@ function An({ sceneRef: e }) {
9053
9092
  });
9054
9093
  }
9055
9094
  //#endregion
9095
+ //#region src/components/SearchPanel.tsx
9096
+ function jn(e, t = 40) {
9097
+ return e.length > t ? e.slice(0, t) + "…" : e;
9098
+ }
9099
+ function Mn({ onClose: e }) {
9100
+ let a = O((e) => e.map), [o, s] = i(""), [c, l] = i("rooms"), [p, m] = i(0), h = r(null), g = r(null);
9101
+ t(() => {
9102
+ h.current?.focus();
9103
+ }, []);
9104
+ let _ = n(() => {
9105
+ if (!a || o.trim().length === 0) return [];
9106
+ let e = o.trim().toLowerCase();
9107
+ if (c === "rooms") {
9108
+ let t = [];
9109
+ for (let [n, r] of Object.entries(a.rooms)) {
9110
+ if (!r) continue;
9111
+ let i = Number(n), o = null;
9112
+ if (r.name?.toLowerCase().includes(e)) o = "name";
9113
+ else if (n.includes(e)) o = "id";
9114
+ else if (r.userData) {
9115
+ for (let [t, n] of Object.entries(r.userData)) if (t.toLowerCase().includes(e) || String(n).toLowerCase().includes(e)) {
9116
+ o = `${t}: ${jn(String(n))}`;
9117
+ break;
9118
+ }
9119
+ }
9120
+ if (o !== null && (t.push({
9121
+ kind: "room",
9122
+ id: i,
9123
+ name: r.name ?? "",
9124
+ areaId: r.area,
9125
+ areaName: a.areaNames[r.area] ?? `Area ${r.area}`,
9126
+ x: r.x,
9127
+ y: r.y,
9128
+ z: r.z,
9129
+ matchReason: o
9130
+ }), t.length >= 100)) break;
9131
+ }
9132
+ return t;
9133
+ } else {
9134
+ let t = [];
9135
+ for (let [n, r] of Object.entries(a.labels)) {
9136
+ if (!r) continue;
9137
+ let i = Number(n);
9138
+ for (let n of r) if (!(!n || !n.text?.toLowerCase().includes(e)) && (t.push({
9139
+ kind: "label",
9140
+ id: n.id,
9141
+ text: n.text,
9142
+ areaId: i,
9143
+ areaName: a.areaNames[i] ?? `Area ${i}`,
9144
+ x: n.pos[0],
9145
+ y: n.pos[1],
9146
+ z: n.pos[2]
9147
+ }), t.length >= 100)) break;
9148
+ if (t.length >= 100) break;
9149
+ }
9150
+ return t;
9151
+ }
9152
+ }, [
9153
+ a,
9154
+ o,
9155
+ c
9156
+ ]);
9157
+ t(() => {
9158
+ m(0);
9159
+ }, [_]);
9160
+ let v = (e) => {
9161
+ let t = D.getState(), n = t.currentAreaId === e.areaId && t.currentZ === e.z;
9162
+ e.kind === "room" ? n ? D.setState({
9163
+ selection: {
9164
+ kind: "room",
9165
+ ids: [e.id]
9166
+ },
9167
+ panRequest: {
9168
+ mapX: e.x,
9169
+ mapY: -e.y
9170
+ }
9171
+ }) : (D.setState({
9172
+ currentAreaId: e.areaId,
9173
+ currentZ: e.z,
9174
+ navigateTo: {
9175
+ mapX: e.x,
9176
+ mapY: -e.y
9177
+ },
9178
+ selection: {
9179
+ kind: "room",
9180
+ ids: [e.id]
9181
+ },
9182
+ pending: null
9183
+ }), D.bumpStructure()) : n ? D.setState({
9184
+ selection: {
9185
+ kind: "label",
9186
+ id: e.id,
9187
+ areaId: e.areaId
9188
+ },
9189
+ panRequest: {
9190
+ mapX: e.x,
9191
+ mapY: -e.y
9192
+ }
9193
+ }) : (D.setState({
9194
+ currentAreaId: e.areaId,
9195
+ currentZ: e.z,
9196
+ navigateTo: {
9197
+ mapX: e.x,
9198
+ mapY: -e.y
9199
+ },
9200
+ selection: {
9201
+ kind: "label",
9202
+ id: e.id,
9203
+ areaId: e.areaId
9204
+ },
9205
+ pending: null
9206
+ }), D.bumpStructure());
9207
+ }, y = (t) => {
9208
+ if (t.key === "Escape") {
9209
+ e();
9210
+ return;
9211
+ }
9212
+ if (t.key === "Tab") {
9213
+ t.preventDefault(), b(c === "rooms" ? "labels" : "rooms");
9214
+ return;
9215
+ }
9216
+ t.key === "ArrowDown" ? (t.preventDefault(), m((e) => Math.min(e + 1, _.length - 1))) : t.key === "ArrowUp" ? (t.preventDefault(), m((e) => Math.max(e - 1, 0))) : t.key === "Enter" && _.length > 0 && (t.preventDefault(), v(_[p]));
9217
+ };
9218
+ t(() => {
9219
+ (g.current?.children[p])?.scrollIntoView({ block: "nearest" });
9220
+ }, [p]);
9221
+ let b = (e) => {
9222
+ l(e), s(""), h.current?.focus();
9223
+ };
9224
+ return /* @__PURE__ */ f("div", {
9225
+ className: "search-panel",
9226
+ onKeyDown: y,
9227
+ children: [
9228
+ /* @__PURE__ */ f("div", {
9229
+ className: "search-panel-header",
9230
+ children: [/* @__PURE__ */ f("div", {
9231
+ className: "search-panel-tabs",
9232
+ children: [/* @__PURE__ */ d("button", {
9233
+ type: "button",
9234
+ className: `search-tab${c === "rooms" ? " active" : ""}`,
9235
+ onClick: () => b("rooms"),
9236
+ children: "Rooms"
9237
+ }), /* @__PURE__ */ d("button", {
9238
+ type: "button",
9239
+ className: `search-tab${c === "labels" ? " active" : ""}`,
9240
+ onClick: () => b("labels"),
9241
+ children: "Labels"
9242
+ })]
9243
+ }), /* @__PURE__ */ d("button", {
9244
+ type: "button",
9245
+ className: "modal-close",
9246
+ onClick: e,
9247
+ title: "Close (Esc)",
9248
+ children: "✕"
9249
+ })]
9250
+ }),
9251
+ /* @__PURE__ */ f("div", {
9252
+ className: "search-panel-input-wrap",
9253
+ children: [
9254
+ /* @__PURE__ */ f("svg", {
9255
+ className: "search-panel-icon",
9256
+ width: "14",
9257
+ height: "14",
9258
+ viewBox: "0 0 16 16",
9259
+ fill: "none",
9260
+ "aria-hidden": "true",
9261
+ children: [/* @__PURE__ */ d("circle", {
9262
+ cx: "6.5",
9263
+ cy: "6.5",
9264
+ r: "4.5",
9265
+ stroke: "currentColor",
9266
+ strokeWidth: "1.4"
9267
+ }), /* @__PURE__ */ d("path", {
9268
+ d: "M10.5 10.5L14 14",
9269
+ stroke: "currentColor",
9270
+ strokeWidth: "1.4",
9271
+ strokeLinecap: "round"
9272
+ })]
9273
+ }),
9274
+ /* @__PURE__ */ d("input", {
9275
+ ref: h,
9276
+ className: "search-panel-input",
9277
+ type: "text",
9278
+ placeholder: c === "rooms" ? "name, ID, or user data… (Tab to switch)" : "label text… (Tab to switch)",
9279
+ value: o,
9280
+ onChange: (e) => s(e.target.value)
9281
+ }),
9282
+ o && /* @__PURE__ */ d("button", {
9283
+ type: "button",
9284
+ className: "search-panel-clear",
9285
+ onClick: () => {
9286
+ s(""), h.current?.focus();
9287
+ },
9288
+ title: "Clear",
9289
+ children: "✕"
9290
+ })
9291
+ ]
9292
+ }),
9293
+ o.trim().length > 0 && /* @__PURE__ */ f("ul", {
9294
+ className: "search-panel-results",
9295
+ ref: g,
9296
+ children: [_.length === 0 ? /* @__PURE__ */ d("li", {
9297
+ className: "search-panel-empty",
9298
+ children: "No matches"
9299
+ }) : _.map((e, t) => /* @__PURE__ */ d("li", {
9300
+ className: `search-panel-result${t === p ? " selected" : ""}`,
9301
+ onClick: () => v(e),
9302
+ onMouseEnter: () => m(t),
9303
+ children: e.kind === "room" ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
9304
+ className: "search-result-row",
9305
+ children: [/* @__PURE__ */ d("span", {
9306
+ className: "search-result-name",
9307
+ children: e.name || /* @__PURE__ */ d("em", { children: "unnamed" })
9308
+ }), /* @__PURE__ */ f("span", {
9309
+ className: "search-result-meta",
9310
+ children: [
9311
+ "#",
9312
+ e.id,
9313
+ " · ",
9314
+ e.areaName,
9315
+ e.z === 0 ? "" : ` · z${e.z}`
9316
+ ]
9317
+ })]
9318
+ }), /* @__PURE__ */ d("div", {
9319
+ className: "search-result-reason",
9320
+ children: e.matchReason
9321
+ })] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
9322
+ className: "search-result-name",
9323
+ children: e.text || /* @__PURE__ */ d("em", { children: "empty label" })
9324
+ }), /* @__PURE__ */ f("span", {
9325
+ className: "search-result-meta",
9326
+ children: [e.areaName, e.z === 0 ? "" : ` · z${e.z}`]
9327
+ })] })
9328
+ }, e.kind === "room" ? `room-${e.id}` : `label-${e.areaId}-${e.id}`)), _.length === 100 && /* @__PURE__ */ d("li", {
9329
+ className: "search-panel-more",
9330
+ children: "Showing first 100 results — refine your query"
9331
+ })]
9332
+ })
9333
+ ]
9334
+ });
9335
+ }
9336
+ //#endregion
9056
9337
  //#region src/editor/reader/EditorMapReader.ts
9057
- var jn = {
9338
+ var Nn = {
9058
9339
  1: "solid line",
9059
9340
  2: "dash line",
9060
9341
  3: "dot line",
9061
9342
  4: "dash dot line",
9062
9343
  5: "dash dot dot line"
9063
9344
  };
9064
- function Mn(e, t) {
9345
+ function Pn(e, t) {
9065
9346
  let n = {
9066
9347
  id: e,
9067
9348
  __raw: t
@@ -9150,7 +9431,7 @@ function Mn(e, t) {
9150
9431
  g: 255,
9151
9432
  b: 255
9152
9433
  },
9153
- style: jn[t.customLinesStyle?.[r]] ?? "solid line",
9434
+ style: Nn[t.customLinesStyle?.[r]] ?? "solid line",
9154
9435
  arrow: t.customLinesArrow?.[r] ?? !1
9155
9436
  }
9156
9437
  };
@@ -9161,7 +9442,7 @@ function Mn(e, t) {
9161
9442
  configurable: !0
9162
9443
  }), n;
9163
9444
  }
9164
- function Nn(e) {
9445
+ function Fn(e) {
9165
9446
  let t = {
9166
9447
  north: "south",
9167
9448
  south: "north",
@@ -9227,7 +9508,7 @@ function Nn(e) {
9227
9508
  }
9228
9509
  return r;
9229
9510
  }
9230
- function Pn(e) {
9511
+ function In(e) {
9231
9512
  if (!e || e.length === 0) return "";
9232
9513
  if (typeof e == "string") return e.includes(",") ? e.split(",")[1] : e;
9233
9514
  try {
@@ -9236,10 +9517,10 @@ function Pn(e) {
9236
9517
  return "";
9237
9518
  }
9238
9519
  }
9239
- function Fn(e) {
9240
- e.pixMapBase64 === void 0 && (e.pixMapBase64 = Pn(e.pixMap));
9520
+ function Ln(e) {
9521
+ e.pixMapBase64 === void 0 && (e.pixMapBase64 = In(e.pixMap));
9241
9522
  }
9242
- function In(e, t) {
9523
+ function Rn(e, t) {
9243
9524
  let n = e.id;
9244
9525
  if (!e.font) {
9245
9526
  let r = t[`system.labelFont_${n}`];
@@ -9269,7 +9550,7 @@ function In(e, t) {
9269
9550
  });
9270
9551
  }
9271
9552
  }
9272
- function Ln(e, t) {
9553
+ function zn(e, t) {
9273
9554
  let n = e.id, r = e.font;
9274
9555
  if (r?.family) {
9275
9556
  let e = r.bold ? 75 : 50;
@@ -9280,7 +9561,7 @@ function Ln(e, t) {
9280
9561
  t[`system.labelOutlineColor_${n}`] = `${r}|${i}|${a}|${o}`;
9281
9562
  } else t[`system.labelOutlineColor_${n}`] = "0|0|0|0";
9282
9563
  }
9283
- function Rn(e) {
9564
+ function Bn(e) {
9284
9565
  return {
9285
9566
  id: e.id,
9286
9567
  pos: [...e.pos],
@@ -9296,7 +9577,7 @@ function Rn(e) {
9296
9577
  imageSrc: e.imageSrc
9297
9578
  };
9298
9579
  }
9299
- var zn = class {
9580
+ var Vn = class {
9300
9581
  constructor(e, t) {
9301
9582
  this.rooms = e, this.labels = t;
9302
9583
  }
@@ -9326,7 +9607,7 @@ var zn = class {
9326
9607
  setLabels(e) {
9327
9608
  this.labels = e;
9328
9609
  }
9329
- }, Bn = class {
9610
+ }, Hn = class {
9330
9611
  planes = {};
9331
9612
  exits = /* @__PURE__ */ new Map();
9332
9613
  version = 0;
@@ -9394,19 +9675,19 @@ var zn = class {
9394
9675
  let t = {};
9395
9676
  for (let [n, r] of Object.entries(e)) {
9396
9677
  let e = Number(n);
9397
- t[e] = new zn(r, this.labels.filter((t) => t.Z === e));
9678
+ t[e] = new Vn(r, this.labels.filter((t) => t.Z === e));
9398
9679
  }
9399
9680
  this.planes = t;
9400
9681
  }
9401
9682
  rebuildExits() {
9402
- this.exits = Nn(this.rooms);
9683
+ this.exits = Fn(this.rooms);
9403
9684
  }
9404
9685
  };
9405
- function Vn(e) {
9686
+ function Un(e) {
9406
9687
  let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
9407
9688
  return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
9408
9689
  }
9409
- var Hn = {
9690
+ var Wn = {
9410
9691
  rgb: [
9411
9692
  114,
9412
9693
  1,
@@ -9419,17 +9700,17 @@ var Hn = {
9419
9700
  225
9420
9701
  ],
9421
9702
  symbolColorValue: "rgb(225,225,225)"
9422
- }, Un = class {
9703
+ }, Gn = class {
9423
9704
  rooms = {};
9424
9705
  areas = {};
9425
9706
  colors = {};
9426
9707
  constructor(e) {
9427
9708
  this.raw = e;
9428
- let { colors: t } = U(e);
9709
+ let { colors: t } = W(e);
9429
9710
  for (let e of t) this.colors[e.envId] = {
9430
9711
  rgb: e.colors,
9431
9712
  rgbValue: `rgb(${e.colors.join(",")})`,
9432
- symbolColor: Vn(e.colors) > .41 ? [
9713
+ symbolColor: Un(e.colors) > .41 ? [
9433
9714
  25,
9434
9715
  25,
9435
9716
  25
@@ -9438,19 +9719,19 @@ var Hn = {
9438
9719
  255,
9439
9720
  255
9440
9721
  ],
9441
- symbolColorValue: Vn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9722
+ symbolColorValue: Un(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9442
9723
  };
9443
9724
  for (let [t, n] of Object.entries(e.areas)) {
9444
9725
  let r = Number(t), i = [];
9445
9726
  for (let t of n.rooms) {
9446
9727
  let n = e.rooms[t];
9447
9728
  if (!n) continue;
9448
- let r = Mn(t, n);
9729
+ let r = Pn(t, n);
9449
9730
  this.rooms[t] = r, i.push(r);
9450
9731
  }
9451
9732
  let a = e.labels?.[r] ?? [], o = e.areas[r]?.userData ?? {};
9452
- for (let e of a) Fn(e), In(e, o);
9453
- this.areas[r] = new Bn(r, e.areaNames[r] ?? `Area ${r}`, i, a.map((e) => this.toRendererLabel(e, r)));
9733
+ for (let e of a) Ln(e), Rn(e, o);
9734
+ this.areas[r] = new Hn(r, e.areaNames[r] ?? `Area ${r}`, i, a.map((e) => this.toRendererLabel(e, r)));
9454
9735
  }
9455
9736
  }
9456
9737
  toRendererLabel(e, t) {
@@ -9507,10 +9788,10 @@ var Hn = {
9507
9788
  return !1;
9508
9789
  }
9509
9790
  getColorValue(e) {
9510
- return this.colors[e]?.rgbValue ?? Hn.rgbValue;
9791
+ return this.colors[e]?.rgbValue ?? Wn.rgbValue;
9511
9792
  }
9512
9793
  getSymbolColor(e, t) {
9513
- let n = this.colors[e] ?? Hn, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.symbolColor.join(",");
9794
+ let n = this.colors[e] ?? Wn, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.symbolColor.join(",");
9514
9795
  return r === 1 ? `rgba(${i})` : `rgba(${i}, ${r})`;
9515
9796
  }
9516
9797
  moveRoom(e, t, n, r) {
@@ -9544,7 +9825,7 @@ var Hn = {
9544
9825
  this.raw.rooms[e] = t;
9545
9826
  let n = this.raw.areas[t.area];
9546
9827
  n && !n.rooms.includes(e) && n.rooms.push(e);
9547
- let r = Mn(e, t);
9828
+ let r = Pn(e, t);
9548
9829
  this.rooms[e] = r, this.areas[t.area]?.addRoomLive(r);
9549
9830
  }
9550
9831
  setSpecialExit(e, t, n) {
@@ -9640,7 +9921,7 @@ var Hn = {
9640
9921
  isZone: !1,
9641
9922
  zoneAreaRef: -1,
9642
9923
  userData: {}
9643
- }, this.raw.areaNames[e] = t, this.areas[e] = new Bn(e, t, [], []);
9924
+ }, this.raw.areaNames[e] = t, this.areas[e] = new Hn(e, t, [], []);
9644
9925
  }
9645
9926
  removeArea(e) {
9646
9927
  delete this.raw.areas[e], delete this.raw.areaNames[e], delete this.areas[e];
@@ -9668,11 +9949,11 @@ var Hn = {
9668
9949
  }
9669
9950
  setCustomEnvColor(e, t) {
9670
9951
  t === null ? delete this.raw.mCustomEnvColors[e] : this.raw.mCustomEnvColors[e] = t;
9671
- let { colors: n } = U(this.raw);
9952
+ let { colors: n } = W(this.raw);
9672
9953
  for (let e of n) this.colors[e.envId] = {
9673
9954
  rgb: e.colors,
9674
9955
  rgbValue: `rgb(${e.colors.join(",")})`,
9675
- symbolColor: Vn(e.colors) > .41 ? [
9956
+ symbolColor: Un(e.colors) > .41 ? [
9676
9957
  25,
9677
9958
  25,
9678
9959
  25
@@ -9681,13 +9962,13 @@ var Hn = {
9681
9962
  255,
9682
9963
  255
9683
9964
  ],
9684
- symbolColorValue: Vn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9965
+ symbolColorValue: Un(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9685
9966
  };
9686
9967
  t === null && delete this.colors[e];
9687
9968
  }
9688
9969
  getLabelSnapshot(e, t) {
9689
9970
  let n = this.raw.labels[e]?.find((e) => e.id === t);
9690
- return n ? Rn(n) : null;
9971
+ return n ? Bn(n) : null;
9691
9972
  }
9692
9973
  addLabel(e, t) {
9693
9974
  this.raw.labels[e] || (this.raw.labels[e] = []);
@@ -9709,7 +9990,7 @@ var Hn = {
9709
9990
  };
9710
9991
  this.raw.labels[e].push(r);
9711
9992
  let i = this.raw.areas[e]?.userData;
9712
- i && Ln(r, i), this.syncRendererLabels(e);
9993
+ i && zn(r, i), this.syncRendererLabels(e);
9713
9994
  }
9714
9995
  removeLabel(e, t) {
9715
9996
  if (!this.raw.labels[e]) return;
@@ -9742,14 +10023,14 @@ var Hn = {
9742
10023
  if (!r) return;
9743
10024
  r.font = { ...n };
9744
10025
  let i = this.raw.areas[e]?.userData;
9745
- i && Ln(r, i), this.syncRendererLabels(e);
10026
+ i && zn(r, i), this.syncRendererLabels(e);
9746
10027
  }
9747
10028
  setLabelOutlineColor(e, t, n) {
9748
10029
  let r = this.raw.labels[e]?.find((e) => e.id === t);
9749
10030
  if (!r) return;
9750
10031
  r.outlineColor = n ? { ...n } : void 0;
9751
10032
  let i = this.raw.areas[e]?.userData;
9752
- i && Ln(r, i), this.syncRendererLabels(e);
10033
+ i && zn(r, i), this.syncRendererLabels(e);
9753
10034
  }
9754
10035
  setLabelNoScaling(e, t, n) {
9755
10036
  let r = this.raw.labels[e]?.find((e) => e.id === t);
@@ -9780,10 +10061,10 @@ var Hn = {
9780
10061
  restoreAreaWithRooms(e, t, n, r) {
9781
10062
  let i = [];
9782
10063
  for (let { id: e, room: t } of n) {
9783
- let n = Mn(e, t);
10064
+ let n = Pn(e, t);
9784
10065
  this.rooms[e] = n, i.push(n);
9785
10066
  }
9786
- this.areas[e] = new Bn(e, t, i, []);
10067
+ this.areas[e] = new Hn(e, t, i, []);
9787
10068
  for (let e of r) {
9788
10069
  let t = this.areas[e];
9789
10070
  t && (t.rebuildExits(), t.markDirty());
@@ -9822,7 +10103,7 @@ var Hn = {
9822
10103
  }
9823
10104
  for (let e of this.getAreas()) n.has(e.getAreaId()) || e.rebuildExits();
9824
10105
  }
9825
- }, Wn = class {
10106
+ }, Kn = class {
9826
10107
  rects = /* @__PURE__ */ new Map();
9827
10108
  layer;
9828
10109
  unsubscribe;
@@ -9866,7 +10147,7 @@ var Hn = {
9866
10147
  }
9867
10148
  this.layer.batchDraw();
9868
10149
  }
9869
- }, Gn = "#ffcc00", Kn = .9, qn = .3, Jn = .2, Yn = class {
10150
+ }, qn = "#ffcc00", Jn = .9, Yn = .3, Xn = .2, Zn = class {
9870
10151
  roomRect;
9871
10152
  linkGroup;
9872
10153
  layer;
@@ -9877,7 +10158,7 @@ var Hn = {
9877
10158
  }
9878
10159
  attach(e) {
9879
10160
  this.layer = e, this.roomRect = new h.Rect({
9880
- stroke: Gn,
10161
+ stroke: qn,
9881
10162
  strokeWidth: .06,
9882
10163
  listening: !1,
9883
10164
  visible: !1,
@@ -9925,23 +10206,23 @@ var Hn = {
9925
10206
  }
9926
10207
  for (let t of e.data.lines) this.linkGroup.add(new h.Line({
9927
10208
  points: [...t.points],
9928
- stroke: Gn,
10209
+ stroke: qn,
9929
10210
  strokeWidth: r,
9930
10211
  dash: t.dash ? [...t.dash] : void 0,
9931
10212
  listening: !1,
9932
10213
  lineCap: "round",
9933
- opacity: Kn
10214
+ opacity: Jn
9934
10215
  }));
9935
10216
  for (let t of e.data.arrows) this.linkGroup.add(new h.Arrow({
9936
10217
  points: [...t.points],
9937
- stroke: Gn,
9938
- fill: Gn,
10218
+ stroke: qn,
10219
+ fill: qn,
9939
10220
  strokeWidth: r,
9940
10221
  dash: t.dash ? [...t.dash] : void 0,
9941
10222
  pointerLength: t.pointerLength,
9942
10223
  pointerWidth: t.pointerWidth,
9943
10224
  listening: !1,
9944
- opacity: Kn
10225
+ opacity: Jn
9945
10226
  }));
9946
10227
  this.linkGroup.visible(!0);
9947
10228
  } else if (t.kind === "customLine") {
@@ -9952,32 +10233,32 @@ var Hn = {
9952
10233
  }
9953
10234
  let i = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
9954
10235
  points: [...e.points],
9955
- stroke: Gn,
9956
- fill: Gn,
10236
+ stroke: qn,
10237
+ fill: qn,
9957
10238
  strokeWidth: r,
9958
10239
  dash: e.dash ? [...e.dash] : void 0,
9959
- pointerLength: qn,
9960
- pointerWidth: Jn,
10240
+ pointerLength: Yn,
10241
+ pointerWidth: Xn,
9961
10242
  listening: !1,
9962
10243
  lineCap: "round",
9963
10244
  lineJoin: "round",
9964
- opacity: Kn
10245
+ opacity: Jn
9965
10246
  }) : new h.Line({
9966
10247
  points: [...e.points],
9967
- stroke: Gn,
10248
+ stroke: qn,
9968
10249
  strokeWidth: r,
9969
10250
  dash: e.dash ? [...e.dash] : void 0,
9970
10251
  listening: !1,
9971
10252
  lineCap: "round",
9972
10253
  lineJoin: "round",
9973
- opacity: Kn
10254
+ opacity: Jn
9974
10255
  });
9975
10256
  this.linkGroup.add(i), this.linkGroup.visible(!0);
9976
10257
  }
9977
10258
  this.layer.batchDraw();
9978
10259
  }
9979
- }, Xn = .6;
9980
- function Zn(e) {
10260
+ }, Qn = .6;
10261
+ function $n(e) {
9981
10262
  for (let [t, n, r] of ot) if (r === e) return {
9982
10263
  ox: t,
9983
10264
  oy: n
@@ -9987,7 +10268,7 @@ function Zn(e) {
9987
10268
  oy: 0
9988
10269
  };
9989
10270
  }
9990
- var Qn = class {
10271
+ var er = class {
9991
10272
  line;
9992
10273
  dirLabel;
9993
10274
  layer;
@@ -10034,14 +10315,14 @@ var Qn = class {
10034
10315
  }
10035
10316
  let r = n.getRenderRoom(t.sourceId);
10036
10317
  if (!r) return;
10037
- let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ?? Xn) / 2, o = r.x, s = r.y;
10318
+ let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ?? Qn) / 2, o = r.x, s = r.y;
10038
10319
  if (t.sourceDir) {
10039
- let { ox: e, oy: n } = Zn(t.sourceDir);
10320
+ let { ox: e, oy: n } = $n(t.sourceDir);
10040
10321
  o = r.x + e * a, s = r.y + n * a;
10041
10322
  }
10042
10323
  let c, l;
10043
10324
  if (i && t.targetDir) {
10044
- let { ox: e, oy: n } = Zn(t.targetDir);
10325
+ let { ox: e, oy: n } = $n(t.targetDir);
10045
10326
  c = i.x + e * a, l = i.y + n * a;
10046
10327
  } else i ? (c = i.x, l = i.y) : (c = t.cursorMap?.x ?? r.x, l = t.cursorMap?.y ?? r.y);
10047
10328
  let u = !0, d = "";
@@ -10062,7 +10343,7 @@ var Qn = class {
10062
10343
  l
10063
10344
  ]), 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();
10064
10345
  }
10065
- }, $n = class {
10346
+ }, tr = class {
10066
10347
  rect;
10067
10348
  layer;
10068
10349
  unsubscribe;
@@ -10098,7 +10379,7 @@ var Qn = class {
10098
10379
  }
10099
10380
  this.rect.x(t.x), this.rect.y(t.y), this.rect.visible(!0), this.layer.batchDraw();
10100
10381
  }
10101
- }, er = class {
10382
+ }, nr = class {
10102
10383
  source;
10103
10384
  target;
10104
10385
  layer;
@@ -10176,7 +10457,7 @@ var Qn = class {
10176
10457
  }
10177
10458
  this.layer.batchDraw();
10178
10459
  }
10179
- }, tr = "rgba(255, 220, 60, 0.9)", nr = .55, rr = class {
10460
+ }, rr = "rgba(255, 220, 60, 0.9)", ir = .55, ar = class {
10180
10461
  group;
10181
10462
  layer;
10182
10463
  unsubscribe;
@@ -10249,14 +10530,14 @@ var Qn = class {
10249
10530
  if (o) {
10250
10531
  let t = this.resolveTargetRoom(e, o.roomId, o.exitName);
10251
10532
  if (t) {
10252
- let { x: e, y: n } = t, r = nr, i = new h.Line({
10533
+ let { x: e, y: n } = t, r = ir, i = new h.Line({
10253
10534
  points: [
10254
10535
  e - r,
10255
10536
  n,
10256
10537
  e + r,
10257
10538
  n
10258
10539
  ],
10259
- stroke: tr,
10540
+ stroke: rr,
10260
10541
  strokeWidth: a,
10261
10542
  listening: !1,
10262
10543
  lineCap: "round"
@@ -10267,7 +10548,7 @@ var Qn = class {
10267
10548
  e,
10268
10549
  n + r
10269
10550
  ],
10270
- stroke: tr,
10551
+ stroke: rr,
10271
10552
  strokeWidth: a,
10272
10553
  listening: !1,
10273
10554
  lineCap: "round"
@@ -10297,11 +10578,11 @@ var Qn = class {
10297
10578
  y: c.y
10298
10579
  };
10299
10580
  }
10300
- }, ir = "#00e5ff", ar = {
10301
- shadowColor: ir,
10581
+ }, or = "#00e5ff", sr = {
10582
+ shadowColor: or,
10302
10583
  shadowBlur: 4,
10303
10584
  shadowOpacity: .8
10304
- }, or = .3, sr = .2, cr = class {
10585
+ }, cr = .3, lr = .2, ur = class {
10305
10586
  group;
10306
10587
  layer;
10307
10588
  unsubscribe;
@@ -10339,22 +10620,22 @@ var Qn = class {
10339
10620
  }
10340
10621
  for (let t of e.data.lines) this.group.add(new h.Line({
10341
10622
  points: [...t.points],
10342
- stroke: ir,
10623
+ stroke: or,
10343
10624
  strokeWidth: .08,
10344
10625
  dash: t.dash ? [...t.dash] : void 0,
10345
10626
  listening: !1,
10346
- ...ar
10627
+ ...sr
10347
10628
  }));
10348
10629
  for (let t of e.data.arrows) this.group.add(new h.Arrow({
10349
10630
  points: [...t.points],
10350
- stroke: ir,
10351
- fill: ir,
10631
+ stroke: or,
10632
+ fill: or,
10352
10633
  strokeWidth: .08,
10353
10634
  dash: t.dash ? [...t.dash] : void 0,
10354
10635
  pointerLength: t.pointerLength,
10355
10636
  pointerWidth: t.pointerWidth,
10356
10637
  listening: !1,
10357
- ...ar
10638
+ ...sr
10358
10639
  }));
10359
10640
  this.group.visible(!0), this.layer.batchDraw();
10360
10641
  return;
@@ -10367,28 +10648,28 @@ var Qn = class {
10367
10648
  }
10368
10649
  let r = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
10369
10650
  points: [...e.points],
10370
- stroke: ir,
10371
- fill: ir,
10651
+ stroke: or,
10652
+ fill: or,
10372
10653
  strokeWidth: .08,
10373
10654
  dash: e.dash ? [...e.dash] : void 0,
10374
- pointerLength: or,
10375
- pointerWidth: sr,
10655
+ pointerLength: cr,
10656
+ pointerWidth: lr,
10376
10657
  listening: !1,
10377
- ...ar
10658
+ ...sr
10378
10659
  }) : new h.Line({
10379
10660
  points: [...e.points],
10380
- stroke: ir,
10661
+ stroke: or,
10381
10662
  strokeWidth: .08,
10382
10663
  dash: e.dash ? [...e.dash] : void 0,
10383
10664
  listening: !1,
10384
- ...ar
10665
+ ...sr
10385
10666
  });
10386
10667
  this.group.add(r), this.group.add(new h.Circle({
10387
10668
  x: e.points[0],
10388
10669
  y: e.points[1],
10389
10670
  radius: .1,
10390
10671
  fill: "#1a2030",
10391
- stroke: ir,
10672
+ stroke: or,
10392
10673
  strokeWidth: .04,
10393
10674
  listening: !1
10394
10675
  }));
@@ -10399,8 +10680,8 @@ var Qn = class {
10399
10680
  x: e.points[t],
10400
10681
  y: e.points[t + 1],
10401
10682
  radius: r ? .14 : .1,
10402
- fill: r ? "#ffffff" : ir,
10403
- stroke: r ? ir : "#ffffff",
10683
+ fill: r ? "#ffffff" : or,
10684
+ stroke: r ? or : "#ffffff",
10404
10685
  strokeWidth: r ? .06 : .04,
10405
10686
  listening: !1
10406
10687
  }));
@@ -10413,13 +10694,13 @@ var Qn = class {
10413
10694
  };
10414
10695
  //#endregion
10415
10696
  //#region src/editor/effects/GridOverlayEffect.ts
10416
- function lr(e, t) {
10697
+ function dr(e, t) {
10417
10698
  let n = e.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);
10418
10699
  if (!n) return e;
10419
10700
  let r = n[4] === void 0 ? 1 : parseFloat(n[4]);
10420
10701
  return `rgba(${n[1]}, ${n[2]}, ${n[3]}, ${Math.min(1, r * t)})`;
10421
10702
  }
10422
- var ur = class {
10703
+ var fr = class {
10423
10704
  gridShape;
10424
10705
  axisShape;
10425
10706
  labelShape;
@@ -10451,7 +10732,7 @@ var ur = class {
10451
10732
  }), this.axisShape = new h.Shape({
10452
10733
  listening: !1,
10453
10734
  visible: !1,
10454
- stroke: lr(this.gridColor, 2),
10735
+ stroke: dr(this.gridColor, 2),
10455
10736
  strokeWidth: this.gridLineWidth * 2,
10456
10737
  sceneFunc: (e, t) => {
10457
10738
  let { minX: n, maxX: r, minY: i, maxY: a } = this.bounds;
@@ -10465,7 +10746,7 @@ var ur = class {
10465
10746
  text: "(0,0)",
10466
10747
  fontSize: this.gridSize,
10467
10748
  fontFamily: "monospace",
10468
- fill: lr(this.gridColor, 2)
10749
+ fill: dr(this.gridColor, 2)
10469
10750
  }), e.add(this.gridShape), e.add(this.axisShape), e.add(this.labelShape), this.unsubscribe = D.subscribe(() => this.syncVisibility());
10470
10751
  }
10471
10752
  updateViewport(e, t, n) {
@@ -10479,7 +10760,7 @@ var ur = class {
10479
10760
  let e = this.getIsEmpty();
10480
10761
  e && (this.bounds = this.getViewportBounds()), this.gridShape.visible() !== e && (this.gridShape.visible(e), this.axisShape.visible(e), this.labelShape.visible(e), this.layer.batchDraw());
10481
10762
  }
10482
- }, dr = class {
10763
+ }, pr = class {
10483
10764
  rect;
10484
10765
  layer;
10485
10766
  unsubscribe;
@@ -10513,7 +10794,7 @@ var ur = class {
10513
10794
  };
10514
10795
  //#endregion
10515
10796
  //#region src/editor/effects/LabelHaloEffect.ts
10516
- function fr(e, t, n, r) {
10797
+ function mr(e, t, n, r) {
10517
10798
  return [
10518
10799
  {
10519
10800
  id: "nw",
@@ -10557,7 +10838,7 @@ function fr(e, t, n, r) {
10557
10838
  }
10558
10839
  ];
10559
10840
  }
10560
- var pr = class {
10841
+ var hr = class {
10561
10842
  selRect;
10562
10843
  hoverRect;
10563
10844
  previewRect;
@@ -10647,7 +10928,7 @@ var pr = class {
10647
10928
  for (let e of this.handles) e.visible(!1);
10648
10929
  return;
10649
10930
  }
10650
- 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 = fr(n, r, i, a);
10931
+ 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 = mr(n, r, i, a);
10651
10932
  for (let e = 0; e < this.handles.length; e++) {
10652
10933
  let t = this.handles[e], n = s[e];
10653
10934
  t.x(n.x - o / 2), t.y(n.y - o / 2), t.width(o), t.height(o), t.visible(!0);
@@ -10669,7 +10950,7 @@ var pr = class {
10669
10950
  };
10670
10951
  //#endregion
10671
10952
  //#region src/editor/pointerController.ts
10672
- function mr(e) {
10953
+ function gr(e) {
10673
10954
  let { container: t } = e, n = null, r = null, i = D.getState().spaceHeld, a = D.subscribe((r) => {
10674
10955
  if (!i && r.spaceHeld && n !== null) {
10675
10956
  It[r.activeTool].onCancel?.(e);
@@ -10735,10 +11016,10 @@ function mr(e) {
10735
11016
  }
10736
11017
  //#endregion
10737
11018
  //#region src/editor/scene.ts
10738
- function hr(e, t) {
11019
+ function _r(e, t) {
10739
11020
  let n = m();
10740
11021
  n.gridEnabled = !0, n.highlightCurrentRoom = !1, n.areaName = !1, n.labelRenderMode = "image", t.dataset.editorCursor = "true";
10741
- let r = new Un(e), i = new p(r, n, t), a = { current: null }, o = new dr(), s = new Wn(n.roomSize, a), c = new Yn(n.roomSize, a), l = new Qn(a), u = new $n(n.roomSize), d = new er(n.roomSize, a), f = new rr(a), h = new cr(a, n.roomSize), g = new pr(a), _ = new ur(n.gridColor, n.gridLineWidth, n.gridSize, () => {
11022
+ let r = new Gn(e), i = new p(r, n, t), a = { current: null }, o = new pr(), s = new Kn(n.roomSize, a), c = new Zn(n.roomSize, a), l = new er(a), u = new tr(n.roomSize), d = new nr(n.roomSize, a), f = new ar(a), h = new ur(a, n.roomSize), g = new hr(a), _ = new fr(n.gridColor, n.gridLineWidth, n.gridSize, () => {
10742
11023
  let e = D.getState();
10743
11024
  if (e.currentAreaId == null) return !1;
10744
11025
  let t = r.getArea(e.currentAreaId);
@@ -10768,7 +11049,7 @@ function hr(e, t) {
10768
11049
  }
10769
11050
  };
10770
11051
  a.current = v;
10771
- let y = mr({
11052
+ let y = gr({
10772
11053
  renderer: i,
10773
11054
  container: t,
10774
11055
  settings: n,
@@ -10779,12 +11060,12 @@ function hr(e, t) {
10779
11060
  }
10780
11061
  //#endregion
10781
11062
  //#region src/App.tsx
10782
- var gr = {
11063
+ var vr = {
10783
11064
  top: 104,
10784
11065
  right: 464,
10785
11066
  bottom: 24,
10786
11067
  left: 24
10787
- }, _r = {
11068
+ }, yr = {
10788
11069
  1: "select",
10789
11070
  2: "connect",
10790
11071
  3: "unlink",
@@ -10793,7 +11074,7 @@ var gr = {
10793
11074
  6: "delete",
10794
11075
  7: "pan",
10795
11076
  8: "paint"
10796
- }, vr = {
11077
+ }, br = {
10797
11078
  ArrowLeft: {
10798
11079
  dx: -1,
10799
11080
  dy: 0
@@ -10811,33 +11092,33 @@ var gr = {
10811
11092
  dy: -1
10812
11093
  }
10813
11094
  };
10814
- function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10815
- let s = r(null), c = r(null), l = O((e) => e.map), u = O((e) => e.swatchPaletteOpen), p = l != null, m = O((e) => e.currentAreaId), h = O((e) => e.currentZ), g = O((e) => e.activeTool), _ = O((e) => e.pending), v = O((e) => e.hover), y = O((e) => e.spaceHeld), b = O((e) => e.panelCollapsed), x = O((e) => e.dataVersion), C = O((e) => e.panRequest), [w, T] = i(!1), [E, k] = i(!1), [A, j] = i(() => new URLSearchParams(window.location.search).get("map")), M = n(() => a.flatMap((e) => e.swatchSets?.() ?? []), [a]), N = n(() => a.flatMap((e) => e.sidebarTabs?.() ?? []), [a]), P = n(() => a.flatMap((e) => e.roomPanelSections?.() ?? []), [a]);
11095
+ function xr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11096
+ let s = r(null), c = r(null), l = O((e) => e.map), u = O((e) => e.swatchPaletteOpen), p = l != null, m = O((e) => e.currentAreaId), h = O((e) => e.currentZ), g = O((e) => e.activeTool), _ = O((e) => e.pending), v = O((e) => e.hover), y = O((e) => e.spaceHeld), b = O((e) => e.panelCollapsed), x = O((e) => e.dataVersion), C = O((e) => e.panRequest), [w, T] = i(!1), [E, k] = i(!1), [A, j] = i(!1), [M, N] = i(() => new URLSearchParams(window.location.search).get("map")), P = n(() => a.flatMap((e) => e.swatchSets?.() ?? []), [a]), F = n(() => a.flatMap((e) => e.sidebarTabs?.() ?? []), [a]), I = n(() => a.flatMap((e) => e.roomPanelSections?.() ?? []), [a]);
10816
11097
  t(() => {
10817
- D.setState({ pluginSwatchSets: M });
10818
- }, [M]), t(() => {
11098
+ D.setState({ pluginSwatchSets: P });
11099
+ }, [P]), t(() => {
10819
11100
  a.length !== 0 && (async () => {
10820
11101
  for (let e of a) await e.onAppReady?.();
10821
11102
  })();
10822
11103
  }, []);
10823
- let F = r(l);
11104
+ let L = r(l);
10824
11105
  t(() => {
10825
- let e = F.current;
10826
- if (F.current = l, l && l !== e) for (let e of a) e.onMapOpened?.(l);
11106
+ let e = L.current;
11107
+ if (L.current = l, l && l !== e) for (let e of a) e.onMapOpened?.(l);
10827
11108
  else if (e && !l) for (let e of a) e.onMapClosed?.();
10828
11109
  }, [l]), t(() => {
10829
11110
  if (!l || !s.current) return;
10830
- let e = hr(l, s.current);
11111
+ let e = _r(l, s.current);
10831
11112
  c.current = e;
10832
11113
  let { currentAreaId: t, currentZ: n } = D.getState();
10833
- return t != null && e.setArea(t, n, gr), () => {
11114
+ return t != null && e.setArea(t, n, vr), () => {
10834
11115
  e.destroy(), c.current = null;
10835
11116
  };
10836
11117
  }, [l]), t(() => {
10837
11118
  let e = c.current;
10838
11119
  if (!e || !p || m == null) return;
10839
11120
  let t = D.getState().navigateTo;
10840
- t ? (D.setState({ navigateTo: null }), e.setAreaAt(m, h, t.mapX, t.mapY)) : e.setArea(m, h, gr);
11121
+ t ? (D.setState({ navigateTo: null }), e.setAreaAt(m, h, t.mapX, t.mapY)) : e.setArea(m, h, vr);
10841
11122
  }, [
10842
11123
  m,
10843
11124
  h,
@@ -10901,12 +11182,16 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10901
11182
  t.preventDefault(), D.getState().spaceHeld || D.setState({ spaceHeld: !0 });
10902
11183
  return;
10903
11184
  }
11185
+ if ((t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "f") {
11186
+ t.preventDefault(), j((e) => !e);
11187
+ return;
11188
+ }
10904
11189
  if ((t.ctrlKey || t.metaKey) && !t.shiftKey && t.key.toLowerCase() === "z") {
10905
- t.preventDefault(), L();
11190
+ t.preventDefault(), z();
10906
11191
  return;
10907
11192
  }
10908
11193
  if ((t.ctrlKey || t.metaKey) && (t.shiftKey && t.key.toLowerCase() === "z" || t.key.toLowerCase() === "y")) {
10909
- t.preventDefault(), R();
11194
+ t.preventDefault(), B();
10910
11195
  return;
10911
11196
  }
10912
11197
  if (t.key === "Enter") {
@@ -10924,7 +11209,7 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10924
11209
  return;
10925
11210
  }
10926
11211
  if (t.key === "Delete" || t.key === "Backspace") {
10927
- I();
11212
+ R();
10928
11213
  return;
10929
11214
  }
10930
11215
  if (t.key === "g" || t.key === "G") {
@@ -10932,13 +11217,13 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10932
11217
  return;
10933
11218
  }
10934
11219
  if (t.key === "f" || t.key === "F") {
10935
- c.current?.renderer.fitArea(gr);
11220
+ c.current?.renderer.fitArea(vr);
10936
11221
  return;
10937
11222
  }
10938
- if (_r[t.key]) {
11223
+ if (yr[t.key]) {
10939
11224
  let e = D.getState();
10940
11225
  e.pending?.kind === "customLine" && c.current && (kt(e.pending, c.current), D.bumpData()), D.setState({
10941
- activeTool: _r[t.key],
11226
+ activeTool: yr[t.key],
10942
11227
  pending: null
10943
11228
  });
10944
11229
  return;
@@ -10954,14 +11239,14 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10954
11239
  } });
10955
11240
  return;
10956
11241
  }
10957
- if (vr[t.key]) {
11242
+ if (br[t.key]) {
10958
11243
  let e = D.getState();
10959
11244
  if (e.activeTool !== "select" || !e.selection || !e.map) return;
10960
11245
  if (e.selection.kind === "label") {
10961
11246
  let { id: n, areaId: r } = e.selection, i = c.current?.reader.getLabelSnapshot(r, n);
10962
11247
  if (!i) return;
10963
11248
  t.preventDefault();
10964
- let a = (t.shiftKey ? 5 : 1) * e.gridStep, o = vr[t.key], s = o.dx * a, l = o.dy * a, u = [...i.pos], d = [
11249
+ let a = (t.shiftKey ? 5 : 1) * e.gridStep, o = br[t.key], s = o.dx * a, l = o.dy * a, u = [...i.pos], d = [
10965
11250
  i.pos[0] + s,
10966
11251
  i.pos[1] + l,
10967
11252
  i.pos[2]
@@ -10978,42 +11263,49 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10978
11263
  })), c.current?.refresh(), D.bumpData(), D.setState({ status: `Moved label ${n}` });
10979
11264
  return;
10980
11265
  }
10981
- if (e.selection.kind !== "room" || e.selection.ids.length !== 1) return;
10982
- let n = e.selection.ids[0], r = e.map.rooms[n];
10983
- if (!r) return;
11266
+ if (e.selection.kind !== "room") return;
10984
11267
  t.preventDefault();
10985
- let i = (t.shiftKey ? 5 : 1) * e.gridStep, a = vr[t.key], o = a.dx * i, s = a.dy * i, l = {
10986
- x: r.x,
10987
- y: r.y,
10988
- z: r.z
10989
- }, u = Ae(e.map, n, o, s);
10990
- c.current?.reader.moveRoom(n, r.x + o, -(r.y + s), r.z);
10991
- let d = {
10992
- x: r.x,
10993
- y: r.y,
10994
- z: r.z
10995
- };
10996
- for (let e of u) e.kind === "setCustomLine" && c.current?.reader.setCustomLine(e.roomId, e.exitName, e.data.points, e.data.color, e.data.style, e.data.arrow);
10997
- let f = {
10998
- kind: "moveRoom",
10999
- id: n,
11000
- from: l,
11001
- to: d
11002
- }, p = u.length > 0 ? {
11268
+ let n = (t.shiftKey ? 5 : 1) * e.gridStep, r = br[t.key], i = r.dx * n, a = r.dy * n, o = [];
11269
+ for (let t of e.selection.ids) {
11270
+ let n = e.map.rooms[t];
11271
+ if (!n) continue;
11272
+ let r = {
11273
+ x: n.x,
11274
+ y: n.y,
11275
+ z: n.z
11276
+ }, s = Ae(e.map, t, i, a);
11277
+ c.current?.reader.moveRoom(t, n.x + i, -(n.y + a), n.z);
11278
+ let l = {
11279
+ x: n.x,
11280
+ y: n.y,
11281
+ z: n.z
11282
+ };
11283
+ for (let e of s) e.kind === "setCustomLine" && c.current?.reader.setCustomLine(e.roomId, e.exitName, e.data.points, e.data.color, e.data.style, e.data.arrow);
11284
+ o.push({
11285
+ kind: "moveRoom",
11286
+ id: t,
11287
+ from: r,
11288
+ to: l
11289
+ }, ...s);
11290
+ }
11291
+ if (o.length === 0) return;
11292
+ let s = o.length === 1 ? o[0] : {
11003
11293
  kind: "batch",
11004
- cmds: [f, ...u]
11005
- } : f;
11294
+ cmds: o
11295
+ };
11006
11296
  D.setState((e) => ({
11007
- undo: [...e.undo, p],
11297
+ undo: [...e.undo, s],
11008
11298
  redo: []
11009
- })), c.current?.refresh(), D.bumpData(), D.setState({ status: `Moved room ${n} → (${r.x}, ${r.y}, ${r.z})` });
11299
+ })), c.current?.refresh(), D.bumpData();
11300
+ let { ids: l } = e.selection;
11301
+ D.setState({ status: l.length === 1 ? `Moved room ${l[0]} → (${e.map.rooms[l[0]]?.x}, ${e.map.rooms[l[0]]?.y}, ${e.map.rooms[l[0]]?.z})` : `Moved ${l.length} rooms` });
11010
11302
  }
11011
11303
  }
11012
11304
  };
11013
11305
  window.addEventListener("keydown", r), window.addEventListener("keyup", t), window.addEventListener("blur", n);
11014
- let i = () => c.current?.renderer.fitArea(gr);
11015
- return window.addEventListener("editor:undo", L), window.addEventListener("editor:redo", R), window.addEventListener("editor:fit", i), () => {
11016
- window.removeEventListener("keydown", r), window.removeEventListener("keyup", t), window.removeEventListener("blur", n), window.removeEventListener("editor:undo", L), window.removeEventListener("editor:redo", R), window.removeEventListener("editor:fit", i);
11306
+ let i = () => c.current?.renderer.fitArea(vr);
11307
+ return window.addEventListener("editor:undo", z), window.addEventListener("editor:redo", B), window.addEventListener("editor:fit", i), () => {
11308
+ 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);
11017
11309
  };
11018
11310
  }, []), t(() => {
11019
11311
  let e = (e) => {
@@ -11027,7 +11319,7 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11027
11319
  window.removeEventListener("dragover", e), window.removeEventListener("drop", t);
11028
11320
  };
11029
11321
  }, []);
11030
- let I = () => {
11322
+ let R = () => {
11031
11323
  let e = D.getState();
11032
11324
  if (!e.map) return;
11033
11325
  let t = e.selection;
@@ -11172,10 +11464,10 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11172
11464
  return;
11173
11465
  }
11174
11466
  }
11175
- }, L = () => {
11467
+ }, z = () => {
11176
11468
  let { changed: e, structural: t } = Oe(c.current);
11177
11469
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Undone" }));
11178
- }, R = () => {
11470
+ }, B = () => {
11179
11471
  let { changed: e, structural: t } = ke(c.current);
11180
11472
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Redone" }));
11181
11473
  };
@@ -11196,23 +11488,25 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11196
11488
  onLoadFromUrl: () => k(!0),
11197
11489
  onSave: (e) => {
11198
11490
  for (let t of a) t.onMapSave?.(e);
11199
- }
11491
+ },
11492
+ onSearchClick: () => j((e) => !e)
11200
11493
  }),
11201
11494
  /* @__PURE__ */ d(mn, {
11202
11495
  sceneRef: c,
11203
- extraTabs: N,
11204
- pluginRoomSections: P
11496
+ extraTabs: F,
11497
+ pluginRoomSections: I
11205
11498
  })
11206
11499
  ]
11207
11500
  }),
11208
11501
  /* @__PURE__ */ d(hn, { sceneRef: c }),
11209
11502
  u && /* @__PURE__ */ d(An, { sceneRef: c }),
11210
11503
  a.map((t, n) => /* @__PURE__ */ d(e, { children: t.renderOverlay?.() }, n)),
11504
+ A && p && /* @__PURE__ */ d(Mn, { onClose: () => j(!1) }),
11211
11505
  w && /* @__PURE__ */ d(le, { onClose: () => T(!1) }),
11212
- (E || A) && /* @__PURE__ */ d(de, {
11213
- initialUrl: A ?? void 0,
11506
+ (E || M) && /* @__PURE__ */ d(de, {
11507
+ initialUrl: M ?? void 0,
11214
11508
  onClose: () => {
11215
- k(!1), j(null);
11509
+ k(!1), N(null);
11216
11510
  }
11217
11511
  })
11218
11512
  ]
@@ -11220,9 +11514,9 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11220
11514
  }
11221
11515
  //#endregion
11222
11516
  //#region src/editor/mapBytes.ts
11223
- function br() {
11517
+ function Sr() {
11224
11518
  let { map: e } = D.getState();
11225
- return e ? H(e) : null;
11519
+ return e ? U(e) : null;
11226
11520
  }
11227
11521
  //#endregion
11228
- export { yr as App, br as getMapBytes, G as loadUrlIntoStore, Y as pushCommand, D as store, O as useEditorState };
11522
+ export { xr as App, Sr as getMapBytes, ie as loadUrlIntoStore, Y as pushCommand, D as store, O as useEditorState };