@mirage-engine/core 0.3.19 → 0.3.21

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,47 +1,47 @@
1
- var Xe = Object.defineProperty, Ne = Object.defineProperties;
2
- var ze = Object.getOwnPropertyDescriptors;
3
- var Ee = Object.getOwnPropertySymbols;
4
- var Ve = Object.prototype.hasOwnProperty, Ye = Object.prototype.propertyIsEnumerable;
5
- var be = (i, e, t) => e in i ? Xe(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, te = (i, e) => {
1
+ var Ve = Object.defineProperty, Ye = Object.defineProperties;
2
+ var We = Object.getOwnPropertyDescriptors;
3
+ var Re = Object.getOwnPropertySymbols;
4
+ var Pe = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
5
+ var xe = (i, e, t) => e in i ? Ve(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, re = (i, e) => {
6
6
  for (var t in e || (e = {}))
7
- Ve.call(e, t) && be(i, t, e[t]);
8
- if (Ee)
9
- for (var t of Ee(e))
10
- Ye.call(e, t) && be(i, t, e[t]);
7
+ Pe.call(e, t) && xe(i, t, e[t]);
8
+ if (Re)
9
+ for (var t of Re(e))
10
+ He.call(e, t) && xe(i, t, e[t]);
11
11
  return i;
12
- }, Ce = (i, e) => Ne(i, ze(e));
13
- var g = (i, e, t) => (be(i, typeof e != "symbol" ? e + "" : e, t), t);
14
- var Te = (i, e, t) => new Promise((r, s) => {
12
+ }, Me = (i, e) => Ye(i, We(e));
13
+ var p = (i, e, t) => (xe(i, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var Le = (i, e, t) => new Promise((r, s) => {
15
15
  var c = (l) => {
16
16
  try {
17
- a(t.next(l));
18
- } catch (n) {
19
- s(n);
17
+ n(t.next(l));
18
+ } catch (a) {
19
+ s(a);
20
20
  }
21
21
  }, o = (l) => {
22
22
  try {
23
- a(t.throw(l));
24
- } catch (n) {
25
- s(n);
23
+ n(t.throw(l));
24
+ } catch (a) {
25
+ s(a);
26
26
  }
27
- }, a = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(c, o);
28
- a((t = t.apply(i, e)).next());
27
+ }, n = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(c, o);
28
+ n((t = t.apply(i, e)).next());
29
29
  });
30
30
  import * as w from "three";
31
- const Ie = {
31
+ const Be = {
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
- }, ee = {
37
+ }, te = {
38
38
  NAME: "data-mirage-dom",
39
39
  KEY: "mirageDom",
40
40
  VALUES: {
41
41
  HIDE: "hide",
42
42
  SHOW: "show"
43
43
  }
44
- }, Re = {
44
+ }, De = {
45
45
  TRAVELER: "traveler",
46
46
  NATIVE: "native",
47
47
  CAPTURE_1: "1",
@@ -54,30 +54,30 @@ const Ie = {
54
54
  CAPTURE_8: "8",
55
55
  CAPTURE_9: "9",
56
56
  CAPTURE_10: "10"
57
- }, N = {
57
+ }, V = {
58
58
  NAME: "data-mirage-travel",
59
59
  KEY: "mirageTravel",
60
- VALUES: Re,
61
- MAX_LAYERS: Object.keys(Re).length - 1
62
- }, H = {
60
+ VALUES: De,
61
+ MAX_LAYERS: Object.keys(De).length - 1
62
+ }, q = {
63
63
  NAME: "data-mirage-filter",
64
64
  KEY: "mirageFilter",
65
- VALUES: Ie
66
- }, $ = {
65
+ VALUES: Be
66
+ }, j = {
67
67
  NAME: "data-mirage-select",
68
68
  KEY: "mirageSelect",
69
- VALUES: Ie
70
- }, We = {
69
+ VALUES: Be
70
+ }, Ge = {
71
71
  NAME: "data-mirage-shader",
72
72
  KEY: "mirageShader"
73
- }, dt = {
73
+ }, gt = {
74
74
  NAME: "data-mirage-sandwich",
75
75
  KEY: "mirageSandwich",
76
76
  VALUES: {
77
77
  FRONT: "front"
78
78
  }
79
- }, ge = 0, re = 1, ue = 2, Pe = 4, pe = 8, ye = 16;
80
- function He(i) {
79
+ }, pe = 0, ie = 1, fe = 2, qe = 4, me = 8, Se = 16;
80
+ function $e(i) {
81
81
  const e = i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
82
82
  return e ? {
83
83
  r: parseInt(e[1]) / 255,
@@ -86,10 +86,10 @@ function He(i) {
86
86
  a: e[4] !== void 0 ? parseFloat(e[4]) : 1
87
87
  } : { r: 1, g: 1, b: 1, a: 1 };
88
88
  }
89
- function Ge(i) {
89
+ function je(i) {
90
90
  const e = {};
91
91
  if (i.opacity && (e.opacity = parseFloat(i.opacity)), i.backgroundColor) {
92
- const t = He(i.backgroundColor);
92
+ const t = $e(i.backgroundColor);
93
93
  e.backgroundColor = [t.r, t.g, t.b, t.a];
94
94
  }
95
95
  if (i.backgroundImage ? e.backgroundImage = i.backgroundImage : i.background && (e.backgroundImage = i.background), i.boxShadow && (e.boxShadow = i.boxShadow), i.borderRadius && (e.borderRadius = parseFloat(i.borderRadius)), i.width && (e.width = parseFloat(i.width)), i.height && (e.height = parseFloat(i.height)), i.transform && i.transform !== "none") {
@@ -98,34 +98,34 @@ function Ge(i) {
98
98
  }
99
99
  return e;
100
100
  }
101
- class qe {
101
+ class Ke {
102
102
  constructor(e, t) {
103
- g(this, "target");
104
- g(this, "observer");
105
- g(this, "pendingDeletions", /* @__PURE__ */ new Set());
106
- g(this, "pendingStyles", /* @__PURE__ */ new Map());
107
- g(this, "isDomDirty", !1);
108
- g(this, "isRunning", !1);
109
- g(this, "pendingMask", ge);
110
- g(this, "mutationTimer", null);
111
- g(this, "cssTimer", null);
112
- g(this, "resizeConfig");
113
- g(this, "resizeTimer", null);
114
- g(this, "isResizing", !1);
115
- g(this, "lastScrollX", 0);
116
- g(this, "lastScrollY", 0);
117
- g(this, "scrollTimer", null);
118
- g(this, "onBeforeRender", /* @__PURE__ */ new Set());
119
- g(this, "onLayoutChange", /* @__PURE__ */ new Set());
120
- g(this, "onStyleChange", /* @__PURE__ */ new Set());
121
- g(this, "onScrollChange", /* @__PURE__ */ new Set());
122
- g(this, "onRender", /* @__PURE__ */ new Set());
123
- g(this, "onTransitionFinished", (e) => {
124
- this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= re | ue, this.cssTimer = window.setTimeout(() => {
103
+ p(this, "target");
104
+ p(this, "observer");
105
+ p(this, "pendingDeletions", /* @__PURE__ */ new Set());
106
+ p(this, "pendingStyles", /* @__PURE__ */ new Map());
107
+ p(this, "isDomDirty", !1);
108
+ p(this, "isRunning", !1);
109
+ p(this, "pendingMask", pe);
110
+ p(this, "mutationTimer", null);
111
+ p(this, "cssTimer", null);
112
+ p(this, "resizeConfig");
113
+ p(this, "resizeTimer", null);
114
+ p(this, "isResizing", !1);
115
+ p(this, "lastScrollX", 0);
116
+ p(this, "lastScrollY", 0);
117
+ p(this, "scrollTimer", null);
118
+ p(this, "onBeforeRender", /* @__PURE__ */ new Set());
119
+ p(this, "onLayoutChange", /* @__PURE__ */ new Set());
120
+ p(this, "onStyleChange", /* @__PURE__ */ new Set());
121
+ p(this, "onScrollChange", /* @__PURE__ */ new Set());
122
+ p(this, "onRender", /* @__PURE__ */ new Set());
123
+ p(this, "onTransitionFinished", (e) => {
124
+ this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= ie | fe, this.cssTimer = window.setTimeout(() => {
125
125
  this.isDomDirty = !0, this.cssTimer = null;
126
126
  }, 50)));
127
127
  });
128
- g(this, "onWindowResize", () => {
128
+ p(this, "onWindowResize", () => {
129
129
  if (!this.resizeConfig.enabled) {
130
130
  this.isDomDirty = !0;
131
131
  return;
@@ -134,13 +134,13 @@ class qe {
134
134
  this.isDomDirty = !0, this.resizeConfig.onEnd && this.resizeConfig.onEnd(), this.isResizing = !1, this.resizeTimer = null;
135
135
  }, this.resizeConfig.delay);
136
136
  });
137
- g(this, "renderLoop", () => {
137
+ p(this, "renderLoop", () => {
138
138
  if (!this.isRunning)
139
139
  return;
140
- this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = ge);
140
+ this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = pe);
141
141
  const e = window.scrollX, t = window.scrollY;
142
142
  (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(() => {
143
- this.pendingMask |= re, this.isDomDirty = !0, this.scrollTimer = null;
143
+ this.pendingMask |= ie, this.isDomDirty = !0, this.scrollTimer = null;
144
144
  }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((r) => r(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((r) => r()), requestAnimationFrame(this.renderLoop);
145
145
  });
146
146
  var s, c;
@@ -152,23 +152,23 @@ class qe {
152
152
  onStart: r.onStart,
153
153
  onEnd: r.onEnd
154
154
  }, this.observer = new MutationObserver((o) => {
155
- let a = ge;
155
+ let n = pe;
156
156
  for (const l of o)
157
157
  if (l.type === "childList")
158
- a |= pe, l.removedNodes.length > 0 && l.removedNodes.forEach((n) => {
159
- n instanceof HTMLElement && this.pendingDeletions.add(n);
158
+ n |= me, l.removedNodes.length > 0 && l.removedNodes.forEach((a) => {
159
+ a instanceof HTMLElement && this.pendingDeletions.add(a);
160
160
  });
161
161
  else if (l.type === "attributes")
162
162
  if (l.attributeName === "style") {
163
- a |= re | ue;
164
- const n = l.target, u = Ge(n.style);
165
- this.pendingStyles.set(n, u);
163
+ n |= ie | fe;
164
+ const a = l.target, u = je(a.style);
165
+ this.pendingStyles.set(a, u);
166
166
  } else
167
- l.attributeName === "class" ? a |= re | ue : l.attributeName && l.attributeName.startsWith("data-") && (a |= re | ue, l.attributeName.startsWith("data-mirage") && (a |= pe));
167
+ l.attributeName === "class" ? n |= ie | fe : l.attributeName && l.attributeName.startsWith("data-") && (n |= ie | fe, l.attributeName.startsWith("data-mirage") && (n |= me));
168
168
  else
169
- l.type === "characterData" && (a |= ye | re);
170
- if (a !== ge) {
171
- if (this.pendingMask |= a, a & pe) {
169
+ l.type === "characterData" && (n |= Se | ie);
170
+ if (n !== pe) {
171
+ if (this.pendingMask |= n, n & me) {
172
172
  this.clearTimers(), this.isDomDirty = !0;
173
173
  return;
174
174
  }
@@ -193,13 +193,13 @@ class qe {
193
193
  this.mutationTimer && (clearTimeout(this.mutationTimer), this.mutationTimer = null), this.cssTimer && (clearTimeout(this.cssTimer), this.cssTimer = null), this.scrollTimer && (clearTimeout(this.scrollTimer), this.scrollTimer = null);
194
194
  }
195
195
  }
196
- const G = 1, ae = 2, ut = 0, F = {
196
+ const $ = 1, ne = 2, pt = 0, O = {
197
197
  BASE: 0,
198
198
  SELECTED: 1,
199
199
  getCaptureLayer: (i) => 31 - i,
200
200
  HIDDEN: 31
201
- }, Me = Object.values(H.VALUES);
202
- class ke {
201
+ }, Ae = Object.values(q.VALUES);
202
+ class Fe {
203
203
  /**
204
204
  * Calculates or retrieves the exact alphabetic baseline (in pixels) for the given font.
205
205
  * @param font CSS font shorthand string (e.g., "400 16px Inter")
@@ -220,17 +220,17 @@ class ke {
220
220
  return document.body.removeChild(t), c;
221
221
  }
222
222
  }
223
- g(ke, "cache", /* @__PURE__ */ new Map());
224
- class $e extends w.MeshBasicMaterial {
223
+ p(Fe, "cache", /* @__PURE__ */ new Map());
224
+ class Je extends w.MeshBasicMaterial {
225
225
  constructor(t, r, s, c, o = 2) {
226
226
  super({
227
227
  transparent: !0,
228
228
  side: w.FrontSide,
229
229
  color: 16777215
230
230
  });
231
- g(this, "canvas");
232
- g(this, "ctx");
233
- g(this, "qualityFactor");
231
+ p(this, "canvas");
232
+ p(this, "ctx");
233
+ p(this, "qualityFactor");
234
234
  if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
235
235
  throw new Error("[Mirage] Failed to create canvas context");
236
236
  this.qualityFactor = o, this.map = new w.CanvasTexture(this.canvas), this.map.colorSpace = w.LinearSRGBColorSpace, this.map.minFilter = w.LinearFilter, this.map.magFilter = w.LinearFilter, this.updateText(t, r, s, c);
@@ -239,14 +239,14 @@ class $e extends w.MeshBasicMaterial {
239
239
  const s = t.split(`
240
240
  `), c = [];
241
241
  return s.forEach((o) => {
242
- const a = o.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
- if (a.length === 0) {
242
+ const n = o.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
+ if (n.length === 0) {
244
244
  c.push("");
245
245
  return;
246
246
  }
247
- let l = a[0];
248
- for (let n = 1; n < a.length; n++) {
249
- const u = a[n];
247
+ let l = n[0];
248
+ for (let a = 1; a < n.length; a++) {
249
+ const u = n[a];
250
250
  this.ctx.measureText(l + u).width <= r + 2 ? l += u : (l && c.push(l), l = u.trimStart());
251
251
  }
252
252
  l && c.push(l);
@@ -254,13 +254,13 @@ class $e extends w.MeshBasicMaterial {
254
254
  }
255
255
  updateText(t, r, s, c, o) {
256
256
  o !== void 0 && (this.qualityFactor = o);
257
- const l = (window.devicePixelRatio || 1) * this.qualityFactor, n = s * l, u = c * l;
258
- this.canvas.width !== n || this.canvas.height !== u ? (this.canvas.width = n, this.canvas.height = u) : 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;
259
- const h = this.wrapText(t, s), d = r.lineHeight, p = ke.getBaseline(r.font);
260
- h.forEach((f, L) => {
261
- const m = L * d + p;
262
- let b = 0;
263
- r.textAlign === "center" ? b = s / 2 : r.textAlign === "right" && (b = s), this.ctx.textAlign = r.textAlign, this.ctx.fillText(f, b, m);
257
+ const l = (window.devicePixelRatio || 1) * this.qualityFactor, a = s * l, u = c * l;
258
+ this.canvas.width !== a || this.canvas.height !== u ? (this.canvas.width = a, this.canvas.height = u) : 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;
259
+ const h = this.wrapText(t, s), d = r.lineHeight, m = Fe.getBaseline(r.font);
260
+ h.forEach((g, R) => {
261
+ const v = R * d + m;
262
+ let y = 0;
263
+ r.textAlign === "center" ? y = s / 2 : r.textAlign === "right" && (y = s), this.ctx.textAlign = r.textAlign, this.ctx.fillText(g, y, v);
264
264
  }), this.map && (this.map.needsUpdate = !0);
265
265
  }
266
266
  dispose() {
@@ -285,7 +285,7 @@ function ce(i) {
285
285
  }
286
286
  return { color: new w.Color(i), alpha: 1 };
287
287
  }
288
- function Ue(i) {
288
+ function Oe(i) {
289
289
  const e = [];
290
290
  let t = "", r = 0;
291
291
  for (let s = 0; s < i.length; s++) {
@@ -302,13 +302,13 @@ function Ue(i) {
302
302
  }
303
303
  return t && e.push(t.trim()), e;
304
304
  }
305
- function je(i) {
305
+ function Ze(i) {
306
306
  if (!i || typeof i != "string" || !i.includes("linear-gradient"))
307
307
  return null;
308
308
  const e = i.match(/linear-gradient\((.*)\)/);
309
309
  if (!e)
310
310
  return null;
311
- const t = e[1], r = Ue(t);
311
+ const t = e[1], r = Oe(t);
312
312
  let s = Math.PI, c = 0;
313
313
  const o = r[0].trim();
314
314
  if (o.startsWith("to "))
@@ -317,63 +317,63 @@ function je(i) {
317
317
  const l = parseFloat(o);
318
318
  o.endsWith("deg") ? s = l * (Math.PI / 180) : o.endsWith("rad") ? s = l : o.endsWith("turn") && (s = l * Math.PI * 2), c = 1;
319
319
  }
320
- const a = [];
321
- for (let l = c; l < r.length && !(a.length >= 8); l++) {
322
- const n = r[l].trim(), u = n.lastIndexOf(" ");
323
- let h = n, d = null;
324
- if (u !== -1 && !n.endsWith(")")) {
325
- const f = n.substring(u + 1);
326
- (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = n.substring(0, u).trim(), d = f);
320
+ const n = [];
321
+ for (let l = c; l < r.length && !(n.length >= 8); l++) {
322
+ const a = r[l].trim(), u = a.lastIndexOf(" ");
323
+ let h = a, d = null;
324
+ if (u !== -1 && !a.endsWith(")")) {
325
+ const g = a.substring(u + 1);
326
+ (g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = a.substring(0, u).trim(), d = g);
327
327
  }
328
- const p = ce(h);
329
- a.push({
330
- color: p.color,
331
- alpha: p.alpha,
328
+ const m = ce(h);
329
+ n.push({
330
+ color: m.color,
331
+ alpha: m.alpha,
332
332
  rawStop: d,
333
333
  stop: 0
334
334
  });
335
335
  }
336
- if (a.length > 0) {
337
- for (let n = 0; n < a.length; n++)
338
- a[n].rawStop !== null && (a[n].stop = parseFloat(a[n].rawStop) / 100);
339
- a[0].rawStop === null && (a[0].stop = 0), a.length > 1 && a[a.length - 1].rawStop === null && (a[a.length - 1].stop = 1);
336
+ if (n.length > 0) {
337
+ for (let a = 0; a < n.length; a++)
338
+ n[a].rawStop !== null && (n[a].stop = parseFloat(n[a].rawStop) / 100);
339
+ n[0].rawStop === null && (n[0].stop = 0), n.length > 1 && n[n.length - 1].rawStop === null && (n[n.length - 1].stop = 1);
340
340
  let l = 0;
341
- for (let n = 1; n < a.length; n++)
342
- if (a[n].rawStop !== null || n === a.length - 1) {
343
- const u = n - l;
341
+ for (let a = 1; a < n.length; a++)
342
+ if (n[a].rawStop !== null || a === n.length - 1) {
343
+ const u = a - l;
344
344
  if (u > 1) {
345
- const h = a[l].stop, p = (a[n].stop - h) / u;
346
- for (let f = 1; f < u; f++)
347
- a[l + f].stop = h + p * f;
345
+ const h = n[l].stop, m = (n[a].stop - h) / u;
346
+ for (let g = 1; g < u; g++)
347
+ n[l + g].stop = h + m * g;
348
348
  }
349
- l = n;
349
+ l = a;
350
350
  }
351
351
  }
352
- return { angle: s, stops: a };
352
+ return { angle: s, stops: n };
353
353
  }
354
- function Ke(i) {
354
+ function Qe(i) {
355
355
  if (!i || i === "none")
356
356
  return null;
357
- const e = Ue(i);
357
+ const e = Oe(i);
358
358
  if (e.length === 0)
359
359
  return null;
360
360
  const t = e[0].trim(), r = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, s = t.match(r);
361
361
  let c = "transparent", o = t;
362
362
  if (s && s[1] !== "inset") {
363
- const p = s[1];
364
- (p.startsWith("rgb") || p.startsWith("#") || p === "black" || p === "white" || p === "transparent") && (c = p, o = t.replace(p, "").trim());
363
+ const m = s[1];
364
+ (m.startsWith("rgb") || m.startsWith("#") || m === "black" || m === "white" || m === "transparent") && (c = m, o = t.replace(m, "").trim());
365
365
  }
366
366
  o = o.replace("inset", "").trim();
367
- const a = o.split(/\s+/).map((p) => parseFloat(p) || 0), l = a[0] || 0, n = a[1] || 0, u = a[2] || 0, h = a[3] || 0, d = ce(c);
368
- return { offsetX: l, offsetY: n, blurRadius: u, spreadRadius: h, color: d.color, alpha: d.alpha };
367
+ const n = o.split(/\s+/).map((m) => parseFloat(m) || 0), l = n[0] || 0, a = n[1] || 0, u = n[2] || 0, h = n[3] || 0, d = ce(c);
368
+ return { offsetX: l, offsetY: a, blurRadius: u, spreadRadius: h, color: d.color, alpha: d.alpha };
369
369
  }
370
- const Je = `varying vec2 vUv;
370
+ const et = `varying vec2 vUv;
371
371
  varying vec4 vScreenPos;
372
372
  void main() {
373
373
  vUv = uv;
374
374
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
375
375
  vScreenPos = gl_Position;
376
- }`, Ze = `varying vec2 vUv;
376
+ }`, tt = `varying vec2 vUv;
377
377
  uniform vec2 uSize;
378
378
  uniform vec2 uMeshSize;
379
379
  uniform vec4 uShadowColor;
@@ -532,40 +532,41 @@ void main() {
532
532
 
533
533
  // #include <colorspace_fragment>
534
534
  }
535
- `, Qe = `uniform sampler2D uTexture;
535
+ `, rt = `uniform sampler2D uTexture;
536
536
  varying vec4 vScreenPos;
537
537
  uniform vec2 uTextureRepeat;
538
- uniform vec2 uTextureOffset;`, et = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
538
+ uniform vec2 uTextureOffset;`, it = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
539
539
  vec2 resultUv = screenUv;
540
540
 
541
- `, tt = `vec4 texColor = texture2D(uTexture, resultUv);
542
- baseColor = blendSrcOver(baseColor, texColor);`, Le = {
543
- vertexShader: Je,
544
- fragmentShader: Ze
545
- }, De = {
546
- declChunk: Qe,
547
- uvChunk: et,
548
- baseColorChunk: tt
541
+ `, st = `vec4 texColor = texture2D(uTexture, resultUv);
542
+ baseColor = blendSrcOver(baseColor, texColor);`, Ie = {
543
+ vertexShader: et,
544
+ fragmentShader: tt
545
+ }, ke = {
546
+ declChunk: rt,
547
+ uvChunk: it,
548
+ baseColorChunk: st
549
549
  };
550
- function rt(i, e, t, r = null, s) {
550
+ function ot(i, e, t, r = null, s) {
551
551
  var C;
552
552
  const c = r !== null || !!i.imageSrc;
553
553
  let o = "";
554
- const a = {};
554
+ const n = {};
555
555
  if (s != null && s.uniforms)
556
- for (const [y, S] of Object.entries(s.uniforms))
557
- typeof S == "number" ? (o += `uniform float ${y};
558
- `, a[y] = { value: S }) : Array.isArray(S) ? S.length === 2 ? (o += `uniform vec2 ${y};
559
- `, a[y] = { value: new w.Vector2(...S) }) : S.length === 3 ? (o += `uniform vec3 ${y};
560
- `, a[y] = { value: new w.Vector3(...S) }) : S.length === 4 && (o += `uniform vec4 ${y};
561
- `, a[y] = { value: new w.Vector4(...S) }) : (o += `uniform float ${y};
562
- `, a[y] = { value: S });
563
- const l = s !== void 0, n = (c || l ? De.declChunk : "") + `
556
+ for (const [b, x] of Object.entries(s.uniforms))
557
+ typeof x == "number" ? (o += `uniform float ${b};
558
+ `, n[b] = { value: x }) : Array.isArray(x) ? x.length === 2 ? (o += `uniform vec2 ${b};
559
+ `, n[b] = { value: new w.Vector2(...x) }) : x.length === 3 ? (o += `uniform vec3 ${b};
560
+ `, n[b] = { value: new w.Vector3(...x) }) : x.length === 4 && (o += `uniform vec4 ${b};
561
+ `, n[b] = { value: new w.Vector4(...x) }) : x && typeof x == "object" && x.type ? (o += `uniform ${x.type} ${b};
562
+ `, n[b] = x) : (o += `uniform float ${b};
563
+ `, n[b] = { value: x });
564
+ const l = s !== void 0, a = (c || l ? ke.declChunk : "") + `
564
565
  ` + o, u = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
565
566
  `, h = i.isTraveler ? `vec2 resultUv = screenUv;
566
567
  ` : `vec2 localUv = (p / uSize) + 0.5;
567
568
  vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
568
- `, d = c || l ? u + h + ((s == null ? void 0 : s.uvModifier) || "") : "", p = c || l ? De.baseColorChunk : "", f = (s == null ? void 0 : s.colorModifier) || "", L = Le.fragmentShader.replace("#INJECT_DECLARATIONS", n).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", f), m = ce(i.backgroundColor), b = ce(i.borderColor), E = {
569
+ `, d = c || l ? u + h + ((s == null ? void 0 : s.uvModifier) || "") : "", m = c || l ? ke.baseColorChunk : "", g = (s == null ? void 0 : s.colorModifier) || "", R = Ie.fragmentShader.replace("#INJECT_DECLARATIONS", a).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", m).replace("#INJECT_COLOR_MODIFIER", g), v = ce(i.backgroundColor), y = ce(i.borderColor), E = {
569
570
  uSize: { value: new w.Vector2(e, t) },
570
571
  uMeshSize: { value: new w.Vector2(e, t) },
571
572
  uShadowColor: { value: new w.Vector4(0, 0, 0, 0) },
@@ -574,18 +575,18 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
574
575
  uShadowSpread: { value: 0 },
575
576
  uBgColor: {
576
577
  value: new w.Vector4(
577
- m.color.r,
578
- m.color.g,
579
- m.color.b,
580
- m.alpha
578
+ v.color.r,
579
+ v.color.g,
580
+ v.color.b,
581
+ v.alpha
581
582
  )
582
583
  },
583
584
  uBorderColor: {
584
585
  value: new w.Vector4(
585
- b.color.r,
586
- b.color.g,
587
- b.color.b,
588
- b.alpha
586
+ y.color.r,
587
+ y.color.g,
588
+ y.color.b,
589
+ y.alpha
589
590
  )
590
591
  },
591
592
  uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
@@ -601,20 +602,20 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
601
602
  },
602
603
  uGradientStops: { value: new Float32Array(8) }
603
604
  };
604
- Be(E.uBorderRadius.value, i.borderRadius, Math.min(e, t)), c && (E.uTexture.value = r);
605
- const A = new w.ShaderMaterial({
606
- uniforms: te(te({}, E), a),
607
- vertexShader: Le.vertexShader,
608
- fragmentShader: L,
605
+ _e(E.uBorderRadius.value, i.borderRadius, Math.min(e, t)), c && (E.uTexture.value = r);
606
+ const L = new w.ShaderMaterial({
607
+ uniforms: re(re({}, E), n),
608
+ vertexShader: Ie.vertexShader,
609
+ fragmentShader: R,
609
610
  transparent: !0,
610
611
  side: w.FrontSide
611
612
  // for better performance
612
613
  });
613
- return i.backgroundImage && xe(A, { backgroundImage: i.backgroundImage }), A;
614
+ return i.backgroundImage && Ee(L, { backgroundImage: i.backgroundImage }), L;
614
615
  }
615
- function it(i, e, t, r, s) {
616
+ function at(i, e, t, r, s) {
616
617
  const c = le(e.borderWidth);
617
- xe(i, {
618
+ Ee(i, {
618
619
  width: t,
619
620
  height: r,
620
621
  borderRadius: e.borderRadius,
@@ -627,19 +628,19 @@ function it(i, e, t, r, s) {
627
628
  boxShadow: e.boxShadow
628
629
  });
629
630
  }
630
- function xe(i, e) {
631
+ function Ee(i, e) {
631
632
  var r, s, c;
632
633
  if (e.boxShadow !== void 0) {
633
- const o = Ke(e.boxShadow);
634
+ const o = Qe(e.boxShadow);
634
635
  o ? (i.uniforms.uShadowColor.value.set(o.color.r, o.color.g, o.color.b, o.alpha), i.uniforms.uShadowOffset.value.set(o.offsetX, o.offsetY), i.uniforms.uShadowBlur.value = o.blurRadius, i.uniforms.uShadowSpread.value = o.spreadRadius, i.userData.shadowPadding = o.blurRadius + o.spreadRadius + Math.max(Math.abs(o.offsetX), Math.abs(o.offsetY))) : (i.uniforms.uShadowColor.value.w = 0, i.userData.shadowPadding = 0);
635
636
  }
636
637
  if (e.width !== void 0 && e.height !== void 0 && i.uniforms.uSize.value.set(e.width, e.height), i.uniforms.uMeshSize) {
637
- const o = i.userData.shadowPadding || 0, a = e.width !== void 0 ? e.width : i.uniforms.uSize.value.x, l = e.height !== void 0 ? e.height : i.uniforms.uSize.value.y;
638
- i.uniforms.uMeshSize.value.set(a + o * 2, l + o * 2);
638
+ const o = i.userData.shadowPadding || 0, n = e.width !== void 0 ? e.width : i.uniforms.uSize.value.x, l = e.height !== void 0 ? e.height : i.uniforms.uSize.value.y;
639
+ i.uniforms.uMeshSize.value.set(n + o * 2, l + o * 2);
639
640
  }
640
641
  if (e.borderRadius !== void 0) {
641
642
  const o = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(i.uniforms.uSize.value.x, i.uniforms.uSize.value.y);
642
- Be(i.uniforms.uBorderRadius.value, e.borderRadius, o);
643
+ _e(i.uniforms.uBorderRadius.value, e.borderRadius, o);
643
644
  }
644
645
  if (e.borderWidth !== void 0 && (i.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
645
646
  if (Array.isArray(e.backgroundColor)) {
@@ -696,9 +697,9 @@ function xe(i, e) {
696
697
  e.opacity !== void 0 && (i.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (i.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (i.uniforms.uBorderColor.value.w = e.borderOpacity), i.uniforms.uTexture && e.texture !== void 0 && (i.uniforms.uTexture.value = e.texture);
697
698
  const t = e.texture !== void 0 ? e.texture : (r = i.uniforms.uTexture) == null ? void 0 : r.value;
698
699
  if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
699
- const o = t.image.naturalWidth || t.image.videoWidth || t.image.width, a = t.image.naturalHeight || t.image.videoHeight || t.image.height, l = (s = e.width) != null ? s : i.uniforms.uSize.value.x, n = (c = e.height) != null ? c : i.uniforms.uSize.value.y;
700
- if (o && a && l && n) {
701
- const u = o / a, h = l / n;
700
+ const o = t.image.naturalWidth || t.image.videoWidth || t.image.width, n = t.image.naturalHeight || t.image.videoHeight || t.image.height, l = (s = e.width) != null ? s : i.uniforms.uSize.value.x, a = (c = e.height) != null ? c : i.uniforms.uSize.value.y;
701
+ if (o && n && l && a) {
702
+ const u = o / n, h = l / a;
702
703
  if (u > h) {
703
704
  const d = h / u;
704
705
  i.uniforms.uTextureRepeat.value.set(d, 1), i.uniforms.uTextureOffset.value.set((1 - d) / 2, 0);
@@ -710,28 +711,28 @@ function xe(i, e) {
710
711
  } else
711
712
  i.uniforms.uTextureRepeat && (i.uniforms.uTextureRepeat.value.set(1, 1), i.uniforms.uTextureOffset.value.set(0, 0));
712
713
  if (e.backgroundImage !== void 0) {
713
- const o = je(e.backgroundImage);
714
+ const o = Ze(e.backgroundImage);
714
715
  if (o) {
715
716
  i.uniforms.uGradientCount.value = o.stops.length, i.uniforms.uGradientAngle.value = o.angle;
716
- for (let a = 0; a < 8; a++)
717
- if (a < o.stops.length) {
718
- const l = o.stops[a];
719
- i.uniforms.uGradientColors.value[a].set(
717
+ for (let n = 0; n < 8; n++)
718
+ if (n < o.stops.length) {
719
+ const l = o.stops[n];
720
+ i.uniforms.uGradientColors.value[n].set(
720
721
  l.color.r,
721
722
  l.color.g,
722
723
  l.color.b,
723
724
  l.alpha
724
- ), i.uniforms.uGradientStops.value[a] = l.stop;
725
+ ), i.uniforms.uGradientStops.value[n] = l.stop;
725
726
  } else
726
- i.uniforms.uGradientColors.value[a].set(0, 0, 0, 0), i.uniforms.uGradientStops.value[a] = 1;
727
+ i.uniforms.uGradientColors.value[n].set(0, 0, 0, 0), i.uniforms.uGradientStops.value[n] = 1;
727
728
  } else
728
729
  i.uniforms.uGradientCount.value = 0;
729
730
  }
730
731
  for (const o of Object.keys(e))
731
732
  o !== "width" && o !== "height" && o !== "borderRadius" && o !== "borderWidth" && o !== "backgroundColor" && o !== "borderColor" && o !== "opacity" && o !== "bgOpacity" && o !== "borderOpacity" && o !== "texture" && o !== "backgroundImage" && o !== "boxShadow" && i.uniforms[o] !== void 0 && (i.uniforms[o].value !== void 0 && i.uniforms[o].value !== null && typeof i.uniforms[o].value.set == "function" ? Array.isArray(e[o]) ? i.uniforms[o].value.set(...e[o]) : e[o] !== void 0 && (e[o].copy ? i.uniforms[o].value.copy(e[o]) : i.uniforms[o].value = e[o]) : i.uniforms[o].value = e[o]);
732
733
  }
733
- function Be(i, e, t = 0) {
734
- var l, n, u, h;
734
+ function _e(i, e, t = 0) {
735
+ var l, a, u, h;
735
736
  if (e == null) {
736
737
  i.set(0, 0, 0, 0);
737
738
  return;
@@ -744,18 +745,18 @@ function Be(i, e, t = 0) {
744
745
  i.set(e[0], e[1], e[2], e[3]);
745
746
  return;
746
747
  }
747
- const r = e.split("/")[0].trim().split(/\s+/), s = le(r[0], t), c = le((l = r[1]) != null ? l : r[0], t), o = le((n = r[2]) != null ? n : r[0], t), a = le((h = (u = r[3]) != null ? u : r[1]) != null ? h : r[0], t);
748
- i.set(s, c, o, a);
748
+ const r = e.split("/")[0].trim().split(/\s+/), s = le(r[0], t), c = le((l = r[1]) != null ? l : r[0], t), o = le((a = r[2]) != null ? a : r[0], t), n = le((h = (u = r[3]) != null ? u : r[1]) != null ? h : r[0], t);
749
+ i.set(s, c, o, n);
749
750
  }
750
- const W = {
751
- create(i, e, t, r, s, c = 2, o = null, a) {
752
- return i === "BOX" ? rt(
751
+ const H = {
752
+ create(i, e, t, r, s, c = 2, o = null, n) {
753
+ return i === "BOX" ? ot(
753
754
  e,
754
755
  r,
755
756
  s,
756
757
  o,
757
- a
758
- ) : i === "TEXT" ? new $e(
758
+ n
759
+ ) : i === "TEXT" ? new Je(
759
760
  t || "",
760
761
  e,
761
762
  r,
@@ -763,13 +764,13 @@ const W = {
763
764
  c
764
765
  ) : new w.MeshBasicMaterial({ visible: !1 });
765
766
  },
766
- update(i, e, t, r, s, c, o = 2, a) {
767
- e === "BOX" ? it(
767
+ update(i, e, t, r, s, c, o = 2, n) {
768
+ e === "BOX" ? at(
768
769
  i,
769
770
  t,
770
771
  s,
771
772
  c,
772
- a
773
+ n
773
774
  ) : e === "TEXT" && i.updateText(
774
775
  r || "",
775
776
  t,
@@ -779,16 +780,16 @@ const W = {
779
780
  );
780
781
  },
781
782
  forceUpdateUniforms(i, e) {
782
- xe(i, e);
783
+ Ee(i, e);
783
784
  }
784
785
  };
785
- class st {
786
+ class nt {
786
787
  constructor(e, t = !0) {
787
- g(this, "observer");
788
- g(this, "textures", /* @__PURE__ */ new WeakMap());
789
- g(this, "loadStatus", /* @__PURE__ */ new WeakMap());
790
- g(this, "elementUrls", /* @__PURE__ */ new WeakMap());
791
- g(this, "onUpdate");
788
+ p(this, "observer");
789
+ p(this, "textures", /* @__PURE__ */ new WeakMap());
790
+ p(this, "loadStatus", /* @__PURE__ */ new WeakMap());
791
+ p(this, "elementUrls", /* @__PURE__ */ new WeakMap());
792
+ p(this, "onUpdate");
792
793
  this.onUpdate = e, t && (this.observer = new IntersectionObserver(
793
794
  (r) => {
794
795
  for (const s of r) {
@@ -808,7 +809,7 @@ class st {
808
809
  e.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(e), this.disposeTexture(e), this.elementUrls.delete(e), this.loadStatus.delete(e);
809
810
  }
810
811
  loadTexture(e) {
811
- return Te(this, null, function* () {
812
+ return Le(this, null, function* () {
812
813
  if (this.loadStatus.get(e) || this.textures.has(e))
813
814
  return;
814
815
  const t = this.elementUrls.get(e);
@@ -818,8 +819,8 @@ class st {
818
819
  let r;
819
820
  if (t.startsWith("data:image/svg+xml"))
820
821
  r = yield new Promise((c, o) => {
821
- const a = new Image();
822
- a.onload = () => c(a), a.onerror = o, a.src = t;
822
+ const n = new Image();
823
+ n.onload = () => c(n), n.onerror = o, n.src = t;
823
824
  });
824
825
  else {
825
826
  const o = yield (yield fetch(t)).blob();
@@ -850,35 +851,35 @@ class st {
850
851
  this.observer && this.observer.disconnect();
851
852
  }
852
853
  }
853
- class ot {
854
+ class lt {
854
855
  constructor(e, t, r, s) {
855
- g(this, "canvas");
856
- g(this, "scene");
857
- g(this, "camera");
858
- g(this, "renderer");
859
- g(this, "renderTargets", []);
860
- g(this, "renderOrder", 0);
861
- g(this, "qualityFactor", 2);
862
- g(this, "mode", "overlay");
863
- g(this, "canvasSize", "viewport");
864
- g(this, "clipArea", 1);
865
- g(this, "targetLayer", "base");
866
- g(this, "overscan", 200);
867
- g(this, "target");
868
- g(this, "mountContainer");
869
- g(this, "registry");
870
- g(this, "targetRect");
871
- g(this, "travelersByLayer", Array.from(
872
- { length: N.MAX_LAYERS },
856
+ p(this, "canvas");
857
+ p(this, "scene");
858
+ p(this, "camera");
859
+ p(this, "renderer");
860
+ p(this, "renderTargets", []);
861
+ p(this, "renderOrder", 0);
862
+ p(this, "qualityFactor", 2);
863
+ p(this, "mode", "overlay");
864
+ p(this, "canvasSize", "viewport");
865
+ p(this, "clipArea", 1);
866
+ p(this, "targetLayer", "base");
867
+ p(this, "overscan", 200);
868
+ p(this, "target");
869
+ p(this, "mountContainer");
870
+ p(this, "registry");
871
+ p(this, "targetRect");
872
+ p(this, "travelersByLayer", Array.from(
873
+ { length: V.MAX_LAYERS },
873
874
  () => /* @__PURE__ */ new Set()
874
875
  ));
875
- g(this, "textureManager");
876
+ p(this, "textureManager");
876
877
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
877
- g(this, "fixedMeshes", /* @__PURE__ */ new Set());
878
- var a, l, n, u, h;
879
- this.target = e, this.mountContainer = r, this.registry = s, this.mode = (a = t.mode) != null ? a : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (n = t.travelerClipArea) != null ? n : 1, this.targetLayer = (u = t.layer) != null ? u : "base", this.textureManager = new st((d, p) => {
880
- const f = this.registry.get(d);
881
- f && f.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(f.material, { texture: p });
878
+ p(this, "fixedMeshes", /* @__PURE__ */ new Set());
879
+ var n, l, a, u, h;
880
+ this.target = e, this.mountContainer = r, this.registry = s, this.mode = (n = t.mode) != null ? n : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (a = t.travelerClipArea) != null ? a : 1, this.targetLayer = (u = t.layer) != null ? u : "base", this.textureManager = new nt((d, m) => {
881
+ const g = this.registry.get(d);
882
+ g && g.material instanceof w.ShaderMaterial && H.forceUpdateUniforms(g.material, { texture: m });
882
883
  }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new w.Scene(), this.targetRect = this.target.getBoundingClientRect();
883
884
  const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, o = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
884
885
  this.camera = new w.OrthographicCamera(
@@ -900,10 +901,10 @@ class ot {
900
901
  return this.mode === "overlay" && this.canvasSize === "viewport";
901
902
  }
902
903
  getSceneLayer() {
903
- return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? F.SELECTED : F.BASE;
904
+ return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? O.SELECTED : O.BASE;
904
905
  }
905
906
  createRenderTarget() {
906
- for (let e = 0; e < N.MAX_LAYERS; e++) {
907
+ for (let e = 0; e < V.MAX_LAYERS; e++) {
907
908
  const t = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, r = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
908
909
  this.renderTargets.push(
909
910
  new w.WebGLRenderTarget(
@@ -950,12 +951,12 @@ class ot {
950
951
  updateUniforms(e, t) {
951
952
  const r = this.registry.get(e);
952
953
  r && (r.traverse((s) => {
953
- s.isMesh && s.material && W.forceUpdateUniforms(
954
+ s.isMesh && s.material && H.forceUpdateUniforms(
954
955
  s.material,
955
956
  t
956
957
  );
957
958
  }), r.userData.nativeMesh && r.userData.nativeMesh.traverse((s) => {
958
- s.isMesh && s.material && W.forceUpdateUniforms(
959
+ s.isMesh && s.material && H.forceUpdateUniforms(
959
960
  s.material,
960
961
  t
961
962
  );
@@ -971,8 +972,8 @@ class ot {
971
972
  this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
972
973
  }
973
974
  syncScene(e, t) {
974
- const r = this.target.getBoundingClientRect(), s = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, o = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, a = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, l = Math.abs(s - o) > 0.1 || Math.abs(c - a) > 0.1, n = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
975
- l ? (this.targetRect = r, this.setSize(s, c), this.updateCanvasLayout()) : n ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((u) => {
975
+ const r = this.target.getBoundingClientRect(), s = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, o = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, n = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, l = Math.abs(s - o) > 0.1 || Math.abs(c - n) > 0.1, a = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
976
+ l ? (this.targetRect = r, this.setSize(s, c), this.updateCanvasLayout()) : a ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((u) => {
976
977
  const h = this.registry.get(u);
977
978
  if (h) {
978
979
  this.scene.remove(h);
@@ -981,7 +982,7 @@ class ot {
981
982
  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(
982
983
  (d) => d.dispose()
983
984
  ) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((d) => {
984
- d instanceof w.Mesh && (d.geometry && d.geometry.dispose(), d.material && (Array.isArray(d.material) ? d.material.forEach((p) => p.dispose()) : d.material.dispose()));
985
+ d instanceof w.Mesh && (d.geometry && d.geometry.dispose(), d.material && (Array.isArray(d.material) ? d.material.forEach((m) => m.dispose()) : d.material.dispose()));
985
986
  }), this.registry.remove(u), this.textureManager.unregister(u);
986
987
  }
987
988
  });
@@ -995,20 +996,20 @@ class ot {
995
996
  let t = this.registry.get(e.element);
996
997
  const r = JSON.stringify(e.shaderHooks || null);
997
998
  if (t && t.userData.shaderHash !== r && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof w.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
998
- const o = new w.PlaneGeometry(1, 1), a = e.isTraveler ? (s = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : s.texture : this.textureManager.get(e.element), l = W.create(
999
+ const o = new w.PlaneGeometry(1, 1), n = e.isTraveler ? (s = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : s.texture : this.textureManager.get(e.element), l = H.create(
999
1000
  "BOX",
1000
1001
  e.styles,
1001
1002
  "",
1002
1003
  e.rect.width,
1003
1004
  e.rect.height,
1004
1005
  this.qualityFactor,
1005
- a,
1006
+ n,
1006
1007
  e.shaderHooks
1007
1008
  );
1008
1009
  t = new w.Mesh(o, l), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = l, t.userData.domElement = e.element, t.userData.shaderHash = r;
1009
1010
  }
1010
1011
  if (t.userData.clipElements = e.clipElements, (c = e.nativeStyles) != null && c.transform ? t.userData.nativeTransform = e.nativeStyles.transform : t.userData.nativeTransform = void 0, this.updateMeshProperties(t, e), this.updateMeshLayers(t, e), e.isTraveler)
1011
- for (let o = 0; o < N.MAX_LAYERS; o++)
1012
+ for (let o = 0; o < V.MAX_LAYERS; o++)
1012
1013
  o === e.captureLayer - 2 ? this.travelersByLayer[o].add(t) : this.travelersByLayer[o].delete(t);
1013
1014
  else
1014
1015
  for (const o of this.travelersByLayer)
@@ -1024,35 +1025,35 @@ class ot {
1024
1025
  ));
1025
1026
  }
1026
1027
  reconcileTextChild(e, t, r) {
1027
- var n;
1028
+ var a;
1028
1029
  const s = t.textLines || [
1029
1030
  { text: t.textContent || "", rect: t.rect }
1030
- ], c = r ? t.nativeStyles : t.textStyles, o = JSON.stringify(c) + t.textContent + s.map((u) => u.text).join("|"), a = (n = e.userData) == null ? void 0 : n.textChildStyleHash;
1031
- if (t.dirtyMask & ye || o !== a) {
1031
+ ], c = r ? t.nativeStyles : t.textStyles, o = JSON.stringify(c) + t.textContent + s.map((u) => u.text).join("|"), n = (a = e.userData) == null ? void 0 : a.textChildStyleHash;
1032
+ if (t.dirtyMask & Se || o !== n) {
1032
1033
  e.children.filter(
1033
- (f) => f.name.startsWith("TEXT_CHILD")
1034
- ).forEach((f) => {
1035
- var m;
1036
- const L = f;
1037
- (m = L.material.map) == null || m.dispose(), L.geometry.dispose(), e.remove(L);
1034
+ (g) => g.name.startsWith("TEXT_CHILD")
1035
+ ).forEach((g) => {
1036
+ var v;
1037
+ const R = g;
1038
+ (v = R.material.map) == null || v.dispose(), R.geometry.dispose(), e.remove(R);
1038
1039
  });
1039
- const h = t.rect, d = h.x + h.width / 2, p = h.y + h.height / 2;
1040
- s.forEach((f, L) => {
1041
- const m = W.create(
1040
+ const h = t.rect, d = h.x + h.width / 2, m = h.y + h.height / 2;
1041
+ s.forEach((g, R) => {
1042
+ const v = H.create(
1042
1043
  "TEXT",
1043
1044
  c,
1044
- f.text,
1045
- f.rect.width,
1046
- f.rect.height,
1045
+ g.text,
1046
+ g.rect.width,
1047
+ g.rect.height,
1047
1048
  this.qualityFactor
1048
- ), b = new w.PlaneGeometry(1, 1), E = new w.Mesh(b, m);
1049
- E.name = `TEXT_CHILD_${L}`;
1050
- const A = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, C = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
1051
- E.scale.set(A, C, 1);
1052
- const y = f.rect.x + f.rect.width / 2, S = f.rect.y + f.rect.height / 2, X = y - d, z = -(S - p);
1049
+ ), y = new w.PlaneGeometry(1, 1), E = new w.Mesh(y, v);
1050
+ E.name = `TEXT_CHILD_${R}`;
1051
+ const L = t.rect.width === 0 ? 1 : g.rect.width / t.rect.width, C = t.rect.height === 0 ? 1 : g.rect.height / t.rect.height;
1052
+ E.scale.set(L, C, 1);
1053
+ const b = g.rect.x + g.rect.width / 2, x = g.rect.y + g.rect.height / 2, X = b - d, Y = -(x - m);
1053
1054
  E.position.set(
1054
1055
  t.rect.width === 0 ? 0 : X / t.rect.width,
1055
- t.rect.height === 0 ? 0 : z / t.rect.height,
1056
+ t.rect.height === 0 ? 0 : Y / t.rect.height,
1056
1057
  5e-3
1057
1058
  ), e.add(E);
1058
1059
  }), e.userData.textChildStyleHash = o;
@@ -1062,22 +1063,22 @@ class ot {
1062
1063
  return;
1063
1064
  const h = u;
1064
1065
  if (r && t.nativeLayer !== void 0)
1065
- h.layers.set(F.HIDDEN), t.visibility & G && h.layers.enable(F.getCaptureLayer(t.nativeLayer));
1066
+ h.layers.set(O.HIDDEN), t.visibility & $ && h.layers.enable(O.getCaptureLayer(t.nativeLayer));
1066
1067
  else {
1067
- const d = t.visibility & G ? F.BASE : F.HIDDEN;
1068
- if (h.layers.set(d), t.visibility & ae && h.layers.enable(F.SELECTED), t.visibility & G)
1068
+ const d = t.visibility & $ ? O.BASE : O.HIDDEN;
1069
+ if (h.layers.set(d), t.visibility & ne && h.layers.enable(O.SELECTED), t.visibility & $)
1069
1070
  if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1070
- for (let p = t.captureLayer; p <= N.MAX_LAYERS + 1; p++)
1071
- p !== t.nativeLayer && h.layers.enable(F.getCaptureLayer(p));
1071
+ for (let m = t.captureLayer; m <= V.MAX_LAYERS + 1; m++)
1072
+ m !== t.nativeLayer && h.layers.enable(O.getCaptureLayer(m));
1072
1073
  else
1073
- for (let p = t.captureLayer; p <= N.MAX_LAYERS + 1; p++)
1074
- h.layers.enable(F.getCaptureLayer(p));
1074
+ for (let m = t.captureLayer; m <= V.MAX_LAYERS + 1; m++)
1075
+ h.layers.enable(O.getCaptureLayer(m));
1075
1076
  }
1076
1077
  });
1077
1078
  }
1078
1079
  updateMeshProperties(e, t) {
1079
- var C, y, S, X, z;
1080
- const { rect: r, styles: s } = t, c = this.renderer.getPixelRatio(), o = this.renderer.domElement.width / c, a = this.renderer.domElement.height / c;
1080
+ var C, b, x, X, Y;
1081
+ const { rect: r, styles: s } = t, c = this.renderer.getPixelRatio(), o = this.renderer.domElement.width / c, n = this.renderer.domElement.height / c;
1081
1082
  e.material = e.userData.baseMaterial;
1082
1083
  let l = ((C = e.material.userData) == null ? void 0 : C.shadowPadding) || 0;
1083
1084
  e.scale.set(r.width + l * 2, r.height + l * 2, 1), e.userData.domRect = {
@@ -1086,30 +1087,30 @@ class ot {
1086
1087
  width: r.width,
1087
1088
  height: r.height
1088
1089
  };
1089
- const n = 1e-3;
1090
+ const a = 1e-3;
1090
1091
  this.renderOrder++;
1091
1092
  const u = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
1092
- let d, p;
1093
+ let d, m;
1093
1094
  if (this.isViewport)
1094
- d = r.x - window.innerWidth / 2 + r.width / 2, p = -r.y + window.innerHeight / 2 - r.height / 2;
1095
+ d = r.x - window.innerWidth / 2 + r.width / 2, m = -r.y + window.innerHeight / 2 - r.height / 2;
1095
1096
  else {
1096
- const U = r.x - u, I = r.y - h;
1097
- d = U - o / 2 + r.width / 2, p = -I + a / 2 - r.height / 2;
1097
+ const A = r.x - u, N = r.y - h;
1098
+ d = A - o / 2 + r.width / 2, m = -N + n / 2 - r.height / 2;
1098
1099
  }
1099
1100
  e.position.set(
1100
1101
  d,
1101
- p,
1102
- s.zIndex + this.renderOrder * n
1102
+ m,
1103
+ s.zIndex + this.renderOrder * a
1103
1104
  );
1104
- const f = r.x, L = r.y;
1105
- e.userData.basePosition = { x: d, y: p }, e.userData.originalBasePosition = { x: d, y: p }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: f, y: L }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1106
- const m = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, b = window.getComputedStyle(m);
1107
- let E = 0, A = 0;
1108
- if (b.transform && b.transform !== "none") {
1109
- const U = new DOMMatrix(b.transform);
1110
- E = U.m41, A = U.m42;
1105
+ const g = r.x, R = r.y;
1106
+ e.userData.basePosition = { x: d, y: m }, e.userData.originalBasePosition = { x: d, y: m }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: g, y: R }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1107
+ const v = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, y = window.getComputedStyle(v);
1108
+ let E = 0, L = 0;
1109
+ if (y.transform && y.transform !== "none") {
1110
+ const A = new DOMMatrix(y.transform);
1111
+ E = A.m41, L = A.m42;
1111
1112
  }
1112
- if (e.userData.baseTransform = { x: E, y: A }, delete e.userData.originRatioX, delete e.userData.originRatioY, W.update(
1113
+ if (e.userData.baseTransform = { x: E, y: L }, delete e.userData.originRatioX, delete e.userData.originRatioY, H.update(
1113
1114
  e.userData.baseMaterial,
1114
1115
  "BOX",
1115
1116
  s,
@@ -1117,130 +1118,130 @@ class ot {
1117
1118
  r.width,
1118
1119
  r.height,
1119
1120
  this.qualityFactor,
1120
- t.isTraveler ? (y = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : y.texture : this.textureManager.get(t.element)
1121
+ t.isTraveler ? (b = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : b.texture : this.textureManager.get(t.element)
1121
1122
  ), t.nativeStyles && t.nativeRect) {
1122
1123
  if (!e.userData.nativeMesh) {
1123
- const B = W.create(
1124
+ const F = H.create(
1124
1125
  "BOX",
1125
1126
  t.nativeStyles,
1126
1127
  "",
1127
1128
  t.nativeRect.width,
1128
1129
  t.nativeRect.height,
1129
1130
  this.qualityFactor,
1130
- t.isTraveler ? (S = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : S.texture : this.textureManager.get(t.element),
1131
+ t.isTraveler ? (x = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : x.texture : t.nativeStyles.imageSrc && t.nativeStyles.imageSrc !== t.styles.imageSrc ? new w.TextureLoader().load(t.nativeStyles.imageSrc) : this.textureManager.get(t.element),
1131
1132
  t.shaderHooks
1132
- ), V = new w.Mesh(e.geometry, B);
1133
- t.type === "TEXT" && (V.name = "BG_MESH"), this.scene.add(V), e.userData.nativeMesh = V;
1133
+ ), W = new w.Mesh(e.geometry, F);
1134
+ t.type === "TEXT" && (W.name = "BG_MESH"), this.scene.add(W), e.userData.nativeMesh = W;
1134
1135
  }
1135
- const U = e.userData.nativeMesh;
1136
- let I, j;
1136
+ const A = e.userData.nativeMesh;
1137
+ let N, U;
1137
1138
  if (this.isViewport)
1138
- I = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, j = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1139
+ N = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, U = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1139
1140
  else {
1140
- const B = t.nativeRect.x - u, V = t.nativeRect.y - h;
1141
- I = B - o / 2 + t.nativeRect.width / 2, j = -V + a / 2 - t.nativeRect.height / 2;
1141
+ const F = t.nativeRect.x - u, W = t.nativeRect.y - h;
1142
+ N = F - o / 2 + t.nativeRect.width / 2, U = -W + n / 2 - t.nativeRect.height / 2;
1142
1143
  }
1143
- let J = t.nativeRect.width, Z = t.nativeRect.height, M = I, O = j;
1144
+ let K = t.nativeRect.width, J = t.nativeRect.height, M = N, B = U;
1144
1145
  if (t.nativeStyles.transform) {
1145
- const B = t.nativeStyles.transform, V = B.match(/scale\(([\d.]+%?)\)/);
1146
- if (V) {
1147
- let x = parseFloat(V[1]);
1148
- V[1].includes("%") && (x /= 100), J *= x, Z *= x;
1149
- }
1150
- const ie = B.match(/scaleX\(([\d.]+%?)\)/);
1151
- if (ie) {
1152
- let x = parseFloat(ie[1]);
1153
- ie[1].includes("%") && (x /= 100), J *= x;
1146
+ const F = t.nativeStyles.transform, W = F.match(/scale\(([\d.]+%?)\)/);
1147
+ if (W) {
1148
+ let f = parseFloat(W[1]);
1149
+ W[1].includes("%") && (f /= 100), K *= f, J *= f;
1154
1150
  }
1155
- const se = B.match(/scaleY\(([\d.]+%?)\)/);
1151
+ const se = F.match(/scaleX\(([\d.]+%?)\)/);
1156
1152
  if (se) {
1157
- let x = parseFloat(se[1]);
1158
- se[1].includes("%") && (x /= 100), Z *= x;
1153
+ let f = parseFloat(se[1]);
1154
+ se[1].includes("%") && (f /= 100), K *= f;
1159
1155
  }
1160
- const oe = B.match(/translate\(([^,]+),\s*([^)]+)\)/);
1156
+ const oe = F.match(/scaleY\(([\d.]+%?)\)/);
1161
1157
  if (oe) {
1162
- const x = oe[1].trim(), T = oe[2].trim();
1163
- let _ = parseFloat(x);
1164
- x.includes("%") && (_ = _ / 100 * t.nativeRect.width);
1165
- let D = parseFloat(T);
1166
- T.includes("%") && (D = D / 100 * t.nativeRect.height), M += _, O -= D;
1158
+ let f = parseFloat(oe[1]);
1159
+ oe[1].includes("%") && (f /= 100), J *= f;
1167
1160
  }
1168
- const he = B.match(/translateX\(([^)]+)\)/);
1161
+ const ae = F.match(/translate\(([^,]+),\s*([^)]+)\)/);
1162
+ if (ae) {
1163
+ const f = ae[1].trim(), S = ae[2].trim();
1164
+ let I = parseFloat(f);
1165
+ f.includes("%") && (I = I / 100 * t.nativeRect.width);
1166
+ let _ = parseFloat(S);
1167
+ S.includes("%") && (_ = _ / 100 * t.nativeRect.height), M += I, B -= _;
1168
+ }
1169
+ const he = F.match(/translateX\(([^)]+)\)/);
1169
1170
  if (he) {
1170
- const x = he[1].trim();
1171
- let T = parseFloat(x);
1172
- x.includes("%") && (T = T / 100 * t.nativeRect.width), M += T;
1171
+ const f = he[1].trim();
1172
+ let S = parseFloat(f);
1173
+ f.includes("%") && (S = S / 100 * t.nativeRect.width), M += S;
1173
1174
  }
1174
- const v = B.match(/translateY\(([^)]+)\)/);
1175
- if (v) {
1176
- const x = v[1].trim();
1177
- let T = parseFloat(x);
1178
- x.includes("%") && (T = T / 100 * t.nativeRect.height), O -= T;
1175
+ const de = F.match(/translateY\(([^)]+)\)/);
1176
+ if (de) {
1177
+ const f = de[1].trim();
1178
+ let S = parseFloat(f);
1179
+ f.includes("%") && (S = S / 100 * t.nativeRect.height), B -= S;
1179
1180
  }
1180
1181
  }
1181
- let K = ((X = U.material.userData) == null ? void 0 : X.shadowPadding) || 0;
1182
- U.scale.set(J + K * 2, Z + K * 2, 1), U.position.set(
1182
+ let Z = ((X = A.material.userData) == null ? void 0 : X.shadowPadding) || 0;
1183
+ A.scale.set(K + Z * 2, J + Z * 2, 1), A.position.set(
1183
1184
  M,
1184
- O,
1185
- t.nativeStyles.zIndex + this.renderOrder * n
1186
- ), W.update(
1187
- U.material,
1185
+ B,
1186
+ t.nativeStyles.zIndex + this.renderOrder * a
1187
+ ), H.update(
1188
+ A.material,
1188
1189
  "BOX",
1189
1190
  t.nativeStyles,
1190
1191
  "",
1191
1192
  t.nativeRect.width,
1192
1193
  t.nativeRect.height,
1193
1194
  this.qualityFactor,
1194
- t.isTraveler ? (z = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : z.texture : this.textureManager.get(t.element)
1195
+ t.isTraveler ? (Y = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : Y.texture : A.material.uniforms.uTexture.value || this.textureManager.get(t.element)
1195
1196
  );
1196
1197
  } else
1197
1198
  e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof w.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1198
1199
  }
1199
1200
  updateMeshLayers(e, t) {
1200
- const r = t.visibility & G ? F.BASE : F.HIDDEN;
1201
- if (e.layers.set(r), t.visibility & ae && e.layers.enable(F.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1201
+ const r = t.visibility & $ ? O.BASE : O.HIDDEN;
1202
+ if (e.layers.set(r), t.visibility & ne && e.layers.enable(O.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1202
1203
  const s = e.userData.nativeMesh;
1203
- if (s.layers.set(F.HIDDEN), t.visibility & G) {
1204
- s.layers.enable(F.getCaptureLayer(t.nativeLayer));
1205
- for (let c = t.captureLayer; c <= N.MAX_LAYERS + 1; c++)
1206
- c !== t.nativeLayer && e.layers.enable(F.getCaptureLayer(c));
1204
+ if (s.layers.set(O.HIDDEN), t.visibility & $) {
1205
+ s.layers.enable(O.getCaptureLayer(t.nativeLayer));
1206
+ for (let c = t.captureLayer; c <= V.MAX_LAYERS + 1; c++)
1207
+ c !== t.nativeLayer && e.layers.enable(O.getCaptureLayer(c));
1207
1208
  }
1208
- } else if (t.visibility & G)
1209
- for (let s = t.captureLayer; s <= N.MAX_LAYERS + 1; s++)
1210
- e.layers.enable(F.getCaptureLayer(s));
1209
+ } else if (t.visibility & $)
1210
+ for (let s = t.captureLayer; s <= V.MAX_LAYERS + 1; s++)
1211
+ e.layers.enable(O.getCaptureLayer(s));
1211
1212
  }
1212
1213
  captureRenderTarget(e, t, r) {
1213
1214
  if (e.size === 0 || !r)
1214
1215
  return;
1215
1216
  const s = new w.Color(), c = this.renderer.getClearAlpha();
1216
1217
  this.renderer.getClearColor(s), 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);
1217
- const o = new w.Vector3(), a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, n = this.renderer.getPixelRatio();
1218
+ const o = new w.Vector3(), n = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, a = this.renderer.getPixelRatio();
1218
1219
  for (const u of e) {
1219
1220
  o.setFromMatrixPosition(u.matrixWorld), o.project(this.camera);
1220
- const h = (o.x + 1) / 2 * a, d = (o.y + 1) / 2 * l;
1221
- let p = 0, f = 1;
1222
- typeof this.clipArea == "number" ? f = this.clipArea : this.clipArea.endsWith("%") ? f = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1223
- const L = u.scale.x * f + 0.5, m = u.scale.y * f + 0.5, b = h - L / 2, E = d - m / 2, A = (b * this.qualityFactor - p) / n, C = (E * this.qualityFactor - p) / n, y = (L * this.qualityFactor + p * 2) / n, S = (m * this.qualityFactor + p * 2) / n;
1224
- this.renderer.setScissor(A, C, y, S), this.renderer.render(this.scene, this.camera);
1221
+ const h = (o.x + 1) / 2 * n, d = (o.y + 1) / 2 * l;
1222
+ let m = 0, g = 1;
1223
+ typeof this.clipArea == "number" ? g = this.clipArea : this.clipArea.endsWith("%") ? g = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (m = parseFloat(this.clipArea));
1224
+ const R = u.scale.x * g + 0.5, v = u.scale.y * g + 0.5, y = h - R / 2, E = d - v / 2, L = (y * this.qualityFactor - m) / a, C = (E * this.qualityFactor - m) / a, b = (R * this.qualityFactor + m * 2) / a, x = (v * this.qualityFactor + m * 2) / a;
1225
+ this.renderer.setScissor(L, C, b, x), this.renderer.render(this.scene, this.camera);
1225
1226
  }
1226
1227
  this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(s, c);
1227
1228
  }
1228
1229
  render() {
1229
- for (let l = 0; l < N.MAX_LAYERS; l++) {
1230
- const n = l + 1;
1230
+ for (let l = 0; l < V.MAX_LAYERS; l++) {
1231
+ const a = l + 1;
1231
1232
  this.captureRenderTarget(
1232
1233
  this.travelersByLayer[l],
1233
- F.getCaptureLayer(n),
1234
+ O.getCaptureLayer(a),
1234
1235
  this.renderTargets[l]
1235
1236
  );
1236
1237
  }
1237
- const e = this.renderer.getContext(), t = this.renderer.getPixelRatio(), r = this.renderer.domElement.height / t, s = this.renderer.domElement, c = s.getBoundingClientRect().top, o = s.getBoundingClientRect().left, a = (l, n) => {
1238
- if (n && n.width > 0 && n.height > 0) {
1239
- const u = Math.floor((n.x - o) * t), h = Math.floor(
1240
- (r - (n.y - c + n.height)) * t
1241
- ), d = Math.ceil(n.width * t), p = Math.ceil(n.height * t);
1238
+ const e = this.renderer.getContext(), t = this.renderer.getPixelRatio(), r = this.renderer.domElement.height / t, s = this.renderer.domElement, c = s.getBoundingClientRect().top, o = s.getBoundingClientRect().left, n = (l, a) => {
1239
+ if (a && a.width > 0 && a.height > 0) {
1240
+ const u = Math.floor((a.x - o) * t), h = Math.floor(
1241
+ (r - (a.y - c + a.height)) * t
1242
+ ), d = Math.ceil(a.width * t), m = Math.ceil(a.height * t);
1242
1243
  l.onBeforeRender = () => {
1243
- e.enable(e.SCISSOR_TEST), e.scissor(u, h, d, p);
1244
+ e.enable(e.SCISSOR_TEST), e.scissor(u, h, d, m);
1244
1245
  }, l.onAfterRender = () => {
1245
1246
  e.disable(e.SCISSOR_TEST);
1246
1247
  }, l.__hasScissorHook = !0;
@@ -1251,9 +1252,9 @@ class ot {
1251
1252
  };
1252
1253
  this.scene.children.forEach((l) => {
1253
1254
  var h;
1254
- const n = l, u = (h = n.userData) == null ? void 0 : h.scissorRect;
1255
- a(n, u), n.children.forEach((d) => {
1256
- d.name.startsWith("TEXT_CHILD") && a(d, u);
1255
+ const a = l, u = (h = a.userData) == null ? void 0 : h.scissorRect;
1256
+ n(a, u), a.children.forEach((d) => {
1257
+ d.name.startsWith("TEXT_CHILD") && n(d, u);
1257
1258
  });
1258
1259
  }), this.renderer.render(this.scene, this.camera);
1259
1260
  }
@@ -1261,116 +1262,116 @@ class ot {
1261
1262
  const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, r = this.renderer.getPixelRatio(), s = this.renderer.domElement.width / r, c = this.renderer.domElement.height / r;
1262
1263
  this.scene.children.forEach((o) => {
1263
1264
  var h, d;
1264
- const a = o;
1265
- if (!a.userData || !a.userData.domElement)
1265
+ const n = o;
1266
+ if (!n.userData || !n.userData.domElement)
1266
1267
  return;
1267
- const l = a.userData.domElement;
1268
+ const l = n.userData.domElement;
1268
1269
  if (!l.isConnected)
1269
1270
  return;
1270
- let n;
1271
+ let a;
1271
1272
  if (l.nodeType === Node.TEXT_NODE) {
1272
- const p = document.createRange();
1273
- p.selectNode(l), n = p.getBoundingClientRect();
1273
+ const m = document.createRange();
1274
+ m.selectNode(l), a = m.getBoundingClientRect();
1274
1275
  } else
1275
- n = l.getBoundingClientRect();
1276
- const u = a.userData.domRect;
1277
- if (!u || Math.abs(n.x - u.x) > 0.5 || Math.abs(n.y - u.y) > 0.5 || Math.abs(n.width - u.width) > 0.5 || Math.abs(n.height - u.height) > 0.5) {
1278
- a.userData.domRect = {
1279
- x: n.x,
1280
- y: n.y,
1281
- width: n.width,
1282
- height: n.height
1276
+ a = l.getBoundingClientRect();
1277
+ const u = n.userData.domRect;
1278
+ if (!u || Math.abs(a.x - u.x) > 0.5 || Math.abs(a.y - u.y) > 0.5 || Math.abs(a.width - u.width) > 0.5 || Math.abs(a.height - u.height) > 0.5) {
1279
+ n.userData.domRect = {
1280
+ x: a.x,
1281
+ y: a.y,
1282
+ width: a.width,
1283
+ height: a.height
1283
1284
  };
1284
- const p = a.userData.clipElements;
1285
- if (p && p.length > 0) {
1286
- let b = -1 / 0, E = -1 / 0, A = 1 / 0, C = 1 / 0;
1287
- for (const y of p) {
1288
- const S = y.getBoundingClientRect();
1289
- b = Math.max(b, S.left), E = Math.max(E, S.top), A = Math.min(A, S.right), C = Math.min(C, S.bottom);
1285
+ const m = n.userData.clipElements;
1286
+ if (m && m.length > 0) {
1287
+ let y = -1 / 0, E = -1 / 0, L = 1 / 0, C = 1 / 0;
1288
+ for (const b of m) {
1289
+ const x = b.getBoundingClientRect();
1290
+ y = Math.max(y, x.left), E = Math.max(E, x.top), L = Math.min(L, x.right), C = Math.min(C, x.bottom);
1290
1291
  }
1291
- a.userData.scissorRect = {
1292
- x: b,
1292
+ n.userData.scissorRect = {
1293
+ x: y,
1293
1294
  y: E,
1294
- width: Math.max(0, A - b),
1295
+ width: Math.max(0, L - y),
1295
1296
  height: Math.max(0, C - E)
1296
1297
  };
1297
1298
  } else
1298
- a.userData.scissorRect = void 0;
1299
- let f, L;
1299
+ n.userData.scissorRect = void 0;
1300
+ let g, R;
1300
1301
  if (this.isViewport)
1301
- f = n.x - window.innerWidth / 2 + n.width / 2, L = -n.y + window.innerHeight / 2 - n.height / 2;
1302
+ g = a.x - window.innerWidth / 2 + a.width / 2, R = -a.y + window.innerHeight / 2 - a.height / 2;
1302
1303
  else {
1303
- const b = n.x - e, E = n.y - t;
1304
- f = b - s / 2 + n.width / 2, L = -E + c / 2 - n.height / 2;
1304
+ const y = a.x - e, E = a.y - t;
1305
+ g = y - s / 2 + a.width / 2, R = -E + c / 2 - a.height / 2;
1305
1306
  }
1306
- a.position.setX(f), a.position.setY(L);
1307
- let m = ((h = a.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1308
- if (a.scale.set(n.width + m * 2, n.height + m * 2, 1), a.updateMatrixWorld(), a.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(a.material, {
1309
- width: n.width,
1310
- height: n.height
1311
- }), a.userData.nativeMesh) {
1312
- const b = a.userData.nativeMesh;
1313
- let E = n.width, A = n.height, C = f, y = L;
1314
- if (a.userData.nativeTransform) {
1315
- const X = a.userData.nativeTransform, z = X.match(/scale\(([\d.]+%?)\)/);
1316
- if (z) {
1317
- let M = parseFloat(z[1]);
1318
- z[1].includes("%") && (M /= 100), E *= M, A *= M;
1307
+ n.position.setX(g), n.position.setY(R);
1308
+ let v = ((h = n.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1309
+ if (n.scale.set(a.width + v * 2, a.height + v * 2, 1), n.updateMatrixWorld(), n.material instanceof w.ShaderMaterial && H.forceUpdateUniforms(n.material, {
1310
+ width: a.width,
1311
+ height: a.height
1312
+ }), n.userData.nativeMesh) {
1313
+ const y = n.userData.nativeMesh;
1314
+ let E = a.width, L = a.height, C = g, b = R;
1315
+ if (n.userData.nativeTransform) {
1316
+ const X = n.userData.nativeTransform, Y = X.match(/scale\(([\d.]+%?)\)/);
1317
+ if (Y) {
1318
+ let M = parseFloat(Y[1]);
1319
+ Y[1].includes("%") && (M /= 100), E *= M, L *= M;
1319
1320
  }
1320
- const U = X.match(/scaleX\(([\d.]+%?)\)/);
1321
- if (U) {
1322
- let M = parseFloat(U[1]);
1323
- U[1].includes("%") && (M /= 100), E *= M;
1321
+ const A = X.match(/scaleX\(([\d.]+%?)\)/);
1322
+ if (A) {
1323
+ let M = parseFloat(A[1]);
1324
+ A[1].includes("%") && (M /= 100), E *= M;
1324
1325
  }
1325
- const I = X.match(/scaleY\(([\d.]+%?)\)/);
1326
- if (I) {
1327
- let M = parseFloat(I[1]);
1328
- I[1].includes("%") && (M /= 100), A *= M;
1326
+ const N = X.match(/scaleY\(([\d.]+%?)\)/);
1327
+ if (N) {
1328
+ let M = parseFloat(N[1]);
1329
+ N[1].includes("%") && (M /= 100), L *= M;
1330
+ }
1331
+ const U = X.match(/translate\(([^,]+),\s*([^)]+)\)/);
1332
+ if (U) {
1333
+ const M = U[1].trim(), B = U[2].trim();
1334
+ let Z = parseFloat(M);
1335
+ M.includes("%") && (Z = Z / 100 * a.width);
1336
+ let F = parseFloat(B);
1337
+ B.includes("%") && (F = F / 100 * a.height), C += Z, b -= F;
1329
1338
  }
1330
- const j = X.match(/translate\(([^,]+),\s*([^)]+)\)/);
1331
- if (j) {
1332
- const M = j[1].trim(), O = j[2].trim();
1333
- let K = parseFloat(M);
1334
- M.includes("%") && (K = K / 100 * n.width);
1335
- let B = parseFloat(O);
1336
- O.includes("%") && (B = B / 100 * n.height), C += K, y -= B;
1339
+ const K = X.match(/translateX\(([^)]+)\)/);
1340
+ if (K) {
1341
+ const M = K[1].trim();
1342
+ let B = parseFloat(M);
1343
+ M.includes("%") && (B = B / 100 * a.width), C += B;
1337
1344
  }
1338
- const J = X.match(/translateX\(([^)]+)\)/);
1345
+ const J = X.match(/translateY\(([^)]+)\)/);
1339
1346
  if (J) {
1340
1347
  const M = J[1].trim();
1341
- let O = parseFloat(M);
1342
- M.includes("%") && (O = O / 100 * n.width), C += O;
1343
- }
1344
- const Z = X.match(/translateY\(([^)]+)\)/);
1345
- if (Z) {
1346
- const M = Z[1].trim();
1347
- let O = parseFloat(M);
1348
- M.includes("%") && (O = O / 100 * n.height), y -= O;
1348
+ let B = parseFloat(M);
1349
+ M.includes("%") && (B = B / 100 * a.height), b -= B;
1349
1350
  }
1350
1351
  }
1351
- let S = ((d = b.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1352
- b.position.setX(C), b.position.setY(y), b.scale.set(E + S * 2, A + S * 2, 1), b.updateMatrixWorld(), b.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(b.material, {
1352
+ let x = ((d = y.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1353
+ y.position.setX(C), y.position.setY(b), y.scale.set(E + x * 2, L + x * 2, 1), y.updateMatrixWorld(), y.material instanceof w.ShaderMaterial && H.forceUpdateUniforms(y.material, {
1353
1354
  width: E,
1354
- height: A
1355
+ height: L
1355
1356
  });
1356
1357
  }
1357
1358
  }
1358
1359
  });
1359
1360
  }
1360
1361
  }
1361
- function nt(i) {
1362
+ function ct(i) {
1362
1363
  const e = i.textContent || "", t = [];
1363
1364
  let r = "", s = null, c = -1;
1364
- const o = (n, u) => {
1365
- for (let h = 0; h < n.length; h++) {
1366
- const d = n[h], p = document.createRange();
1367
- p.setStart(i, u + h), p.setEnd(i, u + h + 1);
1368
- const f = p.getBoundingClientRect();
1369
- if (f.width === 0 && f.height === 0) {
1365
+ const o = (a, u) => {
1366
+ for (let h = 0; h < a.length; h++) {
1367
+ const d = a[h], m = document.createRange();
1368
+ m.setStart(i, u + h), m.setEnd(i, u + h + 1);
1369
+ const g = m.getBoundingClientRect();
1370
+ if (g.width === 0 && g.height === 0) {
1370
1371
  r += d;
1371
1372
  continue;
1372
1373
  }
1373
- c === -1 || Math.abs(f.top - c) > f.height / 2 ? (r && s && t.push({
1374
+ c === -1 || Math.abs(g.top - c) > g.height / 2 ? (r && s && t.push({
1374
1375
  text: r,
1375
1376
  rect: {
1376
1377
  left: s.left,
@@ -1379,27 +1380,27 @@ function nt(i) {
1379
1380
  height: s.bottom - s.top
1380
1381
  }
1381
1382
  }), r = d, s = {
1382
- left: f.left,
1383
- top: f.top,
1384
- right: f.right,
1385
- bottom: f.bottom
1386
- }, c = f.top) : (r += d, s && (s.left = Math.min(s.left, f.left), s.top = Math.min(s.top, f.top), s.right = Math.max(s.right, f.right), s.bottom = Math.max(
1383
+ left: g.left,
1384
+ top: g.top,
1385
+ right: g.right,
1386
+ bottom: g.bottom
1387
+ }, c = g.top) : (r += d, s && (s.left = Math.min(s.left, g.left), s.top = Math.min(s.top, g.top), s.right = Math.max(s.right, g.right), s.bottom = Math.max(
1387
1388
  s.bottom,
1388
- f.bottom
1389
+ g.bottom
1389
1390
  )));
1390
1391
  }
1391
- }, a = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1392
+ }, n = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1392
1393
  let l = 0;
1393
- for (const n of a) {
1394
+ for (const a of n) {
1394
1395
  const u = document.createRange();
1395
- u.setStart(i, l), u.setEnd(i, l + n.length);
1396
+ u.setStart(i, l), u.setEnd(i, l + a.length);
1396
1397
  const h = u.getClientRects();
1397
1398
  if (h.length > 1)
1398
- o(n, l);
1399
+ o(a, l);
1399
1400
  else {
1400
1401
  const d = h.length === 1 ? h[0] : u.getBoundingClientRect();
1401
1402
  if (d.width === 0 && d.height === 0) {
1402
- r += n, l += n.length;
1403
+ r += a, l += a.length;
1403
1404
  continue;
1404
1405
  }
1405
1406
  c === -1 || Math.abs(d.top - c) > d.height / 2 ? (r && s && t.push({
@@ -1410,17 +1411,17 @@ function nt(i) {
1410
1411
  width: s.right - s.left,
1411
1412
  height: s.bottom - s.top
1412
1413
  }
1413
- }), r = n, s = {
1414
+ }), r = a, s = {
1414
1415
  left: d.left,
1415
1416
  top: d.top,
1416
1417
  right: d.right,
1417
1418
  bottom: d.bottom
1418
- }, c = d.top) : (r += n, s && (s.left = Math.min(s.left, d.left), s.top = Math.min(s.top, d.top), s.right = Math.max(s.right, d.right), s.bottom = Math.max(
1419
+ }, c = d.top) : (r += a, s && (s.left = Math.min(s.left, d.left), s.top = Math.min(s.top, d.top), s.right = Math.max(s.right, d.right), s.bottom = Math.max(
1419
1420
  s.bottom,
1420
1421
  d.bottom
1421
1422
  )));
1422
1423
  }
1423
- l += n.length;
1424
+ l += a.length;
1424
1425
  }
1425
1426
  return r && s && t.push({
1426
1427
  text: r,
@@ -1431,10 +1432,10 @@ function nt(i) {
1431
1432
  height: s.bottom - s.top
1432
1433
  }
1433
1434
  }), t.filter(
1434
- (n) => n.text.trim().length > 0 && n.rect.width > 0 && n.rect.height > 0
1435
+ (a) => a.text.trim().length > 0 && a.rect.width > 0 && a.rect.height > 0
1435
1436
  );
1436
1437
  }
1437
- function Ae(i) {
1438
+ function Ue(i) {
1438
1439
  const e = parseFloat(i.fontSize);
1439
1440
  let t = parseFloat(i.lineHeight);
1440
1441
  isNaN(t) && (t = e * 1.2);
@@ -1450,74 +1451,74 @@ function Ae(i) {
1450
1451
  letterSpacing: r
1451
1452
  };
1452
1453
  }
1453
- function Fe(i, e = re | ue | Pe | ye | pe, t, r = 1, s = 0, c = 2, o, a, l) {
1454
- var K, B, V, ie, se, oe, he;
1454
+ function Xe(i, e = ie | fe | qe | Se | me, t, r = 1, s = 0, c = 2, o, n, l) {
1455
+ var F, W, se, oe, ae, he, de;
1455
1456
  if (i.nodeType === Node.TEXT_NODE) {
1456
- const v = i;
1457
- if (!v.textContent || !v.textContent.trim())
1457
+ const f = i;
1458
+ if (!f.textContent || !f.textContent.trim())
1458
1459
  return null;
1459
- const x = v.textContent.replace(/\s+/g, " ");
1460
- if (x.length === 0)
1460
+ const S = f.textContent.replace(/\s+/g, " ");
1461
+ if (S.length === 0)
1461
1462
  return null;
1462
- const T = nt(v);
1463
- if (T.length === 0)
1463
+ const I = ct(f);
1464
+ if (I.length === 0)
1464
1465
  return null;
1465
- const _ = v.parentElement, D = _ ? window.getComputedStyle(_) : null;
1466
- if (!D)
1466
+ const _ = f.parentElement, k = _ ? window.getComputedStyle(_) : null;
1467
+ if (!k)
1467
1468
  return null;
1468
- const q = Math.min(...T.map((R) => R.rect.left)), Y = Math.min(...T.map((R) => R.rect.top)), Q = Math.max(...T.map((R) => R.rect.left + R.rect.width)), k = Math.max(...T.map((R) => R.rect.top + R.rect.height));
1469
+ const P = Math.min(...I.map((T) => T.rect.left)), z = Math.min(...I.map((T) => T.rect.top)), Q = Math.max(...I.map((T) => T.rect.left + T.rect.width)), D = Math.max(...I.map((T) => T.rect.top + T.rect.height));
1469
1470
  return {
1470
1471
  id: Math.random().toString(36).substring(2, 9),
1471
1472
  type: "TEXT",
1472
- element: v,
1473
+ element: f,
1473
1474
  rect: {
1474
- x: q + window.scrollX,
1475
- y: Y + window.scrollY,
1476
- width: Q - q,
1477
- height: k - Y
1475
+ x: P + window.scrollX,
1476
+ y: z + window.scrollY,
1477
+ width: Q - P,
1478
+ height: D - z
1478
1479
  },
1479
1480
  styles: {
1480
1481
  backgroundColor: "transparent",
1481
1482
  backgroundImage: "",
1482
- opacity: _ && _.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1483
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + s,
1483
+ opacity: _ && _.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(k.opacity),
1484
+ zIndex: (isNaN(parseInt(k.zIndex)) ? 0 : parseInt(k.zIndex)) + s,
1484
1485
  borderRadius: "0px",
1485
1486
  borderColor: "transparent",
1486
1487
  borderWidth: "0px",
1487
1488
  isTraveler: !1
1488
1489
  },
1489
- textContent: x,
1490
- textLines: T.map((R) => ({
1491
- text: R.text.trim(),
1490
+ textContent: S,
1491
+ textLines: I.map((T) => ({
1492
+ text: T.text.trim(),
1492
1493
  rect: {
1493
- x: R.rect.left + window.scrollX,
1494
- y: R.rect.top + window.scrollY,
1495
- width: R.rect.width,
1496
- height: R.rect.height
1494
+ x: T.rect.left + window.scrollX,
1495
+ y: T.rect.top + window.scrollY,
1496
+ width: T.rect.width,
1497
+ height: T.rect.height
1497
1498
  }
1498
1499
  })),
1499
- textStyles: Ae(D),
1500
+ textStyles: Ue(k),
1500
1501
  dirtyMask: e,
1501
1502
  visibility: t,
1502
1503
  isTraveler: !1,
1503
1504
  captureLayer: r,
1504
- isFixed: D.position === "fixed",
1505
+ isFixed: k.position === "fixed",
1505
1506
  nativeLayer: o,
1506
- nativeStyles: a ? te(te({
1507
+ nativeStyles: n ? re(re({
1507
1508
  backgroundColor: "transparent",
1508
1509
  backgroundImage: "",
1509
- opacity: _ && _.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1510
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + s,
1510
+ opacity: _ && _.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(k.opacity),
1511
+ zIndex: (isNaN(parseInt(k.zIndex)) ? 0 : parseInt(k.zIndex)) + s,
1511
1512
  borderRadius: "0px",
1512
1513
  borderColor: "transparent",
1513
1514
  borderWidth: "0px",
1514
1515
  isTraveler: !1
1515
- }, Ae(D)), a) : void 0,
1516
- nativeRect: a ? {
1517
- x: q + window.scrollX,
1518
- y: Y + window.scrollY,
1519
- width: Q - q,
1520
- height: k - Y
1516
+ }, Ue(k)), n) : void 0,
1517
+ nativeRect: n ? {
1518
+ x: P + window.scrollX,
1519
+ y: z + window.scrollY,
1520
+ width: Q - P,
1521
+ height: D - z
1521
1522
  } : void 0,
1522
1523
  clipElements: l,
1523
1524
  children: []
@@ -1525,244 +1526,248 @@ function Fe(i, e = re | ue | Pe | ye | pe, t, r = 1, s = 0, c = 2, o, a, l) {
1525
1526
  }
1526
1527
  if (i.nodeType !== Node.ELEMENT_NODE)
1527
1528
  return null;
1528
- const n = i, u = n.dataset[H.KEY];
1529
+ const a = i, u = a.dataset[q.KEY];
1529
1530
  let h = t, d = t;
1530
1531
  if (u) {
1531
- const v = new Set(u.split(/\s+/));
1532
- for (const x of v)
1533
- if (!Me.includes(x))
1532
+ const f = new Set(u.split(/\s+/));
1533
+ for (const S of f)
1534
+ if (!Ae.includes(S))
1534
1535
  throw new Error(
1535
- `[MirageEngine] Invalid filter token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1536
+ `[MirageEngine] Invalid filter token: '${S}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1536
1537
  );
1537
- if (v.has(H.VALUES.END))
1538
+ if (f.has(q.VALUES.END))
1538
1539
  return null;
1539
- if (v.has(H.VALUES.INCLUDE_TREE) && v.has(H.VALUES.EXCLUDE_TREE))
1540
+ if (f.has(q.VALUES.INCLUDE_TREE) && f.has(q.VALUES.EXCLUDE_TREE))
1540
1541
  throw new Error(
1541
1542
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1542
1543
  );
1543
- if (v.has(H.VALUES.INCLUDE_SELF) && v.has(H.VALUES.EXCLUDE_SELF))
1544
+ if (f.has(q.VALUES.INCLUDE_SELF) && f.has(q.VALUES.EXCLUDE_SELF))
1544
1545
  throw new Error(
1545
1546
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1546
1547
  );
1547
- v.has(H.VALUES.INCLUDE_TREE) ? h = h | G : v.has(H.VALUES.EXCLUDE_TREE) && (h = h & ~G), d = h, v.has(H.VALUES.INCLUDE_SELF) ? d = d | G : v.has(H.VALUES.EXCLUDE_SELF) && (d = d & ~G);
1548
+ f.has(q.VALUES.INCLUDE_TREE) ? h = h | $ : f.has(q.VALUES.EXCLUDE_TREE) && (h = h & ~$), d = h, f.has(q.VALUES.INCLUDE_SELF) ? d = d | $ : f.has(q.VALUES.EXCLUDE_SELF) && (d = d & ~$);
1548
1549
  }
1549
- const p = n.dataset[$.KEY];
1550
- if (p) {
1551
- const v = new Set(p.split(/\s+/));
1552
- for (const x of v)
1553
- if (!Me.includes(x))
1550
+ const m = a.dataset[j.KEY];
1551
+ if (m) {
1552
+ const f = new Set(m.split(/\s+/));
1553
+ for (const S of f)
1554
+ if (!Ae.includes(S))
1554
1555
  throw new Error(
1555
- `[MirageEngine] Invalid select token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1556
+ `[MirageEngine] Invalid select token: '${S}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1556
1557
  );
1557
- if (v.has($.VALUES.END))
1558
+ if (f.has(j.VALUES.END))
1558
1559
  return null;
1559
- if (v.has($.VALUES.INCLUDE_TREE) && v.has($.VALUES.EXCLUDE_TREE))
1560
+ if (f.has(j.VALUES.INCLUDE_TREE) && f.has(j.VALUES.EXCLUDE_TREE))
1560
1561
  throw new Error(
1561
1562
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1562
1563
  );
1563
- if (v.has($.VALUES.INCLUDE_SELF) && v.has($.VALUES.EXCLUDE_SELF))
1564
+ if (f.has(j.VALUES.INCLUDE_SELF) && f.has(j.VALUES.EXCLUDE_SELF))
1564
1565
  throw new Error(
1565
1566
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1566
1567
  );
1567
- v.has($.VALUES.INCLUDE_TREE) ? h = h | ae : v.has($.VALUES.EXCLUDE_TREE) && (h = h & ~ae), d = h, v.has($.VALUES.INCLUDE_SELF) ? d = d | ae : v.has($.VALUES.EXCLUDE_SELF) && (d = d & ~ae);
1568
- }
1569
- const f = n.dataset[N.KEY];
1570
- let L = !1, m = a ? te({}, a) : {}, b = o;
1571
- if (f) {
1572
- let v = 1;
1573
- const x = f.indexOf("{"), T = f.lastIndexOf("}");
1574
- let _ = f;
1575
- if (x !== -1 && T !== -1 && T > x) {
1576
- _ = f.substring(0, x).trim();
1577
- const k = f.substring(x, T + 1);
1568
+ f.has(j.VALUES.INCLUDE_TREE) ? h = h | ne : f.has(j.VALUES.EXCLUDE_TREE) && (h = h & ~ne), d = h, f.has(j.VALUES.INCLUDE_SELF) ? d = d | ne : f.has(j.VALUES.EXCLUDE_SELF) && (d = d & ~ne);
1569
+ }
1570
+ const g = a.dataset[V.KEY];
1571
+ let R = !1, v = n ? re({}, n) : {}, y = o;
1572
+ if (g) {
1573
+ let f = 1;
1574
+ const S = g.indexOf("{"), I = g.lastIndexOf("}");
1575
+ let _ = g;
1576
+ if (S !== -1 && I !== -1 && I > S) {
1577
+ _ = g.substring(0, S).trim();
1578
+ const D = g.substring(S, I + 1);
1578
1579
  try {
1579
- m = new Function("return " + k)();
1580
- } catch (R) {
1580
+ v = new Function("return " + D)();
1581
+ } catch (T) {
1581
1582
  console.warn(
1582
- `[MirageEngine] Failed to parse travel styles JSON: ${k}`
1583
+ `[MirageEngine] Failed to parse travel styles JSON: ${D}`
1583
1584
  );
1584
1585
  }
1585
1586
  }
1586
- const D = _.split(/\s+/);
1587
- let q = !1;
1588
- const Y = D.indexOf(N.VALUES.TRAVELER);
1589
- if (Y !== -1) {
1590
- L = !0, q = !0;
1591
- const k = D[Y + 1];
1592
- if (k && !isNaN(parseInt(k, 10)))
1593
- v = parseInt(k, 10);
1587
+ const k = _.split(/\s+/);
1588
+ let P = !1;
1589
+ const z = k.indexOf(V.VALUES.TRAVELER);
1590
+ if (z !== -1) {
1591
+ R = !0, P = !0;
1592
+ const D = k[z + 1];
1593
+ if (D && !isNaN(parseInt(D, 10)))
1594
+ f = parseInt(D, 10);
1594
1595
  else {
1595
- const R = D.find((ne) => !isNaN(parseInt(ne, 10)));
1596
- R && (v = parseInt(R, 10));
1596
+ const T = k.find((ee) => !isNaN(parseInt(ee, 10)));
1597
+ T && (f = parseInt(T, 10));
1597
1598
  }
1598
1599
  }
1599
- const Q = D.indexOf(N.VALUES.NATIVE);
1600
+ const Q = k.indexOf(V.VALUES.NATIVE);
1600
1601
  if (Q !== -1) {
1601
- const k = D[Q + 1];
1602
- if (k && !isNaN(parseInt(k, 10)))
1603
- b = parseInt(k, 10);
1604
- else if (!L) {
1605
- const R = D.find((ne) => !isNaN(parseInt(ne, 10)));
1606
- R && (b = parseInt(R, 10));
1602
+ const D = k[Q + 1];
1603
+ if (D && !isNaN(parseInt(D, 10)))
1604
+ y = parseInt(D, 10);
1605
+ else if (!R) {
1606
+ const T = k.find((ee) => !isNaN(parseInt(ee, 10)));
1607
+ T && (y = parseInt(T, 10));
1607
1608
  }
1608
1609
  }
1609
- if (q) {
1610
- const k = v + 1;
1611
- if (k < r)
1610
+ if (P) {
1611
+ const D = f + 1;
1612
+ if (D < r)
1612
1613
  throw new Error(
1613
- `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${r - 1}).`
1614
+ `[MirageEngine] Traveler layer (${f}) cannot be smaller than inherited capture layer (${r - 1}).`
1614
1615
  );
1615
- r = Math.min(k, N.MAX_LAYERS + 1);
1616
+ r = Math.min(D, V.MAX_LAYERS + 1);
1616
1617
  }
1617
1618
  }
1618
- const E = n.dataset[We.KEY];
1619
- let A;
1620
- E && (A = JSON.parse(E));
1621
- const C = n.getBoundingClientRect(), y = window.getComputedStyle(n);
1622
- if (C.width === 0 || C.height === 0 || y.display === "none")
1619
+ const E = a.dataset[Ge.KEY];
1620
+ let L;
1621
+ E && (L = JSON.parse(E));
1622
+ const C = a.getBoundingClientRect(), b = window.getComputedStyle(a);
1623
+ if (C.width === 0 || C.height === 0 || b.display === "none")
1623
1624
  return null;
1624
- let S = n.getAttribute("data-mid");
1625
- S || (S = Math.random().toString(36).substring(2, 11), n.setAttribute("data-mid", S));
1626
- const X = parseInt(y.zIndex), z = (isNaN(X) ? 0 : X) + s;
1627
- let U;
1628
- if (n.tagName === "IMG")
1629
- U = n.src;
1630
- else if (n.tagName.toLowerCase() === "svg") {
1631
- const v = n.cloneNode(!0), x = m == null ? void 0 : m.color, T = m == null ? void 0 : m.fill, _ = m == null ? void 0 : m.stroke, D = m == null ? void 0 : m.opacity, q = (R, ne) => {
1632
- const P = window.getComputedStyle(R), de = ne, Oe = P.fill === P.color, _e = P.stroke === P.color, me = T || (Oe ? x : void 0) || P.fill;
1633
- me && me !== "none" && (de.style.fill = me);
1634
- const ve = _ || (_e ? x : void 0) || P.stroke;
1635
- ve && ve !== "none" && (de.style.stroke = ve), P.strokeWidth && P.strokeWidth !== "0px" && (de.style.strokeWidth = P.strokeWidth);
1636
- const Se = x || P.color;
1637
- Se && (de.style.color = Se);
1638
- const we = D || P.opacity;
1639
- we && we !== "1" && (de.style.opacity = we);
1640
- for (let fe = 0; fe < R.children.length; fe++)
1641
- q(R.children[fe], ne.children[fe]);
1625
+ let x = a.getAttribute("data-mid");
1626
+ x || (x = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", x));
1627
+ const X = parseInt(b.zIndex), Y = (isNaN(X) ? 0 : X) + s;
1628
+ let A, N;
1629
+ if (a.tagName === "IMG")
1630
+ A = a.src;
1631
+ else if (a.tagName.toLowerCase() === "svg") {
1632
+ const f = v == null ? void 0 : v.color, S = v == null ? void 0 : v.fill, I = v == null ? void 0 : v.stroke, _ = v == null ? void 0 : v.opacity, k = (P) => {
1633
+ const z = a.cloneNode(!0), Q = (ve, Ce) => {
1634
+ const G = window.getComputedStyle(ve), ue = Ce, Ne = G.fill === G.color, ze = G.stroke === G.color, we = (P ? S || (Ne ? f : void 0) : void 0) || G.fill;
1635
+ we && we !== "none" && (ue.style.fill = we);
1636
+ const be = (P ? I || (ze ? f : void 0) : void 0) || G.stroke;
1637
+ be && be !== "none" && (ue.style.stroke = be), G.strokeWidth && G.strokeWidth !== "0px" && (ue.style.strokeWidth = G.strokeWidth);
1638
+ const Te = (P ? f : void 0) || G.color;
1639
+ Te && (ue.style.color = Te);
1640
+ const ye = (P ? _ : void 0) || G.opacity;
1641
+ ye && ye !== "1" && (ue.style.opacity = ye);
1642
+ for (let ge = 0; ge < ve.children.length; ge++)
1643
+ Q(ve.children[ge], Ce.children[ge]);
1644
+ };
1645
+ Q(a, z);
1646
+ const D = a.getBoundingClientRect(), T = window.devicePixelRatio * c;
1647
+ z.hasAttribute("viewBox") || z.setAttribute("viewBox", `0 0 ${D.width} ${D.height}`), z.setAttribute("width", (D.width * T).toString()), z.setAttribute("height", (D.height * T).toString());
1648
+ let ee = new XMLSerializer().serializeToString(z);
1649
+ return ee.includes("xmlns=") || (ee = ee.replace(
1650
+ "<svg",
1651
+ '<svg xmlns="http://www.w3.org/2000/svg"'
1652
+ )), `data:image/svg+xml;utf8,${encodeURIComponent(ee)}`;
1642
1653
  };
1643
- q(n, v);
1644
- const Y = n.getBoundingClientRect(), Q = window.devicePixelRatio * c;
1645
- v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${Y.width} ${Y.height}`), v.setAttribute("width", (Y.width * Q).toString()), v.setAttribute("height", (Y.height * Q).toString());
1646
- let k = new XMLSerializer().serializeToString(v);
1647
- k.includes("xmlns=") || (k = k.replace(
1648
- "<svg",
1649
- '<svg xmlns="http://www.w3.org/2000/svg"'
1650
- )), U = `data:image/svg+xml;utf8,${encodeURIComponent(k)}`;
1651
- } else if (y.backgroundImage && y.backgroundImage !== "none") {
1652
- const v = y.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1653
- v && (U = v[1]);
1654
- }
1655
- const I = {
1656
- backgroundColor: y.backgroundColor,
1657
- backgroundImage: y.backgroundImage,
1658
- opacity: n.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(y.opacity),
1659
- zIndex: z,
1660
- borderRadius: y.borderRadius,
1661
- borderColor: y.borderColor,
1662
- borderWidth: y.borderWidth,
1663
- boxShadow: y.boxShadow,
1664
- imageSrc: U,
1665
- isTraveler: L
1666
- }, j = I;
1667
- let J, Z;
1668
- const M = [], O = y.overflow === "hidden" ? [...l || [], n] : l;
1669
- return n.tagName.toLowerCase() !== "svg" && Array.from(n.childNodes).forEach((v) => {
1670
- const x = v.nodeType === Node.TEXT_NODE ? d : h, T = Fe(
1671
- v,
1654
+ A = k(!1), y !== void 0 && (f || S || I || _) && (N = k(!0));
1655
+ } else if (b.backgroundImage && b.backgroundImage !== "none") {
1656
+ const f = b.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1657
+ f && (A = f[1]);
1658
+ }
1659
+ const U = {
1660
+ backgroundColor: b.backgroundColor,
1661
+ backgroundImage: b.backgroundImage,
1662
+ opacity: a.dataset[te.KEY] === te.VALUES.HIDE ? 1 : parseFloat(b.opacity),
1663
+ zIndex: Y,
1664
+ borderRadius: b.borderRadius,
1665
+ borderColor: b.borderColor,
1666
+ borderWidth: b.borderWidth,
1667
+ boxShadow: b.boxShadow,
1668
+ imageSrc: A,
1669
+ isTraveler: R
1670
+ }, K = U;
1671
+ let J, M;
1672
+ const B = [], Z = b.overflow === "hidden" ? [...l || [], a] : l;
1673
+ return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((f) => {
1674
+ const S = f.nodeType === Node.TEXT_NODE ? d : h, I = Xe(
1675
+ f,
1672
1676
  e,
1673
- x,
1677
+ S,
1674
1678
  r,
1675
- z,
1679
+ Y,
1676
1680
  c,
1677
- v.nodeType === Node.TEXT_NODE ? b : void 0,
1678
- v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0,
1679
- O
1681
+ f.nodeType === Node.TEXT_NODE ? y : void 0,
1682
+ f.nodeType === Node.TEXT_NODE && Object.keys(v).length > 0 ? v : void 0,
1683
+ Z
1680
1684
  );
1681
- T && M.push(T);
1685
+ I && B.push(I);
1682
1686
  }), {
1683
- id: S,
1687
+ id: x,
1684
1688
  type: "BOX",
1685
- element: n,
1689
+ element: a,
1686
1690
  rect: {
1687
1691
  x: C.left + window.scrollX,
1688
1692
  y: C.top + window.scrollY,
1689
1693
  width: C.width,
1690
1694
  height: C.height
1691
1695
  },
1692
- styles: j,
1696
+ styles: K,
1693
1697
  textContent: J,
1694
- textStyles: Z,
1698
+ textStyles: M,
1695
1699
  dirtyMask: e,
1696
1700
  visibility: d,
1697
- isTraveler: L,
1701
+ isTraveler: R,
1698
1702
  captureLayer: r,
1699
- nativeLayer: b,
1700
- nativeStyles: b !== void 0 ? Ce(te({}, I), {
1701
- backgroundColor: (K = m.backgroundColor) != null ? K : I.backgroundColor,
1702
- backgroundImage: (B = m.backgroundImage) != null ? B : I.backgroundImage,
1703
- opacity: (V = m.opacity) != null ? V : I.opacity,
1704
- zIndex: m.zIndex !== void 0 ? m.zIndex + z : I.zIndex,
1705
- borderRadius: (ie = m.borderRadius) != null ? ie : I.borderRadius,
1706
- borderColor: (se = m.borderColor) != null ? se : I.borderColor,
1707
- borderWidth: (oe = m.borderWidth) != null ? oe : I.borderWidth,
1708
- boxShadow: (he = m.boxShadow) != null ? he : I.boxShadow,
1709
- isTraveler: I.isTraveler,
1710
- transform: m.transform
1703
+ nativeLayer: y,
1704
+ nativeStyles: y !== void 0 ? Me(re({}, U), {
1705
+ backgroundColor: (F = v.backgroundColor) != null ? F : U.backgroundColor,
1706
+ backgroundImage: (W = v.backgroundImage) != null ? W : U.backgroundImage,
1707
+ opacity: (se = v.opacity) != null ? se : U.opacity,
1708
+ zIndex: v.zIndex !== void 0 ? v.zIndex + Y : U.zIndex,
1709
+ borderRadius: (oe = v.borderRadius) != null ? oe : U.borderRadius,
1710
+ borderColor: (ae = v.borderColor) != null ? ae : U.borderColor,
1711
+ borderWidth: (he = v.borderWidth) != null ? he : U.borderWidth,
1712
+ boxShadow: (de = v.boxShadow) != null ? de : U.boxShadow,
1713
+ isTraveler: U.isTraveler,
1714
+ transform: v.transform,
1715
+ imageSrc: N != null ? N : A
1711
1716
  }) : void 0,
1712
- nativeRect: b !== void 0 ? {
1713
- x: m.x !== void 0 ? parseFloat(m.x) : C.left + window.scrollX,
1714
- y: m.y !== void 0 ? parseFloat(m.y) : C.top + window.scrollY,
1715
- width: m.width !== void 0 ? parseFloat(m.width) : C.width,
1716
- height: m.height !== void 0 ? parseFloat(m.height) : C.height
1717
+ nativeRect: y !== void 0 ? {
1718
+ x: v.x !== void 0 ? parseFloat(v.x) : C.left + window.scrollX,
1719
+ y: v.y !== void 0 ? parseFloat(v.y) : C.top + window.scrollY,
1720
+ width: v.width !== void 0 ? parseFloat(v.width) : C.width,
1721
+ height: v.height !== void 0 ? parseFloat(v.height) : C.height
1717
1722
  } : void 0,
1718
- isFixed: y.position === "fixed",
1723
+ isFixed: b.position === "fixed",
1719
1724
  clipElements: l,
1720
- children: M,
1721
- shaderHooks: A
1725
+ children: B,
1726
+ shaderHooks: L
1722
1727
  };
1723
1728
  }
1724
- function at(i, e) {
1729
+ function ht(i, e) {
1725
1730
  e.size !== 0 && e.forEach((t, r) => {
1726
- var c, o, a, l;
1731
+ var c, o, n, l;
1727
1732
  const s = i.get(r);
1728
- !s || !s.userData.basePosition || (W.forceUpdateUniforms(s.material, {
1733
+ !s || !s.userData.basePosition || (H.forceUpdateUniforms(s.material, {
1729
1734
  backgroundColor: t.backgroundColor,
1730
1735
  backgroundImage: t.backgroundImage,
1731
1736
  boxShadow: t.boxShadow,
1732
1737
  opacity: t.opacity,
1733
1738
  borderRadius: (o = t.borderRadius) != null ? o : (c = s.userData.baseStyles) == null ? void 0 : c.borderRadius
1734
1739
  // width and height are no longer updated here, they are updated in syncMeshesByDOM
1735
- }), s.userData.nativeMesh && W.forceUpdateUniforms(s.userData.nativeMesh.material, {
1740
+ }), s.userData.nativeMesh && H.forceUpdateUniforms(s.userData.nativeMesh.material, {
1736
1741
  backgroundColor: t.backgroundColor,
1737
1742
  backgroundImage: t.backgroundImage,
1738
1743
  boxShadow: t.boxShadow,
1739
1744
  opacity: t.opacity,
1740
- borderRadius: (l = t.borderRadius) != null ? l : (a = s.userData.baseStyles) == null ? void 0 : a.borderRadius
1745
+ borderRadius: (l = t.borderRadius) != null ? l : (n = s.userData.baseStyles) == null ? void 0 : n.borderRadius
1741
1746
  }));
1742
1747
  });
1743
1748
  }
1744
- class lt {
1749
+ class dt {
1745
1750
  constructor(e, t, r, s) {
1746
- g(this, "target");
1747
- g(this, "renderer");
1748
- g(this, "registry");
1749
- g(this, "isTravelEnabled", !1);
1750
- g(this, "tracker");
1751
- this.target = e, this.renderer = t, this.registry = r, this.tracker = new qe(e, {
1751
+ p(this, "target");
1752
+ p(this, "renderer");
1753
+ p(this, "registry");
1754
+ p(this, "isTravelEnabled", !1);
1755
+ p(this, "tracker");
1756
+ this.target = e, this.renderer = t, this.registry = r, this.tracker = new Ke(e, {
1752
1757
  resizeDebounce: s.resizeDebounce
1753
1758
  }), this.tracker.onLayoutChange.add((c, o) => {
1754
- document.querySelector(`[${N.NAME}~='${N.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1755
- const l = Fe(
1759
+ document.querySelector(`[${V.NAME}~='${V.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1760
+ const l = Xe(
1756
1761
  this.target,
1757
1762
  c,
1758
- G,
1763
+ $,
1759
1764
  1,
1760
1765
  0,
1761
1766
  this.renderer.qualityFactor
1762
1767
  );
1763
1768
  l && this.renderer.syncScene(l, o);
1764
1769
  }), this.tracker.onStyleChange.add((c) => {
1765
- at(this.registry, c);
1770
+ ht(this.registry, c);
1766
1771
  }), this.tracker.onRender.add(() => {
1767
1772
  this.renderer.syncMeshesByDOM(), this.renderer.render();
1768
1773
  });
@@ -1774,9 +1779,9 @@ class lt {
1774
1779
  this.tracker.stop();
1775
1780
  }
1776
1781
  }
1777
- class ct {
1782
+ class ut {
1778
1783
  constructor() {
1779
- g(this, "store");
1784
+ p(this, "store");
1780
1785
  this.store = /* @__PURE__ */ new WeakMap();
1781
1786
  }
1782
1787
  register(e, t) {
@@ -1799,30 +1804,30 @@ class ct {
1799
1804
  this.store.delete(e);
1800
1805
  }
1801
1806
  }
1802
- class ft {
1807
+ class mt {
1803
1808
  constructor(e, t) {
1804
- g(this, "renderer");
1805
- g(this, "syncer");
1806
- g(this, "target");
1807
- g(this, "registry");
1809
+ p(this, "renderer");
1810
+ p(this, "syncer");
1811
+ p(this, "target");
1812
+ p(this, "registry");
1808
1813
  var s, c, o;
1809
- if (this.target = e, this.registry = new ct(), !document.getElementById("mirage-engine-styles")) {
1810
- const a = document.createElement("style");
1811
- a.id = "mirage-engine-styles", a.textContent = `
1812
- [${ee.NAME}="${ee.VALUES.HIDE}"] {
1814
+ if (this.target = e, this.registry = new ut(), !document.getElementById("mirage-engine-styles")) {
1815
+ const n = document.createElement("style");
1816
+ n.id = "mirage-engine-styles", n.textContent = `
1817
+ [${te.NAME}="${te.VALUES.HIDE}"] {
1813
1818
  opacity: 0 !important;
1814
1819
  }
1815
- `, document.head.appendChild(a);
1820
+ `, document.head.appendChild(n);
1816
1821
  }
1817
1822
  let r;
1818
1823
  if (t.mode === "duplicate" ? r = (c = (s = t.container) != null ? s : this.target.parentElement) != null ? c : void 0 : r = (o = this.target.parentElement) != null ? o : void 0, !r)
1819
1824
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1820
- this.renderer = new ot(
1825
+ this.renderer = new lt(
1821
1826
  this.target,
1822
1827
  t,
1823
1828
  r,
1824
1829
  this.registry
1825
- ), this.renderer.mount(), this.syncer = new lt(this.target, this.renderer, this.registry, t);
1830
+ ), this.renderer.mount(), this.syncer = new dt(this.target, this.renderer, this.registry, t);
1826
1831
  }
1827
1832
  start() {
1828
1833
  this.syncer.start();
@@ -1866,25 +1871,25 @@ class ft {
1866
1871
  }
1867
1872
  }
1868
1873
  export {
1869
- Me as ALLOWED_FILTERS,
1870
- ee as ATTR_DOM,
1871
- H as ATTR_FILTER,
1872
- dt as ATTR_SANDWICH,
1873
- $ as ATTR_SELECT,
1874
- We as ATTR_SHADER,
1875
- N as ATTR_TRAVEL,
1876
- ye as DIRTY_CONTENT,
1877
- ge as DIRTY_NONE,
1878
- re as DIRTY_RECT,
1879
- pe as DIRTY_STRUCTURE,
1880
- ue as DIRTY_STYLE,
1881
- Pe as DIRTY_ZINDEX,
1882
- ut as EXCLUDED,
1883
- ft as Engine,
1884
- ae as SELECT_LAYER,
1885
- F as THREE_LAYERS,
1886
- Re as TRAVEL_VALUES,
1887
- qe as Tracker,
1888
- G as USER_LAYER,
1889
- Ge as extractFromStyle
1874
+ Ae as ALLOWED_FILTERS,
1875
+ te as ATTR_DOM,
1876
+ q as ATTR_FILTER,
1877
+ gt as ATTR_SANDWICH,
1878
+ j as ATTR_SELECT,
1879
+ Ge as ATTR_SHADER,
1880
+ V as ATTR_TRAVEL,
1881
+ Se as DIRTY_CONTENT,
1882
+ pe as DIRTY_NONE,
1883
+ ie as DIRTY_RECT,
1884
+ me as DIRTY_STRUCTURE,
1885
+ fe as DIRTY_STYLE,
1886
+ qe as DIRTY_ZINDEX,
1887
+ pt as EXCLUDED,
1888
+ mt as Engine,
1889
+ ne as SELECT_LAYER,
1890
+ O as THREE_LAYERS,
1891
+ De as TRAVEL_VALUES,
1892
+ Ke as Tracker,
1893
+ $ as USER_LAYER,
1894
+ je as extractFromStyle
1890
1895
  };