mudlet-map-editor 0.4.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
  }
@@ -4312,6 +4342,13 @@ var gt = .15, _t = {
4312
4342
  if (a) {
4313
4343
  let i = n.map?.rooms[a.id];
4314
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
+ }
4315
4352
  if (e.ctrlKey || e.metaKey) {
4316
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];
4317
4354
  return D.setState({ selection: t.length === 0 ? null : {
@@ -4387,6 +4424,7 @@ var gt = .15, _t = {
4387
4424
  currentX: o.x,
4388
4425
  currentY: o.y,
4389
4426
  ctrlHeld: e.ctrlKey || e.metaKey,
4427
+ shiftHeld: e.shiftKey,
4390
4428
  preExistingIds: n.selection?.kind === "room" ? n.selection.ids : []
4391
4429
  } }), t.container.setPointerCapture(e.pointerId), !0;
4392
4430
  },
@@ -4406,6 +4444,10 @@ var gt = .15, _t = {
4406
4444
  let e = new Set(i.preExistingIds);
4407
4445
  for (let t of a) e.has(t) ? e.delete(t) : e.add(t);
4408
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];
4409
4451
  } else o = a;
4410
4452
  return D.setState({
4411
4453
  pending: i,
@@ -4495,7 +4537,7 @@ var gt = .15, _t = {
4495
4537
  t.container.releasePointerCapture(e.pointerId);
4496
4538
  } catch {}
4497
4539
  let r = n.pending, i = Math.abs(r.currentX - r.startX), a = Math.abs(r.currentY - r.startY);
4498
- 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;
4499
4541
  }
4500
4542
  if (n.pending?.kind === "labelDrag" && n.map) {
4501
4543
  let e = n.pending, r = t.scene.reader.getLabelSnapshot(e.areaId, e.labelId);
@@ -5926,7 +5968,7 @@ function Gt(e) {
5926
5968
  }
5927
5969
  function Kt(e) {
5928
5970
  let t = e.includes(",") ? e.split(",")[1] : e;
5929
- return t ? re.from(t, "base64") : re.alloc(0);
5971
+ return t ? ne.from(t, "base64") : ne.alloc(0);
5930
5972
  }
5931
5973
  //#endregion
5932
5974
  //#region src/components/FontPicker.tsx
@@ -6157,7 +6199,7 @@ function Qt({ selection: e, sceneRef: n }) {
6157
6199
  from: i.noScaling,
6158
6200
  to: t
6159
6201
  }, r), r.refresh(), D.bumpData());
6160
- }, ee = (t) => {
6202
+ }, z = (t) => {
6161
6203
  let r = n.current;
6162
6204
  if (!r) return;
6163
6205
  let i = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6168,7 +6210,7 @@ function Qt({ selection: e, sceneRef: n }) {
6168
6210
  from: i.showOnTop,
6169
6211
  to: t
6170
6212
  }, r), r.refresh(), D.bumpData());
6171
- }, z = (t) => {
6213
+ }, B = (t) => {
6172
6214
  let r = n.current;
6173
6215
  if (!r) return;
6174
6216
  let i = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6187,9 +6229,9 @@ function Qt({ selection: e, sceneRef: n }) {
6187
6229
  ...i,
6188
6230
  font: a
6189
6231
  })], r), r.refresh(), D.bumpData();
6190
- }, B = () => {
6232
+ }, V = () => {
6191
6233
  M.current ||= { color: s.outlineColor };
6192
- }, V = (t) => {
6234
+ }, H = (t) => {
6193
6235
  let r = n.current, i = M.current ?? { color: s.outlineColor };
6194
6236
  if (M.current = null, !r || Xt(i.color, t)) return;
6195
6237
  let a = r.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6205,7 +6247,7 @@ function Qt({ selection: e, sceneRef: n }) {
6205
6247
  from: i.color,
6206
6248
  to: t
6207
6249
  }, ...N(o)], r), r.refresh(), D.bumpData();
6208
- }, te = () => {
6250
+ }, ee = () => {
6209
6251
  let t = n.current;
6210
6252
  if (!t) return;
6211
6253
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6224,8 +6266,8 @@ function Qt({ selection: e, sceneRef: n }) {
6224
6266
  `"${u.family}", sans-serif`
6225
6267
  ].filter(Boolean).join(" "), Math.max(...l.map((e) => i.measureText(e).width)) <= s ? (m = e, f = e + 1) : p = e - 1;
6226
6268
  }
6227
- m !== r.font.size && z({ size: m });
6228
- }, ne = () => {
6269
+ m !== r.font.size && B({ size: m });
6270
+ }, te = () => {
6229
6271
  let t = n.current;
6230
6272
  if (!t) return;
6231
6273
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6238,7 +6280,7 @@ function Qt({ selection: e, sceneRef: n }) {
6238
6280
  from: r.pixMap,
6239
6281
  to: i
6240
6282
  }, t), t.refresh(), D.bumpData());
6241
- }, re = () => {
6283
+ }, ne = () => {
6242
6284
  let t = document.createElement("input");
6243
6285
  t.type = "file", t.accept = "image/*", t.onchange = () => {
6244
6286
  let r = t.files?.[0];
@@ -6278,7 +6320,7 @@ function Qt({ selection: e, sceneRef: n }) {
6278
6320
  }, r.src = t;
6279
6321
  }, i.readAsDataURL(r);
6280
6322
  }, t.click();
6281
- }, ie = () => {
6323
+ }, re = () => {
6282
6324
  let t = n.current;
6283
6325
  if (!t) return;
6284
6326
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
@@ -6297,14 +6339,14 @@ function Qt({ selection: e, sceneRef: n }) {
6297
6339
  from: r.pixMap,
6298
6340
  to: i
6299
6341
  }], t), t.refresh(), D.setState({ labelAspectRatioLocked: !1 }), D.bumpData();
