@mirage-engine/core 0.3.3 → 0.3.5

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.
@@ -1,46 +1,47 @@
1
- var Oe = Object.defineProperty, Fe = Object.defineProperties;
2
- var Xe = Object.getOwnPropertyDescriptors;
3
- var Ee = Object.getOwnPropertySymbols;
1
+ var Oe = Object.defineProperty, Be = Object.defineProperties;
2
+ var Fe = Object.getOwnPropertyDescriptors;
3
+ var be = Object.getOwnPropertySymbols;
4
4
  var _e = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
5
- var ge = (s, e, t) => e in s ? Oe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, G = (s, e) => {
5
+ var oe = (s, e, t) => e in s ? Oe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, q = (s, e) => {
6
6
  for (var t in e || (e = {}))
7
- _e.call(e, t) && ge(s, t, e[t]);
8
- if (Ee)
9
- for (var t of Ee(e))
10
- Ne.call(e, t) && ge(s, t, e[t]);
7
+ _e.call(e, t) && oe(s, t, e[t]);
8
+ if (be)
9
+ for (var t of be(e))
10
+ Ne.call(e, t) && oe(s, t, e[t]);
11
11
  return s;
12
- }, pe = (s, e) => Fe(s, Xe(e));
13
- var g = (s, e, t) => (ge(s, typeof e != "symbol" ? e + "" : e, t), t);
14
- var Ce = (s, e, t) => new Promise((i, r) => {
15
- var n = (a) => {
12
+ }, we = (s, e) => Be(s, Fe(e));
13
+ var g = (s, e, t) => (oe(s, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var Ee = (s, e, t) => new Promise((r, i) => {
15
+ var a = (l) => {
16
16
  try {
17
- c(t.next(a));
18
- } catch (l) {
19
- r(l);
17
+ o(t.next(l));
18
+ } catch (c) {
19
+ i(c);
20
20
  }
21
- }, o = (a) => {
21
+ }, n = (l) => {
22
22
  try {
23
- c(t.throw(a));
24
- } catch (l) {
25
- r(l);
23
+ o(t.throw(l));
24
+ } catch (c) {
25
+ i(c);
26
26
  }
27
- }, c = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(n, o);
28
- c((t = t.apply(s, e)).next());
27
+ }, o = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(a, n);
28
+ o((t = t.apply(s, e)).next());
29
29
  });
30
- import * as b from "three";
31
- const De = {
30
+ import * as y from "three";
31
+ const Re = {
32
32
  INCLUDE_TREE: "include-tree",
33
33
  EXCLUDE_TREE: "exclude-tree",
34
34
  INCLUDE_SELF: "include-self",
35
35
  EXCLUDE_SELF: "exclude-self",
36
36
  END: "end"
37
- }, q = {
37
+ }, H = {
38
38
  NAME: "data-mirage-dom",
39
39
  KEY: "mirageDom",
40
40
  VALUES: {
41
- HIDE: "hide"
41
+ HIDE: "hide",
42
+ SHOW: "show"
42
43
  }
43
- }, Te = {
44
+ }, xe = {
44
45
  TRAVELER: "traveler",
45
46
  NATIVE: "native",
46
47
  CAPTURE_1: "1",
@@ -48,29 +49,29 @@ const De = {
48
49
  CAPTURE_3: "3",
49
50
  CAPTURE_4: "4",
50
51
  CAPTURE_5: "5"
51
- }, F = {
52
+ }, k = {
52
53
  NAME: "data-mirage-travel",
53
54
  KEY: "mirageTravel",
54
- VALUES: Te,
55
- MAX_LAYERS: Object.keys(Te).length - 1
56
- }, z = {
55
+ VALUES: xe,
56
+ MAX_LAYERS: Object.keys(xe).length - 1
57
+ }, _ = {
57
58
  NAME: "data-mirage-filter",
58
59
  KEY: "mirageFilter",
59
- VALUES: De
60
+ VALUES: Re
60
61
  }, V = {
61
62
  NAME: "data-mirage-select",
62
63
  KEY: "mirageSelect",
63
- VALUES: De
64
- }, ze = {
64
+ VALUES: Re
65
+ }, Xe = {
65
66
  NAME: "data-mirage-shader",
66
67
  KEY: "mirageShader"
67
- }, ct = {
68
+ }, at = {
68
69
  NAME: "data-mirage-sandwich",
69
70
  KEY: "mirageSandwich",
70
71
  VALUES: {
71
72
  FRONT: "front"
72
73
  }
73
- }, he = 0, $ = 1, oe = 2, Ye = 4, ve = 8, be = 16;
74
+ }, te = 0, $ = 1, Q = 2, ze = 4, re = 8, le = 16;
74
75
  function Ve(s) {
75
76
  const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
76
77
  return e ? {
@@ -79,7 +80,7 @@ function Ve(s) {
79
80
  b: parseInt(e[3]) / 255
80
81
  } : { r: 1, g: 1, b: 1 };
81
82
  }
82
- function We(s) {
83
+ function Ye(s) {
83
84
  const e = {};
84
85
  if (s.opacity && (e.opacity = parseFloat(s.opacity)), s.backgroundColor && s.backgroundColor !== "rgba(0, 0, 0, 0)") {
85
86
  const t = Ve(s.backgroundColor);
@@ -91,7 +92,7 @@ function We(s) {
91
92
  }
92
93
  return e;
93
94
  }
94
- class Pe {
95
+ class We {
95
96
  constructor(e, t) {
96
97
  g(this, "target");
97
98
  g(this, "observer");
@@ -99,7 +100,7 @@ class Pe {
99
100
  g(this, "pendingStyles", /* @__PURE__ */ new Map());
100
101
  g(this, "isDomDirty", !1);
101
102
  g(this, "isRunning", !1);
102
- g(this, "pendingMask", he);
103
+ g(this, "pendingMask", te);
103
104
  g(this, "mutationTimer", null);
104
105
  g(this, "cssTimer", null);
105
106
  g(this, "resizeConfig");
@@ -114,7 +115,7 @@ class Pe {
114
115
  g(this, "onScrollChange", /* @__PURE__ */ new Set());
115
116
  g(this, "onRender", /* @__PURE__ */ new Set());
116
117
  g(this, "onTransitionFinished", (e) => {
117
- this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= $ | oe, this.cssTimer = window.setTimeout(() => {
118
+ this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= $ | Q, this.cssTimer = window.setTimeout(() => {
118
119
  this.isDomDirty = !0, this.cssTimer = null;
119
120
  }, 50)));
120
121
  });
@@ -130,38 +131,38 @@ class Pe {
130
131
  g(this, "renderLoop", () => {
131
132
  if (!this.isRunning)
132
133
  return;
133
- this.onBeforeRender.forEach((i) => i()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((i) => i(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = he);
134
+ this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = te);
134
135
  const e = window.scrollX, t = window.scrollY;
135
- (e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((i) => i(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
136
+ (e !== this.lastScrollX || t !== this.lastScrollY) && (this.onScrollChange.forEach((r) => r(e, t)), this.lastScrollX = e, this.lastScrollY = t, this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
136
137
  this.pendingMask |= $, this.isDomDirty = !0, this.scrollTimer = null;
137
- }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((i) => i(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((i) => i()), requestAnimationFrame(this.renderLoop);
138
+ }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((r) => r(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((r) => r()), requestAnimationFrame(this.renderLoop);
138
139
  });
139
- var r, n;
140
+ var i, a;
140
141
  this.target = e;
141
- const i = (r = t.resizeDebounce) != null ? r : !0;
142
- i === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : i === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
142
+ const r = (i = t.resizeDebounce) != null ? i : !0;
143
+ r === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : r === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
143
144
  enabled: !0,
144
- delay: (n = i.delay) != null ? n : 150,
145
- onStart: i.onStart,
146
- onEnd: i.onEnd
147
- }, this.observer = new MutationObserver((o) => {
148
- let c = he;
149
- for (const a of o)
150
- if (a.type === "childList")
151
- c |= ve, a.removedNodes.length > 0 && a.removedNodes.forEach((l) => {
152
- l instanceof HTMLElement && this.pendingDeletions.add(l);
145
+ delay: (a = r.delay) != null ? a : 150,
146
+ onStart: r.onStart,
147
+ onEnd: r.onEnd
148
+ }, this.observer = new MutationObserver((n) => {
149
+ let o = te;
150
+ for (const l of n)
151
+ if (l.type === "childList")
152
+ o |= re, l.removedNodes.length > 0 && l.removedNodes.forEach((c) => {
153
+ c instanceof HTMLElement && this.pendingDeletions.add(c);
153
154
  });
154
- else if (a.type === "attributes")
155
- if (a.attributeName === "style") {
156
- c |= $ | oe;
157
- const l = a.target, d = We(l.style);
158
- this.pendingStyles.set(l, d);
155
+ else if (l.type === "attributes")
156
+ if (l.attributeName === "style") {
157
+ o |= $ | Q;
158
+ const c = l.target, d = Ye(c.style);
159
+ this.pendingStyles.set(c, d);
159
160
  } else
160
- (a.attributeName === "class" || a.attributeName && a.attributeName.startsWith("data-")) && (c |= $ | oe);
161
+ l.attributeName === "class" ? o |= $ | Q : l.attributeName && l.attributeName.startsWith("data-") && (o |= $ | Q, l.attributeName.startsWith("data-mirage") && (o |= re));
161
162
  else
162
- a.type === "characterData" && (c |= be | $);
163
- if (c !== he) {
164
- if (this.pendingMask |= c, c & ve) {
163
+ l.type === "characterData" && (o |= le | $);
164
+ if (o !== te) {
165
+ if (this.pendingMask |= o, o & re) {
165
166
  this.clearTimers(), this.isDomDirty = !0;
166
167
  return;
167
168
  }
@@ -186,13 +187,13 @@ class Pe {
186
187
  this.mutationTimer && (clearTimeout(this.mutationTimer), this.mutationTimer = null), this.cssTimer && (clearTimeout(this.cssTimer), this.cssTimer = null), this.scrollTimer && (clearTimeout(this.scrollTimer), this.scrollTimer = null);
187
188
  }
188
189
  }
189
- const W = 1, j = 2, lt = 0, I = {
190
+ const W = 1, j = 2, lt = 0, L = {
190
191
  BASE: 0,
191
192
  SELECTED: 1,
192
193
  getCaptureLayer: (s) => 31 - s,
193
194
  HIDDEN: 31
194
- }, Se = Object.values(z.VALUES);
195
- class Ae {
195
+ }, Ce = Object.values(_.VALUES);
196
+ class Le {
196
197
  /**
197
198
  * Calculates or retrieves the exact alphabetic baseline (in pixels) for the given font.
198
199
  * @param font CSS font shorthand string (e.g., "400 16px Inter")
@@ -207,18 +208,18 @@ class Ae {
207
208
  static calculateBaselineFromDOM(e) {
208
209
  if (typeof document == "undefined")
209
210
  return 0;
210
- const t = document.createElement("div"), i = document.createElement("span"), r = document.createElement("img");
211
- t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none", i.style.margin = "0", i.style.padding = "0", i.style.border = "none", i.style.lineHeight = "normal", r.width = 1, r.height = 1, r.style.verticalAlign = "baseline", i.appendChild(document.createTextNode("Hidden Text")), t.appendChild(i), t.appendChild(r), document.body.appendChild(t);
212
- const n = r.offsetTop - i.offsetTop;
213
- return document.body.removeChild(t), n;
211
+ const t = document.createElement("div"), r = document.createElement("span"), i = document.createElement("img");
212
+ t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none", r.style.margin = "0", r.style.padding = "0", r.style.border = "none", r.style.lineHeight = "normal", i.width = 1, i.height = 1, i.style.verticalAlign = "baseline", r.appendChild(document.createTextNode("Hidden Text")), t.appendChild(r), t.appendChild(i), document.body.appendChild(t);
213
+ const a = i.offsetTop - r.offsetTop;
214
+ return document.body.removeChild(t), a;
214
215
  }
215
216
  }
216
- g(Ae, "cache", /* @__PURE__ */ new Map());
217
- class He extends b.MeshBasicMaterial {
218
- constructor(t, i, r, n, o = 2) {
217
+ g(Le, "cache", /* @__PURE__ */ new Map());
218
+ class He extends y.MeshBasicMaterial {
219
+ constructor(t, r, i, a, n = 2) {
219
220
  super({
220
221
  transparent: !0,
221
- side: b.FrontSide,
222
+ side: y.FrontSide,
222
223
  color: 16777215
223
224
  });
224
225
  g(this, "canvas");
@@ -226,34 +227,34 @@ class He extends b.MeshBasicMaterial {
226
227
  g(this, "qualityFactor");
227
228
  if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
228
229
  throw new Error("[Mirage] Failed to create canvas context");
229
- this.qualityFactor = o, this.map = new b.CanvasTexture(this.canvas), this.map.colorSpace = b.LinearSRGBColorSpace, this.map.minFilter = b.LinearFilter, this.map.magFilter = b.LinearFilter, this.updateText(t, i, r, n);
230
- }
231
- wrapText(t, i) {
232
- const r = t.split(`
233
- `), n = [];
234
- return r.forEach((o) => {
235
- const c = o.match(/[^\s\-]+\-?|\-|\s+/g) || [];
236
- if (c.length === 0) {
237
- n.push("");
230
+ this.qualityFactor = n, this.map = new y.CanvasTexture(this.canvas), this.map.colorSpace = y.LinearSRGBColorSpace, this.map.minFilter = y.LinearFilter, this.map.magFilter = y.LinearFilter, this.updateText(t, r, i, a);
231
+ }
232
+ wrapText(t, r) {
233
+ const i = t.split(`
234
+ `), a = [];
235
+ return i.forEach((n) => {
236
+ const o = n.match(/[^\s\-]+\-?|\-|\s+/g) || [];
237
+ if (o.length === 0) {
238
+ a.push("");
238
239
  return;
239
240
  }
240
- let a = c[0];
241
- for (let l = 1; l < c.length; l++) {
242
- const d = c[l];
243
- this.ctx.measureText(a + d).width <= i + 2 ? a += d : (a && n.push(a), a = d.trimStart());
241
+ let l = o[0];
242
+ for (let c = 1; c < o.length; c++) {
243
+ const d = o[c];
244
+ this.ctx.measureText(l + d).width <= r + 2 ? l += d : (l && a.push(l), l = d.trimStart());
244
245
  }
245
- a && n.push(a);
246
- }), n;
247
- }
248
- updateText(t, i, r, n, o) {
249
- o !== void 0 && (this.qualityFactor = o);
250
- const a = (window.devicePixelRatio || 1) * this.qualityFactor, l = r * a, d = n * a;
251
- this.canvas.width !== l || this.canvas.height !== d ? (this.canvas.width = l, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(a, 0, 0, a, 0, 0), this.ctx.font = i.font, this.ctx.fillStyle = i.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
252
- const h = this.wrapText(t, r), u = i.lineHeight, v = Ae.getBaseline(i.font);
253
- h.forEach((f, p) => {
254
- const E = p * u + v;
246
+ l && a.push(l);
247
+ }), a;
248
+ }
249
+ updateText(t, r, i, a, n) {
250
+ n !== void 0 && (this.qualityFactor = n);
251
+ const l = (window.devicePixelRatio || 1) * this.qualityFactor, c = i * l, d = a * l;
252
+ this.canvas.width !== c || this.canvas.height !== d ? (this.canvas.width = c, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(l, 0, 0, l, 0, 0), this.ctx.font = r.font, this.ctx.fillStyle = r.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
253
+ const h = this.wrapText(t, i), u = r.lineHeight, p = Le.getBaseline(r.font);
254
+ h.forEach((f, m) => {
255
+ const E = m * u + p;
255
256
  let R = 0;
256
- i.textAlign === "center" ? R = r / 2 : i.textAlign === "right" && (R = r), this.ctx.textAlign = i.textAlign, this.ctx.fillText(f, R, E);
257
+ r.textAlign === "center" ? R = i / 2 : r.textAlign === "right" && (R = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(f, R, E);
257
258
  }), this.map && (this.map.needsUpdate = !0);
258
259
  }
259
260
  dispose() {
@@ -263,91 +264,91 @@ class He extends b.MeshBasicMaterial {
263
264
  function K(s) {
264
265
  return typeof s == "number" ? s : parseFloat(s) || 0;
265
266
  }
266
- function ne(s) {
267
+ function Z(s) {
267
268
  if (!s || s === "transparent")
268
- return { color: new b.Color(16777215), alpha: 0 };
269
+ return { color: new y.Color(16777215), alpha: 0 };
269
270
  const e = s.match(
270
271
  /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
271
272
  );
272
273
  if (e) {
273
- const t = parseInt(e[1], 10), i = parseInt(e[2], 10), r = parseInt(e[3], 10), n = e[4] !== void 0 ? parseFloat(e[4]) : 1;
274
- return { color: new b.Color(`rgb(${t}, ${i}, ${r})`), alpha: n };
274
+ const t = parseInt(e[1], 10), r = parseInt(e[2], 10), i = parseInt(e[3], 10), a = e[4] !== void 0 ? parseFloat(e[4]) : 1;
275
+ return { color: new y.Color(`rgb(${t}, ${r}, ${i})`), alpha: a };
275
276
  }
276
- return { color: new b.Color(s), alpha: 1 };
277
+ return { color: new y.Color(s), alpha: 1 };
277
278
  }
278
- function Ge(s) {
279
+ function Pe(s) {
279
280
  const e = [];
280
- let t = "", i = 0;
281
- for (let r = 0; r < s.length; r++) {
282
- const n = s[r];
283
- if (n === "(")
284
- i++;
285
- else if (n === ")")
286
- i--;
287
- else if (n === "," && i === 0) {
281
+ let t = "", r = 0;
282
+ for (let i = 0; i < s.length; i++) {
283
+ const a = s[i];
284
+ if (a === "(")
285
+ r++;
286
+ else if (a === ")")
287
+ r--;
288
+ else if (a === "," && r === 0) {
288
289
  e.push(t.trim()), t = "";
289
290
  continue;
290
291
  }
291
- t += n;
292
+ t += a;
292
293
  }
293
294
  return t && e.push(t.trim()), e;
294
295
  }
295
- function qe(s) {
296
+ function Ge(s) {
296
297
  if (!s || typeof s != "string" || !s.includes("linear-gradient"))
297
298
  return null;
298
299
  const e = s.match(/linear-gradient\((.*)\)/);
299
300
  if (!e)
300
301
  return null;
301
- const t = e[1], i = Ge(t);
302
- let r = Math.PI, n = 0;
303
- const o = i[0].trim();
304
- if (o.startsWith("to "))
305
- o === "to top" ? r = 0 : o === "to right" ? r = Math.PI / 2 : o === "to bottom" ? r = Math.PI : o === "to left" ? r = Math.PI * 1.5 : o === "to top right" || o === "to right top" ? r = Math.PI / 4 : o === "to bottom right" || o === "to right bottom" ? r = Math.PI * 0.75 : o === "to bottom left" || o === "to left bottom" ? r = Math.PI * 1.25 : (o === "to top left" || o === "to left top") && (r = Math.PI * 1.75), n = 1;
306
- else if (o.endsWith("deg") || o.endsWith("rad") || o.endsWith("turn")) {
307
- const a = parseFloat(o);
308
- o.endsWith("deg") ? r = a * (Math.PI / 180) : o.endsWith("rad") ? r = a : o.endsWith("turn") && (r = a * Math.PI * 2), n = 1;
309
- }
310
- const c = [];
311
- for (let a = n; a < i.length && !(c.length >= 8); a++) {
312
- const l = i[a].trim(), d = l.lastIndexOf(" ");
313
- let h = l, u = null;
314
- if (d !== -1 && !l.endsWith(")")) {
315
- const f = l.substring(d + 1);
316
- (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = l.substring(0, d).trim(), u = f);
302
+ const t = e[1], r = Pe(t);
303
+ let i = Math.PI, a = 0;
304
+ const n = r[0].trim();
305
+ if (n.startsWith("to "))
306
+ n === "to top" ? i = 0 : n === "to right" ? i = Math.PI / 2 : n === "to bottom" ? i = Math.PI : n === "to left" ? i = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? i = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? i = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? i = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (i = Math.PI * 1.75), a = 1;
307
+ else if (n.endsWith("deg") || n.endsWith("rad") || n.endsWith("turn")) {
308
+ const l = parseFloat(n);
309
+ n.endsWith("deg") ? i = l * (Math.PI / 180) : n.endsWith("rad") ? i = l : n.endsWith("turn") && (i = l * Math.PI * 2), a = 1;
310
+ }
311
+ const o = [];
312
+ for (let l = a; l < r.length && !(o.length >= 8); l++) {
313
+ const c = r[l].trim(), d = c.lastIndexOf(" ");
314
+ let h = c, u = null;
315
+ if (d !== -1 && !c.endsWith(")")) {
316
+ const f = c.substring(d + 1);
317
+ (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = c.substring(0, d).trim(), u = f);
317
318
  }
318
- const v = ne(h);
319
- c.push({
320
- color: v.color,
321
- alpha: v.alpha,
319
+ const p = Z(h);
320
+ o.push({
321
+ color: p.color,
322
+ alpha: p.alpha,
322
323
  rawStop: u,
323
324
  stop: 0
324
325
  });
325
326
  }
326
- if (c.length > 0) {
327
- for (let l = 0; l < c.length; l++)
328
- c[l].rawStop !== null && (c[l].stop = parseFloat(c[l].rawStop) / 100);
329
- c[0].rawStop === null && (c[0].stop = 0), c.length > 1 && c[c.length - 1].rawStop === null && (c[c.length - 1].stop = 1);
330
- let a = 0;
331
- for (let l = 1; l < c.length; l++)
332
- if (c[l].rawStop !== null || l === c.length - 1) {
333
- const d = l - a;
327
+ if (o.length > 0) {
328
+ for (let c = 0; c < o.length; c++)
329
+ o[c].rawStop !== null && (o[c].stop = parseFloat(o[c].rawStop) / 100);
330
+ o[0].rawStop === null && (o[0].stop = 0), o.length > 1 && o[o.length - 1].rawStop === null && (o[o.length - 1].stop = 1);
331
+ let l = 0;
332
+ for (let c = 1; c < o.length; c++)
333
+ if (o[c].rawStop !== null || c === o.length - 1) {
334
+ const d = c - l;
334
335
  if (d > 1) {
335
- const h = c[a].stop, v = (c[l].stop - h) / d;
336
+ const h = o[l].stop, p = (o[c].stop - h) / d;
336
337
  for (let f = 1; f < d; f++)
337
- c[a + f].stop = h + v * f;
338
+ o[l + f].stop = h + p * f;
338
339
  }
339
- a = l;
340
+ l = c;
340
341
  }
341
342
  }
342
- return { angle: r, stops: c };
343
+ return { angle: i, stops: o };
343
344
  }
344
- const $e = `varying vec2 vUv;
345
+ const qe = `varying vec2 vUv;
345
346
  varying vec4 vScreenPos;
346
347
  void main() {
347
348
  vUv = uv;
348
349
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
349
350
  vScreenPos = gl_Position;
350
- }`, je = `varying vec2 vUv;
351
+ }`, $e = `varying vec2 vUv;
351
352
  uniform vec2 uSize;
352
353
  uniform vec4 uBorderRadius;
353
354
  uniform float uBorderWidth;
@@ -476,40 +477,40 @@ void main() {
476
477
 
477
478
  // #include <colorspace_fragment>
478
479
  }
479
- `, Ke = `uniform sampler2D uTexture;
480
+ `, je = `uniform sampler2D uTexture;
480
481
  varying vec4 vScreenPos;
481
482
  uniform vec2 uTextureRepeat;
482
- uniform vec2 uTextureOffset;`, Je = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
483
+ uniform vec2 uTextureOffset;`, Ke = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
483
484
  vec2 resultUv = screenUv;
484
485
 
485
- `, Qe = `vec4 texColor = texture2D(uTexture, resultUv);
486
- baseColor = blendSrcOver(baseColor, texColor);`, Re = {
487
- vertexShader: $e,
488
- fragmentShader: je
489
- }, me = {
490
- declChunk: Ke,
491
- uvChunk: Je,
492
- baseColorChunk: Qe
486
+ `, Je = `vec4 texColor = texture2D(uTexture, resultUv);
487
+ baseColor = blendSrcOver(baseColor, texColor);`, Te = {
488
+ vertexShader: qe,
489
+ fragmentShader: $e
490
+ }, ae = {
491
+ declChunk: je,
492
+ uvChunk: Ke,
493
+ baseColorChunk: Je
493
494
  };
494
- function Ze(s, e, t, i = null, r) {
495
- var L;
496
- const n = i !== null || !!s.imageSrc;
497
- let o = "";
498
- const c = {};
499
- if (r != null && r.uniforms)
500
- for (const [x, w] of Object.entries(r.uniforms))
501
- typeof w == "number" ? (o += `uniform float ${x};
502
- `, c[x] = { value: w }) : Array.isArray(w) ? w.length === 2 ? (o += `uniform vec2 ${x};
503
- `, c[x] = { value: new b.Vector2(...w) }) : w.length === 3 ? (o += `uniform vec3 ${x};
504
- `, c[x] = { value: new b.Vector3(...w) }) : w.length === 4 && (o += `uniform vec4 ${x};
505
- `, c[x] = { value: new b.Vector4(...w) }) : (o += `uniform float ${x};
506
- `, c[x] = { value: w });
507
- const a = (n ? me.declChunk : "") + `
508
- ` + o, l = s.isTraveler ? me.uvChunk : `vec2 resultUv = vUv * uTextureRepeat + uTextureOffset;
509
- `, d = n ? l + ((r == null ? void 0 : r.uvModifier) || "") : "", h = n ? me.baseColorChunk : "", u = (r == null ? void 0 : r.colorModifier) || "", v = Re.fragmentShader.replace("#INJECT_DECLARATIONS", a).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", h).replace("#INJECT_COLOR_MODIFIER", u), f = ne(s.backgroundColor), p = ne(s.borderColor), E = {
510
- uSize: { value: new b.Vector2(e, t) },
495
+ function Qe(s, e, t, r = null, i) {
496
+ var M;
497
+ const a = r !== null || !!s.imageSrc;
498
+ let n = "";
499
+ const o = {};
500
+ if (i != null && i.uniforms)
501
+ for (const [w, b] of Object.entries(i.uniforms))
502
+ typeof b == "number" ? (n += `uniform float ${w};
503
+ `, o[w] = { value: b }) : Array.isArray(b) ? b.length === 2 ? (n += `uniform vec2 ${w};
504
+ `, o[w] = { value: new y.Vector2(...b) }) : b.length === 3 ? (n += `uniform vec3 ${w};
505
+ `, o[w] = { value: new y.Vector3(...b) }) : b.length === 4 && (n += `uniform vec4 ${w};
506
+ `, o[w] = { value: new y.Vector4(...b) }) : (n += `uniform float ${w};
507
+ `, o[w] = { value: b });
508
+ const l = (a ? ae.declChunk : "") + `
509
+ ` + n, c = s.isTraveler ? ae.uvChunk : `vec2 resultUv = vUv * uTextureRepeat + uTextureOffset;
510
+ `, d = a ? c + ((i == null ? void 0 : i.uvModifier) || "") : "", h = a ? ae.baseColorChunk : "", u = (i == null ? void 0 : i.colorModifier) || "", p = Te.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", h).replace("#INJECT_COLOR_MODIFIER", u), f = Z(s.backgroundColor), m = Z(s.borderColor), E = {
511
+ uSize: { value: new y.Vector2(e, t) },
511
512
  uBgColor: {
512
- value: new b.Vector4(
513
+ value: new y.Vector4(
513
514
  f.color.r,
514
515
  f.color.g,
515
516
  f.color.b,
@@ -517,111 +518,111 @@ function Ze(s, e, t, i = null, r) {
517
518
  )
518
519
  },
519
520
  uBorderColor: {
520
- value: new b.Vector4(
521
- p.color.r,
522
- p.color.g,
523
- p.color.b,
524
- p.alpha
521
+ value: new y.Vector4(
522
+ m.color.r,
523
+ m.color.g,
524
+ m.color.b,
525
+ m.alpha
525
526
  )
526
527
  },
527
- uBorderRadius: { value: new b.Vector4(0, 0, 0, 0) },
528
+ uBorderRadius: { value: new y.Vector4(0, 0, 0, 0) },
528
529
  uBorderWidth: { value: K(s.borderWidth) },
529
- uOpacity: { value: (L = s.opacity) != null ? L : 1 },
530
+ uOpacity: { value: (M = s.opacity) != null ? M : 1 },
530
531
  uTexture: { value: null },
531
- uTextureRepeat: { value: new b.Vector2(1, 1) },
532
- uTextureOffset: { value: new b.Vector2(0, 0) },
532
+ uTextureRepeat: { value: new y.Vector2(1, 1) },
533
+ uTextureOffset: { value: new y.Vector2(0, 0) },
533
534
  uGradientCount: { value: 0 },
534
535
  uGradientAngle: { value: 0 },
535
536
  uGradientColors: {
536
- value: Array.from({ length: 8 }, () => new b.Vector4(0, 0, 0, 0))
537
+ value: Array.from({ length: 8 }, () => new y.Vector4(0, 0, 0, 0))
537
538
  },
538
539
  uGradientStops: { value: new Float32Array(8) }
539
540
  };
540
- Ie(E.uBorderRadius.value, s.borderRadius), n && (E.uTexture.value = i);
541
- const R = new b.ShaderMaterial({
542
- uniforms: G(G({}, E), c),
543
- vertexShader: Re.vertexShader,
544
- fragmentShader: v,
541
+ Me(E.uBorderRadius.value, s.borderRadius), a && (E.uTexture.value = r);
542
+ const R = new y.ShaderMaterial({
543
+ uniforms: q(q({}, E), o),
544
+ vertexShader: Te.vertexShader,
545
+ fragmentShader: p,
545
546
  transparent: !0,
546
- side: b.FrontSide
547
+ side: y.FrontSide
547
548
  // for better performance
548
549
  });
549
- return s.backgroundImage && ye(R, { backgroundImage: s.backgroundImage }), R;
550
+ return s.backgroundImage && ce(R, { backgroundImage: s.backgroundImage }), R;
550
551
  }
551
- function et(s, e, t, i, r) {
552
- const n = K(e.borderWidth);
553
- ye(s, {
552
+ function Ze(s, e, t, r, i) {
553
+ const a = K(e.borderWidth);
554
+ ce(s, {
554
555
  width: t,
555
- height: i,
556
+ height: r,
556
557
  borderRadius: e.borderRadius,
557
- borderWidth: n,
558
+ borderWidth: a,
558
559
  backgroundColor: e.backgroundColor,
559
560
  borderColor: e.borderColor,
560
561
  opacity: e.opacity,
561
- texture: r,
562
+ texture: i,
562
563
  backgroundImage: e.backgroundImage
563
564
  });
564
565
  }
565
- function ye(s, e) {
566
- var i, r, n;
567
- if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), e.borderRadius !== void 0 && Ie(s.uniforms.uBorderRadius.value, e.borderRadius), e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
566
+ function ce(s, e) {
567
+ var r, i, a;
568
+ if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), e.borderRadius !== void 0 && Me(s.uniforms.uBorderRadius.value, e.borderRadius), e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
568
569
  if (Array.isArray(e.backgroundColor)) {
569
- const o = s.uniforms.uBgColor.value.w;
570
+ const n = s.uniforms.uBgColor.value.w;
570
571
  s.uniforms.uBgColor.value.set(
571
572
  e.backgroundColor[0],
572
573
  e.backgroundColor[1],
573
574
  e.backgroundColor[2],
574
- o
575
+ n
575
576
  );
576
577
  } else if (typeof e.backgroundColor == "string") {
577
- const o = ne(e.backgroundColor);
578
+ const n = Z(e.backgroundColor);
578
579
  s.uniforms.uBgColor.value.set(
579
- o.color.r,
580
- o.color.g,
581
- o.color.b,
582
- o.alpha
580
+ n.color.r,
581
+ n.color.g,
582
+ n.color.b,
583
+ n.alpha
583
584
  );
584
585
  } else {
585
- const o = s.uniforms.uBgColor.value.w;
586
+ const n = s.uniforms.uBgColor.value.w;
586
587
  s.uniforms.uBgColor.value.set(
587
588
  e.backgroundColor.r,
588
589
  e.backgroundColor.g,
589
590
  e.backgroundColor.b,
590
- o
591
+ n
591
592
  );
592
593
  }
593
594
  if (e.borderColor !== void 0)
594
595
  if (Array.isArray(e.borderColor)) {
595
- const o = s.uniforms.uBorderColor.value.w;
596
+ const n = s.uniforms.uBorderColor.value.w;
596
597
  s.uniforms.uBorderColor.value.set(
597
598
  e.borderColor[0],
598
599
  e.borderColor[1],
599
600
  e.borderColor[2],
600
- o
601
+ n
601
602
  );
602
603
  } else if (typeof e.borderColor == "string") {
603
- const o = ne(e.borderColor);
604
+ const n = Z(e.borderColor);
604
605
  s.uniforms.uBorderColor.value.set(
605
- o.color.r,
606
- o.color.g,
607
- o.color.b,
608
- o.alpha
606
+ n.color.r,
607
+ n.color.g,
608
+ n.color.b,
609
+ n.alpha
609
610
  );
610
611
  } else {
611
- const o = s.uniforms.uBorderColor.value.w;
612
+ const n = s.uniforms.uBorderColor.value.w;
612
613
  s.uniforms.uBorderColor.value.set(
613
614
  e.borderColor.r,
614
615
  e.borderColor.g,
615
616
  e.borderColor.b,
616
- o
617
+ n
617
618
  );
618
619
  }
619
620
  e.opacity !== void 0 && (s.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (s.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (s.uniforms.uBorderColor.value.w = e.borderOpacity), s.uniforms.uTexture && e.texture !== void 0 && (s.uniforms.uTexture.value = e.texture);
620
- const t = e.texture !== void 0 ? e.texture : (i = s.uniforms.uTexture) == null ? void 0 : i.value;
621
+ const t = e.texture !== void 0 ? e.texture : (r = s.uniforms.uTexture) == null ? void 0 : r.value;
621
622
  if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
622
- const o = t.image.width, c = t.image.height, a = (r = e.width) != null ? r : s.uniforms.uSize.value.x, l = (n = e.height) != null ? n : s.uniforms.uSize.value.y;
623
- if (o && c && a && l) {
624
- const d = o / c, h = a / l;
623
+ const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, o = t.image.naturalHeight || t.image.videoHeight || t.image.height, l = (i = e.width) != null ? i : s.uniforms.uSize.value.x, c = (a = e.height) != null ? a : s.uniforms.uSize.value.y;
624
+ if (n && o && l && c) {
625
+ const d = n / o, h = l / c;
625
626
  if (d > h) {
626
627
  const u = h / d;
627
628
  s.uniforms.uTextureRepeat.value.set(u, 1), s.uniforms.uTextureOffset.value.set((1 - u) / 2, 0);
@@ -633,28 +634,28 @@ function ye(s, e) {
633
634
  } else
634
635
  s.uniforms.uTextureRepeat && (s.uniforms.uTextureRepeat.value.set(1, 1), s.uniforms.uTextureOffset.value.set(0, 0));
635
636
  if (e.backgroundImage !== void 0) {
636
- const o = qe(e.backgroundImage);
637
- if (o) {
638
- s.uniforms.uGradientCount.value = o.stops.length, s.uniforms.uGradientAngle.value = o.angle;
639
- for (let c = 0; c < 8; c++)
640
- if (c < o.stops.length) {
641
- const a = o.stops[c];
642
- s.uniforms.uGradientColors.value[c].set(
643
- a.color.r,
644
- a.color.g,
645
- a.color.b,
646
- a.alpha
647
- ), s.uniforms.uGradientStops.value[c] = a.stop;
637
+ const n = Ge(e.backgroundImage);
638
+ if (n) {
639
+ s.uniforms.uGradientCount.value = n.stops.length, s.uniforms.uGradientAngle.value = n.angle;
640
+ for (let o = 0; o < 8; o++)
641
+ if (o < n.stops.length) {
642
+ const l = n.stops[o];
643
+ s.uniforms.uGradientColors.value[o].set(
644
+ l.color.r,
645
+ l.color.g,
646
+ l.color.b,
647
+ l.alpha
648
+ ), s.uniforms.uGradientStops.value[o] = l.stop;
648
649
  } else
649
- s.uniforms.uGradientColors.value[c].set(0, 0, 0, 0), s.uniforms.uGradientStops.value[c] = 1;
650
+ s.uniforms.uGradientColors.value[o].set(0, 0, 0, 0), s.uniforms.uGradientStops.value[o] = 1;
650
651
  } else
651
652
  s.uniforms.uGradientCount.value = 0;
652
653
  }
653
- for (const o of Object.keys(e))
654
- o !== "width" && o !== "height" && o !== "borderRadius" && o !== "borderWidth" && o !== "backgroundColor" && o !== "borderColor" && o !== "opacity" && o !== "bgOpacity" && o !== "borderOpacity" && o !== "texture" && o !== "backgroundImage" && s.uniforms[o] !== void 0 && (s.uniforms[o].value !== void 0 && s.uniforms[o].value !== null && typeof s.uniforms[o].value.set == "function" ? Array.isArray(e[o]) ? s.uniforms[o].value.set(...e[o]) : e[o] !== void 0 && (e[o].copy ? s.uniforms[o].value.copy(e[o]) : s.uniforms[o].value = e[o]) : s.uniforms[o].value = e[o]);
654
+ for (const n of Object.keys(e))
655
+ n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && s.uniforms[n] !== void 0 && (s.uniforms[n].value !== void 0 && s.uniforms[n].value !== null && typeof s.uniforms[n].value.set == "function" ? Array.isArray(e[n]) ? s.uniforms[n].value.set(...e[n]) : e[n] !== void 0 && (e[n].copy ? s.uniforms[n].value.copy(e[n]) : s.uniforms[n].value = e[n]) : s.uniforms[n].value = e[n]);
655
656
  }
656
- function Ie(s, e) {
657
- var c, a, l, d;
657
+ function Me(s, e) {
658
+ var o, l, c, d;
658
659
  if (e == null) {
659
660
  s.set(0, 0, 0, 0);
660
661
  return;
@@ -667,45 +668,45 @@ function Ie(s, e) {
667
668
  s.set(e[0], e[1], e[2], e[3]);
668
669
  return;
669
670
  }
670
- const t = e.split("/")[0].trim().split(/\s+/), i = K(t[0]), r = K((c = t[1]) != null ? c : t[0]), n = K((a = t[2]) != null ? a : t[0]), o = K((d = (l = t[3]) != null ? l : t[1]) != null ? d : t[0]);
671
- s.set(i, r, n, o);
671
+ const t = e.split("/")[0].trim().split(/\s+/), r = K(t[0]), i = K((o = t[1]) != null ? o : t[0]), a = K((l = t[2]) != null ? l : t[0]), n = K((d = (c = t[3]) != null ? c : t[1]) != null ? d : t[0]);
672
+ s.set(r, i, a, n);
672
673
  }
673
- const H = {
674
- create(s, e, t, i, r, n = 2, o = null, c) {
675
- return s === "BOX" ? Ze(
674
+ const Y = {
675
+ create(s, e, t, r, i, a = 2, n = null, o) {
676
+ return s === "BOX" ? Qe(
676
677
  e,
677
- i,
678
678
  r,
679
- o,
680
- c
679
+ i,
680
+ n,
681
+ o
681
682
  ) : s === "TEXT" ? new He(
682
683
  t || "",
683
684
  e,
684
- i,
685
685
  r,
686
- n
687
- ) : new b.MeshBasicMaterial({ visible: !1 });
686
+ i,
687
+ a
688
+ ) : new y.MeshBasicMaterial({ visible: !1 });
688
689
  },
689
- update(s, e, t, i, r, n, o = 2, c) {
690
- e === "BOX" ? et(
690
+ update(s, e, t, r, i, a, n = 2, o) {
691
+ e === "BOX" ? Ze(
691
692
  s,
692
693
  t,
693
- r,
694
- n,
695
- c
694
+ i,
695
+ a,
696
+ o
696
697
  ) : e === "TEXT" && s.updateText(
697
- i || "",
698
+ r || "",
698
699
  t,
699
- r,
700
- n,
701
- o
700
+ i,
701
+ a,
702
+ n
702
703
  );
703
704
  },
704
705
  forceUpdateUniforms(s, e) {
705
- ye(s, e);
706
+ ce(s, e);
706
707
  }
707
708
  };
708
- class tt {
709
+ class et {
709
710
  constructor(e, t = !0) {
710
711
  g(this, "observer");
711
712
  g(this, "textures", /* @__PURE__ */ new WeakMap());
@@ -713,10 +714,10 @@ class tt {
713
714
  g(this, "elementUrls", /* @__PURE__ */ new WeakMap());
714
715
  g(this, "onUpdate");
715
716
  this.onUpdate = e, t && (this.observer = new IntersectionObserver(
716
- (i) => {
717
- for (const r of i) {
718
- const n = r.target;
719
- r.isIntersecting ? this.loadTexture(n) : this.disposeTexture(n);
717
+ (r) => {
718
+ for (const i of r) {
719
+ const a = i.target;
720
+ i.isIntersecting ? this.loadTexture(a) : this.disposeTexture(a);
720
721
  }
721
722
  },
722
723
  { rootMargin: "300px" }
@@ -731,31 +732,31 @@ class tt {
731
732
  e.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(e), this.disposeTexture(e), this.elementUrls.delete(e), this.loadStatus.delete(e);
732
733
  }
733
734
  loadTexture(e) {
734
- return Ce(this, null, function* () {
735
+ return Ee(this, null, function* () {
735
736
  if (this.loadStatus.get(e) || this.textures.has(e))
736
737
  return;
737
738
  const t = this.elementUrls.get(e);
738
739
  if (t) {
739
740
  this.loadStatus.set(e, !0);
740
741
  try {
741
- let i;
742
+ let r;
742
743
  if (t.startsWith("data:image/svg+xml"))
743
- i = yield new Promise((n, o) => {
744
- const c = new Image();
745
- c.onload = () => n(c), c.onerror = o, c.src = t;
744
+ r = yield new Promise((a, n) => {
745
+ const o = new Image();
746
+ o.onload = () => a(o), o.onerror = n, o.src = t;
746
747
  });
747
748
  else {
748
- const o = yield (yield fetch(t)).blob();
749
- i = yield createImageBitmap(o, { imageOrientation: "flipY" });
749
+ const n = yield (yield fetch(t)).blob();
750
+ r = yield createImageBitmap(n, { imageOrientation: "flipY" });
750
751
  }
751
752
  if (this.elementUrls.get(e) !== t) {
752
- "close" in i && i.close();
753
+ "close" in r && r.close();
753
754
  return;
754
755
  }
755
- const r = new b.Texture(i);
756
- i instanceof HTMLImageElement || (r.flipY = !1), r.colorSpace = b.LinearSRGBColorSpace, r.needsUpdate = !0, this.textures.set(e, r), this.onUpdate(e, r);
757
- } catch (i) {
758
- console.warn("[MirageEngine] Failed to load texture:", t, i);
756
+ const i = new y.Texture(r);
757
+ r instanceof HTMLImageElement || (i.flipY = !1), i.colorSpace = y.LinearSRGBColorSpace, i.needsUpdate = !0, this.textures.set(e, i), this.onUpdate(e, i);
758
+ } catch (r) {
759
+ console.warn("[MirageEngine] Failed to load texture:", t, r);
759
760
  } finally {
760
761
  this.elementUrls.has(e) && this.loadStatus.set(e, !1);
761
762
  }
@@ -773,8 +774,8 @@ class tt {
773
774
  this.observer && this.observer.disconnect();
774
775
  }
775
776
  }
776
- class rt {
777
- constructor(e, t, i, r) {
777
+ class tt {
778
+ constructor(e, t, r, i) {
778
779
  g(this, "canvas");
779
780
  g(this, "scene");
780
781
  g(this, "camera");
@@ -792,50 +793,50 @@ class rt {
792
793
  g(this, "registry");
793
794
  g(this, "targetRect");
794
795
  g(this, "travelersByLayer", Array.from(
795
- { length: F.MAX_LAYERS },
796
+ { length: k.MAX_LAYERS },
796
797
  () => /* @__PURE__ */ new Set()
797
798
  ));
798
799
  g(this, "textureManager");
799
800
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
800
801
  g(this, "fixedMeshes", /* @__PURE__ */ new Set());
801
- var c, a, l, d, h;
802
- this.target = e, this.mountContainer = i, this.registry = r, this.mode = (c = t.mode) != null ? c : "overlay", this.canvasSize = (a = t.canvasSize) != null ? a : "viewport", this.clipArea = (l = t.travelerClipArea) != null ? l : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new tt((u, v) => {
802
+ var o, l, c, d, h;
803
+ this.target = e, this.mountContainer = r, this.registry = i, this.mode = (o = t.mode) != null ? o : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (c = t.travelerClipArea) != null ? c : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new et((u, p) => {
803
804
  const f = this.registry.get(u);
804
- f && f.material instanceof b.ShaderMaterial && H.forceUpdateUniforms(f.material, { texture: v });
805
- }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new b.Scene(), this.targetRect = this.target.getBoundingClientRect();
806
- const n = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, o = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
807
- this.camera = new b.OrthographicCamera(
808
- n / -2,
805
+ f && f.material instanceof y.ShaderMaterial && Y.forceUpdateUniforms(f.material, { texture: p });
806
+ }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new y.Scene(), this.targetRect = this.target.getBoundingClientRect();
807
+ const a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
808
+ this.camera = new y.OrthographicCamera(
809
+ a / -2,
810
+ a / 2,
809
811
  n / 2,
810
- o / 2,
811
- o / -2,
812
+ n / -2,
812
813
  1,
813
814
  1e3
814
- ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new b.WebGLRenderer({
815
+ ), this.camera.position.z = 100, this.camera.layers.set(this.getSceneLayer()), this.renderer = new y.WebGLRenderer({
815
816
  canvas: this.canvas,
816
817
  alpha: !0,
817
818
  antialias: !0
818
819
  // [new]
819
820
  // premultipliedAlpha: true
820
- }), b.ColorManagement.enabled = !1, this.renderer.outputColorSpace = b.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(n, o), this.applyTextQuality((h = t.quality) != null ? h : "medium");
821
+ }), y.ColorManagement.enabled = !1, this.renderer.outputColorSpace = y.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(a, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
821
822
  }
822
823
  get isViewport() {
823
824
  return this.mode === "overlay" && this.canvasSize === "viewport";
824
825
  }
825
826
  getSceneLayer() {
826
- return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? I.SELECTED : I.BASE;
827
+ return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? L.SELECTED : L.BASE;
827
828
  }
828
829
  createRenderTarget() {
829
- for (let e = 0; e < F.MAX_LAYERS; e++) {
830
- const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, i = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
830
+ for (let e = 0; e < k.MAX_LAYERS; e++) {
831
+ const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
831
832
  this.renderTargets.push(
832
- new b.WebGLRenderTarget(
833
+ new y.WebGLRenderTarget(
833
834
  t * this.qualityFactor,
834
- i * this.qualityFactor,
835
+ r * this.qualityFactor,
835
836
  {
836
- minFilter: b.LinearFilter,
837
- magFilter: b.LinearFilter,
838
- format: b.RGBAFormat,
837
+ minFilter: y.LinearFilter,
838
+ magFilter: y.LinearFilter,
839
+ format: y.RGBAFormat,
839
840
  stencilBuffer: !1,
840
841
  depthBuffer: !0
841
842
  }
@@ -871,15 +872,15 @@ class rt {
871
872
  this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`, this.mode === "duplicate" ? (this.canvas.style.position = "", this.canvas.style.top = "", this.canvas.style.left = "", this.canvas.style.display = "block") : (this.canvas.style.position = this.isViewport ? "fixed" : "absolute", this.canvas.style.top = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetTop}px`, this.canvas.style.left = this.isViewport ? `-${this.overscan}px` : `${this.target.offsetLeft}px`, this.canvas.style.display = "block");
872
873
  }
873
874
  updateUniforms(e, t) {
874
- const i = this.registry.get(e);
875
- i && (i.traverse((r) => {
876
- r.isMesh && r.material && H.forceUpdateUniforms(
877
- r.material,
875
+ const r = this.registry.get(e);
876
+ r && (r.traverse((i) => {
877
+ i.isMesh && i.material && Y.forceUpdateUniforms(
878
+ i.material,
878
879
  t
879
880
  );
880
- }), i.userData.nativeMesh && i.userData.nativeMesh.traverse((r) => {
881
- r.isMesh && r.material && H.forceUpdateUniforms(
882
- r.material,
881
+ }), r.userData.nativeMesh && r.userData.nativeMesh.traverse((i) => {
882
+ i.isMesh && i.material && Y.forceUpdateUniforms(
883
+ i.material,
883
884
  t
884
885
  );
885
886
  }));
@@ -889,20 +890,20 @@ class rt {
889
890
  }
890
891
  setSize(e, t) {
891
892
  this.renderer.setSize(e, t);
892
- for (const i of this.renderTargets)
893
- i.setSize(e * this.qualityFactor, t * this.qualityFactor);
893
+ for (const r of this.renderTargets)
894
+ r.setSize(e * this.qualityFactor, t * this.qualityFactor);
894
895
  this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
895
896
  }
896
897
  syncScene(e, t) {
897
- const i = this.target.getBoundingClientRect(), r = this.isViewport ? window.innerWidth + this.overscan * 2 : i.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : i.height, o = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, c = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, a = Math.abs(r - o) > 0.1 || Math.abs(n - c) > 0.1, l = this.mode === "overlay" && (Math.abs(i.top - this.targetRect.top) > 0.1 || Math.abs(i.left - this.targetRect.left) > 0.1);
898
- a ? (this.targetRect = i, this.setSize(r, n), this.updateCanvasLayout()) : l ? (this.targetRect = i, this.updateCanvasLayout()) : this.targetRect = i, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
898
+ const r = this.target.getBoundingClientRect(), i = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, a = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, o = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, l = Math.abs(i - n) > 0.1 || Math.abs(a - o) > 0.1, c = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
899
+ l ? (this.targetRect = r, this.setSize(i, a), this.updateCanvasLayout()) : c ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
899
900
  const h = this.registry.get(d);
900
901
  if (h) {
901
902
  this.scene.remove(h);
902
903
  for (const u of this.travelersByLayer)
903
904
  u.delete(h);
904
905
  this.fixedMeshes.delete(h), h.geometry.dispose(), h.userData.nativeMesh && (this.scene.remove(h.userData.nativeMesh), Array.isArray(h.userData.nativeMesh.material) ? h.userData.nativeMesh.material.forEach((u) => u.dispose()) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((u) => {
905
- u instanceof b.Mesh && (u.geometry && u.geometry.dispose(), u.material && (Array.isArray(u.material) ? u.material.forEach((v) => v.dispose()) : u.material.dispose()));
906
+ u instanceof y.Mesh && (u.geometry && u.geometry.dispose(), u.material && (Array.isArray(u.material) ? u.material.forEach((p) => p.dispose()) : u.material.dispose()));
906
907
  }), this.registry.remove(d), this.textureManager.unregister(d);
907
908
  }
908
909
  });
@@ -914,8 +915,9 @@ class rt {
914
915
  reconcileNode(e) {
915
916
  var i;
916
917
  let t = this.registry.get(e.element);
917
- if (!t) {
918
- const r = new b.PlaneGeometry(1, 1), n = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), o = H.create(
918
+ const r = JSON.stringify(e.shaderHooks || null);
919
+ if (t && t.userData.shaderHash !== r && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof y.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
920
+ const a = new y.PlaneGeometry(1, 1), n = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), o = Y.create(
919
921
  "BOX",
920
922
  e.styles,
921
923
  "",
@@ -925,137 +927,139 @@ class rt {
925
927
  n,
926
928
  e.shaderHooks
927
929
  );
928
- t = new b.Mesh(r, o), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = o;
930
+ t = new y.Mesh(a, o), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = o, t.userData.domElement = e.element, t.userData.shaderHash = r;
929
931
  }
930
932
  if (this.updateMeshProperties(t, e), this.updateMeshLayers(t, e), e.isTraveler)
931
- for (let r = 0; r < F.MAX_LAYERS; r++)
932
- r === e.captureLayer - 2 ? this.travelersByLayer[r].add(t) : this.travelersByLayer[r].delete(t);
933
+ for (let a = 0; a < k.MAX_LAYERS; a++)
934
+ a === e.captureLayer - 2 ? this.travelersByLayer[a].add(t) : this.travelersByLayer[a].delete(t);
933
935
  else
934
- for (const r of this.travelersByLayer)
935
- r.delete(t);
936
+ for (const a of this.travelersByLayer)
937
+ a.delete(t);
936
938
  if (e.isFixed ? this.fixedMeshes.add(t) : this.fixedMeshes.delete(t), e.styles.imageSrc ? this.textureManager.register(e.element, e.styles.imageSrc) : this.textureManager.unregister(e.element), e.type === "BOX")
937
- for (const r of e.children)
938
- this.reconcileNode(r);
939
+ for (const a of e.children)
940
+ this.reconcileNode(a);
939
941
  else
940
942
  e.type === "TEXT" && (this.reconcileTextChild(t, e, !1), t.userData.nativeMesh && e.nativeStyles && this.reconcileTextChild(t.userData.nativeMesh, e, !0));
941
943
  }
942
- reconcileTextChild(e, t, i) {
943
- var l;
944
- const r = t.textLines || [
944
+ reconcileTextChild(e, t, r) {
945
+ var c;
946
+ const i = t.textLines || [
945
947
  { text: t.textContent || "", rect: t.rect }
946
- ], n = i ? t.nativeStyles : t.textStyles, o = JSON.stringify(n) + t.textContent + r.map((d) => d.text).join("|"), c = (l = e.userData) == null ? void 0 : l.textChildStyleHash;
947
- if (t.dirtyMask & be || o !== c) {
948
+ ], a = r ? t.nativeStyles : t.textStyles, n = JSON.stringify(a) + t.textContent + i.map((d) => d.text).join("|"), o = (c = e.userData) == null ? void 0 : c.textChildStyleHash;
949
+ if (t.dirtyMask & le || n !== o) {
948
950
  e.children.filter(
949
951
  (f) => f.name.startsWith("TEXT_CHILD")
950
952
  ).forEach((f) => {
951
953
  var E;
952
- const p = f;
953
- (E = p.material.map) == null || E.dispose(), p.geometry.dispose(), e.remove(p);
954
+ const m = f;
955
+ (E = m.material.map) == null || E.dispose(), m.geometry.dispose(), e.remove(m);
954
956
  });
955
- const h = t.rect, u = h.x + h.width / 2, v = h.y + h.height / 2;
956
- r.forEach((f, p) => {
957
- const E = H.create(
957
+ const h = t.rect, u = h.x + h.width / 2, p = h.y + h.height / 2;
958
+ i.forEach((f, m) => {
959
+ const E = Y.create(
958
960
  "TEXT",
959
- n,
961
+ a,
960
962
  f.text,
961
963
  f.rect.width,
962
964
  f.rect.height,
963
965
  this.qualityFactor
964
- ), R = new b.PlaneGeometry(1, 1), L = new b.Mesh(R, E);
965
- L.name = `TEXT_CHILD_${p}`;
966
- const x = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, w = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
967
- L.scale.set(x, w, 1);
968
- const U = f.rect.x + f.rect.width / 2, M = f.rect.y + f.rect.height / 2, B = U - u, X = -(M - v);
969
- L.position.set(
970
- t.rect.width === 0 ? 0 : B / t.rect.width,
971
- t.rect.height === 0 ? 0 : X / t.rect.height,
966
+ ), R = new y.PlaneGeometry(1, 1), M = new y.Mesh(R, E);
967
+ M.name = `TEXT_CHILD_${m}`;
968
+ const w = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, b = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
969
+ M.scale.set(w, b, 1);
970
+ const U = f.rect.x + f.rect.width / 2, D = f.rect.y + f.rect.height / 2, O = U - u, N = -(D - p);
971
+ M.position.set(
972
+ t.rect.width === 0 ? 0 : O / t.rect.width,
973
+ t.rect.height === 0 ? 0 : N / t.rect.height,
972
974
  5e-3
973
- ), e.add(L);
974
- }), e.userData.textChildStyleHash = o;
975
+ ), e.add(M);
976
+ }), e.userData.textChildStyleHash = n;
975
977
  }
976
978
  e.children.forEach((d) => {
977
979
  if (!d.name.startsWith("TEXT_CHILD"))
978
980
  return;
979
- const h = d, u = t.visibility & W ? I.BASE : I.HIDDEN;
980
- if (h.layers.set(u), t.visibility & j && h.layers.enable(I.SELECTED), t.visibility & W)
981
- if (!i && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
982
- for (let v = t.captureLayer; v < t.nativeLayer; v++)
983
- h.layers.enable(I.getCaptureLayer(v));
984
- else if (i && t.nativeLayer !== void 0)
985
- for (let v = Math.max(t.captureLayer, t.nativeLayer); v <= F.MAX_LAYERS + 1; v++)
986
- h.layers.enable(I.getCaptureLayer(v));
981
+ const h = d, u = t.visibility & W ? L.BASE : L.HIDDEN;
982
+ if (h.layers.set(u), t.visibility & j && h.layers.enable(L.SELECTED), t.visibility & W)
983
+ if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
984
+ for (let p = t.captureLayer; p < t.nativeLayer; p++)
985
+ h.layers.enable(L.getCaptureLayer(p));
986
+ else if (r && t.nativeLayer !== void 0)
987
+ for (let p = Math.max(t.captureLayer, t.nativeLayer); p <= k.MAX_LAYERS + 1; p++)
988
+ h.layers.enable(L.getCaptureLayer(p));
987
989
  else
988
- for (let v = t.captureLayer; v <= F.MAX_LAYERS + 1; v++)
989
- h.layers.enable(I.getCaptureLayer(v));
990
+ for (let p = t.captureLayer; p <= k.MAX_LAYERS + 1; p++)
991
+ h.layers.enable(L.getCaptureLayer(p));
990
992
  });
991
993
  }
992
994
  updateMeshProperties(e, t) {
993
- var x, w, U;
994
- const { rect: i, styles: r } = t, n = this.renderer.getPixelRatio(), o = this.renderer.domElement.width / n, c = this.renderer.domElement.height / n;
995
- e.material = e.userData.baseMaterial, e.scale.set(i.width, i.height, 1), e.userData.domRect = pe(G({}, i), {
996
- width: i.width,
997
- height: i.height
998
- });
999
- const a = 1e-3;
995
+ var w, b, U;
996
+ const { rect: r, styles: i } = t, a = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / a, o = this.renderer.domElement.height / a;
997
+ e.material = e.userData.baseMaterial, e.scale.set(r.width, r.height, 1), e.userData.domRect = {
998
+ x: r.x,
999
+ y: r.y,
1000
+ width: r.width,
1001
+ height: r.height
1002
+ };
1003
+ const l = 1e-3;
1000
1004
  this.renderOrder++;
1001
- const l = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1005
+ const c = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1002
1006
  let h, u;
1003
1007
  if (this.isViewport)
1004
- h = i.x - window.innerWidth / 2 + i.width / 2, u = -i.y + window.innerHeight / 2 - i.height / 2;
1008
+ h = r.x - window.innerWidth / 2 + r.width / 2, u = -r.y + window.innerHeight / 2 - r.height / 2;
1005
1009
  else {
1006
- const M = i.x - l, B = i.y - d;
1007
- h = M - o / 2 + i.width / 2, u = -B + c / 2 - i.height / 2;
1010
+ const D = r.x - c, O = r.y - d;
1011
+ h = D - n / 2 + r.width / 2, u = -O + o / 2 - r.height / 2;
1008
1012
  }
1009
1013
  e.position.set(
1010
1014
  h,
1011
1015
  u,
1012
- r.zIndex + this.renderOrder * a
1016
+ i.zIndex + this.renderOrder * l
1013
1017
  );
1014
- const v = i.x, f = i.y;
1015
- e.userData.basePosition = { x: h, y: u }, e.userData.originalBasePosition = { x: h, y: u }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: v, y: f }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1016
- const p = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, E = window.getComputedStyle(p);
1017
- let R = 0, L = 0;
1018
+ const p = r.x, f = r.y;
1019
+ e.userData.basePosition = { x: h, y: u }, e.userData.originalBasePosition = { x: h, y: u }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: p, y: f }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1020
+ const m = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, E = window.getComputedStyle(m);
1021
+ let R = 0, M = 0;
1018
1022
  if (E.transform && E.transform !== "none") {
1019
- const M = new DOMMatrix(E.transform);
1020
- R = M.m41, L = M.m42;
1023
+ const D = new DOMMatrix(E.transform);
1024
+ R = D.m41, M = D.m42;
1021
1025
  }
1022
- if (e.userData.baseTransform = { x: R, y: L }, delete e.userData.originRatioX, delete e.userData.originRatioY, H.update(
1026
+ if (e.userData.baseTransform = { x: R, y: M }, delete e.userData.originRatioX, delete e.userData.originRatioY, Y.update(
1023
1027
  e.userData.baseMaterial,
1024
1028
  "BOX",
1025
- r,
1029
+ i,
1026
1030
  "",
1027
- i.width,
1028
- i.height,
1031
+ r.width,
1032
+ r.height,
1029
1033
  this.qualityFactor,
1030
- t.isTraveler ? (x = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : x.texture : this.textureManager.get(t.element)
1034
+ t.isTraveler ? (w = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : w.texture : this.textureManager.get(t.element)
1031
1035
  ), t.nativeStyles && t.nativeRect) {
1032
1036
  if (!e.userData.nativeMesh) {
1033
- const A = H.create(
1037
+ const I = Y.create(
1034
1038
  "BOX",
1035
1039
  t.nativeStyles,
1036
1040
  "",
1037
1041
  t.nativeRect.width,
1038
1042
  t.nativeRect.height,
1039
1043
  this.qualityFactor,
1040
- t.isTraveler ? (w = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : w.texture : this.textureManager.get(t.element),
1044
+ t.isTraveler ? (b = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : b.texture : this.textureManager.get(t.element),
1041
1045
  t.shaderHooks
1042
- ), Y = new b.Mesh(e.geometry, A);
1043
- t.type === "TEXT" && (Y.name = "BG_MESH"), this.scene.add(Y), e.userData.nativeMesh = Y;
1046
+ ), P = new y.Mesh(e.geometry, I);
1047
+ t.type === "TEXT" && (P.name = "BG_MESH"), this.scene.add(P), e.userData.nativeMesh = P;
1044
1048
  }
1045
- const M = e.userData.nativeMesh;
1046
- let B, X;
1049
+ const D = e.userData.nativeMesh;
1050
+ let O, N;
1047
1051
  if (this.isViewport)
1048
- B = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, X = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1052
+ O = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, N = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1049
1053
  else {
1050
- const A = t.nativeRect.x - l, Y = t.nativeRect.y - d;
1051
- B = A - o / 2 + t.nativeRect.width / 2, X = -Y + c / 2 - t.nativeRect.height / 2;
1054
+ const I = t.nativeRect.x - c, P = t.nativeRect.y - d;
1055
+ O = I - n / 2 + t.nativeRect.width / 2, N = -P + o / 2 - t.nativeRect.height / 2;
1052
1056
  }
1053
- M.scale.set(t.nativeRect.width, t.nativeRect.height, 1), M.position.set(
1054
- B,
1055
- X,
1056
- t.nativeStyles.zIndex + this.renderOrder * a
1057
- ), H.update(
1058
- M.material,
1057
+ D.scale.set(t.nativeRect.width, t.nativeRect.height, 1), D.position.set(
1058
+ O,
1059
+ N,
1060
+ t.nativeStyles.zIndex + this.renderOrder * l
1061
+ ), Y.update(
1062
+ D.material,
1059
1063
  "BOX",
1060
1064
  t.nativeStyles,
1061
1065
  "",
@@ -1065,135 +1069,167 @@ class rt {
1065
1069
  t.isTraveler ? (U = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : U.texture : this.textureManager.get(t.element)
1066
1070
  );
1067
1071
  } else
1068
- e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof b.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1072
+ e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof y.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1069
1073
  }
1070
1074
  updateMeshLayers(e, t) {
1071
- const i = t.visibility & W ? I.BASE : I.HIDDEN;
1072
- if (e.layers.set(i), t.visibility & j && e.layers.enable(I.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1073
- const r = e.userData.nativeMesh;
1074
- if (r.layers.set(I.HIDDEN), t.visibility & W) {
1075
- for (let n = t.captureLayer; n < t.nativeLayer; n++)
1076
- e.layers.enable(I.getCaptureLayer(n));
1077
- for (let n = Math.max(t.captureLayer, t.nativeLayer); n <= F.MAX_LAYERS + 1; n++)
1078
- r.layers.enable(I.getCaptureLayer(n));
1075
+ const r = t.visibility & W ? L.BASE : L.HIDDEN;
1076
+ if (e.layers.set(r), t.visibility & j && e.layers.enable(L.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1077
+ const i = e.userData.nativeMesh;
1078
+ if (i.layers.set(L.HIDDEN), t.visibility & W) {
1079
+ for (let a = t.captureLayer; a < t.nativeLayer; a++)
1080
+ e.layers.enable(L.getCaptureLayer(a));
1081
+ for (let a = Math.max(t.captureLayer, t.nativeLayer); a <= k.MAX_LAYERS + 1; a++)
1082
+ i.layers.enable(L.getCaptureLayer(a));
1079
1083
  }
1080
1084
  } else if (t.visibility & W)
1081
- for (let r = t.captureLayer; r <= F.MAX_LAYERS + 1; r++)
1082
- e.layers.enable(I.getCaptureLayer(r));
1085
+ for (let i = t.captureLayer; i <= k.MAX_LAYERS + 1; i++)
1086
+ e.layers.enable(L.getCaptureLayer(i));
1083
1087
  }
1084
- captureRenderTarget(e, t, i) {
1085
- if (e.size === 0 || !i)
1088
+ captureRenderTarget(e, t, r) {
1089
+ if (e.size === 0 || !r)
1086
1090
  return;
1087
- const r = new b.Color(), n = this.renderer.getClearAlpha();
1088
- this.renderer.getClearColor(r), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(i), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1089
- const o = new b.Vector3(), c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, a = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, l = this.renderer.getPixelRatio();
1091
+ const i = new y.Color(), a = this.renderer.getClearAlpha();
1092
+ this.renderer.getClearColor(i), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(r), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1093
+ const n = new y.Vector3(), o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, c = this.renderer.getPixelRatio();
1090
1094
  for (const d of e) {
1091
- o.setFromMatrixPosition(d.matrixWorld), o.project(this.camera);
1092
- const h = (o.x + 1) / 2 * c, u = (o.y + 1) / 2 * a;
1093
- let v = 0, f = 1;
1094
- typeof this.clipArea == "number" ? f = this.clipArea : this.clipArea.endsWith("%") ? f = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (v = parseFloat(this.clipArea));
1095
- const p = d.scale.x * f + 0.5, E = d.scale.y * f + 0.5, R = h - p / 2, L = u - E / 2, x = (R * this.qualityFactor - v) / l, w = (L * this.qualityFactor - v) / l, U = (p * this.qualityFactor + v * 2) / l, M = (E * this.qualityFactor + v * 2) / l;
1096
- this.renderer.setScissor(x, w, U, M), this.renderer.render(this.scene, this.camera);
1095
+ n.setFromMatrixPosition(d.matrixWorld), n.project(this.camera);
1096
+ const h = (n.x + 1) / 2 * o, u = (n.y + 1) / 2 * l;
1097
+ let p = 0, f = 1;
1098
+ typeof this.clipArea == "number" ? f = this.clipArea : this.clipArea.endsWith("%") ? f = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1099
+ const m = d.scale.x * f + 0.5, E = d.scale.y * f + 0.5, R = h - m / 2, M = u - E / 2, w = (R * this.qualityFactor - p) / c, b = (M * this.qualityFactor - p) / c, U = (m * this.qualityFactor + p * 2) / c, D = (E * this.qualityFactor + p * 2) / c;
1100
+ this.renderer.setScissor(w, b, U, D), this.renderer.render(this.scene, this.camera);
1097
1101
  }
1098
- this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(r, n);
1102
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, a);
1099
1103
  }
1100
1104
  render() {
1101
- for (let e = 0; e < F.MAX_LAYERS; e++) {
1105
+ for (let e = 0; e < k.MAX_LAYERS; e++) {
1102
1106
  const t = e + 1;
1103
1107
  this.captureRenderTarget(
1104
1108
  this.travelersByLayer[e],
1105
- I.getCaptureLayer(t),
1109
+ L.getCaptureLayer(t),
1106
1110
  this.renderTargets[e]
1107
1111
  );
1108
1112
  }
1109
1113
  this.renderer.render(this.scene, this.camera);
1110
1114
  }
1111
- updateCameraScroll(e, t) {
1112
- this.isViewport && (this.camera.position.x = e, this.camera.position.y = -t, this.camera.updateMatrixWorld());
1115
+ syncMeshesByDOM() {
1116
+ const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, r = this.renderer.getPixelRatio(), i = this.renderer.domElement.width / r, a = this.renderer.domElement.height / r;
1117
+ this.scene.children.forEach((n) => {
1118
+ const o = n;
1119
+ if (!o.userData || !o.userData.domElement)
1120
+ return;
1121
+ const l = o.userData.domElement;
1122
+ if (!l.isConnected)
1123
+ return;
1124
+ let c;
1125
+ if (l.nodeType === Node.TEXT_NODE) {
1126
+ const h = document.createRange();
1127
+ h.selectNode(l), c = h.getBoundingClientRect();
1128
+ } else
1129
+ c = l.getBoundingClientRect();
1130
+ const d = o.userData.domRect;
1131
+ if (!d || Math.abs(c.x - d.x) > 0.5 || Math.abs(c.y - d.y) > 0.5 || Math.abs(c.width - d.width) > 0.5 || Math.abs(c.height - d.height) > 0.5) {
1132
+ o.userData.domRect = { x: c.x, y: c.y, width: c.width, height: c.height };
1133
+ let h, u;
1134
+ if (this.isViewport)
1135
+ h = c.x - window.innerWidth / 2 + c.width / 2, u = -c.y + window.innerHeight / 2 - c.height / 2;
1136
+ else {
1137
+ const p = c.x - e, f = c.y - t;
1138
+ h = p - i / 2 + c.width / 2, u = -f + a / 2 - c.height / 2;
1139
+ }
1140
+ if (o.position.setX(h), o.position.setY(u), o.scale.set(c.width, c.height, 1), o.material instanceof y.ShaderMaterial && Y.forceUpdateUniforms(o.material, {
1141
+ width: c.width,
1142
+ height: c.height
1143
+ }), o.userData.nativeMesh) {
1144
+ const p = o.userData.nativeMesh;
1145
+ p.position.setX(h), p.position.setY(u), p.scale.set(c.width, c.height, 1);
1146
+ }
1147
+ }
1148
+ });
1113
1149
  }
1114
1150
  }
1115
- function it(s) {
1151
+ function rt(s) {
1116
1152
  const e = s.textContent || "", t = [];
1117
- let i = "", r = null, n = -1;
1118
- const o = (l, d) => {
1119
- for (let h = 0; h < l.length; h++) {
1120
- const u = l[h], v = document.createRange();
1121
- v.setStart(s, d + h), v.setEnd(s, d + h + 1);
1122
- const f = v.getBoundingClientRect();
1153
+ let r = "", i = null, a = -1;
1154
+ const n = (c, d) => {
1155
+ for (let h = 0; h < c.length; h++) {
1156
+ const u = c[h], p = document.createRange();
1157
+ p.setStart(s, d + h), p.setEnd(s, d + h + 1);
1158
+ const f = p.getBoundingClientRect();
1123
1159
  if (f.width === 0 && f.height === 0) {
1124
- i += u;
1160
+ r += u;
1125
1161
  continue;
1126
1162
  }
1127
- n === -1 || Math.abs(f.top - n) > f.height / 2 ? (i && r && t.push({
1128
- text: i,
1163
+ a === -1 || Math.abs(f.top - a) > f.height / 2 ? (r && i && t.push({
1164
+ text: r,
1129
1165
  rect: {
1130
- left: r.left,
1131
- top: r.top,
1132
- width: r.right - r.left,
1133
- height: r.bottom - r.top
1166
+ left: i.left,
1167
+ top: i.top,
1168
+ width: i.right - i.left,
1169
+ height: i.bottom - i.top
1134
1170
  }
1135
- }), i = u, r = {
1171
+ }), r = u, i = {
1136
1172
  left: f.left,
1137
1173
  top: f.top,
1138
1174
  right: f.right,
1139
1175
  bottom: f.bottom
1140
- }, n = f.top) : (i += u, r && (r.left = Math.min(r.left, f.left), r.top = Math.min(r.top, f.top), r.right = Math.max(r.right, f.right), r.bottom = Math.max(
1141
- r.bottom,
1176
+ }, a = f.top) : (r += u, i && (i.left = Math.min(i.left, f.left), i.top = Math.min(i.top, f.top), i.right = Math.max(i.right, f.right), i.bottom = Math.max(
1177
+ i.bottom,
1142
1178
  f.bottom
1143
1179
  )));
1144
1180
  }
1145
- }, c = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1146
- let a = 0;
1147
- for (const l of c) {
1181
+ }, o = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1182
+ let l = 0;
1183
+ for (const c of o) {
1148
1184
  const d = document.createRange();
1149
- d.setStart(s, a), d.setEnd(s, a + l.length);
1185
+ d.setStart(s, l), d.setEnd(s, l + c.length);
1150
1186
  const h = d.getClientRects();
1151
1187
  if (h.length > 1)
1152
- o(l, a);
1188
+ n(c, l);
1153
1189
  else {
1154
1190
  const u = h.length === 1 ? h[0] : d.getBoundingClientRect();
1155
1191
  if (u.width === 0 && u.height === 0) {
1156
- i += l, a += l.length;
1192
+ r += c, l += c.length;
1157
1193
  continue;
1158
1194
  }
1159
- n === -1 || Math.abs(u.top - n) > u.height / 2 ? (i && r && t.push({
1160
- text: i,
1195
+ a === -1 || Math.abs(u.top - a) > u.height / 2 ? (r && i && t.push({
1196
+ text: r,
1161
1197
  rect: {
1162
- left: r.left,
1163
- top: r.top,
1164
- width: r.right - r.left,
1165
- height: r.bottom - r.top
1198
+ left: i.left,
1199
+ top: i.top,
1200
+ width: i.right - i.left,
1201
+ height: i.bottom - i.top
1166
1202
  }
1167
- }), i = l, r = {
1203
+ }), r = c, i = {
1168
1204
  left: u.left,
1169
1205
  top: u.top,
1170
1206
  right: u.right,
1171
1207
  bottom: u.bottom
1172
- }, n = u.top) : (i += l, r && (r.left = Math.min(r.left, u.left), r.top = Math.min(r.top, u.top), r.right = Math.max(r.right, u.right), r.bottom = Math.max(
1173
- r.bottom,
1208
+ }, a = u.top) : (r += c, i && (i.left = Math.min(i.left, u.left), i.top = Math.min(i.top, u.top), i.right = Math.max(i.right, u.right), i.bottom = Math.max(
1209
+ i.bottom,
1174
1210
  u.bottom
1175
1211
  )));
1176
1212
  }
1177
- a += l.length;
1213
+ l += c.length;
1178
1214
  }
1179
- return i && r && t.push({
1180
- text: i,
1215
+ return r && i && t.push({
1216
+ text: r,
1181
1217
  rect: {
1182
- left: r.left,
1183
- top: r.top,
1184
- width: r.right - r.left,
1185
- height: r.bottom - r.top
1218
+ left: i.left,
1219
+ top: i.top,
1220
+ width: i.right - i.left,
1221
+ height: i.bottom - i.top
1186
1222
  }
1187
1223
  }), t.filter(
1188
- (l) => l.text.trim().length > 0 && l.rect.width > 0 && l.rect.height > 0
1224
+ (c) => c.text.trim().length > 0 && c.rect.width > 0 && c.rect.height > 0
1189
1225
  );
1190
1226
  }
1191
- function Le(s) {
1227
+ function Se(s) {
1192
1228
  const e = parseFloat(s.fontSize);
1193
1229
  let t = parseFloat(s.lineHeight);
1194
1230
  isNaN(t) && (t = e * 1.2);
1195
- let i = parseFloat(s.letterSpacing);
1196
- return isNaN(i) && (i = 0), {
1231
+ let r = parseFloat(s.letterSpacing);
1232
+ return isNaN(r) && (r = 0), {
1197
1233
  font: `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`,
1198
1234
  fontSize: s.fontSize,
1199
1235
  color: s.color,
@@ -1201,329 +1237,303 @@ function Le(s) {
1201
1237
  textBaseline: "alphabetic",
1202
1238
  direction: s.direction || "inherit",
1203
1239
  lineHeight: t,
1204
- letterSpacing: i
1240
+ letterSpacing: r
1205
1241
  };
1206
1242
  }
1207
- function ke(s, e = $ | oe | Ye | be | ve, t, i = 1, r = 0, n = 2, o, c) {
1208
- var Q, Z, ee, te, re, ie;
1243
+ function De(s, e = $ | Q | ze | le | re, t, r = 1, i = 0, a = 2, n, o) {
1244
+ var de, ue, fe, ge, pe, me;
1209
1245
  if (s.nodeType === Node.TEXT_NODE) {
1210
- const m = s;
1211
- if (!m.textContent || !m.textContent.trim())
1246
+ const v = s;
1247
+ if (!v.textContent || !v.textContent.trim())
1212
1248
  return null;
1213
- const T = m.textContent.replace(/\s+/g, " ");
1214
- if (T.length === 0)
1249
+ const C = v.textContent.replace(/\s+/g, " ");
1250
+ if (C.length === 0)
1215
1251
  return null;
1216
- const D = it(m);
1217
- if (D.length === 0)
1252
+ const A = rt(v);
1253
+ if (A.length === 0)
1218
1254
  return null;
1219
- const k = m.parentElement, S = k ? window.getComputedStyle(k) : null;
1255
+ const B = v.parentElement, S = B ? window.getComputedStyle(B) : null;
1220
1256
  if (!S)
1221
1257
  return null;
1222
- const O = Math.min(...D.map((y) => y.rect.left)), C = Math.min(...D.map((y) => y.rect.top)), _ = Math.max(...D.map((y) => y.rect.left + y.rect.width)), P = Math.max(...D.map((y) => y.rect.top + y.rect.height));
1258
+ const X = Math.min(...A.map((T) => T.rect.left)), x = Math.min(...A.map((T) => T.rect.top)), z = Math.max(...A.map((T) => T.rect.left + T.rect.width)), G = Math.max(...A.map((T) => T.rect.top + T.rect.height));
1223
1259
  return {
1224
1260
  id: Math.random().toString(36).substring(2, 9),
1225
1261
  type: "TEXT",
1226
- element: m,
1262
+ element: v,
1227
1263
  rect: {
1228
- x: O + window.scrollX,
1229
- y: C + window.scrollY,
1230
- width: _ - O,
1231
- height: P - C
1264
+ x: X + window.scrollX,
1265
+ y: x + window.scrollY,
1266
+ width: z - X,
1267
+ height: G - x
1232
1268
  },
1233
1269
  styles: {
1234
1270
  backgroundColor: "transparent",
1235
1271
  backgroundImage: "",
1236
- opacity: k && k.dataset[q.KEY] === q.VALUES.HIDE ? 1 : parseFloat(S.opacity),
1237
- zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + r,
1272
+ opacity: B && B.dataset[H.KEY] === H.VALUES.HIDE ? 1 : parseFloat(S.opacity),
1273
+ zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + i,
1238
1274
  borderRadius: "0px",
1239
1275
  borderColor: "transparent",
1240
1276
  borderWidth: "0px",
1241
1277
  isTraveler: !1
1242
1278
  },
1243
- textContent: T,
1244
- textLines: D.map((y) => ({
1245
- text: y.text.trim(),
1279
+ textContent: C,
1280
+ textLines: A.map((T) => ({
1281
+ text: T.text.trim(),
1246
1282
  rect: {
1247
- x: y.rect.left + window.scrollX,
1248
- y: y.rect.top + window.scrollY,
1249
- width: y.rect.width,
1250
- height: y.rect.height
1283
+ x: T.rect.left + window.scrollX,
1284
+ y: T.rect.top + window.scrollY,
1285
+ width: T.rect.width,
1286
+ height: T.rect.height
1251
1287
  }
1252
1288
  })),
1253
- textStyles: Le(S),
1289
+ textStyles: Se(S),
1254
1290
  dirtyMask: e,
1255
1291
  visibility: t,
1256
1292
  isTraveler: !1,
1257
- captureLayer: i,
1293
+ captureLayer: r,
1258
1294
  isFixed: S.position === "fixed",
1259
- nativeLayer: o,
1260
- nativeStyles: c ? G(G({
1295
+ nativeLayer: n,
1296
+ nativeStyles: o ? q(q({
1261
1297
  backgroundColor: "transparent",
1262
1298
  backgroundImage: "",
1263
- opacity: k && k.dataset[q.KEY] === q.VALUES.HIDE ? 1 : parseFloat(S.opacity),
1264
- zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + r,
1299
+ opacity: B && B.dataset[H.KEY] === H.VALUES.HIDE ? 1 : parseFloat(S.opacity),
1300
+ zIndex: (isNaN(parseInt(S.zIndex)) ? 0 : parseInt(S.zIndex)) + i,
1265
1301
  borderRadius: "0px",
1266
1302
  borderColor: "transparent",
1267
1303
  borderWidth: "0px",
1268
1304
  isTraveler: !1
1269
- }, Le(S)), c) : void 0,
1270
- nativeRect: c ? {
1271
- x: O + window.scrollX,
1272
- y: C + window.scrollY,
1273
- width: _ - O,
1274
- height: P - C
1305
+ }, Se(S)), o) : void 0,
1306
+ nativeRect: o ? {
1307
+ x: X + window.scrollX,
1308
+ y: x + window.scrollY,
1309
+ width: z - X,
1310
+ height: G - x
1275
1311
  } : void 0,
1276
1312
  children: []
1277
1313
  };
1278
1314
  }
1279
1315
  if (s.nodeType !== Node.ELEMENT_NODE)
1280
1316
  return null;
1281
- const a = s, l = a.dataset[z.KEY];
1317
+ const l = s, c = l.dataset[_.KEY];
1282
1318
  let d = t, h = t;
1283
- if (l) {
1284
- const m = new Set(l.split(/\s+/));
1285
- for (const T of m)
1286
- if (!Se.includes(T))
1319
+ if (c) {
1320
+ const v = new Set(c.split(/\s+/));
1321
+ for (const C of v)
1322
+ if (!Ce.includes(C))
1287
1323
  throw new Error(
1288
- `[MirageEngine] Invalid filter token: '${T}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1324
+ `[MirageEngine] Invalid filter token: '${C}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1289
1325
  );
1290
- if (m.has(z.VALUES.END))
1326
+ if (v.has(_.VALUES.END))
1291
1327
  return null;
1292
- if (m.has(z.VALUES.INCLUDE_TREE) && m.has(z.VALUES.EXCLUDE_TREE))
1328
+ if (v.has(_.VALUES.INCLUDE_TREE) && v.has(_.VALUES.EXCLUDE_TREE))
1293
1329
  throw new Error(
1294
1330
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1295
1331
  );
1296
- if (m.has(z.VALUES.INCLUDE_SELF) && m.has(z.VALUES.EXCLUDE_SELF))
1332
+ if (v.has(_.VALUES.INCLUDE_SELF) && v.has(_.VALUES.EXCLUDE_SELF))
1297
1333
  throw new Error(
1298
1334
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1299
1335
  );
1300
- m.has(z.VALUES.INCLUDE_TREE) ? d = d | W : m.has(z.VALUES.EXCLUDE_TREE) && (d = d & ~W), h = d, m.has(z.VALUES.INCLUDE_SELF) ? h = h | W : m.has(z.VALUES.EXCLUDE_SELF) && (h = h & ~W);
1336
+ v.has(_.VALUES.INCLUDE_TREE) ? d = d | W : v.has(_.VALUES.EXCLUDE_TREE) && (d = d & ~W), h = d, v.has(_.VALUES.INCLUDE_SELF) ? h = h | W : v.has(_.VALUES.EXCLUDE_SELF) && (h = h & ~W);
1301
1337
  }
1302
- const u = a.dataset[V.KEY];
1338
+ const u = l.dataset[V.KEY];
1303
1339
  if (u) {
1304
- const m = new Set(u.split(/\s+/));
1305
- for (const T of m)
1306
- if (!Se.includes(T))
1340
+ const v = new Set(u.split(/\s+/));
1341
+ for (const C of v)
1342
+ if (!Ce.includes(C))
1307
1343
  throw new Error(
1308
- `[MirageEngine] Invalid select token: '${T}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1344
+ `[MirageEngine] Invalid select token: '${C}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1309
1345
  );
1310
- if (m.has(V.VALUES.END))
1346
+ if (v.has(V.VALUES.END))
1311
1347
  return null;
1312
- if (m.has(V.VALUES.INCLUDE_TREE) && m.has(V.VALUES.EXCLUDE_TREE))
1348
+ if (v.has(V.VALUES.INCLUDE_TREE) && v.has(V.VALUES.EXCLUDE_TREE))
1313
1349
  throw new Error(
1314
1350
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1315
1351
  );
1316
- if (m.has(V.VALUES.INCLUDE_SELF) && m.has(V.VALUES.EXCLUDE_SELF))
1352
+ if (v.has(V.VALUES.INCLUDE_SELF) && v.has(V.VALUES.EXCLUDE_SELF))
1317
1353
  throw new Error(
1318
1354
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1319
1355
  );
1320
- m.has(V.VALUES.INCLUDE_TREE) ? d = d | j : m.has(V.VALUES.EXCLUDE_TREE) && (d = d & ~j), h = d, m.has(V.VALUES.INCLUDE_SELF) ? h = h | j : m.has(V.VALUES.EXCLUDE_SELF) && (h = h & ~j);
1321
- }
1322
- const v = a.dataset[F.KEY];
1323
- let f = !1, p = c ? G({}, c) : {}, E = o;
1324
- if (v) {
1325
- let m = 1;
1326
- const T = v.indexOf("{"), D = v.lastIndexOf("}");
1327
- let k = v;
1328
- if (T !== -1 && D !== -1 && D > T) {
1329
- k = v.substring(0, T).trim();
1330
- const C = v.substring(T, D + 1);
1356
+ v.has(V.VALUES.INCLUDE_TREE) ? d = d | j : v.has(V.VALUES.EXCLUDE_TREE) && (d = d & ~j), h = d, v.has(V.VALUES.INCLUDE_SELF) ? h = h | j : v.has(V.VALUES.EXCLUDE_SELF) && (h = h & ~j);
1357
+ }
1358
+ const p = l.dataset[k.KEY];
1359
+ let f = !1, m = o ? q({}, o) : {}, E = n;
1360
+ if (p) {
1361
+ let v = 1;
1362
+ const C = p.indexOf("{"), A = p.lastIndexOf("}");
1363
+ let B = p;
1364
+ if (C !== -1 && A !== -1 && A > C) {
1365
+ B = p.substring(0, C).trim();
1366
+ const x = p.substring(C, A + 1);
1331
1367
  try {
1332
- p = new Function("return " + C)();
1333
- } catch (_) {
1368
+ m = new Function("return " + x)();
1369
+ } catch (z) {
1334
1370
  console.warn(
1335
- `[MirageEngine] Failed to parse travel styles JSON: ${C}`
1371
+ `[MirageEngine] Failed to parse travel styles JSON: ${x}`
1336
1372
  );
1337
1373
  }
1338
1374
  }
1339
- const S = k.split(/\s+/);
1340
- let O = !1;
1341
- if (S.includes(F.VALUES.TRAVELER)) {
1342
- f = !0, O = !0;
1343
- const C = S.find((_) => !isNaN(parseInt(_, 10)));
1344
- C && (m = parseInt(C, 10));
1345
- } else if (S.includes(F.VALUES.NATIVE)) {
1375
+ const S = B.split(/\s+/);
1376
+ let X = !1;
1377
+ if (S.includes(k.VALUES.TRAVELER)) {
1378
+ f = !0, X = !0;
1379
+ const x = S.find((z) => !isNaN(parseInt(z, 10)));
1380
+ x && (v = parseInt(x, 10));
1381
+ } else if (S.includes(k.VALUES.NATIVE)) {
1346
1382
  f = !1;
1347
- const C = S.find((_) => !isNaN(parseInt(_, 10)));
1348
- C && (E = parseInt(C, 10));
1383
+ const x = S.find((z) => !isNaN(parseInt(z, 10)));
1384
+ x && (E = parseInt(x, 10));
1349
1385
  }
1350
- if (O) {
1351
- const C = m + 1;
1352
- if (C < i)
1386
+ if (X) {
1387
+ const x = v + 1;
1388
+ if (x < r)
1353
1389
  throw new Error(
1354
- `[MirageEngine] Traveler layer (${m}) cannot be smaller than inherited capture layer (${i - 1}).`
1390
+ `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${r - 1}).`
1355
1391
  );
1356
- i = Math.min(C, F.MAX_LAYERS + 1);
1392
+ r = Math.min(x, k.MAX_LAYERS + 1);
1357
1393
  }
1358
1394
  }
1359
- const R = a.dataset[ze.KEY];
1360
- let L;
1361
- R && (L = JSON.parse(R));
1362
- const x = a.getBoundingClientRect(), w = window.getComputedStyle(a);
1363
- if (x.width === 0 || x.height === 0 || w.display === "none")
1395
+ const R = l.dataset[Xe.KEY];
1396
+ let M;
1397
+ R && (M = JSON.parse(R));
1398
+ const w = l.getBoundingClientRect(), b = window.getComputedStyle(l);
1399
+ if (w.width === 0 || w.height === 0 || b.display === "none")
1364
1400
  return null;
1365
- let U = a.getAttribute("data-mid");
1366
- U || (U = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", U));
1367
- const M = parseInt(w.zIndex), B = (isNaN(M) ? 0 : M) + r;
1368
- let X;
1369
- if (a.tagName === "IMG")
1370
- X = a.src;
1371
- else if (a.tagName.toLowerCase() === "svg") {
1372
- const m = a.cloneNode(!0), T = p == null ? void 0 : p.color, D = p == null ? void 0 : p.fill, k = p == null ? void 0 : p.stroke, S = p == null ? void 0 : p.opacity, O = (y, we) => {
1373
- const N = window.getComputedStyle(y), se = we, Ue = N.fill === N.color, Be = N.stroke === N.color, de = D || (Ue ? T : void 0) || N.fill;
1374
- de && de !== "none" && (se.style.fill = de);
1375
- const ue = k || (Be ? T : void 0) || N.stroke;
1376
- ue && ue !== "none" && (se.style.stroke = ue), N.strokeWidth && N.strokeWidth !== "0px" && (se.style.strokeWidth = N.strokeWidth);
1377
- const xe = T || N.color;
1378
- xe && (se.style.color = xe);
1379
- const fe = S || N.opacity;
1380
- fe && fe !== "1" && (se.style.opacity = fe);
1381
- for (let le = 0; le < y.children.length; le++)
1382
- O(y.children[le], we.children[le]);
1401
+ let U = l.getAttribute("data-mid");
1402
+ U || (U = Math.random().toString(36).substring(2, 11), l.setAttribute("data-mid", U));
1403
+ const D = parseInt(b.zIndex), O = (isNaN(D) ? 0 : D) + i;
1404
+ let N;
1405
+ if (l.tagName === "IMG")
1406
+ N = l.src;
1407
+ else if (l.tagName.toLowerCase() === "svg") {
1408
+ const v = l.cloneNode(!0), C = m == null ? void 0 : m.color, A = m == null ? void 0 : m.fill, B = m == null ? void 0 : m.stroke, S = m == null ? void 0 : m.opacity, X = (T, ve) => {
1409
+ const F = window.getComputedStyle(T), J = ve, ke = F.fill === F.color, Ue = F.stroke === F.color, ie = A || (ke ? C : void 0) || F.fill;
1410
+ ie && ie !== "none" && (J.style.fill = ie);
1411
+ const se = B || (Ue ? C : void 0) || F.stroke;
1412
+ se && se !== "none" && (J.style.stroke = se), F.strokeWidth && F.strokeWidth !== "0px" && (J.style.strokeWidth = F.strokeWidth);
1413
+ const ye = C || F.color;
1414
+ ye && (J.style.color = ye);
1415
+ const ne = S || F.opacity;
1416
+ ne && ne !== "1" && (J.style.opacity = ne);
1417
+ for (let ee = 0; ee < T.children.length; ee++)
1418
+ X(T.children[ee], ve.children[ee]);
1383
1419
  };
1384
- O(a, m);
1385
- const C = a.getBoundingClientRect(), _ = window.devicePixelRatio * n;
1386
- m.hasAttribute("viewBox") || m.setAttribute("viewBox", `0 0 ${C.width} ${C.height}`), m.setAttribute("width", (C.width * _).toString()), m.setAttribute("height", (C.height * _).toString());
1387
- let P = new XMLSerializer().serializeToString(m);
1388
- P.includes("xmlns=") || (P = P.replace(
1420
+ X(l, v);
1421
+ const x = l.getBoundingClientRect(), z = window.devicePixelRatio * a;
1422
+ v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${x.width} ${x.height}`), v.setAttribute("width", (x.width * z).toString()), v.setAttribute("height", (x.height * z).toString());
1423
+ let G = new XMLSerializer().serializeToString(v);
1424
+ G.includes("xmlns=") || (G = G.replace(
1389
1425
  "<svg",
1390
1426
  '<svg xmlns="http://www.w3.org/2000/svg"'
1391
- )), X = `data:image/svg+xml;utf8,${encodeURIComponent(P)}`;
1392
- } else if (w.backgroundImage && w.backgroundImage !== "none") {
1393
- const m = w.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1394
- m && (X = m[1]);
1395
- }
1396
- const A = {
1397
- backgroundColor: w.backgroundColor,
1398
- backgroundImage: w.backgroundImage,
1399
- opacity: a.dataset[q.KEY] === q.VALUES.HIDE ? 1 : parseFloat(w.opacity),
1400
- zIndex: B,
1401
- borderRadius: w.borderRadius,
1402
- borderColor: w.borderColor,
1403
- borderWidth: w.borderWidth,
1404
- imageSrc: X,
1427
+ )), N = `data:image/svg+xml;utf8,${encodeURIComponent(G)}`;
1428
+ } else if (b.backgroundImage && b.backgroundImage !== "none") {
1429
+ const v = b.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1430
+ v && (N = v[1]);
1431
+ }
1432
+ const I = {
1433
+ backgroundColor: b.backgroundColor,
1434
+ backgroundImage: b.backgroundImage,
1435
+ opacity: l.dataset[H.KEY] === H.VALUES.HIDE ? 1 : parseFloat(b.opacity),
1436
+ zIndex: O,
1437
+ borderRadius: b.borderRadius,
1438
+ borderColor: b.borderColor,
1439
+ borderWidth: b.borderWidth,
1440
+ imageSrc: N,
1405
1441
  isTraveler: f
1406
- }, Y = A;
1407
- let ae, ce;
1408
- const J = [];
1409
- return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((m) => {
1410
- const T = m.nodeType === Node.TEXT_NODE ? h : d, D = ke(
1411
- m,
1442
+ }, P = I;
1443
+ let Ae, Ie;
1444
+ const he = [];
1445
+ return l.tagName.toLowerCase() !== "svg" && Array.from(l.childNodes).forEach((v) => {
1446
+ const C = v.nodeType === Node.TEXT_NODE ? h : d, A = De(
1447
+ v,
1412
1448
  e,
1413
- T,
1414
- i,
1415
- B,
1416
- n,
1449
+ C,
1450
+ r,
1451
+ O,
1452
+ a,
1417
1453
  E,
1418
- m.nodeType === Node.TEXT_NODE && Object.keys(p).length > 0 ? p : void 0
1454
+ v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0
1419
1455
  );
1420
- D && J.push(D);
1456
+ A && he.push(A);
1421
1457
  }), {
1422
1458
  id: U,
1423
1459
  type: "BOX",
1424
- element: a,
1460
+ element: l,
1425
1461
  rect: {
1426
- x: x.left + window.scrollX,
1427
- y: x.top + window.scrollY,
1428
- width: x.width,
1429
- height: x.height
1462
+ x: w.left + window.scrollX,
1463
+ y: w.top + window.scrollY,
1464
+ width: w.width,
1465
+ height: w.height
1430
1466
  },
1431
- styles: Y,
1432
- textContent: ae,
1433
- textStyles: ce,
1467
+ styles: P,
1468
+ textContent: Ae,
1469
+ textStyles: Ie,
1434
1470
  dirtyMask: e,
1435
1471
  visibility: h,
1436
1472
  isTraveler: f,
1437
- captureLayer: i,
1473
+ captureLayer: r,
1438
1474
  nativeLayer: E,
1439
- nativeStyles: E !== void 0 ? pe(G({}, A), {
1440
- backgroundColor: (Q = p.backgroundColor) != null ? Q : A.backgroundColor,
1441
- backgroundImage: (Z = p.backgroundImage) != null ? Z : A.backgroundImage,
1442
- opacity: (ee = p.opacity) != null ? ee : A.opacity,
1443
- zIndex: p.zIndex !== void 0 ? p.zIndex + B : A.zIndex,
1444
- borderRadius: (te = p.borderRadius) != null ? te : A.borderRadius,
1445
- borderColor: (re = p.borderColor) != null ? re : A.borderColor,
1446
- borderWidth: (ie = p.borderWidth) != null ? ie : A.borderWidth,
1447
- isTraveler: A.isTraveler
1475
+ nativeStyles: E !== void 0 ? we(q({}, I), {
1476
+ backgroundColor: (de = m.backgroundColor) != null ? de : I.backgroundColor,
1477
+ backgroundImage: (ue = m.backgroundImage) != null ? ue : I.backgroundImage,
1478
+ opacity: (fe = m.opacity) != null ? fe : I.opacity,
1479
+ zIndex: m.zIndex !== void 0 ? m.zIndex + O : I.zIndex,
1480
+ borderRadius: (ge = m.borderRadius) != null ? ge : I.borderRadius,
1481
+ borderColor: (pe = m.borderColor) != null ? pe : I.borderColor,
1482
+ borderWidth: (me = m.borderWidth) != null ? me : I.borderWidth,
1483
+ isTraveler: I.isTraveler
1448
1484
  }) : void 0,
1449
1485
  nativeRect: E !== void 0 ? {
1450
- x: p.x !== void 0 ? parseFloat(p.x) : x.left + window.scrollX,
1451
- y: p.y !== void 0 ? parseFloat(p.y) : x.top + window.scrollY,
1452
- width: p.width !== void 0 ? parseFloat(p.width) : x.width,
1453
- height: p.height !== void 0 ? parseFloat(p.height) : x.height
1486
+ x: m.x !== void 0 ? parseFloat(m.x) : w.left + window.scrollX,
1487
+ y: m.y !== void 0 ? parseFloat(m.y) : w.top + window.scrollY,
1488
+ width: m.width !== void 0 ? parseFloat(m.width) : w.width,
1489
+ height: m.height !== void 0 ? parseFloat(m.height) : w.height
1454
1490
  } : void 0,
1455
- isFixed: w.position === "fixed",
1456
- children: J,
1457
- shaderHooks: L
1491
+ isFixed: b.position === "fixed",
1492
+ children: he,
1493
+ shaderHooks: M
1458
1494
  };
1459
1495
  }
1460
- function st(s, e) {
1461
- e.size !== 0 && e.forEach((t, i) => {
1462
- var U, M, B, X, A, Y, ae, ce, J, Q, Z, ee, te, re, ie, m, T, D;
1463
- const r = s.get(i);
1464
- if (!r || !r.userData.basePosition)
1465
- return;
1466
- let { x: n, y: o } = r.userData.basePosition;
1467
- const { width: c, height: a } = r.userData.baseSize, l = (U = t.width) != null ? U : c, d = (M = t.height) != null ? M : a, h = l - c, u = d - a;
1468
- if (t.width !== void 0 && r.userData.originRatioX === void 0 && Math.abs(h) > 0.1) {
1469
- const k = i.getBoundingClientRect(), S = (B = t.x) != null ? B : 0, O = (A = (X = r.userData.baseTransform) == null ? void 0 : X.x) != null ? A : 0, C = r.userData.isFixed ? 0 : window.scrollX;
1470
- let y = -(k.left + C - S + O - r.userData.baseDOM.x) / h;
1471
- Math.abs(y) < 0.05 ? y = 0 : Math.abs(y - 1) < 0.05 ? y = 1 : Math.abs(y - 0.5) < 0.05 && (y = 0.5), r.userData.originRatioX = y;
1472
- }
1473
- if (t.height !== void 0 && r.userData.originRatioY === void 0 && Math.abs(u) > 0.1) {
1474
- const k = i.getBoundingClientRect(), S = (Y = t.y) != null ? Y : 0, O = (ce = (ae = r.userData.baseTransform) == null ? void 0 : ae.y) != null ? ce : 0, C = r.userData.isFixed ? 0 : window.scrollY;
1475
- let y = -(k.top + C - S + O - r.userData.baseDOM.y) / u;
1476
- Math.abs(y) < 0.05 ? y = 0 : Math.abs(y - 1) < 0.05 ? y = 1 : Math.abs(y - 0.5) < 0.05 && (y = 0.5), r.userData.originRatioY = y;
1477
- }
1478
- const v = (J = r.userData.originRatioX) != null ? J : 0.5, f = (Q = r.userData.originRatioY) != null ? Q : 0.5, p = h * (0.5 - v), E = u * (0.5 - f), R = (ee = (Z = r.userData.baseTransform) == null ? void 0 : Z.x) != null ? ee : 0, L = (re = (te = r.userData.baseTransform) == null ? void 0 : te.y) != null ? re : 0, x = ((ie = t.x) != null ? ie : R) - R, w = ((m = t.y) != null ? m : L) - L;
1479
- r.position.setX(n + p + x), r.position.setY(o - (E + w)), r.scale.set(l, d, 1), H.forceUpdateUniforms(r.material, {
1496
+ function it(s, e) {
1497
+ e.size !== 0 && e.forEach((t, r) => {
1498
+ var a, n;
1499
+ const i = s.get(r);
1500
+ !i || !i.userData.basePosition || Y.forceUpdateUniforms(i.material, {
1480
1501
  backgroundColor: t.backgroundColor,
1481
1502
  backgroundImage: t.backgroundImage,
1482
1503
  opacity: t.opacity,
1483
- borderRadius: (D = t.borderRadius) != null ? D : (T = r.userData.baseStyles) == null ? void 0 : T.borderRadius,
1484
- width: l,
1485
- height: d
1504
+ borderRadius: (n = t.borderRadius) != null ? n : (a = i.userData.baseStyles) == null ? void 0 : a.borderRadius
1505
+ // width and height are no longer updated here, they are updated in syncMeshesByDOM
1486
1506
  });
1487
1507
  });
1488
1508
  }
1489
- function Me(s, e, t) {
1490
- s.forEach((i) => {
1491
- if (i.userData.isFixed && i.userData.initialScroll && i.userData.originalBasePosition) {
1492
- const r = e - i.userData.initialScroll.x, n = t - i.userData.initialScroll.y;
1493
- i.userData.basePosition.x = i.userData.originalBasePosition.x + r, i.userData.basePosition.y = i.userData.originalBasePosition.y - n, i.position.x = i.userData.basePosition.x, i.position.y = i.userData.basePosition.y;
1494
- }
1495
- });
1496
- }
1497
- class ot {
1498
- constructor(e, t, i, r) {
1509
+ class st {
1510
+ constructor(e, t, r, i) {
1499
1511
  g(this, "target");
1500
1512
  g(this, "renderer");
1501
1513
  g(this, "registry");
1502
1514
  g(this, "isTravelEnabled", !1);
1503
1515
  g(this, "tracker");
1504
- this.target = e, this.renderer = t, this.registry = i, this.tracker = new Pe(e, {
1505
- resizeDebounce: r.resizeDebounce
1506
- }), this.tracker.onLayoutChange.add((n, o) => {
1507
- document.querySelector(`[${F.NAME}~='${F.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1508
- const a = ke(
1516
+ this.target = e, this.renderer = t, this.registry = r, this.tracker = new We(e, {
1517
+ resizeDebounce: i.resizeDebounce
1518
+ }), this.tracker.onLayoutChange.add((a, n) => {
1519
+ document.querySelector(`[${k.NAME}~='${k.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1520
+ const l = De(
1509
1521
  this.target,
1510
- n,
1522
+ a,
1511
1523
  W,
1512
1524
  1,
1513
1525
  0,
1514
1526
  this.renderer.qualityFactor
1515
1527
  );
1516
- a && this.renderer.syncScene(a, o);
1517
- }), this.tracker.onScrollChange.add((n, o) => {
1518
- Me(this.renderer.fixedMeshes, n, o), this.renderer.updateCameraScroll(n, o);
1519
- }), this.tracker.onStyleChange.add((n) => {
1520
- st(this.registry, n);
1528
+ l && this.renderer.syncScene(l, n);
1529
+ }), this.tracker.onStyleChange.add((a) => {
1530
+ it(this.registry, a);
1521
1531
  }), this.tracker.onRender.add(() => {
1522
- this.renderer.render();
1532
+ this.renderer.syncMeshesByDOM(), this.renderer.render();
1523
1533
  });
1524
1534
  }
1525
1535
  start() {
1526
- this.tracker.start(), Me(this.renderer.fixedMeshes, window.scrollX, window.scrollY), this.renderer.updateCameraScroll(window.scrollX, window.scrollY);
1536
+ this.tracker.start();
1527
1537
  }
1528
1538
  stop() {
1529
1539
  this.tracker.stop();
@@ -1554,30 +1564,30 @@ class nt {
1554
1564
  this.store.delete(e);
1555
1565
  }
1556
1566
  }
1557
- class ht {
1567
+ class ct {
1558
1568
  constructor(e, t) {
1559
1569
  g(this, "renderer");
1560
1570
  g(this, "syncer");
1561
1571
  g(this, "target");
1562
1572
  g(this, "registry");
1563
- var r, n, o;
1573
+ var i, a, n;
1564
1574
  if (this.target = e, this.registry = new nt(), !document.getElementById("mirage-engine-styles")) {
1565
- const c = document.createElement("style");
1566
- c.id = "mirage-engine-styles", c.textContent = `
1567
- [${q.NAME}="${q.VALUES.HIDE}"] {
1575
+ const o = document.createElement("style");
1576
+ o.id = "mirage-engine-styles", o.textContent = `
1577
+ [${H.NAME}="${H.VALUES.HIDE}"] {
1568
1578
  opacity: 0 !important;
1569
1579
  }
1570
- `, document.head.appendChild(c);
1580
+ `, document.head.appendChild(o);
1571
1581
  }
1572
- let i;
1573
- if (t.mode === "duplicate" ? i = (n = (r = t.container) != null ? r : this.target.parentElement) != null ? n : void 0 : i = (o = this.target.parentElement) != null ? o : void 0, !i)
1582
+ let r;
1583
+ if (t.mode === "duplicate" ? r = (a = (i = t.container) != null ? i : this.target.parentElement) != null ? a : void 0 : r = (n = this.target.parentElement) != null ? n : void 0, !r)
1574
1584
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1575
- this.renderer = new rt(
1585
+ this.renderer = new tt(
1576
1586
  this.target,
1577
1587
  t,
1578
- i,
1588
+ r,
1579
1589
  this.registry
1580
- ), this.renderer.mount(), this.syncer = new ot(this.target, this.renderer, this.registry, t);
1590
+ ), this.renderer.mount(), this.syncer = new st(this.target, this.renderer, this.registry, t);
1581
1591
  }
1582
1592
  start() {
1583
1593
  this.syncer.start();
@@ -1609,37 +1619,37 @@ class ht {
1609
1619
  ArrowUp: !1,
1610
1620
  ArrowDown: !1
1611
1621
  };
1612
- window.addEventListener("keydown", (n) => {
1613
- t[n.key] !== void 0 && (t[n.key] = !0);
1614
- }), window.addEventListener("keyup", (n) => {
1615
- t[n.key] !== void 0 && (t[n.key] = !1);
1622
+ window.addEventListener("keydown", (a) => {
1623
+ t[a.key] !== void 0 && (t[a.key] = !0);
1624
+ }), window.addEventListener("keyup", (a) => {
1625
+ t[a.key] !== void 0 && (t[a.key] = !1);
1616
1626
  });
1617
- const i = 2, r = () => {
1618
- requestAnimationFrame(r), t.ArrowRight && e.position.setX(e.position.x + i), t.ArrowLeft && e.position.setX(e.position.x - i), t.ArrowUp && e.position.setY(e.position.y + i), t.ArrowDown && e.position.setY(e.position.y - i);
1627
+ const r = 2, i = () => {
1628
+ requestAnimationFrame(i), t.ArrowRight && e.position.setX(e.position.x + r), t.ArrowLeft && e.position.setX(e.position.x - r), t.ArrowUp && e.position.setY(e.position.y + r), t.ArrowDown && e.position.setY(e.position.y - r);
1619
1629
  };
1620
- r();
1630
+ i();
1621
1631
  }
1622
1632
  }
1623
1633
  export {
1624
- Se as ALLOWED_FILTERS,
1625
- q as ATTR_DOM,
1626
- z as ATTR_FILTER,
1627
- ct as ATTR_SANDWICH,
1634
+ Ce as ALLOWED_FILTERS,
1635
+ H as ATTR_DOM,
1636
+ _ as ATTR_FILTER,
1637
+ at as ATTR_SANDWICH,
1628
1638
  V as ATTR_SELECT,
1629
- ze as ATTR_SHADER,
1630
- F as ATTR_TRAVEL,
1631
- be as DIRTY_CONTENT,
1632
- he as DIRTY_NONE,
1639
+ Xe as ATTR_SHADER,
1640
+ k as ATTR_TRAVEL,
1641
+ le as DIRTY_CONTENT,
1642
+ te as DIRTY_NONE,
1633
1643
  $ as DIRTY_RECT,
1634
- ve as DIRTY_STRUCTURE,
1635
- oe as DIRTY_STYLE,
1636
- Ye as DIRTY_ZINDEX,
1644
+ re as DIRTY_STRUCTURE,
1645
+ Q as DIRTY_STYLE,
1646
+ ze as DIRTY_ZINDEX,
1637
1647
  lt as EXCLUDED,
1638
- ht as Engine,
1648
+ ct as Engine,
1639
1649
  j as SELECT_LAYER,
1640
- I as THREE_LAYERS,
1641
- Te as TRAVEL_VALUES,
1642
- Pe as Tracker,
1650
+ L as THREE_LAYERS,
1651
+ xe as TRAVEL_VALUES,
1652
+ We as Tracker,
1643
1653
  W as USER_LAYER,
1644
- We as extractFromStyle
1654
+ Ye as extractFromStyle
1645
1655
  };