6300
- }, 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 ?? {
6301
6343
  spec: 1,
6302
6344
  r: 0,
6303
6345
  g: 0,
6304
6346
  b: 0,
6305
6347
  alpha: 0,
6306
6348
  pad: 0
6307
- }, ae = Le(G), oe = (e) => ({
6349
+ }, ae = Le(ie), oe = (e) => ({
6308
6350
  flex: 1,
6309
6351
  padding: "4px 0",
6310
6352
  fontSize: 12,
@@ -6339,18 +6381,18 @@ function Qt({ selection: e, sceneRef: n }) {
6339
6381
  overflow: "hidden"
6340
6382
  },
6341
6383
  children: [/* @__PURE__ */ d("button", {
6342
- style: oe(!H),
6384
+ style: oe(!U),
6343
6385
  onClick: () => {
6344
- H && ie();
6386
+ U && re();
6345
6387
  },
6346
6388
  children: "Text"
6347
6389
  }), /* @__PURE__ */ d("button", {
6348
6390
  style: {
6349
- ...oe(H),
6391
+ ...oe(U),
6350
6392
  borderLeft: "1px solid var(--border, #444)"
6351
6393
  },
6352
6394
  onClick: () => {
6353
- H || re();
6395
+ U || ne();
6354
6396
  },
6355
6397
  children: "Image"
6356
6398
  })]
@@ -6407,7 +6449,7 @@ function Qt({ selection: e, sceneRef: n }) {
6407
6449
  }),
6408
6450
  /* @__PURE__ */ d(Pe, {
6409
6451
  checked: s.showOnTop,
6410
- onChange: ee,
6452
+ onChange: z,
6411
6453
  description: "Show on top (foreground)"
6412
6454
  }),
6413
6455
  /* @__PURE__ */ d(Pe, {
@@ -6415,7 +6457,7 @@ function Qt({ selection: e, sceneRef: n }) {
6415
6457
  onChange: (e) => R(!e),
6416
6458
  description: "Scale with zoom"
6417
6459
  }),
6418
- H && /* @__PURE__ */ d(X, {
6460
+ U && /* @__PURE__ */ d(X, {
6419
6461
  label: "Image",
6420
6462
  children: /* @__PURE__ */ f("div", {
6421
6463
  style: {
@@ -6433,13 +6475,13 @@ function Qt({ selection: e, sceneRef: n }) {
6433
6475
  borderRadius: 3
6434
6476
  }
6435
6477
  }), /* @__PURE__ */ d("button", {
6436
- onClick: re,
6478
+ onClick: ne,
6437
6479
  style: { alignSelf: "flex-start" },
6438
6480
  children: "Replace image..."
6439
6481
  })]
6440
6482
  })
6441
6483
  }),
6442
- !H && /* @__PURE__ */ f(u, { children: [
6484
+ !U && /* @__PURE__ */ f(u, { children: [
6443
6485
  /* @__PURE__ */ d(X, {
6444
6486
  label: "Text",
6445
6487
  children: /* @__PURE__ */ d("textarea", {
@@ -6465,22 +6507,22 @@ function Qt({ selection: e, sceneRef: n }) {
6465
6507
  as: "div",
6466
6508
  children: /* @__PURE__ */ d("input", {
6467
6509
  type: "color",
6468
- defaultValue: U,
6510
+ defaultValue: W,
6469
6511
  onMouseDown: I,
6470
6512
  onBlur: (e) => L(Re(e.target.value), s.bgColor)
6471
- }, `fg-${e.id}-${U}`)
6513
+ }, `fg-${e.id}-${W}`)
6472
6514
  }), /* @__PURE__ */ d(X, {
6473
6515
  label: "BG color",
6474
6516
  as: "div",
6475
6517
  children: /* @__PURE__ */ d("input", {
6476
6518
  type: "color",
6477
- defaultValue: W,
6519
+ defaultValue: G,
6478
6520
  onMouseDown: I,
6479
6521
  onBlur: (e) => L(s.fgColor, {
6480
6522
  ...Re(e.target.value),
6481
6523
  alpha: s.bgColor.alpha
6482
6524
  })
6483
- }, `bg-${e.id}-${W}`)
6525
+ }, `bg-${e.id}-${G}`)
6484
6526
  })]
6485
6527
  }),
6486
6528
  /* @__PURE__ */ d(X, {
@@ -6526,7 +6568,7 @@ function Qt({ selection: e, sceneRef: n }) {
6526
6568
  children: /* @__PURE__ */ d(qt, {
6527
6569
  value: s.font.family,
6528
6570
  options: x,
6529
- onChange: (e) => z({ family: e })
6571
+ onChange: (e) => B({ family: e })
6530
6572
  })
6531
6573
  }),
6532
6574
  /* @__PURE__ */ d(X, {
@@ -6545,14 +6587,14 @@ function Qt({ selection: e, sceneRef: n }) {
6545
6587
  defaultValue: s.font.size,
6546
6588
  onBlur: (e) => {
6547
6589
  let t = parseInt(e.target.value, 10);
6548
- t > 0 && z({ size: t });
6590
+ t > 0 && B({ size: t });
6549
6591
  },
6550
6592
  onKeyDown: (e) => e.key === "Enter" && e.target.blur(),
6551
6593
  style: { width: 60 }
6552
6594
  }, `font-size-${e.id}-${s.font.size}`),
6553
6595
  /* @__PURE__ */ d("button", {
6554
6596
  title: "Auto-fit font size to fill label area",
6555
- onClick: te,
6597
+ onClick: ee,
6556
6598
  style: {
6557
6599
  height: 24,
6558
6600
  padding: "0 6px",
@@ -6593,7 +6635,7 @@ function Qt({ selection: e, sceneRef: n }) {
6593
6635
  ]
6594
6636
  ].map(([e, t, n]) => /* @__PURE__ */ d("button", {
6595
6637
  title: t,
6596
- onClick: () => z({ [t]: !s.font[t] }),
6638
+ onClick: () => B({ [t]: !s.font[t] }),
6597
6639
  style: {
6598
6640
  width: 24,
6599
6641
  height: 24,
@@ -6618,9 +6660,9 @@ function Qt({ selection: e, sceneRef: n }) {
6618
6660
  children: /* @__PURE__ */ d("input", {
6619
6661
  type: "color",
6620
6662
  defaultValue: ae,
6621
- onMouseDown: B,
6622
- onBlur: (e) => V({
6623
- ...G,
6663
+ onMouseDown: V,
6664
+ onBlur: (e) => H({
6665
+ ...ie,
6624
6666
  ...Re(e.target.value)
6625
6667
  })
6626
6668
  }, `outline-${e.id}-${ae}`)
@@ -6641,19 +6683,19 @@ function Qt({ selection: e, sceneRef: n }) {
6641
6683
  step: 1,
6642
6684
  value: y,
6643
6685
  style: { flex: 1 },
6644
- onPointerDown: B,
6686
+ onPointerDown: V,
6645
6687
  onChange: (e) => b(parseInt(e.target.value, 10)),
6646
6688
  onPointerUp: (e) => {
6647
6689
  let t = parseInt(e.target.value, 10);
6648
- V(t === 0 ? void 0 : {
6649
- ...G,
6690
+ H(t === 0 ? void 0 : {
6691
+ ...ie,
6650
6692
  alpha: t
6651
6693
  });
6652
6694
  },
6653
6695
  onBlur: (e) => {
6654
6696
  let t = parseInt(e.target.value, 10);
6655
- V(t === 0 ? void 0 : {
6656
- ...G,
6697
+ H(t === 0 ? void 0 : {
6698
+ ...ie,
6657
6699
  alpha: t
6658
6700
  });
6659
6701
  }
@@ -6689,7 +6731,7 @@ function Qt({ selection: e, sceneRef: n }) {
6689
6731
  className: "hint",
6690
6732
  children: "No pixmap stored"
6691
6733
  }), /* @__PURE__ */ d("button", {
6692
- onClick: ne,
6734
+ onClick: te,
6693
6735
  style: { alignSelf: "flex-start" },
6694
6736
  children: "Regenerate pixmap"
6695
6737
  })]
@@ -7008,17 +7050,17 @@ var on = [
7008
7050
  "door-locked"
7009
7051
  ];
7010
7052
  function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = [] }) {
7011
- 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);
7012
- V.current = k, t(() => (pt((e) => V.current(String(e))), () => pt(null)), []);
7013
- let te = r(m);
7014
- te.current = m;
7015
- let ne = r(g);
7016
- ne.current = g;
7017
- let re = r(v);
7018
- 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(() => {
7019
7061
  let e = a, t = l;
7020
7062
  return () => {
7021
- let n = !1, r = re.current;
7063
+ let n = !1, r = ne.current;
7022
7064
  r !== e.symbol && (Y({
7023
7065
  kind: "setRoomField",
7024
7066
  id: t,
@@ -7026,7 +7068,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7026
7068
  from: e.symbol,
7027
7069
  to: r
7028
7070
  }, s.current), n = !0);
7029
- let i = te.current;
7071
+ let i = ee.current;
7030
7072
  i !== e.name && (Y({
7031
7073
  kind: "setRoomField",
7032
7074
  id: t,
@@ -7034,7 +7076,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7034
7076
  from: e.name,
7035
7077
  to: i
7036
7078
  }, s.current), n = !0);
7037
- let a = Number(ne.current);
7079
+ let a = Number(te.current);
7038
7080
  !Number.isNaN(a) && a !== e.weight && (Y({
7039
7081
  kind: "setRoomField",
7040
7082
  id: t,
@@ -7044,11 +7086,11 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7044
7086
  }, s.current), n = !0), n && (s.current?.refresh(), D.bumpData());
7045
7087
  };
7046
7088
  }, [a]), t(() => {
7047
- 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);
7048
7090
  let e = D.getState().pending;
7049
7091
  (e?.kind === "pickExit" || e?.kind === "pickSpecialExit") && D.setState({ pending: null });
7050
7092
  }, [a]);
7051
- let ie = (e, t) => {
7093
+ let re = (e, t) => {
7052
7094
  let n = a[e], r = t;
7053
7095
  if (e === "weight" || e === "environment") {
7054
7096
  let e = Number(t);
@@ -7062,7 +7104,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7062
7104
  from: n,
7063
7105
  to: r
7064
7106
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Updated ${e} on room ${l}` }));
7065
- }, H = (e) => {
7107
+ }, U = (e) => {
7066
7108
  e !== a.environment && (Y({
7067
7109
  kind: "setRoomField",
7068
7110
  id: l,
@@ -7070,7 +7112,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7070
7112
  from: a.environment,
7071
7113
  to: e
7072
7114
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Room ${l} environment → ${e}` }));
7073
- }, U = (e) => {
7115
+ }, W = (e) => {
7074
7116
  let t = "system.fallback_symbol_color", n = a.userData?.[t] ?? null, r = e;
7075
7117
  n !== r && (Y({
7076
7118
  kind: "setUserDataEntry",
@@ -7079,7 +7121,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7079
7121
  from: n,
7080
7122
  to: r
7081
7123
  }, s.current), s.current?.refresh(), D.bumpData());
7082
- }, W = (e, t) => {
7124
+ }, G = (e, t) => {
7083
7125
  if (!o.rooms[t]) return;
7084
7126
  let n = a[e];
7085
7127
  Y({
@@ -7090,7 +7132,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7090
7132
  previous: n,
7091
7133
  reverse: null
7092
7134
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Exit ${e} → room ${t} added.` });
7093
- }, G = (e, t, n) => {
7135
+ }, ie = (e, t, n) => {
7094
7136
  Y({
7095
7137
  kind: "setDoor",
7096
7138
  roomId: l,
@@ -7219,7 +7261,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7219
7261
  style: a.customLinesStyle?.[i] ?? 1,
7220
7262
  arrow: a.customLinesArrow?.[i] ?? !1
7221
7263
  } : null, u = Re(P), d = null, f = _e[i];
7222
- if (z && f) {
7264
+ if (B && f) {
7223
7265
  let e = a?.[f];
7224
7266
  if (e !== void 0 && e !== -1) {
7225
7267
  let t = o.rooms[e], r = me[f];
@@ -7276,7 +7318,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7276
7318
  } });
7277
7319
  return;
7278
7320
  }
7279
- F("#ffffff"), L(1), ee(!1), B(!1), N(e);
7321
+ F("#ffffff"), L(1), z(!1), V(!1), N(e);
7280
7322
  }, be = (e) => /* @__PURE__ */ f("div", {
7281
7323
  className: "cl-form cl-form-inline",
7282
7324
  children: [
@@ -7331,7 +7373,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7331
7373
  }), /* @__PURE__ */ d("input", {
7332
7374
  type: "checkbox",
7333
7375
  checked: R,
7334
- onChange: (e) => ee(e.target.checked)
7376
+ onChange: (e) => z(e.target.checked)
7335
7377
  })]
7336
7378
  }),
7337
7379
  /* @__PURE__ */ f("div", {
@@ -7342,8 +7384,8 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7342
7384
  children: "Both ways"
7343
7385
  }), /* @__PURE__ */ d("input", {
7344
7386
  type: "checkbox",
7345
- checked: z,
7346
- onChange: (e) => B(e.target.checked)
7387
+ checked: B,
7388
+ onChange: (e) => V(e.target.checked)
7347
7389
  })]
7348
7390
  }),
7349
7391
  /* @__PURE__ */ f("div", {
@@ -7434,7 +7476,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7434
7476
  })),
7435
7477
  onBlur: (n) => {
7436
7478
  let r = parseInt(n.target.value, 10);
7437
- isNaN(r) || (W(t, r), j((t) => ({
7479
+ isNaN(r) || (G(t, r), j((t) => ({
7438
7480
  ...t,
7439
7481
  [e]: ""
7440
7482
  })));
@@ -7464,7 +7506,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7464
7506
  className: `cc-door-btn ${dn[u]}${c ? "" : " cc-dim"}`,
7465
7507
  title: c ? un[u] : void 0,
7466
7508
  disabled: !c,
7467
- onClick: c ? () => G(t, u, (u + 1) % 4) : void 0,
7509
+ onClick: c ? () => ie(t, u, (u + 1) % 4) : void 0,
7468
7510
  children: /* @__PURE__ */ d(en, {})
7469
7511
  }),
7470
7512
  /* @__PURE__ */ d("button", {
@@ -7528,7 +7570,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7528
7570
  children: /* @__PURE__ */ d("input", {
7529
7571
  value: m,
7530
7572
  onChange: (e) => h(e.target.value),
7531
- onBlur: () => ie("name", m),
7573
+ onBlur: () => re("name", m),
7532
7574
  onKeyDown: (e) => {
7533
7575
  e.key === "Enter" && e.target.blur();
7534
7576
  }
@@ -7559,7 +7601,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7559
7601
  map: o,
7560
7602
  sceneRef: s,
7561
7603
  currentEnvId: a.environment,
7562
- onSelect: H,
7604
+ onSelect: U,
7563
7605
  onClose: () => C(!1)
7564
7606
  })
7565
7607
  ]
@@ -7573,7 +7615,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7573
7615
  value: v,
7574
7616
  maxLength: 4,
7575
7617
  onChange: (e) => y(e.target.value),
7576
- onBlur: () => ie("symbol", v)
7618
+ onBlur: () => re("symbol", v)
7577
7619
  }),
7578
7620
  /* @__PURE__ */ d("input", {
7579
7621
  type: "color",
@@ -7582,7 +7624,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7582
7624
  title: "Symbol color (stored in userData as system.fallback_symbol_color)",
7583
7625
  onChange: (e) => x(e.target.value),
7584
7626
  onBlur: () => {
7585
- b !== null && U(b);
7627
+ b !== null && W(b);
7586
7628
  }
7587
7629
  }),
7588
7630
  /* @__PURE__ */ d("button", {
@@ -7591,7 +7633,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7591
7633
  style: { visibility: b === null ? "hidden" : "visible" },
7592
7634
  title: "Clear symbol color",
7593
7635
  onClick: () => {
7594
- x(null), U(null);
7636
+ x(null), W(null);
7595
7637
  },
7596
7638
  children: "×"
7597
7639
  })
@@ -7623,7 +7665,7 @@ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7623
7665
  value: g,
7624
7666
  title: "Room weight",
7625
7667
  onChange: (e) => _(e.target.value),
7626
- onBlur: () => ie("weight", g),
7668
+ onBlur: () => re("weight", g),
7627
7669
  onKeyDown: (e) => e.key === "Enter" && e.target.blur()
7628
7670
  }, `${l}-w`)]
7629
7671
  }, t) : xe(e))
@@ -7977,7 +8019,7 @@ function mn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7977
8019
  className: "panel-content",
7978
8020
  children: [/* @__PURE__ */ f("h3", { children: [r.ids.length, " rooms selected"] }), /* @__PURE__ */ d("p", {
7979
8021
  className: "hint",
7980
- 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."
7981
8023
  })]
7982
8024
  })]
7983
8025
  });
@@ -8093,7 +8135,7 @@ function hn({ sceneRef: e }) {
8093
8135
  }, i = (n) => {
8094
8136
  if (n.kind === "room") {
8095
8137
  let e = t.map?.rooms[n.id]?.name;
8096
- return e ? `Room ${n.id}: ${e}` : `Room ${n.id}`;
8138
+ return e && String(n.id) !== e ? `Room ${n.id}: ${e}` : `Room ${n.id}`;
8097
8139
  }
8098
8140
  if (n.kind === "label") {
8099
8141
  let t = (e.current?.reader.getLabelSnapshot(n.areaId, n.id))?.text?.trim();
@@ -8493,7 +8535,7 @@ function yn(e) {
8493
8535
  return t;
8494
8536
  }
8495
8537
  async function bn(e, t, n, r, i, a) {
8496
- 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 = {
8497
8539
  id: c,
8498
8540
  fileName: e,
8499
8541
  mapBytes: s,
@@ -8547,7 +8589,7 @@ async function Cn(e) {
8547
8589
  });
8548
8590
  }
8549
8591
  function wn(e) {
8550
- let t = ie(e.mapBytes);
8592
+ let t = re(e.mapBytes);
8551
8593
  if (Object.keys(e.imageSrcs).length > 0) for (let n of Object.values(t.labels)) for (let t of n) {
8552
8594
  let n = e.imageSrcs[String(t.id)];
8553
8595
  n && (t.imageSrc = n);
@@ -8740,46 +8782,46 @@ function An({ sceneRef: e }) {
8740
8782
  };
8741
8783
  return window.addEventListener("editor:swatchRoomPicked", e), () => window.removeEventListener("editor:swatchRoomPicked", e);
8742
8784
  }, []);
8743
- let ee = (t) => {
8785
+ let z = (t) => {
8744
8786
  let n = e.current?.reader;
8745
8787
  return n ? n.getColorValue(t) : "rgb(114,1,0)";
8746
- }, z = (e, t, n) => {
8788
+ }, B = (e, t, n) => {
8747
8789
  let r = t === void 0 ? o : t, i = n === void 0 ? s : n;
8748
8790
  D.setState({
8749
8791
  swatchSets: e,
8750
8792
  activeSwatchSetId: r,
8751
8793
  activeSwatchId: i
8752
8794
  }), w(e, r, i);
8753
- }, B = () => {
8795
+ }, V = () => {
8754
8796
  let e = v.trim() || "New Set", t = crypto.randomUUID();
8755
- z([...n, {
8797
+ B([...n, {
8756
8798
  id: t,
8757
8799
  name: e,
8758
8800
  swatches: []
8759
8801
  }], t, null), y(""), _(!1);
8760
- }, V = (e) => {
8761
- R && z(n.map((t) => t.id === R.id ? {
8802
+ }, H = (e) => {
8803
+ R && B(n.map((t) => t.id === R.id ? {
8762
8804
  ...t,
8763
8805
  name: e
8764
8806
  } : t));
8765
- }, te = () => {
8807
+ }, ee = () => {
8766
8808
  if (!R || n.length <= 1 || !window.confirm(`Delete set "${R.name}"?`)) return;
8767
8809
  let e = n.filter((e) => e.id !== R.id);
8768
- z(e, e[0]?.id ?? null, null);
8769
- }, ne = (e) => {
8810
+ B(e, e[0]?.id ?? null, null);
8811
+ }, te = (e) => {
8770
8812
  D.setState({
8771
8813
  activeSwatchSetId: e,
8772
8814
  activeSwatchId: null
8773
8815
  }), w(n, e, null);
8774
- }, re = (e) => {
8816
+ }, ne = (e) => {
8775
8817
  D.setState({ activeSwatchId: e }), w(n, o, e);
8776
- }, ie = (e) => {
8818
+ }, re = (e) => {
8777
8819
  E(e.id), A(e.name), M(e.symbol), P(e.environment), I(!1);
8778
- }, H = () => {
8779
- E("new"), A(""), M(""), P(-1), I(!1);
8780
8820
  }, U = () => {
8781
- E(null), I(!1);
8821
+ E("new"), A(""), M(""), P(-1), I(!1);
8782
8822
  }, W = () => {
8823
+ E(null), I(!1);
8824
+ }, G = () => {
8783
8825
  if (!R || !T) return;
8784
8826
  let e = k.trim() || "Swatch", t = j.slice(0, 4);
8785
8827
  if (T === "new") {
@@ -8789,11 +8831,11 @@ function An({ sceneRef: e }) {
8789
8831
  symbol: t,
8790
8832
  environment: N
8791
8833
  };
8792
- z(n.map((e) => e.id === R.id ? {
8834
+ B(n.map((e) => e.id === R.id ? {
8793
8835
  ...e,
8794
8836
  swatches: [...e.swatches, i]
8795
8837
  } : e), o, r);
8796
- } else z(n.map((n) => n.id === R.id ? {
8838
+ } else B(n.map((n) => n.id === R.id ? {
8797
8839
  ...n,
8798
8840
  swatches: n.swatches.map((n) => n.id === T ? {
8799
8841
  ...n,
@@ -8803,8 +8845,8 @@ function An({ sceneRef: e }) {
8803
8845
  } : n)
8804
8846
  } : n));
8805
8847
  E(null), I(!1);
8806
- }, G = (e) => {
8807
- R && z(n.map((t) => t.id === R.id ? {
8848
+ }, ie = (e) => {
8849
+ R && B(n.map((t) => t.id === R.id ? {
8808
8850
  ...t,
8809
8851
  swatches: t.swatches.filter((t) => t.id !== e)
8810
8852
  } : t), void 0, s === e ? null : void 0);
@@ -8847,7 +8889,7 @@ function An({ sceneRef: e }) {
8847
8889
  value: S,
8848
8890
  onChange: (e) => C(e.target.value),
8849
8891
  onKeyDown: (e) => {
8850
- 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);
8851
8893
  },
8852
8894
  autoFocus: !0
8853
8895
  }),
@@ -8855,7 +8897,7 @@ function An({ sceneRef: e }) {
8855
8897
  type: "button",
8856
8898
  className: "swatch-icon-btn",
8857
8899
  onClick: () => {
8858
- V(S), x(!1);
8900
+ H(S), x(!1);
8859
8901
  },
8860
8902
  children: "✓"
8861
8903
  }),
@@ -8868,7 +8910,7 @@ function An({ sceneRef: e }) {
8868
8910
  ] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("select", {
8869
8911
  className: "swatch-set-select",
8870
8912
  value: R?.id ?? "",
8871
- onChange: (e) => ne(e.target.value),
8913
+ onChange: (e) => te(e.target.value),
8872
8914
  children: L.map((e) => /* @__PURE__ */ d("option", {
8873
8915
  value: e.id,
8874
8916
  children: e.name
@@ -8886,7 +8928,7 @@ function An({ sceneRef: e }) {
8886
8928
  className: "swatch-icon-btn swatch-icon-btn-danger",
8887
8929
  title: "Delete set",
8888
8930
  disabled: n.length <= 1,
8889
- onClick: te,
8931
+ onClick: ee,
8890
8932
  children: "🗑"
8891
8933
  })] })] }), g ? /* @__PURE__ */ f(u, { children: [
8892
8934
  /* @__PURE__ */ d("input", {
@@ -8895,14 +8937,14 @@ function An({ sceneRef: e }) {
8895
8937
  value: v,
8896
8938
  onChange: (e) => y(e.target.value),
8897
8939
  onKeyDown: (e) => {
8898
- e.key === "Enter" && B(), e.key === "Escape" && (_(!1), y(""));
8940
+ e.key === "Enter" && V(), e.key === "Escape" && (_(!1), y(""));
8899
8941
  },
8900
8942
  autoFocus: !0
8901
8943
  }),
8902
8944
  /* @__PURE__ */ d("button", {
8903
8945
  type: "button",
8904
8946
  className: "swatch-icon-btn",
8905
- onClick: B,
8947
+ onClick: V,
8906
8948
  children: "✓"
8907
8949
  }),
8908
8950
  /* @__PURE__ */ d("button", {
@@ -8925,12 +8967,12 @@ function An({ sceneRef: e }) {
8925
8967
  className: "swatch-grid",
8926
8968
  children: [R.swatches.map((e) => /* @__PURE__ */ f("div", {
8927
8969
  className: `swatch-chip${s === e.id ? " active" : ""}${T === e.id ? " editing" : ""}`,
8928
- onClick: () => re(e.id),
8970
+ onClick: () => ne(e.id),
8929
8971
  title: `${e.name} · env ${e.environment}${e.symbol ? ` · "${e.symbol}"` : ""}`,
8930
8972
  children: [
8931
8973
  /* @__PURE__ */ d("span", {
8932
8974
  className: "swatch-chip-env",
8933
- style: { background: ee(e.environment) }
8975
+ style: { background: z(e.environment) }
8934
8976
  }),
8935
8977
  e.symbol && /* @__PURE__ */ d("span", {
8936
8978
  className: "swatch-chip-symbol",
@@ -8945,7 +8987,7 @@ function An({ sceneRef: e }) {
8945
8987
  className: "swatch-chip-edit",
8946
8988
  title: "Edit",
8947
8989
  onClick: (t) => {
8948
- t.stopPropagation(), ie(e);
8990
+ t.stopPropagation(), re(e);
8949
8991
  },
8950
8992
  children: "✏"
8951
8993
  }), /* @__PURE__ */ d("button", {
@@ -8953,7 +8995,7 @@ function An({ sceneRef: e }) {
8953
8995
  className: "swatch-chip-del",
8954
8996
  title: "Delete",
8955
8997
  onClick: (t) => {
8956
- t.stopPropagation(), G(e.id);
8998
+ t.stopPropagation(), ie(e.id);
8957
8999
  },
8958
9000
  children: "×"
8959
9001
  })] })
@@ -8962,7 +9004,7 @@ function An({ sceneRef: e }) {
8962
9004
  type: "button",
8963
9005
  className: "swatch-add-btn",
8964
9006
  title: "Add swatch",
8965
- onClick: H,
9007
+ onClick: U,
8966
9008
  children: "+"
8967
9009
  })]
8968
9010
  }),
@@ -8983,7 +9025,7 @@ function An({ sceneRef: e }) {
8983
9025
  value: k,
8984
9026
  onChange: (e) => A(e.target.value),
8985
9027
  onKeyDown: (e) => {
8986
- e.key === "Enter" && W(), e.key === "Escape" && U();
9028
+ e.key === "Enter" && G(), e.key === "Escape" && W();
8987
9029
  },
8988
9030
  autoFocus: !0
8989
9031
  }),
@@ -8994,7 +9036,7 @@ function An({ sceneRef: e }) {
8994
9036
  value: j,
8995
9037
  onChange: (e) => M(e.target.value),
8996
9038
  onKeyDown: (e) => {
8997
- e.key === "Enter" && W(), e.key === "Escape" && U();
9039
+ e.key === "Enter" && G(), e.key === "Escape" && W();
8998
9040
  }
8999
9041
  }),
9000
9042
  /* @__PURE__ */ f("div", {
@@ -9002,7 +9044,7 @@ function An({ sceneRef: e }) {
9002
9044
  children: [/* @__PURE__ */ d("button", {
9003
9045
  type: "button",
9004
9046
  className: "swatch-env-btn",
9005
- style: { background: ee(N) },
9047
+ style: { background: z(N) },
9006
9048
  title: `Env ${N === -1 ? "none" : N} — click to change`,
9007
9049
  onClick: () => I((e) => !e),
9008
9050
  children: /* @__PURE__ */ d("span", {
@@ -9030,14 +9072,14 @@ function An({ sceneRef: e }) {
9030
9072
  type: "button",
9031
9073
  className: "swatch-edit-ok",
9032
9074
  title: "Save",
9033
- onClick: W,
9075
+ onClick: G,
9034
9076
  children: "✓"
9035
9077
  }),
9036
9078
  /* @__PURE__ */ d("button", {
9037
9079
  type: "button",
9038
9080
  className: "swatch-edit-cancel",
9039
9081
  title: "Cancel",
9040
- onClick: U,
9082
+ onClick: W,
9041
9083
  children: "✕"
9042
9084
  })
9043
9085
  ]
@@ -9050,15 +9092,257 @@ function An({ sceneRef: e }) {
9050
9092
  });
9051
9093
  }
9052
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
9053
9337
  //#region src/editor/reader/EditorMapReader.ts
9054
- var jn = {
9338
+ var Nn = {
9055
9339
  1: "solid line",
9056
9340
  2: "dash line",
9057
9341
  3: "dot line",
9058
9342
  4: "dash dot line",
9059
9343
  5: "dash dot dot line"
9060
9344
  };
9061
- function Mn(e, t) {
9345
+ function Pn(e, t) {
9062
9346
  let n = {
9063
9347
  id: e,
9064
9348
  __raw: t
@@ -9147,7 +9431,7 @@ function Mn(e, t) {
9147
9431
  g: 255,
9148
9432
  b: 255
9149
9433
  },
9150
- style: jn[t.customLinesStyle?.[r]] ?? "solid line",
9434
+ style: Nn[t.customLinesStyle?.[r]] ?? "solid line",
9151
9435
  arrow: t.customLinesArrow?.[r] ?? !1
9152
9436
  }
9153
9437
  };
@@ -9158,7 +9442,7 @@ function Mn(e, t) {
9158
9442
  configurable: !0
9159
9443
  }), n;
9160
9444
  }
9161
- function Nn(e) {
9445
+ function Fn(e) {
9162
9446
  let t = {
9163
9447
  north: "south",
9164
9448
  south: "north",
@@ -9224,7 +9508,7 @@ function Nn(e) {
9224
9508
  }
9225
9509
  return r;
9226
9510
  }
9227
- function Pn(e) {
9511
+ function In(e) {
9228
9512
  if (!e || e.length === 0) return "";
9229
9513
  if (typeof e == "string") return e.includes(",") ? e.split(",")[1] : e;
9230
9514
  try {
@@ -9233,10 +9517,10 @@ function Pn(e) {
9233
9517
  return "";
9234
9518
  }
9235
9519
  }
9236
- function Fn(e) {
9237
- e.pixMapBase64 === void 0 && (e.pixMapBase64 = Pn(e.pixMap));
9520
+ function Ln(e) {
9521
+ e.pixMapBase64 === void 0 && (e.pixMapBase64 = In(e.pixMap));
9238
9522
  }
9239
- function In(e, t) {
9523
+ function Rn(e, t) {
9240
9524
  let n = e.id;
9241
9525
  if (!e.font) {
9242
9526
  let r = t[`system.labelFont_${n}`];
@@ -9266,7 +9550,7 @@ function In(e, t) {
9266
9550
  });
9267
9551
  }
9268
9552
  }
9269
- function Ln(e, t) {
9553
+ function zn(e, t) {
9270
9554
  let n = e.id, r = e.font;
9271
9555
  if (r?.family) {
9272
9556
  let e = r.bold ? 75 : 50;
@@ -9277,7 +9561,7 @@ function Ln(e, t) {
9277
9561
  t[`system.labelOutlineColor_${n}`] = `${r}|${i}|${a}|${o}`;
9278
9562
  } else t[`system.labelOutlineColor_${n}`] = "0|0|0|0";
9279
9563
  }
9280
- function Rn(e) {
9564
+ function Bn(e) {
9281
9565
  return {
9282
9566
  id: e.id,
9283
9567
  pos: [...e.pos],
@@ -9293,7 +9577,7 @@ function Rn(e) {
9293
9577
  imageSrc: e.imageSrc
9294
9578
  };
9295
9579
  }
9296
- var zn = class {
9580
+ var Vn = class {
9297
9581
  constructor(e, t) {
9298
9582
  this.rooms = e, this.labels = t;
9299
9583
  }
@@ -9323,7 +9607,7 @@ var zn = class {
9323
9607
  setLabels(e) {
9324
9608
  this.labels = e;
9325
9609
  }
9326
- }, Bn = class {
9610
+ }, Hn = class {
9327
9611
  planes = {};
9328
9612
  exits = /* @__PURE__ */ new Map();
9329
9613
  version = 0;
@@ -9391,19 +9675,19 @@ var zn = class {
9391
9675
  let t = {};
9392
9676
  for (let [n, r] of Object.entries(e)) {
9393
9677
  let e = Number(n);
9394
- 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));
9395
9679
  }
9396
9680
  this.planes = t;
9397
9681
  }
9398
9682
  rebuildExits() {
9399
- this.exits = Nn(this.rooms);
9683
+ this.exits = Fn(this.rooms);
9400
9684
  }
9401
9685
  };
9402
- function Vn(e) {
9686
+ function Un(e) {
9403
9687
  let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
9404
9688
  return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
9405
9689
  }
9406
- var Hn = {
9690
+ var Wn = {
9407
9691
  rgb: [
9408
9692
  114,
9409
9693
  1,
@@ -9416,17 +9700,17 @@ var Hn = {
9416
9700
  225
9417
9701
  ],
9418
9702
  symbolColorValue: "rgb(225,225,225)"
9419
- }, Un = class {
9703
+ }, Gn = class {
9420
9704
  rooms = {};
9421
9705
  areas = {};
9422
9706
  colors = {};
9423
9707
  constructor(e) {
9424
9708
  this.raw = e;
9425
- let { colors: t } = U(e);
9709
+ let { colors: t } = W(e);
9426
9710
  for (let e of t) this.colors[e.envId] = {
9427
9711
  rgb: e.colors,
9428
9712
  rgbValue: `rgb(${e.colors.join(",")})`,
9429
- symbolColor: Vn(e.colors) > .41 ? [
9713
+ symbolColor: Un(e.colors) > .41 ? [
9430
9714
  25,
9431
9715
  25,
9432
9716
  25
@@ -9435,19 +9719,19 @@ var Hn = {
9435
9719
  255,
9436
9720
  255
9437
9721
  ],
9438
- 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)"
9439
9723
  };
9440
9724
  for (let [t, n] of Object.entries(e.areas)) {
9441
9725
  let r = Number(t), i = [];
9442
9726
  for (let t of n.rooms) {
9443
9727
  let n = e.rooms[t];
9444
9728
  if (!n) continue;
9445
- let r = Mn(t, n);
9729
+ let r = Pn(t, n);
9446
9730
  this.rooms[t] = r, i.push(r);
9447
9731
  }
9448
9732
  let a = e.labels?.[r] ?? [], o = e.areas[r]?.userData ?? {};
9449
- for (let e of a) Fn(e), In(e, o);
9450
- 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)));
9451
9735
  }
9452
9736
  }
9453
9737
  toRendererLabel(e, t) {
@@ -9504,10 +9788,10 @@ var Hn = {
9504
9788
  return !1;
9505
9789
  }
9506
9790
  getColorValue(e) {
9507
- return this.colors[e]?.rgbValue ?? Hn.rgbValue;
9791
+ return this.colors[e]?.rgbValue ?? Wn.rgbValue;
9508
9792
  }
9509
9793
  getSymbolColor(e, t) {
9510
- 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(",");
9511
9795
  return r === 1 ? `rgba(${i})` : `rgba(${i}, ${r})`;
9512
9796
  }
9513
9797
  moveRoom(e, t, n, r) {
@@ -9541,7 +9825,7 @@ var Hn = {
9541
9825
  this.raw.rooms[e] = t;
9542
9826
  let n = this.raw.areas[t.area];
9543
9827
  n && !n.rooms.includes(e) && n.rooms.push(e);
9544
- let r = Mn(e, t);
9828
+ let r = Pn(e, t);
9545
9829
  this.rooms[e] = r, this.areas[t.area]?.addRoomLive(r);
9546
9830
  }
9547
9831
  setSpecialExit(e, t, n) {
@@ -9637,7 +9921,7 @@ var Hn = {
9637
9921
  isZone: !1,
9638
9922
  zoneAreaRef: -1,
9639
9923
  userData: {}
9640
- }, 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, [], []);
9641
9925
  }
9642
9926
  removeArea(e) {
9643
9927
  delete this.raw.areas[e], delete this.raw.areaNames[e], delete this.areas[e];
@@ -9665,11 +9949,11 @@ var Hn = {
9665
9949
  }
9666
9950
  setCustomEnvColor(e, t) {
9667
9951
  t === null ? delete this.raw.mCustomEnvColors[e] : this.raw.mCustomEnvColors[e] = t;
9668
- let { colors: n } = U(this.raw);
9952
+ let { colors: n } = W(this.raw);
9669
9953
  for (let e of n) this.colors[e.envId] = {
9670
9954
  rgb: e.colors,
9671
9955
  rgbValue: `rgb(${e.colors.join(",")})`,
9672
- symbolColor: Vn(e.colors) > .41 ? [
9956
+ symbolColor: Un(e.colors) > .41 ? [
9673
9957
  25,
9674
9958
  25,
9675
9959
  25
@@ -9678,13 +9962,13 @@ var Hn = {
9678
9962
  255,
9679
9963
  255
9680
9964
  ],
9681
- 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)"
9682
9966
  };
9683
9967
  t === null && delete this.colors[e];
9684
9968
  }
9685
9969
  getLabelSnapshot(e, t) {
9686
9970
  let n = this.raw.labels[e]?.find((e) => e.id === t);
9687
- return n ? Rn(n) : null;
9971
+ return n ? Bn(n) : null;
9688
9972
  }
9689
9973
  addLabel(e, t) {
9690
9974
  this.raw.labels[e] || (this.raw.labels[e] = []);
@@ -9706,7 +9990,7 @@ var Hn = {
9706
9990
  };
9707
9991
  this.raw.labels[e].push(r);
9708
9992
  let i = this.raw.areas[e]?.userData;
9709
- i && Ln(r, i), this.syncRendererLabels(e);
9993
+ i && zn(r, i), this.syncRendererLabels(e);
9710
9994
  }
9711
9995
  removeLabel(e, t) {
9712
9996
  if (!this.raw.labels[e]) return;
@@ -9739,14 +10023,14 @@ var Hn = {
9739
10023
  if (!r) return;
9740
10024
  r.font = { ...n };
9741
10025
  let i = this.raw.areas[e]?.userData;
9742
- i && Ln(r, i), this.syncRendererLabels(e);
10026
+ i && zn(r, i), this.syncRendererLabels(e);
9743
10027
  }
9744
10028
  setLabelOutlineColor(e, t, n) {
9745
10029
  let r = this.raw.labels[e]?.find((e) => e.id === t);
9746
10030
  if (!r) return;
9747
10031
  r.outlineColor = n ? { ...n } : void 0;
9748
10032
  let i = this.raw.areas[e]?.userData;
9749
- i && Ln(r, i), this.syncRendererLabels(e);
10033
+ i && zn(r, i), this.syncRendererLabels(e);
9750
10034
  }
9751
10035
  setLabelNoScaling(e, t, n) {
9752
10036
  let r = this.raw.labels[e]?.find((e) => e.id === t);
@@ -9777,10 +10061,10 @@ var Hn = {
9777
10061
  restoreAreaWithRooms(e, t, n, r) {
9778
10062
  let i = [];
9779
10063
  for (let { id: e, room: t } of n) {
9780
- let n = Mn(e, t);
10064
+ let n = Pn(e, t);
9781
10065
  this.rooms[e] = n, i.push(n);
9782
10066
  }
9783
- this.areas[e] = new Bn(e, t, i, []);
10067
+ this.areas[e] = new Hn(e, t, i, []);
9784
10068
  for (let e of r) {
9785
10069
  let t = this.areas[e];
9786
10070
  t && (t.rebuildExits(), t.markDirty());
@@ -9819,7 +10103,7 @@ var Hn = {
9819
10103
  }
9820
10104
  for (let e of this.getAreas()) n.has(e.getAreaId()) || e.rebuildExits();
9821
10105
  }
9822
- }, Wn = class {
10106
+ }, Kn = class {
9823
10107
  rects = /* @__PURE__ */ new Map();
9824
10108
  layer;
9825
10109
  unsubscribe;
@@ -9863,7 +10147,7 @@ var Hn = {
9863
10147
  }
9864
10148
  this.layer.batchDraw();
9865
10149
  }
9866
- }, Gn = "#ffcc00", Kn = .9, qn = .3, Jn = .2, Yn = class {
10150
+ }, qn = "#ffcc00", Jn = .9, Yn = .3, Xn = .2, Zn = class {
9867
10151
  roomRect;
9868
10152
  linkGroup;
9869
10153
  layer;
@@ -9874,7 +10158,7 @@ var Hn = {
9874
10158
  }
9875
10159
  attach(e) {
9876
10160
  this.layer = e, this.roomRect = new h.Rect({
9877
- stroke: Gn,
10161
+ stroke: qn,
9878
10162
  strokeWidth: .06,
9879
10163
  listening: !1,
9880
10164
  visible: !1,
@@ -9922,23 +10206,23 @@ var Hn = {
9922
10206
  }
9923
10207
  for (let t of e.data.lines) this.linkGroup.add(new h.Line({
9924
10208
  points: [...t.points],
9925
- stroke: Gn,
10209
+ stroke: qn,
9926
10210
  strokeWidth: r,
9927
10211
  dash: t.dash ? [...t.dash] : void 0,
9928
10212
  listening: !1,
9929
10213
  lineCap: "round",
9930
- opacity: Kn
10214
+ opacity: Jn
9931
10215
  }));
9932
10216
  for (let t of e.data.arrows) this.linkGroup.add(new h.Arrow({
9933
10217
  points: [...t.points],
9934
- stroke: Gn,
9935
- fill: Gn,
10218
+ stroke: qn,
10219
+ fill: qn,
9936
10220
  strokeWidth: r,
9937
10221
  dash: t.dash ? [...t.dash] : void 0,
9938
10222
  pointerLength: t.pointerLength,
9939
10223
  pointerWidth: t.pointerWidth,
9940
10224
  listening: !1,
9941
- opacity: Kn
10225
+ opacity: Jn
9942
10226
  }));
9943
10227
  this.linkGroup.visible(!0);
9944
10228
  } else if (t.kind === "customLine") {
@@ -9949,32 +10233,32 @@ var Hn = {
9949
10233
  }
9950
10234
  let i = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
9951
10235
  points: [...e.points],
9952
- stroke: Gn,
9953
- fill: Gn,
10236
+ stroke: qn,
10237
+ fill: qn,
9954
10238
  strokeWidth: r,
9955
10239
  dash: e.dash ? [...e.dash] : void 0,
9956
- pointerLength: qn,
9957
- pointerWidth: Jn,
10240
+ pointerLength: Yn,
10241
+ pointerWidth: Xn,
9958
10242
  listening: !1,
9959
10243
  lineCap: "round",
9960
10244
  lineJoin: "round",
9961
- opacity: Kn
10245
+ opacity: Jn
9962
10246
  }) : new h.Line({
9963
10247
  points: [...e.points],
9964
- stroke: Gn,
10248
+ stroke: qn,
9965
10249
  strokeWidth: r,
9966
10250
  dash: e.dash ? [...e.dash] : void 0,
9967
10251
  listening: !1,
9968
10252
  lineCap: "round",
9969
10253
  lineJoin: "round",
9970
- opacity: Kn
10254
+ opacity: Jn
9971
10255
  });
9972
10256
  this.linkGroup.add(i), this.linkGroup.visible(!0);
9973
10257
  }
9974
10258
  this.layer.batchDraw();
9975
10259
  }
9976
- }, Xn = .6;
9977
- function Zn(e) {
10260
+ }, Qn = .6;
10261
+ function $n(e) {
9978
10262
  for (let [t, n, r] of ot) if (r === e) return {
9979
10263
  ox: t,
9980
10264
  oy: n
@@ -9984,7 +10268,7 @@ function Zn(e) {
9984
10268
  oy: 0
9985
10269
  };
9986
10270
  }
9987
- var Qn = class {
10271
+ var er = class {
9988
10272
  line;
9989
10273
  dirLabel;
9990
10274
  layer;
@@ -10031,14 +10315,14 @@ var Qn = class {
10031
10315
  }
10032
10316
  let r = n.getRenderRoom(t.sourceId);
10033
10317
  if (!r) return;
10034
- 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;
10035
10319
  if (t.sourceDir) {
10036
- let { ox: e, oy: n } = Zn(t.sourceDir);
10320
+ let { ox: e, oy: n } = $n(t.sourceDir);
10037
10321
  o = r.x + e * a, s = r.y + n * a;
10038
10322
  }
10039
10323
  let c, l;
10040
10324
  if (i && t.targetDir) {
10041
- let { ox: e, oy: n } = Zn(t.targetDir);
10325
+ let { ox: e, oy: n } = $n(t.targetDir);
10042
10326
  c = i.x + e * a, l = i.y + n * a;
10043
10327
  } else i ? (c = i.x, l = i.y) : (c = t.cursorMap?.x ?? r.x, l = t.cursorMap?.y ?? r.y);
10044
10328
  let u = !0, d = "";
@@ -10059,7 +10343,7 @@ var Qn = class {
10059
10343
  l
10060
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();
10061
10345
  }
10062
- }, $n = class {
10346
+ }, tr = class {
10063
10347
  rect;
10064
10348
  layer;
10065
10349
  unsubscribe;
@@ -10095,7 +10379,7 @@ var Qn = class {
10095
10379
  }
10096
10380
  this.rect.x(t.x), this.rect.y(t.y), this.rect.visible(!0), this.layer.batchDraw();
10097
10381
  }
10098
- }, er = class {
10382
+ }, nr = class {
10099
10383
  source;
10100
10384
  target;
10101
10385
  layer;
@@ -10173,7 +10457,7 @@ var Qn = class {
10173
10457
  }
10174
10458
  this.layer.batchDraw();
10175
10459
  }
10176
- }, tr = "rgba(255, 220, 60, 0.9)", nr = .55, rr = class {
10460
+ }, rr = "rgba(255, 220, 60, 0.9)", ir = .55, ar = class {
10177
10461
  group;
10178
10462
  layer;
10179
10463
  unsubscribe;
@@ -10246,14 +10530,14 @@ var Qn = class {
10246
10530
  if (o) {
10247
10531
  let t = this.resolveTargetRoom(e, o.roomId, o.exitName);
10248
10532
  if (t) {
10249
- 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({
10250
10534
  points: [
10251
10535
  e - r,
10252
10536
  n,
10253
10537
  e + r,
10254
10538
  n
10255
10539
  ],
10256
- stroke: tr,
10540
+ stroke: rr,
10257
10541
  strokeWidth: a,
10258
10542
  listening: !1,
10259
10543
  lineCap: "round"
@@ -10264,7 +10548,7 @@ var Qn = class {
10264
10548
  e,
10265
10549
  n + r
10266
10550
  ],
10267
- stroke: tr,
10551
+ stroke: rr,
10268
10552
  strokeWidth: a,
10269
10553
  listening: !1,
10270
10554
  lineCap: "round"
@@ -10294,11 +10578,11 @@ var Qn = class {
10294
10578
  y: c.y
10295
10579
  };
10296
10580
  }
10297
- }, ir = "#00e5ff", ar = {
10298
- shadowColor: ir,
10581
+ }, or = "#00e5ff", sr = {
10582
+ shadowColor: or,
10299
10583
  shadowBlur: 4,
10300
10584
  shadowOpacity: .8
10301
- }, or = .3, sr = .2, cr = class {
10585
+ }, cr = .3, lr = .2, ur = class {
10302
10586
  group;
10303
10587
  layer;
10304
10588
  unsubscribe;
@@ -10336,22 +10620,22 @@ var Qn = class {
10336
10620
  }
10337
10621
  for (let t of e.data.lines) this.group.add(new h.Line({
10338
10622
  points: [...t.points],
10339
- stroke: ir,
10623
+ stroke: or,
10340
10624
  strokeWidth: .08,
10341
10625
  dash: t.dash ? [...t.dash] : void 0,
10342
10626
  listening: !1,
10343
- ...ar
10627
+ ...sr
10344
10628
  }));
10345
10629
  for (let t of e.data.arrows) this.group.add(new h.Arrow({
10346
10630
  points: [...t.points],
10347
- stroke: ir,
10348
- fill: ir,
10631
+ stroke: or,
10632
+ fill: or,
10349
10633
  strokeWidth: .08,
10350
10634
  dash: t.dash ? [...t.dash] : void 0,
10351
10635
  pointerLength: t.pointerLength,
10352
10636
  pointerWidth: t.pointerWidth,
10353
10637
  listening: !1,
10354
- ...ar
10638
+ ...sr
10355
10639
  }));
10356
10640
  this.group.visible(!0), this.layer.batchDraw();
10357
10641
  return;
@@ -10364,28 +10648,28 @@ var Qn = class {
10364
10648
  }
10365
10649
  let r = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
10366
10650
  points: [...e.points],
10367
- stroke: ir,
10368
- fill: ir,
10651
+ stroke: or,
10652
+ fill: or,
10369
10653
  strokeWidth: .08,
10370
10654
  dash: e.dash ? [...e.dash] : void 0,
10371
- pointerLength: or,
10372
- pointerWidth: sr,
10655
+ pointerLength: cr,
10656
+ pointerWidth: lr,
10373
10657
  listening: !1,
10374
- ...ar
10658
+ ...sr
10375
10659
  }) : new h.Line({
10376
10660
  points: [...e.points],
10377
- stroke: ir,
10661
+ stroke: or,
10378
10662
  strokeWidth: .08,
10379
10663
  dash: e.dash ? [...e.dash] : void 0,
10380
10664
  listening: !1,
10381
- ...ar
10665
+ ...sr
10382
10666
  });
10383
10667
  this.group.add(r), this.group.add(new h.Circle({
10384
10668
  x: e.points[0],
10385
10669
  y: e.points[1],
10386
10670
  radius: .1,
10387
10671
  fill: "#1a2030",
10388
- stroke: ir,
10672
+ stroke: or,
10389
10673
  strokeWidth: .04,
10390
10674
  listening: !1
10391
10675
  }));
@@ -10396,8 +10680,8 @@ var Qn = class {
10396
10680
  x: e.points[t],
10397
10681
  y: e.points[t + 1],
10398
10682
  radius: r ? .14 : .1,
10399
- fill: r ? "#ffffff" : ir,
10400
- stroke: r ? ir : "#ffffff",
10683
+ fill: r ? "#ffffff" : or,
10684
+ stroke: r ? or : "#ffffff",
10401
10685
  strokeWidth: r ? .06 : .04,
10402
10686
  listening: !1
10403
10687
  }));
@@ -10410,13 +10694,13 @@ var Qn = class {
10410
10694
  };
10411
10695
  //#endregion
10412
10696
  //#region src/editor/effects/GridOverlayEffect.ts
10413
- function lr(e, t) {
10697
+ function dr(e, t) {
10414
10698
  let n = e.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);
10415
10699
  if (!n) return e;
10416
10700
  let r = n[4] === void 0 ? 1 : parseFloat(n[4]);
10417
10701
  return `rgba(${n[1]}, ${n[2]}, ${n[3]}, ${Math.min(1, r * t)})`;
10418
10702
  }
10419
- var ur = class {
10703
+ var fr = class {
10420
10704
  gridShape;
10421
10705
  axisShape;
10422
10706
  labelShape;
@@ -10448,7 +10732,7 @@ var ur = class {
10448
10732
  }), this.axisShape = new h.Shape({
10449
10733
  listening: !1,
10450
10734
  visible: !1,
10451
- stroke: lr(this.gridColor, 2),
10735
+ stroke: dr(this.gridColor, 2),
10452
10736
  strokeWidth: this.gridLineWidth * 2,
10453
10737
  sceneFunc: (e, t) => {
10454
10738
  let { minX: n, maxX: r, minY: i, maxY: a } = this.bounds;
@@ -10462,7 +10746,7 @@ var ur = class {
10462
10746
  text: "(0,0)",
10463
10747
  fontSize: this.gridSize,
10464
10748
  fontFamily: "monospace",
10465
- fill: lr(this.gridColor, 2)
10749
+ fill: dr(this.gridColor, 2)
10466
10750
  }), e.add(this.gridShape), e.add(this.axisShape), e.add(this.labelShape), this.unsubscribe = D.subscribe(() => this.syncVisibility());
10467
10751
  }
10468
10752
  updateViewport(e, t, n) {
@@ -10476,7 +10760,7 @@ var ur = class {
10476
10760
  let e = this.getIsEmpty();
10477
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());
10478
10762
  }
10479
- }, dr = class {
10763
+ }, pr = class {
10480
10764
  rect;
10481
10765
  layer;
10482
10766
  unsubscribe;
@@ -10510,7 +10794,7 @@ var ur = class {
10510
10794
  };
10511
10795
  //#endregion
10512
10796
  //#region src/editor/effects/LabelHaloEffect.ts
10513
- function fr(e, t, n, r) {
10797
+ function mr(e, t, n, r) {
10514
10798
  return [
10515
10799
  {
10516
10800
  id: "nw",
@@ -10554,7 +10838,7 @@ function fr(e, t, n, r) {
10554
10838
  }
10555
10839
  ];
10556
10840
  }
10557
- var pr = class {
10841
+ var hr = class {
10558
10842
  selRect;
10559
10843
  hoverRect;
10560
10844
  previewRect;
@@ -10644,7 +10928,7 @@ var pr = class {
10644
10928
  for (let e of this.handles) e.visible(!1);
10645
10929
  return;
10646
10930
  }
10647
- 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);
10648
10932
  for (let e = 0; e < this.handles.length; e++) {
10649
10933
  let t = this.handles[e], n = s[e];
10650
10934
  t.x(n.x - o / 2), t.y(n.y - o / 2), t.width(o), t.height(o), t.visible(!0);
@@ -10666,7 +10950,7 @@ var pr = class {
10666
10950
  };
10667
10951
  //#endregion
10668
10952
  //#region src/editor/pointerController.ts
10669
- function mr(e) {
10953
+ function gr(e) {
10670
10954
  let { container: t } = e, n = null, r = null, i = D.getState().spaceHeld, a = D.subscribe((r) => {
10671
10955
  if (!i && r.spaceHeld && n !== null) {
10672
10956
  It[r.activeTool].onCancel?.(e);
@@ -10732,10 +11016,10 @@ function mr(e) {
10732
11016
  }
10733
11017
  //#endregion
10734
11018
  //#region src/editor/scene.ts
10735
- function hr(e, t) {
11019
+ function _r(e, t) {
10736
11020
  let n = m();
10737
11021
  n.gridEnabled = !0, n.highlightCurrentRoom = !1, n.areaName = !1, n.labelRenderMode = "image", t.dataset.editorCursor = "true";
10738
- 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, () => {
10739
11023
  let e = D.getState();
10740
11024
  if (e.currentAreaId == null) return !1;
10741
11025
  let t = r.getArea(e.currentAreaId);
@@ -10765,7 +11049,7 @@ function hr(e, t) {
10765
11049
  }
10766
11050
  };
10767
11051
  a.current = v;
10768
- let y = mr({
11052
+ let y = gr({
10769
11053
  renderer: i,
10770
11054
  container: t,
10771
11055
  settings: n,
@@ -10776,12 +11060,12 @@ function hr(e, t) {
10776
11060
  }
10777
11061
  //#endregion
10778
11062
  //#region src/App.tsx
10779
- var gr = {
11063
+ var vr = {
10780
11064
  top: 104,
10781
11065
  right: 464,
10782
11066
  bottom: 24,
10783
11067
  left: 24
10784
- }, _r = {
11068
+ }, yr = {
10785
11069
  1: "select",
10786
11070
  2: "connect",
10787
11071
  3: "unlink",
@@ -10790,7 +11074,7 @@ var gr = {
10790
11074
  6: "delete",
10791
11075
  7: "pan",
10792
11076
  8: "paint"
10793
- }, vr = {
11077
+ }, br = {
10794
11078
  ArrowLeft: {
10795
11079
  dx: -1,
10796
11080
  dy: 0
@@ -10808,33 +11092,33 @@ var gr = {
10808
11092
  dy: -1
10809
11093
  }
10810
11094
  };
10811
- function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10812
- 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]);
10813
11097
  t(() => {
10814
- D.setState({ pluginSwatchSets: M });
10815
- }, [M]), t(() => {
11098
+ D.setState({ pluginSwatchSets: P });
11099
+ }, [P]), t(() => {
10816
11100
  a.length !== 0 && (async () => {
10817
11101
  for (let e of a) await e.onAppReady?.();
10818
11102
  })();
10819
11103
  }, []);
10820
- let F = r(l);
11104
+ let L = r(l);
10821
11105
  t(() => {
10822
- let e = F.current;
10823
- 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);
10824
11108
  else if (e && !l) for (let e of a) e.onMapClosed?.();
10825
11109
  }, [l]), t(() => {
10826
11110
  if (!l || !s.current) return;
10827
- let e = hr(l, s.current);
11111
+ let e = _r(l, s.current);
10828
11112
  c.current = e;
10829
11113
  let { currentAreaId: t, currentZ: n } = D.getState();
10830
- return t != null && e.setArea(t, n, gr), () => {
11114
+ return t != null && e.setArea(t, n, vr), () => {
10831
11115
  e.destroy(), c.current = null;
10832
11116
  };
10833
11117
  }, [l]), t(() => {
10834
11118
  let e = c.current;
10835
11119
  if (!e || !p || m == null) return;
10836
11120
  let t = D.getState().navigateTo;
10837
- 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);
10838
11122
  }, [
10839
11123
  m,
10840
11124
  h,
@@ -10898,12 +11182,16 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10898
11182
  t.preventDefault(), D.getState().spaceHeld || D.setState({ spaceHeld: !0 });
10899
11183
  return;
10900
11184
  }
11185
+ if ((t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "f") {
11186
+ t.preventDefault(), j((e) => !e);
11187
+ return;
11188
+ }
10901
11189
  if ((t.ctrlKey || t.metaKey) && !t.shiftKey && t.key.toLowerCase() === "z") {
10902
- t.preventDefault(), L();
11190
+ t.preventDefault(), z();
10903
11191
  return;
10904
11192
  }
10905
11193
  if ((t.ctrlKey || t.metaKey) && (t.shiftKey && t.key.toLowerCase() === "z" || t.key.toLowerCase() === "y")) {
10906
- t.preventDefault(), R();
11194
+ t.preventDefault(), B();
10907
11195
  return;
10908
11196
  }
10909
11197
  if (t.key === "Enter") {
@@ -10921,7 +11209,7 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10921
11209
  return;
10922
11210
  }
10923
11211
  if (t.key === "Delete" || t.key === "Backspace") {
10924
- I();
11212
+ R();
10925
11213
  return;
10926
11214
  }
10927
11215
  if (t.key === "g" || t.key === "G") {
@@ -10929,13 +11217,13 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10929
11217
  return;
10930
11218
  }
10931
11219
  if (t.key === "f" || t.key === "F") {
10932
- c.current?.renderer.fitArea(gr);
11220
+ c.current?.renderer.fitArea(vr);
10933
11221
  return;
10934
11222
  }
10935
- if (_r[t.key]) {
11223
+ if (yr[t.key]) {
10936
11224
  let e = D.getState();
10937
11225
  e.pending?.kind === "customLine" && c.current && (kt(e.pending, c.current), D.bumpData()), D.setState({
10938
- activeTool: _r[t.key],
11226
+ activeTool: yr[t.key],
10939
11227
  pending: null
10940
11228
  });
10941
11229
  return;
@@ -10951,14 +11239,14 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10951
11239
  } });
10952
11240
  return;
10953
11241
  }
10954
- if (vr[t.key]) {
11242
+ if (br[t.key]) {
10955
11243
  let e = D.getState();
10956
11244
  if (e.activeTool !== "select" || !e.selection || !e.map) return;
10957
11245
  if (e.selection.kind === "label") {
10958
11246
  let { id: n, areaId: r } = e.selection, i = c.current?.reader.getLabelSnapshot(r, n);
10959
11247
  if (!i) return;
10960
11248
  t.preventDefault();
10961
- 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 = [
10962
11250
  i.pos[0] + s,
10963
11251
  i.pos[1] + l,
10964
11252
  i.pos[2]
@@ -10975,42 +11263,49 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10975
11263
  })), c.current?.refresh(), D.bumpData(), D.setState({ status: `Moved label ${n}` });
10976
11264
  return;
10977
11265
  }
10978
- if (e.selection.kind !== "room" || e.selection.ids.length !== 1) return;
10979
- let n = e.selection.ids[0], r = e.map.rooms[n];
10980
- if (!r) return;
11266
+ if (e.selection.kind !== "room") return;
10981
11267
  t.preventDefault();
10982
- let i = (t.shiftKey ? 5 : 1) * e.gridStep, a = vr[t.key], o = a.dx * i, s = a.dy * i, l = {
10983
- x: r.x,
10984
- y: r.y,
10985
- z: r.z
10986
- }, u = Ae(e.map, n, o, s);
10987
- c.current?.reader.moveRoom(n, r.x + o, -(r.y + s), r.z);
10988
- let d = {
10989
- x: r.x,
10990
- y: r.y,
10991
- z: r.z
10992
- };
10993
- 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);
10994
- let f = {
10995
- kind: "moveRoom",
10996
- id: n,
10997
- from: l,
10998
- to: d
10999
- }, 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] : {
11000
11293
  kind: "batch",
11001
- cmds: [f, ...u]
11002
- } : f;
11294
+ cmds: o
11295
+ };
11003
11296
  D.setState((e) => ({
11004
- undo: [...e.undo, p],
11297
+ undo: [...e.undo, s],
11005
11298
  redo: []
11006
- })), 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` });
11007
11302
  }
11008
11303
  }
11009
11304
  };
11010
11305
  window.addEventListener("keydown", r), window.addEventListener("keyup", t), window.addEventListener("blur", n);
11011
- let i = () => c.current?.renderer.fitArea(gr);
11012
- return window.addEventListener("editor:undo", L), window.addEventListener("editor:redo", R), window.addEventListener("editor:fit", i), () => {
11013
- 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);
11014
11309
  };
11015
11310
  }, []), t(() => {
11016
11311
  let e = (e) => {
@@ -11024,7 +11319,7 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11024
11319
  window.removeEventListener("dragover", e), window.removeEventListener("drop", t);
11025
11320
  };
11026
11321
  }, []);
11027
- let I = () => {
11322
+ let R = () => {
11028
11323
  let e = D.getState();
11029
11324
  if (!e.map) return;
11030
11325
  let t = e.selection;
@@ -11169,10 +11464,10 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11169
11464
  return;
11170
11465
  }
11171
11466
  }
11172
- }, L = () => {
11467
+ }, z = () => {
11173
11468
  let { changed: e, structural: t } = Oe(c.current);
11174
11469
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Undone" }));
11175
- }, R = () => {
11470
+ }, B = () => {
11176
11471
  let { changed: e, structural: t } = ke(c.current);
11177
11472
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Redone" }));
11178
11473
  };
@@ -11193,23 +11488,25 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11193
11488
  onLoadFromUrl: () => k(!0),
11194
11489
  onSave: (e) => {
11195
11490
  for (let t of a) t.onMapSave?.(e);
11196
- }
11491
+ },
11492
+ onSearchClick: () => j((e) => !e)
11197
11493
  }),
11198
11494
  /* @__PURE__ */ d(mn, {
11199
11495
  sceneRef: c,
11200
- extraTabs: N,
11201
- pluginRoomSections: P
11496
+ extraTabs: F,
11497
+ pluginRoomSections: I
11202
11498
  })
11203
11499
  ]
11204
11500
  }),
11205
11501
  /* @__PURE__ */ d(hn, { sceneRef: c }),
11206
11502
  u && /* @__PURE__ */ d(An, { sceneRef: c }),
11207
11503
  a.map((t, n) => /* @__PURE__ */ d(e, { children: t.renderOverlay?.() }, n)),
11504
+ A && p && /* @__PURE__ */ d(Mn, { onClose: () => j(!1) }),
11208
11505
  w && /* @__PURE__ */ d(le, { onClose: () => T(!1) }),
11209
- (E || A) && /* @__PURE__ */ d(de, {
11210
- initialUrl: A ?? void 0,
11506
+ (E || M) && /* @__PURE__ */ d(de, {
11507
+ initialUrl: M ?? void 0,
11211
11508
  onClose: () => {
11212
- k(!1), j(null);
11509
+ k(!1), N(null);
11213
11510
  }
11214
11511
  })
11215
11512
  ]
@@ -11217,9 +11514,9 @@ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11217
11514
  }
11218
11515
  //#endregion
11219
11516
  //#region src/editor/mapBytes.ts
11220
- function br() {
11517
+ function Sr() {
11221
11518
  let { map: e } = D.getState();
11222
- return e ? H(e) : null;
11519
+ return e ? U(e) : null;
11223
11520
  }
11224
11521
  //#endregion
11225
- 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 };